| 1 |
\documentclass{scrartcl} |
| 2 |
\usepackage[clear-aux]{xsim} |
| 3 |
|
| 4 |
\usepackage{enumitem,amssymb,fmtcount} |
| 5 |
\newlist{choices}{itemize}{1} |
| 6 |
\setlist[choices]{label=$\Box$} |
| 7 |
\newcommand*\choice{\item} |
| 8 |
|
| 9 |
\DeclareExerciseProperty{choices} |
| 10 |
\DeclareExerciseProperty*{multiple} |
| 11 |
\DeclareExerciseEnvironmentTemplate{mc} |
| 12 |
{% |
| 13 |
\UseExerciseTemplate{begin}{default}% |
| 14 |
\IfExerciseBooleanPropertyTF{multiple} |
| 15 |
{Select one or more correct answers} |
| 16 |
{% |
| 17 |
\GetExercisePropertyT{choices} |
| 18 |
{Select \numberstringnum{#1} correct answer\ifnum#1>1 s\fi.}% |
| 19 |
}% |
| 20 |
\begin{choices} |
| 21 |
} |
| 22 |
{% |
| 23 |
\end{choices} |
| 24 |
\UseExerciseTemplate{end}{default}% |
| 25 |
} |
| 26 |
|
| 27 |
\DeclareExerciseType{mc}{ |
| 28 |
exercise-env = multiplechoice , |
| 29 |
solution-env = correctchoices , |
| 30 |
exercise-name = Question , |
| 31 |
solution-name = Solution , |
| 32 |
exercise-template = mc , |
| 33 |
solution-template = mc , |
| 34 |
counter = exercise |
| 35 |
} |
| 36 |
|
| 37 |
\xsimsetup{ |
| 38 |
exercise/name = Question , |
| 39 |
solution/name = Solution |
| 40 |
} |
| 41 |
|
| 42 |
\begin{document} |
| 43 |
|
| 44 |
\section{Questions} |
| 45 |
\begin{multiplechoice}[choices=1] |
| 46 |
\choice one |
| 47 |
\choice two |
| 48 |
\choice three |
| 49 |
\choice four |
| 50 |
\end{multiplechoice} |
| 51 |
|
| 52 |
\begin{exercise} |
| 53 |
Answer this question on a separate sheet. |
| 54 |
\end{exercise} |
| 55 |
|
| 56 |
\begin{multiplechoice}[multiple] |
| 57 |
\choice one |
| 58 |
\choice two |
| 59 |
\choice three |
| 60 |
\choice four |
| 61 |
\end{multiplechoice} |
| 62 |
|
| 63 |
\begin{multiplechoice}[choices=2] |
| 64 |
\choice one |
| 65 |
\choice two |
| 66 |
\choice three |
| 67 |
\choice four |
| 68 |
\end{multiplechoice} |
| 69 |
|
| 70 |
\end{document} |