diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/xsim/doc/examples/xsim.multiplechoice.tex |
Initial commit
Diffstat (limited to 'macros/latex/contrib/xsim/doc/examples/xsim.multiplechoice.tex')
-rw-r--r-- | macros/latex/contrib/xsim/doc/examples/xsim.multiplechoice.tex | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/macros/latex/contrib/xsim/doc/examples/xsim.multiplechoice.tex b/macros/latex/contrib/xsim/doc/examples/xsim.multiplechoice.tex new file mode 100644 index 0000000000..e0db3eb0c5 --- /dev/null +++ b/macros/latex/contrib/xsim/doc/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} |