Debian Codegraph @

texmf-dist/doc/latex/xsim/examples/xsim.texsx-549540.tex

raw
1 % https://tex.stackexchange.com/q/549540/
2 \documentclass[12pt]{article}
3 \usepackage[T1]{fontenc}
4
5 \usepackage{parskip}
6 \usepackage{geometry}
7 \geometry{ a4paper, left=5mm, right=5mm, top=15mm }
8
9 \usepackage{amsmath,amssymb}
10
11 \usepackage{multicol}
12 \setlength{\columnsep}{1mm}
13 \setlength{\columnseprule}{0.2pt}
14
15 \usepackage[most]{tcolorbox}
16
17 \usepackage{siunitx}
18 \usepackage{xsim}
19 \usepackage{tasks}
20
21 \makeatletter
22 \newtcolorbox{examtitle}[2][]{
23 halign=flush center,
24 colframe=gray!70!black,
25 fonttitle=\Large,
26 enhanced,
27 breakable,
28 colback=white,
29 attach boxed title to top right={yshift=-2pt}, title={#2},
30 boxed title size=standard,
31 boxrule=0pt,
32 boxed title style={
33 sharp corners,
34 rounded corners=northeast,
35 colback=tcbcolframe,
36 boxrule=0pt},
37 sharp corners=north,
38 overlay unbroken={
39 \path[fill=tcbcolback]
40 ([xshift=2pt]title.south west)
41 to[out=180, in=0] ([xshift=-1.5cm]title.west)--
42 (title.west-|frame.west) |-
43 ([xshift=2pt]title.south west)--cycle;
44 \path[fill=tcbcolframe] (title.south west)
45 to[out=180, in=0] ([xshift=-1.5cm]title.west)--
46 (title.west-|frame.west)
47 [rounded corners=\kvtcb@arc] |-
48 (title.north-|frame.north)
49 [sharp corners] -| (title.south west);
50 \draw[line width=.5mm, rounded corners=\kvtcb@arc,
51 tcbcolframe]
52 (title.north east) rectangle
53 (frame.south west);
54 },
55 overlay first={
56 \path[fill=tcbcolback]
57 ([xshift=2pt]title.south west)
58 to[out=180, in=0] ([xshift=-1.5cm]title.west)--
59 (title.west-|frame.west) |-
60 ([xshift=2pt]title.south west)--cycle;
61 \path[fill=tcbcolframe] (title.south west)
62 to[out=180, in=0] ([xshift=-1.5cm]title.west)--
63 (title.west-|frame.west)
64 [rounded corners=\kvtcb@arc] |-
65 (title.north-|frame.north)
66 [sharp corners] -| (title.south west);
67 \draw[line width=.5mm, rounded corners=\kvtcb@arc,
68 tcbcolframe]
69 (frame.south west) |- (title.north) -|
70 (frame.south east);
71 },
72 overlay middle={
73 \draw[line width=.5mm, tcbcolframe]
74 (frame.north west)--(frame.south west)
75 (frame.north east)--(frame.south east);
76 },
77 overlay last={
78 \draw[line width=.5mm, rounded corners=\kvtcb@arc,
79 tcbcolframe]
80 (frame.north west) |- (frame.south) -|
81 (frame.north east);
82 },
83 #1
84 }
85 \makeatother
86
87 \xsimsetup{
88 load-style = layouts ,
89 exercise/template = minimal ,
90 exercise/the-counter = \arabic{exercise}. ,
91 exercise/end-hook = \vspace{\baselineskip}
92 }
93
94 \NewTasksEnvironment[
95 label = (\Alph*) ,
96 label-format = \bfseries ,
97 label-width = 21pt
98 ]{choices}[\choice]
99
100 \DeclareExerciseProperty{answer}
101 \newcommand*\answer[1]{%
102 \SetExpandedExerciseProperty{answer}{ \thetask\ \unexpanded{#1}}%
103 #1%
104 }
105
106 \newcommand*\getanswers{%
107 \def\betweenanswers{\def\betweenanswers{\hspace{2em}}}%
108 \ForEachUsedExerciseByID{%
109 \betweenanswers##3\ExercisePropertyGet{##1}{##2}{answer}%
110 }%
111 }
112
113 \begin{document}
114
115 \begin{examtitle}{Test 1}
116 Angles in parallel lines
117 \end{examtitle}
118
119 \begin{multicols*}{2}
120 \begin{exercise}
121 If the ratio of two supplementary angles is $\frac{4}{11}$, what is the
122 measure of the small angle?
123 \begin{choices}(5)
124 \choice \ang{36}
125 \choice \ang{44}
126 \choice \answer{\ang{48}}
127 \choice \ang{52}
128 \choice \ang{60}
129 \end{choices}
130 \end{exercise}
131 \begin{exercise}
132 Is this really a question?
133 \begin{choices}(4)
134 \choice \answer{yes}
135 \choice no
136 \choice maybe
137 \choice no idea
138 \end{choices}
139 \end{exercise}
140 \begin{exercise}
141 This really is a question!
142 \begin{choices}(4)
143 \choice yes
144 \choice \answer{no}
145 \choice maybe
146 \choice no idea
147 \end{choices}
148 \end{exercise}
149 \subsection*{Answers}
150 \getanswers
151 \end{multicols*}
152
153 \end{document}