0

Sometimes I want labels of numbered lists like:

Exercise 2.2
  (a)
  (b)  

For others, I want to display like:

Theorem 2.3
  (i)
  (ii)

For this end, I add \begingroup and \endgroup and \renewcommand for the group. So the code is like:

\begin{example}
\qquad
\end{example}
\begin{enumerate}
\item ...
\item ...
\end{enumerate}

\begingroup\renewcommand{\labelenumi}{(\roman{enumi})}
\begin{theorem}
\qquad
\end{theorem}
\begin{enumerate}
\item ...
\item ...
\end{enumerate}
\endgroup

This is working, but list index counter can not be reset to (i). The result is actually like:

Exercise 2.2
(a) ...
(b) ...

Theorem 2.3
(iii) ...
(iv) ...

So I want to know how to reset list index counter in each group.

  • 1
    \setcounter{enumi}{0} at the start of the group? Or use the enumitem package, which allows you to do this kind of thing more easily. – Marijn Sep 26 '19 at 22:09
  • \setcounter{enumi}{0} is working, but the problem is that the rest list index follows that. Is there a way to save the counter number just before Theorem group and restore after the group is over? – Math Wizard Sep 26 '19 at 22:30
  • 1
    I'm not sure why the enumerate environments are outside example and theorem. – egreg Sep 26 '19 at 22:34
  • It is created in SW file and SW may handle latex differently. It should be compatible with latex – Math Wizard Sep 26 '19 at 22:38
  • \newcounter{tmpenumi} at the start of your file, then \setcounter{tmpenumi}{\value{enumi}} and vice versa. But it would be better to put the enumerate environments inside of the other environments as commented. Also Scientific Workplace is technically off-topic on the site. – Marijn Sep 26 '19 at 22:42

Your Answer

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

Browse other questions tagged or ask your own question.