Browse code

Add local copy of leaflet-source

The version shipped in various LaTeX-Distribution is not up to date.

Michael F. Schönitzer authored on 13/06/2016 21:22:33
Showing 6 changed files
... ...
@@ -90,3 +90,7 @@ sympy-plots-for-*.tex/
90 90
 
91 91
 # xindy
92 92
 *.xdy
93
+
94
+# Don't ship compiled version of leaflet
95
+leaflet-manual.tex
96
+leaflet.cls
... ...
@@ -1,26 +1,29 @@
1 1
 all:  audio.pdf edu.pdf web.pdf video.pdf office.pdf grafik.pdf games.pdf
2 2
 
3
-grafik.pdf: grafik.tex header.tex
3
+grafik.pdf: leaflet/leaflet.cls grafik.tex header.tex
4 4
 	lualatex -interaction=nonstopmode grafik.tex
5 5
 
6
-office.pdf: office.tex header.tex
6
+office.pdf: leaflet/leaflet.cls office.tex header.tex
7 7
 	lualatex -interaction=nonstopmode office.tex
8 8
 
9
-video.pdf: video.tex header.tex
9
+video.pdf: leaflet/leaflet.cls video.tex header.tex
10 10
 	lualatex -interaction=nonstopmode video.tex
11 11
 
12
-web.pdf: web.tex header.tex
12
+web.pdf: leaflet/leaflet.cls web.tex header.tex
13 13
 	lualatex -interaction=nonstopmode web.tex
14 14
 
15
-edu.pdf: edu.tex header.tex
15
+edu.pdf: leaflet/leaflet.cls edu.tex header.tex
16 16
 	lualatex -interaction=nonstopmode edu.tex
17 17
 
18
-audio.pdf: audio.tex header.tex
18
+audio.pdf: leaflet/leaflet.cls audio.tex header.tex
19 19
 	lualatex -interaction=nonstopmode audio.tex
20 20
 
21
-games.pdf: games.tex header.tex
21
+games.pdf: leaflet/leaflet.cls games.tex header.tex
22 22
 	lualatex -interaction=nonstopmode games.tex
23 23
 
24
+leaflet/leaflet.cls: leaflet/leaflet.ins leaflet/leaflet.dtx
25
+	cd leaflet; pdflatex leaflet.ins 
26
+
24 27
 online: audio.pdf edu.pdf web.pdf video.pdf office.pdf grafik.pdf games.pdf
25 28
 	pdftk grafik.pdf cat 1 2down output grafik-web.pdf
26 29
 	pdftk office.pdf cat 1 2down output office-web.pdf
... ...
@@ -1,4 +1,4 @@
1
-\documentclass[12pt,a4paper]{leaflet}
1
+\documentclass[12pt,a4paper]{leaflet/leaflet}
2 2
 \usepackage[utf8]{luainputenc} % remove if you want to use XeTeX
3 3
 \usepackage[ngerman]{babel}
4 4
 \usepackage[T1]{fontenc}
