3

I used the newtheorem command to create exercises in a book in the following way.

\newtheorem{xca}[theorem]{Problems}

So in the body I use the following command to create a set of exercises,

\begin{xca}\label{ex1.3}{Problems}

The default numbering in this environment is roman. I would like to change it to arabic without having to go through each of the exercises in the book and modifying the enumeration command.

Here is a MWE. By creating a MWE, I noted why I was getting roman as oppose to arabic. My question now is whether I can still add something to the definition of xca so that enumeration is in Arabic and not in Roman.

\documentclass{cambridge7A}

\newtheorem{theorem}{Theorem}[chapter]


\newtheorem{xca}[theorem]{Problems}

% remove the dot and change default for enumerated lists
\def\makeRRlabeldot#1{\hss\llap{#1}}
\renewcommand\theenumi{{\rm (\roman{enumi})}}
\renewcommand\theenumii{{\rm (\alph{enumii})}}
\renewcommand\theenumiii{{\rm (\arabic{enumiii})}}
\renewcommand\theenumiv{{\rm (\Alph{enumiv})}}


\begin{document}
\begin{xca}\label{ex1.3}{Problems}
\begin{enumerate}
\item Show that it follows from the definition of a field that zero, unit, additive, and multiplicative inverse scalars are all unique.
\end{enumerate}
\end{xca}
\end{document}
  • Could you provide us with a minimal working example (MWE)? There are multiple packages that provide support for creating theorems. – Werner Apr 15 '14 at 23:45
  • Thanks. By creating a MWE I noted the reason for Roman enumeration as oppose to Arabic. – lmedina Apr 16 '14 at 0:20
  • Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – jub0bs Apr 16 '14 at 0:27
  • @lmedina No problem. Sorry about the mistake I introduced in the title. Sorry Gonzalo; the fault is mine. – jub0bs Apr 16 '14 at 0:36
2

To change the representation for the first level of an enumerate environment, you can redefine \theenumi; the default definition on your example is

\renewcommand\theenumi{{\rm (\roman{enumi})} 

so the label numbering will use lower-case Roman numerals; to get Arabic numbering you need to change it to

\renewcommand\theenumi{{\rmfamily(\arabic{enumi})}}

Since you want the change only to have effect inside the xca environment, one option would be to use \AtBeginEnvironment (from the etoolbox package) to make the change only inside the environment:

\usepackage{etoolbox}
\AtBeginEnvironment{xca}{\renewcommand\theenumi{{\rmfamily(\arabic{enumi})}}}

A complete example:

\documentclass{cambridge7A}
\usepackage{etoolbox}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{xca}[theorem]{Problems}

% remove the dot and change default for enumerated lists
\def\makeRRlabeldot#1{\hss\llap{#1}}
\renewcommand\theenumi{{\rmfamily(\roman{enumi})}}
\renewcommand\theenumii{{\rmfamily(\alph{enumii})}}
\renewcommand\theenumiii{{\rmfamily(\arabic{enumiii})}}
\renewcommand\theenumiv{{\rmfamily(\Alph{enumiv})}}

\AtBeginEnvironment{xca}{\renewcommand\theenumi{{\rmfamily(\arabic{enumi})}}}

\begin{document}

\begin{xca}
\label{ex1.3}
Problems
\begin{enumerate}
\item Show that it follows from the definition of a field that zero, unit, additive, and multiplicative inverse scalars are all unique.
\end{enumerate}
\end{xca}

\begin{enumerate}
\item An item of an enumerated list outside the \texttt{xca} environment.
\end{enumerate}

\end{document}

enter image description here

  • Thanks for your suggestion. However, this will change everything else in the book as well to Arabic where Roman was used. I just want to make changes in the exercises section without making changes elsewhere. – lmedina Apr 16 '14 at 0:37
  • @lmedina then move the line inside the xca environment. – Gonzalo Medina Apr 16 '14 at 0:38
  • I really do not where to put it. I tried '\newtheorem{xca}[theorem]{Problems \renewcommand\theenumi{{\rm (\arabic{enumi})}}}' – lmedina Apr 16 '14 at 0:40
  • @lmedina please see my updated answer. Will you always use the xca environment for problems? Should the modification be always used inside all xca environments? – Gonzalo Medina Apr 16 '14 at 0:42
  • Yes, I will always use xca for problems and inside the xca environment. So I would like to change the way I defined xca so that the numbering can change automatically wherever I used xca but elsewhere should not be affected. – lmedina Apr 16 '14 at 0:45

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.