1

Why is the (C) popping up instead of (D). (D) should be the right solution. Code copy/pasted from xsim manual.

\NewTasksEnvironment[label=(\Alph*),label-width=15pt]{choices}[\choice]
\newcommand*\correct{\thetask\expanded{\SetExerciseProperty{choice}{\thetask}}}

\begin{exercise}
The system of units that is based on the powers of 10 is called 
    \begin{choices}(1)
        \choice US System of Units
        \choice EU System of Units
        \choice Imperial System
        \choice[\correct] The Metric System
    \end{choices}
\end{exercise}
\begin{solution}
    \GetExerciseProperty{choice}
\end{solution}

enter image description here

2
  • Can you post your code to include all preamble and the \begin{document} and \end{document} tags? Jan 20, 2022 at 15:23
  • In any case, I can confirm that the example file xsim-issue-49.tex included in the xsim package also produce the incorrect output. I'll file a bug pointing it to this question. Jan 20, 2022 at 15:31

1 Answer 1

1

Try changing the definition of the \correct macro to

\newcommand*\correct{\refstepcounter{task}\thetask\expanded{\SetExerciseProperty{choice}{\thetask}}}

(Possibly the tasks package changed its behavior; it would make sense that when a user uses a custom label the counter for the original label should not be incremented.)


On the other hand, I am not sure why it is necessary to put the "\correct" inside brackets. To me it makes more sense to do

\NewTasksEnvironment[label=(\Alph*),label-width=15pt]{choices}[\choice]
\newcommand*\correct{\expanded{\SetExerciseProperty{choice}{\thetask}}}

\begin{exercise}
The system of units that is based on the powers of 10 is called 
    \begin{choices}(1)
        \choice US System of Units
        \choice EU System of Units
        \choice Imperial System
        \choice\correct The Metric System
    \end{choices}
\end{exercise}
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .