0

Is there any other way to write examples with numbering in mathematics? I am using asmart class.

\textbf{Example 1 }
  • 1
    Use a theorem construction. Something like \theoremstyle{definition} (just a name of the style) and then \newtheorem{example}{Example} , then the example env will number it self. – daleif Feb 21 '18 at 13:08
3

Not sure if this style is what you want to achive, but here is a MWE showing how to use \newtheorem to get a numbered example environment that you can refer to with the usual label / ref approach:

\documentclass{amsart}
\theoremstyle{definition}
\newtheorem{thm}{Theorem}[section]
\newtheorem{example}[thm]{Example}

\begin{document}

\begin{example}
some example
\label{test example}
\end{example}
Reference the above example: \ref{test example}
\end{document}

enter image description here

As stated by barbara beeton in the comments, the above example will number examples and theorems using the same counter. If you want to number the examples separately, use \newtheorem{example}{Example}[section] instead.

  • 1
    this will number the examples with the same series of numbers as any theorems. if examples should be numbered separately, then specify \newtheorem{example}{Example}[section] instead. – barbara beeton Feb 21 '18 at 14:36
  • @barbarabeeton: Thanks for pointing this out. I have edited my answer to include this information. – leandriis Feb 21 '18 at 21:40
1

If you want an automatic numbering, a correct vertical spacing w.r.t. the context, use something like this:

\newtheorem{example}{Example}
......
\begin{document}
......
\begin{example}
......
\end{example}
......
\end{document}

The layout details can be customised with dedicated packages like amsthm or ntheorem, using one of their predefined styles. A package like thmtools, which cooperates with both, provides further possibilities of customisation.

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.