summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/isodoc/isodoc.dtx
blob: c8e10f0f1e74752cf7d6b161acc288a602284381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
% \iffalse meta-comment
%
% Copyright (C) 2006 by Wybo Dekker <wybo@servalys.nl>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% 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.2 or later is part of all distributions of LaTeX
% version 1999/12/01 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{isodoc.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{isodoc}%
%<*class>
           [2008/08/22 v0.3 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}
\usepackage{txfonts}\pdfprotrudechars=1
\usepackage{ctable,pdfpages,paralist,marvosym,sverb,ltablex}
\usepackage[colorlinks]{hyperref}
\parindent0pt\parskip1ex
\EnableCrossrefs
\PageIndex
\RecordChanges

\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}
}
\newcommand{\OPTS}[3]{
  \smallskip\noindent
  \begin{tabularx}{\hsize}{@{}lX@{}}
    \multicolumn{2}{@{}l}{\bfseries #1}\NN
    \multicolumn{2}{@{}p{\hsize}@{}}{#2}\NN\NN
    #3
  \end{tabularx}
}
\def\T#1{\texttt{#1}}
\def\C#1{\texttt{$\mathtt{\backslash}$#1}}
\def\CMP#1{\C{#1}\marginpar{\C{#1}}}

\begin{document}
  \DocInput{isodoc.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{1676}
%
% \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{v0.1}{2006/03/18}{Initial version}
% \changes{v0.2}{2007/04/05}{added options phoneprefix, routingno, logoaddress
%                            accountname now optional
%                            accountnumber-> accountno
%                            german and french translations corrected
%                            indents removed in header fields
%                            expect printer to have more unprintable border
%                            ascriptiontext -> accountnametext for dutch
%                            Interdocument language changes now work;
%                            Vatno, if defined, is reported with accountdata;
%                            country in returnaddress now separated with dot;
%                            option changes kept local to the letter/invoice;
%                            English/American accountname text adapted
%                           }
% \changes{v0.3}{2007/08/21}{several errors in documentation corrected
%                           }
%
% \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
% }
% \GetFileInfo{isodoc.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \title{The \textsf{isodoc} class\thanks{This document
%   corresponds to \textsf{isodoc}~\fileversion, dated \filedate.}\\for
%   letters, invoices, and more}
% \author{Wybo Dekker \\ \texttt{wybo@servalys.nl}}
%
% \maketitle
%
% \begin{abstract}\noindent
% The \texttt{isodoc} class can be used for the preparation of letters,
% invoices, and, in the future, similar documents.
% Documents are set up with options, thus making the class easily adaptable to
% user's wishes and extensible for other document types.
% \\[2ex]
% \textbf{Keywords:} letter, invoice, key/value, \textsc{nen1026}
%
% \end{abstract}
% \tableofcontents
% \section{Introduction}
%
% This class is intended to be used for the preparation of letters and
% invoices. Its starting point was Victor Eijkhout's NTG
% {\texttt{brief}} class\footnote{CTAN: ntgclass/briefdoc.pdf}, which
% implements the \textsc{nen 1026} standard. The \texttt{brief} class
% does not provide facilities for invoices and it is not easily
% extensible.
%
% The goal for the \texttt{isodoc} class is to be extensible and easy to
% use by providing \textsl{key=value} configuration. Furthermore, texts
% that need to be placed on prescribed positions on the page (there are
% many such texts) are positioned by using the {\texttt{textpos}}
% package.\footnote{CTAN: textpos/textpos.pdf} This provides a very
% rugged construction of the page.
%
% The class itself contains many general definitions, but variable data, such as
% opening, closing,
% address and many more, have to be defined using \textsl{key=value}
% 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,
% 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
% document itself!}
%
% The general setup of a document producing one or more letters is (see
% figures~\ref{letter1}--\ref{logo2}, page~\pageref{logo1}--\pageref{logo2},
% for examples):
% \begin{verbatim}
%     \documentclass{isodoc}
%     \usepackage{<somestyle>}
%     \setupdocument{<generaloptions>}
%     \begin{document}
%     \letter[<addressee_specific_options>]{<letter_content>}
%     ... more \letter calls ...
%     \end{document}
% \end{verbatim}
% Similarly, the general setup of a document producing one or more invoices is
% (figure~\ref{invoice}, page~\pageref{invoice}):
% \begin{verbatim}
%     \documentclass{isodoc}
%     \usepackage{<somestyle>}
%     \setupdocument{<generaloptions>}
%     \begin{document}
%     \invoice[<addressee_specific_options>]{<invoice_content>}
%     ... more \invoice calls ...
%     \end{document}
% \end{verbatim}
%
% \section{Options}
%
% 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.
%
% 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
% 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
% the language, English is used by default.}{
% \T{dutch}            & Set language to Dutch, \NN
% \T{english}          & English,\NN
% \T{german}           & German,\NN
% \T{american}         & American,\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
%                        return and logo addresses, your zip code will be
%                        prefixed with your country code, telephone numbers will
%                        be prefixed with +31-- (or whatever your \T{areacode}
%                        option has been set to) instead of just a 0. In
%                        the \C{accountdata} command, it causes \textsc{iban} en
%                        \textsc{bic} code to be included.\NN
% }
%
% \OPTS{Logo}{Information about the sender is defined here. The logo, by
% default, consists of a large company name on top a rule with, hanging under the rule,
% a contact person's data.
% You can define the latter either explicitly with the |logoaddress| option, 
% or let it automatically be created from the contents of the options |who|, |street|,
% |prezip|, |zip|, |city|, |country|, and |foreign|, as far as you have defined those.
% Definition in parts can be useful if you need
% them elsewhere in your document.}{
% \T{company = ...}    & Your company name as it should appear in the logo (if
%                        you use the default logo) and in the return address
%                        (where it may get overridden by the \T{returnaddress}
%                        keyword.) For private documents, use your name or
%                        nickname here.\NN
% \T{logoaddress = ...}& Contact person's data; use |\\| commands for line breaks. 
%                        If you don't define this option, the data will be constructed
%                        from the following options.\NN
% \T{who = ...}        & Contact person's name; probably your own name.\NN
% \T{street = ...}     & Street in the sender's address.\NN
% \T{city = ...}       & City in the sender's address.\NN
% \T{zip = ...}        & Zip in the sender's address.\NN
% \T{country = ...}    & Country in the sender's address. Only used if \T{foreign}
%                        key was used.\NN
% \T{countrycode = ...}& Sender's country code. For The Netherlands: NL\NN
% \T{areacode = ...}   & Sender's area code. For The Netherlands: 31\NN
% }
%
% \OPTS{Address window}{The addressee's address is printed in a window. The
% width of the window is two columns (70 mm), and its contents are vertically
% centered in it. There are no limits to the vertical size of the
% window, other than the physical size of the window in the envelopes you use.
% The vertical position of the window's center is set with the \T{addresscenter}
% keyword. Horizontally there are two options: left or right.}{
% \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
%                         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
%                         the window is at 50+30/2=65 mm from the top of the
%                         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
% \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
% \T{[no]return}        & Do or don't print a return address on top of the
%                         addressee's address. This is useful if blank window envelopes
%                         are used. The return address is composed from the
%                         contents of the \T{company}, \T{street}, \T{zip}, \T{city}, and
%                         \T{country} keywords; it is printed in a bold
%                         script size sans serif font and is is separated from
%                         the addressee's address with a rule. The country will
%                         only be printed if the \T{foreign} keyword has been used.\NN
% \T{returnaddress = ...}& The return address, if it is composed as just
%                         described, may become too long to fit in the address
%                         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
% }
%
% \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.}{
% \T{opening = ...}     & Dear John\NN
% \T{closing = ...}     & Regards\NN
% \T{signature = ...}   & Betty\NN
% \T{autograph = ...}   & \begin{minipage}[t]{\hsize}
%                         This keyword can have one of the 10 values 0--9:\\[-\baselineskip]
%                         \begin{compactitem}
%                         \item [0:] no autograph; the \T{signature} appears right under
%                                 the \T{closing}. This is the default if the |autograph| option
%                                 is not used (using it without a value is equivalent to 
%                                 |autograph=2|).
%                         \item [1:] generates extra whitespace between
%                                 \T{signature} and \T{closing} for a hand-written
%                                 autograph.  Change with the \T{closingskip} key.
%                         \item [2--9:] inserts one of eight autograph images
%                                 which, with the \C{autograph} command,
%                                 may have been defined in the style file.\\\mbox{}
%                         \end{compactitem}
%                         \end{minipage}
%                         \NN
% \T{enclosures = ...}  & This keyword can be used to add a note, at the end of
%                         the document, which starts with \textbf{Enclosure:}
%                         followed by the value of the keyword. Multiple
%                         enclosures can be separated with \C{}\C{} commands. If
%                         those are found, the starting text will be
%                         \textbf{Enclosures:}.\NN
% \T{closingskip = ...} & white space between signature and closing. The
%                         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{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
% \T{website = ...}     & and website.\NN
% }
%
% \OPTS{Folding marks}{Folding marks can be useful, particularly if your address
% window is used to its limits. Correctly folding your letter then prevents
% parts of the address to become invisible because of the letter loosely filling
% the envelope.}{
% \T{nofold}            & Disable folding marks.\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
% \T{fold3}             & Folding mark at about one third from the top, set for
%                         tight fitting into a 220x110 mm envelope, with a
%                         tolerance of 1.5 mm at both sides.\NN
% \T{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.
% }
%
% \OPTS{Payment data}{In invoices you probably want to make clear where you want
% your debtor to transfer his money to. You can do so by calling
% the \C{accountdata} command, which generates a little table containing these data.
% The contents of this table can be defined with the following keywords:}{
% \T{accountno = ...}   & Your bank account number.\NN
% \T{routingno = ...}   & Your bank's routing number. Will not be cited if undefined.\NN
% \T{accountname = ...} & Your bank account's ascription.
%                         Will not be cited if undefined.\NN
% \T{iban = ...}        & Your account's \textsc{iban}...\NN
% \T{bic = ...}         & and \textsc{bic} code; \textsc{iban} and \textsc{bic}
%                         are only reported in invoices to foreign
%                         customers---see the \T{foreign} keyword.\NN
% \T{vatno = ...}       & Your \textsc{vat} reference number, not yet used.\NN
% \T{chamber = ...}     & Your Chamber of Commerce subscription number, not yet
%                         used.\NN
% }
%
% \OPTS{Accept data}{These keys pertain to data needed for accept forms:}{
% \T{acceptaccount = ...}     & Payer's bank account number\NN
% \T{acceptaddress = ...}     & Payer's address lines, separated with \C{}\C{}\NN
% \T{accepteuros = ...}       & Euro part of the amount to be paid\NN
% \T{acceptcents = ...}       & Cents part of the amount to be paid\NN
% \T{acceptdescription = ...} & Description to be quoted on the accept form\NN
% \T{acceptdesc = ...}        & Short version of the description for the
%                               detachable strip of the form to be kept by the payer\NN
% \T{acceptreference = ...}   & Reference\NN
% }
%
% \OPTS{Miscellaneous}{Normally, texts in letters are set ragged right. This can
% be changed with the following keywords:}{
% \T{[no]fill}          & Use the \T{fill} keyword to justify text both left and
%                         right; the default is \T{nofill}: left justification
%                         only.\NN
% \T{fontpackage = ...} & The default font is Latin Modern (\T{fontpackage = lmodern}),
%                         but with the \T{fontpackage} keyword you can select another
%                         package, like \T{txfonts} or \T{osf-txfonts}.
% }
%
% \section{Commands}
% \DescribeMacro{\showkeys}
% The \C{showkeys} command can be useful for debugging. It prints a table
% showing the option keys described in the previous section, and their current values.
%
% \DescribeMacro{\setupdocument}
% Most of the setup, both in the style files and in the documents
% themselves, is done setting options in a call to the class-defined
% |\setupdocument| command. The options can be either a key/value pair, or just
% a key.
% Options with values and those without may occur in any order, with
% the exception of |addresscenter| (see there.)
% Values need
% their surrounding \{\}'s only if they contain any comma's.
% The \textsl{Options} section explains the available options.
%
% Most of the options have a corresponding command with the same name.
% 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|}
%
% \noindent\begin{tabular}{@{}lllll@{}}
% acceptaccount     &areacode    &enclosures   &returnaddress &zip \NN
% acceptaddress     &bic         &fax          &routingno     &    \NN
% acceptcents       &cellphone   &fontpackage  &signature     &    \NN
% acceptdesc        &chamber     &iban         &street        &    \NN
% acceptdescription &city        &logoaddress  &subject       &    \NN
% accepteuros       &closing     &opening      &vatno         &    \NN
% acceptreference   &company     &openingcomma &website       &    \NN
% accountname       &country     &ourref       &who           &    \NN
% accountno         &countrycode &phone        &yourletter    &    \NN
% addresscenter     &email       &phoneprefix  &yourref       &    \NN
% \end{tabular}
%
% \noindent So you could write in your letter: ``please send me the money on my bank
% account: |\accountno\| as soon as possible.''
%
% \DescribeMacro{\letter}
% The |\letter| command produces one letter and can be called multiple times. It
% has two arguments. The first argument is optional and must be a list of
% \textsl{key=value} pairs. The options set here are usually those that vary among
% different letters. The second argument contains the letter's content. This
% content will, depending on the options set, automatically be surrounded by an
% opening, a closing, an autograph, a signature and a remark about any
% enclosures. The first page of each letter will be decorated with a logo,
% the addressee's address, a return address,
% various reference fields, a footer, a folding mark---all as defined by
% \textsl{key=value} pairs in |\setupdocument| or in the |\letter| command itself.
%
% The second an following pages will have a heading, quoting the name of the
% addressee and a page number. Examples of letters can be found in the
% section \textsl{Usage: letters}.
%
% \DescribeMacro{\invoice}
% The |\invoice| command is essentially the same as the |\letter| command, except
% that the opening is always ``\textbf{\textsc{invoice}}'', and the content
% (argument 2) is largely composed using the |\itable|, |\iitem|, |\itotal|, and
% |\accountdata| commands described hereafter. Closing, autograph, and signature
% are disabled.
%
% In the Netherlands, invoices can be provided with an accept form on the lower
% third part of the page.  If the |accept| option was used, this accept form
% will be filled with the available data, in the |ocrb| font where needed.
%
% The following commands pertain to invoices:
% \DescribeMacro{\itable}
% The |\itable| command uses |tabularx| to create a two-column table. The
% first column of the table will have the header `Description' (or its
% equivalent in the language selected), the header of the second column says
% `Amount (\EUR)'. The single argument of |\itable| should contain the
% contents of the table and is of the form:
% \begin{verbatim}
%     item 1 & amount 1\NN
%     item 2 & amount 2\NN
%     ...
%     item n & amount n \NN
%     \cmidrule[.05em]{2-2}
%     Total  & amount \NN
% \end{verbatim}
% However, the next two commands may be used to enter these data more cleanly:
%
% \DescribeMacro{\iitem}
% The |\iitem{item}{amount}| command (|iitem| stands for Invoice Item) is
% equivalent to writing |item & amount\NN|.
%
% \DescribeMacro{\itotal}
% The |\itotal{amount}| command (|itotal| stands for Invoice total) is
% 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|
% command show above can also be written:
% \begin{verbatim}
%     \iitem{item 1}{amount 1}
%     \iitem{item 2}{amount 2}
%     ...
%     \iitem{item n}{amount n}
%     \total{amount}
% \end{verbatim}
% \DescribeMacro{\accountdata}
% The |\accountdata| command prints a little table with accounting information
% needed by the creditor for paying the invoice. It is constructed using the
% values of the options |accountno|, |accountname|, |routingno|, |iban|, and
% |bic|. The latter two are only included if the |foreign| option was used.
%
% \DescribeMacro{\autograph}
% The \C{autograph} command, which will normally appear in a style file,
% serves to define up to eight autographs based
% on \textsc{pdf}, \textsc{jpeg} or \textsc{png} images. One of these
% autographs will be drawn between the closing (\textsl{Best regards})
% and the signature (\textsl{Betty}) if you use the \T{autograph} option
% with a value from 2 through 9. \C{autograph} has 7 arguments:
%
% \begin{tabularx}{\hsize}{@{}rX@{}}
% arg 1:&2,3,...9: autograph number; will be translated internally to define
%        |\autographA|, |\autographB|... |\autographH|\NN
%     2:&scaling factor for the image\NN
%     3:&distance the autograph outdents in the margin\NN
%     4:&vertical position of the baseline of the closing
%        (\textsl{Regards,}) from the top\NN
%     5:&vertical position of the baseline of the signature (\textsl{John
%        Letterwriter}) from the top\NN
%     6:&height of the image\NN
%     7:&the image (jpg, png, pdf...)\NN
% \end{tabularx}
%
% The arguments 3--6 must be dimensions, and for a given autograph image should
% be inferred by inspecting the image with an image manipulation program
% like, for example, the gimp. In the lower left corner of the gimp window,
% select the units of length, move the pointer to the positions where you want
% margin, closing, and signature and to the bottom of the image, read the x, y,
% y and y positions respectively and use those for the argument 3, 4, 5, and 6.
%
% \FIG{letter}{letter1}{Minimal letter example}
%
% \DescribeMacro{\logo}
% The |\logo| command is internally used to define the default logo; you can
% redefine it with |\renewcommand{\logo}{...}|. An example of logo redefinition
% can be found on page~\pageref{logoredef}.
%
% \section{Usage: letters}
%
% Usage of the class is best explained with an example.
% 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:
% \begin{compactenum}
% \item the inclusion of a package |mystyle|; we'll come to that shortly.
% \item the command |\setupdocument| called with many \textsl{key=value} arguments, each
% defining one of the texts that go into the letter.
% \item the command |\letter|, enclosing the body of the letter;
% just to give the letter some real body, a small text has
% been included using |\input|.
% \end{compactenum}
% Of course this is not all of the information needed to create a
% letter. For example, there should be a logo, telling the addressee who I am
% and there should be contact information such as my address, telephone number
% and so on. This is where the included |mystyle| package plays its part. Here
% is an example of such a style file:
% \verbinput{mystyle.txt}
% So in the style file, too, |\setupdocument| is used to register
% information that will common to almost all of my letters. The
% |\autograph| command sets up an autograph, based on an image file. Apart
% from the code shown here, a style file can contain definitions for more
% autographs, and a definition for a logo. Without the latter, a default logo is
% produced. Note also that I have included defaults for |opening|, |closing|,
% and |signature| in the style file, and that I did not override those in the
% letter's source.
%
% \FIG{logo1}{logo1}{Long letter example with a non-standard logo, page 1}
% \FIG{logo2}{logo2}{Long letter example with a non-standard logo, page 2}
%
% The letter source example shown above, in combination with this style example,
% 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 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
% send your letters in a standard window envelope. The positioning of the
% address is done in the style file, using the |addresscenter| and |leftaddress| or
% |rightaddress| keywords.
% \item The paper is vertically divided in six equally wide columns. The outer
% two columns are the left and right margins, the second to fifth columns contain
% header and footer fields.
% \item The ``Your reference'' and ``Our reference'' fields have not been set
% (with the |yourref| and |ourref| keys) and therefore stay empty by default,
% the date field has also not been set, but it should be. Therefore, the default
% value is ``Undefined date'', and a warning is issued by a pink background.
% \item A folding mark has been printed in the extreme right margin, such that
% on folding the paper along it, it will correctly fit in a 220 x 110 mm
% envelope; this has been achieved by using the |fold3| key.
% \item In between closing (\textsl{Best regards,}) and signature
% (\textsl{W.H.~Dekker}) an autograph has been placed. This was done by setting
% |autograph=2|. Alternative values are |0| (nothing between closing and
% signature), |1| for white space where an autograph can be placed with a pen
% after printing, or one of the values |2-9|, which may have been associated
% with other autograph images. In this case, I have used an autograph image in
% which I have drawn the boundary box and the \textsl{outdent},
% \textsl{closing}, and \textsl{signature} positions defined in the
% |\autograph| command (see the section \textsl{Commands}) with red lines.
% \item The bottom of the letter has (up to) four fields with contact
% information. This is useful if your logo does not show that information. If it
% does, you can omit these fields by using the |nofooter| key, or by not
% 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}
% 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
% (|logostyle.sty|):
% \verbinput{logostyle.txt}
% \label{logoredef}
% \FIG{invoice}{invoice}{Invoice example}
% The letter source does not use the |autograph| key, so the default value of
% |2| is used; we write it in Dutch and use
% a larger text, just to see what happens if more than one page is generated:
% \verbinput{logoletter.txt}
% In this case, the same letter had to be sent to two different people,
% with different openings and addresses of course. So the letter's body
% is separately defined and the |\letter| command is called twice, with
% the same body, but different |to| and |opening| keys.
% Figures~\ref{logo1} and~\ref{logo2} show the first two pages (the
% first letter) of this document, which actually has four pages.
%
% \section{Usage: invoices}
% \FIG{accept}{accept}{Invoice example with accept form}
%
% Invoices (can) have the same structure as letters, except that the |\opening|
% isn't ``Dear Somebody'' anymore, but something like ``Invoice''. And the
% |\closing| doesn't say ``Best regards'', but may provide payment information.
% And the body is not a simple text, but a table with descriptions of things to
% be paid, and the corresponding amounts of money.
%
% An example, as usual, is most instructive:
% \verbinput{invoice.txt}
% The result is shown in figure~\ref{invoice}.
%
% 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}
% Normally such invoices are printed on preprinted paper with an easily
% detachable, perforated form. In this example, the form itself has been
% printed, too. The |graphicx| and |textpos| packages have already been made
% available by the |isodoc| class. Figure~\ref{accept} shows the output of this
% example.
%% \StopEventually{}
%
% \section{Implementation}
% The basis is the |article| class with all options:
%
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass{article}
%    \end{macrocode}
% We don't use |\ctable| floats here, but 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.
%    \begin{macrocode}
\RequirePackage{ctable,marvosym,graphicx}
\RequirePackage[dutch,german,french,american,english]{babel}
%    \end{macrocode}
%
% Since the name of the package contains 'iso', make the page A4.
% For textpos, divide the page in 210 columns of 1mm each
% and 297 rows, 1mm each. The page is vertically divided in 6 columns of
% 35mm each: a left margin, 4 fields, and a right margin.
% If the class option |landscape| is used, the paper still stays divided in
% 1mm x 1mm cells. This may be useful if you use the isodoc class for other
% purposes.
%
%    \begin{macrocode}
\RequirePackage[a4paper,margin=35mm,head=\baselineskip]{geometry}
\RequirePackage[absolute,overlay]{textpos}
\ifdim\paperwidth>\paperheight\TPGrid{297}{210}\else\TPGrid{210}{297}\fi
%    \end{macrocode}
%
% Use fancy headings, except for the first page.
% The heading, on a rule, looks like:\\[2ex]
% To: John Doe (April 1st, 2006)\hfill Page 2 of 3\\[2ex]
%    \begin{macrocode}
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\if@twoside
  \fancyhead[LE,RO]{\pagetext\ \thepage\ \oftext{} \pageref{LastPageOf\thelettercount}}
  \fancyhead[RE,LO]{\totext: \toname\ (\date)}
