I'm not sure if this has already been asked, but I have been curious if amsthm also contains support for "examples".

For example, I would like to have something like


that gets auto numbered in the same way as theorems, lemmas, remarks, etc.

Is there any LaTeX package that supports this?

  • 4
    \newtheorem{example}{Example}, out of the box with LaTeX or with amsthm then. It will define a counter example, is numbered and can be referred to – user31729 Jan 1 '17 at 9:52
  • 1
    If you prefer some eye-candy, look for mdframed and tcolorbox, both provide theorem environments with colour etc. There are certainly more packages that define theorem - like environments. – user31729 Jan 1 '17 at 10:03

Three short example definitions from amsthm, tcolorbox and mdframed. See the different options and the similarities.




\newtheorem{amsexample}{Example from amsthm package}[section] % Defines a counter named amsexample which resets with section

\newtcbtheorem[auto counter,number within=section]{tcbexample}{Example from tcolorbox}{%

\newmdtheoremenv[backgroundcolor=cyan]{mdfexample}{Example from mdframed package}[section]


\section{A section}

  Some example.

\begin{tcbexample}{This is my example title}{first}
  Some example.

\begin{mdfexample}[MDF example title]
  Some example.

See \ref{exa:first} for more eye-candy. 


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.