summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/lecturer/ltr-slides.tex
blob: dd99458dbfc6b778019d2f8352e2579ccb183e27 (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
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
% This file is part of the Lecturer package.
% Paul Isambert -- July 2010.
% 
\countdef\slideno=0
\slideno=1
\def\advanceslideno{\global\advance\slideno1 }
\def\slidenumber{\the\slideno}
%
%
%
% ATTRIBUTES
%
\def\ltr@slide_restrictions{width height background foreground image transition bookmark everyslide anchor font scale
  vsize vpos hpos top left right bottom parindent parskip hsize baselineskip topskip pdftitle bookmarklevel bookmarkstyle areas areas* }
\def\ltr@slide_deleteattributes{%
  \passexpanded{\ltr@attribute_deletion{ltr@inner_slide}}\ltr@slide_restrictions
  }
\passexpandednobraces{\restrictparameter slide ltr@inner_slide:}\ltr@slide_restrictions\par
\ltr@restrictattribute slide:vpos; top center bottom\par
\ltr@restrictattribute ltr@inner_slide:vpos; top center bottom\par
\ltr@restrictattribute slide:hpos; ff rr fr rf\par
\ltr@restrictattribute ltr@inner_slide:hpos; ff rr fr rf\par
\ltr@boolean_attr{slide:bookmark}
\ltr@boolean_attr{ltr@inner_slide:bookmark}
\ltr@boolean_attr{slide:scale}
\ltr@boolean_attr{ltr@inner_slide:scale}
\def\ltr@slide_parameter#1{%
  \ltr@todim_loop{#1}{width height vsize hsize top left bottom right parindent baselineskip topskip }%
  \ltr@delete_empty{#1:font}%
  \ltr@delete_empty{#1:hsize}\ltr@delete_empty{#1:left}\ltr@delete_empty{#1:right}%
  \ltr@delete_empty{#1:vsize}\ltr@delete_empty{#1:top}\ltr@delete_empty{#1:bottom}%
  \ltr@dimen_set{#1}{right}{left}{hsize}{\ltr@usevalueor #1:width;\pdfpagewidth}%
  \ltr@dimen_set{#1}{bottom}{top}{vsize}{\ltr@usevalueor #1:height;\pdfpageheight}%
  \ltr@deleteattribute #1:right;%
  \ltr@deleteattribute #1:bottom;%
  }
\defactiveparameter slide {%
  \ltr@slide_parameter{#1}%
  }
% #1 parameter (e.g. slide)
% #2 ordering attribute (e.g. right (for slide))
% #3 first obeying attribute (e.g. left)
% #4 second obeying attribute (e.g. hsize)
% #5 reference (e.g. (page)width)
\def\ltr@dimen_set#1#2#3#4#5{%
    \nometa\ltr@ifattribute #1:#2;
      {\ltr@passvalue{\defcs{ltr@#1:inner_#2}}#1:#2;%
       \nometa\ltr@ifattribute #1:#3;
         {\ltr@setattribute #1:#4; = {\dimexpr(#5-\dimexpr(\usecs{ltr@#1:inner_#2}+\ltr@usevalue #1:#3;))\relax} }% SPACE
         {\nometa\ltr@ifattribute #1:#4;
             {\ltr@setattribute #1:#3; = {\dimexpr(#5-\dimexpr(\usecs{ltr@#1:inner_#2}+\ltr@usevalue #1:#4;))\relax} }% SPACE
             {\ltr@passvalue{\ltr@setattribute #1:#3;=}#1:#2; % SPACE
              \ltr@setattribute #1:#4; = {\dimexpr(#5-\dimexpr(\usecs{ltr@#1:inner_#2}+\ltr@usevalue #1:#3;))\relax} }}}% SPACE
      {}%
  }
% Defaults
\vsize=\maxdimen % So no unwanted output occurs
\setparameter slide:
  vpos           = center
  background     = white
  foreground     = black
  bookmark       = true
  bookmarklevel  = 1
  scale          = false

\setparameter ltr@inner_slide:
  meta = slide

\long\def\setslide#1#2\par{%
  \ltr@space_loop{\ltr@setslide_do{#2}}{#1 }%
  }
\long\def\ltr@setslide_do#1#2{%
  \ltr@ifattribute {ltr@#2@inner_slide}:meta;
    {\setparameter{ltr@#2@inner_slide}:}
    {\ltr@setslide_new{#2}}%
    #1\par
  }
\def\ltr@setslide_new#1{%
  \defcs{#1}{%
    \ltr@setattribute ltr@inner_slide:meta;={ltr@#1@inner_slide}
    \slide}%
  \letcs{end#1}\endslide
  \ifnum\formatnumber=3 % ConTeXt
    \letcstocs{start#1}{#1}%
    \letcs{stop#1}\endslide
  \fi
  \passexpandednobraces{\restrictparameter ltr@#1@inner_slide:}\ltr@slide_restrictions\par
  \ltr@restrictattribute ltr@#1@inner_slide:vpos; top center bottom\par
  \ltr@boolean_attr{ltr@#1@inner_slide:bookmark}%
  \defactiveparameter ltr@#1@inner_slide {%
    \ltr@slide_parameter{##1}%
    }%
  \setparameter{ltr@#1@inner_slide}:
    meta = slide
  }
%
%
%
%
%
%
% The \slide command.
% Attributes (beside those in the slide parameter):
% pdftitle; and a value without a = sign is taken
% as the slide title and recorded in \slidetitle;
% it is also recorded as pdftitle if there is this
% entry is missing.
%
\def\slidetitle{}\def\ltr@slide_pdftitle{}
\def\ltr@ltr@inner_slide_usepair#1#2{% Used by option_launchloop.
  \ltr@setattribute ltr@inner_slide:#1;={#2} %
  }
\def\ltr@ltr@inner_slide_useatom#1{% Idem. (Literate programming, he said?)
  \def\slidetitle{#1}%
  }
\def\slide{%
  \ifnextnospace[{\ltr@slide}{\ltr@slide[]}%
  }
\ifnum\formatnumber=3
  \let\startslide\slide
\fi
\def\ltr@slide[#1]{%
  \def\slidetitle{}
  \ltr@option_launchloop{ltr@inner_slide}{#1}%
  \ltr@slide_parameter{ltr@inner_slide}%
  \edef\ltr@slide_pdftitle{%
    \ltr@usevalueor ltr@inner_slide:pdftitle;{\slidetitle}%
    }%
  \pdfdest name {ltr@linktopage_\the\slideno} fit
  \ltr@ifvalue ltr@inner_slide:bookmark;= true
     {\ltr@ifattribute ltr@inner_slide:anchor;
        {\createbookmark[\ltr@usevalue ltr@inner_slide:bookmarkstyle;]{\ltr@usevalue ltr@inner_slide:bookmarklevel;}[\ltr@usevalue ltr@inner_slide:anchor;]{\ltr@slide_dotitle}}
        {\createbookmark[\ltr@usevalue ltr@inner_slide:bookmarkstyle;]{\ltr@usevalue ltr@inner_slide:bookmarklevel;}{\ltr@slide_dotitle}}}
     {\ltr@passvalue\anchor ltr@inner_slide:anchor;}
  %
  \ltr@usevalueor ltr@inner_slide:font;{\ltr@usevalue job:font;}%
  % Set the page dimensions.
  \baselineskip=\ltr@usevalueor ltr@inner_slide:baselineskip;{12pt}\relax
  \topskip=\ltr@usevalueor ltr@inner_slide:topskip;{12pt}\relax
  \parskip=\ltr@usevalueor ltr@inner_slide:parskip;{0pt}\relax
  \pdfpagewidth=\ltr@usevalueor ltr@inner_slide:width;{15cm}\relax
  \pdfpageheight=\ltr@usevalueor ltr@inner_slide:height;{12cm}\relax
  \pdfhorigin=\ltr@usevalueor ltr@inner_slide:left;{2cm}\relax
  \pdfvorigin=\ltr@usevalueor ltr@inner_slide:top;{1cm}\relax
  \hsize=\ltr@usevalueor ltr@inner_slide:hsize;{\dimexpr(\pdfpagewidth-2\pdfhorigin)\relax}\relax
  \parindent=\ltr@usevalueor ltr@inner_slide:parindent;{0pt}\relax
  \leftskip=0pt \rightskip=0pt plus 1fill\relax
  \ltr@ifcasevalue ltr@inner_slide:hpos;
    \val ff \rightskip=0pt
    \val rr \leftskip=0pt plus 1fill\relax
    \val rf \leftskip=0pt plus 1fill\rightskip=0pt
  \endval
  \ltr@usevalue ltr@inner_slide:everyslide;%
  }
\def\ltr@slide_dotitle{%
  \ifemptycommand\ltr@slide_pdftitle{Page \the\slideno}{\ltr@slide_pdftitle}%
  }
\def\endslide{%
  \par
  \ltr@step_clear
  \ifdim\pagetotal=0pt
    \hbox{\vrule width 0pt}% If the slide is empty, there might be material in areas.
  \fi  % Close the previous step, if any.
  \addtopageresources{%
    /Properties << \ltr@page_properties >>
    /Shading    << \ltr@page_shading    >>
    /ExtGState  << \ltr@page_extgstate  >>
    }%
  \addtopageobject{%
    \iffcs{ltr@inner_transition:\ltr@usevalueor ltr@inner_slide:transition;{ltr@no_value}}
          {/Trans \usecs{ltr@inner_transition:\ltr@usevalueor ltr@inner_slide:transition;{ltr@no_value}} 0 R}
    \ltr@pageattr_global}%
                                   % End up as /Order [ [(Page 1) 1 0 R 2 0 R...] [(Page 2)...]...] in the catalog.
  \global\eaddright\ltr@order_OCGs{[(\ltr@slide_dotitle) \ltr@page_OCGs] }%
  % Here we go.
  \penalty\ltr@output_penalty
  \ltr@page_clear
  }
\ifnum\formatnumber=3 % ConTeXt
  \let\stopslide\endslide
\fi
%
% Resource management.
% Should be usable by anybody. Returns the list of /<name> <number> 0 R pairs
% in /Page ... /Resources << /Properties ... >>.
% Using \pdfpageresources would ruin everything.
%
\def\ltr@catalog_OCGs{} \def\ltr@page_OCGs{}        \def\ltr@order_OCGs{}
\def\ltr@visible_OCGs{} \def\ltr@page_visibleOCGs{} \def\ltr@page_invisibleOCGs{}
\edef\ltr@page_PA{}
\def\ltr@page_properties{} \def\ltr@page_steplist{}
\def\ltr@page_shading{} \def\ltr@page_extgstate{}
\def\ltr@pageattr_global{}
\def\addshading#1#2{%
  \global\eaddright\ltr@page_shading{/#1 #2 0 R }%
  }
\def\addgstate#1#2{%
  \global\eaddright\ltr@page_extgstate{/#1 #2 0 R }%
  }
\def\addproperties#1#2{%
  \global\eaddright\ltr@page_properties{/#1 #2 0 R }%
  }
\def\addtopageresources#1{%
  \begingroup
    \edef\ltr@temp{\global\pdfpageresources{\the\pdfpageresources\spacecs #1 }}%
    \ltr@temp
  \endgroup
  }
\def\addOCG#1{%
  \global\eaddright\ltr@catalog_OCGs{#1 0 R }%
  \global\eaddright\ltr@page_OCGs{#1 0 R }%
  \global\eaddright\ltr@page_invisibleOCGs{#1 0 R }%
  }
\def\addvisibleOCG#1{%
  \global\eaddright\ltr@catalog_OCGs{#1 0 R }%
  \global\eaddright\ltr@visible_OCGs{#1 0 R }%
  \global\eaddright\ltr@page_OCGs{#1 0 R }%
  \global\eaddright\ltr@page_visibleOCGs{#1 0 R }%
  }
\def\addtopageobject#1{%
  \begingroup
    \edef\ltr@temp{\global\pdfpageattr{#1\the\pdfpageattr}}%
    \ltr@temp
  \endgroup
  }
\def\addtoeachpageobject#1{%
  \global\eaddright\ltr@pageattr_global{#1}%
  }
\def\ltr@page_clear{%
  \gdef\ltr@page_OCGs{}%
  \gdef\ltr@page_visbleOCGs{}%
  \gdef\ltr@page_invisbleOCGs{}%
  \gdef\ltr@page_PA{}%
  \gdef\ltr@page_properties{}%
  \gdef\ltr@page_steplist{}%
  \global\pdfpageattr={}%
  \global\def\ltr@step_current{}%
  \global\ltr@steps_count=0
  \global\ltr@activesteps_count=0
  \ltr@setattribute ltr@inner_slide:meta; = slide
  \ltr@slide_deleteattributes
  }

\endinput