summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/examples/xsim.issues-49.tex
blob: f9baf0a601597a6c09b7b09b938ecd0e437dce2b (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
\documentclass{article}
\usepackage{xsim}

\xsimsetup{
  load-style = layouts ,
  exercise/template = runin ,
  solution/template = runin
}

\usepackage{tasks,fontawesome,fmtcount,multicol}
\NewTasksEnvironment[label=\Alph*),label-width=12pt]{choices}[\choice]
\newcommand*\correct{\thetask\expanded{\SetExerciseProperty{choice}{\thetask}}}

\NewTasksEnvironment[label=\Roman*,label-width=12pt]{options}[\option]

\DeclareExerciseProperty{choice}

\newcommand*\pkg[1]{\texttt{#1}}
\newcommand*\cls[1]{\texttt{#1}}

\newcommand\EA[2]{\IfInsideSolutionTF{#2}{#1}}
\newcommand\answer[1]{\IfInsideSolutionT{#1}}

\begin{document}

\section{List of exercises}
Solve and answer the following exercises.

\begin{exercise}
  Factor $x^{2}-2x+1$
\end{exercise}
\begin{solution}
  $\left(x-1\right)^{2}$
\end{solution}
\begin{exercise}
  Factor $3x+3y+3z$
\end{exercise}
\begin{solution}
  $3(x+y+z)$
\end{solution}

\begin{exercise}[solution]
  \EA{True or false?}{}
  \begin{tasks}(2)
    \task \EA{$\alpha > \delta$}{False}
    \task \EA{\LaTeX2e\ is cool?}{Very True!}
  \end{tasks}
\end{exercise}

\begin{exercise}[subtitle=Talking Linux,solution]
  \begin{tasks}(2)
    \task \EA{You use linux?}{Yes}
    \task \EA{Usually uses the package manager?}{Yes}
  \end{tasks}
\end{exercise}

\begin{exercise}[solution]
  \EA{Rate the following \LaTeX\ packages and classes.}{}
  \begin{tasks}(\EA{3}{1})
    \task \EA{\cls{xsim-exam}}{doesn't exist for now}
    \task \EA{\pkg{xsim}}{very good}
    \task \EA{\pkg{exsheets}}{obsolete}
  \end{tasks}
\end{exercise}

\begin{exercise}
  \begin{choices}(5)
    \choice value
    \choice value
    \choice value
    \choice[\correct] correct
    \choice value
  \end{choices}
\end{exercise}
\begin{solution}
  \GetExerciseProperty{choice}
\end{solution}

\begin{exercise}
  \begin{options}(3)
    \option $2\alpha+2\delta=90^{\circ}$
    \option $\alpha=\delta$
    \option $\angle EDF=45^{\circ}$
  \end{options}
  \begin{choices}(4)
    \choice I only
    \choice[\correct] II only
    \choice I and II only
    \choice I and III only
    \choice I, II, and III
  \end{choices}
\end{exercise}
\begin{solution}
  \GetExerciseProperty{choice}
\end{solution}

\begin{exercise}
  \begin{tasks}[label=(\arabic*),label-width=13pt](2)
    \task $2\alpha+2\delta=90^{\circ}$
    \task $\angle EDF=45^{\circ}$
  \end{tasks}
  \begin{choices}(3)
    \choice Alternative A
    \choice Alternative B
    \choice[\correct] Alternative C
    \choice Alternative D
    \choice Alternative E
  \end{choices}
\end{exercise}
\begin{solution}
  \GetExerciseProperty{choice}
\end{solution}

\clearpage

\section{Solutions}
\raggedcolumns
\begin{multicols}{2}
  \printsolutions[headings=false]
\end{multicols}

\end{document}