% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \GetFileInfo{kulstijl.drv}
% \title{K.U.Leuven specific Document Classes\\
%    version \fileversion}
% \author{Luc Van Eycken\\
%   \texttt{Luc.VanEycken@esat.kuleuven.be}}
% \date{\filedate}
% \maketitle
%
% \begin{abstract}
%    This file \file{kulstijl.dtx} contains the document classes to produce
%    documents according to the guidelines of the K.U.Leuven, also know as
%    the ``huisstijl''\footnote{Katholieke Universiteit Leuven,
%      ``\textit{Huisstijl handleiding}''}.
%    Letters (class \Lopt{kulbrief}), faxes (class \Lopt{kulfax}), memos
%    (class \Lopt{kulmemo}), reports (class \Lopt{kulverslag}), and
%    (business) cards (class \Lopt{kulkaart}) are provided.
% \end{abstract}
%
% \newif\ifmulticols
% \IfFileExists{multicol.sty}{\multicolstrue}{}
%
% \setcounter{tocdepth}{2}
% \ifmulticols
%   \addtocontents{toc}{\protect\begin{multicols}{2}}
% \fi
% \tableofcontents
%
% ^^A Since `|' is used a lot and `"' not, we use " instead of | as short verb
% \DeleteShortVerb\|
% \MakeShortVerb\"
%
% \iffalse ^^A Meta-comment: no identification/driver documentation is printed
% \section{Identification of the \protect\Lopt{kulstijl} files}
%    The document classes can only be used with \LaTeXe, dated December~1
%    1996 or later, because I didn't test it on earlier versions.
%    \begin{macrocode}
%<*driver|class>
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
%</driver|class>
%    \end{macrocode}
%    Provide the document class or file identification (all files use the
%    same date and version number):
%    \begin{macrocode}
%<brief>\ProvidesClass{kulbrief}%
%<fax>\ProvidesClass{kulfax}%
%<kaart>\ProvidesClass{kulkaart}%
%<memo>\ProvidesClass{kulmemo}%
%<verslag>\ProvidesClass{kulverslag}%
%<*driver>
\ProvidesFile{kulstijl.drv}%
%</driver>
%<*driver|class>
  [2005/05/31 v1.5
%</driver|class>
%<brief>    K.U.Leuven letter document class]
%<fax>    K.U.Leuven fax document class]
%<kaart>    K.U.Leuven card document class]
%<memo>    K.U.Leuven memo document class]
%<verslag>    K.U.Leuven report document class]
%<*driver>
    kulstijl documentation]
