% \CheckSum{1237}
%
%\iffalse   % this is a METACOMMENT !
%
%% File: slidenotes.dtx Copyright (C) 1993-1996 Hans van der Meer
%%
%
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\ProvidesFile{slidenotes.dtx}[1998/04/23 3.27  Slides and notes]
\GetFileInfo{slidenotes.dtx}
\title{The \textsf{slidenotes} package%
\thanks{This file has version \fileversion\space dated \filedate.}}
\author{Hans van der Meer\\hansm@wins.uva.nl}
\date{Printed \today}
\DisableCrossrefs
\CodelineNumbered
%\RecordChanges
\begin{document}
\maketitle
\DocInput{slidenotes.dtx}
\end{document}
%</driver>
%    \end{macrocode}
%
%\fi
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \changes{3.00}{1994/03/21}{First version for LaTeX2E and docstrip}
% \changes{3.01}{1994/12/10}{Removed @vpt... macros}
% \changes{3.02}{1995/01/26}{sheets->slides, various changes}
% \changes{3.03}{1995/02/02}{small changes}
% \changes{3.04}{1995/08/11}{@currdir in folder defaults}
% \changes{3.05}{1995/08/28}{restructured documentation}
% \changes{3.06}{1995/08/29}{frame variations, LaTeX2e-isms}
% \changes{3.07}{1995/09/01}{frame variations, oval boxing problematic}
% \changes{3.08}{1995/09/04}{note (section) title -> toc error}
% \changes{3.09}{1995/09/05}{added vertical slide centering option}
% \changes{3.10}{1995/09/18}{cue macro changed}
% \changes{3.11}{1995/10/12}{everyslide, nofiles for slides added}
% \changes{3.12}{1995/10/23}{cue macro marginpar always same side}
% \changes{3.13}{1996/03/16}{changes to frame treatment}
% \changes{3.14}{1996/03/22}{check for slides that are too high}
% \changes{3.15}{1996/05/25}{nofiles removed}
% \changes{3.16}{1996/08/13}{test presence chapter, cleaning code}
% \changes{3.17}{1996/08/14}{on directory names changed pathseparator,
%                            disable tableofcontents if not notes}
% \changes{3.18}{1996/08/14}{added mixing of portrait and landscape}
% \changes{3.19}{1996/08/21}{added portrait/landscape selective code}
% \changes{3.20}{1996/08/23}{made all newcommands starred where appropiate,
%                            removed superfluous braces}
% \changes{3.21}{1997/03/08}{added better directory separator,
%                            changed slide dimensions to magnified sizes,
%                            corrected calculation of text dimensions,
%                            problem with missedslidecounter solved}
% \changes{3.22}{1997/03/14}{CurrentDirectory for @currdir added}
% \changes{3.23}{1998/02/17}{option to suppress newpage at slide}
% \changes{3.24}{1998/03/20}{ignorespaces in slide en note begin-commands}
% \changes{3.25}{1998/04/08}{stepcounter{slidecounter}->refstepcounter}
% \changes{3.26}{1998/04/15}{list in note environment zet parsep}
% \changes{3.27}{1998/04/23}{boldmath in titles on sheets}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \DoNotIndex{\#}
% \DoNotIndex{\@,}
% \DoNotIndex{\\}
% \DoNotIndex{\@dblarg}
% \DoNotIndex{\@empty}
% \DoNotIndex{\@firstoftwo}
% \DoNotIndex{\@height}
% \DoNotIndex{\@ifstar}
% \DoNotIndex{\@ifundefined}
% \DoNotIndex{\@m}
% \DoNotIndex{\@makeother}
% \DoNotIndex{\@namedef}
% \DoNotIndex{\@sanitize}
% \DoNotIndex{\@secondoftwo}
% \DoNotIndex{\@tempdima}
% \DoNotIndex{\@tempdimb}
% \DoNotIndex{\@title}
% \DoNotIndex{\@width}
% \DoNotIndex{\addtolength}
% \DoNotIndex{\addvspace}
% \DoNotIndex{\advance}
% \DoNotIndex{\begin}
% \DoNotIndex{\begingroup}
% \DoNotIndex{\bgroup}
% \DoNotIndex{\bigskip}
% \DoNotIndex{\bigskipamount}
% \DoNotIndex{\box}
% \DoNotIndex{\catcode}
% \DoNotIndex{\csname}
% \DoNotIndex{\def}
% \DoNotIndex{\dimen@}
% \DoNotIndex{\divide}
% \DoNotIndex{\dp}
% \DoNotIndex{\edef}
% \DoNotIndex{\egroup}
% \DoNotIndex{\end}
% \DoNotIndex{\endcsname}
% \DoNotIndex{\endgroup}
% \DoNotIndex{\endlist}
% \DoNotIndex{\enspace}
% \DoNotIndex{\expandafter}
% \DoNotIndex{\fbox}
% \DoNotIndex{\gdef}
% \DoNotIndex{\global}
% \DoNotIndex{\hbox}
% \DoNotIndex{\hfil}
% \DoNotIndex{\hfill}
% \DoNotIndex{\hrule}
% \DoNotIndex{\hspace}
% \DoNotIndex{\Huge}
% \DoNotIndex{\huge}
% \DoNotIndex{\ht}
% \DoNotIndex{\if,\else,\fi}
% \DoNotIndex{\ifcase,\or,\fi}
% \DoNotIndex{\ifdim,\fi}
% \DoNotIndex{\ifnum,\fi}
% \DoNotIndex{\ifodd,\fi}
% \DoNotIndex{\ifx,\fi}
% \DoNotIndex{\item}
% \DoNotIndex{\kern}
% \DoNotIndex{\LARGE}
% \DoNotIndex{\Large}
% \DoNotIndex{\large}
% \DoNotIndex{\let}
% \DoNotIndex{\list}
% \DoNotIndex{\m@ne}
% \DoNotIndex{\medskip}
% \DoNotIndex{\medskipamount}
% \DoNotIndex{\multiply}
% \DoNotIndex{\newcommand}
% \DoNotIndex{\newcounter}
% \DoNotIndex{\newenvironment}
% \DoNotIndex{\newif}
% \DoNotIndex{\newlength}
% \DoNotIndex{\newpage}
% \DoNotIndex{\newsavebox}
% \DoNotIndex{\newtoks}
% \DoNotIndex{\next}
% \DoNotIndex{\noexpand}
% \DoNotIndex{\noindent}
% \DoNotIndex{\null}
% \DoNotIndex{\p@}
% \DoNotIndex{\par}
% \DoNotIndex{\parbox}
% \DoNotIndex{\raggedright}
% \DoNotIndex{\relax}
% \DoNotIndex{\renewcommand}
% \DoNotIndex{\reserved@a}
% \DoNotIndex{\scriptsize}
% \DoNotIndex{\setbox}
% \DoNotIndex{\setlength}
% \DoNotIndex{\sloppy}
% \DoNotIndex{\small}
% \DoNotIndex{\smallskip}
% \DoNotIndex{\smallskipamount}
% \DoNotIndex{\space}
% \DoNotIndex{\stepcounter}
% \DoNotIndex{\string}
% \DoNotIndex{\strut}
% \DoNotIndex{\test}
% \DoNotIndex{\the}
% \DoNotIndex{\tiny}
% \DoNotIndex{\tw@}
% \DoNotIndex{\typeout}
% \DoNotIndex{\undefined}
% \DoNotIndex{\value}
% \DoNotIndex{\vbox}
% \DoNotIndex{\vfil}
% \DoNotIndex{\vfill}
% \DoNotIndex{\vskip}
% \DoNotIndex{\vspace}
% \DoNotIndex{\wd}
% \DoNotIndex{\xdef}
% \DoNotIndex{\z@}
%
% \begin{abstract}
%   This article describes the use and the implementation of the 
%   \emph{slidenotes class}.
%   Its purpose is the typesetting of slides and accompanying notes.
%   Slides can be in portrait or landscape orientation.
%   Options are the typesetting of the slides or slides plus notes,
%   or a collection of slides in small format.
% \end{abstract}
%
% \tableofcontents
%
% \section{Usage}
%
% An input file may consist of a series of slides accompanied
% by notes. Below the format of a slide in a nutshell:
%
% \DescribeEnv{slide}
% \begin{verbatim}
% \begin{slide}[SLIDE TITLE (optional)]
%    ...
%    \slidesubtitle{SUBTITLE}
%    ...
%    <more slide text>
%    ...
% \end{slide}
% \end{verbatim}
%
% or
%
% \DescribeEnv{portraitslide}
% \begin{verbatim}
% \begin{portraitslide}[SLIDE TITLE (optional)]
%    ...
% \end{portraitslide}
% \end{verbatim}
%
% \DescribeEnv{landscapeslide}
% \begin{verbatim}
% \begin{landscapeslide}[SLIDE TITLE (optional)]
%    ...
% \end{landscapeslide}
% \end{verbatim}
%
% Do not put anything text outside notes/slide, 
% because it interferes destructively with the layout.
%
% \DescribeEnv{note}
% \begin{verbatim}
% \begin{note}
%    ...
%    \cue{MARGIN TEXT}
%    ...
%    <more note text>
%    ...
% \end{note}
% \end{verbatim}
%
% Use |\chapter| for the main structure, each note will
% be converted to a |\section|.
% Several parameters and font macro's are defined for various
% style features; they can be redefined, either in the document
% or in the \emph{slidenotes.cfg} file.
% These parameters exist for the dimensions of the slide,
% the font in the various text parts, several standard texts.
%
% Options exist for:
% \begin{itemize}\setlength{\itemsep}{0pt}
% \item choosing between slides, slides + notes, a collection of slides; 
% \item landscape or portrait format;
% \item notes in a type one notch smaller than in the slides;
% \item variation in frame around slide.
% \item variation in vertical centering of the contents.
% \end{itemize}
% 
% See the implementation sections for further details.
% 
% \StopEventually{\PrintChanges}
%
% \section{Identification}
%
%    This document class can only be used with \LaTeXe, so we make
%    sure that an appropriate message is displayed when another \TeX{}
%    format is used.
%
%    \begin{macrocode}
%<cls|obox>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%    \end{macrocode}
%
%    Announce class names and versions:
%    \begin{macrocode}
%<*cls>
\ProvidesClass{slidenotes}[1998/04/23 3.27  Slides and notes]
%    \end{macrocode}
%
% \section{Declaration of Class Options}
%
%    In this part we define the options for this class that are additional
%    to those of its parent class.
%
% \subsection{Show Options to User}
%
% Show options to the user with option |help|.
%
%    \begin{macrocode}
\DeclareOption{help}{\ClassWarningNoLine{slidenotes}{%
    Options (first one is default):
      \MessageBreak
    notes,slides,minis:\space type of production;
      \MessageBreak
    portrait,landscape:\space slide orientation;
      \MessageBreak
    mixed,unmixed,anti:\space both, chosen, anti orientation;
      \MessageBreak
    center,nocenter,squeeze:\space vertical slide position;
      \MessageBreak
    rect,oval,rules,drules,noframe:\space type of slideframe;
      \MessageBreak
    newpage,nonewpage:\space yes/no start slide on new page;
      \MessageBreak
    smallnotes:\space notes one notch smaller}}
%    \end{macrocode}
%
% \subsection{Slides and/or Notes}
%
% \begin{macro}{\ifnotes}
% \begin{macro}{\ifslides}
% \begin{macro}{\ifminis}
% Flag |\ifnotes| governs the production of notes in the
% typesetting of slides and notes, 
% flag |\ifslides| signals the typesetting of slides only
% and |\ifminis| is for the production of a smallsized slide collection.
% Options |notes|, |slides| and |minis| perform the selection
% of these modes.
%
%    \begin{macrocode}
\newif\ifnotes
\newif\ifslides
\newif\ifminis
\DeclareOption{notes}{\notestrue\minisfalse\slidesfalse}
\DeclareOption{slides}{\notesfalse\minisfalse\slidestrue}
\DeclareOption{minis}{\notesfalse\ministrue\slidesfalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Portrait or Landscape Orientation}
%
% \begin{macro}{\iflandscape}
% Typesetting of slides can come in portrait or landscape format;
% even mixing of these within one document is possible.
%
%    \begin{macrocode}
\newif\iflandscape
\DeclareOption{landscape}{\landscapetrue}
\DeclareOption{portrait}{\landscapefalse}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifmixed}
% \begin{macro}{\ifanti}
% The next series of flags control the production of mixed portrait\slash
% landscape slides or runs with one orientation only.
%
% With the |mixed| option one may mix portrait and landscape
% oriented slides. If a slide has an orientation differing
% from the one currently in effect (from the landscape and
% portrait class option), it will be rotated over 90 degrees.
% This however, requires the presence of one of the graphics
% styles (\emph{graphics.sty} or \emph{graphicx.sty}) and
% a conforming printer driver.
% If one of these styles is not already present, one 
% will be loaded at the start of the document.
%
% The |unmixed| option is for the case where rotation is
% not possible (as for ex. the native OzTeX printer driver)
% or not wanted. Only slides conforming to the current
% orientation are typeset. E.g. if landscape format is chosen, 
% then all slides produced from the environments |landscapeslide|
% and the neutral |slide| are done, those of |portraitslide| are skipped.
% If there are any slides skipped,
% then a warning will be issued and the job must be rerun with
% the |anti| option; this will produce the
% missing slides in the complementary orientation.
% The |anti| option can coexist with the |unmixed| option.
%
%    \begin{macrocode}
\newif\ifmixed
\newif\ifanti
\DeclareOption{mixed}{\mixedtrue\antifalse}
\DeclareOption{unmixed}{\mixedfalse}
\DeclareOption{anti}{\mixedfalse\antitrue}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Vertical Centering of Slide Material}
%
% \begin{macro}{\ifcenter}
% \begin{macro}{\ifsqueeze}
% Everything below the title at the head of the slide can
% be centered vertically as well as kept tightly below the
% head, the options |center| and |nocenter| accomplish this. 
% Filling will be done with |\vfil|, thereby allowing it
% to be overridden simply by the inclusion of a |\vfill|.
% Furthermore one can |squeeze| the slidebox to minimal height
% for the slides + notes combination.
%
%    \begin{macrocode}
\newif\ifcenter
\newif\ifsqueeze
\DeclareOption{center}{\squeezefalse\centertrue}
\DeclareOption{nocenter}{\squeezefalse\centerfalse}
\DeclareOption{squeeze}{\squeezetrue\centerfalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Suppress Newpage with Slide}
%
% \begin{macro}{\ifnewpage}
% In typesetting notes it may be usefull to suppress the
% newpage at the beginning of a slide.
% This option has effect in note production only.
%
%    \begin{macrocode}
\newif\ifnewpage
\DeclareOption{newpage}{\newpagetrue}
\DeclareOption{nonewpage}{\newpagefalse}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Notes in Smaller Type}
%
% \begin{macro}{\ifsmallnotes}
% The \texttt{smallnotes} option switches the font set
% in the notes one notch smaller than the standard
% sizes chosen in the style. The sizes in the slides
% are always those specified by the style.
%
%    \begin{macrocode}
\newif\ifsmallnotes
\smallnotesfalse
\DeclareOption{smallnotes}{\smallnotestrue}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Variation in Slideframe}
%
% \begin{macro}{\framevariant}
% The frame of a slide can be rectangular, oval,
% delineated by rules or empty.
%
%    \begin{macrocode}
\newcommand*\framevariant{}
\DeclareOption{noframe}{\renewcommand*\framevariant{n}}
\DeclareOption{rules}{\renewcommand*\framevariant{r}}
\DeclareOption{drules}{\renewcommand*\framevariant{d}}
\DeclareOption{rect}{\renewcommand*\framevariant{f}}
\DeclareOption{oval}{\renewcommand*\framevariant{o}}
%    \end{macrocode}
% \end{macro}
%
% The |\obox| macro is in file \texttt{obox.sty};
% if necessary it is read when document processing starts.
%
%    \begin{macrocode}
\AtBeginDocument{\@ifundefined{obox}%
  {\IfFileExists{obox.sty}{\RequirePackage{obox}}%
    {\if\framevariant o
    \ClassWarningNoLine{slidenotes}{oval option disabled}%
    \renewcommand*\framevariant{f}\fi}}%
  {}}
