4

For example, in the MWE below, how can I label the items with the theorem counter?

\documentclass{article}

\usepackage{amsthm,thmtools,lipsum}

\declaretheorem[name=Theorem, numberwithin=section]{theorem}

\begin{document}

\section{First section}

\begin{theorem}
    This is a theorem.
\end{theorem}
\lipsum[1]
\begin{enumerate}
    \item The label of this item should be 1.2.
    \item The label of this item should be 1.3. 
\end{enumerate}

\end{document}
1
  • 2
    Always? Or just for a specific enumerate? – Werner Jun 10 '15 at 18:15
4

You have to set the counter enumi to the value of theorem at the start and set theorem to the value of enumi at the end.

\documentclass{article}

\usepackage{amsthm,thmtools,enumitem,lipsum}

\declaretheorem[name=Theorem, numberwithin=section]{theorem}
\newenvironment{thmenumerate}
 {\enumerate[
    label=\thesection.\arabic*,
    before=\setcounter{enumi}{\value{theorem}},
    after=\setcounter{theorem}{\value{enumi}},
  ]}
 {\endenumerate}

\begin{document}

\section{First section}

\begin{theorem}
    This is a theorem.
\end{theorem}
\lipsum[1]
\begin{thmenumerate}
    \item The label of this item should be 1.2.
    \item The label of this item should be 1.3. 
\end{thmenumerate}

\begin{theorem}
    This is a theorem.
\end{theorem}
\lipsum[1]
\begin{thmenumerate}
    \item The label of this item should be 1.5.
    \item The label of this item should be 1.6. 
\end{thmenumerate}

\end{document}

enter image description here

You may want to change the formatting of the label so as to be consistent with that of theorems.

\documentclass{article}

\usepackage{amsthm,thmtools,enumitem,lipsum}

\declaretheorem[name=Theorem, numberwithin=section]{theorem}
\newenvironment{thmenumerate}
 {\enumerate[
    leftmargin=*,
    label=\bfseries\thesection.\arabic*.,
    ref=\thesection.\arabic*,
    before=\setcounter{enumi}{\value{theorem}},
    after=\setcounter{theorem}{\value{enumi}},
  ]}
 {\endenumerate}

\begin{document}

\section{First section}

\begin{theorem}
    This is a theorem.
\end{theorem}
\lipsum[1]
\begin{thmenumerate}
    \item The label of this item should be 1.2.
    \item The label of this item should be 1.3. 
\end{thmenumerate}

\begin{theorem}
    This is a theorem.
\end{theorem}
\lipsum[1]
\begin{thmenumerate}
    \item The label of this item should be 1.5.
    \item The label of this item should be 1.6. 
\end{thmenumerate}

\end{document}

enter image description here

2
  • might it not be possible to define an environment that overrides or outmaneuvers the definition of \usecounter to not reset the counter to 0 at \begin? (would probably have to use a new counter, say \enumj.) or is that just too much trouble? – barbara beeton Jun 10 '15 at 18:28
  • @barbarabeeton: Well, one could say, e.g., \enumerate[label=\thetheorem, before=\def\@listctr{theorem}] (which also works); but egreg’s solution is so straightforward… – GuM Jun 10 '15 at 19:08
3

Well, after all, I think I could give this code a chance:

\documentclass{article}

\usepackage{amsthm,thmtools,enumitem,lipsum}

\declaretheorem[name=Theorem, numberwithin=section]{theorem}
\makeatletter
\newenvironment{thmenumerate}
 {\enumerate[
    label=\thetheorem,
    before=\def\@listctr{theorem}
  ]}
 {\endenumerate}
\makeatother

\begin{document}

\section{First section}

\begin{theorem}
    This is a theorem.
\end{theorem}
\lipsum[1]
\begin{thmenumerate}
    \item The label of this item should be 1.2.
    \item The label of this item should be 1.3. 
\end{thmenumerate}

\begin{theorem}
    This is a theorem.
\end{theorem}
\lipsum[1]
\begin{thmenumerate}
    \item The label of this item should be 1.5.
    \item The label of this item should be 1.6. 
\end{thmenumerate}

\end{document}

Output:

Output of the above code

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.