%</driver>
%    \end{macrocode}
%
%
% \section{The documentation driver}
%    Use the standard \LaTeX\ documentation document class, by default on
%    A4 paper. You can always override this option in your local
%    \file{ltxdoc.cfg} file.
%    \begin{macrocode}
%<*driver>
\documentclass[a4paper]{ltxdoc}
%    \end{macrocode}
%    Some commonly used abbreviations:
%    \begin{macrocode}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\newcommand*\pstyle[1]{\textsl{#1}}
%    \end{macrocode}
%    By default, an index is printed, but the standard \TeX\ and \LaTeX\
%    commands are not included. The index refers to the line number for
%    code lines.
%    \begin{macrocode}
\CodelineIndex
\EnableCrossrefs
%    \end{macrocode}
%    By default, update information is also collected.
%    \begin{macrocode}
\RecordChanges
%    \end{macrocode}
%    By default, only the description is printed. If you also want the
%    implementation, put "\AtBeginDocument{\AlsoImplementation}" in your
%    \file{ltxdoc.cfg} file.
%    \begin{macrocode}
\OnlyDescription
%    \end{macrocode}
%    First of all, don't index internal \TeX\ commands.
%    They will not change in future versions (or it is not \TeX).
% META-COMMENT: to balance the else and fi, add an extra \iffalse
%    \begin{macrocode}
\DoNotIndex{\advance,\baselineskip,\begingroup,\bgroup,\box,\boxmaxdepth,%
  \copy,\cr,\csname,\day,\def,\divide,\dp,\edef,\egroup,\else,\endcsname,%
  \endgroup,\escapechar,\everycr,\everypar,\expandafter,\fi,\gdef,\global,%
  \hbox,\hfil,\hfill,\hfilneg,\hrule,\hsize,\hskip,\hss,\ht,\if,\ifcase,%
  \ifdim,\ifhbox,\ifhmode,\ifinner,\ifnum,\ifvbox,\ifvmode,\ifx,%
  \ignorespaces,\immediate,\interlinepenalty,\language,\lastbox,\lastskip,%
  \leftskip,\let,\lineskip,\lineskiplimit,\long,\meaning,\month,\multiply,%
  \noalign,\noexpand,\noindent,\number,\omit,\or,\pagetotal,\par,\parfillskip,%
  \parindent,\parskip,\prevdepth,\relax,\rightskip,\setbox,\spacefactor,%
  \string,\tabskip,\the,\topskip,\unhbox,\unhcopy,\unskip,\unvbox,\vadjust,%
  \valign,\vbox,\vfil,\vrule,\vskip,\vss,\vtop,\wd,\write,\year}
%    \end{macrocode}
% META-COMMENTS: to balance the if, ifcase, ifdim, ifhbox, ifhmode,
%                ifinner, ifnum, ifvbox, ifvmode, ifx,
%                add an extra \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
%    Also don't index plain \TeX\ commands, which are unlikely to change.
%    \begin{macrocode}
\DoNotIndex{\,,\@m,\@ne,\allowbreak,\bigskipamount,\break,\count@,\dimen@,%
  \dimen@i,\dimen@ii,\ialign,\leavevmode,\llap,\maxdimen,\newbox,\newcount,%
  \newdimen,\newif,\newtoks,\nobreak,\nointerlineskip,\m@ne,\p@,\rlap,\quad,%
  \space,\strut,\strutbox,\tw@,\voidb@x,\z@,\z@skip}
%    \end{macrocode}
%    Don't index documented \LaTeX\ commands either, unless they are redefined.
%    \begin{macrocode}
\DoNotIndex{\@,\\,\addtocounter,\addtolength,\addvspace,\begin,\bfdefault,%
  \bfseries,\centering,\clearpage,\color,\colorbox,\documentclass,\emph,\end,%
  \endminipage,\enlargethispage,\familydefault,\fontfamily,\fontseries,%
  \fontshape,\fontsize,\index,\input,\itshape,\Large,\makeatletter,%
  \makeatother,\marginpar,\mathbf,\mathit,\mathrm,\mathsf,\mathtt,\mddefault,%
  \minipage,\newcommand,\newcounter,\newenvironment,\newline,\newpage,%
  \normalcolor,\normalfont,\normalsize,\linewidth,\pagestyle,\parbox,%
  \protect,\raggedleft,\raggedright,\raisebox,\renewcommand,%
  \renewenvironment,\rmfamily,\samepage,\selectfont,\seriesdefault,%
  \setcounter,\setlength,\settoheight,\settowidth,\scshape,\sfdefault,%
  \sffamily,\slshape,\subsubsection,\textbf,\textcolor,\textsf,\textsl,%
  \texttt,\thefootnote,\thepage,\thispagestyle,\ttfamily,\updefault,%
  \usefont,\usepackage,\value,\vspace}
%    \end{macrocode}
%    Don't index internal \LaTeX\ commands, we are only using the name of
%    and not their contents.
%    \begin{macrocode}
\DoNotIndex{\reserved@a,\reserved@b,\@nnil,\do}
%    \end{macrocode}
%    Don't index \LaTeX\ commands for package writers.
%    \begin{macrocode}
\DoNotIndex{\AtBeginDocument,\ClassError,\ClassInfo,\ClassWarning,%
  \ClassWarningNoLine,\CurrentOption,\DeclareOldFontCommand,%
  \DeclareOption,\ExecuteOptions,\IfFileExists,\InputIfFileExists,%
  \LoadClass,\MakeUppercase,\MessageBreak,\NeedsTeXFormat,%
  \PassOptionsToClass,\ProcessOptions,\ProvidesClass,\ProvidesFile,%
  \RequirePackage}
%    \end{macrocode}
%    Don't index the commands defined by the \Lopt{ifthen} or the
%    \Lopt{babel} package.
%    \begin{macrocode}
\DoNotIndex{\addto,\captionsamerican,\captionsdutch,\captionsenglish,%
  \equal,\iflanguage,\ifthenelse}
%    \end{macrocode}
%    Don't index the commands defined by the \Lopt{ltxdoc} document class
%    (including the \Lopt{doc} package). They probably won't change and
%    anyway, they are only used in the driver.
%    \begin{macrocode}
\DoNotIndex{\CodelineIndex,\DocInput,\DoNotIndex,\EnableCrossrefs,%
  \MacroFont,\MacroIndent,\PrintDescribeEnv,\PrintEnvName,\PrintIndex,%
  \theCodelineNo,\actualchar,\bslash,\encapchar,\levelchar,\special@index}
%    \end{macrocode}
%    Don't index internal \LaTeX\ commands, or internal commands of the
%    classes \Lopt{article} and \Lopt{letter}. Notice that it is dangerous
%    to depend on their meaning, since a \LaTeX\ upgrade may change this
%    without notice.
%    \begin{macrocode}
\DoNotIndex{\@arrayparboxrestore,\@auxout,\@date,\@dblarg,%
  \@defaultunits,\@empty,\@flushglue,\@fnsymbol,\@gobble,\@gobbletwo,%
  \@height,\@ifdefinable,\@ifnextchar,\@ifstar,\@ifundefined,%
  \@makefnmark,\@makefntext,\@maketitle,\@minus,\@mkboth,\@mlabel,%
  \@parboxrestore,\@plus,\@tempboxa,\@tempcnta,\@tempcntb,\@tempdima,%
  \@tempdimb,\@tempdimc,\@tempskipa,\@tempskipb,\@tempswafalse,%
  \@tempswatrue,\@textsuperscript,\@thefnmark,\@topnum,%
  \@unused,\@whilenum,\@width,\c@footnote,\c@page,%
  \f@encoding,\f@family,\f@series,\f@shape,\if@filesw,\if@tempswa,%
  \protected@edef,\strip@prefix,\try@load@fontshape}
%    \end{macrocode}
% META-COMMENTS: to balance the if@filesw, if@tempswa add an extra \fi\fi
%
%    I have written more than hundred lines of code (oh dear, even more
%    than thousand), so we increase the room for the line number.
%    \begin{macrocode}
\setcounter{CodelineNo}{999}
\settowidth\MacroIndent{\MacroFont\theCodelineNo\ }
\setcounter{CodelineNo}{0}
%    \end{macrocode}
%    In addition to the "\DescribeMacro" "\DescribeEnv" commands, we want
%    some commands to describe (and index) counters and options. The same
%    goes for "\Define...".
%    \begin{macrocode}
\newcommand*\DefineCounter[1]{%
  \index{#1\actualchar\texttt{#1} (counter)\levelchar
    \string\seealso{\texttt{\protect\bslash c@#1}}\encapchar x}%
  \ignorespaces}
\newcommand*\seealso[4]{\emph{see also}
  \hfil\allowbreak\hfilneg #1\hfil}
\makeatletter
\newcommand*\DefineOption[1]{\leavevmode
  \marginpar{\raggedleft \PrintEnvName{\Lopt{#1}}}%
  \special@index{#1\actualchar\string\Lopt{#1} (option)\encapchar main}%
  \index{options:\levelchar\Lopt{#1}\encapchar main}%
  \ignorespaces}
\makeatother
\newcommand*\DescribeCounter[1]{\leavevmode
  \marginpar{\raggedleft \PrintDescribeEnv{\texttt{#1}}}%
  \index{#1\actualchar\texttt{#1} (counter)\encapchar usage}%
  \index{counters:\levelchar\texttt{#1}\encapchar usage}%
  \ignorespaces}
\newcommand*\DescribeOption[1]{%
  \index{#1\actualchar\string\Lopt{#1} (option)\encapchar usage}%
  \index{options:\levelchar\Lopt{#1}\encapchar usage}%
  \ignorespaces}
%    \end{macrocode}
%    Finally, we define some commands to print control sequences as command
%    arguments.
%    \begin{macrocode}
\newcommand\oldmeta{}\let\oldmeta\meta
\newcommand\metacs[1]{\oldmeta{\cs{#1}}}
\newcommand\margcs[1]{{\let\meta\metacs \marg{#1}}}
\newcommand\oargcs[1]{{\let\meta\metacs \oarg{#1}}}
%    \end{macrocode}
%    Let's print the documentation and the index without overfull boxes.
%    \begin{macrocode}
\begin{document}
\sloppy
\DocInput{kulstijl.dtx}
\PrintChanges
\PrintIndex
\end{document}
%</driver>
%    \end{macrocode}
% \fi ^^A End of the meta-comment
%
%
% \section{User interface}
%    Five K.U.Leuven document classes are described in this documentation.
%    Each class handles a specific type of documents, according to the
%    official guidelines of the K.U.Leuven. You have to use class
%    \Lopt{kulbrief} to generate letters, class \Lopt{kulfax} for faxes,
%    class \Lopt{kulmemo} for memos, class \Lopt{kulverslag} for K.U.Leuven
%    reports, and class \Lopt{kulkaart} for (business) cards.
%    When we are talking about any of these five classes, we shall refer to
%    it as a \Lopt{kulstijl} class.
%
%    Examples are described in a separate file \file{kulexamp.dtx}. At
%    installation time, this file will generate an example for each class;
%    e.g., the example for the class \Lopt{kulfax} can be found in file
%    \file{fax.tex}.
%
%    The classes are based on the standard \LaTeX\ document class
%    \Lopt{article}, except class \Lopt{kulbrief} which is based on class
%    \Lopt{letter}, so it inherits most of the aspects of these classes.
%    The document class options are described in section~\ref{sec:opt}.
%
%    Each user file, except for K.U.Leuven reports, can contain more than
%    one element, indicated by an environment; e.g., a file with the class
%    \Lopt{kulbrief} can contain several letters, each in his own "letter"
%    environment. In case of the class \Lopt{kulverslag}, the element
%    environment is the "document" environment. For each element we can
%    define three regions with a difference in processing:
%    \begin{enumerate}
%    \item \textsl{The document preamble}: everything from the start of the
%      file until the statement "\begin{document}". It includes the
%      contents of the configuration files (see section~\ref{sec:init}).
%
%      This area is used to load packages and for global initializations
%      common to all elements, such as the name and address of the sender.
%    \item \textsl{The element preamble}: everything after the document
%      preamble and before the start of the element environment, but not
%      inside a previous element environment, \emph{and} anything inside
%      the element environment from its start up to the first text.
%
%      This area is used for initializations local to this element, such as
%      references or data about the recipient. If the initialization is
%      done before the beginning of the element environment, it also
%      belongs to the element preambles of all following elements.
%
% \DescribeMacro{\starttext}
%      The element preamble can always be ended by the command
%      "\starttext". This is needed if some unusual \LaTeX\ command or a
%      plain \TeX\ command such as "\hbox" is used. Normally you should
%      only use the command "\starttext"  if \LaTeX\ gives an error about
%      ``"Illegal commands before the first text" \ldots'' or if you start
%      your text with "\noindent".
%    \item \textsl{The element text}: everything in an element environment
%      after the element preamble.
%
%      This area contains the actual text to typeset.
%    \end{enumerate}
%    These regions will later be referred to when commands that change
%    their way of working in some regions are described.
%
%    \begin{description}
%    \item[Note:]
%      All commands described here with a starred version or optional
%      arguments, or the commands based on them, are fragile commands which
%      must be "\protect"ed in a moving argument. Additional fragile
%      commands are: "\addpages", "\closing", "\expandargument",
%      "\foreachaddressee", "\linestack", "\marginfont", "\preprintfont",
%      "\printfrommargin", "\selectaddressee", "\starttext".
%
%      Apart from the moving arguments in existing commands, as described
%      in the \LaTeX{} manual, all text converted to upper case will be used
%      internally in moving arguments, so fragile commands must be
%      "\protect"ed there. The new command  "\expandargument" has also a
%      moving second argument, because it expands this argument.
%    \end{description}
%
% \subsection{Variables}
%    We shall often refer to variables in this text, so the concept is
%    explained here before describing the \Lopt{kulstijl} classes.
%    A variable \metacs{var} is actually a control sequence, holding
%    some data.
%    If you want to examine the contents of the variable, you can use the
%    command \metacs{var}. \\
% \DescribeMacro{\setvar}
%    To set a variable \metacs{var} you can use the command
%    "\setvar"\allowbreak\margcs{var}\allowbreak\marg{data}. This
%    command can be preceded by "\global" if you want to set a global
%    variable (regardless of the grouping).
%
% \DescribeMacro{\expandargument}
%    The command "\expandargument"\allowbreak \marg{command}\allowbreak
%    \marg{argument} expands the \meta{argument} of a \meta{command}
%    before executing ``\meta{command}\marg{argument}''. Because the
%    \meta{argument} is expanded, it is a moving argument.
%    You can use it to set a \metacs{var} to expanded \meta{data} by using
%    "\expandargument"\allowbreak "{\setvar"\margcs{var}"}"\allowbreak
%    \marg{data}.
%
% \DescribeMacro{\newvar}
%    A new variable \metacs{var} is defined with the command
%    "\newvar"\allowbreak\oargcs{varset}\allowbreak
%    \margcs{var}\allowbreak\oarg{data}. The first optional argument
%    \metacs{varset} gives a command, which is equivalent to
%    "\setvar"\margcs{var}. If this optional argument is absent, no such
%    command is defined. The second optional argument, which defaults to an
%    empty argument, gives the initial \meta{data} to store in the variable
%    \metacs{var}. The following statement defines the new variable
%    "\myvar", initializes it with ``"contents"'' and defines a new command
%    "\setmyvar"\marg{data} to set the variable to the \meta{data}:
%    \begin{verbatim}
%    \newvar[\setmyvar]{\myvar}[contents]
%\end{verbatim}
% \DescribeMacro{\renewvar}
%    The command "\renewvar" has the same syntax as "\newvar", but instead
%    of defining a new variable and eventually a new \metacs{varset}
%    command, it redefines existing ones.
%
% \DescribeMacro{\undefine}
%    You can undefine the variable \metacs{var} with the command
%    "\undefine"\margcs{var}. An undefined variable is the same as a new
%    variable, which has not yet been defined with a "\newvar" command.
%    This is not the same as a variable with nothing as contents (i.e,
%    \meta{data} is empty): see the description of "\newtopic" on
%    page~\pageref{newtopic} for the use of an undefined variable. It can
%    also be used to undefine commands, although you normally should never
%    feel the need for that.
%
%    Sometimes variables will be used to store lengths instead of length
%    registers. This has the advantage that they can refer to other
%    variables or dimensions, without being evaluated at the time of
%    definition. E.g., if it contains "\baselineskip" it refers to the
%    distance between two lines, not at the time of definition (usually in
%    the document preamble), but at the time of execution, which could be
%    inside a document part typeset with a larger or smaller font. However,
%    the disadvantage of using a variable \metacs{var} is that you can't
%    use "2"\metacs{var}, as would be possible with length registers. If
%    you want to do this, you'll have to use the \Lopt{calc} package.
%
%
% \subsection{Options of the \Lopt{kulstijl} classes}\label{sec:opt}
%    The \Lopt{kulstijl} classes are based on the standard \LaTeX\
%    document class \Lopt{letter} for the \Lopt{kulbrief} class or on the
%    standard \LaTeX\ document class \Lopt{article} for the other classes.
% \DescribeOption{titlepage}
% \DescribeOption{twocolumn}
% \DescribeOption{twoside}
%    This means they inherits the respective options, with the exception of
%    the options \Lopt{titlepage}, \Lopt{twocolumn}, and \Lopt{twoside},
%    because of the restrictions put on the layout by the K.U.Leuven
%    guidelines.
%    In addition some new options are defined.
%
%    The valid options for \Lopt{kulstijl} document classes are:
%    \begingroup
%      \renewcommand*\descriptionlabel[1]{\hspace\labelsep \Lopt{#1}}
%      \renewcommand*\|{\vrule\relax}
%      \begin{description}
%      \item[10pt \| 11pt \| 12pt]
% \DescribeOption{10pt}
% \DescribeOption{11pt}
% \DescribeOption{12pt}
%        Set the default type size of the document. The default is
%        \Lopt{12pt} for faxes and memos, and \Lopt{10pt} for the other
%        classes.
%      \item[a4paper \| a5paper \| b5paper \| letterpaper \| legalpaper \|
%            executivepaper]
% \DescribeOption{a4paper}
% \DescribeOption{a5paper}
% \DescribeOption{b5paper}
% \DescribeOption{letterpaper}
% \DescribeOption{legalpaper}
% \DescribeOption{executivepaper}
%        Format for the appropriate paper size. The default is \Lopt{a4paper}.
%        If you choose any paper size other than A4 paper, only the
%        dimensions of the body of the text will change, not the defined
%        distances from the edges of the paper. Therefore, the absolute
%        positioning is only correct for the default A4 paper size, so
%        preprinted forms can only be used with this paper size.
%      \item[landscape]
% \DescribeOption{landscape}
%        Format for landscape (sideways) printing.
%        This will definitely screw up the absolute positioning of items on
%        the page, except for cards.
%      \item[final \| draft]
% \DescribeOption{final}
% \DescribeOption{draft}
%        The option \Lopt{draft} marks overfull lines by black boxes, the
%        default option \Lopt{final} does not mark these lines.
%        (These options are not recognized by the \Lopt{kulkaart} class.)
%      \item[leqno]
% \DescribeOption{leqno}
%        Put formula numbers on the left side in "equation" and "eqnarray"
%        environments.
%        (This option is not recognized by the \Lopt{kulkaart} class.)
%      \item[fleqn]
% \DescribeOption{fleqn}
%        Left-align displayed formulas.
%        (This option is not recognized by the \Lopt{kulkaart} class.)
%      \item[noconfigfiles]
% \DescribeOption{noconfigfiles}
%        Switch off the loading of configuration files. This can be useful
%        if you want to send your document file to some other department,
%        where these configuration files will be different. To guarantee
%        that the outcome is the same, you have to include your
%        configuration files in the document preamble immediately after the
%        "\documentclass" statement (cf.\ the examples from
%        \file{kulexamp.dtx}).
%      \item[foldingmarks \| nofoldingmarks]
% \DescribeOption{foldingmarks}
% \DescribeOption{nofoldingmarks}
%        Normally cutting marks on cards or folding marks on letters are
%        only printed on the first page. The option \Lopt{foldingmarks}
%        puts these marks on all pages and the option \Lopt{nofoldingmarks}
%        removes them from all pages.
%        (These options are only recognized by the classes \Lopt{kulbrief}
%        and \Lopt{kulkaart}.)
%
% \DescribeMacro{\foldingmarkscondition}
%        To allow even further control, the printing of the marks is
%        controlled by the variable "\foldingmarkscondition". It contains a
%        \meta{test} condition for an
%        "\ifthenelse"\marg{test}\marg{print marks}"{}" command (from
%        the standard package \Lopt{ifthen}). For instants, you can set
%        marks on every even page with
%        \begin{verbatim}
%    \setvar{\foldingmarkscondition}{\not \isodd{\value{page}}}
%\end{verbatim}
%      \item[centerpage]
% \DescribeOption{centerpage}
%        For letters, it centers the body of the first page vertically,
%        instead of flushing it to the top. For cards, all pages are
%        centered horizontally as well as vertically.
%        (This option is only recognized by the classes \Lopt{kulbrief}
%        and \Lopt{kulkaart}.)
%      \item[preprintedform]
% \DescribeOption{preprintedform}
%        Indicate that preprinted letter forms will be used. It removes any
%        text that is already preprinted from the \LaTeX\ output (i.e., the
%        address, the logo, any standard marginal data and the footer). For
%        a correct positioning, use A4 paper!
%        (This option is only recognized by the \Lopt{kulbrief} class.)
%
%        To check in your configuration file for preprinted forms, you
%        can examine the internal boolean "kul@addpre" if the \Lopt{kulbrief}
%        class is used. The switch is true if no preprinted form is used.
%      \end{description}
%    \endgroup
%
%    Since all classes preload the standard \LaTeX\ package \Lopt{ifthen},
%    you don't have to do this in your document file. In addition, the
%    package \Lopt{kulfonts} is loaded to provide the Sedes logo, unless
%    you are using preprinted letter forms.
%
% \subsection{Fonts}
%    The guidelines require Futura or for PC~users Univers or Helvetica.
%    Unfortunately the designer of the \Lopt{kulstijl} classes has no
%    guarantee that your installation has these fonts available for \LaTeX.
%    So by default the \Lopt{kulstijl} classes use the Computer Modern
%    fonts, but I must agree that this doesn't have a visually pleasing
%    look, e.g., compared to Helvetica. If you have to use it, I recommend
%    to use the \Lopt{11pt} option instead of the default \Lopt{10pt}
%    option.
%    According to the guidelines, the document class also selects a sans
%    serif family for the main body of the text, except for reports which
%    use the standard serif family. If the user doesn't like it as main
%    font, (s)he can redefine it again in the document preamble, e.g., to
%    the standard serif family: 
%    \begin{verbatim}
%    \renewcommand{\familydefault}{\rmdefault}
%\end{verbatim}
%
%    If you want to use fonts other than Computer Modern, you have to make
%    sure that they are installed in your \TeX\ system. This means that
%    they are either available as bitmap fonts at the correct sizes or
%    available to your printer drivers as an installed or down-loadable
%    font. Furthermore you need the appropriate font descriptions for
%    \LaTeX. Font descriptions for Helvetica and Univers can be found in
%    the PSNFSS package collection on the CTAN archives\footnote{To locate
%      the nearest CTAN archive do ``\texttt{finger ctan@ftp.dante.de}''.}.
%    Since all Postscript printers have a built-in Helvetica font, you can
%    switch to Helvetica as sans serif font if you use a Postscript
%    printer, by putting the following in your document preamble:
%    \begin{verbatim}
%    \usepackage{helvet}
%\end{verbatim}
%
% \DescribeMacro{\preprintfont}
%    A second font is used for printing the header and footer information.
%    By default, it is the sans serif version of the main font with an
%    upright shape and the prescribed font size.
%    You can access the font with the macro "\preprintfont".
% \DescribeMacro{\preprintfontdefaults}
%    If you want to change the characteristics of this font, you can
%    redefine the hook "\preprintfontdefaults" with "\renewcommand". In
%    this hook, you can use the commands "\fontencoding", "\fontfamily",
%    "\fontseries", "\fontshape" or  "\fontsize" to change the
%    characteristics. Changing the series selected by "\textbf" can be done
%    in "\preprintfontdefaults" by changing the hook "\bfdefault". The
%    following selects for the header and footer the Futura family ("pfu")
%    with a normal series of semi-light ("sl") and a bold series of
%    semi-bold ("sb"):
%    \begin{verbatim}
%    \renewcommand{\preprintfontdefaults}{%
%      \fontfamily{pfu}\fontseries{sl}%
%      \renewcommand{\bfdefault}{sb}}
%\end{verbatim}
%
% \DescribeMacro{\marginfont}
%    A third font is used for printing information in the margin.
%    You can access this font with the macro "\marginfont". If you want to
%    change it, you have to redefine the macro.
%    By default it is equal to "\preprintfont", except for faxes and memos,
%    where it defaults to the main upright bold sans serif font.
%    
% \subsection{Page Layout}
%    The page layout is conform to the K.U.Leuven guidelines if A4 paper is
%    used in portrait orientation.
%
%    The first page of an element contains a header with the address of the
%    department, the Sedes logo and eventually a title, a departemental
%    logo, a footer with the coordinates of the sender, and some first page
%    top information. The page style \pstyle{firstpage} is used
%    automatically on this first page. The first page top, which is the
%    text at the top of the first page main text area, is printed at the
%    end of the element preamble, so commands can influence the contents
%    and appearance of the first page top, as well as of the first page
%    header and footer.
%
% \DescribeMacro{\deptlogo}
% \changes{v1.3}{2003/02/26}{New variable \cs{deptlogo}}
%    At the upper left of the first page, a departemental logo (as
%    contained in the variable "\deptlogo") can be inserted. If you want to
%    use graphics here, I strongly recommend the use of the \Lopt{graphics}
%    package.
%
% \DescribeMacro{\footlogo}
% \changes{v1.1}{2000/03/14}{New variable \cs{footlogo}}
% \changes{v1.4}{2005/05/12}{\cs{footlogo} now defaults to \cs{logoAssociatie}}
%    At the lower right of the first page, a logo (as contained in the
%    variable "\footlogo") can be inserted. By default, the logo for the
%    ``Associatie K.U.Leuven'' is used, according to the guidelines. It
%    used to be the anniversary logo~575 until the end of the year~2001.\\
%    If this logo is rather large, you may want to adjust the length
%    "\firstfootsep" (cf.\ page~\pageref{firstfootsep}) or use the standard
%    \LaTeX{} command "\enlargethispage" to reduce the bottom white space
%    on the first page.
%
%    On continuation pages, the redefined page style \pstyle{plain} is used.
%    For letters and reports, it puts the page number flushed right in the
%    footer.
% \DescribeMacro{\headerlines}
%    The header contains the Sedes logo on the right side and on the left
%    side the page number and the macro "\headerlines". By default, this
%    macro prints the reference topics and the date as set by "\headdate"
%    (cf.\ page~\pageref{headdate}). For preprinted letters, changing
%    the macro will have no effect.
%
% \subsubsection{Title in the first page header}
% \DescribeMacro{\firstheadtitle}
% \DescribeMacro{\firstheadtitledata}
%    For faxes, memos and reports, a title describing the element is put in
%    the first page header. The command "\firstheadtitle"\marg{title}
%    declares this \meta{title} and stores it in the variable
%    "\firstheadtitledata"\footnote{For this variable, you are \emph{not}
%      allowed to use the \texttt{\string\setvar} command to set it!}.
% \DescribeMacro{\firstheadtitlefax}
% \DescribeMacro{\firstheadtitlememo}
% \DescribeMacro{\firstheadtitlereport}
%    The default contents of this variable is, depending on the element
%    name, either "\firstheadtitlefax" (with the default contents
%    ``\texttt{VOORBLAD FAX}''), "\firstheadtitlememo" (with the default
%    contents ``\texttt{MEMO}'') or "\firstheadtitlereport" (with the
%    default contents ``\texttt{VERSLAG}'').
%
%    The guidelines require that this title is printed white-on-black, but
%    the general \LaTeX\ installation doesn't have these possibilities,
%    because it depends on the possibilities of the printer. If you are
%    using a printer capable of white-on-black printing and supported by
%    the standard \LaTeX\ package \Lopt{color}, you can indicate this by
%    invoking the \Lopt{color} package in the document preamble. For
%    instants, if you are using a Postscript printer and the \file{dvips}
%    program for printing the \file{dvi} file, you can put in your document
%    preamble
%    \begin{verbatim}
%    \usepackage[dvips]{color}
%\end{verbatim}
% \DescribeMacro{\printfirstheadtitle}
%    If the \Lopt{color} package is loaded and the colors "black" and
%    "white" are defined, a box around the text, generated by the command
%    "\printfirstheadtitle", is printed with the background color set to
%    black and the foreground color set to white.
% \DescribeMacro{\firstheadtitleboxsep}
%    The distance between the text and the border is set to the contents of
%    the variable "\firstheadtitleboxsep". By default it holds ``"2mm"'',
%    but if you want it to be the same as other box separations, you can
%    set it to "\fboxsep". \\
%    If the \Lopt{color} package is not loaded or the colors "black" and
%    "white" are not defined, the class will try to use the predefined
%    white-on-black text strings in font "kulfont1". It relies on the
%    \Lopt{kulfonts} package for this. If the text string is available, it
%    is used, regardless of the actual formatting specified in
%    "\printfirstheadtitle". \\
%    If this doesn't work either, the \meta{title} is simply printed using
%    the command "\printfirstheadtitle". In its original definition, this
%    command will print the \meta{title} in a bold large font.
%
% \subsubsection{Sender coordinates}\label{sec:senderinfo}
%    The first page header and footer contain most of the sender
%    coordinates. This information is stored in several variables, so the
%    user can use it also in the element text. These variables are
%    initialized empty, unless specified otherwise below. Normally, the
%    information is declared in your personal configuration file or in the
%    document preamble. If you want it to be valid only for one element,
%    you can put it in the preamble of that element.
%
% \DescribeMacro{\name}
% \DescribeMacro{\fromname}
%    The command "\name"\marg{name} declares the \meta{name} to be
%    used for the first page footer, storing it in the variable "\fromname". 
%    The data is typeset in bold upper case, which makes it a moving
%    argument.
%
% \DescribeMacro{\profession}
% \DescribeMacro{\fromprofession}
% \DescribeMacro{\fromprofessionlong}
%    The command "\profession"\oarg{long}\marg{short} declares the
%    profession of the sender. The \meta{short} version is stored in the
%    variable "\fromprofession" and is appended to the name in the first
%    page footer. The \meta{long} version, which defaults to the
%    \meta{short} one, is stored in the variable "\fromprofessionlong" and
%    is used on business cards.
%
% \DescribeMacro{\signature}
% \DescribeMacro{\fromsig}
%    The command "\signature"\marg{name} declares the name and possibly
%    other data to be put under the (first) signature. The \meta{name} is
%    stored in the variable "\fromsig", which defaults to "\fromname". The
%    \meta{name} can contain multiple lines. \\
%    The starred version "\signature*" of the command declares the
%    information to be put under an additional signature and stores the
%    information in inaccessible internal variables. The starred command
%    can be used more than once to declare more additional signatures,
%    which are put to the right and below the previous (additional)
%    signature(s). Using the non-starred version deletes all additional
%    signatures declared up to that point for that element. \\
%    Two layout parameters are defined for defining the layout of the
%    signature space.
% \DescribeCounter{sigsperline}
%    The counter "sigsperline" holds the number of signatures that can be
%    put on one line. If it is smaller than or equal to zero (the default
%    value), the number of signatures on one line is the total number of
%    signatures minus $\left|\mathtt{sigsperline}\right|$. \\
% \DescribeMacro{\signaturespace}
%    The variable "\signaturespace" holds the vertical distance (a rubber
%    length), provided for the signature. By default it holds ``"1in"''
%    (1\,inch).
%
% \DescribeMacro{\address}
% \DescribeMacro{\fromaddress}
%    The command "\address"\marg{address} declares the full \meta{address}
%    to be used for the left header on the first page, storing it in the
%    variable "\fromaddress". Since this \meta{address} is usually the same
%    for the whole department, it is normally defined in the system-wide
%    configuration file. Because the address is required in the first page
%    header, an error will be given if it isn't defined.\\
%    The \meta{address} is typeset in upper case, which makes it a moving
%    argument, and can contain multiple lines. If you want other fonts for
%    some parts, you have to include font changing commands (e.g.,
%    "\textbf").
%
% \DescribeMacro{\location}
% \DescribeMacro{\fromlocation}
%    The command "\location"\marg{location} declares the \meta{location}
%    you are sending the element from, storing it in the variable
%    "\fromlocation". The \meta{location} normally only contains a single
%    word and it is initialized to ``\texttt{Leuven}''. The \meta{location}
%    is not used in this implementation, except for the classes
%    \Lopt{kulbrief} and \Lopt{kulverslag}, where it initializes
%    "\headdatename" (cf.\ page~\pageref{headdate}).
%
% \DescribeMacro{\telephonenumber}
% \DescribeMacro{\telephonenum}
%    The command "\telephonenumber"\marg{telephone number} declares the
%    \meta{telephone number}, put in the footer of the first page, storing
%    it in the variable "\telephonenum". The \meta{telephone number}
%    defaults to the general telephone number of the K.U.Leuven.
%
% \DescribeMacro{\faxnumber}
% \DescribeMacro{\faxnum}
%    The command "\faxnumber"\marg{fax number} declares the \meta{fax
%    number}, put in the footer of the first page, storing it in the
%    variable "\faxnum".
%
% \DescribeMacro{\email}
% \DescribeMacro{\fromemail}
%    The command "\email"\marg{e-mail address} declares the \meta{e-mail
%    address}, put in the footer of the first page, storing it in the
%    variable "\fromemail".
%
% \DescribeMacro{\www}
% \DescribeMacro{\fromwww}
% \changes{v1.2}{2000/03/14}{New command \cs{www} to store the WWW address}
%    The command "\www"\marg{http address} declares the \meta{http
%    address}, put in the footer of the first page, storing it in the
%    variable "\fromwww". In the \meta{http address}, the special \LaTeX{}
%    character `"~"' becomes an ordinary character, so it requires no
%    special action.
%
% \subsubsection{Addressee information}\label{sec:addresseeinfo}
%    The first page top text of letters, faxes and memos contains some
%    information about the addressee(s).
%    The addressee information is usually given in one or more arguments to
%    the element environment (see the specific element environment
%    descriptions for more details). If you have more than one addressee
%    (e.g., one letter with several mailing labels, or a fax sent to
%    several people), you can concatenate the addressee information with
%    the character `"&"'.
%
% \DescribeMacro{\sendto}
%    You can also use the generic command
%    \begin{itemize}\item[] 
%      "\sendto"\marg{address}\marg{tel}\marg{fax}\marg{email}\oarg{other}\\
%      \quad ["&"\marg{address}\marg{tel}\marg{fax}\marg{email}\oarg{other}]*
%    \end{itemize}
%    where the ``[$x$]*'' means zero or more occurrences of $x$.
%    Using this command, it is easy to construct shorthand macros for
%    entire mailing lists of addressees (see file \file{kulexamp.dtx} for
%    an example). \\
%    Each group of five arguments gives information about one addressee.
%    The first argument \meta{address} contains the full address of the
%    recipient: the first line is considered as his/hers name and the other
%    lines give the address. If you want a multi-line name, enclose the
%    entire name in a group. The next three arguments give the telephone
%    number \meta{tel}, the fax number \meta{fax} and the e-mail address
%    \meta{email}. The final optional argument \meta{other} can be used for
%    any other information, such as ``\texttt{Urgent}'' or
%    ``\texttt{Huispost}''.
%
% \DescribeMacro{\aftersendto}
%    After each "\sendto" or related command (including the beginning of
%    the element environment), the hook command "\aftersendto" is executed.
%    By default it is used to select the first addressee, but it can
%    also be used to set switches depending on the address information.
% \DescribeMacro{\selectaddressee}
%    Selecting addressee number \meta{listnum} is done with the command
%    "\selectaddressee"\marg{listnum}. It selects the addressee by setting
%    the global variables, described in the next paragraph. If addressee
%    number \meta{listnum} is not defined, all variables are reset (i.e.,
%    made empty). The numbering of \meta{listnum} starts at~1.
%
% \DescribeMacro{\toname}
% \DescribeMacro{\toaddress}
% \DescribeMacro{\tofulladdress}
% \DescribeMacro{\totelephonenum}
% \DescribeMacro{\tofaxnum}
% \DescribeMacro{\toemail}
% \DescribeMacro{\toother}
%    The addressee information is available to the user in the following
%    global variables: 
%    "\toname" holds the name part of \meta{address},
%    "\toaddress" holds the address part of \meta{address},
%    "\tofulladdress" holds \meta{address} (the combined name and address),
%    "\totelephonenum" holds the telephone number \meta{tel},
%    "\tofaxnum" holds the fax number \meta{fax},
%    "\toemail" holds the e-mail address \meta{email},
%    and "\toother" holds other address information \meta{other}.
%
% \DescribeMacro{\foreachaddressee}
%    The command "\foreachaddressee"\marg{pre}\marg{cmds}\marg{post} can be
%    used to execute some commands for each addressee. It first executes
%    the \meta{pre} commands. Then for each addressee, it sets the global
%    address variables ("\toname", \ldots) and then executes the commands
%    \meta{cmds}. Finally the \meta{post} commands are executed and the
%    global address variables are restored to the information of the first
%    addressee. If no addressee information is given before this command is
%    called, nothing is executed.
%
% \subsubsection{Topics}
%    All \Lopt{kulstijl} classes can define topics, except for the
%    \Lopt{kulkaart} class. Since cards need only basic typesetting
%    features, there seemed to be no need for topics in this class.
%
%    A topic \metacs{topic} is a combination of a variable
%    \metacs{topic}"data", a command to set it \metacs{topic}\marg{data},
%    and a related caption variable \metacs{topic}"name".
% \DescribeMacro{\printtopic}
%    The command "\printtopic"\margcs{topic} prints (using the command
%    "\hangfrom" as described in the next section) the contents of the
%    variable \metacs{topic}"data", hanging from the contents of the
%    variable \metacs{topic}"name". If the contents of the variable
%    \metacs{topic}"data" is undefined, nothing is printed.
%
% \DescribeMacro{\newtopic}
%    The command "\newtopic"\label{newtopic}\margcs{topic}\oarg{name}
%    defines a new topic \metacs{topic}. The variable \metacs{topic}"data"
%    is undefined, allowing a difference to be made between a new topic and
%    an empty one, and the variable \metacs{topic}"name" is set to
%    \meta{name}. The optional argument defaults to an empty argument.
%    Normally "\newtopic" adds a "\printtopic"\margcs{topic} to the
%    first page top area, but the starred version "\newtopic*" doesn't.
%
%    In the different classes some topics are predefined. We describe them
%    here in the order they will be printed in the first page top area. As
%    described above, nothing will be printed if you haven't used
%    \metacs{topic}\marg{data}.
%
% \DescribeMacro{\ourreference}
% \DescribeMacro{\ourreferencedata}
% \DescribeMacro{\ourreferencename}
%    The topic command "\ourreference"\marg{reference} declares the
%    \meta{reference} of the sender. The contents of the caption variable
%    defaults to ``\texttt{Ons kenmerk}''.
%
% \DescribeMacro{\yourreference}
% \DescribeMacro{\yourreferencedata}
% \DescribeMacro{\yourreferencename}
%    The topic command "\yourreference"\marg{reference} declares the
%    \meta{reference} of the recipient. The contents of the caption
%    variable defaults to ``\texttt{Uw kenmerk}''.
%    This topic is not predefined in the \Lopt{kulverslag} class.
%
% \DescribeMacro{\headdate}
% \DescribeMacro{\headdatedata}
% \DescribeMacro{\headdatename}
%    The topic command "\headdate"\marg{date}\label{headdate} declares
%    the \meta{date} to put in the first page top and in the headers of the
%    continuation pages\footnote{Of course, this doesn't change the
%    postmark on the envelope or the date printed at the top by the fax
%    machine.}. \\
% \DescribeMacro{\date}
%    By default, \meta{date} is the same as the date set by the command
%    "\date"\marg{date} (used to set the date in the title generated with
%    "\maketitle"), which defaults to the date of processing. This date is
%    printed with the standard \TeX\ command "\today", except for the
%    classes \Lopt{kulbrief} and \Lopt{kulverslag}, which use the command
%    "\todaybni" instead.
% \DescribeMacro{\todaybni}
%    The command "\todaybni" prints the date of processing as defined by
%    the Belgian Normalization Institute.
%    If you disagree with these defaults, you can always put
%    "\"("head")"date{\today}" or "\"("head")"date{\todaybni}" in your file.
% \DescribeMacro{\datename}
%    The contents of the caption variable defaults to the contents of the
%    variable "\datename", (which defaults to ``\texttt{Datum}''), except
%    for letters and reports. In the latter case, the caption variable is
%    set by the command "\location"\marg{location} to
%    ``\meta{location}\texttt{,}''.
%
% \DescribeMacro{\subject}
% \DescribeMacro{\subjectdata}
% \DescribeMacro{\subjectname}
%    The topic command "\subject"\marg{subject} declares the
%    \meta{subject}. The contents of the caption variable defaults to
%    ``\texttt{Betreft}''.
%
% \DescribeMacro{\cc}
% \DescribeMacro{\ccdata}
% \DescribeMacro{\ccname}
%    The topic command "\cc"\marg{cc} declares the names of \meta{cc}ed
%    persons (the list of people to whom you are sending copies). Multiple
%    lines in \meta{cc} are separated by "\\"s.
%    The contents of the caption variable defaults to ``\texttt{Cc}''.
%    This topic is only predefined in the \Lopt{kulmemo} class. For other
%    classes, the command "\cc"\marg{cc} immediately prints the names of the
%    \meta{cc}ed persons, hanging from "\ccname", without using "\ccdata".
%
% \DescribeMacro{\status}
% \DescribeMacro{\statusdata}
% \DescribeMacro{\statusname}
%    The topic command "\status"\marg{status} declares the \meta{status} of
%    the document. The contents of the caption variable defaults to
%    ``\texttt{Status}''.
%    This topic is only predefined in the \Lopt{kulmemo} class.
%
% \subsubsection{Hanging text}
%    Since text is hanging very often from a caption, either inside the
%    margin or inlined in the text, a command is defined to handle all of
%    these cases.
%
% \DescribeMacro{\hangfrom}
%    The command "\hangfrom"\marg{caption}\marg{data} hangs the \meta{data}
%    from the \meta{caption}. If necessary, a new paragraph is started
%    first. If the boolean switch "hangfrommargin" is set (e.g., when
%    printing the first page top), the caption is put in the margin. If the
%    switch is reset (its default state), the \meta{caption} is put at the
%    current left margin and the \meta{data} hangs from it.
% \DescribeMacro{\hangfrommargintrue}
% \DescribeMacro{\hangfrommarginfalse}
%    The switch can be set with "\hangfrommargintrue" or reset with
%    "\hangfrommarginfalse". \\
%    If you want to be independent of the switch, you can either use the
%    starred version "\hangfrom*", which works as if the switch is reset,
% \DescribeMacro{\printfrommargin}
%    or you can use "\printfrommargin"\allowbreak \marg{caption}\allowbreak
%    \marg{data}, which works as if the switch is set.
%
%    Apart from topics, some commands are directly based on the "\hangfrom"
%    command. An example of such a command is "\cc", which is equivalent to
%    "\hangfrom{\ccname}" for all classes, except \Lopt{kulmemo} and
%    \Lopt{kulkaart}, as explained above. These commands can be used in the
%    element preamble (and document preamble) as well as in the element
%    text. If they are used in the element text, the \meta{data} is printed
%    immediately, hanging from the (inlined) \meta{caption}. Otherwise, the
%    "\hangfrom" command is put in the first page top of the element and it
%    acts exactly in the same way as a topic. This also means that any
%    "\hangfrom" command, or a command based on it such as a topic, that is
%    put in the document preamble, will be put in the first page tops of
%    all the elements in the file.
%
% \DescribeMacro{\encl}
% \DescribeMacro{\enclname}
%    The command "\encl"\meta{list} hangs the \meta{list} of enclosures
%    from the contents of variable "\enclname". Multiple lines in
%    \meta{list} are separated by "\\"s.
%    It is also based on the "\hangfrom" command.
%
% \subsection{Document markup for the different \Lopt{kulstijl} classes}
%    Before describing the document markup commands for each specific
%    class, the commands, which can be used in several classes, are
%    described. The first command can be used in all classes, while the
%    rest can be used in all classes except \Lopt{kulkaart}.
%
% \DescribeMacro{\linestack}
%    The command "\linestack"\oarg{alignment}\marg{lines} creates a box
%    with the \meta{lines} stacked at the normal distance. It acts more or
%    less like a "minipage" environment without line wrapping and
%    therefore, the box is only as wide as the largest line. The advantage
%    over an "tabular" environment is that no struts are added to the
%    lines, so the box has its natural height or depth.\\
%    As usual, the lines are separated by "\\".
%    The \meta{alignment} is either "t" (the default) for top alignment or
%    "b" for bottom alignment of the box with the baseline of the
%    surrounding text. The alignment of the lines inside the box is flush
%    left, but if you want to change it, you can add an "\hfil" command for
%    centered lines or an "\hfill" command for flushed right lines at the
%    beginning of these lines.
%
% \DescribeMacro{\letterlike}
%    The command "\letterlike" emulates a "letter" environment in the other
%    classes by setting the style parameters of a letter (e.g., the
%    paragraph separation), which makes it a good candidate for
%    "\firstpagedefaults" in faxes. Of course it is also useful as a
%    "letterlike" environment. Since the command doesn't make sense in the
%    \Lopt{kulbrief} class, it is not available there.
%
% \DescribeMacro{\opening}
%    The command "\opening"\marg{salutation} generates a \meta{salutation}
%    to start a letter or a letter-like element. The \meta{salutation} is
%    aligned to the left margin.
%
% \DescribeMacro{\closing}
%    The command "\closing"\marg{greetings} ends a letter or a letter-like
%    element. After printing the \meta{greetings} aligned to the left
%    margin, it prints the signature(s) preceded by the required space
%    (cf.\ the "\signature" command in section~\ref{sec:senderinfo}).
%
% \subsubsection{The \Lopt{kulbrief} class}
% \DescribeMacro{\letterto}
%    The information about the letter recipient can be given in the letter
%    preamble with the generic command "\sendto", as explained in
%    section~\ref{sec:addresseeinfo}, or with the command
%    \begin{itemize}\item[] 
%       "\letterto"\oarg{other}\marg{address}["&"\oarg{other}\marg{address}]*
%    \end{itemize}
%    where the ``[$x$]*'' means zero or more occurrences of $x$.
%    The mandatory argument \meta{address} contains the full address of the
%    recipient, name (first line) and address (the other lines). The
%    optional argument \meta{other} is typically used for information such
%    as ``Huispost'', \ldots
%
% \DescribeEnv{letter}
%    You can put any number of letters in a single input file, each in its
%    own "letter" environment. The arguments of the environment are the
%    same as those of the "\letterto" command and they specify the
%    recipient coordinates. You can always omit the arguments if the
%    environment starts with a "\relax", a "\letterto" or a "\sendto"
%    command.
%
%    At the top of the first page of a letter, the \meta{other} information
%    followed by the \meta{address} of the first addressee is printed at
%    the appropriate place for window envelopes. This information is
%    centered vertically in the address window in the envelope, but if it
%    exceeds the window's maximum height (27\,mm), it overlaps with the
%    header.
%    After the address the used topics (e.g., references and date) are
%    inserted and the first page top is concluded by the subject topic,
%    printed in bold.
%
%    The actual body of the letter is usually started with a salutation,
%    generated by the command "\opening", but contrary to the standard
%    \Lopt{letter} class, it is allowed to put typeset material before
%    "\opening".
%    The main body of the text is typeset with a ragged right margin,
%    starting from page~1. As in the standard \Lopt{letter} class, no
%    floats (i.e., figures and tables) are allowed.
%
%    The body of the text ends with a closing, generated by the command
%    "\closing". After the signature(s), only a few commands make sense,
%    namely "\cc", "\encl" and "\ps".
% \DescribeMacro{\ps}
%    The command "\ps" precedes any additional text after the closing.
%    This command generates no text, but is needed to format the
%    additional text correctly. The command "\hangfrom" or any command
%    based on it can also be useful here.
%
% \DescribeMacro{\makelabels}
%    Because the \Lopt{kulbrief} class is based on the \Lopt{letter} class,
%    you can also use its mailing label making facilities. A label with the
%    \meta{address} information is generated for each addressee of a
%    letter, unless that \meta{address} information is empty. So, if you
%    want to generate labels without specifying an address in the letter,
%    simply use an empty first address. In case you only want to make
%    labels, use an empty letter environment.
%
% \subsubsection{The \Lopt{kulfax} class}
% \DescribeMacro{\faxto}
%    The information about the fax recipient can be given in the fax
%    preamble with the generic command "\sendto", as explained in
%    section~\ref{sec:addresseeinfo}, or with the command
%    \begin{itemize}\item[]
%       "\faxto"\oarg{tel}\marg{fax}\marg{address}[^^A
%         "&"\oarg{tel}\marg{fax}\marg{address}]*
%    \end{itemize}
%    where the ``[$x$]*'' means zero or more occurrences of $x$.
%    The mandatory argument \meta{address} contains the full address of the
%    recipient, name (first line) and address (the other lines).
%    The mandatory argument \meta{fax} contains the fax number of the
%    recipient, and the optional argument \meta{tel} his/her telephone number.
%
% \DescribeEnv{fax}
%    You can put any number of faxes in a single input file, each in its
%    own "fax" environment. The arguments of the environment are the
%    same as those of the "\faxto" command and they specify the
%    recipient coordinates. You can always omit the arguments if the
%    environment starts with a "\relax", a "\faxto" or a "\sendto"
%    command.
%
%    At the top of the first page of a fax the coordinates of the addressee(s)
%    are printed. Two default layouts are provided.
% \DescribeMacro{\printlongfaxto}
%    The first one "\printlongfaxto" prints extensive information and is
%    normally used when information of only one addressee is printed. This
%    is the layout as specified in the K.U.Leuven guidelines.
% \DescribeMacro{\printshortfaxto}
%    The second layout "\printshortfaxto" prints more compact information and
%    makes more sense when several addressees are given.
% \DescribeMacro{\printfaxto}
%    The actual printing of the information is done by the command
%    "\printfaxto", which calls "\printlongfaxto" when only one addressee
%    is given and "\printshortfaxto" when more than one is given.
%    The user can redefine "\printfaxto" (with "\renewcommand"), using
%    either of the two commands, or even using the command
%    "\foreachaddressee". So if you always want the layout of the
%    guidelines, put the following line in the element preamble
%    \begin{verbatim}
%    \renewcommand{\printfaxto}{\printlongfaxto}
%\end{verbatim}
%
%    After the addressee information follows the name of the sender.
%    Actually it is his/her signature (given by the command
%    "\signature"\marg{name}), so it can be different from the name used in
%    the footer.
%    Then follow all used topics and finally the number of pages is printed.
%    Therefore the first page of the fax is printed last, so the correct
%    number of pages can be computed.
% \DescribeMacro{\addpages}
%    If you want to add extra pages, you must use the command
%    "\addpages"\marg{cnt}, where \meta{cnt} is the number of pages to add
%    at that place.
%
% \DescribeEnv{firstpage}
%    The rest of the first page can only contain some small remarks, which
%    are entered inside the "fax" environment in a special environment
%    "firstpage". This environment has one optional parameter \meta{toptext},
%    which is printed at its top. The parameter defaults to the contents of
% \DescribeMacro{\firstpagetoptext}
%    the variable "\firstpagetoptext", which defaults to the contents of
%    the variable "\messagesname" with default value ``\mbox{Mededelingen}''
%    (see table~\ref{tab:babel}).
%    If the contents of this environment is higher than the remaining part
%    of the page, an error is given, unless you used "\addpages{1}" before
%    the "firstpage" environment to provide space for an additional `first'
%    page.
% \DescribeMacro{\firstpagedefaults}
%    The macro "\firstpagedefaults" holds the initializing commands for
%    the "firstpage" environment. A typical example of such an initializing
%    command is "\letterlike".
%
%
% \subsubsection{The \Lopt{kulmemo} class}
% \DescribeMacro{\memoto}
%    The information about the memo addressee(s) can be given in the memo
%    preamble with the generic command "\sendto", as explained in
%    section~\ref{sec:addresseeinfo}, or with the command
%    \begin{itemize}\item[]
%       "\memoto"\marg{address}["&"\marg{address}]*
%    \end{itemize}
%    where the ``[$x$]*'' means zero or more occurrences of $x$.
%    As usual, the mandatory argument \meta{address} contains the full
%    address of the addressee, name as well as the address.
%
% \DescribeEnv{memo}
%    You can put any number of memos in a single input file, each in its
%    own "memo" environment. The arguments of the environment are the
%    same as those of the "\memoto" command and they specify the
%    addressee coordinates. You can always omit the argument if the
%    environment starts with a "\relax", a "\memoto" or a "\sendto"
%    command.
%
%    The top of the first page of a memo contains the coordinates of the
%    addressee(s).
% \DescribeMacro{\printmemoto}
%    The actual printing of the information is done by the command
%    "\printmemoto". By default, it prints the entire \meta{address} for
%    each addressee. The user can redefine it (with "\renewcommand"), using
%    the command "\foreachaddressee". \\
%    After the addressee information follows the name of the sender.
%    Actually it is his/her signature (given by the command
%    "\signature"\marg{name}), so it can be different from the name used in
%    the footer.
%    Then follow all used topics, such as date, subject, cc and status.
%    
%
% \subsubsection{The \Lopt{kulverslag} class}
%    Only one report is allowed in the document class \Lopt{kulverslag}, so
%    no environment for a report is provided: the element is the entire
%    document.
%
%    The top of the first page contains only the used topics, such as our
%    reference, the date, and the subject.
%
%    Contrary to the other classes, the text is not printed with a ragged
%    right margin, but with the standard justification.
%
% \subsubsection{The \Lopt{kulkaart} class}
% \DescribeEnv{cards}
%    Cards printed with the \Lopt{kulkaart} class come in two flavors:
%    regular cards, made with the "cards" environment, and business cards,
%    made with the "cards*" environment. The business cards not only have
%    smaller dimensions, but they also use a smaller font. These
%    environments have one optional argument to specify the dimensions
%    of the cards: it is either a \oarg{width} or a combined
%    "["\meta{width}","\meta{height}"]". For regular cards, the
%    \meta{width} defaults to 15\,cm and the \meta{height} to 10.5\,cm. For
%    business cards, the \meta{width} defaults to 9\,cm and the
%    \meta{height} to 6\,cm.
%
%    Apart from these generic card environments, some shorthands are also
%    defined.
% \DescribeEnv{largecards}
%    The environment "largecards", which takes no arguments, gives a
%    regular card, but with a default \meta{width} of 21\,cm.
% \DescribeMacro{\businesscards}
%    The command "\businesscards" typesets business cards, including their
%    normal contents: your name and a long description of your profession
%    (from variable "\fromprofessionlong"). It takes the same optional
%    argument as the "cards*" environment.
%
%    Each "cards"("*") environment starts a new page and by default, one
%    page filled with cards is printed.
% \DescribeCounter{numberofcards}
%    You can change this by setting the counter "numberofcards", which
%    defaults to $-1$. If it holds a positive value, this is the number of
%    cards to print. If it holds a negative value, this is the number of
%    pages to fill with cards.
%
% \DescribeMacro{\cardhsep}
% \DescribeMacro{\cardvsep}
%    The horizontal separation between the cards is stored in the variable
%    "\cardhsep", with a default value of `"2mm"', and the vertical
%    separation is stored in the variable "\cardvsep", which defaults
%    to "\cardhsep". These variables must contain (rubber) lengths.
%
%
% \subsection{Multi-language support}
%    If you want to write in other languages than Dutch, you can use the
%    \Lopt{babel} package. Even if you are only writing Dutch letters, it
%    is useful to use this package to get your text hyphenated correctly.
%    This is why all \Lopt{kulstijl} classes will try to load the Dutch
%    hyphenation patterns, if they are preloaded in your \LaTeX\ format by
%    \Lopt{babel}.
%
%    Table~\ref{tab:babel} gives an overview of the language dependent
%    variables in the different \Lopt{kulstijl} classes.
%    \begin{table}
%      \begin{center}
%        \begin{tabular}{|l|l|l|}
%          \hline
%          \multicolumn1{|c|}{symbol}
%                                 & \multicolumn1{c|}{Dutch}
%                                               & \multicolumn1{c|}{English}\\
%          \hline
%          "\ccname"              & cc          & cc             \\
%          "\datename"            & Datum       & Date           \\
%          "\enclname"            & Bijlage(n)  & encl           \\
%          "\firstheadtitlefax"   & VOORBLAD FAX& FAX            \\
%          "\firstheadtitlememo"  & MEMO        & MEMO           \\
%          "\firstheadtitlereport"& VERSLAG     & REPORT         \\
%          "\headcompanyname"     & Bedrijf\,/\,Dienst
%                                               & Company        \\
%          "\headfaxpagesname"    & Aantal pagina's
%                                               & Page count     \\
%                                 & incl.\ voorblad
%                                               & incl.\ front page\\
%          "\headfromname"        & Van         & From           \\
%          "\headtoname"          & Aan         & To             \\
%          "\messagesname"        & Mededelingen& Messages       \\
%          "\ourreferencename"    & Ons kenmerk & Our reference  \\
%          "\pagenumbername"      & Blad nr.    & Page           \\
%          "\statusname"          & Status      & Status         \\
%          "\subjectname"         & Betreft     & Subject        \\
%          "\yourreferencename"   & Uw kenmerk  & Your reference \\
%          \hline
%        \end{tabular}
%      \end{center}
%      \caption{Language dependent variables in the \Lopt{kulstijl} classes,
%        as defined by the \Lopt{babel} package.}
%      \label{tab:babel}
%    \end{table}
%    If the \Lopt{babel} package is not used, the Dutch text is used.
%
%
% \subsection{Configuration files}\label{sec:init}
%    Two configuration files are allowed: one for the system-wide
%    configuration of all \Lopt{kulstijl} classes, called
%    \file{kulstijl.def}, and one for the user specific configuration,
%    called \file{kulstijl.cfg}. The file \file{kulstijl.def} is required,
%    but the other one is optional.
%
%    Normally the file \file{kulstijl.def} is created by the installer of
%    the \Lopt{kulstijl} classes and put somewhere on the \TeX\ input path
%    (e.g., as specified in the environment variable "TEXINPUTS"). It
%    contains general configuration information, such as the address of the
%    department and font information. For an example, see
%    section~\ref{sec:esatconfig}.
%
%    The file \file{kulstijl.cfg} is created by the user and it contains
%    personal information, such as sender coordinates, and personal
%    configuration preferences. Definitions in this file override those
%    from the system-wide configuration file. This file is put in the same
%    directory as the documents or somewhere on the \TeX\ input path.
%
%    If you want site-independence when transmitting documents to other
%    sites, you must always include any used \file{kulstijl.def} or
%    \file{kulstijl.cfg} file in your document (e.g., with the
%    "filecontents" environment). Probably a better solution is to
%    use the \Lopt{noconfigfiles} option and insert all the necessary
%    information from the configuration files in the document file.
%
% \subsubsection{The ESAT configuration commands}\label{sec:esatcmds}
%    This section describes the additional user commands available at the
%    Department of Electrical Engineering (ESAT)\@. It is irrelevant for
%    other departments. If you are interested, the complete description of
%    the configuration file can be found in section~\ref{sec:esatconfig}.
%
% \DescribeMacro{\group}
% \DescribeMacro{\groupname}
%    The command "\group"\marg{name} (as defined in
%    section~\ref{sec:esatconfig}) sets the variable "\groupname", which
%    holds the abbreviated \meta{name} of the research group in the
%    department.
%
% \DescribeMacro{\national}
% \DescribeMacro{\international}
%    The switch "international" indicates whether the letters, faxes,
%    \ldots{} are intended to be sent abroad or not. For local elements, the
%    country name and the international telephone prefix will be omitted.
%    The user commands "\national" and "\international" are used to set the
%    switch "international".
%
%
% \section{Configuration information}
%    In this section, some additional information for installers or people
%    writing configuration files is given.
%
%    For a correct working, the font "kulfont1" and the package
%    \Lopt{kulfonts} must be installed.
%
%    When the configuration files are read, the `"@"' is considered a
%    letter, so you can access all internal commands without problem.
%    However, compatibility with future version may be lost if you do so.
%
%    Page layout parameters such as "\headheight", "\headsep" or
%    "\footskip" normally can't be changed without messing up the page
%    layout as described by the guidelines. If you insist on doing it
%    anyway, you have to recompute the correct value of "\textheight" also.
%    The same goes for parameters such as "\oddsidemargin" or
%    "\marginparsep", which are coupled with "\marginparwidth" and
%    "\textwidth".
%
% \DescribeMacro{\firstfootsep}\label{firstfootsep}
%    The rigid length "\firstfootsep" (to be set with "\setlength") gives
%    the extra space between the top of the footer and the bottom of the
%    regular text on the first page. It is normally used to correct the
%    estimation made of the height of the footer. If we use preprinted
%    letter forms, we guess that the footer is 15\,pt high (containing only
%    a fax and telephone number), but this can be very wrong, so we need to
%    set "\firstfootsep" to the real height of the footer $-$~15\,pt.
%
% \DescribeMacro{\fromaddressbottomsep}
%    The variable "\fromaddressbottomsep" holds the length of the minimum
%    white space below the address of the sender in the first page header.
%    By default, it is about 12\,pt. For faxes, memos, and reports, it gives
%    the minimum spacing between the address and the title in the header.
%    For letters, it gives the minimum spacing between the address in the
%    header and the address of the addressee. For cards, it gives the
%    minimum distance between the header address and the text on the card.
%
% \DescribeMacro{\hangfrommakecaption}
%    The command "\hangfrommakecaption"\marg{caption} is used internally by
%    the command "\hangfrom" to format the \meta{caption}. If the
%    \meta{caption} is put in the margin, it is made upper case for letters
%    and reports. If the caption is inlined, it is followed by ":" (if the
%    caption didn't end with a punctuation character) and a space. If you
%    want a different format, you can always redefine the command
%    "\hangfrommakecaption".
%
% \DescribeMacro{\CurrentClass}
%    The variable "\CurrentClass" holds the name of the current class,
%    e.g., "kulfax". It can be used in an "\ifthenelse" statement to take
%    class specific actions. For instants, if you want your name to be "Me"
%    in letters and "I. Me" in other classes, you can use the following
%    statement in your configuration file:
%    \begin{verbatim}
%    \ifthenelse{\equal{\CurrentClass}{kulbrief}}{\name{Me}}{\name{I. Me}}
%\end{verbatim}
%
%    From \Lopt{babel} version~3.5 on, language specific configuration
%    files are allowed. The file \file{kulstijl.dtx} generates such
%    configuration files for English (file \file{english.cfg}) and Dutch
%    (file \file{dutch.cfg}). If your system has already defined these
%    files, you must append the contents of the generated files to them.
%
% \subsection{The configuration file of ESAT}\label{sec:esatconfig}
%    This section describes the system-wide configuration file
%    \file{kulstijl.def}, used at the Department of Electrical Engineering
%    (ESAT)\@. The extra user commands are described in
%    section~\ref{sec:esatcmds}.
%    For other departments this only serves as an example.
%
% \iffalse ^^A don't print docstrip info
%    \begin{macrocode}
%<*esat>
%    \end{macrocode}
% \fi      ^^A end of meta-comment
%
%    In the dumped \LaTeX\ of ESAT\@, the \Lopt{babel} initialization is
%    included (version~3.5 or higher) and the language "dutch" is provided,
%    so no tests for it are included in this configuration file.
% \begin{macro}{\iflanguage}
%    However, we redefine the dumped command "\iflanguage", so it can be
%    used even if the rest of the \Lopt{babel} package is not loaded. If it
%    is loaded, it will redefine it again.
%    \begin{macrocode}
\renewcommand*{\iflanguage}[1]{\@ifundefined{l@#1}{\@secondoftwo}{%
    \ifnum\csname l@#1\endcsname=\language \expandafter\@firstoftwo \else
    \expandafter\@secondoftwo \fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifinternational}
%    The switch "international" indicates whether the elements are intended
%    to be sent abroad or not.
%    \begin{macrocode}
\newif\ifinternational
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\national}
% \begin{macro}{\international}
%    The user commands "\national" and "\international" are used to set the
%    switch "international". Some additional hackery is used to set the
%    default value depending on the selected language, which is only known
%    after the document preamble: national layout for Dutch letters,
%    international layout for other languages. It could be made much more
%    complex, using addressee information and setting it in the hook
%    "\aftersendto".
%    The use of the commands "\national" and "\international" always
%    overrides the default value, even when they are used in the preamble.
%    \begin{macrocode}
\newcommand{\national}{\AtBeginDocument\internationalfalse}
\newcommand{\international}{\AtBeginDocument\internationaltrue}
\AtBeginDocument{%
  \let\national\internationalfalse
  \let\international\internationaltrue
  \@ifundefined{bbl@main@language}\internationalfalse{%
    \def\reserved@a{dutch}\ifx\bbl@main@language\reserved@a
      \internationalfalse \else \internationaltrue \fi}}
%    \end{macrocode}
%    The hackery with "\bbl@main@language" is needed because \Lopt{babel}
%    sets the language also with an "\AtBeginDocument", which will be
%    executed after this one.
% \end{macro}
% \end{macro}
%
% \begin{macro}{\group}
% \begin{macro}{\groupname}
%    The variable "\groupname" stores the name of the \meta{division} and is
%    set by the command "\group"\marg{division}.
%    \begin{macrocode}
\newvar[\group]\groupname
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    By default, three kinds of fonts are used: Futura for the preprinted
%    information, Computer Modern for the body of the text in reports, and
%    Helvetica in the body of the text for all other classes.
%    \begin{macrocode}
\ifthenelse{\equal{\CurrentClass}{kulverslag}}{}{%
  \RequirePackage{helvet}}
\renewcommand{\preprintfontdefaults}{\fontfamily{pfu}}
%    \end{macrocode}
%
% \changes{v1.3}{2005/04/06}{New Dutch name of faculty of Engineering}
% \changes{v1.3}{2005/04/06}{WWW no longer needs ``\texttt{.ac}''}
%    Finally initialize the coordinates of the department, taking into
%    account the requirement for international information and the correct
%    language. Only Dutch and English are provided, but the user can extend
%    this himself in his/her own configuration file.
%    \begin{macrocode}
\address{%
  \iflanguage{dutch}{%
    Faculteit Ingenieurswetenschappen\\%
    \textbf{Departement Elektrotechniek (ESAT)}}{%
    Faculty of Engineering\\%
    \textbf{Department of Electrical Engineering (ESAT)}}%
  \ifx\groupname\@empty\else
    \textbf{, \iflanguage{dutch}{Afdeling}{Division} \groupname}\fi
  \\Kasteelpark Arenberg 10\\%
  \ifinternational B--\fi 3001 Leuven--Heverlee%
  \ifinternational , Belgi\iflanguage{dutch}{\"e}{um}\fi}
\location{Heverlee}
\telephonenumber{\ifinternational +32--\else 0\fi 16\,32\,1130}
\faxnumber{\ifinternational +32--\else 0\fi 16\,32\,1986}
\www{http://www.esat.kuleuven.be}
%    \end{macrocode}
% \changes{v1.3}{2003/02/26}{Provide the ESAT logo by default}
%    As departmental logo we use an EPS file scaled to 29~point, which
%    approximates the height of the four header lines. For PDF\TeX, the
%    \Lopt{graphics} package automatically takes the PDF file instead.
%    \begin{macrocode}
\AtBeginDocument{\RequirePackage{graphics}}
\setvar\deptlogo{\resizebox*{!}{29pt}{\includegraphics{esatlogo-gr102}}}
%    \end{macrocode}
%
% \iffalse ^^A don't print docstrip info
%    \begin{macrocode}
%</esat>
%    \end{macrocode}
% \fi      ^^A end of meta-comment
%
%
% \StopEventually{\ifmulticols
%     \addtocontents{toc}{\protect\end{multicols}}\fi}
%
%
% \section{General utility macros for all classes}
% \begin{macro}{\CurrentClass}
%    In our configuration files, we may want to know the name of the class
%    that invoked it. This information is stored in the variable
%    "\CurrentClass".
%    \begin{macrocode}
%<*class>
\@ifdefinable\CurrentClass{\edef\CurrentClass{\@currname}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@robust@cr}
%    The macro "\kul@robust@cr" stores the original definition of "\\",
%    which is robust. This can be used to make "\\" robust again in headers
%    and "\parbox"es.
%    \begin{macrocode}
\let\kul@robust@cr\\
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@noesc}
%    The command "\kul@noesc"\marg{cs} converts \meta{cs} to a string
%    without the escape character. Its primary use is in the first argument
%    of a "\@ifundefined" or inside a "\csname"\ldots"\endcsname".
%    \begin{macrocode}
\newcommand\kul@noesc{\expandafter\kul@gobblesc\string}
%    \end{macrocode}
% \begin{macro}{\kul@gobblesc}
%    The internal command "\kul@gobblesc"\marg{char} removes the first
%    \meta{char} of the string if it is the escape character.
%    \begin{macrocode}
\newcommand*\kul@gobblesc[1]{\ifnum`#1=\escapechar\else #1\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\kul@optarg}
%    The internal command "\kul@optarg"\marg{cmdopt}\allowbreak
%    \marg{cmdnoopt}\allowbreak  \marg{aftercmds}\allowbreak \oarg{arg}
%    executes command \meta{cmdopt} with argument \meta{arg} if the
%    optional argument \meta{arg} is present, and executes \meta{cmdnoopt}
%    otherwise. Afterwards, the commands \meta{aftercmds} are executed.
%    \begin{macrocode}
\newcommand\kul@optarg[3]{\@ifnextchar[{\kul@optarg@{#3}#1}{#2#3}}
%    \end{macrocode}
% \begin{macro}{\kul@optarg@}
%    The internal command "\kul@optarg@"\marg{aftercmds}\allowbreak
%    \marg{cmd}\allowbreak \oarg{arg} executes command \meta{cmdopt} with
%    argument \meta{arg}. Then the commands \meta{aftercmds} are executed.
%    We assume that we already verified that \meta{arg} is present.
%    \begin{macrocode}
\@ifdefinable\kul@optarg@{\long\def\kul@optarg@#1#2[#3]{#2{#3}#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\kul@errhelp}
%    The command "\kul@errhelp" holds the help text when something
%    seriously went wrong.
%    \begin{macrocode}
\newcommand\kul@errhelp{Type \space X <return> \space to quit,
  correct the document and rerun LaTeX.}
%    \end{macrocode}
% \end{macro}
%    The next command is not used in the \Lopt{kulkaart} class.
% \begin{macro}{\toks@addto}
%    The command "\toks@addto"\marg{toks}\marg{arg} adds \meta{arg} to
%    token register \meta{toks}. For global operations, you can prepend
%    "\global". Of course, this definition makes only sense if we use it a
%    lot!
%    \begin{macrocode}
%<!kaart>\newcommand\toks@addto[2]{#1\expandafter{\the #1#2}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Variables}
% \begin{macro}{\setvar}
%    The command "\setvar"\margcs{var}\marg{data} stores \meta{data}
%    in the variable \metacs{var}.
%    \begin{macrocode}
\newcommand\setvar[2]{\def #1{#2}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\newvar}
%    The command "\newvar"\oargcs{varset}\margcs{var}\oarg{data}
%    defines the variable \metacs{var} and initializes it with
%    \meta{data} (which defaults to nothing).
%    If the first optional argument is used, it also defines the command
%    \metacs{varset}\marg{data} to set the variable.
%    It also checks to see if \metacs{var} and (if the first optional
%    argument is used) \metacs{varset} are not in use.
%    \begin{macrocode}
\newcommand\newvar{\@ifnextchar[{%
    \kul@setvar\newcommand}{\kul@newvar\newcommand}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\renewvar}
%    The command "\renewvar"\oargcs{varset}\margcs{var}\oarg{data}
%    is similar to "\newvar", but it checks whether the commands
%    \metacs{var} and \metacs{varset} are already in use.
%    \begin{macrocode}
\newcommand\renewvar{\@ifnextchar[{%
    \kul@setvar\renewcommand}{\kul@newvar\renewcommand}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@setvar}
%    The command "\kul@setvar"\marg{defcmd}\oargcs{varset}\allowbreak
%    \margcs{var} (re)defines \metacs{varset} before calling
%    "\kul@newvar".
%    The argument \meta{defcmd} should be a variant of "\newcommand". 
%    \begin{macrocode}
\@ifdefinable\kul@setvar{\def\kul@setvar#1[#2]#3{%
    #1#2{\setvar #3}\kul@newvar #1#3}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@newvar}
%    The command "\kul@newvar"\marg{defcmd}\margcs{var}\oarg{data}
%    (re)defines \metacs{varset} to contain \meta{data}.
%    The argument \meta{defcmd} should be a variant of "\newcommand". 
%    \begin{macrocode}
\newcommand*\kul@newvar[2]{#1*#2{}\kul@optarg{\setvar #2}{}{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\expandargument}
%    The command "\expandargument"\marg{cmds}\marg{argument} expands
%    the \meta{argument} before executing \meta{cmds}\marg{expanded argument}.
%    Of course, this command makes \meta{argument} a moving argument.\\
%    Warning: \meta{cmds} can not contain a "\par".
%    \begin{macrocode}
\newcommand\expandargument[2]{%
  \protected@edef\reserved@a ##1{##1{#2}}%
  \reserved@a{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\undefine}
%    The command "\undefine"\margcs{cs} undefines the command, by
%    "\let"ting it to "\relax". This means that the test
%    "\@ifundefined"\marg{cs} will succeed.
%    \begin{macrocode}
\newcommand*\undefine[1]{\let #1\relax}
%    \end{macrocode}
% \end{macro}
%
% \section{Handling the options and required packages}
% \subsection{Defining options}
% \subsubsection{Paper dimensions}
% \begin{macro}{\paperheight}
% \begin{macro}{\paperwidth}
%    ^^A Leave room for the 2 macro names in the margin.
%    \leavevmode\marginpar\strut\marginpar\strut
% \DefineOption{a4paper}
% \DefineOption{a5paper}
% \DefineOption{b5paper}
% \DefineOption{letterpaper}
% \DefineOption{legalpaper}
% \DefineOption{executivepaper}
% \DefineOption{landscape}
%    The lengths "\paperwidth" and "\paperheight" are set for the
%    \Lopt{kulkaart} class. They are copied from the standard \LaTeX\
%    classes. For other classes they are defined by the loaded classes.
%    \begin{macrocode}
%<*kaart>
\DeclareOption{a4paper}{%
  \setlength\paperheight {297mm}%
  \setlength\paperwidth  {210mm}}
\DeclareOption{a5paper}{%
  \setlength\paperheight {210mm}%
  \setlength\paperwidth  {148mm}}
\DeclareOption{b5paper}{%
  \setlength\paperheight {250mm}%
  \setlength\paperwidth  {176mm}}
\DeclareOption{letterpaper}{%
  \setlength\paperheight {11in}%
  \setlength\paperwidth  {8.5in}}
\DeclareOption{legalpaper}{%
  \setlength\paperheight {14in}%
  \setlength\paperwidth  {8.5in}}
\DeclareOption{executivepaper}{%
  \setlength\paperheight {10.5in}%
  \setlength\paperwidth  {7.25in}}
\DeclareOption{landscape}
   {\setlength\@tempdima   {\paperheight}%
    \setlength\paperheight {\paperwidth}%
    \setlength\paperwidth  {\@tempdima}}
%</kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Printing (folding) marks (\Lopt{kulbrief} and
%   \Lopt{kulkaart})}
%    Normally special marks for cutting or folding are printed on the first
%    page, when using the classes \Lopt{kulbrief} (if no preprinted form is
%    used) or \Lopt{kulkaart}. You can use the option \Lopt{foldingmarks}
%    to print them on every page or \Lopt{nofoldingmarks} to remove them
%    from all pages.
% \begin{macro}{\foldingmarkscondition}
%    Actually, the printing of the marks is controlled by the variable
%    "\foldingmarkscondition", which contains a test for an "\ifthenelse"
%    command. By default it evaluates to true for the first page only.
%    \begin{macrocode}
%<*brief|kaart>
\newvar\foldingmarkscondition[\value{page}=1]
%    \end{macrocode}
% \end{macro}
% \DefineOption{foldingmarks}
% \DefineOption{nofoldingmarks}
%    Now we can define the two options \Lopt{foldingmarks} and
%    \Lopt{nofoldingmarks}, using the above condition.
%    \begin{macrocode}
\DeclareOption{foldingmarks}{\setvar\foldingmarkscondition{1=1}}
\DeclareOption{nofoldingmarks}{\setvar\foldingmarkscondition{0=1}}
%</brief|kaart>
%    \end{macrocode}
%
% \subsubsection{Using preprinted forms (\Lopt{kulbrief})}
% \DefineOption{preprintedform}
%    The option \Lopt{preprintedform} indicates that preprinted pages are used.
% \begin{macro}{\ifkul@addpre}
%    It uses the switch "kul@addpre". This switch is set to false when
%    preprinted pages will be used.
%    \begin{macrocode}
%<*brief>
\newif\ifkul@addpre
\kul@addpretrue
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\DeclareOption{preprintedform}{\kul@addprefalse}
%</brief>
%    \end{macrocode}
%
% \subsubsection{Centering the first page (\Lopt{kulbrief} and
%   \Lopt{kulkaart})}
% \label{sec:opt-center}
% \DefineOption{centerpage}
%    An option is defined to indicate whether the body of the first page
%    has to be centered (\Lopt{centerpage}) or not (the default). For
%    letters it centers only vertically, for cards it centers horizontally
%    and vertically. If you want to remove the horizontal centering, you
%    can use "\raggedright".
%
%    For centered letters, the glue at the top ("\@firsttexttop") is chosen
%    equal to the glue inserted by "\@texttop" in the standard
%    \Lopt{letter} class. In this case, "\vspace" is used to guarantee that
%    the glue is not removed by "\addvspace"s following it.
%    \begin{macrocode}
%<*brief>
\DeclareOption{centerpage}{%
  \def\@firsttexttop{\vspace{\z@\@plus.00006fil}}}
%</brief>
%    \end{macrocode}
% \begin{macro}{\@firsttexttop}
%    The macro "\@firsttexttop", which is available in all
%    \Lopt{kulstijl} classes, expands to the commands to insert the
%    necessary glue after the top of the (first) empty page.
%    No glue is added for cards, two empty lines for letters and reports,
%    and 70\,\% of "\headsep" for faxes and memos.
%    The skip is given with "\vskip" instead of "\vspace" to allow
%    subsequent "\addvspace"s to work (e.g., from "\section").
%    \begin{macrocode}
\newcommand\@firsttexttop{%
%<brief|verslag>  \vskip 2\baselineskip
%<fax|memo>  \vskip .7\headsep
  }
%    \end{macrocode}
% \end{macro}
%
%    For a card, it uses the standard commands "\@texttop" and
%    "\@textbottom". The values are not the same as in "\raggedbottom", but
%    are the same as in "\centering" because of symmetry.
%    \begin{macrocode}
%<*kaart>
\DeclareOption{centerpage}{\centering
  \def\@texttop{\vskip\@flushglue}\let\@textbottom\@texttop}
%    \end{macrocode}
%    If this option is not used, we need to set the defaults: ragged right
%    and ragged bottom. Just in case "\cardvsep" is a real rubber length,
%    we set the bottom glue the same as when the option \Lopt{centerpage}
%    is used.
%    \begin{macrocode}
\raggedright
\let\@texttop\relax \def\@textbottom{\vskip\@flushglue}
%</kaart>
%    \end{macrocode}
%
% \subsubsection{Using configuration files}
% \DefineOption{noconfigfiles}
%    At the end of the class, the configuration files are read (see
%    page~\pageref{config}). This can be switched off by the option
%    \Lopt{noconfigfiles}.
% \begin{macro}{\ifkul@noconfig}
%    The switch "kul@noconfig" is set to true if we want to omit the
%    configuration files. By default it is false.
%    \begin{macrocode}
\newif\ifkul@noconfig
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\DeclareOption{noconfigfiles}{\kul@noconfigtrue}
%    \end{macrocode}
%
% \subsubsection{The type size}
% \DefineOption{10pt}
% \DefineOption{11pt}
% \DefineOption{12pt}
%    Selecting the type size is normally done by the inherited class
%    (\Lopt{letter} or \Lopt{article}). This assumes that the default size
%    is \Lopt{10pt}, but this is incorrect for the class \Lopt{kulfax} or
%    the class \Lopt{kulmemo}. For these classes we handle the sizes first
%    and pass the correct size to the inherited class, after we have
%    processed them all. For cards we define them also, since they are not
%    based upon any other class.
% \begin{macro}{\@ptsize}
%    The macro "\@ptsize" is used to store the point size in the same way
%    as other classes do, so \Lopt{kulkaart} can use any package depending
%    on this.
%    \begin{macrocode}
%<*fax|memo|kaart>
\newcommand*\@ptsize{}
\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
%</fax|memo|kaart>
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Illegal options}
% \begin{macro}{\kul@illegalopt}
%    The macro "\kul@illegalopt" declares the current option illegal for
%    this class.
%    \begin{macrocode}
%<*!kaart>
\newcommand\kul@illegalopt{\ClassError\CurrentClass
  {No `\CurrentOption' option allowed for this K.U.Leuven class}%
  {This option will be ignored.\MessageBreak
   Type  \space <return> \space to continue without it.}}
%    \end{macrocode}
% \end{macro}
% \DefineOption{titlepage}
%    The option \Lopt{titlepage} isn't allowed because I think it doesn't
%    make much sense and it makes some redefinitions (e.g., "\maketitle" and
%    "titlepage") easier.
%    \begin{macrocode}
\DeclareOption{titlepage}{\kul@illegalopt}
%    \end{macrocode}
% \DefineOption{twoside}
%    The option \Lopt{twoside} isn't allowed since the K.U.Leuven
%    instructions only define symmetrical pages.
%    \begin{macrocode}
\DeclareOption{twoside}{\kul@illegalopt}
%    \end{macrocode}
% \DefineOption{twocolumn}
%    The option \Lopt{twocolumn} isn't allowed because I haven't the time
%    to implement it now (how's that for a reason).
%    \begin{macrocode}
\DeclareOption{twocolumn}{\kul@illegalopt}
%    \end{macrocode}
%
% \subsubsection{Other options}
%    The rest of the options are passed to the standard document class
%    \Lopt{letter} for letters and to the standard class \Lopt{article} for
%    other classes.
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass\CurrentOption
%<brief>  {letter}}
%<!brief>  {article}}
%</!kaart>
%    \end{macrocode}
%
%
% \subsection{Executing Options}
%    First set the default options. This is only required for the classes
%    \Lopt{kulfax}, \Lopt{kulmemo} and \Lopt{kulkaart}.
%    \begin{macrocode}
%<fax|memo>\ExecuteOptions{12pt}
%<kaart>\ExecuteOptions{a4paper,10pt}
%    \end{macrocode}
%    Process the options.
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%    Finally pass the correct size option also to the \Lopt{article} class
%    for faxes and memos. Before loading the class, we have to undefine
%    "\@ptsize" again, so it can be defined with "\newcommand" in the class.
%    \begin{macrocode}
%<*fax|memo>
\expandafter\PassOptionsToClass\expandafter{%
  \expandafter 1\@ptsize pt}{article}
\undefine\@ptsize
%</fax|memo>
%    \end{macrocode}
%
%
% \subsection{Loading Packages}
%    The document class \Lopt{kulbrief} is based on the standard document
%    class \Lopt{letter}. The other document classes, except for
%    \Lopt{kulkaart} which is defined completely later on, are based on the
%    standard document class \Lopt{article}. All classes use the default
%    paper size \Lopt{a4paper}. This default paper size can be added to the
%    options without problems, since it is defined first in the inherited
%    class, so it will be overridden by any other specified option.
%    \begin{macrocode}
%<brief>\LoadClass[a4paper]{letter}
%<!kaart&!brief>\LoadClass[a4paper]{article}
%    \end{macrocode}
%
%    The \Lopt{letter} class sets "\@texttop" to "\vskip 0pt plus .00006fil"
%    on the first page of a letter, which centers a short letter on
%    the page. We don't want this because it also moves the address and
%    other header information, which \emph{must} stay on their place when we
%    are using window envelopes or preprinted forms. Its effect is replaced
%    by "\@firsttexttop" if required by the option \Lopt{centerpage} (see
%    section~\ref{sec:opt-center}).
%    \begin{macrocode}
%<*brief>
\let\@texttop\relax
%    \end{macrocode}
% \begin{macro}{\startlabels}
%    The standard command "\startlabels" must also guarantee that the first
%    page of the labels has page style \pstyle{empty} and not page
%    style \pstyle{firstpage}.
%    \begin{macrocode}
\expandafter\def\expandafter\startlabels\expandafter{\startlabels
  \thispagestyle{empty}}
%</brief>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\maketitle}
%    The \Lopt{article} class defines the command "\maketitle" to be used
%    only once, so it can undefine commands such as "\date". This we can't
%    allow in our classes, so we redefine the command "\maketitle".
%    Furthermore we guarantee that it doesn't force a \pstyle{plain} page
%    style.
%    \begin{macrocode}
%<*!kaart&!brief>
\renewcommand\maketitle{\par
  \begingroup
    \def\thefootnote{\@fnsymbol\c@footnote}%
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
    \long\def\@makefntext##1{\parindent 1em\noindent
      \hbox to1.8em{\hss
        \@textsuperscript{\normalfont\@thefnmark}}##1}%
    \newpage \global\@topnum\z@
    \@maketitle
  \endgroup
  \setcounter{footnote}\z@}
%    \end{macrocode}
% \end{macro}
% \begin{environment}{titlepage}
%    We also redefine the environment "titlepage" to remove the page style
%    reference.
%    \begin{macrocode}
\renewenvironment{titlepage}{\newpage
  \setcounter{page}\@ne}{\newpage}
%</!kaart&!brief>
%    \end{macrocode}
% \end{environment}
%
%    The classes \Lopt{kulbrief} and \Lopt{kulkaart} use the command
%    "\ifthenelse" from the standard package \Lopt{ifthen} to test the
%    condition for folding marks. Other classes may want to use it too, so
%    we always load it here.
%    \begin{macrocode}
\RequirePackage{ifthen}
%    \end{macrocode}
%
% \changes{v1.4}{2005/05/12}{Require version~3 of \Lopt{kulfonts}}
%    The 22\,mm Sedes ("\sedesxxii") and the 17\,mm Sedes ("\sedesxvii")
%    are defined by the package \Lopt{kulfonts}, which we require here. The
%    other K.U.Leuven logos ("\logoAssociatie" and "\logovviiv"), if
%    needed, are also defined by this package. We require at least
%    version~3 because this is the first version to supply "\logoAssociatie".
%    Of course, these definitions are not needed if preprinted forms are used.
%    \begin{macrocode}
%<brief>\ifkul@addpre
  \RequirePackage{kulfonts}[2005/05/12]
%<brief>\fi
%    \end{macrocode}
%
%
% \section{\Lopt{kulstijl} topics}
% \subsection{Hanging text}
% \begin{macro}{\ifhangfrommargin}
%    The switch "hangfrommargin" indicates whether the command "\hangfrom"
%    puts its caption in the margin (if the switch is true) or not (if the
%    switch is false). By default it is false.
%    \begin{macrocode}
\newif\ifhangfrommargin
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\hangfrom}
%    The command "\hangfrom"\marg{caption}\marg{data} hangs the \meta{data}
%    from the \meta{caption}.
%    The starred version of the command acts as if the switch was false.
%    \begin{macrocode}
\newcommand\hangfrom{\@ifstar{\kul@hang@\hangfrommarginfalse}{%
    \kul@hang@\relax}}
%    \end{macrocode}
% \begin{macro}{\kul@hangfrom}
%    We often need "\hangfrom" with its first argument expanded
%    once, so we define the internal shortcut "\kul@hangfrom" for it.
%    \begin{macrocode}
\newcommand*\kul@hangfrom[1]{\expandafter\hangfrom\expandafter{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\printfrommargin}
%    The command "\printfrommargin"\marg{caption}\marg{data} prints
%    \meta{caption} in the margin and \meta{data} hanging from it.
%    \begin{macrocode}
\newcommand\printfrommargin{\kul@hang@\hangfrommargintrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\hangfrommakecaption}
%    The command "\hangfrommakecaption"\marg{caption} constructs the
%    caption to hang from in "\printfrommargin" as well as in "\hangfrom".
%    It is provided as a separate command, so it can be redefined in the
%    configuration files. At invocation time the switch "hangfrommargin"
%    has its correct value. The default value of the command is defined
%    here. If the \meta{caption} is inlined, the "\spacefactor" is used to
%    guess whether the \meta{caption} ended with punctuation.
%    \begin{macrocode}
\newcommand\hangfrommakecaption[1]{\ignorespaces
  \ifhangfrommargin
%<brief|verslag>    \MakeUppercase{#1}%
%<!brief&!verslag>    #1%
  \else
    #1\relax \ifhmode\ifnum\spacefactor>\@m\else :\fi \space \fi
  \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@margintextwidth}
%    The global dimen register "\kul@margintextwidth" holds the width of
%    the last line of the last text printed in the margin for faxes and memos.
%    \begin{macrocode}
%<fax|memo>\newdimen\kul@margintextwidth
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifkul@beforetext}
%    The global switch "kul@beforetext" indicates that we are in the
%    document or element preamble. This is not used in cards.
%    \begin{macrocode}
%<*!kaart>
\newif\ifkul@beforetext
\global\kul@beforetexttrue
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\starttext}
%    The command "\starttext" ends the preamble by resetting the global
%    switch "kul@beforetext".
%    \begin{macrocode}
\newcommand\starttext{\global\kul@beforetextfalse}
%</!kaart>
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@hang@}
%    The internal command "\kul@hang@"\marg{cmds}\marg{caption}\marg{data}
%    handles the "\hangfrom" command as well as the "\printfrommargin"
%    command. The first argument \meta{cmds} can contain commands to
%    change the switch "hangfrommargin" and the command
%    "\hangfrommakecaption".
%    The argument \meta{caption} contains the caption, the \meta{data} is
%    hanging of.
%    \begin{macrocode}
\newcommand\kul@hang@[3]{\par
%    \end{macrocode}
%    If the page is still empty and we are not printing cards, store the
%    command in "\kul@toks@top", else execute it inside a group, starting
%    with the commands \meta{cmds}.
%    \begin{macrocode}
%<*!kaart>
  \ifkul@beforetext
    \toks@addto\kul@toks@top{\kul@hang@{#1}{#2}{#3}}%
  \else
%</!kaart>
    \noindent
    \begingroup #1%
      \@tempdima\linewidth
%<fax|memo>      \global\kul@margintextwidth\z@
%    \end{macrocode}
%    If the \meta{caption} is empty, nothing is printed.
%    Some temporary dimension registers are used to store the depth of the
%    \meta{caption} box ("\dimen@") and of the baseline of the last line of
%    the \meta{caption} ("\dimen@ii").
%    \begin{macrocode}
      \def\reserved@a{#2}\ifx\reserved@a\@empty
        \dimen@\z@ \dimen@ii\z@
      \else
%    \end{macrocode}
%    If the non-empty \meta{caption} hangs from the margin, it is printed
%    in the margin at the appropriate place. If the text is larger than
%    "\marginparwidth", it is split over several lines, but it aligns with
%    the top line.
%    \begin{macrocode}
        \ifhangfrommargin
          \setbox\@tempboxa\hbox{%
            \parbox[t]\marginparwidth{\raggedleft\marginfont
              \hangfrommakecaption{#2}\par
              \global\dimen@i\prevdepth}}%
          \dimen@\dp\@tempboxa
          \dimen@ii\dimen@
          \ifdim\dimen@i>\z@ \advance\dimen@ii -\dimen@i \fi
%    \end{macrocode}
%    For faxes and memos, the width of the last line of the text is saved
%    in the global dimension "\kul@margintextwidth". This is only possible
%    if the margin text ends with real text and not vertical mode material
%    or "\special"s (e.g., color information).
%    \begin{macrocode}
%<*fax|memo>
          \begingroup
            \setbox\z@\hbox{\unhcopy\@tempboxa
              \setbox\z@\lastbox
              \ifvbox\z@ \setbox\z@\vbox{\unvbox\z@
                \setbox\z@\lastbox
                \ifhbox\z@
                  \setbox\z@\hbox{\unhbox\z@}%
                  \global\kul@margintextwidth\wd\z@
                \fi}%
              \fi}%
          \endgroup
%</fax|memo>
          \llap{\unhbox\@tempboxa \hskip\marginparsep}%
        \else
%    \end{macrocode}
%    If the \meta{caption} doesn't hang from the margin, we assume that its
%    width is smaller than the width a line.
%    \begin{macrocode}
          \setbox\@tempboxa\hbox{\color@begingroup
            \hangfrommakecaption{#2}\color@endgroup}%
          \dimen@\dp\@tempboxa \dimen@ii\z@
          \advance\@tempdima-\wd\@tempboxa
          \box\@tempboxa
        \fi
      \fi
%    \end{macrocode}
%    The command "\parbox" is used to inhibit page breaking and allow for
%    alignment with parboxes in the margin. We also set the depth of the
%    line for line breaking purposes to the correct value: if $d_i$ is the
%    depth of box $i$ on a line and $l_i$ is the depth of the last line in
%    that box, then the apparent depth of the line ("\prevdepth") is set to
%    $\max_i(d_i) - \max_i(d_i - \max(0,l_i))$.
%    \begin{macrocode}
      \setbox\@tempboxa\hbox{\parbox[t]\@tempdima{#3\par
          \global\dimen@i\prevdepth}}%
      \@tempdimb\dp\@tempboxa
      \@tempdima\ifdim\@tempdimb>\dimen@ \@tempdimb \else \dimen@ \fi
      \ifdim\dimen@i>\z@ \advance\@tempdimb -\dimen@i \fi
      \advance\@tempdima -\ifdim\@tempdimb>\dimen@ii
        \@tempdimb \else \dimen@ii \fi
      \unhbox\@tempboxa \par
      \prevdepth\@tempdima
    \endgroup
%<!kaart>  \fi
  }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@line}
%    The command "\kul@line" prints a full width 1\,pt line, going into the
%    left margin by an amount "\kul@margintextwidth" + "\marginparsep". 
%    Above and below the line some appropriate spacing is provided.
%    This internal command is only available for faxes and memos.
%    \begin{macrocode}
%<*fax|memo>
\newcommand\kul@line{%
  \vskip\dp\strutbox
  \nointerlineskip
  \hbox{%
    \ifdim\kul@margintextwidth>\z@
      \@tempdima\kul@margintextwidth
      \advance\@tempdima\marginparsep
      \hskip -\@tempdima
      \advance\linewidth\@tempdima
    \fi
    \vrule \@width\linewidth \@height\p@}%
  \nointerlineskip}
%</fax|memo>
%    \end{macrocode}
% \end{macro}
%
%    Next we define the commands, that are defined using the "\hangfrom"
%    command.
% \begin{macro}{\encl}
% \begin{macro}{\enclname}
%    The command "\encl"\meta{encl} hangs \meta{encl} from variable
%    "\enclname". Depending on the state of the switch "hangfrommargin",
%    "\enclname" is printed in the margin or not.
%    This command already exists for letters, so it must be redefined in
%    that case. It is not available in the \Lopt{kulkaart} class.
%    \begin{macrocode}
%<*!kaart>
%<brief>\renewcommand\encl{%
%<!brief>\newcommand\encl{%
  \kul@hangfrom\enclname}
%<brief>\renewvar\enclname[Bijlage(n)]
%<!brief>\newvar\enclname[Bijlage(n)]
%</!kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsection{\Lopt{kulstijl} topics}
%    Topics are a combination of variables and hanging text. They can be
%    used in all \Lopt{kulstijl} classes, except for the \Lopt{kulkaart}
%    class.
% \begin{macro}{\kul@toks@top}
%    The token register "\kul@toks@top" stores the commands to be executed
%    at the top of the first page.
%    \begin{macrocode}
%<*!kaart>
\newtoks\kul@toks@top
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\newtopic}
%    The command "\newtopic"\margcs{topic}\oarg{name} defines a new
%    \metacs{topic}. The optional argument initializes
%    \metacs{topic}"name" and defaults to nothing.
%    \begin{macrocode}
\newcommand\newtopic{\@ifstar\kul@snewtopic\kul@newtopic}
%    \end{macrocode}
% \begin{macro}{\kul@newtopic}
%    The internal command "\kul@newtopic"\margcs{topic} implements
%    the non-starred version of "\newtopic". It adds
%    "\printtopic"\metacs{topic} to "\kul@toks@top" before calling
%    "\kul@snewtopic" to do the rest.
%    \begin{macrocode}
\newcommand*\kul@newtopic[1]{%
  \toks@addto\kul@toks@top{\printtopic #1}%
  \kul@snewtopic #1}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@snewtopic}
%    The internal command "\kul@snewtopic"\margcs{topic} implements
%    the starred version of "\newtopic". It creates a new variable
%    \metacs{topic}"data", set with \metacs{topic}. This
%    variable is undefined again.
%    It warns the user if the contents of \metacs{topic}"name" will
%    be overridden.
%    \begin{macrocode}
\newcommand*\kul@snewtopic[1]{%
  \expandafter\newvar\expandafter[\expandafter #1\expandafter]%
    \csname\kul@noesc #1data\endcsname
  \expandafter\undefine\csname\kul@noesc #1data\endcsname
  \@ifundefined{\kul@noesc #1name}{%
    \expandafter\newvar\csname\kul@noesc #1name\endcsname}{%
    \kul@optarg{\ClassWarning\CurrentClass{%
        Contents of variable \string #1name replaced}%
      \expandafter\setvar\csname\kul@noesc #1name\endcsname}{}{}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\printtopic}
%    The command "\printtopic"\margcs{topic} prints the contents of
%    the variable \metacs{topic}"data", hanging from
%    \metacs{topic}"name". If the contents is undefined, nothing is
%    printed.
%    \begin{macrocode}
\newcommand*\printtopic[1]{%
  \@ifundefined{\kul@noesc #1data}\relax{\expandafter
    \kul@hangfrom\csname\kul@noesc #1name\endcsname{%
      \csname\kul@noesc #1data\endcsname}}}
%    \end{macrocode}
% \end{macro}
%
%    Now we define the standard topics in the correct order, so they are
%    printed in this order at the top of the first page.
% \begin{macro}{\ourreference}
% \begin{macro}{\ourreferencedata}
% \begin{macro}{\ourreferencename}
%    The topic command "\ourreference"\marg{reference} stores the
%    \meta{reference} in the variable "\ourreferencedata". When printed, the
%    \meta{reference} hangs from "\ourreferencename".
%    \begin{macrocode}
\newtopic\ourreference[Ons kenmerk]
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\yourreference}
% \begin{macro}{\yourreferencedata}
% \begin{macro}{\yourreferencename}
%    The topic command "\yourreference"\marg{reference} stores the
%    \meta{reference} in the variable "\yourreferencedata". When printed, the
%    \meta{reference} hangs from "\yourreferencename".\\
%    This topic is not available in the \Lopt{kulverslag} class.
%    \begin{macrocode}
%<!verslag>\newtopic\yourreference[Uw kenmerk]
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\headdate}
% \begin{macro}{\headdatedata}
% \begin{macro}{\headdatename}
%    The topic command "\headdate"\marg{date} stores the \meta{date} in the
%    variable "\headdatedata". When printed, the \meta{date} hangs from
%    "\headdatename". By default the \meta{date} is the date defined by
%    "\date", which is stored in "\@date". The default "\headdatename" is
%    the same as "\datename".
%    \begin{macrocode}
\newtopic\headdate[\datename]
\headdate{\@date}
%    \end{macrocode}
% \begin{macro}{\datename}
%    The variable "\datename" holds the string to print before a date.
%    \begin{macrocode}
\newvar\datename[Datum]
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\subject}
% \begin{macro}{\subjectdata}
% \begin{macro}{\subjectname}
%    The topic command "\subject"\marg{subject} stores the \meta{subject}
%    in the variable "\subjectdata". When printed, the \meta{subject} hangs
%    from "\subjectname".
%    \begin{macrocode}
\newtopic\subject[Betreft]
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%    For letters we reset "\kul@toks@top" because the above topics are
%    already printed by "\kulbrief@top".
%    \begin{macrocode}
%<brief>\kul@toks@top{}
%    \end{macrocode}
% \begin{macro}{\cc}
% \begin{macro}{\ccdata}
% \begin{macro}{\ccname}
%    The topic command "\cc"\marg{cc} stores the names of \meta{cc}ed
%    persons in the variable "\ccdata". When printed, these names hangs from
%    "\ccname".\\
%    This topic is only defined for memos.
%    \begin{macrocode}
%<memo>\newtopic\cc[Cc]
%    \end{macrocode}
%    For other classes, the command "\cc"\marg{cc} is defined to hang the
%    names of \meta{cc}ed persons from "\ccname". Because these commands
%    are already defined in the \Lopt{letter} class, we have to redefine
%    them for letters.
%    \begin{macrocode}
%<*brief>
\renewcommand\cc{\kul@hangfrom\ccname}
\renewvar\ccname[Cc]
%</brief>
%<*!brief&!memo>
\newcommand\cc{\kul@hangfrom\ccname}
\newvar\ccname[Cc]
%</!brief&!memo>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\status}
% \begin{macro}{\statusdata}
% \begin{macro}{\statusname}
%    The topic command "\status"\marg{status} stores the \meta{status} in
%    the variable "\statusdata". When printed, the \meta{status} hangs from
%    "\statusname".\\
%    This topic is only defined for memos.
%    \begin{macrocode}
%<memo>\newtopic\status[Status]
%</!kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \section{\Lopt{kulstijl} declarations}
%    The declarations define information about the sender, the addressee
%    and the layout. The first category is usually common to all classes,
%    so they are normally put in the common initialization files. The last
%    category is more class specific, so they can be placed in the class
%    specific part of the initialization files. The second category is
%    usually document file specific.
% \subsection{Sender information}
%    This is usually common information, so all declarations are defined in
%    all classes, even if there information is never used, so they can be
%    put in the common initialization files.
%
%    If variables are already defined by the \Lopt{letter} class, we borrow
%    the names for the commands and the variables from it. To guarantee
%    consistency, we redefine these variables for the \Lopt{letter} class.
%
% \begin{macro}{\name}
% \begin{macro}{\fromname}
%    The variable "\fromname" is set by the command "\name"\marg{name} and
%    it contains the \meta{name} to be used for the first page footer.
%    \begin{macrocode}
%<!brief>\newvar[\name]\fromname
%<brief>\renewvar[\name]\fromname
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\profession}
% \begin{macro}{\fromprofession}
% \begin{macro}{\fromprofessionlong}
%    The user command "\profession"\oarg{long}\marg{short} lets you store
%    the profession of the sender. The \meta{short} version is stored in the
%    variable "\fromprofession", and the \meta{long} version, which
%    defaults to the \meta{short} one, is stored in the variable
%    "\fromprofessionlong". Normally the \meta{short} version is appended
%    to the name, and the \meta{long} version is used on business cards.
%    \begin{macrocode}
\newcommand\profession{\@dblarg\kul@prof}
\newvar\fromprofession
\newvar\fromprofessionlong
%    \end{macrocode}
% \begin{macro}{\kul@prof}
%    The internal command "\kul@prof" actually stores the data in the
%    variables.
%    \begin{macrocode}
\@ifdefinable\kul@prof{\def\kul@prof[#1]#2{%
    \setvar\fromprofession{#2}\setvar\fromprofessionlong{#1}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\signature}
%    The user command "\signature"\marg{name} stores the \meta{name} to put
%    below the signature in letters or the \meta{name} next to
%    "\headfromname" in other classes. It is extended with a starred
%    version "\signature*"\label{def:signature*}, which adds additional
%    signatures to the right of or below the previous signatures. Each
%    invocation of the non-starred version clears the list of signatures,
%    stored in "\kul@sigtoks".
%    For letters it is redefined, for other classes it is simply defined.
%    For cards, it simply gobbles \meta{name} without storing it.
%    \begin{macrocode}
%<brief>\renewcommand\signature{%
%<!brief>\newcommand\signature{%
%<kaart>  \@ifstar\@gobble\@gobble}
%<*!kaart>
  \@ifstar\kul@addsig{\kul@sigtoks{}\kul@addsig}}
%    \end{macrocode}
% \begin{macro}{\kul@sigtoks}
%    The signatures are stored in the internal token register "\kul@sigtoks".
%    \begin{macrocode}
\newtoks\kul@sigtoks
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@addsig}
%    The command "\kul@addsig" adds signatures by storing them in the
%    token register "\kul@sigtoks". The first signature is also stored in
%    variable "\fromsig" for compatibility.
%    \begin{macrocode}
\newcommand\kul@addsig[1]{\toks@addto\kul@sigtoks{\kul@elt{#1}}%
  \def\kul@elt{\let\kul@elt\@gobble \setvar\fromsig}\the\kul@sigtoks}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fromsig}
%    The first signature data is stored in the variable "\fromsig", just as
%    in the \Lopt{letter} class.
%    \begin{macrocode}
%<brief>\renewvar\fromsig
%<!brief>\newvar\fromsig
%</!kaart>
%    \end{macrocode}
% \end{macro}
%    The default signature is the name.
%    \begin{macrocode}
\signature{\fromname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\address}
% \begin{macro}{\fromaddress}
%    The variable "\fromaddress" is set by the command
%    "\address"\allowbreak \marg{address} and it contains the full
%    \meta{address} to be used for the left header on the first page.
%    \begin{macrocode}
%<!brief>\newvar[\address]\fromaddress
%<brief>\renewvar[\address]\fromaddress
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\location}
% \begin{macro}{\fromlocation}
%    The variable "\fromlocation" is set by the command
%    "\location"\allowbreak \marg{location} and it contains your
%    \meta{location}.
%    \begin{macrocode}
%<!brief&!verslag>\newvar[\location]\fromlocation
%    \end{macrocode}
%    For letters and reports the command "\location" also stores the
%    \meta{location} information in "\headdatename". This means we have to
%    redefine the command for letters.
%    \begin{macrocode}
%<*brief|verslag>
%<brief>\renewvar\fromlocation
%<!brief>\newvar\fromlocation
%<brief>\renewcommand\location[1]{%
%<!brief>\newcommand\location[1]{%
  \setvar\fromlocation{#1}%
  \ifx\fromlocation\@empty
    \setvar\headdatename{}%
  \else
    \setvar\headdatename{#1,}%
  \fi}
%</brief|verslag>
%    \end{macrocode}
% \end{macro}
%    The default location is ``Leuven''.
%    \begin{macrocode}
\location{Leuven}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\telephone}
% \begin{macro}{\telephonenum}
%    The variable "\telephonenum" is set by the command
%    "\telephone"\allowbreak \marg{telephone number} and it contains your
%    \meta{telephone number}. 
%    \begin{macrocode}
%<!brief>\newvar[\telephone]\telephonenum
%<brief>\renewvar[\telephone]\telephonenum
%    \end{macrocode}
% \begin{macro}{\telephonenumber}
%    The command "\telephonenumber" is an alias for "\telephone" for
%    consistency with "\faxnumber".
%    \begin{macrocode}
\let\telephonenumber\telephone
%    \end{macrocode}
% \end{macro}
%    The default telephone number is the general telephone number of the
%    K.U.Leuven.
%    \begin{macrocode}
\telephone{(016) 32\,11\,11}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\faxnumber}
% \begin{macro}{\faxnum}
%    The variable "\faxnum" is set by the command "\faxnumber"\allowbreak
%    \marg{fax number} and it contains your \meta{fax number}.
%    \begin{macrocode}
\newvar[\faxnumber]\faxnum
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\email}
% \begin{macro}{\fromemail}
%    The variable "\fromemail" is set by the command "\email"\allowbreak
%    \marg{address} and it contains your e-mail \meta{address}.
%    \begin{macrocode}
\newvar[\email]\fromemail
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\fromwww}
% \changes{v1.2}{2000/03/14}{New variable for the WWW address}
%    The variable "\fromwww" stores the WWW~address of the sender.
%    \begin{macrocode}
\newvar\fromwww
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\www}
% \changes{v1.2}{2000/03/14}{New command to store the WWW address}
%    The variable "\fromwww" is set by the command "\www"\allowbreak
%    \marg{address}. We make sure that the character `"~"' has the
%    catergory code ``other'' before reading the argument with the command
%    "\kul@endwww".
%    \begin{macrocode}
\newcommand*\www{\bgroup \catcode`\~=12 \kul@endwww}
%    \end{macrocode}
% \begin{macro}{\kul@endwww}
%    The command "\kul@endwww" restores the catcodes and saves the value in
%    the variable "\fromwww".
%    \begin{macrocode}
\def\kul@endwww#1{\egroup \setvar\fromwww{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Addressee information}
%    This information is file specific, so it is only defined for the
%    classes that need it. None of these are normally needed for the
%    \Lopt{kulverslag} or the \Lopt{kulkaart} class.
%
% \begin{macro}{\toname}
%    The global variable "\toname" gets the name from the selected addressee.
%    By default, the selected addressee is the first one.
%    \begin{macrocode}
%<*!verslag&!kaart>
\newvar\toname
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\toaddress}
%    The global variable "\toaddress" stores the address from the selected
%    addressee.
%    \begin{macrocode}
\newvar\toaddress
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tofulladdress}
%    The global variable "\tofulladdress" stores the combined name and address
%    from the selected addressee.
%    \begin{macrocode}
\newvar\tofulladdress
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\totelephonenum}
%    The global variable "\totelephonenum" stores the telephone number from the
%    selected addressee.
%    \begin{macrocode}
\newvar\totelephonenum
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tofaxnum}
%    The global variable "\tofaxnum" stores the fax number from the
%    selected addressee.
%    \begin{macrocode}
\newvar\tofaxnum
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\toemail}
%    The global variable "\toemail" stores the e-mail address from the selected
%    addressee.
%    \begin{macrocode}
\newvar\toemail
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\toother}
%    The global variable "\toother" stores the other address information
%    from the selected addressee.
%    \begin{macrocode}
\newvar\toother
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@tolist}
%    The token register "\kul@tolist" holds the list of addressee
%    information. The first parameter of each list element holds the name
%    of the addressee, the second one his address, the third one his
%    telephone number, the fourth one his fax number, the fifth one its
%    e-mail address, and the sixth one other information.
%    \begin{macrocode}
\newtoks\kul@tolist
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@tolist@gobble}
%    The command "\kul@tolist@gobble" gobbles all parameters of an item
%    ("\kul@elt" can be "\let" to it).
%    \begin{macrocode}
\newcommand\kul@tolist@gobble[6]{}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@tolist@ne}
%    The command "\kul@tolist@ne"\marg{aftercmds}\marg{name}\allowbreak
%    \marg{address}\allowbreak\marg{tel}\allowbreak\marg{fax}\allowbreak
%    \marg{email}\allowbreak\marg{other} defines the variables with
%    addressee information (store \meta{name} in variable "\toname",
%    \ldots). Then it executes the commands \meta{aftercmds}.
%    \begin{macrocode}
\newcommand\kul@tolist@ne[7]{%
  \global\setvar\toname{#2}%
  \global\setvar\toaddress{#3}%
  \ifx\toaddress\@empty
    \global\setvar\tofulladdress{#2}%
  \else
    \global\setvar\tofulladdress{#2\\#3}%
  \fi
  \global\setvar\totelephonenum{#4}%
  \global\setvar\tofaxnum{#5}%
  \global\setvar\toemail{#6}%
  \global\setvar\toother{#7}%
  #1}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\selectaddressee}
%    The command "\selectaddressee"\marg{listnum} selects addressee number
%    \meta{listnum} (starting at 1) and sets its variables, initialized empty.
%    \begin{macrocode}
\newcommand*\selectaddressee[1]{%
  \begingroup
    \kul@tolist@ne\relax{}{}{}{}{}{}%
    \count@ #1\relax
    \def\kul@elt{\advance\count@\m@ne
      \ifnum\count@=\z@
        \expandafter\kul@tolist@ne\expandafter\relax \else
        \expandafter\kul@tolist@gobble \fi}%
    \the\kul@tolist
  \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\foreachaddressee}
%    The command "\foreachaddressee"\marg{pre}\marg{cmds}\marg{post}
%    first executes the \meta{pre} commands. Then for each addressee, it
%    sets the global address variables and then executes the commands
%    \meta{cmds}. Finally the \meta{post} commands are executed and the
%    global address variables are restored to the first addressee. If no
%    addressees are available, nothing is executed.
%    \begin{macrocode}
\newcommand\foreachaddressee[3]{%
  \edef\reserved@a{\the\kul@tolist}\ifx\reserved@a\@empty\else
    \def\kul@elt{\kul@tolist@ne{#2}}%
    #1\the\kul@tolist #3%
    \selectaddressee\@ne
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\sendt@}
%    The internal command "\sendt@"\margcs{sendto}\allowbreak
%    \marg{address}\allowbreak \marg{tel}\allowbreak \marg{fax}\allowbreak
%    \marg{email}\allowbreak \marg{other} stores the address information in
%    the token register "\kul@tolist". The first argument
%    \metacs{sendto} must be a control sequence. The third argument
%    \meta{address} is split (and stored in "\kul@tolist") by
%    "\kul@processaddress".
%    \begin{macrocode}
\newcommand\sendt@[6]{%
  \kul@processaddress #2\\\@nnil
  \toks@addto\kul@tolist{{#3}{#4}{#5}{#6}}%
%    \end{macrocode}
%    Special care must be taken because we use the alignment character
%    `"&"'. This implies that "\sendt@" cannot be used in a tabular or
%    array environment. Furthermore we have to guarantee that no internal
%    variables (e.g., of "\@ifnextchar") are let to the alignment
%    character, because this can cause trouble at the next invocation of
%    "\@ifnextchar" inside an alignment. This gives no problem since both
%    arguments use "\@ifnextchar" again (assuming that "\kul@nxtadd" also
%    uses "\@ifnextchar"). If this was apparently the last address, call
%    the hook "\aftersendto".
%    \begin{macrocode}
  \@ifnextchar &{\kul@nxtadd #1}{\@ifnextchar #1\relax\aftersendto}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@nxtadd}
%    The internal command "\kul@nxtadd"\margcs{sendto}"&" gets the
%    next address. This is done by replacing "&" by \metacs{sendto}
%    unless the "&" is followed by \metacs{sendto}, "\sendto" or "\relax".
%    \begin{macrocode}
\@ifdefinable\kul@nxtadd{\def\kul@nxtadd #1&{%
    \@ifnextchar #1{}{\@ifnextchar\sendto{}{%
        \@ifnextchar\relax{}#1}}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\aftersendto}
%    The hook command "\aftersendto" can be used to set switches depending
%    on the address information. By default it is used to select the first
%    addressee again.
%    \begin{macrocode}
\newcommand\aftersendto{\selectaddressee\@ne}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@processaddress}
%    The command "\kul@processaddress" separates the name from the rest of
%    the address.
%    \begin{macrocode}
\@ifdefinable\kul@processaddress{%
  \long\def\kul@processaddress#1\\#2\@nnil{%
    \toks@addto\kul@tolist{\kul@elt{#1}}%
    \def\reserved@a{#2}\ifx\reserved@a\@empty
      \toks@addto\kul@tolist{{}}%
    \else
      \kul@processaddress@ #2\@nnil
    \fi}}
%    \end{macrocode}
% \begin{macro}{\kul@processaddress@}
%    The internal command "\kul@processaddress@" strips the trailing "\\"
%    from its argument.
%    \begin{macrocode}
\@ifdefinable\kul@processaddress@{%
  \long\def\kul@processaddress@#1\\\@nnil{%
    \toks@addto\kul@tolist{{#1}}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\sendto}
%    The command "\sendto"\marg{address}\allowbreak \marg{tel}\allowbreak
%    \marg{fax}\allowbreak \marg{email}\allowbreak \oarg{other} is the
%    generic command to store address information.
%    \begin{macrocode}
\newcommand\sendto[4]{\kul@optarg{%
    \sendt@\sendto{#1}{#2}{#3}{#4}}{%
    \sendt@\sendto{#1}{#2}{#3}{#4}{}}{}}
%</!verslag&!kaart>
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\letterto}
%    The command "\letterto"\oarg{other}\marg{address} stores the address
%    information in letters. The optional argument \meta{other} is
%    typically used for information such as ``Huispost'', \ldots
%    \begin{macrocode}
%<brief>\newcommand\letterto[2][]{\sendt@\letterto{#2}{}{}{}{#1}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\faxto}
%    The command "\faxto"\oarg{tel}\marg{fax}\marg{address} stores the
%    address information in faxes.
%    \begin{macrocode}
%<fax>\newcommand\faxto[3][]{\sendt@\faxto{#3}{#1}{#2}{}{}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\memoto}
%    The command "\memoto"\marg{address} stores the address information in
%    memos.
%    \begin{macrocode}
%<memo>\newcommand\memoto[1]{\sendt@\memoto{#1}{}{}{}{}}
%    \end{macrocode}
% \end{macro}
%
%    Finally we declare some variables related to addressee information.
% \begin{macro}{\headfromname}
%    The variable "\headfromname" contains the string to be printed before
%    the name in the header of faxes and memos.
%    \begin{macrocode}
%<*fax|memo>
\newvar\headfromname[Van]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\headtoname}
%    The variable "\headtoname" contains the string to be printed before
%    the name of the addressee on the first page for faxes and memos.
%    \begin{macrocode}
\newvar\headtoname[Aan]
%</fax|memo>
%    \end{macrocode}
% \end{macro}
%
% \subsection{Layout declarations}
%    These layout declarations are usually common to all documents of the
%    same class. Therefore, they can be placed in the class specific parts
%    of the initialization files.
%
% \begin{macro}{\firstheadtitle}
%    The declaration "\firstheadtitle"\marg{title} declares the
%    \meta{title} to be printed in the header of the first page for all
%    classes except letters and cards. When we store the \meta{title}
%    in the variable "\firstheadtitledata", we put an "\@empty" before the
%    \meta{title} because the first token in this variable will be expanded
%    if used.
%    \begin{macrocode}
%<*!brief&!kaart>
\newcommand\firstheadtitle[1]{\setvar\firstheadtitledata{\@empty #1}}
%    \end{macrocode}
% \begin{macro}{\firstheadtitledata}
%    The data is stored in the variable "\firstheadtitledata". The first
%    token in this variable will be expanded if used. This allows us to use
%    the default values, changed by the \Lopt{babel} package, as long as
%    the user has not specified a \meta{title} himself.
%    \begin{macrocode}
\newvar\firstheadtitledata[%
%<fax>  \firstheadtitlefax
%<memo>  \firstheadtitlememo
%<verslag>  \firstheadtitlereport
  ]
%    \end{macrocode}
% \begin{macro}{\firstheadtitlefax}
%    The variable "\firstheadtitlefax" holds the default \meta{title} for a
%    fax.
%    \begin{macrocode}
%<fax>\newvar\firstheadtitlefax[VOORBLAD FAX]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\firstheadtitlememo}
%    The variable "\firstheadtitlememo" holds the default \meta{title} for a
%    memo.
%    \begin{macrocode}
%<memo>\newvar\firstheadtitlememo[MEMO]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\firstheadtitlereport}
%    The variable "\firstheadtitlereport" holds the default \meta{title}
%    for a report.
%    \begin{macrocode}
%<verslag>\newvar\firstheadtitlereport[VERSLAG]
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\firstheadtitleboxsep}
%    The variable "\firstheadtitleboxsep" holds the rigid length between
%    the text and the border for the head title of the first page. This
%    implies that it can refer to other dimensions (e.g., "\fboxsep") and
%    is evaluated only at time of execution. The initial value is 2\,mm.
%    Of course, it has only effect if the \Lopt{color} package is used.
%    \begin{macrocode}
\newvar\firstheadtitleboxsep[2mm]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@firstheadtitle}
%    The command "\kul@firstheadtitle" prints the "\firstheadtitledata" as
%    intelligent as possible. If the \Lopt{color} package is loaded and the
%    colors "black" and "white" are defined, the title is printed
%    white-on-black. Actually it should be with background and foreground
%    colors switched, but there is no way to know these colors, so I assume
%    that the current background color is white.
%    \begin{macrocode}
\newcommand\kul@firstheadtitle{%
  \begingroup
    \@ifundefined{colorbox}\@tempswafalse{%
      \@ifundefined{\string\color @black}\@tempswafalse{%
        \@ifundefined{\string\color @white}\@tempswafalse
          \@tempswatrue}}%
    \if@tempswa
      \setlength\fboxsep\firstheadtitleboxsep
      \colorbox{black}{\textcolor{white}\printfirstheadtitle}%
    \else
%    \end{macrocode}
%    With the command "\kulfontinversetext" from the package
%    \Lopt{kulfonts} the white-on-black \meta{title} is inserted
%    (regardless of the actual formatting specified in
%    "\printfirstheadtitle") with a fall-back text given by
%    "\printfirstheadtitle". The additional hacking here makes sure that
%    "\firstheadtitledata" is expanded once and its first element once extra.
%    \begin{macrocode}
      \def\reserved@a{\kulfontinversetext[\printfirstheadtitle]}%
      \expandafter\expandafter\expandafter\reserved@a\expandafter
        \expandafter\expandafter{\firstheadtitledata}%
    \fi
  \endgroup}
%    \end{macrocode}
% \begin{macro}{\printfirstheadtitle}
%    The command "\printfirstheadtitle" prints the "\firstheadtitledata".
%    It can be redefined by the user if needed. We use "\linestack" to get
%    rid of the  strut, so the coloring rectangle is smaller.
%    \begin{macrocode}
\newcommand\printfirstheadtitle{\textbf{\Large
    \linestack[b]\firstheadtitledata}}
%</!brief&!kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \section{Document Layout}
% \subsection{Fonts}
% \begin{macro}{\rm}
% \begin{macro}{\tt}
% \begin{macro}{\sf}
% \begin{macro}{\bf}
% \begin{macro}{\sl}
% \begin{macro}{\it}
% \begin{macro}{\sc}
%    Since \Lopt{kulkaart} doesn't build upon another class, it has to
%    initialize the font commands itself. These definitions are borrowed
%    from the \Lopt{article} class.
%    \begin{macrocode}
%<*kaart>
\input{size1\@ptsize.clo}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}\mathrm
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}\mathsf
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}\mathtt
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}\mathbf
\DeclareOldFontCommand{\it}{\normalfont\itshape }\mathit
\DeclareOldFontCommand{\sl}{\normalfont\slshape }\relax
\DeclareOldFontCommand{\sc}{\normalfont\scshape }\relax
%</kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\familydefault}
%    We leave the font selection to external packages and we don't make any
%    assumptions on the available fonts here, except that they have a sans
%    serif family. We select the sans serif family by default, except for
%    reports.
%    \begin{macrocode}
%<!verslag>\renewcommand\familydefault{\sfdefault}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\preprintfont}
%    The command "\preprintfont" is a shorthand for selecting the sans serif
%    font for the header and footer at the correct size, even if another
%    family is used as main font. It scales with the requested typesetting
%    point size, except for cards. The user can change all these defaults
%    with the command "\preprintfontdefaults" if needed.
%    \begin{macrocode}
\newcommand\preprintfont{\def\bfdefault{sb}%
  \fontfamily\sfdefault \fontseries{sl}\fontshape\updefault
  \expandafter\fontsize
%<!kaart>    \ifcase\@ptsize{7}{7.5}\or 8{8.5}\else 9{9.5}\fi
%<kaart>    \ifkul@businesscard 6{6.5}\else 7{7.5}\fi
  \preprintfontdefaults
%    \end{macrocode}
%    The selected series for this font is "sl" and its bold version "sb"
%    (or the ones defined by the user in "\preprintfontdefaults"). If
%    they don't exist these are respectively substituted by "l" or the
%    default and "b" or "bx". Before we test if they exist, make sure the
%    font shape information is loaded. This is done by
%    "\try@load@fontshape", which must be enclosed in a group because it
%    changes catcodes.
%    \begin{macrocode}
  \begingroup \try@load@fontshape \endgroup
  \edef\bfdefault{\kul@ifnotseries\bfdefault{%
      \kul@ifnotseries b{bx}}}%
  \edef\mddefault{\kul@ifnotseries\f@series{%
      \kul@ifnotseries l\seriesdefault}}%
%    \end{macrocode}
%    Before selecting the font, make sure an existing series is selected.
%    \begin{macrocode}
  \fontseries\mddefault
  \selectfont}
%    \end{macrocode}
% \begin{macro}{\preprintfontdefaults}
%    The command "\preprintfontdefaults" starts off empty because all
%    defaults are incorporated in "\preprintfont".
%    \begin{macrocode}
\newcommand\preprintfontdefaults{}
%    \end{macrocode}
% \begin{macro}{\kul@ifnotseries}
%    The command "\kul@ifnotseries"\marg{default series}\marg{other series}
%    expands to \meta{default series} if it exists for the current font and
%    to \meta{other series} otherwise.
%    \begin{macrocode}
\newcommand\kul@ifnotseries[2]{\expandafter
  \ifx\csname\f@encoding/\f@family/#1/\f@shape\endcsname\relax
    #2\else #1\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\marginfont}
%    The command "\marginfont" is a shorthand for selecting the Sans Serif
%    font for the margin at the correct size, even if another family is
%    used as main font. For all classes except faxes and memos, it is the
%    same as "\preprintfont". For faxes and memos, it selects a bold Sans
%    Serif font with a normal size. This command is not available for cards.
%    \begin{macrocode}
%<*!kaart>
\newcommand\marginfont{%
%<!fax&!memo>  \preprintfont}
%<*fax|memo>
  \fontfamily\sfdefault \fontseries\bfdefault \fontshape\updefault
  \normalsize}
%</fax|memo>
%</!kaart>
%    \end{macrocode}
% \end{macro}
%
% \subsection{Page Layout}
%    All margin dimensions are measured from a point one inch from the
%    top and left-hand side of the page.
% \subsubsection{\Lopt{kulkaart} layout parameters}
% \begin{macro}{\lineskip}
% \begin{macro}{\normallineskip}
% \begin{macro}{\baselinestretch}
% \begin{macro}{\parskip}
% \begin{macro}{\parindent}
% \begin{macro}{\@lowpenalty}
% \begin{macro}{\@medpenalty}
% \begin{macro}{\@highpenalty}
%    The class \Lopt{kulkaart} is the only class that doesn't inherit
%    parameters from another class, so we have to define some basic \LaTeX\
%    page layout parameters here.
%    \begin{macrocode}
%<*kaart>
\lineskip=1pt
\normallineskip=1pt
\renewcommand\baselinestretch{}
\parskip=\z@skip
\parindent=\z@
\@lowpenalty   51
\@medpenalty  151
\@highpenalty 301
%</kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{Vertical spacing}
% \begin{macro}{\headheight}
% \begin{macro}{\headsep}
%    The height of the header is set to 24\,mm (more than the height of
%    the standard Sedes logo and approximately the height of the header if
%    Helvetica at 12\,pt is used). The distance between the bottom of the
%    header and the top of the text area is "\headsep".
%    \begin{macrocode}
%<*!kaart>
\headheight=24mm
\headsep=25pt
%</!kaart>
%    \end{macrocode}
%    For the \Lopt{kulkaart} class, we don't have a header or footer.
%    \begin{macrocode}
%<*kaart>
\headheight=\z@
\headsep=\z@
%</kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\footskip}
%    We make the distance between the footer and the body of the text the
%    same as the distance between the header and the body of the text. Then
%    we add the estimated height of the footer (8pt), except for cards.
%    \begin{macrocode}
\footskip=\headsep
%<!kaart>\advance\footskip 8pt
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Margins}
% \begin{macro}{\topmargin}
%    The top of the header starts at 16\,mm from the top of the page for
%    all classes except for \Lopt{kulkaart}, where it starts at the top of
%    the page.
%    \begin{macrocode}
\topmargin=-1in
%<!kaart>\advance\topmargin 16mm
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oddsidemargin}
%    The left text margin is fixed at 33\,mm from the left side of the
%    paper for letters and reports, at 4\,cm for faxes and memos, and at
%    0\,cm for cards.
%    \begin{macrocode}
\oddsidemargin=-1in
%<brief|verslag>\advance\oddsidemargin 33mm
%<fax|memo>\advance\oddsidemargin 4cm
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\evensidemargin}
%    Since there is no \Lopt{twoside} option, even and odd side margins are
%    equal.
%    \begin{macrocode}
\evensidemargin=\oddsidemargin
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\marginparsep}
%    The length "\marginparsep" is set to the separation between the left
%    margin and the right side of the text in the left margin. The
%    "\marginpar"\ldots parameters are irrelevant for cards.
%    \begin{macrocode}
%<*!kaart>
\marginparsep=3mm
%    \end{macrocode}
% \end{macro} 
% \begin{macro}{\marginparwidth}
%    The length "\marginparwidth" is set to the width of the left margin
%    with a additional space of "\marginparsep" at both sides.
%    \begin{macrocode}
\marginparwidth=1in
\advance\marginparwidth \oddsidemargin
\advance\marginparwidth -2\marginparsep
%</!kaart>
%    \end{macrocode}
% \end{macro} 
%
% \subsubsection{The dimension of text}
% \begin{macro}{\textheight}
%    The height of the text area (for the continuation pages) is computed
%    from the "\paperheight", the top (16\,mm) and bottom (10\,mm) paper
%    margins and the room occupied by the header. Room for a footer is also
%    provided. For cards, we use the full page.
%    \begin{macrocode}
\textheight=\paperheight
%<*!kaart>
\advance\textheight -26mm
\advance\textheight -\headheight
\advance\textheight -\headsep
\advance\textheight -\footskip
%</!kaart>
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\textwidth}
%    The width of the text area is obtained from the "\paperwidth" and the
%    left ("\oddsidemargin" + 1\,in) and right (15\,mm) paper margins. For
%    cards, we use the full page.
%    \begin{macrocode}
\textwidth=\paperwidth
%<*!kaart>
\advance\textwidth -\oddsidemargin
\advance\textwidth -1in
\advance\textwidth -15mm
%</!kaart>
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Other layout parameters}
%    Again for \Lopt{kulkaart} we need additional layout parameters because
%    they haven't been defined by another inherited class.
% \begin{macro}{\arraycolsep}
% \begin{macro}{\tabcolsep}
% \begin{macro}{\tabbingsep}
% \begin{macro}{\arrayrulewidth}
% \begin{macro}{\doublerulesep}
% \begin{macro}{\fboxsep}
% \begin{macro}{\fboxrule}
% \begin{macro}{\leftmargin}
% \begin{macro}{\leftmargini}
% \begin{macro}{\leftmarginii}
% \begin{macro}{\leftmarginiii}
% \begin{macro}{\leftmarginiv}
% \begin{macro}{\leftmarginv}
% \begin{macro}{\leftmarginvi}
% \begin{macro}{\labelsep}
% \begin{macro}{\labelwidth}
% \begin{macro}{\@beginparpenalty}
% \begin{macro}{\@endparpenalty}
% \begin{macro}{\@itempenalty}
%    These include the parameters for the environments "array", "tabular",
%    and "tabbing", and for lists (only the general list parameters are
%    provided, no "enumerate", "itemize", "description", "verse",
%    "quotation", "quote" environments are defined).
%    \begin{macrocode}
%<*kaart>
\setlength\arraycolsep{5\p@}
\setlength\tabcolsep{6\p@}
\setlength\tabbingsep{\labelsep}
\setlength\arrayrulewidth{.4\p@}
\setlength\doublerulesep{2\p@}
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}
\setlength\leftmargini  {2.5em}
\setlength\leftmarginii {2.2em}
\setlength\leftmarginiii{1.87em}
\setlength\leftmarginiv {1.7em}
\setlength\leftmarginv  {1em}
\setlength\leftmarginvi {1em}
\setlength\leftmargin   \leftmargini
\setlength  \labelsep  {5\p@}
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
%</kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Page styles}
%    The page style \pstyle{firstpage} is used on the first page and other
%    pages use the page style \pstyle{plain}.
%
%    In case you want it, the page style \pstyle{empty} is already defined
%    by \LaTeX.
% \begin{macro}{\ps@headings}
%    The page style \pstyle{headings} is also already defined for all
%    classes, except for cards. In that case it is made identical to the
%    page style \pstyle{empty}.
%    \begin{macrocode}
%<kaart>\let\ps@headings\ps@empty
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Page style for the first page}
% \begin{macro}{\ps@firstpage}
%    If the first page is preprinted, the page style of the first page is
%    \pstyle{empty}. Otherwise, the page style of the first page takes care
%    of printing the coordinates of the sender in the footer, the logo and
%    eventually the folding marks in the header.
%    The page style \pstyle{firstpage} is not defined for cards.
%    \begin{macrocode}
%<*!kaart>
%<brief>\ifkul@addpre
  \def\ps@firstpage{%
%<*!brief>
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble \let\subsectionmark\@gobble
%</!brief>
    \def\@oddhead{%
      \ifvoid\kul@firstheadbox \kul@setfirstheadbox \fi
%<brief>      \kulbrief@marks
      \box\kul@firstheadbox}\let\@evenhead\@oddhead
    \def\@oddfoot{%
      \ifvoid\kul@firstfootbox \kul@setfirstfootbox \fi
      \vbox to\z@{\vss \unvbox\kul@firstfootbox}}%
    \let\@evenfoot\@oddfoot}
%<brief>\else \let\ps@firstpage\ps@empty \fi
%</!kaart>
%    \end{macrocode}
%
% \begin{macro}{\fromaddressbottomsep}
%    The variable "\fromaddressbottomsep" holds the length of the minimum white
%    space below the "\fromaddress". By default, it is the (plain \TeX)
%    "\bigskip" spacing.
%    \begin{macrocode}
\newvar\fromaddressbottomsep[\bigskipamount]
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\deptlogo}
% \changes{v1.3}{2003/02/26}{New variable}
%    The variable "\deptlogo" stores the commands to generate the
%    departemental logo at the upper left of the first page.
%    \begin{macrocode}
\newvar\deptlogo
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@firstheadbox}
%    The global box register "\kul@firstheadbox" holds the contents of the
%    first page header until it is used. Normally the height of the box is
%    zero and its depth is the real total height $-$ "\headheight".
%    \begin{macrocode}
\newbox\kul@firstheadbox
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@setfirstheadbox}
%    The command "\kul@setfirstheadbox" prepares the first page header and
%    stores it in the global register "\kul@firstheadbox".
%    To guarantee that it starts at the correct place, a "\vtop" box is
%    used, which starts with a negative vertical skip. At the beginning of
%    the box, parameters are set to emulate a parbox environment.
%    Furthermore, the correct font "\preprintfont" and the correct color
%    are selected.
%    \begin{macrocode}
\newcommand\kul@setfirstheadbox{%
  \global\setbox\kul@firstheadbox\vtop{\color@begingroup
    \hsize\textwidth
    \@arrayparboxrestore \let\\\kul@robust@cr
    \normalcolor \preprintfont
%    \end{macrocode}
%    To start at the top of the header, an negative vertical offset of
%    "\headheight" is needed, except for cards. In addition, we skip the
%    12\,mm (for cards 10\,mm and for business cards 8\,mm), required by
%    the guidelines before the data.
%    \begin{macrocode}
%<kaart>    \@tempdima \ifkul@businesscard 8\else 10\fi mm%
%<!kaart>    \@tempdima 12mm\advance\@tempdima-\headheight
    \vskip\@tempdima
%    \end{macrocode}
%    To align the left part and right part of the header we use "\valign".
%    For letters this isn't really necessary, but it keeps the source more
%    or less the same. For other classes, it allows us to align the address
%    with the top of the logo, guarantee a minimum distance of two empty
%    lines between the address and the title from "\firstheadtitledata",
%    and if possible align "\firstheadtitledata" with the bottom of the
%    logo, without measuring anything.
%    \begin{macrocode}
    \everycr{}\tabskip\z@skip \valign{##\cr
%<kaart>      \vskip \ifkul@businesscard 1\else 2\fi mm%
%    \end{macrocode}
% \changes{v1.3}{2003/02/26}{Handle the departemental logo better}
% \changes{v1.5}{2005/05/31}{Allow for an empty departemental logo}
%    Add the departemental logo here in the margin, right aligned, except
%    on business cards.
%    \begin{macrocode}
%<*!kaart>
      \noalign{\@tempdima\marginparwidth \advance\@tempdima\marginparsep
        \hskip -\@tempdima}%
      \hsize\marginparwidth \raggedleft
      \vskip 3mm\leavevmode \deptlogo \vss \cr
      \noalign{\hskip\marginparsep}%
      \vskip 3mm%
%</!kaart>
%    \end{macrocode}
%    We protect ourselves against an empty address.
%    \begin{macrocode}
      \leavevmode \MakeUppercase{\ignorespaces \fromaddress}%
        \vspace\fromaddressbottomsep \vfil
%<!brief&!kaart>        \kul@firstheadtitle
        \cr
%    \end{macrocode}
%    Both columns fill the complete text width, so we add a negative skip
%    of this size.
%    \begin{macrocode}
      \noalign{\hskip -\hsize}%
%    \end{macrocode}
%    In the second column we put the Sedes logo at the correct size, a rule
%    and the name of our university.
%    \begin{macrocode}
      \raggedleft
%<*kaart>
      \ifkul@businesscard\sedesxvii\vskip 2\else\sedesxxii\vskip 3\fi mm%
      \expandafter\fontsize\ifkul@businesscard {7.5}{7.5}\else 99\fi
%</kaart>
%<!kaart>      \sedesxxii \vskip 3mm\fontsize99%
      \selectfont
      \nointerlineskip
%    \end{macrocode}
%    For cards, the box apparently ends below the Sedes logo.
%    \begin{macrocode}
%<kaart>        \vbox to\z@{%
          \leavevmode \vbox{\hrule \@height.5\p@
%<kaart>            \vskip \ifkul@businesscard 1\else 2\fi mm%
%<!kaart>            \vskip 2mm%
            \hbox{KATHOLIEKE}}\break
          UNIVERSITEIT\break LEUVEN%
%<kaart>          \vss}%
        \vfil \cr}%
    \color@endgroup}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kulbrief@marks}
%    Now we define the command to put the folding marks on the page for
%    letters. We assume we are at the beginning of the header. Two marks
%    are typeset: one at $(99-16)$~mm from the top of the header and one at
%    $(148.5-99)$~mm below it. Both are 3~mm long and start at 1~cm from
%    the left side of the paper (or end at 2~cm from the left text margin).
%    \begin{macrocode}
%<*brief>
\newcommand\kulbrief@marks{%
  \ifkul@addpre
    \ifthenelse\foldingmarkscondition{%
      \llap{\normalcolor
        \vbox to\z@{\@tempdima-\headheight
          \advance\@tempdima 83mm\advance\@tempdima-.2\p@
          \vskip\@tempdima \hrule\@width 3mm 
          \@tempdima 49.5mm\advance\@tempdima-.4\p@
          \vskip\@tempdima \hrule \vss}%
        \hskip 2cm}}\relax
  \fi}
%</brief>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\footlogo}
% \changes{v1.1}{2000/03/14}{New variable, defaulting to \cs{logovviiv}
%                            until the end of 2001}
% \changes{v1.4}{2005/05/12}{New default: \cs{logoAssociatie}}
%    The variable "\footlogo" stores the commands to generate the logo at
%    the lower right of the page. Until the end of the year 2001, it
%    defaulted to the anniversary logo~575. Now the logo of the
%    ``Associatie'' is used. \\
%    It is of no use for cards.
%    \begin{macrocode}
%<*!kaart>
\newvar\footlogo[\logoAssociatie]
%</!kaart>
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@firstfootbox}
%    The global box register "\kul@firstfootbox" holds the contents of the
%    first page footer until it is used.
%    \begin{macrocode}
\newbox\kul@firstfootbox
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@setfirstfootbox}
% \changes{v1.1}{2000/03/14}{Use \cs{fontlogo} if defined}
% \changes{v1.2}{2000/03/14}{Use WWW address}
%    The command "\kul@setfirstfootbox" prepares the first page footer and
%    stores it in the global register "\kul@firstfootbox". \\
%    If a logo is used in the footer, we first store it in a box to measure
%    its height into "\@tempdima". Then the logo it modified to consume no
%    space.
%    \begin{macrocode}
\newcommand*\kul@setfirstfootbox{%
%<*!kaart>
  \ifx\footlogo\@empty\else
    \setbox\@tempboxa\llap{\color@begingroup \normalcolor
      \footlogo \color@endgroup}%
    \@tempdima\ht\@tempboxa
    \ht\@tempboxa\z@ \dp\@tempboxa\z@
  \fi
%</!kaart>
%    \end{macrocode}
%    At the beginning of the box, parameters are set to emulate a parbox
%    environment. Furthermore, the correct font "\preprintfont" and the
%    correct color are selected.
%    \begin{macrocode}
  \global\setbox\kul@firstfootbox\vbox{\color@begingroup
    \hsize\textwidth
    \@arrayparboxrestore \let\\\kul@robust@cr
    \normalcolor \preprintfont
%    \begin{macrocode}
%    \end{macrocode}
%    The name, if present, is printed in bold upper case, and followed by
%    the short description of the profession. \\
%    The temporary variable "\kul@tmp" is used to store the commands to end
%    the previous line of text. If it is equal to "\relax", this indicates
%    that no name was present. \\
%    For business cards, a smaller font is selected and the name and
%    profession information is omitted. By setting "\kul@tmp" to something
%    different from "\relax", we indicate that a name is present somewhere
%    else on the card.
%    \begin{macrocode}
%<*kaart>
    \ifkul@businesscard
      \fontsize{5.5}{5.5}\selectfont
      \let\kul@tmp\@empty
    \else
%</kaart>
      \ifx\fromname\@empty
        \let\kul@tmp\relax
      \else
        \textbf{\MakeUppercase\fromname}%
        \ifx\fromprofession\@empty\else
          , \MakeUppercase\fromprofession \fi
        \def\kul@tmp{\\[.6mm]}%
      \fi
%<kaart>    \fi
%    \end{macrocode}
%    If no name is present ("\kul@tmp" = "\relax"), the telephone and fax
%    number are printed below each other, otherwise they are printed adjacent.
%    \begin{macrocode}
    \ifx\telephonenum\@empty
      \ifx\faxnum\@empty
      \else
        \kul@tmp FAX \faxnum
        \def\kul@tmp{\\}%
      \fi
    \else
      \kul@tmp
      \ifx\faxnum\@empty
        TEL. \telephonenum
      \else
        \ifx\kul@tmp\relax
          \begin{tabular}[b]{@{}l@{\space}l}%
            TEL.&\telephonenum \\FAX&\faxnum
          \end{tabular}%
        \else
          TEL. \telephonenum \quad FAX \faxnum
        \fi
      \fi
      \def\kul@tmp{\\}%
    \fi
%    \end{macrocode}
%    Finally the e-mail and WWW address are added.
%    \begin{macrocode}
    \ifx\fromemail\@empty\else
      \kul@tmp E-mail: \fromemail
      \def\kul@tmp{\\}%
    \fi
    \ifx\fromwww\@empty\else \kul@tmp \fromwww \fi
%    \end{macrocode}
%    If a logo is needed, it is added here.
%    \begin{macrocode}
%<!kaart>    \ifx\footlogo\@empty\else \hfill \box\@tempboxa \fi
    \color@endgroup}%
%    \end{macrocode}
%    If the logo was larger than the rest of the footer, adjust the height
%    of the footer box.
%    \begin{macrocode}
%<*!kaart>
  \ifx\footlogo\@empty\else
    \ifdim\@tempdima>\ht\kul@firstfootbox
      \global\ht\kul@firstfootbox\@tempdima
    \fi
  \fi
%</!kaart>
  }
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Page style for the other pages}
% \begin{macro}{\ps@plain}
%    For the other pages, the page style \pstyle{plain} is used, which is
%    redefined to fit the layout of the continuation pages (cf.\
%    "\kul@head"). It also puts a page number at the bottom right part of
%    the page for letters and reports. For cards it is identical to the
%    page style \pstyle{empty}.
%    \begin{macrocode}
%<kaart>\let\ps@plain\ps@empty
%<*!kaart>
\def\ps@plain{%
%<brief|verslag>  \def\@oddfoot{\hfill \thepage}%
%<!brief&!verslag>  \let\@oddfoot\@empty
  \let\@evenfoot\@oddfoot
  \let\@oddhead\kul@head \let\@evenhead\@oddhead
%<*!brief>
  \let\@mkboth\@gobbletwo
  \let\sectionmark\@gobble \let\subsectionmark\@gobble
%</!brief>
  }
%    \end{macrocode}
% \begin{macro}{\pagenumbername}
%    The variable "\pagenumbername" holds the string to be printed before
%    the page number on the continuation pages.
%    \begin{macrocode}
\newvar\pagenumbername[Blad nr\@.]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\headerlines}
%    The macro "\headerlines" contains the commands to execute below the
%    page number in the header. We can assume it is not used on preprinted
%    letters. The default contents of the macro includes the references and
%    the date.
%    \begin{macrocode}
\newcommand\headerlines{%
  \printtopic\ourreference
  \printtopic\yourreference
  \printtopic\headdate}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@head}
%    The command "\kul@head" prints the margin information of the
%    continuation pages, the logo and the folding marks at the correct
%    absolute position if no preprinted pages are used. In any case, it
%    prints the page number and the header lines.
%    It assumes that the current location is at the beginning of the header.
%    \begin{macrocode}
\newcommand\kul@head{%
%    \end{macrocode}
%    First of all, we put the folding marks on the page if needed.
%    \begin{macrocode}
%<brief>  \kulbrief@marks
%    \end{macrocode}
%    Next, we print the left margin information.
%    \begin{macrocode}
  \everycr{}\tabskip\z@skip
  \valign{##\vfil\cr
%    \end{macrocode}
%    The first column contains the left margin information. The use of a
%    full width "\parbox" is emulated. The distance between topics is at
%    least 12.5\,pt unless you are using preprinted forms where it is fixed
%    to 12.5\,pt. As the font for the marginal text, "\preprintfont" is used.
%    Just to make sure, we locally reset the switch "kul@beforetext".
%    \begin{macrocode}
    \hsize\textwidth \@parboxrestore
      \ifdim\baselineskip<12.5\p@
      \baselineskip 12.5\p@
%<brief>      \else \ifkul@addpre\else \baselineskip 12.5\p@ \fi
      \fi
      \let\marginfont\preprintfont
      \kul@beforetextfalse \hangfrommargintrue
%<brief>      \ifkul@addpre
        \kul@hangfrom\pagenumbername\thepage
%<brief>      \else \raisebox\z@[5\p@][\z@]\thepage \fi
      \vskip\baselineskip
%<brief>      \ifkul@addpre
        \headerlines
%<*brief>
      \else
        \noindent
        \raisebox\z@[5\p@][\z@]\ourreferencedata \newline
        \raisebox\z@[\z@][\z@]\yourreferencedata \newline
        \raisebox\z@[\z@][\z@]\headdatedata \par
      \fi
%</brief>
      \cr
    \noalign{\hss}%
%    \end{macrocode}
%    The second column contains the Sedes logo or a placeholder of the same
%    height if preprinted forms are used.
%    \begin{macrocode}
    \hbox{%
%<brief>      \ifkul@addpre
        \sedesxxii
%<brief>      \else \vrule \@width\z@ \@height 22mm\fi
      }\cr}}
%</!kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    Additionally reset the global page style again to the new version of
%    \pstyle{plain} for all classes (including \Lopt{kulkaart}).
%    \begin{macrocode}
\pagestyle{plain}
%    \end{macrocode}
%
%
% \section{Document markup for the specific classes}
% \subsection{Common commands}
% \subsubsection{Printing the first page top}
%    To allow for variables to get set before the first text, the printing
%    of the first page top is usually postponed to the moment just before
%    the first text will be typeset (using "\everypar").
%    This is not used on cards.
% \begin{macro}{\kul@allowdefs}
%    The command "\kul@allowdefs" postpones the insertion of the first page
%    top text until (or rather just before) the first text is set on the
%    page or until "\starttext" is called. This command is used at the
%    beginning of the element environment, so normally the switch
%    "kul@beforetext" is still set. 
%    \begin{macrocode}
%<*!kaart>
\newcommand\kul@allowdefs{%
%    \end{macrocode}
%    Except for faxes, we use a modified version of "\starttext" in the
%    element environment, which also prints the first page text top.
%    \begin{macrocode}
%<!fax>  \let\starttext\kul@starttext
%    \end{macrocode}
%    The command "\starttext" is also called from "\everypar". According to
%    the documentation in the base \LaTeX\ file \file{ltpar.dtx}
%    ``whenever "\everypar" is set non-null, it should restore itself to
%    null when executed,'' so we start by resetting "\everypar".
%    Furthermore, it says that ``commands that change "\everypar" should
%    remember that "\everypar" might be supposed to set the switches
%    "@nobreak" and "@minipage" false.'' Since an element should never be
%    called inside a minipage, we must only worry about the switch
%    "@nobreak". \\
%    If we are still in the element preamble, we start by removing the
%    freshly inserted indentation and the last vertical space ("\parskip")
%    before inserting the first page top text. The additional test for
%    outer horizontal mode is needed if "\the\everypar" is used in vertical
%    mode.
%    \begin{macrocode}
  \everypar{\everypar{}\@nobreakfalse
    \ifkul@beforetext
      \ifhmode\ifinner\else {\setbox\z@\lastbox}\vskip-\lastskip \fi\fi
      \starttext
    \fi}%
%    \end{macrocode}
%    Now we protect some vertical mode commands, which don't change to
%    horizontal mode but may be useful: "\vspace*" ("\null" is often used
%    to emulate "\vspace*{0pt}"), "\@trivlist", "\@xfloat" (for figures and
%    tables), and "\@@line". (Perhaps we should also use "\@nodocument" for
%    a better coverage of future errors?)
%    We assume that the user doesn't insert plain \TeX\ commands like "\hbox",
%    "\hrule" or "\halign".
%    \begin{macrocode}
  \kul@vcom\@vspacer \kul@vcom\null
  \kul@vcom\@trivlist
  \kul@vcom\@xfloat
  \kul@vcom\@@line}
%    \end{macrocode}
% \begin{macro}{\kul@vcom}
%    The internal command "\kul@vcom"\margcs{command} prepends a
%    "\starttext" command to an outer vertical mode \metacs{command}.
%    If the \metacs{command} is called in another mode or the page is
%    no longer empty, it acts as if nothing happened. The only known problem
%    occurs when \metacs{command} is used in an assignment in outer
%    vertical mode (e.g., "\setbox0\null" when the page is still empty).
%    We assume that "\kul@vcom" is only called once for a
%    \metacs{command} and that no control sequences starting with
%    "\kul@\"\ldots{} are in use.
%    \begin{macrocode}
\newcommand*\kul@vcom[1]{%
  \def\reserved@a##1{\let##1#1%
    \def#1{\ifkul@beforetext\ifvmode\ifinner\else
        \starttext \let#1##1\fi\fi\fi
      ##1}}%
  \expandafter\reserved@a\csname kul@\string #1\endcsname}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\kul@starttext}
%    The command "\kul@starttext" is the equivalent of "\starttext" inside
%    an element. In addition to ending the element preamble, it inserts the
%    first page top text. For faxes we know the exact spot where it is
%    called, so no additional error checking is necessary. For other
%    classes, it makes only sense in (inner or outer) vertical mode and
%    before the element preamble is ended, so some additional error
%    checking is provided.
%    \begin{macrocode}
\newcommand\kul@starttext{%
%<*!fax>
  \ifkul@beforetext
    \ifvmode
      \ifdim\pagetotal>\z@
        \ClassError\CurrentClass{%
          Illegal commands before the first text or \string\starttext
          }{Putting vertical mode commands before this line
          will mangle the page.\MessageBreak \kul@errhelp}%
      \fi
%</!fax>
      \global\kul@beforetextfalse
%    \end{macrocode}
%    Now follows the actual printing of the first page top text. It takes
%    into account the real depth of the header, and adjusts the page height
%    to allow for the first page footer on this page.
%    Since we are not sure when exactly this routine is called, we
%    initialize the necessary things, also resetting "\parskip" and
%    "\parindent" to zero. Therefore we enclose it in a group.
%    \begin{macrocode}
      \begingroup
        \normalfont \normalsize
        \thispagestyle{firstpage}%
        \parskip \z@skip \parindent\z@
%    \end{macrocode}
%    For all classes, except \Lopt{kulbrief}, we then measure the depth of
%    the header to add vertical glue to the beginning of the page, to
%    guarantee a separation of "\headsep" between the bottom of the header
%    and the top of the text.
%    \begin{macrocode}
%<*!brief>
        \kul@setfirstheadbox
        \@tempdima\dp\kul@firstheadbox
        \advance\@tempdima-\baselineskip
        \vspace*\@tempdima
%</!brief>
%    \end{macrocode}
%    For letters, we go to the right starting place of the address, 34\,mm
%    from the top of the header, print the address, and go to the starting
%    place of the references, 6\,mm under the address. \\
%    The address is centered vertically in the address window in the
%    envelope, but if it exceeds the window's maximum height (27\,mm), it may
%    overlap with the header and a warning is given. The width is limited
%    to 8\,cm because of the width of the window.
%    \begin{macrocode}
%<*brief>
        \@tempdima 34mm%
        \advance\@tempdima-\headheight
        \advance\@tempdima-\headsep
        \advance\@tempdima-\topskip
        \vspace*\@tempdima
        \nointerlineskip
        \settoheight\@tempdima{\parbox[b]\textwidth{%
            \normalcolor \preprintfont \let\\\kul@robust@cr
            \leavevmode \MakeUppercase{\ignorespaces \fromaddress}%
            \vspace\fromaddressbottomsep}}%
        \advance\@tempdima-46mm%
        \setbox\@tempboxa\hbox{\boxmaxdepth\z@
          \parbox[b]{8cm}{%
            \ifx\toother\@empty\else \toother\\\fi
            \tofulladdress}}%
        \advance\@tempdima\ht\@tempboxa
        \ifdim\@tempdima>\z@
          \ClassWarningNoLine\CurrentClass{The address is
            \the\@tempdima\space too high}\fi
        \vbox to27mm{\vss \unhbox\@tempboxa \vfil}%
        \vspace{6mm}%
%</brief>
%    \end{macrocode}
%    For letters and reports, the header lines are put at least 12.5\,pt
%    apart (for preprinted forms exactly 12.5\,pt).
%    \begin{macrocode}
%<*brief|verslag>
        \ifdim\baselineskip<12.5\p@
          \baselineskip 12.5\p@
%<brief>        \else \ifkul@addpre\else \baselineskip 12.5\p@ \fi
        \fi
        \nointerlineskip
%</brief|verslag>
%    \end{macrocode}
%    Topics are printed hanging from the margin.
%    \begin{macrocode}
        \hangfrommargintrue
%    \end{macrocode}
%    For faxes and memos, topics are separated by an additional 7\,pt.
%    \begin{macrocode}
%<fax|memo>        \parskip 7\p@ \vskip -\parskip
%    \end{macrocode}
%    First comes the information of the addressee for faxes and memos. They
%    use a specific command for this, so the user can define the real
%    layout of this.
%    \begin{macrocode}
%<fax>        \printfaxto
%<memo>        \printmemoto
%    \end{macrocode}
%    For letters, the header lines are printed next. For preprinted forms,
%    we make sure that the information comes at the correct location.
%    \begin{macrocode}
%<*brief>
        \ifkul@addpre
          \printtopic\ourreference
          \printtopic\yourreference
          \printtopic\headdate
        \else
          \noindent
          \raisebox\z@[5\p@][\z@]\ourreferencedata \newline
          \raisebox\z@[\z@][\z@]\yourreferencedata \newline
          \raisebox\z@[\z@][\z@]\headdatedata \par
        \fi
%</brief>
%    \end{macrocode}
%    For other classes follows the information about the sender. His
%    telephone number and fax number are not given here, because they are
%    already put at the bottom of the page. If you want them anyway, add
%    some "\hangfrom" commands in the signature.
%    \begin{macrocode}
%<*fax|memo>
        \kul@hangfrom\headfromname\fromsig
        \vskip\parskip
%</fax|memo>
%    \end{macrocode}
%    Now comes all the information we stored in "\kul@toks@top", including
%    the date where needed.
%    \begin{macrocode}
        \the\kul@toks@top
%    \end{macrocode}
%    For letters, the first page top text is concluded with the subject
%    printed in bold.
%    \begin{macrocode}
%<*brief>
        \@ifundefined{subjectdata}\relax{\vskip\baselineskip
          \kul@hang@\bfseries{}\subjectdata}%
%</brief>
%    \end{macrocode}
%    The final item of the header of a fax is the number of pages. Then we can
%    reset the page number to~1, assuming that nothing on this page until
%    now needed the page number.
%    \begin{macrocode}
%<*fax>
        \kul@hangfrom\headfaxpagesname{%
          \advance\c@page\m@ne \number\c@page}%
        \kul@setcounter{page}\@ne
%</fax>
%    \end{macrocode}
%    We conclude the header of a fax or a memo with a line. We keep it as a
%    separate command, so you can redefine it if it doesn't work for your
%    specific layout.
%    \begin{macrocode}
%<fax|memo>        \kul@line
%    \end{macrocode}
%    Next we provide space for the footer.
%    If we use preprinted letter forms, we guess that the footer contains
%    only a fax and telephone number (with a size of about 15\,pt),
%    otherwise we measure the exact height.
%    The normal separation between the bottom of the text and the top of
%    the footer is assumed to be "\footskip" $-$ 8\,pt $+$ "\firstfootsep".
%    \begin{macrocode}
%<brief>        \ifkul@addpre
          \kul@setfirstfootbox \@tempdima\ht\kul@firstfootbox
          \advance\@tempdima -8\p@
%<brief>        \else \@tempdima 7\p@ \fi
        \advance\@tempdima\firstfootsep
        \enlargethispage{-\@tempdima}%
      \endgroup
%    \end{macrocode}
%    Finally the glue below the first page top text is set, outside the
%    above group to use the correct values of "\parskip" etc.
%    \begin{macrocode}
      \@firsttexttop
%    \end{macrocode}
%    If we are not in vertical mode and not in faxes, we can't execute the
%    first page top commands, so we let the user know and throw them away.
%    \begin{macrocode}
%<*!fax>
    \else
      \ClassError\CurrentClass{%
        Illegal position of \string\starttext\space removes page top}{%
        This command can only be used in vertical mode.\MessageBreak
        \kul@errhelp}%
      \global\kul@beforetextfalse
    \fi
  \fi
%</!fax>
  }
%</!kaart>
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\firstfootsep}
%    The rigid length "\firstfootsep" gives the extra space, in addition
%    to "\footskip" $-$ 8\,pt, between the top of the footer and the bottom
%    of the regular text on the first page. It is available for cards, but
%    not used there. \\
%    This can also be used to correct the estimation made of the height of
%    the footer. If we use preprinted letter forms, we guess that the
%    footer is 15\,pt high, but this can be very wrong.
%    \begin{macrocode}
\newdimen\firstfootsep
\firstfootsep=\z@
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Stacking lines}
% \begin{macro}{\linestack}
%    The command "\linestack"\oarg{alignment}\marg{lines} creates a box
%    with the \meta{lines} stacked at the normal distance. The width of the
%    box is not larger than the largest line. As usual, the lines are
%    separated by "\\". The \meta{alignment} is either "t" (the default) or
%    "b". The alignment in each line is flush left, but if you want to
%    change it, you can add "\hfil"("l") commands at the beginning of the
%    line.
%    \begin{macrocode}
\newcommand*\linestack[2][t]{\leavevmode
  \if #1b\vbox \else \vtop \fi {\color@begingroup
      \@arrayparboxrestore
      \def\\{\@ifstar\kul@cr\kul@cr}%
      \ialign{##\unskip\hfil\cr \ignorespaces #2\cr}%
    \color@endgroup}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@cr}
%    The internal command "\kul@cr"\oarg{skip} can be used as "\\" in
%    an alignment. If \meta{skip} is given, it produces an additional
%    vertical space \meta{skip}. No starred version is available.
%    \begin{macrocode}
\newcommand\kul@cr{\@ifnextchar[\kul@cr@{\cr\ignorespaces}}
%    \end{macrocode}
% \begin{macro}{\kul@cr@}
%    The internal command "\kul@cr@" processes the optional argument of
%    "\kul@cr".
%    \begin{macrocode}
\@ifdefinable\kul@cr@{%
  \def\kul@cr@[#1]{\cr\noalign{\vskip #1}\ignorespaces}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{The salutation command}
% \begin{macro}{\opening}
%    For letters the standard "\opening" command is redefined. For other
%    classes (except \Lopt{kulkaart}), it is defined here to be used e.g.,
%    inside a "letterlike" environment. 
%    \begin{macrocode}
%<*!kaart>
%<brief>\renewcommand\opening[1]{%
%<!brief>\newcommand\opening[1]{%
  \par \normalfont
%    \end{macrocode}
%    The first "\noindent" typesets the top information and the second one
%    is used to guarantee that the opening starts at the left margin.
%    Some additional hackery is introduced to omit the "\parskip" glue.
%    \begin{macrocode}
  {\parskip\z@skip \noindent\noindent}%
  \ignorespaces #1\par\nobreak
  \vspace\parskip}
%</!kaart>
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{The closing command}
% \begin{macro}{\c@sigsperline}
% \DefineCounter{sigsperline}
%    The counter "sigsperline" holds the number of signatures that can be
%    put on one line. If it is smaller than or equal to zero, the number of
%    signatures on one line is the total number of signatures plus
%    "sigsperline" with a minimum of one.
%    \begin{macrocode}
\newcounter{sigsperline}
%    \end{macrocode}
%    "\newcounter" sets this counter to zero, which is a good default value.
% \end{macro} 
% \begin{macro}{\signaturespace}
%    The variable "\signaturespace" holds the vertical distance left for
%    a signature, defaulting to 1\,inch.
%    \begin{macrocode}
%<*!kaart>
\newvar\signaturespace[1in]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@sigwidth}
%    The internal length "\kul@sigwidth" is used to store the maximum width
%    of one signature. Normally it should not be set by the user, since it is
%    recomputed by every "\closing" command.
%    \begin{macrocode}
\newdimen\kul@sigwidth
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\closing}
%    This is a redefinition of the standard command "\closing". The closing
%    is aligned to the left margin.
%    \begin{macrocode}
%<!brief>\newcommand\closing[1]{%
%<brief>\renewcommand\closing[1]{%
  \par\nobreak\vskip\parskip
  \normalfont
%    \end{macrocode}
%    The following is a simplified version of "\stopbreaks". I want it to
%    last until after the signatures, so it is enclosed in a group.
%    \begin{macrocode}
  \begingroup
    \def\\{\vadjust{\nobreak}\kul@robust@cr}\samepage
    \noindent\ignorespaces #1\par\nobreak
%    \end{macrocode}
%    Signatures are printed with a vertical spacing of "\signaturespace" to
%    provide space for signing the letter.
%    \begin{macrocode}
    \setlength\lineskip\signaturespace \baselineskip\z@
    \parindent\z@ \parskip\z@ \parfillskip\z@skip
%    \end{macrocode}
%    Register "\count@" holds the allowed number of signatures per line.
%    If the counter "sigsperline" is larger than zero, it is equal to that
%    counter, otherwise the signatures are counted and "sigsperline" is
%    added.
%    \begin{macrocode}
    \count@\c@sigsperline
    \ifnum\c@sigsperline<\@ne
      \def\kul@elt##1{\advance\count@\@ne}\the\kul@sigtoks
    \fi
%    \end{macrocode}
%    Before printing the signature data with the command "\kul@printsig",
%    the maximum width of a single signature is set to "\kul@sigwidth".
%    \begin{macrocode}
    \kul@sigwidth\textwidth
    \ifnum\count@>\@ne \divide\kul@sigwidth\count@ \fi
    \let\kul@elt\kul@printsig \the\kul@sigtoks
    \par
  \endgroup
%    \end{macrocode}
%    Close the signature space with some extra space, ignoring the depth of
%    the last line of signatures. This extra space (including the
%    "\parskip") should be two empty lines according to the standards of
%    the Belgian Normalization Institute.
%    \begin{macrocode}
  \prevdepth\z@
  \vskip 2\baselineskip
  \vskip -\parskip}
%    \end{macrocode}
% \end{macro} 
% \begin{macro}{\kul@printsig}
%    The command "\kul@printsig" prints a single signature with a maximum
%    width of "\kul@sigwidth". This can be redefined in the configuration
%    file.
%    \begin{macrocode}
\newcommand\kul@printsig[1]{%
  \parbox[t]\kul@sigwidth{\raggedright #1}\hskip\@flushglue}
%</!kaart>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Markup for \Lopt{kulletter}}
%    The letter environment is redefined here to move the typesetting of
%    the address and references into an "\everypar". We can't typeset this
%    information now for two reasons: first of all, we may not have
%    reference information yet, and furthermore we don't want to typeset
%    anything if we have an empty "letter" environment (which makes sense
%    when we use the "\makelabels" command).
% \begin{environment}{letter}
%    The "letter" environment creates a new letter, starting from page~1.
%    The first page is unnumbered. Its arguments must be conform to the
%    format used by the "\letterto" command.
%    \begin{macrocode}
%<*brief>
\renewenvironment{letter}%
  {\newpage
    \c@page\@ne
    \interlinepenalty 200
%    \end{macrocode}
%    The printing of the additional header information is postponed to
%    allow for declarations inside this environment.
%    \begin{macrocode}
    \kul@allowdefs
%    \end{macrocode}
%    Finally read the address(es).
%    \begin{macrocode}
    \kul@nxtadd\letterto &}%
%    \end{macrocode}
%    The end of the environment is copied from the standard \Lopt{letter}
%    class, but modified to handle also multiple addressees.
%    \begin{macrocode}
  {\stopletter\par\break
    \if@filesw
      \foreachaddressee{%
        \begingroup
          \let\\\relax
          \let\protect\string}{%
          \ifx\tofulladdress\@empty\else
            \immediate\write\@auxout{%
              \string\@mlabel{\returnaddress}{\tofulladdress}}%
          \fi}%
        \endgroup
    \fi
    \global\kul@beforetexttrue}
%</brief>
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\letterlike}
%    The command "\letterlike" emulates a "letter" environment in the other
%    classes by setting the style parameters of a letter. This is a good
%    candidate for "\firstpagedefaults". Of course it is also useful as a
%    "letterlike" environment.
%    \begin{macrocode}
%<*!brief&!kaart>
\newcommand\letterlike{\raggedright
  \normalfont
  \parindent\z@ \parskip.7em\relax}
%</!brief&!kaart>
%    \end{macrocode}
% \end{macro}
%
% \subsection{Markup for \Lopt{kulfax}}
% \begin{environment}{fax}
%    The "fax" environment creates a new fax, starting from page~1. Its
%    arguments follow the "\faxto" address format.
%    \begin{macrocode}
%<*fax>
\newenvironment{fax}%
  {\newpage
%    \end{macrocode}
%    Since the first page is printed last, that page is postponed to the
%    concluding part of the "fax" environment and we start with page~2 now.
%    We assume that the page style \pstyle{plain} is used (otherwise the
%    user is responsible for the correct layout), which puts the header
%    information (if requested) on the right spot.
%    \begin{macrocode}
    \c@page\tw@
%    \end{macrocode}
%    Apart from indicating that the first page is still empty, we make sure
%    that "list" environments leave vertical mode before changing
%    "\everypar" by calling "\kul@allowdefs".
%    \begin{macrocode}
    \kul@allowdefs
%    \end{macrocode}
%    Before reading the address information, reinitialize the global
%    "\kul@firstpagebox" and "\kul@nrpageii".
%    \begin{macrocode}
    \global\setbox\kul@firstpagebox\copy\voidb@x
    \global\kul@nrpageii\c@page
    \kul@nxtadd\faxto &}%
%    \end{macrocode}
%    The end of the environment finishes the current page and then typesets
%    the first page.
%    \begin{macrocode}
  {\clearpage
    \parskip\z@skip
    \kul@starttext
%    \end{macrocode}
%    The last part of the page consists of the data from the "firstpage"
%    environment. If it occupies more than "\kul@nrpageii" pages, give an
%    error.
%    \begin{macrocode}
    \nobreak \unvbox\kul@firstpagebox \newpage
    \ifnum\c@page>\kul@nrpageii
      \ClassError\CurrentClass{First page too large}{%
        The first page split invalidates the page count.\MessageBreak
        Probably this can be cured by using \string\addpages\space
        before the first text.\MessageBreak \kul@errhelp}%
    \fi
    \global\kul@beforetexttrue}
%    \end{macrocode}
% \changes{v1.4}{2005/05/12}{Remove incompatibility with \Lopt{marvosym}}
% \begin{macro}{\kul@saved@fax}
%    "\kul@saved@fax" stores the definition of "\fax", in case some other
%    package (like \Lopt{marvosym}) overwrites it. The definition of "\fax"
%    is restored after all packages are loaded.
%    \begin{macrocode}
\let\kul@saved@fax\fax
\AtBeginDocument{\global\let\fax\kul@saved@fax}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\headfaxpagesname}
%    The variable "\headfaxpagesname" contains the data to be printed
%    before the number of pages of the fax.
%    \begin{macrocode}
\newvar\headfaxpagesname[Aantal pagina's\\incl.\ voorblad]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@nrpageii}
%    The global count register "\kul@nrpageii" holds the page number on
%    which the first data of the fax, not including the contents of the
%    "firstpage" environment, is put. If no "\addpages" command is used
%    before "\starttext", this is equal to page number initialized by the
%    "fax" environment (normally 2).
%    \begin{macrocode}
\newcount\kul@nrpageii
%    \end{macrocode}
% \end{macro}
% \end{environment}
% \begin{macro}{\printfaxto}
%    The command "\printfaxto" expands to the addressee information to print.
%    The user can redefine it using the command "\foreachaddressee".
%    Two default layouts are provided. The first one "\printlongfaxto" is
%    normally used when only one addressee is given and the second one
%    "\printshortfaxto" when more than one is given. The command "\printfaxto"
%    can be let to these defaults or it can call them (in a
%    "\renewcommand").
%    By default, it first checks the number of addressees and then calls
%    one of the defaults.
%    \begin{macrocode}
\newcommand\printfaxto{%
  \begingroup
    \count@\z@
    \def\kul@elt{\advance\count@\@ne \kul@tolist@gobble}%
    \the\kul@tolist
    \expandafter\endgroup
  \ifnum\count@>\@ne \expandafter\printshortfaxto\else
    \expandafter\printlongfaxto\fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\printlongfaxto}
%    This long form is the one defined by the guidelines.
%    \begin{macrocode}
\newcommand\printlongfaxto{\foreachaddressee\relax{%
    \kul@hangfrom\headtoname\toname
    \ifx\toaddress\@empty\else
      \kul@hangfrom\headcompanyname\toaddress \fi
    \hangfrom{Fax}{\leavevmode
      \ifx\totelephonenum\@empty
        \tofaxnum
      \else
        \setbox\@tempboxa\hbox{%
          \color@begingroup
            \tofaxnum \hfil\hskip 3\marginparsep
            {\marginfont Tel.}\hskip\marginparsep
          \color@endgroup}%
        \ifdim\wd\@tempboxa>.5\textwidth
          \box\@tempboxa
        \else
          \hbox to.5\textwidth{\unhbox\@tempboxa}%
        \fi
        \totelephonenum
      \fi}%
    \addvspace\parskip}\relax}
%    \end{macrocode}
% \begin{macro}{\headcompanyname}
%    The variable "\headcompanyname" holds the string to be printed before
%    the address on faxes.
%    \begin{macrocode}
\newvar\headcompanyname[Bedrijf\,/\,Dienst]
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\printshortfaxto}
%    The short form allows many addressees on one fax.
%    \begin{macrocode}
\newcommand\printshortfaxto{\kul@hangfrom\headtoname{%
    \foreachaddressee{\begin{tabular}[t]{@{}ll@{}}}{%
        \tofaxnum &\linestack{\toname\unskip\strut}\\[.5ex]}{%
      \end{tabular}}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{firstpage}
%    The environment "firstpage" has one optional parameter \meta{toptext},
%    which is printed at its top. The parameter defaults to the contents of
%    the variable "\firstpagetoptext".
%    \begin{macrocode}
\newenvironment{firstpage}{%
%    \end{macrocode}
%    The operations inside this environment are actually carried out inside
%    a temporary box to avoid interference with the actual typesetting.
%    \begin{macrocode}
  \setbox\@tempboxa\hbox\bgroup
%    \end{macrocode}
%    We typeset the data for the first page inside a minipage. Additionally
%    attention is paid to save the color because this data will only be
%    used much later.
%    First we end the empty page, if needed.
%    \begin{macrocode}
    \minipage[b]\textwidth
      \color@setgroup
        \starttext
%    \end{macrocode}
%    We initialize the typesetting parameters from "\firstpagedefaults".
%    Before calling it, we save \meta{toptext} in the variable
%    "\firstpagetoptext", just in case "\firstpagedefaults" wants to change
%    it. After calling it, the "\firstpagetoptext" is printed, unless it
%    produces text with a non-zero width.
%    \begin{macrocode}
        \kul@optarg{\setvar\firstpagetoptext}{}{%
          \firstpagedefaults
          \settowidth\@tempdima{\ignorespaces \firstpagetoptext}%
          \ifdim\@tempdima=\z@
            \ignorespaces
          \else
            \subsubsection*{\firstpagetoptext}%
          \fi}}{%
%    \end{macrocode}
%    At the end of the environment we end the group for colors (started by
%    "\color@setgroup"), but first we unskip the last space to emulate the
%    effect of "\endminipage".
%    \begin{macrocode}
        \unskip
      \color@endgroup
%    \end{macrocode}
%    Before closing the minipage, we insert some glue that can be unskipped
%    by "\endminipage", in case "\color@endgroup" is a no-op.
%    \begin{macrocode}
      \hskip\z@
    \endminipage
%    \end{macrocode}
%    Now we move the minipage to the global box register
%    "\kul@firstpagebox" and we close the temporary box.
%    \begin{macrocode}
    \global\setbox\kul@firstpagebox\lastbox
  \egroup}
%    \end{macrocode}
% \begin{macro}{\kul@firstpagebox}
%    We define the global box register "\kul@firstpagebox" to hold the data
%    for the first page.
%    \begin{macrocode}
\newbox\kul@firstpagebox
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\firstpagetoptext}
%    The variable "\firstpagetoptext" holds the default text to be used as a
%    section header inside the first page box. It defaults to "\messagesname".
%    \begin{macrocode}
\newvar\firstpagetoptext[\messagesname]
%    \end{macrocode}
% \begin{macro}{\messagesname}
%    The variable "\messagesname" generates the text ``Messages'' in the
%    correct language.
%    \begin{macrocode}
\newvar\messagesname[Mededelingen]
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\firstpagedefaults}
%    The macro "\firstpagedefaults" holds the initializing commands for
%    the first page box.
%    \begin{macrocode}
\newcommand\firstpagedefaults{}
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
% \begin{macro}{\addpages}
%    The number of pages is computed, but if you want to add \meta{number}
%    extra pages, you can use the command "\addpages"\marg{number}. This
%    command can be used before "\starttext" to account for a "firstpage"
%    environment larger than one page. Therefor, if we are still on the
%    first page and it is empty, we also save the page number in
%    "\kul@nrpageii".
%    \begin{macrocode}
\newcommand*\addpages[1]{%
  \ifkul@beforetext\else \clearpage \fi
  \addtocounter{page}{#1}%
  \ifkul@beforetext \global\kul@nrpageii\c@page \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\setcounter}
% \begin{macro}{\kul@setcounter}
%    The command "\setcounter{page}" is redefined here to make sure that
%    nothing interferes with the counting of pages. The old definition of
%    "\setcounter" is stored in "\kul@setcounter".
%    \begin{macrocode}
\@ifdefinable\kul@setcounter{\let\kul@setcounter\setcounter}
\renewcommand*\setcounter[2]{%
  \def\reserved@a{#1}\def\reserved@b{page}%
  \ifx\reserved@a\reserved@b
    \ClassWarning\CurrentClass{%
      Setting the page counter is ignored in a fax.\MessageBreak
      Instead, use the command \string\addpages}%
  \else
    \kul@setcounter{#1}{#2}%
  \fi}
%</fax>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsection{Markup for \Lopt{kulmemo}}
% \begin{environment}{memo}
%    The "memo" environment creates a new memo, starting from page~1. Its
%    arguments follow the "\memoto" address format.
%    \begin{macrocode}
%<*memo>
\newenvironment{memo}%
  {\newpage
    \c@page\@ne
%    \end{macrocode}
%    The printing of the additional header information is postponed to
%    allow for declarations inside this environment.
%    \begin{macrocode}
    \kul@allowdefs
%    \end{macrocode}
%    Finally read the addressee(s).
%    \begin{macrocode}
    \kul@nxtadd\memoto &}%
%    \end{macrocode}
%    The end of the environment finishes the current page and prepares for
%    a new memo.
%    \begin{macrocode}
  {\clearpage
    \global\kul@beforetexttrue}
%    \end{macrocode}
% \begin{macro}{\printmemoto}
%    The command "\printmemoto" expands to the addressee information to print.
%    The user can redefine it using the command "\foreachaddressee".
%    \begin{macrocode}
\newcommand\printmemoto{\foreachaddressee\relax{%
    \kul@hangfrom\headtoname\tofulladdress}{\addvspace\parskip}}
%</memo>
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
% \subsection{Markup for \Lopt{kulverslag}}
%    Only one report is allowed in the document class \Lopt{kulverslag}, so
%    no environment for a report is provided. Instead we use
%    "\AtBeginDocument" to initialize the report.
%    \begin{macrocode}
%<*verslag>
\AtBeginDocument{\kul@allowdefs}
%</verslag>
%    \end{macrocode}
%
%
% \subsection{Markup for \Lopt{kulkaart}}
% \begin{macro}{\c@numberofcards}
% \DefineCounter{numberofcards}
%    The counter "numberofcards" holds the number of cards that are
%    needed. If its value is positive, it gives the number of cards to
%    print, if it is negative, it gives the number of pages to fill with
%    cards. By default, it is -1.
%    \begin{macrocode}
%<*kaart>
\newcounter{numberofcards}
\setcounter{numberofcards}{-1}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cardhsep}
%    The variable "\cardhsep" holds the horizontal separation between cards
%    (a rubber length). By default it is 2\,mm.
%    \begin{macrocode}
\newvar\cardhsep[2mm]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\cardvsep}
%    The variable "\cardvsep" holds the vertical separation between cards
%    (a rubber length). By default it equals "\cardhsep".
%    \begin{macrocode}
\newvar\cardvsep[\cardhsep]
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifkul@businesscard}
%    The switch "kul@businesscard" selects between a business card layout or a
%    general card layout. By default it is false.
%    \begin{macrocode}
\newif\ifkul@businesscard
%    \end{macrocode}
% \end{macro}
% \begin{environment}{cards}
%    The "cards" environment is the generic environment, used for all cards.
%    If you want it to typeset a business card, you have to set the switch
%    "kul@businesscard" to false before invoking it (e.g., using the "cards*"
%    environment). It has one optional argument to specify the dimensions
%    of the cards: it is either a \oarg{width} or a combined
%    \oarg{width\texttt{,}height}.\\
%    The cards start from page~1.
%    \begin{macrocode}
\newenvironment{cards}[1][15cm]{%
  \newpage
  \c@page\@ne
%    \end{macrocode}
%    Before computing anything, we store "\cardhsep" and "\cardvsep" in
%    respectively "\@tempskipa" and "\@tempskipb". This allows the use of
%    packages like \Lopt{calc}, which may change internal registers.
%    \begin{macrocode}
  \setlength\@tempskipa\cardhsep
  \setlength\@tempskipb\cardvsep
%    \end{macrocode}
%    We start by storing the width of a card in "\@tempdima" and the height
%    in "\@tempdimb".
%    \begin{macrocode}
  \kul@secondparam\@tempdima,#1,\@nnil
  \kul@secondparam\@tempdimb#1,\ifkul@businesscard 60\else 105\fi mm,\@nnil
%    \end{macrocode}
%    First we compute the number of cards in one row and store it temporarily in
%    "\@tempcnta". We use "\linewidth" instead of "\textwidth" to cover the
%    use of the "cards" environment inside a "list" environment. However
%    this is unrelated to the use of "\leftskip" and/or "\rightskip".
%    Furthermore, we put at least one card in a row.
%    \begin{macrocode}
  \@tempcnta\linewidth \advance\@tempcnta\@tempskipa
  \advance\@tempcnta-\leftskip \advance\@tempcnta-\rightskip
  \@tempdimc\@tempdima \advance\@tempdimc\@tempskipa
  \ifnum\@tempcnta>\@tempdimc
    \divide\@tempcnta\@tempdimc
  \else
    \@tempcnta\@ne
  \fi
%    \end{macrocode}
%    Then we compute the number of cards on a page and store it
%    in "\@tempcntb". We put at least one row of cards on a page.
%    \begin{macrocode}
  \@tempcntb\textheight \advance\@tempcntb\@tempskipb
  \@tempdimc\@tempdimb  \advance\@tempdimc\@tempskipb
  \ifnum\@tempcntb>\@tempdimc
    \divide\@tempcntb\@tempdimc
    \multiply\@tempcntb\@tempcnta
  \else
    \@tempcntb\@tempcnta
  \fi
%    \end{macrocode}
%    If the number of cards is given by pages, we compute the exact number
%    of cards next.
%    \begin{macrocode}
  \ifnum\c@numberofcards<\z@
    \multiply\c@numberofcards-\@tempcntb
  \fi
%    \end{macrocode}
%    Finally the number of dummy cards on the last line (to align that line
%    of cards with the rest) is computed and stored in "\@tempcnta".
%    If $n$ is the number of cards and $l$ is the number of cards per line,
%    the number of dummy cards is $(((n+l-1)/l)\times l)-n$.
%    \begin{macrocode}
  \count@\c@numberofcards
  \advance\count@\@tempcnta \advance\count@\m@ne
  \divide\count@\@tempcnta \multiply\@tempcnta\count@
  \advance\@tempcnta-\c@numberofcards
%    \end{macrocode}
%    Now start the box to store the card information in.
%    \begin{macrocode}
  \setbox\kul@cardbox\hbox to\@tempdima\bgroup
    \hskip \ifkul@businesscard 7\else 8\fi mm%
    \advance\@tempdima -1\ifkul@businesscard 1\else 6\fi mm%
    \edef\reserved@a{[b][\the\@tempdimb][s]{\the\@tempdima}}%
    \expandafter\minipage\reserved@a
%    \end{macrocode}
%    First select the correct default font.
%    \begin{macrocode}
      \preprintfont
      \kul@setfirstheadbox \box\kul@firstheadbox
      \par \nointerlineskip
%    \end{macrocode}
%    For business cards we continue to use the "\preprintfont", but for
%    other cards we typeset the body of the card at the normal size.
%    \begin{macrocode}
      \ifkul@businesscard\else \normalsize \fi
      \@firsttexttop}{%
%    \end{macrocode}
%    The end of the environment first finishes the box.
%    \begin{macrocode}
      \vfil
      \kul@setfirstfootbox \box\kul@firstfootbox \par
      \vspace{\ifkul@businesscard 5\else 7\fi mm}%
    \endminipage
    \hfil
    \egroup
%    \end{macrocode}
%    Then it typesets the box "\c@numberofcards" times in pages with each
%    "\@tempcntb" boxes. This results in completely filled pages, which is
%    needed to avoid a paragraph to span two pages (having a wrong page
%    number when typesetting some of the boxes). First we print all pages,
%    but the last, one at the time.
%    \begin{macrocode}
  \topskip\z@skip \parskip\z@skip \parfillskip\z@skip
  \lineskiplimit\maxdimen \setlength\lineskip\cardvsep
  \@whilenum\c@numberofcards>\@tempcntb \do{%
    \count@\@tempcntb
    \@whilenum\count@>\z@ \do{%
      \kul@usecardbox \hskip\@tempskipa
      \advance\count@\m@ne}%
    \par\break
    \advance\c@numberofcards-\@tempcntb}%
%    \end{macrocode}
%    Finally the last page is typeset, starting first with the remaining
%    real cards and finishing with the dummy cards to fill the line.
%    \begin{macrocode}
  \@whilenum\c@numberofcards>\z@ \do{%
    \kul@usecardbox \hskip\@tempskipa
    \advance\c@numberofcards\m@ne}%
  \@whilenum\@tempcnta>\z@ \do{%
    \hskip\wd\kul@cardbox\allowbreak \hskip\@tempskipa
    \advance\@tempcnta\m@ne}%
  \par\break}
%    \end{macrocode}
%    The "cards*" environment is the same as the "cards" environment with the
%    switch "kul@businesscard" set to true and correct default dimensions.
% \DoNotIndex{\endcards}
%    \begin{macrocode}
\expandafter\newcommand\csname cards*\endcsname[1][9cm]{%
  \kul@businesscardtrue \cards[#1]}
\expandafter\let\csname endcards*\endcsname\endcards
%    \end{macrocode}
% \end{environment}
% \begin{environment}{largecards}
%    The environment "largecards" is version of the "cards" environment with
%    the prescribed width.
% \DoNotIndex{\largecards,\endlargecards}
%    \begin{macrocode}
\newcommand\largecards{\cards[21cm]}
\let\endlargecards\endcards
%    \end{macrocode}
% \end{environment}
% \begin{macro}{\businesscards}
%    The command "\businesscards" typesets business cards. In fact it is
%    simply a shortcut to invoking the "cards*" environment with the name
%    (if defined) and the profession added.
%    \begin{macrocode}
\newcommand\businesscards{\begin{cards*}%
    \ifx\fromname\@empty\else
      \let\\\kul@robust@cr
      \begingroup
        \fontsize{7.5}\z@ \fontseries\bfdefault \selectfont
        \MakeUppercase\fromname \par
      \endgroup
      \ifx\fromprofessionlong\@empty\else
        \MakeUppercase\fromprofessionlong \par
      \fi
    \fi
  \end{cards*}}
%    \end{macrocode}
% \begin{macro}{\kul@secondparam}
%    The command "\kul@secondparam"\marg{reg}\meta{rest}"\@nnil" stores the
%    second parameter from \meta{rest} in the register \meta{reg}.
%    \begin{macrocode}
\@ifdefinable\kul@secondparam{%
  \def\kul@secondparam #1#2,#3,#4\@nnil{%
    \@defaultunits #1#3\relax\@nnil}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@cardbox}
%    The box "\kul@cardbox" holds the contents of one card.
%    \begin{macrocode}
\newbox\kul@cardbox
%    \end{macrocode}
% \begin{macro}{\kul@twoverlines}
%    The command "\kul@twoverlines" prints two vertical lines, one ending
%    at the height of "\kul@cardbox", another one starting at a zero.
%    \begin{macrocode}
\newcommand\kul@twoverlines{%
  \vbox to\ht\kul@cardbox{%
    \hrule \@width .4\p@ \@height 5mm\vss
    \hrule \@height 5mm}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\kul@twohorlines}
%    The command "\kul@twohorlines" prints two horizontal lines, one at a
%    distance equal to the height of "\kul@cardbox", another one at a
%    distance equal to its depth.
%    \begin{macrocode}
\newcommand\kul@twohorlines{%
  \vbox to\ht\kul@cardbox{\vss
    \hrule \@height .4\p@ \@width 5mm\vskip\ht\kul@cardbox
    \hrule \@height .4\p@ \vss}}
%    \end{macrocode}
% \begin{macro}{\kul@usecardbox}
%    The command "\kul@usecardbox" prints one card, including its crop
%    marks if needed.
%    \begin{macrocode}
\newcommand\kul@usecardbox{%
  \leavevmode
  \ifthenelse\foldingmarkscondition{%
    \hbox{%
      \hskip -.4\p@ \kul@twoverlines \kul@twohorlines \hskip -5mm%
      \copy\kul@cardbox
      \hskip -5mm\kul@twohorlines \kul@twoverlines \hskip -.4\p@}%
    }{\copy\kul@cardbox}}
%</kaart>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \section{Final initializations}
% \begin{macro}{\today}
%    Since the default language is Dutch, we let "\today" print Dutch dates.
%    \begin{macrocode}
\def\today{\number\day~\ifcase\month\or
    januari\or februari\or maart\or april\or mei\or juni\or juli\or
    augustus\or september\or oktober\or november\or december\fi
  \space \number\year}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\todaybni}
% \changes{v1.1}{2000/03/14}{Use four digits for the year instead of two}
%    The command "\todaybni" prints the current date as defined by the
%    Belgian Normalization Institute.
%    \begin{macrocode}
\newcommand\todaybni{\number\year
  --\ifnum\month<10 0\fi\number\month
  --\ifnum\day  <10 0\fi\number\day}
%    \end{macrocode}
%    For letters and reports, we use this BNI date format by default.
%    \begin{macrocode}
%<brief|verslag>\date\todaybni
%    \end{macrocode}
% \end{macro}
%
%    These packages can be used for several languages if you use the
%    \Lopt{babel} package, which also loads the appropriate hyphenation
%    patterns. Since the language defaults to Dutch, we try to load the
%    Dutch hyphenation patterns if they exist.
%    \begin{macrocode}
\@ifundefined{l@dutch}{}{\language\l@dutch}
%    \end{macrocode}
%
%    The document is typeset ragged right, except for reports and cards.
%    \begin{macrocode}
%<!verslag&!kaart>\raggedright
%    \end{macrocode}
%
%    The very last thing to do in this document class, is to read the
%    configuration files\label{config}, if allowed.
%    Normally the system wide configuration file \file{kulstijl.def}
%    should be available, so give a warning if it is absent. The user
%    specific configuration file \file{kulstijl.cfg} is optional. It
%    holds the user specific information.
%    Class specific information can be stored in any of those two files
%    using the command "\ifthenelse" and "\CurrentClass".
%    \begin{macrocode}
\ifkul@noconfig
  \def\kul@tmp{}
  \IfFileExists{kulstijl.def}{%
    \edef\kul@tmp{\kul@tmp, kulstijl.def}}{}
  \IfFileExists{kulstijl.cfg}{%
    \edef\kul@tmp{\kul@tmp, kulstijl.cfg}}{}
  \ifx\kul@tmp\@empty\else
    \immediate\write\@unused{Kulstijl configuration files
      skipped:\expandafter\@gobble\kul@tmp.}
  \fi
\else
  \InputIfFileExists{kulstijl.def}{}{\ClassWarningNoLine\CurrentClass
    {No site specific information (kulstijl.def) available}}
  \InputIfFileExists{kulstijl.cfg}{}{\ClassInfo\CurrentClass
    {No user specific information (kulstijl.cfg) available}}
\fi
%</class>
%    \end{macrocode}
%
% \section{Other files}
%    In this section some auxiliary files are described. Most of them are
%    not required in any of the above classes, but they allow for user or
%    site specific configurations. Of course, if you want
%    site-independence when transmitting documents to other sites, you must
%    always include these files, as well as the configuration files, in
%    your document (e.g., with the \texttt{filecontents} environment).
%
% \subsection{Babel configuration files}\label{sec:babel}
%    The following data can be added to the local Babel configuration files
%    (version 3.5 or higher). It translates some of the variables we have
%    used.
%    Examples are given here for Dutch and English, but they can be easily
%    extended to other languages.
%    \begin{macrocode}
%<*dutch>
\addto\captionsdutch{%
  \def\datename{Datum}%
  \def\firstheadtitlefax{VOORBLAD FAX}%
  \def\firstheadtitlememo{MEMO}%
  \def\firstheadtitlereport{VERSLAG}%
  \def\headcompanyname{Bedrijf\,/\,Dienst}%
  \def\headfaxpagesname{Aantal pagina's\\incl.\ voorblad}%
  \def\headfromname{Van}%
  \def\ourreferencename{Ons kenmerk}%
  \def\pagenumbername{Blad nr\@.}%
  \def\messagesname{Mededelingen}%
  \def\statusname{Status}%
  \def\subjectname{Betreft}%
  \def\yourreferencename{Uw kenmerk}%
  }%
%</dutch>
%<*english>
\addto\captionsenglish{%
  \def\datename{Date}%
  \def\firstheadtitlefax{FAX}%
  \def\firstheadtitlememo{MEMO}%
  \def\firstheadtitlereport{REPORT}%
  \def\headcompanyname{Company}%
  \def\headfaxpagesname{Page count\\incl.\ front page}%
  \def\headfromname{From}%
  \def\ourreferencename{Our reference}%
  \def\pagenumbername{Page}%
  \def\messagesname{Messages}%
  \def\statusname{Status}%
  \def\subjectname{Subject}%
  \def\yourreferencename{Your reference}%
  }%
\def\captionsamerican{\captionsenglish}%
%</english>
%    \end{macrocode}
%
% \Finale
%
\endinput