%    \end{macrocode}
%
% \begin{macro}{\ovalslideframerule}
% An oval slideframe is drawn using LaTeX's picture command.
% Therefore the range of linethicknesses is restricted to
% those provided by the circle fonts. The following macro
% is defined to one of the standard linethickness commands.
%
%    \begin{macrocode}
\newcommand*\ovalslideframerule{\thicklines}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Pass Options and Load Parent Class}
%
% \begin{macro}{\parentclass}
% Since the \emph{slidenotes class} is implemented as a modification
% of an existing document class, we must load the parent class.
% However in order to ease changes in parent class the
% name of this class is parametrized in macro |\parentclass|.
% An obvious candidate is \emph{report} or friends.
%
% Customize with a definition of |\parentclass| before
% calling |\documentclass|.
%
%    \begin{macrocode}
\providecommand\parentclass{report}
%    \end{macrocode}
% \end{macro}
%
% Set the class defaults.
%
%    \begin{macrocode}
\ExecuteOptions{notes,portrait,mixed,rect,center,newpage}
%    \end{macrocode}
%
% The options of the |\documentclass| call which are not specific for the
% \emph{slidenotes class} must be passed to the parent class.
% We take the opportunity to select some defaults, e.g.
% production of a titlepage in case the parent class is \emph{article}.
%
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\parentclass}}
\PassOptionsToClass{titlepage,a4paper}{\parentclass}
\ProcessOptions
%    \end{macrocode}
%
% After this we load the parent class.
% Note that the landscape option is not passed if \texttt{notes}
% is also specified.
% For the production of skipped slides we may also need
% landscaped printing.
%
%    \begin{macrocode}
\iflandscape\ifnotes\else
  \PassOptionsToClass{landscape}{\parentclass}%
