From bc4228893e34a9b147b3d349b63f0f28743232b3 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 3 Jan 2010 23:20:42 +0000
Subject: isodoc update (3jan10)

git-svn-id: svn://tug.org/texlive/trunk@16590 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/isodoc/isodoc.dtx | 574 ++++++++++++++---------
 1 file changed, 353 insertions(+), 221 deletions(-)

(limited to 'Master/texmf-dist/source/latex/isodoc/isodoc.dtx')

diff --git a/Master/texmf-dist/source/latex/isodoc/isodoc.dtx b/Master/texmf-dist/source/latex/isodoc/isodoc.dtx
index 37d2311710f..0f725ef2ec9 100644
--- a/Master/texmf-dist/source/latex/isodoc/isodoc.dtx
+++ b/Master/texmf-dist/source/latex/isodoc/isodoc.dtx
@@ -22,39 +22,24 @@
 %<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<class>\ProvidesClass{isodoc}%
 %<*class>
-           [2009/06/15 v0.6 isodoc class for letters and invoices]
+           [2009/11/16 v0.7 isodoc class for letters and invoices]
 %</class>
 %<class>\ifnum\pdfoutput=1\else\ClassError{isodoc}{Compile me with pdflatex!}{}
 %<class>\fi
 %<*driver>
-\documentclass[11pt]{ltxdoc}
-\usepackage[
-   verbose,
-   pdftex,
-   paper=a4paper,
-   margin=35mm,
-   top=15mm,
-   bottom=20mm,
-   nohead
-]{geometry}
+\documentclass{ltxdoc}
+\usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry}
 \usepackage{txfonts}\pdfprotrudechars=1
-\usepackage{ctable,pdfpages,paralist,marvosym,sverb,ltablex}
-\usepackage[colorlinks]{hyperref}
+\usepackage[l2tabu,orthodox]{nag}
+\usepackage{ctable,pdfpages,paralist,eurosym,sverb,ltablex}
 \parindent0pt\parskip1ex
 \EnableCrossrefs
 \PageIndex
