% This is the Lecturer package.
% Relevant information can be found in lecturer-doc.pdf
%
% Author: Paul Isambert.
% E-mail: zappathustra AT free DOT fr
% Comments and suggestions are welcome.
% Date: July 2010.
%
\ifx\lectureralreadyloaded\undefined
  \let\lectureralreadyloaded\relax
\else
  \expandafter\endinput
\fi

\input yax % which input's texapi
\ifdefined\yaxversion
  \ifdim\yaxversion pt<1.02pt
    \senderror{Lecturer}{I need YaX with version at least 1.02. I quit}
    \expandafter\expandafter\expandafter\endinput
  \fi
\else
  \senderror{Lecturer}{I need YaX with version at least 1.02. I quit}
  \expandafter\endinput
\fi
\setcatcodes{\_\@=11}
\def\ltr@error{\senderror{Lecturer}}
\pdfminorversion5
%
% YAX SETTINGS.
%
\newsyntax#1:#2;{ltr@}
%
% A faster way to restrict those attributes
% that take boolean values.
%
\def\ltr@boolean_attr#1{%
  \ltr@restrictattribute #1; true false\par
  }
%
% Delete a list of attributes.
%
\newfor\ltr@attribute_deletion{1}#2 {%
  \ltr@deleteattribute #1:#2;%
  }
%
% Delete an attribute if empty, so being empty
% is equivalent to being undefined. 
%
\def\ltr@delete_empty#1{%
  \ltr@passvalueand{\iffemptystring}#1;{{\ltr@deleteattribute#1;}}{}%
  }
%
% Turn the <value> of those attributes that are supposed to
% be dimensions into \dimexpr(<value>), so that one can
% declare e.g. "5cm-12pt" as a value.
%
\newfor\ltr@todim_loop{1}#2 {%
  \nometa\ltr@ifattribute#1:#2;
    {\ltr@passvalue{\ltr@todim_trim{#1:#2}}#1:#2;}{}%
  }
\def\ltr@todim_trim#1#2{%
  \passtrim{#2}{\ltr@todim_do{#1}}%
  }
\def\ltr@todim_do#1#2{%
  \ltr@setattribute#1; = {\dimexpr(#2)}
  }
\def\ltr@gobbletopar#1\par{}%
% GENERAL COMMANDS
%
% Option processing when between brackets [...].
% Each command where such options occur (\slide, \step...)
% defines a "useatom" and "usepair".
%
\newstring{=}
\def\ltr@option_launchloop#1#2{\ltr@option_loop{#1}{#2,}}
\newfornoempty\ltr@option_loop{1}#2,{%
  \ifcontains={#2}{\ltr@option_getpair{#1}#2\ltr@end}
                  {\passtrim{#2}{\usecs{ltr@#1_useatom}}}%
  }
\def\ltr@option_getpair#1#2=#3\ltr@end{%
  \passtrim{#3}{\ltr@option_checkquotes{\passtrim{#2}{\usecs{ltr@#1_usepair}}}}%
  }
\newstring{"}
\def\ltr@option_checkquotes#1#2{%
  \iffprefix"{#2}
    {\iffsuffix"{#2}\ltr@option_removequotes}%
    #1{#2}%
  }
\def\ltr@option_removequotes#1#2#3#4{%
  \removeprefixand"{#4}{\ltr@removesuffixand"{#1{#2}{#3}}}%
  }
\def\ltr@removesuffixand#1#2#3{\removesuffixand#1{#3}{#2}}  
%
% A generic loop on space-separated lists.
\newfornoempty\ltr@space_loop{1}#2 {#1{#2}}
%
% Turns a dimension into a number.
%
\def\ltr@nopt#1{\expandafter\lTr@noPT\the\dimexpr(#1)\relax}
\def\ltr@integer#1{\expandafter\lTr@inTeger\the\dimexpr(#1)\relax}
% Turns TeX english points (72.27 per inch), in which dimensions
% are expressed, into Postscript ones (72 per inch), which PDF understands.
%
\def\ltr@point_convert#1{%
  \expandafter\lTr@noPT\the\dimexpr(.996264\dimexpr(#1))\relax\spacecs
  }
\let\numexPr\numexpr
{\setcatcodes{pt=12} \gdef\lTr@noPT#1pt{#1}
\gdef\lTr@inTeger#1.#2#3pt{\numexPr(#1#2/10)}}
%
% Here we go.
%
\def\ltr@input#1 {\priminput ltr-#1.tex }
\ltr@input job
\ltr@input slides
\ltr@input steps
\ltr@input areas
\ltr@input graphics
\ltr@input navigation
\restorecatcodes
\endinput
% Goodbye.
