diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/xsim/examples/xsim.multiplechoice.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/examples/xsim.multiplechoice.tex | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.multiplechoice.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.multiplechoice.tex new file mode 100644 index 00000000000..e0db3eb0c52 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.multiplechoice.tex @@ -0,0 +1,70 @@ +\documentclass{scrartcl} +\usepackage[clear-aux]{xsim} + +\usepackage{enumitem,amssymb,fmtcount} +\newlist{choices}{itemize}{1} +\setlist[choices]{label=$\Box$} +\newcommand*\choice{\item} + +\DeclareExerciseProperty{choices} +\DeclareExerciseProperty*{multiple} +\DeclareExerciseEnvironmentTemplate{mc} + {% + \UseExerciseTemplate{begin}{default}% + \IfExerciseBooleanPropertyTF{multiple} + {Select one or more correct answers} + {% + \GetExercisePropertyT{choices} + {Select \numberstringnum{#1} correct answer\ifnum#1>1 s\fi.}% + }% + \begin{choices} + } + {% + \end{choices} + \UseExerciseTemplate{end}{default}% + } + +\DeclareExerciseType{mc}{ + exercise-env = multiplechoice , + solution-env = correctchoices , + exercise-name = Question , + solution-name = Solution , + exercise-template = mc , + solution-template = mc , + counter = exercise +} + +\xsimsetup{ + exercise/name = Question , + solution/name = Solution +} + +\begin{document} + +\section{Questions} +\begin{multiplechoice}[choices=1] + \choice one + \choice two + \choice three + \choice four +\end{multiplechoice} + +\begin{exercise} + Answer this question on a separate sheet. +\end{exercise} + +\begin{multiplechoice}[multiple] + \choice one + \choice two + \choice three + \choice four +\end{multiplechoice} + +\begin{multiplechoice}[choices=2] + \choice one + \choice two + \choice three + \choice four +\end{multiplechoice} + +\end{document} |