SmtC: Show me the Code
Ole Peter Smith
Instituto de Matemática e Estatística
Universidade Federal de Goiás
http://www.olesmith.com.br

$\LaTeX$ IV
Deus não se preocupe das nossas dificuldades matemáticas.
Ele integra empiricamente.
Einstein.
< Newcommand | Newenvironment | Poster >

New environements

LaTeX Listing: First.tex. PDF   ZIP*  
\documentclass{article}
\usepackage{changepage}
\usepackage{blindtext}

%% \newenvironment{envname}{start}{end}

%Indent 20 pts and decrease font 
\newenvironment{Example}
{
   \vspace{10pt}
   \begin{adjustwidth}{20pt}{0pt}
      \begin{small}
}
{ 
       \end{small}
   \end{adjustwidth} 
   \vspace{10pt}
}

\begin{document}


\blindtext
\begin{Example}
   \blindtext
\end{Example}
\blindtext


\end{document}
LaTeX Listing: Second.tex. PDF   ZIP*  
\documentclass{article}

%Generate text
\usepackage{blindtext}


\usepackage{changepage}
%\qed

\usepackage{amsmath}
\usepackage{amssymb}

%Show the labels
\usepackage[right]{showlabels}


%Numbering of examples.
\newcounter{ExampleNo}[section]

%Add example numbering (by section)
%Indent and decrease font.
%Add square to end of example.

%Argumentos: title and ref
\newenvironment{Example}[2]
{
%start with empty line to force line break
%empty line much better that \\ or \newline

   \vspace{10pt}
   \stepcounter{ExampleNo}
   \underline{\textbf{Example \thesection.\theExampleNo:}}
   \label{Example:#2} 
   \textit{#1}.
   
   \vspace{5pt}
   \begin{adjustwidth}{20pt}{0pt}
      \begin{small}
}
{ 
       \end{small}
       
       \hfill$\blacksquare$
   \end{adjustwidth}
   
   
   \vspace{10pt}
}

\begin{document}

\section{Introduction}

\blindtext
\begin{Example}{A Pythagorean Triangle}{pythagoras1}
   \blindtext
\end{Example}
\blindtext

\section{Geometria Esférica}

\blindtext
\begin{Example}{Another Pythagorean Triangle}{pythagoras2}
   See Example \ref{Example:pythagoras1} page \pageref{Example:pythagoras1}.
   
   
   \blindtext
\end{Example}
\blindtext

\end{document}
< Newcommand | Newenvironment | Poster >
Messages:
0 secs.