blob: 2d76cae57edb3b760fd7d1abda19d8eb48ae3583 (
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
|
% https://tex.stackexchange.com/q/391530
\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{document}
\collectexercises{exercise-pool}
\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}
\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}
|