summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/cloze/cloze.tex
blob: c3d1f86e12438201afb679bf95e083d360c995f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
%%
%% This is file `cloze.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% cloze.dtx  (with options: `plaintex')
%% 
%% This is a generated file.
%% 
%% 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.3c of this license
%% or (at your option) any later version. The latest version of this
%% license is in:
%% 
%%   http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/05 or later.
%% 
\directlua{
  cloze = require('cloze')
}
\newif\ifclozeshow\clozeshowtrue
\def\ClozeSetToGlobal{%
  \directlua{cloze.set_is_global(true)}%
}
\def\ClozeSetToLocal{%
  \directlua{
    cloze.unset_local_options()
    cloze.set_is_global(false)
  }%
}
\def\ClozeGetOption#1{%
  \directlua{
    tex.print(cloze.get_value('#1'))
  }%
}
\def\ClozeColor#1{\csname\string\color@#1\endcsname}
\def\ClozeStartMarker#1{%
  \strut\directlua{
    cloze.register('#1')
    cloze.marker('#1', 'start')
  }%
}
\def\ClozeStopMarker#1{%
  \strut\directlua{
    cloze.marker('#1', 'stop')
  }%
}
\def\ClozeMargin#1{%
  \directlua{cloze.margin()}%
  #1%
  \directlua{cloze.margin()}%
}
\def\clozesetoption#1#2{%
  \ClozeSetToGlobal%
  \directlua{cloze.set_option('#1', '#2')}%
}
\def\clozereset{%
  \ClozeSetToGlobal%
  \directlua{cloze.reset()}%
}
\def\clozeshow{%
  \clozeshowtrue%
  \ClozeSetToGlobal%
  \clozesetoption{show}{true}%
  \clozesetoption{hide}{false}%
}
\def\clozehide{%
  \clozeshowfalse%
  \ClozeSetToGlobal%
  \clozesetoption{hide}{true}%
  \clozesetoption{show}{false}%
}
\def\clozefont{\it}
\def\clozesetfont#1{%
  \def\clozefont{%
    #1%
  }%
}
\def\cloze#1{%
  \ClozeStartMarker{basic}%
  {%
    \clozefont\relax%
    \ClozeMargin{#1}%
  }%
  \ClozeStopMarker{basic}%
}
\def\clozefix#1{%
  \ClozeStartMarker{fix}%
  {%
    \clozefont\relax%
    \ClozeMargin{#1}%
  }%
  \ClozeStopMarker{fix}%
}
\def\clozenol#1{%
  \clozesetoption{thickness}{0pt}%
  \ClozeStartMarker{basic}%
  {%
    \clozefont\relax%
    \ClozeMargin{#1}%
  }%
  \ClozeStopMarker{basic}%
}
\def\clozeline{%
  \directlua{cloze.line()}%
}
\def\clozelinefil{%
  \strut%
  \directlua{cloze.linefil()}%
  \strut%
}
\def\clozefil#1{%
  \cloze{#1}\clozelinefil%
}
\def\clozeparcmd#1\par {%
  \par%
  \ClozeStartMarker{par}%
  \clozefont\relax%
  #1%
  \ClozeStopMarker{par}%
  \par%
  \directlua{cloze.unregister('par')}%
}
\endinput
%%
%% End of file `cloze.tex'.