# I want to detect an order placed at the beginning of each theorem

I want to detect an order placed at the beginning of each theorem.

\documentclass{article}
\usepackage{ifthen,ntheorem}
\newtheorem{ex}{Exam}
\begin{document}
\begin{ex}
\LaTeX{} There is the LaTeX command at the beginning of the theorem.\\
Returns the result as True
\end{ex}
\begin{ex}
There is no LaTeX command at the beginning of the theorem environment
\LaTeX{} \\
Returns the result as False
\end{ex}
\end{document}


Thank!

• Welcome to TeX.SE! What do you mean with "detect an order"? Number the theorems? – CarLaTeX May 27 at 5:04
• please state what output you want from the supplied document. – David Carlisle May 27 at 7:48
• I intend to write an image insert command. If in the theorem (Exam) environment meets this command at the first position, the command will be assigned option 1. But if in the theorem (Exam) environment this command does not appear or is not in the first position then the command This will be assigned option 2. Same as immediately after \begin{ex}\@ifnextchar\LaTeX{option 1}{option 2} – Anh Tuấn Trần May 27 at 8:12