% \iffalse
%   (This is a META-COMMENT.)
%
%   This is file `cdpbundl.dtx'.
%
%   This file is part of a work named "C.D.P. Bundle".
%
%   Copyright (C) 1999-2015 by Gustavo MEZZETTI
%                             <gustavo.mezzetti@istruzione.it>.
%
%   The C.D.P. Bundle may be distributed and/or modified under the
%   conditions of the LaTeX Project Public License, either version 1.3
%   of this license or (at your option) any later version.
%   The latest version of this license is in
%     http://www.latex-project.org/lppl.txt
%   and version 1.3 or later is part of all distributions of LaTeX
%   version 2005/12/01 or later.
%
%   The C.D.P. Bundle has the LPPL maintenance status
%     "author-maintained".
%
%   The file `manifest.txt' that comes along with this file specifies
%   what the C.D.P. Bundle consists of; more precisely, it explains how
%   the locutions "Work" and "Compiled Work", used in the LaTeX Project
%   Public License, are to be interpreted in the case of this work.
%
%   Note that the distribution of this file alone is "distribution of
%   only part of the Work" in the sense of the LaTeX Project Public
%   License, and is not allowed.
%
%   (End of the META-COMMENT.)
% \fi
%
% \def\filename{cdpbundl.dtx}
% \def\fileversion{0.36}
% \def\filedate{2015/02/08}
% \def\docdate {2015/04/01}
% \def\doclongdate{April~1, 2015}
%
% \CheckSum{4984}
%
% \DeclareRobustCommand*{\Bundle}{C.D.P. Bundle}
%
% \changes{0.30}{2001 Jul 01}{First release of the \Bundle}
% \changes{0.31}{2001 Dec 01}{Added support for the \protect\opz{usePS}
%   option in the \protect\packlass{\protect\cdpaddon} package}
% \changes{0.32}{2002 Jul 01}{Removed support for the \protect\opz{usePS}
%   option in the \protect\packlass{\protect\cdpaddon} package}
% \changes{0.33}{2005 Jan 01}{Reorganized code of the
%   \protect\packlass{\protect\articoletteracdp} class and of the
%   \protect\packlass{\protect\cdpaddon} package to make it compatible
%   with the \protect\packlass{\protect\HyperRef} package}
% \changes{0.34}{2006 Jan 01}{Improved interaction with the
%   \protect\packlass{\protect\HyperRef} package}
% \changes{0.34}{2006 Jan 01}{Corrected positioning of floats
%   in float pages}
% \changes{0.34}{2006 Jan 01}{Added \protect\texttt{\protect\bslash place}
%   command}
% \changes{0.35}{About 2013}{Never publicly released.  Some of the changes 
%   listed below for vers.~0.36 were actually introduced in this version.}
% \changes{0.36}{2015 Feb 08}{Added \protect\texttt{\protect\bslash
%   OpeningSequence} command and related macros, in part.\ 
%   the \protect\texttt{\protect\bslash ChosenMakeOpening} hook.}
% \changes{0.36}{2015 Feb 08}{Added \protect\texttt{\protect\bslash
%   ClosingSequence} command and related macros, in particular
%   \protect\texttt{\protect\bslash ChosenMakeClosing} and
%   \protect\texttt{\protect\bslash ChosenMakeSignature}.}
% \changes{0.36}{2015 Feb 08}{Eventually added functionality to the
%   \protect\packlass{\protect\cdpaddon} package to support user-defined
%   letterheads.}^^A
% \changes{0.36}{2015 Feb 08}{Added \protect\relax the
%   \protect\opz{signaturerule} option, and its related stuff
%   (the \protect\texttt{\protect\bslash signaturerule} command,
%   the \protect\texttt{\protect\bslash signaturerulewidth} parameter),
%   to support rules that mark where to sign by hand.}
% \changes{0.36}{2015 Feb 08}{Delegated to a new command
%   (\protect\texttt{\protect\bslash foldingtagrule}) the task of drawing 
%   the sign that shows where the sheet is to be folded.}
% \changes{0.36}{2015 Feb 08}{Removed the \protect\packlass{\protect\adiseal}
%   package and the \protect\packlass{\protect\lettcdpadi} document class.}
% \changes{0.36}{2015 Feb 08}{Tidied up in several points the code of the
%   \protect\packlass{\protect\cdpaddon} package.}
% \changes{0.36}{2015 Feb 08}{Added \protect\packlass{\protect\cdpbabel}
%   package and related language definition files for English and Italian.}
%
%% \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         \~}
%
% \MakeShortVerb{\"}
% \DeleteShortVerb{\|}
%
% \DoNotIndex{\begin,\end,\def,\let,\else,\fi,\@ifdefinable,\@empty}
% \DoNotIndex{\newcommand,\renewcommand}
% \DoNotIndex{\newenvironment,\renewenvironment}
% \DoNotIndex{\z@,\z@skip,\p@,\@ne,\tw@,\thr@@,\@m,\@M,\m@ne}
% \DoNotIndex{\setlength,\setcounter,\addtolength}
% \DoNotIndex{\expandafter,\do,\relax,\advance,\multiply,\divide}
% \DoNotIndex{\DeclareOption,\ExecuteOptions,\ProcessOptions}
% \DoNotIndex{\",\.,\@}
%
% \IndexPrologue{
%   \section{\indexname}
%   Numbers in italics refer to the page where the corresponding entry
%   is described, the ones underlined to the code line of the
%   definition, the rest to the code lines where the entry is used.
% }
% \setcounter{IndexColumns}{2}
%
% \GlossaryPrologue{\section{Change History}}
%
% \setcounter{StandardModuleDepth}{1}
%
% \newcommand*{\DS}{\textsf{DocStrip}}
% \renewcommand*{\partname}{Part}
% \newcommand*{\cdpbundl}{cdpbundl}
% \newcommand*{\letteracdp}{letteracdp}
% \newcommand*{\articoletteracdp}{articoletteracdp}
% \newcommand*{\adiseal}{adiseal}
% \newcommand*{\lettcdpadi}{lettcdpadi}
% \newcommand*{\cdpaddon}{cdpaddon}
% \newcommand*{\cdpbabel}{cdpbabel}
% \newcommand*{\babel}{babel}
% \newcommand*{\HyperRef}{hyperref}
% \newcommand*{\pictee}{pict2e}
% \newcommand*{\epsfig}{epsfig}
% \newcommand*{\cdpnamesenglish}{cdpnamesenglish.ldf}
% \newcommand*{\cdpnamesitalian}{cdpnamesitalian.ldf}
% \newcommand*{\example}{cdpshues-example.def}
% \newcommand*{\epson}{epson-stylus-740.def}
% \newcommand*{\hplj}{hp-laserjet-4500.def}
% \newcommand*{\cdpshues}{cdpshues.cfg}
% \newcommand*{\textoken}[1]{\(\langle\mbox{\normalfont #1}\rangle\)}
% \newcommand*{\param}[1]{\(\mbox{\##1}\leftarrow {\,}\)}
% \makeatletter
% \newcommand*{\myspecialindex}[2]
%    {\special@index{#1\actualchar#2\encapchar main}}
% \makeatother
% \newcommand*{\counterindex}[1]{\myspecialindex{#1}{{\string\ttfamily
%    \space #1} (counter)}\index{counters:\levelchar{\protect\ttfamily
%    #1}\encapchar usage}}
% \newcommand*{\optuseindex}[1]{\SortIndex{#1}{\protect\opz{#1}^^A
%    (option)\encapchar usage}\index{options:\levelchar
%    \protect\opz{#1}\encapchar usage}}
% \newcommand*{\opz}[1]{{\normalfont\ttfamily #1}}
% \newcommand*{\iopz}[1]{$\mbox{\opz{#1}}\optuseindex{#1}}
% \newcommand*{\eopz}[1]{\mathbin{|}\mbox{\opz{#1}}\optuseindex{#1}}
% \newcommand*{\fopz}{$}
% \newcommand*{\packlass}[1]{{\normalfont\sffamily #1}}
% \newcommand*{\filedir}[1]{{\normalfont\ttfamily #1}}
% \newcommand*{\env}[1]{{\normalfont\ttfamily #1}}
% \newcommand*{\cnt}[1]{{\normalfont\ttfamily #1}}
% \newcommand*{\sty}[1]{{\normalfont\ttfamily #1}}
% \newcommand*{\eqref}[1]{(\ref{#1})}
% \newcommand*{\strongemph}[1]{\textbf{#1}}
% \newcommand*{\zerolistvertspaces}{^^A
%   \setlength{\parskip}{0pt}^^A
%   \setlength{\topsep}{\parskip}^^A
%   \setlength{\partopsep}{\parskip}^^A
% }
% \newcommand*{\closeofsentencespace}{\spacefactor \sfcode `. \space}
%
% \DeclareFixedFont{\lhnss}{T1}{cmss}{m}{n} {12}
% \DeclareFixedFont{\lhbss}{T1}{cmss}{m}{n} {17}
% \DeclareFixedFont{\lhrm} {T1}{cmr} {m}{n} {9}
% \DeclareFixedFont{\lhit} {T1}{cmr} {m}{it}{9}
% \DeclareFixedFont{\lhtt} {T1}{cmtt}{m}{n} {9}
%
%
%
% \title{
%    The \Bundle\thanks{This file has version
%    \fileversion, release date \filedate;
%    last documentation update: \docdate.
%    Copyright \copyright~1999--2015 by G.~Mezzetti
%    (see page~\pageref{S:Copy}).}
% }
% \author{G. Mezzetti}
% \date{\doclongdate}
%
% \makeatletter
%   \@ifundefined{hypersetup}{}{
%     \hypersetup{
%       pdftitle        = {The C.D.P. Bundle},
%       pdfauthor       = {G. Mezzetti},
%       pdfsubject      = {Documentation of the C.D.P. Bundle},
%       pdfkeywords     = {letter, letterhead},
%       pdfcreationdate = {D:20150401120000},
%       pdfmoddate      = {D:20150401120000}
%     }
%   }
% \makeatother
%
% \maketitle
%
% \begin{abstract}
%    A bundle of \LaTeX\ (former \LaTeXe) classes and packages is
%    described, which was used by the \emph{Coordinamento dei Dottorandi e
%    dei Dottori di Ricerca dell'Universit\`{a} di Padova} (a free and
%    informal association of Ph.D.  students and Ph.D.'s at the
%    university of Padua, Italy) to write its ``official'' letters.
%    These classes and packages took care of formatting the letters as
%    required by the standards of this association; in particular, they
%    made it very easy to include its seal, both in black-and-white and
%    in color, at the top of pages.
% \end{abstract}
%
% \tableofcontents
% \listoffigures
%
% \clearpage
% \begingroup
%
%    \setlength{\parskip}{\medskipamount}
%    \setlength{\parindent}{0pt}
%
% \section*{Copyright notice}
%    \label{S:Copy}
%    \vspace{-\parskip}
%
%    Copyright \copyright~1999--2015 by Gustavo \textsc{Mezzetti}.  All
%    rights are reserved, except as noted below.
%
%    This document has been produced by feeding to a \LaTeX\ typesetting
%    engine the file \filedir{\filename} version \fileversion\ (\docdate).
%    This file is part of a work named ``\Bundle''.
%
%    The \Bundle\ may be distributed and/or modified under the
%    conditions of the \LaTeX\ Project Public License, either version~1.3
%    of this license or (at your option) any later version.  The latest
%    version of this license is in
%    \begin{list}{\setlength{\topsep}{0pt}}\item\relax
%      \ttfamily
%      http://www.latex-project.org/lppl.txt
%    \end{list}
%    and version~1.3 or later is part of all distributions of \LaTeX\
%    version 2005/12/01 or later.
%
%    The \Bundle\ has the LPPL maintenance status ``author-maintained''.
%
%    The file \filedir{manifest.txt} included in the \Bundle\ 
%    specifies what the \Bundle\ consists of; more precisely,
%    it explains how the locutions ``Work'' and ``Compiled Work'',
%    used in the \LaTeX\ Project Public License, are to be interpreted
%    in the case of this work.
%
%    Permission is granted to make new printed copies of this document,
%    by any means (\emph{e.g.}, photocopying, direct printing from the
%    electronic version, and so on).
%
%    Note, though, that distribution of this document alone is
%    ``distribution of only part of the Work'' in the sense of the
%    \LaTeX\ Project Public License, and should therefore be avoided:
%    please distribute, in addition, the source file \filedir{\filename}
%    together with all other files listed in \filedir{manifest.txt},
%    as explained in the file \filedir{manifest.txt} itself and also in
%    Subsection~\ref{sS:License} on page~\pageref{sS:License}, to which you
%    are referred for more information.
%
% \section*{Author's address}
%    \vspace{-\parskip}
%
%    The recommended way to contact the author is by e-mail; his address is:
%
%    \begin{list}{\setlength{\topsep}{0pt}}\item\relax
%      \href{mailto:gustavo.mezzetti@istruzione.it}
%        {\nolinkurl{gustavo.mezzetti@istruzione.it}}
%    \end{list}
%
%    Please include the \emph{exact} phrase \verb*|C.D.P. Bundle| in the
%    \emph{subject} of your message; otherwise, your message could be
%    thrown away by a mail filter.  In this regard, the weakness of the
%    laws concerning the protection of privacy forces me to explicitly
%    forbid the use of the above address for any kind of advertising,
%    marketing, polling, or similar commercial or statistical contact.
%
% \endgroup
%
%
%
% \setcounter{secnumdepth}{0}
%
%
%
% \clearpage
% \section{Introduction}
%
%    The \emph{Coordinamento dei Dottorandi e dei Dottori di Ricerca
%    dell'Universit\`a di Padova} (henceforth simply referred to as
%    ``\emph{Coordinamento}'') was a free association of Ph.D.'s and Ph.D.
%    students who took their degree, or were studying for it, at the
%    University of Padova (Padua), Italy.  Discussing its precise nature is
%    completely outside the scope of this document; the only thing that
%    concerns us here is that it wrote letters of a somewhat
%    ``official'' kind, which, for this reason, had to bear its letterhead
%    on the top of their first page.  The classes and packages herein described 
%    were used for preparing this kind of letters, automatically taking care of
%    printing the letterhead; but besides this, they incorporated much more
%    functionality than the standard \packlass{letter} \LaTeX\ class,
%    and it was precisely this additional functionality that proved useful
%    also in more general contexts, thus determining the adoption of the
%    \Bundle\ in (certain niches of) the \LaTeX\ community.
%
%    \subsection{Credits and disclaimer}
%
%    The \packlass{\letteracdp} document class was originally based on
%    the \packlass{letter} standard \LaTeX\ class.  During the time, it
%    went through so many deep revisions, that by now it retains
%    practically no relation with the original \packlass{letter} class;
%    but we want to acknowledge the ``historical'' source anyway.  The
%    \packlass{\articoletteracdp} document class uses some ideas borrowed
%    from the \packlass{article} standard \LaTeX\ class.
%
%    The author thanks heartfully Alessandro Ambrosi and Roberto
%    Strepparava, who tested the software and constantly stimulated
%    improvements and refinements, and Paolo Cojazzi, who, besides this,
%    also helped with the compression tools.
%
%    As usual with computer software, no warranty is given that
%    this code will work properly, or even that it will work at all.
%    Using this code can even result in loss of data and/or damages
%    to your disks and your storage media.
%    If you use this code, you do so exclusively at your own risk!
%
%    See Subsection~\ref{sS:License} and the \LaTeX\ Project Public
%    License for more information.
%
%    \subsection{About this document}
%
%    This document, like many documentation files distributed for
%    \LaTeX, is divided into two parts.
%
%    The first part, \emph{User's Manual}, should contain all the
%    documentation you need to succesfully \emph{use} the classes and
%    packages that this document presents; but unfortunately (for you!),
%    this document is still unfinished, so this information is \emph{not}
%    given here; instead, you are referred to some other sources (all
%    available through the world-wide web).  The only pieces of
%    information you will find in this part are how to install those
%    classes and packages and how to generate this documentation.  This
%    part, however, specifies to what extent, and under what conditions,
%    you are allowed to use and distribute the classes and packages
%    presented in this document.
%
%    The second part, \emph{Implementation}, can be omitted if you want
%    (explanations on how to omit it are given at the beginning of the
%    part itself), and contains information that concerns only
%    ``hackers'' who want to learn how the macros that this document
%    presents are \emph{implemented}.  Actually, this part contains the
%    complete listing of the \LaTeX\ code that implements the
%    macros---unfortunately, almost without comments---in the usual \DS\
%    format; if you are not a \LaTeX\ hacker, this part will not mean
%    anything to you.
%
%    \subsection{About this release: a provisional patch}
%
%    The \Bundle\ was essentially written between 1999 and 2000 (for
%    an Italian audience), and even at that time it contained code that was
%    already deprecated; even worse, its design was flawed since the
%    beginning, because it had been conceived for a specific and limited
%    application (the letters of the C.D.P., exactly), and was adapted for
%    more general use only as an afterthought.
%
%    A thorough redesign would therefore be needed; on the other hand, some
%    users have suggested, or asked for, improvements and additions, in
%    particular for what concerns the use of the bundle with other
%    languages besides Italian, that can be implemented rather easily by
%    means of provisional patches.  I~have already been deferring the
%    introduction of these comparatively harmless enhancements for five
%    years, waiting for the right moment to undertake the task of
%    redesigning the bundle from scratch, but now I~have resolved to simply 
%    patch up the existing version.
%
%    The macros presented in this document, therefore, are far from being 
%    optimal: no serious attempt has been made to remove ``fossil'' code, nor 
%    to bring it up to date with modern \LaTeX\ usage.  The only exception to 
%    this is a small change that has been made to the fonts used to print the 
%    letterhead of the \emph{Coordinamento}, switching them from OT1 encoding 
%    to~T1---because this just required hitting the \meta{DEL} key half a dozen 
%    of times!~^^A ( paren match
%    ;-)\closeofsentencespace Of course, nobody will 
%    care about this, since the least likely reason for which you might want to 
%    use the \Bundle\ is to produce that letterhead.\footnote{Note, however, 
%    that the ability to compose the letterhead of the \emph{Coordinamento} is 
%    still required in order to typeset the documentation given in the 
%    References.}  For this same 
%    motive, essentially, I~have also removed the \packlass{\adiseal} package 
%    and the \packlass{\lettcdpadi} document class, of which, probably, nobody 
%    besides me even remembers the purpose.
%
%    Though\marginpar{\hfill\strongemph{$*{*}*\;$WOW!!$\;*{*}*$}},
%    ^^A Yes, I know, I should use \textasteriskcentered...
%    \strongemph{good news} are coming for all those users who asked 
%    for a means to \strongemph{customize the letterhead} produced by the 
%    \Bundle: a reasonably viable method for doing so has been provided
%    at last!~:-D\closeofsentencespace  The method requires the use 
%    of the \packlass{\cdpaddon} package, passing in the new option 
%    \opz{customletterhead}.  You specify the contents of your custom head and 
%    foot by means of two new environments, called \env{customletterhead} and 
%    \env{customletterfoot}, respectively, which are similar, to a certain 
%    extent, to the \env{minipage} environment.  This should give you maximum 
%    freedom in designing the letterhead, whilst adopting an interface you are 
%    surely well familiar with.
%    See Subsection~\ref{sS:Customization} for more information.
%
%    Another nifty feature is the ability to draw a thin rule to guide your
%    hand in signing your letters: you ask for this behavior by passing the new
%    \opz{signaturerule} option to the \packlass{\letteracdp} document class.
%    See Subsection~\ref{sS:Options} for more information.
%
%    Sorry, but for now I~cannot offer any more.
%
%
%
% \setcounter{secnumdepth}{3}
%
%
%
% \clearpage
% \part{User's Manual}
%
% \section{About this part}
%
%    We shall only give instructions on how to install the bundle and
%    how to generate this documentation; partial instructions on how to use
%    the classes and packages contained in the bundle can be found
%    in several documents written by the author
%    \cite{tutti,esempi,etichette,novita,nts,ver028,cdpaddon,ver031,ver036},
%    but a systematic user's manual is no longer foreseen.~\mbox{:-(}^^A ) match
%    \closeofsentencespace
%    Note that including in this document the instructions on how to generate
%    the document itself may seem pretty useless, but actually isn't:
%    you might be reading a copy obtained from another person.
%
% \section{Installing the \Bundle\ and generating this documentation}
%
%    As usual for \LaTeX\ distributions, the \Bundle\ is
%    distributed in the form of a \filedir{.dtx} file, namely
%    \filedir{cdpbundl.dtx}, and an accompanying \filedir{.ins} file,
%    namely \filedir{cdpbundl.ins}.
%
%    \subsection{Installation}
%
%    To install the bundle, run \LaTeX\ (or plain \TeX) once on the file
%    \filedir{cdpbundl.ins}.  This will generate the following \LaTeX\
%    input files:
%    \begin{quote}
%      \ttfamily
%      \articoletteracdp.cls\\
%      \cdpaddon.sty\\
%      \cdpbabel.sty\\
%      \cdpnamesenglish\\
%      \cdpnamesitalian\\
%      \example\\
%      \cdpshues\\
%      \epson\\
%      \hplj\\
%      \letteracdp.cls
%    \end{quote}
%    To finish the installation, move them into a \LaTeX\ input
%    directory.  (If you want, you can discard one, more, or all of the
%    files whose name ends in \filedir{.def}, each of which contains color
%    definitions for the seal appropriate for a particular printer.  See
%    Subsection~\ref{sS:config} for information about how these files
%    are used for this purpose.) The above listing of all the files you
%    need to move is also displayed on the terminal at the end of the run
%    of the file \filedir{cdpbundl.ins}.  The documentation of your \TeX\
%    installation should tell you how to find the \LaTeX\ input
%    directory/ies, and probably also how to create new \LaTeX\ input
%    directories reserved to hold your private classes and packages.
%
%    Note that the TDS-compliant directory where the above files should be
%    put is
%    \begin{quote}
%      \texttt{tex/latex/cdpbundl/}
%    \end{quote}
%
%    \subsection{Configuring the \packlass{\cdpaddon} package}
%    \label{sS:config}
%
%    The \packlass{\cdpaddon} package is the part of the \Bundle\ 
%    that takes care of coloring the C.D.P.  seal, which appears in
%    black-and-white if you don't load this package.  Experience by trial
%    and error has shown that some configuration work may be necessary in
%    order to obtain (more or less) correctly-\null looking colors in the
%    seal.  This happens because different printers may render color hues
%    in different ways, sometimes producing surprising results.
%
%    The configuration mechanism works as follows.  For each printer
%    you plan to use there should be a definition file that specifies what
%    hues should be used to color the C.D.P.  seal.  To select which
%    file to load, the user indicates its name in an option passed to the
%    \packlass{\cdpaddon} package.  If the user gives no such indication,
%    the package reads from a configuration file the name of the default
%    definition file, and uses that file.  In both cases, if the
%    designated definition file cannot be read, the package issues a
%    warning and resorts, for the hues, to an emergency definition
%    (which, as you can expect, is not very pleasant to the eye).
%
%    \subsubsection{Writing color definition files}
%
%    The task of a color definition file is simply to define two colors
%    called "slight@col" and "strong@col" (when the definition file is
%    read, the "@"~characters are treated as ordinary letters):
%    "slight@col" is the color used to paint the inner of the D and of
%    the P in the seal, "strong@col" is the color used to draw the lines.
%    You define these colors by means of the "\definecolor" command: see
%    the \textsl{\LaTeX book} \cite[Section~7.3 and
%    Subsection~C.14.3]{LaTeXbook} for information on colors and the
%    "\definecolor" command.
%
%    The file \filedir{\example}, too, contains comments which explain
%    how to write new definition files for the \packlass{\cdpaddon}
%    package.  Indeed, this file is supplied only as a prototype: I suggest
%    that you write a new file by making a copy of it (with the
%    appropriate name) and modifying it with the help of the comments.
%    The colors defined in this file are just an example, and indeed they
%    are exactly the emergency colors used internally by the
%    \packlass{\cdpaddon} package when it cannot load a definition
%    file---that is, a completely useless definition!
%
%    The file \filedir{\example} uses the \texttt{named} color model,
%    but of course you can use any color model you want.  Indeed, it is
%    best to use ``direct'' color models like \texttt{rgb} or
%    \texttt{cmyk}, that allow you to drive the printer with precision:
%    after all, it is exactly for this purpose that you are writing the
%    file.  The other two definition files included in the \Bundle\ 
%    illustrate the use of these color models.
%
%    \subsubsection{Selecting a color definition file via an option}
%
%    The first way to select a particular color definition file among the
%    ones you have installed is to pass a suitable option to the
%    \packlass{\cdpaddon} package.  More precisely, the option name has
%    the form \opz{printer:}\( \langle\textit{bare file name}\rangle \),
%    all in a row without intervening spaces, where \(
%    \langle\textit{bare file name}\rangle \) is the name of the
%    definition file you want to load \emph{without} the extension
%    \filedir{.def}.  For example, to load a file called
%    \filedir{acme-wilejet.def}, you pass the option
%    \opz{printer:acme-wilejet}.  Explicitly, you would write
%    \begin{verbatim}\usepackage[printer:acme-wilejet]{cdpaddon}\end{verbatim}
%    to load the \packlass{\cdpaddon} package and the color definitions
%    suitable for the ACME WileJet printer (the printer preferred by
%    8~coyotes out of~10).  Similarly, to load the file
%    \filedir{\example} you would write
%    \begin{verbatim}\usepackage[printer:cdpshues-example]{cdpaddon}\end{verbatim}
%    and so on.  Of course, you can still specify, as well, the other
%    options listed in~\cite{cdpaddon}: for instance,
%    \begin{verbatim}\usepackage[hypertext,printer:acme-wilejet]{cdpaddon}\end{verbatim}
%    activates the hyperlinks and selects the colors for the
%    ACME WileJet printer.
%
%    When no \opz{printer:}\ldots\ option is specified, a default
%    definition file is loaded, as explained in the next section.  For
%    elegance, you can explicitly request this default definition file with
%    the \opz{printer:Default} option (note the capitalization).  Of
%    course, this implies that you cannot have a definition file called
%    \filedir{Default.def}; but \filedir{default.def} is absolutely OK,
%    and you can select it with \opz{printer:default}.  Moreover, the
%    \opz{printer:None} option forces the \packlass{\cdpaddon} package to
%    ignore the configuration file and to use the emergency, built-in
%    colors; again, \opz{printer:none}, instead, tries to load a color
%    definition file called \filedir{none.def}.
%
%    \subsubsection{Declaring the default color definition file}
%
%    Most users will have only one printer, and even those users who
%    have access to several printers will use one of them more often than
%    the others.  Therefore, it is wise to have a second way of selecting
%    a definition file, to be used when the user does not specify one.
%    This is done by indicating in a configuration file the name of a
%    default color definition file.  This configuration file is called
%    \filedir{\cdpshues}.
%
%    The \filedir{\cdpshues} file should contain only zero or one (but
%    preferably one!) "\DeclareCDPSealHuesDefault" command.  This command
%    may be used only here, and only once, since it deactivates itself
%    when executed, and also stops \LaTeX\ from reading any further in
%    the configuration file.  In its unique (mandatory) argument, one
%    puts the name, \emph{without} the extension \filedir{.def}, of the
%    default color definition file.  Do not include any other command in
%    your configuration file, because the effect of any other command is
%    undefined.
%
%    The \filedir{\cdpshues} file included in the \Bundle\ contains
%    comments that help you to modify it in order to declare your
%    personal default color definition file.  The recommended way of
%    doing this is:
%    \begin{enumerate}
%    ^^A ( paren match
%    \renewcommand*{\labelenumi}{\theenumi)}
%    \item
%    make a backup copy (good idea indeed!) of the original configuration
%    file under a convenient name, for example
%    \filedir{\cdpshues.original};
%    \item
%    modify the \filedir{\cdpshues} file following the advice given
%    in its comments;
%    \item
%    if you want, delete all comments from the (new version of the)
%    \filedir{\cdpshues} file, to save disk space.
%    \end{enumerate}
%
%    The obsolete version of the \packlass{\cdpaddon} package
%    documented in~\cite{cdpaddon} was not configurable: it was
%    programmed to read the color definitions from a file called
%    \filedir{cdpshues.def}, and this name was hard-coded in the package.
%    To maintain compatibility with this version, the file
%    \filedir{\cdpshues} included in the \Bundle\ designates as the
%    default color definition file exactly a file named
%    \filedir{cdpshues.def}.  Consequently, if you  install the supplied
%    files without making any change to them, the \packlass{\cdpaddon}
%    package will continue to exhibit the old behavior, reading the
%    legacy \filedir{cdpshues.def} file if you have one installed, and
%    adopting the emergency colors otherwise.  Note that no actual
%    \filedir{cdpshues.def} file is included in the \Bundle.
%
%    \subsection{Defining the captions for unsupported languages}
%
%    Like many other document classes and packages, the classes and
%    packages of the \Bundle\ mark up some portions of the output they
%    produce by adding certain descriptive strings, that, by default, are
%    written in Italian.  For example, when you have requested the
%    \sty{headings} page style, the name of the addressee, which is printed
%    atop pages, is preceded by the string ``\emph{A:}'' (=~``To:'');
%    similarly, when you issue the command "\tableofcontents" in a documents
%    that adopts the \packlass{\articoletteracdp} document class, the table it
%    produces is titled ``\emph{Sommario}'' (=~``Contents''); and so on.
%
%    When the \Bundle\ was used only by the members of the
%    \emph{Coordinamento}, the Italian defaults it provided for those captions
%    were, of course, quite adequate; as long as its use remained circumscribed
%    to the Italian \LaTeX\ community, they were still acceptable; but now, 
%    questions about how to adapt the \Bundle\ to foreign languages have 
%    begun to be asked in some Internet forums by users around the world,
%    pushing me to reconsider the matter.
%
%    Of course, the Italian captions are not (nor they have ever been)
%    ``hard-wired'' in the code: they are defined by macros that follow the
%    usual naming conventions ("\headtoname", "\contentsname", and so on).
%    Thus, it's only a matter of redefining these ``hooks'' to suit the target
%    language.  However, it would be desirable to have some standard
%    definitions set for each language; but unfortunately, this cannot be 
%    attained just by loading the \packlass{\babel} package, for two reasons.
%    In the first place, there are some captions that are specific to the
%    \Bundle\ and are therefore not cared for by the \packlass{\babel}
%    package: for example, the (optional) subject of a letter is preceded by
%    the expansion of "\subjectname" (which is ``\emph{Oggetto:}'' in Italian
%    and should be ``Subject:'' in English), a hook the
%    \packlass{\babel} package knows nothing about.  Secondarily, even for
%    those hooks that are standard, sometimes the definition provided by the
%    \packlass{\babel} package seems (at least to me) not adequate for a
%    letter; in particular, alas, if you load \packlass{\babel} with the
%    \opz{italian} option (as you ordinarily do when you are writing in
%    Italian), it actually \emph{cancels} the definitions preset by the
%    \Bundle, substituting for them strings that I~deem more suitable for
%    articles or books, for which they are indeed intended, than for letters
%    (for example, \( "\contentsname" \to \mbox{``\emph{Indice}''} \)
%    in \packlass{\babel}, instead of
%    \( "\contentsname" \to \mbox{``\emph{Sommario}''} \), as defined by the
%    \Bundle;
%    \( "\refname" \to \mbox{``\emph{Riferimenti bibliografici}''} \) 
%    in \packlass{\babel},
%    instead of \( "\refname" \to \mbox{``\emph{Testi citati}''} \), as
%    I~prefer; etc.).\footnote{I~do not insist on these captions being defined
%    in the way the \Bundle\ currently uses: if the \LaTeX\  community
%    thinks that such definitions are inadequate, I~have no objection at all,
%    of course, to changing them.}
%
%    To supply a \emph{provisional} solution to this problem, a new component 
%    has been added to the \Bundle: the \packlass{\cdpbabel} package.
%    The idea is that, when using one of the document classes of the
%    \Bundle, you load the \packlass{\cdpbabel} package \emph{instead of} 
%    \packlass{\babel}, and let the former load the latter on your behalf;
%    in this way, you offer it a chance to augment, or amend, the definitions 
%    made by \packlass{\babel} itself.  This solution might seem inelegant
%    (and admittedly it is), but the problem is more subtle than it may look
%    at first sight, involving also compatibility issues with existing
%    documents, and I~need to further investigate it.  Hopefully, a more
%    satisfactory  scheme will be found for future releases.\footnote{More
%    generally, it can be observed that the document classes of the
%    \Bundle\ rely too heavily on ancillary packages, and that this reconfirms
%    the ``patched-up'' nature of their design; just think of the entanglement
%    between the \packlass{\letteracdp} class and the \packlass{\cdpaddon}
%    package---a typical Italian \emph{pasticcio}, it should be admitted!}
%
%    In practice, all the \packlass{\cdpbabel} package has to do is (to load 
%    \packlass{\babel} and) to issue an 
%    "\addto{\captions"\meta{language}"}{"\ldots"}" command (or better, 
%    one such command for each required \meta{language}), with ``\ldots''
%    replaced by the appropriate redefinitions; the list, and the details,
%    of such redefintions are of course dictated by \meta{language},
%    so \packlass{\cdpbabel} takes them from what we will call a ``C.D.P.
%    language definition file''.  This is a text file that, by convention,
%    must be named \filedir{cdpnames}\meta{language}\filedir{.ldf},
%    where \meta{language} is the name of the corresponding language option
%    (for example,
%    \begin{verbatim}\usepackage[english,italian]{cdpbabel}\end{verbatim}
%    invokes both \filedir{\cdpnamesenglish} and  \filedir{\cdpnamesitalian},
%    in this order), and which must adhere to the format shown
%    in fig.~\ref{fig:cdpnames}.
%
%    \begin{figure}[tbp]
%      \fontsize{9}{11}\selectfont
%      \zerolistvertspaces
%      \begin{flushleft}
%        "\ProvidesFile{cdpnames"\meta{language}".ldf}["\meta{date \& version}"]"
%      \end{flushleft}
%      \begin{verbatim}
%
%\def\@cdpbabel@letter@names{%\end{verbatim}
%      \begin{flushleft}
%        "  \def\subjectname      {"\meta{Subject:}"}%"\\
%        "  \def\registeredname   {"\meta{Registered}"}%"\\
%        "  \def\registeredRRname {"\meta{Registered R.R.}"}%"\\
%        "  \def\andccname        {"\meta{cc (in addresses)}"}%"\\
%        "  \def\ccname           {"\meta{cc (at end of letters)}"}%"\\
%        "  \def\enclname         {"\meta{Encl:}"}%"\\
%        "  \def\PSname           {"\meta{P.S.:}"}%"\\
%        "  \def\headtoname       {"\meta{To:}"}%"\\
%        "  \def\lettername       {"\meta{Letter}"}%"
%      \end{flushleft}
%      \begin{verbatim}
%  % More captions could be added in the future.
%}
%\def\@cdpbabel@artlet@names{%\end{verbatim}
%      \begin{flushleft}
%        "  \def\contentsname     {"\meta{Contents}"}%"\\
%        "  \def\listfigurename   {"\meta{List of figures}"}%"\\
%        "  \def\listtablename    {"\meta{List of tables}"}%"\\
%        "  \def\refname          {"\meta{References}"}%"\\
%        "  \def\indexname        {"\meta{Index}"}%"\\
%        "  \def\figurename       {"\meta{Figure}"}%"\\
%        "  \def\tablename        {"\meta{Table}"}%"\\
%      \end{flushleft}
%      \begin{verbatim}
%  % More captions could be added in the future.
%}
%
%\endinput\end{verbatim}
%      \caption{Contents of a \filedir{cdpnames}\meta{language}\filedir{.ldf} 
%        file}
%      \label{fig:cdpnames}
%    \end{figure}
%
%    As you can see, a ``C.D.P. language definition file'' must define two 
%    macros, named "\@cdpbabel@letter@names" and "\@cdpbabel@artlet@names",
%    respectively: in the first you put the redefinitions that should be
%    added to "\captions"\meta{language} when only the \packlass{\letteracdp}
%    class has been loaded; in the second you list the additional redefinitions
%    that apply if the \packlass{\articoletteracdp} class is loaded too;
%    and that's all.  The listing shown in fig.~\ref{fig:cdpnames} details exactly
%    what hooks need to be redefined when switching to another language;
%    in principle, you must supply a suitable redefinition for each of them,
%    but of course, when a hook is already defined by the \packlass{\babel}
%    package in a way that you think suits, you may omit it from your list
%    (or, perhaps better, comment it out).  Look at the two provided files
%    for inspiration, and in particular at \filedir{\cdpnamesenglish} for the
%    intended meaning of the captions (which sould be quite obvious, however).
%
%    At present, the \Bundle\ ships with \emph{just two} such definition
%    files included, namely \filedir{\cdpnamesitalian} for Italian
%    and \filedir{\cdpnamesenglish} for English: for all other languages,
%    you'll have to write and install appropriate files yourself.
%    Needless to say, you are most welcome if, after doing so, you want to
%    contribute your work for inclusion in future releases of the
%    \Bundle.  Suggestions for amending the captions specified in the two
%    existing files are most welcome too; for Italian, it is also a matter of
%    updating the captions originally defined by the \packlass{\letteracdp}
%    and \packlass{\articoletteracdp} document classes so that they remain
%    ``in sync'' with those specified in the \filedir{\cdpnamesitalian} file.
%
%    It is hardly worth remarking that ``C.D.P. language definition files''
%    naturally belong to the same directory where the \Bundle\ is located, 
%    and \emph{not} to any directory of the \packlass{\babel} system!
%
%    One final word of clarification: two of the abovementioned captions,
%    namely "\ccname"
%    and "\andccname", look like they are the same, but they actually differ:
%    the latter is prepended to \emph{addresses} to which the letter is sent
%    as a ``carbon copy'', whilst the former is used when the names from those
%    addresses are enumerated again \emph{at the end} of a letter (in the same
%    place where enclosures are also listed).  In Italian, "\andccname"
%    should expand to ``\emph{e~p.~c.}'', but "\ccname" just to
%    ``\emph{P.~c.}''; hence, there is at least one language in which the
%    distinction is relevant.
%
%    \subsection{Documentation}
%
%    To produce this documentation, run \LaTeX\ three times (for the
%    table of contents to be correct) on the file \filedir{\cdpbundl.dtx}.
%    This won't produce the index and the change history, however: for
%    those, you have to run MakeIndex on the files \filedir{\cdpbundl.idx}
%    and \filedir{\cdpbundl.glo}, produced during the previous \LaTeX\
%    run, with the styles \filedir{gind.ist} and \filedir{gglo.ist},
%    respectively (these styles are part of the standard \LaTeX\
%    distribution); then pass \filedir{\cdpbundl.dtx} through \LaTeX\
%    twice more.
%
%    Starting with version 0.36 of the \Bundle, a (quite trivial!\@) makefile
%    that ``knows'' how to produce the documentation is offered along with the 
%    Bundle itself.  Although it is not a required part of the distribution
%    (as per LPPL\@), you may find that some distributors supply it all the
%    same (I~hope the CTAN\@ sites will do so).  With this makefile in the same 
%    directory as \filedir{\filename}, the shell command
%    \begin{quote}
%      \ttfamily
%      make doc
%    \end{quote}
%    will take all the necessary actions to produce the full documentation
%    (in PDF\@; the modifications you need to introduce into the makefile
%    in order to obtain DVI\@ output should be quite obvious, however).
%
%    The same makefile can also be used to extract the various class, package,
%    and ancillary (definition and configuration) files: simply issue the
%    command
%    \begin{quote}
%      \ttfamily
%      make code
%    \end{quote}
%    at the shell prompt; whereas
%    \begin{quote}
%      \ttfamily
%      make
%    \end{quote}
%    will \emph{both} extract the code files \emph{and} typeset the
%    documentation.  Type
%    \begin{quote}
%      \ttfamily
%      make help
%    \end{quote}
%    for more information.
%
% \section{How to use the \Bundle}
%
%    The \Bundle\ v.~0.36 contains two \LaTeX\ document classes,
%    namely \packlass{\letteracdp} and \packlass{\articoletteracdp},
%    and two helper \LaTeX\ packages, called \packlass{\cdpaddon}
%    and \packlass{\cdpbabel}, plus a certain number of definition
%    and configuration files related to these packages.
%    As already said, the actual purpose of this section is not
%    to explain you how to use these macro files, but only to give you
%    references to documents where you can find the explanations.
%
%    For instructions on how to use the \packlass{\letteracdp} class
%    the reader is referred to \cite{tutti,esempi,etichette,nts,ver028,ver031}.
%    Note, however, that the class is syntactically compatible with the
%    \packlass{letter} standard \LaTeX\ class, in the sense that a
%    document prepared for the \packlass{letter} class can be compiled
%    without errors with the \packlass{\letteracdp} class; but the output
%    will be different.
%
%    As a minimal reference, fig.~\ref{fig:input} illustrates the typical
%    structure of a simple input file for the \packlass{\letteracdp}
%    document class.
%
% \iffalse
%   Meta-comment: a <*gobble> guard is needed here to prevent the
%   DocStrip program from putting the lines beginning with "%%" in the
%   generated files.
%<*gobble>
% \fi
%    \begin{figure}[tbp]
%      \zerolistvertspaces
%      \begin{verbatim}\documentclass[boldsubject,italicsignature,smartindent]{letteracdp}
%% Of course, the above options are a matter of personal taste...
%\usepackage[T1]{fontenc} % as it is now customary
%% Since we are writing in English, we need to redefine some captions;
%% the following package automatically takes care of this:
%\usepackage[english]{cdpbabel}
%% Presently only two languages are supported: "english" and "italian".
%
%% Name, address and signature of the sender (the name is optional):
%\name{Revinu Jitis Drofnats}
%\address{
%    Revinu~J. \textsc{Drofnats}\\
%    Department of Farm Ecology\\
%    University of St.\,Anford\\
%    Haga Alto, CA~94321 (U.S.A.)
%}
%\signature{R.~J. Drofnats\\Professor}
%\date{February~8, 2015} % as usual, date is optional, default is \today
%\place{St.\,Anford}     % place where the letter is written (optional)
%
%% Uncomment the following declaration if you want running heads:
%% \pagestyle{headings}
%
%
%
%\begin{document}
%
%\begin{letterhead}[Brian~K. Reid]{
%    Prof.~Brian~K. \textsc{Reid}\\
%    Department of Electrical Engineering\\
%    Stanford University\\
%    Stanford, CA~94305 (U.S.A.)
%}[
%    This is the optional subject of the letter.
%]
%
%\opening{Dear Prof.~Reid,}
%
%this letter is typeset using a \texttt{letterhead} environment, so it
%will be printed with the letterhead of the \emph{Coordinamento} above
%it; if you don't want it, use the \texttt{letter} environment instead.
%You can also use the \texttt{foldedletterhead} environment in place
%of the \texttt{letterhead} environment (or \texttt{foldedletter} in
%place of \texttt{letter}) to obtain a letter prepared to be folded in
%three parts, as one usually does before putting it in an envelope.
%Experiment to see what happens.
%
%\closing{Sincerely,}
%
%\end{letterhead}
%
%\end{document}\end{verbatim}
%      \caption{A sample input file for the \packlass{\letteracdp}
%        document class}
%      \label{fig:input}
%    \end{figure}
% \iffalse
%</gobble>
% \fi
%
%    For instructions on how to use the \packlass{\articoletteracdp}
%    class, see~\cite{novita}.
%
%    For instructions on how to use the \packlass{\cdpaddon} package,
%    see~\cite{cdpaddon}.  Note, however, that this document describes an
%    obsolete version, which lacks the ability to deal with several color
%    definition files.  The use of the \packlass{\cdpaddon} package for 
%    customizing the letterhead, though, is covered in~\cite{ver036}.
%
%    For instructions on how to use the \packlass{\cdpbabel} package,
%    see~\cite{ver036}.
%
%    Please note that before using the \Bundle\ you must read the
%    following license to see whether its terms are acceptable for you,
%    especially for what concerns the lack of any warranty; if they are
%    not, don't use this program.
%
%    \subsection{License}
%    \label{sS:License}
%
%    The \Bundle\ is \emph{not} in the public domain: its author,
%    Gustavo \textsc{Mezzetti}, owns the copyright, and in general retains
%    all the rights therein; but as a special exception, the author
%    grants you the permissions indicated below.
%
%    \subsubsection{Distribution and/or modification}
%
%    The \Bundle\ may be distributed and/or modified under the
%    conditions of the \LaTeX\ Project Public License, either version~1.3
%    of this license or (at your option) any later version.  The latest
%    version of this license is in
%    \begin{quote}
%      \ttfamily
%      http://www.latex-project.org/lppl.txt
%    \end{quote}
%    and version~1.3 or later is part of all distributions of \LaTeX\
%    version 2005/12/01 or later.
%
%    The \Bundle\ has the LPPL maintenance status ``author-maintained''.
%
%    The file \filedir{manifest.txt} included in the \Bundle\ 
%    specifies what the \Bundle\ consists of; more precisely,
%    it explains how the locutions ``Work'' and ``Compiled Work'',
%    used in the \LaTeX\ Project Public License, are to be interpreted
%    in the case of this work.
%
%    \subsubsection{Use}
%
%    The use of the \Bundle\ is unrestricted, provided that you
%    accept the terms and conditions of the \LaTeX\ Project Public
%    License and of the following subsection for what concerns the absence
%    of any warranty.
%
%    \subsubsection{No warranty}
%
%    There is absolutely no warranty for the \Bundle.  The
%    Copyright Holder provides the \Bundle\ ``as is'', without
%    warranty of any kind, either expressed or implied, including, but
%    not limited to, the implied warranties of merchantability and
%    fitness for a particular purpose.  The entire risk as to the quality
%    and performance of the \Bundle\ is with you.  Should the
%    \Bundle\ prove defective, you assume the cost of all necessary
%    servicing, repair, or correction.
%
%    In no event will The Copyright Holder, or any other party who may
%    distribute and/or modify the \Bundle\ as permitted by the
%    \LaTeX\ Project Public License, be liable to you for damages,
%    including any general, special, incidental or consequential damages
%    arising out of any use of the \Bundle\ or out of inability to
%    use it (including, but not limited to, loss of data, data being
%    rendered inaccurate, or losses sustained by anyone as a result of any
%    failure of the \Bundle\ to operate with any other programs),
%    even if The Copyright Holder or said other party has been advised of
%    the possibility of such damages.
%
%    \subsection{Options of the \packlass{\letteracdp} class}
%    \label{sS:Options}
%
%    Of course, you load the \packlass{\letteracdp} class by means of the
%    usual "\documentclass" declaration, which allows you to specify
%    various options.  For some reason, the complete list of all the
%    options recognized by this class has never been given in any of the
%    previous documents containing instructions about it; so, we give it
%    here.
%
%    We shall now list all the options recognized by the
%    \packlass{\letteracdp} class, including the standard ones it can
%    understand.  If an option does not appear in the list given below,
%    then that option is not recognized by the \packlass{\letteracdp}
%    class, even if it is a standard one (that is, documented in the
%    \textsl{\LaTeX book}~\cite{LaTeXbook}).
%
%    We begin with the list of standard options.  Since they are
%    already described in the \textsl{\LaTeX book}~\cite{LaTeXbook}, we
%    describe only the options that behave differently from the standard;
%    the others are just listed without description.
%
%    \begin{description}
%
%    \item[\iopz{10pt}\eopz{11pt}\eopz{12pt}\fopz]
%
%    \item[\iopz{letterpaper}\eopz{legalpaper}\eopz{executivepaper}\eopz
%      {a4paper}\eopz{a5paper}\eopz{b5paper}\fopz]
%    \hfil\null\linebreak
%    Note that \packlass{\letteracdp} uses \opz{a4paper} as the default.
%
%    \item[\iopz{landscape}\fopz]
%
%    \item[\iopz{final}\eopz{draft}\fopz]
%
%    \item[\iopz{oneside}\eopz{twoside}\fopz]
%
%    \item[\iopz{onecolumn}\eopz{twocolumn}\fopz] The \opz{twocolumn}
%    option is recognized, but triggers an error; the \opz{onecolumn}
%    option is recognized, but it is ignored because in any case the
%    document is typeset in one-column mode.  Note, however, that
%    requesting \opz{onecolumn} as a global option could make sense:
%    precisely, it could serve to inform possible packages that the
%    document has only one column.  But, precisely for this reason, this
%    option is requested by default during the class initialization;
%    there is hence no reason to specify it, but it does no harm.
%
%    \item[\iopz{leqn}\fopz]
%
%    \item[\iopz{fleqn}\fopz]
%
%    \end{description}
%
%    We now list the option specific to the \packlass{\letteracdp} class.
%
%    \begin{description}
%
%    \item[\iopz{mediumsubject}\eopz{boldsubject}\fopz]
%    The \opz{mediumsubject} option requests that the subject of the
%    letters be typeset in medium weight, while the \opz{boldsubject}
%    option makes it appear in boldface type.  The default is
%    \opz{mediumsubject}.
%
%    \item[\iopz{uprightsignature}\eopz{italicsignature}\fopz]
%    The \opz{uprightsignature} option requests that the signature of the
%    letters be typeset in upright shape, while the \opz{italicsignature}
%    option makes it appear in italic shape.  The default is
%    \opz{uprightsignature}.
%
%    \item[\iopz{signaturerule}\eopz{nosignaturerule}\fopz]
%    Drawing or not a thin rule to mark the spot where you should sign a
%    letter is a matter of style that, as such, should apply to the whole
%    document; for this reason, this behavior is requested by menas of an
%    option, namely \opz{signaturerule}.  As you can guess, \opz{signaturerule}
%    causes the rule to be drawn, while \opz{nosignaturerule}, which is defined
%    for the sake of completeness, suppresses it.  Anyway, the rule is never
%    drawn inside a \env{signatureenv*} environment; this includes signatures
%    generated by the \mbox{$*$-form} of the "\closing" command.
%    You can adjust the width of the rule by modifying, with "\setlength",
%    the "\signaturerulewidth" rigid length.
%
%    \item[\iopz{noPS}\eopz{usePS}\fopz]
%    These two options are obsolete (to say the least!\@) and should
%    \emph{not} be used any longer.  If you want to improve the graphical
%    quality of the seal, simply load the \packlass{\pictee} package in
%    your document, along with the \packlass{\cdpaddon} package (of course, 
%    if you do so, PostScript or PDF\@ printing will be needed to produce the 
%    output).
%
%    \item[\iopz{indent}\eopz{noindent}\eopz{smartindent}\eopz{shortindent}\fopz]
%    These options are used to specify the paragraph indentation, but
%    only for letters; any portion of text that is not included in a
%    letter---but normally there is no such text---is not affected by
%    these options.  The \opz{indent} option sets the paragraph
%    indentation, for letters, to one tenth of the text width,
%    unless this amount looks too bad, in which case the indentation
%    is set to 2~picas.  The \opz{noindent} option completely
%    suppressess paragraph indentation within letters.  The \opz{smartindent}
%    option sets the paragraph indentation, for letters, to the width
%    of (the last line of) the salutation, unless this amount looks
%    too bad, in which case it behaves like \opz{indent}.  The \opz{shortindent}
%    option maintains also for letters the same indentation used for
%    text not included in letters (see below); its name, chosen to be
%    more easily remembered, is due to the fact that normally it involves
%    a shorter indentation than the default one.  The default is \opz{indent}.
%    I repeat that these options do not affect any text that should appear
%    outside of letters, whose paragraphs will be always indented by
%    2~em, where the unit of 1~em is taken from the main document font;
%    this is also the paragraph indentation for letters if the
%    \opz{shortindent} option is specified.  Paragraphs of
%    postscripts are never indented.
%
%    \item[\iopz{105x37labels}\eopz{70x37labels}\eopz{Avery5352labels}\fopz]
%    These options indicate the format of the address labels.  The
%    first two options indicate address labels of mm~105\,$\times$\,37
%    and mm~70\,$\times$\,37, respectively.  The third option
%    indicates the address labels used by the standard \packlass{letter}
%    class.  Note the uppercase letter in \opz{Avery5352labels}.  The
%    default is \opz{105x37labels}.
%
%    \end{description}
%
%    \subsection{Customizing the letterhead}
%    \label{sS:Customization}
%
%    A new, long-awaited feature is available at last: it is now possible, 
%    with reasonable ease, to customize the letterhead produced by the
%    \env{letterhead} environment.~:-D\closeofsentencespace
%    As a matter of fact, this customization has always been possible---the
%    \env{letterhead} environment would have been completely useless
%    otherwise---but instructions on how to carry it out were given uniquely
%    in documents that were only privately circulated; moreover, these
%    instructions required you to modify some of the internal commands of the
%    \Bundle.  What the present version does is to provide a reasonable user
%    interface for making these internal changes and (which is not less
%    important) to document this interface.
%
%    The customization of the letterhead basically involves the following three
%    steps:
%
%    \begin{enumerate}
%
%    \item
%    First of all, you need to load the \packlass{\cdpaddon} package,
%    which is part of the \Bundle, passing to it the (new) option
%    \opz{customletterhead}.
%
%    \item
%    The \packlass{\cdpaddon} package defines two environments, named
%    \env{customletterhead} and \env{customletterfoot}, respectively,
%    that can be used more or less like a \env{minipage} environment.
%    You should put, in any place before the first letter (not entirely exact,
%    but almost so: we'll refine this information underneath), a
%    \env{customletterhead} environment holding the
%    description of your letterhead.  Just pretend you are composing a
%    \env{minipage} with your letterhead inside.
%
%    \item
%    If you also want to customize the page footer (as it is ordinarily the
%    case), define its contents inside a similarly placed
%    \env{customletterfoot} environment.
%    If you omit this step, the footer will be empty.
%
%    \end{enumerate}
%
%    \DescribeEnv{customletterhead}^^A
%    \DescribeEnv{customletterfoot}^^A
%    More formally, the \packlass{\cdpaddon} package makes two new environments
%    available, named as stated above, that conform to the following syntax:
%
%    \begin{flushleft}
%      "\begin{customletterhead}{"\meta{wdth}"}"\quad
%        \meta{text}\quad
%      "\end{customletterhead}"\\
%      "\begin{customletterfoot}{"\meta{wdth}"}"\quad
%        \meta{text}\quad
%      "\end{customletterfoot}"
%    \end{flushleft}
%
%    Both these environments typeset \meta{text} in a \env{minipage} with
%    width \meta{wdth} and save the result in a box register specifically
%    reserved for this purpose (each environment has its own, dedicated
%    register); subsequently, if the \opz{customletterhead} option has been
%    specified, the contents of these box registers are used in place of the
%    header and footer ordinarily defined by the \packlass{\letteracdp}
%    document class.  Note that the \packlass{\cdpaddon} package defines the
%    \env{customletterhead} and \env{customletterfoot} environments in any
%    case, \emph{independently} of which options you pass to it.
%
%    The contents specified inside \env{customletterhead} and
%    \env{customletterfoot} will be horizontally centered in the header and
%    footer boxes, respectively; these boxes are defined by the page layout,
%    but normally their left and right edges coincide with those of the main
%    text.  If the \meta{wdth} you have specified for the contents themselves
%    exceeds the width available in the header\slash footer, they will stick
%    out by the same amount of space on both sides (in brief: the contents are
%    centered with "\hss" at both ends).  Normally, you pass "\textwidth" as
%    the \meta{wdth} parameter\footnote{I~have long been in doubt whether to make
%    \meta{wdth} an optional parameter, with default value equal to
%    \texttt{\bslash textwidth}; eventually, I~decided for a syntax that
%    parallels the syntax of the \env{minipage} environment, and should
%    therefore be obvious to remember.} and align things as you prefer
%    \emph{inside} the \env{minipage}, perhaps creating sub-boxes or using 
%    \env{picture}s.
%
%    Coming to vertical alignment, the boxes produced by the
%    \env{customletterhead}\slash\env{customletterfoot} environments are
%    ``smashed'' down to null height and depth;
%    for \env{customletterhead}, the bottom edge of the box
%    is aligned with the baseline of the header, whilst for
%    \env{customletterfoot} it is the top edge which is aligned
%    with the baseline of the footer.  If you want the contents of
%    \env{customletterhead} to sink below the baseline of the header,
%    simply backspace vertically at their end, \emph{i.e.},
%    use "\vspace{"\meta{dist}"}" with a negative \meta{dist},
%    and the bottom edge of your custom header will be placed exactly
%    \( \left|\meta{dist}\right| \) below the baseline of the header
%    as defined by the general page layout.
%    Similarly, a "\vspace{"\meta{dist}"}" with a negative \meta{dist}
%    placed at the beginning of your custom footer will rise its top edge
%    exactly \( \left|\meta{dist}\right| \) above the baseline of the footer
%    defined by the general page layout.
%
% \iffalse
%   Meta-comment: a <*gobble> guard is needed here to prevent the
%   DocStrip program from putting the lines beginning with "%%" in the
%   generated files.
%<*gobble>
% \fi
%    \begin{figure}[tbp]
%      \zerolistvertspaces
%      \begin{verbatim}\documentclass
%    [twoside,boldsubject,italicsignature,shortindent,signaturerule]
%    {letteracdp}[2015/01/20]
%\usepackage[T1]{fontenc}
%\usepackage[english]{cdpbabel}
%\usepackage[customletterhead]{cdpaddon}[2015/01/21]
%\usepackage{url,lipsum}
% 
%\address{
%    Gustavo \textsc{Mezzetti}\\
%    \protect\url{gustavo.mezzetti@istruzione.it}
%}
%\signature{Gustavo Mezzetti}
%\date{February~8, 2015}
%\place{Padova}
%
%
%
%% Definition of your letterhead occurs here:
%
%\begin{customletterhead}{\textwidth}
%    \centering \Huge
%    My Huge Centered Letterhead
%\end{customletterhead}
%\begin{customletterfoot}{\textwidth}
%    \raggedleft \tiny
%    \ruleacrossheadorfoot
%    My (almost unreadable) small print\\
%    flushed against the right margin.
%\end{customletterfoot}
%
%
%
%\begin{document}
%
%\begin{foldedletterhead}[Whom it may concern]
%    {To whom it may concern}
%    [My own letterhead, at last!]
%
%\makepresentation
%\maketopdate\relax
%
%\lipsum[1-2]
%
%\makesignature
%
%\end{foldedletterhead}
%
%\end{document}\end{verbatim}
%      \caption{How to customize the letterhead}
%      \label{fig:customletter}
%    \end{figure}
% \iffalse
%</gobble>
% \fi
%
%    Fig.~\ref{fig:customletter} shows a sample input file for a letter with
%    customized letterhead.  Note that, among the others, we load the
%    \packlass{\cdpaddon} package with the \opz{customletterhead} option.
%    Note also that the \env{customletterhead}\slash\env{customletterfoot}
%    environments \emph{can} be placed in the preamble; this makes it very easy
%    to create a definition file containing the description of your custom
%    letterhead, to be subsequently loaded in your source files,
%    or even to define your custom version of the \packlass{\letteracdp}
%    and \packlass{\articoletteracdp} document classes.  For example, the three
%    files \filedir{myletter.cls}, \filedir{myarticletter.cls}, and
%    \filedir{mylogo.def}, whose contents are listed in
%    fig.~\ref{fig:myletter}, \ref{fig:myarticletter}, and~\ref{fig:mylogo},
%    respectively, together define two new classes, called \packlass{myletter}
%    and \packlass{myarticletter}, that respectively parallel
%    \packlass{\letteracdp} and \packlass{\articoletteracdp}, but produce the
%    same letterhead as the file of 
%    fig.~\ref{fig:customletter}.\footnote{Please note that \packlass{myletter} 
%    also used to be (a great many years ago) the obsolete name of the 
%    \packlass{akletter} document class.  Instructing you to create a custom 
%    class by that name shouldn't cause you any trouble in
%    ^^A ( paren match
%    2015~:-), but I~want to inform you all the same of the potential name 
%    conflict.}
%
%    \begin{figure}[tbp]
%      \zerolistvertspaces
%      \begin{verbatim}\NeedsTeXFormat{LaTeX2e} % LaTeX2e is required!
%\ProvidesClass{myletter}
%              [2015/02/08 v0.01 (development)]
%\LoadClassWithOptions{letteracdp}[2015/01/20]
%\input{mylogo.def}
%\endinput\end{verbatim}
%      \caption{Contents of the \filedir{myletter.cls} file}
%      \label{fig:myletter}
%    \end{figure}
%
%    \begin{figure}[tbp]
%      \zerolistvertspaces
%      \begin{verbatim}\NeedsTeXFormat{LaTeX2e} % LaTeX2e is required!
%\ProvidesClass{myarticletter}
%              [2015/02/08 v0.01 (development)]
%\LoadClassWithOptions{articoletteracdp}[2015/01/20]
%\input{mylogo.def}
%\endinput\end{verbatim}
%      \caption{Contents of the \filedir{myarticletter.cls} file}
%      \label{fig:myarticletter}
%    \end{figure}
%
%    \begin{figure}[tbp]
%      \zerolistvertspaces
%      \begin{verbatim}\ProvidesFile{mylogo.def}[2015/02/08 v0.01 (development)]
%
%\RequirePackage[customletterhead]{cdpaddon}[2015/01/21]
%
%\begin{customletterhead}{\textwidth}
%    \centering \Huge
%    My Huge Centered Letterhead
%\end{customletterhead}
%\begin{customletterfoot}{\textwidth}
%    \raggedleft \tiny
%    \ruleacrossheadorfoot
%    My (almost unreadable) small print\\
%    flushed against the right margin.
%\end{customletterfoot}
%
%\endinput\end{verbatim}
%      \caption{Contents of the \filedir{mylogo.def} file}
%      \label{fig:mylogo}
%    \end{figure}
%
%    One final word: the \env{customletterhead}\slash\env{customletterfoot}
%    environments save their contents in their respective box registers by
%    means of a \emph{local} assignment, subject to ordinary scoping rules:
%    this can be useful if you want to change the letterhead for just a single
%    letter in a source file that contains many ones.
%
%    See~\cite{ver036} for more information.
%
% \StopEventually{
%    \setcounter{secnumdepth}{0}
%    \providecommand*\bysame{\leavevmode\hbox to3em{\hrulefill}\thinspace}
%
%    \clearpage
%    \begin{thebibliography}{99}
%    \addcontentsline{toc}{section}{\refname}
%
%    \bibitem{LaTeXbook}
%    L.~Lamport, \emph{\LaTeX---A Document Preparation System---User's
%       Guide and Reference Manual}, 2nd~edition, Addison-Wesley,
%       Reading, 1994.
%
%    \bibitem{tutti}
%    G.~Mezzetti, \emph{Breve presentazione d'una classe \LaTeX, denominata
%       \packlass{\letteracdp}, utile nella preparazione delle lettere del
%       Coordinamento}, technical note downloadable from:\\
%       \rlap{\url{http://www.math.unipd.it/~mezzetti/Gustavo/Ludic/CDP/presentazione.tex}}
%
%    \bibitem{esempi}
%    \bysame, \emph{Esempi d'uso della classe \packlass{\letteracdp}},
%       technical note downloadable from:\\
%       \rlap{\url{http://www.math.unipd.it/~mezzetti/Gustavo/Ludic/CDP/esempi.tex}}
%
%    \bibitem{etichette}
%    \bysame, \emph{Etichette degli indirizzi con la classe \packlass{\letteracdp}},
%       technical note downloadable from:\\
%       \rlap{\url{http://www.math.unipd.it/~mezzetti/Gustavo/Ludic/CDP/etichett.tex}}
%
%    \bibitem{novita}
%    \bysame, \emph{Grandi novit\`{a} per \packlass{\letteracdp}:
%       arriva \packlass{\articoletteracdp}!}, technical note downloadable from:\\
%       \rlap{\url{http://www.math.unipd.it/~mezzetti/Gustavo/Ludic/CDP/novita.tex}}
%
%    \bibitem{nts}
%    \bysame, \emph{Forse non tutti sanno che\ldots},
%       technical note downloadable from:\\
%       \rlap{\url{http://www.math.unipd.it/~mezzetti/Gustavo/Ludic/CDP/nontuttisanno.tex}}
%
%    \bibitem{ver028}
%    \bysame, \emph{Annuncio delle versioni 0.28 della classe \packlass{\letteracdp}
%       e 0.08 della classe \packlass{\articoletteracdp}},
%       technical note downloadable from:\\
%       \rlap{\url{http://www.math.unipd.it/~mezzetti/Gustavo/Ludic/CDP/ver0-28.tex}}
%
%    \bibitem{cdpaddon}
%    \bysame, \emph{Il pacchetto \packlass{\cdpaddon}},
%       technical note downloadable from:\\
%       \rlap{\url{http://www.math.unipd.it/~mezzetti/Gustavo/Ludic/CDP/cdpaddonistr.tex}}
%
%    \bibitem{ver031}
%    \bysame, \emph{Annuncio della versione 0.31 del \emph{\Bundle}},
%       technical note downloadable from:\\
%       \rlap{\url{http://www.math.unipd.it/~mezzetti/Gustavo/Ludic/CDP/ver0-31.tex}}
%
%    \bibitem{ver036}
%    \bysame, \href
%          {http://mirrors.ctan.org/macros/latex/contrib/cdpbundl/cdp-ver-0-36.pdf}
%          {\emph{The \Bundle\ version~0.36}},
%       available on CTAN\@ as part of the \href
%          {http://www.ctan.org/pkg/cdpbundl}
%          {\Bundle} vers.~0.36.
%
%    \end{thebibliography}
% }
%
%
%
% \clearpage
% \part{Implementation}
%
% \section{About this part}
%
%    This part is of interest only to \LaTeX\ hackers; to avoid
%    having this part printed, look in the file \filedir{\filename}
%    for a line that looks \emph{exactly} like this
%    \begin{verbatim}%% \OnlyDescription % uncomment to discard Implementation part\end{verbatim}
%    and remove the two leading percent signs ("%%").
%
% \section{A driver for this document}
%
%    This part of the file is \emph{not} included in any generated file:
%    it is simply the driver.
%    \begin{macrocode}
%<*driver>
%    \end{macrocode}
%
%    To begin with, we load the \packlass{ltxdoc} class and the 
%    \packlass{hypdoc} package.
%    \begin{macrocode}
\documentclass{ltxdoc}
\usepackage{hypdoc}
%    \end{macrocode}
%    We now set a few typesetting options.
%    First of all, we want a history listing and a full index, the latter
%    organized by line numbers.
%    \begin{macrocode}
\RecordChanges
\EnableCrossrefs
\CodelineIndex
%    \end{macrocode}
%    If you don't want to include the second part of this document,
%    \emph{Implementation}, uncomment the line containing the command
%    "\OnlyDescription".
%    \begin{macrocode}
%% \OnlyDescription % uncomment to discard Implementation part
%    \end{macrocode}
%    Finally, setting "\hfuzz" and "\vfuzz" to 0~points is only one
%    of the many neurotic symptoms of the author!
%    \begin{macrocode}
\hfuzz = 0pt
\vfuzz = 0pt
%    \end{macrocode}
%    Now input this same file, using \DS\ conventions.
%    \begin{macrocode}
\begin{document}
  \DocInput{cdpbundl.dtx}
%    \end{macrocode}
%    Then print the change list and the index.  We put these commands in
%    the driver, rather than in the comments of this file, because
%    producing the change list and the index is somewhat cumbersome, and some
%    users could prefer to omit them: such users should simply use a
%    different driver.
%    \begin{macrocode}
  \clearpage \PrintChanges
  \clearpage \PrintIndex
%    \end{macrocode}
%    When this file is read directly by \LaTeX\ without the intervention
%    of \DS, the following line will make \TeX\ stop
%    reading.
%    \begin{macrocode}
\end{document}
%    \end{macrocode}
%    End of driver module.
%    \begin{macrocode}
%</driver>
%    \end{macrocode}
%    \noindent\null\par
%
% \section{The code for the \packlass{\letteracdp} class}
%
%    This part of the file goes into \filedir{\letteracdp.cls}.
%    \begin{macrocode}
%<*letter>
%    \end{macrocode}
%    The reader must be warned that this is only a preliminary release
%    of this code: a thorough reorganization of the macros has already
%    been planned for future releases.  Instead of putting all the code
%    in a single file and giving it the form of a document class,
%    in future releases the code will be split into several files,
%    part of which will be packages, part definition and/or
%    configuation files, and so on.
%
%    \subsection{Identification}
%
%    I don't remember exactly why I asked for the June 1997 release
%    of \LaTeXe, but I am sure that there was a reason; so, let us
%    continue to ask for it.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1997/06/01] % LaTeX2e is required!
%    \end{macrocode}
%    The usual identification; the string \texttt{(**incomplete**)}
%    will eventually be removed, I hope!
%    \begin{macrocode}
\ProvidesClass{letteracdp}
              [2015/02/08 v0.36 (**incomplete**)]
%    \end{macrocode}
%    Print a copyright message on the terminal, just below the name
%    of the class.
%    \begin{macrocode}
\typeout{Copyright (C) 1999-2015 by Gustavo MEZZETTI,
  all rights reserved.}
%    \end{macrocode}
%
%    \begin{macro}{\@letteracdp}
%    Define a macro containing the name of the class; it will be used
%    in error and warning messages.  This is done for two reasons:
%    first of all, to save tokens in macro definitions, but also to
%    avoid the risk of mispelling the name of the class in some place.
%    \begin{macrocode}
\@ifdefinable\@letteracdp{\def\@letteracdp{letteracdp}}
%    \end{macrocode}
%    \end{macro}
%
%    \subsection{Initial code}
%
%    \begin{macro}{\Coordinamento}
%    Define the following macros near the beginning of the code, so it
%    will be easy to change them.  The first one is the full name of the
%    \emph{Coordinamento}:
%    \begin{macrocode}
\newcommand*\Coordinamento{%
  Coordinamento dei Dottorandi e dei Dottori di Ricerca
  dell'Universit{\char "E0} di Padova%
}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\CoordinamentoWWW}
%    The second one is its web address:
%    \begin{macrocode}
\newcommand*\CoordinamentoWWW{%
  http://www.dei.unipd.it/\string~assdott/%
}
%    \end{macrocode}
%    \end{macro}
%
%    Declare the fonts used to print the letterhead and the footer;
%    they are declared as ``fixed fonts'' so that they are not
%    affected by options (\emph{e.g.}, \opz{12pt}), packages
%    (\emph{e.g.}, \opz{times}), and so on.
%    \begin{macro}{\@lh@nss}
%    Main font for letterhead is Computer Modern Sans Serif 12pt
%    (LetterHead\slash Normal Sans Serif):
%    \begin{macrocode}
\DeclareFixedFont\@lh@nss{T1}{cmss}{m}{n} {12}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@lh@bss}
%    A couple of initials are printed using a bigger font, that is,
%    Computer Modern Sans Serif 17pt (LetterHead\slash Bigger Sans
%    Serif):
%    \begin{macrocode}
\DeclareFixedFont\@lh@bss{T1}{cmss}{m}{n} {17}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@lh@rm}
%    Main font for footer: Computer Modern Roman 9pt
%    (LetterHead\slash RoMan):
%    \begin{macrocode}
\DeclareFixedFont\@lh@rm {T1}{cmr} {m}{n} {9}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@lh@it}
%    The words ``World Wide Web'' are printed in italics
%    (LetterHead\slash ITalics):
%    \begin{macrocode}
\DeclareFixedFont\@lh@it {T1}{cmr} {m}{it}{9}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@lh@tt}
%    And finally, the web address is printed in teletype font
%    (LetterHead\slash TeleType):
%    \begin{macrocode}
\DeclareFixedFont\@lh@tt {T1}{cmtt}{m}{n} {9}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@ptsize}
%    The following macro will be used later to decide which ``class
%    layout'' file to load.
%    \begin{macrocode}
\newcommand\@ptsize{}
%    \end{macrocode}
%    \end{macro}
%
%    A couple of useful commands that are missing from the \LaTeX\
%    kernel; we leave this explicative comment in the code too.
%    \begin{macrocode}
%% A couple of useful things that are missing from the LaTeX kernel:
%    \end{macrocode}
%    \begin{macro}{\@newrigidlength}
%    The first is similar to "\newlength", but allocates a
%    \textoken{dimen} rather than a \textoken{glue}.
%    \begin{macrocode}
\@ifdefinable\@newrigidlength{\def\@newrigidlength#1{%
  \@ifdefinable#1{\newdimen#1}%
}}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@msetlength}
%    The second can be used to say, for instance,
%\begin{verbatim}
%\@msetlength{\someRubberLength}{2}{\anotherRubberLength}
%\end{verbatim}
%    to set "\someRubberLength" to twice the value of
%    "\anotherRubberLength", without destroying the stretch and
%    shrink components (recall that, on the contrary,
%\begin{verbatim}
%\setlength{\someRubberLength}{2\anotherRubberLength}
%\end{verbatim}
%    only sets the \emph{natural length} of "\someRubberLength" to
%    twice the \emph{natural length} of "\anotherRubberLength", and
%    both the stretch and shrink components of "\someRubberLength" to
%    zero).
%    \begin{macrocode}
\@ifdefinable\@msetlength{\def\@msetlength#1#2#3{%
  #1#3\multiply#1#2\relax
}}
%    \end{macrocode}
%    \end{macro}
%
%    A number of counter, lengths, etc.\ are defined here, at the
%    beginning of the class, to detect as soon as possible if any name
%    conflicts with an already defined one.  The idea is that, since the
%    class is pretty long, it is better to avoid to discover near the end
%    that it cannot be used because of a name that is already defined;
%    but of course, with the speed of modern computers this is not at all
%    a problem, so it is very likely that in future releases all
%    declarations will be moved to the place they naturally belong to.
%    Presently, however, they are almost all listed here; for many of
%    them, some explanations are given here, and a more precise description
%    is deferred until the spot where the corresponding entity is used.
%
%    \counterindex{letter}
%    First, we introduce a counter to keep track of the number of letters
%    produced.  \textbf{Warning:} {\em this counter is used also for
%    internal bookkeeping, so don't change its value unless you know what
%    you are doing!}
%    \begin{macrocode}
\newcounter{letter}
%    \end{macrocode}
%
%    \counterindex{emptyaddrlabels}
%    The following five counters are used in connection with the
%    address labels optionally printed at the end of a compiled file.
%    The \cnt{emptyaddrlabels} counter holds the number of labels to
%    leave blank when starting to print (the first sheet of) the address
%    labels; this is useful if some labels on the same sheet have already
%    been peeled off.
%    \begin{macrocode}
\newcounter{emptyaddrlabels}
%    \end{macrocode}
%    \counterindex{addrlabelrows}
%    A single sheet of address labels contains many labels.  For example,
%    in the well-known (in the U.S.) Avery 5352 format each sheet
%    contains ten labels, organized in two columns and five rows.  Other
%    formats contain different number of rows and columns of labels.  To
%    cope with all these different formats, the number of rows and
%    columns of labels is kept in two counters: \cnt{addrlabelrows} holds
%    the number of rows
%    \begin{macrocode}
\newcounter{addrlabelrows}
%    \end{macrocode}
%    \counterindex{addrlabelcolumns}
%    and \cnt{addrlabelcolumns} holds the number of columns.
%    \begin{macrocode}
\newcounter{addrlabelcolumns}
%    \end{macrocode}
%    \counterindex{label}
%    The \cnt{addrlabelrows} and \cnt{addrlabelcolumns} counters are
%    usually set once for all by the code provided in a suitable
%    "\DeclareOption" declaration, as the result of the user's request of
%    one of the options devoted to specifying the address label format
%    (\opz{105x37labels}, etc.).  In some exceptional circumstances, they
%    can also be reset by the user, but even in this case, once set they
%    are not changed any more.  They are therefore not real ``counters'',
%    but rather (style) parameters.  The following two counters, instead,
%    are ``real'', \emph{running} counters: they hold a running index
%    which identifies the current label.  The \cnt{label} counter holds
%    the index of a label inside a given letter
%    \begin{macrocode}
\newcounter{label}[letter]
%    \end{macrocode}
%    \counterindex{totallabel}
%    while the \cnt{totallabel} counter holds the global index of a
%    label, that is, the index of the label in the whole document.
%    \begin{macrocode}
\newcounter{totallabel}
%    \end{macrocode}
%    It is possible that a single letter has more than one label
%    associated, because sometimes letters are sent to more than one
%    addressee.
%
%    \counterindex{equation}
%    \counterindex{footnote}
%    \counterindex{mpfootnote}
%    In our document class, the letter is the main unit in which the
%    document is organized.  Therefore, we want that equations, footnotes,
%    and footnotes inside minipages be numbered within letters.
%    \begin{macrocode}
\@addtoreset{equation}{letter}
\@addtoreset{footnote}{letter}
\@addtoreset{mpfootnote}{letter}
%    \end{macrocode}
%
%    \begin{macro}{\@lh@left@margin}
%    The second type of parameters we are going to define are rigid
%    lengths (\textoken{dimen}'s).  The first two govern the position of
%    the CDP seal with respect to the text margins (see also
%    fig.~\ref{fig:plo} on page~\pageref{fig:plo}).  More precisely,
%    "\@lh@left@margin" is the horizontal distance from the left margin of
%    text to the \emph{right} edge of the seal\ldots
%    \begin{macrocode}
\@newrigidlength\@lh@left@margin
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@lh@right@margin}
%    \ldots and "\@lh@right@margin" is the distance from the right edge of
%    the rule found in the rightmost part of the letterhead to the right
%    margin of text.
%    \begin{macrocode}
\@newrigidlength\@lh@right@margin
%    \end{macrocode}
%    \end{macro}
%    A couple of lenghts used as internal registers, to hold
%    values that must be passed to certain macros---we shall explain
%    their use when we come to it.
%    \begin{macrocode}
\@newrigidlength\@block@inden
\@newrigidlength\@block@width
%    \end{macrocode}
%    \begin{macro}{\longindentation}
%    The following are style parameters used to govern the typesetting
%    of the addresses and of the signature.  Some of them, in turn, are
%    defined in terms of another, crucial style parameter, the so-called
%    ``long indentation''; this is the length by which items that appear
%    in the right-hand half of the letter should be indented: roughly, it
%    is equal to half the value of "\textsize", but it can be fine-tuned
%    at ``"\begin{document}"-time'' for better alignment with some parts
%    of the letterhead.
%    \begin{macrocode}
\@newrigidlength\longindentation
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\senderindentation}
%    The amount by which the sender address should be indented:
%    \begin{macrocode}
\@newrigidlength\senderindentation
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\senderwidth}
%    The width of the column in which the sender address should be
%    typeset:
%    \begin{macrocode}
\@newrigidlength\senderwidth
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addresseeindentation}
%    The indentation\ldots
%    \begin{macrocode}
\@newrigidlength\addresseeindentation
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addresseewidth}
%    \ldots and column width for the addresse address:
%    \begin{macrocode}
\@newrigidlength\addresseewidth
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\signatureindentation}
%    Indentation\ldots
%    \begin{macrocode}
\@newrigidlength\signatureindentation
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\signaturewidth}
%    \ldots and width for the signature:
%    \begin{macrocode}
\@newrigidlength\signaturewidth
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\signaturerulewidth}
%    The width of the rule drawn by the ``factory'' definition of
%    "\signaturerule" (which is backed up in "\CDPFactorySignatureRule"):
%    \begin{macrocode}
\@newrigidlength\signaturerulewidth
\setlength\signaturerulewidth{5cm}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\foldedheight}
%    There are macros that provide the ability to typeset letters that
%    are going to be folded before being put into the envelopes; these
%    macros ensure that no text is typeset astride of the folding.  The
%    vertical distance from the upper edge of the \emph{paper} (not of
%    the text) to the folding is kept in "\foldedheight".  A value of
%    zero or less (\emph{e.g.}, $-"\maxdimen"$) prohibits folded letters:
%    this can be useful for certain paper sizes, and for safety it is set
%    here as the default.  For paper sizes that allow folded letters, the
%    actual value of "\foldedheight" is set by the code given in the
%    relevant "\DeclareOption".
%    \begin{macrocode}
\@newrigidlength\foldedheight
  \setlength\foldedheight{-\maxdimen}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@folding@ht}
%    In general, the default setting of "\foldedheight" provided by the
%    option handling mechanism should be sufficient.  However, the user
%    is allowed to change the value of "\foldedheight", preferably in the
%    preamble, but also in the document body, if a certain simple
%    precaution is taken.  This can be useful if one wants to alter the
%    default behavior, \emph{e.g.}, to have letters that are two-folded
%    rather then three-folded, or to allow folded letters also when using
%    a paper format, like A5, that normally does not allow them.  Useful,
%    sure, but it rises a problem: the algorithm that decides where to
%    split the text between the part that must go above the folding and
%    the part that must go below it requires that the value of
%    "\foldedheight" lie within a certain range.  Obviously we cannot ask
%    the user to know what range is acceptable, so we adopt the following
%    solution: we define an ``internal backup'' of "\foldedheight",
%    called "\@folding@ht" for historical reasons; then, the user is
%    asked to call the macro "\checkfoldedheight" (see below) whenever
%    (s)he changes the value of "\foldedheight"; this macro checks the
%    new value and, if it is OK, copies it in the internal dimension
%    "\@folding@ht" (actually, after some scaling conversions), otherwise
%    it sets an internal flag which disables folded letters and issues a
%    warning.  A slight variant of "\checkfoldedheight", which differs
%    only in the warning produced, is called automatically at the
%    "\begin{document}", so the user is \emph{not} required to call
%    "\checkfoldedheight" if the changes to "\foldedheight" are made in
%    the preamble.
%    \begin{macrocode}
\@newrigidlength\@folding@ht
%    \end{macrocode}
%    \end{macro}
%    The following three dimensions will be described when we come to
%    the point where they are used.
%    \begin{macrocode}
\@newrigidlength\@lh@folding@ht
\@newrigidlength\@above@folding@margin
\@newrigidlength\@above@folding@shrink
%    \end{macrocode}
%
%    Now we pass to rubber lengths, \emph{i.e.}, \TeX's
%    \textoken{skip}'s.  The first two are something like internal
%    registers used to pass certain style parameters back and forth
%    between macros.
%    \begin{macrocode}
\newlength\@block@space
\newlength\@block@andspace
%    \end{macrocode}
%    \begin{macro}{\@below@folding@skip}
%    This is an internal style parameter which specifies the amount of
%    vertical blank space that should be left, in folded letters, between
%    the folding and the text that follows it.  It can be redefined in
%    packages or other classes, or, in an emergency, by the final user.
%    It is a rubber length, but in this class it is assigned, as we shall
%    see later, a value without stretch or shrink components.  Note that
%    the actual space left between the folding and the text will usually
%    be greater than, or at most equal to, the value of
%    "\@below@folding@skip", because lines of text are usually aligned to
%    integer multiples of half the "\baselineskip".
%    \begin{macrocode}
\newlength\@below@folding@skip
%    \end{macrocode}
%    \end{macro}
%
%    The following ten (rubber) length are style parameters that affect
%    the amount of vertical space left before and after certain building
%    blocks, like addresses and signature.  The user can freely change
%    them with "\setlength".  Note that all these spaces are added with
%    "\addvspace", so only the largest one survives if two of them occur
%    in a row.
%    \begin{macro}{\aboveaddressvspace}
%    The amount of vertical space above the sender's or addressee's
%    address:
%    \begin{macrocode}
\newlength\aboveaddressvspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\andaddressvspace}
%    The amount of vertical space between two consecutive addresses
%    separated with "\and" or "\andcc":
%    \begin{macrocode}
\newlength\andaddressvspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\belowaddressvspace}
%    The amount of vertical space below the sender's or addressee's
%    address:
%    \begin{macrocode}
\newlength\belowaddressvspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\abovesubjectvspace}
%    The amount of vertical space above the subject:
%    \begin{macrocode}
\newlength\abovesubjectvspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\presubjectvspace}
%    The amount of vertical space between the text specified with
%    "\presubject" (if any) and the main body of the subject:
%    \begin{macrocode}
\newlength\presubjectvspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\belowsubjectvspace}
%    The amount of vertical space below the subject:
%    \begin{macrocode}
\newlength\belowsubjectvspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\abovesignaturevspace}
%    The amount of vertical space above the signature:
%    \begin{macrocode}
\newlength\abovesignaturevspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\abovesignatureshortvspace}
%    The amount of vertical space above the signature when the
%    \mbox{$*$-form} of the "\makesignature" command is used (this
%    happens, for instance, when the \mbox{$*$-form} of the
%    "\closing" command is used):
%    \begin{macrocode}
\newlength\abovesignatureshortvspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\belowsignaturevspace}
%    The amount of vertical space below the signature:
%    \begin{macrocode}
\newlength\belowsignaturevspace
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\belowpresentationvspace}
%    The amount of vertical space below the presentation as a whole
%    (the presentation contains the sender address, the addressee
%    address, and the optional subject); this also ends the block of
%    these style parameters:
%    \begin{macrocode}
\newlength\belowpresentationvspace
%    \end{macrocode}
%    \end{macro}
%
%    Allocation of some other rigid lengths (\textoken{dimen}'s)
%    follows: these concern the layout of the sheets of address
%    labels that the user wants to employ.  To save a few keystrokes,
%    we define the "\do" macro to do the allocation and to initialize
%    the value of the allocated length to zero.
%    \begin{macrocode}
\def\do#1{\@newrigidlength #1\setlength #1\z@}
%    \end{macrocode}
%    Then we allocate and initialize the individual lengths.
%    \begin{macro}{\addrlabelsleftmargin}
%    This is the amount of horizontal space between the left edge of the
%    sheet of address labels and the left edge of the leftmost column of
%    labels on the sheet.
%    \begin{macrocode}
\do\addrlabelsleftmargin
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addrlabelstopmargin}
%    This is the amount of vertical space between the top edge of the
%    sheet of address labels and the top edge of the upper row of labels
%    on the sheet.
%    \begin{macrocode}
\do\addrlabelstopmargin
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addrlabelshsep}
%    This is the amount of horizontal space between two columns of labels
%    on the sheet.
%    \begin{macrocode}
\do\addrlabelshsep
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addrlabelsvsep}
%    This is the amount of vertical space between two rows of labels on
%    the sheet.
%    \begin{macrocode}
\do\addrlabelsvsep
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addrlabelborder}
%    Normally, you don't want to write into the labels starting from
%    their physical border: you want to leave a little margin between the
%    text inside the labels and their edges.  The amount of margin is
%    kept in this style parameter (sorry, no provision is made to specify
%    different margins in the two directions).
%    \begin{macrocode}
\do\addrlabelborder
%    \end{macrocode}
%    \end{macro}
%
%    The following four lengths don't have reasonable default values,
%    so they are not initialized here.  The code for each individual
%    address label option will initialize the first two, and the
%    other two are computed later.
%    \begin{macro}{\addrlabelwidth}
%    The (horizontal) width of a single address label.
%    \begin{macrocode}
\@newrigidlength\addrlabelwidth
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addrlabelheight}
%    The (vertical) height of a single address label.
%    \begin{macrocode}
\@newrigidlength\addrlabelheight
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addrlabeltrimwidth}
%    This is a computed value, that the user should regard as
%    read-only: it is the width of a single address label
%    ("\addrlabelwidth"), diminished by twice the width of the
%    border ("\addrlabelborder").
%    \begin{macrocode}
\@newrigidlength\addrlabeltrimwidth
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\addrlabeltrimheight}
%    Analogous: "\addrlabelheight" diminished by twice
%    "\addrlabelborder".  This ends this block of code.
%    \begin{macrocode}
\@newrigidlength\addrlabeltrimheight
%    \end{macrocode}
%    \end{macro}
%
%    Now, we just declare a few names we are going to use.  The idea
%    is to trigger an error message if one of them is already defined.
%    \begin{macro}{\@cdp@reserved}
%    This is a reserved name that will be used as a
%    ``general-purpose'' container, much like "\reserved@a", etc.
%    \begin{macrocode}
\@ifdefinable\@cdp@reserved{}
%    \end{macrocode}
%    \end{macro}
%    Miscellaneous names, we shall describe them in a more
%    appropriate place.
%    \begin{macrocode}
\@ifdefinable\@empty@block{}
\@ifdefinable\@beginlabels{}
\@ifdefinable\@beginlabelgroup{}
\@ifdefinable\@mlabel{}
\@ifdefinable\@endlabelgroup{}
\@ifdefinable\@endlabels{}
\@ifdefinable\startaddrlabel{}
\@ifdefinable\startaddrlabel{}
\@ifdefinable\stopaddrlabel{}
\@ifdefinable\ifactuallabel{}
\@ifdefinable\ChosenMakeOpening{}
\@ifdefinable\ChosenMakeClosing{}
\@ifdefinable\ChosenMakeSignature{}
%    \end{macrocode}
%
%    \begin{macro}{\@lett@decl}
%    We define a token register used to save declarations to execute
%    when a letter begins (see below).
%    \begin{macrocode}
\@ifdefinable\@lett@decl{\newtoks\@lett@decl}
%    \end{macrocode}
%    \end{macro}
%
%    We finally arrive to something simple and clearly comprehensible.
%    We initialize the addresses, the signature, etc.  to empty strings.
%    To do that, we define the "\do" macro as follows:
%    \begin{macrocode}
\def\do#1{\@ifdefinable#1{\let#1\@empty}}
%    \end{macrocode}
%    \begin{macro}{\thesenderaddress}
%    The address of the sender, \emph{including her/his name}:
%    \begin{macrocode}
\do\thesenderaddress
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\thesendername}
%    The name of the sender (essentially, this is provided only for
%    compatibility with the \packlass{letter} standard \LaTeX\ class):
%    \begin{macrocode}
\do\thesendername
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\thesendersignature}
%    The signature of the sender:
%    \begin{macrocode}
\do\thesendersignature
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\thesenderlocation}
%    The room number, etc., of the sender:
%    \begin{macrocode}
\do\thesenderlocation
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\thesenderphone}
%    The phone number of the sender:
%    \begin{macrocode}
\do\thesenderphone
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\theaddresseeaddress}
%    The complete address of the addressee, \emph{including her/his
%    name, title, etc.}:
%    \begin{macrocode}
\do\theaddresseeaddress
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\theaddresseename}
%    The name of the addressee (used in page headings):
%    \begin{macrocode}
\do\theaddresseename
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\thesubject}
%    The subject of the letter:
%    \begin{macrocode}
\do\thesubject
%    \end{macrocode}
%    \end{macro}
%
%    There are also some internal macros that need to be initialized to
%    "\@empty".
%    \begin{macro}{\@subject@style}
%    The subject can be typeset either in medium weight or in
%    boldface.  This is achieved by inserting the "\@subject@style"
%    token in front of it: its default definition given here makes
%    this token a no-op (no font attributes are changed), but the code
%    that implements options like \opz{mediumsubject} or
%    \opz{boldsubject} can "\let" this token be equal to, say,
%    "\mdseries" or "\bfseries", to obtain the desired changes in the
%    font attributes.  If more than one attribute needed to be
%    changed (\emph{e.g.}, if somebody wanted to define a
%    \opz{bolditalicsubject} option), then "\def" should be used
%    instead of "\let"; for instance, one would write
%    \begin{verbatim}\def\@subject@style{\bfseries\itshape}\end{verbatim}
%    We don't make "\@subject@style" a token register because the
%    ``"\let" case'' is the most common.
%    \begin{macrocode}
\do\@subject@style
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@signature@style}
%    This is analogous to "\@subject@style", but for the signature.
%    The code for the \opz{uprightsignature} option "\let"s it equal to
%    "\upshape", and the code for the \opz{italicsignature} option to
%    "\itshape".
%    \begin{macrocode}
\do\@signature@style
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@place}
%    The place where the letter is written: starting from version~0.34,
%    this macro is used as the default value for the optional argument of
%    "\@makeopening", "\makedate", etc.  It is logically and functionally
%    analogous to "\@date".
%    \begin{macrocode}
\do\@place
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@begin@letter@hook}
%    This hook is executed when a letter starts, at the very end of the
%    process of setting up the ``letter-making'' environment, just
%    after the declarations stored in "\@lett@decl".  It may turn out to
%    be useful in packages and derived classes, and in fact it is used by
%    the \packlass{articoletteracdp} class.  It is not a token register
%    because it is envisioned that many independent segments of code
%    will want to store tokens in it, and this can easily be achieved
%    with the "\g@addto@macro" function, which requires that its
%    argument be a macro, not a token register.
%    \begin{macrocode}
\do\@begin@letter@hook
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@end@letter@hook}
%    This is analogous to "\@begin@letter@hook", but is executed at the
%    end of every ``letter-making'' environment, after its last page has
%    been finished off and ejected, but before writing to the
%    \filedir{.aux} file the information for the associated address labels.
%    Note that there is another hook, called "\stopletter" and described
%    later, which is executed \emph{before} ejecting the last page of
%    the letter.
%    \begin{macrocode}
\do\@end@letter@hook
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@begin@block@or@and@hook}
%    Vers.~0.36: new hook used in "\@block@everypar" to support signature
%    rules.
%    \begin{macrocode}
\do\@begin@block@or@and@hook
%    \end{macrocode}
%    \end{macro}
%
%    The following macros are defined only inside a \env{subject}
%    environment.  We want that they cause an error if used outside of that
%    environment, but we also want to be sure that their names are not
%    already defined.  We achieve this by calling "\@ifdefinable", and
%    then "\let"ting the relevant token be "\@undefined".
%    \begin{macrocode}
\def\do#1{\@ifdefinable#1{\let#1\@undefined}}
\do\presubject
\do\registered
\do\registeredRR
%    \end{macrocode}
%
%    The following are integer (numeric) style parameters: they are
%    initialized later, and contain several penalty values used to assist
%    \TeX\ in choosing sightful and meaningful page breaks, and also for
%    other purposes that will be explained later.  For now we content
%    ourselves with the simple allocation with "\newcount".
%    \begin{macrocode}
\def\do#1{\@ifdefinable#1{\newcount#1}}
%    \end{macrocode}
%    The first five parameters are actually ``constants'' analogous to
%    "\@lowpenalty", "\@medpenalty", and "\@highpenalty"; they are
%    typically assigned very high penalty values, and their names all
%    begin with "\@fold@" because they are used in connection with the
%    algorithm that takes care of ``folded presentations'' (explained
%    later).
%    \begin{macrocode}
\do\@fold@basepenalty
\do\@fold@lowpenalty
\do\@fold@medpenalty
\do\@fold@highpenalty
\do\@fold@toppenalty
%    \end{macrocode}
%    The real style parameters begin here.  Their values are assigned
%    later, in various spots of the code; indeed, the values assigned
%    vary according to certain circumstances, for example, they are
%    changed from the default when a ``presentation'' is entered.
%    We'll discuss all this later on.
%    \begin{macro}{\@b@frompenalty}
%    This is the penalty inserted at the beginning of a \env{sender}
%    environment---the environment used to typeset the sender address.
%    \begin{macrocode}
\do\@b@frompenalty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@i@frompenalty}
%    This is the penalty inserted before additional sender addresses
%    separated with "\and".
%    \begin{macrocode}
\do\@i@frompenalty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@e@frompenalty}
%    This is the penalty inserted at the end of a \env{sender}
%    environment.
%    \begin{macrocode}
\do\@e@frompenalty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@b@topenalty}
%    This is the penalty inserted at the beginning of an
%    \env{addressee} environment---the environment used to typeset the
%    addressee address.
%    \begin{macrocode}
\do\@b@topenalty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@i@topenalty}
%    This is the penalty inserted before additional addressee addresses
%    separated with "\and" or "\andcc".
%    \begin{macrocode}
\do\@i@topenalty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@e@topenalty}
%    This is the penalty inserted at the end of an \env{addressee}
%    environment.
%    \begin{macrocode}
\do\@e@topenalty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@b@subjpenalty}
%    This is the penalty inserted at the beginning of a \env{subject}
%    environment---the environment used to typeset the subject.
%    \begin{macrocode}
\do\@b@subjpenalty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@e@subjpenalty}
%    This is the penalty inserted at the end of a \env{subject}
%    environment.
%    \begin{macrocode}
\do\@e@subjpenalty
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@e@prespenalty}
%    This is the penalty inserted at the end of a presentation as a
%    whole.
%    \begin{macrocode}
\do\@e@prespenalty
%    \end{macrocode}
%    \end{macro}
%    The following are two internal registers, used to pass penalty
%    values back and forth between macros.
%    \begin{macrocode}
\do\@i@penalty
\do\@e@penalty
%    \end{macrocode}
%    \begin{macro}{\@cdp@gencount}
%    We also take the opportunity to define a general-purpose numeric
%    register, used for short-term storage when needed.  This ends the
%    block of count registers.
%    \begin{macrocode}
\do\@cdp@gencount
%    \end{macrocode}
%    \end{macro}
%
%    Six internal switches are defined next.
%    \begin{macrocode}
\def\do#1{\@ifdefinable#1{\newif#1}}
%    \end{macrocode}
%    \begin{macro}{\if@use@eepic@}
%    The user can request, through the \opz{usePS} option, that the
%    \packlass{eepic} package be used to trace the lines that make up the
%    CDP seal, for better graphical result; the user's indication,
%    however, will be honored only if the \packlass{eepic} package is
%    available on the system (of course!).  This switch is set to ``true''
%    if the \packlass{eepic} package is present and should be used.
%    \begin{macrocode}
\do\if@use@eepic@
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\if@do@fold@}
%    This switch is ``true'' when folded letters are allowed, and
%    ``false'' when they are shunned; the setting is made by the
%    "\checkfoldedheight" command, and also at
%    ``"\begin{document}"-time''.
%    \begin{macrocode}
\do\if@do@fold@
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\if@making@labels@}
%    Prior to version~0.36, the code for generating the address labels (that
%    had been copied from the standard \packlass{letter} class) wrote to the
%    \filedir{.aux} file the data concerning the addresses even when no labels
%    were being produced.  This is totally useless.  Starting from
%    version~0.36, the following conditional has been introduced in order to
%    avoid this.
%    \begin{macrocode}
\do\if@making@labels@
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\if@signature@rule@}
%    True if a typeset signature should be surmounted by a ``signature rule''
%    intended to guide the signer's hand.  New in vers.~0.36 (2015 Feb~08).
%    \begin{macrocode}
\do\if@signature@rule@
%    \end{macrocode}
%    \end{macro}
%    The other two switches cannot be explained here.  They are defined
%    differently, without using "\newif", so that they are always changed
%    "\global"ly.
%    \begin{macrocode}
\@ifdefinable\if@new@block@{
  \def\@new@block@true {\global\let\if@new@block@\iftrue }
  \def\@new@block@false{\global\let\if@new@block@\iffalse}
}
\@ifdefinable\if@empty@and@{
  \def\@empty@and@true {\global\let\if@empty@and@\iftrue }
  \def\@empty@and@false{\global\let\if@empty@and@\iffalse}
}
%    \end{macrocode}
%
%    We need the following box registers to hold precompiled parts of
%    the letterhead and of the footer.
%    \begin{macro}{\@logo@box@base}
%    This holds the main part of the CDP seal; more precisely, that
%    part that appears both in the \ldots\sty{letterhead} and in the
%    \sty{logo}\ldots page styles.
%    \begin{macrocode}
\newsavebox\@logo@box@base
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@logo@box@addS}
%    This holds the part of the CDP seal that should be added to the
%    part contained in "\@logo@box@base" to obtain the seal as it appears
%    in the \sty{logo}\ldots page styles.
%    \begin{macrocode}
\newsavebox\@logo@box@addS
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@logo@box@addL}
%    This holds the part of the CDP seal that should be added to the
%    part contained in "\@logo@box@base" to obtain the seal embedded
%    in the \ldots\sty{letterhead} page styles.
%    \begin{macrocode}
\newsavebox\@logo@box@addL
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@oordinamento@box}
%    This holds the writing ``oordinamento dei Dottorandi di Padova''
%    that appears in the letterhead, with the initial~``C'' being
%    supplied by the seal.
%    \begin{macrocode}
\newsavebox\@oordinamento@box
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@name@and@WWW@box}
%    This holds the footer used in the \sty{firstletterhead} and
%    \sty{foldedletterhead} page styles, which contains the full name of
%    the \emph{Coordinamento} and its web address.  This ends the block
%    of box registers, too.
%    \begin{macrocode}
\newsavebox\@name@and@WWW@box
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\and}
%    It is possible to specify several addresses (both for the sender
%    and the addressee) as well as several signatures; the various parts
%    are separated by "\and" commands.  Strictly speaking, it is an error
%    to expand the token "\and" anywhere but inside the \env{sender},
%    \env{addressee}, and \env{signatureenv} environments (the
%    environments used to produce the sender address, the addressee
%    address, and the signature, repectively); hence, the correct thing
%    to do here would be to initialize "\and" to produce an error
%    message, and then redefine it in the various environments, as
%    required in each case.  But alas, the code for \packlass{\letteracdp}
%    is still incomplete, and this is one of the things I still have to
%    finish: I don't know exactly how to handle a misplaced "\and", so,
%    for now, I simply decide to ignore it.
%    \begin{macrocode}
\let\and\relax
%    \end{macrocode}
%    Of course, this definition will be changed inside the
%    abovementioned environments, where "\and" must have a special
%    meaning.
%    \end{macro}
%    \begin{macro}{\andcc}
%    Only inside an \env{addressee} environment, the token "\andcc" may
%    be used in place of "\and" to separate addresses of persons to which
%    the letter is sent as a carbon copy.  Its default definition,
%    however, is to act as "\and".
%    \begin{macrocode}
\@ifdefinable\andcc{\def\andcc{\and}}
%    \end{macrocode}
%    \end{macro}
%
%    We need to save the definitions, as initialized by the \LaTeX\
%    kernel, of a couple of macros.
%    \begin{macro}{\m@kel@bel}
%    Saved definition of "\makelabel".
%    \begin{macrocode}
\@ifdefinable\m@kel@bel{\let\m@kel@bel\makelabel}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@@vspace}
%    Saved definition of "\vspace".
%    \begin{macrocode}
\@ifdefinable\@@vspace{\let\@@vspace\vspace}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@indent@pref}
%    This is a multi-way switch used to implement the \opz{indent},
%    \opz{noindent}, etc.\ options, which govern the way in which
%    paragraphs of letters (except~P.S.) are indented.  The code associated
%    with the various options "\let"s this token equal to one of the
%    following keys, which will be interpreted later as specified:
%    \begin{description}
%      \item[F (for ``fixed indent'').]
%        Set "\parindent" to one tenth of "\textwidth", with a threshold
%        value of 2~pica (that is, "\parindent" will be at least 2~pica, even
%        if this is more than one tenth of "\textwidth").
%      \item[N (for ``no ident'').]
%        Set "\parindent" to 0~points.
%      \item[L (for ``leave indent'').]
%        The value of "\parindent" that was in effect outside of the
%        current \ldots\env{letter}\ldots\ environment is retained.
%      \item[O (sorry, I don't remember for what).]
%        Set "\parindent" to the width of the last line of the salutation
%        (\emph{i.e.}, the argument of "\opening" or "\makeopening"); if the
%        salutation is not given, this is the same as~``F''.
%
%        2015 Feb~08 (v.~0.36): I~have conjectured that the choice of the
%        letter~``O'' for this key could have been suggested by the initial of
%        ``opening'', meaning, as it were, ``indent by the extent of the 
%        opening''; but I~cannot remember of having thought of that.
%    \end{description}
%    The default setting is the same as the one implied by the
%    \opz{indent} option.
%    \begin{macrocode}
\@ifdefinable\@indent@pref{\let\@indent@pref F}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\voidisOK}
%    Sometimes, in a letter, you want to omit the sender or the
%    addressee address, or the signature, and it is annoying to see a
%    warning about an ``empty something'' that you left empty
%    deliberately.  For this reason, inside the environments that produce
%    the addresses and the signature you are allowed to use the command
%    "\voidisOK" to disable such warnings.  The idea is that you say
%    something like
%\begin{verbatim}
%\address{\voidisOK}
%\end{verbatim}
%    when you want to declare that the address has intentionally be
%    left void; when the address is actually typeset (and this happens
%    inside an \env{addressee} environment), the command "\voidisOK" will
%    be expanded, causing the warning to be suppressed.  As for the
%    command "\and", the right thing to do would be to define this
%    command only inside the environments in which it can be used; but
%    there are complications arising from the fact that the text
%    specified inside an "\address" declaration can be expanded also at
%    other times, for instance when typesetting the address labels.  For
%    this reason, we take the shortcut of "\let"ting this command equal
%    to "\@empty", so that it will be ignored when it occurs out of place.
%    (We do not "\let" it equal to "\relax" because the latter could
%    confuse an "\ignorespaces"; on the contrary, "\@empty" disappears
%    upon "\write" and "\mark" operations, and this is quite OK\@.) Where
%    appropriate, "\voidisOK" will be redefined to achieve the desired
%    effect.
%    \begin{macrocode}
\@ifdefinable\voidisOK{\let\voidisOK\@empty}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\subjectnamegap}
%    If present, the subject of a letter is typeset with hanging
%    indentation, preceded by the text contained in the command
%    "\subjectname" and separated from it by a certain amount of
%    horizontal white space: the width of this white space is specified
%    by the "\subjectnamegap" macro.  This is a macro and not a
%    \textoken{dimen} register to allow the length to be specified in
%    terms of the font-dependent units like ``em''.  Of course, the
%    hanging indentation includes this horizontal space; note,
%    however, that if "\subjectname" is empty than the
%    "\subjectnamegap" space is not taken into account.
%    \begin{macrocode}
\newcommand*\subjectnamegap{.5em}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\closingindentation}
%    As for the way of typesetting addresses, different countries have
%    different uses about how to indent the closing of the letter: for
%    instance, in Italy the closing is indented like any other, ordinary
%    paragraph, whilst in anglo-saxon letters it is indented by the same
%    amount by which the sender address is indented.  To cope with this,
%    the "\closingindentation" command is introduced, to hold the amount
%    of indentation for the closing: its default definition is
%    "\parindent", so that the closing is indented like an ordinary
%    paragraph, but a ``letter-making'' environment can redefine it,
%    if necessary.  It is a command and not a length, because the
%    value of "\parindent" can change, and actually does change, in
%    the sequel.
%    \begin{macrocode}
\newcommand*\closingindentation{\parindent}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\signaturealignment}
%    Different countries have different conventions also about how the
%    signature should be aligned; for instance, in the U.S.  the
%    signature is set ragged right, but with a hanging indentation equal
%    to the hanging indentation of the sender address, which in the U.S.
%    is printed on the right-hand half of the paper; in Italy, the
%    signature is more or less centered between the margins, and if it
%    contains more than one line, the lines are aligned at their
%    midpoint.  In order to accomodate the various conventions, the token
%    "\signaturealignment" is inserted at the beginning of the
%    \env{signatureenv} environment (the environment one uses to typeset
%    the signature); it is the responsability of the surrounding
%    \ldots\env{letter}\ldots\ environment to "\let" this token equal to
%    "\raggedright", "\centering", etc., as required by the particular
%    letter being produced.  This makes it easy, for instance, to define
%    an \env{asletter} (anglo-saxon letter) environment that prints
%    letters that obey the U.S.  conventions.  The default setting given
%    here has no special meaning: it just sets the signature ragged
%    right.
%    \begin{macrocode}
\newcommand*\signaturealignment{\raggedright}
%    \end{macrocode}
%    \end{macro}
%
%    \subsection{Declaration of options}
%
%    As a general rule, options pertaining to the same functional group
%    are declared in reverse order of desirability, the default option of
%    the group being declared last.  This ensures that if more than
%    one option of the same group is erroneously asked for by the
%    user, the ``most desirable'' one (whatever this means) is
%    executed last, thereby remaining in effect.
%
%    We begin with the options that support the usual page formats.
%    For each such option, the associated code sets appropriate values
%    for the "\paperheight" and "\paperwidth" parameters.  The code also
%    sets the "\foldedheight" parameter, which, as explained above,
%    contains the height at which the sheets of paper should be folded in
%    order to put them into an envelope; this parameter is set to more or
%    less one third of "\paperheight".  For some paper formats, folding
%    is not adequate: for them, folded letters are disabled by setting
%    "\foldedheight" to $-"\maxdimen"$.
%    \begin{macrocode}
\DeclareOption{executivepaper}
   {\setlength\paperheight {10.5in}%
    \setlength\paperwidth  {7.25in}%
    \setlength\foldedheight{3.5in}}
\DeclareOption{legalpaper}
   {\setlength\paperheight {14in}%
    \setlength\paperwidth  {8.5in}%
    \setlength\foldedheight{4.7in}}
\DeclareOption{letterpaper}
   {\setlength\paperheight {11in}%
    \setlength\paperwidth  {8.5in}%
    \setlength\foldedheight{3.7in}}
\DeclareOption{b5paper}
   {\setlength\paperheight {250mm}%
    \setlength\paperwidth  {176mm}%
    \setlength\foldedheight{-\maxdimen}}
\DeclareOption{a5paper}
   {\setlength\paperheight {210mm}%
    \setlength\paperwidth  {148mm}%
    \setlength\foldedheight{-\maxdimen}}
\DeclareOption{a4paper}
   {\setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}%
    \setlength\foldedheight{100mm}}
%    \end{macrocode}
%
%    The \opz{landscape} option is implemented as usual, by
%    exchanging the values of "\paperheight" and "\paperwidth" (note that
%    this option is executed after any one of the options that sets the
%    paper dimensions); but we also disable folded letters by setting
%    "\foldedheight" to $-"\maxdimen"$, because usually one does not want
%    to fold a letter set in landscape orientation!
%    \begin{macrocode}
\DeclareOption{landscape}
   {\setlength\@tempdima   {\paperheight}%
    \setlength\paperheight {\paperwidth}%
    \setlength\paperwidth  {\@tempdima}%
    \setlength\foldedheight{-\maxdimen}}
%    \end{macrocode}
%
%    These are the usual options for setting the main font size: they are
%    copied from the standard \LaTeX\ classes.  See, \emph{e.g.}, the
%    documentation of the standard \packlass{letter} class for
%    explanations.
%    \begin{macrocode}
\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
%    \end{macrocode}
%
%    The way of implementing the \opz{oneside}\slash\opz{twoside}
%    options is again copied from the \packlass{letter} standard \LaTeX\
%    class.
%    \begin{macrocode}
\if@compatibility
  \DeclareOption{twoside}{%
    \@latexerr{No `twoside' layout for letters}\@eha
  }
\else
  \DeclareOption{twoside}{\@twosidetrue  \@mparswitchtrue}
\fi
\DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse}
%    \end{macrocode}
%
%    The \opz{onecolumn}\slash\opz{twocolumn} options are not
%    declared in the \packlass{letter} standard \LaTeX\ class, but I prefer
%    to declare them.  The \opz{twocolumn} options causes an error,
%    because I have never seen letters typeset in two columns mode!
%    \begin{macrocode}
\DeclareOption{twocolumn}{%
  \@latexerr{No `twocolumn' layout for letters}\@eha
}
%    \end{macrocode}
%    The \opz{onecolumn} option is simply ignored, but it is
%    declared, so that it is removed from the list of unused options.
%    \begin{macrocode}
\DeclareOption{onecolumn}{}
%    \end{macrocode}
%
%    More options copied from the standard \LaTeX\ classes.
%    \begin{macrocode}
\DeclareOption{final}{\setlength\overfullrule{0pt}}
\DeclareOption{draft}{\setlength\overfullrule{5pt}}
\DeclareOption{leqno}{\input{leqno.clo}}
\DeclareOption{fleqn}{\input{fleqn.clo}}
%    \end{macrocode}
%
%    Now we have four options for setting the way in which the subject
%    of a letter (if present) and the signature are printed.  As
%    explained above, the setting is done by "\let"ting a conventional
%    token equal to one of the usual NFSS commands used to set individual
%    font attributes; if more than one attribute needed to be changed,
%    "\def" would be used instead of "\let", but fortunately this is not
%    necessary.
%
%    Options for the subject: it can be set in boldface type\ldots
%    \begin{macrocode}
\DeclareOption{boldsubject}{\let\@subject@style\bfseries}
%    \end{macrocode}
%    \ldots or in medium weight.
%    \begin{macrocode}
\DeclareOption{mediumsubject}{\let\@subject@style\mdseries}
%    \end{macrocode}
%
%    Options for the signature: it can be set in italic shape\ldots
%    \begin{macrocode}
\DeclareOption{italicsignature}{\let\@signature@style\itshape}
%    \end{macrocode}
%    \ldots or in upright (normal) shape.
%    \begin{macrocode}
\DeclareOption{uprightsignature}{\let\@signature@style\upshape}
%    \end{macrocode}
%
%    Vers.~0.36 (2015 Feb~08): new option \opz{signaturerule} requests that
%    each typeset signature be surmounted by a ``signature rule'' intended to
%    guide the signer's hand.  This, however, should not affect at all
%    signatures contained in a \env{signatureenv*} environment, the variant of
%    the \env{signatureenv} environment meant for situations in which the
%    letter is not going to be signed by hand.
%    \begin{macrocode}
\DeclareOption{signaturerule}{\@signature@rule@true}
%    \end{macrocode}
%    The \opz{nosignaturerule} option (also new in vers.~0.36) is the opposite 
%    of the above, and is the default.
%    \begin{macrocode}
\DeclareOption{nosignaturerule}{\@signature@rule@false}
%    \end{macrocode}
%    \emph{Remark:} the ability to draw a rule for handwritten signatures has
%    been explicitly requested by some users of the \Bundle, but I~deem the use
%    of such feature questionable, since only pupils in primary school need
%    rules to guide their writing.  Nevertheless, this practice is admittedly
%    ^^A ( paren match
%    fairly common in the business world~:-), so it has now been supported.
%
%    Next, we have the options used to tell whether PostScript
%    commands, inserted by means of the \packlass{eepic} package, should be
%    used, or not, to draw the CDP seal.  Here we simply set the internal
%    switch according to the user's request; if we later find that the
%    \packlass{eepic} package is not available, we shall force the switch
%    to false.
%    \begin{macrocode}
\DeclareOption{usePS}{\@use@eepic@true}
\DeclareOption{noPS}{\@use@eepic@false}
%    \end{macrocode}
%    (These mean ``use PostScript'' and ``don't use PostScript'',
%    respectively.)
%
%    Cheer up!  We are almost over!  (Just with the options, of
%    course!)  We are now to the options for the paragraph
%    indentation within letters.  They are implemented by setting an
%    internal multi-value switch to a conventional key; the meaning of
%    the keys has already been explained above.
%    \begin{macrocode}
\DeclareOption{smartindent}{\let\@indent@pref O}
\DeclareOption{shortindent}{\let\@indent@pref L}
\DeclareOption{noindent}{\let\@indent@pref N}
\DeclareOption{indent}{\let\@indent@pref F}
%    \end{macrocode}
%
%    The last three options deal with the format of the address
%    labels.  As already said, the format is specified by
%    initializing a number of \textoken{dimen} parameters which
%    specify the ``geometry'' of the sheet of address labels.  Many
%    of these parameters have a default value of 0~points: when this
%    default is appropriate, the parameter is not re-initialized in
%    the code given below.
%
%    We support the Avery 5352 address labels only for compatibility
%    with the standard \packlass{letter} class.  I have never seen a sheet
%    of these labels, and the code for the \opz{Avery5352labels}
%    option simply assigns values to the parameters in a way that tries to
%    imitate the geometry described by the code found in the
%    \packlass{letter} class.
%    \begin{macrocode}
\DeclareOption{Avery5352labels}{%
%    \end{macrocode}
%    We have 5~rows of labels.
%    \begin{macrocode}
  \setcounter{addrlabelrows}{5}%
%    \end{macrocode}
%    Each row contains 2~labels, \emph{i.e.}, we have two columns of
%    labels.
%    \begin{macrocode}
  \setcounter{addrlabelcolumns}{\tw@}%
%    \end{macrocode}
%    The left edge of the leftmost column is 35~points to the left of
%    the \TeX\ origin, which in turn is 1~inch from the left edge of
%    the paper.
%    \begin{macrocode}
  \setlength\addrlabelsleftmargin{-35\p@}%
  \addtolength\addrlabelsleftmargin{1in}%
%    \end{macrocode}
%    The top edge of the topmost row is 50~points above
%    the \TeX\ origin, which in turn is 1~inch from the top edge of
%    the paper.
%    \begin{macrocode}
  \setlength\addrlabelstopmargin{-50\p@}%
  \addtolength\addrlabelstopmargin{1in}%
%    \end{macrocode}
%    The two columns are separated by 26~points.
%    \begin{macrocode}
  \setlength\addrlabelshsep{26\p@}%
%    \end{macrocode}
%    Labels are 262~points wide by 2~inches high.
%    \begin{macrocode}
  \setlength\addrlabelwidth{262\p@}%
  \setlength\addrlabelheight{2in}%
}
%    \end{macrocode}
%
%    The code for the labels I had the opportunity to actually see and
%    measure is more elegant, and fits more naturally into the scheme.
%    The following is the setting for the 70\,$\times$\,37 labels (the
%    dimensions are given in~mm).
%    \begin{macrocode}
\DeclareOption{70x37labels}{%
%    \end{macrocode}
%    8~rows of labels.
%    \begin{macrocode}
  \setcounter{addrlabelrows}{8}%
%    \end{macrocode}
%    3~columns, \emph{i.e.}, 3~labels in each row.
%    \begin{macrocode}
  \setcounter{addrlabelcolumns}{\thr@@}%
%    \end{macrocode}
%    Labels are 70\,mm wide by 37\,mm high.
%    \begin{macrocode}
  \setlength\addrlabelwidth{70mm}%
  \setlength\addrlabelheight{37mm}%
%    \end{macrocode}
%    We leave 6\,mm of margin between the border of the labels and the
%    actual printing.
%    \begin{macrocode}
  \setlength\addrlabelborder{6mm}%
}
%    \end{macrocode}
%    The setting for the 105\,$\times$\,37 labels (the default) is
%    similar.
%    \begin{macrocode}
\DeclareOption{105x37labels}{%
  \setcounter{addrlabelrows}{8}%
  \setcounter{addrlabelcolumns}{\tw@}%
  \setlength\addrlabelwidth{105mm}%
  \setlength\addrlabelheight{37mm}%
  \setlength\addrlabelborder{6mm}%
}
%    \end{macrocode}
%
%    \subsection{Option processing}
%
%    Nothing special to note here.
%
%    \emph{Begin to think (v.~0.34):} should I change the defaults as
%    follows: \opz{boldsubject} in place of \opz{mediumsubject},
%    \opz{italicsignature} in place of \opz{uprightsignature},
%    \opz{shortindent} in place of \opz{indent}?
%
%    Ver.~0.36 (2015 Feb~08): not yet determined to change the default options.
%    Added \opz{nosignaturerule}.
%    \begin{macrocode}
\ExecuteOptions{%
  a4paper,10pt,oneside,onecolumn,final,%
  mediumsubject,uprightsignature,nosignaturerule,noPS,indent,%
  105x37labels%
}
\ProcessOptions\relax
%    \end{macrocode}
%
%    \subsection{Package loading}
%
%    In this version of the \Bundle, all the original code is
%    put in the file \filedir{\letteracdp.cls}, so in the normal operating
%    mode no packages need to be loaded.  This will change in future
%    releases: the code will be split among several packages, to allow
%    the final user to request only some features and not the others;
%    when this happens, this section will become much longer, in order to
%    load all those packages.  However, even now it could be necessary to
%    require the \packlass{eepic} package, if the user specified the
%    \opz{usePS} option.  At this stage, the presence of this option can
%    be tested for by means of the "\if@use@eepic@" switch.
%    \begin{macrocode}
\if@use@eepic@
%    \end{macrocode}
%    If the \packlass{eepic} package is not available, force the switch
%    to false and warn the user.
%    \begin{macrocode}
  \IfFileExists{eepic.sty}{%
    \RequirePackage{eepic}%
  }{%
    \@use@eepic@false
    \ClassWarningNoLine{\@letteracdp}{%
      Can't find the eepic package;\MessageBreak
      option usePS ignored (converted to noPS)%
    }%
  }%
\fi
%    \end{macrocode}
%
%    \subsection{Main code}
%
%    ^^A ( paren match
%    OK, boys, until now we have just set up a few things; now the real
%    fun begins.~\mbox{:-)}  Oh, well, actually it will begin in a few lines:
%    for now we have to do a little more bit of tedious work.~\mbox{:-(}
%    ^^A ) paren match
%
%    \subsubsection{More initializations}
%
%    Some of the following initializations could have been put in the
%    \emph{Initial code} section, but some others require that the code
%    for the options have already been executed.
%
%    \begin{macro}{\date}
%    We redefine "\date" in order to make the changes to the date local
%    instead of global: this is useful if one of the letters has a date
%    which is different from the other ones.  Since "\date" is a kernel
%    command, an explicative comment is left in % the code too.
%    \begin{macrocode}
%% Command \date redefined to make changes to date local.
\def\date#1{\def\@date{#1}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\place}
%    This command records the place where the letter is written (added
%    in version~0.34): it is analogous to "\date".  Starting from
%    version~0.34, this should be used instead of the optional argument
%    of "\opening", "\makedate", etc.\ (however, the optional argument of
%    those commands may still be used, for compatibility).  Note that the
%    comma is added automatically, but only if the argument of "\place"
%    is nonempty.
%    \begin{macrocode}
\newcommand*\place[1]{%
  \ifx \@empty #1\@empty % if #1 is empty
    \let\@place\@empty
  \else
    \def\@place{#1,}%
  \fi
}
%    \end{macrocode}
%    \end{macro}
%
%    Usual loading of the suitable \filedir{.clo} file; see the
%    documentation of, \emph{e.g.}, the standard \packlass{letter}
%    class for explanations about the following three lines of code.
%    \begin{macrocode}
\input{size1\@ptsize.clo}
\setlength\lineskip{\p@}
\setlength\normallineskip{\p@}
%    \end{macrocode}
%    \begin{macro}{\baselinestretch}
%    This command can be redefined by the final user to obtain
%    double-spaced, triple-spaced, etc.\ output.  See the
%    \textsl{\LaTeX book} \cite[Subsection~C.3.2]{LaTeXbook}.
%    \begin{macrocode}
\renewcommand*\baselinestretch{}
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\thelabel}
%    The printed form of the \cnt{label} counter is changed to include
%    also the number of the letter it refers to.  Note that we do not
%    change "\p@label" (the prefix used only when printing
%    \emph{references} to the counter), but actually the command used to
%    print the counter itself.
%    \begin{macrocode}
\renewcommand*\thelabel{\theletter\@alph\c@label}
%    \end{macrocode}
%    \end{macro}
%
%    The following are the usual constants used to represent typical
%    penalty values; again, see the documentation of the standard
%    classes.
%    \begin{macrocode}
\@lowpenalty   51
\@medpenalty  151
\@highpenalty 301
%    \end{macrocode}
%    We need five more constants of the same type, but with much
%    higher penalty values.  They are used in the algorithm that takes
%    care of folded letters.
%    \begin{macrocode}
\@fold@basepenalty 9000
\@fold@lowpenalty  9101
\@fold@medpenalty  9202
\@fold@highpenalty 9303
\@fold@toppenalty  9500
%    \end{macrocode}
%
%    We now initialize the style parameters that contain the penalties
%    inserted around the address blocks and the subject.  This values
%    will never be used in practice, because usually the address blocks
%    and the subject are wrapped up in a \ldots\env{presentation}
%    environment, and these environments completely redefine the values
%    of these style parameters.  The values given here will be used only
%    when a \env{sender}, \env{addressee}, or \env{subject} environment
%    is used without being wrapped in a presentation.  These values allow
%    a page break without penalty before each of the blocks and at the
%    end of the subject, mildly discourage a break after the address
%    blocks, and discourage rather strongly a break at an "\and" or
%    "\andcc" token.
%    \begin{macrocode}
\@b@frompenalty\z@
\@i@frompenalty\@highpenalty
\@e@frompenalty\@lowpenalty
\@b@topenalty\z@
\@i@topenalty\@highpenalty
\@e@topenalty\@lowpenalty
\@b@subjpenalty\z@
\@e@subjpenalty\z@
%    \end{macrocode}
%    Unlike the preceding ones, the following style parameter is not
%    redefined elsewhere.  It is the penalty inserted after
%    presentations, and since a presentation typically ends with the
%    subject, the following initialization seems quite natural.
%    \begin{macrocode}
\@e@prespenalty\@e@subjpenalty
%    \end{macrocode}
%
%    \subsubsection{Page layout}
%
%    The first thing one could begin to find interesting is the code
%    for setting up the page layout.  To help the reader to understand
%    what is going on, fig.~\ref{fig:plo} summarizes the basic page
%    layout parameters we are going to speak about.\footnote{If you are
%    reading directly the comments in the \filedir{.dtx} file, instead of
%    typesetting it with \LaTeX, you might find it difficult to follow
%    the forthcoming discussion.}  This figure shows the parameters used
%    in the case of an A5~sheet of paper: this allows to fit the entire
%    figure on the page without having to scale it.
%
%    \begin{figure}[tbp]
%      \centering
%      \setlength{\unitlength}{1mm}
%      \begin{picture}(108,200)(-10,0)
%        \thinlines
%        \put(-20,0)  {\line(1,0){148}}
%        \put(-20,210){\line(1,0){148}}
%        \put(-20,0)  {\line(0,1){210}}
%        \put(128,0)  {\line(0,1){210}}
%        \put(10,185){\makebox(88,10)[bl]{\makebox[88mm][s]{^^A
%          \kern -1cm
%          \setlength\unitlength{.625mm}^^A
%          \begin{picture}(32,16)(-3,7.87)
%            \thinlines
%            \put(8,16){\oval(10,10)[l]}
%            \put(8,11){\line(0,1){10}}
%            \put(9,11){\framebox(3,20){}}
%            \put(18,16){\oval(10,10)[r]}
%            \put(18,11){\line(0,1){10}}
%            \put(14,1){\framebox(3,20){}}
%            \thicklines
%            \put(8,16){\oval(16,16)[l]}
%            \put(8,8){\line(1,0){5}}
%            \put(13,24){\line(1,0){10}}
%            \put(8,16){\oval(14,14)[l]}
%            \put(8,9){\line(1,0){5}}
%            \put(13,23){\line(1,0){10}}
%            \put(18,8){\line(1,0){10}}
%            \put(18,9){\line(1,0){10}}
%          \end{picture}^^A
%          \lhnss oordinamento dei {\lhbss D}\kern-.033333em ottorandi di
%          {\lhbss P}\kern-.1em adova\enspace\hrulefill\kern-1cm
%        }}}
%        \put(10,40){\makebox(88,130)[tl]{\begin{minipage}[t]{88mm}
%          \vrule height 10pt depth 0pt width 0pt \relax
%          Text text text text text text text text text text text text
%          text text text text text text text text text text text text.
%        \end{minipage}}}
%        \put(10,25){\makebox(88,3.514598035146)[tl]{\parbox[t]{88mm}{^^A
%          \setlength{\parfillskip}{0pt}
%          \noindent\rule{0pt}{10pt}\kern-1cm\hrulefill\kern-1cm\par
%          \setlength{\baselineskip}{11pt}
%          \hbox to \hsize{\hss\lhrm
%            Coordinamento dei Dottorandi e dei Dottori di Ricerca
%            dell'Universit\`{a} di Padova
%          \hss}
%          \hbox to \hsize{\hss
%            \lhit World Wide Web:\/
%            \lhtt http://www.dei.unipd.it/\string~assdott/^^A
%          \hss}
%        }}}
%        \linethickness{0.1pt}
%        \put(-27,210){\line(1,0){17}}
%        \put(-27,195){\line(1,0){125}}
%        \put(-27,185){\line(1,0){142}}
%        \put(-27,170){\line(1,0){142}}
%        \put(-27,40) {\line(1,0){142}}
%        \put(-27,25) {\line(1,0){142}}
%        \put(10,25) {\line(0,1){192}}
%        \put(98,25) {\line(0,1){192}}
%        \put(20,185){\line(0,1){37}}
%        \put(5,215) {\vector(1,0){5}}
%        \put(10,215){\line(1,0){10}}
%        \put(55,215){\vector(-1,0){35}}
%        \put(55,215){\makebox(0,35)[br]{\strut\ttfamily\bslash @lh@left@margin}}
%        \put(63,215) {\vector(1,0){35}}
%        \put(63,215){\makebox(0,35)[bl]{\strut\ttfamily\bslash @lh@right@margin}}
%        \put(98,215){\line(1,0){10}}
%        \put(113,215){\vector(-1,0){5}}
%        \put(108,25){\line(0,1){197}}
%        \put(0,25)  {\line(0,1){12}}
%        \put(-5,30){\vector(1,0){5}}
%        \put(0,30) {\line(1,0){10}}
%        \put(45,30){\vector(-1,0){35}}
%        \put(45,30){\makebox(0,35)[br]{\strut\ttfamily\bslash @lh@right@margin}}
%        \put(-15,35){\vector(1,0) {15}}
%        \put(-5,35) {\vector(-1,0){15}}
%        \put(-10,35){\makebox(0,0)[b]{\strut $2\,\mbox{cm}$}}
%        \put(-20,200){\line(0,1){22}}
%        \put(-10,220){\vector(1,0) {30}}
%        \put(10,220) {\vector(-1,0){30}}
%        \put(0,220){\makebox(0,0)[b]{\strut $4\,\mbox{cm}$}}
%        \put(128,200){\line(0,1){22}}
%        \put(113,220){\vector(1,0) {15}}
%        \put(123,220){\vector(-1,0){15}}
%        \put(118,220){\makebox(0,0)[b]{\strut $2\,\mbox{cm}$}}
%        \put(113,195){\vector(0,1) {15}}
%        \put(113,200){\vector(0,-1){15}}
%        \put(113,197.5){\makebox(0,0)[l]{ $2.5\,\mbox{cm}$}}
%        \put(113,175){\vector(0,1) {10}}
%        \put(113,180){\vector(0,-1){10}}
%        \put(113,177.5){\makebox(0,0)[l]{ $1.5\,\mbox{cm}$}}
%        \put(113,30){\vector(0,1) {10}}
%        \put(113,35){\vector(0,-1){10}}
%        \put(113,32.5){\makebox(0,0)[l]{${}\ge1.5\,\mbox{cm}$}}
%        \put(113,10){\vector(0,1) {15}}
%        \put(113,15){\vector(0,-1){15}}
%        \put(113,12.5){\makebox(0,0)[l]{ $2.5\,\mbox{cm}$}}
%        \put(-25,200){\vector(0,1) {10}}
%        \put(-25,205){\vector(0,-1){10}}
%        \put(-25,202.5){\makebox(0,0)[r]{$\mbox{\ttfamily\bslash topmargin}+1\,\mbox{in}$ }}
%        \put(-25,189){\vector(0,1) {6}}
%        \put(-25,191){\vector(0,-1){6}}
%        \put(-25,190){\makebox(0,0)[r]{{\ttfamily\bslash headheight} }}
%        \put(-25,175){\vector(0,1) {10}}
%        \put(-25,180){\vector(0,-1){10}}
%        \put(-25,177.5){\makebox(0,0)[r]{{\ttfamily\bslash headsep} }}
%        \put(-25,100){\vector(0,1) {70}}
%        \put(-25,110){\vector(0,-1){70}}
%        \put(-25,105){\makebox(0,0)[r]{{\ttfamily\bslash textheight} }}
%        \put(-25,30){\vector(0,1) {10}}
%        \put(-25,35){\vector(0,-1){10}}
%        \put(-25,32.5){\makebox(0,0)[r]{{\ttfamily\bslash footskip} }}
%        \put(-10,100){\vector(1,0) {20}}
%        \put(0,100)  {\vector(-1,0){20}}
%        \put(-5,100) {\makebox(0,0)[b]{\parbox[b]{4cm}{\centering
%          \strut\texttt{\bslash oddsidemargin}\\
%          or\\
%          \texttt{\bslash evensidemargin}\\
%          ${}+1\,\mbox{in}$\strut
%        }}}
%        \put(48,100){\vector(1,0) {50}}
%        \put(60,100){\vector(-1,0){50}}
%        \put(54,100){\makebox(0,0)[b]{\strut\ttfamily\bslash textwidth}}
%      \end{picture}
%      \caption{Basic page layout parameters}
%      \label{fig:plo}
%    \end{figure}
%
%    Before discussing the page layout parameters, let us make a brief
%    digression to illustrate what we are trying to achieve and what
%    difficulties we need to solve.  We would like that the seal and
%    certain other details of the letterhead and the footer appeared in
%    fixed positions with respect to the physical edges of the sheet:
%    fig.~\ref{fig:plo} shows these fixed distances, explicitly given in
%    centimeters, among the others, indicated by their symbolic name.
%    This rises a little problem: we want to typeset the letterhead and
%    the footer as standard \LaTeX\ headers and footers, but the
%    subroutine for the header or the footer installed with a
%    "\ps@"\ldots\ declaration is called inside a box of width
%    "\textwidth" and aligned with the main body of text.  In other
%    words, when typesetting the header, or the footer, one has no direct
%    means to refer to the page boundaries: the only available reference
%    points are the margins of the main body of text.  For this reason,
%    it is necessary to precompute the offset from the text margins of
%    the various points that we want to appear in fixed positions.  For
%    instance, looking at fig.~\ref{fig:plo}: if we know that the left
%    margin of the text runs exactly at \( 3\,\mbox{cm} \) from the left
%    border of the sheet, and we want the left edge of the writing
%    ``oordinamento dei Dottorandi di Padova'' to lie at exactly \(
%    4\,\mbox{cm} \) from this border, we need to set the
%    "\@lh@left@margin" parameter to \( 1\,\mbox{cm} \), to indicate that
%    the left edge of the writing should lie \( 1\,\mbox{cm} \) to the
%    right of the left text margin.
%
%    But this is only half of the story; the other half is best
%    illustrated with an example.  Suppose you are typesetting on A4~paper,
%    using 10 points fonts (these are precisely the settings chosen by
%    default).  If you calculate the text margins and the text width
%    following the recommendations given by the authors of \LaTeX\ for
%    this particular combination of paper and font sizes, you will
%    discover that the left margin of the main text runs at, say, \(
%    4.2\,\mbox{cm} \) from the left border of the sheet.  (I~don't want
%    to compute the exact value just now, since this is only an example,
%    but I know that the actual value is very close to this, so the
%    example is meaningful.)  If, according to what we have just said, you
%    set "\@lh@left@margin" to \( -0.2\,\mbox{cm} \), you will end with
%    the writing ``oordinamento\ldots'' that fails to be aligned with the
%    main text by just \( 2\,\mbox{mm} \)---which is awful to see.
%    Clearly, in a case like this it is better to foresee that
%    "\@lh@left@margin" is going to receive a small value, and to adjust
%    the left margin of the main body of text to \( 4\,\mbox{cm} \), so
%    that "\@lh@left@margin" can be set to \( 0\,\mbox{pt} \).  This is
%    just what the class does, and the final visual effect is, let
%    me say, pretty good indeed\ldots
%
%    To sum up, the strategy for setting the page layout parameters is
%    the following:
%
%    \begin{enumerate}
%
%    \item\label{plostep1}
%    Compute the main text width and margins according to usual \LaTeX\
%    recommendations.
%
%    \item\label{plostep2}
%    Figure out whether the margins computed in step~\ref{plostep1} fall
%    too close to some of the points of the letterhead that we want to
%    stay in fixed position, and, if it is so, adjust them so that they
%    are exactly aligned with those positions.
%
%    \item\label{plostep3}
%    Allow the user to change the values computed in step~\ref{plostep2},
%    in case (s)he needs to set the margins to some special value.
%
%    \item\label{plostep4}
%     Compute the offset of those fixed points from one of the text
%    margin (\emph{e.g.}, "\@lh@left@margin" in the example above), using
%    whatever values for the margins are in effect after
%    step~\ref{plostep3}, in such a way to be able to correctly position
%    the abovementioned points using only the text margins as a reference.
%
%    \end{enumerate}
%
%    Of course, step~\ref{plostep3} occurs in the preamble; this means
%    that step~\ref{plostep4} must be performed during the
%    "\AtBeginDocument" hook.
%
%    As already said, the fixed distances of the layout design are all
%    shown in fig.~\ref{fig:plo}; from this distances, from the relations
%    shown in the figure, and from the additional information that the
%    main body of text should be horizontally centered between the edges
%    of the sheet, it is possible to deduce the values of almost all the
%    basic page layout parameters once the value for "\textwidth" has
%    been (cleverly) chosen.  Some of these parameters are readily
%    readable: for instance, fig.~\ref{fig:plo} clearly states that
%    "\headsep" should be equal to \( 1.5\,\mbox{cm} \); other parameters
%    may require some computations, and may even not be completely
%    determined: for instance, from the figure you see that \(
%    "\topmargin"+"\headheight" = 2.5\,\mbox{cm}-1\,\mbox{in} \), but you
%    cannot tell what the single values of "\topmargin" and "\headheight"
%    are.  In the last case, the inherent uncertainty does no harm,
%    because the "\headheight" parameter is not used to position any
%    graphical element of the letterhead: it suffices to ensure that it
%    allows enough room for the other, ordinary running heads; in
%    practice, that there is room for a line of text in the largest
%    supported font size (\emph{i.e.}, 12~points).  Setting "\headheight"
%    to \( 1\,\mbox{cm} \) definitely satisfies this requisite, and has the
%    nice additional aesthetic advantage that the virtual lines delimiting the
%    head run exactly along the outer strokes of the ``C'' in the seal.
%    (Note that decreasing or increasing the value of "\headheight" does
%    not alter the dimensions of the seal: the dimensions of the seal are
%    fixed, and the seal appears as a box of null width and height.)
%
%    We shall now discuss the parameters shown in fig.~\ref{fig:plo}
%    one by one.  Of course, many of them are standard \LaTeX\ page
%    layout parameters, and do not require particular explanations.
%
%    The first decision I took was to locate the lower right corner of
%    the seal in a fixed position \( 4\,\mbox{cm} \) across and \(
%    2.5\,\mbox{cm} \) down from the upper left corner of the page.  The
%    value of \( 4\,\mbox{cm} \) was chosen because it was twice the
%    design width of the seal; $2.5$~is the golden section of~$4$.  I then
%    placed the upper margin of the main body of text \( 4\,\mbox{cm}
%    \) from the upper edge of the paper.  Also, the rule found to the
%    right of the letterhead extends up to a distance of \( 2\,\mbox{cm}
%    \) from the right edge of the paper; the rule of the footer is
%    aligned with that of the letterhead on the right, and on the left it
%    extends to a symmetric distance.  From these fixed setting, one
%    deduces the other parameters: let us see how.
%
%    \begin{description}
%
%    \renewcommand*\makelabel[1]{\hspace\labelsep\normalfont
%      \texttt{\bslash #1}.}
%
%    \item[textwidth]
%    This parameter is first of all initialized in the standard
%    \filedir{.clo} files: this ensures that the standard \LaTeX\ initial
%    value is used (cf.~step~\ref{plostep1} above).  Nevertheless, the
%    value can be subsequently adjusted as explained in
%    step~\ref{plostep2}, to achieve a better alignment with some points
%    of the letterhead.
%
%    \item[oddsidemargin]
%    This is set to \( \frac{1}{2}("\paperwidth"-"\textwidth") -
%    1\,\mbox{in} \), to ensure that the main body of text is
%    horizontally centered on the page.  Note that \LaTeX\ measures
%    "\oddsidemargin" from the \TeX\ origin, and not from the left edge
%    of the paper.
%
%    \item[evensidemargin]
%    This is set equal to "\oddsidemargin".
%
%    \item[@lh@left@margin]
%    This is set to \( 4\,\mbox{cm}-"\oddsidemargin"-1\,\mbox{in} \);
%    this setting is done at ``"\begin{document}"-time''
%    (cf.~step~\ref{plostep4} above), to allow the user to change
%    "\oddsidemargin" in the preamble (cf.~step~\ref{plostep3} above).
%    It can be useful to remark that the amount shown in
%    fig.~\ref{fig:plo} is positive when measured according to the
%    sign convention used internally by the code.
%
%    \item[@lh@right@margin]
%    This is set to \( 2\,\mbox{cm}-"\oddsidemargin"-1\,\mbox{in} \);
%    this setting is done at ``"\begin{document}"-time''
%    (cf.~step~\ref{plostep4} above), to allow the user to change
%    "\oddsidemargin" in the preamble (cf.~step~\ref{plostep3} above).
%    It can be useful to remark that the amounts shown in
%    fig.~\ref{fig:plo} are negative when measured according to the sign
%    convention used internally by the code.
%
%    \item[topmargin]
%    This is set to \( 2.5\,\mbox{cm}-1\,\mbox{in} \) (because \LaTeX\
%    measures "\topmargin" from the \TeX\ origin, and not from the
%    upper edge of the paper).
%
%    \item[headheight]
%    This is set to \( 1\,\mbox{cm} \).
%
%    \item[headsep]
%    This is set to \( 1.5\,\mbox{cm} \).
%
%    \item[textheight]
%    To avoid underfull "\vbox"es when typesetting pages that contain
%    no glue besides the "\baselineskip" glue (that usually has no
%    ability to stretch or shrink), it is highly recommendable to
%    set "\textheight" to an integer number of text lines, that is,
%    to set it to \( "\topskip" + n\cdot"\baselineskip" \), where
%    $n$~is a natural number.  We do this, choosing $n$ to be the
%    largest natural number such that
%    \begin{equation}
%      "\topskip" + n\cdot"\baselineskip" \le "\paperheight"-8\,\mbox{cm}
%      \mbox{.}
%      \label{eq:textheight}
%    \end{equation}
%
%    \item[footskip]
%    This is set to \( "\paperheight" - "\textheight" -
%    6.5\,\mbox{cm} \): this ensures that the baseline of the footer
%    (along which the rule is traced) runs at \( 2.5\,\mbox{cm} \)
%    from the bottom edge of the paper.
%
%    \end{description}
%
%    In the case of "\footskip", note that the baseline of the footer
%    actually means\ldots\ the baseline of the footer!  I mean, normal
%    footers (like, for instance, page numbers) are typeset with the
%    baseline at exactly \( 2.5\,\mbox{cm} \) from the bottom edge of the
%    paper; but the footer containing the address of the
%    \emph{Coordinamento} is treated differently, in that it is the
%    horizontal rule which is aligned with the baseline.
%
%    OK, after all this preliminary blather, we are now ready to return
%    to the code.  Since we have already given many explanations, the
%    following comments will be rather terse.
%
%    We begin to perform some of the initialization described above.
%    \begin{macrocode}
\setlength\headheight{1cm}
\setlength\topmargin{1.5cm}
\addtolength\topmargin{-1in}
\setlength\headsep{1.5cm}
%    \end{macrocode}
%    The following settings pertaining to marginal notes and footnotes
%    are simply copied from the standard \packlass{letter} class: we have
%    no reason to change them.
%    \begin{macrocode}
\setlength\marginparsep {11\p@}
\setlength\marginparpush{5\p@}
\setlength\footnotesep{12\p@}
\setlength{\skip\footins}{10\p@ plus 2\p@ minus 4\p@}
%    \end{macrocode}
%
%    Everything we have been saying above was for \LaTeXe\footnote{This
%    term should no longer be used, however: what was once known as
%    \LaTeXe\ has now become \LaTeX\ \emph{tout-court}.}.  No attempt is
%    made to support any users who happened to be still using the
%    Palaeolithic \LaTeX~2.09: we simply honor the standard convention
%    according to which certain basic page layout parameters must be set to
%    fixed values in compatibility mode.  Note that the alignment of
%    those certain special points of the letterhead to fixed positions
%    will still work even in this case, but the placement of the main
%    body of text will be awful, in the best hypothesis.  Note also that,
%    in general, "\textheight" will not at all be of the form \(
%    "\topskip" + n\cdot "\baselineskip" \).
%    \begin{macrocode}
\if@compatibility
  \setlength\oddsidemargin{53pt}
  \setlength\evensidemargin{53pt}
  \setlength\marginparwidth{90pt}
  \setlength\textwidth{365\p@}
  \setlength\textheight{505\p@}
  \setlength\footskip{25\p@}
\else
%    \end{macrocode}
%
%    Very well, now that the have get rid of that bothersome
%    parenthesis of compatibility mode, we can go on with our
%    initialization code.  We now take care of "\textwidth" and
%    "\oddsidemargin".  These parameters have already been initialized in
%    a \filedir{.clo} file---and this was step~\ref{plostep1}, see above.
%    Now we take care of step~\ref{plostep2}.  Put
%    \[
%      "\@tempdima" = \textit{total\_left\_margin} :=
%        {"\paperwidth"-"\textwidth"\over 2}
%      \mbox{.}
%    \]
%    \begin{macrocode}
  \setlength\@tempdima{\paperwidth}
  \addtolength\@tempdima{-\textwidth}
  \setlength\@tempdima{.5\@tempdima}
%    \end{macrocode}
%    If \( \textit{total\_left\_margin} < 3.25\,\mbox{cm} \), that is,
%    if the left margin measured from the paper edge is too narrow, then
%    we set "\oddsidemargin" to \( 3\,\mbox{cm} \), thereby aligning the
%    left margin with the centre of the seal.
%    \begin{macrocode}
  \ifdim\@tempdima < 3.25cm % align to centre of logo
    \setlength\oddsidemargin{3cm}
%    \end{macrocode}
%    If \( 3.25\,\mbox{cm} \le \textit{total\_left\_margin} <
%    4.5\,\mbox{cm} \), that is, if the left margin measured from the paper
%    edge is sufficiently close to the predetermined position of the right
%    edge of the seal, then we align the former to the latter, by
%    setting "\oddsidemargin" to~\( 4\,\mbox{cm} \).
%    \begin{macrocode}
  \else\ifdim\@tempdima < 4.5cm % align to right edge of logo
    \setlength\oddsidemargin{4cm}
%    \end{macrocode}
%    In all other cases, we set "\oddsidemargin" to the computed
%    $\textit{total\_left\_margin}$.
%    \begin{macrocode}
  \else % keep the computed margin
    \setlength\oddsidemargin{\@tempdima}
  \fi\fi
%    \end{macrocode}
%    Whatever value we have set "\oddsidemargin" to, we reset
%    "\textwidth" according to it.
%    \begin{macrocode}
  \setlength\textwidth{\paperwidth}
  \addtolength\textwidth{-2\oddsidemargin}
%    \end{macrocode}
%    Of course, we must not forget to subtract \( 1\,\mbox{in} \) from
%    "\oddsidemargin": we shall do this later.
%
%    The following segment of code sets the width of marginal
%    paragraphs (marginal notes).  We first try to use up all the
%    margin, leaving only a gap of "\marginparsep" (already
%    initialized above) on the text side, and of \( 7\,\mbox{mm} \)
%    from the paper edge.  The latter should suffice with modern laser
%    printers, but other printers might have more restrictive
%    mechanical constraints that can affect their ability to print so
%    close to the paper edge: let's hope everything works\ldots
%    \begin{macrocode}
  \setlength\marginparwidth{\oddsidemargin}
  \addtolength\marginparwidth{-\marginparsep}
  \addtolength\marginparwidth{-7mm}
%    \end{macrocode}
%    However, with some paper formats (\emph{e.g.}, with landscape
%    orientation) the above setting may yield very wide marginal notes,
%    which is undesirable.  Therefore, if the value just set exceeds one
%    third of "\textwidth", we cut it down to this value, provided that
%    the latter is at least \( 90\,\mbox{pt} \).
%    \begin{macrocode}
  \setlength\@tempdima{.33333\textwidth}
  \ifdim\marginparwidth > \@tempdima
    \ifdim\@tempdima < 90pt\else
      \setlength\marginparwidth{\@tempdima}
    \fi
  \fi
%    \end{macrocode}
%
%    All the main horizontal page layout parameters have been set.  We
%    can now convert "\oddsidemargin" into \TeX's coordinate system: we
%    did not do this before to ease other computations.  We also set
%    "\evensidemargin".
%    \begin{macrocode}
  \addtolength\oddsidemargin{-1in}
  \setlength\evensidemargin{\oddsidemargin}
%    \end{macrocode}
%
%    We turn now to vertical parameters.  We set "\textheight"
%    according to~\eqref{eq:textheight} and "\footskip" as stated above.
%    First step:
%    \[
%      "\@tempdima" = \textit{max\_desired\_text\_height}
%        := "\paperheight"-8\,\mbox{cm}
%      \mbox{.}
%    \]
%    \begin{macrocode}
  \setlength\@tempdima{\paperheight}
  \addtolength\@tempdima{-8cm}
  \setlength\footskip{\@tempdima}
%    \end{macrocode}
%    Remove the first line, which is only "\topskip" high:
%    \begin{macrocode}
  \addtolength\@tempdima{-\topskip}
%    \end{macrocode}
%    Set "\textheight" to the largest possible integer multiple of
%    "\baselineskip":
%    \begin{macrocode}
  \divide\@tempdima\baselineskip
  \@tempcnta=\@tempdima
  \setlength\textheight{\@tempcnta\baselineskip}
%    \end{macrocode}
%    Put in again the first line:
%    \begin{macrocode}
  \addtolength\textheight{\topskip}
%    \end{macrocode}
%    "\footskip" is still equal to \( "\paperheight"-8\,\mbox{cm} \);
%    finish its initialization (cf.~above):
%    \begin{macrocode}
  \addtolength\footskip{-\textheight}
  \addtolength\footskip{1.5cm}
%    \end{macrocode}
%
%    The following "\fi" goes with "\if@compatibility":
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
%    \begin{macro}{\computelongindentation}
%    As explained above, "\longindentation" is a parameter that should
%    set to roughly half the value of "\textwidth", with optional
%    fine-tuning for better graphical results.  The setting is made
%    by the "\computelongindentation" macro, which is available also
%    to the final user: if (s)he alters the value of "\textwidth",
%    then (s)he should also call this macro to update the value of
%    "\longindentation".  The macro takes care of all the necessary
%    fine-tuning.
%    \begin{macrocode}
\newcommand*\computelongindentation{%
%    \end{macrocode}
%    More precisely, "\longindentation" is set as follows: the first
%    attempt is to set it equal to the width of the writing
%    ``oordinamento dei Dottorandi di Padova'' ("\@oordinamento@box"
%    is initialized below), because this makes for a great visual
%    effect\ldots
%    \begin{macrocode}
  \setlength\@tempdima{\wd\@oordinamento@box}%
  \setlength\longindentation{\@tempdima}%
%    \end{macrocode}
%    \ldots but this ideal value will only be retained if it falls within
%    the closed range \( [\frac{1}{2}"\textwidth"-2.5\,\mbox{mm},
%    \frac{1}{2}"\textwidth"+12.5\,\mbox{mm}] \), that is, sufficiently
%    close to \( \frac{1}{2}"\textwidth" \) (which is the case for the
%    most common page formats, like \opz{a4paper}); otherwise, \(
%    \frac{1}{2}"\textwidth" \) will be used.
%    \begin{macrocode}
  \addtolength\@tempdima{2.5mm}%
  \ifdim\@tempdima<.5\textwidth
    \setlength\longindentation{.5\textwidth}%
  \else
    \addtolength\@tempdima{-12.5mm}%
    \ifdim\@tempdima>.5\textwidth
      \setlength\longindentation{.5\textwidth}%
    \fi
  \fi
%    \end{macrocode}
%    A final check is also made to ensure that "\longindentation" falls
%    within the closed range \( [\frac{4}{10}"\textwidth",
%    \frac{6}{10}"\textwidth"] \).
%    \begin{macrocode}
  \ifdim\longindentation<.4\textwidth
    \setlength\longindentation{.5\textwidth}%
  \else\ifdim\longindentation>.6\textwidth
    \setlength\longindentation{.5\textwidth}%
  \fi\fi
}
%    \end{macrocode}
%    \end{macro}
%
%    The following part of the code deals with initializations the have
%    to be deferred until the "\begin{document}" hook.  The most complex
%    of these is the check about the "\foldedheight" parameter.  Recall
%    that this parameter, which is initialized to a default value by the
%    code which handles the \ldots\opz{paper} options, can be altered by
%    the user at any time, but has to be converted in an internal form
%    afterwards; before making the conversion, we need to check that the
%    value lies in the prescribed range.  If this is not the case, we
%    issue a warning and set the "\if@do@fold@" switch to false: the
%    following two macros, which are used below, take care of this,
%    providing two different types of warning.  They take two arguments,
%    used to modify the warning printed to the user: argument "#1" will be
%    either the word ``short'' or the word ``tall'', and argument "#2"
%    will contain text giving further help.
%
%    \begin{macro}{\@folding@ht@warn}
%    This macro is invoked when the value of "\foldedheight" is found
%    to be wrong in the check that is made during the "\AtBeginDocument"
%    hook.
%    \begin{macrocode}
\@ifdefinable\@folding@ht@warn{\def\@folding@ht@warn#1#2{%
  \ClassWarningNoLine{\@letteracdp}{%
    \protect\foldedheight\space ignored:
    it is too #1!\MessageBreak
    (#2.)\MessageBreak
    Folded letters will be shunned%
  }%
  \@do@fold@false
}}%
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@folding@ht@NO}
%    This macro is used by the "\checkfoldedheight" command.
%    \begin{macrocode}
\@ifdefinable\@folding@ht@NO{\def\@folding@ht@NO#1#2{%
  \ClassWarning{\@letteracdp}{%
    Bad value of \protect\foldedheight: it is too #1!\MessageBreak
    (#2.)\MessageBreak
    Therefore, at present folded letters are _shunned_;\MessageBreak
    warning issued%
  }%
  \@do@fold@false
}}%
%    \end{macrocode}
%    \end{macro}
%    \begin{macro}{\@folding@ht@OK}
%    The following, instead, is the macro used to inform the user that
%    the value of "\foldedheight" is correct.  It sets the "\if@do@fold@"
%    switch to true, too.
%    \begin{macrocode}
\@ifdefinable\@folding@ht@OK{\def\@folding@ht@OK{%
  \ClassWarning{\@letteracdp}{%
    Checked \protect\foldedheight,
    current value is acceptable.\MessageBreak
    Therefore, at present folded letters are _allowed_;\MessageBreak
    warning issued%
  }%
  \@do@fold@true
}}%
%    \end{macrocode}
%    \end{macro}
%
%    Uncommented code starts here.
%    \begin{macrocode}
\@ifdefinable\@checkfoldedheight{\def\@checkfoldedheight#1#2{%
  \ifdim\foldedheight>\z@
    \ifdim\foldedheight>.6\paperheight
      #1{tall}{% action to take if value is bad
        It must not exceed 0.6\protect\paperheight%
      }%
    \else
      \setlength\@folding@ht{\foldedheight}%
      \addtolength\@folding@ht{-1in}%
      \addtolength\@folding@ht{-\topmargin}%
      \addtolength\@folding@ht{-\headheight}%
      \setlength\@lh@folding@ht{-\@folding@ht}%
      \addtolength\@folding@ht{-\headsep}%
      \ifdim\@folding@ht<2.5cm
        #1{short}{% action to take if value is bad
          At least 2cm _of_text_ and 0.5cm of margin\MessageBreak
          must be allowed above the folding%
        }%
      \else
        \setlength\@above@folding@margin{1cm}%
        \setlength\@above@folding@shrink{5mm}%
        \setlength\@below@folding@skip{5mm}%
        \dimen4 .5\baselineskip
        \dimen@ \@folding@ht
        \advance\dimen@ \@below@folding@skip
        \advance\dimen@ -\topskip
        \dimen@ii -\dimen@
        \divide\dimen@ \dimen4%
        \count@ \dimen@
        \advance\dimen@ii \count@\dimen4%
        \addtolength\@below@folding@skip{\dimen@ii}%
        \addtolength\@folding@ht{-\@above@folding@margin}%
        #2% action to take if value is OK
      \fi
    \fi
  \else
    \@do@fold@false
  \fi
}}
\newcommand*\checkfoldedheight{%
  \@checkfoldedheight\@folding@ht@NO\@folding@ht@OK
}
\AtBeginDocument{%
  \setlength\@lh@left@margin{4cm}%
  \addtolength\@lh@left@margin{-1in}%
  \addtolength\@lh@left@margin{-\oddsidemargin}%
  \setlength\@lh@right@margin{\@lh@left@margin}%
  \addtolength\@lh@right@margin{-2cm}%
  \@checkfoldedheight\@folding@ht@warn\@do@fold@true
  \let\@folding@ht@warn\@undefined
}
\sbox\@oordinamento@box{%
  \@lh@nss oordinamento dei {\@lh@bss D}\kern-.033333em ottorandi di
  {\@lh@bss P}\kern-.1em adova\enspace
}
\computelongindentation
\newcommand*\standardvertspaces{%
  \setlength\aboveaddressvspace       {\medskipamount}%
  \@msetlength\andaddressvspace       {2}{\medskipamount}%
  \@msetlength\belowaddressvspace     {3}{\medskipamount}%
  \setlength\abovesubjectvspace       {\medskipamount}%
  \setlength\presubjectvspace         {\medskipamount}%
  \@msetlength\belowsubjectvspace     {3}{\medskipamount}%
  \@msetlength\abovesignaturevspace   {6}{\medskipamount}%
  \setlength\abovesignatureshortvspace{\bigskipamount}%
  \setlength\belowsignaturevspace     {\bigskipamount}%
  \@msetlength\belowpresentationvspace{3}{\medskipamount}%
}
\setlength\senderindentation   {\z@}
\setlength\senderwidth         {\textwidth}
\setlength\addresseeindentation{\z@}
\setlength\addresseewidth      {\textwidth}
\setlength\signatureindentation{\z@}
\setlength\signaturewidth      {\textwidth}
\standardvertspaces
%    \end{macrocode}
%
%    \subsubsection{Page styles}
%
%    \begin{macrocode}
\newcommand*{\automark}{\let\@mkboth\markboth}
\newcommand*{\usermark}{\let\@mkboth\@gobbletwo}
\automark % default is to put page no. and addressee in the header
%% We need to change even the definition of the standard page styles.
\def\ps@empty{%
  \let\@oddhead\@empty
  \let\@evenhead\@empty
  \let\@oddfoot\@empty
  \let\@evenfoot\@empty
}
\def\ps@plain{%
  \let\@oddhead\@empty
  \let\@evenhead\@empty
  \let\@oddfoot\@centred@folio
  \let\@evenfoot\@centred@folio
}
\def\ps@firstpage{%
  \let\@oddhead\@empty
  \let\@evenhead\@empty
  \let\@oddfoot\@first@foot
  \let\@evenfoot\@centred@folio
}
\def\ps@foldedpage{%
  \def\@oddhead{\hfill\@folding@tag}%
  \let\@evenhead\@empty
  \let\@oddfoot\@first@foot
  \let\@evenfoot\@centred@folio
}
\def\ps@letterhead{%
  \let\@oddhead\@cdp@head
  \let\@evenhead\@empty
  \let\@oddfoot\@centred@folio
  \let\@evenfoot\@centred@folio
}
\def\ps@firstletterhead{%
  \let\@oddhead\@cdp@head
  \let\@evenhead\@empty
  \let\@oddfoot\@cdp@foot
  \let\@evenfoot\@centred@folio
}
\def\ps@foldedletterhead{%
  \def\@oddhead{\@cdp@head\@folding@tag}%
  \let\@evenhead\@empty
  \let\@oddfoot\@cdp@foot
  \let\@evenfoot\@centred@folio
}
\def\ps@logo{%
  \def\@oddhead{\@cdp@logo\hfill}%
  \let\@evenhead\@empty
  \let\@oddfoot\@centred@folio
  \let\@evenfoot\@centred@folio
}
\def\ps@headings{%
  \automark
  \let\@oddhead\@r@head
  \let\@evenhead\@l@head
  \let\@oddfoot\@centred@folio
  \let\@evenfoot\@centred@folio
}
\def\ps@logoheadings{%
  \automark
  \def\@oddhead{\@cdp@logo\@r@head}%
  \let\@evenhead\@l@head
  \let\@oddfoot\@centred@folio
  \let\@evenfoot\@centred@folio
}
\def\ps@myheadings{%
  \usermark
  \let\@oddhead\@r@head
  \let\@evenhead\@l@head
  \let\@oddfoot\@centred@folio
  \let\@evenfoot\@centred@folio
}
\def\ps@logomyheadings{%
  \usermark
  \def\@oddhead{\@cdp@logo\@r@head}%
  \let\@evenhead\@l@head
  \let\@oddfoot\@centred@folio
  \let\@evenfoot\@centred@folio
}
\def\ps@letterheadnpn{%
  \let\@oddhead\@cdp@head
  \let\@evenhead\@empty
  \let\@oddfoot\@empty
  \let\@evenfoot\@empty
}
\def\ps@logonpn{%
  \def\@oddhead{\@cdp@logo\hfill}%
  \let\@evenhead\@empty
  \let\@oddfoot\@empty
  \let\@evenfoot\@empty
}
\@ifdefinable\@centred@folio{\def\@centred@folio{%
  \reset@font\hfil\thepage\hfil
}}
\@ifdefinable\@l@head{\def\@l@head{%
  \reset@font\slshape\hfil\ignorespaces\leftmark\unskip\/\hfil
}}
\@ifdefinable\@r@head{\def\@r@head{%
  \reset@font\slshape\hfil\ignorespaces\rightmark\unskip\/\hfil
}}
\@ifdefinable\@first@foot{\def\@first@foot{%
  \reset@font
  \raisebox{-24\p@}[\z@]{%
    \hb@xt@\textwidth{%
      \ifcase \@ptsize\relax
        \normalsize
      \or
        \small
      \or
        \footnotesize
      \fi
      \thesenderlocation \hfill \thesenderphone
    }%
  }\hss
}}
%    \end{macrocode}
%
%    \begin{macro}{\@folding@tag}
%    Invoked by the macros that implement the ``folded'' page styles,
%    more precisely by those which draw the header, to draw the small sign
%    that marks the point where the sheet should be folded.
%    \begin{macrocode}
\@ifdefinable\@folding@tag{\def\@folding@tag{%
  \if@do@fold@
    \raisebox{\@lh@folding@ht}[\z@][\z@]{%
      \makebox[\z@][l]{%
%    \end{macrocode}
%    Vers.~0.36: new and more robust way of computing the horizontal position.
%    \begin{macrocode}
        \dimen@ \paperwidth
        \advance \dimen@ -1in%
        \advance \dimen@ -\oddsidemargin
        \advance \dimen@ -\textwidth
        \advance\dimen@ -1cm%
%    \end{macrocode}
%    End of change.
%    \begin{macrocode}
        \kern\dimen@ \vbox{%
%    \end{macrocode}
%    Vers.~0.36: change to support the new "\foldingtagrule" user-level command
%    and the use of color.
%    \begin{macrocode}
          \color@begingroup
          \foldingtagrule
          \color@endgroup
%    \end{macrocode}
%    End of change.
%    \begin{macrocode}
        }%
      }%
    }%
  \fi
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\foldingtagrule}
%    Vers.~0.36 (2015 Feb~08): new command, redefinable by the user, 
%    to draw the tag.  It permits customization of the latter.
%    It should take up no vertical space in total
%    (\emph{i.e.}, it should backspace).
%    \begin{macrocode}
\newcommand*\foldingtagrule{%
  \kern -.1\p@
  \hrule \@height .1\p@ \@depth .1\p@ \@width 5mm%
  \kern -.1\p@
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\CDPFactoryFoldingTagRule}
%    Back up of the above.  Should \emph{not} be redefined!
%    \begin{macrocode}
\@ifdefinable\CDPFactoryFoldingTagRule{
  \let \CDPFactoryFoldingTagRule = \foldingtagrule
}
%    \end{macrocode}
%    \end{macro}
%
%    \subsubsection{Macros for drawing the CDP seal}
%
%    \begin{macrocode}
\savebox\@logo@box@base[\z@][r]{\setlength\unitlength{.625mm}%
  \begin{picture}(32,16)(-3,7.87)%
    \put(8,16){\oval(10,10)[l]}%
    \put(8,11){\line(0,1){10}}%
    \put(9,11){\framebox(3,20){}}%
    \put(18,16){\oval(10,10)[r]}%
    \put(18,11){\line(0,1){10}}%
    \put(14,1){\framebox(3,20){}}%
    \thicklines
    \put(8,16){\oval(16,16)[l]}%
    \put(8,8){\line(1,0){5}}%
    \put(13,24){\line(1,0){10}}%
    \put(8,16){\oval(14,14)[l]}%
    \put(8,9){\line(1,0){5}}%
    \put(13,23){\line(1,0){10}}%
  \end{picture}%
}%
\savebox\@logo@box@addS[\z@][r]{\setlength\unitlength{.625mm}%
  \begin{picture}(32,16)(-3,7.87)%
    \thicklines
    \put(18,8){\line(1,0){8}}%
    \put(18,9){\line(1,0){8}}%
  \end{picture}%
}%
\savebox\@logo@box@addL[\z@][r]{\setlength\unitlength{.625mm}%
  \begin{picture}(32,16)(-3,7.87)%
    \thicklines
    \put(18,8){\line(1,0){10}}%
    \put(18,9){\line(1,0){10}}%
  \end{picture}%
}%
\@ifdefinable\@logo@overlay{\def\@logo@overlay{%
  \kern\@lh@left@margin
  \copy\@logo@box@base \copy
}}
\@ifdefinable\@cdp@logo{\def\@cdp@logo{%
  \@logo@overlay\@logo@box@addS
}}
\@ifdefinable\@cdp@head{\def\@cdp@head{%
  \@logo@overlay\@logo@box@addL
  \copy\@oordinamento@box \hrulefill \kern\@lh@right@margin
}}
\setbox\@name@and@WWW@box = \vtop{%
  \baselineskip 11\p@
  \hb@xt@\z@{\hss \@lh@rm\Coordinamento \hss}%
  \hb@xt@\z@{%
    \hss
    \@lh@it World Wide Web:\/
    \@lh@tt \CoordinamentoWWW
    \hss
  }%
}
\@ifdefinable\@cdp@foot{\def\@cdp@foot{%
  \reset@font
  \setlength\@tempdima{\textwidth}%
  \addtolength\@tempdima{-2\@lh@right@margin}%
  \hss\parbox[t]{\@tempdima}{%
    \parfillskip\z@skip
    \noindent\hrulefill\@@par
    \baselineskip 11\p@
    \hb@xt@\hsize{\hfil\copy\@name@and@WWW@box\hfil}%
  }\hss
}}
%    \end{macrocode}
%
%    \subsubsection{``Letter-making'' environments}
%
%    \begin{macrocode}
\newcommand*\name     [1]{\def\thesendername{#1}}
\newcommand \signature[1]{\def\thesendersignature{#1}}
\newcommand \address  [1]{\def\thesenderaddress{#1}}
\newcommand \location [1]{\def\thesenderlocation{#1}}
\newcommand*\telephone[1]{\def\thesenderphone{#1}}
%    \end{macrocode}
%
%    \begin{macro}{\makelabels}
%    \changes{0.36}{2015 Feb 08}{Added new instruction
%      \protect\texttt{\protect\bslash @making@labels@true}.}
%    The "\makelabels" command now sets the "\if@making@labels@" switch.
%    \begin{macrocode}
\newcommand*\makelabels{%
  \@making@labels@true
  \AtBeginDocument{%
     \def\@beginlabels{\begin{labels}}%
     \def\@beginlabelgroup{\begin{labelgroup}}%
     \let\@mlabel\basemlabel
     \def\@endlabelgroup{\end{labelgroup}}%
     \def\@endlabels{\end{labels}}%
     \if@filesw
       \immediate\write\@mainaux{\string\@beginlabels}\fi}%
  \AtEndDocument{%
     \if@filesw\immediate\write\@mainaux{\string\@endlabels}\fi}}
\@onlypreamble\makelabels
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\cleardoubleemptypage}
%    Similar to "\cleardoublepage", but inserts pages with \sty{empty} page
%    style.
%    \begin{macrocode}
\newcommand*\cleardoubleemptypage{\par
  \onecolumn
  \if@twoside \ifodd\c@page \else
    \thispagestyle{empty}\null\newpage
  \fi\fi
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@safe@space}
%    This macro inserts \#1 in the current horizontal lists; if it contributes
%    a (strictly) positive width, it also inserts~\#2.  Usually \#1 is a
%    certain string, and \#2 is a spacing command that one wants to emit (if
%    and) only if the string is nonempty.
%    \begin{macrocode}
\@ifdefinable\@safe@space{\def\@safe@space#1#2{%
  \setbox\z@\hbox{\ignorespaces #1\unskip}%
  \ifdim\wd\z@>\z@
    \unhbox\z@ #2%
  \else
    \unhbox\z@
  \fi
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{environment}{baseletter}
%    \changes{0.31}{2001 Dec 01}{Reintroduced the first mandatory argument
%      to hold local initializations}
%    All the ``letter-making'' environments are based upon this one,
%    which is the lowest-level one.  Its purpose is to take the basic
%    actions that are needed to begin and end every kind of letter.  In
%    this version of the code it takes two arguments (this has changed
%    several times among different releases), which are meant to contain
%    code that performs any custom initialization required by the
%    higher-level environments (or by the user, if this environment is
%    called directly by the user).  The code passed in~"#1" is executed
%    before the core initializations provided by "baseletter", but inside
%    the group implied by this environment; the code passed in~"#2" is
%    executed as the last thing (just before "\@begin@letter@hook").  Other
%    arguments will be picked up by the "\x@baseletter" or
%    "\y@baseletter" macro.
%    \begin{macrocode}
\newenvironment{baseletter}[2]{%
  #1%
%    \end{macrocode}
%    Save~"#2" in a token register for later execution:
%    \begin{macrocode}
  \@lett@decl{#2}%
%    \end{macrocode}
%    Obvious initializations; note that "\cleardoubleemptypage" calls
%    "\onecolumn".
%    \begin{macrocode}
  \cleardoubleemptypage
  \c@page\@ne
  \refstepcounter{letter}%
  \typeout{\lettername \space \number\c@letter}%
  \interlinepenalty 200 % smaller than the TeXbook value
  \parskip\medskipamount
%    \end{macrocode}
% Set "\parindent" according to the option specified by the user.
%    \begin{macrocode}
  \ifx\@indent@pref L\else
    \ifx\@indent@pref N%
      \setlength\parindent{\z@}%
    \else
      \ifdim .1\textwidth>2pc
        \setlength\parindent{.1\textwidth}%
      \else
        \setlength\parindent{2pc}%
      \fi
    \fi
  \fi
%    \end{macrocode}
%    Continue initialization in two different ways, according to the
%    presence or not of the first optional argument.
%    \begin{macrocode}
  \@ifnextchar[\x@baseletter\y@baseletter % ] bracket matching
}{%
%    \end{macrocode}
%    Code for ending letters.  "\stopletter" is a hook reserved to the
%    user; it is executed \emph{before} the last page of the letter is
%    finished off.
%    \begin{macrocode}
  \stopletter
%    \end{macrocode}
%    Now ensure vertical mode and add a zero-cost page break \emph{above}
%    the vertical glue (possibly) present at the end of the page: this
%    allows to discard the glue after the signature if this is needed to
%    fit the letter in the page, even if "\stopbreaks" is in effect after
%    the signature.  Should this be a ``"-\@M"''-cost page break instead?
%
%    (2015 Feb~08, vers.~0.36: definitely \emph{no}, since that would stretch 
%    out the last page of the letter!  It was fortunate we didn't dare change
%    it in previous releases!)
%    \begin{macrocode}
  \@@par\addpenalty\z@
  \clearpage
%    \end{macrocode}
%    The following is a hook reserved to extensions of the
%    \packlass{letteracdp} class; it is used, for instance, by
%    \packlass{articoletteracdp}.  Note that it is executed \emph{after}
%    ejecting the last page of the letter.
%    \begin{macrocode}
  \@end@letter@hook
%    \end{macrocode}
%    Write to the \filedir{.aux} file the data for the address labels.
%    This is rather tricky because we can have multiple addressees
%    \emph{and} multiple senders
%    \changes{0.36}{2015 Feb 08}{Added check for the
%      \protect\texttt{\protect\bslash if@making@labels@} switch before
%      writing to the \protect\filedir{.aux} file unneeded information for 
%      generating the address labels.}
%    (v.~0.36: note the new check for "\if@making@labels@", in order to write
%    to the \filedir{.aux} file the information about the address labels
%    only when it is actually needed).
%    \begin{macrocode}
  \if@filesw \if@making@labels@
    \begingroup
%    \end{macrocode}
%    Ensure that "\\", "~" and "\protect"'ed tokens are written literally
%    instead of being expanded:
%    \begin{macrocode}
      \let\\\relax
      \let ~\relax
      \let\protect\@unexpandable@protect
%    \end{macrocode}
%    ^^A { brace match
%    The following hack causes "\and" (and "\andcc") to expand into
%    ``"}\@gobble{"''.
%    ^^A } brace match
%    \begin{macrocode}
      \def\and{%
        \iffalse{\fi}\expandafter\@gobble\expandafter{\iffalse}\fi
      }%
      \let\andcc\and
%    \end{macrocode}
%    "\returnaddress" contains the addresses of the senders, separated by
%    "\and"; thanks to the above hack, only the first is saved into
%    "\@cdp@reserved", and the others are "\@gobble"'d.
%    \begin{macrocode}
      \edef\@cdp@reserved{{\returnaddress}}%
%    \end{macrocode}
%    We now cope with "\and"'s and "\andcc"'s inside "\theaddresseeaddress":
%    we write them to the \filedir{.aux} file as
%    ^^A { brace match
%    ``"}"\,\meta{LF}\,"\@mlabel{"^^A
%    \( \langle\mbox{\itshape expansion of\/ } "\@cdp@reserved"\,\rangle \)^^A
%    "}{"'',
%    ^^A } brace match
%    \emph{i.e.}, for what we have just said, as
%    ^^A { brace match
%    ``"}"\,\meta{LF}\,"\@mlabel{"\meta{address of 1st~sender}"}{"''.
%    ^^A } brace match
%    \begin{macrocode}
      \def\and{%
        \iffalse{\fi}^^J%
        \string\@mlabel{\@cdp@reserved}{\iffalse}\fi
      }%
      \let\andcc\and
%    \end{macrocode}
%    We are now ready to write out the correct sequence of commands,
%    \emph{e.g.}:
%    \begingroup
%      \fontsize{9}{11}\selectfont
%      \zerolistvertspaces
%      \begin{flushleft}
%        "\@beginlabelgroup"\\
%        "\@mlabel{"\meta{1st sender}"}{"\meta{1st addressee}"}"\\
%        "\@mlabel{"\meta{1st sender}"}{"\meta{2nd addressee}"}"\\
%        "\@mlabel{"\meta{1st sender}"}{"\meta{3rd addressee}"}"\\
%        \ldots\\
%        "\@endlabelgroup"\\
%      \end{flushleft}
%    \endgroup
%    \begin{macrocode}
      \immediate\write\@auxout{%
        \string\@beginlabelgroup ^^J%
        \string\@mlabel
          {\@cdp@reserved}{\theaddresseeaddress}^^J%
        \string\@endlabelgroup
      }%
    \endgroup
%    \end{macrocode}
%    Vers.~0.36: note the additional "\fi" to go with the new
%    "\if@making@labels@".
%    \begin{macrocode}
  \fi \fi
}
%    \end{macrocode}
%    \end{environment}
%
%    Back to uncommented code.
%    \begin{macrocode}
\@ifdefinable\x@baseletter{\long\def\x@baseletter[#1]#2{%
  \def\theaddresseename{#1}%
  \def\theaddresseeaddress{#2}%
  \@baseletter
}}
\@ifdefinable\y@baseletter{\long\def\y@baseletter#1{%
  \@cut@andcc #1\andcc\@@@
  \def\theaddresseeaddress{#1}%
  \@baseletter
}}
\newcommand\@baseletter[1][]{%
  \def\thesubject{#1}%
  \if@twoside
    \@mkboth{%
      \noexpand\@safe@space\noexpand\headtoname\noexpand\enspace
      \ignorespaces\theaddresseename\unskip \hfill \noexpand\@date
    }{%
      \noexpand\@date \hfill
      \noexpand\@safe@space\noexpand\headtoname\noexpand\enspace
      \ignorespaces\theaddresseename % \unskip put by \@?@head
    }%
  \else
    \@mkboth{}{%
      \noexpand\@safe@space\noexpand\headtoname\noexpand\enspace
      \ignorespaces\theaddresseename\unskip \hfill \noexpand\@date
    }%
  \fi
  \the\@lett@decl
  \@begin@letter@hook
}
\@ifdefinable\@cut@andcc{\long\def\@cut@andcc#1\andcc#2\@@@{%
  \@cut@and #1\and\@@@%
}}
\@ifdefinable\@cut@and{\long\def\@cut@and#1\and#2\@@@{%
  \@cut@nl #1\\\@@@%
}}
\@ifdefinable\@cut@nl{\long\def\@cut@nl#1\\#2\@@@{%
  \@cut@par #1\par\@@@%
}}
\@ifdefinable\@cut@par{\long\def\@cut@par#1\par#2\@@@{%
  \def\theaddresseename{#1}%
}}
\newcommand*\stopbreaks{%
  \interlinepenalty\@M
  \def\par{\ifvmode\else\@@par\nobreak\fi}%
  \let\\\@nobreakcr
  \let\vspace\@nobreakvspace
}
\DeclareRobustCommand\@nobreakvspace
   {\@ifstar\@vspacer\@nobreakvspacex}
\@ifdefinable\@nobreakvspacex{\def\@nobreakvspacex#1{%
  \ifvmode
    \nobreak
    \vskip #1%
    \vskip\z@skip
  \else
    \@bsphack
    \vadjust{\@restorepar
      \nobreak
      \vskip #1%
      \vskip\z@skip
    }%
    \@esphack
  \fi
}}
\@ifdefinable\@nobreakcr{\def\@nobreakcr{%
  \@ifstar{\@normalcr*}{\@normalcr*}%
}}
\newcommand*\startbreaks{%
  \interlinepenalty 200%
  \let\par\@@par
  \let\\\@normalcr
  \let\vspace\@@vspace
}
\@ifdefinable\@par@stopbreaks{\def\@par@stopbreaks{%
  \par\nobreak\stopbreaks
}}
\@ifdefinable\@@letter{\def\@@letter#1#2#3{%
  \ifx#2N%
    \renewcommand*\makepresentation{\makenormalpresentation}%
    \renewenvironment*{presentation}{%
      \normalpresentation
    }{%
      \endnormalpresentation
    }%
  \else\ifx#2F%
    \renewcommand*\makepresentation{\makefoldedpresentation}%
    \renewenvironment*{presentation}{%
      \foldedpresentation
    }{%
      \endfoldedpresentation
    }%
  \fi\fi
  \setlength\senderindentation   {\z@}%
  \setlength\senderwidth         {#3}%
  \setlength\addresseeindentation{#3}%
  \setlength\addresseewidth      {\textwidth}%
    \addtolength\addresseewidth{-\addresseeindentation}%
  \setlength\signatureindentation{.3\textwidth}%
  \setlength\signaturewidth      {.6\textwidth}%
  \renewcommand*\closingindentation{\parindent}
  \renewcommand*\signaturealignment{\centering}%
  \standardvertspaces
  \baseletter{}{%
    #1%
  }%
}}
\@ifdefinable\@letter{\def\@letter#1{%
  \@@letter{\thispagestyle{#1}}%
}}
\newenvironment*{customletter}{%
  \@@letter{}L%
}{\endbaseletter}
\newenvironment*{letter}{%
  \@letter{firstpage}N{.5\textwidth}%
}{\endbaseletter}
\newenvironment*{foldedletter}{%
  \@letter{foldedpage}F{.5\textwidth}%
}{\endbaseletter}
\newenvironment*{letter*}{%
  \@letter{firstpage}N\longindentation
}{\endbaseletter}
\newenvironment*{foldedletter*}{%
  \@letter{foldedpage}F\longindentation
}{\endbaseletter}
\newenvironment*{letterhead}{%
  \@letter{firstletterhead}N\longindentation
}{\endbaseletter}
\newenvironment*{foldedletterhead}{%
  \@letter{foldedletterhead}F\longindentation
}{\endbaseletter}
%    \end{macrocode}
%
%    \subsubsection{Addresses and subject}
%
%    The addresses and the subject are not composed inside inner boxes:
%    instead, they are constructed from ``blocks'' of lines, conveniently 
%    indented, that are contributed directly to the main vertical list.
%    The correct indentation is achieved by a clever combination of "\parshape"
%    and "\everypar".
%    This unusual scheme was chosen with the intent of maintaining full control
%    over the interline glue, but other, and simpler, ways to accomplish this
%    are actually available (\emph{if} the interline glue is \emph{rigid}).
%
%    \begin{macro}{\@block@parshape}
%    This macro, invoked at every par., is responsible for setting the
%    indentation.
%    \begin{macrocode}
\@ifdefinable\@block@parshape{\def\@block@parshape{%
  \parshape \@ne\@block@inden\@block@width
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@block@@everypar}
%    The part of "\@block@everypar" that "\y@custom@block" uses directly.
%    \begin{macrocode}
\@ifdefinable\@block@@everypar{\def\@block@@everypar{%
  \parskip\z@skip
  \@nobreakfalse \@minipagefalse % these are already \global
  \@new@block@false \@empty@and@false % these too
  \everypar{\@block@parshape}%
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@block@everypar}
%    Code executed when a block or an ``"\and"-section'' begins.
%    \changes{0.36}{2015 Feb 08}{Added a hook, \protect\texttt{\protect\bslash
%      @begin@block@or@and@hook}.}^^A
%    2015 Feb~08 (v.~0.36): "\@begin@block@or@and@hook" added.
%    \begin{macrocode}
\@ifdefinable\@block@everypar{\def\@block@everypar{%
  \@block@parshape
  \@block@@everypar
  \@begin@block@or@and@hook
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\x@custom@block}
%    General utility macro for generating blocks that, like address blocks,
%    haven't got a label, but for which, in exchange, the indentation and the
%    width can be set independently of one another.  Parameters:\strut\\*
%    \strut
%    \begin{tabular}{r@{}l}
%      \param{1} & switch: \( \mbox{Y} = \mbox{add} \) space above and below,
%          \( \mbox{N} = \mbox{don't} \) add it;\\
%      \param{2} & block indentation from left margin (\textoken{dimen});\\
%      \param{3} & block width (\textoken{dimen});\\
%      \param{4} & vertical space above block (\textoken{glue});\\
%      \param{5} & vertical space between ``"\and"-sections''
%          (\textoken{glue});\\
%      \param{6} & vertical space below block (\textoken{glue});\\
%      \param{7} & penalty for breaking before block;\\
%      \param{8} & penalty for breaking between ``"\and"-sections'';\\
%      \param{9} & penalty for breaking after block.\\
%    \end{tabular}\strut
%    \begin{macrocode}
\@ifdefinable\x@custom@block{\def\x@custom@block#1#2#3#4#5#6#7#8#9{%
  \@custom@block#1#4#5#6#8#9%
  \@block@inden #2%
  \@block@width #3%
  \def\voidisOK{\global\let\@empty@block\@empty}%
  \everypar{\@block@everypar}%
  \@@custom@block #7%
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\y@custom@block}
%    General utility macro for generating blocks that, just like the block of
%    the subject, do have a label, but for which, in exchange, both the
%    indentation and the width are deduced from the width of the label itself.
%    \changes{0.36}{2015 Feb 08}{Added parameter for space after label.}^^A
%    2015 Feb~08 (v.~0.36): added new parameter for the amount of
%    horizontal space after the label.  Parameters now are:\strut\\*
%    \strut
%    \begin{tabular}{r@{}l}
%      \param{1} & switch: \( \mbox{Y} = \mbox{add} \) space above and below,
%          \( \mbox{N} = \mbox{don't} \) add it;\\
%      \param{2} & label;\\
%      \param{3} & horizontal space after label (\textoken{dimen});\\
%      \param{4} & vertical space above block (\textoken{glue});\\
%      \param{5} & vertical space between ``"\and"-sections''
%          (\textoken{glue});\\
%      \param{6} & vertical space below block (\textoken{glue});\\
%      \param{7} & penalty for breaking before block;\\
%      \param{8} & penalty for breaking between ``"\and"-sections'';\\
%      \param{9} & penalty for breaking after block.\\
%    \end{tabular}\strut
%    \begin{macrocode}
\@ifdefinable\y@custom@block{\def\y@custom@block#1#2#3#4#5#6#7#8#9{%
  \@custom@block#1#4#5#6#8#9%
  \sbox\@labels{\normalfont\ignorespaces #2\unskip}%
    % We use \@labels to save a box register.
  \@block@inden\wd\@labels
  \ifdim\@block@inden>\z@
    \advance \@block@inden #3\relax
    \wd\@labels\@block@inden
  \fi
  \@block@width\textwidth \advance\@block@width -\@block@inden
  \everypar{%
    \parshape \tw@ \z@\textwidth \@block@inden\@block@width
    \box\@labels
    \@block@@everypar
  }%
  \@@custom@block #7%
}}
%    \end{macrocode}
%    \end{macro}
%
%    Uncommented code.
%    \begin{macrocode}
\@ifdefinable\@custom@block{\def\@custom@block#1#2#3#4#5#6{%
  \if@inlabel \indent \fi
  \let\par\@@par \par
  \if@newlist \@noitemerr \fi
  \let\makelabel\m@kel@bel
  \@nobreakfalse
  \@noskipsecfalse
  \@totalleftmargin\z@
  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
  \parfillskip\@flushglue
  \ifx#1Y%
    \parskip #2\relax
    \ifdim\lastskip>\parskip
      \parskip\z@skip
    \else
      \advance\parskip -\lastskip
    \fi
  \else
    \parskip\z@skip
  \fi
  \parindent\z@
  \linewidth\textwidth
  \hsize\textwidth
  \@block@space #4%
  \@block@andspace #3%
  \@i@penalty #5%
  \@e@penalty #6%
  \stopbreaks
  \@new@block@true \@empty@and@true
}}
\@ifdefinable\@@custom@block{\def\@@custom@block#1{%
  \addpenalty #1%
  \color@begingroup
}}
\def\end@custom@block#1{\par
  \color@endgroup
  \if@new@block@
    \@empty@block
  \else
    \if@empty@and@
      \@empty@and
    \fi
    \ifx#1Y%
      \addpenalty\@e@penalty
      \addvspace\@block@space
    \fi
  \fi
  \everypar{}%
}
\newcommand*\makeandvspace{%
  \addpenalty\@i@penalty
  \addvspace\@block@andspace
}
\newcommand*\makeandcclabel[1][\andccname]{%
  \makebox[\z@][r]{\normalfont\@safe@space{#1}\quad}%
  \ignorespaces
}
\@ifdefinable\@block@nd{\def\@block@nd{\par
  \if@empty@and@
    \@empty@and
  \else
    \makeandvspace
  \fi
  \@empty@and@true
  \everypar{\@block@everypar}%
}}
\@ifdefinable\@empty@and{\def\@empty@and{%
  \ClassWarning{\@letteracdp}{%
    \protect\and\space with nothing inside%
  }%
}}
\@ifdefinable\@empty@sender{\def\@empty@sender{%
  \ClassWarning{\@letteracdp}{%
    Empty sender address%
  }%
}}
\@ifdefinable\@sender{\def\@sender#1{%
  \let\@empty@block\@empty@sender
  \let\and\@block@nd
  \x@custom@block #1%
    \senderindentation\senderwidth
    \aboveaddressvspace\andaddressvspace\belowaddressvspace
    \@b@frompenalty\@i@frompenalty\@e@frompenalty
  \raggedright
}}
\newenvironment*{sender} {\@sender Y}{\end@custom@block Y}
\newenvironment*{sender*}{\@sender N}{\end@custom@block N}
\@ifdefinable\@empty@addressee{\def\@empty@addressee{%
  \ClassWarning{\@letteracdp}{%
    Empty addressee address%
  }%
}}
\@ifdefinable\@addressee{\def\@addressee#1{%
  \let\@empty@block\@empty@addressee
  \let\and\@block@nd
  \def\andcc{\@block@nd
    \everypar\expandafter{\the\everypar
      \makeandcclabel\relax
    }%
  }%
  \x@custom@block #1%
    \addresseeindentation\addresseewidth
    \aboveaddressvspace\andaddressvspace\belowaddressvspace
    \@b@topenalty\@i@topenalty\@e@topenalty
  \raggedright
}}
\newenvironment*{addressee} {\@addressee Y}{\end@custom@block Y}
\newenvironment*{addressee*}{\@addressee N}{\end@custom@block N}
\@ifdefinable\@good@prsbj{\def\@good@prsbj#1{%
  \@new@block@false \@empty@and@false
  \let\presubject\@bad@prsbj
  \vskip\parskip
  \leftline{\normalfont\ignorespaces #1\unskip}%
  \nobreak
  \parskip\presubjectvspace
}}
\@ifdefinable\@bad@prsbj{\def\@bad@prsbj#1{%
  \ClassError{\@letteracdp}{%
    Misused \protect\presubject%
  }{%
    At the beginning of the subject of a letter
    you can write something like\MessageBreak
    \protect\presubject{A short phrase...}
    in order to typeset "A short phrase..."\MessageBreak
    just above the subject; but the \protect\presubject\space
    command must come before\MessageBreak
    any other text in the subject,
    and it cannot be used twice.\MessageBreak
    (If you are wondering where you used the
    \protect\presubject\space command,\MessageBreak
    recall that both \protect\registered\space and
    \protect\registeredRR\space invoke
    \protect\presubject.)\MessageBreak
    The offending command will be ignored:
    try to type \space <return> \space to proceed.%
  }%
}}
%    \end{macrocode}
%
%    \begin{macro}{\@subject}
%    Inner implementation of \env{subject}\slash\env{subject*} environments.
%    \changes{0.36}{2015 Feb 08}{Now this macro passes
%      \protect\texttt{\protect\bslash subjectnamegap} as parameter~\#3 to
%      \protect\texttt{\protect\bslash y@custom@block}.}^^A
%    2015 Feb~08 (v.~0.36): now passes the "\subjectnamegap" macro
%    as parameter~\#3 to "\y@custom@block", parameter added in this same
%    version.
%    \begin{macrocode}
\@ifdefinable\@subject{\def\@subject#1#2{%
  \let\@empty@block\@empty
  \y@custom@block #1%
    {#2}\subjectnamegap
    \abovesubjectvspace\z@skip\belowsubjectvspace
    \@b@subjpenalty\@M\@e@subjpenalty
  \let\presubject\@good@prsbj
  \def\registered  {\presubject{\registeredname}}%
  \def\registeredRR{\presubject{\registeredRRname}}%
  \everypar\expandafter{\the\everypar
    \let\presubject\@bad@prsbj
  }%
  \@subject@style
}}
%    \end{macrocode}
%    \end{macro}
%
%    Uncommented code.
%    \begin{macrocode}
\newenvironment*{subject} [1][\subjectname]
  {\@subject Y{#1}}{\end@custom@block Y}
\newenvironment*{subject*}[1][\subjectname]
  {\@subject N{#1}}{\end@custom@block N}
\newcommand*\ifemptyblock{%
  \if@new@block@
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\@ifdefinable\@makesender{\def\@makesender#1{%
  \begin{sender#1}\thesenderaddress\end{sender#1}%
}}
\newcommand*\makesender{%
  \@ifstar{\@makesender *}{\@makesender {}}%
}
\@ifdefinable\@makeaddressee{\def\@makeaddressee#1{%
  \begin{addressee#1}\theaddresseeaddress\end{addressee#1}%
}}
\newcommand*\makeaddressee{%
  \@ifstar{\@makeaddressee *}{\@makeaddressee {}}%
}
\newcommand*\x@makesubject[1][\subjectname]{%
  \begin{subject}[#1]\thesubject\end{subject}%
}
\newcommand*\y@makesubject[1][\subjectname]{%
  \begin{subject*}[#1]\thesubject\end{subject*}%
}
\newcommand*\makesubject{\@ifstar\y@makesubject\x@makesubject}
%    \end{macrocode}
%
%    \subsubsection{Presentations}
%
%    With this funny term we denote the initial part of a letter
%    (addresses and the like).
%
%    \begin{macro}{\@setup@pres}
%    Code for setting up style parameters.
%    \begin{macrocode}
\@ifdefinable\@setup@pres{\def\@setup@pres{%
  \global\@topnum\z@ % prevents figures from going at top of page
  \parskip\z@skip
  \parindent\z@
  \@b@frompenalty \@M
  \@i@frompenalty \@fold@toppenalty
  \@e@frompenalty \@M
  \@b@topenalty   \@fold@toppenalty
  \@i@topenalty   \@fold@toppenalty
  \@e@topenalty   \@M
  \@b@subjpenalty \@fold@toppenalty
  \@e@subjpenalty \@M
  \interlinepenalty\@M
  \def\par{\ifvmode\else\@@par\penalty\@fold@toppenalty\fi}%
  \let\\\@nobreakcr
  \let\vspace\@nobreakvspace
}}
\newenvironment*{presentation}{%
  \normalpresentation
}{%
  \endnormalpresentation
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{environment}{normalpresentation}
%    The environment for making a normal presentation:
%    \begin{macrocode}
\newenvironment*{normalpresentation}{%
  \cleardoublepage
  \@setup@pres
}{%
%    \end{macrocode}
%    \changes{0.34}{2006 Jan 01}{At the end of the environment,
%      changed \protect\texttt{\protect\bslash par} into
%      \protect\texttt{\protect\bslash @@par}}
%    Changed the following line from "\par" to "\@@par" (v.~0.34):
%    \begin{macrocode}
  \@@par
  \addpenalty\@e@prespenalty
  \addvspace\belowpresentationvspace
}
%    \end{macrocode}
%    \end{environment}
%
%    \begin{macro}{\@nofoldwarning}
%    Warning issued when folded presentations are not allowed:
%    \begin{macrocode}
\@ifdefinable\@nofoldwarning{\def\@nofoldwarning{%
  \ClassWarning{\@letteracdp}{%
    The paper format you chose does not allow\MessageBreak
    folded letters; making normal presentation.\MessageBreak
    (Modify \protect\foldedheight\space in the preamble\MessageBreak
    if you want to alter the default behavior.)\MessageBreak
    Warning issued%
  }%
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{environment}{foldedpresentation}
%    The environment for making a folded presentation, possibly
%    splitting it into two parts: the part the actually fits in the folded
%    flap, and the other, which is merged with the text below the
%    folding.  I~think it's better to include some comments here.
%    \begin{macrocode}
\newenvironment*{foldedpresentation}{%
%    \end{macrocode}
%    Are folded letters currently allowed?
%    \begin{macrocode}
  \if@do@fold@
%    \end{macrocode}
%    \emph{Yes.} First, ensure that we are at the beginning of a page;
%    note that \emph{numbered} pages, here, are inserted if there is a gap
%    to be filled.
%    \begin{macrocode}
    \cleardoublepage
%    \end{macrocode}
%    The contents of the presentation will be saved in "\box0": set up
%    parameters, color support\ldots
%    \begin{macrocode}
    \setbox\z@\vbox\bgroup
      \@setup@pres
%    \end{macrocode}
%    \changes{0.34}{2006 Jan 01}{Added setting of
%      \protect\texttt{\protect\bslash boxmaxdepth}
%      at the beginning of the environment}
%    Added the following line (v.~0.34), even if the depth of "\box0" 
%    will be checked later:
%    \begin{macrocode}
      \boxmaxdepth\maxdepth
%    \end{macrocode}
%    \ldots color support, we were saying\ldots
%    \begin{macrocode}
      \color@begingroup
%    \end{macrocode}
%    The reason for this "\penalty" will be explained later~($*$):
%    \begin{macrocode}
      \penalty-\@M
%    \end{macrocode}
%    \changes{0.34}{2006 Jan 01}{Removed a superfluous setting of
%      \protect\texttt{\protect\bslash prevdepth}
%      from the beginning of the environment}
%    Removed the following line (v.~0.34): we have no need to insert
%    interline glue here, and it is even wrong to do it; we will insert the
%    "\topskip" glue below with a trick (which, in any case, would remove
%    the---incorrect---interline glue inserted here).  Why did I include
%    this redundant statement?
%\begin{verbatim}
%\prevdepth\z@
%\end{verbatim}
%    \begin{macrocode}
  \else
%    \end{macrocode}
%    \emph{No.} Inform the user and substitute a normal presentation.
%    \begin{macrocode}
    \@nofoldwarning
    \normalpresentation
  \fi
}{%
%    \end{macrocode}
%
%    When the presentation ends, if we were making a folded
%    presentation\ldots
%    \begin{macrocode}
  \if@do@fold@
%    \end{macrocode}
%    \ldots finish off the box\ldots
%    \begin{macrocode}
      \@@par
      \color@endgroup
%    \end{macrocode}
%    \ldots and save its "\prevdepth" for later.
%    \begin{macrocode}
      \global\dimen@i\prevdepth
%    \end{macrocode}
%    Insert the equivalent of "\foldingfilbreak[0]": if possible, the
%    "\vsplit" that will later split the presentation should try to split
%    it here (\emph{i.e.}, not to split it at all).
%    \begin{macrocode}
      \@f@ldingfilbreak\@fold@basepenalty
%    \end{macrocode}
%    But "\vsplit" might prefer to split the box at the implicit
%    "\penalty-10000" inserted at its end; avoid this, since it would
%    defeat the "\vfil" of "\@f@ldingfilbreak":\nobreak\space($**$)
%    \begin{macrocode}
      \vskip\maxdimen % "discourage" the break at the \penalty-10000
%    \end{macrocode}
%    End of "\vbox".
%    \begin{macrocode}
    \egroup
%    \end{macrocode}
%    Now "\box0" contains the presentation, but it lacks the due
%    "\topskip" glue atop.  Of course, we could have inserted the
%    equivalent (in normal circumstances) of the "\topskip" glue by
%    setting \[ "\prevdepth" := "\topskip"-"\baselineskip" \] at the
%    beginning of "\box0", but this does not work always, since it could
%    insert the "\lineskip" glue instead.  We are admittedly whimsical
%    here, but, in order to achieve exactly the same result yielded by
%    the "\topskip" glue machinery operated in the main vertical list, we
%    use the following trick of "\vsplit"'ting "\box0" to \texttt{0pt}.
%    A legal breakpoint exists for this: it is the "\penalty-10000"
%    inserted above in~($*$)!  This breakpoint comes first in "\box0" and
%    it is mandatory, so the "\vsplit" operation will stop immediately
%    (without consuming time); nothing will be actually split off,
%    everything will remain in "\box0", but with "\splittopskip" glue
%    added at the top!  Moreover, although we set "\boxmaxdepth" inside
%    "\box0", we check again for possible excess depth (can't figure out
%    how it could creep in, however).  So:
%    \begin{macrocode}
    \splitmaxdepth\maxdepth
    \splittopskip\topskip
    \setbox\tw@\vsplit\z@ to\z@
%    \end{macrocode}
%    The real splitting of the presentation is done by the following
%    "\vsplit": the baseline of the first line possibly remaining in
%    "\box0" after the "\vsplit" must be at a distance of
%    "\@below@folding@skip" from the folding, plus the "\parskip" glue
%    and, of course, the normal interline glue (we are in mid-page now).
%    \begin{macrocode}
    \splittopskip\baselineskip
    \advance\splittopskip\@below@folding@skip
    \advance\splittopskip\parskip
    \setbox\tw@\vsplit\z@ to\@folding@ht
%    \end{macrocode}
%    Now "\box2" contains the part of the presentation that does fit in the
%    folded flap; we append this box to the page (actually, it is the first
%    thing contributed since the "\cleardoublepage").  Since this box already
%    includes "\topskip" glue at the top, we take redundant precautions to
%    ensure that no such glue is added again here.
%    \begin{macrocode}
    {\topskip\z@skip \box\tw@
%    \end{macrocode}
%    Thanks to the above setting of "\splitmaxdepth", we are sure that
%    the depth of the previous box is small; so the following line will
%    take us exactly on the edge of the fold, with null depth\ldots
%    \begin{macrocode}
    \baselineskip\@above@folding@margin \nobreak\null}%
%    \end{macrocode}
%    \ldots where we insert a costly, yet feasible breakpoint.
%    \begin{macrocode}
    \penalty\@highpenalty
%    \end{macrocode}
%    If everything fitted in the folded flap, nothing remained in
%    "\box0".
%    \begin{macrocode}
    \ifvoid\z@
%    \end{macrocode}
%    In that case, just leave appropriate blank space (the "\prevdepth"
%    is already zero, so the interline glue of the following line will be
%    correct).
%    \begin{macrocode}
      \vskip\@below@folding@skip
%    \end{macrocode}
%    Otherwise, take the part that did not fit out of "\box0"\ldots
%    \begin{macrocode}
    \else
      \unvbox\z@
%    \end{macrocode}
%    \ldots so it is now in the list of ``recent contributions''
%    ("\unvbox" does not exercise the page builder); remove the
%    "\vskip\maxdimen" added in~($**$) just to fool "\vsplit", as well as
%    the items added by the virtual "\foldingfilbreak[0]".
%    \begin{macrocode}
      \unskip    % remove "\vskip\maxdimen"
      \unpenalty % remove "\penalty\@fold@basepenalty"
      \unskip    % remove "\vskip \dimen@ plus 1fil minus ..."
      \unskip    % remove "\vskip -\skip@"
      \unpenalty % remove "\penalty 10000"
%    \end{macrocode}
%    Now the list of ``recent contributions'' contains exactly what the
%    user put in the presentation (and did not fit in the folded flap).
%    Restore "\prevdepth" and conclude as if it were a normal
%    presentation: this makes a perfectly seamless join with the
%    following material, as if the folded presentation had been a normal
%    one, extending down to this spot in the page.  ^^A ( paren match
%    Not bad, uhu?~:-)
%    \begin{macrocode}
      \prevdepth\dimen@i
      \addpenalty\@e@prespenalty
      \addvspace\belowpresentationvspace
%    \end{macrocode}
%    Ah, yes, also inform the user of what happened:
%    \begin{macrocode}
      \ClassWarning{\@letteracdp}{%
        Some text that did not fit into the folded flap\MessageBreak
        was moved into the main text below the folding;\MessageBreak
        warning issued%
      }%
    \fi
%    \end{macrocode}
%    If we were not making a folded presentation, then conclude a
%    normal one.
%    \begin{macrocode}
  \else
    \endnormalpresentation
  \fi
}
%    \end{macrocode}
%    \end{environment}
%
%    Back to uncommented code.
%    \begin{macrocode}
\newcommand*\iffoldedallowed{%
  \if@do@fold@
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\newcommand*\makepresentation{\makenormalpresentation}
\newcommand*\makenormalpresentation{%
  \begin{normalpresentation}%
    \makesender\relax
    \makeaddressee\relax
    \makesubject\relax
  \end{normalpresentation}%
}
%    \end{macrocode}
%
%    \begin{macro}{\@f@ldingfilbreak}
%    The ``upper half'' of "\@foldingfilbreak".
%    \begin{macrocode}
\@ifdefinable\@f@ldingfilbreak{\def\@f@ldingfilbreak#1{%
  \ifdim\prevdepth<\maxdepth
    \dimen@ -\prevdepth
  \else
    \dimen@ -\maxdepth
  \fi
  \skip@ \lastskip
  \nobreak
  \vskip -\skip@
  \vskip \dimen@ \@plus 1fil\@minus \@above@folding@shrink
  \penalty #1%
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macrocode}
\@ifdefinable\@foldingfilbreak{\def\@foldingfilbreak#1#2{\par
  \@f@ldingfilbreak#1%
  \vskip -\dimen@ \@plus -1fil\@minus -\@above@folding@shrink
  \vskip \skip@
  \addvspace{#2}%
}}
\@ifdefinable\@fold@getpen{\def\@fold@getpen#1{%
  \ifcase #1 \@fold@basepenalty \or \@fold@lowpenalty
    \or \@fold@medpenalty \or \@fold@highpenalty
    \else \@fold@toppenalty \fi
}}
\newcommand*\foldingbreak[1][\z@]{%
  \ifvmode
    \penalty\@fold@getpen{#1}%
  \else
    \@bsphack
    \vadjust{\penalty\@fold@getpen{#1}}%
    \@esphack
  \fi
}
\newcommand*\foldingfilbreak[1][\z@]{%
  \@foldingfilbreak{\@fold@getpen{#1}}%
}
\newcommand*\makefoldedpresentation{%
  \if@do@fold@
    \begin{foldedpresentation}%
      \renewcommand*\makeandvspace{%
        \@foldingfilbreak\@fold@medpenalty\andaddressvspace
      }%
      \makesender\relax
      \@foldingfilbreak\@fold@medpenalty\z@skip
      \if@new@block@
        \aboveaddressvspace \z@\@plus1fil\relax
        \nointerlineskip\null\nobreak
      \fi
      \makeaddressee\relax
      \@foldingfilbreak\@fold@lowpenalty\z@skip
      \makesubject\relax
    \end{foldedpresentation}%
  \else
    \@nofoldwarning
    \makenormalpresentation
  \fi
}
%    \end{macrocode}
%
%    \subsubsection{Date, salutation, signature, enclosures\ldots}
%
%    This section should be reorganized, with commands listed in a more 
%    logical order: at present, they are rather mixed up.
%
%    First comes the date.
%    \begin{macrocode}
\@ifdefinable\@make@date{\def\@make@date#1#2#3{\par
  \ifx#2Y%
    \nobreak\medskip
  \fi
  \noindent\@safe@space{#1}\space\@date\par
  \ifx#3Y%
    \nobreak\medskip
  \fi
}}
\newcommand*\makedate      [1][\@place]{\@make@date{#1}NN}
\newcommand*\maketopdate   [1][\@place]{\@make@date{#1}NY}
\newcommand*\makebottomdate[1][\@place]{\@make@date{#1}YN}
\@ifdefinable\@empty@signature{\def\@empty@signature{%
  \ClassWarning{\@letteracdp}{%
    Empty signature%
  }%
}}
%    \end{macrocode}
%
%    Then, heaven knows why, the signature.
%
%    \begin{macro}{\@signatureenv}
%    Inner implementation of the \env{signatureenv}\slash\env{signatureenv*}
%    environments.
%    \changes{0.36}{2015 Feb 08}{Added support for \protect\opz{signaturerule}
%      option.}^^A
%    Added support for the \opz{signaturerule} option (vers.~0.36), exploiting
%    the new ``hook'' "\@begin@block@or@and@hook", the gets executed whenever a
%    signature is typeset.
%    \begin{macrocode}
\@ifdefinable\@signatureenv{\def\@signatureenv#1{\par
  \let\@empty@block\@empty@signature
  \let\and\@block@nd
  \if@signature@rule@
    \let \@begin@block@or@and@hook \@make@signature@rule
  \fi
  \x@custom@block Y%
    \signatureindentation\signaturewidth
    #1#1\z@skip
    \@M\@M\@M
  \signaturealignment\@signature@style
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\end@signatureenv}
%    Ends a \env{signatureenv}\slash\env{signatureenv*} environment.
%    \begin{macrocode}
\def\end@signatureenv{%
  \end@custom@block N% not "Y" for efficiency
%    \end{macrocode}
%    The following line (also added, of course, in vers.~0.36) is not actually necessary ("\@begin@block@or@and@hook"
%    has been set by "\@signatureenv" inside a group), but redundancy does not
%    hurt.
%    \begin{macrocode}
  \let \@begin@block@or@and@hook \@empty
  \addvspace\belowsignaturevspace
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{environment}{signatureenv}
%    For signatures that include vertical space for handwriting.
%    \begin{macrocode}
\newenvironment*{signatureenv}{%
  \@signatureenv\abovesignaturevspace
}{%
  \end@signatureenv
}
%    \end{macrocode}
%    \end{environment}
%
%    \begin{environment}{signatureenv*}
%    For signatures that do \emph{not} include vertical space for handwriting; 
%    these should \emph{never} display a rule, and for this reason\ldots
%    \begin{macrocode}
\newenvironment*{signatureenv*}{%
%    \end{macrocode}
%    \changes{0.36}{2015 Feb 08}{Taken care of always suppressing rules
%      here.}^^A
%    \ldots~we add the following line in vers.~0.36 (note that we are inside a
%    group).
%    \begin{macrocode}
  \@signature@rule@false
  \@signatureenv\abovesignatureshortvspace
}{%
  \end@signatureenv
}
%    \end{macrocode}
%    \end{environment}
%
%    Uncommented code.
%    \begin{macrocode}
\@ifdefinable\x@msignature{\def\x@msignature#1{%
  \begin{signatureenv#1}%
    \ifx\thesendersignature\@empty
      \thesendername
    \else
      \thesendersignature
    \fi
  \end{signatureenv#1}%
}}
\@ifdefinable\y@msignature{\def\y@msignature{%
  \begin{signatureenv}%
    \vskip\parskip \vskip\z@skip
    \the\everypar
  \end{signatureenv}%
}}
\newcommand*\makesignature{\@par@stopbreaks
  \@ifstar{%
    \x@msignature *%
  }{%
    \@ifnextchar -{%
      \@firstoftwo\y@msignature
    }{%
      \x@msignature {}%
    }%
  }%
}
%    \end{macrocode}
%
%    \begin{macro}{\@make@signature@rule}
%    Generate a fake, raised line, containing the rule.  Added in vers.~0.36.
%    \begin{macrocode}
\@ifdefinable\@make@signature@rule{\def\@make@signature@rule{%
  \raisebox{\baselineskip}[0pt][0pt]{%
    \signaturerule
  }\\*[-\baselineskip]%
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\signaturerule}
%    User command to allow customization of the signature rule.
%    Added in vers.~0.36.
%    \begin{macrocode}
\newcommand*\signaturerule{%
  \makebox[\signaturerulewidth]{%
    \leaders \hrule \@height .1\p@ \@depth .1\p@ \hfill
  }%
}
%    \end{macrocode}
%    \end{macro}
%
%    Now it is the turn of the salutation (I~said the order isn't logical!).
%
%    \begin{macro}{\makeopening}
%    This command generates the sheer salutation.  It comes in two flavors:
%    \begin{description}
%      \item[normal form:]
%        "\makeopening{"\meta{text}"}"\\*
%          typeset the \meta{text} as the salutation;
%      \item[$+$-form:]
%        "\makeopening+"\\*
%          leave space for a handwritten salutation.
%    \end{description}
%    \begin{macrocode}
\newcommand*\makeopening{\par
  \@ifnextchar +{\@firstoftwo\y@mopening}\x@mopening
}
%    \end{macrocode}
%    \end{macro}
%
%    Uncommented code.
%    \begin{macrocode}
\@ifdefinable\x@mopening{\def\x@mopening#1{%
  \ifx\@indent@pref O%
    \dimen@\prevdepth
    \setbox\z@\vbox{\color@begingroup
      \null
      \prevdepth\dimen@
      \noindent\null\ignorespaces #1\par
      \global\dimen@i\prevdepth
    \color@endgroup}%
    \setbox\tw@\vbox{%
      \unvcopy\z@
      \setbox\z@\lastbox
      \global\setbox\@ne\hbox{\unhbox\z@}%
    }%
    \ifdim\wd\@ne<2pc
      \parindent 2pc\relax
    \else\ifdim\wd\@ne>.4\textwidth
      \parindent .1\textwidth\relax
    \else
      \parindent \wd\@ne
    \fi\fi
    \unvbox\z@
    \prevdepth\dimen@i
  \else
    \noindent\null\ignorespaces #1\par
  \fi
  \nobreak
}}
\@ifdefinable\y@mopening{\def\y@mopening{%
  \@handwr@box\z@ \nobreak
}}
%    \end{macrocode}
%
%    \begin{macro}{\opening}
%    Well-known command for opening a letter.  In vers.~0.35, it,
%    and related macros, have been completely reimplemented to support the
%    "\OpeningSequence" feature.
%    \begin{macrocode}
\newcommand*\opening{\par
  \@ifnextchar +{\@firstoftwo\y@opening}\x@opening
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\y@opening}
%    Implements the ``\mbox{$+$-form}'' of the "\opening" command (salutation
%    written by hand): "\ChosenMakeOpening" should expand to ``"\y@mopening"''.
%    \begin{macrocode}
\newcommand*\y@opening[1][\@place]{%
  \@opening \y@mopening {#1}%
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\x@opening}
%    Implements the normal form of the "\opening" command (with typeset
%    salutation): "\ChosenMakeOpening" should expand to
%    ``"\x@mopening{"\meta{contents of~\#2}"}"''.
%    \begin{macrocode}
\newcommand*\x@opening[2][\@place]{%
  \@opening{\x@mopening{#2}}{#1}%
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@opening}
%    Prepare call to "\OpeningSequence", then call it.  Parameters:\strut\\*
%    \strut
%    \begin{tabular}{r@{}l}
%      \param{1} & intended meaning of "\ChosenMakeOpening";\\
%      \param{2} & contents of optional argument of "\opening"
%          (defaults to "\@place").\\
%    \end{tabular}\strut
%    \begin{macrocode}
\@ifdefinable\@opening{\def\@opening#1#2{%
%    \end{macrocode}
%    Keep definition of "\ChosenMakeOpening" local.
%    \begin{macrocode}
  \begingroup
    \def\ChosenMakeOpening{#1}%
%    \end{macrocode}
%    Invoke user-customizable opening sequence.
%    \begin{macrocode}
    \OpeningSequence{#2}%
%    \end{macrocode}
%    If the \opz{smartindent} option is in force, "\parindent" might have just
%    been changed: this change must be ``lifted'' out of the group.
%    \begin{macrocode}
    \global\dimen@i\parindent
  \endgroup
  \parindent\dimen@i
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\OpeningSequence}
%    This command defines the ``opening sequence'', that is, the sequence of
%    commands that should be executed when the user-level "\opening" command
%    is given.  Provided in vers.~0.35 to allow customization.  The optional
%    argument of "\opening" is passed in the---mandatory!---argument of this
%    command; the mandatory argument of "\opening", if present (\emph{i.e.},
%    if not ``\mbox{$+$-form}'') is embodied in "\ChosenMakeOpening".
%    Factory definition:
%    \begin{macrocode}
\newcommand*\OpeningSequence[1]{%
  \makepresentation
  \maketopdate[#1]%
  \ChosenMakeOpening
}
%    \end{macrocode}
%    \end{macro}
%
%    A little bit of uncommented code.
%    \begin{macrocode}
\newcommand*\makeclosing{\@par@stopbreaks
  \@ifnextchar +{\@firstoftwo\y@mclosing}\x@mclosing
}
\@ifdefinable\x@mclosing{\def\x@mclosing#1{%
  \noindent\hspace*{\closingindentation}\ignorespaces #1\par
}}
\@ifdefinable\y@mclosing{\def\y@mclosing{%
  \@handwr@box\closingindentation
}}
%    \end{macrocode}
%
%    \begin{macro}{\closing}
%    Well-known command for closing a letter.  In vers.~0.35, it,
%    and related macros, have been completely reimplemented to support the
%    "\ClosingSequence" feature.  The present implementation support exactly
%    the same modifiers as the former one (cf.~\cite{nts}), \emph{i.e.}:
%    \begin{description}
%      \item[normal form:]
%        "\closing{"\meta{text}"}"\\*
%          typeset the \meta{text} as the closing sentence,
%          using the internal equivalent of "\makeclosing{"\meta{text}"}";
%          an ordinary signature (the internal equivalent of "\makesignature")
%          follows;
%      \item[$*$-form:]
%        "\closing*{"\meta{text}"}"\\*
%          typeset the \meta{text} as the closing sentence,
%          using the internal equivalent of "\makeclosing{"\meta{text}"}";
%          a compressed signature (the internal equivalent of
%          "\makesignature*") follows;
%      \item[$+$-form:]
%        "\closing+"\\*
%          leave space for a handwritten closing sentence (as "\makeclosing+"
%          would do),
%          followed by another space for an equally handwritten signature
%          (like the one produced by "\makesignature-");
%      \item[$-$-form:]
%        "\closing-{"\meta{text}"}"\\*
%          typeset the \meta{text} as the closing sentence,
%          using the internal equivalent of "\makeclosing{"\meta{text}"}",
%          followed by the space for a handwritten signature
%          (like the one produced by "\makesignature-").
%    \end{description}
%    \begin{macrocode}
\newcommand*\closing{\@par@stopbreaks
  \@ifstar{%
    \@closing{\x@msignature *}%
  }{%
    \@ifnextchar +{\@firstoftwo{%
      \@@closing \y@mclosing \y@msignature
    }}{%
      \@ifnextchar -{\@firstoftwo{%
        \@closing \y@msignature
      }}{%
        \@closing{\x@msignature {}}%
      }%
    }%
  }%
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@closing}
%    The sole purpose of this macro is to absorb the argument destined for the
%    "\closing" command (which is absent in the ``\mbox{$+$-form}, though),
%    which becomes argument~\#2; argument~\#1 is the token sequence that should
%    be used to generate the signature.
%    \begin{macrocode}
\@ifdefinable\@closing{\def\@closing#1#2{%
  \@@closing{\x@mclosing{#2}}{#1}%
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@@closing}
%    Prepare call to "\ClosingSequence", then call it.  Parameters:\strut\\*
%    \strut
%    \begin{tabular}{r@{}l}
%      \param{1} & intended meaning of "\ChosenMakeClosing";\\
%      \param{2} & intended meaning of "\ChosenMakeSignature".\\
%    \end{tabular}\strut
%    \begin{macrocode}
\@ifdefinable\@@closing{\def\@@closing#1#2{%
%    \end{macrocode}
%    Keep definitions local.
%    \begin{macrocode}
  \begingroup
    \def\ChosenMakeClosing{#1}%
    \def\ChosenMakeSignature{#2}%
%    \end{macrocode}
%    Invoke user-customizable closing sequence.
%    \begin{macrocode}
    \ClosingSequence
  \endgroup
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\ClosingSequence}
%    This command defines the ``closing sequence'', that is, the sequence of
%    commands that should be executed when the user-level "\closing" command
%    is given.  Provided in vers.~0.35 to allow customization.
%    Factory definition:
%    \begin{macrocode}
\newcommand*\ClosingSequence{%
  \ChosenMakeClosing
  \ChosenMakeSignature
}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@handwr@box}
%    Draws an almost imperceptible sign that marks the spot where a handwritten
%    salutation, or closing sentence, should start.  \#1~is the amount of
%    indentation.
%    \begin{macrocode}
\@ifdefinable\@handwr@box{\def\@handwr@box#1{%
  \vskip .5\baselineskip
  \setbox\z@\vbox{%
    \hrule\@height .1\p@ \@depth .1\p@ \@width 3\p@
  }%
  \wd\z@\z@ \ht\z@\z@ \dp\z@\z@ \noindent\hspace*{#1}\box\z@\par
  \vskip .5\baselineskip\vskip\z@skip
}}
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\@cc@encl}
%    Inner implementation for both "\cc" and "\encl".
%    \changes{0.36}{2015 Feb 08}{Fully reimplemented by means of
%      ``blocks''.}^^A
%    Wholly rewritten in vers.~0.36, now uses ``blocks'' (like addresses and
%    subject).  This, among other things, ensures coherent treatment of the
%    interline glue.
%    \begin{macrocode}
\@ifdefinable\@cc@encl{\long\def\@cc@encl#1#2{\par
  \begingroup
    \let\@empty@block\@empty
    \y@custom@block N{#1}{.5em}%
      \z@skip\z@skip\z@skip
      \@M\z@\z@
    \ignorespaces #2%
    \end@custom@block N%
  \endgroup
}}
%    \end{macrocode}
%    \end{macro}
%
%    Uncommented code.
%    \begin{macrocode}
\newcommand*\cc  [1][\ccname]  {\@cc@encl{#1}}
\newcommand*\encl[1][\enclname]{\@cc@encl{#1}}
\newenvironment{enclosures}[1][\enclname]{%
  \baseenclosures[#1]{}%
}{%
  \endbaseenclosures
}
\newenvironment{baseenclosures}[2][\enclname]{\par
  \addpenalty{-\@lowpenalty}%
  \addvspace{\bigskipamount}%
  \startbreaks
  \parskip\z@skip
  {\parindent\z@ #1\par}%
  \list{\labelenumi}{%
    \usecounter{enumi}%
    \@beginparpenalty\@M
    \@itempenalty-\@lowpenalty
    \@endparpenalty-\@medpenalty
%% ( paren match
    \renewcommand*\labelenumi{\theenumi)}%
    #2%
  }%
}{%
  \endlist
  \aftergroup\startbreaks
}
\newcommand*\ps{\par\startbreaks\parindent\z@}
\newcommand*\@PS@rigid [1][\PSname]{%
  {\normalfont\@safe@space{#1}\enspace}\ignorespaces
}
\newcommand*\@PS@rubber[1][\PSname]{%
  \@safe@space{#1}{\nobreak\space}\ignorespaces
}
\newcommand*\PS{%
  \ps\@ifstar{\@PS@rubber}{\@PS@rigid}%
}
%    \end{macrocode}
%
%    \begin{macro}{\stopletter}
%    User-level hook invoked (before anything else) when a letter ends.
%    \begin{macrocode}
\newcommand*\stopletter{}
%    \end{macrocode}
%    \end{macro}
%
%    \subsubsection{Address labels}
%
%    This part of the code should probably be detached and put in a 
%    separate file to be loaded on demand.
%
%    The general idea is the following:
%    \begin{itemize}
%    \item
%    a \env{labels} (or \env{baselabels}, see below) environment
%    produces one or more sheets of address labels;
%    \item
%    inside \env{labels}, several \env{labelgroup} environments wrap up
%    the address labels pertaining to each letter (a letter may have
%    several address labels associated with it, if it has several
%    addressees);
%    \item
%    inside each \env{labelgroup} environment, individual labels are
%    produced with the "\basemlabel" command.
%    \end{itemize}
%    The \env{labels} environment takes care of such things like jumping
%    to a new page, etc.; the \env{labelgroup} environment merely changes
%    the way address labels are numbered, but does not otherwise affect
%    the printout.
%
%    The user may either:
%    \begin{enumerate}
%    \renewcommand*{\theenumi}{(\Alph{enumi})}
%    \renewcommand*{\labelenumi}{\theenumi}
%    \item\label{autolabels}
%    include a "\makelabels" declaration in the preamble, to have 
%    address labels generated automatically via the \filedir{.aux} 
%    file; in this case, appropriate commands are written in the 
%    \filedir{.aux} file by each 
%    \env{baseletter} environment, which, when the \filedir{.aux} file 
%    is re-read at the "\end{document}", automatically generate the 
%    required environments and commands (\env{labels}, 
%    \env{labelgroup}, etc.); \emph{or}
%    \item\label{handlabels}
%    produce the address labels ``by hand'', including directly in the
%    source file, where (s)he want the address label sheets to appear, a
%    \env{labels} environment, containing the appropriate
%    \env{labelgroup} environments, containing, in turn, the individual
%    "\basemlabel" commands.
%    \end{enumerate}
%    In principle, it is also possible to mix \ref{autolabels} 
%    and~\ref{handlabels} (and to have several \env{labels} 
%    environments, too), but this has no practical utility.
%
%    \begin{macrocode}
\newcommand*\returnaddress{\thesenderaddress}
\@ifdefinable\@emptyaddrlabels@err{\def\@emptyaddrlabels@err{%
  \advance \@cdp@gencount \m@ne
  \ClassError{\@letteracdp}{%
    Counter emptyaddrlabels out of range%
  }{%
    The counter emptyaddrlabels holds
    the number of labels\MessageBreak
    to leave blank when starting to print
    the address labels\MessageBreak
    (e.g., because some labels
    have already been peeled off).\MessageBreak
    For the label format you chose,
    it must lie in the range\MessageBreak
    0..\number\@cdp@gencount\space (inclusive),
    but presently its value is \number\c@emptyaddrlabels.\MessageBreak
    It will therefore be ignored;
    type \space <return> \space to proceed.%
  }%
}}
\newcommand*\skipemptylabels{%
  \@cdp@gencount \c@addrlabelrows
  \multiply \@cdp@gencount \c@addrlabelcolumns
  \ifnum\c@emptyaddrlabels<\z@
    \@emptyaddrlabels@err
  \else\ifnum\c@emptyaddrlabels<\@cdp@gencount
    \begingroup
      \let\ifactuallabel\@secondoftwo
      \@whilenum\c@totallabel<\c@emptyaddrlabels\do{\@mlabel{}{}}%
    \endgroup
  \else
    \@emptyaddrlabels@err
  \fi\fi
}
%    \end{macrocode}
%
%    \begin{environment}{baselabels}
%    This is the actual environment for producing sheets of address
%    labels: the \env{labels} environment (see below) is simply a wrapper
%    that offers the user the opportunity of changing some settings before
%    invoking \env{baselabels}.
%    \begin{macrocode}
\newenvironment*{baselabels}{%
  \cleardoubleemptypage
  \c@page\@ne
  \typeout{Address Labels}%
  \pagestyle{empty}%
  \textwidth \c@addrlabelcolumns\addrlabelwidth
  \count@ \c@addrlabelcolumns
  \advance \count@ \m@ne
  \ifnum\count@>\z@
    \advance \textwidth \count@\addrlabelshsep
  \fi
  \linewidth\textwidth \hsize\textwidth
  \oddsidemargin -1in%
  \advance \oddsidemargin \addrlabelsleftmargin
  \evensidemargin \oddsidemargin
  \@totalleftmargin\z@
  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
  \parfillskip\@flushglue
  \textheight \c@addrlabelrows\addrlabelheight
  \count@ \c@addrlabelrows
  \advance \count@ \m@ne
  \ifnum\count@>\z@
    \advance \textheight \count@\addrlabelsvsep
  \fi
  \@colht\textheight  \@colroom\textheight \vsize\textheight
  \headsep \z@
  \headheight \z@
  \footskip \z@
  \topmargin -1in%
  \advance \topmargin \addrlabelstopmargin
  \ifcase \@ptsize\relax
    \normalsize
  \or
    \small
  \or
    \footnotesize
  \fi
  \parindent \z@
  \baselineskip \z@skip
  \lineskip \z@skip
  \boxmaxdepth \z@
  \raggedright
  \fboxrule \z@
  \fboxsep \addrlabelborder
  \addrlabeltrimwidth \addrlabelwidth
  \advance \addrlabeltrimwidth -2\addrlabelborder
  \addrlabeltrimheight \addrlabelheight
  \advance \addrlabeltrimheight -2\addrlabelborder
  \setcounter{totallabel}{\z@}%
  \setcounter{label}{\z@}%
  \setcounter{letter}{\z@}%
  \noindent
  \skipemptylabels
}{%
  \@killglue\clearpage
}
%    \end{macrocode}
%    \end{environment}
%
%    \begin{environment}{labels}
%    It is the user-level environment for producing one or more sheets of 
%    address labels. 
%    Its default definition simply invokes \env{baselables}, but the 
%    user may redefine it to set some style parameters.  For example:
%\begin{verbatim}
%\renewenvironment{labels}{%
%    \baselabels
%    \setlength\fboxrule{.2pt}%
%    \addtolength\fboxsep{-2\fboxrule}%
%}{\endbaselabels}
%\end{verbatim}
%    will draw a thin border around each address label.
%    \begin{macrocode}
\newenvironment*{labels}{\baselabels}{\endbaselabels}
%    \end{macrocode}
%    \end{environment}
%
%    Back to uncommented code.
%    \begin{macrocode}
\let\@beginlabels=\relax
\let\@endlabels=\relax
\newenvironment*{labelgroup}{\stepcounter{letter}}{}
\let\@beginlabelgroup=\relax
\let\@endlabelgroup=\relax
\newcommand*\labeltab{\@killglue
  \ifnum\c@totallabel>\z@
    \count@ \c@totallabel
    \divide \count@ \c@addrlabelcolumns
    \multiply \count@ -\c@addrlabelcolumns
    \advance \count@ \c@totallabel
    \ifnum\count@=\z@
      \par\vskip\addrlabelsvsep\noindent
    \else
      \hskip\addrlabelshsep
    \fi
  \fi
  \stepcounter{totallabel}%
  \stepcounter{label}%
}
%    \end{macrocode}
%
%    \begin{macro}{\ifactuallabel}
%    Macro for the user: "\ifactuallabel{"\meta{FOO}"}{"\meta{BAR}"}"
%    executes \meta{FOO} if the label is not being skipped, \meta{BAR}
%    otherwise.
%    \begin{macrocode}
\let\ifactuallabel\@firstoftwo
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macrocode}
\newcommand\basemlabel[2]{%
  \begingroup
    \def\startaddrlabel{\par
      \noindent \vrule\@height\topskip \@depth\z@ \@width\z@ \par
      \vskip-\baselineskip \vskip\z@skip
    }%
    \def\stopaddrlabel{\par
      \ifnum\prevdepth>\z@
        \kern -\prevdepth
        \prevdepth\z@
      \fi
    }%
    \labeltab\mlabel{\ignorespaces #1}{\ignorespaces #2}%
  \endgroup
}
\newcommand\mlabel[2]{%
  \fbox{%
    \parbox[c][\addrlabeltrimheight]{\addrlabeltrimwidth}{%
      \raggedright\startaddrlabel #2\stopaddrlabel
    }%
  }%
}
\let\@mlabel=\@gobbletwo
%    \end{macrocode}
%
%    \subsubsection{Lists and other similar environments}
%
%    \begin{macrocode}
\normalfont \normalsize
\setlength\leftmargini  {2em}
\setlength\leftmarginii {2em}
\setlength\leftmarginiii{2em}
\setlength\leftmarginiv {1.75em}
\setlength\leftmarginv  {1.5em}
\setlength\leftmarginvi {1.5em}
\setlength\leftmargin   {\leftmargini}
\setlength  \labelsep  {.5em}
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\setlength\partopsep{\z@skip}
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
\def\@listI{\leftmargin\leftmargini
            \parsep \smallskipamount
            \topsep \medskipamount
            \itemsep\smallskipamount}
\let\@listi\@listI
\@listi
\def\@listii {\leftmargin\leftmarginii
              \labelwidth\leftmarginii
              \advance\labelwidth-\labelsep
              \topsep\smallskipamount
              \parsep\z@skip}
\def\@listiii{\leftmargin\leftmarginiii
              \labelwidth\leftmarginiii
              \advance\labelwidth-\labelsep}
\def\@listiv {\leftmargin\leftmarginiv
              \labelwidth\leftmarginiv
              \advance\labelwidth-\labelsep}
\def\@listv  {\leftmargin\leftmarginv
              \labelwidth\leftmarginv
              \advance\labelwidth-\labelsep}
\def\@listvi {\leftmargin\leftmarginvi
              \labelwidth\leftmarginvi
              \advance\labelwidth-\labelsep}
\renewcommand*\theenumi{\@arabic\c@enumi}
\renewcommand*\theenumii{\@alph\c@enumii}
\renewcommand*\theenumiii{\@roman\c@enumiii}
\renewcommand*\theenumiv{\@Alph\c@enumiv}
\newcommand*\labelenumi{\theenumi.}
\newcommand*\labelenumii{(\theenumii)}
\newcommand*\labelenumiii{\theenumiii.}
\newcommand*\labelenumiv{\theenumiv.}
\renewcommand*\p@enumii{\theenumi}
\renewcommand*\p@enumiii{\theenumi(\theenumii)}
\renewcommand*\p@enumiv{\p@enumiii\theenumiii}
\newcommand*\labelitemi{\textbullet}
\newcommand*\labelitemii{\normalfont\bfseries \textendash}
\newcommand*\labelitemiii{\textasteriskcentered}
\newcommand*\labelitemiv{\textperiodcentered}
\newenvironment*{description}
               {\list{}{\labelwidth\z@ \itemindent-\leftmargin
                        \let\makelabel\descriptionlabel}}
               {\endlist}
\newcommand*\descriptionlabel[1]{\hspace\labelsep
                                \normalfont\bfseries #1}
\newenvironment*{verse}
               {\let\\\@centercr
                \list{}{\setlength\itemsep{\z@skip}%
                        \setlength\itemindent{-15\p@}%
                        \setlength\listparindent{\itemindent}%
                        \setlength\rightmargin{\leftmargin}%
                        \addtolength\leftmargin{15\p@}}%
                \item[]}
               {\endlist}
\newenvironment*{quotation}
               {\list{}{\setlength\listparindent{1.5em}%
                        \setlength\itemindent{\listparindent}%
                        \setlength\rightmargin{\leftmargin}}%
                \item[]}
               {\endlist}
\newenvironment*{quote}
               {\list{}{\setlength\rightmargin{\leftmargin}}%
                \item[]}
               {\endlist}
%    \end{macrocode}
%
%    \subsubsection{Miscellanea}
%
%    \begin{macrocode}
\setlength\parindent{2em}
\setlength\parskip{\z@ plus \p@}
\setlength\columnsep{10\p@}
\setlength\columnseprule{\z@}
\setlength\arraycolsep{5\p@}
\setlength\tabcolsep{6\p@}
\setlength\arrayrulewidth{.4\p@}
\setlength\doublerulesep{2\p@}
\setlength\tabbingsep{\labelsep}
\skip\@mpfootins = \skip\footins
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}
\renewcommand*\theequation{\@arabic\c@equation}
\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}
\DeclareRobustCommand*{\cal}{\@fontswitch{\relax}{\mathcal}}
\DeclareRobustCommand*{\mit}{\@fontswitch{\relax}{\mathnormal}}
\renewcommand*\footnoterule{%
  \kern-\p@
  \hrule \@width .4\columnwidth
  \kern .6\p@}
\long\def\@makefntext#1{%
    \noindent
    \hangindent 5\p@
    \hb@xt@5\p@{\hss\@makefnmark}#1}
%    \end{macrocode}
%
%    \subsubsection{Names and final setup}
%
%    \begin{macrocode}
\newcommand*\subjectname     {Oggetto:}
\newcommand*\registeredname  {Raccomandata}
\newcommand*\registeredRRname{\registeredname~A.R.}
\newcommand*\andccname       {e~p.~c.}
\newcommand*\ccname          {P.~c.:}
\newcommand*\enclname        {Allegati:}
\newcommand*\PSname          {P.S.:}
\newcommand*\headtoname      {A:}
\newcommand*\lettername      {Lettera}
\newcommand*\today{\number\day~\ifcase\month\or
  gennaio\or febbraio\or marzo\or aprile\or maggio\or giugno\or
  luglio\or agosto\or settembre\or ottobre\or novembre\or dicembre\fi
  \space\number\year}
\let\do\@undefined
\pagestyle{plain}
\pagenumbering{arabic}
\raggedbottom
\onecolumn
%    \end{macrocode}
%
%    End of the module for the \packlass{\letteracdp} class.
%    \begin{macrocode}
%</letter>
%    \end{macrocode}
%    \noindent\null\par
%
% \section{The code for the \packlass{\articoletteracdp} class}
%
%    This part of the file goes into \filedir{\articoletteracdp.cls}.
%    \begin{macrocode}
%<*artico>
%    \end{macrocode}
%
%    \subsection{Identification}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1996/06/01] % LaTeX2e is required!
\ProvidesClass{articoletteracdp}
              [2015/02/08 v0.36 (development)]
%    \end{macrocode}
%
%    \subsection{Initial code}
%
%    We check that some names are not already taken.
%    \begin{macrocode}
\@ifdefinable\@out@table@list{}
\@ifdefinable\@in@table@list{}
\@ifdefinable\@do@tf{}
\@ifdefinable\@sec@head@size{}
%    \end{macrocode}
%
%    Definition of two switches that support the options about what to
%    include in the table of contents.
%    \begin{macrocode}
\def\do#1{\@ifdefinable#1{\newif#1}}
\do\if@toc@in@toc@
\do\if@loX@in@toc@
%    \end{macrocode}
%
%    \begin{macro}{\@letter@bookmark}
%    Support for pdf\TeX\slash\packlass{\HyperRef}.  If pdf\TeX\ is
%    being used to typeset the document, if the \packlass{\HyperRef}
%    package is loaded, and if the user doesn't ask us to avoid doing so,
%    we shall generate a ``level~0'' bookmark for each letter we shall
%    typeset (sections are of level~1, so they will be bookmarked under
%    letters).  This command serves this purpose: it is defined either
%    as "\@gobbletwo", if such bookmarks are \emph{not} being generated,
%    or as a suitable invocation of "\pdfbookmark" if they are.  To begin
%    with, we set the former alternative, which makes it act as a no-op.
%    \begin{macrocode}
\@ifdefinable\@letter@bookmark{\let\@letter@bookmark\@gobbletwo}
%    \end{macrocode}
%    \end{macro}
%
%    Space above and below captions for figures and tables.
%    \begin{macrocode}
\newlength\abovecaptionskip
\newlength\belowcaptionskip
%    \end{macrocode}
%
%    \subsection{Declaration of options}
%
%    \begin{macrocode}
\DeclareOption{titlepage}{%
  \@latexerr{No title page for letters}\@eha
}
\DeclareOption{notitlepage}{}
\DeclareOption{loXintoc}{%
  \@toc@in@toc@false
  \@loX@in@toc@true
}
\DeclareOption{tocintoc}{%
  \@toc@in@toc@true
  \@loX@in@toc@true
}
\DeclareOption{Hofstadter}{%
  \ExecuteOptions{tocintoc}%
}
\DeclareOption{plaintoc}{%
  \@toc@in@toc@false
  \@loX@in@toc@false
}
%    \end{macrocode}
%    The option \opz{letterbookmarks} causes the bookmarks for letters to
%    be generated.  Upon expansion, the 2~arguments of
%    "\@letter@bookmark" will become arguments of "\pdfbookmark".  We
%    also need to ask the \packlass{\HyperRef} package to generate closed
%    bookmarks.  Note that the user can later overwrite this setting;
%    note also that nothing will happen if \packlass{\HyperRef} is not
%    loaded later.
%    \begin{macrocode}
\DeclareOption{letterbookmarks}{%
  \def\@letter@bookmark{\pdfbookmark[0]}%
  \PassOptionsToPackage{bookmarksopen=false}{hyperref}%
}
%    \end{macrocode}
%    The option \opz{noletterbookmarks} supresses the bookmarks for
%    letters.
%    \begin{macrocode}
\DeclareOption{noletterbookmarks}{%
  \let\@letter@bookmark\@gobbletwo
}
%    \end{macrocode}
%    The option \opz{openletterbookmarks} causes the bookmarks for
%    letters to be generated and to be presented open to the reader.  We
%    ask the \packlass{\HyperRef} package to generate open bookmarks, but
%    only one level deep.  Note that the user can later overwrite this
%    setting.  This is made the default option, below.
%    \begin{macrocode}
\DeclareOption{openletterbookmarks}{%
  \def\@letter@bookmark{\pdfbookmark[0]}%
  \PassOptionsToPackage{bookmarksopen,bookmarksopenlevel=1}{hyperref}%
}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letteracdp}}
%    \end{macrocode}
%
%    \subsection{Option processing}
%
%    \begin{macrocode}
\ExecuteOptions{plaintoc,openletterbookmarks}
\ProcessOptions\relax
%    \end{macrocode}
%
%    \subsection{Class loading}
%
%    \begin{macrocode}
\LoadClass{letteracdp}[2015/02/08]
%    \end{macrocode}
%
%    \subsection{Main code}
%
%    Unfortunately, most of the code is not commented (yet).
%
%    \subsubsection{More initializations}
%
%    \begin{macrocode}
\newcounter{section}[letter]
\newcounter{paragraph}[section]
\newcounter{figure}[letter]
\newcounter{table}[letter]
%    \end{macrocode}
%
%    Stuff for dealing with the \packlass{\HyperRef} package.  The
%    problem is our non-standard hierarchy of sectioning commands, with
%    paragraphs placed directly below sections.  In this version (0.34) we
%    choose a different approach than the one we adopted in version 0.33,
%    redefining "\theHparagraph"; of course, this must be done
%    \emph{after} \packlass{\HyperRef} has been loaded, and we could not
%    find any better place for this than the "\AtBeginDocument" hook.
%    Within the same hook, we also redefine "\theHsection" (the counter
%    used by \packlass{\@hyperref} to generate hyperlinks to sections) so
%    that sections with the same number, but included in different
%    letters, will have different anchors; we fix the bookmark level for
%    paragraphs, too.
%    \begin{macrocode}
\AtBeginDocument{%
  \def\theHletter{\arabic{letter}}%
  \@ifpackageloaded{hyperref}{%
    \def\theHparagraph{\theHsection.\arabic{paragraph}}%
    \def\theHsection{\theHletter.\arabic{section}}%
    \def\toclevel@paragraph{2}%
  }{%
%    \end{macrocode}
%    If the \packlass{\@hyperref} package is not loaded, we ensure that
%    "\@letter@bookmarks" acts as a no-op:
%    \begin{macrocode}
    \let\@letter@bookmark\@gobbletwo
  }%
}
%    \end{macrocode}
%
%    \begin{macro}{\hyper@last}
%    The following line is to deactivate the check that
%    \packlass{\HyperRef} makes against old files; this is necessary
%    because otherwise, on the first \LaTeX\ run, it would overwrite our
%    redefinition of "\@starttoc", possibly writing unwanted
%    \filedir{.toc}, \filedir{.lof}, and \filedir{.lot} files, and (much
%    worse) causing trouble if the letter happens to contain more than one
%    "\tableofcontents", "\listoffigures", or "\listoftables".  Of
%    course, this means that the user must be informed that (s)he has to
%    delete the old files by hand.~\mbox{:-(}^^A ) paren match
%    \closeofsentencespace Note, anyway, that the automatic check
%    made by \packlass{\HyperRef} would not work with the \Bundle\ 
%    in any case (because it looks for \filedir{.toc}, \filedir{.lof},
%    etc.\ files, not for, say, \filedir{.toc1}, etc.), so\ldots
%    \begin{macrocode}
\@ifdefinable\hyper@last{\let\hyper@last\relax}
%    \end{macrocode}
%    \end{macro}
%
%    Back to uncommented code.
%
%    \begin{macrocode}
%% Command \title and \author redefined to make changes local.
\def\title#1{\def\@title{#1}}
\def\author#1{\def\@author{#1}}
%    \end{macrocode}
%
%    \subsubsection{Managing the \filedir{.toc}, \filedir{.lof}, and
%      \filedir{.lot} files}
%
%    \begin{macrocode}
%% Inner command \@starttoc redefined to make table of contents, etc.
%% local to letters (this is tricky!).
\def\@starttoc#1{%
  \begingroup
    \vskip\parskip
    \parskip\z@skip
    \makeatletter
    \@input{\jobname.#1\number\c@letter}%
    \if@filesw
      \@ifundefined{tf@@#1}{%
        \expandafter\newwrite\csname tf@@#1\endcsname
      }\relax
      \immediate\write\@out@table@list{\string\@do@tf{#1}}%
    \fi
    \@nobreakfalse
  \endgroup
}
%    \end{macrocode}
%
%    The "\@begin@letter@hook" macro is invoked whenever a letter
%    starts; we want (possibly, see above) a bookmark to be generated for
%    the letter.  Note that we use "\theletter" for the letter number
%    presented to the user, and "\theHletter" for the number used to
%    generate the anchor.
%    \begin{macrocode}
\g@addto@macro\@begin@letter@hook{%
  \edef\@cdp@reserved{%
    \noexpand\@letter@bookmark
      {\lettername\space\theletter}{letter.\theHletter}%
  }%
  \@cdp@reserved
%    \end{macrocode}
%
%    Actions for closing a set of toc/lof/lot file and opening another:
%    \begin{macrocode}
  \if@filesw
    {\escapechar\m@ne
      \immediate\write\@out@table@list{\string\}^^J\string\{}%
    }%
    \immediate\write\@auxout
      {\string\@deferred@clopen{\number\c@letter}}%
  \fi
}
%    \end{macrocode}
%
%    Uncommented code.
%    \begin{macrocode}
\@ifdefinable\@deferred@open  {\let\@deferred@open  \@gobble}
\@ifdefinable\@deferred@close {\let\@deferred@close \@empty}
\@ifdefinable\@deferred@clopen{\let\@deferred@clopen\@gobble}
\newwrite\@out@table@list
\newread\@in@table@list
\AtBeginDocument{%
  \if@filesw
    \immediate\openout\@out@table@list = \jobname.summ\relax
    {\escapechar\m@ne
      \immediate\write\@out@table@list{\string\{}%
    }%
    \immediate\write\@auxout{\string\@deferred@open{0}}%
    \def\@deferred@close{%
      \def\@do@tf##1{%
        \@restore@tf{##1}%
        \immediate\closeout \csname tf@##1\endcsname
        \global\expandafter\let\csname tf@##1\endcsname\@undefined
      }%
      \@temp@table@list
    }%
    \def\@deferred@open#1{%
      \ifeof\@in@table@list\else
        \read\@in@table@list to\@temp@table@list
        \def\@do@tf##1{%
          \@restore@tf{##1}%
          \immediate\openout
            \csname tf@##1\endcsname = \jobname.##1#1\relax
        }%
        \@temp@table@list
      \fi
    }%
    \def\@deferred@clopen#1{%
      \@deferred@close
      \@deferred@open{#1}%
    }%
  \fi
}
\AtEndDocument{%
  \if@filesw
    {\escapechar\m@ne
      \immediate\write\@out@table@list{\string\}}%
    }%
    \immediate\closeout\@out@table@list
    \clearpage
    \immediate\write\@auxout{\string\@deferred@close}%
    \openin\@in@table@list = \jobname.summ\relax
  \fi
}
\@ifdefinable\@restore@tf{\def\@restore@tf#1{%
  \edef\@tempa{%
    \let\csname tf@#1\endcsname\csname tf@@#1\endcsname
  }%
  \global\@tempa
}}
\@ifdefinable\@temp@table@list{\let\@temp@table@list\@empty}
%    \end{macrocode}
%
%    \subsubsection{Adding punctuation to titles}
%
%    \begin{macrocode}
\@ifdefinable\@addfullstop{\long\def\@addfullstop#1{%
  {\nonfrenchspacing\ignorespaces#1\unskip
  \ifnum \spacefactor>\@m \else.\fi \/}%
}}
\newcommand*\nopunct{\spacefactor 1001\relax}
%    \end{macrocode}
%
%    \subsubsection{Floats}
%
%    \begin{macrocode}
\setcounter{topnumber}{\tw@}
\renewcommand\topfraction{.7}
\setcounter{bottomnumber}{\@ne}
\renewcommand\bottomfraction{.3}
\setcounter{totalnumber}{\thr@@}
\renewcommand\textfraction{.2}
\renewcommand\floatpagefraction{.5}
\c@dbltopnumber\c@topnumber
\let\dbltopfraction\topfraction
\let\dblfloatpagefraction\floatpagefraction
\setlength  \floatsep           {\bigskipamount}
\@msetlength\textfloatsep    {2}{\bigskipamount}
\setlength  \intextsep          {\bigskipamount}
\setlength  \dblfloatsep        {\bigskipamount}
\@msetlength\dbltextfloatsep {2}{\bigskipamount}
\setlength  \@fptop             {\z@ plus 1 fil}
\setlength  \@fpsep             {1\bigskipamount plus 2 fil}
\setlength  \@fpbot             {\z@ plus 1 fil}
\setlength  \@dblfptop          {\@fptop}
\setlength  \@dblfpsep          {\@fpsep}
\setlength  \@dblfpbot          {\@fpbot}
\setlength\abovecaptionskip{\medskipamount}
\setlength\belowcaptionskip{\z@skip}
%    \end{macrocode}
%
%    \subsubsection{Title, section heads, figures, bibliography\ldots}
%
%    \begin{macro}{\maketitle}
%    Without the \packlass{\@hyperref} package, the "\maketitle"
%    command can take the same optional argument as "\maketopdate", for
%    specifying a short string to be prepended to the date; and in this
%    case, the new "\place" declaration will be automatically honored.
%    But the former feature will break if \packlass{\@hyperref} is
%    loaded, and no remedy seems feasible for this, since
%    \packlass{\@hyperref} assumes that "\maketitle" hasn't got any
%    arguments.  Note also that a period is automatically added to the
%    title.
%    \begin{macrocode}
\newcommand*\maketitle{%
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \def\thesenderaddress{\@author}%
    \def\thesubject{\leavevmode\@addfullstop\@title}%
    \let\@empty@sender\@empty
    \let\@thanks\@empty
    \makepresentation
    \@thanks
  \endgroup
  \setcounter{footnote}{\z@}%
  \maketopdate
}
%    \end{macrocode}
%    \end{macro}
%
%    Uncommented code.
%    \begin{macrocode}
\setcounter{secnumdepth}{\tw@}
\def\@seccntformat#1{\csname the#1\endcsname .\enspace}
\ifcase \@ptsize\relax
  \def\@sec@head@size{\@setfontsize\@sec@head@size\@xiipt{15}}
\or
  \def\@sec@head@size{\@setfontsize\@sec@head@size\@xiipt{17.4}}
\or
  \def\@sec@head@size{\@setfontsize\@sec@head@size\@xivpt{18.75}}
\fi
\newcommand*\section{\@startsection {section}{\@ne}%
  {\z@}%
  {-\bigskipamount}%
  {\smallskipamount}%
  {%
    \normalfont
    \noindent\null\@@par\nobreak\vskip-\baselineskip
    \parskip\z@skip
    \@sec@head@size\bfseries
  }%
}
\newcommand*\paragraph{\@startsection{paragraph}{\tw@}%
  {\z@}%
  {-\medskipamount}%
  {-.66667em}%
  {\normalfont\normalsize\itshape\@addfullstop}%
}
\newcommand*\epilogue{%
  \if@noskipsec \leavevmode \fi
  \par
  \if@nobreak
    \everypar{}%
  \else
    \addpenalty\@secpenalty\addvspace\bigskipamount
  \fi
}
\renewcommand*\thesection{\@arabic\c@section}
\renewcommand*\theparagraph{\thesection.\@arabic\c@paragraph}
\renewcommand*\thefigure{\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{\@ne}
\def\ext@figure{lof}
\def\fnum@figure{\figurename~\thefigure}
\newenvironment*{figure}
               {\@float{figure}}
               {\end@float}
\newenvironment*{figure*}
               {\@dblfloat{figure}}
               {\end@dblfloat}
\renewcommand*\thetable{\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{\tw@}
\def\ext@table{lot}
\def\fnum@table{\tablename~\thetable}
\newenvironment*{table}
               {\@float{table}}
               {\end@float}
\newenvironment*{table*}
               {\@dblfloat{table}}
               {\end@dblfloat}
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{\itshape \@addfullstop{#1: #2}}%
  \ifdim \wd\@tempboxa >\hsize
    \unhbox\@tempboxa\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip
}
\newcommand*\@pnumwidth{1.55em}
\newcommand*\@tocrmarg{2.55em}
\newcommand*\@dotsep{4.5}
\setcounter{tocdepth}{\@ne}
\newcommand*\tableofcontents{%
  \section*{\contentsname \sectionmark\contentsname}
  \if@toc@in@toc@
    \addcontentsline{toc}{section}{\protect\contentsname}%
  \fi
  \@starttoc{toc}%
}
\newcommand*\l@section{\@dottedtocline{\@ne}{\z@}{2em}}
\newcommand*\l@paragraph[2]{%
  \@dottedtocline{\tw@}{2em}{2.5em}{\small #1}{\small #2}%
}
\newcommand*\listoffigures{%
  \section*{\listfigurename \sectionmark\listfigurename}%
  \if@loX@in@toc@
    \addcontentsline{toc}{section}{\protect\listfigurename}%
  \fi
  \@starttoc{lof}%
}
\def\l@figure{\@dottedtocline{\@ne}{\z@}{2em}}
\newcommand*\listoftables{%
  \section*{\listtablename \sectionmark\listtablename}%
  \if@loX@in@toc@
    \addcontentsline{toc}{section}{\protect\listtablename}%
  \fi
  \@starttoc{lot}%
}
\let\l@table\l@figure
\newenvironment*{thebibliography}[1]{%
  \startbreaks
  \section*{\refname \sectionmark\refname}%
  \addcontentsline{toc}{section}{\protect\refname}%
  \vskip\parskip
  \parskip\z@skip
  \parindent\z@
  \list{\@biblabel{\@arabic\c@enumiv}}{%
    \settowidth\labelwidth{\@biblabel{#1}}%
    \leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \usecounter{enumiv}%
    \let\p@enumiv\@empty
    \renewcommand\theenumiv{\@arabic\c@enumiv}%
  }%
  \sloppy
  \clubpenalty 4000
  \@clubpenalty \clubpenalty
  \widowpenalty 4000
  \sfcode`\.\@m
}{%
  \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
  \endlist
}
\newcommand*\newblock{\hskip .11em\@plus.33em\@minus.07em}
\newcommand*\bysame{\leavevmode\hbox to3em{\hrulefill}\thinspace}
%    \end{macrocode}
%
%    \subsubsection{Names}
%
%    \begin{macrocode}
\newcommand*\contentsname  {Sommario}
\newcommand*\listfigurename{Indice delle figure}
\newcommand*\listtablename {Indice delle tabelle}
\newcommand*\refname       {Testi citati}
\newcommand*\indexname     {Indice analitico}
\newcommand*\figurename    {Figura}
\newcommand*\tablename     {Tabella}
%    \end{macrocode}
%
%    End of the module for the \packlass{\articoletteracdp} class.
%    \begin{macrocode}
%</artico>
%    \end{macrocode}
%    \noindent\null\par
%
% \section{The code for the \packlass{\cdpaddon} package}
%
%    This part of the file goes into \filedir{\cdpaddon.sty}.
%    \begin{macrocode}
%<*addon>
%    \end{macrocode}
%
%    \subsection{Identification}
%
%    Why did I ask for the June 1998 release of \LaTeX?  I don't remember!
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1998/06/01] % LaTeX2e is required!
\ProvidesPackage{cdpaddon}
              [2015/02/08 v0.36 (development)]
\@ifdefinable\@cdpaddon{\def\@cdpaddon{cdpaddon}}
%    \end{macrocode}
%
%    \subsection{Initial code}
%
%    Switches; "\if@custom@lh@" added in vers.~0.36 (2015 Feb~08).
%    \begin{macrocode}
\def\do#1{\@ifdefinable#1{\newif#1}}
\do\if@using@cdp@
\do\if@use@color@
\do\if@use@hyper@
\do\if@custom@lh@
%    \end{macrocode}
%
%    \begin{macro}{\@cdpaddon@printer}
%    Below, we shall store in this macro the name (without the extension
%    \filedir{.def}) of the definition file from which to read the
%    definitions of the colors for the C.D.P.  seal.
%    If it is empty, the emergency colors will be used:
%    we make this the default.
%    \begin{macrocode}
\@ifdefinable\@cdpaddon@printer{\let\@cdpaddon@printer\@empty}
%    \end{macrocode}
%    \end{macro}
%
%    ``Scratch'' macros, will be re-used in the sequel.
%    \begin{macrocode}
\@ifdefinable\@temp@cdpaddon@a{}
\@ifdefinable\@temp@cdpaddon@b{}
%    \end{macrocode}
%
%    Here is a first use of those ``scratch'' macros.
%    \begin{macrocode}
\def\@temp@cdpaddon@a{%
  \@using@cdp@false
  \PackageWarningNoLine{\@cdpaddon}{%
    It seems that you are not using the letteracdp\MessageBreak
    document class; therefore no attempt will be made\MessageBreak
    to modify letterheads and similar things%
  }%
}
\def\@temp@cdpaddon@b{letteracdp}
%    \end{macrocode}
%    Double check to be absolutely sure that the \packlass{\letteracdp}
%    class is loaded.
%    \begin{macrocode}
\@ifclassloaded{\@temp@cdpaddon@b}{%
  \ifx\@letteracdp\@temp@cdpaddon@b
    \@using@cdp@true
  \else
    \@temp@cdpaddon@a
  \fi
}{%
  \@temp@cdpaddon@a
}
%    \end{macrocode}
%
%    \subsection{Declaration of options}
%
%    The following macro is needed to strip the prefix \opz{printer:}\
%    from the option that selects which color definition file to load.
%    Again, we use one of the ``scratch'' macro to save memory (the other
%    ``scratch'' macro is used as well inside).
%    \begin{macrocode}
\def\@temp@cdpaddon@a#1printer:#2,#3\@@@{%
  \def\@temp@cdpaddon@b{#1}%
  \ifx\@temp@cdpaddon@b\@empty
    \def\@cdpaddon@printer{#2}%
  \else
    \@unknownoptionerror
  \fi
}
%    \end{macrocode}
%    Vers.~0.36 (2015 Feb~08): modified the existing option so that they also
%    deal with the new "\if@custom@lh@" switch\ldots
%    \begin{macrocode}
\DeclareOption{bw}{\@use@color@false\@custom@lh@false}
\DeclareOption{color}{\@use@color@true\@custom@lh@false}
\DeclareOption{hypertext}{\@use@hyper@true\@custom@lh@false}
\DeclareOption{plaintext}{\@use@hyper@false\@custom@lh@false}
%    \end{macrocode}
%    \ldots~and added new \opz{customletterhead} option.
%    \begin{macrocode}
\DeclareOption{customletterhead}{%
  \@use@color@false
  \@use@hyper@false
  \@custom@lh@true
}
%    \end{macrocode}
%    Otherwise, we can have a \opz{printer:}\ldots\ option requesting a color
%    definition file.
%    \begin{macrocode}
\DeclareOption*{%
  \expandafter\@temp@cdpaddon@a\CurrentOption,printer:,\@@@%
}
%    \end{macrocode}
%
%    \subsection{Option processing}
%
%    \begin{macrocode}
\ExecuteOptions{color,plaintext}
\ProcessOptions\relax
%    \end{macrocode}
%    If the \opz{printer:Default} option has been specified, we want
%    the same behavior as if no \opz{printer:}\ldots\ option had been
%    specified at all.
%    \begin{macrocode}
\def\@temp@cdpaddon@a{Default}
\ifx\@cdpaddon@printer\@temp@cdpaddon@a
  \let\@cdpaddon@printer\@empty
\fi
%    \end{macrocode}
%
%    \subsection{Package loading}
%
%    V.~0.34a: fixed up the use of dvips names
%    (bug reported by Tommaso Gordini).^^A
%    \changes{0.34a}{2010 Jun 01}{Fixed up the use of dvips names in the
%      \protect\packlass{\protect\cdpaddon} package (bug reported by Tommaso
%      Gordini).}
%    V.~0.36: also removed the ridiculous check for the presence of standard
%    packages on the system!
%    \begin{macrocode}
\if@use@color@
  \RequirePackage[dvipsnames]{color}
\fi
\if@use@hyper@
  \RequirePackage{hyperref}
\fi
%    \end{macrocode}
%
%    \subsection{Main code}
%
%    Unfortunately, the code is only sparsely commented (at the moment).
%
%    \subsubsection{Redefinition of the seal, etc.}
%
%    Vers.~0.36 (2015 Feb~08): removed the "\@back@folding@tag" macro,
%    now become unnecessary because of the introduction of the
%    "\foldingtagrule" user command.
%    We leave the code in place, but commented out, for documentation purposes.
%\begin{verbatim}
%\@ifdefinable\@back@folding@tag{\def\@back@folding@tag{%
%  \if@do@fold@
%    \raisebox{\@lh@folding@ht}[\z@][\z@]{%
%      \makebox[\z@][l]{%
%        \color{strong@col}%
%        \dimen@ -\@lh@right@margin
%        \advance\dimen@ 1cm%
%        \kern\dimen@ \vbox{%
%          \kern -.1\p@
%          \hrule \@height .1\p@ \@depth .1\p@ \@width 5mm%
%          \kern -.1\p@
%        }%
%      }%
%    }%
%  \fi
%}}
%\end{verbatim}
%
%    If the \packlass{\letteracdp} class is loaded\ldots
%    \begin{macrocode}
\if@using@cdp@
%    \end{macrocode}
%    \ldots then we can try to replace the macros that draw the seal,
%    etc.; but we want to perform the redefinition (if and) only if the
%    macro is already defined, and rise an error otherwise.  To ease this
%    task, we define the ``scratch'' macro "\@temp@cdpaddon@a" in such a
%    way that "\@temp@cdpaddon@a{"\meta{name}"}{"\meta{code}"}" rises an
%    error if \meta{name} is undefined, and executes \meta{code}
%    otherwise.  It is intended that \meta{code} is the code that does the
%    actual redefinition.  Note that \meta{name} must be indicated
%    \emph{without} the backslash.  Note also that it is not necessary
%    a second parameter for \meta{code}: "{"\meta{code}"}" becomes the
%    third parameter of "\@ifundefined".
%    \begin{macrocode}
  \def\@temp@cdpaddon@a#1{%
    \@ifundefined{#1}{%
      \PackageError\@cdpaddon{%
        Internal command \@backslashchar#1 undefined%
      }{%
        The internal command \@backslashchar#1,
        that should have been defined\MessageBreak
        by the \@letteracdp\space document class,
        is actually undefined.\MessageBreak
        Probably, you are using an old or modified version
        of that class.\MessageBreak
%    \end{macrocode}
%    Vers.~0.36 (2015 Feb~08): modified the following line:
%    \begin{macrocode}
        Proceed, but keep your fingers crossed!%
      }%
    }%
  }
%    \end{macrocode}
%
%    We first take care of color.  Did the user request colors?
%    \begin{macrocode}
  \if@use@color@
%    \end{macrocode}
%    Yes?  Well, in that case, we try to load the file that defines
%    the hues.  First of all, see whether the user selected a color
%    definition file.
%    \begin{macrocode}
    \ifx\@cdpaddon@printer\@empty
%    \end{macrocode}
%    If not (\("\@cdpaddon@printer"="\@empty"\)), then we must read the
%    config.\ file.  Before doing this, we define the "\DeclareCDPSealHuesDefault"
%    command, in a somewhat tricky way: we begin a group, thereby making
%    a local definition, but we put the "\endgroup" in the replacement text
%    of the macro itself.  This is quite OK, because once the macro has
%    been expanded, we no longer need its definition!  We must foresee
%    the case in which the configuration file does not contain any
%    "\DeclareCDPSealHuesDefault" command at all.  For this, we use
%    another hack: we "\let" "\@temp@cdpaddon@b" equal to "\endgroup"
%    \emph{inside} the group, but to "\@empty" outside of it.  Then we call it:
%    if the group has already ended, nothing happens, otherwise the group
%    is ended now.
%    \begin{macrocode}
      \let\@temp@cdpaddon@b\@empty
      \begingroup % \endgroup put in by \@temp@cdpaddon@b
      \let\@temp@cdpaddon@b\endgroup
      \InputIfFileExists{cdpshues.cfg}{%
        \PackageInfo{\@cdpaddon}{%
          Reading config. file%
        }%
%    \end{macrocode}
%    \begin{macro}{\DeclareCDPSealHuesDefault}
%    This command is defined in such a way that it not only ends the group,
%    but also stops reading from the file.
%    \begin{macrocode}
        \def\DeclareCDPSealHuesDefault{%
          \@temp@cdpaddon@b % ends group
          \endinput
%    \end{macrocode}
%    \end{macro}
%    The argument to "\DeclareCDPSealHuesDefault" will become the
%    replacement text of the following "\def".
%    \begin{macrocode}
          \def\@cdpaddon@printer
        }%
      }{%
        \PackageWarningNoLine{\@cdpaddon}{%
          Could not find config. file for default printer%
        }%
      }%
%    \end{macrocode}
%    The following is part of the hack to end the group if it has not
%    already ended.
%    \begin{macrocode}
      \@temp@cdpaddon@b
%    \end{macrocode}
%    We now check if the user specified the \opz{printer:None} option;
%    if so, we take the same action that would result from an empty
%    configuration file.
%    \begin{macrocode}
    \else
      \def\@temp@cdpaddon@b{None}%
      \ifx\@cdpaddon@printer\@temp@cdpaddon@b
        \let\@cdpaddon@printer\@empty
      \fi
%    \end{macrocode}
%    End of things to do when no \opz{printer:}\ldots\ option has been
%    specified.
%    \begin{macrocode}
    \fi
%    \end{macrocode}
%    OK, now we have the name of the color definition file in
%    "\@cdpaddon@printer", and we have to load it.  The following are the
%    actions to take when the file cannot be found or when
%    "\@cdpaddon@printer" is still empty (\emph{e.g.,} because no
%    config.\ file was found, or because it was void): use emergency
%    definitions and issue a warning.  We save them in a ``scratch''
%    macro because we need them twice~(!).
%    \begin{macrocode}
    \def\@temp@cdpaddon@b{%
      \definecolor{slight@col}{named}{SpringGreen}
      \definecolor{strong@col}{named}{OliveGreen}
      \PackageInfo{\@cdpaddon}{%
        Color hues defined internally%
      }%
      \typeout{%
        *Package cdpaddon using built-in colors for the C.D.P. seal.*%
      }%
    }
%    \end{macrocode}
%    We finally try to load the color definition file.
%    \begin{macrocode}
    \ifx\@cdpaddon@printer\@empty
      \@temp@cdpaddon@b
    \else
      \InputIfFileExists{\@cdpaddon@printer.def}{%
        \PackageInfo{\@cdpaddon}{%
          Color hues defined by def. file\MessageBreak
          \@cdpaddon@printer.def%
        }%
      }{%
        \PackageWarningNoLine{\@cdpaddon}{%
          Could not find def. file \@cdpaddon@printer.def%
        }%
        \@temp@cdpaddon@b
      }%
    \fi
%    \end{macrocode}
%
%    We define another handy subroutine.  Given the name \meta{boxname}
%    of an hbox, "\@temp@cdpaddon@b{"\meta{boxname}"}" causes a
%    "\color{strong@col}" declaration to be added at the beginning of
%    "\"\meta{boxname}, properly contained in a group to ensure that the
%    "\special" for restoring the previous colors is included in the box too.
%    We use this method of setting and resetting the color inside the
%    individual boxes because the one used in the previous versions, of
%    setting the color once for all at the beginning of "\@cdp@head", did
%    not seem to work properly with pdf\TeX.
%    \begin{macrocode}
    \def\@temp@cdpaddon@b#1{%
      \@temp@cdpaddon@a{#1}{%
        \setbox\z@\box\@nameuse{#1}%
        \sbox{\@nameuse{#1}}{{\color{strong@col}\unhbox\z@}}%
      }%
    }
%    \end{macrocode}
%
%    Actual redefinition of macros begins here.
%
%    Vers.~0.36 (2015 Feb~08): no need, now, to redefine the "\@folding@tag"
%    macro: just redefine the user-level command "\foldingtagrule"
%    (much neater!).
%    \begin{macrocode}
    \renewcommand*\foldingtagrule{%
      \color{strong@col}%
      \CDPFactoryFoldingTagRule
    }
%    \end{macrocode}
%
%    \begin{macro}{\@logo@box@base}
%    \changes{0.32}{2002 Jul 01}{Eliminated an awful bug introduced with
%      version 0.31 (a conditional that could not appear at this spot).}^^A
%    Color the main part of the seal.
%    \begin{macrocode}
    \@temp@cdpaddon@a{@logo@box@base}{%
      \savebox\@logo@box@base[\z@][r]{\setlength\unitlength{.625mm}%
        \begin{picture}(32,16)(-3,7.87)%
%    \end{macrocode}
%    I don't remember exactly what this group was for.  Eliminate?
%    \begin{macrocode}
          \begingroup
%    \end{macrocode}
%    Draw the inner of the~``D'' and of the~``P'', in the slight color.
%    \begin{macrocode}
            \color{slight@col}%
%    \end{macrocode}
%    Try to draw two filled circles of the right size to fill up the
%    inner of the two letters.  If the target system happens to have 
%    sufficiently large filled circles, this will suffice.
%    \begin{macrocode}
            \put(8,16){\circle*{10}}%
            \put(18,16){\circle*{10}}%
%    \end{macrocode}
%    With the standard set of fonts, however, the above request can not
%    be honored, and the two circles we have just obtained are a little
%    too small; so, we finish them by adding arcs of circumference of
%    increasing size, drawn in thick lines.
%    \begin{macrocode}
            \thicklines
            \put(8,16){\oval(8.2,8.2)[l]}%
            \put(8,16){\oval(8.6,8.6)[l]}%
            \put(8,16){\oval(9,9)[l]}%
            \put(8,16){\oval(9.4,9.4)[l]}%
            \put(8,16){\oval(9.8,9.8)[l]}%
            \put(18,16){\oval(8.2,8.2)[r]}%
            \put(18,16){\oval(8.6,8.6)[r]}%
            \put(18,16){\oval(9,9)[r]}%
            \put(18,16){\oval(9.4,9.4)[r]}%
            \put(18,16){\oval(9.8,9.8)[r]}%
%    \end{macrocode}
%    Now erase the inner half of the two circles.
%    \begin{macrocode}
            \put(13,16){\makebox(0,0){\color{white}%
              \vrule height 6.25mm depth 0mm width 6.25mm
            }}%
%    \end{macrocode}
%    Draw the vertical part of the two letters.
%    \begin{macrocode}
            \put(9,11){\makebox(0,0)[bl]{%
              \vrule height 12.5mm depth 0mm width 1.875mm
            }}%
            \put(14,1){\makebox(0,0)[bl]{%
              \vrule height 12.5mm depth 0mm width 1.875mm
            }}%
          \endgroup
%    \end{macrocode}
%    Now redraw the outer strokes of the~``D'' and of the~``P'' in the
%    strong color.
%    \begin{macrocode}
          \color{strong@col}%
          \put(8,16){\oval(10,10)[l]}%
          \put(8,11){\line(0,1){10}}%
          \put(9,11){\framebox(3,20){}}%
          \put(18,16){\oval(10,10)[r]}%
          \put(18,11){\line(0,1){10}}%
          \put(14,1){\framebox(3,20){}}%
%    \end{macrocode}
%    The strokes of the~``C'' are thick.
%    \begin{macrocode}
          \thicklines
          \put(8,16){\oval(16,16)[l]}%
          \put(8,8){\line(1,0){5}}%
          \put(13,24){\line(1,0){10}}%
          \put(8,16){\oval(14,14)[l]}%
          \put(8,9){\line(1,0){5}}%
          \put(13,23){\line(1,0){10}}%
        \end{picture}%
      }%
    }
%    \end{macrocode}
%    \end{macro}
%    Coloring the other parts of the seal is easier: just add the color
%    declaration to the various boxes, to the rule in the head, and to the
%    whole footer.
%    \begin{macrocode}
    \@temp@cdpaddon@b{@logo@box@addS}
    \@temp@cdpaddon@b{@logo@box@addL}
    \@temp@cdpaddon@b{@oordinamento@box}
    \@temp@cdpaddon@a{@cdp@head}{\def\@cdp@head{%
      \@logo@overlay\@logo@box@addL
      \copy\@oordinamento@box
      {\color{strong@col}\hrulefill}\kern\@lh@right@margin
    }}
    \@temp@cdpaddon@a{@cdp@foot}{\def\@cdp@foot{%
      \color{strong@col}%
      \reset@font
      \setlength\@tempdima{\textwidth}%
      \addtolength\@tempdima{-2\@lh@right@margin}%
      \hss\parbox[t]{\@tempdima}{%
        \parfillskip\z@skip
        \noindent\hrulefill\@@par
        \baselineskip 11\p@
        \hb@xt@\hsize{\hfil\copy\@name@and@WWW@box\hfil}%
      }\hss
    }}
  \fi
%    \end{macrocode}
%
%    Support for user-defined letterheads added in vers.~0.36 (2015 Feb~08).
%    Support for custom logo (cf.~\sty{logo} pagestyle and its relatives)
%    still kept hidden.
%
%    First, define storage boxes to hold custom head, foot, and logo.
%    \begin{macrocode}
  \newsavebox\@cdp@custom@lhead@box
  \newsavebox\@cdp@custom@lfoot@box
  \newsavebox\@cdp@custom@llogo@box
%    \end{macrocode}
%
%    \begin{environment}{customletterhead}
%    \begin{environment}{customletterfoot}
%    \begin{environment}{customletterlogo}
%    These three environments are defined similarly, so we use one of the
%    ``scratch'' macros to perform their definition
%    The parameters are:\strut\\*
%    \strut
%    \begin{tabular}{r@{}l}
%      \param{1} & \( \texttt{head} \mathbin{|} \texttt{foot} \mathbin{|}
%          \texttt{logo} \);\\
%      \param{2} & intended alignment of the \env{minipage}
%          (\( \texttt{b} \mathbin{|} \texttt{t} \));\\
%      \param{3} & either "\vss" or nothing;\\
%      \param{4} & either "\vss" or nothing.\\
%    \end{tabular}\strut
%    \begin{macrocode}
  \def\@temp@cdpaddon@b#1#2#3#4{%
    \newenvironment*{customletter#1}[1]{%
%    \end{macrocode}
%    Save in the appropriate box, pretending that they have zero height and
%    depth\ldots
%    \begin{macrocode}
      \setbox\@nameuse{@cdp@custom@l#1@box}\vbox to\z@ \bgroup
        \hsize ##1\relax
        \parskip \z@skip
        #3% either \vss or nothing
%    \end{macrocode}
%    \ldots~the contents of a temporary \env{minipage}; note that we need to
%    disable the ``"Missing \begin{document}"'' error, which is triggered by
%    "\everypar".
%    \begin{macrocode}
        \everypar{}%
        \noindent\minipage[#2]{##1}%
          \null
    }{%
%    \end{macrocode}
%    Code for ending the \env{minipage}: note that we smash to zero the 
%    possible depth of the contents.
%    \begin{macrocode}
          \par
          \vskip -\baselineskip
          \null
        \endminipage
        #4% either \vss or nothing
      \egroup
%    \end{macrocode}
%    ``Lift'' the definition out of the group implied by the environment.
%    We have used the outer boxes, above, because we prefer not to keep around
%    any ``scratch'' boxes (\emph{e.g.}, "\box1") when we must pass control to
%    the final user.
%    \begin{macrocode}
      \global \setbox \@ne \box \@nameuse{@cdp@custom@l#1@box}%
      \xdef\@cdp@reserved{%
        \setbox \@nameuse{@cdp@custom@l#1@box}\box \@ne
      }%
      \aftergroup \@cdp@reserved
    }%
  }%
%    \end{macrocode}
%    Perform definitions of the three abovementioned environments.
%    \begin{macrocode}
  \@temp@cdpaddon@b{head}{b}{\vss}{}
  \@temp@cdpaddon@b{foot}{t}{}{\vss}
  \@temp@cdpaddon@b{logo}{b}{\vss}{}
%    \end{macrocode}
%    \end{environment}
%    \end{environment}
%    \end{environment}
%
%    \begin{macro}{\ruleacrossheadorfoot}
%    Draw a rule across head or foot.  Synopsis:
%    \begin{flushleft}
%      "\ruleacrossheadorfoot["\meta{wdth\_l}"]["\meta{wdth\_r}"]"
%    \end{flushleft}
%    \meta{wdth\_l} is the inset from the left margin (defaults to zero),
%    a negative inset causes the rule to protrude into the margin itself;
%    \meta{wdth\_r} is the inset from the right margin (defaults to
%    \meta{wdth\_l}).  Both \meta{wdth\_l} and \meta{wdth\_r} must be
%    rigid lengths.  \emph{Note:} "\@tempdima" and "\@tempdimb" are used here.
%    \begin{macrocode}
  \newcommand*\ruleacrossheadorfoot[1][\z@]{\par
    \setlength\@tempdima{#1}%
    \@ifnextchar [% ] bracket matching
      \@cdp@rule@across@x
      {%
        \@tempdimb \@tempdima
        \@cdp@rule@across
      }%
  }
%    \end{macrocode}
%    \end{macro}
%
%    Inner implementation.
%    \begin{macrocode}
  \@ifdefinable\@cdp@rule@across@x{\def\@cdp@rule@across@x[#1]{%
    \setlength\@tempdimb{#1}%
    \@cdp@rule@across
  }}
  \@ifdefinable\@cdp@rule@across{\def\@cdp@rule@across{
    \nobreak
    \vskip -\baselineskip
    \hb@xt@ \hsize {%
      \kern \@tempdima \hrulefill \kern \@tempdimb
    }%
  }}
%    \end{macrocode}
%
%    If the \opz{customletterhead} option is in force, install custom
%    head\slash foot\slash logo.
%    \begin{macrocode}
  \if@custom@lh@
    \@temp@cdpaddon@a{@cdp@head}{\def\@cdp@head{%
      \hss\copy\@cdp@custom@lhead@box\hss
    }}
    \@temp@cdpaddon@a{@cdp@foot}{\def\@cdp@foot{%
      \hss\copy\@cdp@custom@lfoot@box\hss
    }}
%    \end{macrocode}
%    The logo is assumed to protrude to the left of the header line.
%    \begin{macrocode}
    \@temp@cdpaddon@a{@cdp@logo}{\def\@cdp@logo{%
      \hb@xt@ \z@ {\hss\copy\@cdp@custom@llogo@box}%
    }}
%    \end{macrocode}
%    Do not forget to reset "\longindentation"!
%    \begin{macrocode}
    \setlength\longindentation{.5\textwidth}
  \fi
%    \end{macrocode}
%
%    We now deal with hyperlinks.  If the user requested them\ldots
%    \begin{macrocode}
  \if@use@hyper@
%    \end{macrocode}
%    \ldots well, we take care of them.  The precompilation of the footer
%    must be deferred until the "\begin{document}" hook, because the macros
%    of the \packlass{hyperref} package are not available for actual
%    typesetting until that moment.  Note that we just need to encapsulate
%    the web address of the \emph{Coordinamento} into an "\href" command:
%    the color-switching command has already been given above, inside the
%    "\@cdp@foot" box (the color must be changed independently of the use
%    of hyperlinks).
%    \begin{macrocode}
    \AtBeginDocument{%
      \@temp@cdpaddon@a{@name@and@WWW@box}{%
        \setbox\@name@and@WWW@box = \vtop{%
          \baselineskip 11\p@
          \hb@xt@\z@{\hss \@lh@rm\Coordinamento \hss}%
          \hb@xt@\z@{%
            \hss
            \@lh@it World Wide Web:\/
            \href{\CoordinamentoWWW}{\@lh@tt \CoordinamentoWWW}%
            \hss
          }%
        }%
      }%
%    \end{macrocode}
%    Of course, in this case we cannot release the "\@temp@cdpaddon@a"
%    macro until the "\begin{document}" hook, too.
%    \begin{macrocode}
      \let\@temp@cdpaddon@a\@undefined
    }
%    \end{macrocode}
%    The following line has been removed from the code, since the
%    bookmark level for paragraphs is now fixed in the file
%    \filedir{\articoletteracdp.cls} (v.~0.34).
%\begin{verbatim}
%\def\toclevel@paragraph{2}
%\end{verbatim}
%    If hyperlinks are not requested, we can release "\@temp@cdpaddon@a"
%    right now.
%    \begin{macrocode}
  \else
    \let\@temp@cdpaddon@a\@undefined
  \fi
%    \end{macrocode}
%
%    We can do the same thing if the \packlass{\letteracdp} class is
%    not loaded.
%    \begin{macrocode}
\else
  \let\@temp@cdpaddon@a\@undefined
\fi
%    \end{macrocode}
%
%    The memory taken by the following ``scratch'' macros can be freed
%    in any case.
%    \begin{macrocode}
\let\if@using@cdp@\@undefined
\let\@using@cdp@true\@undefined
\let\@using@cdp@false\@undefined
\let\if@use@color@\@undefined
\let\@use@color@true\@undefined
\let\@use@color@false\@undefined
\let\if@use@hyper@\@undefined
\let\@use@hyper@true\@undefined
\let\@use@hyper@false\@undefined
%    \end{macrocode}
%    Vers.~0.36 (2015 Feb~08): added the following three lines\ldots
%    \begin{macrocode}
\let\if@custom@lh@\@undefined
\let\@custom@lh@true\@undefined
\let\@custom@lh@false\@undefined
%    \end{macrocode}
%    \ldots~and removed the following one:
%\begin{verbatim}
%\let\@back@folding@tag\@undefined
%\end{verbatim}
%    \begin{macrocode}
\let\@cdpaddon@printer\@undefined
\let\@temp@cdpaddon@b\@undefined
%    \end{macrocode}
%
%    \subsubsection{Smiling faces}
%
%    \begin{macro}{\facesmile}
%    \begin{macro}{\facefrown}
%    These commands produce happy or sad ``faces''.  They are made
%    ``transparent'' to the "\spacefactor", just like parentheses
%    (the "\spacefactor" is saved in "\count@").
%    \begin{macrocode}
\DeclareRobustCommand*\facesmile{\@face\smile}
\DeclareRobustCommand*\facefrown{\@face\frown}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\@face}
%    The low-level command that draws the face ("\bigcirc"), the eyes,
%    and the mouth: the latter is passed as an argument, so it can be
%    either a "\smile" or a "\frown".
%    \begin{macrocode}
\@ifdefinable\@face{\def\@face#1{%
  \leavevmode
  \count@\spacefactor
  \hb@xt@ 1em{\hfil$%
    \hb@xt@\z@ {\hss$\bigcirc$\hss}%
    \lower .2ex \hb@xt@\z@ {\hss$\scriptscriptstyle #1$\hss}%
    \raise .3ex \hb@xt@\z@ {\hss${\cdot}\mkern 2mu{\cdot}$\hss}%
  $\hfil}%
  \spacefactor\count@
}}
%    \end{macrocode}
%    \end{macro}
%
%    End of the module for the \packlass{\cdpaddon} package.
%    \begin{macrocode}
%</addon>
%    \end{macrocode}
%    \noindent\null\par
%
% \section{The code for the \packlass{\cdpbabel} package}
%
%    This part of the file goes into \filedir{\cdpbabel.sty}.
%    \begin{macrocode}
%<*babel>
%    \end{macrocode}
%
%    \subsection{Identification}
%
%    As usual, the reason for requesting this specific version of \LaTeXe\ is
%    shrouded in mystery\ldots
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1998/09/02] % LaTeX2e is required!
\ProvidesPackage{cdpbabel}
                [2015/02/08 v0.36 (development)]
\@ifdefinable\@cdpbabel{\def\@cdpbabel{cdpbabel}}
%    \end{macrocode}
%
%    \subsection{Initial code}
%
%    Usual check for availability of names.
%    \begin{macrocode}
\def\do#1{\@ifdefinable #1{\let #1\@empty}}
\do\@cdpbabel@perform@redefinitions
\do\@cdpbabel@letter@names
\do\@cdpbabel@artlet@names
%    \end{macrocode}
%
%    \subsection{Declaration of options}
%
%    Options specify which languages should be activated.  A language option is
%    both passed on to the \packlass{\babel} package and used to select and
%    load a ``C.D.P. language definition file''.
%    \begin{macrocode}
\DeclareOption*{%
  \IfFileExists{cdpnames\CurrentOption.ldf}{%
    \input{cdpnames\CurrentOption.ldf}%
%    \end{macrocode}
%    If \( "\CurrentOption" = \mbox{\opz{italian}} \), say,
%    then the following amounts to
%\begin{verbatim}
%\def\do#1{\g@addto@macro\@cdpbabel@perform@redefinitions{%
%    \addto\captionsitalian{#1}%
%}}
%\end{verbatim}
%    which is used just below with parameter~\#1 set equal to
%    \emph{the expansion of} either "\@cdpbabel@letter@names" or
%    "\@cdpbabel@artlet@names".
%    \begin{macrocode}
    \edef\do##1{%
      \noexpand\g@addto@macro
        \noexpand\@cdpbabel@perform@redefinitions
        {%
          \noexpand\addto \csname captions\CurrentOption \endcsname
            {##1}%
        }%
    }%
    \@ifclassloaded{letteracdp}{%
      \expandafter\do \expandafter{\@cdpbabel@letter@names}%
    }{}%
    \@ifclassloaded{articoletteracdp}{%
      \expandafter\do \expandafter{\@cdpbabel@artlet@names}%
    }{}%
    \PackageInfo{\@cdpbabel}{%
      Redefined the names of "C.D.P. Bundle" captions\MessageBreak
      for the language `\CurrentOption'%
    }%
  }{%
    \PackageError{\@cdpbabel}{%
      Name def. file `cdpnames\CurrentOption.ldf' not found%
    }{%
      Files of the form `cdpnames<language>.ldf' are meant
      to define the names\MessageBreak
      in the language <language> of some captions used by
      the "C.D.P. Bundle".\MessageBreak
      You requested\MessageBreak
      \space\space<language> = `\CurrentOption',\MessageBreak
      but the corresponding file is missing; therefore,
      probably some of these\MessageBreak
      captions will not be printed as intended.\MessageBreak
      This error affects only the \@cdpbabel\space package,
      but not the babel package.\MessageBreak
      You may continue:
      type \space <return> \space to proceed.%
    }%
  }%
  \PassOptionsToPackage{\CurrentOption}{babel}%
}
%    \end{macrocode}
%
%    \subsection{Option processing}
%
%    \mbox{$*$-form} of "\ProcessOptions" required here.
%    \begin{macrocode}
\ProcessOptions*
%    \end{macrocode}
%    Now, the following are no longer needed.
%    \begin{macrocode}
\let \do = \@undefined
\let \@cdpbabel@letter@names = \@undefined
\let \@cdpbabel@artlet@names = \@undefined
%    \end{macrocode}
%
%    \subsection{Package loading}
%
%    Note that the \packlass{\cdpbabel} package is loaded \emph{instead} of
%    \packlass{\babel}.
%    \begin{macrocode}
\RequirePackage{babel}
%    \end{macrocode}
%
%    \subsection{Main code}
%
%    At this point, "\@cdpbabel@perform@redefinitions" contains exactly the 
%    set of "\addto\captions"\meta{language}"{"\ldots"}" commands that need
%    to be executed for the languages that have been specified in the options.
%    So, execute them.
%    \begin{macrocode}
\@cdpbabel@perform@redefinitions
%    \end{macrocode}
%    After that, "\@cdpbabel@perform@redefinitions" is no longer needed.
%    \begin{macrocode}
\let \@cdpbabel@perform@redefinitions = \@undefined
%    \end{macrocode}
%
%    End of the module for the \packlass{\cdpbabel} package.
%    \begin{macrocode}
%</babel>
%    \end{macrocode}
%    \noindent\null\par
%
% \section{Definition and configuration files}
%
%    This section contains the ancillary files (definition and
%    configuration files) used by the \packlass{\cdpaddon} and
%    the \packlass{\cdpbabel} packages.
%
%    \subsection{The \filedir{\example} file}
%
%    This part of the file goes into the prototype definition file
%    \filedir{\example}.  All comments are left in the code because this
%    file is intended as an example of how to write color definition files
%    for the \packlass{\cdpaddon} package.
%    \begin{macrocode}
%<*example>
%%%
%%% The "\ProvidesFile" command allows LaTeX to check the name and
%%% the release date of the file; if either differs from what the
%%% user requested, a warning is issued when the file is loaded.
%%% This helps to pinpoint old files as well as files which have been
%%% installed incorrectly.  It is not mandatory to include this
%%% command in a file, and you can omit it from your definition files
%%% if you want (but including it is more elegant); however, if you do
%%% leave this command in your definition files, you should modify
%%% both its mandatory and its optional argument so that they reflect
%%% the name and the release date, respectively, of your file.
%%% Note that the extension ".def" must be included in the file name,
%%% and that the date is in the format YYYY/MM/DD.
\ProvidesFile{cdpshues-example.def}[2015/02/08 Printer-dependent file]
%%%
%%% Define here the colors to use to draw the C.D.P. seal;
%%% "slight@col" is the color used to paint the inner of the D and
%%% of the P, "strong@col" is the color used to draw the lines.
%%% The colors are defined by means of the usual "\definecolor"
%%% command, which is part of the standard color package.  The colors
%%% defined here, of course, are just a silly example.
\definecolor{slight@col}{named}{SpringGreen}
\definecolor{strong@col}{named}{OliveGreen}
%</example>
%    \end{macrocode}
%
%    \subsection{The \filedir{\epson} file}
%
%    This part of the file goes into the definition file
%    \filedir{\epson}.
%    \begin{macrocode}
%<*epson>
\ProvidesFile{epson-stylus-740.def}[2015/02/08 Printer-dependent file]
\definecolor{slight@col}{rgb}{.8,1,.8}
\definecolor{strong@col}{rgb}{0,.266667,0}
%</epson>
%    \end{macrocode}
%
%    \subsection{The \filedir{\hplj} file}
%
%    This part of the file goes into the definition file \filedir{\hplj}.
%    \begin{macrocode}
%<*hplj>
\ProvidesFile{hp-laserjet-4500.def}[2015/02/08 Printer-dependent file]
\definecolor{slight@col}{cmyk}{.1,0,.1,0}
\definecolor{strong@col}{cmyk}{.5,0,.5,.5}
%</hplj>
%    \end{macrocode}
%
%    \subsection{The \filedir{\cdpshues} file}
%
%    This part of the file goes into the configuration file
%    \filedir{\cdpshues}.  Again, we leave all comments in the generated
%    file because they are meant to help the final user to modify the file.
%    \begin{macrocode}
%<*config>
%%%
%%% The argument of the "\DeclareCDPSealHuesDefault" command contains
%%% the name (w/o extension) of the default color definition file:
\DeclareCDPSealHuesDefault{cdpshues}

====================
EXPLANATORY COMMENTS
====================

This file is special in that the cdpaddon package stops reading it as
soon as it encounters the first "\DeclareCDPSealHuesDefault" command:
all subsequent lines are ignored, and can hence contain explanatory
comments, just like these.  To save disk space (although, in this era
of terabytes, this is not a compelling issue!), you can, if you want,
delete all lines in this file except the one which contains the first
occurrence of a "\DeclareCDPSealHuesDefault" command (12 lines above);
but if you do so, please be sure to read them before deleting them!
(Anyway, I think it is a good idea to leave the comments in place.)

The "\DeclareCDPSealHuesDefault" command has one argument, in which
you should put the name of a default file from which the definitions
of the hues for the C.D.P. seal are read when no other file has been
indicated in the options passed to the cdpaddon package.  Note that
the extension ".def" is automatically added to the name; therefore,
you **must** leave it out in the name given as the argument of the
"\DeclareCDPSealHuesDefault" command.

The C.D.P. Bundle comes with some definition files already included;
their names are listed below, without the extension ".def" (each one
is packaged in a "\DeclareCDPSealHuesDefault" command):

\DeclareCDPSealHuesDefault{cdpshues-example}
\DeclareCDPSealHuesDefault{epson-stylus-740}
\DeclareCDPSealHuesDefault{hp-laserjet-4500}

To make one of these files the default one, copy (or move) the line
containing its name to the top of the file, so that its becomes the
first line (yes, even above the opening comments, those four dozens
lines starting with "%%": let us keep things easy!).

If you write a new definition file, you can make it the default by
writing a similar "\DeclareCDPSealHuesDefault" command and putting it
in the first line of this file (above the opening comments, why not).
Remember that only the first such command appearing in this file is
taken into consideration: all subsequent lines are ignored.

%</config>
%    \end{macrocode}
%
%    \subsection{The \filedir{\cdpnamesenglish} file}
%
%    This part of the file goes into the language definition file
%    \filedir{\cdpnamesenglish}.
%    \begin{macrocode}
%<*lang-en>
\ProvidesFile{cdpnamesenglish.ldf}[2015/02/08]
\def\@cdpbabel@letter@names{%
  \def\subjectname      {Subject:}%
  \def\registeredname   {Registered}%
  \def\registeredRRname {\registeredname~R.R.}%
  \def\andccname        {cc}%
  \def\ccname           {cc:}%
  \def\enclname         {Encl:}%
  \def\PSname           {P.S.:}%
  \def\headtoname       {To:}%
  \def\lettername       {Letter}%
}
\def\@cdpbabel@artlet@names{%
  \def\contentsname     {Contents}%
  \def\listfigurename   {List of figures}%
  \def\listtablename    {List of tables}%
%%  \def\refname          {References}%
%%  \def\indexname        {Index}%
%%  \def\figurename       {Figure}%
%%  \def\tablename        {Table}%
}
%</lang-en>
%    \end{macrocode}
%
%    \subsection{The \filedir{\cdpnamesitalian} file}
%
%    This part of the file goes into the language definition file
%    \filedir{\cdpnamesitalian}.
%    \begin{macrocode}
%<*lang-it>
\ProvidesFile{cdpnamesitalian.ldf}[2015/02/08]
\def\@cdpbabel@letter@names{%
  \def\subjectname      {Oggetto:}%
  \def\registeredname   {Raccomandata}%
  \def\registeredRRname {\registeredname~A.R.}%
  \def\andccname        {e~p.~c.}%
  \def\ccname           {P.~c.:}%
  \def\enclname         {Allegati:}%
  \def\PSname           {P.S.:}%
  \def\headtoname       {A:}%
  \def\lettername       {Lettera}%
}
\def\@cdpbabel@artlet@names{%
  \def\contentsname     {Sommario}%
  \def\listfigurename   {Indice delle figure}%
  \def\listtablename    {Indice delle tabelle}%
  \def\refname          {Testi citati}%
%%  \def\indexname        {Indice analitico}%
%%  \def\figurename       {Figura}%
%%  \def\tablename        {Tabella}%
}
%</lang-it>
%    \end{macrocode}
%
% \section{End of input}
%
%    The usual "\endinput" which prevents the \DS\ program from putting
%    garbage into the generated files.
%    \begin{macrocode}
\endinput
%    \end{macrocode}
%
% \Finale
%
