# Change enumeration style in exercises using xsim

Forgive me if this has already been asked, but I couldn't find this question, exactly. I'm using the xsim package (documentclass book) and I'd like my "top"-level enumeration to be labeled with letters in my exercises, but with Arabic numerals outside of those. So, for instance, if I type

\begin{enumerate}
\item Hello
\end{enumerate}


outside of the exercises, I want it to read

1. Hello

but if I type it within an exercise environment I want it to read

a. Hello

Obviously I could hack this by changing my enumeration labeling style each time I enumerate within an exercise, but there has to be a better way. Right? Keep in mind I'm using the default exercise environment supplied by xsim.

• please post MWE of the same Jun 16, 2017 at 5:39

You can either add the re-definition with the pre-hook or begin-hook options to the exercise environments

\documentclass{article}
\usepackage{xsim}

\xsimsetup{
exercise/begin-hook = \renewcommand\theenumi{\alph{enumi}} ,
solution/begin-hook = \renewcommand\theenumi{\alph{enumi}}
}

\begin{document}

\begin{exercise}
\begin{enumerate}
\item bla bla
\end{enumerate}
\end{exercise}

Outside:
\begin{enumerate}
\item bla bla
\end{enumerate}

\end{document}


or just add the redefinition inside the code of a custom environment template:

\documentclass{article}
\usepackage{xsim}

\DeclareExerciseEnvironmentTemplate{custom}
{%
\UseExerciseTemplate{begin}{default}%
\renewcommand\theenumi{\alph{enumi}}%
}
{\UseExerciseTemplate{end}{default}}

\xsimsetup{
exercise/template=custom ,
solution/template=custom
}

\begin{document}

\begin{exercise}
\begin{enumerate}
\item bla bla
\end{enumerate}
\end{exercise}

Outside:
\begin{enumerate}
\item bla bla
\end{enumerate}

\end{document}


• That was exactly what I was looking for, thank you! Jun 17, 2017 at 7:08