diff options
author | Karl Berry <karl@freefriends.org> | 2020-06-30 21:21:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-06-30 21:21:36 +0000 |
commit | 8bb985021b2f40fd3c9ef24653decafda35a3592 (patch) | |
tree | f42b0c46f969ff3a9eada2fc099bd1992e25249b /Master/texmf-dist/tex | |
parent | 3188a1fa1e0a251e9952c526036a175b39a1cb3d (diff) |
cloze (30jun20)
git-svn-id: svn://tug.org/texlive/trunk@55704 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/luatex/cloze/cloze.sty (renamed from Master/texmf-dist/tex/lualatex/cloze/cloze.sty) | 193 |
1 files changed, 70 insertions, 123 deletions
diff --git a/Master/texmf-dist/tex/lualatex/cloze/cloze.sty b/Master/texmf-dist/tex/luatex/cloze/cloze.sty index a7f604dbbc0..4c67c66a55a 100644 --- a/Master/texmf-dist/tex/lualatex/cloze/cloze.sty +++ b/Master/texmf-dist/tex/luatex/cloze/cloze.sty @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% cloze.dtx (with options: `package') +%% cloze.dtx (with options: `latex') %% %% This is a generated file. %% @@ -22,7 +22,8 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{cloze} - [2020/05/27 v1.5 Package to typeset cloze worksheets or cloze tests] + [2020/06/60 v1.6 Package to typeset cloze worksheets or cloze tests] +\input{cloze.tex} \RequirePackage{fontspec} \RequirePackage{luatexbase-mcb} \RequirePackage{kvoptions} @@ -33,156 +34,103 @@ \RequirePackage{ulem} \normalem \RequirePackage{transparent} -\directlua{ - cloze = require('cloze') -} -\newif\ifclozeshow\clozeshowtrue -\def\cloze@set@to@global{% - \directlua{cloze.set_is_global(true)}% -} -\def\cloze@set@to@local{% - \directlua{ - cloze.unset_local_options() - cloze.set_is_global(false) - }% -} -\def\cloze@set@option[#1]#2{% +\let\clozesetoption=\undefined +\newcommand{\clozesetoption}[2]{% \directlua{cloze.set_option('#1', '#2')}% } -\def\cloze@color#1{\csname\string\color@#1\endcsname} -\def\cloze@set@local@options#1{% - \cloze@set@to@local% +\def\ClozeSetLocalOptions#1{% + \ClozeSetToLocal% \kvsetkeys{CLZ}{#1}% } -\def\cloze@start@marker#1{% - \strut\directlua{ - cloze.register('#1') - cloze.marker('#1', 'start') - }% -} -\def\cloze@stop@marker#1{% - \strut\directlua{ - cloze.marker('#1', 'stop') - }% -} -\def\cloze@margin#1{% - \directlua{cloze.margin()}% - #1% - \directlua{cloze.margin()}% -} -\cloze@set@to@global +\ClozeSetToGlobal \SetupKeyvalOptions{ family=CLZ, prefix=CLZ@ } \DeclareStringOption{align} -\define@key{CLZ}{align}[]{\cloze@set@option[align]{#1}} +\define@key{CLZ}{align}[]{\clozesetoption{align}{#1}} \DeclareStringOption{boxheight} -\define@key{CLZ}{boxheight}[]{\cloze@set@option[boxheight]{#1}} +\define@key{CLZ}{boxheight}[]{\clozesetoption{boxheight}{#1}} \DeclareStringOption{boxwidth} -\define@key{CLZ}{boxwidth}[]{\cloze@set@option[boxwidth]{#1}} +\define@key{CLZ}{boxwidth}[]{\clozesetoption{boxwidth}{#1}} \DeclareStringOption{distance} -\define@key{CLZ}{distance}[]{\cloze@set@option[distance]{#1}} +\define@key{CLZ}{distance}[]{\clozesetoption{distance}{#1}} \DeclareVoidOption{hide}{% \clozeshowfalse% - \cloze@set@option[hide]{true}% - \cloze@set@option[show]{false}% + \clozesetoption{hide}{true}% + \clozesetoption{show}{false}% } \DeclareStringOption{linecolor} \define@key{CLZ}{linecolor}[]{% - \cloze@set@option[linecolor]{\cloze@color{#1}}% - \cloze@set@option[linecolor_name]{#1}% + \clozesetoption{linecolor}{\ClozeColor{#1}}% + \clozesetoption{linecolor_name}{#1}% } \DeclareStringOption{margin} -\define@key{CLZ}{margin}[]{\cloze@set@option[margin]{#1}} +\define@key{CLZ}{margin}[]{\clozesetoption{margin}{#1}} \DeclareVoidOption{show}{% \clozeshowtrue% - \cloze@set@option[show]{true}% - \cloze@set@option[hide]{false}% + \clozesetoption{show}{true}% + \clozesetoption{hide}{false}% } \DeclareStringOption{spacing} -\define@key{CLZ}{spacing}[]{\cloze@set@option[spacing]{#1}} +\define@key{CLZ}{spacing}[]{\clozesetoption{spacing}{#1}} \DeclareStringOption{textcolor} \define@key{CLZ}{textcolor}[]{% - \cloze@set@option[textcolor]{\cloze@color{#1}}% - \cloze@set@option[textcolor_name]{#1}% + \clozesetoption{textcolor}{\ClozeColor{#1}}% + \clozesetoption{textcolor_name}{#1}% } \DeclareStringOption{thickness} -\define@key{CLZ}{thickness}[]{\cloze@set@option[thickness]{#1}} +\define@key{CLZ}{thickness}[]{\clozesetoption{thickness}{#1}} \DeclareStringOption{width} -\define@key{CLZ}{width}[]{\cloze@set@option[width]{#1}} +\define@key{CLZ}{width}[]{\clozesetoption{width}{#1}} \ProcessKeyvalOptions{CLZ} \newcommand{\clozeset}[1]{% - \cloze@set@to@global% + \ClozeSetToGlobal% \kvsetkeys{CLZ}{#1}% } -\newcommand{\clozereset}{% - \directlua{cloze.reset()} -} +\let\clozeshow=\undefined \newcommand{\clozeshow}{% \clozeset{show} } +\let\clozehide=\undefined \newcommand{\clozehide}{% \clozeset{hide} } -\newcommand{\clozefont}{\itshape} -\newcommand{\clozesetfont}[1]{% - \renewcommand{\clozefont}[1]{% - #1% - }% -} +\let\clozeplain=\cloze +\let\cloze=\undefined \newcommand{\cloze}[2][]{% - \cloze@set@local@options{#1}% - \cloze@start@marker{basic}% - {% - \clozefont\relax% - \cloze@margin{#2}% - }% - \cloze@stop@marker{basic}% + \ClozeSetLocalOptions{#1}% + \clozeplain{#2}% } +\let\clozefixplain=\clozefix +\let\clozefix=\undefined \newcommand{\clozefix}[2][]{% - \cloze@set@local@options{#1}% - \cloze@start@marker{fix}% - {% - \clozefont\relax% - \cloze@margin{#2}% - }% - \cloze@stop@marker{fix}% + \ClozeSetLocalOptions{#1}% + \clozefixplain{#2}% } +\let\clozenolplain=\clozenol +\let\clozenol=\undefined \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% - }% + \ClozeSetLocalOptions{#1}% + \clozenolplain{#2}% } \newenvironment{clozepar}[1][]% {% \par% - \cloze@set@local@options{#1}% - \cloze@start@marker{par}% + \ClozeSetLocalOptions{#1}% + \ClozeStartMarker{par}% \clozefont\relax% }% {% - \cloze@stop@marker{par}% + \ClozeStopMarker{par}% \par% \directlua{cloze.unregister('par')}% } -\newcommand{\cloze@get@value}[1]{% - \directlua{ - tex.print(cloze.get_value('#1')) - }% -} -\newsavebox{\cloze@box} +\newsavebox{\ClozeBox}% \NewDocumentEnvironment{clozebox}{ s O{} +b}{% - \cloze@set@local@options{#2}% + \ClozeSetLocalOptions{#2}% \noindent% - \begin{lrbox}{\cloze@box}% + \begin{lrbox}{\ClozeBox}% \directlua{ local boxheight = cloze.get_value('boxheight') local boxwidth = cloze.get_value('boxwidth') @@ -191,24 +139,33 @@ 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% + }% + \setlength{\parindent}{0pt}% + \clozenol[margin=0pt]{#3}% \end{minipage}% \end{lrbox}% \IfBooleanTF{#1}% - {\usebox{\cloze@box}}% - {\fbox{\usebox{\cloze@box}}}% + {\usebox{\ClozeBox}}% + {\fbox{\usebox{\ClozeBox}}}% }{} \newenvironment{clozespace}[1][]% {% - \cloze@set@local@options{#1}% + \ClozeSetLocalOptions{#1}% \begin{spacing}{\directlua{tex.print(cloze.get_value('spacing'))}}% }{\end{spacing}} +\let\clozelineplain=\clozeline +\let\clozeline=\undefined +\newcommand{\clozeline}[1][]{% + \ClozeSetLocalOptions{#1}% + \clozelineplain% +} +\let\clozelinefilplain=\clozelinefil +\let\clozelinefil=\undefined +\newcommand{\clozelinefil}[1][]{% + \ClozeSetLocalOptions{#1}% + \clozelinefilplain% +} +\let\clozefil=\undefined \newcommand{\clozefil}[2][]{% \cloze[#1]{#2}\clozelinefil[#1]% } @@ -220,37 +177,27 @@ end } } -\newcommand{\clozeline}[1][]{% - \cloze@set@local@options{#1}% - \directlua{cloze.line()}% -} -\newcommand{\clozelinefil}[1][]{% - \cloze@set@local@options{#1}% - \strut% - \directlua{cloze.linefil()}% - \strut% -} -\newcommand{\cloze@text@color}[1]{% +\newcommand{\ClozeTextColor}[1]{% \textcolor% {\directlua{tex.print(cloze.get_value('textcolor_name'))}}% {#1}% } -\newcommand\cloze@strike@line{% +\newcommand\ClozeStrikeLine{% \bgroup% \markoverwith{% - \cloze@text@color{% + \ClozeTextColor{% \rule[0.5ex]{2pt}{1pt}% }% }% \ULon% } \newcommand{\clozestrike}[3][]{% - \cloze@set@local@options{#1}% + \ClozeSetLocalOptions{#1}% \ifclozeshow% \stackengine% {\Sstackgap}% \Sstackgap or \Lstackgap or \stackgap or stacklength - {\cloze@strike@line{#2}}% anchor - {\cloze@text@color{\clozefont{}#3}}% item + {\ClozeStrikeLine{#2}}% anchor + {\ClozeTextColor{\clozefont{}#3}}% item {O}% O or U {c}% \stackalignment or l or c or r {\quietstack}% \quietstack or T or F |