-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloze-doc.tex
2266 lines (1792 loc) · 52.7 KB
/
cloze-doc.tex
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
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass{ltxdoc}
\usepackage[show]{cloze}
\usepackage{graphicx}
\usepackage{fontspec}
\usepackage{paralist}
\usepackage{forest}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning}
%%
% titlesec
%%
\usepackage{titlesec}
\titleformat{\paragraph}[hang]{%
\normalfont\normalsize\bfseries%
}{\theparagraph}{1em}{}
\titleformat{\subparagraph}[hang]{%
\normalfont\small\bfseries%
}{\thesubparagraph}{1em}{}
\titlespacing*{\subparagraph}{0pt}{*1}{0pt}
%%
% hyperref
%%
\usepackage[
colorlinks=true,
linkcolor=red,
filecolor=red,
urlcolor=red,
]{hyperref}
%%
% mdframed
%%
\usepackage{mdframed}
\definecolor{TmpGray}{gray}{0.95}
% f2d6aa 242 214 170
\definecolor{TmpYellow}{rgb}{0.949019608, 0.839215686, 0.666666667}
\newmdenv[
backgroundcolor=TmpYellow!3,
linecolor=TmpYellow!70
]{TmpExample}
\surroundwithmdframed[backgroundcolor=TmpGray]{verbatim}
%%
% minted
%%
\usepackage{minted}
\usemintedstyle{colorful}
\BeforeBeginEnvironment{minted}{\begin{mdframed}[
backgroundcolor=TmpGray!60,
linecolor=gray!40,
]}
\AfterEndEnvironment{minted}{\end{mdframed}}
\setminted{
breaklines=true,
fontsize=\footnotesize,
}
\MakeShortVerb{\|}
%%
% Temporary local macros
%%
\newcommand{\TmpExpDesc}[1]{(|#1|)}
\newcommand{\TmpDesc}[1]{%
\hfill%
\TmpExpDesc{#1}%
\par%
}
\def\tt#1{%
\texttt{#1}%
}
\def\TmpSecRef#1{%
(\rightarrow\ \ref{#1})%
}
\def\TmpOption#1#2{%
\tt{[#1=}\meta{#2}\tt{]}%
}
\def\TmpHide{%
\noindent%
\texttt{\string\clozehide}:%
\clozehide%
}
\def\TmpShow{%
\noindent%
\texttt{\string\clozeshow}:%
\clozeshow%
}
\def\TmpReduceVspace{%
\vspace{-0.2cm}%
}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand*{\url}{\texttt}
\GetFileInfo{cloze.dtx}
\title{The \cloze{cloze} package%
\thanks{Many thanks to Robert-Michael Huber for his advice
and to Paul Isambert for his article \emph{"Three things you can do with
Lua\TeX{} that would be extremely painful otherwise"} in TUGboat, Volume
31 (2010), No. 3. This article helped a lot to write this package.}%
}
\author{%
Josef Friedrich\\%
\url{josef@friedrich.rocks}\\%
\href{https://github.com/Josef-Friedrich/cloze}
{github.com/Josef-Friedrich/cloze}%
}
\date{v1.6~from 2020/06/30}
\maketitle\vfill
\pagebreak
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\tableofcontents
%-----------------------------------------------------------------------
% Introduction
%-----------------------------------------------------------------------
\pagebreak
\section{Introduction}
\emph{cloze} is a plain \TeX{} or a \LaTeX{} package to generate cloze
texts. It uses the capabilities of the modern \TeX{} engine
\emph{Lua\TeX}. Therefore, you must use Lua\TeX{} or Lua\LaTeX{} to
create documents containing gaps.
\begin{center}
\begin{minipage}{0.4\linewidth}
\begin{verbatim}
lualatex cloze-text.tex
\end{verbatim}
\end{minipage}
or
\begin{minipage}{0.4\linewidth}
\begin{verbatim}
luatex cloze-text.tex
\end{verbatim}
\end{minipage}
\end{center}
\noindent
The main feature of the package is that the formatting doesn't change
when using the |hide| and |show| \TmpSecRef{sec:option-hide} options.
\newcommand{\clozelorem}{%
Lorem ipsum \cloze{dolor sit} amet, consectetur \cloze{adipisicing}
elit, sed do eiusmod tempor incididunt ut labore et \cloze{dolore magna}
aliqua. Ut enim ad minim veniam, quis nostrud \cloze{exercitation}
ullamco laboris nisi ut \cloze{aliquip} ex ea commodo consequat.%
}
\begin{TmpExample}
\clozelorem
\end{TmpExample}
\clozeset{hide}
\noindent
The command |\clozeset{hide}| only shows gaps. When you put both texts
on top of each other you will see that they perfectly match.
\begin{TmpExample}
\clozelorem
\end{TmpExample}
\clozeset{show}
%-----------------------------------------------------------------------
% Usage
%-----------------------------------------------------------------------
\section{Usage}
%-----------------------------------------------------------------------
%
%-----------------------------------------------------------------------
\subsection{Interfaces}
The main difference between the plain \TeX{} and the \LaTeX{} interface
is option handling. In \LaTeX{} options can be set by using key-value
pairs. In plain \TeX{} the only possibility to set options is to use the
macro \cmd{\clozesetoption} \TmpSecRef{sec:command-clozesetoption}.
%%
%
%%
\subsubsection{The plain \TeX{} interface}
\begin{minted}{tex}
\input cloze.tex
\clozesetoption{margin}{1cm}
\clozeshow
Lorem \cloze{ipsum} dolor.
\bye
\end{minted}
%%
%
%%
\subsubsection{The \LaTeX{} interface}
\begin{minted}{latex}
\documentclass{article}
\usepackage[show,margin=1cm]{cloze}
\begin{document}
Lorem \cloze{ipsum} dolor.
\end{document}
\end{minted}
\subsection{The commands and environments}
There are the commands
\cmd{\cloze},
\cmd{\clozefix},
\cmd{\clozefil},
\cmd{\clozenol},
\cmd{\clozeparcapture},
\cmd{\clozestrike} and the environments
|clozepar| and
|clozebox|
to generate cloze texts.
%%
% \cloze
%%
\subsubsection{\cmd{\cloze}}
\label{sec:command-cloze}
\DescribeMacro{\cloze} \cmd{\cloze}\oarg{options}\marg{some text}: The
command \cmd{\cloze} is similar to a command that offers the possibility
to underline the texts. \cmd{\cloze} does not prevent line breaks. The
width of a gap depends on the number of letters and the font used.
The only option which affects the widths of a gap is the option
|margin| \TmpSecRef{sec:option-margin}.
\begin{TmpExample}
Lorem ipsum \cloze{dolor} sit amet, \cloze{consectetur} adipisicing
elit, sed do eiusmod tempor incididunt ut labore et dolore
\cloze{magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi} ut aliquip ex ea commodo consequat.
\end{TmpExample}
\noindent It is possible to convert a complete paragraph into a `gap'.
But don't forget: There is a special environment for this: \tt{clozepar}
\TmpSecRef{sec:command-clozepar}.
\begin{TmpExample}
\cloze{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat.}
\end{TmpExample}
\noindent The command \cmd{\cloze} doesn’t (better shouldn’t) change
the behavior of the hyphenation. Let’s try some long German words (Known
issue: Sometimes you have to insert manual hyphenation points (|\-|). I
don’t know why. Solutions and suggestions are very welcome.):
\begin{TmpExample}
es
\cloze{Te\-le\-kom\-mu\-ni\-ka\-tions\-ü\-ber\-wach\-ung}
geht
\cloze{Un\-ter\-neh\-mens\-steu\-er\-fort\-ent\-wick\-lungs\-ge\-setz}
\cloze{Ab\-teil\-ungs\-lei\-ter\-in}
\cloze{Ober\-kom\-mi\-sar\-in}
auch
\cloze{Fil\-lial\-lei\-ter\-in}
kurz.
\end{TmpExample}
%%
% \clozesetfont
%%
\subsubsection{\cmd{\clozesetfont}}
\label{sec:command-clozesetfont}
\label{sec:command-clozefont}
\DescribeMacro{\clozesetfont}
The gap font can be changed by using the command
\cmd{\clozesetfont}. \tt{\string\cloze\-set\-font} redefines the command
\cmd{\clozefont} which contains the font definition.
Thus, the command \tt{\string\clozesetfont\string{\string\Large\string}}
has the same effect as
|\def\clozefont{\Large}|.
\clozesetfont{\Large}
\begin{TmpExample}
Excepteur \cloze{sint} occaecat \cloze{cupidatat} non proident.
\end{TmpExample}
\noindent Please do not put any color definitions in
\cmd{\clozesetfont}, as it won't work. Use the option
|textcolor| instead \TmpSecRef{sec:option-textcolor}.
|\clozesetfont{\ttfamily\normalsize}| changes the gap text for example
into a normal sized typewriter font.
\clozesetfont{\ttfamily\normalsize}
\begin{TmpExample}
Excepteur \cloze{sint} occaecat \cloze{cupidatat} non proident.
\end{TmpExample}
\clozesetfont{\itshape}
\noindent
If you use clozes in math mode you have to overwrite the default cloze
font (|\clozesetfont{\itshape}|) of the package, because \cmd{\itshape}
is not available in math mode. |\clozesetfont{}| will do the
trick.
%%
% \clozefix
%%
\subsubsection{\cmd{\clozefix}}
\label{sec:command-clozefix}
\DescribeMacro{\clozefix} \cmd{\clozefix}\oarg{options}\marg{some text}:
The command \cmd{\clozefix} creates gaps with a fixed width. The
clozes are default concering the width \tt{\ClozeGetOption{width}}.
\begin{TmpExample}
\noindent Lorem ipsum dolor sit amet:
\begin{compactenum}
\item \clozefix[width=5cm]{consectetur}
\item \clozefix[width=5cm]{adipisicing}
\item \clozefix[width=5cm]{elit}
\end{compactenum}
sed do eiusmod.
\end{TmpExample}
\noindent
Gaps with a fixed width are much harder to solve.
\begin{TmpExample}
Lorem ipsum dolor \clozefix[align=center,width=3cm]{sit} amet,
\clozefix[align=center,width=3cm]{consectetur} adipisicing elit, sed do
eiusmod tempor incididunt \clozefix[align=center,width=3cm]{ut} labore
et dolore magna aliqua.
\end{TmpExample}
\noindent
Using the option |align| you can make nice tabulars like this:
\begin{TmpExample}
\begin{tabular}{p{5cm}p{4cm}}
\raggedleft Composer & Life span \\
\clozefix[width=5cm,align=right]{Joseph Haydn} &
\clozefix{1723-1809} \\
\clozefix[width=5cm,align=right]{Wolfgang Amadeus Mozart} &
\clozefix{1756-1791} \\
\clozefix[width=5cm,align=right]{Ludwig van Beethoven} &
\clozefix{1770-1827} \\
\end{tabular}
\end{TmpExample}
%%
% \clozenol
%%
\subsubsection{\cmd{\clozenol}}
\label{sec:command-clozenol}
\DescribeMacro{\clozenol} \cmd{\clozenol}\oarg{options}\marg{some text}:
The macro name |clozenol| stands for \emph{“cloze no line”}. As the
the name suggests this macro typesets cloze texts without a line.
\cmd{\clozenol} is a convenient abbreviation for
|\cloze[thickness=0pt]{text}|.
\begin{minted}{latex}
Lorem \clozenol{ipsum dolor} sit amet.
\end{minted}
\begin{TmpExample}
Lorem \clozenol{ipsum dolor} sit amet.
\end{TmpExample}
\begin{minted}{latex}
Lorem \clozenol[textcolor=green]{ipsum dolor} sit amet.
\end{minted}
\begin{TmpExample}
Lorem \clozenol[textcolor=green]{ipsum dolor} sit amet.
\end{TmpExample}
\noindent
The next examples are showing that \cmd{\clozenol} behaves exactly as
\cmd{\clozenol} with the option |thickness=0pt|
(|\cloze[thickness=0pt]|) set: The text layout doesn’t change if we are
hiding the gaps and the hidden text is not really hidden. It is removed.
It can not be copied.
\begin{mdframed}[backgroundcolor=gray!40]
Lorem ipsum \clozenol{dolor sit amet, consetetur sadipscing elitr, sed
diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
erat, sed diam voluptua} sit amet.
\end{mdframed}
\noindent
Now hide the text
\clozehide
\begin{mdframed}[backgroundcolor=gray!40]
Lorem ipsum \clozenol{dolor sit amet, consetetur sadipscing elitr, sed
diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
erat, sed diam voluptua} sit amet.
\end{mdframed}
\clozeshow
%%
% \clozefil
%%
\subsubsection{\cmd{\clozefil}}
\label{sec:command-clozefil}
\DescribeMacro{\clozefil} \cmd{\clozefil}\oarg{options}\marg{some text}:
The name of the command is inspired by \cmd{\hfil}, \cmd{\hfill}, and
\cmd{\hfilll}. \cmd{\clozefil} fills out all available horizontal
space with a line. The macros \cmd{\clozefill} and \cmd{\clozefilll}
doesn’t exist, only \cmd{\clozefil} (with one |l|) does.
\def\TmpExampleClozefil{
Complete the sentences below to share more about yourself:
\bigskip
\noindent
I am someone who love \clozefil{to write cloze worksheets in \TeX}.
\noindent
I am someone who hate \clozefil{to write cloze worksheets in MS Word}.
\noindent
I am someone who can \clozefil{write cloze worksheets in \TeX}.
\noindent
I am someone who can’t \clozefil{write cloze worksheets in MS Word}.
}
\bigskip
\TmpHide
\begin{TmpExample}
\TmpExampleClozefil
\end{TmpExample}
\TmpShow
\begin{TmpExample}
\TmpExampleClozefil
\end{TmpExample}
%%
% \clozeextend
%%
\subsubsection{\cmd{\clozeextend}}
\label{sec:command-clozeextend}
\DescribeMacro{\clozeextend} \cmd{\clozeextend}\oarg{spaces}: The
command |\clozeextend| adds some invisible placeholders to extend some
cloze texts with blank space. Keep in mind that there is the option
\tt{minlines} \TmpSecRef{sec:option-minlines}, if you want to extend some
cloze paragraphs.
Corresponding options:
\begin{description}
\item[extension\_count]: The number of extension units.
\item[extension\_height]: The height of one extension unit (default: 2ex).
\item[extension\_width]: The width of one extension unit (default: 1em).
\end{description}
\begin{minted}{latex}
\begin{itemize}
\item \clozefil{Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua.}
\item \clozefil{Ut enim ad minim veniam \clozeextend[20]}
\item \clozefil{quis nostrud \clozeextend[20]}
\end{itemize}
\end{minted}
\begin{TmpExample}
\begin{itemize}
\item \clozefil{Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua.}
\item \clozefil{Ut enim ad minim veniam \clozeextend[20]}
\item \clozefil{quis nostrud \clozeextend[20]}
\end{itemize}
\end{TmpExample}
%%
% clozepar
%%
\subsubsection{\tt{clozepar}}
\label{sec:command-clozepar}
\DescribeEnv{clozepar} |\begin{clozepar}|\oarg{options} \dots
\textit{some text} \dots |\end{clozepar}|: The environment \tt{clozepar}
transforms a complete paragraph into a cloze text. The options |align|,
|margin| and |width| have no effect on this environment.
\begin{TmpExample}
Lorem ipsum dolor sit amet, consectetur adipisicing elit ullamco laboris
nisi.
\begin{clozepar}
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum.
\end{clozepar}
Excepteur sint occaecat cupidatat non proident.
\end{TmpExample}
%%
% \clozeparplain
%%
\subsubsection{\cmd{\clozeparplain}}
\label{sec:command-clozeparplain}
\DescribeMacro{\clozeparplain} \cmd{\clozeparplain}: The command
\cmd{\clozeparplain} is the macro version of the environment |clozepar|
\TmpSecRef{sec:command-clozepar}. It is intended to provide cloze
support on full paragraphs in plain Lua\TeX.
%%
% \clozeparcapture
%%
\subsubsection{\cmd{\clozeparcapture}}
\label{sec:command-clozeparcapture}
\DescribeMacro{\clozeparcapture} \cmd{\clozeparcapture}: The command is
defined to capture all text until the next paragraph (|\par|):
\mintinline{latex}{\def\clozeparcapture#1\par{...}}. In some cases (see
example below) you have to set the paragraph end manually by inserting a
|\par|.
\begin{minted}{latex}
\begin{enumerate}
\item Solid state drives (SSD) ...
\clozeparcapture
They do not need to get up to speed to work properly / No latency;
...
\par
\end{enumerate}
\end{minted}
\TmpReduceVspace
% https://www.bitsofbytes.co/exam-questions---memory--storage.html
\begin{TmpExample}
\begin{enumerate}
\item Solid state drives (SSD) are replacing hard disc drives (HDD) in
some computers. Give some reasons why this is happening.
\clozeparcapture
They do not need to get up to speed to work properly / No latency;
Less power consumption / More energy efficient;
Run cooler;
Run quieter;
Data access is faster;
Occupies less physical space - more compact;
Lighter, so suitable for portable computer / laptop;
No moving parts so more reliable / durable in a portable computer / laptop.
\par
\end{enumerate}
\end{TmpExample}
\noindent
It is often sufficient to insert an empty line.
\begin{minted}{latex}
Explain three ways that RAM is different to ROM.
1:
\clozeparcapture RAM is Volatile, ROM is non-volatile
2:
\end{minted}
\TmpReduceVspace
% https://www.bitsofbytes.co/exam-questions---memory--storage.html
\begin{TmpExample}
\noindent
Explain three ways that RAM is different to ROM.
\def\TmpWay#1{\medskip\noindent\textbf{#1:}\medskip}
\TmpWay{1}
\clozeparcapture RAM is Volatile, ROM is non-volatile
\TmpWay{2}
\clozeparcapture RAM is temporary, ROM is (semi) permanent
\TmpWay{3}
\clozeparcapture RAM normally has a larger capacity than ROM \par
\end{TmpExample}
%%
% clozebox
%%
\subsubsection{\tt{clozebox}}
\label{sec:command-clozebox}
\DescribeEnv{clozebox} |\begin{clozebox}|*\oarg{options} \dots
\textit{some text} \dots |\end{clozebox}|: The environment \tt{clozebox}
surrounds a text with a box. The starred version omits the line around
the box. Use the options |boxheight| \TmpSecRef{sec:option-boxheight}
and |boxwidth| \TmpSecRef{sec:option-boxwidth} to specify the dimensions
of the box. By default the width of the box is |\linewidth|. The height
of the box is determined by the amount of text. This environment is
realized by a combination of the |minipage| environment surrounded by a
\cmd{\fbox}. For the cloze text the macro \cmd{\clozenol} is reused. New
paragraphs are not allowed inside a cloze box. Use two backslashes
multiple times |\\| instead.
\begin{minted}{latex}
\begin{clozebox}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
\end{clozebox}
\end{minted}
\begin{multicols}{2}
\TmpHide
\begin{TmpExample}
\begin{clozebox}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
\end{clozebox}
\end{TmpExample}
\columnbreak
\TmpShow
\begin{TmpExample}
\begin{clozebox}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
\end{clozebox}
\end{TmpExample}
\end{multicols}
\noindent
Like with all cloze macros and environments the hidden text vanishes
from the rendered file. The starred version omits the line around the
box:
% starred
\begin{multicols}{2}
\begin{minted}{latex}
\begin{clozebox}*
Lorem ...
\end{clozebox}
\end{minted}
\columnbreak
\begin{TmpExample}
\begin{center}
\begin{clozebox}*
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
\end{clozebox}
\end{center}
\end{TmpExample}
\end{multicols}
%%
% clozespace
%%
\subsubsection{\tt{clozespace}}
\label{sec:command-clozespace}
\DescribeEnv{clozespace} |\begin{clozespace}|\oarg{options} \dots
\textit{some text} \dots |\end{clozespace}|: If you are using a
bigger font for the cloze text as for the normal text, you are getting
irregular distances between the lines:
\def\TmpOrbit{
\clozesetfont{\Huge\fontspec{Kalam}}
Today in the Discovery Lab we learned about three types of spacecraft
that are helping us explore \cloze{Mars}. The \cloze{spacecraft} are on
Mrs. Bratt’s Principal’s Reading Challenge board. One type of spacecraft
is the \cloze{orbiter}.
}
\begin{minted}{latex}
\clozesetfont{\Huge\fontspec{Kalam}}
Today in the Discovery ...
\end{minted}
\TmpReduceVspace
% https://en.wikipedia.org/wiki/Cloze_test#/media/File:Student_matching_cloze_terms_on_smartboard.jpg
\begin{TmpExample}
\TmpOrbit
\end{TmpExample}
\noindent
With the environment |clozespace| you are able to restore the regular
balanced line spacing. The default value for the option |spacing| is
\tt{\ClozeGetOption{spacing}}. Also take a look in the section about the
option |spacing| \TmpSecRef{sec:option-spacing}.
\begin{minted}{latex}
\begin{clozespace}[spacing=2]
...
\end{clozespace}
\end{minted}
\TmpReduceVspace
\begin{TmpExample}
\begin{clozespace}[spacing=2]
\TmpOrbit
\end{clozespace}
\TmpReduceVspace
\end{TmpExample}
\noindent
The environment |clozespace| uses the package
\href{https://www.ctan.org/pkg/setspace}{setspace} in the background for
setting the spacing between the lines.
%%
% \clozeline
%%
\subsubsection{\cmd{\clozeline}}
\label{sec:command-clozeline}
\DescribeMacro{\clozeline}
%
\cmd{\clozeline}\oarg{options}: To create a cloze line of a certain
width, use the command \cmd{\clozeline}. The default width of the line
is \tt{\ClozeGetOption{width}}. In combination with the other cloze
commands you can create for example an irregular alignment of the cloze
text.
\begin{minted}{latex}
Ut enim ad
\clozeline[width=1cm]\cloze{minim}\clozeline[width=3cm]
minim veniam
\end{minted}
\begin{TmpExample}
Ut enim ad \clozeline[width=1cm]\cloze{minim}\clozeline[width=3cm] minim
veniam,
\end{TmpExample}
%%
% \clozelinefil
%%
\subsubsection{\cmd{\clozelinefil}}
\label{sec:command-clozelinefil}
\DescribeMacro{\clozelinefil}
\cmd{\clozelinefil}\oarg{options}:
This command \cmd{\clozelinefil} fills the
complete available horizontal space with a line. Moreover,
\cmd{\clozelinefil} was used to create \cmd{\clozefil}.
\begin{TmpExample}
Lorem\clozelinefil
\end{TmpExample}
%%
% \clozestrike
%%
% \subsubsection{\cmd{\clozestrike}}
% \label{sec:command-clozelinefil}
% \DescribeMacro{\clozestrike}
% \cmd{\clozestrike}\oarg{options}\marg{wrong text}\marg{correct text}:
% This macro can be useful for worksheets that contain intentionally
% errors. The pupils have to find and cross out the mistakes and
% write the right solution on top of the errors.
% \begin{minted}{latex}
% Wolfgang Amadeus Mozart was born in \clozestrike{Vienna}{Salzburg}.
% \end{minted}
% \begin{TmpExample}
% Wolfgang Amadeus Mozart was born in \clozestrike[textcolor=green]{Vienna}{Salzburg}.
% \end{TmpExample}
% \noindent
% The option |linecolor| has no effect on the lines produced by the
% macro \cmd{\clozestrike}. The line color and and the text color
% are both the same, because the pupils have to draw the lines.
% \begin{minted}{latex}
% Mozart’s father was called
% \clozestrike[textcolor=red]{Ludwig}{Leopold} Mozart.
% \end{minted}
% \begin{TmpExample}
% Mozart’s father was called
% \clozestrike[textcolor=red]{Ludwig}{Leopold} Mozart.
% \end{TmpExample}
%-----------------------------------------------------------------------
% Options
%-----------------------------------------------------------------------
\subsection{The options}
\subsubsection{Overview over all options}
\def\TmpDescriptionLine#1{
{\footnotesize#1}
}
\begin{tabular}{lll}
\textbf{Option} &
\textbf{Description} &
\textbf{Reference} \\\hline
\tt{align} &
\TmpDescriptionLine{Align the text of a fixed size cloze (\cmd{\clozefix})}. &
\TmpSecRef{sec:option-align} \\
\tt{boxheight} &
\TmpDescriptionLine{The height of a cloze box (\tt{clozebox}).} &
\TmpSecRef{sec:option-boxheight} \\
\tt{boxrule} &
\TmpDescriptionLine{The thickness of the rule around a \tt{clozebox}.} &
\TmpSecRef{sec:option-boxrule} \\
\tt{boxwidth} &
\TmpDescriptionLine{The width of a cloze box (\tt{clozebox}).} &
\TmpSecRef{sec:option-boxwidth} \\
\tt{distance} &
\TmpDescriptionLine{The distance between the cloze text and the cloze line.} &
\TmpSecRef{sec:option-distance} \\
\tt{hide} &
\TmpDescriptionLine{Hide the cloze text.} &
\TmpSecRef{sec:option-hide} \\
\tt{linecolor} &
\TmpDescriptionLine{A color name to colorize the cloze line.} &
\TmpSecRef{sec:option-linecolor} \\
\tt{margin} &
\TmpDescriptionLine{Additional margin between the normal and the cloze text.} &
\TmpSecRef{sec:option-margin} \\
\tt{minlines} &
\TmpDescriptionLine{The minimum of lines a \tt{clozepar} environment must have.} &
\TmpSecRef{sec:option-minlines} \\
\tt{show} &
\TmpDescriptionLine{Show the cloze text.} &
\TmpSecRef{sec:option-show} \\
\tt{spacing} &
\TmpDescriptionLine{The distance of the lines in the environment \tt{clozespace}.} &
\TmpSecRef{sec:option-spacing} \\
\tt{textcolor} &
\TmpDescriptionLine{A color name to colorize the cloze text.} &
\TmpSecRef{sec:option-textcolor} \\
\tt{thickness} &
\TmpDescriptionLine{The thickness of a line.} &
\TmpSecRef{sec:option-thickness} \\
\tt{width} &
\TmpDescriptionLine{The width of a fixed size cloze (\cmd{\clozefix}).} &
\TmpSecRef{sec:option-show} \\
\end{tabular}
%%
%
%%
\noindent
\begin{tikzpicture}[x=1cm,y=1cm,scale=0.8,transform shape]
% \draw (0,0) grid[step=1] (13,8);
% \draw[help lines] (0,0) grid[step=0.2] (13,8);
\node (cloze) at (-1,0) [node font=\fontsize{180}{1.2},anchor=south west]{
\cloze[distance=15pt,thickness=3pt,margin=40pt]{cl…}
};
\node (distance) at (3,1.9) {distance};
\draw [|<->|] (4,1.7) -- (4,2.05);
\node (thickness) at (0,1.65) {thickness};
\draw [->] (1.3,2.2) -- (1.3,1.8);
\draw [->] (1.3,1) -- (1.3,1.4);
\node (margin) at (2.2,4) {margin};
\draw [|<->|] (1.5,3.5) -- (3,3.5);
\node (margin) at (11.75,4) {margin};
\draw [|<->|] (11,3.5) -- (12.5,3.5);
\node (textcolor) at (4.5,6) {textcolor};
\draw [->] (textcolor) -- (6.4,5);
\node (linecolor) at (7,0.5) {linecolor};
\draw [->] (linecolor) -- (7,1.5);
\end{tikzpicture}
%%
% clozefix
%%
\noindent
\begin{tikzpicture}[
x=1cm,
y=1cm,
clozefix/.style={
node font=\fontsize{40}{1.2}
},
scale=0.95,
transform shape
]
% \draw (0,0) grid[step=1] (13,7);
% \draw[help lines] (0,0) grid[step=0.2] (13,7);
\node (right) at (7,6) [clozefix]{
\clozefix[distance=10pt,thickness=2pt,width=8cm,align=right]{clozefix}
};
\node (center) at (5,4) [clozefix]{
\clozefix[distance=10pt,thickness=2pt,width=8cm,align=center]{clozefix}
};
\node (left) at (3,2) [clozefix]{
\clozefix[distance=10pt,thickness=2pt,width=8cm]{clozefix}
};
\node (width) at (5,0.7) {width};
\draw [|<->|] (0.8,1) -- (8.7,1);
\node (alignleft) at (6.5,2) {align=left};
\node (aligncenter) at (3.3,4) {align=center};
\node (alignright) at (7,6) {align=right};
\end{tikzpicture}
\clozereset
\begin{tikzpicture}