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
|
% This is part of OpTeX project, see http://petr.olsak.net/optex
\_codedecl \slideshow {Slides style for OpTeX <2020-03-19>} % loaded on demand by \slides
\_doc -----------------------------
Default margins and design is declared here.
Note that `\_ttfont` is scaled by `mag1.15` in order to balance the
ex height of Helvetica (Heros) and LM fonts Typewriter.
The `\begtt`...`\endtt` verbatim is printed by smaller text.
\_cod -----------------------------
\_margins/1 a5l (14,14,10,3)mm % landscape A5 format
\_def\_wideformat{\_margins/1 (263,148) (16,16,10,3)mm } % 16:9 format
\_fontfam[Heros]
\_typosize[16/19]
\_famvardef\_ttfont{\_setfontsize{mag1.15}\_tt}
\_def\_urlfont{}
\_everytt={\_typosize[13/16] \advance\hsize by10mm}
\_fontdef\_fixbf{\_bf}
\_nopagenumbers
\_parindent=0pt
\_ttindent=5mm
\_parskip=5pt plus 4pt minus2pt
\_rightskip=0pt plus 1fil
\_ttindent=10pt
\_def\_ttskip{\_smallskip}
\_onlyrgb % RGB color space is better for presentations
\_doc -----------------------------
The bottom margin is set to 3\,mm. If we use 1\,mm, then baseline of
`\footline` is 2\,mm from the bottom page. This is depth of the `\Grey`
rectange used for page numbers. It is rlapped to `\hoffset` because left
margin = `\hoffset` = right margin. It is 14\,mm for narrow pages or
16\,mm for wide pages.
\_cod -----------------------------
\_footlinedist=1mm
\_footline={\_hss \_rlap{%
\_rlap{\Grey\_kern.2\_hoffset\_vrule height6mm depth2mm width.8\_hoffset}%
\_hbox to\_hoffset{\White\_hss\_folio\_kern3mm}}}
\_doc -----------------------------
The `\subtit` is defined analogicaly like `\tit`.
\_cod -----------------------------
\_eoldef\_subtit#1{\_vskip20pt {\_leftskip=0pt plus1fill \_rightskip=\_leftskip
\_subtitfont #1\_nbpar}}
\_doc -----------------------------
The `\pshow<num>` is implemented by printing the text in invisible
(transparent) font when `\layernum<<num>`.
The color font feature is used for this transparency.
\_cod -----------------------------
\_famvardef\Transparent{\_setfontcolor{FF000000}\_currvar}
\_def\_use#1#2{\_ifnum\_layernum#1\_relax#2\_fi}
\_def\_pshow#1{\_use{=#1}\Red \_use{<#1}\Transparent \_ignorespaces}
\_doc -----------------------------
The main level list is activated here. The `\_item:X` and
`\_item:x` are used and are re-defined here.
If we are in nested level of items and `\pg+` is used then
`\egroups` macro xepands to the right number of `\egroup`s
in order to close page correctly. The level of nested item lists
is saved to the `\_ilevel` register and used when we start again
the next text after `\pg+`.
\_cod -----------------------------
\_newcount\_ilevel \_newcount\_gilevel
\_def\*{*}
\_adef*{\_startitem}
\_sdef{_item:X}{\Blue\_raise.2ex\_fullrectangle{.8ex}\_kern.5em}
\_sdef{_item:x}{\Blue\_raise.3ex\_fullrectangle{.6ex}\_kern.4em}
\_style X
\_addto\_begitems{\_style x }\public \begitems ;
\_def\_egroups{\_par\_global\_gilevel=\_ilevel \_egroup}
\_everybegitems={\_advance\_ilevel by1 \_addto\_egroups{\_egroup}}
\_doc -----------------------------
The default values of `\pg;`, `\pg+` and `\pg.` are very simple.
They are used when `\showslides` is not specified.
\_cod -----------------------------
\_def\_pg#1{\_cs{_spg:#1}}
\_sdef{_spg:;}{\_vfil\_break \_lfnotenumreset}
\_sdef{_spg:.}{\_end}
\_sdef{_spg:+}{\_par}
\_doc -----------------------------
We need no numbers and no table of contents when using slides.
The `\_printsec` macro is redefined in order the title is centered
and typeset in `\Blue`.
\_cod -----------------------------
\_def\_titfont{\_typosize[42/60]\_bf \Blue}
\_def\_subtitfont{\_typosize[20/30]\_bf}
\_def\_secfont{\_typosize[25/30]\_bf \Blue}
\_nonum \_notoc \_let\_resetnonumnotoc=\_relax
\_def\_printsec#1{\_par
\_abovetitle{\_penalty-400}\_bigskip
{\_secfont \_noindent \_leftskip=0pt plus1fill \_rightskip=\_leftskip
\_printrefnum[@\_quad]#1\_nbpar}\_insertmark{#1}%
\_nobreak \_belowtitle{\_medskip}%
}
\_doc -----------------------------
When `\slideshow` is active then each page is opened (roughly speaking)
by `\setbox\_slidepage=\vbox\bgroup` and closed by `\egroup`. The material is
`\unvbox`ed and saved for the usage in the next usage if `\pg+` is in process.
The `\_slidelayer` is inceremnted instead `\pageno` if `\pg+`.
This counter is equal to `\count1`, so it is printed to the terminal and
log file next to `\pageno`.
The code is somewhat more complicated when `\layers` is used. Then
<layered-text> is saved to the `\_layertext` macro, the material before
it is in `\_sidepage` box and the material after it is in `\_slidepageB`
box. The pages are completrd in the `\loop` which increments the
`\layernum` register.
\_cod -----------------------------
\_newbox\_slidepage \_newbox\_slidepageB
\_countdef\_slidelayer=1
\_def\_decr#1{\_global\_advance#1 by-1 }
\_def\_slideshow{\_slidelayer=1 \_slideshowactive \_setbox\_slidepage=\_vbox\_bgroup}
\_def\_slideshowactive{%
\_sdef{_spg:;}{\_closepage \_global\_slidelayer=1 \_resetpage \_openslide}
\_sdef{_spg:.}{\_closepage \_end}
\_sdef{_spg:+}{\_closepage \_incr\_slidelayer \_decr\_pageno \_openslide}
\_def\bye {\_closepage \_end}
\_let\_layers=\_layersactive
\_def\_destbox[##1:##2]{\_isequal{##1}{ref}\_iffalse \_destboxori[##1:##2]\_fi}%
}
\_def\_openslide{\_setbox\_slidepage=\_vbox\_bgroup \_setilevel
\_ifvoid\_slidepage \_else \_unvbox\_slidepage \_nointerlineskip\_lastbox \_fi}
\_def\_setilevel{\_loop \_decr\_gilevel \_ifnum\_gilevel<0 \_else \_begitems \_repeat}
\_def\_closepage{\_egroups
\_ifnum \_maxlayers=0 \_unvcopy\_slidepage \_vfil\_break
\_else \_begingroup \_setwarnslides \_layernum=0
\_loop
\_ifnum\_layernum<\_maxlayers \_advance\_layernum by1
\_printlayers \_vfil\_break
\_ifnum\_layernum<\_maxlayers \_incr\_slidelayer \_decr\_pageno \_fi
\_repeat
\_global\_maxlayers=0
\_incr\_layernum \_global\_setbox\_slidepage=\_vbox{\_printlayers}%
\_endgroup
\_fi}
\_def\_resetpage{%
\_global\_setbox\_slidepage=\_box\_voidbox \_global\_setbox\_slidepageB=\_box\_voidbox
\_lfnotenumreset
}
\_def\_setwarnslides{%
\_def\pg##1{\_opwarning{\_string\pg##1 \_layersenv}\_def\pg####1{}}%
\_def\layers##1 {\_opwarning{\_string\layers\_space \_layersenv}\_def\layers####1{}}%
}
\_def\_layersenv{cannot be inside \_string\layers...\_string\endlayers, ignored}
\_def\_printlayers{\_unvcopy\_slidepage \_nointerlineskip\_lastbox
\_layertext \_endgraf
\_ifdim\_prevdepth>-1000pt \_kern-\_prevdepth \_kern\_dp\_strutbox \_fi
\_vskip\_parskip
\_unvcopy\_slidepageB
}
\_let\_destboxori=\_destbox
\_newcount\_layernum \_newcount\_maxlayers
\_maxlayers=0
\_long\_def\_layersactive #1 #2\endlayers{%
\_par\_egroup
\_gdef\_layertext{#2}%
\_global\_maxlayers=#1
\_setbox\_slidepageB=\_vbox\_bgroup
}
\_doc -----------------------------
Default `\layers <num>` macro (when `\slideshow` is not activated) is simple.
It prints the <layered-text> with `\layernum=<num>+1` because we need the
result after last layer is processed.
\_cod -----------------------------
\_def\_layers #1 {\_par\_layernum=\_numexpr#1+1\_relax}
\_let\endlayers=\_relax
\_def\layers{\_layers}
\_public \subtit \slideshow \pg \wideformat \use \pshow ;
\_doc -----------------------------
We must to redefine `\fnotenumpages` because the data from `.ref` file
are less usable for implementing such feature: the
footnote should be in more layers repeatedly. But we can suppose that
each page starts by `\pg;` macro, so we can reset the footnote counter by
this macro.
\_cod -----------------------------
\_def \_fnotenumpages {\def\_fnotenum{\_the\_lfnotenum}\_pgfnotefalse
\_def\_lfnotenumreset{\_global\_lfnotenum=0 }}
\_let \_lfnotenumreset=\_relax
\_public \fnotenumpages ;
\_endcode % ----------------------------------------------
The user manual of \OpTeX/ slides are in `op-slides.tex` file.
|