-\RecordChanges
+\IndexPrologue{\section*{Index}}
 \newcommand{\FIG}[3]{ % pdfname label caption
-  \begin{figure}
-    \begin{center}
-      \fboxsep=0pt
-      \fbox{\includegraphics[width=\hsize]{#1.pdf}}
-      \caption{#3\label{#2}}
-      \bigskip
-      \bigskip
-      \bigskip
-    \end{center}
-  \end{figure}
+  \ctable[label={#2},caption={#3},figure,botcap,framerule=.5pt]{@{}c@{}}{}{%
+    \includegraphics[width=\textwidth]{#1}
+  }
 }
 \newcommand{\OPTS}[3]{
   \smallskip\noindent
@@ -69,13 +54,12 @@
 \def\CMP#1{\C{#1}\marginpar{\C{#1}}}
 \begin{document}
   \DocInput{isodoc.dtx}
-  \PrintChanges
   \PrintIndex
 \end{document}
 %</driver>
 % \fi
 %
-% \CheckSum{1825}
+% \CheckSum{1941}
 %
 % \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
@@ -96,11 +80,11 @@
 % \changes{v0.1}{2006/03/18}{Initial version}
 % \changes{v0.2}{2007/04/05}{added options phoneprefix, routingno, logoaddress
 %                            accountname now optional
-%                            accountnumber-> accountno
+%                            accountnumber $\Rightarrow$ accountno
 %                            german and french translations corrected
 %                            indents removed in header fields
 %                            expect printer to have more unprintable border
-%                            ascriptiontext -> accountnametext for dutch
+%                            ascriptiontext $\Rightarrow$ accountnametext for dutch
 %                            Interdocument language changes now work;
 %                            Vatno, if defined, is reported with accountdata;
 %                            country in returnaddress now separated with dot;
@@ -121,39 +105,48 @@
 %                           }
 % \changes{v0.5}{2008/07/12}{text misplacement in subject-less letters
 %                            corrected
-%                            norwegian translations corrected)
+%                            norwegian translations corrected
+%                           }
+% \changes{v0.6}{2008/07/12}{moved all documentation files in subdirectory doc,
+%                            because files appeared to be wrongly placed on the 
+%                            TeX Collection DVD
+%                            Some minor corrections
+%                           }
+% \changes{v0.7}{2010/01/02}{using eurosym package instead of marvosym;
+%                            using frenchb package instead of french;
+%                            added addresswidth option, default stays 2 cols;
+%                            changes suggested by Fabrice Niessen (thanks!):
+%                            added header/noheader options;
+%                            added bodyshift option;
+%                            date format can be yyyy-mm-dd or a literal `today';
+%                            added forcedate option to enter anything for date;
+%                            added foldleft and foldright options, default stays right;
+%                            headingcolor, if defined, colors fancy headings;
+%                            headcolor, if defined, colors headings in header and footer;
+%                            foldmarkcolor, if defined, colors foldmark
 %                           }
 %
 % \DoNotIndex{%
-% \",                 \baselineskip,\ifdim,            \quad,
-% \',                 \begin,       \ifnum,            \raggedright,
-% \\,                 \bfseries,    \ifx,              \raisebox,
-% \^,                 \cmidrule,    \ignorespaces,     \rule,
-% \`,                 \colorbox,    \immediate,        \scriptsize,
-% \@auxout,           \def,         \includegraphics,  \scshape,
-% \AtBeginDocument,   \define@key,  \lastpage@putlabel,\selectlanguage,
-% \AtEndDocument,     \definecolor, \let,              \setbox,
-% \CurrentOption,     \else,        \long,             \setkeys,
-% \DeclareOption,     \empty,       \multicolumn,      \sffamily,
-% \DescribeMacro,     \end,         \newcount,         \space,
-% \EUR,               \enspace,     \newdimen,         \tbfigures,
-% \LARGE,             \fancyhead,   \newif,            \textbf,
-% \Large,             \fancyhf,     \newlabel,         \textbullet,
-% \LoadClass,         \fi,          \noindent,         \thepage,
-% \ML,                \footnotesize,\number,           \thispagestyle,
-% \NN,                \geometry,    \or,               \undefined,
-% \PassOptionsToClass,\hfill,       \pageref,          \unskip,
-% \ProcessOptions,    \hsize,       \pagestyle,        \vbox,
-% \RequirePackage,    \hspace,      \parindent,        \vfill,
-% \TPGrid,            \ht,          \pdfinfo,          \vspace,
-% \addtocounter,      \if@twoside,  \pdfprotrudechars, \write,
-% \advance,           \ifcase,      \qquad,            \string,
-% \rightskip,         \fileversion, \filedat,          \clearpage,
-% \parskip
+% \ , \", \', \@auxout, \AtBeginDocument, \AtEndDocument, \Cbox, \CurrentOption,
+% \DeclareOption, \DescribeMacro, \EUR, \LARGE, \Large, \LoadClass, \ML, \NN,
+% \PassOptionsToClass, \ProcessOptions, \RequirePackage, \TPGrid, \Tbox, \\, \^,
+% \`, \aa, \addtocounter, \advance, \barsep, \baselineskip, \begin, \bfseries,
+% \bgroup, \clearpage, \cmidrule, \colorbox, \csname, \def, \define@key,
+% \definecolor, \egroup, \else, \empty, \end, \endcsname, \enspace,
+% \expandafter, \fancyhead, \fancyhf, \fi, \filedat, \fileversion,
+% \footnotesize, \geometry, \hfill, \hsize, \hspace, \ht, \if@twoside,
+% \ifcase, \ifdim, \ifnum, \ifx, \ignorespaces, \immediate, \includegraphics,
+% \lastpage@putlabel, \let, \long, \multicolumn, \newcommand, \newcount,
+% \newdimen, \newenvironment, \newif, \newlabel, \noindent, \number, \o, \or,
+% \pageref, \pagestyle, \paperheight, \paperwidth, \par, \parindent, \parskip,
+% \pdfinfo, \pdfprotrudechars, \qquad, \quad, \raggedright, \raisebox, \relax,
+% \rightskip, \rule, \scriptsize, \scshape, \selectlanguage, \setbox,
+% \setcounter, \setkeys, \sffamily, \space, \string, \tbfigures, \textbf,
+% \textbullet, \thepage, \thispagestyle, \undefined, \unskip, \usepackage,
+% \vbox, \vfill, \vspace, \write
 % }
-% \GetFileInfo{isodoc.dtx}
 %
-% \DoNotIndex{\newcommand,\newenvironment}
+% \GetFileInfo{isodoc.dtx}
 %
 % \title{The \textsf{isodoc} class\thanks{This document
 %   corresponds to \textsf{isodoc}~\fileversion, dated \filedate.}\\for
@@ -194,7 +187,7 @@
 % definitions, either in the document or
 % in a style file. The latter is indicated for definitions that don't vary on a
 % per document basis, such as your company name, address, email address and so
-% on. Thus if you run a company and are the secretary of a club,
+% on. Thus if you run a company and also are the secretary of a club,
 % you would have style files for each of them, plus one for your private letters
 % or invoices.\footnote{If you archive your documents in their source form
 % only, it may be wise to work without a style file and set all options in the
@@ -228,23 +221,24 @@
 %
 % Options are given as key=value pairs, separated by comma's.
 % Extra comma's, including one behind the last pair, don't hurt.
-% Arguments to option should be put between braces if they contain
+% An option argument should be enclosed in braces if it contains
 % comma's or equals signs.
 %
 % As shown in the two examples in the previous section, there are three commands
 % that can set options: |\setupdocument|, |\letter|, and |\invoice|.
 % These commands will be further explained in the \textsl{Commands} section.
 % |\setupdocument| is normally used to set options that are common to all
-% letters of invoices in the document, like your company data; |\letter|, and
-% |\invoice| set only those options that are different for each letter or
-% invoice, like the |to| and |opening| options.
+% letters or invoices in the document, like your company data; the optional 
+% arguments of |\letter| and |\invoice| set only those options
+% that are different for each letter or invoice, such as the |to|
+% and |opening| options.
 %
 % This section lists and explains all available options.
 % All options can be used in both the style files and in the document
 % source, although several will normally only be used in style files (such as
 % |company|) and some only in the document source (such as |to| or |opening|).
 %
-% \OPTS{Language}{Currently five languages are defined. As I am not particularly
+% \OPTS{Language}{Currently only a few languages are defined. As I am not particularly
 % strong in the translation of administrative terminology, please feel free to
 % send me corrections. And if you don't find your own language here, please send
 % me your translations and your language will be added. The keywords below set
@@ -253,6 +247,7 @@
 % \T{english}          & English,\NN
 % \T{german}           & German,\NN
 % \T{american}         & American,\NN
+% \T{norwegian}        & Norwegian,\NN
 % \T{french}           & or French.\NN
 % \T{foreign}          & Use this key if you send your letter to a foreign
 %                        country. With it, your country will be added to
@@ -300,7 +295,7 @@
 % \T{leftaddress}       & Places the window over columns 2 and 3; this is the
 %                         default.\NN
 % \T{rightaddress}      & Places the window over columns 4 and 5.\NN
-% \T{addresscenter = ...}    & Distance in mm of the center of the window from the top of the
+% \T{addresscenter = ...} & Distance in mm of the center of the window from the top of the
 %                         paper; the default value is 63.5 mm, fitting for a DL
 %                         envelope for triple folded A4 (110x220mm) with a window
 %                         at 50 mm from the top, 30mm high.\footnote{The middle of
@@ -308,11 +303,8 @@
 %                         envelope; the paper is folded (see the folding options
 %                         below) to give the folded paper a tolerance of 1.5mm on
 %                         both sides in the envelope, so the address should be
-%                         placed 1.5 mm higher at 65-1.5=63.5 mm.} Use
-%                         \T{addresscenter} \textsl{after} \T{fold}, \T{fold2} or \T{fold3},
-%                         because the definition of the folding marks also puts
-%                         the window positions at their corresponding
-%                         defaults.\NN
+%                         placed 1.5 mm higher at 65-1.5=63.5 mm.}\NN
+% \T{addresswidth = ...}& The address window's width. The default is 70 mm (2 columns).\NN
 % \T{to = ...}          & The addressee's address. New lines can be introduced with the \C{}\C{}
 %                         command; lines longer than 70 mm will cause extra
 %                         newlines.\NN\relax
@@ -329,9 +321,46 @@
 %                         window. Or you may want to define a completely
 %                         different return address.  With the \T{returnaddress} keyword you can
 %                         redefine the return address. Use \C{}\C{} to insert
-%                         bullets.  \NN
+%                         bullets.\NN
+% }
+%
+% \OPTS{Header fields}{Under the address window, a header is printed. The
+% page is vertically divided in six columns, one each for the left and right
+% margins, and four which, in the header,
+% say: \textsl{Your letter of}, \textsl{Your reference}, \textsl{Our reference},
+% and \textsl{Date}, each with their respective contents under them. If the
+% \T{subject} keyword is used, an extra line starting with \textsl{Subject:} will
+% appear, followed by the contents on the same line and over a width of 2.5
+% columns. If needed, extra lines will be used.}{
+% \T{bodyshift = ...}   & The header starts 98mm from the top of the paper,
+%                         but it can be shifted with the |bodyshift| option.\NN
+% \T{[no]header}        & The |noheader| option disables all header fields, the
+%                         |header| option re-enables them (|header| is the default.)\NN
+% \T{yourletter = ...}  & first field in the header: the date of the letter
+%                         this document is reaction on; empty by default.\NN
+% \T{yourref = ...}     & second field in the header: addressee's reference of the letter
+%                         this document is reaction on; empty by default.\NN
+% \T{ourref = ...}      & third field in the header: your own reference for
+%                         this document.\NN
+% \T{date = ...}        & fourth field of the header. The argument must
+%                         have the form \T{yyyymmdd} or \T{yyyy-mm-dd}; it will
+%                         be translated into a date like ``May 3, 2006'' if the
+%                         document language is English, or into its translation
+%                         in the actual language. The default value is
+%                         `Undefined date', i.e.\ the date of \C{today} is not
+%                         the default as this would make the date untraceable
+%                         from the document source only. However, you can force
+%                         the use of \C{today} by providing the string |today|
+%                         for the argument.\NN
+% \T{forcedate = ...}   & The restrictions of the |date| option can be overridden by 
+%                         using the |forcedate| option instead; you can thus enter
+%                         anything you like for the date.\NN
+% \T{subject = ...}     & subject of this document; is placed under the other fields,
+%                         over the width of the first, second and half of the
+%                         third fields.\NN
 % }
 %
+% \pagebreak %%%
 % \OPTS{Opening and Closing}{A letter is started with an opening -- something
 % like `Dear John', and ended with a closing -- something like
 % `Regards,\T{<newline>}Betty', perhaps with an autograph (or white space) in between.}{
@@ -364,45 +393,19 @@
 %                         default is \T{2}\C{baselineskip}.
 % }
 %
-% \OPTS{Headline fields}{Under the address window, a headline is printed. The
-% page is vertically divided in six columns, one each for the left and right
-% margins, and four which, in the headline,
-% say: \textsl{Your letter of}, \textsl{Your reference}, \textsl{Our reference},
-% and \textsl{Date}, each with their respective contents under them. If the
-% \T{subject} keyword is used, an extra line starting with \textsl{Subject:} will
-% appear, followed by the contents on the same line and over a width of 2.5
-% columns. If needed, extra lines will be used.}{
-% \T{yourletter = ...}    & first field in the headline: the date of the letter
-%                         this document is reaction on; empty by default.\NN
-% \T{yourref = ...}       & second field in the headline: addressee's reference of the letter
-%                         this document is reaction on; empty by default.\NN
-% \T{ourref = ...}      & third field in the headline: your own reference for
-%                         this document.\NN
-% \T{date = ...}        & fourth field of the headline; the default is `Undefined
-%                         date', i.e.\ the date of \C{today} is not the default
-%                         as this would make the date untraceable from the document
-%                         source only. The argument of the \T{date} option must
-%                         have the form \T{yyyymmdd}; it will be translated into a
-%                         date like ``May 3, 2006'' if the document language is
-%                         English, or into its translation in the actual language.\NN
-% \T{subject = ...}     & subject of this document; is placed under the headline,
-%                         over the width of the first, second and half of the
-%                         third fields.\NN
-% }
-%
 % \OPTS{Footer fields}{Footer fields are shown in the order in which
 % they appear below; they are empty by default, and empty
 % fields are not displayed.}{
 % \T{[no]footer}        & enables or disables printing a page footer; there is room
 %                         for upto four fields, if you set five fields, the last
 %                         one will appear in the right margin.\NN
+% \T{phoneprefix}	& prefix for phone numbers. The default is `0'; will be changed
+%			  into `+$<$areacode$>$-' if the \T{foreign} option is used.\NN
 % \T{phone = ...}       & if not empty, prints `phone' in the first field of the
 %                         page footer, with the contents under it, prefixed with a~0 or,
 %                         if the \T{foreign} option was used, the areacode (set with the
 %                         \T{areacode} option.) Telephone numbers should thus be entered
 %                         without a prefix.\NN
-% \T{phoneprefix}	& prefix for phone numbers. The default is `0'; will be changed
-%			  into `+<areacode>-' if the \T{foreign} option is used.\NN
 % \T{cellphone = ...}   & same for cellphone...\NN
 % \T{fax = ...}         & fax...\NN
 % \T{email = ...}       & email...\NN
@@ -414,6 +417,8 @@
 % parts of the address to become invisible because of the letter loosely filling
 % the envelope.}{
 % \T{nofold}            & Disable folding marks.\NN
+% \T{foldleft}          & The folding mark is printed in the left margin.\NN
+% \T{foldright}         & The folding mark is printed in the right margin. This is the default.\NN
 % \T{fold2}             & Folding mark at about halfway, set for tight fitting
 %                         into a 220x162 mm envelope, with a tolerance of 2 mm
 %                         at both sides.\NN
@@ -455,8 +460,7 @@
 % \T{acceptreference = ...}   & Reference\NN
 % }
 %
-% \OPTS{Miscellaneous}{Normally, texts in letters are set ragged right. This can
-% be changed with the following keywords:}{
+% \OPTS{Miscellaneous}{}{
 % \T{[no]fill}          & Use the \T{fill} keyword to justify text both left and
 %                         right; the default is \T{nofill}: left justification
 %                         only.\NN
@@ -464,7 +468,7 @@
 %                         but with the \T{fontpackage} keyword you can select another
 %                         package, like \T{txfonts} or \T{osf-txfonts}.\NN
 % \T{shift = ...}       & The many textpositions in isodoc are defined in millimeters, 
-%                         but sometime printers show an aberration in their horizontal
+%                         but sometimes printers show an aberration in their horizontal
 %                         or vertical printing position. You can correct for this with the
 %                         \T{shift = x,y} option, where x and y (both 0 by default) shift
 %                         the output to the right and down, respectively, in millimeters.\NN
@@ -490,21 +494,21 @@
 % Although not very often, it may sometimes be useful to have those
 % commands available. These are the options with a corresponding
 % command:\footnote{Note for developers: the table lines below can be
-% generated with a ruby script listkeys (included at the end of isodoc.dtx):
-% |listkeys isodoc.dtx show|}
+% generated with a ruby script listkeys (included in the distribution):
+% |listkeys show|}
 %
 % \noindent\begin{tabular}{@{}lllll@{}}
-% accept            &areacode    &email        &phoneprefix   &yourletter \NN
-% acceptaccount     &autograph   &enclosures   &returnaddress &yourref    \NN
-% acceptaddress     &bic         &fax          &rightaddress  &zip        \NN
-% acceptcents       &cellphone   &fontpackage  &routingno     &           \NN
-% acceptdesc        &chamber     &iban         &signature     &           \NN
-% acceptdescription &city        &leftaddress  &street        &           \NN
-% accepteuros       &closing     &logoaddress  &subject       &           \NN
-% acceptreference   &company     &opening      &term          &           \NN
-% accountname       &country     &openingcomma &vatno         &           \NN
-% accountno         &countrycode &ourref       &website       &           \NN
-% addresscenter     &currency    &phone        &who           &           \NN
+% accept            &addresswidth &currency     &ourref        &website    \NN
+% acceptaccount     &areacode     &email        &phone         &who        \NN
+% acceptaddress     &autograph    &enclosures   &phoneprefix   &yourletter \NN
+% acceptcents       &bic          &fax          &returnaddress &yourref    \NN
+% acceptdesc        &cellphone    &fontpackage  &rightaddress  &zip        \NN
+% acceptdescription &chamber      &forcedate    &routingno     &           \NN
+% accepteuros       &city         &iban         &signature     &           \NN
+% acceptreference   &closing      &leftaddress  &street        &           \NN
+% accountname       &company      &logoaddress  &subject       &           \NN
+% accountno         &country      &opening      &term          &           \NN
+% addresscenter     &countrycode  &openingcomma &vatno         &           \NN
 % \end{tabular}
 %
 % \noindent So you could write in your letter: ``please send me the money on my bank
@@ -560,7 +564,7 @@
 %
 % \DescribeMacro{\itotal}
 % The |\itotal{amount}| command (|itotal| stands for Invoice total) is
-% equivalent to writing\\
+% equivalent to writing:
 % |\cmidrule[.05em]{2-2} Total & amount \NN|, with the additional
 % advantage that the word `Total' will be replaced with its equivalent
 % in the current language. Thus, the argument to the |\itable|
@@ -615,7 +619,8 @@
 %
 % \section{Usage: letters}
 %
-% Usage of the class is best explained with an example.
+% Usage of the class is best explained by example.
+% \subsection{A simple letter}
 % Here is the latex source for a small letter; its result appears in figure~\ref{letter1}:
 % \verbinput{letter.txt}
 % This source essentially shows three items:
@@ -649,8 +654,8 @@
 % compiles to the letter shown in figure~\ref{letter1}.
 % This example illustrates some aspects of isodoc:
 % \begin{compactitem}
-% \item At the top, you see the default letterhead (logo).  The
-% |\renewcommand{\logo}{...}| command can be used to create your own logo.
+% \item At the top, you see the default letterhead (logo).  You can create your
+% own logo by redefining the |\logo| command.
 % \item Under it is the address. It has a return address in script sized sans
 % serif boldface over
 % it, because the |return| key has been used. A return address is useful if you
@@ -682,7 +687,8 @@
 % using the |footer| key, depending on the default set in the style file.
 % \end{compactitem}
 %
-% Let's try another illustrative example, seee figures~\ref{logo1}
+% \subsection{Multiple letters, redefined logo}
+% Let's try another illustrative example, see figures~\ref{logo1}
 % and~\ref{logo2}: we use a modified style file, with a
 % redefined logo, so we don't need a page footer; we use preprinted right-windowed
 % envelopes, so a return address is not needed. Here is the style file
@@ -702,6 +708,7 @@
 % first letter) of this document, which actually has four pages.
 %
 % \section{Usage: invoices}
+% \subsection{A simple invoice}
 % \FIG{accept}{accept}{Invoice example with accept form}
 %
 % Invoices (can) have the same structure as letters, except that the |\opening|
@@ -714,6 +721,7 @@
 % \verbinput{invoice.txt}
 % The result is shown in figure~\ref{invoice}.
 %
+% \subsection{Invoice with redefined logo}
 % When the |accept| option is used, the invoice will be created with an invoice
 % form on the lower third part of the page. Here is an example:
 % \verbinput{accept.txt}
@@ -732,12 +740,12 @@
 \ProcessOptions
 \LoadClass{article}
 %    \end{macrocode}
-% We don't use |\ctable| floats here, but we need |ctable|'s commands for decent
+% We use |\ctable| floats here, and we need |ctable|'s commands for decent
 % spacing in tables and more. |ctable| also brings us |array|, |tabularx|,
-% |color|, and |xkeyval|. |marvosym| is used for the euro symbol.
+% |color|, and |xkeyval|. |eurosym| is used for the euro symbol.
 %    \begin{macrocode}
-\RequirePackage{ctable,marvosym,graphicx}
-\RequirePackage[dutch,german,french,american,english]{babel}
+\RequirePackage{ctable,eurosym,graphicx,stringstrings}
+\RequirePackage[dutch,norsk,german,frenchb,american,english]{babel}
 %    \end{macrocode}
 %
 % Since the name of the package contains 'iso', make the page A4.
@@ -749,10 +757,23 @@
 % purposes.
 %
 %    \begin{macrocode}
-\RequirePackage[a4paper,margin=35mm,head=\baselineskip]{geometry}
+\RequirePackage[a4paper,margin=35mm,nofoot,head=\baselineskip]{geometry}
 \RequirePackage[absolute,overlay]{textpos}
 \ifdim\paperwidth>\paperheight\TPGrid{297}{210}\else\TPGrid{210}{297}\fi
 %    \end{macrocode}
+% Several colors can be changed, by using the |\definecolor| command;
+% the defaults (all black) are set here:\\
+% \DescribeMacro{headcolor}
+%   \texttt{headcolor:} color for the header and footer field texts\\
+% \DescribeMacro{headingcolor}
+%   \texttt{headingcolor:} color for the fancy headings\\
+% \DescribeMacro{markercolor}
+%   \texttt{markercolor:} color for the folding marks
+%    \begin{macrocode}
+\definecolor{headcolor}{gray}{0}
+\definecolor{headingcolor}{gray}{0}
+\definecolor{markercolor}{gray}{0}
+%    \end{macrocode}
 %
 % Use fancy headings, except for the first page.
 % The heading, on a rule, looks like:\\[2ex]
@@ -762,11 +783,15 @@
 \pagestyle{fancy}
 \fancyhf{}
 \if@twoside
-  \fancyhead[LE,RO]{\pagetext\ \thepage\ \oftext{} \pageref{LastPageOf\thelettercount}}
-  \fancyhead[RE,LO]{\totext: \toname\ (\date)}
+  \fancyhead[LE,RO]{\color{headingcolor}%
+     \pagetext\ \thepage\ \oftext{} \pageref{LastPageOf\thelettercount}}
+  \fancyhead[RE,LO]{\color{headingcolor}%
+     \totext: \toname\ (\date)}
 \else
-  \fancyhead[L]{\totext: \toname\ (\date)}
-  \fancyhead[R]{\pagetext\ \thepage\ \oftext{} \pageref{LastPageOf\thelettercount}}
+  \fancyhead[L]{\color{headingcolor}%
+     \totext: \toname\ (\date)}
+  \fancyhead[R]{\color{headingcolor}%
+     \pagetext\ \thepage\ \oftext{} \pageref{LastPageOf\thelettercount}}
 \fi
 %    \end{macrocode}
 % The |\xxxdoc| commands (like |\dutchdoc|) set the default language via
@@ -787,20 +812,20 @@
 % sender's address information. The idea is that this is used for all
 % pre-printed text on the letter paper.
 %    \begin{macrocode}
-\def\@hft{\footnotesize\sffamily}
+\def\@hft{\footnotesize\sffamily\color{headcolor}}
 %    \end{macrocode}
 % \subsection{The options and their defaults}
 % \subsubsection{General options}
 % The default font is latin modern (using the |lmodern| package).
-% The |fontpackage| option can be used to select another font.
 % \DescribeMacro{fontpackage}
+% The |fontpackage| option can be used to select another font.
 %    \begin{macrocode}
 \define@key{isodoc}{fontpackage}{\def\fontpackage{#1}}
                                  \def\fontpackage{lmodern}
 %    \end{macrocode}
-% The default shift is 0mm,0mm
-% The |shift| option moves the output to the right and down:
+% The default shift is 0mm,0mm.
 % \DescribeMacro{shift}
+% The |shift| option moves the output to the right and down:
 %    \begin{macrocode}
 \def\@xyshift#1,#2@@@{\def\@xshift{#1}\def\@yshift{#2}}
 \define@key{isodoc}{shift}{%
@@ -819,13 +844,14 @@
 \define@key{isodoc}{localbank}[\localbanktrue]{\localbanktrue}
                                            \newif\iflocalbank\localbankfalse
 %    \end{macrocode}
-% The following keys set the language; English, set at the |\EndOfClass| is the
-% default.
 % \DescribeMacro{dutch}
 % \DescribeMacro{english}
 % \DescribeMacro{german}
 % \DescribeMacro{american}
 % \DescribeMacro{french}
+% \DescribeMacro{norwegian}
+% The following keys set the language; English, set at the |\EndOfClass| is the
+% default.
 %    \begin{macrocode}
 \define@key{isodoc}{dutch}   []{\dutchdoc}
 \define@key{isodoc}{english} []{\englishdoc}
@@ -833,21 +859,18 @@
 \define@key{isodoc}{german}  []{\germandoc}
 \define@key{isodoc}{american}[]{\americandoc}
 \define@key{isodoc}{french}  []{\frenchdoc}
+\define@key{isodoc}{norwegian}  []{\norwegiandoc}
 %    \end{macrocode}
-% The default is to have left, but not right justification, allowing for hyphenation
-% in extreme cases:
 % \DescribeMacro{fill}
 % \DescribeMacro{nofill}
+% The default is to have left, but not right justification, allowing for hyphenation
+% in extreme cases:
 %    \begin{macrocode}
 \define@key{isodoc}{fill}  []{\rightskip=1\rightskip}
 \define@key{isodoc}{nofill}[]{\rightskip=0mm plus 35mm}
                               \rightskip=0mm plus 35mm
 %    \end{macrocode}
 % \subsubsection{Logo}
-% The logo, by default, consists of a large company or personal name on top a
-% rule, with a contact person's name (probably your own name) and address
-% hanging under the rule. 
-% Its contents are defined by the following options:
 % \DescribeMacro{company}
 % \DescribeMacro{logoaddress}
 % \DescribeMacro{who}
@@ -856,6 +879,10 @@
 % \DescribeMacro{zip}
 % \DescribeMacro{country}
 % \DescribeMacro{countrycode}
+% The logo, by default, consists of a large company or personal name on top a
+% rule, with a contact person's name (probably your own name) and address
+% hanging under the rule. 
+% Its contents are defined by the following options:
 %    \begin{macrocode}
 \define@key{isodoc}{company}    {\def\company{#1}}
                                  \def\company{\Undefined{company}}
@@ -875,6 +902,10 @@
 \def\prezip{\ifforeign\countrycode\else\fi}
 %    \end{macrocode}
 % \subsubsection{Address window}
+% \DescribeMacro{leftaddress}
+% \DescribeMacro{rightaddress}
+% \DescribeMacro{addresscenter}
+% \DescribeMacro{addresswidth}
 % The address can be positioned vertically with the |addresscenter| option; the
 % default is 63.5mm. This is the vertical position of the center of the address.
 % Horizontally, the address is positioned either left or right, depending on the
@@ -882,16 +913,16 @@
 % address start at x=35mm, which is the left margin (the default), and thus in
 % line with the first header field, in the second case at 105mm, in line with
 % the one-but-last header field.
-% \DescribeMacro{leftaddress}
-% \DescribeMacro{rightaddress}
-% \DescribeMacro{addresscenter}
 %    \begin{macrocode}
 \define@key{isodoc}{leftaddress} []{\def\xaddress{35}}
                                     \def\xaddress{35}
 \define@key{isodoc}{rightaddress}[]{\def\xaddress{105}}
 \define@key{isodoc}{addresscenter} {\def\addresscenter{#1}}
                                     \def\addresscenter{63.5}
+\define@key{isodoc}{addresswidth}  {\def\addresswidth{#1}}
+                                    \def\addresswidth{70}
 %    \end{macrocode}
+% \DescribeMacro{to}
 % The |to| option takes the addressee's address lines. Use |\\| to
 % separate lines. The info will be split by |\processto| on the first
 % |\\| separator into the addressee's name (|\toname|) and his address
@@ -902,7 +933,6 @@
 % |\letter| or |\invoice| commands and thus is not seen by the |\hypersetup|,
 % which is called |\AtBeginDocument|; so set the defaults to
 % |Various people| for the |\toname| and make the address undefined:
-% \DescribeMacro{to}
 %    \begin{macrocode}
 \define@key{isodoc}{to}{\processto{#1}}\def\toname{Various people}
                                        \def\toaddress{\Undefined{to}}
@@ -911,31 +941,59 @@
 \long\def\xproc #1\\#2@@@{\def\toname{#1}\def\toaddress{#2}}
 \long\def\yproc #1\\#2@@@{\def\toaddress{#2}}
 %    \end{macrocode}
+% \DescribeMacro{return}
+% \DescribeMacro{noreturn}
+% \DescribeMacro{returnaddress}
 % The default is to have no return address; but this can be changed by using
 % the |return| (either in the style file or in the source) or, if the default
 % was changed in the style file, remove it with |noreturn| in the source.
 % Company and country names are often too long to fit in the address window. Or
 % you may want to define an entirely different return address. The
 % |returnaddress| option is provided to redefine the return address:
-% \DescribeMacro{return}
-% \DescribeMacro{noreturn}
-% \DescribeMacro{returnaddress}
 %    \begin{macrocode}
 \define@key{isodoc}{return}     []{\returntrue}
                     \newif\ifreturn\returnfalse
 \define@key{isodoc}{noreturn}   []{\returnfalse}
 \define@key{isodoc}{returnaddress}{\def\returnaddress{#1}}
 %    \end{macrocode}
-% \subsubsection{Page footer}
-% A footer is switched on or off with the |footer| and |nofooter| options.
-% The default is the have no page footer.
+%
+% \subsubsection{Header}
+% \DescribeMacro{header}
+% \DescribeMacro{noheader}
+% A header is switched on or off with the |header| and |noheader| options.
+% The default is to have a header.
+%    \begin{macrocode}
+\define@key{isodoc}{header}  []{\headertrue}
+                 \newif\ifheader\headertrue
+\define@key{isodoc}{noheader}[]{\headerfalse}
+%    \end{macrocode}
+% \DescribeMacro{bodyshift}
+% The header is the start of the body. It is initially positioned
+% at 98mm from the top of the paper, but it can be shifted with
+% the |bodyshift| option.
+%    \begin{macrocode}
+\define@key{isodoc}{bodyshift} {\advance\headerpos#1\advance\bodyskip#1mm}
+                                \newdimen\bodyskip\bodyskip=0mm
+\newcount\headerpos\headerpos=98
+%    \end{macrocode}
+%
+% \subsubsection{Footer}
 % \DescribeMacro{footer}
 % \DescribeMacro{nofooter}
+% A footer is switched on or off with the |footer| and |nofooter| options.
+% The default is the have no footer.
 %    \begin{macrocode}
 \define@key{isodoc}{footer}  []{\footertrue}
                  \newif\iffooter\footerfalse
 \define@key{isodoc}{nofooter}[]{\footerfalse}
 %    \end{macrocode}
+% \DescribeMacro{areacode}   
+% \DescribeMacro{phone}      
+% \DescribeMacro{phoneprefix} 
+% \DescribeMacro{cellphone}  
+% \DescribeMacro{fax}        
+% \DescribeMacro{website}    
+% \DescribeMacro{email}      
 % If there \textsl{is} a page footer, only those fields will be displayed which are not empty.
 % Currently the |phone|, |cellphone|, |fax|, |email| and |website| are
 % recognised as possible footer fields. Phone and fax number will be prefixed
@@ -960,31 +1018,41 @@
 \def\lead{\ifforeign+\areacode-\else\phoneprefix\fi}
 %    \end{macrocode}
 % \subsubsection{Folding mark}
+% \DescribeMacro{nofold}
 % The default is to have no folding mark. So start with the folding mark
 % position outside the paper boundaries:
-% \DescribeMacro{nofold}
 %    \begin{macrocode}
 \define@key{isodoc}{nofold}[]{\yfold=-1mm}
                \newdimen\yfold\yfold=-1mm
 %    \end{macrocode}
+% \DescribeMacro{foldleft}
+% \DescribeMacro{foldright}
+% The folding mark is in the right margin, but it can be moved to the left
+% margin with the |foldleft| option, or, if made that the default in your style
+% file, back to the right margin with the |foldright| option:
+%    \begin{macrocode}
+\define@key{isodoc}{foldleft}[]{\xfold=9mm}
+               \newdimen\xfold\xfold=201mm
+\define@key{isodoc}{foldright}[]{\xfold=201mm}
+%    \end{macrocode}
+% \DescribeMacro{fold2}
 % The envelope for double folded A4 is C5: 162x220mm,
 % window 40x110mm, upper left corner at 20x50mm.
 % Fold the A4 to have a tolerance of 2mm at top and bottom, by
 % putting the fold mark at 162-4=158 mm.
-% \DescribeMacro{fold2}
 %    \begin{macrocode}
 \define@key{isodoc}{fold2}[]{\yfold=158mm}
 %    \end{macrocode}
+% \DescribeMacro{fold3}
 % The envelope for triple folded A4 is DL: 110x220mm,
 % Fold the A4 to have a tolerance of 1.5mm at top and bottom, by
 % putting the fold mark at 110-3=107mm.
-% \DescribeMacro{fold3}
 %    \begin{macrocode}
 \define@key{isodoc}{fold3}[]{\yfold=107mm}
 %    \end{macrocode}
+% \DescribeMacro{fold}
 % For non-standard envelopes and paper formats the position of the
 % folding mark can be set at any position (in mm) from the top of the paper:
-% \DescribeMacro{fold}
 %    \begin{macrocode}
 \define@key{isodoc}{fold}{\yfold=#1mm}
 %    \end{macrocode}
@@ -992,6 +1060,7 @@
 % \subsubsection{Header fields}
 % There are four header fields, each one quarter of the textwidth wide.
 % Under those, if the subject has been defined, a subject line.
+% The header position is 98mm by default, but it can be shifted with the |bodyshift| option.
 % \DescribeMacro{ourref}
 % \DescribeMacro{yourref}
 % \DescribeMacro{yourletter}
@@ -1003,83 +1072,87 @@
 \define@key{isodoc}{yourletter}{\def\yourletter{#1}}
                               \def\yourletter{}
 %    \end{macrocode}
-% The date must be entered in yyyymmdd format; here we check that it
-% contains exactly 8 digits (thanks Taco Hoekwater, Piet van Oostrum)
 % \DescribeMacro{date}
-% \DescribeMacro{subject}
+% The date must be entered in either of three formats: yyyy-mm-dd, yyyymmdd
+% or the string |today|. Here we check that a correct format is offered and
+% that the values for |mm| and |dd| are in the range 1--12 and 1--31 respectively.
+% The string |today| sets the date to today's date.
 %    \begin{macrocode}
-\define@key{isodoc}{date}{\setdate{#1}}
+\define@key{isodoc}{date}{\@isomakedate{#1}}
                           \def\date{\Undefined{date}}
+%    \end{macrocode}
+% \DescribeMacro{forcedate}
+% If you know what you do you can substitute anything you like for the date by 
+% using the |forcedate| option instead of |date|:
+%    \begin{macrocode}
+\define@key{isodoc}{forcedate}{\def\forcedate{#1}}\def\forcedate{}
+%    \end{macrocode}
+% \DescribeMacro{subject}
+% The subject is empty by default and will be typeset.
+%    \begin{macrocode}
 \define@key{isodoc}{subject}{\def\subject{#1}}
                              \def\subject{}
-\def\checkdigit#1{%
-  \ifcase0\ifcase1#1\or\or\or\or\or\or\or\or\or\else1\fi
-    \ClassError{test}{non-digit-character (#1) in date}{}
-  \fi
-}
-\def\newdate#1#2#3#4#5#6#7#8#9\wybo{%
-  \checkdigit{#1}\checkdigit{#2}\checkdigit{#3}\checkdigit{#4}
-  \checkdigit{#5}\checkdigit{#6}\checkdigit{#7}\checkdigit{#8}
-  \ifx\relax#9\relax
-     \year=#1#2#3#4\month=#5#6\day=#7#8
-     \ifnum \month > 12 \ClassError{isodoc}{Illegal date }{}\fi
-     \ifnum \day   > 31 \ClassError{isodoc}{Illegal date }{}\fi
-  \else
-    \ClassError{isodoc}{Date must have exactly 8 digits}{}
-  \fi
-}
-\def\wybo{}
-\def\setdate#1{\newdate #1\wybo\wybo\wybo\wybo\wybo\wybo\wybo\wybo\wybo}
 %    \end{macrocode}
+% \DescribeMacro{opening}
+% \DescribeMacro{openingcomma}
 % The opening, something like `Dear Reader', is set by the |opening| option; the
 % default is `Undefined opening'. It is followed by a comma, unless the
 % |openingcomma| has been used to set it to a different character, like a
 % semicolon or an exclamation mark.
-% \DescribeMacro{opening}
-% \DescribeMacro{openingcomma}
 %    \begin{macrocode}
+\newcount\openingpos
 \define@key{isodoc}{opening}     {\def\opening{#1}}
                                   \def\openingcomma{,}
 \define@key{isodoc}{openingcomma}{\def\openingcomma{#1}}
                                   \def\opening{\Undefined{opening}}
 %    \end{macrocode}
 % \subsubsection{Closing, autograph, signature}
+% \DescribeMacro{closing}
+% \DescribeMacro{closingskip}
 % The closing, something like `Best regards', is set by the |closing| option;
 % the default is `Undefined closing'. It will be preceded by a vertical skip,
 % which can be set by the |closingskip| option, which is |2\baselineskip| by
 % default:
-% \DescribeMacro{closing}
-% \DescribeMacro{closingskip}
 %    \begin{macrocode}
 \define@key{isodoc}{closing}    {\def\closing{#1,}}
-                                 \def\closing{\Undefined{closing}}       % Best regards,
+                                 \def\closing{\Undefined{closing}} % Best regards,
 \define@key{isodoc}{closingskip}{\closingskip=#1}
             \newdimen\closingskip\closingskip=2\baselineskip
 %    \end{macrocode}
+% \DescribeMacro{autograph}
 % The autograph is either just a newline, or a vertical spacing where you can
 % put your autograph manually, or a graphic. In the latter case, is must have
 % been defined with the macro |\autograph|, which defines an autograph from an
 % image, see the section \textsl{User Macros}.
 % Not using the |autograph| option is equivalent to |autograph=0| (just a newline).
 % Using it without a value is equivalent to |autograph=2| (image inserted):
-% \DescribeMacro{autograph}
 %    \begin{macrocode}
 \define@key{isodoc}{autograph}[2]{\def\autographversion{#1}}
                                   \def\autographversion{0}
 %    \end{macrocode}
+% \DescribeMacro{signature}
 % The signature, something like `John Letterwriter', is set by the |signature| option;
 % the default is `Undefined signature'.
-% \DescribeMacro{signature}
 %    \begin{macrocode}
 \define@key{isodoc}{signature}{\def\signature{#1}}
                                \def\signature{\Undefined{signature}}
 %    \end{macrocode}
+% \DescribeMacro{enclosures}
 % Enclosures are set by the |enclosures| option. There are none by default.
 %    \begin{macrocode}
 \define@key{isodoc}{enclosures} {\def\enclosures{#1}}
                                  \def\enclosures{}
 %    \end{macrocode}
 % \subsubsection{Invoice specific data}
+% \DescribeMacro{term}
+% \DescribeMacro{accountno}  
+% \DescribeMacro{routingno}  
+% \DescribeMacro{accountname}
+% \DescribeMacro{iban}       
+% \DescribeMacro{bic}        
+% \DescribeMacro{vatno}      
+% \DescribeMacro{chamber}    
+% \DescribeMacro{currency}   
 % Invoices need to state some specific data, like account data and term of
 % payment:
 %    \begin{macrocode}
@@ -1095,6 +1168,14 @@
 \define@key{isodoc}{currency}   {\def\currency{#1}}
 				 \def\currency{\EUR}
 %    \end{macrocode}
+% \DescribeMacro{accept}
+% \DescribeMacro{acceptaccount}    
+% \DescribeMacro{acceptaddress}    
+% \DescribeMacro{acceptcents}      
+% \DescribeMacro{acceptdescription}
+% \DescribeMacro{acceptdesc}       
+% \DescribeMacro{accepteuros}      
+% \DescribeMacro{acceptreference}  
 % If an accept form is to be printed, here are the options to fill in all the
 % fields:
 %    \begin{macrocode}
@@ -1120,6 +1201,7 @@
 % other forms become available, the content of |\accepttype| will have to be
 % checked. Here is a rough layout of the E05 accept form -- the last character
 % tells if the items are tyepset in a Tbox (T) or in a Cbox (C):
+% \pagebreak%%%
 % \begin{verbatim}
 %                                        description       T
 % ref                                    description       T
@@ -1209,7 +1291,7 @@
     \end{textblock}
   }
   \Tbox{140}{22}{35}{\noindent
-     \@hft
+     \footnotesize\sffamily
      \ifx\undefined\logoaddress%
        \ifx\undefined\tbfigures\else\tbfigures\fi
        \ifx\who\empty\else\who\\\fi
@@ -1239,6 +1321,42 @@
   \RequirePackage{\fontpackage}\pdfprotrudechars=1
 }
 %    \end{macrocode}
+% \DescribeMacro{\@isomakedate}
+%    \begin{macrocode}
+\newcount\@isoyear   \@isoyear=\year  \year=0
+\newcount\@isomonth \@isomonth=\month
+\newcount\@isoday     \@isoday=\day
+\def\@isomakedate#1{%
+  \def\@isoarg{#1}\def\@isotoday{today}
+  \ifx\@isoarg\@isotoday
+     \year=\@isoyear
+    \month=\@isomonth
+      \day=\@isoday
+  \else
+    \stringlength[q]{\@isoarg}
+    \ifnum\theresult=10
+      \substring[q]{\@isoarg}{5}{5}
+      \if\thestring-\else\ClassError{isodoc}{
+        Illegal date separator: \thestring (must be -)}{}\fi
+      \substring[q]{\@isoarg}{8}{8}
+      \if\thestring-\else\ClassError{isodoc}{
+        Illegal date separator: \thestring (must be -)}{}\fi
+    \else
+      \ifnum\theresult=8\else\ClassError{isodoc}{
+        Illegal date: not yyyymmdd | yyyy-mm-dd | today}{}\fi
+    \fi
+    \Treatments{0}{0}{0}{1}{0}{0}
+    \substring[q]{\@isoarg}{1}{$} \let\@isodigits=\thestring \def\@isoarg{\thestring}
+    \stringlength[q]{\@isodigits}
+    \ifnum\theresult=8\else\ClassError{isodoc}{Illegal date: must have 8 digits}{}\fi
+    \substring[q]{\@isoarg}{1}{4}  \year=\thestring \def\@isoarg{\@isodigits}
+    \substring[q]{\@isoarg}{5}{6} \month=\thestring \def\@isoarg{\@isodigits}
+    \substring[q]{\@isoarg}{7}{8}   \day=\thestring \def\@isoarg{\@isodigits}
+    \ifnum \month > 12 \ClassError{isodoc}{Illegal date: month>12}{}\fi
+    \ifnum \day   > 31 \ClassError{isodoc}{Illegal date: day>31}{}\fi
+  \fi
+}
+%    \end{macrocode}
 % \DescribeMacro{\footfield}
 % Create any non-empty footfields, starting at left arguments:
 % \begin{compactenum}
@@ -1290,8 +1408,8 @@
 %    \end{macrocode}
 % The |\showkeys| command is useful for debugging. It prints a table showing the
 % values of most keys.\footnote{Note for developers: the table lines below can
-% be generated with a ruby script listkeys (included at the end of isodoc.dtx):
-% |listkeys isodoc.dtx show|}
+% be generated with a ruby script listkeys (included in the distribution):
+% |listkeys defs|}
 % \DescribeMacro{\showkeys}
 %    \begin{macrocode}
 \def\showkeys{%
@@ -1307,6 +1425,7 @@
          accountname & \accountname\NN
            accountno & \accountno\NN
        addresscenter & \addresscenter\NN
+        addresswidth & \addresswidth\NN
             areacode & \areacode\NN
            autograph & \autograph\NN
                  bic & \bic\NN
@@ -1322,6 +1441,7 @@
           enclosures & \enclosures\NN
                  fax & \fax\NN
          fontpackage & \fontpackage\NN
+           forcedate & \forcedate\NN
                 iban & \iban\NN
          leftaddress & \leftaddress\NN
          logoaddress & \logoaddress\NN
@@ -1349,9 +1469,8 @@
   \usepackage{hyperref}
    \year=0
 }
-\AtBeginDocument{%
+\AtEndDocument{%
   \hypersetup{pdfauthor={\who},
-              pdfsubject={\subject},
               pdfproducer={isodoc v\fileversion},
   }
 }
@@ -1360,7 +1479,8 @@
 %    \begin{macrocode}
 \def\itable#1{
   \begin{tabularx}{\hsize}{@{}X@{\barsep\quad\qquad}r@{}}
-    \multicolumn{2}{@{}c@{}}{\sffamily\descriptiontext\hfill \amounttext (\currency)}\ML
+    \multicolumn{2}{@{}c@{}}{\sffamily\descriptiontext\hfill
+    \amounttext (\currency)}\ML
     #1
   \end{tabularx}
 }
@@ -1405,18 +1525,19 @@
 \newcount\footcount
 \newcommand{\invoice}[2][]{%
   \closingfalse
-  \hypersetup{pdftitle={invoice to \toname\ dated \today}}
   \def\barsep{\raisebox{-1.5ex}[0pt][0pt]{\rule{.05em}{4ex}}}%
   \letter[#1,opening=\invoicetext,openingcomma={},closing={},signature={}]{%
     \Tbox{35}{127}{140}{#2}
   }
 }
 %    \end{macrocode}
+% \DescribeMacro{\letter}
 % |\letter| prints a letter...
 %    \begin{macrocode}
 \newcommand{\letter}[2][]{{ % extra brace keeps option changes local
-  \hypersetup{pdftitle={letter to \toname\ dated \today}}
   \setkeys{isodoc}{#1}
+  \hypersetup{pdftitle={letter to \toname\ dated \today},
+              pdfsubject={\subject}}
   \label{LastPageOf\thelettercount}
   \newpage
   \addtocounter{lettercount}{1}
@@ -1428,39 +1549,48 @@
 % xaddress should be 1 or 3 for left- and right address windows
 %    \begin{macrocode}
   { \parskip=0pt\parindent=0pt
-    \begin{textblock}{70}[0,.5](\xaddress,\addresscenter)%
+    \begin{textblock}{\addresswidth}[0,.5](\xaddress,\addresscenter)%
         \ifreturn
           {\def\\{\unskip\enspace\textbullet\enspace\ignorespaces}%
-            \sffamily\scriptsize\bfseries\returnaddress
+            \sffamily\bfseries\scriptsize\returnaddress
           }\\[-.8\baselineskip]
           \rule{\hsize}{.2pt}\\
         \fi
         \toname\\\toaddress
     \end{textblock}
   }
-  \ifx\subject\empty\else%
-    \Tbox{35}{108}{105}{\noindent
-      \begin{tabularx}{\hsize}{@{}l>{\raggedright}X@{}}
-        \@hft\subjecttext&\subject
-      \end{tabularx}
+  \openingpos=\headerpos
+  \ifheader
+    \advance\openingpos12
+    \advance\bodyskip12mm
+    \Tbox{35}{\headerpos}{35}{\noindent
+      {\@hft\yourlettertext}\\
+      \yourletter
+    }
+    \Tbox{70}{\headerpos}{35}{\noindent
+      {\@hft\yourreftext}\\
+      \raggedright\yourref
     }
+    \Tbox{105}{\headerpos}{35}{\noindent
+      {\@hft\ourreftext}\\
+      \raggedright\ourref
+    }
+    \Tbox{140}{\headerpos}{35}{\noindent
+      {\@hft\datetext}\\
+      \ifx\forcedate\empty%
+        \ifnum\year=0\Undefined{date}\else\date\fi
+      \else\forcedate\fi
+    }
+    \ifx\subject\empty\else%
+     \advance\openingpos10
+      \advance\bodyskip10mm
+      \Tbox{35}{108}{105}{\noindent
+        \begin{tabularx}{\hsize}{@{}l>{\raggedright}X@{}}
+          \@hft\subjecttext&\subject
+        \end{tabularx}
+      }
+    \fi
   \fi
-  \Tbox{35}{98}{35}{\noindent
-    {\@hft\yourlettertext}\\
-    \yourletter
-  }
-  \Tbox{70}{98}{35}{\noindent
-    {\@hft\yourreftext}\\
-    \raggedright\yourref
-  }
-  \Tbox{105}{98}{35}{\noindent
-    {\@hft\ourreftext}\\
-    \raggedright\ourref
-  }
-  \Tbox{140}{98}{35}{\noindent
-    {\@hft\datetext}\\
-    \ifnum\year=0\Undefined{date}\else\date\fi
-  }
   \footcount=35
   \iffooter
     \footfield{\websitetext}{}{\website}
@@ -1470,8 +1600,8 @@
     \footfield{\emailtext}{}{\email}
   \fi
   { \parskip=0pt\parindent=0pt
-    \begin{textblock*}{3mm}(201mm,\yfold)%
-        \rule{\hsize}{.2pt}
+    \begin{textblock*}{3mm}(\xfold,\yfold)%
+       {\color{markercolor}\rule{\hsize}{.2pt}}
     \end{textblock*}
   }
   \ifx\undefined\accepttype\else\accept\fi
@@ -1584,11 +1714,13 @@
        {\ocrb\acceptcents}
 }
 %    \end{macrocode}
-% Definitions of field names in various languages; corrections and suggestions
-% are very welcome:
+% Definitions of field names in various languages; corrections
+% and suggestions are very welcome:
 % \DescribeMacro{\dutchdoc}
 %    \begin{macrocode}
-\def\set@lang#1{\ifpreamble\AtBeginDocument{\selectlanguage{#1}}\else\selectlanguage{#1}\fi}
+\def\set@lang#1{%
+  \ifpreamble\AtBeginDocument{\selectlanguage{#1}}%
+  \else\selectlanguage{#1}\fi}
 \def\dutchdoc{%
   \set@lang{dutch}
   \def\yourlettertext{Uw brief van}
@@ -1792,9 +1924,9 @@
   \def\Totaltext{Total}
 }
 %    \end{macrocode}
-% \DescribeMacro{\norskdoc}
+% \DescribeMacro{\norwegiandoc}
 %    \begin{macrocode}
-\def\norskdoc{%
+\def\norwegiandoc{%
   \set@lang{norsk}
   \def\yourlettertext{Deres brev av}
   \def\yourreftext{Deres ref:}
@@ -1833,4 +1965,4 @@
 %    \end{macrocode}
 % \Finale
 \endinput
-$Id: isodoc.dtx,v 1.25 2009-06-15 11:29:33 wybo Exp $
+$Id: isodoc.dtx,v 1.28 2010-01-02 16:54:02 wybo Exp $
-- 
cgit v1.2.3

