Debian Codegraph @

texmf-dist/source/latex/cesenaexam/cesenaexam.dtx

raw
1 % \iffalse meta-comment
2 % !TEX program = pdfLaTeX
3 %<*internal>
4 \iffalse
5 %</internal>
6 %<*readme>
7 # cesenaexam LaTeX class
8 ```
9 ----------------------------------------------------------------
10 cesenaexam --- class file to typeset exams
11 E-mail: [email protected]
12 Released under the LaTeX Project Public License v1.3c or later
13 See http://www.latex-project.org/lppl.txt
14 Contributions to this repository as pull requests are welcome!
15 ----------------------------------------------------------------
16 ```
17
18 This LaTeX document class has been designed to typeset exams.
19 To make the ```.cls``` from the ```.dtx``` one, just run
20 ```make```.
21 Read the manual for more informations.
22
23 The processed files ready to be included can be downloaded from
24 the following links:
25
26 [Download cesenaexam Manual](https://alexpacini.github.io/cesenaexam/build/cesenaexam.pdf)
27
28 [Download cesenaexam Example](https://alexpacini.github.io/cesenaexam/build/cesenaexam_example.pdf)
29
30 <a href="https://alexpacini.github.io/cesenaexam/build/cesenaexam.cls" download="cesenaexam.cls">Download cesenaexam Class File</a>
31
32 To use the class file, just drop it in the same folder as the ```.tex``` source file and use ```cesenaexam``` in the
33 ```\documentclass[a4paper, 10pt]{cesenaexam}``` or download the last published version from the archive below.
34
35 ## [Tag Archive](https://github.com/alexpacini/cesenaexam/tags)
36 - [2017-08-04 - cesenaexam v0.2](https://github.com/alexpacini/cesenaexam/archive/v0.2.zip)
37
38 %</readme>
39 %<*internal>
40 \fi
41 \def\nameofplainTeX{plain}
42 \ifx\fmtname\nameofplainTeX\else
43 \expandafter\begingroup
44 \fi
45 %</internal>
46 %<*install>
47 \input docstrip.tex
48 \keepsilent
49 \askforoverwritefalse
50 \preamble
51 ----------------------------------------------------------------
52 cesenaexam --- class file to typeset exams
53 E-mail: [email protected]
54 Released under the LaTeX Project Public License v1.3c or later
55 See http://www.latex-project.org/lppl.txt
56 Contributions to this repository as pull requests are welcome!
57 ----------------------------------------------------------------
58
59 This LaTeX document class has been designed to typeset exams.
60 To make the .cls from the .dtx one, just run
61 ```make```.
62
63 \endpreamble
64 \postamble
65
66 Copyright (C) 2017 by Alex Pacini <[email protected]>
67
68 This work may be distributed and/or modified under the
69 conditions of the LaTeX Project Public License (LPPL), either
70 version 1.3c of this license or (at your option) any later
71 version. The latest version of this license is in the file:
72
73 http://www.latex-project.org/lppl.txt
74
75 This work is "maintained" (as per LPPL maintenance status) by
76 Alex Pacini.
77
78 This work consists of the file cesenaexam.dtx
79 and the derived files cesenaexam.ins,
80 cesenaexam.pdf and
81 cesenaexam.cls.
82
83 \endpostamble
84 \usedir{tex/latex/cesenaexam}
85 \generate{
86 \file{\jobname.cls}{\from{\jobname.dtx}{class,classpackage}}
87 }
88 \generate{
89 \file{\jobname.sty}{\from{\jobname.dtx}{package,classpackage}}
90 }
91 %</install>
92 %<install>\endbatchfile
93 %<*internal>
94 \usedir{source/latex/cesenaexam}
95 \generate{
96 \file{\jobname.ins}{\from{\jobname.dtx}{install}}
97 }
98 \nopreamble\nopostamble
99 \usedir{doc/latex/cesenaexam}
100 \generate{
101 \file{README.md}{\from{\jobname.dtx}{readme}}
102 }
103 \ifx\fmtname\nameofplainTeX
104 \expandafter\endbatchfile
105 \else
106 \expandafter\endgroup
107 \fi
108 %</internal>
109 %<*class>
110 \NeedsTeXFormat{LaTeX2e}
111 \ProvidesClass{cesenaexam}[2017/08/03 - v0.2 Cesena Exam]
112 \def\cesenaexamversion{0.2}
113 %</class>
114 %<*package>
115 \NeedsTeXFormat{LaTeX2e}
116 \ProvidesPackage{cesenaexam}[2017/08/03 - v0.2 Cesena Exam]
117 \def\cesenaexamversion{0.2}
118 %</package>
119 %<*driver>
120 \documentclass{ltxdoc}
121
122 \makeatletter% Do not index foreign macros: tex.stackexchange.com/questions/46085
123 \def\SpecialMainIndex#1{%
124 \@bsphack
125 \immediate\write\@auxout{%
126 \global\noexpand\expandafter\let\noexpand\csname MAIN:\noexpand\string\string#1\endcsname\noexpand\@empty}%
127 \SpecialIndex@{#1}{\encapchar main}\@esphack}
128 \def\SpecialIndex#1{%
129 \@bsphack
130 \expandafter\ifx\csname MAIN:\string#1\endcsname\@empty
131 \special@index{\expandafter\@gobble
132 \string#1\actualchar
133 \string\verb\quotechar*\verbatimchar\string#1\verbatimchar}%
134 \fi
135 \@esphack}
136 \makeatother
137
138 \usepackage[T1]{fontenc}
139 \usepackage[utf8]{inputenc}
140 %\usepackage{lmodern}
141 \usepackage[numbered]{hypdoc}
142 \usepackage{booktabs}
143 \usepackage{amsfonts, amssymb, amsmath, textcomp, gensymb, mathtools}
144 \interdisplaylinepenalty=2500
145 \usepackage{array}
146 \usepackage{url}
147 \usepackage{microtype, datetime}
148 \usepackage{color, soul}
149 \let\oldsection\section
150 \let\oldmaketitle\maketitle
151 \usepackage{\jobname}
152 \let\section\oldsection
153 \let\maketitle\oldmaketitle
154 \EnableCrossrefs
155 \CodelineIndex
156 \RecordChanges
157 \begin{document}
158 \DocInput{\jobname.dtx}
159 \end{document}
160 %</driver>
161 % \fi
162 %
163 % \def\fileversion{v0.2}
164 % \def\filedate{2017/08/03}
165 %
166 %\title{^^A
167 % \textsf{cesenaexam} --- class file to typeset exams\thanks{^^A
168 % This file describes version \fileversion, last revised \filedate.^^A
169 % }^^A
170 %}
171 %\author{^^A
172 % Alex Pacini\thanks{E-mail: [email protected]}^^A
173 %}
174 %\date{Released \filedate}
175 %
176 %\maketitle
177 %\tableofcontents
178 %
179 %\changes{v0.2}{2017/08/03}{First public release}
180 %
181 % \section{How to make}
182 % This class is also provided with a Makefile and an example document.
183 %
184 % Just execute the Makefile with \verb|make| and the class file \verb|cesenaexam.cls|, the package file \verb|cesenaexam.sty|, this manual \verb|cesenaexam.pdf| and the example document \verb|cesenaexam_example.pdf| will be produced.
185 %
186 % \section{The cesenaexam document class}
187 % \verb|\documentclass[a4paper, 10pts]{cesenaexam}|\\
188 % \newline
189 % The document class for the \texttt{cesenaexam}, which has few additional optional arguments listed in the following:
190 % \begin{itemize}
191 % \item \oarg{boxed}: Draws boxes around blocks.
192 % The red box is the tikz bounding box, the black one is the minipage bounding box.
193 % Useful for the layout of the page.
194 % \item \oarg{times}: Sets a times font.
195 % \item \oarg{noversion}: Hides the footer.
196 % \item \oarg{left=2cm, right=2cm, top=2.5cm, bottom=2.5cm}: Set the page margins using the geometry package, the defaults are indicated here in the options.
197 % \end{itemize}
198 %
199 %\section{The cesenaexam package}
200 % \verb|\usepackage{cesenaexam}|\\
201 % \newline
202 % \noindent \textcolor{red}{\bfseries Not intended to be used with the class which already defines all the macros}
203 %
204 % All the macros are defined also without the class in a standalone package, which is used to make this manual.
205 % There could be other uses, but those are not guaranteed.
206 %
207 %\StopEventually{^^A
208 %\PrintChanges
209 %\PrintIndex
210 %}
211 %
212 % \iffalse
213 %<*classpackage>
214 % \fi
215 %
216 % \section[Class and package settings and definitions]{{\color{red}Class} and {\color{blue}package} settings and definitions}
217 %
218 % In both {\color{red}\verb|cesenaexam.cls|} and {\color{blue}\verb|cesenaexam.sty|}.
219 % \begin{macrocode}
220 %% Custom options
221 \RequirePackage{etoolbox}
222 %% I decided to use the etoolbox ifbool because the if else fi
223 %% has issues with docstrip and needs a dirty hack
224 %% tex.stackexchange.com/questions/162762
225 %% No version option
226 \newbool{exam@version}\booltrue{exam@version}
227 %% Box the blocks option
228 \newbool{exam@boxed}\boolfalse{exam@boxed}
229 %% Times font option
230 \newbool{exam@times}\boolfalse{exam@times}
231 % \end{macrocode}
232 %\iffalse
233 %</classpackage>
234 %<*class>
235 %\fi
236 % \noindent
237 % Only in {\color{red}\verb|cesenaexam.cls|}.
238 % \begin{macrocode}
239 %% No version option
240 \DeclareOption{noversion}{\boolfalse{exam@version}}
241 %% Box the blocks option
242 \DeclareOption{boxed}{\booltrue{exam@boxed}}
243 %% Times font option
244 \DeclareOption{times}{\booltrue{exam@times}}
245 %% This class extends the article class
246 %% Read all the documentclass options; pass them to article,
247 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
248 \ProcessOptions \relax
249 %%
250 \LoadClass{article}
251 %%
252 \RequirePackage{pgfkeys}
253 \RequirePackage{pgfopts}
254 %%
255 %% Options to pass to geometry using pgfopts
256 \pgfkeys{
257 /myexamgeometry/.is family, /myexamgeometry,
258 left/.default = 2cm,
259 right/.default = 2cm,
260 top/.default = 2.5cm,
261 bottom/.default = 2.5cm,
262 left/.store in =\exam@geometryleft,
263 right/.store in =\exam@geometryright,
264 top/.store in =\exam@geometrytop,
265 bottom/.store in =\exam@geometrybottom,
266 left, right, bottom, top,
267 }
268 \ProcessPgfOptions{/myexamgeometry}
269 %%
270 %% Page layout, check if the boxed option is used to load
271 %% geometry with the showframe option
272 \ifbool{exam@boxed}{%
273 \RequirePackage[showframe,%
274 left=\exam@geometryleft, right=\exam@geometryright,%
275 top=\exam@geometrytop,bottom=\exam@geometrybottom]{geometry}%
276 }{%
277 \RequirePackage[left=\exam@geometryleft, right=\exam@geometryright,%
278 top=\exam@geometrytop, bottom=\exam@geometrybottom]{geometry}%
279 }
280 %%
281 %% Set the times font if the option is times
282 \ifbool{exam@times}{%
283 \RequirePackage{newtxtext,newtxmath}%
284 }{}
285 % \end{macrocode}
286 %\iffalse
287 %</class>
288 %<*classpackage>
289 %\fi
290 % In both {\color{red}\verb|cesenaexam.cls|} and {\color{blue}\verb|cesenaexam.sty|}.
291 % \begin{macrocode}
292 %% Loading graphicx before tikz removes a
293 %% strange issue with the \graphicspath
294 \RequirePackage[pdftex]{graphicx}
295 %% Tikz and circuitikz
296 \RequirePackage{tikz}
297 \RequirePackage[betterproportions]{circuitikz}
298 \usetikzlibrary{arrows.meta,arrows,intersections,%
299 positioning,fit,calc,through,babel}
300 \usetikzlibrary{decorations.pathmorphing,backgrounds}
301 %% Some settings for Tikz
302 \tikzset{switcharc/.style={draw, thick, >=stealth},
303 every picture/.append style={tight background,%
304 baseline={([yshift=-1em] current bounding box.north)}}}
305 % \end{macrocode}
306 %\iffalse
307 %</classpackage>
308 %<*class>
309 %\fi
310 % Only in {\color{red}\verb|cesenaexam.cls|}.
311 % \begin{macrocode}
312 %% Set the Header
313 \RequirePackage{fancyhdr}
314 \renewcommand{\headrulewidth}{0pt}
315 \setlength{\headheight}{25pt}
316 \addtolength{\headheight}{\baselineskip}
317 \fancypagestyle{plain}{
318 \fancyhead[C]{
319 \ifbool{exam@boxed}{%
320 \tikzset{every picture/.style={framed, tight background},%
321 background rectangle/.style={draw=red}}%
322 }{}
323 \begin{tikzpicture}
324 \node (header) [align=center] at (0,0) {\@title};
325 \end{tikzpicture}%
326 }%
327 \ifbool{exam@version}{%
328 \fancyfoot[L]{{\it Proudly made with} \LaTeX}%
329 \fancyfoot[R]{CesenaExam v\cesenaexamversion { }- {\it A. Pacini}}%
330 }{}
331 }
332 \pagestyle{plain}
333 % \end{macrocode}
334 %\iffalse
335 %</class>
336 %<*classpackage>
337 %\fi
338 % In both {\color{red}\verb|cesenaexam.cls|} and {\color{blue}\verb|cesenaexam.sty|}.
339 % \begin{macrocode}
340 %% Redefine the section to have bigger font and to be
341 %% delimited between two lines
342 \RequirePackage{titlesec}
343 \newcommand{\sectionfont}{\Large}
344 \renewcommand\thesection{\bfseries \arabic{section}}
345 \titleformat{\section}
346 {\titlerule
347 \vspace{0.5ex}%
348 \sectionfont}
349 {\thesection}{1em}
350 {\sectionfont \bfseries}[\titlerule]
351 %% Redefine the enumerate item to be bold
352 \renewcommand\labelenumi{\bfseries\theenumi.}
353 %% Options for the titlebox processed from the
354 %% maketitle optional arguments
355 \pgfkeys{
356 /mytitlebox/.is family, /mytitlebox,
357 textboxheight/.default = 0.6cm,
358 whiteboxheight/.default = 1cm,
359 textboxheight/.store in = \minheighttext@title,
360 whiteboxheight/.store in = \minwhiteboxheight@title,
361 textboxone/.default = {\relax},
362 textboxtwo/.default = {\relax},
363 textboxthree/.default = {\relax},
364 textboxfour/.default = {\relax},
365 textboxone/.store in = \textboxone@title,
366 textboxtwo/.store in = \textboxtwo@title,
367 textboxthree/.store in = \textboxthree@title,
368 textboxfour/.store in = \textboxfour@title,
369 %% Executing them to assign the default value
370 %% (Tikz manual 82.3.2 or tex.stackexchange.com/questions/85754)
371 textboxheight, whiteboxheight, textboxone,
372 textboxtwo, textboxthree, textboxfour,
373 }
374 % \end{macrocode}
375 %\iffalse
376 %</classpackage>
377 %\fi
378
379 %\iffalse
380 %<*internal>
381 \iffalse
382 %</internal>
383 %<*comment>
384 %% Just two example definition to be copied and pasted
385 %
386 %% Example definition of a macro with starred version, using describe macro:
387 %
388 %\DescribeMacro{\macroname}
389 % Usage: \verb|\macroname|\marg{mandatory 1}\marg{mandatory 2} \\
390 % Description.\\
391 %
392 %\DescribeMacro{\macroname*}
393 % Usage: \verb|\macroname*|\marg{mandatory 1}\marg{mandatory 2} \\
394 % Description.\\
395 %
396 % Definition of \cs{macroname} and \cs{macroname*}:
397 %\DoNotIndex{\def,\@ifstar} ^^A Not really needed with the modified index macro in the doc document (see above)
398 % \begin{macrocode} ^^A The four spaces are mandatory!
399 %% Comment
400 \def\macroname{\@ifstar\macro@name\macro@@name}
401 \def\macro@name#1#2{\relax}
402 \def\macro@@name#1#2{\relax}
403 % \end{macrocode}
404 %
405 %% Example definition of a macro:
406 %
407 %\begin{macro}{\macroname}
408 % Usage: \verb|\macroname|\marg{mandatory 1}\marg{mandatory 2} \\
409 % Description.\\
410 %
411 % Definition of \cs{macroname}:
412 %\DoNotIndex{\def} ^^A Not really needed with the modified index macro in the doc document (see above)
413 %^^A The four spaces are mandatory!
414 % \begin{macrocode}
415 %% Comment
416 \def\macroname#1#2{\relax}
417 % \end{macrocode}
418 %\end{macro}
419 %</comment>
420 %<*internal>
421 \fi
422 %</internal>
423 %\fi
424
425 %\iffalse
426 %<*classpackage>
427 %\fi
428 % \section{Defined Macros} \indent
429 %
430 %\DescribeMacro{\examsection}
431 % Usage: \verb|\examsection|\marg{bold title}\marg{italic text} \\
432 % Prints the title between two lines \textbf{with} numbering.\\
433 %
434 %\DescribeMacro{\examsection*}
435 % Usage: \verb|\examsection*|\marg{bold title}\marg{italic text} \\
436 % Prints the title between two lines \textbf{without} numbering.\\
437 %
438 % Definition of \cs{examsection} and \cs{examsection*}:
439 %\DoNotIndex{\def,\@ifstar,\@examsection,\@@examsection,\textmd,\textit,\noindent,\section}
440 % \begin{macrocode}
441 %% Define examsection and examsection*
442 \def\examsection{\@ifstar\@examsection\@@examsection}
443 \def\@examsection#1#2{\section*{#1 \textmd{(\textit{#2})}}\noindent}
444 \def\@@examsection#1#2{\section{#1 \textmd{(\textit{#2})}}\noindent}
445 % \end{macrocode}
446 %
447 %\begin{macro}{\boxempty}
448 % Usage: \verb|\boxempty| $\to$ \boxempty \\
449 % Prints an empty box.
450 %
451 % Definition of \verb|\boxempty|:
452 %\DoNotIndex{\newcommand,\square,\;}
453 % \begin{macrocode}
454 %% Definition of empty tick box
455 \newcommand{\boxempty}{$ \square \;$}
456 % \end{macrocode}
457 %\end{macro}
458 %
459 %\begin{macro}{\boxcheck}
460 % Usage: \verb|\boxcheck| $\to$ \boxcheck \\
461 % Prints a black or \textit{checked} box.
462 %
463 % Definition of \verb|\boxcheck|:
464 %\DoNotIndex{\newcommand,\square,\;}
465 % \begin{macrocode}
466 %% Definition of empty tick box
467 \newcommand{\boxcheck}{$ \blacksquare \;$}
468 % \end{macrocode}
469 %\end{macro}
470 %
471 %\begin{macro}{\examparts}
472 % Usage: \verb|\examparts|\marg{}
473 %\begin{verbatim}
474 %\examparts{\bfseries Parts done: \hspace{1cm}%
475 % E1 \boxempty \hspace{1cm}%
476 % E2 \boxempty \hspace{1cm}%
477 % D \boxempty}
478 % \end{verbatim}
479 % Used to include the checkboxes in \cs{maketitle} by passing the code to the \cs{examparts\{\}} macro.
480 % It is internally assigned to the variable \cs{ex@parts}.
481 %
482 % Definition of \verb|\examparts{}|:
483 % \begin{macrocode}
484 %% Assigns to ex@parts what is passed to the function examparts{}.
485 %% Works similarly similarly to author{}
486 \def\examparts#1{\def\ex@parts{#1}}
487 % \end{macrocode}
488 %\end{macro}
489 %
490 %\DescribeMacro{\maketitle}
491 % Usage: \cs{maketitle}\oarg{opt. args}\marg{Surname}\marg{Name}\marg{Id}\marg{Signature}\marg{N} \\
492 % Redefines the \cs{maketitle}.\\
493 % The mandatory arguments label the text (or top) boxes, where the last one used to give the exam type using one char or number.
494 % It is also possible to give optional arguments:
495 % \begin{itemize}
496 % \item \oarg{textboxheight=0.6cm, whiteboxheight=1cm}: To set the height of the textboxes (\verb|textboxheight|) and of the whiteboxes (\verb|whiteboxheight|), the defaults are indicated here in the options;
497 % \item \oarg{textboxone={Guglielmo}, textboxtwo={Marconi}, textboxthree={000},%\\ textboxfour={Signature.pdf}}: To fill the whiteboxes, default are empty.
498 % \end{itemize}
499 % A usage example is:
500 %\begin{verbatim}
501 %\maketitle[textboxheight=0.6cm, whiteboxheight=1cm,%
502 % textboxone={Guglielmo}, textboxtwo={Marconi}, textboxthree={00000000},%
503 % textboxfour={\includegraphics[width=3cm]{Guglielmo_Marconi_Signature}}]%
504 % {Cognome}{Nome}{Matricola}{Firma}{1}
505 % \end{verbatim}
506 %
507 %\DescribeMacro{\maketitle*}
508 % Not implemented at the moment.\\
509 %
510 % Definition of \cs{maketitle} and \cs{maketitle*}:
511 %\DoNotIndex{\def,\@ifstar} ^^A Not really needed with the modified index macro in the doc document (see above)
512 % \begin{macrocode}
513 %% Redefine maketitle
514 %% Just for a future starred version
515 \def\maketitle{\@ifstar\make@@title\make@title}%
516 %% Define the unstarred version maketitle (make@title)
517 \newcommand\make@title[6][]{%
518 \pgfkeys{/mytitlebox, #1}%
519 \make@@@title{#2}{#3}{#4}{#5}{#6}}%
520 %% Define the common command
521 \def\make@@@title#1#2#3#4#5{%
522 \ifbool{exam@boxed}{%
523 \tikzset{every picture/.append style={framed},%
524 background rectangle/.style={draw=red}}}{}%
525 \begin{center}%
526 \begin{tikzpicture}%
527 \pgfmathsetmacro{\boxlen}{(\textwidth-1.6cm)/4}%
528 \pgfmathsetmacro{\lastboxlen}{\textwidth - 4*\boxlen - 1mm}%
529 \node (surname) [draw, align=center, minimum width=\boxlen,%
530 minimum height = \minheighttext@title] at (0,0) {\bf #1};%
531 \node (surname box) [draw, anchor=north, minimum width=\boxlen,%
532 minimum height = \minwhiteboxheight@title] at%
533 ($(surname.south)+(0,\pgflinewidth)$) {\textboxone@title};%
534 \node (name) [draw, align=center, right=0 and -\pgflinewidth of surname,%
535 minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #2};%
536 \node (name box) [draw, anchor=north, minimum width=\boxlen,%
537 minimum height = \minwhiteboxheight@title] at%
538 ($(name.south)+(0,\pgflinewidth)$) {\textboxtwo@title};%
539 \node (id) [draw, align=center, right=0 and -\pgflinewidth of name,%
540 minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #3};%
541 \node (id box) [draw, anchor=north, minimum width=\boxlen,%
542 minimum height = \minwhiteboxheight@title] at%
543 ($(id.south)+(0,\pgflinewidth)$) {\textboxthree@title};%
544 \node (signature) [draw, align=center, right=0 and -\pgflinewidth of id,%
545 minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #4};%
546 \node (signature box) [draw, anchor=north, minimum width=\boxlen,%
547 minimum height = \minwhiteboxheight@title] at%
548 ($(signature.south)+(0,\pgflinewidth)$) {\textboxfour@title};%
549 %%
550 \pgfmathsetmacro{\minheighttypebox}{\minheighttext@title +%
551 \minwhiteboxheight@title}%
552 \node (examtype) [draw, align=center, anchor=north west,%
553 minimum width=\lastboxlen, minimum height = \minheighttypebox] at%
554 ($(signature.north east)+(-\pgflinewidth,0)$) {\Huge \bfseries #5};%
555 \node (checkboxes) [align=left, anchor=north west] at%
556 (surname box.south west) {\ex@parts};%
557 \end{tikzpicture}%
558 \end{center}%
559 }
560 % \end{macrocode}
561 %
562 %\begin{macro}{\examtwoblocks}
563 % Usage: \verb|\examtwoblocks|\marg{B1 length}\marg{B2 length}\marg{B1}\marg{B2} \\
564 % Defines the macro \cs{examtwoblocks}.\\
565 % The mandatory arguments are the lenght of the first block and of the second block, and their content, respectively.
566 % They two boxes are vertically aligned to their centre.
567 %
568 % Definition of \cs{examtwoblocks}:
569 %\DoNotIndex{\def} ^^A Not really needed with the modified index macro in the doc document (see above)
570 % \begin{macrocode}
571 %% Macro for two blocks centre aligned
572 \def\examtwoblocks#1#2#3#4{%
573 \noindent%
574 \begin{minipage}[c]{#1}\flushleft#3\end{minipage}%
575 \hfill%
576 \begin{minipage}[c]{#2}#4\end{minipage}
577 \par\vspace{5mm}\noindent%
578 }
579 \def\examtwoblocks@box#1#2#3#4{%
580 \noindent%
581 \tikzset{every picture/.append style={framed},
582 background rectangle/.style={draw=red}}%
583 \let\bak@fboxsep\fboxsep%
584 \def\fboxsep{0pt}%
585 \fbox{\begin{minipage}[c]{#1}\flushleft#3\end{minipage}}%
586 \hfill%
587 \fbox{\begin{minipage}[c]{#2}#4\end{minipage}}%
588 \let\fboxsep\bak@fboxsep%
589 \par\vspace{5mm}\noindent%
590 }
591 \ifbool{exam@boxed}{%
592 \renewcommand{\examtwoblocks}{\examtwoblocks@box}}{}
593 % \end{macrocode}
594 %\end{macro}
595 %
596 %
597 %\begin{macro}{\examtwoblockstop}
598 % Usage: \verb|\examtwoblockstop|\marg{B1 length}\marg{B2 length}\marg{B1}\marg{B2} \\
599 % Defines the macro \cs{examtwoblockstop}.\\
600 % The mandatory arguments are the lenght of the first block and of the second block, and their content, respectively.
601 % They two boxes are vertically aligned to their top, which is useful if used inside an itemize or an enumerate environment.
602 %
603 % Definition of \cs{examtwoblockstop}:
604 %\DoNotIndex{\def} ^^A Not really needed with the modified index macro in the doc document (see above)
605 % \begin{macrocode}
606 %% Macro for two blocks top aligned
607 \def\examtwoblockstop#1#2#3#4{%
608 \noindent%
609 \begin{minipage}[t]{#1}\flushleft#3\end{minipage}%
610 \hfill%
611 \begin{minipage}[t]{#2}\flushright#4\end{minipage}%
612 }
613 \def\examtwoblockstop@box#1#2#3#4{%
614 \noindent%
615 \tikzset{every picture/.append style={framed},
616 background rectangle/.style={draw=red}}%
617 \let\bak@fboxsep\fboxsep%
618 \def\fboxsep{0pt}%
619 \fbox{\begin{minipage}[t]{#1}\flushleft#3\end{minipage}}%
620 \hfill%
621 \fbox{\begin{minipage}[t]{#2}\flushright#4\end{minipage}}%
622 \let\fboxsep\bak@fboxsep%
623 }
624 \ifbool{exam@boxed}{%
625 \renewcommand{\examtwoblockstop}{\examtwoblockstop@box}}{}
626 % \end{macrocode}
627 %\end{macro}
628 %
629 %\begin{macro}{\examoneblocktop}
630 % Usage: \verb|\examoneblocktop|\marg{B length}\marg{B} \\
631 % Defines the macro \cs{examoneblock}.\\
632 % The mandatory arguments are the lenght of the block and its content.
633 % They box is vertically aligned to its top, which is useful if used inside an itemize or an enumerate environment.
634 %
635 % Definition of \cs{examoneblock}:
636 %\DoNotIndex{\def} ^^A Not really needed with the modified index macro in the doc document (see above)
637 % \begin{macrocode}
638 %% Macro for one block top aligned
639 \def\examoneblocktop#1#2{%
640 \noindent%
641 \begin{minipage}[t]{#1}\flushleft#2\end{minipage}}%
642 \def\examoneblocktop@box#1#2{%
643 \noindent%
644 \tikzset{every picture/.append style={framed},
645 background rectangle/.style={draw=red}}%
646 \let\bak@fboxsep\fboxsep%
647 \def\fboxsep{0pt}%
648 \fbox{\begin{minipage}[t]{#1}\flushleft#2\end{minipage}}%
649 \let\fboxsep\bak@fboxsep%
650 }
651 \ifbool{exam@boxed}{%
652 \renewcommand{\examoneblocktop}{\examoneblocktop@box}}{}
653 % \end{macrocode}
654 %\end{macro}
655 %
656 %\iffalse
657 %</classpackage>
658 %\fi
659
660 %\Finale