\fi\fi
\LoadClass{\parentclass}
%    \end{macrocode}
%
% Show some of the options chosen.
%
%    \begin{macrocode}
\ClassWarningNoLine{slidenotes}{%
  \iflandscape LANDSCAPE\else PORTRAIT\fi
  \space SLIDES\space
  \ifminis COLLECTION \fi \ifnotes + NOTES \fi
  PRODUCTION}
%    \end{macrocode}
%
% \section{Some Useful Macros}
%
% We define some helpfull macros first, as we need them later on.
% Defining is with |\providecommand| just in case the parent class
% has already loaded them.
%
% \begin{macro}{\@swapdimens}
% This macro swaps two dimens with the help of a third.
%
%    \begin{macrocode}
\providecommand*\@swapdimens[3]{#3=#1 #1=#2 #2=#3\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ifemptyarg}
% Testing for the presence or absence of a parameter.
%
%    \begin{macrocode}
\providecommand{\@ifemptyarg}[1]{% {absence}{presence}
  \ifx\@empty#1\@empty
  \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Postprocessing of Options}
%
% Reset the squeeze option to false when slides or minis are produced.
% This is done to prevent the slide numbering jumping up and down.
%
%    \begin{macrocode}
\ifminis\squeezefalse\fi
\ifslides\squeezefalse\fi
%    \end{macrocode}
%
% Production of notes turns |mixed| on and |anti| off.
% When typesetting notes, no rotation on the part of the
% dvi driver is required; both can be displayed.
%
%    \begin{macrocode}
\ifnotes\mixedtrue\antifalse\fi
%    \end{macrocode}
%
% When the skipped slides are in production we must effectively
% change the orientation from landscape to portrait or vice versa.
%
%    \begin{macrocode}
\ifanti
  \iflandscape\landscapefalse\else\landscapetrue\fi
  \ClassWarningNoLine{slidenotes}{ANTI OPTION => ORIENTATION CHANGED}
\fi
%    \end{macrocode}
%
% \DescribeEnv{verbatim}
% We need the \emph{verbatim.sty} for skipping portions of the text.
%
%    \begin{macrocode}
\RequirePackage{verbatim}
%    \end{macrocode}
%
% \DescribeMacro{\rotatebox}
% We need the |\rotatebox| macro in case of mixed slides or minis;
% if necessary load \emph{graphics.sty}.
% We are even prepared for the case where this file cannot be found.
%
%    \begin{macrocode}
\ifmixed\ifnotes\else
  \AtBeginDocument{%
    \@ifundefined{rotatebox}%
      {\IfFileExists{graphics.sty}%
        {\RequirePackage{graphics}}%
        {\mixedfalse}%
      }{}}
\fi\fi
%    \end{macrocode}
%
% \section{Dimensions}
%
% \begin{macro}{\slidewidth}
% \begin{macro}{\slideheight}
% We give default values for height and width in portrait format,
% |\slideheight| and |\slidewidth| respectively. 
% In the initialization section the landscape format is set
% by an exchange of height and width. Please note that
% these values are set for slides production: magnified values.
% They will be automatically diminished when slides \&\ notes are made.
% All other dimensions (frame separation, linethickness, etc.)
% must be given unmagnified values, just as one would do in
% normal typesetting.
%
%    \begin{macrocode}
\newlength\slidewidth
\newlength\slideheight
\setlength\slidewidth{176mm}
\setlength\slideheight{248mm}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\slidemagnification}
% For the production of the slides the magnification is set to
% |\slidemagnification|.
%
%    \begin{macrocode}
\newcommand*\slidemagnification{\magstep4}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\slideboxrule}
% \begin{macro}{\slideboxsep}
% \begin{macro}{\slidenotesep}
% \begin{macro}{\slidetitlesep}
% Furthermore we define special parameters for the
% separation between frame and contents of the slide,
% |\slideboxsep| and for the thickness of the frame, |\slideboxrule|.
% Length |\slidenotesep| is the distance between the slide
% and the note, |\slidetitlesep| the skip below a call of
% a (sub)title macro.
%
%    \begin{macrocode}
\newlength\slideboxrule
\newlength\slideboxsep
\newlength\slidenotesep
\newlength\slidetitlesep
\setlength\slideboxrule{.2mm}
\setlength\slideboxsep{3mm}
\setlength\slidenotesep{8mm}
\setlength\slidetitlesep{\z@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Registers}
% 
% \begin{macro}{\slidecounter}
% The slides are counted and the counter is reset whenever
% a new chapter is begun, if there is a chapter structure, of course.
%
%    \begin{macrocode}
\@ifundefined{c@chapter}%
  {\newcounter{slidecounter}}%
  {\newcounter{slidecounter}[chapter]}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\missedslidecounter}