\else
  \fancyhead[L]{\totext: \toname\ (\date)}
  \fancyhead[R]{\pagetext\ \thepage\ \oftext{} \pageref{LastPageOf\thelettercount}}
\fi
%    \end{macrocode}
% The |\xxxdoc| commands (like |\dutchdoc|) set the default language via
% |\AtBeginDocument|, but other language changes should be done without that. 
% So we must have a boolean to check if we are in the preamble:
%
%    \begin{macrocode}
\newif\ifpreamble\preambletrue
\AtBeginDocument{\preamblefalse}
%    \end{macrocode}
% Background color for signaling items that should have been defined, but
% weren't:
%    \begin{macrocode}
\definecolor{isodocpink}{rgb}{1,.7,.7}
\def\Undefined#1{\colorbox{isodocpink}{Undefined #1}}
%    \end{macrocode}
% A small sans serif font is used for header and footer field names and the
% 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}
%    \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}
%    \begin{macrocode}
\define@key{isodoc}{fontpackage}{\def\fontpackage{#1}}
                                 \def\fontpackage{lmodern}
%    \end{macrocode}
% Several items in the letter/invoice will be different in documents that are to
% be sent abroad; this is set with the |foreign| option, false by default:
% \DescribeMacro{foreign}
%    \begin{macrocode}
\define@key{isodoc}{foreign}[\foreigntrue]{\foreigntrue}
                                           \newif\ifforeign\foreignfalse
\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}
%    \begin{macrocode}
\define@key{isodoc}{dutch}   []{\dutchdoc}
\define@key{isodoc}{english} []{\englishdoc}
                                \AtEndOfClass{\englishdoc}
\define@key{isodoc}{german}  []{\germandoc}
\define@key{isodoc}{american}[]{\americandoc}
\define@key{isodoc}{french}  []{\frenchdoc}
%    \end{macrocode}
% The default is to have left, but not right justification, allowing for hyphenation
% in extreme cases:
% \DescribeMacro{fill}
% \DescribeMacro{nofill}
%    \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}
% \DescribeMacro{street}
% \DescribeMacro{city}
% \DescribeMacro{zip}
% \DescribeMacro{country}
% \DescribeMacro{countrycode}
%    \begin{macrocode}
\define@key{isodoc}{company}    {\def\company{#1}}
                                 \def\company{\Undefined{company}}
\define@key{isodoc}{logoaddress}{\def\logoaddress{#1}}
\define@key{isodoc}{who}        {\def\who{#1}}
                                 \def\who{\Undefined{who}}
\define@key{isodoc}{street}     {\def\street{#1}}
                                 \def\street{\Undefined{street}}
\define@key{isodoc}{city}       {\def\city{#1}}
                                 \def\city{\Undefined{city}}
\define@key{isodoc}{country}    {\def\country{#1}}
                                 \def\country{\Undefined{country}}
\define@key{isodoc}{countrycode}{\def\countrycode{#1}}
                                 \def\countrycode{\Undefined{countrycode}}
\define@key{isodoc}{zip}        {\def\zip{#1}}
                                 \def\zip{\Undefined{zip}}
\def\prezip{\ifforeign\countrycode\else\fi}
%    \end{macrocode}
% \subsubsection{Address window}
% 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
% |leftaddress| or |rightaddress| options being used. In the first case, the
% 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}
%    \end{macrocode}
% 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
% (|\toaddress|)

% The |\toname| will be reported in the pdf's document properties.
% However, this works only if the |to| key is set, with |\setupdocument|, in the
% preamble. If several letters are composed, |to| is normally set in the
% |\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}}
\long\def\processto#1{\xproc #1\\@@@\ifx\toaddress\empty
    \else \yproc #1@@@\fi}
\long\def\xproc #1\\#2@@@{\def\toname{#1}\def\toaddress{#2}}
\long\def\yproc #1\\#2@@@{\def\toaddress{#2}}
%    \end{macrocode}
% 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.
% \DescribeMacro{footer}
% \DescribeMacro{nofooter}
%    \begin{macrocode}
\define@key{isodoc}{footer}  []{\footertrue}
                 \newif\iffooter\footerfalse
\define@key{isodoc}{nofooter}[]{\footerfalse}
%    \end{macrocode}
% 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
% with a 0, unless the |foreign| option was used: then the prefix will be
% `+nn-', where nn is the areacode. The latter is set with the |areacode|
% option, which is `Undefined areacode' by default.
%    \begin{macrocode}
\define@key{isodoc}{areacode}   {\def\areacode{#1}}
                                 \def\areacode{\Undefined{areacode}}
\define@key{isodoc}{phone}      {\def\phone{#1}}
                                 \def\phone{}
\define@key{isodoc}{phoneprefix}{\def\phoneprefix{#1}}
                                 \def\phoneprefix{0}
\define@key{isodoc}{cellphone}  {\def\cellphone{#1}}
                                 \def\cellphone{}
\define@key{isodoc}{fax}        {\def\fax{#1}}
                                 \def\fax{}
\define@key{isodoc}{website}    {\def\website{#1}}
                                 \def\website{}
\define@key{isodoc}{email}      {\def\email{#1}}
                                 \def\email{}
\def\lead{\ifforeign+\areacode-\else\phoneprefix\fi}

%    \end{macrocode}
% \subsubsection{Folding mark}
% 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}
% 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}
% 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}
% 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}
%
% \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.
% \DescribeMacro{ourref}
% \DescribeMacro{yourref}
% \DescribeMacro{yourletter}
%    \begin{macrocode}
\define@key{isodoc}{ourref}  {\def\ourref{#1}}
                              \def\ourref{}
\define@key{isodoc}{yourref}   {\def\yourref{#1}}
                              \def\yourref{}
\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}
%    \begin{macrocode}
\define@key{isodoc}{date}{\setdate{#1}}
                          \def\date{\Undefined{date}}
\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}
% 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}
\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}
% 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,
\define@key{isodoc}{closingskip}{\closingskip=#1}
            \newdimen\closingskip\closingskip=2\baselineskip
%    \end{macrocode}
% 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}
% 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}
% 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}
% Invoices need to state some specific data, like account data and term of
% payment:
%    \begin{macrocode}
\define@key{isodoc}{term}   [30]{\def\term{#1}}
\define@key{isodoc}{accountno}  {\def\accountno{#1}}
\define@key{isodoc}{routingno}  {\def\routingno{#1}}
\define@key{isodoc}{accountname}{\def\accountname{#1}}
\define@key{isodoc}{iban}       {\def\iban{#1}}
\define@key{isodoc}{bic}        {\def\bic{#1}}
\define@key{isodoc}{vatno}      {\def\vatno{#1}}
\define@key{isodoc}{chamber}    {\def\chamber{#1}}
                                 \def\chamber{Undefined{chamber}}
%    \end{macrocode}
% If an accept form is to be printed, here are the options to fill in all the
% fields:
%    \begin{macrocode}
\define@key{isodoc}{accept}[E05]{\def\accepttype{#1}
                                 \newfont\ocrb{ocrb10}
                                }
\define@key{isodoc}{acceptaccount}    {\def\acceptaccount{#1}}
                                       \def\acceptaccount{}
\define@key{isodoc}{acceptaddress}    {\def\acceptaddress{#1}}
                                       \def\acceptaddress{}
\define@key{isodoc}{acceptcents}      {\def\acceptcents{#1}}
                                       \def\acceptcents{Undefined{}}
\define@key{isodoc}{acceptdescription}{\def\acceptdescription{#1}}
                                       \def\acceptdescription{}
\define@key{isodoc}{acceptdesc}       {\def\acceptdesc{#1}}
                                       \def\acceptdesc{}
\define@key{isodoc}{accepteuros}      {\def\accepteuros{#1}}
                                       \def\accepteuros{Undefined{}}
\define@key{isodoc}{acceptreference}  {\def\acceptreference{#1}}
                                       \def\acceptreference{Undefined{ref}}
%    \end{macrocode}
% For now, we define field positons for the E05 accept form only; when data for
% other forms become available, the content of |\accepttype| will have to be
% checked. Here is a rough layout of the E05 accept form:
% \begin{verbatim}
%                                        description
% ref                                    description
% ref                 euros cents             reference
% 
% eur ct                  account
% 
% desc                address
% desc                address
% desc                address
% \end{verbatim}
%    \begin{macrocode}
\def\xacceptdescription{105}\def\yacceptdescription{200}\def\wacceptdescription{100}
\def\xacceptref{7}          \def\yacceptref{212}        \def\wacceptref{30}
\def\xaccepteuros{60}       \def\yaccepteuros{218}      \def\waccepteuros{32}
\def\xacceptcents{89}       \def\yacceptcents{218}      \def\wacceptcents{13}
\def\xacceptreference{125}  \def\yacceptreference{218}  \def\wacceptreference{55}
\def\xaccepteur{14.4}       \def\yaccepteur{231}        \def\waccepteur{21}
\def\xacceptct{32}          \def\yacceptct{231}         \def\wacceptct{9}
\def\xacceptaccount{75}     \def\yacceptaccount{231}    \def\wacceptaccount{65}
\def\xacceptdesc{7}         \def\yacceptdesc{240}       \def\wacceptdesc{26}
\def\xacceptaddress{58}     \def\yacceptaddress{243}    \def\wacceptaddress{90}
%    \end{macrocode}
% This is the |\baselineskip| for the two-line reference of the detachable strip:
%    \begin{macrocode}
\newdimen\acceptreferenceskip\acceptreferenceskip=5.15mm
%    \end{macrocode}
% \subsection{User Macros}
% 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.\footnote{Thanks, Hans Hagen and Piet van  Oostrum, for its definition}\\
% The arguments 3 - 6 can be found by measuring those (with the gimp, for example)
% in the unscaled (raw) image (which is the last argument).
% \\[1ex]
% \begin{tabularx}{\hsize}{@{}rX@{}}
% arg 1:&2,3,...9: autograph number; will be translated internally to define
%        |\autographA|, |\autographB|... |\autographH|\NN
%     2:&scaling factor for the image\NN
%     3:&the distance the autograph outdents in the margin\NN
%     4:&the vertical position of the baseline of the closing (Regards,) from the top\NN
%     5:&the vertical position of the baseline of the signature (John Letterwriter) from the top\NN
%     6:&the height of the image\NN
%     7:&the image (jpg, png, pdf...)\NN
% \end{tabularx}
% \DescribeMacro{\autograph}
%    \begin{macrocode}
\newdimen\myoutdent
\newdimen\signskip
\newdimen\mydown
\def\autograph#1#2#3#4#5#6#7{%
  \ifnum #1<2
    \ClassError{isodoc}{autograph #1 cannot be changed (first arg must be 2..9)}{}
  \fi
  \ifnum #1>9
    \ClassError{isodoc}{autograph #1 cannot be changed (first arg must be 2..9)}{}
  \fi
  \bgroup
  \lccode`2=`A \lccode`6=`E
  \lccode`3=`B \lccode`7=`F
  \lccode`4=`C \lccode`8=`G
  \lccode`5=`D \lccode`9=`H
  \lowercase{\def\temp{#1}}%
  \expandafter\egroup\expandafter\def\csname autograph\temp\endcsname{%
    \myoutdent=#3
    \signskip=#5\advance\signskip-#4
    \mydown=#6\advance\mydown-#4
    \par\hspace*{-#2\myoutdent}%
    \raisebox{-#2\mydown}[0bp][0bp]{\includegraphics[scale=#2]{#7}}\\[-\baselineskip]
    \closing\\[-2\baselineskip]\\[#2\signskip]\signature%
  }
}
%    \end{macrocode}
% \subsubsection{Logo}
% The logo, by default, consists of a large company name on top a rule,
% with a contact person's name (probably your own name) and address
% hanging under the rule. 
% If the osf-txfonts package is used, oldstyle figures are disabled here.
% \DescribeMacro{\logo}
%    \begin{macrocode}
\newcommand{\logo}{%
  \begin{textblock}{140}[0,1](35,20)\noindent
    \textsf{\LARGE\company}\\[-1.7ex] % large company name
    \rule{\hsize}{.3pt}               % on top a rule
  \end{textblock}
  \Tbox{140}{22}{35}{\noindent
     \@hft
     \ifx\undefined\logoaddress%
       \ifx\undefined\tbfigures\else\tbfigures\fi
       \ifx\who\empty\else\who\\\fi
       \ifx\street\empty\else\street\\\fi
       \prezip\ \zip\ \city
       \ifforeign\\\country\fi
     \else\logoaddress\fi
  }
}
%    \end{macrocode}
% \DescribeMacro{\returnaddress}
%    \begin{macrocode}
\def\returnaddress{%
  \company\\
  \street\\
  \prezip{} \zip{} \city
  \ifforeign\\\country\fi
}
%    \end{macrocode}
% \DescribeMacro{\setupdocument}
%    \begin{macrocode}
\newcommand{\setupdocument}[1]{
  \setkeys{isodoc}{#1}
  \iffooter\else\geometry{bottom=25mm}\fi
  \RequirePackage[T1]{fontenc}
  \RequirePackage{\fontpackage}\pdfprotrudechars=1
}
%    \end{macrocode}
% \DescribeMacro{\footfield}
% Create any non-empty footfields, starting at left arguments:
% \begin{compactenum}
% \item fieldlabel
% \item a prefix for the content (for phone numbers)
% \item the content
% \end{compactenum}
%    \begin{macrocode}
\def\footfield#1#2#3{%
  \ifx#3\empty\else
    \Tbox{\footcount}{275}{35}{\noindent
      {\@hft#1}\\
        #2#3
    }
    \advance\footcount35
  \fi
}
%    \end{macrocode}
% \DescribeMacro{\accountdata}
% Print a table with banking information. Show account number, account
% name + city, and a reference. If the |foreign| key was used,
% \textsc{iban} and \textsc{bic} codes are also reported.
%    \begin{macrocode}
\def\accountdata{
  \textbf{\accountdatatext:}\\
  \begin{tabular}{@{}rl@{}}
    \ifx\term\undefined\else
             \termtext: & \term\ \daystext\\
    \fi
        \accountnotext: & \accountno\\
    \ifx\accountname\undefined\else
       \accountnametext: & \accountname{}\\
    \fi
    \ifx\routingno\undefined\else
       \routingnotext: & \routingno{}\\
    \fi
        \referencetext: & \ourref\\
    \ifforeign
      \iflocalbank\else
                  iban: & \scshape \iban\\
                   bic: & \scshape \bic\\
      \fi
    \fi
    \ifx\vatno\undefined\else
      \vatnotext: & \vatno\\
    \fi
  \end{tabular}
}
%    \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|}
% \DescribeMacro{\showkeys}
%    \begin{macrocode}
\def\showkeys{%
  \begin{tabular}{ll}
       acceptaccount & \acceptaccount\NN
       acceptaddress & \acceptaddress\NN
         acceptcents & \acceptcents\NN
          acceptdesc & \acceptdesc\NN
   acceptdescription & \acceptdescription\NN
         accepteuros & \accepteuros\NN
     acceptreference & \acceptreference\NN
         accountname & \accountname\NN
           accountno & \accountno\NN
       addresscenter & \addresscenter\NN
            areacode & \areacode\NN
                 bic & \bic\NN
           cellphone & \cellphone\NN
             chamber & \chamber\NN
                city & \city\NN
             closing & \closing\NN
             company & \company\NN
             country & \country\NN
         countrycode & \countrycode\NN
               email & \email\NN
          enclosures & \enclosures\NN
                 fax & \fax\NN
         fontpackage & \fontpackage\NN
                iban & \iban\NN
         logoaddress & \logoaddress\NN
             opening & \opening\NN
        openingcomma & \openingcomma\NN
              ourref & \ourref\NN
               phone & \phone\NN
         phoneprefix & \phoneprefix\NN
       returnaddress & \returnaddress\NN
           routingno & \routingno\NN
           signature & \signature\NN
              street & \street\NN
             subject & \subject\NN
               vatno & \vatno\NN
             website & \website\NN
                 who & \who\NN
          yourletter & \yourletter\NN
             yourref & \yourref\NN
                 zip & \zip\NN
  \end{tabular}
}

\AtEndOfClass{%
  \usepackage{hyperref}
   \year=0
}

\AtBeginDocument{%
  \hypersetup{pdfauthor={\who},
              pdfsubject={\subject},
              pdfproducer={isodoc v\fileversion},
  }
}

% \DescribeMacro{\itable}
% |\itable| inserts an invoice table; arg1 should be the rows of the table.
%    \begin{macrocode}
\def\itable#1{
  \begin{tabularx}{\hsize}{@{}X@{\barsep\quad\qquad}r@{}}
    \multicolumn{2}{@{}c@{}}{\sffamily\descriptiontext\hfill \amounttext (\EUR)}\ML
    #1
  \end{tabularx}
}
% \DescribeMacro{\iitem}
% |\iitem| inserts an invoice item in the |\itable|.
% It inserts |arg1 & % arg2\NN|:
%    \begin{macrocode}
\def\iitem#1#2{#1&#2\NN}
% \DescribeMacro{\itotal}
%    \end{macrocode}
% |\itotal| inserts an invoice total in the |\itable|.\\
% It inserts |\cmidrule[.05em]{2-2}Total & arg1\NN|:
%    \begin{macrocode}
\def\itotal#1{\cmidrule[.05em]{2-2}\Totaltext&\textbf{#1}\NN}
%    \end{macrocode}
% The counter |\lettercount| is used to construct a label on the last
% page of each letter/invoice of this document; it wil be set to
% \texttt{LastPageOf\textsl{n}}, where \textsl{n} is the letter
% number: 1, 2, 3, ... This allows for page headings saying ``Page n
% of m.'' Whether we are on the last page of a letter is only known
% either at |\end{document}| or when a new letter is started. This is
% why a label is set at the start of a |\letter| call, thus labeling
% the last page of the previous letter and using |\AtEndDocument| for
% the last letter, which would otherwise stay unlabeled.
%    \begin{macrocode}
\newcounter{lettercount}\setcounter{lettercount}{0}
\AtEndDocument{\label{LastPageOf\thelettercount}}
%    \end{macrocode}
% \DescribeMacro{\invoice}
% |\invoice| prints an invoice. The first argument is optional, and may
% contain the same \textsl{key=value} statement as |\setupdocument|. This is
% useful if the document contains more than one invoice for different
% addressees.
%
% The second argument creates a two-column table with headings
% ``Description'' and ``Amount (\EUR)''. The two columns are separated
% with a vertical rule; its construction is somewhat complicated, as the
% booktabs/ctable packages are in use that don't provide decent vertical
% separators. The |\barsep| macro extends these separators vertically.

%    \begin{macrocode}
\newif\ifclosing\closingtrue
\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={}]{%
    \noindent
    #2
  }
}
%    \end{macrocode}
% |\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}
  \label{LastPageOf\thelettercount}
  \newpage
  \addtocounter{lettercount}{1}
  \setcounter{page}{1}
  \setcounter{footnote}{0}
  \logo
%    \end{macrocode}
% addresscenter is the center, vertically, of the to-address block:
% xaddress should be 1 or 3 for left- and right address windows
%    \begin{macrocode}
  \begin{textblock}{70}[0,.5](\xaddress,\addresscenter)\noindent
    \ifreturn
      {\def\\{\unskip\enspace\textbullet\enspace\ignorespaces}%
        \sffamily\scriptsize\bfseries\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}
    }
  \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}
    \footfield{\phonetext}{\lead}{\phone}
    \footfield{\cellphonetext}{\lead}{\cellphone}
    \footfield{\faxtext}{\lead}{\fax}
    \footfield{\emailtext}{}{\email}
  \fi
  \begin{textblock*}{3mm}(201mm,\yfold)\noindent % rule from 201-204mm 
    \rule{\hsize}{.2pt}
  \end{textblock*}
  \ifx\undefined\accepttype\else\accept\fi

  \ifx\subject\empty\vspace*{80mm}\else\vspace*{90mm}\fi
  \noindent\opening\openingcomma\\[\baselineskip]
  \thispagestyle{empty}
  \noindent
  #2
  {\parindent=0pt\parskip=\baselineskip
    \ifclosing
      \ifcase\autographversion
        \par\closing\\\signature                % 0: closing on the next line
      \or\par\closing\\[\closingskip]\signature % 1: whiteskip
      \or\autographA
      \or\autographB
      \or\autographC
      \or\autographD
      \or\autographE
      \or\autographF
      \or\autographG
      \or\autographH
      \else
        \par\Undefined{autograph: \autographversion}\\
      \fi
    \fi
    \ifx\enclosures\empty\else
      \vfill
      \setbox1=\vbox{\enclosures}%
      \textbf{\ifdim\ht1>\baselineskip\enclosurestext\else\enclosuretext\fi}%
      \\\enclosures
    \fi
  }
}}
%    \end{macrocode}
% \subsection{Internal Macros}
% The accept is produced from |\Tbox| and |\Cbox| commands only, using the
% |textpos| package:
% \DescribeMacro{\Cbox}
% |\Cbox{x}{y}{width}{text}| places |text| in a box of |\testsl{width}| mm, centered around (|x|,|y|) in mm:
%    \begin{macrocode}
\def\Cbox#1#2#3#4{
  \begin{textblock}{#3}[.5,.5](#1,#2)
  \begin{center}
    #4
  \end{center}
\end{textblock}}
%    \end{macrocode}
% \DescribeMacro{\Tbox}
% |\Tbox{x}{y}{width}{text}| places |text| in a box of |\testsl{width}| mm, with the upper left corner at (|x|,|y|) in mm:
%    \begin{macrocode}
\long\def\Tbox#1#2#3#4{
  \begin{textblock}{#3}(#1,#2)\noindent
    \begin{minipage}[t]{\hsize}
      \noindent#4
    \end{minipage}
  \end{textblock}
}
%    \end{macrocode}
% \DescribeMacro{\accept}
% This macro will have a parameter if other accept forms will have to be
% programmed:
%    \begin{macrocode}
\def\accept{
  \Tbox{\xacceptdescription}
       {\yacceptdescription}
       {\wacceptdescription}
       {\acceptdescription}
  \Tbox{\xacceptdesc}
       {\yacceptdesc}
       {\wacceptdesc}
       {\acceptdesc}
  \Tbox{\xacceptaddress}
       {\yacceptaddress}
       {\wacceptaddress}
       {\ifx\acceptaddress\empty\toname\\\toaddress\else\acceptaddress\fi}
  \Cbox{\xacceptreference}
       {\yacceptreference}
       {\wacceptreference}
       {\ocrb\acceptreference}
  \Tbox{\xacceptref}
       {\yacceptref}
       {\wacceptref}
       {\baselineskip=\acceptreferenceskip\ocrb\acceptreference}
  \Cbox{\xaccepteuros}
       {\yaccepteuros}
       {\waccepteuros}
       {\ocrb\accepteuros}
  \Cbox{\xacceptaccount}
       {\yacceptaccount}
       {\wacceptaccount}
       {\ocrb\acceptaccount}
  \Cbox{\xacceptcents}
       {\yacceptcents}
       {\wacceptcents}
       {\ocrb\acceptcents}
  \Cbox{\xaccepteur}
       {\yaccepteur}
       {\waccepteur}
       {\ocrb\accepteuros}
  \Cbox{\xacceptct}
       {\yacceptct}
       {\wacceptct}
       {\ocrb\acceptcents}
}
%    \end{macrocode}
% 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\dutchdoc{%
  \set@lang{dutch}
  \def\yourlettertext{Uw brief van}
  \def\yourreftext{Uw kenmerk}
  \def\ourreftext{Ons kenmerk}
  \def\datetext{Datum}
  \def\totext{Aan}
  \def\pagetext{Bladnummer}
  \def\oftext{van}
  \def\date{\number\day~\ifcase\month\or
    januari\or februari\or maart\or april\or mei\or juni\or juli\or
    augustus\or september\or oktober\or november\or december\fi
    \space \number\year}
  \def\subjecttext{Onderwerp:}
  \def\ccname{Cc:}
  \def\enclosuretext{Bijlage:}
  \def\enclosurestext{Bijlagen:}
  \def\faxtext{telefax}
  \def\websitetext{webstek}
  \def\emailtext{email}
  \def\phonetext{telefoon}
  \def\cellphonetext{mobiel}
  \def\chambertext{kvk}
  \def\invoicetext{{\bfseries\Large\scshape rekening}}
  \def\descriptiontext{Omschrijving}
  \def\amounttext{Bedrag}
  \def\accountdatatext{Betalingsgegevens}
  \def\termtext{betalingstermijn}
  \def\daystext{dagen}
  \def\accountnotext{rekening nr}
  \def\accountnametext{ten name van}
  \def\referencetext{kenmerk}
  \def\chambertext{kvk}
  \def\vatnotext{btw nr}
  \def\Vattext{Btw}
  \def\Totaltext{Totaal}
}
%    \end{macrocode}
% \DescribeMacro{\englishdoc}
%    \begin{macrocode}
\def\englishdoc{%
  \set@lang{english}
  \def\yourlettertext{Your letter of}
  \def\yourreftext{Your reference}
  \def\ourreftext{Our reference}
  \def\datetext{Date}
  \def\totext{To}
  \def\pagetext{Page}
  \def\oftext{of}
  \def\date{\ifcase\day\or
    1st\or 2nd\or 3rd\or 4th\or 5th\or
    6th\or 7th\or 8th\or 9th\or 10th\or
    11th\or 12th\or 13th\or 14th\or 15th\or
    16th\or 17th\or 18th\or 19th\or 20th\or
    21st\or 22nd\or 23rd\or 24th\or 25th\or
    26th\or 27th\or 28th\or 29th\or 30th\or
    31st\fi~\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\year}
  \def\subjecttext{Subject:}
  \def\ccname{cc}
  \def\enclosuretext{Enclosure:}
  \def\enclosurestext{Enclosures:}
  \def\faxtext{telefax}
  \def\websitetext{website}
  \def\emailtext{email}
  \def\phonetext{telephone}
  \def\cellphonetext{cellphone}
  \def\invoicetext{{\bfseries\Large\scshape invoice}}
  \def\descriptiontext{Description}
  \def\amounttext{Amount}
  \def\accountdatatext{Banking data}
  \def\termtext{term of payment}
  \def\daystext{days}
  \def\accountnotext{Account no.}
  \def\accountnametext{to the name of}
  \def\referencetext{Reference}
  \def\chambertext{ch.comm.}
  \def\vatnotext{vat no.}
  \def\Vattext{Vat}
  \def\Totaltext{Total}
}
%    \end{macrocode}
% \DescribeMacro{\americandoc}
%    \begin{macrocode}
\def\americandoc{%
  \set@lang{american}
  \def\yourlettertext{Your letter of}
  \def\yourreftext{Your reference}
  \def\ourreftext{Our reference}
  \def\datetext{Date}
  \def\totext{To}
  \def\pagetext{Page}
  \def\oftext{of}
  \def\date{\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\subjecttext{Subject:}
  \def\ccname{cc}
  \def\enclosuretext{Enclosure:}
  \def\enclosurestext{Enclosures:}
  \def\faxtext{telefax}
  \def\websitetext{website}
  \def\emailtext{email}
  \def\phonetext{telephone}
  \def\cellphonetext{cellphone}
  \def\invoicetext{{\bfseries\Large\scshape invoice}}
  \def\descriptiontext{Description}
  \def\amounttext{Amount}
  \def\accountdatatext{Banking data}
  \def\termtext{term of payment}
  \def\daystext{days}
  \def\accountnotext{Account no.}
  \def\accountnametext{to the name of}
  \def\referencetext{Reference}
  \def\chambertext{ch.comm.}
  \def\vatnotext{vat no.}
  \def\Vattext{Vat}
  \def\Totaltext{Total}
}
%    \end{macrocode}
% \DescribeMacro{\germandoc}
%    \begin{macrocode}
\def\germandoc{%
  \set@lang{german}
  \def\yourlettertext{Ihr Brief vom}
  \def\yourreftext{Ihr Zeichen}
  \def\ourreftext{Unser Zeichen}
  \def\datetext{Datum}
  \def\totext{An}
  \def\pagetext{Seite}
  \def\oftext{aus}
  \def\date{\number\day.~\ifcase\month\or
    Januar\or Februar\or M\"arz\or April\or Mai\or Juni\or
    Juli\or August\or September\or Oktober\or November\or Dezember\fi
    \space\number\year}
  \def\subjecttext{Betrifft:}
  \def\ccname{Kopien an}
  \def\enclosuretext{Anlage:}
  \def\enclosurestext{Anlagen:}
  \def\faxtext{Telefax}
  \def\websitetext{Webseite}
  \def\emailtext{Email}
  \def\phonetext{Telefon}
  \def\cellphonetext{Handy}
  \def\invoicetext{{\bfseries\Large\scshape rechnung}}
  \def\descriptiontext{Umschreibung}
  \def\amounttext{Betrag}
  \def\accountdatatext{Bezahlungsdaten}
  \def\termtext{Zahlungstermin}
  \def\daystext{Tage}
  \def\accountnotext{Konto Nr}
  \def\routingnotext{BLZ}
  \def\accountnametext{Name}
  \def\referencetext{Beleg Nr}
  \def\chambertext{Register Nr}
  \def\vatnotext{Ustid Nr}
  \def\Vattext{MwSt}
  \def\Totaltext{Insgesamt}
}
%    \end{macrocode}
% \DescribeMacro{\frenchdoc}
%    \begin{macrocode}
\def\frenchdoc{%
  \set@lang{french}
  \def\yourlettertext{Votre lettre du}
  \def\yourreftext{Vos r\'ef\'erences:}
  \def\ourreftext{Nos r\'ef\'erences:}
  \def\datetext{Date:}
  \def\totext{\`A l'attention de}
  \def\pagetext{Page}
  \def\oftext{de}
  \def\date{\number\day\ifnum\day=1$^{er}$\fi
    ~\ifcase\month\or janvier\or
    f\'evrier\or mars\or avril\or mai\or juin\or
    juillet\or ao\^ut\or septembre\or octobre\or
    novembre\or d\'ecembre\fi \space \number\year}
  \def\subjecttext{Objet:}
  \def\ccname{Copie \`a}
  \def\enclosuretext{Pi\`ece jointe:}
  \def\enclosurestext{Pi\`eces jointes:}
  \def\faxtext{t\'el\'efax}
  \def\websitetext{site Web}
  \def\emailtext{email}
  \def\phonetext{t\'el\'ephone}
  \def\cellphonetext{portable}
  \def\invoicetext{{\bfseries\Large\scshape facture}}
  \def\descriptiontext{Description}
  \def\amounttext{Montant}
  \def\accountdatatext{Cooronn\'ees banquaires}
  \def\termtext{terme}
  \def\daystext{jours}
  \def\accountnotext{no. compte}
  \def\accountnametext{au nom de}
  \def\referencetext{r\'ef\'erence}
  \def\chambertext{c.c.i.}
  \def\vatnotext{no. T.V.A.}
  \def\Vattext{T.V.A.}
  \def\Totaltext{Total}
}
%    \end{macrocode}
% \Finale
\endinput
$Id: isodoc.dtx,v 1.14 2007/08/21 22:16:38 wybo Exp $