summaryrefslogtreecommitdiff
path: root/macros/generic/lecturer/tex/ltr-slides.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/lecturer/tex/ltr-slides.tex')
-rw-r--r--macros/generic/lecturer/tex/ltr-slides.tex244
1 files changed, 244 insertions, 0 deletions
diff --git a/macros/generic/lecturer/tex/ltr-slides.tex b/macros/generic/lecturer/tex/ltr-slides.tex
new file mode 100644
index 0000000000..dd99458dbf
--- /dev/null
+++ b/macros/generic/lecturer/tex/ltr-slides.tex
@@ -0,0 +1,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 \ No newline at end of file