% If we have both the |mixed| and |anti| options off we must
% keep count of the number of slides passed over.
% Always define this counter, it may be present in the auxiliary
% files from a previous run.
% We cannot use the standard \LaTeX's |\newcounter| command, because the
% the value reported will be the value produced by the last
% included file; the reason being the recording of the counter
% in the auxiliary files. Therefore we use plain \TeX's |\newcount|.
%
%    \begin{macrocode}
\newcount\missedslidecounter
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\minicounter}
% Minis come just four to a page, therefore we count them.
%
%    \begin{macrocode}
\newcounter{minicounter}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\slidebox}
% Slides are typeset in a box for later placement and
% height adjustement.
%
%    \begin{macrocode}
\newsavebox\slidebox
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\slidemarker}
% Slides are marked by a text and a number. The text by
% default comes from the |\chapter| macro and is put into
% a token register named |\slidemarker|.
% In the article style, however there is no chapter structure.
% There we intialize this
% token register from the |\title|; note that we need to do this
% at |\begin{document}|, because |\maketitle| interfers
% by setting |\@title| empty.
%
%    \begin{macrocode}
\newtoks\slidemarker
\AtBeginDocument{%
  \@ifundefined{@title}{\def\@title{\Collection}}{}%
  \slidemarker={\@title}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\everyslide}
% \begin{macro}{\everynote}
% At the start of each slide a token register |\everyslide| is executed,
% where the user can place settings that should be local to each slide. 
% The same for the start of each note where |\everynote| is executed.
%
%    \begin{macrocode}
\newtoks\everyslide
\newtoks\everynote
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Note Environment}
%
% \begin{environment}{note}
% In case of productions of slides the notes are simply left out;
% we effectuate this with the comment mechanism of the
% \emph{verbatim.sty}. Otherwise the material in
% the \texttt{note} environment is typeset.
% The environment for notes is started with font selections;
% the fontsize is initialized to normalsize, but all
% sizes are set one notch down for the |smallnotes| option.
% Execution starts the note with the code in token register |\everynote|.
%
%    \begin{macrocode}
\ifnotes
\newenvironment{note}[1][]{%
  \notesfont
  \ifsmallnotes\smallersizes\fi
  \normalsize
  \the\everynote
%    \end{macrocode}
%
% Separate slide and note with some whitespace.
%
%    \begin{macrocode}
  \addvspace{\slidenotesep}%
%    \end{macrocode}
%
% We use the \texttt{list} environment for offsetting
% the margin inside the notes, a variation on the
% \texttt{quote} environment. However, the leftmargin is
% reduced to zero, because we do not want extra indentation
% for the text of the notes.
%
%    \begin{macrocode}
  \list{}{\leftmargin=\z@ 
  	\rightmargin=\marginwidth
  	\parsep=\parskip}\item[]
%    \end{macrocode}
%
% Finish the \texttt{note} environment, close page with a filler
% when newpage option is in effect.
%
%    \begin{macrocode}
  \ignorespaces}{\endlist\ifnewpage\vfill\fi}
%    \end{macrocode}
%
% If notes are not wanted, |\let| the |note| environment to |comment|.
%
%    \begin{macrocode}
\else
  \let\note=\comment
  \let\endnote=\endcomment
\fi
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\smallersizes}
% This macro switches all of \LaTeX's sizes one notch down (except
% for |\tiny|, the smallest size).
%
%    \begin{macrocode}
\newcommand*\smallersizes{%
  \let\Huge\huge
  \let\huge\LARGE
  \let\LARGE\Large
  \let\Large\large
  \let\large\normalsize
  \let\normalsize\small
  \let\small\footnootsize
  \let\footnotesize\scriptsize
  \let\scriptsize\tiny
  }
%    \end{macrocode}
% \end{macro}
%
% \section{Slide Environment}
%
% \subsection{Slide Orientation}
%
% \begin{environment}{portraitslide}
% \begin{environment}{landscapeslide}
% \begin{environment}{slide}
% Here we differentiate between the various possibilities
% for the slide orientation.
% Note that we set a flag for the current orientation
% in order to allow orientation dependent code.
%
% First the case of mixed orientations.
%
%    \begin{macrocode}
\ifmixed
\newenvironment{portraitslide}{%
  \landscapeslidefalse
  \iflandscape\@swapdimens\slideheight\slidewidth\@tempdima
  \fi
  \@slide}{\@endslide
  \iflandscape\putslide{90}\else\putslide{0}\fi}
