1

I try to manage the numbering of exercices and sub-exercices with xsim. It works well for the questions, but i can't have the same numbering in the solutions...

Here is a simple code :

\documentclass{article} \usepackage{xsim} \usepackage[most]{tcolorbox} \DeclareExerciseEnvironmentTemplate{simple}{\par\medskip\noindent\textbf{\GetExerciseProperty{counter}}.~}{} \DeclareExerciseEnvironmentTemplate{simplerep}{\par\smallskip\noindent\begin{tcolorbox}[breakable,enhanced]}{\end{tcolorbox}} % Modified template for subquestion to use a) format instead of (a) \DeclareExerciseEnvironmentTemplate{subquestion}{\par\medskip\noindent\hspace{1em}\GetExerciseProperty{counter}~}{} \DeclareExerciseType{question}{ exercise-env=question, solution-env=reponse, exercise-name=Q, solution-name=Rép., exercise-template=simple, solution-template=simplerep, } \DeclareExerciseType{subquestion}{ exercise-env=subquestion, solution-env=subreponse, exercise-name=, solution-name=, exercise-template=subquestion, solution-template=simplerep, within=question, } % Use this to format the subquestion counter as a), b), c), etc. \renewcommand*{\thesubquestion}{(\alph{subquestion})} \DeclareExerciseCollection{sujet} \xsimsetup{solution/print=true, print-collection/print=both} \begin{document} \activatecollection{sujet} \begin{question} Question 1. \end{question} \begin{subquestion} Sous-question 1a \end{subquestion} \begin{subreponse} Sous reponse 1.a \end{subreponse} \begin{subquestion} Sous question 1b \end{subquestion} \begin{subreponse} Sous reponse 1b \end{subreponse} %\begin{reponse} %Reponse 1. %\end{reponse} \begin{question} Question 2. \end{question} \begin{subquestion} Sous-question 2a \end{subquestion} \begin{subreponse} Sous reponse 2.a \end{subreponse} \begin{subquestion} Sous question 2b \end{subquestion} \begin{subreponse} Sous reponse 2b \end{subreponse} %\begin{reponse} %Réponse question 2. %\end{reponse} \deactivatecollection{sujet} \newpage \xsimsetup{solution/print=true} \printcollection{sujet} \end{document} 

Questions are well-numbered (1 1a 1b 2 2a 2b) but responses are not (1 2a b a b)

I think that i didn't put the good options but i don't know what to change.

Thanks for the help !

1
  • Welcome to TeX.SE! Commented Mar 30 at 16:27

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.