[Tex/LaTex] Example environment

environmentsexamples

I was wondering if there is any formal environment for specifying 'examples' through out the text. If not, which environments do you recommend?

Best Answer

You could use the amsthm package. As per their recommendations, which is what most people use, you should define the environment as

\theoremstyle{definition}
\newtheorem{exmp}{Example}[section]

and than use is as

\begin{exmp}
This is the example.
\end{exmp}

Note however, that the above definition will give the examples its own counter. If you already have theorems and definitions using the thm-counter, you might want to consider using

\newtheorem[thm]{exmp}

since it can be very confusing for the reader if you have Theorem 3, Lemma 3, Definition 3 and Example 3 on different pages.

Related Question