\newenvironment{landscapeslide}{%
  \landscapeslidetrue
  \iflandscape\else\@swapdimens\slideheight\slidewidth\@tempdima
  \fi
  \@slide}{\@endslide
  \iflandscape\putslide{0}\else\putslide{90}\fi}
\newenvironment{slide}{\@slide}{\@endslide\putslide{0}}
%    \end{macrocode}
%
% Secondly the case where missed slides are produced. 
% A tricky point here is that we have already complemented the
% value of |\iflandscape|; therefore no dimensions
% have to be interchanged and the tests all seem
% to point the wrong way.
%
%    \begin{macrocode}
\else\ifanti
\newenvironment{portraitslide}{%
  \landscapeslidefalse
  \iflandscape
    \refstepcounter{slidecounter}%
    \let\@slide=\comment\let\@endslide=\endcomment
  \fi
  \@slide}{\@endslide
  \iflandscape\else\putslide{0}\fi}
\newenvironment{landscapeslide}{%
  \landscapeslidetrue
  \iflandscape\else
    \refstepcounter{slidecounter}%
    \let\@slide=\comment\let\@endslide=\endcomment
  \fi
  \@slide}{\@endslide
  \iflandscape\putslide{0}\fi}
\newenvironment{slide}{%
  \refstepcounter{slidecounter}%
  \let\@slide=\comment\let\@endslide=\endcomment
  \@slide}{\@endslide}
%    \end{macrocode}
%
% Finally the case of separate slide orientation.
% A skipped slide must be counted always in |slidecounter|
% in order to keep the numbers straight and is also recorded
% in |missedslidecounter|; the |comment| environment
% is used to get rid of a skipped slide.
%
%    \begin{macrocode}
\else
\newenvironment{portraitslide}{%
  \landscapeslidefalse
  \iflandscape
    \refstepcounter{slidecounter}%
    \global\advance\missedslidecounter\@ne
    \let\@slide=\comment\let\@endslide=\endcomment
  \fi
  \@slide}{\@endslide
  \iflandscape\else\putslide{0}\fi}
\newenvironment{landscapeslide}{%
  \landscapeslidetrue
  \iflandscape\else
    \refstepcounter{slidecounter}%
    \global\advance\missedslidecounter\@ne
    \let\@slide=\comment\let\@endslide=\endcomment
  \fi
  \@slide}{\@endslide
  \iflandscape\putslide{}\fi}
