summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-10-12 00:07:54 +0000
committerKarl Berry <karl@freefriends.org>2010-10-12 00:07:54 +0000
commited4cee06354e9445d584672440a045044c5a46b9 (patch)
tree3a7fd0e40d479de2b1b9db8c7e758b0c5ece6d49 /Master
parentbaa7f8e9f03bccf6f383eab72d2945fb6a2e110d (diff)
chletter update (11oct10)
git-svn-id: svn://tug.org/texlive/trunk@20060 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/chletter/README31
-rw-r--r--Master/texmf-dist/doc/latex/chletter/chletter.pdfbin0 -> 134462 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chletter/chletterdoc.pdfbin123075 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chletter/chlettmp.tex23
-rw-r--r--Master/texmf-dist/doc/latex/chletter/sampleletter.ltx27
-rw-r--r--Master/texmf-dist/source/latex/chletter/chletter.dtx1975
-rw-r--r--Master/texmf-dist/source/latex/chletter/chletter.ins57
-rw-r--r--Master/texmf-dist/tex/latex/chletter/chletter.cls472
8 files changed, 1853 insertions, 732 deletions
diff --git a/Master/texmf-dist/doc/latex/chletter/README b/Master/texmf-dist/doc/latex/chletter/README
index f54286a40ae..42c873f8d24 100644
--- a/Master/texmf-dist/doc/latex/chletter/README
+++ b/Master/texmf-dist/doc/latex/chletter/README
@@ -1,14 +1,27 @@
-{chletter}[2008/07/29 v1.0 Swiss Letter document class]
+{chletter}[2010/10/10 v2.0 Swiss letter document class]
-A class for typesetting letters or small documents according to the swiss rules. No assumption is made about the language used.
+The chletter class is suited for typesetting letters with letterhead
+corresponding to the Swiss norm SN 010130.
-This class is based on the standard LaTeX classes and is mostly "source compatible" with the LaTeX letter class. Unlike the letter class, this one places the addresses fields according to the specifications of the swiss C6/5 or C5 envelopes, windowed or not. The labels generation mecanism is somewhat different.
+The default letterhead fits into ISO 269 C5 & C6/5 windowed envelopes,
+both right windowed and left windowed.
+
+This class is mostly compatible with the standard LaTeX2e classes. It
+is not limited to letters and may be used as a generic document class.
+
+Its basic usage is very simple and user friendly. It is appropriate to
+quickly typeset casual documents and letters.
+
+However the class is highly configurable and may be used within complex
+setups to provide automated letters composition.
+
+The chletter code is very compact and highly optimized, dropping the
+obsolete legacy (namely LaTeX 2.09) for the sake of efficiency.
Provided files:
-chletter.dtx code and documentation
-chletter.ins install script
-chletterdoc.pdf user documentation in french
-sampleletter.ltx a sample letter
+chletter.dtx code and documentation
+chletter.ins install script
+chletter.pdf documentation
-Copyright 2008 Boris Oriet
-The licence is LPPL.
+Copyright 2010 Boris Oriet
+The licence is LPPL 1.3c. \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/chletter/chletter.pdf b/Master/texmf-dist/doc/latex/chletter/chletter.pdf
new file mode 100644
index 00000000000..dac6a0ae610
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/chletter/chletter.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chletter/chletterdoc.pdf b/Master/texmf-dist/doc/latex/chletter/chletterdoc.pdf
deleted file mode 100644
index 726191937dd..00000000000
--- a/Master/texmf-dist/doc/latex/chletter/chletterdoc.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chletter/chlettmp.tex b/Master/texmf-dist/doc/latex/chletter/chlettmp.tex
new file mode 100644
index 00000000000..fc68ae35520
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/chletter/chlettmp.tex
@@ -0,0 +1,23 @@
+\documentclass{chletter}
+
+%%\usepackage[english,black]{chextras}
+
+\author{My name}
+\address{My address\\My City}
+\telephone{My phone\\My email}
+\date{My location, \today}
+
+\begin{document}
+\begin{letter}{Name\\Address\\City}
+
+\opening{Dear \toname,}
+
+Body text.
+
+\closing{Yours truly,}
+
+\encl{Enclosures}
+\cc{Other recipients}
+
+\end{letter}
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/chletter/sampleletter.ltx b/Master/texmf-dist/doc/latex/chletter/sampleletter.ltx
deleted file mode 100644
index 82ba33e2e78..00000000000
--- a/Master/texmf-dist/doc/latex/chletter/sampleletter.ltx
+++ /dev/null
@@ -1,27 +0,0 @@
-%
-% Copyright 2008 Boris Oriet
-% The licence is LPPL.
-%
-\documentclass{chletter} % defaults: 11pt,a4paper,oneside
-\title{sampleletter} %
-\author{author} % if no signature specified
-\name{fromname} % to appear in the footer
-\signature{fromsig} % to appear after valediction
-\location{office} % to appear in the sender address zone
-\address{fromaddress} % to appear at the upper left
-\return{returnaddress} % to appear in the window
-\telephone{telephone} % to appear under the address
-\date{place, \today} % to alter the date string
-\makelabels % envelope page with return address
-\begin{document} %
- \begin{letter}{toname % gets the recipient name and address
- \\toaddress} % and creates the addresses zones
- \conc[l]{subject} % the letter's subject, left aligned
- \opening[i]{salutation} % the salutation, text will be indented
- text % the letter's main text
- \closing{valediction} % adds the signature
- \ps{\emph{ps}}post % creates a post scriptum
- \cc{copies} % creates a copies field
- \encl{enclosures} % creates an enclosures field
- \end{letter} %
-\end{document} % \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/chletter/chletter.dtx b/Master/texmf-dist/source/latex/chletter/chletter.dtx
index aabf5cd9b8d..7a50fa21ed8 100644
--- a/Master/texmf-dist/source/latex/chletter/chletter.dtx
+++ b/Master/texmf-dist/source/latex/chletter/chletter.dtx
@@ -1,148 +1,711 @@
% \iffalse meta-comment
%
-% Copyright 2008 Boris Oriet
-% The licence is LPPL.
+% Copyright 2008, 2009, 2010 by Boris Oriet <http://boris.oriet.net>
+% -------------------------------------------------------
%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% 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.3c or later is part of all distributions of LaTeX
+% version 2008/05/04 or later.
+%
+% This file has the LPPL maintenance status "author-maintained".
+%
% \fi
+%
% \iffalse
-%<chletter>\NeedsTeXFormat{LaTeX2e}[1996/06/01]
-%<chletter>\ProvidesClass{chletter}[2008/07/29 v1.0 Swiss Letter document class]
%<*driver>
\ProvidesFile{chletter.dtx}
\documentclass[a4paper]{ltxdoc}
-\usepackage[colorlinks]{hyperref}
-\CodelineNumbered
+\usepackage{hypdoc}
+\pdfstringdefDisableCommands{\def\url{}}
+\makeatletter
+\let\PrintMacroName\HDorg@PrintMacroName
+\let\PrintDescribeMacro\HDorg@PrintDescribeMacro
+\makeatother
+\setlength\parindent{0pt}
+\setlength\unitlength{.59pt}
\CodelineIndex
-\EnableCrossrefs
-\RecordChanges
-\frenchspacing
\begin{document}
-\DocInput{chletter.dtx}
+ \DocInput{chletter.dtx}
\end{document}
%</driver>
% \fi
+%
+% \CheckSum{1057}
+%
+% \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 \~}
+%
% \changes{v1.0}{2008/07/29}{Initial version}
-% \GetFileInfo{chletter.dtx}
-% \DoNotIndex{\newcommand,\newenvironment}
-% \author{Boris \textsc{Oriet}}
-% \title{Swiss Letter Document Class for \LaTeXe{}}
+% \changes{v1.1}{2009/11/05}{Internal interim version, minor changes}
+% \changes{v2.0}{2010/10/10}{Code overhaul, new features, code frozen}
+%
+% \title{The \textsf{chletter} Document Class
+% \thanks{This document corresponds to \textsf{chletter} v2.0, dated 2010/10/10.}}
+% \author{Boris \textsc{Oriet}\\\url{http://boris.oriet.net}}
% \maketitle
+% \bigskip\bigskip
+% \tableofcontents
+% \pagebreak
%
% \section{Introduction}
-% The \textsf{chletter} class is intended for typesetting letters with addresses fields
-% corresponding to C5 \& C6/5 envelopes (according to the swiss norm SN~010130)\footnote
-% {This version of the class only generates
-% envelopes with righthanded recipient addresses, perhaps a future version
-% will add an option to support lefthanded windows.}.
%
-% This class is mostly compatible with the standard \LaTeXe{} classes,
-% especially the \textsf{letter} class. Unlike the \textsf{lettre} class\footnote
-% {From the Observatoire de Gen\`eve, see at \texttt{http://www.ctan.org}},
-% this one doesn't provide much additional commands and declarations.
+% The \textsf{chletter} class is suited for typesetting letters with letterhead
+% corresponding to the swiss norm SN~010130.\bigskip
+%
+% The default letterhead is set according to Swiss rules. It fits into both right
+% and left windowed ISO 269 C5 and C6/5 envelopes.\bigskip
+%
+% This class is mostly compatible with the standard \LaTeXe{} classes.
+% It is not limited to letters and may be used as a generic document class.\bigskip
+%
+% Its basic usage is very simple and user friendly.
+% It is appropriate to quickly typeset casual documents and letters.\bigskip
+%
+% It is however highly configurable and may be used within complex setups
+% to provide automated letters composition.
%
-% \section{Examples sources}
-% The following examples describe the normal usage of the \textsf{chletter} class.
+% \section{Usage}
+%
+% The following examples describe the regular usage of the \textsf{chletter} class.
+% Basically, this class behaves in a similar way to a standard class and accepts the
+% regular \textsf{letter} commands, including the dedicated |letter| environment.
+% Much like with standard classes, the only mandatory commands are |\documentclass|
+% and the |document| environment (|\begin{document}| and |\end{document}|).
+%
+% \subsection{A basic letter}
+%
+% This example shows the plain usage of the \textsf{chletter} class.\medskip
+%
+% |\author|, |\address| and |\date| are markup commands which store
+% global values used to build the letterhead. The |letter| environment actually creates the
+% letter with its letterhead and all the needed layout. |\opening|, |\closing|, |\encl| and
+% |\cc| are mainly formatting commands. To have multiple lines in a field, one may use
+% |\newline| (shortcut |\\| as in this example) or |\par| (shortcut is an empty line).\medskip
+%
+% Please note that this example would also compile straightforward with the
+% standard \textsf{letter} class (giving a somewhat different output).
%
-% \subsection{Standard Letter: \texttt{standardletter.ltx}}
% \begin{verbatim}
% \documentclass{chletter}
-% \author{fromname}
-% \address{fromaddress}
+%
+% \author{My name}
+% \address{My address\\My city}
+% \date{Location, \today}
+%
% \begin{document}
-% \begin{letter}{toname\\toaddress}
-% \opening{salutation}
-% text
-% \closing{valediction}
-% \end{letter}
+% \begin{letter}{Name\\Address\\City}
+% \opening{Salutation,}
+% Hello World!
+% \closing{Valediction.}
+% \encl{enclosures}
+% \cc{other recipients}
+% \end{letter}
% \end{document}
% \end{verbatim}
%
-% \subsection{Minimal Letter: \texttt{minimalletter.ltx}}
+% \begin{figure}
+% \begin{picture}(596,842)(0,0)
+% \fontsize{7}{7}\selectfont
+% \thicklines
+% \put(0,0){\framebox(596,842){}}
+% \thinlines
+% \put(72,758){My name}
+% \put(72,746){My address}
+% \put(72,734){My city}
+% \put(334,758){Location, October 10, 2010}
+% \put(334,686){Name}
+% \put(334,674){Address}
+% \put(334,662){City}
+% \put(108,542){Salutation,}
+% \put(108,518){Hello World!}
+% \put(108,494){Valediction.}
+% \put(334,446){My name}
+% \end{picture}
+% \caption{Standard letter output by \textsf{chletter}.}
+% \end{figure}
+%
+% \subsection{A customized letter}
+%
+% This example provides a good overview of the different class options and macros.\medskip
+%
+% The |leftwin| option is to be used with a left windowed envelope, inverting the sender's
+% and recipient's addresses. The |leftsig| option places the signature against the left body
+% margin. The |foldmark| option will include a thin line to help folding of C6/5 letters.
+% The |footfill| option will throw the letter foot against the document footer, for refined
+% vertical balancing.\medskip
+%
+% |\makelabels| creates an addtional envelope page with only the recipient's address and
+% the sender's return address. |\addresswidth| adjusts the letterhead layout (here it is
+% computed to right align the date field, mimicking the standard \textsf{letter} class
+% behaviour). |\location|, |\name|, |\return| and |\telephone| are supplementary markup
+% commands. |\object| and |\ps| are extra layout commands. |\longindentation| (which is
+% also provided by the standard \textsf{letter} class) enables alignement of the text with
+% the addresses.\medskip
+%
+% Please note that lines with a comment (|%|) should be removed to allow compilation with the
+% standard \textsf{letter} class.
+%
% \begin{verbatim}
-% \documentclass{chletter}
+% \documentclass[leftwin,leftsig,foldmark,footfill]{chletter}
+%
+% \settowidth\addresswidth{\today} %
+%
+% \makelabels
+%
+% \location{Our Company}
+% \name{My name}
+% \return{\fromlocation, My address, My city} %
+% \address{My address\\My city}
+% \telephone{My phone\\My email}
+% \signature{My signature\\\footnotesize My position}
+% \title{\textbf{About the \textsf{chletter} document class}}
+%
% \begin{document}
+% \begin{letter}{Name\\Address\\City}
+% \object %
+% \opening{Dear \toname,}
+% Body text.
+% \closing{Yours truly,}
+% \encl{Enclosures}
+% \cc{Other recipients}
+% \ps{P. S.}{Don't forget\par\hspace{\longindentation}long indentation!}
+% \end{letter}
% \end{document}
% \end{verbatim}
%
-% \subsection{Commented example: \texttt{sampleletter.ltx}}
+% \begin{figure}
+% \begin{picture}(596,842)(0,0)
+% \fontsize{7}{7}\selectfont
+% \thicklines
+% \put(0,0){\framebox(596,842){}}
+% \thinlines
+% \put(424,758){Our Company}
+% \put(424,746){My name}
+% \put(424,734){My address}
+% \put(424,722){My city}
+% \put(424,710){\tiny My phone}
+% \put(424,698){\tiny My email}
+% \put(72,686){\textsuperscript{\underline{Our Company, My address, My city}}}
+% \put(72,674){Name}
+% \put(72,662){Address}
+% \put(72,650){City}
+% \put(424,614){October 10, 2010}
+% \put(0,554){\line(1,0){18}}
+% \put(108,542){\textbf{About the \textsf{chletter} document class}}
+% \put(108,512){Dear Name,}
+% \put(108,482){Body text.}
+% \put(108,452){Yours truly,}
+% \put(108,400){My signature}
+% \put(108,388){\tiny My position}
+% \put(72,168){\makebox(36,0)[r]{\strut encl~}}
+% \put(108,168){\makebox(0,0)[l]{\strut Enclosures}}
+% \put(72,144){\makebox(36,0)[r]{\strut cc~}}
+% \put(108,144){\makebox(0,0)[l]{\strut Other recipients}}
+% \put(72,120){\makebox(36,0)[r]{\strut P. S.~}}
+% \put(108,120){\makebox(0,0)[l]{\strut Don't forget}}
+% \put(424,108){\makebox(0,0)[l]{\strut |long indentation|!}}
+% \end{picture}
+% \caption{Customized letter output by \textsf{chletter}.}
+% \end{figure}
+%
+% \begin{figure}
+% \begin{picture}(596,842)(0,0)
+% \fontsize{7}{7}\selectfont
+% \thicklines
+% \put(0,0){\framebox(596,842){}}
+% \thinlines
+% \put(72,686){\textsuperscript{\underline{Our Company, My address, My city}}}
+% \put(72,674){Name}
+% \put(72,662){Address}
+% \put(72,650){City}
+% \end{picture}
+% \caption{Cover page output by \textsf{chletter}.}
+% \end{figure}\pagebreak
+%
+% \section{Compatibility}
+%
+% The \textsf{chletter} class is based upon the standard classes of the \LaTeXe{} distribution.
+% Many documents founded on these classes will also compile with \textsf{chletter}.
+%
+% \subsection{With the \LaTeXe{} \textsf{letter} class}
+%
+% The \textsf{chletter} class is `source compatible' (ascending) with the standard
+% \textsf{letter} class. For the most part a file which compiles with \textsf{letter} will
+% recompile straightforward with \textsf{chletter}. There are however some functional
+% differencies, which are described in the following sections.
+%
+% \subsection{With other \LaTeXe{} classes}
+%
+% The \textsf{chletter} class is largely `source compatible' (ascending) with other standard
+% \LaTeXe{} classes. It doesn't implement the sectioning mecanism, but accepts the related
+% commands (|\section| for example). Some commands behave differently (|\maketitle| for
+% example). Obvsiously, any command specific to the \textsf{chletter} class will prevent
+% compilation with other classes.
+%
+% \subsection{With older versions of \textsf{chletter}}
+%
+% The \textsf{chletter} class has been completely overhauled between versions |1.0| and |2.0|.
+% The new code is far more compact and efficient, so is its usage (the commands no more have
+% a plethora of optional arguments). The versions of the class are mostly `source compatible,'
+% given the deprecated commands are not used: |\conc| (replaced by |\object|), |\letterindent|,
+% |\letterskip|, |\fromheight| (replaced by |\titletopheight|, |\toheight| (replaced by
+% |\titlemidheight|) and |\stockheight| (replaced by |\titlebotheight|). To add a
+% `compilability layer', the following code can be inserted in the preamble:
% \begin{verbatim}
-% \documentclass{chletter} % defaults: 11pt,a4paper,oneside
-% \title{sampleletter} %
-% \author{author} % if no signature specified
-% \name{fromname} % to appear in the footer
-% \signature{fromsig} % to appear after valediction
-% \location{office} % to appear in the sender address zone
-% \address{fromaddress} % to appear at the upper left
-% \return{returnaddress} % to appear in the window
-% \telephone{telephone} % to appear under the address
-% \date{place, \today} % to alter the date string
-% \makelabels % will generate an envelope page
-% \begin{document} %
-% \begin{letter}{toname % gets the recipient name and address
-% \\toaddress} % and creates the addresses zones
-% \conc[l]{subject} % the letter's subject, left aligned
-% \opening[i]{salutation} % the salutation, text will be indented
-% text % the letter's main text
-% \closing{valediction} % adds the signature
-% \ps{\emph{ps}}post % creates a post scriptum
-% \cc{copies} % creates a copies field
-% \encl{enclosures} % creates an enclosures field
-% \end{letter} %
-% \end{document} %
+% \newcommand\conc[2]{\object{#2}}
+% \let\letterindent\parindent
+% \let\letterskip\parskip
+% \let\fromheight\titletopheight
+% \let\toheight\titlemidheight
+% \let\stockheight\titlebotheight
% \end{verbatim}
%
-% \section{Compatibility}
-% The \textsf{chletter} class is based upon the standard classes of the \LaTeXe{}
-% distribution. It is mostly compatible with any type of document founded on these classes.
-%
-%\subsection{Compatibility with the \LaTeXe{} \textsf{letter} class}
-%
-%\subsubsection{Ascending Compatiblity}
-% \textsf{chletter} is ``source compatible'' with the standard \textsf{letter} class.
-% Usually a file which compiles with \textsf{letter} will recompile straight forward
-% with this one. There are however some functional differencies:
-%\begin{itemize}
-%\item the addresses zones, at the top of the first page, is inserted at the opening
-% of the |letter| envrionment rather than at the |\opening| command;
-% \item there are important differences in the page layout; the addresses zones are
-% redefined and the vertical centering mecanisme is absent;
-% \item some macros, for example |\makelabels|, behave somewhat differently; the labels
-% generation mechanism via the \textsf{.aux} file is inactive.
-%\end{itemize}
-%
-%\subsubsection{Descending Compatibility}
-% A document using the new options and macros of the \textsf{chletter} class won't
-% compile directly with the \textsf{letter} class\footnote{These differences are marked
-% with an asterisk in the following sections}.
-%
-%\subsection{Compatibility With Other \LaTeXe{} Standard Classes}
-% The \textsf{chletter} class is largely ``source compatible'' with the standard \LaTeXe{}
-% classes. It doesn't implement the sectioning mecanism, but accepts the related commands
-% (|\section| for example). The |\maketitle| command is defined but behaves in a special way.
-%
-%\subsection{Compatibility with \LaTeX\,2.09}
-% No compatibility mecanism with \LaTeX\,2.09 has been implemented. The sources should
-% be adapted to the standards defined by \LaTeXe, particularly those concerning the font
-% selection scheme\footnote{\texttt{\textbackslash textbf} or \texttt{\textbackslash mathbf} in
-% place of \texttt{\textbackslash bf}.}.
-%\subsection{Compatibility With Other Packages}
-%
-% There is no reported incompatibility with usual packages.
-% \StopEventually{\PrintChanges\PrintIndex}
+% \subsection{With upcoming versions of \textsf{chletter}}
+%
+% The \textsf{chletter} class is now considered mature and won't evolve further
+% (the code is frozen). The class has been thoroughly tested, and there are no known deficiencies.
+%
+% \subsection{With other packages}
+%
+% The \textsf{chletter} class is generic in the sense that it doesn't rely on anything but
+% the \LaTeXe\ kernel. There is no known command clash with any package.\medskip
+%
+% Please note that a \textsf{chextras} companion package is available (but not mandatory).
+% It simplifies the preparation of documents and letters by loading and setting up font,
+% linguistic and other common packages. It also implements a `glue code' for full source
+% compatibility with older \textsf{chletter v1.0} documents.
+%
+% \section{Configuration}
+%
+% The default values used by the \textsf{chletter} class are balanced for casual writing of
+% simple articles (the class can eventually replace the standard \textsf{article} class) and
+% letters (of course). Nevertheless this class is highly configurable and customizable.
+%
+% \subsection{Class options}
+%
+% The \textsf{chletter} class accepts the options provided by the \LaTeXe\ default classes.
+% These options are: |a4paper|, |a5paper|, |b5paper|, |letterpaper|, |legalpaper|,
+% |executivepaper|, |landscape|, |10pt|, |11pt|, |12pt|, |oneside|, |twoside|, |draft|, |final|,
+% |leqno|, |fleqn|, |onecolumn|, |twocolumn|. The defaults are: |a4paper|, |10pt|, |oneside|,
+% |final|, |onecolumn|. Additionally, the \textsf{chletter} class provides four extra options
+% (described just below) to adjust the general layout of the letters.\bigskip
+%
+% \DescribeMacro{leftwin}
+% \DescribeMacro{leftsig}
+% \DescribeMacro{foldmark}
+% \DescribeMacro{footfill}
+% |leftwin| places the recipient's address to the left of the letterhead rather than to the
+% right. |leftsig| aligns the signature with the left body margin rather than with the right
+% address. |foldmark| puts a thin line to help folding of C6/5 letters. |footfill| adds an
+% infinite glue between the signature and the letter foot.
+%
+% \subsection{Page layout}
+%
+% The default page layout provided by the \textsf{chletter} class, while generic enough,
+% leaves more place for the text than the standard classes do.\bigskip
+%
+% \DescribeMacro{\textwidth}
+% \DescribeMacro{\textheight}
+% \DescribeMacro{\oddsidemargin}
+% \DescribeMacro{\evensidemargin}
+% In a single sided document, the space between the top left corner of the page and the main
+% text is (|1in + 36pt|, |1in + 36pt|); |36pt| are left for the header and the footer, along
+% with |72pt| for the right and bottom margins. For A4 paper, the defaults are the following
+% (values in inches and centimeters are rounded):
+% \begin{verbatim}
+% \textwidth 416pt [5.75in or 14.5cm]
+% \textheight 630pt [8.75in or 22cm]
+% \oddsidemargin 36pt [.5in or 1.25cm]
+% \evensidemargin 0pt
+% \end{verbatim}
+%
+% \DescribeMacro{\titlehead}
+% \DescribeMacro{\titletopheight}
+% \DescribeMacro{\titlemidheight}
+% \DescribeMacro{\titlebotheight}
+% \DescribeMacro{\titlemargin}
+% \DescribeMacro{\titlewidth}
+% \DescribeMacro{\addressmargin}
+% \DescribeMacro{\addresswidth}
+% These values are used for the letterhead layout. They are related to the \TeX\ origin, which
+% is (|1in|, |1in|) from the top left corner of the page. Please remember that |1in = 72.27pt|.
+% |\titlehead| controls the vertical placement of the first baseline of the letterhead.
+% |\titlemargin| and |\titlewidth| control the horizontal position and width of the letterhead.
+% |\addressmargin| is where the title is split in two. |\addresswith| is the width of the right
+% address fields. The title is built by opening a |letter| environment or by calling directly
+% |\maketitle|. For A4 paper, the defaults are the following (values in inches and centimeters
+% are rounded):
+% \begin{verbatim}
+% \titlehead 12pt [.16in or .4cm]
+% \titletopheight 72pt [1in or 2.5cm]
+% \titlemidheight 72pt [1in or 2.5cm]
+% \titlebotheight 72pt [1in or 2.5cm]
+% \titlemargin 0pt
+% \titlewidth 452pt [6.25in or 16 cm]
+% \addressmargin 262pt [3.625in or 9.25cm]
+% \addresswidth 190pt [2.625in or 6.75cm]
+% \end{verbatim}
+%
+% \begin{figure}
+% \begin{picture}(595,842)(0,0)
+% \fontsize{5}{5}\selectfont
+% \thicklines
+% \put(0,0){\framebox(596,842){}}
+% \thinlines
+% \put(74,758){|fromname|}
+% \put(74,746){|fromaddress|}
+% \put(336,758){|date|}
+% \put(336,686){|toname|}
+% \put(336,674){|toaddress|}
+% \multiput(72,770)(0,-72){4}{\line(1,0){452}}
+% \multiput(72,770)(262,0){2}{\line(0,-1){216}}
+% \put(524,770){\line(0,-1){662}}
+% \put(108,554){\line(0,-1){446}}
+% \put(108,108){\line(1,0){416}}
+% \put(110,542){|salutation|}
+% \put(110,518){|text|}
+% \put(110,494){|valediction|}
+% \put(336,446){|signature|}
+% \put(25,788){\vector(-1,0){25}}\put(47,788){\vector(1,0){25}}
+% \put(0,788){\makebox(72,0){|1in|}}
+% \put(170,788){\vector(-1,0){98}}\put(236,788){\vector(1,0){98}}
+% \put(72,788){\makebox(262,0){|addressmargin|}}
+% \put(398,788){\vector(-1,0){64}}\put(460,788){\vector(1,0){64}}
+% \put(334,788){\makebox(190,0){|addresswidth|}}
+% \put(272,806){\vector(-1,0){200}}\put(324,806){\vector(1,0){200}}
+% \put(72,806){\makebox(452,0){|titlewidth|}}
+% \put(560,800){\vector(0,-1){30}}\put(560,812){\vector(0,1){30}}
+% \put(524,800){\makebox(72,12){|1in|}}
+% \put(560,728){\vector(0,-1){30}}\put(560,740){\vector(0,1){30}}
+% \put(524,728){\makebox(72,12){|titletopheight|}}
+% \put(560,656){\vector(0,-1){30}}\put(560,668){\vector(0,1){30}}
+% \put(524,656){\makebox(72,12){|titlemidheight|}}
+% \put(560,584){\vector(0,-1){30}}\put(560,596){\vector(0,1){30}}
+% \put(524,584){\makebox(72,12){|titlebotheight|}}
+% \put(182,320){\vector(-1,0){74}}\put(260,320){\vector(1,0){74}}
+% \put(108,320){\makebox(226,0){|longindentation|}}
+% \put(396,320){\vector(-1,0){62}}\put(462,320){\vector(1,0){62}}
+% \put(334,320){\makebox(190,0){|indentedwidth|}}
+% \put(292,90){\vector(-1,0){184}}\put(340,90){\vector(1,0){184}}
+% \put(108,90){\makebox(416,0){|textwidth|}}
+% \end{picture}
+% \caption{The default \textsf{chletter} layout.}
+% \end{figure}
+%
+% \subsection{The \texttt{letter} environment}
+%
+% The |letter| environment performs some special actions in the scope of writing letters. At
+% its beginning, it generates the letterhead according to its arguments and some previously
+% defined values (see below). The |letter| environment takes in account some global options,
+% for example |twocolumn|... so yes, it is possible to write two column letters! At its
+% closing, the |letter| environment generates a cover page if needed (see below).\bigskip
+%
+% \DescribeEnv{letter}
+% The |letter| environment takes one `mandatory' argument : the recipient's address. The
+% address should be formatted with newline markers (|\\|) as in the standard |letter| class.
+% The argument is `tokenized' into |\toname| and |\toaddress|, which can be used in the
+% letter body. The `token separator' is the first encountered |\\|\,. Please note that an
+% invocation of the |letter| environment without argument will retrieve previously defined
+% |\toname| and |\toaddress| values (empty by default).\medskip
+%
+% There is an optional argument to specify if the letter is to be indented |[i]| or not |[n]|
+% where |[n]| is the default. Please note that this option will alter the formatting of general
+% \LaTeX\ lists and \textsf{chletter} |\ps|, |\cc| and |\encl| commands (see below).\bigskip
+%
+% It is possible to open multiple |letter| environments within a single document. Global
+% values may be shared between each letter (see next page). Please remember that environments
+% involve some locality; for example a length value altered within a |letter| environment
+% will recover its initial value outside of the environment.\medskip
+%
+% An ordinary usage would be:
+% \begin{verbatim}
+% \begin{letter}[i]{Toname\\ToAddressFirstLine\\...\\ToAddressLastLine}
+% ...
+% \end{letter}
+% \end{verbatim}
+%
+% \subsubsection{Cover page}
+%
+% \DescribeMacro{\makelabels}
+% Unlike the standard \textsf{letter} class, this macro doesn't involve a complex mecanism
+% using the |.aux| file to build a labels page (the main reason why the standard class is
+% fragile). Anyway, the \textsf{chletter} class provides a way to generate dedicated cover
+% pages. The |\makelabels| command will set a flag which is checked at the closing of the
+% |letter| environment. The default behaviour is to put the recipient's address and, as
+% requested by the Swiss post, the return address above it, separated by a line. |\makelabels|
+% doesn't take any argument.
+%
+% \subsubsection{Page breaking}
+%
+% These commands are intended to (try to) control the place where a page break occur.
+% They may be used anywhere in a document.\medskip
+%
+% \DescribeMacro{\stopbreaks}
+% |\stopbreaks| will try to prevent all page breaks after its invocation.\bigskip
+%
+% \DescribeMacro{\startbreaks}
+% |\startbreaks| cancels the behaviour of |\stopbreaks|.
+%
+% \subsubsection{Letter counter}
+%
+% \DescribeMacro{\theletter}
+% At each new |letter| environment opened, this counter is incremented. Please note that
+% |thepage| and |thefootnote| counters are reset at the same time.
+%
+% \subsubsection{Letter markup}
+%
+% The commands described here are usually put in the preamble, but they may be called from
+% anywhere in the document. They store their argument in associated values which will be
+% retrieved by the |letter| environment, for example to build the letterhead. They are common
+% to a bunch of letter classes.\medskip
+%
+% \DescribeMacro{\name}
+% \DescribeMacro{\address}
+% \DescribeMacro{\location}
+% \DescribeMacro{\telephone}
+% \DescribeMacro{\return}
+% The values stored by these commands are respectively: |\fromname|, |\fromaddress|,
+% |\fromlocation|, |\telephonenum| and |\returnaddress|. |\telephone| and |\return| will
+% format their output (respectively small text and underlined superscript text). Please note
+% that |\return| is not defined in the standard \textsf{letter} class. These values are used
+% to build the expeditor's address fields:
+% \begin{verbatim}
+% \name{My Name}
+% \address{My Street\\My City}
+% \return{My Return Address}
+% \end{verbatim}
+%
+% \DescribeMacro{\date}
+% The date field (stored by kernel |\@date| value) can be customized by, for example:
+% \begin{verbatim}
+% \date{Here, \today}
+% \end{verbatim}
+%
+% \DescribeMacro{\signature}
+% The value stored by this macro is |\fromsig|, which is used by the |\closing| command to
+% output the signature field (see below).\bigskip
+%
+% Please note that |\fromname| and |\fromsig| values default to |\@author| (initialized by
+% \LaTeX, modified by the standard |\author| command). The |\@date| field defaults to
+% |\today|, which will be localized by a linguistic package (\textsf{babel} or
+% \textsf{polyglossia}).\medskip
+%
+% To prevent any value from appearing, it has to be emptied by the corresponding command,
+% for example: |\date{}|.\medskip
+%
+% These macros can contain anything that fits in a |\parbox|, including some special stuff
+% (using dedicated packages): |\location{\includegraphics{mylogo.pdf}}|\medskip
+%
+% Any of the values stored by these commands can be retrieved anywhere in the letter (given
+% the corresponding value is accessible, |\@author| and |\@date| requiring a |\makeatletter|):
+% |I, \fromname, declare...|
+%
+% \subsubsection{Letter body}
+%
+% These commands are mostly used within a letter environment, but they may be called at
+% document level for special purpose. Their foremost intend is formatting, although they are
+% able to retrieve or store their value at will.\medskip
+%
+% \DescribeMacro{\object}
+% This command will simply output the text given in its argument, followed by a |\bigskip|.
+% The |\object| command stores its argument in |\@title| and actually outputs it. If the
+% argument is either empty or null, then the |\object| command will output the value of
+% |\@title| previously set by a |\title| command. Remember that the default |\@title| value
+% is an error (set by the \LaTeX\ kernel):
+% \begin{verbatim}
+% \title{Answer to your previous letter}
+% ...
+% \begin{document}
+% \begin{letter}{...}
+% \object
+% \end{verbatim}
+%
+% Please note that the following code is functionally equivalent (the |\@title| value set by
+% both methods is global (available outside of the current letter environment):
+% \begin{verbatim}
+% \begin{document}
+% \begin{letter}{...}
+% \object{Answer to your previous letter}
+% \end{verbatim}
+%
+% \DescribeMacro{\opening}
+% This command outputs the text given in its argument (adding a |\medskip| vertical space
+% after it):
+% \begin{verbatim}
+% \opening{Dear Sir,}
+% \end{verbatim}
+%
+% It stores its argument in |\salutation| for further use. |\salutation| can also be defined
+% previously and be recalled by an |\opening| with an empty or null argument:
+% \begin{verbatim}
+% \renewcommand{\salutation}{Dear Sir,}
+% ...
+% \begin{document}
+% \begin{letter}{...}
+% \opening
+% \end{verbatim}
+%
+% \DescribeMacro{\closing}
+% This command issues a |\medskip|, outputs the text given in its argument and generates
+% the signature field, which should provide its own vertical spacing (by default it is
+% |4\bigskip| above the signature and |2\bigskip| below):
+% \begin{verbatim}
+% \closing{Yours sincerely,}
+% \end{verbatim}
+%
+% The signature field placement can be altered by invocation of |leftsig| as a
+% class option. The signature field will contain the value defined by:
+% \begin{itemize}
+% \item[---] |\fromsig| (set by |\signature{...}|) in the first place;
+% \item[---] |\fromname| (set by |\name{...}|) if no |\signature| given;
+% \item[---] |\@author| (set by |\author{...}|) if no |\name| given (eventually empty).
+% \end{itemize}
+%
+% The |\closing| macro stores its argument in |\valediction| for later use. As usual, the
+% |\valediction| value can also be defined before and be output by an invocation of
+% |\closing| with an empty or null argument:
+% \begin{verbatim}
+% \renewcommand{\valediction}{Yours sincerely,}
+% \begin{document}
+% \begin{letter}{...}
+% ...
+% \closing{}
+% \end{verbatim}
+%
+% Depending on the class option |footfill|, an extra vertical glue will be added after the
+% signature, in order to balance the appearance of the letter foot. |footfill| pushes the
+% letter foot text against the document footer (usually the the letter foot is filled by the
+% |\ps|, |\encl| and |\cc| commands). Please note that for a weaker balance a |\vfil| could
+% be manually added after the |\closing| command.\bigskip
+%
+% Be aware of the locality of macros. |\salutation| and |\valediction| values are local to
+% the current |letter| environment if defined within the environment (usually by |\opening|
+% and |\closing| commands), global otherwise. Please look at the \LaTeX\ documentation for
+% further explanations.
+%
+% \subsubsection{Letter foot}
+%
+% Some formatting commands are intended to be used at the end of the letter (although they
+% can be used anywhere in the document, even outside of a letter environment---just as any
+% formatting command provided by the \textsf{chletter} class).\bigskip
+%
+% \DescribeMacro{\ps}
+% This command is generic in the sense that it is nothing but a shortcut for a \LaTeX\ list.
+% It takes two mandatory arguments. The text contained in the arguments is output as an
+% indented paragraph. The indentation margin is set by the standard \LaTeX\ |\leftmargin|
+% value (which defaults to |18pt| at document level, |0pt| after the |\closing| of a default
+% letter and |36pt| after the |\closing| of an indented |[i]| letter). Here is an example use:
+% \begin{verbatim}
+% \ps{P.S.}{This is a post scriptum}
+% \end{verbatim}
+%
+% \DescribeMacro{\encl}
+% This command is a shortcut for |\ps{\enclname}{...}| and takes one mandatory argument.
+% Regular use is:
+% \begin{verbatim}
+% \encl{1. Your previous letter\\2. My Curriculum Vit\ae}
+% \end{verbatim}
+%
+% \DescribeMacro{\cc}
+% This command is a shortcut for |\ps{\ccname}{...}| and takes one mandatory argument.
+% Regular use is:
+% \begin{verbatim}
+% \cc{1. First other recipient\\2. Second other recipient}
+% \end{verbatim}
+%
+% |\enclname| and |\ccname| are set to |{encl}|, respectively |{cc}| by default.
+% They will be adjusted by a linguistic package (\textsf{babel} or \textsf{polyglossia}).
+%
+% \subsection{Sectioning}
+%
+% \DescribeMacro{section}
+% \DescribeMacro{subsection}
+% \DescribeMacro{subsubsection}
+% \DescribeMacro{paragraph}
+% \DescribeMacro{subparagraph}
+% The class is intended to output short documents (mainly letters!), so the sectioning mecanism
+% is minimalist (no index nor table of contents generation). The stock sectioning commands are
+% here: |section|, |subsection|, |subsubsection|, |paragraph|, |subparagraph|, but are merely
+% formating commands which select some text style and vertical space. As usual, these commands
+% take one mandatory argument.
+%
+% \subsection{Environments}
+%
+% \DescribeMacro{description}
+% \DescribeMacro{verse}
+% \DescribeMacro{quotation}
+% \DescribeMacro{quote}
+% These environments are available and behave as ordinary in the \textsf{chletter} class.
+% The default list values (at document level) are:|\labelsep6pt|, |\labelwidth12pt|,
+% |\leftmargin18pt|. Please note that |\labelwidth| and |\labelsep| are redefined by a
+% |\closing| command to |\leftmargin2\parindent|, |\labelwidth3\labelwidth|.
+%
+% \subsection{Paragraphing}
+%
+% \DescribeMacro{\parindent}
+% \DescribeMacro{\parskip}
+%|\parindent| and |\parskip| respectively default to |18pt| and |9pt| at document level. If
+% a |letter| environment is called with the |[i]| option, |\parindent| is kept at its previous
+% value. With the default |[n]| option, |\parindent| is locally set to |0| (zero).\bigskip
+%
+% Please note that the actual value of |\parindent| while a |\closing| command is issued
+% will alter the layout of \LaTeX\ lists (in fact |\ps|, |\encl| and |\cc| are lists): the
+% |leftmargin| value (which defaults to |18pt|) is then defined as three times the value of
+% |\parindent| (thus |0pt| for a default letter and |36pt| for an indented letter).
+%
+% \StopEventually
%
% \section{Implementation}
%
-% \subsection{Options}
-% The initial code is taken from the \LaTeXe{} standard document
-% classes. See classes.dtx and letter.dtx for more information.
-% This class is largely compatible with the standard letter class.
-% We have mainly the same options with the same behaviour.
+% The \textsf{chletter} code is fairly compact (less than 300 lines) and highly optimized
+% (it relies on \TeX\ primitives wherever practical), dropping the obsolete legacy (namely
+% \LaTeX\ 2.09) for the sake of efficiency.\bigskip
+%
+% Appart from the options described until now, it is possible (and allowed!) to `hook' into
+% certain pieces of the class code. This enables a degree of customization and extensibility.
+% It would be quite straightforward to add, for example, mail merging features through a
+% dedicated package.
+%
+% \subsection{Initial code}
+%
% \begin{macrocode}
-%<*chletter>
-\newcommand\@ptsize{}
+%<*chletter.cls>
+% \end{macrocode}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{chletter}[2010/10/10 v2.0 Swiss letter document class]
% \end{macrocode}
%
-% \subsubsection{Declaring Options}
+% \subsubsection{Declaring options}
+%
+% \begin{macro}{leftwin}
+% \begin{macro}{leftsig}
+% \begin{macro}{foldmark}
+% \begin{macro}{footfill}
+% There are four specific options: |leftwin|, |leftsig|, |foldmark| and |footfill|,
+% corresponding to the format of the letter (left envelope window, left signature, folding
+% mark for C6/5 covers, letter foot balancing). The default is to not set any of these options.
+% All other options are borrowed from the standard classes.
+%
% \begin{macrocode}
\DeclareOption{a4paper}{\paperheight297mm\paperwidth210mm}
\DeclareOption{a5paper}{\paperheight210mm\paperwidth148mm}
@@ -151,184 +714,280 @@
\DeclareOption{legalpaper}{\paperheight14in\paperwidth8.5in}
\DeclareOption{executivepaper}{\paperheight10.5in\paperwidth7.25in}
\DeclareOption{landscape}
- {\@tempdima\paperheight
- \paperheight\paperwidth
- \paperwidth\@tempdima}
-\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
-\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
-\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
+{\@tempdima\paperheight\paperheight\paperwidth\paperwidth\@tempdima}
+\DeclareOption{10pt}{\def\@ptsize{0}}
+\DeclareOption{11pt}{\def\@ptsize{1}}
+\DeclareOption{12pt}{\def\@ptsize{2}}
\DeclareOption{oneside}{\@twosidefalse\@mparswitchfalse}
\DeclareOption{twoside}{\@twosidetrue\@mparswitchtrue}
-\DeclareOption{draft}{\setlength\overfullrule{5\p@}}
-\DeclareOption{final}{\setlength\overfullrule{0\p@}}
+\DeclareOption{draft}{\overfullrule5\p@}
+\DeclareOption{final}{\overfullrule\z@}
\DeclareOption{leqno}{\input{leqno.clo}}
\DeclareOption{fleqn}{\input{fleqn.clo}}
+\DeclareOption{onecolumn}{\@twocolumnfalse\@leftsigfalse}
+\DeclareOption{twocolumn}{\@twocolumntrue\@leftsigtrue}
+\DeclareOption{leftwin}{\@leftwintrue}
+\DeclareOption{leftsig}{\@leftsigtrue}
+\DeclareOption{foldmark}{\@foldmarktrue}
+\DeclareOption{footfill}{\@footfilltrue}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% These booleans will be evaluated at the end of the class code. They are |false| until the
+% associated option is selected.
+%
+% \begin{macrocode}
+\newif\if@leftwin
+\newif\if@leftsig
+\newif\if@foldmark
+\newif\if@footfill
+% \end{macrocode}
+%
+% \subsubsection{Executing options}
+%
+% Swiss letters are written on A4 paper. Default font size is |10pt|, like in other standard
+% classes. Other switches are set at kernel level.
+%
+% \begin{macrocode}
+\ExecuteOptions{a4paper,10pt}
+\ProcessOptions\relax
% \end{macrocode}
%
-% \subsubsection{Executing Options}
-% The default options are set according to swiss paper format (A4).
-% We also set a standard type size of 11pt.
+% Loading this |.clo| file leads to a lot of redundancy. But we want compatibility.
+%
% \begin{macrocode}
-\ExecuteOptions{a4paper,11pt,oneside,onecolumn,final}
-\ProcessOptions
\input{size1\@ptsize.clo}
% \end{macrocode}
%
-% \subsubsection{Loading Packages}
-% This class dos not load additional packages.
+% \subsubsection{Loading packages}
+%
+% The \textsf{chletter} class does not load additional packages.
+%
+% \subsection{Document layout}
+%
+% This class tries to provide quite a universal layout, not only suitable for letters, but
+% also for other types of short documents. There are anyway some values specific to letters,
+% principally the letterhead values.
+%
+% \subsubsection{Letter counter}
+%
+% \begin{macro}{theletter}
+% Each time a letter is created by a |letter| environment, this counter is incremented.
+%
+% \begin{macrocode}
+\newcounter{letter}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Letter dimensions}
+%
+% These dimensions concern the letterhead, where |\titlehead| is the absolute position of
+% its first baseline. The title matter is vertically stacked in three strips, each one with
+% its own height. |\titlemargin| is the absolute position of the letterhead margin, to which
+% the letterhead matter is relative. |\longindentation| and |\indentedwidth| are to be used
+% within a |letter| environment and will be computed on the fly by |\maketitle|, along with
+% |\addressmargin| or |\addresswidth|.
%
-% \subsection{Document Layout}
-% This class tries to provide a quite universal layout, not only suitable
-% for letters, but also for other types of short documents.
+% \begin{macrocode}
+\newdimen\titlehead
+\newdimen\titletopheight
+\newdimen\titlemidheight
+\newdimen\titlebotheight
+% \end{macrocode}
+% \begin{macrocode}
+\newdimen\titlemargin
+\newdimen\titlewidth
+\newdimen\addressmargin
+\newdimen\addresswidth
+% \end{macrocode}
+% \begin{macrocode}
+\newdimen\longindentation
+\newdimen\indentedwidth
+% \end{macrocode}
%
% \subsubsection{Paragraphing}
-% We prefer some paragraph spacing and some indentation at the document level.
-% This may be altered in the letter environment.
+%
+% We prefer inter paragraph skips in a letter. Swiss letters are rarely indented but the
+% |letter| environement offers an option to do so. Indentation is still enabled at
+% document level. Setting |\normallineskip| to zero prevents layout inconsistencies.
+%
% \begin{macrocode}
-\parskip9\p@\parindent18\p@
+\parskip9\p@
+\parindent18\p@
% \end{macrocode}
-% \begin{macro}{letterskip}
-% \begin{macro}{letterindent}
-% These values are used to store the current paragraph skip and indentation parameters. They are
-% computed at the beginning of the \textsf{letter} environment from |\parskip| and |\parindent| values.
% \begin{macrocode}
-\newdimen\letterskip\newdimen\letterindent
+\normallineskip\z@
+% \end{macrocode}
+%
+% \subsubsection{Page layout}
+%
+% All dimensions are measured from a point |1in| from the top left corner of the page.
+% Remember that |1in = 72.27pt = 2.54cm| = |72bp| and |1pt| = |65536sp|.\medskip
+%
+% Regarding the header, |12pt| (more or less one line) are reserved, plus |24pt| spacing
+% before the main text. The footer space is |36pt|, including body to footer gap.
+%
+% \begin{macrocode}
+\headheight12\p@
+\headsep24\p@
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% We don't allow the breaking of a page in an hyphenated line.
% \begin{macrocode}
-\brokenpenalty10000
+\footskip36\p@
% \end{macrocode}
%
-% \subsubsection{Standard Page Layout}
-% All margin dimensions are measured from a point one inch from the
-% top and lefthand side of the page (the \LaTeXe{} origin). We add 0.5 inch for the header.
-% This gives a 1.5 inch total margin from the top of the page
-% to the begining of the text. Note that the standard classes do not
-% set the |\topskip| value, which is set to 10 pt by the \LaTeX{} kernel.
+% Regarding the text dimensions, we remove approximately |1in| at each side, plus |36pt|
+% horizontally (corresponding to the margin, see below) and |72pt| vertically
+% (corresponding to the header and footer, see above). The trick in the definition
+% of |\textwidth| and |\textheight| is to have integer values for A4 paper.
+%
% \begin{macrocode}
-\topmargin\z@\topskip12\p@\headheight12\p@\headsep24\p@
+\textwidth\paperwidth
+\advance\textwidth-9536004sp
+\titlewidth\textwidth
+\advance\textwidth-36\p@
% \end{macrocode}
-% Same as above, we add 0.5 inch for the footer. We also set the footnotes vertical spaces here.
% \begin{macrocode}
-\footskip36\p@\footnotesep12\p@\skip\footins18\p@
+\textheight\paperheight
+\advance\textheight-14093310sp
% \end{macrocode}
-% We substract 2.5 inches to the width of the paper.
+%
+% The left margin of the odd pages is set to |1in + 36pt| (more or less |4cm|). Sizes of the
+% marginal notes are adapted to quite small margins. Top margin is set to zero.
+%
% \begin{macrocode}
-\textwidth\paperwidth\addtolength\textwidth{-180\p@}
+\oddsidemargin36\p@
+\evensidemargin\z@
% \end{macrocode}
-% We substract 3 inches from the height of the paper.
% \begin{macrocode}
-\textheight\paperheight\addtolength\textheight{-216\p@}
+\marginparwidth48\p@
+\marginparsep6\p@
+\marginparpush6\p@
% \end{macrocode}
-% We set standard values here. We will have a 1.5 inch
-% lefthand margin and a 1~inch righthand margin (given
-% the text width is 2.5~inches shorter than the paper width.
% \begin{macrocode}
-\oddsidemargin36\p@\evensidemargin0\p@
-\marginparwidth48\p@\marginparsep12\p@\marginparpush6\p@
+\topmargin\z@
% \end{macrocode}
%
-% \subsubsection{New Horizontal Dimensions}
-% \begin{macro}{\addressmargin}
-% This is the space between the origin (1 inch from the left border of the page)
-% and the recipient address field.
+% The footnotes values are somewhat larger than the default.
+%
% \begin{macrocode}
-\newdimen\addressmargin\addressmargin246\p@
+\footnotesep12\p@
+\skip\footins12\p@
+% \end{macrocode}
+%
+% \subsubsection{Title layout}
+%
+% What we call `title' here is the letterhead, with the addresses fields and all this kind of
+% stuff. Title is always placed on an odd page at an absolute position.
+%
+% \begin{macro}{\titlehead}
+% The vertical position of the title is controled by the |\titlehead| value (by analogy with
+% |\headheight| which sets the first baseline of the running head). Please note that
+% letterhead position is not altered by anything but |\titlehead| (for example it is
+% independant from the |\topmargin| value).
+%
+% \begin{macrocode}
+\titlehead12\p@
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\longindentation}
-% \begin{macro}{\indentedwidth}
-% |\longindentation| + |\indentedwidth| = |\textwidth|.
-% These values will be computed at the begining of the \textsf{letter} environment.
-% They are useful to align text width the recipient address field, which may be
-% modified by author between two letters.
+%
+% \begin{macro}{\titletopheight}
+% \begin{macro}{\titlemidheight}
+% \begin{macro}{\titlebotheight}
+% The title (letterhead or cover) field is divided into three strips, each one containing
+% some material. For example, the first field could contain the sender's address, the second
+% one the recipient's address and the third one the letter's date. Obviously the total
+% letterhead height is the sum of these three values (|216pt| by default).
+%
% \begin{macrocode}
-\newdimen\longindentation\newdimen\indentedwidth
+\titletopheight72\p@
+\titlemidheight72\p@
+\titlebotheight72\p@
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
-% \subsubsection{New Vertical Dimensions}
-% \begin{macro}{\fromtop}
-% We need to position precisely the addresses fields, substracting some values until
-% we reach the origin at 1 inch from the top of the paper.
-% \begin{macrocode}
-\newdimen\fromtop\fromtop\z@\addtolength\fromtop{-\headheight}
-\addtolength\fromtop{-\headsep}\addtolength\fromtop{-\baselineskip}
-% \end{macrocode}
+% \begin{macro}{\titlemargin}
+% \begin{macro}{\titlewidth}
+% The horizontal position of the title is controlled by |\titlemargin| which is set to |0pt|
+% by default. |\titlewidth| has already been set as |\textwidth + 36pt|.
+% \end{macro}
% \end{macro}
-% \begin{macro}{\fromheight}
-% \begin{macro}{\toheight}
-% |\fromheight| is the height of the field containing the sender address.
-% |\toheight| is the height of the field containing the recipient address.
-% Theses values are set accordingly to swiss standard windowed envelopes.
+%
+% \begin{macro}{\addressmargin}
+% \begin{macro}{\addresswidth}
+% These values are to be computed on the fly by |\maketitle| depending on user input and
+% actual |\titlewidth| value. If |\addressmargin| is defined by the user, then the formula
+% |\titlewidth = \addressmargin + \addresswidth| will be applied to |\addresswidth|, otherwise
+% it will be applied to |\addressmargin|.
+%
% \begin{macrocode}
-\newdimen\fromheight\fromheight60\p@\newdimen\toheight\toheight96\p@
+\addresswidth190\p@
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \begin{macro}{\sigspace}
-% is the total space in which the signature is centered.
+%
+% \subsubsection{Page styles}
+%
+% The default page styles are here, but their layout differ from the standard classes.
+%
% \begin{macrocode}
-\newdimen\sigspace\sigspace6\bigskipamount
+\def\ps@plain%
+{\let\@oddhead\@empty
+ \let\@evenhead\@empty
+ \def\@oddfoot{\footnotesize\hfil\pagename~\thepage}
+ \def\@evenfoot{\footnotesize\pagename~\thepage\hfil}}
% \end{macrocode}
-% \end{macro}
-%
-% \subsubsection{Page Styles}
-% The pagestyles \textsl{empty} and \textsl{plain} are defined in
-% the \LaTeX{} kernel ({ltpage.dtx}). In this class we change
-% a bit the \textsl{plain} style. Note that we don't set different
-% headings for one-sided and two-sided documents.
-% \begin{macrocode}
-\def\ps@plain
- {\let\@oddhead\@empty
- \def\@oddfoot
- {\footnotesize{\hfil\pagename~\thepage}}
- \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}
-\def\ps@headings
- {\def\@oddhead
- {\footnotesize{\hspace*{-\oddsidemargin}\headtoname~\toname\hfil\pagename~\thepage}}
- \def\@oddfoot
- {\footnotesize{\hspace*{-\oddsidemargin}\leftmark\hfil\rightmark}}
- \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}
-\def\ps@myheadings
- {\def\@oddhead
- {\footnotesize{\hspace*{-\oddsidemargin}\leftmark\hfil\rightmark}}
- \def\@oddfoot
- {\footnotesize{\hfil\pagename~\thepage}}
- \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}
-\def\ps@firstpage
- {\let\@oddhead\@empty
- \def\@oddfoot
- {\footnotesize{\hspace*{-\oddsidemargin}\leftmark\hfil\rightmark}}
- \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}
+% \begin{macrocode}
+\def\ps@firstpage%
+{\let\@oddhead\@empty
+ \let\@evenhead\@empty
+ \def\@oddfoot{\footnotesize\leftmark\hfil\rightmark}
+ \def\@evenfoot{\footnotesize\rightmark\hfil\leftmark}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\ps@headings%
+{\def\@oddhead{\footnotesize\headtoname~\toname\hfil\pagename~\thepage}
+ \def\@evenhead{\footnotesize\pagename~\thepage\hfil}
+ \def\@oddfoot{\footnotesize\leftmark\hfil\rightmark}
+ \def\@evenfoot{\footnotesize\rightmark\hfil\leftmark}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\ps@myheadings%
+{\def\@oddhead{\footnotesize\leftmark\hfil\rightmark}
+ \def\@evenhead{\footnotesize\rightmark\hfil\leftmark}
+ \def\@oddfoot{\footnotesize\hfil\pagename~\thepage}
+ \def\@evenfoot{\footnotesize\pagename~\thepage\hfil}}
% \end{macrocode}
%
-% \subsection{Declarations}
+% \subsection{Document markup}
+%
+% These user commands are common to all usual letter classes.
+%
+% \subsubsection{Global declarations}
+%
+% \begin{macro}{\name}
+% \begin{macro}{\signature}
+% \begin{macro}{\address}
+% \begin{macro}{\location}
+% \begin{macro}{\telephone}
+% \begin{macro}{\return}
+% These macros work exactly the same way as with the standard \textsf{letter} class. They
+% don't output anything, but just define an associated word containing their argument. The
+% layout of |\telephonenum| (small text) and |\returnaddress| (underlined small text) is
+% specific to this class and somewhat tricky, intended to manage the best possible appearance.
+% Please note that the default contents of the associated words will be defined later.
%
-% \subsubsection{Commands}
-% \begin{macro}{\name\fromname}
-% \begin{macro}{\signature\fromsig}
-% \begin{macro}{\address\fromaddress}
-% \begin{macro}{\location\fromlocation}
-% \begin{macro}{\telephone\telephonenum}
-% \begin{macro}{\return\returnaddress}
-% The standard \textsf{letter} class doesn't provide a |\return| command, but
-% knows of the |\returnaddress| value. One should note that some of these values
-% are functionally different from the standard class, and that |\@author|
-% (set by the |\author| command) may be used to replace |\fromname| and |\fromsig|
-% in most cases (see ...). Usually the user will use these commands in the preamble
-% of his letter. But they can be altered anywhere to obtain some special effects
-% (different addresses for the envelope page for example).
% \begin{macrocode}
-\newcommand*{\name}[1]{\def\fromname{#1}}\name{}
-\newcommand*{\signature}[1]{\def\fromsig{#1}}\signature{}
-\newcommand*{\address}[1]{\def\fromaddress{#1}}\address{}
-\newcommand*{\location}[1]{\def\fromlocation{#1}}\location{}
-\newcommand*{\telephone}[1]{\def\telephonenum{#1}}\telephone{}
-\newcommand*{\return}[1]{\def\returnaddress{#1}}\return{}
+\long\def\name#1{\def\fromname{#1}}
+\long\def\signature#1{\def\fromsig{#1}}
+\long\def\location#1{\def\fromlocation{#1}}
+\long\def\address#1{\def\fromaddress{#1}}
+\long\def\telephone#1{\def\telephonenum{\vtop{\footnotesize#1}}}
+\long\def\return#1{\def\returnaddress{\underbar{\textsuperscript{#1}}}}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -336,368 +995,662 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \begin{macro}{\fromstreet}
-% \begin{macro}{\fromplace}
-% \begin{macro}{\toname}
-% \begin{macro}{\toaddress}
-% We additionaly declare some default values. These are computed at the begining of
-% the letter environment (see xxx), but may be altered manually by the user.
-% Here we ensure they are defined even if the letter environment is not invoked, to
-% prevent runtime errors.
+%
+% \begin{macro}{\makelabels}
+% \begin{macro}{\startlabels}
+% The |\makelabels| command defines a |\startlabels| macro, which causes cover pages to be
+% added at the end of each letter. See next page for more information.
+%
% \begin{macrocode}
-\def\toname{}\def\toaddress{}\def\fromstreet{}\def\fromplace{}
+\def\makelabels%
+{\def\startlabels%
+ {\let\titletopmatter\@empty
+ \let\titlebotmatter\@empty
+ \let\foldmark\@empty}}
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
%
-% \subsubsection{Words}
-% \begin{macro}{\ccname}
-% \begin{macro}{\enclname}
-% \begin{macro}{\pagename}
-% \begin{macro}{\headtoname}
-% These names are defined the same way as in the standard letter class. They
-% will be altered by the linguistic packages (babel) at the begining of the document.
-% If the user wants to alter them manually, he should do it after |\begin{document}|
-% to obtain the expected result.
+% \begin{macro}{\maketitle}
+% This artful piece of code actually outputs the letterhead stuff. |\maketitle| is always
+% called at the opening of the |letter| environment, and at its closing if the |\startlabels|
+% flag is not |\@null|. It outputs the content of |\titletopmatter|, |\titlemidmatter|,
+% |\titlebotmatter| in three horizontal strips stacked vertically. These strips have respective
+% heights of |\titletopheight|, |\titlemidheight|, |\titlebotheight| and are always placed on
+% a new odd page at an absolute position given by |\titlehead| and |\titlemargin|. The width of
+% the strips is given by |\titlewidth|. |\longindentation| and |\indentedwidth| are computed
+% here, so are |\addressmargin| and |\addresswidth| which are used by |\splitfield|. Some
+% dedicated mecanism deals with the |\twoside| and |\twocolumns| cases (the letterhead is
+% always issued on a clear odd page), executing the |\@maketitle| auxiliary macro. The
+% |\foldmark| macro is called at the end of the letterhead.
+%
% \begin{macrocode}
-\newcommand*{\ccname}{cc}\newcommand*{\enclname}{encl}
-\newcommand*{\pagename}{Page}\newcommand*{\headtoname}{To}
+\def\maketitle%
+{\ifdim\addressmargin=\z@
+ \addressmargin\titlewidth
+ \advance\addressmargin-\addresswidth
+ \else
+ \addresswidth\titlewidth
+ \advance\addresswidth-\addressmargin\fi
+ \longindentation\titlemargin
+ \advance\longindentation-\oddsidemargin
+ \clearpage
+ \if@twoside\ifodd\c@page
+ \else\thispagestyle{empty}\hb@xt@\z@{}\clearpage\fi\fi
+ \if@twocolumn\twocolumn[\@maketitle\leavevmode\vskip-\topskip]
+ \else\vbox{\@parboxrestore\@maketitle}\vskip-\parskip\fi
+ \advance\longindentation\addressmargin
+ \indentedwidth\textwidth
+ \advance\indentedwidth-\longindentation}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@maketitle%
+{\vskip-\topmargin\vskip-\baselineskip
+ \vskip\titlehead\vskip-\headheight\vskip-\headsep
+ \leftskip\longindentation\rightskip\textwidth
+ \advance\rightskip-\paperwidth
+ \advance\rightskip-\titlemargin
+ \parbox[t][\titletopheight]{\titlewidth}
+ {\hb@xt@\z@{}\titletopmatter\strut}\par
+ \parbox[t][\titlemidheight]{\titlewidth}
+ {\hb@xt@\z@{}\titlemidmatter\strut}\par
+ \parbox[t][\titlebotheight]{\titlewidth}
+ {\hb@xt@\z@{}\titlebotmatter\strut}\par
+ \leftskip-\oddsidemargin\advance\leftskip-1in
+ \parbox[b][\z@]{\paperwidth}{\foldmark}\par}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
% \end{macro}
%
-% \subsubsection{Date}
-% \begin{macro}{\today}
-% This macro is identical to the one defined in the standard class.
+% \subsubsection{The \texttt{letter} environment}
+%
+% \begin{environment}{letter}
+% The |letter| environment is the foremost part of a letter. It takes the recipient's address
+% as mandatory argument and |[i]| (default is |[n]|) as optional argument to set the
+% |\parindent| value within the group represented by the environment. The first part of the
+% code manages these arguments. It is sturdier than the standard \LaTeX\ |\newenvironment| in
+% the sense that, for example, the mandatory argument is not... mandatory! At its opening,
+% the |letter| environment tokenizes its mandatory argument into two fields, |\toname| and
+% |\toaddress| (token separator is the first encountered |\\|). If the argument is null
+% (|\begin{letter}{}| or |\begin{letter}|), these values won't be modified and thus may be
+% defined before the opening of the environment, hence the easy mail merging extension. Then
+% |\maketitle| is called to output the letterhead (the first page of the letter is always
+% issued on a clear odd page, leaving a blank page if necessary in two sided documents). The
+% |\pagestyle| of the first letter page is set to |firstpage| and the |letter| counter is
+% incremented, while the |page| and |footnote| counters are reset.
+%
% \begin{macrocode}
-\newcommand*{\today}
- {\ifcase\month\or January\or February\or March\or April\or May\or June\or
- July\or August\or September\or October\or November\or December\fi
- \space\number\day, \number\year}
+\def\letter{\futurelet\@let@token\ch@let}\def\ch@let%
+{\ifx\@let@token[\expandafter\@letter\else\expandafter\ch@lea\fi}
+\long\def\ch@lea#1 {\@letter[n]{#1} }
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\@letter[#1]#2
+{\ifx#1n\parindent\z@\fi\ifx\@null#2\else\@processto#2\\@@@
+ \ifx\@empty\toaddress\else\@processto#2@@@\fi\fi
+ \maketitle\thispagestyle{firstpage}
+ \global\c@page\@ne\global\c@footnote\z@\global\advance\c@letter\@ne}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\@processto#1\\#2@@@{\def\toname{#1}\def\toaddress{#2}}
% \end{macrocode}
-% \end{macro}
%
-% \subsection{Insertion commands}
-% \begin{macro}{\maketitle}
-% This macro will generate the addresses fields from given values. It is invocated by
-% the letter environment, but can be used anywhere in the document (not in the preamble).
-% The recipient address is defined as an argument to the letter environment,
-% but one may use |\def\toname{}| and |\def\toaddress{}| to set it manually.
-%
-% This macro takes the same optional argument as the letter environment:\\
-% |[p]| (plain, default) will put the expeditor field, the date and the recipient field.\\
-% |[e]| (everything) will add the return address to the recipient field.\\
-% |[n]| (nofrom) will put only the recipient field.\\
-% |[r]| (return) will add the return address to the recipient field.
-% \begin{macrocode}
-\newcommand*{\maketitle}[1][p]
- {\vspace*{-\parskip}\ifx n#1\vspace*{\fromheight}\else\ifx r#1\vspace*{\fromheight}%
- \else\noindent\hspace{-\oddsidemargin}\parbox[t][\fromheight]{\addressmargin}
- {\ifx\ch@aut\@author
- \else\leavevmode\@author\\\fi
- \ifx\@empty\fromlocation
- \else\fromlocation\\\fi
- \ifx\@empty\fromaddress
- \else\fromaddress\par\medskip\fi
- \ifx\@empty\telephonenum
- \else{\footnotesize\telephonenum\par\medskip}\fi}%
- \parbox[t]{\indentedwidth}{~\\\@date}\par\vspace*{-\parskip}\fi\fi
- \noindent\hspace{\longindentation}\parbox[t][\toheight]{\indentedwidth}
- {\ifx p#1\else\ifx n#1\else{\footnotesize\returnaddress\par\medskip}\fi\fi
- \leavevmode\toname\\\toaddress\\}\vspace*{-\parskip}\par}
+% At its closing, the |letter| environment removes the last skip, then checks for the
+% definition of |\startlabels|. If undefined, nothing but a |\clearpage| happens. If defined,
+% its contents is executed (usually a redefinition of |\titletopmatter|, |\titlemidmatter| and
+% |\titlebotmatter|) and the |\maketitle| macro is called, taking the |\twoside| case in
+% account (which may produce additional empty pages), then issuing a new page (intended to be
+% a cover) followed by a |\clearpage|.
+%
+% \begin{macrocode}
+\def\endletter{\removelastskip\ifx\startlabels\undefined\else%
+ \startlabels\maketitle\thispagestyle{empty}\fi\clearpage}
+% \end{macrocode}
+% \end{environment}
+%
+% \subsubsection{Page breaking control}
+%
+% \begin{macro}{\stopbreaks}
+% \begin{macro}{\startbreaks}
+% When the command |\stopbreaks| is issued no page breaks should occur until |\startbreaks| is
+% called. These macros are used by the |\closing| command.
+%
+% \begin{macrocode}
+\def\stopbreaks{\interlinepenalty\@M\def\par{\@@par\nobreak}}
+\def\startbreaks{\interlinepenalty100\def\par{\@@par}}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\opening}
-% Unlike the standard letter |\opening| command, this one is very simplistic. It only creates
-% the opening formula given in its mandatory argument.
+% \end{macro}
%
-% There is an optional argument:\\
-% |[n]| (noindent, default) turns indentation off for the following text.\\
-% |[i]| (indent) turns indentation on for the following text.
+% \subsubsection{The generic letter commands}
+%
+% \begin{macro}{\opening}
+% Unlike the standard \textsf{letter} class, the |\opening| command doesn't generate the
+% letterhead (this is done at the opening of the |letter| environment or by a direct call of
+% |\maketitle|). The content of |\salutation| is either locally filled with the mandatory
+% argument or recalled if the argument is null (either |\opening{}| or |\opening| without
+% argument, look at the neat argument handling code), then output. The |\medskipamount| value
+% controls the vertical spacing.
%
-% Note that the optional argument modifies the following text, not the opening itself! The
-% indentation value is taken from |\letterindent|.
% \begin{macrocode}
-\newcommand{\opening}[2][n]
- {\ifx i#1\parindent\letterindent\else\parindent\z@\fi\par\noindent#2\par\medskip}
+\def\opening{\futurelet\@let@token\ch@ope}\def\ch@ope%
+{\ifx\@let@token\bgroup\expandafter\ch@opa\else\expandafter\@opening\fi}
+\def\ch@opa#1{\ifx\@null#1\else\def\salutation{#1}\fi\@opening}
+% \end{macrocode}
+% \begin{macrocode}
+\def\@opening{\par\salutation\par\medskip}
% \end{macrocode}
% \end{macro}
+%
% \begin{macro}{\closing}
-% This command generates the valediction line and the signature.
-% The signature is horizontaly aligned width the recipient address field and
-% verticaly spaced by |\sigspace|. The signature is one of the following:
-% |\fromsig|, |\fromname|, |\@author|, depending on whether they are defined or not.
+% The |\closing| command is to be called at the end of the letter body. It generates the
+% valediction and the signature. Much like the |\opening| command, its argument either fills
+% or retrieve a value, here |\valediction|. A |\medskip| is issued, page breaking is prevented
+% and |\closingmatter| is added. |\closingmatter| is defined according to the class option
+% |leftsig| and could be completely customized.
%
-% It takes the same optional argument as the |\opening| command, default is |[n]|.
% \begin{macrocode}
-\newcommand{\closing}[2][n]
- {\ifx i#1\parindent\letterindent\else\parindent\z@\fi\par\medskip
- #2\par\vspace*{.5\sigspace}
- \noindent\hspace\longindentation
- \ifx\@empty\fromsig
- \ifx\@empty\fromname\@author\else\fromname\fi
- \else\fromsig\fi
- \par\vspace*{.5\sigspace}}
+\def\closing{\futurelet\@let@token\ch@clo}\def\ch@clo%
+{\ifx\@let@token\bgroup\expandafter\ch@cla\else\expandafter\@closing\fi}
+\def\ch@cla#1{\ifx\@null#1\else\def\valediction{#1}\fi\@closing}
% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\longindentation}
-% This macro will align the text contained in its argument with the recipient address.
% \begin{macrocode}
-\newcommand*{\longindent}[1]
- {\par\noindent\hspace{\longindentation}\parbox[t]{\indentedwidth}{#1}\par\smallskip}
+\def\@closing{\par\medskip\stopbreaks\valediction
+ \samepage\par\closingmatter\par\startbreaks}
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\conc}
-% This command is intended to be used before the |\opening| command, to add a subject
-% line. It accepts one mandatory argument (the actual text to be inserted) and one
-% optional argument:\\
-% |[r]| (right, default) aligns against the text margin.\\
-% |[l]| (left) aligns with the expeditor address.
+%
+% \begin{macro}{\object}
+% The |\object| macro outputs the content of |\@title|, either previously defined by a
+% |\title| command or filled by a non empty argument (see |\opening| for an explanation of
+% this behaviour). The |\bigskipamount| value controls the vertical spacing. Styling is left
+% to user's preference, for example: |\object{\textbf{...}}|.
%
% \begin{macrocode}
-\newcommand*{\conc}[2][r]{\ch@pul[#1]{\textbf{#2}}\par\bigskip}
+\def\object{\futurelet\@let@token\ch@obj}\def\ch@obj%
+{\ifx\@let@token\bgroup\expandafter\ch@oba\else\expandafter\@object\fi}
+\def\ch@oba#1{\ifx\@null#1\else\title{#1}\fi\@object}
% \end{macrocode}
-% \end{macro}
-% \begin{macro}{\ps}
-% This command is useful to achieve certain effects. It aligns its text argument following
-% the optional argument and dosen't close the current paragraph. The following text will
-% continue on the same line.
% \begin{macrocode}
-\newcommand*{\ps}[2][r]{\ch@put[#1]{#2}{\ignorespaces}}
+\def\@object{\noindent\@title\par\bigskip}
% \end{macrocode}
% \end{macro}
+%
+% \begin{macro}{\ps}
% \begin{macro}{\cc}
% \begin{macro}{\encl}
-% These two commands are intended to be used at the end of the letter, but they can
-% be placed anywhere in the document to obtain special effects. Their usage is quite similar
-% to what is described in the standard letter class. They all take a mandatory
-% argument (some text) and an optional argument:\\
-% |[r]| (right, default) aligns against the text margin.\\
-% |[l]| (left) aligns with the expeditor address.
+% |\ps| is a shortcut for a simple \LaTeX\ list, with its first argument as item label and
+% its second argument as a item contents. |\cc| and |\encl| are further shortcuts, using
+% respectively |\ccname| and |\enclname| as label. There is a trick involved here: the list
+% behaviour is altered after a |\closing| command (see |\closingmatter|); by these means the
+% letter foot benefit from the powerful list feature while the lists defaults are kept at
+% convenient values for use within the letter body.\medskip
+%
% \begin{macrocode}
-\newcommand*{\cc}[2][r]{\ch@put[#1]{\emph{\ccname}}{#2}\par\medskip}
-\newcommand*{\encl}[2][r]{\ch@put[#1]{\emph{\enclname}}{#2}\par\medskip}
+\long\def\ps#1#2{\begin{list}{}{}\item[#1]#2\end{list}}
+\long\def\cc#1{\ps{\ccname}{#1}}
+\long\def\encl#1{\ps{\enclname}{#1}}
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \begin{macro}{\section}
-% \begin{macro}{\subsection}
-% \begin{macro}{\subsubsection}
-% These commands are not defined in the standard letter class. functionally, they do nothing
-% but emphasize the text given as their argument. They cannot be used to generate
-% a table of contents, because the necessary provisions are not implemented in this class.
-% They take an optional argument:\\
-% |[r]| (right, default) aligns against the text margin.\\
-% |[l]| (left) aligns with the expeditor address.
+% \end{macro}
+%
+% \subsubsection{Sections and paragraphs}
+%
+% Some sectioning commands are defined, but they are merely formatting commands. So there is
+% no section numbering nor index and table of contents generation.
+%
+% \begin{macrocode}
+\long\def\subparagraph#1{\par\textbf{#1}\hskip\labelsep}
+\long\def\paragraph#1{\par\noindent\textbf{#1}\hskip\labelsep}
+\long\def\subsubsection#1{\par\noindent\textbf{#1}\par\nobreak}
+\long\def\subsection#1{\smallskip\subsubsection{#1}}
+\long\def\section#1{\medskip\subsubsection{#1}}
+% \end{macrocode}
+%
+% \subsubsection{Environments}
+%
+% This code is borrowed from the standard classes. Please look at the \LaTeXe\ documentation
+% for further explanation. Remember that all these environments are lists which will be
+% formatted according following the general lists parameters.
+%
+% \begin{macrocode}
+\def\description
+{\list{}
+ {\labelwidth\z@
+ \itemindent-\leftmargin
+ \let\makelabel\descriptionlabel}}\def\enddescription{\endlist}
+% \end{macrocode}
+% \begin{macrocode}
+\def\descriptionlabel#1{\hskip\labelsep\textbf{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\verse
+{\let\\\@centercr
+ \list{}
+ {\itemsep\z@
+ \itemindent-\parindent
+ \listparindent\itemindent
+ \rightmargin\leftmargin
+ \advance\leftmargin\parindent}
+ \item\relax}\def\endverse{\endlist}
+% \end{macrocode}
+% \begin{macrocode}
+\def\quotation
+{\list{}
+ {\listparindent\parindent
+ \itemindent\listparindent
+ \rightmargin\leftmargin}
+ \item\relax}\def\endquotation{\endlist}
+% \end{macrocode}
% \begin{macrocode}
-\newcommand*{\subsubsection}[2][r]{\par\ch@pul[#1]{\textbf{#2}}\par}
-\newcommand*{\subsection}[2][r]{\smallskip\subsubsection[#1]{#2}}
-\newcommand*{\section}[2][r]{\medskip\subsubsection[#1]{#2}}
+\def\quote
+{\list{}
+ {\rightmargin\leftmargin}
+ \item\relax}\def\endquote{\endlist}
+% \end{macrocode}
+%
+% \subsubsection{Lists}
+%
+% This code is borrowed from the standard classes. Please look at the \LaTeXe\ documentation
+% for further explanation. Please also note that list nesting is limited to four levels
+% (seems to be enough for a letter).
+%
+% \begin{macrocode}
+\def\@listI{}
+\let\@listi\@listI
+\let\@listii\@listI
+\let\@listiii\@listI
+\let\@listiv\@listI
+% \end{macrocode}
+% \begin{macrocode}
+\def\theenumi{\@arabic\c@enumi}
+\def\theenumii{\@alph\c@enumii}
+\def\theenumiii{\@roman\c@enumiii}
+\def\theenumiv{\@Alph\c@enumiv}
+% \end{macrocode}
+% \begin{macrocode}
+\def\labelenumi{\theenumi.}
+\def\labelenumii{(\theenumii)}
+\def\labelenumiii{\theenumiii.}
+\def\labelenumiv{\theenumiv.}
+% \end{macrocode}
+% \begin{macrocode}
+\def\p@enumii{\theenumi}
+\def\p@enumiii{\theenumi(\theenumii)}
+\def\p@enumiv{\p@enumiii\theenumiii}
+% \end{macrocode}
+% \begin{macrocode}
+\def\labelitemi{\textbullet}
+\def\labelitemii{\textbf{\textendash}}
+\def\labelitemiii{\textasteriskcentered}
+\def\labelitemiv{\textperiodcentered}
+% \end{macrocode}
+%
+% \subsection{Default settings}
+%
+% As in other classes, some values are set here rather than at kernel level. The values used
+% by the \textsf{chletter} class are as generic as possible.
+%
+% \subsubsection{Lists}
+%
+% \begin{macro}{\labelsep}
+% \begin{macro}{\labelwith}
+% \begin{macro}{\leftmargin}
+% These default values are defined at document level and altered by |\closingmatter|
+% (see next page) in the following manner: |\labelwidth3\labelsep| (usually |18pt|),
+% |\leftmargin2\parindent| (|36pt| in an indented letter, |0pt| in a default letter).
+%
+% \begin{macrocode}
+\labelsep6\p@\labelwidth12\p@\leftmargin18\p@
+% \end{macrocode}
+% \begin{macrocode}
+\topsep\z@\partopsep3\p@\itemsep\z@\parsep3\p@
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
-% \begin{macro}{\paragraph}
-% \begin{macro}{\subparagraph}
-% Contrary to the commands above, these do not accept an optional argument.
+%
+% \subsubsection{Environments}
+%
+% Exactly as in the standard classes.
% \begin{macrocode}
-\newcommand*{\subparagraph}[1]{\par\textbf{#1}~}
-\newcommand*{\paragraph}[1]{\par\noindent\textbf{#1}~}
+\arraycolsep5\p@
+\tabcolsep6\p@
+\arrayrulewidth.4\p@
+\doublerulesep2\p@
+\tabbingsep\labelsep
+\skip\@mpfootins=\skip\footins
+\def\theequation{\@arabic\c@equation}
+% \end{macrocode}
+%
+% \subsubsection{Framed boxes}
+%
+% \begin{macro}{\fboxsep}
+% \begin{macro}{\fboxrule}
+% Apart from their ordinary application, the values defined here are used by the default
+% |\foldmark| macro defined by the |foldmark| class option.
+%
+% \begin{macrocode}
+\fboxsep3\p@
+\fboxrule.4\p@
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \subsection{The \texttt{\textbackslash makelabels} Command}
-% \begin{macro}{\makelabels}
-% This acts as a flag for the letter environment. If true (i.e. |\makelabels| have
-% been invoked with a given option before the |letter| environement), then a page will be
-% added to the letter, containing only the addresses fields. This is intended to generate envelopes.
+% \subsubsection{Footnotes}
%
-% This command passes its argument to the |letter| environment and then to |\maketitle|. An |[f]| argument will be
-% interpreted at the end of the letter environment as a request to deactivate the labels
-% generation mecanism.
+% Light is right! This definition is minimalist, at the same time sensible.
% \begin{macrocode}
-\newcommand*{\makelabels}[1][r]{\let\ch@lab#1}
+\long\def\@makefntext#1{\noindent\hb@xt@\z@{\hss\@makefnmark}#1}
% \end{macrocode}
+%
+% \subsubsection{Letter}
+%
+% Some specific letter values are initialized here.
+%
+% \begin{macro}{\fromname}
+% \begin{macro}{\fromsig}
+% \begin{macro}{\fromaddress}
+% \begin{macro}{\fromlocation}
+% \begin{macro}{\telephonenum}
+% \begin{macro}{\returnaddress}
+% |\fromname| is not empty by default, so is |\fromsig|: they contain the |\@author| value,
+% which is defined at kernel level to output nothing but a warning message (no author given).
+% |\@author| will be modified by the \LaTeX\ |\author| command. |\fromlocation| and
+% |\fromaddress| are somewhat redundant, but they may be used for special purpose.
+% |\returnaddress| should also output nothing by default, but it has to leave an empty line,
+% hence the |\null| trick (actually an empty |\hbox|).
+%
+% \begin{macrocode}
+\def\fromname{\@author}
+\def\fromsig{\@author}
+\let\fromlocation\@empty
+\let\fromaddress\@empty
+\let\telephonenum\@empty
+\def\returnaddress{\null}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
% \end{macro}
%
-% \subsection{The Letter Environment}
-% The aforementioned commands are arguably specific to letters. But they may be used as well outside
-% the letter environment to achieve some special effects. It is not mandatory to use a letter
-% environment with this class.
-% \begin{environment}{letter}
-% The letter environment creates a new page, resets numberings, computes some values,
-% invokes the |\maketitle| macro, optionaly twice (following the flag set
-% by |\makelabels|) to generate an additional envelope page.
-% This is an important functional difference with the standard letter class.
-% As a side effect, local declarations (|\name| for example) will alter only the additional
-% envelope page if they are made inside the letter environement.
-%
-% It has the same mandatory argument as the standard class, nevertheless it accepts one optional argument
-% which will be passed to |\maketitle|:\\
-% |[p]| (plain, default) will put the expeditor field, the date and the recipient field.\\
-% |[e]| (everything) will add the return address to the recipient field.\\
-% |[n]| (nofrom) will put only the recipient field.\\
-% |[r]| (return) will add the return address to the recipient field.
-% \begin{macrocode}
-\newenvironment*{letter}[2][p]
- {\ch@pfr{\fromaddress}\ch@pto{#2}
- \letterindent\parindent\parindent\z@\letterskip\parskip
- \longindentation\addressmargin\addtolength\longindentation{-\oddsidemargin}
- \indentedwidth\textwidth\addtolength\indentedwidth{-\longindentation}
- \newpage\c@page\@ne\c@footnote\z@\pagestyle{plain}\thispagestyle{empty}
- \vspace*{\fromtop}\maketitle[#1]}
- {\vfil\pagebreak
- \if f\ch@lab
- \else\newpage\thispagestyle{empty}\vspace*{\fromtop}\maketitle[\ch@lab]\fi}
+% \begin{macro}{\toname}
+% \begin{macro}{\toaddress}
+% These values retrieved or adjusted at the opening of a |letter| environment.
+% They are initialized here to prevent an error in certain condition.
+%
+% \begin{macrocode}
+\let\toname\@empty
+\let\toaddress\@empty
% \end{macrocode}
-% \end{environment}
+% \end{macro}
+% \end{macro}
%
-% \subsection{Standard Definitions}
-%
-% \subsubsection{Lists Parameters}
-% \begin{macrocode}
-\leftmargini\parindent\leftmargin\leftmargini
-\leftmarginii\leftmargini\leftmarginiii\leftmargini\leftmarginiv\leftmargini
-\labelsep.25\parindent\labelwidth.75\parindent
-\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{\textendash}
-\newcommand\labelitemiii{\textasteriskcentered}
-\newcommand\labelitemiv{\textperiodcentered}
-% \end{macrocode}
-%
-% \subsubsection{New Environments}
-% \begin{macrocode}
-\newenvironment{description}
- {\list{}{\labelwidth\z@\itemindent-\leftmargin
- \let\makelabel\descriptionlabel}}{\endlist}
-\newcommand*{\descriptionlabel}[1]
- {\hspace\labelsep\textbf{#1}}
-\newenvironment{verse}
- {\let\\=\@centercr
- \list{}{\itemsep\z@\itemindent-\parindent
- \listparindent\itemindent\rightmargin\leftmargin
- \addtolength\leftmargin\parindent}
- \item[]}{\endlist}
-\newenvironment{quotation}
- {\list{}{\listparindent\parindent
- \itemindent\listparindent\rightmargin\leftmargin}
- \item[]}{\endlist}
-\newenvironment{quote}
- {\list{}{\rightmargin\leftmargin}
- \item[]}{\endlist}
-% \end{macrocode}
-%
-% \subsubsection{Existing Environments Parameters}
-% \begin{macrocode}
-\arraycolsep5\p@\tabcolsep6\p@
-\arrayrulewidth.4\p@\doublerulesep2\p@
-\tabbingsep\labelsep
-\skip\@mpfootins=\skip\footins
-\fboxsep3\p@\fboxrule.4\p@
-\renewcommand\theequation{\@arabic\c@equation}
+% \begin{macro}{\salutation}
+% \begin{macro}{\valediction}
+% These values are retrieved or adjusted respectively by the |\opening| and |\closing|
+% commands. They are initialized here to prevent an error in certain condition.
+%
+% \begin{macrocode}
+\let\salutation\@empty
+\let\valediction\@empty
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \subsubsection{Words}
+%
+% \begin{macro}{\ccname}
+% \begin{macro}{\enclname}
+% \begin{macro}{\pagename}
+% \begin{macro}{\headtoname}
+% These words are common to the common \textsf{letter} classes. They will be adjusted by the
+% linguistic packages (\textsf{babel} or \textsf{polyglossia}). |\ccname| and |\enclname| are
+% used respectively by the |\cc| and |\encl| macros; while |\pagename| and |\headtoname| are
+% used within |\pagestyle| layouts and some additional packages.
+%
+% \begin{macrocode}
+\def\ccname{cc}
+\def\enclname{encl}
+\def\pagename{Page}
+\def\headtoname{To}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsubsection{Date}
+%
+% \begin{macro}{\today}
+% The |\@date| field, which appears in the letterhead, defaults to |\today|. The |\today|
+% value will be adjusted by the linguistic packages (\textsf{babel} or \textsf{polyglossia}).
+%
+% \begin{macrocode}
+\def\today
+{\ifcase\month\or
+ January\or February\or March\or April\or May\or June\or
+ July\or August\or September\or October\or November\or December\fi
+ \space\number\day, \number\year}
% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Two column mode}
+%
+% \begin{macro}{\columnsep}
+% This is tricky! The idea is to align the columns with the addresses. In a default
+% (A4) letter, the second column will align with the recipient's address and the date.
%
-% \subsubsection{Footnotes Parameters}
% \begin{macrocode}
-\renewcommand\footnoterule
- {\kern-3\p@\hrule\@width.4\columnwidth\kern2.6\p@}
-\newcommand\@makefntext[1]
- {\noindent\hb@xt@\z@{\hss\@makefnmark}#1}
+\columnsep36\p@
% \end{macrocode}
+% \end{macro}
%
-% \subsubsection{Column Mode}
+% \subsubsection{The page style}
+%
+% We have |\pagetyle{plain}| pages in this document class (except the letterhead
+% page which has |\thispagestyle{firspage}|). We use arabic page numbers.
+%
% \begin{macrocode}
-\columnsep10\p@\columnseprule0\p@
+\pagestyle{plain}
\pagenumbering{arabic}
-\raggedbottom\onecolumn
% \end{macrocode}
%
-% \subsection{Internal Declarations}
-% The following macros are internal to the chletter class.
+% \subsection{Later initializations}
+%
+% This code handles the class options |leftwin|, |leftsig|, |foldmark|, |footfill| and
+% |twocolumn| (retrieved by the associated booleans). It defines the default layout of the
+% letter and would be very interesting for those who wish to completely customize the letter
+% appearance by redefining the relevant macros.
%
-% \subsubsection{Tokenizers}
-% \begin{macro}{\ch@pfr}
-% \begin{macro}{\ch@pto}
-% \begin{macro}{\ch@cut}
-% These macros are tokenizers which split their argument
-% depending on what is defined or not by the user.
-% They build |\fromstreet|, |\fromplace|, |\toname|,
-% |\toaddress| and |\returnaddress|. Note that if
-% |\returnaddress| is not empty, it will be left in place.
+% \subsubsection{Letterhead layout}
+%
+% \begin{macro}{\titletopmatter}
+% \begin{macro}{\titlemidmatter}
+% \begin{macro}{\titlebotmatter}
+% The default layout of the letterhead is defined here, taking in account the class option
+% |leftwin|. |\titletopmatter|, |\titlemidmatter| and |\titlebotmatter| are three strips of
+% |\titletopheight|, |\titlemidheight| and |\titlebotheight| respective heights. Please note
+% the usage of |\splitfield{...}{...}| which cuts a strip in two columns of |\adressmargin|
+% and |\addresswidth| respective widths.
+%
+% \begin{macrocode}
+\if@leftwin
+ \def\titletopmatter%
+ {\splitfield
+ {}{\fromlocation\par\fromname\par\fromaddress\par\telephonenum}}
+ \def\titlemidmatter%
+ {\returnaddress\par\toname\par\toaddress}
+ \def\titlebotmatter%
+ {\splitfield
+ {}{\@date}}
+% \end{macrocode}
% \begin{macrocode}
-\newcommand\ch@pfr[1]
- {\expandafter\ch@cut#1\\\@empty
- \ifx\ch@sec\@empty\else\expandafter\ch@cut#1\@empty\fi
- \let\fromstreet\ch@fir\let\fromplace\ch@sec
- \ifx\@empty\returnaddress
- \ifx\@empty\fromname
- \ifx\@author\ch@aut\def\returnaddress{\fromstreet, \fromplace}
- \else\def\returnaddress{\@author, \fromstreet, \fromplace}\fi
- \else\def\returnaddress{\fromname, \fromstreet, \fromplace}\fi\fi}
-\newcommand\ch@pto[1]
- {\expandafter\ch@cut#1\\\@empty
- \ifx\ch@sec\@empty\else\expandafter\ch@cut#1\@empty\fi
- \let\toname\ch@fir\let\toaddress\ch@sec}
-\def\ch@cut#1\\#2\@empty{\def\ch@fir{#1}\def\ch@sec{#2}}
+\else
+ \def\titletopmatter%
+ {\splitfield
+ {\fromlocation\par\fromname\par\fromaddress\par\telephonenum}{\@date}}
+ \def\titlemidmatter%
+ {\splitfield
+ {}{\returnaddress\par\toname\par\toaddress}}
+ \def\titlebotmatter%
+ {}\fi
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \subsubsection{Extractors}
-% \begin{macro}{\ch@put}
-% \begin{macro}{\ch@pul}
-% These two macros are used by some commands (|\ps|, |\cc|, etc.) to position some text
-% outside of the margin, following their optional argument.
+% \begin{macro}{\splitfield}
+% The letterhead is divided in three vertically stacked strips of |\titlewidth| width, named
+% respectively |\titletopmatter|, |titlemidmatter| and |titlebotmatter| (see above). The
+% purpose of this command is to divide a strip in two columns, the first one of |\addressmargin|
+% width, the second one of |\addresswidth| width (computed on the fly by |\maketitle|, see
+% above). The letterhead may contain graphics (a logo for example), so we have to cope with
+% the relative vertical placement of text and imported pictures, hence the |\hbox| and |\strut|
+% in the definitions of the parboxes.
+%
% \begin{macrocode}
-\newcommand{\ch@put}[3][r]
- {\par\noindent\hspace{-\oddsidemargin}\makebox[\oddsidemargin][#1]{#2~}#3}
-\newcommand{\ch@pul}[2][r]
- {\noindent\ifx l#1\hspace{-\oddsidemargin}\fi#2}
+\long\def\splitfield#1#2%
+{\parbox[b][\baselineskip][t]{\addressmargin}{\hb@xt@\z@{}{#1}\strut}%
+ \parbox[b][\baselineskip][t]{\addresswidth}{\hb@xt@\z@{}{#2}\strut}}
% \end{macrocode}
% \end{macro}
+%
+% \subsubsection{Signature layout}
+%
+% \begin{macro}{\closingmatter}
+% |\closingmatter| is output by the |\closing| command and can contain any piece of text or
+% code. |\fooftill| is an extra glue for better letter foot balancing (see below). Please
+% note the crafty use of the |\ps| command. Also remember that |\leftmargin| and |\labelwidth|
+% values are changed by this |\closingmatter|.
+%
+% \begin{macrocode}
+\if@leftsig
+ \def\closingmatter%
+ {\leftmargin2\parindent
+ \vskip4\bigskipamount
+ \ps{}{\fromsig}
+ \vskip2\bigskipamount plus\footfill
+ \labelwidth3\labelwidth
+ \advance\labelwidth-\labelsep}
+% \end{macrocode}
+% \begin{macrocode}
+\else
+ \def\closingmatter%
+ {\leftmargin\longindentation
+ \vskip4\bigskipamount
+ \ps{}{\fromsig}
+ \vskip2\bigskipamount plus\footfill
+ \leftmargin2\parindent
+ \labelwidth3\labelwidth
+ \advance\labelwidth-\labelsep}\fi
+% \end{macrocode}
% \end{macro}
%
-% \subsubsection{Flags}
-% \begin{macro}{\ch@lab}
-% \begin{macro}{\ch@aut}
-% These are flags used by the letter environment and the titling commands. |\ch@lab| defines
-% whether or not a label page should be generated, and |\ch@aut| knows if |\@author| has been
-% altered by the user.
+% \subsubsection{Fold mark}
+%
+% \begin{macro}{\foldmark}
+% The |foldmark| class option alters the |\foldmark| macro, which causes a line to be added
+% between the letterhead and the main text. Default is |\@empty|.
+%
% \begin{macrocode}
-\let\ch@lab=f\let\ch@aut=\@author
+\if@foldmark\def\foldmark{\hrule\@width6\fboxsep\@height\fboxrule}
+\else\let\foldmark\@empty\fi
% \end{macrocode}
% \end{macro}
+%
+% \subsubsection{Letter footer}
+%
+% \begin{macro}{\footfill}
+% A conditionnal definition of |\footfill| will alter the layout of |\closingmatter|
+% (see above), adding an extra vertical glue after the signature. Default is |\@empty|.
+%
+% \begin{macrocode}
+\if@footfill\def\footfill{1fill}
+\else\let\footfill\z@\fi
+% \end{macrocode}
% \end{macro}
%
-% \subsubsection{Dummies}
-% These commands are here only for compatibility with the standard letter class.
+% \subsubsection{Two column mode}
+%
+% The column separator (|\columnsep|) is initialized earlier in the class code.
+% Please note that in one column mode we reverse the position of the margin paragraphs.
+%
% \begin{macrocode}
-\def\@startlabels{}\let\@mlabel=\@gobbletwo
+\if@twocolumn\twocolumn\sloppy
+\else\onecolumn\reversemarginpar\fi
% \end{macrocode}
%
-% \subsection{End Of Class}
+% \subsection{Legacy}
+%
+% Unfortunately some widely spread packages still relie on this!
+%
% \begin{macrocode}
-%</chletter>
+\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}
% \end{macrocode}
-%\newpage
-%\tableofcontents
-% \Finale
%
-\endinput \ No newline at end of file
+% \begin{macrocode}
+%</chletter.cls>
+% \end{macrocode}
+%
+% \pagebreak
+%
+% \section{Letter template}
+%
+% \setcounter{CodelineNo}{0}
+%
+% The following \LaTeX\ document is intended to be used as a template. It will also
+% compile with the standard \textsf{letter} class and the older version of the
+% \textsf{chletter} class.\bigskip
+%
+% Please note that the \textsf{chextras} companion package will simplify the preparation of
+% Swiss documents by setting up linguistic packages, font encoding and document layout.
+% Look at \textsf{chextras} documentation for further information.
+%
+% \begin{macrocode}
+%<*chlettmp.tex>
+% \end{macrocode}
+%
+% \begin{macrocode}
+\documentclass{chletter}
+
+%%\usepackage[english,black]{chextras}
+
+\author{My name}
+\address{My address\\My City}
+\telephone{My phone\\My email}
+\date{My location, \today}
+
+\begin{document}
+\begin{letter}{Name\\Address\\City}
+
+\opening{Dear \toname,}
+
+Body text.
+
+\closing{Yours truly,}
+
+\encl{Enclosures}
+\cc{Other recipients}
+
+\end{letter}
+\end{document}
+% \end{macrocode}
+% \begin{macrocode}
+%</chlettmp.tex>
+% \end{macrocode}
+%
+% \pagebreak
+%
+% \Finale
+% \PrintIndex
+\endinput
+
+
diff --git a/Master/texmf-dist/source/latex/chletter/chletter.ins b/Master/texmf-dist/source/latex/chletter/chletter.ins
index 44b089c8898..5bf5aad4063 100644
--- a/Master/texmf-dist/source/latex/chletter/chletter.ins
+++ b/Master/texmf-dist/source/latex/chletter/chletter.ins
@@ -1,17 +1,62 @@
%%
-%% Copyright 2008 Boris Oriet
-%% The licence is LPPL.
+%% Copyright 2008, 2009, 2010 by Boris Oriet <http://boris.oriet.net>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX version
+%% 2008/05/04 or later.
+%%
+%% This file has the LPPL maintenance status "author-maintained".
%%
\input docstrip
\keepsilent
+
\preamble
-Copyright 2008 Boris Oriet
-The licence is LPPL.
+Copyright 2008, 2009, 2010 by Boris Oriet <http://boris.oriet.net>
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX version
+2008/05/04 or later.
+
+This file has the LPPL maintenance status "author-maintained".
\endpreamble
-\generateFile{chletter.cls}{t}{\from{chletter.dtx}{chletter}}
-\endbatchfile
+\generate{\file{chletter.cls}{\from{chletter.dtx}{chletter.cls}}}
+
+\nopreamble
+\nopostamble
+\generate{\file{chlettmp.tex}{\from{chletter.dtx}{chlettmp.tex}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* chletter.cls *}
+\Msg{* *}
+\Msg{* The chlettemp.tex file can be used as a letter template. *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file chletter.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/Master/texmf-dist/tex/latex/chletter/chletter.cls b/Master/texmf-dist/tex/latex/chletter/chletter.cls
index 5219d245d7a..7ce0810e227 100644
--- a/Master/texmf-dist/tex/latex/chletter/chletter.cls
+++ b/Master/texmf-dist/tex/latex/chletter/chletter.cls
@@ -4,14 +4,24 @@
%%
%% The original source files were:
%%
-%% chletter.dtx (with options: `chletter')
+%% chletter.dtx (with options: `chletter.cls')
%%
-%% Copyright 2008 Boris Oriet
-%% The licence is LPPL.
+%% Copyright 2008, 2009, 2010 by Boris Oriet <http://boris.oriet.net>
%%
-\NeedsTeXFormat{LaTeX2e}[1996/06/01]
-\ProvidesClass{chletter}[2008/07/29 v1.0 Swiss Letter document class]
-\newcommand\@ptsize{}
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX version
+%% 2008/05/04 or later.
+%%
+%% This file has the LPPL maintenance status "author-maintained".
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{chletter}[2010/10/10 v2.0 Swiss letter document class]
\DeclareOption{a4paper}{\paperheight297mm\paperwidth210mm}
\DeclareOption{a5paper}{\paperheight210mm\paperwidth148mm}
\DeclareOption{b5paper}{\paperheight250mm\paperwidth176mm}
@@ -19,187 +29,291 @@
\DeclareOption{legalpaper}{\paperheight14in\paperwidth8.5in}
\DeclareOption{executivepaper}{\paperheight10.5in\paperwidth7.25in}
\DeclareOption{landscape}
- {\@tempdima\paperheight
- \paperheight\paperwidth
- \paperwidth\@tempdima}
-\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
-\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
-\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
+{\@tempdima\paperheight\paperheight\paperwidth\paperwidth\@tempdima}
+\DeclareOption{10pt}{\def\@ptsize{0}}
+\DeclareOption{11pt}{\def\@ptsize{1}}
+\DeclareOption{12pt}{\def\@ptsize{2}}
\DeclareOption{oneside}{\@twosidefalse\@mparswitchfalse}
\DeclareOption{twoside}{\@twosidetrue\@mparswitchtrue}
-\DeclareOption{draft}{\setlength\overfullrule{5\p@}}
-\DeclareOption{final}{\setlength\overfullrule{0\p@}}
+\DeclareOption{draft}{\overfullrule5\p@}
+\DeclareOption{final}{\overfullrule\z@}
\DeclareOption{leqno}{\input{leqno.clo}}
\DeclareOption{fleqn}{\input{fleqn.clo}}
-\ExecuteOptions{a4paper,11pt,oneside,onecolumn,final}
-\ProcessOptions
+\DeclareOption{onecolumn}{\@twocolumnfalse\@leftsigfalse}
+\DeclareOption{twocolumn}{\@twocolumntrue\@leftsigtrue}
+\DeclareOption{leftwin}{\@leftwintrue}
+\DeclareOption{leftsig}{\@leftsigtrue}
+\DeclareOption{foldmark}{\@foldmarktrue}
+\DeclareOption{footfill}{\@footfilltrue}
+\newif\if@leftwin
+\newif\if@leftsig
+\newif\if@foldmark
+\newif\if@footfill
+\ExecuteOptions{a4paper,10pt}
+\ProcessOptions\relax
\input{size1\@ptsize.clo}
-\parskip9\p@\parindent18\p@
-\newdimen\letterskip\newdimen\letterindent
-\brokenpenalty10000
-\topmargin\z@\topskip12\p@\headheight12\p@\headsep24\p@
-\footskip36\p@\footnotesep12\p@\skip\footins18\p@
-\textwidth\paperwidth\addtolength\textwidth{-180\p@}
-\textheight\paperheight\addtolength\textheight{-216\p@}
-\oddsidemargin36\p@\evensidemargin0\p@
-\marginparwidth48\p@\marginparsep12\p@\marginparpush6\p@
-\newdimen\addressmargin\addressmargin246\p@
-\newdimen\longindentation\newdimen\indentedwidth
-\newdimen\fromtop\fromtop\z@\addtolength\fromtop{-\headheight}
-\addtolength\fromtop{-\headsep}\addtolength\fromtop{-\baselineskip}
-\newdimen\fromheight\fromheight60\p@\newdimen\toheight\toheight96\p@
-\newdimen\sigspace\sigspace6\bigskipamount
-\def\ps@plain
- {\let\@oddhead\@empty
- \def\@oddfoot
- {\footnotesize{\hfil\pagename~\thepage}}
- \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}
-\def\ps@headings
- {\def\@oddhead
- {\footnotesize{\hspace*{-\oddsidemargin}\headtoname~\toname\hfil\pagename~\thepage}}
- \def\@oddfoot
- {\footnotesize{\hspace*{-\oddsidemargin}\leftmark\hfil\rightmark}}
- \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}
-\def\ps@myheadings
- {\def\@oddhead
- {\footnotesize{\hspace*{-\oddsidemargin}\leftmark\hfil\rightmark}}
- \def\@oddfoot
- {\footnotesize{\hfil\pagename~\thepage}}
- \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}
-\def\ps@firstpage
- {\let\@oddhead\@empty
- \def\@oddfoot
- {\footnotesize{\hspace*{-\oddsidemargin}\leftmark\hfil\rightmark}}
- \let\@evenhead\@oddhead\let\@evenfoot\@oddfoot}
-\newcommand*{\name}[1]{\def\fromname{#1}}\name{}
-\newcommand*{\signature}[1]{\def\fromsig{#1}}\signature{}
-\newcommand*{\address}[1]{\def\fromaddress{#1}}\address{}
-\newcommand*{\location}[1]{\def\fromlocation{#1}}\location{}
-\newcommand*{\telephone}[1]{\def\telephonenum{#1}}\telephone{}
-\newcommand*{\return}[1]{\def\returnaddress{#1}}\return{}
-\def\toname{}\def\toaddress{}\def\fromstreet{}\def\fromplace{}
-\newcommand*{\ccname}{cc}\newcommand*{\enclname}{encl}
-\newcommand*{\pagename}{Page}\newcommand*{\headtoname}{To}
-\newcommand*{\today}
- {\ifcase\month\or January\or February\or March\or April\or May\or June\or
- July\or August\or September\or October\or November\or December\fi
- \space\number\day, \number\year}
-\newcommand*{\maketitle}[1][p]
- {\vspace*{-\parskip}\ifx n#1\vspace*{\fromheight}\else\ifx r#1\vspace*{\fromheight}%
- \else\noindent\hspace{-\oddsidemargin}\parbox[t][\fromheight]{\addressmargin}
- {\ifx\ch@aut\@author
- \else\leavevmode\@author\\\fi
- \ifx\@empty\fromlocation
- \else\fromlocation\\\fi
- \ifx\@empty\fromaddress
- \else\fromaddress\par\medskip\fi
- \ifx\@empty\telephonenum
- \else{\footnotesize\telephonenum\par\medskip}\fi}%
- \parbox[t]{\indentedwidth}{~\\\@date}\par\vspace*{-\parskip}\fi\fi
- \noindent\hspace{\longindentation}\parbox[t][\toheight]{\indentedwidth}
- {\ifx p#1\else\ifx n#1\else{\footnotesize\returnaddress\par\medskip}\fi\fi
- \leavevmode\toname\\\toaddress\\}\vspace*{-\parskip}\par}
-\newcommand{\opening}[2][n]
- {\ifx i#1\parindent\letterindent\else\parindent\z@\fi\par\noindent#2\par\medskip}
-\newcommand{\closing}[2][n]
- {\ifx i#1\parindent\letterindent\else\parindent\z@\fi\par\medskip
- #2\par\vspace*{.5\sigspace}
- \noindent\hspace\longindentation
- \ifx\@empty\fromsig
- \ifx\@empty\fromname\@author\else\fromname\fi
- \else\fromsig\fi
- \par\vspace*{.5\sigspace}}
-\newcommand*{\longindent}[1]
- {\par\noindent\hspace{\longindentation}\parbox[t]{\indentedwidth}{#1}\par\smallskip}
-\newcommand*{\conc}[2][r]{\ch@pul[#1]{\textbf{#2}}\par\bigskip}
-\newcommand*{\ps}[2][r]{\ch@put[#1]{#2}{\ignorespaces}}
-\newcommand*{\cc}[2][r]{\ch@put[#1]{\emph{\ccname}}{#2}\par\medskip}
-\newcommand*{\encl}[2][r]{\ch@put[#1]{\emph{\enclname}}{#2}\par\medskip}
-\newcommand*{\subsubsection}[2][r]{\par\ch@pul[#1]{\textbf{#2}}\par}
-\newcommand*{\subsection}[2][r]{\smallskip\subsubsection[#1]{#2}}
-\newcommand*{\section}[2][r]{\medskip\subsubsection[#1]{#2}}
-\newcommand*{\subparagraph}[1]{\par\textbf{#1}~}
-\newcommand*{\paragraph}[1]{\par\noindent\textbf{#1}~}
-\newcommand*{\makelabels}[1][r]{\let\ch@lab#1}
-\newenvironment*{letter}[2][p]
- {\ch@pfr{\fromaddress}\ch@pto{#2}
- \letterindent\parindent\parindent\z@\letterskip\parskip
- \longindentation\addressmargin\addtolength\longindentation{-\oddsidemargin}
- \indentedwidth\textwidth\addtolength\indentedwidth{-\longindentation}
- \newpage\c@page\@ne\c@footnote\z@\pagestyle{plain}\thispagestyle{empty}
- \vspace*{\fromtop}\maketitle[#1]}
- {\vfil\pagebreak
- \if f\ch@lab
- \else\newpage\thispagestyle{empty}\vspace*{\fromtop}\maketitle[\ch@lab]\fi}
-\leftmargini\parindent\leftmargin\leftmargini
-\leftmarginii\leftmargini\leftmarginiii\leftmargini\leftmarginiv\leftmargini
-\labelsep.25\parindent\labelwidth.75\parindent
-\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{\textendash}
-\newcommand\labelitemiii{\textasteriskcentered}
-\newcommand\labelitemiv{\textperiodcentered}
-\newenvironment{description}
- {\list{}{\labelwidth\z@\itemindent-\leftmargin
- \let\makelabel\descriptionlabel}}{\endlist}
-\newcommand*{\descriptionlabel}[1]
- {\hspace\labelsep\textbf{#1}}
-\newenvironment{verse}
- {\let\\=\@centercr
- \list{}{\itemsep\z@\itemindent-\parindent
- \listparindent\itemindent\rightmargin\leftmargin
- \addtolength\leftmargin\parindent}
- \item[]}{\endlist}
-\newenvironment{quotation}
- {\list{}{\listparindent\parindent
- \itemindent\listparindent\rightmargin\leftmargin}
- \item[]}{\endlist}
-\newenvironment{quote}
- {\list{}{\rightmargin\leftmargin}
- \item[]}{\endlist}
-\arraycolsep5\p@\tabcolsep6\p@
-\arrayrulewidth.4\p@\doublerulesep2\p@
+\newcounter{letter}
+\newdimen\titlehead
+\newdimen\titletopheight
+\newdimen\titlemidheight
+\newdimen\titlebotheight
+\newdimen\titlemargin
+\newdimen\titlewidth
+\newdimen\addressmargin
+\newdimen\addresswidth
+\newdimen\longindentation
+\newdimen\indentedwidth
+\parskip9\p@
+\parindent18\p@
+\normallineskip\z@
+\headheight12\p@
+\headsep24\p@
+\footskip36\p@
+\textwidth\paperwidth
+\advance\textwidth-9536004sp
+\titlewidth\textwidth
+\advance\textwidth-36\p@
+\textheight\paperheight
+\advance\textheight-14093310sp
+\oddsidemargin36\p@
+\evensidemargin\z@
+\marginparwidth48\p@
+\marginparsep6\p@
+\marginparpush6\p@
+\topmargin\z@
+\footnotesep12\p@
+\skip\footins12\p@
+\titlehead12\p@
+\titletopheight72\p@
+\titlemidheight72\p@
+\titlebotheight72\p@
+\addresswidth190\p@
+\def\ps@plain%
+{\let\@oddhead\@empty
+ \let\@evenhead\@empty
+ \def\@oddfoot{\footnotesize\hfil\pagename~\thepage}
+ \def\@evenfoot{\footnotesize\pagename~\thepage\hfil}}
+\def\ps@firstpage%
+{\let\@oddhead\@empty
+ \let\@evenhead\@empty
+ \def\@oddfoot{\footnotesize\leftmark\hfil\rightmark}
+ \def\@evenfoot{\footnotesize\rightmark\hfil\leftmark}}
+\def\ps@headings%
+{\def\@oddhead{\footnotesize\headtoname~\toname\hfil\pagename~\thepage}
+ \def\@evenhead{\footnotesize\pagename~\thepage\hfil}
+ \def\@oddfoot{\footnotesize\leftmark\hfil\rightmark}
+ \def\@evenfoot{\footnotesize\rightmark\hfil\leftmark}}
+\def\ps@myheadings%
+{\def\@oddhead{\footnotesize\leftmark\hfil\rightmark}
+ \def\@evenhead{\footnotesize\rightmark\hfil\leftmark}
+ \def\@oddfoot{\footnotesize\hfil\pagename~\thepage}
+ \def\@evenfoot{\footnotesize\pagename~\thepage\hfil}}
+\long\def\name#1{\def\fromname{#1}}
+\long\def\signature#1{\def\fromsig{#1}}
+\long\def\location#1{\def\fromlocation{#1}}
+\long\def\address#1{\def\fromaddress{#1}}
+\long\def\telephone#1{\def\telephonenum{\vtop{\footnotesize#1}}}
+\long\def\return#1{\def\returnaddress{\underbar{\textsuperscript{#1}}}}
+\def\makelabels%
+{\def\startlabels%
+ {\let\titletopmatter\@empty
+ \let\titlebotmatter\@empty
+ \let\foldmark\@empty}}
+\def\maketitle%
+{\ifdim\addressmargin=\z@
+ \addressmargin\titlewidth
+ \advance\addressmargin-\addresswidth
+ \else
+ \addresswidth\titlewidth
+ \advance\addresswidth-\addressmargin\fi
+ \longindentation\titlemargin
+ \advance\longindentation-\oddsidemargin
+ \clearpage
+ \if@twoside\ifodd\c@page
+ \else\thispagestyle{empty}\hb@xt@\z@{}\clearpage\fi\fi
+ \if@twocolumn\twocolumn[\@maketitle\leavevmode\vskip-\topskip]
+ \else\vbox{\@parboxrestore\@maketitle}\vskip-\parskip\fi
+ \advance\longindentation\addressmargin
+ \indentedwidth\textwidth
+ \advance\indentedwidth-\longindentation}
+\def\@maketitle%
+{\vskip-\topmargin\vskip-\baselineskip
+ \vskip\titlehead\vskip-\headheight\vskip-\headsep
+ \leftskip\longindentation\rightskip\textwidth
+ \advance\rightskip-\paperwidth
+ \advance\rightskip-\titlemargin
+ \parbox[t][\titletopheight]{\titlewidth}
+ {\hb@xt@\z@{}\titletopmatter\strut}\par
+ \parbox[t][\titlemidheight]{\titlewidth}
+ {\hb@xt@\z@{}\titlemidmatter\strut}\par
+ \parbox[t][\titlebotheight]{\titlewidth}
+ {\hb@xt@\z@{}\titlebotmatter\strut}\par
+ \leftskip-\oddsidemargin\advance\leftskip-1in
+ \parbox[b][\z@]{\paperwidth}{\foldmark}\par}
+\def\letter{\futurelet\@let@token\ch@let}\def\ch@let%
+{\ifx\@let@token[\expandafter\@letter\else\expandafter\ch@lea\fi}
+\long\def\ch@lea#1 {\@letter[n]{#1} }
+\long\def\@letter[#1]#2
+{\ifx#1n\parindent\z@\fi\ifx\@null#2\else\@processto#2\\@@@
+ \ifx\@empty\toaddress\else\@processto#2@@@\fi\fi
+ \maketitle\thispagestyle{firstpage}
+ \global\c@page\@ne\global\c@footnote\z@\global\advance\c@letter\@ne}
+\long\def\@processto#1\\#2@@@{\def\toname{#1}\def\toaddress{#2}}
+\def\endletter{\removelastskip\ifx\startlabels\undefined\else%
+ \startlabels\maketitle\thispagestyle{empty}\fi\clearpage}
+\def\stopbreaks{\interlinepenalty\@M\def\par{\@@par\nobreak}}
+\def\startbreaks{\interlinepenalty100\def\par{\@@par}}
+\def\opening{\futurelet\@let@token\ch@ope}\def\ch@ope%
+{\ifx\@let@token\bgroup\expandafter\ch@opa\else\expandafter\@opening\fi}
+\def\ch@opa#1{\ifx\@null#1\else\def\salutation{#1}\fi\@opening}
+\def\@opening{\par\salutation\par\medskip}
+\def\closing{\futurelet\@let@token\ch@clo}\def\ch@clo%
+{\ifx\@let@token\bgroup\expandafter\ch@cla\else\expandafter\@closing\fi}
+\def\ch@cla#1{\ifx\@null#1\else\def\valediction{#1}\fi\@closing}
+\def\@closing{\par\medskip\stopbreaks\valediction
+ \samepage\par\closingmatter\par\startbreaks}
+\def\object{\futurelet\@let@token\ch@obj}\def\ch@obj%
+{\ifx\@let@token\bgroup\expandafter\ch@oba\else\expandafter\@object\fi}
+\def\ch@oba#1{\ifx\@null#1\else\title{#1}\fi\@object}
+\def\@object{\noindent\@title\par\bigskip}
+\long\def\ps#1#2{\begin{list}{}{}\item[#1]#2\end{list}}
+\long\def\cc#1{\ps{\ccname}{#1}}
+\long\def\encl#1{\ps{\enclname}{#1}}
+\long\def\subparagraph#1{\par\textbf{#1}\hskip\labelsep}
+\long\def\paragraph#1{\par\noindent\textbf{#1}\hskip\labelsep}
+\long\def\subsubsection#1{\par\noindent\textbf{#1}\par\nobreak}
+\long\def\subsection#1{\smallskip\subsubsection{#1}}
+\long\def\section#1{\medskip\subsubsection{#1}}
+\def\description
+{\list{}
+ {\labelwidth\z@
+ \itemindent-\leftmargin
+ \let\makelabel\descriptionlabel}}\def\enddescription{\endlist}
+\def\descriptionlabel#1{\hskip\labelsep\textbf{#1}}
+\def\verse
+{\let\\\@centercr
+ \list{}
+ {\itemsep\z@
+ \itemindent-\parindent
+ \listparindent\itemindent
+ \rightmargin\leftmargin
+ \advance\leftmargin\parindent}
+ \item\relax}\def\endverse{\endlist}
+\def\quotation
+{\list{}
+ {\listparindent\parindent
+ \itemindent\listparindent
+ \rightmargin\leftmargin}
+ \item\relax}\def\endquotation{\endlist}
+\def\quote
+{\list{}
+ {\rightmargin\leftmargin}
+ \item\relax}\def\endquote{\endlist}
+\def\@listI{}
+\let\@listi\@listI
+\let\@listii\@listI
+\let\@listiii\@listI
+\let\@listiv\@listI
+\def\theenumi{\@arabic\c@enumi}
+\def\theenumii{\@alph\c@enumii}
+\def\theenumiii{\@roman\c@enumiii}
+\def\theenumiv{\@Alph\c@enumiv}
+\def\labelenumi{\theenumi.}
+\def\labelenumii{(\theenumii)}
+\def\labelenumiii{\theenumiii.}
+\def\labelenumiv{\theenumiv.}
+\def\p@enumii{\theenumi}
+\def\p@enumiii{\theenumi(\theenumii)}
+\def\p@enumiv{\p@enumiii\theenumiii}
+\def\labelitemi{\textbullet}
+\def\labelitemii{\textbf{\textendash}}
+\def\labelitemiii{\textasteriskcentered}
+\def\labelitemiv{\textperiodcentered}
+\labelsep6\p@\labelwidth12\p@\leftmargin18\p@
+\topsep\z@\partopsep3\p@\itemsep\z@\parsep3\p@
+\arraycolsep5\p@
+\tabcolsep6\p@
+\arrayrulewidth.4\p@
+\doublerulesep2\p@
\tabbingsep\labelsep
\skip\@mpfootins=\skip\footins
-\fboxsep3\p@\fboxrule.4\p@
-\renewcommand\theequation{\@arabic\c@equation}
-\renewcommand\footnoterule
- {\kern-3\p@\hrule\@width.4\columnwidth\kern2.6\p@}
-\newcommand\@makefntext[1]
- {\noindent\hb@xt@\z@{\hss\@makefnmark}#1}
-\columnsep10\p@\columnseprule0\p@
+\def\theequation{\@arabic\c@equation}
+\fboxsep3\p@
+\fboxrule.4\p@
+\long\def\@makefntext#1{\noindent\hb@xt@\z@{\hss\@makefnmark}#1}
+\def\fromname{\@author}
+\def\fromsig{\@author}
+\let\fromlocation\@empty
+\let\fromaddress\@empty
+\let\telephonenum\@empty
+\def\returnaddress{\null}
+\let\toname\@empty
+\let\toaddress\@empty
+\let\salutation\@empty
+\let\valediction\@empty
+\def\ccname{cc}
+\def\enclname{encl}
+\def\pagename{Page}
+\def\headtoname{To}
+\def\today
+{\ifcase\month\or
+ January\or February\or March\or April\or May\or June\or
+ July\or August\or September\or October\or November\or December\fi
+ \space\number\day, \number\year}
+\columnsep36\p@
+\pagestyle{plain}
\pagenumbering{arabic}
-\raggedbottom\onecolumn
-\newcommand\ch@pfr[1]
- {\expandafter\ch@cut#1\\\@empty
- \ifx\ch@sec\@empty\else\expandafter\ch@cut#1\@empty\fi
- \let\fromstreet\ch@fir\let\fromplace\ch@sec
- \ifx\@empty\returnaddress
- \ifx\@empty\fromname
- \ifx\@author\ch@aut\def\returnaddress{\fromstreet, \fromplace}
- \else\def\returnaddress{\@author, \fromstreet, \fromplace}\fi
- \else\def\returnaddress{\fromname, \fromstreet, \fromplace}\fi\fi}
-\newcommand\ch@pto[1]
- {\expandafter\ch@cut#1\\\@empty
- \ifx\ch@sec\@empty\else\expandafter\ch@cut#1\@empty\fi
- \let\toname\ch@fir\let\toaddress\ch@sec}
-\def\ch@cut#1\\#2\@empty{\def\ch@fir{#1}\def\ch@sec{#2}}
-\newcommand{\ch@put}[3][r]
- {\par\noindent\hspace{-\oddsidemargin}\makebox[\oddsidemargin][#1]{#2~}#3}
-\newcommand{\ch@pul}[2][r]
- {\noindent\ifx l#1\hspace{-\oddsidemargin}\fi#2}
-\let\ch@lab=f\let\ch@aut=\@author
-\def\@startlabels{}\let\@mlabel=\@gobbletwo
+\if@leftwin
+ \def\titletopmatter%
+ {\splitfield
+ {}{\fromlocation\par\fromname\par\fromaddress\par\telephonenum}}
+ \def\titlemidmatter%
+ {\returnaddress\par\toname\par\toaddress}
+ \def\titlebotmatter%
+ {\splitfield
+ {}{\@date}}
+\else
+ \def\titletopmatter%
+ {\splitfield
+ {\fromlocation\par\fromname\par\fromaddress\par\telephonenum}{\@date}}
+ \def\titlemidmatter%
+ {\splitfield
+ {}{\returnaddress\par\toname\par\toaddress}}
+ \def\titlebotmatter%
+ {}\fi
+\long\def\splitfield#1#2%
+{\parbox[b][\baselineskip][t]{\addressmargin}{\hb@xt@\z@{}{#1}\strut}%
+ \parbox[b][\baselineskip][t]{\addresswidth}{\hb@xt@\z@{}{#2}\strut}}
+\if@leftsig
+ \def\closingmatter%
+ {\leftmargin2\parindent
+ \vskip4\bigskipamount
+ \ps{}{\fromsig}
+ \vskip2\bigskipamount plus\footfill
+ \labelwidth3\labelwidth
+ \advance\labelwidth-\labelsep}
+\else
+ \def\closingmatter%
+ {\leftmargin\longindentation
+ \vskip4\bigskipamount
+ \ps{}{\fromsig}
+ \vskip2\bigskipamount plus\footfill
+ \leftmargin2\parindent
+ \labelwidth3\labelwidth
+ \advance\labelwidth-\labelsep}\fi
+\if@foldmark\def\foldmark{\hrule\@width6\fboxsep\@height\fboxrule}
+\else\let\foldmark\@empty\fi
+\if@footfill\def\footfill{1fill}
+\else\let\footfill\z@\fi
+\if@twocolumn\twocolumn\sloppy
+\else\onecolumn\reversemarginpar\fi
+\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}
\endinput
%%
%% End of file `chletter.cls'.