summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/xsim/examples
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-11-10 22:07:28 +0000
committerKarl Berry <karl@freefriends.org>2019-11-10 22:07:28 +0000
commite3210b55f95f0078fe35f60e19af205873f7e8b0 (patch)
tree7b098d15283b91276ec84ed29267ee1655c96497 /Master/texmf-dist/doc/latex/xsim/examples
parent36dbb51507ef6c990eab86aa90f6dc4a0a0ebfd2 (diff)
xsim (10nov19)
git-svn-id: svn://tug.org/texlive/trunk@52725 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/xsim/examples')
-rw-r--r--Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-498299.pdfbin0 -> 42513 bytes
-rw-r--r--Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-498299.tex75
2 files changed, 75 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-498299.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-498299.pdf
new file mode 100644
index 00000000000..99e8314406f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-498299.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-498299.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-498299.tex
new file mode 100644
index 00000000000..6716d52e7e7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-498299.tex
@@ -0,0 +1,75 @@
+\documentclass{article}
+\usepackage[no-files]{xsim}
+\usepackage{tasks}
+
+\DeclareExerciseEnvironmentTemplate{item}
+ {\item[\GetExerciseProperty{counter}]}
+ {}
+
+\DeclareExerciseProperty{answer}
+
+\newcommand*\answer[1]{%
+ \XSIMexpandcode{%
+ \SetExerciseProperty{answer}
+ { (\noexpand\textit{\alph{task}}) \unexpanded{#1}}}%
+ #1%
+}
+
+\newcommand*\getanswers{%
+ \def\betweenanswers{\def\betweenanswers{\hspace{2em}}}%
+ \ForEachUsedExerciseByID{%
+ \betweenanswers##3\ExercisePropertyGet{##1}{##2}{answer}%
+ }%
+}
+
+\xsimsetup{
+ exercise/template = item,
+ exercise/the-counter = \arabic{exercise}.
+}
+
+\NewTasksEnvironment[
+ label = (\textit{\alph*}) ,
+ label-width = 14pt
+]{choice}[\choice]
+
+\newenvironment{questions}
+ {\itemize}
+ {\enditemize}
+
+\begin{document}
+
+\section{Problems}
+\begin{questions}
+ \begin{exercise}
+ What is the product of $-2$ and $3$?
+ \begin{choice}(4)
+ \choice \answer{$-6$}
+ \choice $6$
+ \choice $5$
+ \choice $-5$
+ \end{choice}
+ \end{exercise}
+ \begin{exercise}
+ What is the sum of the sides of a polygon called?
+ \begin{choice}(2)
+ \choice Leg
+ \choice \answer{Perimeter}
+ \choice Area
+ \choice Volume
+ \end{choice}
+ \end{exercise}
+ \begin{exercise}
+ What is the sum of $-2$ and $-3$?
+ \begin{choice}(4)
+ \choice $-6$
+ \choice $6$
+ \choice $5$
+ \choice \answer{$-5$}
+ \end{choice}
+ \end{exercise}
+\end{questions}
+
+\section{Answers}
+\getanswers
+
+\end{document}