\newenvironment{slide}{\@slide}{\@endslide\putslide{0}}
\fi\fi
%    \end{macrocode}
% \end{environment}
% \end{environment}
% \end{environment}
%
% And then we have to report if there are any skipped slides.
%
%    \begin{macrocode}
\ifmixed\else\ifanti\else
\AtEndDocument{\ifnum\missedslidecounter>\z@
  \ClassWarningNoLine{slidenotes}{Rerun with `anti'
  for \the\missedslidecounter\space slide(s) skipped}%
  \fi}
\fi\fi
%    \end{macrocode}
%
% \subsection{Placing a Slide}
%
% \begin{macro}{\putslide}
% The positioning of a slide is split off from its
% production in the following macro.
% We define this positioning differently for the
% various production schemes.
%
%    \begin{macrocode}
\ifnotes
  \newcommand*\putslide[1]{\noindent\rputslide{#1}\par}
\fi
\ifslides
  \newcommand*\putslide[1]{\begin{center}\rputslide{#1}\end{center}}
\fi
\ifminis
  \newcommand*\putslide[1]{\noindent
    \rputslide{#1}%
    \stepcounter{minicounter}%
      \ifnum\value{minicounter}=2
        \par
      \else\ifnum\value{minicounter}=4
        \newpage\setcounter{minicounter}{0}%
      \else\hfil\fi\fi}
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rputslide}
% We alse need variants in accordance with the need of slide rotation.
%
%    \begin{macrocode}
\newcommand*\rputslide[1]{\usebox{\slidebox}}
\ifmixed\ifnotes\else
  \renewcommand*\rputslide[1]{%
    \ifnum#1=\z@\usebox{\slidebox}%
    \else\rotatebox{#1}{\kern-.5\slidewidth\usebox{\slidebox}}%
    \fi}
\fi\fi
%    \end{macrocode}
% \end{macro}
%
% \subsection{Typeset Slide Contents}
%
% \begin{macro}{\@slide}
% Slides are collected between |\@slide| and |\@endslide|.
% Each slide starts a new page, except when a collection is made
% or possibly in note production.
% We program the |\newpage| here in order to get the pagenumbering
% in the table of contents right.
% The font is set to the special chosen |\slidefont|.
% The fontsize is initialized to the normal size.
% From the optional argument the title is put into the \emph{toc} file.
%
% \subsubsection{Starting a Slide}
%
%    \begin{macrocode}
\newcommand*\@slide[1][]{%
	\ifnotes
		\ifnewpage\newpage\else\addvspace{\bigskipamount}\fi
	\else
		\ifminis\else\newpage\fi
	\fi
  \refstepcounter{slidecounter}%
  \slidefont
  \normalsize
%    \end{macrocode}
%
% Write a line to the \emph{.toc} file when notes are in production.
%
%    \begin{macrocode}
\ifnotes
  \@ifemptyarg{#1}%
    {\addcontentsline{toc}{section}{\Slide\,\theslidecounter}}%
    {\addcontentsline{toc}{section}{#1}}%
\fi
%    \end{macrocode}
%
% The contents of the slide is typeset in a \texttt{minipage},
% which is captured in a box. 
% Execution starts the box with the code in token register |\everyslide|.
% When the optional argument is not empty, this
% furnishes the slide title at its top.
% The width of the \texttt{minipage}, in which the contents of
% the slide are typeset,
% is the |\slidewidth| adjusted for the thickness of the
% surrounding frame and the separation between frame and contents.
%
%    \begin{macrocode}
  \@tempdima\slidewidth
  \advance\@tempdima-\tw@\slideboxrule
  \advance\@tempdima-\tw@\slideboxsep
  \@tempdimb\slideheight
  \advance\@tempdimb-\tw@\slideboxrule
  \advance\@tempdimb-\tw@\slideboxsep
  \begin{lrbox}{\slidebox}%
    \the\everyslide
    \ifsqueeze
        \begin{minipage}{\@tempdima}%
    \else
        \begin{minipage}[][\@tempdimb][t]{\@tempdima}%
    \fi
%    \end{macrocode}
%
% We want to find out the height of the slide, therefore
% we catch the slide contents in a |\vbox|.
%
%    \begin{macrocode}
     \setbox\@tempboxa=\vbox\bgroup\leavevmode
     \@ifemptyarg{#1}{}{\slidetitle{#1}}\ifcenter\vfil\fi
     \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Finishing a Slide}
%
% \begin{macro}{\@endslide}
% In the second part of slide typesetting we construct the slide.
%
%    \begin{macrocode}
\newcommand*\@endslide{%
%    \end{macrocode} 
%
% First we do vertical centering with |\vfil| if required.
%
%    \begin{macrocode}
  \ifcenter\vfil\fi
%    \end{macrocode} 
%
% Here we close the catching box and check its height.
%
%    \begin{macrocode}
    \egroup
    \chk@slideheight\@tempboxa
    \unvbox\@tempboxa
    \end{minipage}\end{lrbox}%
%    \end{macrocode}
%
% The slide contents are enclosed in a framed box and
% then together with the marker placed into a |\parbox|.
% The height of the box is
% adjusted to slideheight minus frame.
% The complete slide is again captured in |\slidebox| because
% we may want to subject it to a rotation.
%
%    \begin{macrocode}
  \sbox\slidebox{\parbox{\slidewidth}{%
    \fboxsep\slideboxsep
    \fboxrule\slideboxrule
    \csname frame@\framevariant\endcsname
    \\*[\smallskipamount]
    \makebox[\slidewidth]{%
      \small\strut\the\slidemarker
      \hfil\Slidenumber~\theslidecounter}%
  }}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Framing a Slide}
%
% \begin{macro}{\frame@f}
% Rectangular box around slide contents.
%    \begin{macrocode}
\newcommand*\frame@f{%
  \fbox{\usebox\slidebox}%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\frame@o}
% Oval box around slide contents.
%    \begin{macrocode}
\newcommand*\frame@o{%
  \@tempdimb\dp\slidebox
  \advance\@tempdimb-\fboxsep
  \advance\@tempdimb-\fboxrule
  \obox[][\ovalslideframerule]{%
    \raisebox{\@tempdimb}{\usebox\slidebox}}%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\frame@n}
% Nothing around slide contents.
%    \begin{macrocode}
\newcommand*\frame@n{%
  \advance\fboxsep\fboxrule \fboxrule\z@
  \fbox{\usebox\slidebox}%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\frame@r}
% Rule above and below slide contents.
%    \begin{macrocode}
\newcommand*\frame@r{%
  \rule{\slidewidth}{\fboxrule}\\*[\fboxsep]%
  \usebox{\slidebox}\\*[\fboxsep]%
  \rule{\slidewidth}{\fboxrule}%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\frame@d}
% Double rules above and below slide contents.
%    \begin{macrocode}
\newcommand*\frame@d{%
  \rule{\slidewidth}{\fboxrule}\\*[\tw@\fboxrule]%
  \rule[\baselineskip]{\slidewidth}{\fboxrule}%
    \vspace{-\baselineskip}\\*[\fboxsep]%
  \usebox{\slidebox}\\*[\fboxsep]%
  \rule{\slidewidth}{\fboxrule}\\*[\tw@\fboxrule]%
  \rule[\baselineskip]{\slidewidth}{\fboxrule}%
    \vspace{-\baselineskip}%
  }
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Check Slide Height}
%
% \begin{macro}{\chk@slideheight}
% Here we define the macro that checks the height of slides and
% gives a warning when overfilling occurs. 
% Keep the changes to |\dimen@| local by grouping.
%
%    \begin{macrocode}
\newcommand*\chk@slideheight[1]{{%
  \dimen@\ht#1
  \advance\dimen@\dp#1
  \ifnum\dimen@>\slideheight
    \ClassWarning{slidenotes}{slide too high by \the\dimen@}%
  \fi}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Titles on Slides}
%
% \begin{macro}{\slidetitle}
% \begin{macro}{\slidesubtitle}
% Put centered title or subtitle on the slide.
% The first (and optional) argument controls the font setting.
% These titles are followed by a |\medskip|; whitespace before
% the title is the responsibility of the slidewriter.
% These titles are suppressed if their argument somehow
% turns out to be empty.
%
%    \begin{macrocode}
\newcommand*\slidetitle{\@slidetitle{\slidetitlefont}}
\newcommand*\slidesubtitle{\@slidetitle{\slidesubtitlefont}}
\newcommand*\@slidetitle[2]{%
    \@ifemptyarg{#2}{}%
        {\begin{center}#1#2\end{center}\vspace{\slidetitlesep}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Slideformat Dependent Typesetting}
%
% \begin{macro}{\iflandscapeslide}
% Here we define a flag to be used for the implementation
% of format dependent code selection.
% This flag is initialized to the current default orientation.
%
%    \begin{macrocode}
\newif\iflandscapeslide
\iflandscape\landscapeslidetrue\else\landscapeslidefalse\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\portraitonly}
% \begin{macro}{\landscapeonly}
% Material can be selected on the basis the slide's format,
% portrait or landscape orientation with respectively:\\
% |\landscapeonly{...}|\\
% |\portraitonly{...}|\\
% For example, where a list can be placed without any difficulty
% on a portrait slide, it may require the use of |multicols|
% in landscapeformat.
% If problems arise, e.g. with the fixing of catcodes, then use the
% basic construction
% |\iflandscapeslide .. \else ..\fi|
%
%    \begin{macrocode}
\newcommand\landscapeonly[1]{\iflandscapeslide#1\fi}
\newcommand\portraitonly[1]{\iflandscapeslide\else#1\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Cues in the Margin}
%
% \begin{macro}{\marginwidth}
% The length variable |\marginwidth| holds the margin space
% that will be reserved for short remarks.
%
%    \begin{macrocode}
\newlength\marginwidth
\setlength\marginwidth{3cm}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cue}
% Giving short remarks in the margin of the notes text.
% To be used for finding specific text parts with a glance.
%
%    \begin{macrocode}
\newcommand*\cue[2][\cuefont]{%
  \marginpar{\hspace*{-\marginwidth}%
  \parbox{\marginparwidth}{\raggedright\sloppy#1#2}}}
%    \end{macrocode}
% \end{macro}
%
% |\cue| cannot allow marginpar switching from left to
% right margin when typesetting twosided material; therefore
% force all marginpars into the same margin.
%
%    \begin{macrocode}
\@mparswitchfalse
%    \end{macrocode}
%
% \section{Style Features}
%
% \subsection{Redefine Chapter Code}
%
% In order to process the slide marking
% two macro's in the production of chapter heads are redefined.
% Also a new chapter starts a new page and the
% pagestyle for this page is set to \texttt{empty}.
%
%    \begin{macrocode}
\@ifundefined{c@chapter}{}{%
  \let\old@makechapterhead=\@makechapterhead
  \let\old@makeschapterhead=\@makeschapterhead
  \renewcommand*\@makechapterhead[1]{%
    \global\slidemarker={#1}\old@makechapterhead{#1}%
    \thispagestyle{empty}\newpage}%
  \renewcommand*\@makeschapterhead[1]{%
    \global\slidemarker={#1}\old@makeschapterhead{#1}%
    \thispagestyle{empty}\newpage}%
  }
%    \end{macrocode}
%
% \subsection{Pagestyle}
%
% Slides and minis want the \texttt{empty} style.
%
%    \begin{macrocode}
\ifnotes\else\pagestyle{empty}\fi
%    \end{macrocode}
%
% \subsection{Fonts}
%
% \begin{macro}{\headerfont}
% \begin{macro}{\slidefont}
% \begin{macro}{\notesfont}
% \begin{macro}{\footnotefont}
% \begin{macro}{\slidetitlefont}
% \begin{macro}{\slidesubtitlefont}
% \begin{macro}{\cuefont}
% Choose fonts for the various elements of slides and notes.
% Their names speak for themselves.
%
%    \begin{macrocode}
\newcommand*\headerfont{\rmfamily}
\newcommand*\slidefont{\sffamily}
\newcommand*\notesfont{\rmfamily}
\newcommand*\footnotefont{\sffamily\mdseries\upshape}
\newcommand*\slidetitlefont{\Large\bfseries\boldmath}
\newcommand*\slidesubtitlefont{\normalsize\bfseries\boldmath}
\newcommand*\cuefont{\sffamily\bfseries\boldmath}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Language Adjustments}
%
% \begin{macro}{\Collection}
% \begin{macro}{\Slidenumber}
% \begin{macro}{\Slide}
% We define some language specific verbs, such
% as |\Collection| and |\Slidenumber|.
% To be customized by redefinition in the configuration file.
%
%    \begin{macrocode}
\newcommand*\Collection{LECTURE NOTES}
\newcommand*\Slidenumber{\#}
\newcommand*\Slide{Slide}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Example of Adjustements in Configuration File}
%
% Example of a configuration file with dutch equivalents
% for language dependent items.
%
%    \begin{macrocode}
%</cls>
%<*cfg>
\renewcommand*\Collection{COLLEGE AANTEKENINGEN}
\renewcommand*\Slidenumber{Nr.}
\renewcommand*\Slide{Transparant}
%</cfg>
%<*cls>
%    \end{macrocode}
%
% \section{Directory Localization}
%
% \begin{macro}{\CurrentDirectory}
% \begin{macro}{\DirectorySeparator}
% We can determine from |\@currdir| which
% character separates directories in a path name. 
% E.g. in UNIX this is |/| from the string |./|, but
% in the MacOS the current directory and the separator are both |:|.
% Therefore we extract from |\@currdir| the last character 
% (of two at most).\\
% Make |\CurrentDirectory| a synonyme for |\@currdir|.
%
%    \begin{macrocode}
\let\CurrentDirectory=\@currdir
\def\DirectorySeparator#1#2`\^^M{\@ifemptyarg{#2}{#1}{#2}}
\edef\DirectorySeparator{%
	\expandafter\DirectorySeparator\CurrentDirectory`\^^M}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\LastChar}
% Another macro delivers the last character of a string.
%
%    \begin{macrocode}
\providecommand*{\LastChar}[1]{%
  \@ifemptyarg{#1}{}{\expandafter\@lastchar#1`\^^M}}
\def\@lastchar#1#2`\^^M{\@ifemptyarg{#2}{#1}{\@lastchar#2`\^^M}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DirectoryName}
% The next macro ensures that a path name ends correctly, when
% a filename is concatenated with it.
% If the directory separator character isn't the last character,
% it is added.
%
%    \begin{macrocode}
\providecommand*{\DirectoryName}[1]{\@ifemptyarg{#1}{}%
  {\if\LastChar{#1}\DirectorySeparator\relax#1\else
    #1\DirectorySeparator\fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Setfolder}
% Macro |\Setfolder| can be used to install a standard
% folder (directory) name.
% E.g. a name |\figuresfolder| can be defined as the
% standard place for figures.
% Supply as first argument to |\Setfolder| the macro name
% for the folder. e.g. |\figuresfolder| and as second
% parameter its location on disk.
% Below three of these folders (here initialized 
% with empty names) are defined in the example configuration file.
%    \begin{macrocode}
\newcommand*\Setfolder[2]{\edef#1{\DirectoryName{#2}}}
%</cls>
%<*cfg>
\Setfolder{\mainfolder}{}
\Setfolder{\commonfolder}{}
\Setfolder{\figuresfolder}{}
%</cfg>
%<*cls>
%    \end{macrocode}
% \end{macro}
%
% \section{Read Configuration File}
%
% Last, but not least, see if there is a configuration
% file \texttt{slidenotes.cfg} and read it for the final adjustments.
% In this file one can change things like the
% font selection, size of various length variables, etc.
%
%    \begin{macrocode}
\InputIfFileExists{slidenotes.cfg}{}{}
%    \end{macrocode}
%
% \section{Process the Orientation Options}
%
% Final settings take place afterwards, because the variables
% involved may have been changed value in the configuration file.
%
% \subsection{Page Orientation}
%
% In case of landscape orientation the height and width of the page
% need to be exchanged for slides + notes, for slides
% in the anti orientation also.
% For notes we always use a portrait paperformat with 
% both portrait and landscape oriented slides on it.
%
%    \begin{macrocode}
\ifnotes
  \iflandscape\@swapdimens\paperheight\paperwidth\@tempdima\fi
\else
  \ifanti\@swapdimens\paperheight\paperwidth\@tempdima\fi
\fi
%    \end{macrocode}
%
% \subsection{Slide Dimensions and Orientation}
%
% At this point height and width of the slides are known
% in their final sizes. For the proces of typesetting they
% have to be reduced by the magnification applied later on.
%
%    \begin{macrocode}
\divide\slidewidth by\slidemagnification
\multiply\slidewidth by\@m
\divide\slideheight by\slidemagnification
\multiply\slideheight by\@m
%    \end{macrocode}
%
% In case of landscape format the height and width of slides
% need to be exchanged, because they are defined in portrait format.
%
%    \begin{macrocode}
\iflandscape\@swapdimens\slideheight\slidewidth\@tempdima\fi
%    \end{macrocode}
%
% \section{Shutoff Titles if Necessary}
%
% \begin{macro}{\maketitle}
% Kill the title and the chapter pages for slide production, 
% but not when a collection is prepared.
% Also allow for the fact that |\chapter| effects
% a change to pagestyle \texttt{plain}.
%
%    \begin{macrocode}
\ifslides
  \renewcommand\maketitle{}
  \@ifundefined{c@chapter}{}{%
    \renewcommand*\@makechapterhead[1]{\global\slidemarker={#1}%
      \thispagestyle{empty}}%
    \renewcommand*\@makeschapterhead[1]{\global\slidemarker={#1}%
      \thispagestyle{empty}}%
  }
\fi
%    \end{macrocode}
% \end{macro}
%
% Disable typesetting of the table of contents unless notes are
% in production.
%
%    \begin{macrocode}
\ifnotes\else\AtBeginDocument{\let\tableofcontents=\relax}\fi
%    \end{macrocode}
%
% \section{Page Dimensions}
%
% Here we do some calculations on sizes and set the variables
% to their proper values.
%
% \subsection{Fullsize Slides}
%
% First we typeset with an enlarged magnification.
%
%    \begin{macrocode}
\ifslides
  \mag\slidemagnification\relax
%    \end{macrocode}
%
% Horizontal dimensions:
%
%    \begin{macrocode}
  \setlength\hoffset{-1in}
    \divide\hoffset by\slidemagnification
    \multiply\hoffset by\@m
  \setlength\textwidth{\paperwidth}
    \divide\textwidth by\slidemagnification
    \multiply\textwidth by\@m
  \setlength\oddsidemargin{0pt}
  \setlength\evensidemargin{0pt}
%    \end{macrocode}
%
% Vertical dimensions:
%
%    \begin{macrocode}
  \setlength\voffset{-1in}
    \divide\voffset by\slidemagnification
    \multiply\voffset by\@m
  \setlength\headheight{0pt}
  \setlength\headsep{0pt}
  \setlength\textheight{\paperheight}
    \addtolength\textheight{-2\topmargin}
    \divide\textheight by\slidemagnification
    \multiply\textheight by\@m
\fi
%    \end{macrocode}
%
% \subsection{Collection of Slides}
%
%    \begin{macrocode}
\ifminis
  \setlength\headheight{0pt}
  \setlength\headsep{0pt}
  \setlength\footskip{0pt}
  \setbox\@tempboxa\vbox{\hbox{\slidefont\small\strut}\smallskip\null}
  \@tempdima=2\slidewidth
  \ifmixed
    \advance\@tempdima by 2\ht\@tempboxa
  \else
    \advance\@tempdima by 8mm
  \fi
  \ifdim\@tempdima>\textwidth \setlength\textwidth{\@tempdima}\fi
  \@tempdimb=2\slideheight
    \advance\@tempdimb by 2\ht\@tempboxa
  \ifdim\@tempdimb>\textheight
    \setlength\textheight{\@tempdimb}
    \@tempdimb\paperheight
    \advance\@tempdimb-\textheight
    \addtolength\topmargin{-\@tempdimb}
  \fi
  \setlength\oddsidemargin{0pt}
  \setlength\evensidemargin{0pt}
\fi
%    \end{macrocode}
%
% \subsection{Slides plus Notes}
%
% Change margin settings and enlarge |\marginparwidth|
% by the extra margin.
%
%    \begin{macrocode}
\ifnotes
  \setlength\marginparsep{5mm}
  \addtolength\marginparwidth{\marginwidth}
\fi
%    \end{macrocode}
%
% Initialize the font.
%
%    \begin{macrocode}
\notesfont
%</cls>
%    \end{macrocode}
%
% \section{Oval Macro's}
%
% Macro to translate dimensions\\ |#1{dimen}| or 
% |#1(number)| $\rightarrow$
% |#1{number\unitlength}|
%
%    \begin{macrocode}
%<*obox>
\ProvidesClass{obox}[1995/09/04 vs 1.2  Oval box change]
\def\@pickonedim#1{\@ifnextchar(%)
    {\@@pickonedim{#1}}{#1}}
\def\@@pickonedim#1(#2){#1{#2\unitlength}}
%    \end{macrocode}
%
% Redefinition of oval from the picture environment to\\
% |\oval[position](width,height)[optional lrtb=parts]|\\
% position parameter determis how oval will be placed:\\
% |o| midpoint (default as in LaTeX picture environment)\\
% |t| top of oval at baseline\\
% |b| bottom of oval at baseline\\
% |c| halfheight of oval at baseline\\
% |n| neutral placement
%
%    \begin{macrocode}
\gdef\oval{\@ifnextchar[%]
    {\@oval}{\@oval[o]}}
\gdef\@oval[#1](#2,#3){\@ifnextchar[%]
    {\@@oval[#1](#2,#3)}{\@@oval[#1](#2,#3)[]}}
\gdef\@@oval[#1](#2,#3)[#4]{\begingroup\boxmaxdepth \maxdimen
  \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue
  \@tfor\reserved@a :=#4\do{\csname @ov\reserved@a false\endcsname}%
  \@ovxx #2\unitlength \@ovyy #3\unitlength
  \@tempdimb \ifdim\the@ovalradius=\z@
    \ifdim \@ovyy >\@ovxx \@ovxx \else \@ovyy \fi
    \else \the@ovalradius \fi
  \advance \@tempdimb -\tw@\p@
  \@getcirc \@tempdimb
  \@ovro \ht\@tempboxa \@ovri \dp\@tempboxa
  \@ovdx\@ovxx \advance\@ovdx -\@tempdima \divide\@ovdx \tw@
  \@ovdy\@ovyy \advance\@ovdy -\@tempdima \divide\@ovdy \tw@
  \@circlefnt \setbox\@tempboxa
  \hbox{\if@ovr \@ovvert32\kern -\@tempdima \fi
  \if@ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi
  \if@ovt \@ovhorz \kern -\@ovxx \fi
  \if@ovb \raise \@ovyy \@ovhorz \fi}%
  \advance\@ovdx\@ovro \advance\@ovdy\@ovro 
  \if#1t\@ovdx\z@\@ovdy\tw@\@ovdy\fi
  \if#1b\@ovdx\z@\@ovdy\z@\fi
  \if#1c\@ovdx\z@\fi
  \if#1n\@ovdx\z@\@ovdy\dp\@tempboxa\fi
  \ht\@tempboxa\z@ \dp\@tempboxa\z@
  \@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}%
  \endgroup}
%    \end{macrocode}
%
% Oval analogon of |\fbox| is added:\\
% |\obox[optional ovalradius(length)][linethickness-cmd]{box-contents}|
%
%    \begin{macrocode}
\def\obox{\@ifnextchar[%]
    {\@obox}{\@@obox[][]}}
\def\@obox[#1]{\@ifnextchar[%]
    {\@@obox[#1]}{\@@obox[#1][]}}
\def\@@obox[#1][#2]#3{%
  \begingroup
    \@ifemptyarg{#1}{}{\ovalradius{#1}}%
    \setbox\z@\hbox{\advance\fboxsep\@wholewidth \fboxrule\z@ \fbox{#3}}%
    \dimen@\ht\z@ \advance\dimen@\dp\z@ #2\let\unitlength\@empty
    \leavevmode\oval[n](\wd\z@,\dimen@)\box\z@
  \endgroup}
\def\ovalradius{\@pickonedim\@ovalradius}
\def\@ovalradius#1{\@tempdima#1\relax
    \edef\the@ovalradius{\number\@tempdima sp}\ignorespaces}
\def\ovalfraction#1{%
    \edef\the@ovalradius{#1\noexpand\@tempdimb}\ignorespaces}
\ovalradius{0pt}                % initialisation
%</obox>
%    \end{macrocode}
% \Finale
%
