summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cesenaexam/cesenaexam.dtx
blob: a1ee7241c207d767a3ee386ad69bb9f0581e2ba3 (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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
% \iffalse meta-comment
% !TEX program  = pdfLaTeX
%<*internal>
\iffalse
%</internal>
%<*readme>
# cesenaexam LaTeX class
```
----------------------------------------------------------------
cesenaexam --- class file to typeset exams
E-mail: alexpacini90@gmail.com
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
Contributions to this repository as pull requests are welcome!
----------------------------------------------------------------
```

This LaTeX document class has been designed to typeset exams.
To make the ```.cls``` from the ```.dtx``` one, just run
```make```.
Read the manual for more informations.

The processed files ready to be included can be downloaded from
the following links:

[Download cesenaexam Manual](https://alexpacini.github.io/cesenaexam/build/cesenaexam.pdf)

[Download cesenaexam Example](https://alexpacini.github.io/cesenaexam/build/cesenaexam_example.pdf)

<a href="https://alexpacini.github.io/cesenaexam/build/cesenaexam.cls" download="cesenaexam.cls">Download cesenaexam Class File</a>

To use the class file, just drop it in the same folder as the ```.tex``` source file and use ```cesenaexam``` in the
```\documentclass[a4paper, 10pt]{cesenaexam}``` or download the last published version from the archive below.

## [Tag Archive](https://github.com/alexpacini/cesenaexam/tags)
- [2017-08-04 - cesenaexam v0.2](https://github.com/alexpacini/cesenaexam/archive/v0.2.zip)

%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
----------------------------------------------------------------
cesenaexam --- class file to typeset exams
E-mail: alexpacini90@gmail.com
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
Contributions to this repository as pull requests are welcome!
----------------------------------------------------------------

This LaTeX document class has been designed to typeset exams.
To make the .cls from the .dtx one, just run
```make```.

\endpreamble
\postamble

Copyright (C) 2017 by Alex Pacini <alexpacini90@gmail.com>

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

This work is "maintained" (as per LPPL maintenance status) by
Alex Pacini.

This work consists of the file  cesenaexam.dtx
and the derived files           cesenaexam.ins,
                                cesenaexam.pdf and
                                cesenaexam.cls.

\endpostamble
\usedir{tex/latex/cesenaexam}
\generate{
  \file{\jobname.cls}{\from{\jobname.dtx}{class,classpackage}}
}
\generate{
  \file{\jobname.sty}{\from{\jobname.dtx}{package,classpackage}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/latex/cesenaexam}
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/cesenaexam}
\generate{
  \file{README.md}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
%<*class>
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cesenaexam}[2017/08/03 - v0.2 Cesena Exam]
\def\cesenaexamversion{0.2}
%</class>
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cesenaexam}[2017/08/03 - v0.2 Cesena Exam]
\def\cesenaexamversion{0.2}
%</package>
%<*driver>
\documentclass{ltxdoc}

\makeatletter% Do not index foreign macros: tex.stackexchange.com/questions/46085
\def\SpecialMainIndex#1{%
\@bsphack
\immediate\write\@auxout{%
\global\noexpand\expandafter\let\noexpand\csname MAIN:\noexpand\string\string#1\endcsname\noexpand\@empty}%
\SpecialIndex@{#1}{\encapchar main}\@esphack}
\def\SpecialIndex#1{%
\@bsphack
   \expandafter\ifx\csname MAIN:\string#1\endcsname\@empty
   \special@index{\expandafter\@gobble
                                      \string#1\actualchar
      \string\verb\quotechar*\verbatimchar\string#1\verbatimchar}%
   \fi
    \@esphack}
\makeatother

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage{lmodern}
\usepackage[numbered]{hypdoc}
\usepackage{booktabs}
\usepackage{amsfonts, amssymb, amsmath, textcomp, gensymb, mathtools}
\interdisplaylinepenalty=2500
\usepackage{array}
\usepackage{url}
\usepackage{microtype, datetime}
\usepackage{color, soul}
\let\oldsection\section
\let\oldmaketitle\maketitle
\usepackage{\jobname}
\let\section\oldsection
\let\maketitle\oldmaketitle
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \def\fileversion{v0.2}
% \def\filedate{2017/08/03}
%
%\title{^^A
%  \textsf{cesenaexam} --- class file to typeset exams\thanks{^^A
%    This file describes version \fileversion, last revised \filedate.^^A
%  }^^A
%}
%\author{^^A
%  Alex Pacini\thanks{E-mail: alexpacini90@gmail.com}^^A
%}
%\date{Released \filedate}
%
%\maketitle
%\tableofcontents
%
%\changes{v0.2}{2017/08/03}{First public release}
%
% \section{How to make}
% This class is also provided with a Makefile and an example document.
%
% 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.
%
% \section{The cesenaexam document class}
% \verb|\documentclass[a4paper, 10pts]{cesenaexam}|\\
% \newline
% The document class for the \texttt{cesenaexam}, which has few additional optional arguments listed in the following:
% \begin{itemize}
% \item \oarg{boxed}: Draws boxes around blocks.
%   The red box is the tikz bounding box, the black one is the minipage bounding box.
%   Useful for the layout of the page.
% \item \oarg{times}: Sets a times font.
% \item \oarg{noversion}: Hides the footer.
% \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.
% \end{itemize}
%
%\section{The cesenaexam package}
% \verb|\usepackage{cesenaexam}|\\
% \newline
% \noindent \textcolor{red}{\bfseries Not intended to be used with the class which already defines all the macros}
%
% All the macros are defined also without the class in a standalone package, which is used to make this manual.
% There could be other uses, but those are not guaranteed.
%
%\StopEventually{^^A
%\PrintChanges
%\PrintIndex
%}
%
% \iffalse
%<*classpackage>
% \fi
% 
% \section[Class and package settings and definitions]{{\color{red}Class} and {\color{blue}package} settings and definitions}
%
% In both {\color{red}\verb|cesenaexam.cls|} and {\color{blue}\verb|cesenaexam.sty|}.
%    \begin{macrocode}
%% Custom options
\RequirePackage{etoolbox}
%% I decided to use the etoolbox ifbool because the if else fi
%% has issues with docstrip and needs a dirty hack
%% tex.stackexchange.com/questions/162762
%% No version option
\newbool{exam@version}\booltrue{exam@version}
%% Box the blocks option
\newbool{exam@boxed}\boolfalse{exam@boxed}
%% Times font option
\newbool{exam@times}\boolfalse{exam@times}
%    \end{macrocode}
%\iffalse
%</classpackage>
%<*class>
%\fi
% \noindent
% Only in {\color{red}\verb|cesenaexam.cls|}.
%    \begin{macrocode}
%% No version option
\DeclareOption{noversion}{\boolfalse{exam@version}}
%% Box the blocks option
\DeclareOption{boxed}{\booltrue{exam@boxed}}
%% Times font option
\DeclareOption{times}{\booltrue{exam@times}}
%% This class extends the article class
%% Read all the documentclass options; pass them to article,
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax
%%
\LoadClass{article}
%%
\RequirePackage{pgfkeys}
\RequirePackage{pgfopts}
%%
%% Options to pass to geometry using pgfopts
\pgfkeys{
 /myexamgeometry/.is family, /myexamgeometry,
 left/.default = 2cm,
 right/.default = 2cm,
 top/.default = 2.5cm,
 bottom/.default = 2.5cm,
 left/.store in =\exam@geometryleft,
 right/.store in =\exam@geometryright,
 top/.store in =\exam@geometrytop,
 bottom/.store in =\exam@geometrybottom,
 left, right, bottom, top,
}
\ProcessPgfOptions{/myexamgeometry}
%%
%% Page layout, check if the boxed option is used to load
%% geometry with the showframe option
\ifbool{exam@boxed}{%
\RequirePackage[showframe,%
left=\exam@geometryleft, right=\exam@geometryright,%
top=\exam@geometrytop,bottom=\exam@geometrybottom]{geometry}%
}{%
\RequirePackage[left=\exam@geometryleft, right=\exam@geometryright,%
top=\exam@geometrytop, bottom=\exam@geometrybottom]{geometry}%
}
%%
%% Set the times font if the option is times
\ifbool{exam@times}{%
\RequirePackage{newtxtext,newtxmath}%
}{}
%    \end{macrocode}
%\iffalse
%</class>
%<*classpackage>
%\fi
% In both {\color{red}\verb|cesenaexam.cls|} and {\color{blue}\verb|cesenaexam.sty|}.
%    \begin{macrocode}
%% Loading graphicx before tikz removes a 
%% strange issue with the \graphicspath
\RequirePackage[pdftex]{graphicx}
%% Tikz and circuitikz
\RequirePackage{tikz}
\RequirePackage[betterproportions]{circuitikz}
\usetikzlibrary{arrows.meta,arrows,intersections,%
positioning,fit,calc,through,babel}
\usetikzlibrary{decorations.pathmorphing,backgrounds}
%% Some settings for Tikz
\tikzset{switcharc/.style={draw, thick, >=stealth},
    every picture/.append style={tight background,%
    baseline={([yshift=-1em] current bounding box.north)}}}
%    \end{macrocode}
%\iffalse
%</classpackage>
%<*class>
%\fi
% Only in {\color{red}\verb|cesenaexam.cls|}.
%    \begin{macrocode}
%% Set the Header
\RequirePackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{25pt} 
\addtolength{\headheight}{\baselineskip}
\fancypagestyle{plain}{
\fancyhead[C]{
\ifbool{exam@boxed}{%
\tikzset{every picture/.style={framed, tight background},%
background rectangle/.style={draw=red}}%
}{}
\begin{tikzpicture}
\node (header) [align=center] at (0,0) {\@title};
\end{tikzpicture}%
}%
\ifbool{exam@version}{%
\fancyfoot[L]{{\it Proudly made with} \LaTeX}%
\fancyfoot[R]{CesenaExam v\cesenaexamversion { }- {\it A. Pacini}}%
}{}
}
\pagestyle{plain}
%    \end{macrocode}
%\iffalse
%</class>
%<*classpackage>
%\fi
% In both {\color{red}\verb|cesenaexam.cls|} and {\color{blue}\verb|cesenaexam.sty|}.
%    \begin{macrocode}
%% Redefine the section to have bigger font and to be
%% delimited between two lines
\RequirePackage{titlesec}
\newcommand{\sectionfont}{\Large}
\renewcommand\thesection{\bfseries \arabic{section}} 
\titleformat{\section}
    {\titlerule     
     \vspace{0.5ex}%
     \sectionfont}
    {\thesection}{1em}
    {\sectionfont \bfseries}[\titlerule]
%% Redefine the enumerate item to be bold
\renewcommand\labelenumi{\bfseries\theenumi.}
%% Options for the titlebox processed from the
%% maketitle optional arguments
\pgfkeys{
 /mytitlebox/.is family, /mytitlebox,
 textboxheight/.default = 0.6cm,
 whiteboxheight/.default = 1cm,
 textboxheight/.store in = \minheighttext@title,
 whiteboxheight/.store in = \minwhiteboxheight@title,
 textboxone/.default = {\relax},
 textboxtwo/.default = {\relax},
 textboxthree/.default = {\relax},
 textboxfour/.default = {\relax},
 textboxone/.store in = \textboxone@title,
 textboxtwo/.store in = \textboxtwo@title,
 textboxthree/.store in = \textboxthree@title,
 textboxfour/.store in = \textboxfour@title,
 %% Executing them to assign the default value
 %% (Tikz manual 82.3.2 or tex.stackexchange.com/questions/85754)
 textboxheight, whiteboxheight, textboxone,
 textboxtwo, textboxthree, textboxfour,
}
%    \end{macrocode}
%\iffalse
%</classpackage>
%\fi

%\iffalse
%<*internal>
\iffalse
%</internal>
%<*comment>
%% Just two example definition to be copied and pasted
%
%% Example definition of a macro with starred version, using describe macro:
%
%\DescribeMacro{\macroname}
% Usage: \verb|\macroname|\marg{mandatory 1}\marg{mandatory 2} \\
% Description.\\
% 
%\DescribeMacro{\macroname*}
% Usage: \verb|\macroname*|\marg{mandatory 1}\marg{mandatory 2} \\
% Description.\\
%
% Definition of \cs{macroname} and \cs{macroname*}:
%\DoNotIndex{\def,\@ifstar} ^^A Not really needed with the modified index macro in the doc document (see above)
%    \begin{macrocode} ^^A The four spaces are mandatory!
%% Comment
\def\macroname{\@ifstar\macro@name\macro@@name}
\def\macro@name#1#2{\relax}
\def\macro@@name#1#2{\relax}
%    \end{macrocode}
%
%% Example definition of a macro:
% 
%\begin{macro}{\macroname}
% Usage: \verb|\macroname|\marg{mandatory 1}\marg{mandatory 2} \\
% Description.\\
%
% Definition of \cs{macroname}:
%\DoNotIndex{\def} ^^A Not really needed with the modified index macro in the doc document (see above)
%^^A The four spaces are mandatory!
%    \begin{macrocode}
%% Comment
\def\macroname#1#2{\relax}
%    \end{macrocode}
%\end{macro}
%</comment>
%<*internal>
\fi
%</internal>
%\fi

%\iffalse
%<*classpackage>
%\fi
% \section{Defined Macros} \indent
%
%\DescribeMacro{\examsection}
% Usage: \verb|\examsection|\marg{bold title}\marg{italic text} \\
% Prints the title between two lines \textbf{with} numbering.\\
% 
%\DescribeMacro{\examsection*}
% Usage: \verb|\examsection*|\marg{bold title}\marg{italic text} \\
% Prints the title between two lines \textbf{without} numbering.\\
%
% Definition of \cs{examsection} and \cs{examsection*}:
%\DoNotIndex{\def,\@ifstar,\@examsection,\@@examsection,\textmd,\textit,\noindent,\section}
%    \begin{macrocode}
%% Define examsection and examsection*
\def\examsection{\@ifstar\@examsection\@@examsection}
\def\@examsection#1#2{\section*{#1 \textmd{(\textit{#2})}}\noindent}
\def\@@examsection#1#2{\section{#1 \textmd{(\textit{#2})}}\noindent}
%    \end{macrocode}
%
%\begin{macro}{\boxempty}
% Usage: \verb|\boxempty| $\to$ \boxempty \\
% Prints an empty box.
%
% Definition of \verb|\boxempty|:
%\DoNotIndex{\newcommand,\square,\;}
%    \begin{macrocode}
%% Definition of empty tick box
\newcommand{\boxempty}{$ \square \;$}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\boxcheck}
% Usage: \verb|\boxcheck| $\to$ \boxcheck \\
% Prints a black or \textit{checked} box.
%
% Definition of \verb|\boxcheck|:
%\DoNotIndex{\newcommand,\square,\;}
%    \begin{macrocode}
%% Definition of empty tick box
\newcommand{\boxcheck}{$ \blacksquare \;$}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\examparts}
% Usage: \verb|\examparts|\marg{}
%\begin{verbatim}
%\examparts{\bfseries Parts done: \hspace{1cm}%
%   E1 \boxempty \hspace{1cm}%
%   E2 \boxempty \hspace{1cm}%
%   D \boxempty}
% \end{verbatim}
% Used to include the checkboxes in \cs{maketitle} by passing the code to the \cs{examparts\{\}} macro.
% It is internally assigned to the variable \cs{ex@parts}.
% 
% Definition of \verb|\examparts{}|:
%    \begin{macrocode}
%% Assigns to ex@parts what is passed to the function examparts{}.
%% Works similarly similarly to author{}
\def\examparts#1{\def\ex@parts{#1}}
%    \end{macrocode}
%\end{macro}
%
%\DescribeMacro{\maketitle}
% Usage: \cs{maketitle}\oarg{opt. args}\marg{Surname}\marg{Name}\marg{Id}\marg{Signature}\marg{N} \\
% Redefines the \cs{maketitle}.\\
% The mandatory arguments label the text (or top) boxes, where the last one used to give the exam type using one char or number.
% It is also possible to give optional arguments:
% \begin{itemize}
% \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;
% \item \oarg{textboxone={Guglielmo}, textboxtwo={Marconi}, textboxthree={000},%\\ textboxfour={Signature.pdf}}: To fill the whiteboxes, default are empty.
% \end{itemize}
% A usage example is:
%\begin{verbatim}
%\maketitle[textboxheight=0.6cm, whiteboxheight=1cm,%
%   textboxone={Guglielmo}, textboxtwo={Marconi}, textboxthree={00000000},%
%   textboxfour={\includegraphics[width=3cm]{Guglielmo_Marconi_Signature}}]%
%   {Cognome}{Nome}{Matricola}{Firma}{1}
% \end{verbatim}
% 
%\DescribeMacro{\maketitle*}
% Not implemented at the moment.\\
%
% Definition of \cs{maketitle} and \cs{maketitle*}:
%\DoNotIndex{\def,\@ifstar} ^^A Not really needed with the modified index macro in the doc document (see above)
%    \begin{macrocode}
%% Redefine maketitle
%% Just for a future starred version
\def\maketitle{\@ifstar\make@@title\make@title}%
%% Define the unstarred version maketitle (make@title)
\newcommand\make@title[6][]{%
 \pgfkeys{/mytitlebox, #1}%
 \make@@@title{#2}{#3}{#4}{#5}{#6}}%
%% Define the common command
\def\make@@@title#1#2#3#4#5{%
\ifbool{exam@boxed}{%
\tikzset{every picture/.append style={framed},%
background rectangle/.style={draw=red}}}{}%
\begin{center}%
\begin{tikzpicture}%
\pgfmathsetmacro{\boxlen}{(\textwidth-1.6cm)/4}%
\pgfmathsetmacro{\lastboxlen}{\textwidth - 4*\boxlen - 1mm}%
\node (surname) [draw, align=center, minimum width=\boxlen,%
minimum height = \minheighttext@title] at (0,0) {\bf #1};%
\node (surname box) [draw, anchor=north, minimum width=\boxlen,%
minimum height = \minwhiteboxheight@title] at%
($(surname.south)+(0,\pgflinewidth)$) {\textboxone@title};%
\node (name) [draw, align=center, right=0 and -\pgflinewidth of surname,%
minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #2};%
\node (name box) [draw, anchor=north, minimum width=\boxlen,%
minimum height = \minwhiteboxheight@title] at%
($(name.south)+(0,\pgflinewidth)$) {\textboxtwo@title};%
\node (id) [draw, align=center, right=0 and -\pgflinewidth of name,%
minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #3};%
\node (id box) [draw, anchor=north, minimum width=\boxlen,%
minimum height = \minwhiteboxheight@title] at%
($(id.south)+(0,\pgflinewidth)$) {\textboxthree@title};%
\node (signature) [draw, align=center, right=0 and -\pgflinewidth of id,%
minimum width=\boxlen, minimum height = \minheighttext@title] {\bf #4};%
\node (signature box) [draw, anchor=north, minimum width=\boxlen,%
minimum height = \minwhiteboxheight@title] at%
($(signature.south)+(0,\pgflinewidth)$) {\textboxfour@title};%
%%
\pgfmathsetmacro{\minheighttypebox}{\minheighttext@title +%
\minwhiteboxheight@title}%
\node (examtype) [draw, align=center, anchor=north west,%
minimum width=\lastboxlen, minimum height = \minheighttypebox] at%
($(signature.north east)+(-\pgflinewidth,0)$) {\Huge \bfseries #5};%
\node (checkboxes) [align=left, anchor=north west] at%
(surname box.south west) {\ex@parts};%
\end{tikzpicture}%
\end{center}%
}
%    \end{macrocode}
%
%\begin{macro}{\examtwoblocks}
% Usage: \verb|\examtwoblocks|\marg{B1 length}\marg{B2 length}\marg{B1}\marg{B2} \\
% Defines the macro \cs{examtwoblocks}.\\
% The mandatory arguments are the lenght of the first block and of the second block, and their content, respectively.
% They two boxes are vertically aligned to their centre.
%
% Definition of \cs{examtwoblocks}:
%\DoNotIndex{\def} ^^A Not really needed with the modified index macro in the doc document (see above)
%    \begin{macrocode}
%% Macro for two blocks centre aligned
\def\examtwoblocks#1#2#3#4{%
\noindent%
\begin{minipage}[c]{#1}\flushleft#3\end{minipage}%
\hfill%
\begin{minipage}[c]{#2}#4\end{minipage}
\par\vspace{5mm}\noindent%
}
\def\examtwoblocks@box#1#2#3#4{%
\noindent%
\tikzset{every picture/.append style={framed},
    background rectangle/.style={draw=red}}%
\let\bak@fboxsep\fboxsep%
\def\fboxsep{0pt}%
\fbox{\begin{minipage}[c]{#1}\flushleft#3\end{minipage}}%
\hfill%
\fbox{\begin{minipage}[c]{#2}#4\end{minipage}}%
\let\fboxsep\bak@fboxsep%
\par\vspace{5mm}\noindent%
}
\ifbool{exam@boxed}{%
\renewcommand{\examtwoblocks}{\examtwoblocks@box}}{}
%    \end{macrocode}
%\end{macro}
%
%
%\begin{macro}{\examtwoblockstop}
% Usage: \verb|\examtwoblockstop|\marg{B1 length}\marg{B2 length}\marg{B1}\marg{B2} \\
% Defines the macro \cs{examtwoblockstop}.\\
% The mandatory arguments are the lenght of the first block and of the second block, and their content, respectively.
% They two boxes are vertically aligned to their top, which is useful if used inside an itemize or an enumerate environment.
%
% Definition of \cs{examtwoblockstop}:
%\DoNotIndex{\def} ^^A Not really needed with the modified index macro in the doc document (see above)
%    \begin{macrocode}
%% Macro for two blocks top aligned
\def\examtwoblockstop#1#2#3#4{%
\noindent%
\begin{minipage}[t]{#1}\flushleft#3\end{minipage}%
\hfill%
\begin{minipage}[t]{#2}\flushright#4\end{minipage}%
}
\def\examtwoblockstop@box#1#2#3#4{%
\noindent%
\tikzset{every picture/.append style={framed},
    background rectangle/.style={draw=red}}%
\let\bak@fboxsep\fboxsep%
\def\fboxsep{0pt}%
\fbox{\begin{minipage}[t]{#1}\flushleft#3\end{minipage}}%
\hfill%
\fbox{\begin{minipage}[t]{#2}\flushright#4\end{minipage}}%
\let\fboxsep\bak@fboxsep%
}
\ifbool{exam@boxed}{%
\renewcommand{\examtwoblockstop}{\examtwoblockstop@box}}{}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\examoneblocktop}
% Usage: \verb|\examoneblocktop|\marg{B length}\marg{B} \\
% Defines the macro \cs{examoneblock}.\\
% The mandatory arguments are the lenght of the block and its content.
% They box is vertically aligned to its top, which is useful if used inside an itemize or an enumerate environment.
%
% Definition of \cs{examoneblock}:
%\DoNotIndex{\def} ^^A Not really needed with the modified index macro in the doc document (see above)
%    \begin{macrocode}
%% Macro for one block top aligned
\def\examoneblocktop#1#2{%
\noindent%
\begin{minipage}[t]{#1}\flushleft#2\end{minipage}}%
\def\examoneblocktop@box#1#2{%
\noindent%
\tikzset{every picture/.append style={framed},
    background rectangle/.style={draw=red}}%
\let\bak@fboxsep\fboxsep%
\def\fboxsep{0pt}%
\fbox{\begin{minipage}[t]{#1}\flushleft#2\end{minipage}}%
\let\fboxsep\bak@fboxsep%
}
\ifbool{exam@boxed}{%
\renewcommand{\examoneblocktop}{\examoneblocktop@box}}{}
%    \end{macrocode}
%\end{macro}
%
%\iffalse
%</classpackage>
%\fi

%\Finale