summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/examples/xsim.texsx-549540.tex
blob: 332e3d99209ae9cce1b30c053ae0af7a896b35f3 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
% https://tex.stackexchange.com/q/549540/
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}

\usepackage{parskip}
\usepackage{geometry}
\geometry{ a4paper, left=5mm, right=5mm, top=15mm }

\usepackage{amsmath,amssymb}

\usepackage{multicol}
\setlength{\columnsep}{1mm}
\setlength{\columnseprule}{0.2pt}

\usepackage[most]{tcolorbox}

\usepackage{siunitx}
\usepackage{xsim}
\usepackage{tasks}

\makeatletter
\newtcolorbox{examtitle}[2][]{
  halign=flush center,
  colframe=gray!70!black,
  fonttitle=\Large,
  enhanced, 
  breakable,
  colback=white,
  attach boxed title to top right={yshift=-2pt}, title={#2},
  boxed title size=standard,
  boxrule=0pt,
  boxed title style={
    sharp corners, 
    rounded corners=northeast, 
    colback=tcbcolframe, 
    boxrule=0pt},
  sharp corners=north,
  overlay unbroken={
    \path[fill=tcbcolback] 
      ([xshift=2pt]title.south west) 
      to[out=180, in=0] ([xshift=-1.5cm]title.west)--
      (title.west-|frame.west) |- 
      ([xshift=2pt]title.south west)--cycle;
    \path[fill=tcbcolframe] (title.south west) 
      to[out=180, in=0] ([xshift=-1.5cm]title.west)--
      (title.west-|frame.west)
      [rounded corners=\kvtcb@arc] |- 
      (title.north-|frame.north) 
      [sharp corners] -| (title.south west);
    \draw[line width=.5mm, rounded corners=\kvtcb@arc, 
      tcbcolframe] 
      (title.north east) rectangle 
      (frame.south west);
  }, 
  overlay first={
    \path[fill=tcbcolback] 
      ([xshift=2pt]title.south west) 
      to[out=180, in=0] ([xshift=-1.5cm]title.west)--
     (title.west-|frame.west) |- 
      ([xshift=2pt]title.south west)--cycle;
    \path[fill=tcbcolframe] (title.south west) 
      to[out=180, in=0] ([xshift=-1.5cm]title.west)--
      (title.west-|frame.west)
      [rounded corners=\kvtcb@arc] |- 
      (title.north-|frame.north) 
      [sharp corners] -| (title.south west);
    \draw[line width=.5mm, rounded corners=\kvtcb@arc, 
      tcbcolframe] 
      (frame.south west) |- (title.north) -| 
      (frame.south east);
  }, 
  overlay middle={
    \draw[line width=.5mm, tcbcolframe] 
    (frame.north west)--(frame.south west) 
    (frame.north east)--(frame.south east);
  },
  overlay last={
    \draw[line width=.5mm, rounded corners=\kvtcb@arc, 
      tcbcolframe] 
      (frame.north west) |- (frame.south) -|
      (frame.north east);
  }, 
  #1
}
\makeatother

\xsimsetup{
  load-style = layouts ,
  exercise/template = minimal ,
  exercise/the-counter = \arabic{exercise}. ,
  exercise/end-hook = \vspace{\baselineskip}
}

\NewTasksEnvironment[
  label = (\Alph*) ,
  label-format = \bfseries ,
  label-width = 21pt
]{choices}[\choice]

\DeclareExerciseProperty{answer}    
\newcommand*\answer[1]{%
  \SetExpandedExerciseProperty{answer}{ \thetask\ \unexpanded{#1}}%
 #1%
}

\newcommand*\getanswers{%
  \def\betweenanswers{\def\betweenanswers{\hspace{2em}}}%
  \ForEachUsedExerciseByID{%
    \betweenanswers##3\ExercisePropertyGet{##1}{##2}{answer}%
  }%
}

\begin{document}

\begin{examtitle}{Test 1}
  Angles in parallel lines
\end{examtitle}

\begin{multicols*}{2}
\begin{exercise}
  If the ratio of two supplementary angles is $\frac{4}{11}$, what is the
  measure of the small angle?
    \begin{choices}(5)
      \choice \ang{36}
      \choice \ang{44}
      \choice \answer{\ang{48}}
      \choice \ang{52}
      \choice \ang{60}
    \end{choices}
  \end{exercise}
  \begin{exercise}
    Is this really a question?
    \begin{choices}(4)
      \choice \answer{yes}
      \choice no
      \choice maybe
      \choice no idea
    \end{choices}
  \end{exercise}
    \begin{exercise}
    This really is a question!
    \begin{choices}(4)
      \choice yes
      \choice \answer{no}
      \choice maybe
      \choice no idea
    \end{choices}
  \end{exercise}
  \subsection*{Answers}
  \getanswers
\end{multicols*}

\end{document}