Debian Codegraph @

texmf-dist/tex/luatex/cloze/cloze-doc.tex

raw
1 \documentclass{ltxdoc}
2 \usepackage[show]{cloze}
3 \usepackage{graphicx}
4 \usepackage{fontspec}
5 \usepackage{paralist}
6 \usepackage{forest}
7 \usepackage{multicol}
8 \usepackage{amsmath}
9 \usepackage{tikz}
10 \usetikzlibrary{positioning}
11
12 %%
13 % Make underscore an "other" character
14 %%
15 \catcode`\_=12
16
17 %%
18 % titlesec
19 %%
20
21 \usepackage{titlesec}
22 \titleformat{\paragraph}[hang]{%
23 \normalfont\normalsize\bfseries%
24 }{\theparagraph}{1em}{}
25 \titleformat{\subparagraph}[hang]{%
26 \normalfont\small\bfseries%
27 }{\thesubparagraph}{1em}{}
28 \titlespacing*{\subparagraph}{0pt}{*1}{0pt}
29
30 %%
31 % hyperref
32 %%
33
34 \usepackage[
35 colorlinks=true,
36 linkcolor=red,
37 filecolor=red,
38 urlcolor=red,
39 ]{hyperref}
40
41 %%
42 % mdframed
43 %%
44
45 \usepackage{mdframed}
46 \definecolor{TmpGray}{gray}{0.95}
47 % f2d6aa 242 214 170
48 \definecolor{TmpYellow}{rgb}{0.949019608, 0.839215686, 0.666666667}
49 \newmdenv[
50 backgroundcolor=TmpYellow!3,
51 linecolor=TmpYellow!70
52 ]{TmpExample}
53 \surroundwithmdframed[backgroundcolor=TmpGray]{verbatim}
54
55 %%
56 % minted
57 %%
58
59 \usepackage{minted}
60 \usemintedstyle{colorful}
61 \BeforeBeginEnvironment{minted}{\begin{mdframed}[
62 backgroundcolor=TmpGray!60,
63 linecolor=gray!40,
64 ]}
65 \AfterEndEnvironment{minted}{\end{mdframed}}
66 \setminted{
67 breaklines=true,
68 fontsize=\footnotesize,
69 }
70
71 \MakeShortVerb{\|}
72
73 %%
74 % Temporary local macros
75 %%
76
77 \def\TmpExpDesc#1{(|#1|)}
78
79 \def\TmpDesc#1{%
80 \hfill%
81 \TmpExpDesc{#1}%
82 \par%
83 }
84
85 \def\tt#1{%
86 \texttt{#1}%
87 }
88
89 \def\TmpSecRef#1{%
90 (\rightarrow\ \ref{#1})%
91 }
92
93 \def\TmpOption#1#2{%
94 \tt{[#1=}\meta{#2}\tt{]}%
95 }
96
97 \def\TmpHide{%
98 \noindent%
99 \texttt{\string\clozehide}:%
100 \clozehide%
101 }
102
103 \def\TmpShow{%
104 \noindent%
105 \texttt{\string\clozeshow}:%
106 \clozeshow%
107 }
108
109 \def\TmpReduceVspace{%
110 \vspace{-0.2cm}%
111 }
112
113 \EnableCrossrefs
114 \CodelineIndex
115 \RecordChanges
116 \begin{document}
117
118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119 %
120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121
122 \providecommand*{\url}{\texttt}
123 \GetFileInfo{cloze.dtx}
124 \title{The \cloze{cloze} package%
125 \thanks{Many thanks to Robert-Michael Huber for his advice
126 and to Paul Isambert for his article \emph{"Three things you can do with
127 Lua\TeX{} that would be extremely painful otherwise"} in TUGboat, Volume
128 31 (2010), No. 3. This article helped a lot to write this package.}%
129 }
130 \author{%
131 Josef Friedrich\\%
132 \url{[email protected]}\\%
133 \href{https://github.com/Josef-Friedrich/cloze}
134 {github.com/Josef-Friedrich/cloze}%
135 }
136 \date{v2.0.0~from 2025/07/04}
137
138 \maketitle\vfill
139
140 \pagebreak
141
142 \setcounter{secnumdepth}{5}
143 \setcounter{tocdepth}{5}
144 \tableofcontents
145
146 %-----------------------------------------------------------------------
147 % Introduction
148 %-----------------------------------------------------------------------
149
150 \pagebreak
151 \section{Introduction}
152
153 \emph{cloze} is a plain \TeX{} or a \LaTeX{} package to generate cloze
154 texts. It uses the capabilities of the modern \TeX{} engine
155 \emph{Lua\TeX}. Therefore, you must use Lua\TeX{} or Lua\LaTeX{} to
156 create documents containing gaps.
157
158 \begin{center}
159 \begin{minipage}{0.4\linewidth}
160 \begin{verbatim}
161 lualatex cloze-text.tex
162 \end{verbatim}
163 \end{minipage}
164 or
165 \begin{minipage}{0.4\linewidth}
166 \begin{verbatim}
167 luatex cloze-text.tex
168 \end{verbatim}
169 \end{minipage}
170 \end{center}
171
172 \noindent
173 The main feature of the package is that the formatting doesn't change
174 when using the |hide| and |show| \TmpSecRef{sec:option-hide} options.
175
176 \def\clozelorem{%
177 Lorem ipsum \cloze{dolor sit} amet, consectetur \cloze{adipisicing}
178 elit, sed do eiusmod tempor incididunt ut labore et \cloze{dolore magna}
179 aliqua. Ut enim ad minim veniam, quis nostrud \cloze{exercitation}
180 ullamco laboris nisi ut \cloze{aliquip} ex ea commodo consequat.%
181 }
182
183 \begin{TmpExample}
184 \clozelorem
185 \end{TmpExample}
186
187 \clozeset{hide}
188
189 \noindent
190 The command |\clozeset{hide}| only shows gaps. When you put both texts
191 on top of each other you will see that they perfectly match.
192
193 \begin{TmpExample}
194 \clozelorem
195 \end{TmpExample}
196
197 \clozeset{show}
198
199 %-----------------------------------------------------------------------
200 % Usage
201 %-----------------------------------------------------------------------
202
203 \section{Usage}
204
205 %-----------------------------------------------------------------------
206 %
207 %-----------------------------------------------------------------------
208
209 \subsection{Interfaces}
210
211 %%
212 %
213 %%
214
215 \subsubsection{The plain (Lua)\TeX{} interface}
216
217 % Dank \href{https://ctan.org/pkg/lparse}{lparse} sollten die meisten
218 % Kommandos in plain Lua\TeX{} genauso funktionieren wie in Lua\LaTeX{}.
219 Thanks to \href{https://ctan.org/pkg/lparse}{lparse}, most
220 commands should work in plain Lua\TeX{} just like in Lua\LaTeX{}.
221 % In Lua\TeX{} gibt es jedoch keine Umgebungen.
222 However, there are no environments in Lua\TeX{}.
223
224 \begin{minted}{tex}
225 \input cloze.tex
226 \clozeset{margin=1cm}
227 \clozeshow
228 Lorem \cloze{ipsum} dolor.
229 \bye
230 \end{minted}
231
232 %%
233 %
234 %%
235
236 \subsubsection{The (Lua)\LaTeX{} interface}
237
238 \begin{minted}{latex}
239 \documentclass{article}
240 \usepackage[show,margin=1cm]{cloze}
241 \begin{document}
242 Lorem \cloze{ipsum} dolor.
243 \end{document}
244 \end{minted}
245
246 \subsection{The commands and environments}
247
248 There are the commands
249 \cmd{\cloze},
250 \cmd{\clozefix},
251 \cmd{\clozefil},
252 \cmd{\clozenol},
253 \cmd{\clozeparcapture},
254 \cmd{\clozestrike} and the environments
255 |clozepar| and
256 |clozebox|
257 to generate cloze texts.
258
259 %%
260 % \cloze
261 %%
262
263 \subsubsection{\cmd{\cloze}}
264 \label{sec:command-cloze}
265
266 \DescribeMacro{\cloze} \cmd{\cloze}\oarg{options}\marg{some text}: The
267 command \cmd{\cloze} is similar to a command that offers the possibility
268 to underline the texts. \cmd{\cloze} does not prevent line breaks. The
269 width of a gap depends on the number of letters and the font used.
270 The only option which affects the widths of a gap is the option
271 |margin| \TmpSecRef{sec:option-margin}.
272
273 \begin{TmpExample}
274 Lorem ipsum \cloze{dolor} sit amet, \cloze{consectetur} adipisicing
275 elit, sed do eiusmod tempor incididunt ut labore et dolore
276 \cloze{magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
277 ullamco laboris nisi} ut aliquip ex ea commodo consequat.
278 \end{TmpExample}
279
280 \noindent It is possible to convert a complete paragraph into a `gap'.
281 But don't forget: There is a special environment for this: \tt{clozepar}
282 \TmpSecRef{sec:command-clozepar}.
283
284 \begin{TmpExample}
285 \cloze{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
286 eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
287 minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
288 ex ea commodo consequat.}
289 \end{TmpExample}
290
291 \noindent The command \cmd{\cloze} doesn’t (better shouldn’t) change
292 the behavior of the hyphenation. Let’s try some long German words (Known
293 issue: Sometimes you have to insert manual hyphenation points (|\-|). I
294 don’t know why. Solutions and suggestions are very welcome.):
295
296 \begin{TmpExample}
297 es
298 \cloze{Te\-le\-kom\-mu\-ni\-ka\-tions\-ü\-ber\-wach\-ung}
299 geht
300 \cloze{Un\-ter\-neh\-mens\-steu\-er\-fort\-ent\-wick\-lungs\-ge\-setz}
301 \cloze{Ab\-teil\-ungs\-lei\-ter\-in}
302 \cloze{Ober\-kom\-mi\-sar\-in}
303 auch
304 \cloze{Fil\-lial\-lei\-ter\-in}
305 kurz.
306 \end{TmpExample}
307
308 %%
309 % \clozesetfont
310 %%
311
312 \subsubsection{\cmd{\clozesetfont}}
313 \label{sec:command-clozesetfont}
314 \label{sec:command-clozefont}
315
316 \DescribeMacro{\clozesetfont}
317 The gap font can be changed by using the command
318 \cmd{\clozesetfont}. \tt{\string\cloze\-set\-font} redefines the command
319 \cmd{\clozefont} which contains the font definition.
320 Thus, the command \tt{\string\clozesetfont\string{\string\Large\string}}
321 has the same effect as
322 |\def\clozefont{\Large}|.
323
324 \clozesetfont{\Large}
325
326 \begin{TmpExample}
327 Excepteur \cloze{sint} occaecat \cloze{cupidatat} non proident.
328 \end{TmpExample}
329
330 \noindent Please do not put any color definitions in
331 \cmd{\clozesetfont}, as it won't work. Use the option
332 |text_color| instead \TmpSecRef{sec:option-text-color}.
333
334 |\clozesetfont{\ttfamily\normalsize}| changes the gap text for example
335 into a normal sized typewriter font.
336
337 \clozesetfont{\ttfamily\normalsize}
338
339 \begin{TmpExample}
340 Excepteur \cloze{sint} occaecat \cloze{cupidatat} non proident.
341 \end{TmpExample}
342
343 \clozesetfont{\itshape}
344
345 \noindent
346 If you use clozes in math mode you have to overwrite the default cloze
347 font (|\clozesetfont{\itshape}|) of the package, because \cmd{\itshape}
348 is not available in math mode. |\clozesetfont{}| will do the
349 trick.
350
351 %%
352 % \clozefix
353 %%
354
355 \subsubsection{\cmd{\clozefix}}
356 \label{sec:command-clozefix}
357
358 \DescribeMacro{\clozefix} \cmd{\clozefix}\oarg{options}\marg{some text}:
359 The command \cmd{\clozefix} creates gaps with a fixed width. The
360 clozes are default concering the width \tt{\ClozeGetOption{width}}.
361
362 \begin{TmpExample}
363 \noindent Lorem ipsum dolor sit amet:
364 \begin{compactenum}
365 \item \clozefix[width=5cm]{consectetur}
366 \item \clozefix[width=5cm]{adipisicing}
367 \item \clozefix[width=5cm]{elit}
368 \end{compactenum}
369 sed do eiusmod.
370 \end{TmpExample}
371
372 \noindent
373 Gaps with a fixed width are much harder to solve.
374
375 \begin{TmpExample}
376 Lorem ipsum dolor \clozefix[align=center,width=3cm]{sit} amet,
377 \clozefix[align=center,width=3cm]{consectetur} adipisicing elit, sed do
378 eiusmod tempor incididunt \clozefix[align=center,width=3cm]{ut} labore
379 et dolore magna aliqua.
380 \end{TmpExample}
381
382 \noindent
383 Using the option |align| you can make nice tabulars like this:
384
385 \begin{TmpExample}
386 \begin{tabular}{p{5cm}p{4cm}}
387 \raggedleft Composer & Life span \\
388
389 \clozefix[width=5cm,align=right]{Joseph Haydn} &
390 \clozefix{1723-1809} \\
391
392 \clozefix[width=5cm,align=right]{Wolfgang Amadeus Mozart} &
393 \clozefix{1756-1791} \\
394
395 \clozefix[width=5cm,align=right]{Ludwig van Beethoven} &
396 \clozefix{1770-1827} \\
397 \end{tabular}
398 \end{TmpExample}
399
400 %%
401 % \clozenol
402 %%
403
404 \subsubsection{\cmd{\clozenol}}
405 \label{sec:command-clozenol}
406 \DescribeMacro{\clozenol} \cmd{\clozenol}\oarg{options}\marg{some text}:
407 The macro name |clozenol| stands for \emph{“cloze no line”}. As the
408 the name suggests this macro typesets cloze texts without a line.
409 \cmd{\clozenol} is a convenient abbreviation for
410 |\cloze[thickness=0pt]{text}|.
411
412 \begin{minted}{latex}
413 Lorem \clozenol{ipsum dolor} sit amet.
414 \end{minted}
415
416 \begin{TmpExample}
417 Lorem \clozenol{ipsum dolor} sit amet.
418 \end{TmpExample}
419
420 \begin{minted}{latex}
421 Lorem \clozenol[text_color=green]{ipsum dolor} sit amet.
422 \end{minted}
423
424 \begin{TmpExample}
425 Lorem \clozenol[text_color=green]{ipsum dolor} sit amet.
426 \end{TmpExample}
427
428 \noindent
429 The next examples are showing that \cmd{\clozenol} behaves exactly as
430 \cmd{\clozenol} with the option |thickness=0pt|
431 (|\cloze[thickness=0pt]|) set: The text layout doesn’t change if we are
432 hiding the gaps and the hidden text is not really hidden. It is removed.
433 It can not be copied.
434
435 \begin{mdframed}[backgroundcolor=gray!40]
436 Lorem ipsum \clozenol{dolor sit amet, consetetur sadipscing elitr, sed
437 diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
438 erat, sed diam voluptua} sit amet.
439 \end{mdframed}
440
441 \noindent
442 Now hide the text
443
444 \clozehide
445
446 \begin{mdframed}[backgroundcolor=gray!40]
447 Lorem ipsum \clozenol{dolor sit amet, consetetur sadipscing elitr, sed
448 diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
449 erat, sed diam voluptua} sit amet.
450 \end{mdframed}
451
452 \clozeshow
453
454 %%
455 % \clozefil
456 %%
457
458 \subsubsection{\cmd{\clozefil}}
459 \label{sec:command-clozefil}
460
461 \DescribeMacro{\clozefil} \cmd{\clozefil}\oarg{options}\marg{some text}:
462 The name of the command is inspired by \cmd{\hfil}, \cmd{\hfill}, and
463 \cmd{\hfilll}. \cmd{\clozefil} fills out all available horizontal
464 space with a line. The macros \cmd{\clozefill} and \cmd{\clozefilll}
465 doesn’t exist, only \cmd{\clozefil} (with one |l|) does.
466
467 \def\TmpExampleClozefil{
468 Complete the sentences below to share more about yourself:
469 \bigskip
470
471 \noindent
472 I am someone who love \clozefil{to write cloze worksheets in \TeX}.
473
474 \noindent
475 I am someone who hate \clozefil{to write cloze worksheets in MS Word}.
476
477 \noindent
478 I am someone who can \clozefil{write cloze worksheets in \TeX}.
479
480 \noindent
481 I am someone who can’t \clozefil{write cloze worksheets in MS Word}.
482 }
483
484 \bigskip
485
486 \TmpHide
487 \begin{TmpExample}
488 \TmpExampleClozefil
489 \end{TmpExample}
490
491 \TmpShow
492 \begin{TmpExample}
493 \TmpExampleClozefil
494 \end{TmpExample}
495
496 %%
497 % \clozeextend
498 %%
499
500 \subsubsection{\cmd{\clozeextend}}
501 \label{sec:command-clozeextend}
502
503 \DescribeMacro{\clozeextend} \cmd{\clozeextend}\oarg{spaces}: The
504 command |\clozeextend| adds some invisible placeholders to extend some
505 cloze texts with blank space. Keep in mind that there is the option
506 \tt{min_lines} \TmpSecRef{sec:option-min-lines}, if you want to extend
507 some cloze paragraphs.
508 % Die zugehörigen Optionen sind:
509 The associated options are:
510
511 \begin{description}
512 \item[|extension_count|]: The number of extension units
513 \TmpSecRef{sec:option-extend-count}.
514
515 \item[|extension_height|]:
516 The height of one extension unit (default: 2ex)
517 \TmpSecRef{sec:option-extend-height}.
518
519 \item[|extension_width|]:
520 The width of one extension unit (default: 1em)
521 \TmpSecRef{sec:option-extend-width}.
522 \end{description}
523
524 \begin{minted}{latex}
525 \begin{itemize}
526 \item \clozefil{Lorem ipsum dolor sit amet, consectetur adipisicing
527 elit, sed do eiusmod tempor incididunt ut labore et dolore magna
528 aliqua.}
529 \item \clozefil{Ut enim ad minim veniam \clozeextend[30]}
530 \item \clozefil{quis nostrud \clozeextend[40]}
531 \end{itemize}
532 \end{minted}
533
534 \begin{TmpExample}
535 \begin{itemize}
536 \item \clozefil{Lorem ipsum dolor sit amet, consectetur adipisicing
537 elit, sed do eiusmod tempor incididunt ut labore et dolore magna
538 aliqua.}
539 \item \clozefil{Ut enim ad minim veniam \clozeextend[30]}
540 \item \clozefil{quis nostrud \clozeextend[40]}
541 \end{itemize}
542 \end{TmpExample}
543
544 %%
545 % clozepar
546 %%
547
548 \subsubsection{\tt{clozepar}}
549 \label{sec:command-clozepar}
550
551 \DescribeEnv{clozepar} |\begin{clozepar}|\oarg{options} \dots
552 \textit{some text} \dots |\end{clozepar}|: The environment \tt{clozepar}
553 transforms a complete paragraph into a cloze text. The options |align|,
554 |margin| and |width| have no effect on this environment.
555
556 \begin{TmpExample}
557 Lorem ipsum dolor sit amet, consectetur adipisicing elit ullamco laboris
558 nisi.
559
560 \begin{clozepar}
561 Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
562 ut aliquip ex ea commodo consequat. Duis aute irure dolor in
563 reprehenderit in voluptate velit esse cillum.
564 \end{clozepar}
565
566 Excepteur sint occaecat cupidatat non proident.
567 \end{TmpExample}
568
569 %%
570 % \clozeparplain
571 %%
572
573 \subsubsection{\cmd{\clozeparplain}}
574 \label{sec:command-clozeparplain}
575 \DescribeMacro{\clozeparplain} \cmd{\clozeparplain}: The command
576 \cmd{\clozeparplain} is the macro version of the environment |clozepar|
577 \TmpSecRef{sec:command-clozepar}. It is intended to provide cloze
578 support on full paragraphs in plain Lua\TeX.
579
580 %%
581 % \clozeparcapture
582 %%
583
584 \subsubsection{\cmd{\clozeparcapture}}
585 \label{sec:command-clozeparcapture}
586 \DescribeMacro{\clozeparcapture} \cmd{\clozeparcapture}: The command is
587 defined to capture all text until the next paragraph (|\par|):
588 \mintinline{latex}{\def\clozeparcapture#1\par{...}}. In some cases (see
589 example below) you have to set the paragraph end manually by inserting a
590 |\par|.
591
592 \begin{minted}{latex}
593 \begin{enumerate}
594 \item Solid state drives (SSD) ...
595
596 \clozeparcapture
597 They do not need to get up to speed to work properly / No latency;
598 ...
599 \par
600
601 \end{enumerate}
602 \end{minted}
603
604 \TmpReduceVspace
605
606 % https://www.bitsofbytes.co/exam-questions---memory--storage.html
607 \begin{TmpExample}
608 \begin{enumerate}
609 \item Solid state drives (SSD) are replacing hard disc drives (HDD) in
610 some computers. Give some reasons why this is happening.
611
612 \clozeparcapture
613 They do not need to get up to speed to work properly / No latency;
614 Less power consumption / More energy efficient;
615 Run cooler;
616 Run quieter;
617 Data access is faster;
618 Occupies less physical space - more compact;
619 Lighter, so suitable for portable computer / laptop;
620 No moving parts so more reliable / durable in a portable computer / laptop.
621 \par
622 \end{enumerate}
623 \end{TmpExample}
624
625 \noindent
626 It is often sufficient to insert an empty line.
627
628 \begin{minted}{latex}
629 Explain three ways that RAM is different to ROM.
630
631 1:
632
633 \clozeparcapture RAM is Volatile, ROM is non-volatile
634
635 2:
636 \end{minted}
637
638 \TmpReduceVspace
639 % https://www.bitsofbytes.co/exam-questions---memory--storage.html
640 \begin{TmpExample}
641 \noindent
642 Explain three ways that RAM is different to ROM.
643
644 \def\TmpWay#1{\medskip\noindent\textbf{#1:}\medskip}
645
646 \TmpWay{1}
647
648 \clozeparcapture RAM is Volatile, ROM is non-volatile
649
650 \TmpWay{2}
651
652 \clozeparcapture RAM is temporary, ROM is (semi) permanent
653
654 \TmpWay{3}
655
656 \clozeparcapture RAM normally has a larger capacity than ROM \par
657 \end{TmpExample}
658
659 %%
660 % clozebox
661 %%
662
663 \subsubsection{\tt{clozebox}}
664 \label{sec:environment-clozebox}
665
666 \DescribeEnv{clozebox} |\begin{clozebox}|*\oarg{options} \dots
667 \textit{some text} \dots |\end{clozebox}|: The environment \tt{clozebox}
668 surrounds a text with a box. The starred version omits the line around
669 the box. Use the options |box_height| \TmpSecRef{sec:option-box-height}
670 and |box_width| \TmpSecRef{sec:option-box-width} to specify the dimensions
671 of the box. By default the width of the box is |\linewidth|. The height
672 of the box is determined by the amount of text. This environment is
673 realized by a combination of the |minipage| environment surrounded by a
674 \cmd{\fbox}. For the cloze text the macro \cmd{\clozenol} is reused. New
675 paragraphs are not allowed inside a cloze box. Use two backslashes
676 multiple times |\\| instead.
677
678 \begin{minted}{latex}
679 \begin{clozebox}
680 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
681 tempor incididunt ut labore et dolore magna aliqua.
682 \end{clozebox}
683 \end{minted}
684
685 \begin{multicols}{2}
686 \TmpHide
687
688 \begin{TmpExample}
689 \begin{clozebox}
690 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
691 tempor incididunt ut labore et dolore magna aliqua.
692 \end{clozebox}
693 \end{TmpExample}
694
695 \columnbreak
696
697 \TmpShow
698
699 \begin{TmpExample}
700 \begin{clozebox}
701 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
702 tempor incididunt ut labore et dolore magna aliqua.
703 \end{clozebox}
704 \end{TmpExample}
705
706 \end{multicols}
707
708 \noindent
709 Like with all cloze macros and environments the hidden text vanishes
710 from the rendered file. The starred version omits the line around the
711 box:
712
713 % starred
714
715 \begin{multicols}{2}
716 \begin{minted}{latex}
717 \begin{clozebox}*
718 Lorem ...
719 \end{clozebox}
720 \end{minted}
721
722 \columnbreak
723
724 \begin{TmpExample}
725 \begin{center}
726 \begin{clozebox}*
727 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
728 tempor incididunt ut labore et dolore magna aliqua.
729 \end{clozebox}
730 \end{center}
731 \end{TmpExample}
732 \end{multicols}
733
734 %%
735 % clozespace
736 %%
737
738 \subsubsection{\tt{clozespace}}
739 \label{sec:command-clozespace}
740
741 \DescribeEnv{clozespace} |\begin{clozespace}|\oarg{options} \dots
742 \textit{some text} \dots |\end{clozespace}|: If you are using a
743 bigger font for the cloze text as for the normal text, you are getting
744 irregular distances between the lines:
745
746 \def\TmpOrbit{
747 \clozesetfont{\Huge\fontspec{Kalam}}
748 Today in the Discovery Lab we learned about three types of spacecraft
749 that are helping us explore \cloze{Mars}. The \cloze{spacecraft} are on
750 Mrs. Bratt’s Principal’s Reading Challenge board. One type of spacecraft
751 is the \cloze{orbiter}.
752 }
753
754 \begin{minted}{latex}
755 \clozesetfont{\Huge\fontspec{Kalam}}
756 Today in the Discovery ...
757 \end{minted}
758 \TmpReduceVspace
759 % https://en.wikipedia.org/wiki/Cloze_test#/media/File:Student_matching_cloze_terms_on_smartboard.jpg
760 \begin{TmpExample}
761 \TmpOrbit
762 \end{TmpExample}
763
764 \noindent
765 With the environment |clozespace| you are able to restore the regular
766 balanced line spacing. The default value for the option |spacing| is
767 \tt{\ClozeGetOption{spacing}}. Also take a look in the section about the
768 option |spacing| \TmpSecRef{sec:option-spacing}.
769
770 \begin{minted}{latex}
771 \begin{clozespace}[spacing=2]
772 ...
773 \end{clozespace}
774 \end{minted}
775 \TmpReduceVspace
776 \begin{TmpExample}
777 \begin{clozespace}[spacing=2]
778 \TmpOrbit
779 \end{clozespace}
780 \TmpReduceVspace
781 \end{TmpExample}
782
783 \noindent
784 The environment |clozespace| uses the package
785 \href{https://www.ctan.org/pkg/setspace}{setspace} in the background for
786 setting the spacing between the lines.
787
788 %%
789 % \clozeline
790 %%
791
792 \subsubsection{\cmd{\clozeline}}
793 \label{sec:command-clozeline}
794
795 \DescribeMacro{\clozeline}
796 %
797 \cmd{\clozeline}\oarg{options}: To create a cloze line of a certain
798 width, use the command \cmd{\clozeline}. The default width of the line
799 is \tt{\ClozeGetOption{width}}. In combination with the other cloze
800 commands you can create for example an irregular alignment of the cloze
801 text.
802
803 \begin{minted}{latex}
804 Ut enim ad
805 \clozeline[width=1cm]\cloze{minim}\clozeline[width=3cm]
806 minim veniam
807 \end{minted}
808
809 \begin{TmpExample}
810 Ut enim ad \clozeline[width=1cm]\cloze{minim}\clozeline[width=3cm] minim
811 veniam,
812 \end{TmpExample}
813
814 %%
815 % \clozelinefil
816 %%
817
818 \subsubsection{\cmd{\clozelinefil}}
819 \label{sec:command-clozelinefil}
820
821 \DescribeMacro{\clozelinefil}
822 \cmd{\clozelinefil}\oarg{options}:
823 This command \cmd{\clozelinefil} fills the
824 complete available horizontal space with a line. Moreover,
825 \cmd{\clozelinefil} was used to create \cmd{\clozefil}.
826
827 \begin{TmpExample}
828 Lorem\clozelinefil
829 \end{TmpExample}
830
831 %%
832 % \clozestrike
833 %%
834
835 \subsubsection{\cmd{\clozestrike}}
836 \label{sec:command-clozestrike}
837
838 \DescribeMacro{\clozestrike}
839 \cmd{\clozestrike}\oarg{options}\marg{wrong text}\marg{correct text}:
840 This macro can be useful for worksheets that contain intentionally
841 errors. The pupils have to find and cross out the mistakes and
842 write the right solution on top of the errors.
843
844 \begin{minted}{latex}
845 Wolfgang Amadeus Mozart was born in \clozestrike{Vienna}{Salzburg}.
846 \end{minted}
847
848 \begin{TmpExample}
849 Wolfgang Amadeus Mozart was born in \clozestrike{Vienna}{Salzburg}.
850 \end{TmpExample}
851
852 \noindent
853 The option |line_color| has no effect on the lines produced by the
854 macro \cmd{\clozestrike}. The line color and and the text color
855 are both the same, because the pupils have to draw the lines.
856
857 \begin{minted}{latex}
858 Mozart’s father was called
859 \clozestrike[text_color=red]{Ludwig}{Leopold} Mozart.
860 \end{minted}
861
862 \begin{TmpExample}
863 Mozart’s father was called
864 \clozestrike[text_color=red]{Ludwig}{Leopold} Mozart.
865 \end{TmpExample}
866
867 %-----------------------------------------------------------------------
868 % Options
869 %-----------------------------------------------------------------------
870
871 \subsection{The options}
872
873 \subsubsection{Overview over all options}
874
875 \def\TmpDescriptionLine#1{
876 {\footnotesize#1}
877 }
878
879 \begin{tabular}{lll}
880 \textbf{Option} &
881 \textbf{Description} &
882 \textbf{Reference} \\\hline
883
884 \tt{align} &
885 \TmpDescriptionLine{The alignment of a fixed-size cloze text (\cmd{\clozefix})}. &
886 \TmpSecRef{sec:option-align} \\
887
888 \tt{box_height} &
889 \TmpDescriptionLine{The height of a cloze box (\tt{clozebox}).} &
890 \TmpSecRef{sec:option-box-height} \\
891
892 \tt{box_rule} &
893 \TmpDescriptionLine{The thickness of the line around a \tt{clozebox}.} &
894 \TmpSecRef{sec:option-box-rule} \\
895
896 \tt{box_width} &
897 \TmpDescriptionLine{The width of a cloze box (\tt{clozebox}).} &
898 \TmpSecRef{sec:option-box-width} \\
899
900 \tt{debug} &
901 \TmpDescriptionLine{The debug or log level.} &
902 \TmpSecRef{sec:option-debug} \\
903
904 \tt{distance} &
905 \TmpDescriptionLine{The distance between the cloze text and the cloze line.} &
906 \TmpSecRef{sec:option-distance} \\
907
908 \tt{extend_count} &
909 \TmpDescriptionLine{The number of extension units (\cmd{\clozeextend}).} &
910 \TmpSecRef{sec:option-extend-count} \\
911
912 \tt{extend_height} &
913 \TmpDescriptionLine{The height of one extension unit (\cmd{\clozeextend}).} &
914 \TmpSecRef{sec:option-extend-height} \\
915
916 \tt{extend_width} &
917 \TmpDescriptionLine{The width of one extension unit (\cmd{\clozeextend}).} &
918 \TmpSecRef{sec:option-extend-width} \\
919
920 \tt{hide} &
921 \TmpDescriptionLine{Hide the cloze text.} &
922 \TmpSecRef{sec:option-hide} \\
923
924 \tt{font} &
925 \TmpDescriptionLine{The font of the cloze text.} &
926 \TmpSecRef{sec:option-font} \\
927
928 \tt{line_color} &
929 \TmpDescriptionLine{The color name to colorize the cloze line.} &
930 \TmpSecRef{sec:option-line-color} \\
931
932 \tt{margin} &
933 \TmpDescriptionLine{The additional margin between the normal and the cloze text.} &
934 \TmpSecRef{sec:option-margin} \\
935
936 \tt{min_lines} &
937 \TmpDescriptionLine{The minimum number of lines a \tt{clozepar} environment must have.} &
938 \TmpSecRef{sec:option-min-lines} \\
939
940 \tt{show} &
941 \TmpDescriptionLine{Show the cloze text.} &
942 \TmpSecRef{sec:option-show} \\
943
944 \tt{spacing} &
945 \TmpDescriptionLine{The spacing of the lines in the environment \tt{clozespace}.} &
946 \TmpSecRef{sec:option-spacing} \\
947
948 \tt{spread} &
949 \TmpDescriptionLine{The magnification or spreading factor of a gap.} &
950 \TmpSecRef{sec:option-spread} \\
951
952 \tt{text_color} &
953 \TmpDescriptionLine{The color name to colorize the cloze text.} &
954 \TmpSecRef{sec:option-text-color} \\
955
956 \tt{thickness} &
957 \TmpDescriptionLine{The thickness of a line.} &
958 \TmpSecRef{sec:option-thickness} \\
959
960 \tt{width} &
961 \TmpDescriptionLine{The width of a fixed size cloze (\cmd{\clozefix}).} &
962 \TmpSecRef{sec:option-show} \\
963
964 \tt{visibility} &
965 \TmpDescriptionLine{The visibility of the cloze text.} &
966 \TmpSecRef{sec:option-visibility} \\
967 \end{tabular}
968
969 %%
970 %
971 %%
972
973 \noindent
974 \begin{tikzpicture}[x=1cm,y=1cm,scale=0.8,transform shape]
975 % \draw (0,0) grid[step=1] (13,8);
976 % \draw[help lines] (0,0) grid[step=0.2] (13,8);
977 \node (cloze) at (-1,0) [node font=\fontsize{180}{1.2},anchor=south west]{
978 \cloze[distance=15pt,thickness=3pt,margin=40pt]{cl…}
979 };
980
981 \node (distance) at (3,1.9) {distance};
982 \draw [|<->|] (4,1.7) -- (4,2.05);
983
984 \node (thickness) at (0,1.65) {thickness};
985 \draw [->] (1.3,2.2) -- (1.3,1.8);
986 \draw [->] (1.3,1) -- (1.3,1.4);
987
988 \node (margin) at (2.2,4) {margin};
989 \draw [|<->|] (1.5,3.5) -- (3,3.5);
990
991 \node (margin) at (11.75,4) {margin};
992 \draw [|<->|] (11,3.5) -- (12.5,3.5);
993
994 \node (text_color) at (4.5,6) {text_color};
995 \draw [->] (text_color) -- (6.4,5);
996
997 \node (line_color) at (7,0.5) {line_color};
998 \draw [->] (line_color) -- (7,1.5);
999 \end{tikzpicture}
1000
1001 %%
1002 % clozefix
1003 %%
1004
1005 \noindent
1006 \begin{tikzpicture}[
1007 x=1cm,
1008 y=1cm,
1009 clozefix/.style={
1010 node font=\fontsize{40}{1.2}
1011 },
1012 scale=0.95,
1013 transform shape
1014 ]
1015 % \draw (0,0) grid[step=1] (13,7);
1016 % \draw[help lines] (0,0) grid[step=0.2] (13,7);
1017
1018 \node (right) at (7,6) [clozefix]{
1019 \clozefix[distance=10pt,thickness=2pt,width=8cm,align=right]{clozefix}
1020 };
1021
1022 \node (center) at (5,4) [clozefix]{
1023 \clozefix[distance=10pt,thickness=2pt,width=8cm,align=center]{clozefix}
1024 };
1025
1026 \node (left) at (3,2) [clozefix]{
1027 \clozefix[distance=10pt,thickness=2pt,width=8cm]{clozefix}
1028 };
1029
1030 \node (width) at (5,0.7) {width};
1031 \draw [|<->|] (0.8,1) -- (8.7,1);
1032 \node (alignleft) at (6.5,2) {align=left};
1033
1034 \node (aligncenter) at (3.3,4) {align=center};
1035
1036 \node (alignright) at (7,6) {align=right};
1037 \end{tikzpicture}
1038 \clozereset
1039
1040 \begin{tikzpicture}
1041 % \draw (0,0) grid[step=1] (12,7);
1042 % \draw[help lines] (0,0) grid[step=0.2] (12,7);
1043 \node (onlytikz) at (6,3.5) [draw,text width=3cm,scale=3,transform shape,thick] {
1044 \clozeparplain[min_lines=3,]{clozebox}
1045 };
1046
1047 \node (box_height) at (0.5,3.5) [rotate=90] {box_height};
1048 \draw [|<->|] (1,1.05) -- (1,5.95);
1049
1050 \node (box_width) at (6,0.5){box_width};
1051 \draw [|<->|] (1.15,0.9) -- (10.85,0.9);
1052 \end{tikzpicture}
1053
1054 %%
1055 % Local and global options
1056 %%
1057
1058 \subsubsection{Local and global options}
1059
1060 The \emph{cloze} package distinguishs between \emph{local} and
1061 \emph{global} options. Besides the possiblity to set \emph{global}
1062 options in the \cmd{\usepackage}\oarg{global options}\marg{cloze}
1063 declaration, the cloze package offers a special command to set
1064 \emph{global} options:
1065 \cmd{\clozeset}\marg{global options}
1066
1067 %%
1068 % \clozeset
1069 %%
1070
1071 \subsubsection{\cmd{\clozeset}}
1072 \label{sec:command-clozeset}
1073
1074 \DescribeMacro{\clozeset}
1075 \cmd{\clozeset}\marg{global options}: The command can set \emph{global}
1076 options for each paragraph.
1077
1078 \begin{minted}{latex}
1079 \clozeset{text_color=red} Lorem \cloze{ipsum} dolor \par
1080 \clozeset{text_color=green} Lorem \cloze{ipsum} dolor
1081 \end{minted}
1082
1083 \begin{TmpExample}
1084 \clozeset{text_color=red} Lorem \cloze{ipsum} dolor \par
1085 \clozeset{text_color=green} Lorem \cloze{ipsum} dolor
1086 \end{TmpExample}
1087
1088 \noindent \cmd{\clozeset} does not change the options within a
1089 paragraph. As you can see in the example below the last \cmd{\clozeset}
1090 applies the color green for both gaps.
1091
1092 \begin{minted}{latex}
1093 \clozeset{text_color=red} Lorem \cloze{ipsum} dolor
1094 \clozeset{text_color=green} Lorem \cloze{ipsum} dolor
1095 \end{minted}
1096
1097 \begin{TmpExample}
1098 \clozeset{text_color=red} Lorem \cloze{ipsum} dolor
1099 \clozeset{text_color=green} Lorem \cloze{ipsum} dolor
1100 \end{TmpExample}
1101
1102 \clozereset
1103
1104 %%
1105 % \clozereset
1106 %%
1107
1108 \subsubsection{\cmd{\clozereset}}
1109 \label{sec:command-clozereset}
1110
1111 \DescribeMacro{\clozereset}
1112 \cmd{\clozereset}: The command resets all \emph{global} options to the
1113 default values. It has no effect on the \emph{local} options.
1114
1115 \begin{minted}{latex}
1116 \clozeset{
1117 thickness=3mm,
1118 line_color=yellow,
1119 text_color=magenta,
1120 margin=-2pt
1121 }
1122 \end{minted}
1123
1124 \clozeset{thickness=3mm,line_color=yellow,text_color=magenta,margin=-2pt}
1125
1126 \begin{TmpExample}
1127 Very \cloze{silly} global \cloze{options}.
1128 \end{TmpExample}
1129
1130 \begin{minted}{latex}
1131 \clozereset
1132 \end{minted}
1133 \clozereset
1134
1135 \begin{TmpExample}
1136 \cloze{Relax!} We can reset \cloze{those} options.
1137 \end{TmpExample}
1138
1139 %%
1140 % \clozereset
1141 %%
1142
1143 \subsubsection{\cmd{\clozeshow} and \cmd{\clozehide}}
1144 \label{sec:command-clozeshow}
1145 \label{sec:command-clozehide}
1146
1147 \DescribeMacro{\clozeshow} \DescribeMacro{\clozehide}
1148 \cmd{\clozeshow} and \cmd{\clozehide}: This commands are shortcuts for
1149 \cmd{\clozeset}\marg{show} and \cmd{\clozeset}\marg{hide}.
1150
1151 \begin{minted}{latex}
1152 \clozehide
1153 \end{minted}
1154 \clozehide
1155
1156 \begin{TmpExample}
1157 Lorem \cloze{ipsum dolor sit} amet, consectetur \cloze{adipisicing}
1158 elit.
1159 \end{TmpExample}
1160
1161 \begin{minted}{latex}
1162 \clozeshow
1163 \end{minted}
1164 \clozeshow
1165
1166 \begin{TmpExample}
1167 Lorem \cloze{ipsum dolor sit} amet, consectetur \cloze{adipisicing}
1168 elit.
1169 \end{TmpExample}
1170
1171 %%
1172 % align
1173 %%
1174
1175 \subsubsection{\tt{align}}
1176 \label{sec:option-align}
1177
1178 \TmpOption{align}{left/center/right}:
1179 %
1180 Only the macro \cmd{\clozefix} \TmpSecRef{sec:command-clozefix} takes
1181 the option \tt{align} into account. Possible values are \tt{left},
1182 \tt{center} and \tt{right}. This option only makes sense, if the width
1183 of the line is larger than the width of the text.
1184
1185 \def\TmpOptionAlign#1{%
1186 \noindent%
1187 \clozefix[align=#1,width=8cm]{Lorem ipsum}%
1188 \TmpDesc{#1}%
1189 }
1190
1191 \begin{TmpExample}
1192 \TmpOptionAlign{left}
1193 \TmpOptionAlign{center}
1194 \TmpOptionAlign{right}
1195 \end{TmpExample}
1196
1197 %%
1198 % box_height
1199 %%
1200
1201 \subsubsection{\tt{box_height}}
1202 \label{sec:option-box-height}
1203
1204 \TmpOption{box_height}{dimen}:
1205 specifies the height of a cloze box. This
1206 option has only an effect on the environment |clozebox|
1207 \TmpSecRef{sec:environment-clozebox}.
1208
1209 \begin{minted}{latex}
1210 \begin{clozebox}[box_height=5cm]
1211 \end{minted}
1212
1213 \TmpReduceVspace
1214
1215 \begin{TmpExample}
1216 \bigskip
1217 \begin{center}
1218 \begin{clozebox}[box_height=3cm,box_width=3cm]
1219 box_height: 3cm; Lorem ipsum dolor sit amet ...
1220 \end{clozebox}
1221 \begin{clozebox}[box_height=2cm,box_width=3cm]
1222 box_height: 2cm; Lorem ipsum dolor sit amet ...
1223 \end{clozebox}
1224 \begin{clozebox}[box_height=1cm,box_width=3cm]
1225 box_height: 1cm; Lorem ipsum dolor sit amet ...
1226 \end{clozebox}
1227 \end{center}
1228 \bigskip
1229 \end{TmpExample}
1230
1231 %%
1232 % box_rule
1233 %%
1234
1235 \subsubsection{\tt{box_rule}}
1236 \label{sec:option-box-rule}
1237
1238 \TmpOption{box_rule}{dimen}: specifies the thickness of the rule around a
1239 cloze box. This option has only an effect on the environment |clozebox|
1240 \TmpSecRef{sec:environment-clozebox}.
1241
1242 \begin{minted}{latex}
1243 \begin{clozebox}[box_rule=2pt]
1244 \end{minted}
1245
1246 \TmpReduceVspace
1247
1248 \begin{TmpExample}
1249 \bigskip
1250 \begin{center}
1251 \begin{clozebox}[box_rule=1pt,box_width=3cm]
1252 box_rule: 1pt
1253 \end{clozebox}
1254 \begin{clozebox}[box_rule=2pt,box_width=3cm]
1255 box_rule: 2pt
1256 \end{clozebox}
1257 \begin{clozebox}[box_rule=3pt,box_width=3cm]
1258 box_rule: 3pt
1259 \end{clozebox}
1260 \end{center}
1261 \bigskip
1262 \end{TmpExample}
1263
1264 %%
1265 % box_width
1266 %%
1267
1268 \subsubsection{\tt{box_width}}
1269 \label{sec:option-box-width}
1270
1271 \TmpOption{box_width}{dimen}:
1272 specifies the width of a cloze box. This option has only an
1273 effect on the environment |clozebox| \TmpSecRef{sec:environment-clozebox}.
1274
1275 \begin{minted}{latex}
1276 \begin{clozebox}[box_width=3cm]
1277 \end{minted}
1278
1279 \TmpReduceVspace
1280
1281 \begin{TmpExample}
1282 \bigskip
1283 \begin{center}
1284 \begin{clozebox}[box_width=2.5cm]
1285 box_width: 2.5cm; Lorem ipsum dolor sit amet ...
1286 \end{clozebox}
1287 \begin{clozebox}[box_width=3cm]
1288 box_width: 3cm; Lorem ipsum dolor sit amet ...
1289 \end{clozebox}
1290 \begin{clozebox}[box_width=5cm]
1291 box_width: 4cm; Lorem ipsum dolor sit amet ...
1292 \end{clozebox}
1293 \end{center}
1294 \bigskip
1295 \end{TmpExample}
1296
1297 %%
1298 % debug
1299 %%
1300
1301 \subsubsection{\tt{debug}}
1302 \label{sec:option-debug}
1303
1304 % Die Option |debug| definiert den Debug- oder Log-Level für den
1305 % Lua-Code. Die folgenden Debug-Level können eingestellt werden.
1306 The |debug| option sets the log level. The following debug levels can be
1307 set.
1308 % Es gibt einige Stellen im Lua-Code, an denen Print-Anweisungen
1309 % eingebaut sind, die bei Bedarf Debug-Meldungen auf der Konsole
1310 % ausgeben.
1311 There are a few places in the Lua code where print statements are built
1312 in, which output debug messages to the console if required. The default
1313 value is \tt{\ClozeGetOption{debug}}.
1314
1315 \begin{itemize}
1316 \item 1 (error)
1317 \item 2 (warn)
1318 \item 3 (info)
1319 \item 4 (verbose)
1320 \item 5 (debug)
1321 \end{itemize}
1322
1323 %%
1324 % distance
1325 %%
1326
1327 \subsubsection{\tt{distance}}
1328 \label{sec:option-distance}
1329
1330 \TmpOption{distance}{dimen}:
1331 The option |distance| specifies the spacing between the baseline of the
1332 text and the gap line. The larger the dimension of the option
1333 |distance|, the more moves the line down. Negative values cause the line
1334 to appear above the baseline. The default value is
1335 \tt{\ClozeGetOption{distance}}.
1336
1337 \def\TmpOptionDistance#1{%
1338 \noindent%
1339 \clozefil[distance=#1]{Lorem ipsum dolor sit amet.}
1340 \TmpExpDesc{#1}
1341 \par%
1342 }
1343
1344 \begin{TmpExample}
1345 \TmpOptionDistance{1.5pt}
1346 \TmpOptionDistance{3pt}
1347 \TmpOptionDistance{-3pt}
1348 \end{TmpExample}
1349
1350 \subsubsection{\tt{font}}
1351 \label{sec:option-font}
1352
1353 \TmpOption{font}{cmd}: The option |font| is an alternative to the
1354 commands \cmd{\clozefont} or \cmd{\clozesetfont}. If this option is used
1355 \cmd{\clozefont} or \cmd{\clozesetfont} have no effect. The option can
1356 used as a local or global option, but not as a package option.
1357
1358 \begin{minted}{latex}
1359 Lorem \cloze[font=\Huge]{ipsum} dolor.
1360 \end{minted}
1361
1362 \begin{TmpExample}
1363 Lorem \cloze[font=\Huge]{ipsum} dolor.
1364 \end{TmpExample}
1365
1366 %%
1367 % extend_count
1368 %%
1369
1370 \subsubsection{\tt{extend_count}}
1371 \label{sec:option-extend-count}
1372
1373 \TmpOption{extend_count}{integer}:
1374 % Als lokale Option innerhalb des Kommandos \cmd{\clozeextend} angegeben,
1375 % kann die Option abgekürzt und das prefix |extend_| weggelassen
1376 % werden.
1377 If specified as a local option within the \cmd{\clozeextend} command,
1378 the option can be abbreviated and the prefix |extend_| omitted.
1379
1380 \begin{minted}{latex}
1381 \cloze{Lorem ipsum dolor sit amet. \clozeextend[count=5]}
1382 \end{minted}
1383
1384 \def\TmpExtendCount#1{%
1385 \noindent%
1386 \cloze{Lorem ipsum dolor sit amet. \clozeextend[count=#1]}
1387 \hfill
1388 \TmpExpDesc{#1}
1389 \par%
1390 }
1391
1392 \begin{TmpExample}
1393 \TmpExtendCount{5}
1394 \TmpExtendCount{10}
1395 \TmpExtendCount{15}
1396 \end{TmpExample}
1397
1398 % Die Option kann sogar noch weiter gekürzt werden, nämlich als eine
1399 % einzige Zahl.
1400 The option can be shortened even further, namely as a single number.
1401 % In allen drei Beispielen wird die Option |extend_count| auf 5 gesetzt.
1402 All three examples set the |extend_count| option to 5.
1403
1404 \begin{minted}{latex}
1405 \clozeextend[5]
1406 \clozeextend[count=5]
1407 \clozeextend[extend_count=5]
1408 \end{minted}
1409
1410 % Diese Option hat nur Auswirkungen auf den Befehl \cmd{\clozeextend}
1411 % \TmpSecRef{sec:command-clozeextend}.
1412 \noindent
1413 This option only has an effect on the command \cmd{\clozeextend}
1414 \TmpSecRef{sec:command-clozeextend}.
1415
1416 %%
1417 % extend_height
1418 %%
1419
1420 \subsubsection{\tt{extend_height}}
1421 \label{sec:option-extend-height}
1422
1423 \TmpOption{extend_height}{dim}:
1424 % Als lokale Option innerhalb des Kommandos \cmd{\clozeextend} angegeben,
1425 % kann die Option abgekürzt und das prefix |extend_| weggelassen
1426 % werden.
1427 If specified as a local option within the \cmd{\clozeextend} command,
1428 the option can be abbreviated and the prefix |extend_| omitted.
1429
1430 \begin{minted}{latex}
1431 \cloze{Lorem ipsum dolor sit amet. \clozeextend[height=2ex]}
1432 \end{minted}
1433
1434 \def\TmpExtendHeight#1{%
1435 \noindent%
1436 \cloze{Lorem ipsum dolor sit amet. \clozeextend[height=#1]}
1437 \hfill
1438 \TmpExpDesc{#1}
1439 \par%
1440 }
1441
1442 \begin{TmpExample}
1443 \TmpExtendHeight{2ex}
1444 \TmpExtendHeight{3ex}
1445 \TmpExtendHeight{4ex}
1446 \end{TmpExample}
1447
1448 % Diese Option hat nur Auswirkungen auf den Befehl \cmd{\clozeextend}
1449 % \TmpSecRef{sec:command-clozeextend}.
1450 \noindent
1451 This option only has an effect on the command \cmd{\clozeextend}
1452 \TmpSecRef{sec:command-clozeextend}.
1453
1454 %%
1455 % extend_width
1456 %%
1457
1458 \subsubsection{\tt{extend_width}}
1459 \label{sec:option-extend-width}
1460
1461 \TmpOption{extend_width}{dim}:
1462 % Als lokale Option innerhalb des Kommandos \cmd{\clozeextend} angegeben,
1463 % kann die Option abgekürzt und das prefix |extend_| weggelassen
1464 % werden.
1465 If specified as a local option within the \cmd{\clozeextend} command,
1466 the option can be abbreviated and the prefix |extend_| omitted.
1467
1468 \begin{minted}{latex}
1469 \cloze{Lorem ipsum dolor sit amet. \clozeextend[width=1em]}
1470 \end{minted}
1471
1472 \def\TmpExtendWidth#1{%
1473 \noindent%
1474 \cloze{Lorem ipsum dolor sit amet. \clozeextend[width=#1]}
1475 \hfill
1476 \TmpExpDesc{#1}
1477 \par%
1478 }
1479
1480 \begin{TmpExample}
1481 \TmpExtendWidth{1em}
1482 \TmpExtendWidth{2em}
1483 \TmpExtendWidth{3em}
1484 \end{TmpExample}
1485
1486 % Diese Option hat nur Auswirkungen auf den Befehl \cmd{\clozeextend}
1487 % \TmpSecRef{sec:command-clozeextend}.
1488 This option only has an effect on the command \cmd{\clozeextend}
1489 \TmpSecRef{sec:command-clozeextend}.
1490
1491 %%
1492 % hide and show
1493 %%
1494
1495 \subsubsection{\tt{hide} and \tt{show}}
1496 \label{sec:option-hide}
1497 \label{sec:option-show}
1498
1499 \tt{[hide]} and \tt{[show]}:
1500 By default the cloze text is displayed. Use the option |hide| to remove
1501 the cloze text from the output.
1502
1503 \def\TmpOptionShow#1{%
1504 \noindent%
1505 Lorem ipsum \cloze[#1]{dolor sit amet}, consectetur
1506 \cloze[#1]{adipisicing} elit.%
1507 \TmpDesc{#1}%
1508 }
1509
1510 \begin{TmpExample}
1511 \TmpOptionShow{hide}
1512 \TmpOptionShow{show}
1513 \end{TmpExample}
1514
1515 %%
1516 % line_color and text_color
1517 %%
1518
1519 \subsubsection{\tt{line_color} and \tt{text_color}}
1520 \label{sec:option-line-color}
1521 \label{sec:option-text-color}
1522
1523 \TmpOption{line_color}{color name} and
1524 \TmpOption{text_color}{color name}:
1525 Values for both color options are color names.
1526 To define your own color use the following command:
1527
1528 \begin{minted}{latex}
1529 \definecolor{myclozecolor}{rgb}{0.1,0.4,0.6}
1530 \cloze[text_color=myclozecolor]{Lorem ipsum}
1531 \end{minted}
1532 \definecolor{myclozecolor}{rgb}{0.1,0.4,0.6}
1533
1534 \def\TmpOptionColor#1#2{%
1535 \noindent%
1536 \clozefil[#1=#2]{Lorem ipsum dolor sit amet, consectetur} %
1537 \TmpExpDesc{#2}%
1538 \par%
1539 }
1540
1541 \begin{TmpExample}
1542 \TmpOptionColor{text_color}{myclozecolor}
1543 \TmpOptionColor{text_color}{red}
1544 \TmpOptionColor{text_color}{green}
1545 \end{TmpExample}
1546
1547 \noindent You can use the same color names to colorize the cloze lines.
1548
1549 \begin{TmpExample}
1550 \TmpOptionColor{line_color}{myclozecolor}
1551 \TmpOptionColor{line_color}{red}
1552 \TmpOptionColor{line_color}{green}
1553 \end{TmpExample}
1554
1555 \noindent
1556 And now hide the clozes:
1557
1558 \clozehide
1559 \begin{TmpExample}
1560 \TmpOptionColor{line_color}{myclozecolor}
1561 \TmpOptionColor{line_color}{red}
1562 \TmpOptionColor{line_color}{green}
1563 \end{TmpExample}
1564 \clozeshow
1565
1566
1567 %%
1568 % margin
1569 %%
1570
1571 \subsubsection{\tt{margin}}
1572 \label{sec:option-margin}
1573
1574 \TmpOption{margin}{dimen}:
1575 The option |margin| indicates how far the line sticks up from the text.
1576 The option can be used with the commands \cmd{\cloze}, \cmd{\clozefix}
1577 and \cmd{\clozefil}. The default value of the option is
1578 \tt{\ClozeGetOption{margin}}.
1579
1580 \def\TmpOptionMargin#1{%
1581 \noindent%
1582 Lorem ipsum \cloze[margin=#1]{dolor} sit amet.%
1583 \TmpDesc{#1}%
1584 }
1585
1586 \begin{TmpExample}
1587 \TmpOptionMargin{0pt}
1588 \TmpOptionMargin{5mm}
1589 \TmpOptionMargin{1cm}
1590 \TmpOptionMargin{6em}
1591 \TmpOptionMargin{-4pt}
1592 \end{TmpExample}
1593
1594 % Folgt ein Satzzeichen direkt auf eine Lücke, so findet der
1595 % Zeilenumbruch erst nach dem Satzzeichen statt. Auch ein noch so großer
1596 % Wert für |margin| beeinflusst dieses Verhalten nicht.
1597 \noindent Is a punctation mark placed directly after a gap, then the
1598 line breaks after this punctation mark. Even the most large value of
1599 |margin| does not affect this behavior.
1600
1601 \begin{TmpExample}
1602 \clozeset{margin=3mm}
1603 \cloze{Lorem}, \cloze{ipsum}. \cloze{dolor}; \cloze{sit}: \cloze{amet},
1604 \cloze{consectetur}. \cloze{adipisicing}; \cloze{elit}: \cloze{sed},
1605 \cloze{do}. \cloze{eiusmod}; \cloze{tempor}.
1606 \end{TmpExample}
1607
1608 \clozereset
1609
1610 %%
1611 % min_lines
1612 %%
1613
1614 \newpage
1615 \subsubsection{\tt{min_lines}}
1616 \label{sec:option-min-lines}
1617
1618 \TmpOption{min_lines}{integer}: \tt{min_lines} stands for
1619 “\textbf{min}imum \textbf{lines}”. With the option \tt{min_lines} you can
1620 set how many lines a \tt{clozepar} at least must have. If the text to be
1621 typeset results in fewer lines, empty lines are appended to the end. If
1622 the text of a \tt{clozepar} produces more lines as specified in
1623 \tt{min_lines}, the option has no effect at all. The option \tt{min_lines}
1624 only affects the behavior of the environment \tt{clozepar}
1625 \TmpSecRef{sec:command-clozepar} and the macro versions
1626 \cmd{\clozeparplain} \TmpSecRef{sec:command-clozeparplain} and
1627 \cmd{\clozeparcapture} \TmpSecRef{sec:command-clozeparcapture}.
1628
1629 % https://www.pinterest.de/pin/856176579144764867/
1630
1631 \begin{minted}{latex}
1632 \clozeset{min_lines=4}
1633 \begin{enumerate}
1634 \item Battlements
1635
1636 \begin{clozepar}
1637 Higher ...
1638 \end{minted}
1639
1640 \clozeset{min_lines=4}
1641
1642 \def\TmpExampleMinlines{
1643 \textbf{\Large{}Defending a Castle}
1644
1645 \noindent
1646 Here is a list of features on castle in the Middle Ages that would help
1647 to defend it.
1648
1649 \begin{enumerate}
1650 \item Battlements
1651
1652 \begin{clozepar}
1653 Higher than the walls and jutting out from them to allow
1654 defenders to fire at people who had reached the walls
1655 \end{clozepar}
1656
1657 \item Embrasures
1658
1659 \begin{clozepar}
1660 Heavily protected entrance
1661 \end{clozepar}
1662
1663 \item Portcullis
1664
1665 \begin{clozepar}
1666 Arrow slits with a round hole for firing musket guns
1667 \end{clozepar}
1668 \end{enumerate}
1669 }
1670
1671 \begin{multicols}{2}
1672 \TmpHide
1673 \begin{TmpExample}
1674 \TmpExampleMinlines
1675 \end{TmpExample}
1676
1677 \columnbreak
1678
1679 \TmpShow
1680 \begin{TmpExample}
1681 \TmpExampleMinlines
1682 \end{TmpExample}
1683 \end{multicols}
1684
1685 \clozereset
1686
1687 %%
1688 % spacing
1689 %%
1690
1691 \subsubsection{\tt{spacing}}
1692 \label{sec:option-spacing}
1693
1694 \TmpOption{spacing}{number}:
1695 %
1696 This option provides support for setting the spacing between lines. A
1697 larger font used for the cloze texts needs more line space to avoid
1698 unsteady line distances. This option only affects the environment
1699 |clozespace| \TmpSecRef{sec:command-clozespace}.
1700
1701 %%
1702 % spread
1703 %%
1704
1705 \subsubsection{\tt{spread}}
1706 \label{sec:option-spread}
1707
1708 \TmpOption{spread}{number}:
1709 %
1710 % Vergrößere bzw. spreize eine Lücke um einen gewissen Faktor.
1711 The option |spread| enlarges or spreads a gap by a certain factor.
1712 % 0.5 beispielsweise vergrößert die Lücke um die Hälfte ihrer ursprünglichen bereite
1713 $0.5$, for example, enlarges the gap by half of its original size.
1714 % Ein spread-Faktor von 0 fügt keinen Abstand ein.
1715 A spread factor of $0$ does not insert a space.
1716 % Ein negativer spread-Faktor kann auch angewendet werden.
1717 A negative spread factor can also be applied.
1718 % Dadurch überlappen sich unter Umständen die Textzeichen.
1719 This may cause the text characters to overlap.
1720 % Diese Option kann nur in Verbindung mit den Kommandos cloze and clozenol eingesetzt werden.
1721 This option can only be used in combination with the commands
1722 \cmd{\cloze} \TmpSecRef{sec:command-cloze} and \cmd{\clozenol}
1723 \TmpSecRef{sec:command-clozenol}.
1724
1725 \def\TmpOptionSpread#1{%
1726 \noindent%
1727 Lorem \cloze[spread=#1]{ipsum dolor sit} amet.%
1728 \TmpDesc{#1}%
1729 }
1730
1731 \begin{TmpExample}
1732 \TmpOptionSpread{-0.5}
1733 \TmpOptionSpread{0}
1734 \TmpOptionSpread{0.5}
1735 \TmpOptionSpread{1}
1736 \TmpOptionSpread{2}
1737 \end{TmpExample}
1738
1739 \noindent
1740 % Die Option spread fügt am Anfang und am Ende einer Lücke einen Abstand
1741 % ein, der abhängig von der Breite des Texts in der Lücke ist.
1742 The |spread| option inserts a space at the beginning and end of a gap
1743 that depends on the width of the text in the gap.
1744
1745 \begin{TmpExample}
1746 Lorem ipsum dolor \cloze[spread=0.5]{sit} amet. \TmpDesc{0.5}%
1747 \noindent
1748 Lorem ipsum \cloze[spread=0.5]{dolor sit} amet. \TmpDesc{0.5}%
1749 \noindent
1750 Lorem \cloze[spread=0.5]{ipsum dolor sit} amet. \TmpDesc{0.5}%
1751 \noindent
1752 \cloze[spread=0.5]{Lorem ipsum dolor sit} amet. \TmpDesc{0.5}%
1753 \noindent
1754 \cloze[spread=0.5]{Lorem ipsum dolor sit amet}. \TmpDesc{0.5}%
1755 \end{TmpExample}
1756
1757 \noindent
1758 % Zusätzlich zu der der Option spread kann auch noch die Option margin
1759 % verwendet werden, die einen Abstand eingefügt werden, der unabhängig
1760 % von der Breite der Lücke ist.
1761 In addition to the |spread| option, the |margin| option can also be used,
1762 which inserts a distance that is independent of the width of the gap.
1763
1764 %%
1765 % thickness
1766 %%
1767
1768 \subsubsection{\tt{thickness}}
1769 \label{sec:option-thickness}
1770
1771 \TmpOption{thickness}{dimen}:
1772 %
1773 The option |thickness| indicates how thick the line is. The option
1774 |distance| \TmpSecRef{sec:option-distance} is not affected by this
1775 option, because the bottom of the line moves down. The default value of
1776 this option is \tt{\ClozeGetOption{thickness}}.
1777
1778 \def\TmpOptionThickness#1{%
1779 \noindent%
1780 Lorem \cloze[thickness=#1]{ipsum dolor sit} amet.%
1781 \TmpDesc{#1}%
1782 }
1783
1784 \begin{TmpExample}
1785 \TmpOptionThickness{0.01pt}
1786 \TmpOptionThickness{1pt}
1787 \TmpOptionThickness{2pt}
1788 \end{TmpExample}
1789
1790 %%
1791 % width
1792 %%
1793
1794 \subsubsection{\tt{width}}\label{sec:option-width}
1795
1796 \TmpOption{width}{dimen}:
1797 %
1798 The only command which can be changed by the option |width| is
1799 \cmd{\clozefix} \TmpSecRef{sec:command-clozefix}. The default value of
1800 the option is \tt{\ClozeGetOption{width}}.
1801
1802 \def\TmpOptionWidth#1{%
1803 \noindent%
1804 Lorem \clozefix[width=#1]{dolor} amet.%
1805 \TmpDesc{#1}%
1806 }
1807
1808 \begin{TmpExample}
1809 \TmpOptionWidth{3cm}
1810 \TmpOptionWidth{5cm}
1811 \TmpOptionWidth{7cm}
1812 \end{TmpExample}
1813
1814 %%
1815 % visibility
1816 %%
1817
1818 \subsubsection{\tt{visibility}}\label{sec:option-visibility}
1819
1820 \TmpOption{visibility}{boolean}:
1821 %
1822 % Anstelle der entgegengesetzten Optionen |show| und |hide| können Sie
1823 % die Option |visibility| verwenden und diese auf einen booleschen Wert
1824 % setzen.
1825 Instead of the opposite naked |show| and |hide| keys, you can use the
1826 |visibility| option and set it to a boolean value.
1827
1828 \begin{minted}{latex}
1829 Lorem \cloze[visibility=false]{ipsum} dolor.
1830
1831 Lorem \cloze[visibility=true]{ipsum} dolor.
1832
1833 Lorem \cloze[visibility=false]{ipsum} dolor.
1834 \end{minted}
1835
1836 \def\TmpOptionVisibility#1{%
1837 \noindent%
1838 Lorem \cloze[visibility=#1]{ipsum} dolor.%
1839 \TmpDesc{#1}%
1840 }
1841
1842 \begin{TmpExample}
1843 \TmpOptionVisibility{false}
1844 \TmpOptionVisibility{true}
1845 \TmpOptionVisibility{false}
1846 \end{TmpExample}
1847 %
1848
1849 %-----------------------------------------------------------------------
1850 % Handwriting fonts from CTAN and \TeX{} Live
1851 %-----------------------------------------------------------------------
1852
1853 \subsection{Handwriting fonts from CTAN and \TeX{} Live}
1854
1855 If you want to imitate a hand-filled worksheet, then some handwriting
1856 fonts are suitable for this purpose. This section is intended to provide
1857 an overview of handwriting fonts available on CTAN and \TeX{} Live. The
1858 fonts are listed in alphabetical order:
1859
1860 \def\TmpHandwritingExample{
1861 \begin{TmpExample}
1862 Lorem \cloze{ipsum} dolor sit amet, consetetur \cloze{sadipscing
1863 elitr, sed diam nonumy eirmod tempor} invidunt ut \cloze{labore et
1864 dolore magna aliquyam erat}, sed \cloze{diam} voluptua.
1865 \end{TmpExample}
1866 }
1867
1868 \def\TmpHandwritingCtan#1#2{
1869 \subsubsection*{#1}
1870
1871 \begin{tabbing}
1872 \hspace{2.8cm} \= \hspace{8cm} \kill
1873
1874 CTAN: \>
1875 {\footnotesize\href{https://www.ctan.org/pkg/#2}{#2}}\\
1876
1877 \TeX{} Live: \>
1878 \texttt{\footnotesize tlmgr install #2}\\
1879
1880 Font selection: \>
1881 \texttt{\footnotesize\string\clozesetfont\{\string\fontspec\{#1\}\}}\\
1882 \end{tabbing}
1883 \vspace{-0.7cm}
1884 %
1885
1886 \clozeset{margin=7pt}
1887 \clozesetfont{\Large\fontspec{#1}}
1888 \TmpHandwritingExample
1889 }
1890
1891 % \TmpHandwritingCtan{LobsterTwo}{lobster2}
1892 % \TmpHandwritingCtan{Miama Nueva}{miama}
1893 \TmpHandwritingCtan{QT Brush Stroke}{qualitype}
1894 \TmpHandwritingCtan{QT Florencia}{qualitype}
1895 % \TmpHandwritingCtan{QT Handwriting}{qualitype}
1896 \TmpHandwritingCtan{QT Linostroke}{qualitype}
1897 \TmpHandwritingCtan{QT Merry Script}{qualitype}
1898 \TmpHandwritingCtan{QT Slogantype}{qualitype}
1899
1900 %-----------------------------------------------------------------------
1901 % Handwriting fonts from Google Fonts
1902 %-----------------------------------------------------------------------
1903
1904 \subsection{Handwriting fonts from Google Fonts}
1905
1906 You can get many more free handwriting fonts from Google Fonts. This
1907 section shows only a selection. I personally use the font named
1908 \emph{Kalam} for my worksheets. All Google Fonts are available
1909 in a \href{https://github.com/google/fonts}{Git respository}.
1910
1911 \begin{minted}{shell}
1912 git clone https://github.com/google/fonts.git
1913 \end{minted}
1914
1915 \noindent
1916 The fonts are listed in alphabetical order:
1917
1918 \def\TmpHandwritingGoogle#1{
1919 \subsubsection*{#1}
1920
1921 \begin{tabbing}
1922 \hspace{2.8cm} \= \hspace{8cm} \kill
1923 URL: \> {\footnotesize\url{https://fonts.google.com/specimen/\directlua{
1924 local font_name = '#1'
1925 font_name = font_name:gsub(' ', '+')
1926 tex.print(font_name)
1927 }}}
1928 \\
1929
1930 Font selection: \>
1931 \texttt{\footnotesize\string\clozesetfont\{\string\fontspec\{#1\}\}}
1932 \\
1933 \end{tabbing}
1934 \vspace{-0.7cm}
1935 %
1936 \clozeset{margin=7pt}
1937 \clozesetfont{\Large\fontspec{#1}}
1938 \TmpHandwritingExample
1939 }
1940
1941 %\TmpHandwritingGoogle{Amatic SC}
1942 % \TmpHandwritingGoogle{Annie Use Your Telescope}
1943 % \TmpHandwritingGoogle{Architects Daughter}
1944 % \TmpHandwritingGoogle{Bad Script}
1945 % \TmpHandwritingGoogle{Bubblegum Sans}
1946 % \TmpHandwritingGoogle{Caveat Brush}
1947 % \TmpHandwritingGoogle{Caveat}
1948 % \TmpHandwritingGoogle{Cedarville Cursive}
1949 \TmpHandwritingGoogle{Coming Soon}
1950 % \TmpHandwritingGoogle{Covered By Your Grace}
1951 % \TmpHandwritingGoogle{Crafty Girls}
1952 % \TmpHandwritingGoogle{East Sea Dokdo}
1953 % \TmpHandwritingGoogle{Fondamento}
1954 % \TmpHandwritingGoogle{Ga Maamli}
1955 % \TmpHandwritingGoogle{Gamja Flower}
1956 % \TmpHandwritingGoogle{Give You Glory}
1957 % \TmpHandwritingGoogle{Gloria Hallelujah}
1958 \TmpHandwritingGoogle{Gluten}
1959 % \TmpHandwritingGoogle{Gochi Hand}
1960 % \TmpHandwritingGoogle{Grape Nuts}
1961 % \TmpHandwritingGoogle{Hachi Maru Pop}
1962 % \TmpHandwritingGoogle{Handlee}
1963 % \TmpHandwritingGoogle{Homemade Apple}
1964 % \TmpHandwritingGoogle{Indie Flower}
1965 % \TmpHandwritingGoogle{Italianno}
1966 % \TmpHandwritingGoogle{Julee}
1967 % \TmpHandwritingGoogle{Just Another Hand}
1968 % \TmpHandwritingGoogle{Just Me Again Down Here}
1969 \TmpHandwritingGoogle{Kalam}
1970 % \TmpHandwritingGoogle{Knewave}
1971 % \TmpHandwritingGoogle{Kristi}
1972 % \TmpHandwritingGoogle{La Belle Aurore}
1973 % \TmpHandwritingGoogle{Lacquer}
1974 % \TmpHandwritingGoogle{Leckerli One}
1975 % \TmpHandwritingGoogle{Loved by the King}
1976 % \TmpHandwritingGoogle{Ma Shan Zheng}
1977 \TmpHandwritingGoogle{Mali}
1978 % \TmpHandwritingGoogle{Mansalva}
1979 % \TmpHandwritingGoogle{Marck Script}
1980 % \TmpHandwritingGoogle{Meddon}
1981 % \TmpHandwritingGoogle{Merienda}
1982 % \TmpHandwritingGoogle{Montez}
1983 % \TmpHandwritingGoogle{Moon Dance}
1984 % \TmpHandwritingGoogle{Mr Dafoe}
1985 % \TmpHandwritingGoogle{Mr De Haviland}
1986 % \TmpHandwritingGoogle{Mrs Saint Delafield}
1987 % \TmpHandwritingGoogle{Ms Madi}
1988 % \TmpHandwritingGoogle{Nanum Brush Script}
1989 % \TmpHandwritingGoogle{Neucha}
1990 % \TmpHandwritingGoogle{Nothing You Could Do}
1991 % \TmpHandwritingGoogle{Oooh Baby}
1992 \TmpHandwritingGoogle{Oregano}
1993 % \TmpHandwritingGoogle{Over the Rainbow}
1994 % \TmpHandwritingGoogle{Pangolin}
1995 % \TmpHandwritingGoogle{Patrick Hand SC}
1996 % \TmpHandwritingGoogle{Patrick Hand}
1997 % \TmpHandwritingGoogle{Permanent Marker}
1998 % \TmpHandwritingGoogle{Playpen Sans}
1999 % \TmpHandwritingGoogle{Playwrite Deutschland Grundschrift}
2000 % \TmpHandwritingGoogle{Qwitcher Grypen}
2001 % \TmpHandwritingGoogle{Rancho}
2002 % \TmpHandwritingGoogle{Reenie Beanie}
2003 % \TmpHandwritingGoogle{Rock Salt}
2004 % \TmpHandwritingGoogle{Schoolbell}
2005 % \TmpHandwritingGoogle{Seaweed Script}
2006 % \TmpHandwritingGoogle{Sedgwick Ave}
2007 % \TmpHandwritingGoogle{Shadows Into Light Two}
2008 % \TmpHandwritingGoogle{Shadows Into Light}
2009 % \TmpHandwritingGoogle{Shantell Sans}
2010 % \TmpHandwritingGoogle{Short Stack}
2011 % \TmpHandwritingGoogle{Sriracha}
2012 % \TmpHandwritingGoogle{Sue Ellen Francisco}
2013 % \TmpHandwritingGoogle{Sunshiney}
2014 % \TmpHandwritingGoogle{Swanky and Moo Moo}
2015 % \TmpHandwritingGoogle{The Girl Next Door}
2016 % \TmpHandwritingGoogle{Vibur}
2017 %\TmpHandwritingGoogle{Nanum Pen Script}
2018 \clozereset
2019
2020 %-----------------------------------------------------------------------
2021 % Special application areas
2022 %-----------------------------------------------------------------------
2023
2024 \subsection{Special application areas}
2025
2026 This section lists examples that didn’t work in older versions of
2027 the cloze package and required special treatment to work as expected.
2028
2029 \subsubsection{The math mode}
2030
2031 By default the package uses |\itshape| to format the cloze text. In
2032 math mode you have to reset the cloze text format by calling
2033 |\clozesetfont{}|. A known bug is: You can’t show and hide
2034 a single display math formula. Only the last |\clozeshow| or
2035 |\clozehide| takes effect on the whole document. Side note: The usage
2036 of the \TeX{} primitive syntax |$$ $$| is not recommended.
2037
2038 \clozesetfont{}
2039
2040 %%
2041 %
2042 %%
2043
2044 \bigskip
2045
2046 \begin{multicols}{2}
2047 \begin{minted}{latex}
2048 \clozesetfont{}
2049 $$1 + 1 = \cloze{2}$$
2050 \clozesetfont{\itshape}
2051 \end{minted}
2052
2053 \columnbreak
2054
2055 \begin{TmpExample}
2056 $$1 + 1 = \cloze{2}$$
2057 \end{TmpExample}
2058 \end{multicols}
2059
2060 \bigskip
2061
2062 %%
2063 %
2064 %%
2065
2066 \noindent
2067 |\[\]| should be used instead.
2068
2069 \begin{multicols}{2}
2070 \begin{minted}{latex}
2071 \[123 + 456 = \cloze{579}\]
2072 \end{minted}
2073
2074 \columnbreak
2075
2076 \begin{TmpExample}
2077 \[123 + 456 = \cloze{579}\]
2078 \end{TmpExample}
2079 \end{multicols}
2080
2081 %%
2082 %
2083 %%
2084
2085 \bigskip
2086 \noindent
2087 A cloze inside a display math environment should work fine:
2088
2089 \begin{multicols}{2}
2090 \begin{minted}{latex}
2091 \begin{displaymath}
2092 2^{\cloze{2}} = 4
2093 \end{displaymath}
2094 \end{minted}
2095
2096 \columnbreak
2097
2098 \begin{TmpExample}
2099 \begin{displaymath}
2100 2^{\cloze{2}} = 4
2101 \end{displaymath}
2102 \end{TmpExample}
2103 \end{multicols}
2104
2105 \bigskip
2106
2107 \noindent
2108 The inline math mode works too:
2109
2110 \begin{minted}{latex}
2111 ${\sqrt[3]{\cloze{8}}} = 2$ and ${\sqrt[\cloze{3}]{\cloze{8}}} = 2$
2112 \end{minted}
2113
2114 \begin{TmpExample}
2115 \begin{center}
2116 ${\sqrt[3]{\cloze{8}}} = 2$ and ${\sqrt[\cloze{3}]{\cloze{8}}} = 2$
2117 \end{center}
2118 \end{TmpExample}
2119
2120 %%
2121 % equation
2122 %%
2123
2124 \begin{multicols}{2}
2125 \begin{minted}{latex}
2126 \begin{equation}
2127 e^{\pi i} + 1 = \cloze{0}
2128 \end{equation}
2129 \end{minted}
2130
2131 \columnbreak
2132
2133 \begin{TmpExample}
2134 \begin{equation}
2135 e^{\pi i} + 1 = \cloze{0}
2136 \end{equation}
2137 \end{TmpExample}
2138 \end{multicols}
2139
2140 %%
2141 % amsmath: multline
2142 %%
2143
2144 \noindent
2145 The amsmath \texttt{multline} environment:
2146
2147 \begin{multicols}{2}
2148 \begin{minted}{latex}
2149 \begin{multline*}
2150 p(x) = \cloze{590}x^4y^2 + \cloze{19}x^3y^3\\
2151 - 12x^2y^4 - \cloze{12}xy^5
2152 \end{multline*}
2153 \end{minted}
2154
2155 \columnbreak
2156
2157 \begin{TmpExample}
2158 \begin{multline*}
2159 p(x) = \cloze{590}x^4y^2 + \cloze{19}x^3y^3\\
2160 - 12x^2y^4 - \cloze{12}xy^5
2161 \end{multline*}
2162 \end{TmpExample}
2163 \end{multicols}
2164
2165 %%
2166 %
2167 %%
2168
2169 \def\TmpSubtraction{
2170 Missing Subtraction Facts to 12
2171
2172 \def\TmpMath##1{
2173 \hspace{0.3cm}\scalebox{1.5}{$##1$}
2174 }
2175
2176 \clozeset{margin=8pt}
2177 \renewcommand{\labelenumi}{\alph{enumi})}
2178 \begin{enumerate}
2179 \item \TmpMath{8 - 6 = \cloze{2}}
2180 \item \TmpMath{10 - 4 = \cloze{6}}
2181 \item \TmpMath{7 - \cloze{2} = 5}
2182 \item \TmpMath{6 - \cloze{1} = 5}
2183 \item \TmpMath{\cloze{6} - 3 = 3}
2184 \item \TmpMath{\cloze{10} - 2 = 8}
2185 \end{enumerate}
2186 }
2187
2188 \begin{multicols}{2}
2189 \TmpHide
2190 \begin{TmpExample}
2191 \TmpSubtraction
2192 \end{TmpExample}
2193
2194 \columnbreak
2195
2196 \TmpShow
2197 \begin{TmpExample}
2198 \TmpSubtraction
2199 \end{TmpExample}
2200
2201 \end{multicols}
2202
2203 \clozesetfont{\itshape}
2204 \clozereset
2205
2206 %%
2207 % tabbing
2208 %%
2209
2210 \subsubsection{The \tt{tabbing} environment}
2211
2212 \begin{minted}{latex}
2213 \begin{tabbing}
2214 col1 \hspace{1cm} \= col2 \hspace{1cm} \= col3 \hspace{1cm} \= col4 \\
2215 \cloze{col1} \> \> \clozefix{col3} \\
2216 \end{tabbing}
2217 \end{minted}
2218
2219 \begin{TmpExample}
2220 \begin{tabbing}
2221 col1 \hspace{1cm} \= col2 \hspace{1cm} \= col3 \hspace{1cm} \= col4 \\
2222 \cloze{col1} \> \> \clozefix{col3} \\
2223 \end{tabbing}
2224 \end{TmpExample}
2225
2226 %%
2227 % picture
2228 %%
2229
2230 \newpage
2231 \subsubsection{The \tt{picture} environment}
2232
2233 \begin{minted}{latex}
2234 \setlength{\unitlength}{0.8cm}
2235 \begin{picture}(4.8,3.8)
2236 \thicklines
2237 \put(1,0.5){\line(2,1){3}} \put(4,2){\line(-2,1){2}} \put(2,3){\line(-2,-5){1}}
2238
2239 \put(0.4,0.2){\cloze{A}} \put(4.05,1.9){$B$} \put(1.8,3.1){$C$}
2240
2241 \put(3.1,2.5){$a$} \put(0.8,1.8){\cloze{b}} \put(2.5,0.9){\cloze{c}}
2242 \end{picture}
2243 \end{minted}
2244
2245 \def\TmpPicture{
2246 \setlength{\unitlength}{0.8cm}
2247 \begin{picture}(4.8,3.8)
2248 \thicklines
2249 \put(1,0.5){\line(2,1){3}}
2250 \put(4,2){\line(-2,1){2}}
2251 \put(2,3){\line(-2,-5){1}}
2252 \put(0.4,0.2){\cloze{A}}
2253 \put(4.05,1.9){$B$}
2254 \put(1.8,3.1){$C$}
2255 \put(3.1,2.5){$a$}
2256 \put(0.8,1.8){\cloze{b}}
2257 \put(2.5,0.9){\cloze{c}}
2258 \end{picture}
2259 }
2260 %
2261
2262 \begin{multicols}{2}
2263 \TmpHide
2264
2265 \begin{TmpExample}
2266 \center{\TmpPicture}
2267 \end{TmpExample}
2268
2269 \columnbreak
2270
2271 \TmpShow
2272
2273 \begin{TmpExample}
2274 \center{\TmpPicture}
2275 \end{TmpExample}
2276 \end{multicols}
2277
2278 \clozereset
2279
2280 %%
2281 % tabular
2282 %%
2283
2284 \subsubsection{The \tt{tabular} environment}
2285
2286 \begin{minted}{latex}
2287 \begin{tabular}{l|l}
2288 \textbf{englisch} & \textbf{deutsch} \\\hline
2289 book & \clozefil{Buch} \\
2290 \clozefil{scissors} & Schere\\
2291 pen & \clozefil{Füller} \\
2292 \clozefil{pencil} & Bleistift\\
2293 \end{tabular}
2294 \end{minted}
2295
2296 \def\TmpTabluarEnglishGerman{
2297 \clozeset{distance=4pt}
2298 \renewcommand{\arraystretch}{1.5}
2299 \begin{tabular}{ll}
2300 \textbf{englisch} & \textbf{deutsch} \\
2301 \hline
2302 book & \clozefil{Buch} \\
2303 \clozefil{scissors} & Schere\\
2304 pen & \clozefil{Füller} \\
2305 \clozefil{pencil} & Bleistift\\
2306 \end{tabular}
2307 \vspace{0.2cm}
2308 }
2309
2310 \begin{multicols}{2}
2311 \TmpHide
2312 \begin{TmpExample}
2313 \center{\TmpTabluarEnglishGerman}
2314 \end{TmpExample}
2315
2316 \columnbreak
2317
2318 \TmpShow
2319 \begin{TmpExample}
2320 \center{\TmpTabluarEnglishGerman}
2321 \end{TmpExample}
2322 \end{multicols}
2323
2324 %%
2325 % forest
2326 %%
2327
2328 \newpage
2329 \subsubsection{The package \tt{forest}}
2330
2331 \begin{minted}{latex}
2332 \begin{forest}
2333 [Johann Sebastian \cloze{Bach}
2334 [Carl \cloze{Phillip} Emanuel
2335 [Johann Sebastian (der \cloze{Jüngere})]
2336 ]
2337 [Johann Christoph \cloze{Friedrich}
2338 [\cloze{Wilhelm} Friedrich Ernst]
2339 ]
2340 [\cloze{Johann Christian}]
2341 ]
2342 \end{forest}
2343 \end{minted}
2344
2345 \def\TmpForestBach{
2346 {
2347 \noindent
2348 \scriptsize
2349 \begin{forest}
2350 [Johann Sebastian \cloze{Bach}
2351 [Carl \cloze{Phillip} Emanuel
2352 [Johann Sebastian (der \cloze{Jüngere})]
2353 ]
2354 [Johann Christoph \cloze{Friedrich}
2355 [\cloze{Wilhelm} Friedrich Ernst]
2356 ]
2357 [\cloze{Johann Christian}]
2358 ]
2359 \end{forest}
2360 }
2361 }
2362
2363 \TmpHide
2364
2365 \begin{TmpExample}
2366 \begin{center}
2367 \TmpForestBach
2368 \end{center}
2369 \end{TmpExample}
2370
2371 \TmpShow
2372
2373 \begin{TmpExample}
2374 \begin{center}
2375 \TmpForestBach
2376 \end{center}
2377 \end{TmpExample}
2378
2379 \clozereset
2380
2381 %%
2382 % tikz
2383 %%
2384
2385 \newpage
2386 \subsubsection{The package \tt{tikz}}
2387
2388 %%
2389 %
2390 %%
2391
2392 \paragraph{Example Multiline alignment in TikZ}
2393 \def\TmpTikzExampleAlignment{
2394 \begin{tikzpicture}[
2395 cloze box/.style={draw,text width=3cm},
2396 scale=0.6,
2397 transform shape
2398 ]
2399 \def\TmpLorem{
2400 \clozenol[margin=0pt]{Damit Ihr indess erkennt, woher
2401 dieser ganze Irrthum gekommen ist.}
2402 }
2403
2404 \def\TmpTextBox##1##2##3{
2405 \node (##1) at (##2) [cloze box,align=##1] {\TmpLorem};
2406 \node [##3=0cm of ##1] {\texttt{\footnotesize{}align=##1}};
2407 \draw (##1) -- (tikz);
2408 }
2409
2410 \node (tikz) at (4,4) [circle, text width=3cm, align=center] {
2411 \textbf{TikZ}\\Alignment of Multi-Line\\ Text
2412 };
2413
2414 \TmpTextBox{left} {0,8}{above}
2415 \TmpTextBox{center} {4,8}{above}
2416 \TmpTextBox{right} {8,8}{above}
2417 \TmpTextBox{flush right} {8,4}{above}
2418 \TmpTextBox{none} {8,0}{below}
2419 \TmpTextBox{flush center} {4,0}{below}
2420 \TmpTextBox{justify} {0,0}{below}
2421 \TmpTextBox{flush left} {0,4}{above}
2422 \end{tikzpicture}
2423 }
2424
2425 \TmpHide
2426 \begin{TmpExample}
2427 \center{\TmpTikzExampleAlignment}
2428 \end{TmpExample}
2429
2430 \TmpShow
2431 \begin{TmpExample}
2432 \center{\TmpTikzExampleAlignment}
2433 \end{TmpExample}
2434
2435 %%
2436 %
2437 %%
2438
2439 \newpage
2440 \paragraph{Example Timeline}
2441
2442 \def\TmpTimeline{\begin{tikzpicture}[
2443 scale=0.6,
2444 transform shape,
2445 text box/.style={black, text width=3cm, align=flush left, draw},
2446 arrow/.style={<-,thick,black,align=center},
2447 >=latex
2448 ]
2449
2450 % limits
2451 \newcount\yearOne; \yearOne=1860
2452 \def\widthOfAxes{15}
2453 \def\numberOfDecades{11}
2454 \def\tenTickLength{0.40}
2455 \def\fiveTickLength{0.36}
2456 \def\oneTickLength{0.30}
2457
2458 % help functions
2459 % ##1: year
2460 % ##2: distance arrow timeline: - below + above
2461 % ##3: arrow length
2462 % ##4: Text
2463 % ##5: left or right or empty (-> center)
2464 \def\yearArrowLabel(##1,##2,##3,##4,##5){
2465 \def\xy{{(##1-\yearOne)*\widthOfAxes/\numberOfDecades/10}};
2466 \pgfmathparse{int(##2*100)};
2467 \ifnum \pgfmathresult<0
2468 % below
2469 \def\yyp{{(\tenTickLength*(0.90+##2))}}; \def\yyw{{(\yyp-\tenTickLength*##3)}}
2470 \draw[arrow] (\xy,\yyp) -- (\xy,\yyw) node[below ##5,text box] at (\xy,\yyw) {\footnotesize\textbf{##1}: ##4};
2471 \else
2472 % above
2473 \def\yyp{{(\tenTickLength*(0.10+##2)}}; \def\yyw{{(\yyp+\tenTickLength*##3)}}
2474 \draw[arrow] (\xy,\yyp) -- (\xy,\yyw) node[above ##5,text box] at (\xy,\yyw) {\footnotesize\textbf{##1:} ##4};
2475 \fi
2476 }
2477
2478 % axis
2479 \draw[->,thick] (-\widthOfAxes*0.03,0) -- (\widthOfAxes*1.03,0);
2480
2481 % ticks
2482 \foreach \tick in {0,1,...,\numberOfDecades}{
2483 \def\x{{\tick*\widthOfAxes/\numberOfDecades}}
2484 \def\year{\the\numexpr \yearOne+\tick*10 \relax}
2485 % ten tick
2486 \draw[thick] (\x,\tenTickLength) -- (\x,-\tenTickLength) node[below] {\year};
2487
2488 \ifnum \tick<\numberOfDecades
2489 % five tick
2490 \draw ({(\x+\widthOfAxes/\numberOfDecades/2)},0) --
2491 ({(\x+\widthOfAxes/\numberOfDecades/2)},\fiveTickLength);
2492 \foreach \ticko in {1,2,3,4,6,7,8,9}{
2493 \def\xo{{(\x+\ticko*\widthOfAxes/\numberOfDecades/10)}}
2494 % one tick
2495 \draw (\xo,0) -- (\xo,\oneTickLength);
2496 }
2497 \fi
2498 }
2499
2500 % label
2501 \yearArrowLabel(1865,-1,3,
2502 Thirteenth \cloze{Amendment} to constitution abolishes \cloze{Slavery},)
2503
2504 \yearArrowLabel(1875,1,2,
2505 \cloze{Civil Rights Act} is passed giving black citizens \cloze{equal} treatment.,)
2506
2507 \yearArrowLabel(1896,-1,3,
2508 Plessy v. \cloze{Ferguson} say that segregation is \cloze{constitutional},)
2509
2510 \yearArrowLabel(1909,1,2,
2511 \cloze{NAACP} is founded in New York and led by W.E.B. Du \cloze{Bois},)
2512
2513 \yearArrowLabel(1946,1,2,
2514 U.S. Supreme court bans segregation on \cloze{Public Transit} (i.e. subways).,left)
2515
2516 \yearArrowLabel(1955,-1,3,
2517 Rosa \cloze{Parks} refuses to give up her seat on a \cloze{bus} in \cloze{Alabama},left)
2518
2519 \yearArrowLabel(1963,1,2,
2520 Martin Luther \cloze{King} Jr. delivers his ‘I Have a \cloze{Dream}’ speech in \cloze{Washington} D.C.,)
2521
2522 \yearArrowLabel(1968,-3,2,
2523 Martin Luther King Jr. is \cloze{assassinated},right)
2524 \end{tikzpicture}
2525 }
2526
2527 \TmpHide
2528
2529 \begin{TmpExample}
2530 \begin{center}
2531 \TmpTimeline
2532 \end{center}
2533 \end{TmpExample}
2534
2535 \TmpShow
2536
2537 \begin{TmpExample}
2538 \begin{center}
2539 \TmpTimeline
2540 \end{center}
2541 \end{TmpExample}
2542
2543 \paragraph{Number pyramid}
2544
2545 \clozesetfont{\ttfamily}
2546 \def\TmpNumberPyramid(#1,#2,#3,#4,#5,#6){
2547 \begin{tikzpicture}[
2548 node distance = 0pt,
2549 every node/.style = {
2550 draw,
2551 minimum width=10mm,
2552 minimum height=6mm,
2553 inner sep=0pt,
2554 outer sep=0pt,
2555 font=\ttfamily,
2556 }
2557 ]
2558 \node (n1) {#1};
2559 %
2560 \node (n11) [below left=of n1.south] {#2};
2561 \node (n12) [right=of n11] {#3};
2562 %
2563 \node (n21) [below left=of n11.south] {#4};
2564 \node (n22) [right=of n21] {#5};
2565 \node (n23) [right=of n22] {#6};
2566 \end{tikzpicture}
2567 }
2568
2569 \def\TmpNumberPyramids{
2570 \TmpNumberPyramid(\clozenol{17},\clozenol{12},\clozenol{5},10,2,3)
2571 \TmpNumberPyramid(\clozenol{19},10,\clozenol{9},3,\clozenol{7},2)
2572 \TmpNumberPyramid(10,\clozenol{7},3,\clozenol{5},2,\clozenol{1})
2573 }
2574
2575 \TmpHide
2576
2577 \begin{TmpExample}
2578 \begin{center}
2579 \TmpNumberPyramids
2580 \end{center}
2581 \end{TmpExample}
2582
2583 \TmpShow
2584
2585 \begin{TmpExample}
2586 \begin{center}
2587 \TmpNumberPyramids
2588 \end{center}
2589 \end{TmpExample}
2590
2591 \section{Implementation}
2592
2593 The source code is hosted on
2594 \href{https://github.com/Josef-Friedrich/cloze}{Github}. The
2595 following links will take you to the individual files:
2596
2597 \begin{itemize}
2598 \item \href{https://github.com/Josef-Friedrich/cloze/blob/main/cloze.lua}{cloze.lua}
2599
2600 \item \href{https://github.com/Josef-Friedrich/cloze/blob/main/cloze.tex}{cloze.tex}
2601
2602 \item \href{https://github.com/Josef-Friedrich/cloze/blob/main/cloze.sty}{cloze.sty}
2603 \end{itemize}
2604
2605 \pagebreak
2606 \PrintIndex
2607 \end{document}