5 5
new file mode 100644
... ...
@@ -0,0 +1,16 @@
1
+The leaflet document class
2
+==========================
3
+
4
+A LaTeX document class to create small hand-outs (flyers) that fit on a
5
+single sheet of paper which is then folded twice. Pages are rearranged by
6
+LaTeX so that they print correctly on a single sheet -- no external script
7
+is necessary. (Works with PostScript and PDF.)
8
+
9
+Recommended TDS locations:
10
+
11
+   leaflet.cls:                     tex/latex/leaflet
12
+   leaflet.pdf,leaflet-manual.pdf:  doc/latex/leaflet
13
+
14
+For general installation advice, see
15
+http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages
16
+
0 17
new file mode 100644
... ...
@@ -0,0 +1,1399 @@
1
+% \iffalse meta-comment
2
+%
3
+%
4
+%  (c) 1998 J\"urgen Schlegelmilch    <schlegel@informatik.uni-rostock.de>
5
+%  (c) 2000 Walter Schmidt            <w.a.schmidt@gmx.net>
6
+%  (c) 2002/2004 Rolf Niepraschk      <Rolf.Niepraschk@gmx.de> and
7
+%                Hubert G\"a\ss{}lein <HubertJG@open.mind.de>
8
+%  (c) 2012,... Rolf Niepraschk       <Rolf.Niepraschk@gmx.de>
9
+%
10
+% This file may be distributed and/or modified under the
11
+% conditions of the LaTeX Project Public License, either version 1.3
12
+% of this license or (at your option) any later version.
13
+% The latest version of this license is in:
14
+%
15
+%    http://www.latex-project.org/lppl.txt
16
+%
17
+% and version 1.3 or later is part of all distributions of LaTeX
18
+% version 2003/12/01 or later.
19
+%
20
+% \fi
21
+%
22
+% \iffalse
23
+%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
24
+%<class>\ProvidesClass{leaflet}
25
+%<class>  [2015/12/27 v1.1a LaTeX document class (JS,WaS,RN,HjG)]
26
+%
27
+%<*driver|manual>
28
+%<driver>\def\filename{leaflet.dtx}
29
+%<manual>\def\filename{leaflet-manual.tex}
30
+\def\fileversion{v1.1a}   % change this when leaflet-manual changed, too.
31
+\def\filedate{2015/12/27}
32
+\def\docdate {2015/12/27} % change this when leaflet-manual changed, too.
33
+%</driver|manual>
34
+%<*driver>
35
+\listfiles
36
+\errorcontextlines5
37
+\documentclass[a4paper]{ltxdoc}
38
+\IfFileExists{geometry.sty}{%
39
+  \usepackage[left=\marginparwidth,textwidth=1.15\textwidth,%
40
+    top=20mm,bottom=30mm]{geometry}}{}
41
+\IfFileExists{url.sty}{\usepackage{url}}
42
+  {\newcommand\url[1]{\texttt{#1}}}
43
+%\OnlyDescription
44
+%\AlsoImplementation
45
+\EnableCrossrefs
46
+\CodelineIndex
47
+\RecordChanges
48
+\setlength\emergencystretch{3em}
49
+\begin{document}
50
+\DocInput{leaflet.dtx}
51
+\end{document}
52
+%</driver>
53
+% \fi
54
+%
55
+% \CheckSum{1275}
56
+%
57
+% \CharacterTable
58
+%  {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
59
+%   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
60
+%   Digits        \0\1\2\3\4\5\6\7\8\9
61
+%   Exclamation   \!     Double quote  \"     Hash (number) \#
62
+%   Dollar        \$     Percent       \%     Ampersand     \&
63
+%   Acute accent  \'     Left paren    \(     Right paren   \)
64
+%   Asterisk      \*     Plus          \+     Comma         \,
65
+%   Minus         \-     Point         \.     Solidus       \/
66
+%   Colon         \:     Semicolon     \;     Less than     \<
67
+%   Equals        \=     Greater than  \>     Question mark \?
68
+%   Commercial at \@     Left bracket  \[     Backslash     \\
69
+%   Right bracket \]     Circumflex    \^     Underscore    \_
70
+%   Grave accent  \`     Left brace    \{     Vertical bar  \|
71
+%   Right brace   \}     Tilde         \~}
72
+%
73
+% \changes{v0.8c}{2004/01/16}{Repacked as dtx file. (RN)}
74
+% \changes{v0.9d}{2004/05/29}{M-x delete-trailing-whitespace (HjG)}
75
+% \changes{v0.9d}{2004/05/29}{LPPL 1.3 (HjG)}
76
+% \changes{v0.9d}{2004/05/29}{More code documentation; some caveats. (HjG)}
77
+% \changes{v0.9e}{2004/06/11}{Add option `finish'. (RN/HjG)}
78
+% \changes{v0.9f}{2004/06/25}{Merge v0.9d and v0.9e (hastily). (HjG)}
79
+% \changes{v0.9g}{2004/06/25}{Rename option `finish' to `combine'. (RN/HjG)}
80
+% \changes{v1.0pre1}{2004/06/26}{Redefinition of \cmd{\immediate},
81
+%   \cmd{\write}, \cmd{\openout} and \cmd{\closeout}. (RN)}
82
+% \changes{v1.0pre2}{2004/06/26}{eTeX support. (RN)}
83
+% \changes{v1.0pre3}{2004/07/07}{Options `landscape' and `portait'. (RN)}
84
+% \changes{v1.0}{2004/08/06}{CTAN release. (RN/HjG)}
85
+% \changes{v1.0a}{2004/08/08}{Option `debug'. (RN)}
86
+% \changes{v1.0d}{2012/06/04}{Options `twopart/notwopart' suggested
87
+%   by Luis Rivera. No more `final' in \cmd{\ExecuteOptions} suggested
88
+%   by Axel Berger (RN)}
89
+%
90
+% \DoNotIndex{\newcommand,\renewcommand,\newenvironment,\renewenvironment}
91
+% \DoNotIndex{\providecommand,\def,\edef,\let,\gdef,\xdef,\global,\newtoks}
92
+% \DoNotIndex{\newif,\newsavebox}
93
+% \DoNotIndex{\RequirePackage,\DeclareOption,\ProcessOptions,\ExecuteOptions}
94
+% \DoNotIndex{\CurrentOption,\OptionNotUsed}
95
+% \DoNotIndex{\LoadClass,\ClassError,\ClassInfo,\ClassWarningNoLine}
96
+% \DoNotIndex{\documentclass,\usepackage,\document}
97
+% \DoNotIndex{\input,\InputIfFileExists,\IfFileExists,\listfiles}
98
+% \DoNotIndex{\@ifdefinable,\@ifundefined,\@percentchar,\@empty}
99
+% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\AtEndOfPackage}
100
+% \DoNotIndex{\MessageBreak,\typeout,\begin,\end,\noindent}
101
+% \DoNotIndex{\wd,\dp,\ht,\par,\@gobble,\g@addto@macro}
102
+% \DoNotIndex{\z@,\z@skip,\p@,\@ne,\tw@,\thr@@,\@iv,\strip@pt,\@plus}
103
+% ^^A ,\@cclv
104
+% \DoNotIndex{\the,\if,\else,\or,\fi,\ifnum,\ifdim,\ifcase,\ifodd}
105
+% \DoNotIndex{\advance,\multiply,\divide}
106
+% \DoNotIndex{\addtolength,\setlength,\usebox,\setbox,\box,\hbox,\vbox,\hb@xt@}
107
+% \DoNotIndex{\usecounter,\setcounter,\undefined,\@undefined,\loop,\repeat}
108
+% \DoNotIndex{\vspace,\hspace,\vfill,\hfill,\put,\string}
109
+% \DoNotIndex{\csname,\endcsname,\begingroup,\endgroup,\@nameuse}
110
+% \DoNotIndex{\expandafter,\afterassignment,\aftergroup,\noexpand}
111
+% \DoNotIndex{\@tempdima,\@tempdimb,\@tempdimc,\@tempcnta,\@tempcntb}
112
+% \DoNotIndex{\@tempboxa,\@temptokena,\toks@,\mbox,\makebox}
113
+% \DoNotIndex{\reserved@a,\relax,\protect,\space,\@spaces}
114
+% \DoNotIndex{\romannumeral,\Roman,\section,\subsection,\tableofcontents}
115
+% \DoNotIndex{\if@tempswa,\@tempswatrue,\@tempswafalse,\if,\ifx,\@ifstar}
116
+% \DoNotIndex{\bfseries,\normalfont,\normalsize,\small,\large,\Huge}
117
+% \DoNotIndex{\parindent,\parskip,\parsep,\clearpage,\newpage,\thanks,\title}
118
+%
119
+% \DoNotIndex{\TEXT,\author,\maketitle}
120
+%
121
+% \title{The \textsf{leaflet} document class}
122
+%
123
+% \author{\makebox[.25\textwidth][r]{J\"urgen Schlegelmilch} \and
124
+%         Hubert G\"a\ss{}lein \and
125
+%         \makebox[.25\textwidth][l]{Rolf Niepraschk} \and
126
+%         Walter Schmidt}
127
+%
128
+% \date{\filedate}
129
+%
130
+% \maketitle
131
+%
132
+% \tableofcontents
133
+%
134
+% \section{Usage}
135
+% Process the file |leaflet-manual.tex| with \LaTeX\ to see
136
+% details of usage and layout.
137
+%
138
+% \StopEventually{\PrintChanges\PrintIndex}
139
+%
140
+%
141
+% \section{Implementation}
142
+%
143
+%    \begin{macrocode}
144
+%<*class>
145
+%    \end{macrocode}
146
+%
147
+% \subsection{Saving some internal macros\dots}
148
+%
149
+%    \begin{macrocode}
150
+\let\LL@shipout\shipout \let\LL@outputpage\@outputpage
151
+\let\LL@begindvi\@begindvi \let\LL@@end\@@end
152
+%    \end{macrocode}
153
+% \subsection{Option processing}
154
+%
155
+% \changes{v1.0b}{2004/08/12}{New option
156
+%    \texttt{nospecialtricks} for testing purposes. (RN)}
157
+%    \begin{macrocode}
158
+\@ifundefined{iflandscape}{\newif\iflandscape}{}%
159
+\@ifundefined{iftumble}{\newif\iftumble}{}%
160
+\@ifundefined{iftwopart}{\newif\iftwopart}{}%
161
+\@ifundefined{iffoldcorr}{\newif\iffoldcorr}{}%
162
+\newlength\LL@tempdima
163
+\newcommand\LL@debug@info[1]{}%
164
+\DeclareOption{dvips}{\PassOptionsToPackage{\CurrentOption}{graphics}}
165
+\DeclareOption{pdftex}{\PassOptionsToPackage{\CurrentOption}{graphics}}
166
+\DeclareOption{vtex}{\PassOptionsToPackage{\CurrentOption}{graphics}}
167
+\DeclareOption{dvipdfm}{\PassOptionsToPackage{\CurrentOption}{graphics}}
168
+\DeclareOption{twoside}{\OptionNotUsed}
169
+\DeclareOption{twocolumn}{\OptionNotUsed}
170
+\DeclareOption{landscape}{\landscapetrue}
171
+\DeclareOption{portrait}{\landscapefalse}
172
+\DeclareOption{debug}{\let\LL@debug@info\typeout}
173
+\DeclareOption{twopart}{\twoparttrue}
174
+\DeclareOption{notwopart}{\twopartfalse}
175
+\DeclareOption{nospecialtricks}{%
176
+  \AtEndOfClass{%
177
+    \ifLL@combine
178
+      \let\immediate\@@@immediate\let\write\@@@write
179
+      \let\openout\@@@openout\let\closeout\@@@closeout
180
+      \let\special\@@@special\let\@@@exec@outs\relax
181
+    \fi}}
182
+%    \end{macrocode}
183
+%  \begin{macro}{\LL@setPaperSize}
184
+% Some paper sizes are not supported by the article class.
185
+% Hence this work-around.
186
+% These page dimensions \emph{must} be given in landscape orientation!
187
+%    \begin{macrocode}
188
+\newcommand*\LL@setPaperSize{}
189
+\DeclareOption{a3paper}{\def\LL@setPaperSize{%
190
+  \paperwidth=420mm\paperheight=297mm\relax}}%
191
+\@ifdefinable\ifLL@combine{\newif\ifLL@combine}
192
+\DeclareOption{combine}{\LL@combinetrue}
193
+\DeclareOption{nocombine}{\LL@combinefalse}
194
+%    \end{macrocode}
195
+%  \end{macro}
196
+%  \begin{macro}{\LL@selectOutput}
197
+%    \begin{macrocode}
198
+\newcommand*\LL@selectOutput{}
199
+\DeclareOption{frontside}{\def\LL@selectOutput#1#2{#1}}
200
+\DeclareOption{backside}{\def\LL@selectOutput#1#2{#2}}
201
+\DeclareOption{bothsides}{\def\LL@selectOutput#1#2{#1#2}}
202
+%    \end{macrocode}
203
+%  \end{macro}
204
+%    \begin{macrocode}
205
+\DeclareOption{tumble}{\tumbletrue}
206
+\DeclareOption{notumble}{\tumblefalse}
207
+%    \end{macrocode}
208
+%  \begin{macro}{\LL@foldmark}
209
+%  Drawing code for the fold mark.
210
+% (Will be called within a |picture| environment.)
211
+%    \begin{macrocode}
212
+\newcommand*\LL@foldmark{}
213
+\DeclareOption{foldmark}{%
214
+  \def\LL@foldmark{%
215
+    \begingroup
216
+      \linethickness{\LenToUnit{\foldmarkrule}}%
217
+      \@tempdima=\dimexpr\paperheight-\LL@tmargin
218
+      \put(0,\LenToUnit{\@tempdima}){%
219
+        \line(0,-1){\LenToUnit{\foldmarklength}}}%
220
+    \endgroup}%
221
+}
222
+%    \end{macrocode}
223
+% \changes{v1.0d}{2004/12/22}{Invalid code for option ``nofoldmark''
224
+% changed. Thanks to Una Smith |<una.smith@att.net>|. (RN)}
225
+%    \begin{macrocode}
226
+\DeclareOption{nofoldmark}{\def\LL@foldmark{}}%
227
+%    \end{macrocode}
228
+%  \end{macro}
229
+% \changes{v1.1a}{2015/12/27}{New options `foldcorr/nofoldcorr' suggested by
230
+%   Walter Schmidt. (RN)}
231
+%    \begin{macrocode}
232
+\DeclareOption{foldcorr}{\foldcorrtrue}
233
+\DeclareOption{nofoldcorr}{\foldcorrfalse}
234
+%    \end{macrocode}
235
+%    \begin{macrocode}
236
+\newcommand*\LL@toomanypages[2]{}
237
+\DeclareOption{draft}{\PassOptionsToClass{\CurrentOption}{article}%
238
+  \AtEndOfClass{%
239
+    \def\LL@toomanypages#1#2{%
240
+        \ClassWarningNoLine{leaflet}{#1.\MessageBreak#2}}%
241
+  }%
242
+}
243
+\DeclareOption{final}{\PassOptionsToClass{\CurrentOption}{article}%
244
+  \AtEndOfClass{%
245
+    \ifLL@combine
246
+      \def\LL@toomanypages#1#2{%
247
+        \ClassError{leaflet}{#1}{#2.}}%
248
+    \else
249
+      \def\LL@toomanypages#1#2{%
250
+        \ClassWarningNoLine{leaflet}{#1.\MessageBreak#2}}%
251
+    \fi
252
+  }%
253
+}
254
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
255
+\PassOptionsToClass{landscape,a4paper}{article}
256
+\ExecuteOptions{tumble,foldmark,bothsides,combine,landscape,notwopart}
257
+\ProcessOptions\relax
258
+\ifLL@combine
259
+%    \end{macrocode}
260
+%  \begin{macro}{\LL@rotate@I}
261
+%  \begin{macro}{\LL@rotate@II}
262
+% Rotates the output pages.
263
+%    \begin{macrocode}
264
+  \newcommand*\LL@rotate@I{}\newcommand*\LL@rotate@II{}%
265
+  \iflandscape
266
+    \def\LL@rotate@I#1{#1}%
267
+    \iftumble
268
+      \def\LL@rotate@II#1{\rotatebox[origin=c]{180}{#1}}%
269
+    \else
270
+      \def\LL@rotate@II#1{#1}%
271
+    \fi
272
+  \else
273
+    \def\LL@rotate@I#1{\rotatebox[origin=c]{90}{#1}}%
274
+    \iftumble
275
+      \def\LL@rotate@II#1{\rotatebox[origin=c]{270}{#1}}%
276
+    \else
277
+      \def\LL@rotate@II#1{\rotatebox[origin=c]{90}{#1}}%
278
+    \fi
279
+  \fi
280
+%    \end{macrocode}
281
+%  \end{macro}
282
+%  \end{macro}
283
+%  \begin{macro}{\immediate}
284
+%  \begin{macro}{\write}
285
+%  \begin{macro}{\openout}
286
+%  \begin{macro}{\closeout}
287
+% Im Folgenden definieren wir die \TeX{} primitives \cmd{\immediate},
288
+% \cmd{\write}, \cmd{\openout} und \cmd{\closeout} um. Alle nicht
289
+% ``immediate'' ausgef\"uhrten Anweisungen werden dem Makro
290
+% \cmd{\@@@pending@outs} (Kommaliste) hinzugef\"ugt. So k\"onnen speziell die
291
+% \cmd{\write}-Anweisungen unabh\"angig von \TeX's \cmd{\shipout}
292
+% zu einem g\"unstigen Zeitpunkt ausgef\"uhrt werden. For V\TeX\ we
293
+% must keep in mind that \cmd{\immediate}\cmd{\special} exist.
294
+% \changes{v1.0b}{2004/08/12}{\cmd{\special} must be processed similar
295
+% to e.\,g. \cmd{\write} (V\TeX). (RN)}
296
+%    \begin{macrocode}
297
+  \def\@@@pending@outs{}\let\@@@immediate\immediate
298
+  \let\@@@write\write \let\@@@special\special
299
+  \let\@@@openout\openout \let\@@@closeout\closeout
300
+  \def\immediate{%
301
+    \let\write\immediate@write%
302
+    \let\openout\immediate@openout%
303
+    \let\closeout\immediate@closeout%
304
+    \let\special\immediate@special}%
305
+  \def\reset@immediate{%
306
+    \let\write\pending@write%
307
+    \let\openout\pending@openout%
308
+    \let\closeout\pending@closeout%
309
+    \let\special\@@@special}%
310
+  \long\def\pending@write#1#{\pending@@write{#1}}
311
+  \def\immediate@write{%
312
+    \reset@immediate\@@@immediate\@@@write}%
313
+  \def\immediate@openout{%
314
+    \reset@immediate\@@@immediate\@@@openout}%
315
+  \def\immediate@closeout{%
316
+    \reset@immediate\@@@immediate\@@@closeout}%
317
+  \def\immediate@special{%
318
+    \reset@immediate\@@@immediate\@@@special}%
319
+  \let\write\pending@write
320
+  \let\openout\pending@openout
321
+  \let\closeout\pending@closeout
322
+%    \end{macrocode}
323
+%  \begin{macro}{\@dummy@whatsit}
324
+% Makes our redefined primitives more like ``whatsits'' (???).
325
+% `\cmd{\special}|{}|' is also possible for pdf\TeX\ but we get a lot of
326
+% strange warnings (``|Non-PDF special ignored!|'') in this case.
327
+%    \begin{macrocode}
328
+  \def\@dummy@whatsit{\special{}}
329
+  \begingroup\@ifundefined{pdfoutput}%
330
+  {\endgroup}
331
+  {\endgroup
332
+   \ifnum\pdfoutput>\z@\def\@dummy@whatsit{\pdfliteral{}}\fi}
333
+%    \end{macrocode}
334
+%  \end{macro}
335
+%    \begin{macrocode}
336
+  \begingroup\expandafter\expandafter\expandafter\endgroup
337
+  \expandafter\ifx\csname eTeXversion\endcsname\relax
338
+    %%% Test is from Markus Kohm (d.c.t.t, 29 Jun 2004)
339
+    \ClassWarningNoLine{leaflet}{%
340
+    *************************************\MessageBreak
341
+    * It's very recommended to use eTeX  \MessageBreak
342
+    * with this package!                 \MessageBreak
343
+    *************************************}%
344
+%    \end{macrocode}
345
+%  \begin{macro}{\pending@@write}
346
+% Doesn't work correctly without any \cmd{\mark} or \cmd{\special}
347
+% or \cmd{\pdfliteral} command inside.
348
+%    \begin{macrocode}
349
+    \long\def\pending@@write#1#2{%
350
+      \@dummy@whatsit
351
+      \g@addto@macro\@@@pending@outs{\@@@immediate\@@@write\number#1{#2},}}%
352
+%    \end{macrocode}
353
+%  \end{macro}
354
+%  \begin{macro}{\pending@openout}
355
+%    \begin{macrocode}
356
+    \def\pending@openout#1 {%
357
+      \@dummy@whatsit
358
+      \g@addto@macro\@@@pending@outs{\@@@immediate\@@@openout\number#1,}}%
359
+%    \end{macrocode}
360
+%  \end{macro}
361
+%  \begin{macro}{\pending@closeout}
362
+%    \begin{macrocode}
363
+    \def\pending@closeout#1{%
364
+      \@dummy@whatsit
365
+      \g@addto@macro\@@@pending@outs{\@@@immediate\@@@closeout\number#1,}}%
366
+%    \end{macrocode}
367
+%  \end{macro}
368
+%  \begin{macro}{\@@@exec@outs}
369
+% Note to this implementation: The out commands and the page breaks are not
370
+% allways in sync, which means possible wrong page references.
371
+%    \begin{macrocode}
372
+    \newcommand*\@@@exec@outs{%
373
+      \@@@pending@outs\gdef\@@@pending@outs{}%
374
+      \LL@debug@info{%
375
+        >>> execute the output commands of the current page <<<}}%
376
+%    \end{macrocode}
377
+%  \end{macro}
378
+%    \begin{macrocode}
379
+  \else
380
+    \RequirePackage{etex}
381
+%    \end{macrocode}
382
+% Allocation of a new mark class.
383
+%    \begin{macrocode}
384
+    \globmarks\@@@out@mark
385
+    \newcounter{@@total@outs}\setcounter{@@total@outs}{0}
386
+    \newcounter{@@last@exec}\setcounter{@@last@exec}{0}
387
+%    \end{macrocode}
388
+%  \begin{macro}{\pending@@write}
389
+% Doesn't work correctly without any \cmd{\mark} or \cmd{\special}
390
+% or \cmd{\pdfliteral} command inside.
391
+%    \begin{macrocode}
392
+  \long\def\pending@@write#1#2{%
393
+    \global\advance\c@@@total@outs\@ne%
394
+    \marks\@@@out@mark{\the\c@@@total@outs}%
395
+    \g@addto@macro\@@@pending@outs{\@@@immediate\@@@write\number#1{#2},}}%
396
+%    \end{macrocode}
397
+%  \end{macro}
398
+%  \begin{macro}{\pending@openout}
399
+%  \begin{macro}{\pending@@openout}
400
+%  \begin{macro}{\pending@@@openout}
401
+%  \begin{macro}{\@ifequalsign}
402
+%    \begin{macrocode}
403
+\def\pending@openout#1 {%
404
+  \global\advance\c@@@total@outs\@ne%
405
+  \marks\@@@out@mark{\the\c@@@total@outs}%
406
+  \g@addto@macro\@@@pending@outs{\@@@immediate\@@@openout\number#1,}}%
407
+%    \end{macrocode}
408
+%  \end{macro}
409
+%  \end{macro}
410
+%  \end{macro}
411
+%  \end{macro}
412
+%  \begin{macro}{\pending@closeout}
413
+%    \begin{macrocode}
414
+\def\pending@closeout#1{%
415
+  \global\advance\c@@@total@outs\@ne%
416
+  \marks\@@@out@mark{\the\c@@@total@outs}%
417
+  \g@addto@macro\@@@pending@outs{\@@@immediate\@@@closeout\number#1,}}%
418
+%    \end{macrocode}
419
+%  \end{macro}
420
+%  \begin{macro}{\@@@exec@outs}
421
+% With the call of \cmd{\@@@exec@outs} we simulate \TeX's
422
+% execution of non-immediate output commands. The number of pending
423
+% commands which can be executed must be decremented by
424
+% $\cmd{\value}|{@@total@outs}| - \cmd{\botmarks}\cmd{\@@@out@mark}$. The
425
+% remaining commands must still wait until the next output page is
426
+% ready. It works only for output commands in the main text which moved to
427
+% the next page but not for floating output commands.
428
+%    \begin{macrocode}
429
+    \newcommand*\@@@exec@outs{%
430
+      \begingroup
431
+%    \end{macrocode}
432
+% Pending io's $=\cmd{\@tempcntb} = \mbox{TOTAL-OUTS}\,-\,\mbox{LAST-EXEC}$
433
+%    \begin{macrocode}
434
+        \@tempcntb\c@@@total@outs\advance\@tempcntb-\c@@@last@exec%
435
+        \edef\reserved@a{\botmarks\@@@out@mark}%
436
+        \ifx\reserved@a\@empty\@tempcnta\z@\else\@tempcnta\reserved@a\fi%
437
+        \LL@debug@info{PENDING-OUTS:\the\@tempcntb\space\space
438
+                       TOTAL-OUTS:\the\c@@@total@outs\space\space
439
+                       LAST-EXEC:\the\c@@@last@exec\space\space
440
+                       TOPMARK:\topmarks\@@@out@mark\space\space
441
+                       FIRSTMARK:\firstmarks\@@@out@mark\space\space
442
+                       BOTMARK:\botmarks\@@@out@mark}%
443
+%    \end{macrocode}
444
+% Last valid pending entry $ = \cmd{\@tempcntb} =
445
+%   \mbox{PENDING-OUTS}\,-\,\mbox{TOTAL-OUTS}\,+\,\mbox{BOTMARK} $
446
+%   \par\noindent
447
+% Number of invalid (moved) out's $ = \cmd{\@tempcnta} =
448
+%   \mbox{TOTAL-OUTS}\,-\,\mbox{BOTMARK} $
449
+%    \begin{macrocode}
450
+        \advance\@tempcnta-\c@@@total@outs \advance\@tempcntb\@tempcnta
451
+        \@tempcnta-\@tempcnta%
452
+        \ifnum\@tempcnta>\z@
453
+          \LL@debug@info{%
454
+            >>> resave \the\@tempcnta\space output command(s).
455
+                Too early to execute! <<<}%
456
+        \fi
457
+        \@tempcnta\z@ \def\reserved@b{}%
458
+        \@for\reserved@a :=\@@@pending@outs\do{%
459
+          \ifx\reserved@a\@empty\else
460
+            \ifnum\@tempcnta<\@tempcntb%
461
+              \reserved@a%  execute output's related to the current page box.
462
+              \global\advance\c@@@last@exec\@ne
463
+              \LL@debug@info{>>> execute output command number
464
+                       \the\c@@@last@exec\space<<<}%
465
+            \else
466
+%    \end{macrocode}
467
+% Other output's must be resaved and still pending.
468
+%    \begin{macrocode}
469
+              \expandafter\g@addto@macro\expandafter\reserved@b\expandafter{%
470
+                \reserved@a,}%
471
+            \fi
472
+            \advance\@tempcnta\@ne%
473
+          \fi}%
474
+        \expandafter\@temptokena\expandafter{\reserved@b}%
475
+        \xdef\@@@pending@outs{\the\@temptokena}%
476
+      \endgroup}%
477
+%    \end{macrocode}
478
+%  \end{macro}
479
+%    \begin{macrocode}
480
+  \fi% end of eTeX test.
481
+%    \end{macrocode}
482
+%  \end{macro}
483
+%  \end{macro}
484
+%  \end{macro}
485
+%  \end{macro}
486
+%  \begin{macro}{\protected@write}
487
+%  Because our redefined \cmd{\write} is expandable we must protect
488
+%  it inside of \LaTeX's \cmd{\protected@write}.
489
+%    \begin{macrocode}
490
+  \long\def\protected@write#1#2#3{%
491
+    \begingroup
492
+       \let\thepage\relax
493
+       #2%
494
+       \let\protect\@unexpandable@protect
495
+       \edef\reserved@a{\noexpand\write#1{#3}}%
496
+       \reserved@a%
497
+    \endgroup
498
+    \if@nobreak\ifvmode\nobreak\fi\fi}%
499
+%    \end{macrocode}
500
+%  \end{macro}
501
+%  \begin{macro}{\shipout}
502
+%  We make \LaTeX's \cmd{\shipout} inefficacious (no more shipout at
503
+%  all).
504
+%    \begin{macrocode}
505
+  \def\shipout{\deadcycles\z@\setbox\@tempboxa=}
506
+%    \end{macrocode}
507
+%  \end{macro}
508
+%  \begin{macro}{\@begindvi}
509
+%  Delay \cmd{\@begindvi} to be executed until the real page output.
510
+%    \begin{macrocode}
511
+  \let\@begindvi\@empty
512
+\fi% end of \ifLL@combine
513
+%    \end{macrocode}
514
+%  \end{macro}
515
+%  \begin{macro}{\LL@toomanypages}
516
+%  Now elsewhere \dots
517
+%  \end{macro}
518
+% \changes{v1.1a}{2015/12/27}{Using \cmd{\dimexpr} instead of
519
+%   package `calc'.(RN)}
520
+%    \begin{macrocode}
521
+\LoadClass{article}
522
+\RequirePackage{everyshi,graphicx}
523
+%    \end{macrocode}
524
+%  \begin{macro}{\LL@pagesize@specials}
525
+% Now the graphics driver is known.
526
+% We will Check the graphics driver and set special code for page
527
+% dimensions and other.
528
+% \changes{v1.0e}{2013/11/06}{Patch from Toby Thurston for XeLaTeX. (RN)}
529
+%    \begin{macrocode}
530
+\newcommand*\LL@pagesize@specials[2]{}
531
+\@ifundefined{Gin@driver}{}%
532
+{%
533
+  \ifx\Gin@driver\@empty\else%
534
+    \filename@parse{\Gin@driver}\@tempswafalse%
535
+    \def\reserved@a{dvips}%
536
+    \ifx\filename@base\reserved@a\@tempswatrue\fi%
537
+    \def\reserved@a{dvipdfm}%
538
+    \ifx\filename@base\reserved@a\@tempswatrue\fi%
539
+    \if@tempswa
540
+      \ClassInfo{leaflet}{Generating code for dvips}%
541
+      \def\LL@pagesize@specials#1#2{%
542
+        \@tempdima=#1\@tempdimb=#2%
543
+        \AtBeginDvi{\special{papersize=\the\@tempdima,\the\@tempdimb}}}%
544
+    \fi
545
+    \def\reserved@a{pdftex}%
546
+    \ifx\filename@base\reserved@a
547
+      \ClassInfo{leaflet}{Generating code for pdfTeX}%
548
+      \def\LL@pagesize@specials#1#2{%
549
+        \@tempdima=#1\@tempdimb=#2%
550
+        \pdfpagewidth\@tempdima\pdfpageheight\@tempdimb}%
551
+    \fi
552
+    \def\reserved@a{xetex}%
553
+    \ifx\filename@base\reserved@a
554
+      \ClassInfo{leaflet}{Generating code for XeTeX}%
555
+      \def\LL@pagesize@specials#1#2{%
556
+        \@tempdima=#1\@tempdimb=#2%
557
+        \pdfpagewidth\@tempdima\pdfpageheight\@tempdimb}%
558
+    \fi
559
+    \def\reserved@a{vtex}%
560
+    \ifx\filename@base\reserved@a
561
+      \ClassInfo{leaflet}{Generating code for VTeX}%
562
+      \def\LL@pagesize@specials#1#2{%
563
+        \@tempdima=#1\@tempdimb=#2%
564
+        \mediawidth\@tempdima\mediaheight\@tempdimb}%
565
+    \fi
566
+  \fi
567
+}
568
+%    \end{macrocode}
569
+%  \end{macro}
570
+%
571
+%  \begin{macro}{\LL@CmdIgnored}
572
+%    \begin{macrocode}
573
+\newcommand*\LL@CmdIgnored[1]{%
574
+  \ClassWarning{leaflet}{%
575
+    `\string#1' ignored}}
576
+%    \end{macrocode}
577
+%  \end{macro}
578
+% \subsection{Changing the class properties}
579
+%    \begin{macrocode}
580
+\setlength{\parskip}{1ex plus 2pt}
581
+\@listi%
582
+\setlength{\labelwidth}{\leftmargin}
583
+\addtolength{\labelwidth}{-\labelsep}
584
+\pagestyle{empty}
585
+\headheight\z@
586
+\headsep\z@
587
+\footskip\z@
588
+\marginparwidth\z@
589
+\marginparsep\z@
590
+\sloppy
591
+\setcounter{secnumdepth}{0}
592
+%\renewcommand\marginpar[2][]{\LL@CmdIgnored{\marginpar}}
593
+\renewcommand\twocolumn[1][]{\LL@CmdIgnored{\twocolumn}}
594
+\renewcommand\onecolumn{\LL@CmdIgnored{\onecolumn}}
595
+\renewcommand\topfraction{0.7}
596
+\renewcommand\bottomfraction{0.7}
597
+\setlength{\textfloatsep}{10pt plus 4pt minus 3pt}
598
+\setlength{\parindent}{\z@}
599
+\setlength{\leftmargini}{1.5em}
600
+\setlength{\leftmarginii}{1.5em}
601
+\setlength{\leftmarginiii}{1.5em}
602
+\setlength{\leftmarginiv}{1.5em}
603
+\setlength{\leftmarginv}{1.5em}
604
+\setlength{\leftmarginvi}{1.5em}
605
+\setlength{\labelsep}{.5em}
606
+\setlength  \labelwidth{\leftmargini}
607
+\addtolength\labelwidth{-\labelsep}
608
+%    \end{macrocode}
609
+%  \begin{macro}{\noparskip}
610
+%    \begin{macrocode}
611
+\def\noparskip{\par\vspace{-\parskip}}
612
+%    \end{macrocode}
613
+%  \end{macro}
614
+%  Modification of list and section parameters for a more compact layout.
615
+%    \begin{macrocode}
616
+\let\old@small\small
617
+\renewcommand{\small}{\old@small\let\@listi\@listI}
618
+\let\old@footnotesize\footnotesize
619
+\renewcommand{\footnotesize}{\old@footnotesize\let\@listi\@listI}
620
+%    \end{macrocode}
621
+%  \begin{macro}{\sectfont}
622
+% User macro for changing the font of the typesetted parameter of
623
+% the \cmd{\?section} commands.
624
+%    \begin{macrocode}
625
+\newcommand{\sectfont}{\bfseries}
626
+%    \end{macrocode}
627
+%  \end{macro}
628
+%    \begin{macrocode}
629
+\renewcommand\section{\@startsection{section}{1}{\z@}%
630
+  {-3.5ex \@plus -.75ex}%
631
+  {1ex} %{1.5ex}%
632
+  {\normalfont\large\sectfont}}
633
+\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
634
+  {-2.5ex plus -.5ex}%
635
+  {1\p@} %{1ex}%
636
+  {\normalfont\normalsize\sectfont}}
637
+\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
638
+  {-2.5ex plus -.5ex}%
639
+  {-1em}%
640
+  {\normalfont\normalsize\sectfont}}
641
+\def\part{\LL@CmdIgnored{\part}\secdef\@part\@spart}
642
+\def\@part[#1]#2{}
643
+\def\@spart#1{}
644
+
645
+\renewcommand*\descriptionlabel[1]{%
646
+  \hspace\labelsep\normalfont\descfont #1}
647
+%    \end{macrocode}
648
+%  \begin{macro}{\descfont}
649
+% User macro for changing the font of the description label.
650
+%    \begin{macrocode}
651
+\newcommand*\descfont{\bfseries}
652
+%    \end{macrocode}
653
+%  \end{macro}
654
+%    \begin{macrocode}
655
+\iffalse
656
+% Doesn't work!
657
+\g@addto@macro\enumerate{\parsep2\p@\@plus2\p@\@minus\z@}
658
+\g@addto@macro\itemize{\parsep2\p@\@plus2\p@\@minus\z@}
659
+\g@addto@macro\description{\parsep2\p@\@plus2\p@\@minus\z@}
660
+\else
661
+\newcommand*\LL@listsetup{%
662
+%  \parsep.445ex\@plus.445ex\@minus.2225ex%
663
+%  \parsep.5ex\@plus.5ex\@minus.25ex%
664
+  \parsep1ex\@plus.5ex\@minus.25ex%
665
+  \LL@debug@info{***parsep=\the\parsep}%
666
+%  \itemsep.25\parsep
667
+  \itemsep\z@
668
+  \LL@debug@info{***itemsep=\the\itemsep}%
669
+  \topsep\z@
670
+  \LL@debug@info{***topsep=\the\topsep}%
671
+%  \partopsep\z@
672
+  \LL@debug@info{***partopsep=\the\partopsep}%
673
+}
674
+\def\enumerate{%
675
+  \ifnum \@enumdepth >\thr@@\@toodeep\else
676
+    \advance\@enumdepth\@ne
677
+    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
678
+    \expandafter
679
+    \list
680
+      \csname label\@enumctr\endcsname
681
+      {\usecounter\@enumctr
682
+        \def\makelabel##1{\hss\llap{##1}}%
683
+        %\def\makelabel##1{##1\hfill}%
684
+        %\def\makelabel##1{\hss##1}%
685
+        \LL@listsetup
686
+      }%
687
+  \fi}
688
+\def\itemize{%
689
+  \ifnum \@itemdepth >\thr@@\@toodeep\else
690
+    \advance\@itemdepth\@ne
691
+    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
692
+    \expandafter
693
+    \list
694
+      \csname\@itemitem\endcsname
695
+      {%
696
+        \def\makelabel##1{\hss\llap{##1}}%
697
+        %\def\makelabel##1{##1\hfill}%
698
+        %\def\makelabel##1{\hss##1}%
699
+        \LL@listsetup
700
+      }%
701
+  \fi}
702
+\renewenvironment{description}
703
+               {\list{}{\labelwidth\z@ \itemindent-\leftmargin
704
+                        \let\makelabel\descriptionlabel
705
+                        \LL@listsetup}}
706
+               {\endlist}
707
+\fi
708
+%    \end{macrocode}
709
+%
710
+% \subsection{Changing the page dimensions}
711
+%
712
+% \begin{macro}{\setmargins}
713
+% User command to specify the margins. (o, u, l, r)
714
+%
715
+% |\setmargins|\marg{top}\marg{bottom}\marg{left}\marg{right}
716
+%
717
+% The new user interface!
718
+% By default, the \textsf{leaflet} class does not use headings,
719
+% footings and marginal notes.
720
+% If the user desires, these can be restored by setting the respective
721
+% lengths \emph{before} calling |\setmargins|.
722
+% Setting the margins should \emph{always} be done using |\setmargins|;
723
+% if the user assigns to any of the length registers |\topmargin|,
724
+% |\evensidemargin|, |\oddsidemargin| using |\setlength|, chaos will
725
+% happen.
726
+%
727
+%    \begin{macrocode}
728
+\newcommand*\setmargins[4]{%
729
+%    \end{macrocode}
730
+% temp. top!
731
+%    \begin{macrocode}
732
+   \setlength\topmargin{#1}%
733
+   \edef\LL@tmargin{\the\topmargin}%
734
+%    \end{macrocode}
735
+% temp. bottom!
736
+%    \begin{macrocode}
737
+   \setlength\evensidemargin{#2}%
738
+   \textheight=\dimexpr\paperheight
739
+     -\topmargin-\evensidemargin-\headheight-\headsep-\footskip
740
+%    \end{macrocode}
741
+% temp. left!
742
+%    \begin{macrocode}
743
+   \setlength\oddsidemargin{#3}%
744
+%    \end{macrocode}
745
+% temp. right!
746
+%    \begin{macrocode}
747
+   \setlength\evensidemargin{#4}%
748
+   \textwidth=\dimexpr\paperwidth
749
+     -\oddsidemargin-\evensidemargin-\marginparwidth-\marginparsep
750
+%    \end{macrocode}
751
+% real top!
752
+%    \begin{macrocode}
753
+   \addtolength\topmargin{-1in}%
754
+%    \end{macrocode}
755
+% real left!
756
+%    \begin{macrocode}
757
+   \addtolength\oddsidemargin{-1in}%
758
+%    \end{macrocode}
759
+%  probably not necessary
760
+%    \begin{macrocode}
761
+   \evensidemargin\oddsidemargin
762
+}
763
+%    \end{macrocode}
764
+%  \end{macro}
765
+% The dimensions of a single small page.
766
+%    \begin{macrocode}
767
+\LL@setPaperSize
768
+\paperwidth=0.333333334\paperwidth
769
+\setmargins{11mm}{11mm}{8mm}{8mm}
770
+%    \end{macrocode}
771
+%
772
+% \subsection{Additional user macros}
773
+%
774
+% \begin{macro}{\foldmarkrule}
775
+% \begin{macro}{\foldmarklength}
776
+% The dimension of the foldmark between page~2 and page~3.
777
+%    \begin{macrocode}
778
+\newcommand*\foldmarkrule{0.4pt}
779
+\newcommand*\foldmarklength{2mm}
780
+%    \end{macrocode}
781
+%  \end{macro}
782
+%  \end{macro}
783
+%  \begin{macro}{\AddToBackground}
784
+%  \begin{macro}{\AddToBackground*}
785
+%  Adds the given parameter~|#2| (some picture commands) to a
786
+%  macro which will be used inside a zero-dimensional picture environment
787
+%  located at the lower left corner of a page. Parameter~|#1|
788
+%  selects the page number. The star version adds the picture commands to the
789
+%  background of one of the combined large pages instead of one of the small
790
+%  pages.
791
+%    \begin{macrocode}
792
+\newcommand\AddToBackground{%
793
+  \@ifstar{\@tempswatrue\LL@AddToBackground}
794
+          {\@tempswafalse\LL@AddToBackground}}
795
+\@onlypreamble\AddToBackground
796
+\newcommand\LL@AddToBackground[2]{%
797
+  \if@tempswa\def\@tempa{LL@largePic}\else\def\@tempa{LL@smallPic}\fi
798
+  \expandafter\providecommand\csname\@tempa\@Roman{#1}\endcsname{}%
799
+  \expandafter\g@addto@macro\csname\@tempa\@Roman{#1}\endcsname{#2}}
800
+%    \end{macrocode}
801
+%  \end{macro}
802
+%  \end{macro}
803
+% \begin{macro}{\LenToUnit}
804
+% \changes{v1.0a}{2004/08/08}{New macro \cmd{\LenToUnit}. (RN)}
805
+% \changes{v1.1a}{2015/12/27}{\cmd{\providecommand} instead of
806
+%   \cmd{\newcommand}. (RN)}
807
+% \cmd{\LenToUnit}\marg{dimension} can be used in a
808
+% |picture| environment instead of multiples of \cmd{\unitlength}.
809
+%    \begin{macrocode}
810
+\providecommand\LenToUnit[1]{#1\@gobble}
811
+%    \end{macrocode}
812
+%  \end{macro}
813
+%  \begin{macro}{\CutLine}
814
+%  \begin{macro}{\CutLine*}
815
+%  \begin{macro}{\Scissors}
816
+% Adds a dotted line with two scissors on the left side of the page given as
817
+% parameter |#1|.
818
+% The starred version draws only the dotted line.
819
+%    \begin{macrocode}
820
+\newcommand*\CutLine{%
821
+  \@ifstar{\@tempswatrue\LL@CutLine}{\@tempswafalse\LL@CutLine}}
822
+\@onlypreamble\CutLine
823
+\newcommand*\LL@CutLine[1]{%
824
+  \ifLL@combine
825
+    \ifx\Scissors\@empty\@tempswatrue\fi
826
+    \if@tempswa
827
+      \AddToBackground{#1}{%
828
+        \put(0,0){%
829
+          \rotatebox{90}{\makebox(\LenToUnit{\paperheight},0){%
830
+            \normalsize
831
+            \dotfill}}}}%
832
+    \else
833
+      \AddToBackground{#1}{%
834
+        \put(0,0){%
835
+          \rotatebox{90}{\makebox(\LenToUnit{\paperheight},0){%
836
+            \normalsize
837
+            \dotfill\Scissors\dotfill\dotfill\Scissors\dotfill}}}}%
838
+    \fi
839
+  \fi}
840
+\IfFileExists{pifont.sty}
841
+  {\RequirePackage{pifont}%
842
+   \newcommand*\Scissors{\raisebox{-0.85ex}{\large\ding{34}}}}%
843
+  {\newcommand*\Scissors{}}
844
+%    \end{macrocode}
845
+%  \end{macro}
846
+%  \end{macro}
847
+%  \end{macro}
848
+%  Adds the fold mark code between page~2 and page~3.
849
+%    \begin{macrocode}
850
+\AddToBackground{3}{\LL@foldmark}
851
+%    \end{macrocode}
852
+%
853
+% \subsection{Page construction and output}
854
+%
855
+% \subsubsection{Intercepting the small pages}
856
+%
857
+%  \begin{macro}{\vb@xt@}
858
+%  Similar to \cmd{\hb@xt@} (should be part of the \LaTeX\ kernel).
859
+%    \begin{macrocode}
860
+\providecommand*\vb@xt@{\vbox to}
861
+%    \end{macrocode}
862
+%  \end{macro}
863
+%  We use our own page saving macro instead of real \LaTeX\ output.
864
+%    \begin{macrocode}
865
+\AtBeginDocument{\EveryShipout{\LL@savePage}}
866
+%    \end{macrocode}
867
+%  \begin{macro}{LL@page}
868
+% A counter for the small pages (absolute counting).
869
+%    \begin{macrocode}
870
+\newcounter{LL@page}\setcounter{LL@page}{1}
871
+\newcommand\LL@tempa{}
872
+%    \end{macrocode}
873
+%  \end{macro}
874
+%  \begin{macro}{\LL@savePage}
875
+% With ``combine'' option the six small pages will be saved in box registers
876
+% (\cmd{\LL@boxI}\dots \cmd{\LL@boxVI}).
877
+% The box255 with the page content must be a bit moved to get a
878
+% ``normal-sized'' box.
879
+% \changes{v1.1a}{2015/12/27}{Additions for new option `foldcorr'. (RN)}
880
+%    \begin{macrocode}
881
+\newcommand*\LL@savePage{%
882
+  \ifnum\c@LL@page<7\relax
883
+    \LL@tempdima=\paperwidth
884
+    \ifLL@combine
885
+      \iffoldcorr
886
+        \@tempswafalse
887
+        \ifnum\c@LL@page=4\relax
888
+          \@tempswatrue
889
+        \else
890
+          \ifnum\c@LL@page=5\relax
891
+            \@tempswatrue
892
+          \fi
893
+        \fi
894
+        \if@tempswa\LL@tempdima=0.9797979798\paperwidth
895
+        \else\LL@tempdima=1.0101010101\paperwidth \fi
896
+      \fi
897
+      \@@@exec@outs
898
+      \expandafter\newsavebox\csname LL@box\Roman{LL@page}\endcsname%
899
+      \setbox\@cclv=\vbox{\vskip1in\unvbox\@cclv}%
900
+      \setbox\@cclv=\vbox{\moveright1in\box\@cclv}%
901
+      \setbox\@cclv=\hb@xt@\paperwidth{\box\@cclv\hss}%
902
+      \iffoldcorr\setbox\@cclv=\hb@xt@\LL@tempdima{\hss\box\@cclv\hss}\fi
903
+%    \end{macrocode}
904
+% Add a background picture to a single small page (`combine').
905
+%    \begin{macrocode}
906
+      \setbox\@cclv=\vb@xt@\paperheight{%
907
+        \vbox{%
908
+          \pictur@(0,0)(0,\LenToUnit{\paperheight})%
909
+            \begingroup
910
+              \set@typeset@protect
911
+              \paperwidth=\LL@tempdima
912
+              \@nameuse{LL@smallPic\Roman{LL@page}}%
913
+            \endgroup
914
+          \endpicture
915
+        }%
916
+        \nointerlineskip\box\@cclv\vss
917
+      }%
918
+      \global\expandafter\setbox
919
+        \csname LL@box\Roman{LL@page}\endcsname=\box\@cclv
920
+      \typeout{\@spaces[\the\c@LL@page] ==> [\Roman{LL@page}]}%
921
+    \else
922
+%    \end{macrocode}
923
+% Add a background picture to a single small page (`nocombine').
924
+%    \begin{macrocode}
925
+      \setbox\@cclv\vbox{%
926
+        \vbox{\@tempdima=1in\relax
927
+          \@tempdimb=\paperheight\advance\@tempdimb-\@tempdima
928
+          \pictur@(0,0)(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb})%
929
+            \begingroup
930
+              \set@typeset@protect
931
+              \@nameuse{LL@smallPic\Roman{LL@page}}%
932
+            \endgroup
933
+          \endpicture
934
+        }%
935
+        \nointerlineskip\box\@cclv
936
+      }%
937
+    \fi
938
+  \fi
939
+  \ifnum\c@LL@page=7\relax
940
+%    \end{macrocode}
941
+% Make this an error or warning message, depending on class option.
942
+% (|-->| warning in all cases?)
943
+%    \begin{macrocode}
944
+    \begingroup
945
+      \set@typeset@protect
946
+      \LL@toomanypages{%
947
+        The text you supplied fills more than six pages\MessageBreak
948
+        and will therefore not fit onto a single flyer}{%
949
+        Try using smaller fonts or reducing vertical space}%
950
+    \endgroup
951
+  \fi
952
+  \stepcounter{LL@page}}
953
+%    \end{macrocode}
954
+%  \end{macro}
955
+%
956
+% \subsubsection{Generating missing small pages}
957
+%
958
+% NOTE TO OURSELVES:
959
+%  All the following must be done if the document code is already
960
+%  processed.
961
+%    \begin{macrocode}
962
+\ifLL@combine
963
+%    \end{macrocode}
964
+%  \begin{macro}{\@@end}
965
+%    \begin{macrocode}
966
+  \def\@@end{%
967
+    \clearpage\pagestyle{empty}%
968
+%    \end{macrocode}
969
+% Restore the original \cmd{\@outputpage} command (removing any related
970
+% background pictures).
971
+%    \begin{macrocode}
972
+    \let\@outputpage\LL@outputpage
973
+%    \end{macrocode}
974
+% Suppresses all everyshi's clients (removing other kinds of
975
+% background pictures) but our page saving macro is still needed for
976
+% the next step and must be set again.
977
+%    \begin{macrocode}
978
+    \def\@EveryShipout@Hook{}%
979
+    \def\@EveryShipout@AtNextHook{}%
980
+    \EveryShipout{\LL@savePage}%
981
+%    \end{macrocode}
982
+% Create empty pages if necessary.
983
+%    \begin{macrocode}
984
+    \loop\ifnum\c@LL@page<7\relax
985
+      \ClassInfo{leaflet}{Generating empty page \the\c@page}%
986
+      \null\newpage
987
+    \repeat
988
+%    \end{macrocode}
989
+%
990
+% \subsubsection{Reassembling the small pages}
991
+%
992
+% Here begins the real output using \LaTeX's original \cmd{\shipout}.
993
+% The \textsf{everyshi} package isn't active any more.
994
+% The begin dvi hook is reactivated.
995
+%    \begin{macrocode}
996
+    \let\shipout\LL@shipout \let\@begindvi\LL@begindvi
997
+    \paperwidth=3\paperwidth
998
+    \iflandscape
999
+      \LL@pagesize@specials{\paperwidth}{\paperheight}%
1000
+    \else
1001
+      \LL@pagesize@specials{\paperheight}{\paperwidth}%
1002
+    \fi
1003
+%    \end{macrocode}
1004
+%  \begin{macro}{\LL@shipoutPage}
1005
+% \changes{v1.0c}{2004/08/13}{Fix \cmd{\protect}-ion problems. (RN/HjG)}
1006
+% This is similar to \LaTeX's \cmd{\@outputpage}, but without a group;
1007
+% \cmd{\set@display@protect} seems to work as well.
1008
+%  \begin{macro}{\LL@preparePages}
1009
+%  \begin{macro}{\LL@preparePage}
1010
+% Helper macros for page output: reassemble the small pages.
1011
+%
1012
+%    \begin{macrocode}
1013
+    \newcommand*\LL@shipoutPage[1]{%
1014
+%     \set@display@protect
1015
+      \let \protect \noexpand
1016
+      \shipout\vb@xt@\paperheight{%
1017
+        \set@typeset@protect
1018
+        \vskip-1in%
1019
+        \@begindvi\hb@xt@\paperwidth{\hskip-1in##1\hss}\vss}}%
1020
+    \newcommand*\LL@preparePages[3]{%
1021
+      \typeout{[\@Roman{##1}\space\@Roman{##2}\space\@Roman{##3}] ==>}%
1022
+%    \end{macrocode}
1023
+% Add a background picture to a large page.
1024
+%    \begin{macrocode}
1025
+      \pictur@(0,0)\@nameuse{LL@largePic\Roman{page}}\endpicture%
1026
+      \LL@preparePage{##1}\LL@preparePage{##2}\LL@preparePage{##3}}%
1027
+    \newcommand*\LL@preparePage[1]{%
1028
+      \expandafter\box\csname LL@box\@Roman{##1}\endcsname}%
1029
+%    \end{macrocode}
1030
+%  \end{macro}
1031
+%  \end{macro}
1032
+%  \end{macro}
1033
+% Combine and output the frontside and the backside.
1034
+% The option two part arranges the pages in a different than the ``natural''
1035
+% order, to allow the typesetting of a 4 page leaflet and a detachable 2 page
1036
+% form, for summaries, fill-in forms, applications, questionnaires, etc.
1037
+%    \begin{macrocode}
1038
+      \LL@selectOutput
1039
+    \iftwopart
1040
+        {\setcounter{page}{1}%
1041
+         \LL@shipoutPage{\LL@rotate@I{\LL@preparePages{6}{4}{1}}}}%
1042
+        {\setcounter{page}{2}%
1043
+         \LL@shipoutPage{\LL@rotate@II{\LL@preparePages{2}{3}{5}}}}%
1044
+    \else
1045
+        {\setcounter{page}{1}%
1046
+         \LL@shipoutPage{\LL@rotate@I{\LL@preparePages{5}{6}{1}}}}%
1047
+        {\setcounter{page}{2}%
1048
+         \LL@shipoutPage{\LL@rotate@II{\LL@preparePages{2}{3}{4}}}}%
1049
+    \fi
1050
+      \LL@@end
1051
+  }%
1052
+%    \end{macrocode}
1053
+% End of the redefinition of \cmd{\@@end}.
1054
+%  \end{macro}
1055
+%    \begin{macrocode}
1056
+\else
1057
+%    \end{macrocode}
1058
+% Create empty pages if necessary and then call the normal \LaTeX\ end.
1059
+%    \begin{macrocode}
1060
+  \LL@pagesize@specials{\paperwidth}{\paperheight}%
1061
+  \AtEndDocument{%
1062
+    \clearpage\pagestyle{empty}%
1063
+    \loop\ifnum\c@LL@page<7\relax
1064
+      \ClassInfo{leaflet}{Generating empty page \the\c@page}%
1065
+      \null\newpage
1066
+    \repeat
1067
+  }
1068
+\fi
1069
+%</class>
1070
+%    \end{macrocode}
1071
+% Done. Phew! (Did you hear that deep-drawn sigh?)
1072
+%
1073
+% \Finale
1074
+%\endinput
1075
+%
1076
+% And here comes the user manual ...
1077
+%<*manual>
1078
+\listfiles
1079
+\errorcontextlines=99
1080
+\documentclass[
1081
+%%notumble,
1082
+%%nofoldmark,
1083
+%%dvipdfm,
1084
+%%portrait,
1085
+%%titlepage,
1086
+%%nocombine,
1087
+%%a3paper,
1088
+%%debug,
1089
+%%nospecialtricks,
1090
+%%draft,
1091
+]{leaflet}
1092
+
1093
+%\setcounter{secnumdepth}{1}
1094
+
1095
+\renewcommand*\foldmarkrule{.3mm}
1096
+\renewcommand*\foldmarklength{5mm}
1097
+%\setmargins{11mm}{3in}{8mm}{20mm}
1098
+%
1099
+%\pagestyle{plain}
1100
+
1101
+\usepackage[T1]{fontenc}
1102
+\usepackage{textcomp}
1103
+\usepackage{mathptmx}
1104
+\usepackage[scaled=0.9]{helvet}
1105
+% the TeX and LaTeX logos for use with Times
1106
+\makeatletter
1107
+\def\ptmTeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.075emX\@}
1108
+\DeclareRobustCommand{\ptmLaTeX}{L\kern-.3em
1109
+        {\setbox0\hbox{T}%
1110
+         %\vb@xt@ % :-)
1111
+         \vbox to\ht0{\hbox{%
1112
+                            \csname S@\f@size\endcsname
1113
+                            \fontsize\sf@size\z@
1114
+                            \math@fontsfalse\selectfont
1115
+                            A}%
1116
+                      \vss}%
1117
+        }%
1118
+        \kern-.12em
1119
+        \ptmTeX}
1120
+\makeatother
1121
+\let\TeX=\ptmTeX
1122
+\let\LaTeX=\ptmLaTeX
1123
+\usepackage{shortvrb}
1124
+\MakeShortVerb{\|}
1125
+\usepackage{url}
1126
+\usepackage{graphicx}
1127
+\usepackage[dvipsnames,usenames]{color}
1128
+\definecolor{LIGHTGRAY}{gray}{.9}
1129
+
1130
+%%%%\renewcommand{\descfont}{\normalfont}
1131
+\newcommand\Lpack[1]{\textsf{#1}}
1132
+\newcommand\Lclass[1]{\textsf{#1}}
1133
+\newcommand\Lopt[1]{\texttt{#1}}
1134
+\newcommand\Lprog[1]{\textit{#1}}
1135
+
1136
+\newcommand*\defaultmarker{\textsuperscript\textasteriskcentered}
1137
+
1138
+\title{The document class \Lclass{leaflet}}
1139
+\author{%
1140
+  Rolf Niepraschk\\
1141
+  Walter Schmidt\\
1142
+  Hubert G\"a\ss lein}
1143
+\date{Last updated~\docdate\\printed \today}
1144
+
1145
+\CutLine*{1}% Dotted line without scissors
1146
+\CutLine{6}%  Dotted line with scissors
1147
+
1148
+\AddToBackground{5}{%  Background of a small page
1149
+  \put(0,0){\textcolor{Cerulean}{\rule{\paperwidth}{\paperheight}}}}
1150
+
1151
+\AddToBackground*{2}{% Background of a large page
1152
+  \put(\LenToUnit{.5\paperwidth},\LenToUnit{.5\paperheight}){%
1153
+    \makebox(0,0)[c]{%
1154
+      \resizebox{.9\paperwidth}{!}{\rotatebox{35.26}{%
1155
+        \textsf{\textbf{\textcolor{LIGHTGRAY}{BACKGROUND}}}}}}}}
1156
+
1157
+\begin{document}
1158
+
1159
+\maketitle
1160
+\thispagestyle{empty}
1161
+
1162
+%%\LARGE
1163
+
1164
+%%\tableofcontents
1165
+
1166
+
1167
+\section{Overview}
1168
+
1169
+The document class \Lclass{leaflet} creates a document of (up to) six
1170
+small pages in portrait orientation, arranged physically on two
1171
+``normal-size'' pages. The target page sizes supported by the standard
1172
+\LaTeX{}  \Lclass{article} are available, plus |a3paper|. Printing these
1173
+to both sides of a sheet and folding appropriately will yield a six-page
1174
+leaflet.
1175
+
1176
+%% TEST: These commands are no longer disabled!
1177
+\iffalse
1178
+\reversemarginpar
1179
+\marginpar[XXX]{YYY}
1180
+\fi
1181
+%% TEST: These commands are disabled!
1182
+\onecolumn
1183
+\twocolumn[WWW]
1184
+%% end of TEST
1185
+
1186
+\section{Requirements}
1187
+
1188
+Using the \Lclass{leaflet} class requires that the final
1189
+document is created in PostScript or PDF format, using
1190
+\begin{itemize}
1191
+  \item \TeX{} and \Lprog{dvips}, or
1192
+  \item pdf\TeX{}, or
1193
+  \item V\TeX{} in PS or PDF mode.
1194
+\end{itemize}
1195
+(Some other drivers supported by standard \LaTeX{} work as well.)
1196
+
1197
+The non-standard macro package \Lpack{everyshi} \cite{cit:everyshi} is
1198
+used by the \Lclass{leaflet} class.
1199
+
1200
+
1201
+\section{Features}
1202
+
1203
+Basically the \Lclass{leaflet} class provides the same features as the
1204
+standard \Lclass{article} class. There are, however, a number of
1205
+differences and restrictions, as well as some additional facilities and
1206
+peculiarities:
1207
+
1208
+\begin{itemize}
1209
+
1210
+\item
1211
+The sectioning level |\part| is not available.
1212
+The other sectioning levels are not numbered by default.
1213
+
1214
+\item
1215
+References to the page where floating objects are located may come out
1216
+wrong (this includes |\pageref| as well as |\listof...| commends).
1217
+
1218
+\item
1219
+Section headers are typeset in a smaller font size than in the
1220
+standard classes.
1221
+
1222
+\item
1223
+You may use list-like environments just as in the standard classes.
1224
+The left margins have been adjusted to work well with the
1225
+\Lopt{a4paper} and \Lopt{letterpaper} class options.
1226
+With other target page sizes, you'll have to adjust them.
1227
+
1228
+Here's a small demo:
1229
+\begin{description}
1230
+\item[Uncle Meat] First entry in a description environment.
1231
+\item[King Kong] Second entry.
1232
+    \begin{itemize}
1233
+    \item First entry in an itemize environment.
1234
+        \begin{enumerate}
1235
+        \item First entry in an enumerate environment.
1236
+        \item Second entry.
1237
+            \begin{enumerate}
1238
+            \item First entry in an enumerate environment.
1239
+                \begin{enumerate}
1240
+                \item First entry in an enumerate environment.
1241
+                \item Second entry.
1242
+                \end{enumerate}
1243
+            \item Second entry.
1244
+                \begin{itemize}
1245
+                \item First entry in an itemize environment.
1246
+                \item Second entry.
1247
+                \end{itemize}
1248
+            \item Another entry.
1249
+            \end{enumerate}
1250
+        \item Another entry.
1251
+        \end{enumerate}
1252
+    \item Second entry.
1253
+    \item Another entry.
1254
+    \end{itemize}
1255
+\item[Frunobulax] Another entry.
1256
+\end{description}
1257
+
1258
+\item
1259
+Marginal notes are pointless on the given page size and
1260
+are disabled.
1261
+
1262
+\item
1263
+Two-column typesetting is not supported for the same reason.
1264
+
1265
+\item
1266
+By default, there are no page headers, page footers or page numbers,
1267
+nor is there any space reserved for these.
1268
+
1269
+However, you can restore them, if you like.
1270
+To do so, use |\pagestyle| as with the standard classes,
1271
+and |\setlength| to adjust the corresponding parameters (like
1272
+|\headheight|).
1273
+At last, you have to call the new macro \par
1274
+|  \setmargins{top}{bottom}{left}{right}|.
1275
+
1276
+\item
1277
+Paragraphs are separated by vertical space; the first line
1278
+of a paragraph is not indented by default.
1279
+
1280
+\item
1281
+By default, all paragraphs are typeset as if you had
1282
+specified |\sloppy| in the document preamble.
1283
+
1284
+\item
1285
+A small folding mark is created between the second and the
1286
+third page.
1287
+
1288
+\item
1289
+The macro |\CutLine| draws a vertical dotted line with
1290
+scissor symbols between the page indicated by its argument and the
1291
+preceding one.
1292
+The starred version omits the scissors symbols.
1293
+
1294
+\item
1295
+In case the text does not fit on six pages, a warning (or error,
1296
+depending on some class option, see below) will be issued.
1297
+
1298
+\item
1299
+To add some background picture to individual pages, you can use
1300
+|\AddToBackground| commands. Its first argument specifies the page,
1301
+the second one the picture commands.
1302
+The starred version puts the picture on the combined pages.
1303
+
1304
+\end{itemize}
1305
+
1306
+
1307
+\section{Customization}
1308
+
1309
+The typeface to be used for the section headings is given by the macro
1310
+|\sectfont|, and the typeface to be used for the labels of the
1311
+|description| environment is given by |\descfont|.
1312
+Both macros default to |\bfseries| and can be changed using
1313
+|\renewcommand*|.
1314
+
1315
+The horizontal and vertical and margins of the (small) pages
1316
+default to 8\,mm and 11\,mm, respectively, and can be changed
1317
+using |\setmargins|, as explained above.
1318
+This may be useful, if the printing engine exhibits larger unprintable
1319
+margins.
1320
+
1321
+The macros |\foldmarkrule| and |\foldmarklength| determine the stroke
1322
+width and the length of the fold mark, which is printed between the
1323
+second and the third page.
1324
+They default to 0.4\,pt and 2\,mm, respectively, and can be changed
1325
+using |\renewcommand*| (\emph{not} |\setlength|!).
1326
+See also the class options \Lopt{foldmark} and \Lopt{nofoldmark}.
1327
+
1328
+
1329
+\section{Class options}
1330
+
1331
+Default options are marked with an asterisk: