diff options
author | Karl Berry <karl@freefriends.org> | 2020-05-20 21:39:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-05-20 21:39:46 +0000 |
commit | b9251a47b4f363da2f79b10bbc8723522c207bce (patch) | |
tree | cbc5e3c0facde52a02f0232abad5e9655e287561 /Master/texmf-dist/source | |
parent | d1eeaae011ac8b28bbf550e24bc737dfba489a9d (diff) |
cloze (20may20)
git-svn-id: svn://tug.org/texlive/trunk@55221 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/lualatex/cloze/cloze.dtx | 853 |
1 files changed, 654 insertions, 199 deletions
diff --git a/Master/texmf-dist/source/lualatex/cloze/cloze.dtx b/Master/texmf-dist/source/lualatex/cloze/cloze.dtx index 18780780f20..e8d7e3ea171 100644 --- a/Master/texmf-dist/source/lualatex/cloze/cloze.dtx +++ b/Master/texmf-dist/source/lualatex/cloze/cloze.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2015-2016 by Josef Friedrich <josef@friedrich.rocks> +% Copyright (C) 2015-2020 by Josef Friedrich <josef@friedrich.rocks> % ---------------------------------------------------------------------- % This work may be distributed and/or modified under the conditions of % the LaTeX Project Public License, either version 1.3 of this license @@ -28,13 +28,15 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{cloze} %<*package> - [2016/06/23 v1.2 Package to typeset cloze worksheets or cloze tests] + [2020/05/20 v1.4 Package to typeset cloze worksheets or cloze tests] %</package> %<*driver> \documentclass{ltxdoc} \usepackage[show]{cloze} +\usepackage{graphicx} \usepackage{paralist} \usepackage{titlesec} +\usepackage{mdframed} \titleformat{\paragraph}[hang]{% \normalfont\normalsize\bfseries% }{\theparagraph}{1em}{} @@ -59,38 +61,9 @@ \newcommand{\@minipagerestore}{\setlength{\parindent}{10pt}} \makeatother -\newsavebox{\examplebox} -\newenvironment{clozeexample}{% - \noindent% - \begin{lrbox}{\examplebox}% - \begin{minipage}{0.9\textwidth}% - \footnotesize% -}{% - \end{minipage}% - \end{lrbox}% - \begin{center}% - \fbox{\usebox{\examplebox}}% - \end{center}% -} - -% Colors for the codebox -\definecolor{grayline}{gray}{0.9} +\newmdenv{example} \definecolor{graybackground}{gray}{0.97} - -\newsavebox{\codebox} -\newenvironment{code}{% - \noindent% - \begin{lrbox}{\codebox}% - \begin{minipage}{0.9\textwidth}% -}{% - \end{minipage}% - \end{lrbox}% - \begin{center}% - \fcolorbox{grayline}{graybackground}{\usebox{\codebox}}% - \end{center}% -} - -\newcommand{\tighten}{\vspace{-6pt}} +\surroundwithmdframed[backgroundcolor=graybackground]{verbatim} \newcommand{\getdefaults}[1]{% \directlua{tex.print(cloze.get_defaults('#1'))}% @@ -114,7 +87,7 @@ \raggedleft% \MacroFont% \tt{% - #1% + \scantokens{\catcode`\_=12\relax#1}% }% }% } @@ -181,11 +154,9 @@ Lua\TeX{} that would be extremely painful otherwise"} in TUGboat, Volume the capabilities of the modern \TeX{} engine \emph{Lua\TeX}. Therefore, you must use Lua\LaTeX{} to create documents containing gaps. -\begin{code} \begin{verbatim} lualatex cloze-text.tex \end{verbatim} -\end{code} The main feature of the package is that the formatting doesn't change when using the |hide| and |show| \secref{sec:option-hide} options. @@ -197,18 +168,18 @@ aliqua. Ut enim ad minim veniam, quis nostrud \cloze{exercitation} ullamco laboris nisi ut \cloze{aliquip} ex ea commodo consequat.% } -\begin{clozeexample} +\begin{example} \clozelorem -\end{clozeexample} +\end{example} \clozeset{hide} 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{clozeexample} +\begin{example} \clozelorem -\end{clozeexample} +\end{example} \clozeset{show} @@ -218,9 +189,15 @@ on top of each other you will see that they perfectly match. \section{Usage} -There are three commands and one environment to generate -cloze texts: \cmd{\cloze}, \cmd{\clozefix}, \cmd{\clozefil} and -|clozepar|. +There are the commands +\cmd{\cloze}, +\cmd{\clozefix}, +\cmd{\clozefil}, +\cmd{\clozenol}, +\cmd{\clozestrike} and the environments +|clozepar| and +|clozebox| +to generate cloze texts. %% % \cloze @@ -238,28 +215,28 @@ 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| \secref{sec:option-margin}. -\begin{clozeexample} +\begin{example} 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{clozeexample} +\end{example} \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} \secref{sec:command-clozepar}. -\begin{clozeexample} +\begin{example} \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{clozeexample} +\end{example} \noindent The command \cmd{\cloze} doesn't change the behavior of the hyphenation. Let's try some long German words: -\begin{clozeexample} +\begin{example} es \cloze{Te\-le\-kom\-mu\-ni\-ka\-tions\-ü\-ber\-wach\-ung} geht @@ -289,7 +266,7 @@ die \cloze{Ab\-teil\-ungs\-lei\-ter\-in} Würze \cloze{Ober\-kom\-mi\-sar\-in} -\end{clozeexample} +\end{example} %% % \clozesetfont @@ -310,9 +287,9 @@ has the same effect as \clozesetfont{\Large} -\begin{clozeexample} +\begin{example} Excepteur \cloze{sint} occaecat \cloze{cupidatat} non proident. -\end{clozeexample} +\end{example} \noindent Please do not put any color definitions in \cmd{\clozesetfont}, as it won't work. Use the option @@ -323,9 +300,9 @@ into a normal sized typewriter font. \clozesetfont{\ttfamily\normalsize} -\begin{clozeexample} +\begin{example} Excepteur \cloze{sint} occaecat \cloze{cupidatat} non proident. -\end{clozeexample} +\end{example} \clozesetfont{\itshape} @@ -340,7 +317,7 @@ Excepteur \cloze{sint} occaecat \cloze{cupidatat} non proident. The command \cmd{\clozefix} creates gaps with a fixed width. The clozes are default concering the width \tt{\getdefaults{width}}. -\begin{clozeexample} +\begin{example} \noindent Lorem ipsum dolor sit amet: \begin{compactenum} \item \clozefix[width=5cm]{consectetur} @@ -348,27 +325,53 @@ clozes are default concering the width \tt{\getdefaults{width}}. \item \clozefix[width=5cm]{elit} \end{compactenum} sed do eiusmod. -\end{clozeexample} +\end{example} Gaps with a fixed width are much harder to solve. -\begin{clozeexample} +\begin{example} 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{clozeexample} +\end{example} Using the option |align| you can make nice tabulars like this: -\begin{clozeexample} +\begin{example} \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{clozeexample} +\end{example} + +%% +% \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. + +\begin{verbatim} +Lorem \clozenol{ipsum dolor} sit amet. +\end{verbatim} + +\begin{example} +Lorem \clozenol{ipsum dolor} sit amet. +\end{example} + +\begin{verbatim} +Lorem \clozenol[textcolor=green]{ipsum dolor} sit amet. +\end{verbatim} + +\begin{example} +Lorem \clozenol[textcolor=green]{ipsum dolor} sit amet. +\end{example} %% % \clozefil @@ -382,12 +385,43 @@ The name of the command is inspired by \cmd{\hfil}, \cmd{\hfill}, and \cmd{\hfilll}. Only \cmd{\clozefil} fills out all available horizontal spaces with a line. -\begin{clozeexample} +\begin{example} Lorem ipsum dolor sit amet, \clozefil{consectetur adipisicing elit, sed do eiusmod.} Ut enim \clozefil{ad minim veniam} exercitation. -\end{clozeexample} +\end{example} + +%% +% \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. + +\begin{verbatim} +\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{verbatim} + +\begin{example} +\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{example} %% % clozepar @@ -401,7 +435,7 @@ Ut enim \clozefil{ad minim veniam} exercitation. transforms a complete paragraph into a cloze text. The options |align|, |margin| and |width| have no effect on this environment. -\begin{clozeexample} +\begin{example} Lorem ipsum dolor sit amet, consectetur adipisicing elit ullamco laboris nisi. @@ -412,7 +446,140 @@ reprehenderit in voluptate velit esse cillum. \end{clozepar} Excepteur sint occaecat cupidatat non proident. -\end{clozeexample} +\end{example} + +%% +% 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 |boxwidth| and |boxheight| to specify +the dimensions of the box. By default the width of the box is +|\linewidth|. + +\begin{verbatim} +\begin{clozebox} +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{verbatim} + +\bigskip +\noindent +|\clozehide| +\clozehide +\bigskip + +\begin{center} +\begin{clozebox}[boxwidth=8cm] +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{center} + +\bigskip +\noindent +|\clozeshow| +\clozeshow +\bigskip + +\begin{center} +\begin{clozebox}[boxwidth=8cm] +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{center} + +\paragraph{Option boxwidth} +\label{sec:command-clozebox-boxwidth} +See the documentation about the option \secref{sec:option-boxwidth}. + +\begin{verbatim} +\begin{clozebox}[boxwidth=5cm] +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{verbatim} + +\begin{center} +\begin{clozebox}[boxwidth=5cm] +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{center} + +\paragraph{Option boxheight} +\label{sec:command-clozebox-boxheight} +See the documentation about the option \secref{sec:option-boxheight}. + +\begin{verbatim} +\begin{clozebox}[boxwidth=5cm,boxheight=5cm] +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{verbatim} + +\begin{center} +\begin{clozebox}[boxwidth=5cm,boxheight=5cm] +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{center} + +\paragraph{starred} + +% starred +\begin{verbatim} +\begin{clozebox}*[boxwidth=5cm,boxheight=5cm] +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{verbatim} + +\begin{center} +\begin{clozebox}*[boxwidth=5cm,boxheight=5cm] +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. +\end{clozebox} +\end{center} + +%% +% clozespace +%% + +\subsubsection{\tt{clozespace}} +\label{sec:command-clozespace} + +\DescribeEnv{clozespace} |\begin{clozespace}|\oarg{options} \dots +\textit{some text} \dots |\end{clozespace}| + +\begin{verbatim} +\begin{clozespace}[spacing=2] +\clozesetfont{\ttfamily\Huge} +Lorem \cloze{ipsum} dolor sit \cloze{amet}, consectetur adipisicing +elit, sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis \cloze{nostrud} +exercitation ullamco \cloze{laboris} nisi ut aliquip ex ea commodo +consequat. +\end{clozespace} +\end{verbatim} + +\begin{example} +\begin{clozespace}[spacing=2] +\clozesetfont{\ttfamily\Huge} +Lorem \cloze{ipsum} dolor sit \cloze{amet}, consectetur adipisicing +elit, sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Ut enim ad minim veniam, quis \cloze{nostrud} +exercitation ullamco \cloze{laboris} nisi ut aliquip ex ea commodo +consequat. +\vspace{-0.8cm} +\end{clozespace} +\end{example} %% % \clozeline @@ -428,20 +595,16 @@ To create a cloze line of a certain width, use the command \tt{\getdefaults{width}}. In combination with the other cloze commands you can create for example an irregular alignment of the cloze text. -\begin{code} \begin{verbatim} Ut enim ad \clozeline[width=1cm]\cloze{minim}\clozeline[width=3cm] minim veniam \end{verbatim} -\end{code} -\tighten - -\begin{clozeexample} +\begin{example} Ut enim ad \clozeline[width=1cm]\cloze{minim}\clozeline[width=3cm] minim veniam, -\end{clozeexample} +\end{example} %% % \clozelinefil @@ -456,9 +619,61 @@ This command \cmd{\clozelinefil} fills the complete available horizontal space with a line. Moreover, \cmd{\clozelinefil} was used to create \cmd{\clozefil}. -\begin{clozeexample} +\begin{example} Lorem\clozelinefil -\end{clozeexample} +\end{example} + +%% +% \clozestrike +%% + +\subsubsection{\cmd{\clozestrike}} +\label{sec:command-clozelinefil} + +\DescribeMacro{\clozestrike} +\cmd{\clozestrike}\oarg{options}\marg{wrong text}\marg{correct text} + +\begin{verbatim} +Lorem \clozestrike{ipsum}{dolor} sit amet. +\end{verbatim} + +\begin{example} +Lorem \clozestrike{ipsum}{dolor} sit amet. +\end{example} + +\begin{verbatim} +Lorem \clozestrike[textcolor=red]{ipsum}{dolor} sit amet. +\end{verbatim} + +\begin{example} +Lorem \clozestrike[textcolor=red]{ipsum}{dolor} sit amet. +\end{example} + +\begin{example} +\begin{clozespace} +invidunt ut \clozestrike{labore}{et dolore magna aliquyam erat}, sed +diam voluptua. At \clozestrike{vero eos}{et accusam et justo} duo +dolores et ea \clozestrike{rebum. Stet}{clita kasd gubergren}, no sea +takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum +\clozestrike{dolor sit amet, consetetur }{sadipscing elitr, sed diam} +nonumy eirmod tempor invidunt ut labore et dolore magna +aliquyam erat, \clozestrike{sed diam voluptua}{At vero}. +\end{clozespace} +\end{example} + +\begin{example} +\clozehide +\begin{clozespace} +invidunt ut \clozestrike{labore}{et dolore magna aliquyam erat}, sed +diam voluptua. At \clozestrike{vero eos}{et accusam et justo} duo +dolores et ea \clozestrike{rebum. Stet}{clita kasd gubergren}, no sea +takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum +\clozestrike{dolor sit amet, consetetur }{sadipscing elitr, sed diam} +nonumy eirmod tempor invidunt ut labore et dolore magna +aliquyam erat, \clozestrike{sed diam voluptua}{At vero}. +\end{clozespace} +\clozeshow +\end{example} %----------------------------------------------------------------------- % Options @@ -490,37 +705,29 @@ declaration, the cloze package offers a special command to set \cmd{\clozeset}\marg{global options}: The command can set \emph{global} options for each paragraph. -\begin{code} \begin{verbatim} \clozeset{textcolor=red} Lorem \cloze{ipsum} dolor \par \clozeset{textcolor=green} Lorem \cloze{ipsum} dolor \end{verbatim} -\end{code} - -\tighten -\begin{clozeexample} +\begin{example} \clozeset{textcolor=red} Lorem \cloze{ipsum} dolor \par \clozeset{textcolor=green} Lorem \cloze{ipsum} dolor -\end{clozeexample} +\end{example} \noindent \cmd{\clozeset} does not change the options within a paragraph. As you can see in the example below the last \cmd{\clozeset} applies the color green for both gaps. -\begin{code} \begin{verbatim} \clozeset{textcolor=red} Lorem \cloze{ipsum} dolor \clozeset{textcolor=green} Lorem \cloze{ipsum} dolor \end{verbatim} -\end{code} - -\tighten -\begin{clozeexample} +\begin{example} \clozeset{textcolor=red} Lorem \cloze{ipsum} dolor \clozeset{textcolor=green} Lorem \cloze{ipsum} dolor -\end{clozeexample} +\end{example} \clozereset @@ -535,7 +742,6 @@ applies the color green for both gaps. \cmd{\clozereset}: The command resets all \emph{global} options to the default values. It has no effect on the \emph{local} options. -\begin{code} \begin{verbatim} \clozeset{ thickness=3mm, @@ -544,26 +750,21 @@ default values. It has no effect on the \emph{local} options. margin=-2pt } \end{verbatim} -\end{code} - -\tighten \clozeset{thickness=3mm,linecolor=yellow,textcolor=magenta,margin=-2pt} -\begin{clozeexample} +\begin{example} Very \cloze{silly} global \cloze{options}. -\end{clozeexample} +\end{example} -\begin{code} -|\clozereset| -\end{code} +\begin{verbatim} +\clozereset +\end{verbatim} \clozereset -\tighten - -\begin{clozeexample} +\begin{example} \cloze{Relax!} We can reset \cloze{those} options. -\end{clozeexample} +\end{example} %% % \clozereset @@ -577,29 +778,25 @@ Very \cloze{silly} global \cloze{options}. \cmd{\clozeshow} and \cmd{\clozehide}: This commands are shortcuts for \cmd{\clozeset}\marg{show} and \cmd{\clozeset}\marg{hide}. -\begin{code} -|\clozehide| -\end{code} +\begin{verbatim} +\clozehide +\end{verbatim} \clozehide -\tighten - -\begin{clozeexample} +\begin{example} Lorem \cloze{ipsum dolor sit} amet, consectetur \cloze{adipisicing} elit. -\end{clozeexample} +\end{example} -\begin{code} -|\clozeshow| -\end{code} +\begin{verbatim} +\clozeshow +\end{verbatim} \clozeshow -\tighten - -\begin{clozeexample} +\begin{example} Lorem \cloze{ipsum dolor sit} amet, consectetur \cloze{adipisicing} elit. -\end{clozeexample} +\end{example} %% % align @@ -620,11 +817,35 @@ of the line is larger than the width of the text. \desc{#1}% } -\begin{clozeexample} +\begin{example} \optionsalign{left} \optionsalign{center} \optionsalign{right} -\end{clozeexample} +\end{example} + +%% +% boxheight +%% + +\subsubsection{\tt{boxheight}} +\label{sec:option-boxheight} + +|boxheight| specifies the height of a cloze box. This option has only +an effect on the environment |clozebox| \secref{sec:command-clozebox}. +An example can be found in the section about the environment +\secref{sec:command-clozebox-boxheight}. + +%% +% boxwidth +%% + +\subsubsection{\tt{boxwidth}} +\label{sec:option-boxwidth} + +|boxwidth| specifies the width of a cloze box. This option has only +an effect on the environment |clozebox| \secref{sec:command-clozebox}. +An example can be found in the section about the environment +\secref{sec:command-clozebox-boxwidth}. %% % distance @@ -647,11 +868,11 @@ to appear above the baseline. The default value is \par% } -\begin{clozeexample} +\begin{example} \optiondistance{\getdefaults{distance}} \optiondistance{3pt} \optiondistance{-3pt} -\end{clozeexample} +\end{example} %% % hide and show @@ -673,12 +894,12 @@ options -- |hide| and |show| -- the last option "wins". \desc{#1}% } -\begin{clozeexample} +\begin{example} \optionshow{hide} \optionshow{show} \optionshow{show,hide} \optionshow{hide,show} -\end{clozeexample} +\end{example} %% % linecolor and textcolor @@ -693,12 +914,10 @@ options -- |hide| and |show| -- the last option "wins". Values for both color options are color names used by the xcolor package. To define your own color use the following command: -\begin{code} \begin{verbatim} \definecolor{myclozecolor}{rgb}{0.1,0.4,0.6} \cloze[textcolor=myclozecolor]{Lorem ipsum} \end{verbatim} -\end{code} \definecolor{myclozecolor}{rgb}{0.1,0.4,0.6} \newcommand{\optioncolor}[2]{% @@ -708,21 +927,19 @@ package. To define your own color use the following command: \par% } -\tighten - -\begin{clozeexample} +\begin{example} \optioncolor{textcolor}{myclozecolor} \optioncolor{textcolor}{red} \optioncolor{textcolor}{green} -\end{clozeexample} +\end{example} \noindent You can use the same color names to colorize the cloze lines. -\begin{clozeexample} +\begin{example} \optioncolor{linecolor}{myclozecolor} \optioncolor{linecolor}{red} \optioncolor{linecolor}{green} -\end{clozeexample} +\end{example} %% % margin @@ -743,13 +960,13 @@ and \cmd{\clozefil}. The default value of the option is \desc{#1}% } -\begin{clozeexample} +\begin{example} \optionmargin{0pt} \optionmargin{5mm} \optionmargin{1cm} \optionmargin{6em} \optionmargin{-4pt} -\end{clozeexample} +\end{example} % Folgt ein Satzzeichen direkt auf eine Lücke, so findet der % Zeilenumbruch erst nach dem Satzzeichen statt. Auch ein noch so großer @@ -758,16 +975,29 @@ and \cmd{\clozefil}. The default value of the option is line breaks after this punctation mark. Even the most large value of |margin| does not affect this behavior. -\begin{clozeexample} +\begin{example} \clozeset{margin=3mm} \cloze{Lorem}, \cloze{ipsum}. \cloze{dolor}; \cloze{sit}: \cloze{amet}, \cloze{consectetur}. \cloze{adipisicing}; \cloze{elit}: \cloze{sed}, \cloze{do}. \cloze{eiusmod}; \cloze{tempor}. -\end{clozeexample} +\end{example} \clozereset %% +% spacing +%% + +\subsubsection{\tt{spacing}} +\label{sec:option-spacing} + +\option{spacing}{number}: This option provides support for setting the +spacing between lines. A larger font used for the cloze texts needs +more line space to avoid unsteady line distances. +This option only affects the environment |clozespace| +\secref{sec:command-clozespace}. + +%% % thickness %% @@ -786,11 +1016,11 @@ option is \tt{\getdefaults{thickness}}. \desc{#1}% } -\begin{clozeexample} +\begin{example} \optionthickness{0.01pt} \optionthickness{1pt} \optionthickness{2pt} -\end{clozeexample} +\end{example} %% % width @@ -809,11 +1039,11 @@ option is \tt{\getdefaults{width}}. \desc{#1}% } -\begin{clozeexample} +\begin{example} \optionwidth{3cm} \optionwidth{5cm} \optionwidth{7cm} -\end{clozeexample} +\end{example} %----------------------------------------------------------------------- % Special application areas @@ -827,21 +1057,19 @@ option is \tt{\getdefaults{width}}. \subsubsection{The \tt{tabbing} environment} -\begin{code} \begin{verbatim} \begin{tabbing} col1 \hspace{1cm} \= col2 \hspace{1cm} \= col3 \hspace{1cm} \= col4 \\ \cloze{col1} \> \> \clozefix{col3} \\ \end{tabbing} \end{verbatim} -\end{code} -\begin{clozeexample} +\begin{example} \begin{tabbing} col1 \hspace{1cm} \= col2 \hspace{1cm} \= col3 \hspace{1cm} \= col4 \\ \cloze{col1} \> \> \clozefix{col3} \\ \end{tabbing} -\end{clozeexample} +\end{example} %% % picture @@ -849,7 +1077,6 @@ col1 \hspace{1cm} \= col2 \hspace{1cm} \= col3 \hspace{1cm} \= col4 \\ \subsubsection{The \tt{picture} environment} -\begin{code} \begin{verbatim} \begin{picture}(320,100) \put(80,25){\cloze{Lorem}} @@ -857,15 +1084,14 @@ col1 \hspace{1cm} \= col2 \hspace{1cm} \= col3 \hspace{1cm} \= col4 \\ \put(240,75){\clozefil{dolor}} \end{picture} \end{verbatim} -\end{code} -\begin{clozeexample} +\begin{example} \begin{picture}(320,100) \put(80,25){\cloze{Lorem}} \put(160,50){\clozefix{ipsum}} \put(240,75){\clozefil{dolor}} \end{picture} -\end{clozeexample} +\end{example} %% % tabular @@ -873,7 +1099,6 @@ col1 \hspace{1cm} \= col2 \hspace{1cm} \= col3 \hspace{1cm} \= col4 \\ \subsubsection{The \tt{tabular} environment} -\begin{code} \begin{verbatim} \begin{tabular}{l c} \cloze{Lorem} & \cloze{ipsum} \\ @@ -881,18 +1106,17 @@ col1 \hspace{1cm} \= col2 \hspace{1cm} \= col3 \hspace{1cm} \= col4 \\ \cloze{sed} & \cloze{do} \\ \end{tabular} \end{verbatim} -\end{code} % No |c| inside because of short verbatim. -\begin{clozeexample} +\begin{example} \clozeset{width=1cm} \begin{tabular}{l c} \cloze{Lorem} & \cloze{ipsum} \\ \clozefix{amet} & \clozefix{consectetur} \\ \cloze{sed} & \cloze{do} \\ \end{tabular} -\end{clozeexample} +\end{example} \DocInput{cloze.dtx} \pagebreak @@ -958,7 +1182,7 @@ or manually: %</readme> % \fi % -% \CheckSum{128} +% \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -979,9 +1203,15 @@ or manually: % % \changes{v0.1}{2015/06/16}{Converted to DTX file} % \changes{v1.0}{2015/07/08}{Inital release} -% \changes{v1.1}{2016/06/13}{Make cloze compatible to LuaTeX version 0.95} +% \changes{v1.1}{2016/06/13}{Make cloze compatible to LuaTeX version +% 0.95} % \changes{v1.2}{2016/06/23}{The cloze makros are now working in % tabular, tabbing and picture environments} +% \changes{v1.3}{2017/03/13}{Add the new macros \cmd{\clozenol} and +% \cmd{\clozeextend} and the environments \texttt{clozebox} and +% \texttt{clozespace} (This version was not published on CTAN.)} +% \changes{v1.4}{2020/05/20}{Add the new macro \cmd{\clozestrike} and +% improve the documentation} % % \DoNotIndex{\newcommand,\newenvironment,\def,\directlua} % @@ -1001,26 +1231,56 @@ or manually: % % \subsection{The file \tt{cloze.sty}} % -% This four packages are used to build \emph{cloze}: +% This packages are used to build \emph{cloze}: % -% \begin{itemize} -% \item \href{https://www.ctan.org/pkg/fontspec}{fontspec} is not +% \subsubsection{Dependencies} +% +% The package \href{https://www.ctan.org/pkg/fontspec}{fontspec} is not % necessarily required. When using Lua\LaTeX{} it is good form to load % it. Apart from this the package supplies helpful messages, when you % compile a Lua\LaTeX{} document with pdf\LaTeX{}. -% -% \item \href{https://www.ctan.org/pkg/luatexbase}{luatexbase} allows to -% register multiple Lua callbacks. -% -% \item \href{https://www.ctan.org/pkg/kvoptions}{kvoptions} takes the -% handling of the options. -% -% \item \href{https://www.ctan.org/pkg/xcolor}{xcolor} is required to -% colorize the text and the line of a gap. -% \end{itemize} +% \begin{macrocode} +\RequirePackage{fontspec} +% \end{macrocode} +% The package \href{https://www.ctan.org/pkg/luatexbase}{luatexbase} +% allows to register multiple Lua callbacks. +% \begin{macrocode} +\RequirePackage{luatexbase-mcb} +% \end{macrocode} +% The package \href{https://www.ctan.org/pkg/kvoptions}{kvoptions} +% takes the handling of the options. +% \begin{macrocode} +\RequirePackage{kvoptions} +% \end{macrocode} +% The package \href{https://www.ctan.org/pkg/setspace}{setspace} is used +% by the environment |clozespace|. +% \begin{macrocode} +\RequirePackage{setspace} +% \end{macrocode} +% The package \href{https://www.ctan.org/pkg/xcolor}{xcolor} is required +% to colorize the text and the line of a gap. +% \begin{macrocode} +\RequirePackage{xcolor} +% \end{macrocode} +% The package \href{https://www.ctan.org/pkg/xcolor}{xparse} is used by +% the environment |clozebox|. +% \begin{macrocode} +\RequirePackage{xparse} +% \end{macrocode} +% The package \href{https://www.ctan.org/pkg/stackengine}{stackengine} +% is required by the command |\clozestrike{}{}|. +% \begin{macrocode} +\RequirePackage{stackengine} +% \end{macrocode} +% The package \href{https://www.ctan.org/pkg/ulem}{ulem} is required by +% the command |\clozestrike{}{}|. +% \begin{macrocode} +\RequirePackage{ulem} +\normalem +% \end{macrocode} % % \begin{macrocode} -\RequirePackage{fontspec,luatexbase-mcb,kvoptions,xcolor} +\RequirePackage{transparent} % \end{macrocode} % % Load the cloze lua module and put all return values in the variable @@ -1032,6 +1292,10 @@ or manually: } % \end{macrocode} % +% \begin{macrocode} +\newif\ifclozeshow\clozeshowtrue +% \end{macrocode} +% % \subsubsection{Internal macros} % % \begin{macro}{\cloze@set@to@global} @@ -1170,6 +1434,30 @@ or manually: \define@key{CLZ}{align}[]{\cloze@set@option[align]{#1}} % \end{macrocode} % +% \paragraph{\tt{boxheight}} +% +% \noindent Please read the section \secref{sec:sec:command-clozebox} +% how to use the option |boxheight|. |boxheight| affects only the +% environment \cmd{clozebox}. +% \secref{sec:command-clozefix}. +% +% \begin{macrocode} +\DeclareStringOption{boxheight} +\define@key{CLZ}{boxheight}[]{\cloze@set@option[boxheight]{#1}} +% \end{macrocode} +% +% \paragraph{\tt{boxwidth}} +% +% \noindent Please read the section \secref{sec:sec:command-clozebox} +% how to use the option |boxwidth|. |boxwidth| affects only the +% environment \cmd{clozebox}. +% \secref{sec:command-clozefix}. +% +% \begin{macrocode} +\DeclareStringOption{boxwidth} +\define@key{CLZ}{boxwidth}[]{\cloze@set@option[boxwidth]{#1}} +% \end{macrocode} +% % \paragraph{\tt{distance}} % % \noindent Please read the section \secref{sec:option-distance} how to @@ -1189,6 +1477,7 @@ or manually: % % \begin{macrocode} \DeclareVoidOption{hide}{% + \clozeshowfalse% \cloze@set@option[hide]{true}% \cloze@set@option[show]{false}% } @@ -1203,6 +1492,7 @@ or manually: \DeclareStringOption{linecolor} \define@key{CLZ}{linecolor}[]{% \cloze@set@option[linecolor]{\cloze@color{#1}}% + \cloze@set@option[linecolor_name]{#1}% } % \end{macrocode} % @@ -1225,11 +1515,22 @@ or manually: % % \begin{macrocode} \DeclareVoidOption{show}{% + \clozeshowtrue% \cloze@set@option[show]{true}% \cloze@set@option[hide]{false}% } % \end{macrocode} % +% \paragraph{\tt{spacing}} +% +% \noindent Please read the section \secref{sec:option-spacing} how to +% use the option |spacing|. +% +% \begin{macrocode} +\DeclareStringOption{spacing} +\define@key{CLZ}{spacing}[]{\cloze@set@option[spacing]{#1}} +% \end{macrocode} +% % \paragraph{\tt{textcolor}} % % \noindent Please read the section \secref{sec:option-textcolor} how to @@ -1239,6 +1540,7 @@ or manually: \DeclareStringOption{textcolor} \define@key{CLZ}{textcolor}[]{% \cloze@set@option[textcolor]{\cloze@color{#1}}% + \cloze@set@option[textcolor_name]{#1}% } % \end{macrocode} % @@ -1364,6 +1666,27 @@ or manually: % \end{macrocode} % \end{macro} % +% \begin{macro}{\clozenol} +% The usage of the command \cmd{\clozenol} is described in detail in +% section \secref{sec:command-clozenol}. +% TODO: Realize this macro with lua code, without ugly |\color{white}|. +% command. +% \begin{macrocode} +\newcommand{\clozenol}[2][]{% + {% + \cloze@set@local@options{#1}% + \clozefont\relax% + \ifclozeshow% + \color{\directlua{tex.print(cloze.get_value('textcolor_name'))}}% + \else% + \color{white}% + \fi% + #2% + }% +} +% \end{macrocode} +% \end{macro} +% % \begin{environment}{clozepar} % The usage of the environment |clozepar| is described in detail in % section \secref{sec:command-clozepar}. @@ -1383,6 +1706,64 @@ or manually: % \end{macrocode} % \end{environment} % +% \begin{macro}{\cloze@get@value} +% \begin{macrocode} +\newcommand{\cloze@get@value}[1]{% + \directlua{ + tex.print(cloze.get_value('#1')) + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{clozebox} +% The usage of the environment |clozebox| is described in detail in +% section \secref{sec:command-clozebox}. +% TODO: Realize this macro with lua code, without ugly |\color{white}| +% command. +% \begin{macrocode} +\newsavebox{\cloze@box} +\NewDocumentEnvironment{clozebox}{ s O{} +b}{% + \cloze@set@local@options{#2}% + \noindent% + \begin{lrbox}{\cloze@box}% + \directlua{ + local boxheight = cloze.get_value('boxheight') + local boxwidth = cloze.get_value('boxwidth') + if boxheight then + tex.print('\\begin{minipage}[t][' .. boxheight .. '][t]{' .. boxwidth .. '}') + else + tex.print('\\begin{minipage}[t]{' .. boxwidth .. '}') + end + } + \clozefont\relax% + \ifclozeshow% + \color{\directlua{tex.print(cloze.get_value('textcolor_name'))}}#3% + \else% + \color{white}#3% + \fi% + \end{minipage}% + \end{lrbox}% + \IfBooleanTF{#1}% + {\usebox{\cloze@box}}% + {\fbox{\usebox{\cloze@box}}}% +}{} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{clozespace} +% The usage of the environment |clozespace| is described in detail in +% section \secref{sec:command-clozespace}. +% TODO: Realization without setspace package. +% \begin{macrocode} +\newenvironment{clozespace}[1][]% +{% + \cloze@set@local@options{#1}% + \begin{spacing}{\directlua{tex.print(cloze.get_value('spacing'))}}% +}{\end{spacing}} +% \end{macrocode} +% \end{environment} +% % \begin{macro}{\clozefil} % The usage of the command \cmd{\clozefil} is described in detail in % section \secref{sec:command-clozefil}. @@ -1393,6 +1774,20 @@ or manually: % \end{macrocode} % \end{macro} % +% \begin{macro}{\clozeextend} +% TODO: Use node library to create kern nodes. +% \begin{macrocode} +\newcommand{\clozeextend}[1][1]{% + \directlua{ + local loop = #1 + for variable = 1, loop do + tex.print(' \string\\hspace{1em} \string\\strut') + end + } +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\clozeline} % The usage of the command \cmd{\clozeline} is described in detail in % section \secref{sec:command-clozeline}. @@ -1417,6 +1812,59 @@ or manually: % \end{macrocode} % \end{macro} % +% \begin{macro}{\cloze@text@color} +% \begin{macrocode} +\newcommand{\cloze@text@color}[1]{% + \textcolor% + {\directlua{tex.print(cloze.get_value('textcolor_name'))}}% + {#1}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cloze@strike@line} +% \begin{macrocode} +\newcommand\cloze@strike@line{% + \bgroup% + \markoverwith{% + \cloze@text@color{% + \rule[0.5ex]{2pt}{1pt}% + }% + }% + \ULon% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\clozestrike} +% \begin{macrocode} +\newcommand{\clozestrike}[3][]{% + \cloze@set@local@options{#1}% + \ifclozeshow% + \stackengine% + {\Sstackgap}% \Sstackgap or \Lstackgap or \stackgap or stacklength + {\cloze@strike@line{#2}}% anchor + {\cloze@text@color{\clozefont{}#3}}% item + {O}% O or U + {c}% \stackalignment or l or c or r + {\quietstack}% \quietstack or T or F + {T}% \useanchorwidth or T or F + {\stacktype}% \stacktype or S or L + \else% + \stackengine% + {\Sstackgap}% \Sstackgap or \Lstackgap or \stackgap or stacklength + {#2}% anchor + {\texttransparent{0}{\clozefont{}#3}}% item + {O}% O or U + {c}% \stackalignment or l or c or r + {\quietstack}% \quietstack or T or F + {T}% \useanchorwidth or T or F + {\stacktype}% \stacktype or S or L + \fi% +} +% \end{macrocode} +% \end{macro} +% % \iffalse %</package> %<*lua> @@ -1436,7 +1884,7 @@ or manually: % module. % \begin{macrocode} if not modules then modules = { } end modules ['cloze'] = { - version = '0.1', + version = '1.4', comment = 'cloze', author = 'Josef Friedrich, R.-M. Huber', copyright = 'Josef Friedrich, R.-M. Huber', @@ -1463,14 +1911,20 @@ registry.user_id = 3121978 registry.storage = {} registry.defaults = { ['align'] = 'l', + ['boxheight'] = false, + ['boxwidth'] = '\\linewidth', ['distance'] = '1.5pt', ['hide'] = false, ['linecolor'] = '0 0 0 rg 0 0 0 RG', -- black + ['linecolor_name'] = 'black', ['margin'] = '3pt', ['resetcolor'] = '0 0 0 rg 0 0 0 RG', -- black + ['resetcolor_name'] = 'black', ['show_text'] = true, ['show'] = true, + ['spacing'] = '1.6', ['textcolor'] = '0 0 1 rg 0 0 1 RG', -- blue + ['textcolor_name'] = 'blue', -- blue ['thickness'] = '0.4pt', ['width'] = '2cm', } @@ -1504,7 +1958,7 @@ base.is_registered = {} % % \paragraph{Color handling (color)} % -% \clozeluafunction{create\_colorstack} +% \clozeluafunction{create_colorstack} % Create a whatsit node of the subtype |pdf_colorstack|. |data| is a PDF % colorstack string like |0 0 0 rg 0 0 0 RG|. % \begin{macrocode} @@ -1519,7 +1973,7 @@ function nodex.create_colorstack(data) end % \end{macrocode} % -% \clozeluafunction{create\_color} +% \clozeluafunction{create_color} % |nodex.create_color()| is a wrapper for the function % |nodex.create_colorstack()|. It queries the current values of the % options |linecolor| and |textcolor|. The argument |option| accepts the @@ -1542,7 +1996,7 @@ end % % \paragraph{Line handling (line)} % -% \clozeluafunction{create\_line} +% \clozeluafunction{create_line} % Create a rule node, which is used as a line for the cloze texts. The % |depth| and the |height| of the rule are calculated form the options % |thickness| and |distance|. The argument |width| must have the length @@ -1559,7 +2013,7 @@ function nodex.create_line(width) end % \end{macrocode} % -% \clozeluafunction{insert\_list} +% \clozeluafunction{insert_list} % Insert a |list| of nodes after or before the |current|. The |head| % argument is optional. In some edge cases it is unfortately necessary. % if |head| is omitted the |current| node is used. The argument @@ -1580,7 +2034,7 @@ function nodex.insert_list(position, current, list, head) end % \end{macrocode} % -% \clozeluafunction{insert\_line} +% \clozeluafunction{insert_line} % Enclose a rule node (cloze line) with two PDF colorstack whatsits. The % first colorstack node dyes the line, the seccond resets the color. % @@ -1606,7 +2060,7 @@ function nodex.insert_line(current, width) end % \end{macrocode} % -% \clozeluafunction{write\_line} +% \clozeluafunction{write_line} % This function enclozes a rule node with color nodes as it the function % |nodex.insert_line| does. In contrast to |nodex.insert_line| the three % nodes are appended to \TeX’s ‘current list’. They are not inserted in @@ -1630,7 +2084,7 @@ end % % \paragraph{Handling of extendable lines (linefil)} % -% \clozeluafunction{create\_linefil} +% \clozeluafunction{create_linefil} % This function creates a line which stretchs indefinitely in the % horizontal direction. % \begin{macrocode} @@ -1646,7 +2100,7 @@ function nodex.create_linefil() end % \end{macrocode} % -% \clozeluafunction{write\_linefil} +% \clozeluafunction{write_linefil} % The function |nodex.write_linefil| surrounds a indefinitely strechable % line with color whatsits and puts it to \TeX’s ‘current (node) list’. % \begin{macrocode} @@ -1659,7 +2113,7 @@ end % % \paragraph{Kern handling (kern)} % -% \clozeluafunction{create\_kern} +% \clozeluafunction{create_kern} % This function creates a kern node with a given width. The argument % |width| had to be specified in scaled points. % \begin{macrocode} @@ -1670,7 +2124,7 @@ function nodex.create_kern(width) end % \end{macrocode} % -% \clozeluafunction{strut\_to\_hlist} +% \clozeluafunction{strut_to_hlist} % To make life easier: We add at the beginning of each hlist a strut. % Now we can add line, color etc. nodes after the first node of a hlist % not before - after is much more easier. @@ -1685,7 +2139,7 @@ function nodex.strut_to_hlist(hlist) end % \end{macrocode} % -% \clozeluafunction{write\_margin} +% \clozeluafunction{write_margin} % Write kern nodes to the current node list. This kern nodes can be used % to build a margin. % \begin{macrocode} @@ -1695,7 +2149,7 @@ function nodex.write_margin() end % \end{macrocode} % -% \clozeluafunction{search\_hlist} +% \clozeluafunction{search_hlist} % Search for a |hlist| (subtype |line|). Return false, if no |hlist| can % be found. % \begin{macrocode} @@ -1725,7 +2179,7 @@ end % some additional data like the local options. % \end{enumerate} % -% \clozeluafunction{create\_marker} +% \clozeluafunction{create_marker} % We create a user defined whatsit node that can store a number (type = % 100). In order to distinguish this node from other user defined % whatsit nodes we set the |user_id| to a large number. We call this @@ -1741,7 +2195,7 @@ function registry.create_marker(index) end % \end{macrocode} % -% \clozeluafunction{write\_marker} +% \clozeluafunction{write_marker} % Write a marker node to \TeX's current node list. The argument |mode| % accepts the string values |basic|, |fix| and |par|. The argument % |position|. The argument |position| is either set to |start| or to @@ -1754,7 +2208,7 @@ function registry.write_marker(mode, position) end % \end{macrocode} % -% \clozeluafunction{is\_marker} +% \clozeluafunction{is_marker} % This functions checks if the given node |item| is a marker. % \begin{macrocode} function registry.is_marker(item) @@ -1768,7 +2222,7 @@ function registry.is_marker(item) end % \end{macrocode} % -% \clozeluafunction{check\_marker} +% \clozeluafunction{check_marker} % This functions tests, whether the given node |item| is a marker. The % argument |item| is a node. The argument |mode| accepts the string % values |basic|, |fix| and |par|. The argument |position| is either set @@ -1784,7 +2238,7 @@ function registry.check_marker(item, mode, position) end % \end{macrocode} % -% \clozeluafunction{get\_marker} +% \clozeluafunction{get_marker} % |registry.get_marker| returns the given marker. The argument |item| is % a node. The argument |mode| accepts the string values |basic|, |fix| % and |par|. The argument |position| is either set to |start| or to @@ -1804,7 +2258,7 @@ function registry.get_marker(item, mode, position) end % \end{macrocode} % -% \clozeluafunction{get\_marker\_data} +% \clozeluafunction{get_marker_data} % |registry.get_marker_data| tests whether the node |item| is a marker. % The argument |item| is a node of unspecified type. % \begin{macrocode} @@ -1819,7 +2273,7 @@ function registry.get_marker_data(item) end % \end{macrocode} % -% \clozeluafunction{get\_marker\_values} +% \clozeluafunction{get_marker_values} % First this function saves the associatied values of a marker to the % local options table. Second it returns this values. The argument % |marker| is a whatsit node. @@ -1831,7 +2285,7 @@ function registry.get_marker_values(marker) end % \end{macrocode} % -% \clozeluafunction{remove\_marker} +% \clozeluafunction{remove_marker} % This function removes a given whatsit marker. It only deletes a node, % if a marker is given. % \begin{macrocode} @@ -1842,7 +2296,7 @@ end % % \paragraph{Storage functions (storage)} % -% \clozeluafunction{get\_index} +% \clozeluafunction{get_index} % |registry.index| is a counter. The functions |registry.get_index()| % increases the counter by one and then returns it. % \begin{macrocode} @@ -1855,7 +2309,7 @@ function registry.get_index() end % \end{macrocode} % -% \clozeluafunction{set\_storage} +% \clozeluafunction{set_storage} % |registry.set_storage()| stores the local options in the Lua table % |registry.storage|. It returns a numeric index number. This index % number is the key, where the local options in the Lua table are @@ -1874,7 +2328,7 @@ function registry.set_storage(mode, position) end % \end{macrocode} % -% \clozeluafunction{get\_storage} +% \clozeluafunction{get_storage} % The function |registry.get_storage()| retrieves values which belong to % a whatsit marker. The argument |index| is a numeric value. % \begin{macrocode} @@ -1885,7 +2339,7 @@ end % % \paragraph{Option processing (option)} % -% \clozeluafunction{set\_option} +% \clozeluafunction{set_option} % This function stores a value |value| and his associated key |key| % either to the global (|registry.global_options|) or to the local % (|registry.local_options|) option table. The global boolean variable @@ -1904,7 +2358,7 @@ function registry.set_option(key, value) end % \end{macrocode} % -% \clozeluafunction{set\_is\_global} +% \clozeluafunction{set_is_global} % |registry.set_is_global()| sets the variable |registry.is_global| to % the value |value|. It is intended, that the variable takes boolean % values. @@ -1914,7 +2368,7 @@ function registry.set_is_global(value) end % \end{macrocode} % -% \clozeluafunction{unset\_local\_options} +% \clozeluafunction{unset_local_options} % This function unsets the local options. % \begin{macrocode} function registry.unset_local_options() @@ -1922,7 +2376,7 @@ function registry.unset_local_options() end % \end{macrocode} % -% \clozeluafunction{unset\_global\_options} +% \clozeluafunction{unset_global_options} % |registry.unset_global_options| empties the global options storage. % \begin{macrocode} function registry.unset_global_options() @@ -1930,7 +2384,7 @@ function registry.unset_global_options() end % \end{macrocode} % -% \clozeluafunction{get\_value} +% \clozeluafunction{get_value} % Retrieve a value from a given key. First search for the value in the % local options, then in the global options. If both option storages are % empty, the default value will be returned. @@ -1946,7 +2400,7 @@ function registry.get_value(key) end % \end{macrocode} % -% \clozeluafunction{get\_value\_show} +% \clozeluafunction{get_value_show} % The function |registry.get_value_show()| returns the boolean value % |true| if the option |show| is true. In contrast to the function % |registry.get_value()| it converts the string value `true' to a @@ -1965,7 +2419,7 @@ function registry.get_value_show() end % \end{macrocode} % -% \clozeluafunction{has\_value} +% \clozeluafunction{has_value} % This function tests whether the value |value| is not empty and has a % value. % \begin{macrocode} @@ -1978,7 +2432,7 @@ function registry.has_value(value) end % \end{macrocode} % -% \clozeluafunction{get\_defaults} +% \clozeluafunction{get_defaults} % |registry.get_defaults(option)| returns a the default value of the % given option. % \begin{macrocode} @@ -2003,7 +2457,7 @@ end % % \noindent\includegraphics[width=\linewidth]{graphics/picture} % -% \clozeluafunction{basic\_make} +% \clozeluafunction{basic_make} % The function |cloze.basic_make()| makes one gap. The argument |start| % is the node, where the gap begins. The argument |stop| is the node, % where the gap ends. @@ -2043,7 +2497,7 @@ function cloze.basic_make(start, stop) end % \end{macrocode} % -% \clozeluafunction{basic\_search\_stop} +% \clozeluafunction{basic_search_stop} % Search for a stop marker. % \begin{macrocode} function cloze.basic_search_stop(head) @@ -2061,7 +2515,7 @@ function cloze.basic_search_stop(head) end % \end{macrocode} % -% \clozeluafunction{basic\_search\_start} +% \clozeluafunction{basic_search_start} % Search for a start marker. Also begin a new cloze, if the boolean % value |cloze.status.continue| is true. The knowledge of the last % hlist node is a requirement to begin a cloze. @@ -2086,7 +2540,7 @@ function cloze.basic_search_start(head) end % \end{macrocode} % -% \clozeluafunction{basic\_recursion} +% \clozeluafunction{basic_recursion} % Parse recursivley the node tree. Start and stop markers can be nested % deeply into the node tree. % \begin{macrocode} @@ -2115,7 +2569,7 @@ function cloze.basic(head) end % \end{macrocode} % -% \clozeluafunction{fix\_length} +% \clozeluafunction{fix_length} % Calculate the length of the whitespace before (|l.kern_start|) and % after (|l.kern_stopt|) the text. % \begin{macrocode} @@ -2139,7 +2593,7 @@ function cloze.fix_length(start, stop) end % \end{macrocode} % -% \clozeluafunction{fix\_make} +% \clozeluafunction{fix_make} % The function |cloze.fix_make| generates a gap of fixed width. % % \subparagraph*{Node lists} @@ -2199,7 +2653,7 @@ function cloze.fix_make(start, stop) end % \end{macrocode} % -% \clozeluafunction{fix\_recursion} +% \clozeluafunction{fix_recursion} % Function to recurse the node list and search after marker. |head| is % the head node of a node list. % \begin{macrocode} @@ -2365,6 +2819,7 @@ base.set_is_global = registry.set_is_global base.unset_local_options = registry.unset_local_options base.reset = registry.unset_global_options base.get_defaults = registry.get_defaults +base.get_value = registry.get_value base.marker = registry.write_marker % \end{macrocode} % |