% This file is part of the Lecturer package. % Paul Isambert -- July 2010. % % % ATTRIBUTES % \def\setarea#1#2\par{% \ltr@space_loop{\ltr@setarea_do{#2}}{#1 }% } \long\def\ltr@setarea_do#1#2{% \ltr@ifattribute {ltr@#2@inner_area}:visible; {\setparameter {ltr@#2@inner_area}:} {\ltr@setarea_new{#2}}% #1\par }% \def\ltr@area_list{}% \def\ltr@setarea_new#1{% \global\eaddright\ltr@area_list{ltr@#1@inner_area,}% \passcs{\usecs{newbox}}{ltr@#1@inner_area:box}% \restrictparameter ltr@#1@inner_area: width height hshift hshift* vshift vshift* left right top bottom foreground background topskip baselineskip parindent parskip hpos vpos visible frame frame_width frame_color frame_corner frame_dash everyposition everyfreeposition font hsize vsize image \par \ltr@restrictattribute ltr@#1@inner_area:visible; true false step\par \ltr@restrictattribute ltr@#1@inner_area:frame_corner; miter round bevel\par \ltr@restrictattribute ltr@#1@inner_area:hpos; ff rr fr rf\par \defactiveparameter ltr@#1@inner_area {% \ltr@delete_empty{##1:background}% \ltr@todim_loop{##1}{width height hshift hshift* vshift vshift* left right top bottom hsize vsize topskip baselineskip parindent frame_width }% \ltr@dimen_set{##1}{hshift*}{hshift}{width}{\pdfpagewidth}% \ltr@dimen_set{##1}{vshift*}{vshift}{height}{\pdfpageheight}% \ltr@deleteattribute ##1:hshift*;% \ltr@deleteattribute ##1:vshift*;% \ltr@dimen_set{##1}{right}{left}{hsize}{\ltr@area_width{##1}}% \ltr@dimen_set{##1}{bottom}{top}{vsize}{\ltr@area_height{##1}}% \ltr@deleteattribute ##1:right;% \ltr@deleteattribute ##1:bottom;% \ltr@ifattribute##1:frame; {\def\ltr@area_name{#1}\ltr@passvalue{\ltr@option_launchloop{area}}##1:frame;}{}% \ltr@deleteattribute##1:frame; \ltr@todim_loop{##1}{frame_width }% \ltr@ifattribute##1:frame_color;{} {\ltr@ifattribute##1:background; {\ltr@setattribute##1:frame_color; = {\ltr@usevalueor##1:background;{white}} }{}}% }% \setparameter {ltr@#1@inner_area}: visible = true } \def\ltr@area_usepair#1#2{% \ltr@setattribute ltr@\ltr@area_name @inner_area:frame_#1;={#2} } % % % \def\ltr@area_hshift#1{% \ltr@usevalueor #1:hshift;{0pt}% } \def\ltr@area_vshift#1{% \ltr@usevalueor #1:vshift;{0pt}% } \def\ltr@area_width#1{% \ltr@usevalueor #1:width;{\dimexpr(\pdfpagewidth-\ltr@area_hshift{#1})}% } \def\ltr@area_height#1{% \ltr@usevalueor #1:height;{\dimexpr(\pdfpageheight-\ltr@area_vshift{#1})}% } \def\ltr@area_left#1{% \ltr@usevalueor #1:left;{0pt}% } \def\ltr@area_top#1{% \ltr@usevalueor #1:top;{0pt}% } \def\ltr@area_hsize#1{% \ltr@usevalueor #1:hsize;{\dimexpr(\ltr@area_width{#1}-\ltr@area_left{#1})\relax}% } \def\ltr@area_vsize#1{% \ltr@usevalueor #1:vsize;{\dimexpr(\ltr@area_height{#1}-\ltr@area_top{#1})\relax}% } % % POSITION % No attributes, except the optional argument, % which takes the x and y (downward, \'a la TeX) % shifts. Most of this is box manipulation. % \newcount\ltr@temp_count \newcount\ltr@position_count \def\position#1{% \ifnextnospace[{\ltr@position{#1}}{\ltr@position{#1}[]}% } \newife\ifltr@area_do \long\def\ltr@position#1[#2]{% \ltr@ifattribute ltr@#1@inner_area:visible; {\ltr@area_check{#1}% \ifltr@area_do {\ltr@position_do{#2}{ltr@#1@inner_area}} {\gobbleone}} {\ltr@error{Area `#1' doesn't exist. Material is discarded}\gobbleone} } \def\ltr@area_check#1{% \ltr@area_dotrue \ltr@ifattribute ltr@inner_slide:areas*; {\ltr@ifvalue ltr@inner_slide:areas*; = all {\ltr@area_dofalse} {\ltr@storevalue\ltr@temp ltr@inner_slide:areas*; \addright\ltr@temp{ }\addleft\ltr@temp{ }% \passexpanded{\iffcontains{ #1 }}{\ltr@temp}\ltr@area_dofalse}} {}% \ltr@ifattribute ltr@inner_slide:areas; {\ltr@ifvalue ltr@inner_slide:areas; = all {} {\ltr@storevalue\ltr@temp ltr@inner_slide:areas; \addright\ltr@temp{ }\addleft\ltr@temp{ }% \passexpanded{\ifcontains{ #1 }}{\ltr@temp}\ltr@area_dotrue\ltr@area_dofalse}} {}% } \newbox\ltr@temp_box \newdimen\ltr@temp_dimen \long\def\ltr@position_do#1#2#3{% \ifemptystring{#1} % Normal position. {\setbox\ltr@temp_box=\ltr@position_dobox{#2}{\ltr@usevalue #2:everyposition;#3}} % Free position. {\setbox\ltr@temp_box=\vbox{% \ltr@position_dobox{#2}{\ltr@usevalue #2:everyfreeposition;#3}}% \ltr@position_getposition#1 \setbox\ltr@temp_box=\vbox{% \kern\dimexpr(\ltr@position_top+\ltr@usevalueor #2:topskip;\topskip-\ht\ltr@temp_box)\relax \moveright\ltr@position_left\box\ltr@temp_box }% \dp\ltr@temp_box=0pt \ht\ltr@temp_box=0pt }% % How to apply topskip? % If the box isn't empty, that doesn't mean it shouldn't be used, % since the content of the box might be material freely positioned, % which doesn't exist, so to speak. % We can't measure the box either, because if topskip % is 0pt, one-line material without depth will fill the box % with height and depth 0pt, as if there were nothing, and % topskip will be applied again on the next material. % Hence this pseudo-conditional turned to true the first % time real material is added. \ifemptystring{#1} {\begingroup \ltr@usevalue #2:font;% So em and ex are right. \ifcsname #2:done\endcsname \global\ltr@temp_dimen=\dimexpr(% \dimexpr(\ltr@usevalueor #2:baselineskip;\baselineskip+\ltr@usevalueor #2:parskip;{0pt})\relax -\dimexpr(\ht\ltr@temp_box+\dp\usecs{#2:box}))\relax \ifdim\ltr@temp_dimen<\lineskiplimit \global\ltr@temp_dimen=\lineskip \fi \else \global\ltr@temp_dimen=\dimexpr(\ltr@usevalueor #2:topskip;\topskip-\ht\ltr@temp_box)\relax% \global\letcs{#2:done}\relax \fi \endgroup} {\edef\ltr@position_left{\the\ht\usecs{#2:box}}% I could have used special dimensions \edef\ltr@position_top{\the\dp\usecs{#2:box}}}% but it's a time of austerity. \global\setbox\usecs{#2:box}=\vbox{% \unless\ifvoid\usecs{#2:box} \unvcopy\usecs{#2:box} \fi \ifemptystring{#1} {\kern\ltr@temp_dimen} {\kern-\dimexpr(\ht\usecs{#2:box}+\dp\usecs{#2:box})\relax} \ifx\ltr@step_current\emptycs \ifemptystring{#1}\unvbox\box\ltr@temp_box \reverse\iffcs{ltr@#2_\the\slideno @inner_area:group} {\global\letcs{ltr@#2_\the\slideno @inner_area:group}\emptycs} \else \global\advance\ltr@position_count1 \pdfliteral {/OC/ltr@position_\the\ltr@position_count:content BDC} \ifemptystring{#1}\unvbox\box\ltr@temp_box \pdfliteral {EMC} \addproperties{ltr@position_\the\ltr@position_count:content}{\ltr@step_current} \reverse\iffcs{#2_\the\slideno:group} {\global\letcs{#2_\the\slideno:group}\ltr@step_current \addproperties{#2_\the\slideno:background}{\usecs{#2_\the\slideno:group}}} \fi \reverse\iffemptystring{#1} % Restore the box to its original dimensions. {\prevdepth-1000pt \vbox to \ht\usecs{#2:box}{\vfil\hbox{\vrule height0pt width0pt depth\dp\usecs{#2:box}}}}% }% \ltr@temp_dimen=0pt } \def\ltr@position_getposition#1,#2 {% \edef\ltr@position_left{\ifemptystring{#1}{0pt}{\dimexpr(#1)}}% \edef\ltr@position_top{\ifemptystring{#2}{0pt}{\dimexpr(#2)}} } \long\def\ltr@position_dobox#1#2{% \vtop{% \ltr@usevalue #1:font; \parindent\ltr@usevalueor #1:parindent;{0pt}\relax \hsize=\ltr@area_hsize{#1}\relax \ltr@settovalue\baselineskip #1:baselineskip; \parskip=\ltr@usevalueor #1:parskip;{0pt}\relax \leftskip=0pt \rightskip=0pt plus 1fill\relax \ltr@ifcasevalue #1:hpos; \val ff \rightskip=0pt \val rr \leftskip=0pt plus 1fill\relax \val rf \leftskip=0pt plus 1fill \rightskip=0pt \endval #2}% } \endinput