blob: 48bf94cd6eb552bf4f1620b09889075a13d08b7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
\documentclass{article}
\usepackage{xsim}
\DeclareExerciseType{subquestion}{
exercise-env = question ,
solution-env = answer ,
exercise-name = Question ,
solution-name = Answer ,
exercise-template = item ,
solution-template = item
}
\DeclareExerciseProperty{title}
\makeatletter
\DeclareExerciseEnvironmentTemplate{named}
{%
\subsection*{%
\GetExercisePropertyTF{title}
{#1}
{??\@latex@warning{Please give an exercise title}}%
}%
}
{}
\makeatother
\DeclareExerciseEnvironmentTemplate{item}
{\item}
{}
\DeclareExerciseCollection{exercise-pool}
\xsimsetup{
exercise/template = named
}
\begin{filecontents*}{\jobname-exercises.tex}
\begin{question}
Who is the Defence Minister?
\end{question}
\begin{question}
Who is the Home Minister?
\end{question}
\begin{question}
Who is the Finance Minister?
\end{question}
\begin{question}
Who is the External Affairs Minister?
\end{question}
\end{filecontents*}
\begin{document}
\collectexercises{exercise-pool}
\input{\jobname-exercises.tex}
\collectexercisesstop{exercise-pool}
\begin{exercise}[title=Answer the following in one sentence:]
\begin{enumerate}
\item Who is the President?
\item Who is the Prime Minister?
\printrandomexercises[collection=exercise-pool]{2}
\end{enumerate}
\end{exercise}
\end{document}
|