Various tweaks.
[strayman] / strayman.dtx
CommitLineData
1ffa9044 1% \begin{meta-comment}
2%
c3f26ad3 3% $Id: strayman.dtx,v 1.3 2003/09/06 11:25:28 mdw Exp $
1ffa9044 4%
e8c85bbe 5% Document class for Straylight manuals
1ffa9044 6%
e8c85bbe 7% (c) 1996 Straylight
1ffa9044 8%
9%----- Revision history -----------------------------------------------------
10%
11% $Log: strayman.dtx,v $
c3f26ad3 12% Revision 1.3 2003/09/06 11:25:28 mdw
13% Various tweaks.
14%
e8c85bbe 15% Revision 1.2 2002/02/24 12:45:56 mdw
16% Fix banners.
17%
1ffa9044 18% Revision 1.1 2002/02/19 23:27:57 mdw
19% Initial revision.
20%
21% Revision 1.8 1996/12/09 23:20:42 mdw
22% (\tab@setstrut): Fixed so that it uses \dimen\tw@ for the strut depth,
23% as advertised.
24%
25% Revision 1.7 1996/11/29 21:59:16 mdw
26% Fixed a little formatting mistake in a syntax diagram, and switched over
27% to the new syntax diagram commands on the grounds that they're slightly
28% less messy. Maybe.
29%
30% Revision 1.6 1996/11/19 20:54:33 mdw
31% Entered into RCS
32%
33%
34% \end{meta-comment}
35%
36% \begin{meta-comment} <general public licence>
37%%
e8c85bbe 38%% strayman -- a LaTeX document class for Straylight manuals
39%% Copyright (c) 1996 Straylight
1ffa9044 40%%
41%% This program is free software; you can redistribute it and/or modify
42%% it under the terms of the GNU General Public License as published by
43%% the Free Software Foundation; either version 2 of the License, or
44%% (at your option) any later version.
45%%
46%% This program is distributed in the hope that it will be useful,
47%% but WITHOUT ANY WARRANTY; without even the implied warranty of
48%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49%% GNU General Public License for more details.
50%%
51%% You should have received a copy of the GNU General Public License
52%% along with this program; if not, write to the Free Software
53%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
54%%
55% \end{meta-comment}
56%
57% \begin{meta-comment} <Package preamble>
58%<+strayman>\NeedsTeXFormat{LaTeX2e}
59%<+strayman>\ProvidesClass{strayman}
c3f26ad3 60%<+strayman> [2003/09/04 1.10 Straylight document class]
1ffa9044 61% \end{meta-comment}
62%
c3f26ad3 63% \CheckSum{2888}
1ffa9044 64%% \CharacterTable
65%% {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
66%% 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
67%% Digits \0\1\2\3\4\5\6\7\8\9
68%% Exclamation \! Double quote \" Hash (number) \#
69%% Dollar \$ Percent \% Ampersand \&
70%% Acute accent \' Left paren \( Right paren \)
71%% Asterisk \* Plus \+ Comma \,
72%% Minus \- Point \. Solidus \/
73%% Colon \: Semicolon \; Less than \<
74%% Equals \= Greater than \> Question mark \?
75%% Commercial at \@ Left bracket \[ Backslash \\
76%% Right bracket \] Circumflex \^ Underscore \_
77%% Grave accent \` Left brace \{ Vertical bar \|
78%% Right brace \} Tilde \~}
79%%
80%
81% \begin{meta-comment} <driver>
82%
83%<*driver>
84\documentclass[10pt,a4paper,times,cmtt]{strayman}
85\input{mdwtools}
86\usepackage{mdwlist}
87\describesclass{strayman}
88\title[The \strayman\ document class]
89 {The \strayman\footnote{The \strayman\ document class is currently %
90 at version \mdwfileinfo{strayman.cls}{version}, dated %
91 \mdwfileinfo{strayman.cls}{date}.} {} document class}
92\newenvironment{syndisplay}{\display\synshorts}{\enddisplay}
93\DeclareRobustCommand\strayman{\package{strayman}}
94\mdwdoc
95%</driver>
96%
97% \end{meta-comment}
98%
99% \chapter{About the \strayman\ document class}
100%
101% The standard \LaTeX\ document classes are all very well for simple
102% documents, but the style isn't appropriate for works like manuals.
103% The \strayman\ document class is an attempt to recitfy this situataion,
104% providing an attractive and distinctive style for Straylight documents.
105% The layout is based on an earlier style built for \emph{Impression}
106% documents, although many improvements have been made. This document
107% was typeset using \strayman, and it demonstrates the design far better
108% than I can describe it.
109%
110%
111% \section{Document class options}
112%
113% The document class provides many options, most of which are taken from
114% the standard \LaTeX\ classes.
115%
116% \begin{description}
117% \def\|{\ensuremath\vert}
118%
119% \item [\texttt{a4paper} \| \texttt{a5paper} \| \texttt{b5paper} \|
120% \texttt{letterpaper} \| \texttt{legalpaper} \|
121% \texttt{executivepaper}] Select the output paper size. Since
122% \strayman\ is intended to be used mainly for manuals, the default
123% size is |a5paper|.
124%
125% \item [\texttt{landscape}] Swaps the width and height of the paper.
126% Probably not much use, to be honest.
127%
128% \item [\texttt{9pt} \| \texttt{10pt} \| \texttt{11pt} \| \texttt{12pt}]
129% Selects the basic type size for the document. The |9pt| option is
130% nonstandard, but it is the default, since larger sizes don't work
131% well on A5~paper.
132%
133% \item [\texttt{text}] Sets up the page layout and fonts so that the
134% output can be converted fairly easily into a raw text file.
135%
136% \item [\texttt{oneside} \| \texttt{twoside}] Selects one- or two-sided
137% page layouts. Note that one-sided output doesn't look too good.
138%
139% \item [\texttt{draft} \| \texttt{final}] Select various options for draft
140% or final copy.
141%
142% \item [\texttt{titlepage} \| \texttt{notitlepage}] Selects whether
143% the |\maketitle| displays its output on a separate title page.
144%
145% \item [\texttt{openright} \| \texttt{openany}] Select whether chapters
146% start only on quarto pages, or any page. The default is |openright|.
147%
148% \item [\texttt{onecolumn} \| \texttt{twocolumn}] Choose whether the
149% main body text is set in one or two columns. Note that this uses
150% \LaTeX's built-in column handling, not the \package{multicol}
151% package.
152%
153% \item [\texttt{leqno}] Put the equation numbers on the left, not the
154% right.
155%
156% \item [\texttt{fleqn}] Typeset displayed equations left aligned.
157%
158% \item [\texttt{openbib}] Use the `open' style for the bibliography.
159%
160% \item [\texttt{article}] Change the formatting slightly, in a way more
161% suited to short documents.
162%
163% \item [\texttt{square} \| \texttt{rounded}] These options are passed
164% directly to the \package{syntax} package, when it's loaded.
165%
166% \item [\texttt{helvetica}] Typeset headings in the Helvetica font,
167% not in Computer Modern.
168%
169% \item [\texttt{palatino}] Typeset the main body text in Palatino, and
170% headings in Helvetica. The |\tt| font is changed to Courier, but
171% see the \texttt{cmtt} option.
172%
173% \item [\texttt{times}] Typeset the main body text in Times, and headings
174% in Helvetica. The |\tt| font is changed to Courier, but see the
175% \texttt{cmtt} option.
176%
177% \end{description}
178%
179%
180% \section{The \texttt{text} option}
181%
182% In order to facilitate creation of attractively formatted text files
183% from \LaTeX\ documents, \strayman\ provides a |text| option. This will
184% set up \emph{all} the fonts to be monospaced, in the same size. The page
185% size is set up to be a multiple of the character size. The command
186% \begin{syndisplay}
187% "dvi2tty -e-17" <filename>
188% \end{syndisplay}
189% appears to produce a reasonable output from a DVI file created in this
190% way. The output will need to be formatted and corrected slightly by hand
191% although there's a good deal less work to do than might be required
192% otherwise.
193%
194%
195% \section{That's it}
196%
197% That's all I'm writing for now. It's a document class. It defines the
198% style. What more do you expect?
199%
200%
201% \implementation
202%
203% \chapter{Implementation}
204%
205% \section{Options handling}
206%
207% From here on, a lot of the code is shamelessly borrowed from
208% \file{book.cls} and other places. This is what code re-use is for.
209%
210% This bit handles all the options on the |\documentclass| command, either
211% altering our own internal arguments, or loading other packages as
212% appropriate.
213%
214% \subsection{Set up some defaults}
215%
216% We create some variables to hold the settings, and initialise them to
217% sensible values.
218%
219% \begin{macrocode}
220%<*strayman>
221\newcommand\@ptsize{}
222\newif\if@restonecol\@restonecolfalse
223\newif\if@titlepage\@titlepagetrue
224\newif\if@openright\@openrighttrue
225\newif\if@openbib\@openbibfalse
226\newif\if@appendix\@appendixfalse
227\newif\if@article\@articlefalse
228\newif\if@offsetpages\@offsetpagestrue
229\newif\if@numbering\@numberingfalse
230\newif\if@herefloats\@herefloatstrue
231\newif\if@runinsubsubsec\@runinsubsubsecfalse
232\newdimen\pagesurround
233\let\headfam\rmfamily
234\let\pad@margin\@empty
235\def\@delayed{}
236\def\@delaycode#1{%
237 \expandafter\def\expandafter\@delayed\expandafter{\@delayed#1}%
238}
239% \end{macrocode}
240%
241% \subsection{Declare the options we support}
242%
243% This is just a tedious list of all the options.
244%
245% \begin{macrocode}
246\DeclareOption{a4paper}{%
247 \paperheight297mm%
248 \paperwidth210mm%
249 \pagesurround1in%
250}
251\DeclareOption{a5paper}{%
252 \paperheight210mm%
253 \paperwidth148mm%
254 \pagesurround12mm%
255}
256\DeclareOption{b5paper}{%
257 \paperheight250mm%
258 \paperwidth176mm%
259 \pagesurround1in%
260}
261\DeclareOption{letterpaper}{%
262 \paperheight11in%
263 \paperwidth8.5in%
264 \pagesurround1in%
265}
266\DeclareOption{legalpaper}{%
267 \paperheight14in%
268 \paperwidth8.5in%
269 \pagesurround1in%
270}
271\DeclareOption{executivepaper}{%
272 \paperheight10.5in%
273 \paperwidth7.25in%
274 \pagesurround1in%
275}
276\DeclareOption{landscape}{%
277 \@tempdima\paperheight%
278 \paperheight\paperwidth%
279 \paperwidth\@tempdima%
280}
281\DeclareOption{8pt}{\renewcommand\@ptsize{8pt}}
282\DeclareOption{9pt}{\renewcommand\@ptsize{9pt}}
283\DeclareOption{10pt}{\renewcommand\@ptsize{10pt}}
284\DeclareOption{11pt}{\renewcommand\@ptsize{11pt}}
285\DeclareOption{12pt}{\renewcommand\@ptsize{12pt}}
286\DeclareOption{text}{%
287 \renewcommand\@ptsize{text}%
288 \setbox\z@\hbox{\texttt{M\strut}}%
289 \newdimen\tt@chw\tt@chw\wd\z@%
290 \newdimen\tt@chh\tt@chh\ht\z@\advance\tt@chh\dp\z@%
291 \paperwidth77\tt@chw%
292 \paperheight60\tt@chh%
293 \raggedright%
294 \def\pad@margin{.}
295}
296\DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse}
297\DeclareOption{twoside}{\@twosidetrue \@mparswitchfalse \reversemarginpar}
298\DeclareOption{draft}{\overfullrule5\p@}
299\DeclareOption{final}{\overfullrule\z@}
300\DeclareOption{titlepage}{\@titlepagetrue}
301\DeclareOption{notitlepage}{\@titlepagefalse}
302\DeclareOption{openright}{\@openrighttrue}
303\DeclareOption{openany}{\@openrightfalse}
304\DeclareOption{onecolumn}{\@twocolumnfalse}
305\DeclareOption{twocolumn}{\@twocolumntrue}
306\DeclareOption{offsetpages}{\@offsetpagestrue}
307\DeclareOption{nooffsetpages}{\@offsetpagesfalse}
308\DeclareOption{herefloats}{\@herefloatstrue}
309\DeclareOption{noherefloats}{\@herefloatsfalse}
310\DeclareOption{leqno}{\input{leqno.clo}}
311\DeclareOption{fleqn}{\input{fleqn.clo}}
312\DeclareOption{openbib}{\@openbibtrue}
313\DeclareOption{article}{\@articletrue}
314\DeclareOption{numbering}{\@numberingtrue}
315\DeclareOption{nonumbering}{\@numberingfalse}
316\DeclareOption{runinsubsubsec}{\@runinsubsubsectrue}
317\DeclareOption{noruninsubsubsec}{\@runinsubsubsecfalse}
318% \end{macrocode}
319%
320% \subsection{Set up the options}
321%
322% We set up some default options, and then read the user's.
323%
324% \begin{macrocode}
325\ExecuteOptions{a5paper,8pt,twoside,onecolumn,final,openright}
326\ProcessOptions
327% \end{macrocode}
328%
329% If this is PDF\TeX\ then tell it the page bounds.
330%
331% \begin{macrocode}
332\@ifundefined{pdfpageheight}{
333 \relax
334}{
335 \pdfpageheight\paperheight
336 \pdfpagewidth\paperwidth
337}
338% \end{macrocode}
339%
340% \subsection{Read in the text size option}
341%
342% The text sizing is rather messy. We store this in a separate file. To
343% keep this stuff away from other classes, we use the file \emph{extension}
344% as the size specifier, rather than the filename, which is the normal
345% \LaTeX\ way of doing this. This is a \riscos\ thing mainly: I don't like
346% loads of directories cluttering up my disk, and it means that I can move
347% the whole of the \strayman\ stuff around as one directory.
348%
349% \begin{macrocode}
350\input{strayman.\@ptsize}
351%</strayman>
352% \end{macrocode}
353%
354% \section{Package loading}
355%
356% \begin{macrocode}
357%<*strayman>
358\RequirePackage{fancyhdr}
359\RequirePackage{multicol}
360\@delayed
361%</strayman>
362% \end{macrocode}
363%
364% \section{Page layout}
365%
366% This is largely the domain of the size option files.
367%
368% \begin{macrocode}
369%<*8pt|9pt|10pt|11pt|12pt|text>
370%<+8pt>\ProvidesFile{strayman.8pt}
371%<+9pt>\ProvidesFile{strayman.9pt}
372%<+10pt>\ProvidesFile{strayman.10pt}
373%<+11pt>\ProvidesFile{strayman.11pt}
374%<+12pt>\ProvidesFile{strayman.12pt}
375%<+text>\ProvidesFile{strayman.text}
376% \end{macrocode}
377%
378% \subsection{Font sizes}
379%
380% These are fairly standard, and mainly copied from the original size
381% options.
382%
383% \begin{macro}{\@setparskip}
384%
385% Because we separate paragraphs by vertical space, we need to vary this
386% gap when we change font size. This macro does the job.
387%
388% \begin{macrocode}
389\def\@setparskip{%
390 \relax\ifdim\parskip=\z@\else%
391 \parskip.67\baselineskip\@plus\p@\relax%
392 \fi%
393}
394% \end{macrocode}
395% \end{macro}
396%
397% \begin{macro}{\normalsize}
398%
399% Defines the standard size of text in the document.
400%
401% \begin{macrocode}
402\renewcommand\normalsize{%
403%<*8pt>
404 \@setfontsize\normalsize\@viiipt\@xpt%
405 \abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
406 \abovedisplayshortskip\z@\@plus3\p@%
407 \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
408%</8pt>
409%<*9pt>
410 \@setfontsize\normalsize\@ixpt\@xipt%
411 \abovedisplayskip9\p@\@plus2\p@\@minus5\p@%
412 \abovedisplayshortskip\z@\@plus3\p@%
413 \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
414%</9pt>
415%<*10pt>
416 \@setfontsize\normalsize\@xpt\@xiipt%
417 \abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
418 \abovedisplayshortskip\z@\@plus3\p@%
419 \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
420%</10pt>
421%<*11pt>
422 \@setfontsize\normalsize\@xipt{13.6}%
423 \abovedisplayskip11\p@\@plus3\p@\@minus6\p@%
424 \abovedisplayshortskip\z@\@plus3\p@%
425 \belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
426%</11pt>
427%<*12pt>
428 \@setfontsize\normalsize\@xiipt{14.5}%
429 \abovedisplayskip12\p@\@plus3\p@\@minus7\p@%
430 \abovedisplayshortskip\z@\@plus3\p@%
431 \belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
432%</12pt>
433%<*text>
434 \@setfontsize\normalsize\@xpt\@xiipt%
435 \abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
436 \abovedisplayshortskip\z@\@plus3\p@%
437 \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
438%</text>
439 \belowdisplayskip\abovedisplayskip%
440 \let\@listi\@listI%
441 \@setparskip%
442}
443\normalsize
444\parskip2ex\@plus\p@
445% \end{macrocode}
446% \end{macro}
447%
448% \begin{macro}{\small}
449%
450% The |\small| size is defined with similar care to |\normalsize|. The
451% list defaults are altered to cope with our different value for |\parskip|.
452% We can then separate this out independently from the typesize.
453%
454% \begin{macrocode}
455%<+text>\let\small\normalsize
456%<*8pt|9pt|10pt|11pt|12pt>
457\newcommand\small{%
458%<*8pt>
459 \@setfontsize\small\@viipt{8.4}%
460 \abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
461 \abovedisplayshortskip\z@\@plus2\p@%
462 \belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
463%</8pt>
464%<*9pt>
465 \@setfontsize\small\@viiipt{9.5}%
466 \abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
467 \abovedisplayshortskip\z@\@plus2\p@%
468 \belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
469%</9pt>
470%<*10pt>
471 \@setfontsize\small\@ixpt{11}%
472 \abovedisplayskip8.5\p@\@plus3\p@\@minus4\p@%
473 \abovedisplayshortskip\z@\@plus2\p@%
474 \belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
475%</10pt>
476%<*11pt>
477 \@setfontsize\small\@xpt\@xiipt%
478 \abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
479 \abovedisplayshortskip\z@\@plus3\p@%
480 \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
481%</11pt>
482%<*12pt>
483 \@setfontsize\small\@xipt{13.6}%
484 \abovedisplayskip11\p@\@plus3\p@\@minus6\p@%
485 \abovedisplayshortskip\z@ \@plus3\p@%
486 \belowdisplayshortskip6.5\p@ \@plus3.5\p@\@minus3\p@%
487%</12pt>
488 \def\@listi{%
489 \leftmargin\leftmargini%
490 \topsep\z@%
491 \parsep\parskip%
492 \itemsep\z@%
493 }%
494 \belowdisplayskip\abovedisplayskip%
495 \@setparskip%
496}
497%</8pt|9pt|10pt|11pt|12pt>
498% \end{macrocode}
499% \end{macro}
500%
501% \begin{macro}{\footnotesize}
502%
503% This is also defined with the meticulous care of |\normalsize|, and
504% altered in the same way as for |\small|.
505%
506% \begin{macrocode}
507%<+text>\let\footnotesize\normalsize
508%<*8pt|9pt|10pt|11pt|12pt>
509\newcommand\footnotesize{%
510%<*8pt>
511 \@setfontsize\footnotesize\@vipt\@viipt%
512 \abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
513 \abovedisplayshortskip\z@\@plus\p@%
514 \belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
515%</8pt>
516%<*9pt>
517 \@setfontsize\footnotesize\@viipt{8.4}%
518 \abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
519 \abovedisplayshortskip\z@\@plus\p@%
520 \belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
521%</9pt>
522%<*10pt>
523 \@setfontsize\footnotesize\@viiipt{9.5}%
524 \abovedisplayskip6\p@\@plus2\p@\@minus4\p@%
525 \abovedisplayshortskip\z@\@plus\p@%
526 \belowdisplayshortskip3\p@\@plus\p@\@minus2\p@%
527%</10pt>
528%<*11pt>
529 \@setfontsize\footnotesize\@ixpt{11}%
530 \abovedisplayskip8\p@\@plus2\p@\@minus4\p@%
531 \abovedisplayshortskip\z@\@plus\p@%
532 \belowdisplayshortskip4\p@\@plus2\p@\@minus2\p@%
533%</11pt>
534%<*12pt>
535 \@setfontsize\footnotesize\@xpt\@xiipt
536 \abovedisplayskip10\p@\@plus2\p@\@minus5\p@%
537 \abovedisplayshortskip\z@\@plus3\p@%
538 \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@%
539%</12pt>
540 \def\@listi{%
541 \leftmargin\leftmargini%
542 \topsep\z@%
543 \parsep\parskip%
544 \itemsep\z@%
545 }%
546 \belowdisplayskip\abovedisplayskip%
547 \@setparskip%
548}
549%</8pt|9pt|10pt|11pt|12pt>
550% \end{macrocode}
551% \end{macro}
552%
553% The other sizes are all much simpler. We introduce a new size,
554% |\listingsize|, which is used for the \env{listing} environment, to ensure
555% that 77 columns of text fit across an A5 sheet.
556%
557% \begin{macrocode}
558%<*8pt>
559\newcommand\scriptsize{\@setfontsize\scriptsize\@vpt\@vipt\@setparskip}
560\newcommand\tiny{\@setfontsize\tiny{4}\@vpt\@setparskip}
561\newcommand\large{\@setfontsize\large\@xpt\@xiipt\@setparskip}
562\newcommand\Large{\@setfontsize\Large\@xipt{13}\@setparskip}
563\newcommand\LARGE{\@setfontsize\LARGE\@xiipt\@xivpt\@setparskip}
564\newcommand\huge{\@setfontsize\huge\@xviipt{20}\@setparskip}
565\newcommand\Huge{\@setfontsize\Huge\@xxpt{26}\@setparskip}
1ffa9044 566%</8pt>
567%<*9pt>
568\newcommand\scriptsize{\@setfontsize\scriptsize\@vipt\@viipt\@setparskip}
569\newcommand\tiny{\@setfontsize\tiny\@vpt\@vipt\@setparskip}
570\newcommand\large{\@setfontsize\large\@xipt{13}\@setparskip}
571\newcommand\Large{\@setfontsize\Large\@xiipt{14.4}\@setparskip}
572\newcommand\LARGE{\@setfontsize\LARGE\@xivpt{17}\@setparskip}
573\newcommand\huge{\@setfontsize\huge\@xviipt{20}\@setparskip}
574\newcommand\Huge{\@setfontsize\Huge\@xxpt{26}\@setparskip}
1ffa9044 575%</9pt>
576%<*10pt>
577\newcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt\@setparskip}
578\newcommand\tiny{\@setfontsize\tiny\@vpt\@vipt\@setparskip}
579\newcommand\large{\@setfontsize\large\@xiipt{14}\@setparskip}
580\newcommand\Large{\@setfontsize\Large\@xivpt{18}\@setparskip}
581\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}\@setparskip}
582\newcommand\huge{\@setfontsize\huge\@xxpt{25}\@setparskip}
583\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}\@setparskip}
1ffa9044 584%</10pt>
585%<*11pt>
586\newcommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}\@setparskip}
587\newcommand\tiny{\@setfontsize\tiny\@vipt\@viipt\@setparskip}
588\newcommand\large{\@setfontsize\large\@xiipt{14}\@setparskip}
589\newcommand\Large{\@setfontsize\Large\@xivpt{18}\@setparskip}
590\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}\@setparskip}
591\newcommand\huge{\@setfontsize\huge\@xxpt{25}\@setparskip}
592\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}\@setparskip}
1ffa9044 593%</11pt>
594%<*12pt>
595\newcommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}\@setparskip}
596\newcommand\tiny{\@setfontsize\tiny\@vipt\@viipt\@setparskip}
597\newcommand\large{\@setfontsize\large\@xivpt{18}\@setparskip}
598\newcommand\Large{\@setfontsize\Large\@xviipt{22}\@setparskip}
599\newcommand\LARGE{\@setfontsize\LARGE\@xxpt{25}\@setparskip}
600\newcommand\huge{\@setfontsize\huge\@xxvpt{30}\@setparskip}
601\let\Huge\huge
1ffa9044 602%</12pt>
c3f26ad3 603%<+8pt|9pt|10pt|11pt|12pt>\let\listingsize\footnotesize
1ffa9044 604%<*text>
605\def\scriptsize{\@setfontsize\scriptsize\@xpt\@xiipt\@setparskip}
606\let\tiny\scriptsize
607\let\large\scriptsize
608\let\Large\scriptsize
609\let\LARGE\scriptsize
610\let\huge\scriptsize
611\let\Huge\scriptsize
612\let\listingsize\scriptsize
613%
614\let\txt@selectfont\selectfont
615\def\selectfont{%
616 \fontfamily\ttdefault%
617 \fontseries{m}%
618 \fontshape{n}%
619 \txt@selectfont%
620}
621%</text>
622%</8pt|9pt|10pt|11pt|12pt|text>
623% \end{macrocode}
624%
625% \subsection{Paragraph layout}
626%
627% Here we define various paragraph layout parameters.
628%
629% First, set up the line separation parameters. |\baselineskip| is set
630% up by the individual size commands.
631%
632% \begin{macrocode}
633%<*strayman>
634\lineskip\p@
635\normallineskip\p@
636% \end{macrocode}
637%
638% We don't try to stretch the baselines apart:
639%
640% \begin{macrocode}
641\renewcommand\baselinestretch{}
642% \end{macrocode}
643%
644% We don't indent paragraphs at all; instead, we separate them with blank
645% lines. The vertical gap is worked out in the size command; we just clear
646% |\parindent|.
647%
648% \begin{macrocode}
649\parindent\z@
650% \end{macrocode}
651%
652% Set up some standard penalty values.
653%
654% \begin{macrocode}
655\@lowpenalty 51
656\@medpenalty 151
657\@highpenalty 301
658%</strayman>
659% \end{macrocode}
660%
661% \subsection{Page layout}
662%
663% Our layout is a bit different to the standard \LaTeX\ ones: we leave a lot
664% of space down the left hand side: this is reserved for headings and
665% marginal notes.
666%
667% Calculating the size of the space on the left, which we call |\leftindent|,
668% is complicated. We want to use as much of the width of the page as
669% possible, unlike the \LaTeX\ defaults, making sure that we can fit on
670% 77 columns of |\listingsize\tt| text. We also try to make space for a
671% reasonable amount of marginal text, although we don't worry too much if
672% that suffers.
673%
674% The calculation is done as follows. More than about 40\,mm of margin will
675% look very strange. We must have at least 104\,mm of main text, which
676% leaves 20\,mm for the notes on A5 paper (actually, 17\,mm, since we leave
677% 3\,mm gap between the notes and the main text). We divide the page
678% horizontally into $s$\,mm of left border, $m$\,mm of marginal notes,
679% $t$\,mm of body text, and another $s$\,mm of right border, giving
680% a total of $w$\,mm. The value $s$ is given to us by the parameter
681% |\pagesurround|.
682%
683% Articles look odd with a big gap down the side, so this is reduced when
684% necessary.
685%
686% We calculate the quantity~$m$ as $\min\bigl(40,17(w-2s-3)/121+3\bigr)$\@.
687% Then we calculate $t=w-m-24-3$.
688%
689% \begin{macrocode}
690%<*8pt|9pt|10pt|11pt|12pt|text>
691\newdimen\leftindent
692%<*8pt|9pt|10pt|11pt|12pt>
693\leftindent\paperwidth
694\if@offsetpages
695 \advance\leftindent-2\pagesurround
696 \advance\leftindent-3mm
697 \leftindent0.1405\leftindent
698 \advance\leftindent3mm
699 \ifdim\leftindent>40mm\relax
700 \leftindent40mm
701 \fi
702 \if@article\divide\leftindent\tw@\fi
703 \ifdim\leftindent<15mm\leftindent15mm\fi
704\else
705 \leftindent\z@
706\fi
707%</8pt|9pt|10pt|11pt|12pt>
708%<+text>\leftindent8\tt@chw
709% \end{macrocode}
710%
711% In two-column layouts, we prevent headings from being outdented, by
712% zeroing |\sectindent|. Chapter headings and suchlike are still outdented
713% as before. We do not support margin paragraphs in two-column layouts.
714%
715% \begin{macrocode}
716\newdimen\sectindent
717\if@twocolumn
718 \sectindent\z@
719\else
720 \sectindent\if@numbering\z@\else\if@article\else\tw@\fi\leftindent\fi
721\fi
722% \end{macrocode}
723%
724% Having set up the size of the margin, we can get on with the rest of the
725% setting up.
726%
727% First, we fix |\hoffset| and |\voffset| so we can work on the whole size
728% of the paper.
729%
730% \begin{macrocode}
731\advance\hoffset-1in
732\advance\voffset-1in
733% \end{macrocode}
734%
735% Now we can design the page layout in earnest. We begin with the vertical
736% layout.
737%
738% \begin{macrocode}
739%<+8pt>\topskip8\p@
740%<+9pt>\topskip9\p@
741%<+10pt>\topskip10\p@
742%<+11pt>\topskip11\p@
743%<+12pt>\topskip12\p@
744%<+text>\topskip\tt@chh
745%<-text>\topmargin\pagesurround
746%<+text>\topmargin\z@
747%<-text>\headheight12\p@
748%<+text>\headheight12\p@
749%<-text>\headsep.5\pagesurround
750%<+text>\headsep2\tt@chh
751%<+text>\advance\headsep-12\p@
752%<-text>\footskip12\p@
753%<-text>\advance\footskip.5\pagesurround
754%<+text>\footskip2\tt@chh
755\textheight\paperheight
756%<-text>\advance\textheight-24\p@
757%<-text>\advance\textheight-3\pagesurround
758%<+text>\advance\textheight-4\tt@chh
759% \end{macrocode}
760%
761% Now we define the horizontal layout.
762%
763% \begin{macrocode}
764\oddsidemargin\leftindent
765%<-text>\advance\oddsidemargin\pagesurround
766\evensidemargin\oddsidemargin
767\textwidth\paperwidth
768 \advance\textwidth-\oddsidemargin
769%<-text> \advance\textwidth-\pagesurround
770%<-text>\marginparsep3mm
771%<+text>\marginparsep\tt@chw
772\marginparwidth\leftindent
773 \advance\marginparwidth-\marginparsep
774% \end{macrocode}
775%
776% Setting |\maxdepth| is fairly simple. This looks odd, because normally
777% there's some messing for compatibility with \LaTeX~2.09.
778%
779% \begin{macrocode}
780\maxdepth.5\topskip
781\@maxdepth\maxdepth
782% \end{macrocode}
783%
784% Marginal notes need some setting up.
785%
786% \begin{macrocode}
787\marginparpush5\p@
788% \end{macrocode}
789%
790% Footnotes need some setting up now.
791%
792% \begin{macrocode}
793%<+8pt>\footnotesep5.8\p@
794%<+9pt>\footnotesep6.2\p@
795%<+10pt>\footnotesep6.65\p@
796%<+11pt>\footnotesep7.7\p@
797%<+12pt>\footnotesep8.4\p@
798%<+8pt>\setlength{\skip\footins}{7\p@\@plus4\p@\@minus2\p@}
799%<+9pt>\setlength{\skip\footins}{8\p@\@plus4\p@\@minus2\p@}
800%<+10pt>\setlength{\skip\footins}{9\p@\@plus4\p@\@minus2\p@}
801%<+11pt>\setlength{\skip\footins}{10\p@\@plus4\p@\@minus2\p@}
802%<+12pt>\setlength{\skip\footins}{10.8\p@\@plus4\p@\@minus2\p@}
803%</8pt|9pt|10pt|11pt|12pt|text>
804% \end{macrocode}
805%
806% \subsection{Float placement}
807%
808% First, we determine how we position the floats on the page.
809%
810% \begin{macrocode}
811%<*strayman>
812\setcounter{topnumber}{2}
813\renewcommand\topfraction{.7}
814\setcounter{bottomnumber}{1}
815\renewcommand\bottomfraction{.3}
816\setcounter{totalnumber}{3}
817\renewcommand\textfraction{.1}
818\renewcommand\floatpagefraction{.8}
819\setcounter{dbltopnumber}{2}
820\renewcommand\dbltopfraction{.7}
821\renewcommand\dblfloatpagefraction{.5}
822%</strayman>
823% \end{macrocode}
824%
825% Now we define the glue which surrounds floats.
826%
827% \begin{macrocode}
828%<*8pt|9pt|10pt|11pt|12pt>
829\floatsep12\p@\@plus2\p@\@minus2\p@
830\textfloatsep20\p@\@plus2\p@\@minus4\p@
831\dbltextfloatsep20\p@\@plus2\p@\@minus4\p@
832%<+8pt|9pt|10pt|11pt>\intextsep12\p@\@plus2\p@\@minus 2\p@
833%<+8pt|9pt|10pt|11pt>\dblfloatsep12\p@\@plus2\p@\@minus 2\p@
834%<+12pt>\intextsep14\p@\@plus4\p@\@minus 4\p@
835%<+12pt>\dblfloatsep14\p@\@plus2\p@\@minus 4\p@
836% \end{macrocode}
837%
838% We must now define the parameters for float pages and columns.
839%
840% \begin{macrocode}
841\@fptop0\p@\@plus 1fil
842%<+8pt|9pt|10pt|11pt>\@fpsep8\p@\@plus2fil
843%<+12pt>\@fpsep10\p@\@plus2fil
844\@fpbot0\p@\@plus 1fil
845%
846\@dblfptop0\p@\@plus 1fil
847%<+8pt|9pt|10pt|11pt>\@dblfpsep8\p@\@plus 2fil
848%<+12pt>\@dblfpsep10\p@\@plus2fil
849\@dblfpbot0\p@\@plus 1fil
850%</8pt|9pt|10pt|11pt|12pt>
851% \end{macrocode}
852%
853% \section{Headers and footers}
854%
855% This part defines the standard page styles. By default, \strayman\
856% imports \package{fancyheadings} and uses them, although this section is
857% retained in case anything actually needs the original \LaTeX-style
858% headings.
859%
860% \begin{macrocode}
861%<*strayman>
862\def\ps@headings{%
863\let\@oddfoot\@empty\let\@evenfoot\@empty
864\def\@evenhead{\thepage\hfil\slshape\leftmark}%
865\def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
866\let\@mkboth\markboth
867\def\chaptermark##1{\markboth {##1}{}}%
868\def\sectionmark##1{\markright {##1}}%
869}
870%
871\def\ps@myheadings{%
872 \let\@oddfoot\@empty\let\@evenfoot\@empty
873 \def\@evenhead{\thepage\hfil\slshape\leftmark}%
874 \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
875 \let\@mkboth\@gobbletwo
876 \let\chaptermark\@gobble
877 \let\sectionmark\@gobble
878}
879% \end{macrocode}
880%
881% \section{Titles}
882%
883% \begin{macro}{\maketitle}
884% This is a bit of a thorny issue at the moment. Really, these titles need
885% a complete rewrite. The |\maketitle| command will only be used for inside
886% front covers anyway. I'm wondering if it wouldn't be better just to use
887% special case code for each individual manual. Until a decision is made,
888% I'll leave this as it was in \package{book}.
889%
890% \begin{note}
891% This code is largely uncommented. It seems to be fairly straightforward,
892% and if I do need to change it, I'll probably start again from scratch
893% anyway.
894% \end{note}
895%
896% \begin{macrocode}
897\if@titlepage
898%
899 \newcommand\maketitle{%
900 \begin{titlepage}%
901 \let\footnotesize\small%
902 \let\footnoterule\relax%
903 \null\vfil%
904 \vskip 60\p@%
905 \begin{center}%
906 {\LARGE\@title\par}%
907 \vskip3em%
908 {%
909 \large%
910 \lineskip.75em%
911 \begin{tabular}[t]{c}%
912 \@author%
913 \end{tabular}%
914 \par%
915 }%
916 \vskip1.5em%
917 {\large \@date \par}% % Set date in \large size.
918 \end{center}%
919 \par%
920 \@thanks%
921 \vfil\null%
922 \end{titlepage}%
923 \setcounter{footnote}{0}%
924 \let\thanks\relax%
925 \let\maketitle\relax%
926 \gdef\@thanks{}%
927 \gdef\@author{}%
928 \gdef\@title{}%
929 }
930%
931\else
932%
933 \newcommand\maketitle{%
934 \par%
935 \begingroup%
936 \renewcommand\thefootnote{\fnsymbol{footnote}}%
937 \def\@makefnmark{\hb@xt@\z@{$\m@th^{\@thefnmark}$\hss}}%
938 \long\def\@makefntext##1{%
939 \parindent1em\noindent%
940 \hb@xt@1.8em{\hss$\m@th^{\@thefnmark}$}##1%
941 }%
942 \if@twocolumn%
943 \ifnum\col@number=\@ne%
944 \@maketitle%
945 \else%
946 \twocolumn[\@maketitle]%
947 \fi%
948 \else%
949 \newpage%
950 \global\@topnum\z@% % Prevents figures from going at top of page.
951 \@maketitle%
952 \fi%
953 \thispagestyle{plain}%
954 \@thanks%
955 \endgroup%
956 \setcounter{footnote}{0}%
957 \let\thanks\relax%
958 \let\maketitle\relax%
959 \let\@maketitle\relax%
960 \gdef\@thanks{}%
961 \gdef\@author{}%
962 \gdef\@title{}%
963 }
964%
965\fi
966%
967\def\@maketitle{%
968 \newpage%
969 \null%
970 \vskip2em%
971 \begin{center}%
972 {\LARGE\@title\par}%
973 \vskip1.5em%
974 {%
975 \large%
976 \lineskip.5em%
977 \begin{tabular}[t]{c}%
978 \@author%
979 \end{tabular}%
980 \par%
981 }%
982 \vskip 1em%
983 {\large\@date}%
984 \end{center}%
985 \par%
986 \vskip1.5em%
987}
988% \end{macrocode}
989% \end{macro}
990%
991% \begin{environment}{titlepage}
992%
993% The \env{titlepage} environment typesets its contents on a title page.
994% The implementation is fairly straightforward: we just need to do some
995% fiddling with two-column layouts. We also add in some hacking to make
996% title pages centred properly, a bit like the \env{central} environment.
997%
998% \begin{macrocode}
999\newenvironment{titlepage}{%
1000 \cleardoublepage%
1001 \if@twocolumn%
1002 \@restonecoltrue\onecolumn%
1003 \else%
1004 \@restonecolfalse\newpage%
1005 \fi%
1006 \centrepage%
1007 \if@compatibility%
1008 \setcounter{page}{0}%
1009 \fi%
1010}{%
1011 \thispagestyle{empty}%
1012 \if@restonecol%
1013 \twocolumn%
1014 \else%
1015 \newpage%
1016 \fi%
1017}
1018% \end{macrocode}
1019% \end{environment}
1020%
1021% \begin{macro}{\centrepage}
1022%
1023% Change the page layout to centre everything properly. We guard against
1024% this sort of thing happening again by clearing |\leftindent| and
1025% |\sectindent|. This should only be cleared after the page has been
1026% finished, for obvious reasons.
1027%
1028% \begin{macrocode}
1029\def\centrepage{%
1030 \advance\oddsidemargin-\leftindent%
1031 \advance\evensidemargin-\leftindent%
1032 \advance\textwidth\leftindent%
1033 \advance\linewidth\leftindent%
1034 \advance\leftmargini0.5\leftindent%
1035 \leftindent\z@%
1036 \sectindent\z@%
1037 \hsize\textwidth%
1038}
1039% \end{macrocode}
1040% \end{macro}
1041%
1042% \section{Sectioning commands}
1043%
1044% In \strayman, quite a lot of the sectioning is different. We
1045% don't tend to number sections much. Also, the chapter heading style has
1046% been completely rewritten (several times).
1047%
1048% \subsection{Setting up the counters}
1049%
1050% This is pretty simple stuff.
1051%
1052% \begin{macrocode}
1053\newcommand\chaptermark[1]{}
1054\setcounter{secnumdepth}{\if@numbering\if@runinsubsubsec2\else3\fi\else0\fi}
1055\newcounter {part}
1056\newcounter {chapter}
1057\newcounter {section}[chapter]
1058\newcounter {subsection}[section]
1059\newcounter {subsubsection}[subsection]
1060\newcounter {paragraph}[subsubsection]
1061\newcounter {subparagraph}[paragraph]
1062\renewcommand\thepart {\Roman{part}}
1063\renewcommand\thechapter {\arabic{chapter}}
1064\if@article
1065 \renewcommand\thesection {\arabic{section}}
1066\else
1067 \renewcommand\thesection {\thechapter.\arabic{section}}
1068\fi
1069\renewcommand\thesubsection {\thesection.\arabic{subsection}}
1070\renewcommand\thesubsubsection {\thesubsection .\arabic{subsubsection}}
1071\renewcommand\theparagraph {\thesubsubsection.\arabic{paragraph}}
1072\renewcommand\thesubparagraph {\theparagraph.\arabic{subparagraph}}
1073% \end{macrocode}
1074%
1075% \subsection{Frontmatter, mainmatter and backmatter}
1076%
1077% We start off thinking we're in the main matter. The user ought to put a
1078% |\frontmatter| command at the beginning of the document if this is not
1079% correct, as it usually won't be.
1080%
1081% \begin{macrocode}
1082\newif\if@mainmatter
1083\@mainmattertrue
1084\newcommand\frontmatter{%
1085 \cleardoublepage%
1086 \@mainmatterfalse%
1087 \pagenumbering{roman}%
1088}
1089\newcommand\mainmatter{%
1090 \cleardoublepage%
1091 \@mainmattertrue%
1092 \pagenumbering{arabic}%
1093}
1094\newcommand\backmatter{%
1095 \if@openright%
1096 \cleardoublepage%
1097 \else%
1098 \clearpage%
1099 \fi%
1100 \@mainmatterfalse%
1101}
1102% \end{macrocode}
1103%
1104% \subsection{Abstracts}
1105%
1106% \begin{environment}{abstract}
1107%
1108% The \env{abstract} environment reduces the type size and margins slightly.
1109% Abstracts are placed on their own pages when the |titlepage| option is
1110% enabled. The code is filched from the LaTeX article class.
1111%
1112% \begin{macrocode}
1113\if@titlepage
1114 \newenvironment{abstract}{%
1115 \titlepage
1116 \null\vfil
1117 \@beginparpenalty\@lowpenalty
1118 \begin{center}%
1119 \bfseries \abstractname
1120 \@endparpenalty\@M
1121 \end{center}}%
1122 {\par\vfil\null\endtitlepage}
1123\else
1124 \newenvironment{abstract}{%
1125 \if@twocolumn
1126 \section*{\abstractname}%
1127 \else
1128 \small
1129 \list{}{%
1130 \def\makelabel##1{%
1131 \normalfont%
1132 \fontseries{b}\fontfamily\headdefault\selectfont%
1133 ##1%
1134 }%
1135 \labelsep1em\labelwidth\z@\itemindent\labelsep%
1136 \rightmargin\leftmargin%
1137 }
1138 \item[\abstractname]%
1139 \fi}
1140 {\if@twocolumn\else\endlist\fi}
1141\fi
1142% \end{macrocode}
1143% \end{environment}
1144%
1145% \subsection{Appendices}
1146%
1147% \begin{macro}{\appendix}
1148%
1149% This command sets everything up to typeset the appendix.
1150%
1151% \begin{macrocode}
1152\newcommand\appendix{%
1153 \par%
1154 \setcounter{chapter}{0}%
1155 \setcounter{section}{0}%
1156 \renewcommand\@chapapp{\appendixname}%
1157 \if@article%
1158 \renewcommand\thesection{\Alph{section}}%
1159 \else%
1160 \renewcommand\thechapter{\Alph{chapter}}%
1161 \fi%
1162 \@appendixtrue%
1163}
1164% \end{macrocode}
1165% \end{macro}
1166%
1167% \subsection{Parts}
1168%
1169% Part headings are typeset on completely unadorned sheets, devoid of page
1170% numbers and suchlike. Because of the strange page layout, we have to
1171% put the part heading into a |central| environment. to stop the page looking
1172% horribly lopsided.
1173%
1174% \begin{macro}{\part}
1175%
1176% The |\part| macro moves to an appropriate page, changes the pagestyle to
1177% empty to switch off page numbering, and then calls |\@part| or |\@spart|
1178% as appropriate, according to whether a \lit* was supplied. We put some
1179% |\vfil| glue in, to vertically centre anything that these commands typeset,
1180% and ensure printing in a single column.
1181%
1182% \begin{macrocode}
1183\newcommand\part{%
1184 \cleardoublepage%
1185 \thispagestyle{empty}%
1186 \if@twocolumn%
1187 \onecolumn%
1188 \@tempswatrue%
1189 \else%
1190 \@tempswafalse%
1191 \fi%
1192 \hbox{}\vfil%
1193 \begin{centrepage}%
1194 \secdef\@part\@spart%
1195}
1196% \end{macrocode}
1197%
1198% \begin{macro}{\@part}
1199%
1200% This is where most of the part heading typesetting is done. We stick a
1201% line in the contents file, clear the heading markers, and typeset the
1202% heading in the biggest letters we can find. When we're done, we call
1203% |\@endpart| to do some common cleaning up.
1204%
1205% \begin{macrocode}
1206\def\@part[#1]#2{%
1207 \ifnum\c@secnumdepth>-2\relax%
1208 \refstepcounter{part}%
1209 \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
1210 \else%
1211 \addcontentsline{toc}{part}{#1}%
1212 \fi%
1213 \markboth{}{}%
1214 \centering%
1215 \interlinepenalty\@M%
1216 \reset@font%
1217 \ifnum\c@secnumdepth>-2\relax%
1218 \huge\bfseries\headfam\partname~\thepart%
1219 \par%
1220 \vskip20\p@
1221 \fi%
1222 \normalfont\Huge\bfseries\headfam#2\par%
1223 \@endpart%
1224}
1225% \end{macrocode}
1226% \end{macro}
1227%
1228% \begin{macro}{\@spart}
1229%
1230% Here we typeset just the part heading: numbers have been suppressed. Also
1231% we don't put things into the contents file. Otherwise, this is similar to
1232% |\@part|.
1233%
1234% \begin{macrocode}
1235\def\@spart#1{%
1236 \centering%
1237 \interlinepenalty\@M%
1238 \reset@font%
1239 \normalfont\Huge\bfseries\headfam#1\par%
1240 \@endpart%
1241}
1242% \end{macrocode}
1243% \end{macro}
1244%
1245% \begin{macro}{\@endpart}
1246%
1247% This does the clearing up operation after a part has been typeset. We
1248% insert the other |\vfil| glue to centre the heading, clear the other
1249% side of the page, if printing two-sided, and return if necessary to
1250% two-column printing.
1251%
1252% \begin{macrocode}
1253\def\@endpart{%
1254 \vfil\newpage%
1255 \end{centrepage}%
1256 \if@twoside%
1257 \hbox{}%
1258 \thispagestyle{empty}%
1259 \newpage%
1260 \fi%
1261 \if@tempswa%
1262 \twocolumn%
1263 \fi%
1264}
1265% \end{macrocode}
1266% \end{macro}
1267% \end{macro}
1268%
1269% \subsection{Chapters}
1270%
1271% The chapter typesetting has been more-or-less rewritten. We'll follow this
1272% in a reasonable amount of detail.
1273%
1274% \begin{macro}{\@chapapp}
1275%
1276% Because |\appendix| needs to change what chapters are called, we add a
1277% level of indirection through |\@chapapp|:
1278%
1279% \begin{macrocode}
1280\newcommand\@chapapp{\chaptername}
1281% \end{macrocode}
1282% \end{macro}
1283%
1284% \begin{macro}{\chapter}
1285%
1286% The |\chapter| command is the main dispatcher for chapters. We move to
1287% an appropriate page, depending on the |openright| setting, suppress
1288% headers, and then call |\@chapter| or |\@schapter| as appropriate.
1289%
1290% \begin{macrocode}
1291\newcommand\chapter{%
1292 \if@openright%
1293 \cleardoublepage%
1294 \else%
1295 \clearpage%
1296 \fi%
1297 \thispagestyle{plain}%
1298 \global\@topnum\z@%
1299 \@afterindentfalse%
1300 \secdef\@chapter\@schapter%
1301}
1302% \end{macrocode}
1303%
1304% \begin{macro}{\@chapter}
1305%
1306% There's a lot of messing about to do, depending on whether we're in the
1307% main matter and so on. We'll take this carefully.
1308%
1309% \begin{macrocode}
1310\def\@chapter[#1]#2{%
1311% \end{macrocode}
1312%
1313% The first thing to do is put a line in the contents table. We need to
1314% check |secnumdepth| and the |mainmatter| flag for this: we should only
1315% include a number if both these tests pass. In this case, we also type a
1316% message on the terminal.
1317%
1318% \begin{macrocode}
1319 \ifnum\c@secnumdepth>\m@ne%
1320 \if@mainmatter%
1321 \refstepcounter{chapter}%
1322 \typeout{\@chapapp\space\thechapter.}%
1323 \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}%
1324 \else
1325 \addcontentsline{toc}{chapter}{#1}%
1326 \fi
1327 \else
1328 \addcontentsline{toc}{chapter}{#1}
1329 \fi
1330% \end{macrocode}
1331%
1332% Now we put a bit of space in the lists of figures and tables, and set up
1333% the mark to put the chapter heading in the running header.
1334% \begin{macrocode}
1335 \chaptermark{#1}%
1336 \addtocontents{lof}{\protect\addvspace{10\p@}}%
1337 \addtocontents{lot}{\protect\addvspace{10\p@}}%
1338% \end{macrocode}
1339%
1340% Finally, we need to decide how to typeset the chapter heading. On
1341% single-column chapters, this is easy. On double-column formats, we need
1342% to do horrid things with |\@topnewpage|.
1343%
1344% \begin{macrocode}
1345 \if@twocolumn%
1346 \@topnewpage[\@makechapterhead{%
1347 \hb@xt@.5\leftindent{\thechapter\hfil}%
1348 }{#2}]%
1349 \else%
1350 \@makechapterhead{%
1351 \hb@xt@.5\leftindent{\thechapter\hfil}%
1352 }{#2}%
1353 \@afterheading%
1354 \fi%
1355}
1356% \end{macrocode}
1357% \end{macro}
1358%
1359% \begin{macro}{\@makechapterhead}
1360%
1361% This macro actually does the job of typesetting a chapter heading. Call
1362% this routine as |\@makechapterhead{|\synt{number}|}{|\synt{title}|}|.
1363% Here, \synt{number} is how to typeset the chapter number, and \synt{title}
1364% is the rest of the title. To suppress the number, just leave \synt{number}
1365% empty. The number is only typeset when it is correct to do so anyway.
1366%
1367% The spacing is rather awkward. We have to cope with two-column layouts,
1368% which seem to require different spacing. In a double-column layout,
1369% the title is normally one |\baselineskip| too high. Also, the space I
1370% add at the bottom of the heading gets eaten in double-column chapters,
1371% because I'm actually typesetting into a vbox which is floated to the top
1372% by \LaTeX\ in a fairly horrid way. This can't really be worked around,
1373% so we just make the space beneath the heading equal to |\dbltextfloatsep|,
1374% which is what gets added anyway.
1375%
1376% The other snags are to do with the rule after the chapter heading.
1377% Firstly, this is meant to be typeset into the left margin, like the
1378% heading itself, which is a bit messy. More awkwardly, we have to be
1379% careful not to let the depth of the line vary when the chapter heading has
1380% descenders, although obviously we must lower the rule if the heading really
1381% is very deep indeed.
1382%
1383%
1384% We'll approach this a bit at a time.
1385%
1386% \begin{macrocode}
1387\def\@makechapterhead#1#2{%
1388 \begingroup% % Stop my hacking messing things up
1389% \end{macrocode}
1390%
1391% First, the top spacing. This is divided into two parts, by an invisible
1392% rule: the |\vskip| above the rule is eaten by \TeX\ if this is a genuine
1393% new page, but put into the floating vbox if this is a two-column affair.
1394% The second bit is added in both cases.
1395%
1396% \begin{macrocode}
1397 \vskip\baselineskip% % This is gobbled in single column
1398 \hrule\@height\z@% % Stops TeX from binning my vskips
1399 \vskip32\p@% % Start chapters in a funny place
1400% \end{macrocode}
1401%
1402% Now we actually typeset the heading. This is fairly simple: we must just
1403% check that we need to typeset the number.
1404%
1405% \begin{macrocode}
1406 \normalfont\Huge\bfseries\headfam% % Choose a nice font for it
1407 \raggedright % Don't justify -- it looks nasty
1408 \@hangfrom{\hskip-\leftindent}% % Start text at `real left margin'
1409 \ifnum\c@secnumdepth>\m@ne% % Do we typeset chapter numbers?
1410 \if@mainmatter% % Are we past the front matter?
1411 #1% % Yes -- then typeset the number
1412 \fi\fi% % Now back to normality
1413 {#2}% % Typeset the actual chapter head
1414 \par\nobreak% % Back to vmode again, please
1415% \end{macrocode}
1416%
1417% The next tricky bit is the space before the ruleoff. We must be careful
1418% here:
1419%
1420% \begin{itemize}
1421%
1422% \item We want the rule to be the right depth below the heading baseline,
1423% regardless of whether the heading contains descenders: helpfully, \TeX\
1424% omits |\baselineskip| glue before and after rules.
1425%
1426% \item We want the rule to always be below any oddly deep descenders that
1427% a strange user might throw at us (e.g., horrid fractions or weird
1428% |\vrule|s).
1429%
1430% \end{itemize}
1431%
1432% We accomplish this by scrutinising |\prevdepth| carefully.
1433%
1434% \begin{macrocode}
1435 \@tempdima14\p@% % Be this low below the baseline
1436 \advance\@tempdima-\prevdepth% % This is the actual skip then
1437 \ifdim\@tempdima<8\p@% % Is this not enough skippage?
1438 \@tempdima8\p@% % No: then skip some more
1439 \fi%
1440 \vskip\@tempdima% % Skip a bit below the title
1441% \end{macrocode}
1442%
1443% Now we can set the rule. This needs a little care.
1444%
1445% \begin{macrocode}
1446 \@tempskipa\textwidth% % Find the width of the column
1447 \advance\@tempskipa\leftindent% % Add on the big lefthand gap
1448 \nointerlineskip% % Don't add any more space please
1449 \moveleft\leftindent\vbox{% % Shift something left by an amount
1450 \hrule\@width\@tempskipa% % Typeset the rule nicely
1451 }%
1452 \nointerlineskip% % Don't leave a gap beneath it
1453% \end{macrocode}
1454%
1455% Finally, we leave a gap. In two-column layouts this is done for us, and
1456% \LaTeX\ gobbles this glue and replaces it with |\dbltextfloatsep|. To make
1457% things consistent, this is the glue we use anyway.
1458%
1459% \begin{macrocode}
1460 \nobreak% % This would be a bad place to break
1461 \vspace{\dbltextfloatsep}% % Add in some extra glue beneath
1462 \endgroup%
1463}
1464% \end{macrocode}
1465% \end{macro}
1466%
1467% \begin{macro}{\@makeschapterhead}
1468%
1469% This is now just a veneer onto |\@makechapterhead|. It's needed, because
1470% other bits of \LaTeX\ call it.
1471%
1472% \begin{macrocode}
1473\def\@makeschapterhead{%
1474 \@makechapterhead{}
1475}
1476% \end{macrocode}
1477% \end{macro}
1478%
1479% \begin{macro}{\@schapter}
1480%
1481% This macro typesets a starred chapter heading. This is terribly simple,
1482% compared to the sort of things we've been doing so far.
1483%
1484% \begin{macrocode}
1485\def\@schapter#1{%
1486 \if@twocolumn%
1487 \@topnewpage[\@makeschapterhead{#1}]%
1488 \else%
1489 \@makeschapterhead{#1}%
1490 \@afterheading%
1491 \fi%
1492}
1493% \end{macrocode}
1494% \end{macro}
1495% \end{macro}
1496%
1497% \subsection{The other sectioning commands}
1498%
1499% These are all defined through |\@startsection|. They've been modified
1500% to typeset sections and subsections hanging into the left margin, and to
1501% moderate the amount of following space, due to the extra |\parskip| already
1502% introduced.
1503%
1504% \begin{macrocode}
1505\newcommand\section{%
1506 \@startsection%
1507 {section}% % Section name (for contents)
1508 {1}% % Level number (for numbering)
1509 {-.5\sectindent}% % Indentation of title
1510 {-1.5ex\@plus-1ex\@minus-.2ex}% % Space after title (vert/horiz)
1511 {.3ex\@plus.2ex}% % Space before title
1512 {\reset@font\Large\bfseries\headfam}% How to typeset the title
1513}
1514\newcommand\subsection{%
1515 \@startsection%
1516 {subsection}%
1517 {2}%
1518 {-.25\sectindent}%
1519 {-1.25ex\@plus-1ex\@minus-.2ex}%
1520 {\p@\@plus.2ex}%
1521 {\reset@font\large\bfseries\headfam}%
1522}
1523\if@runinsubsubsec
1524\newcommand\subsubsection{%
1525 \@startsection%
1526 {subsubsection}%
1527 {3}%
1528 {\z@}%
1529 {0pt\@plus1ex\@minus.2ex}%
1530 {-1em}%
1531 {\reset@font\normalsize\bfseries\headfam}%
1532}
1533\newcommand\paragraph{%
1534 \@startsection%
1535 {paragraph}%
1536 {4}%
1537 {\z@}%
1538 {0pt\@plus.5ex\@minus.1ex}%
1539 {-1em}%
1540 {\reset@font\normalsize\bfseries\headfam}%
1541}
1542\newcommand\subparagraph{%
1543 \@startsection%
1544 {subparagraph}%
1545 {5}%
1546 {\parindent}%
1547 {0pt\@plus.5ex\@minus.1ex}%
1548 {-1em}%
1549 {\reset@font\normalsize\bfseries\headfam}%
1550}
1551\else
1552\newcommand\subsubsection{%
1553 \@startsection%
1554 {subsubsection}%
1555 {3}%
1556 {\z@}%
1557 {-1.25ex\@plus-1ex\@minus-.2ex}%
1558 {\p@\@plus.2ex}%
1559 {\reset@font\normalsize\bfseries\headfam}%
1560}
1561\newcommand\paragraph{%
1562 \@startsection%
1563 {paragraph}%
1564 {4}%
1565 {\z@}%
1566 {0pt\@plus1ex\@minus.2ex}%
1567 {-1em}%
1568 {\reset@font\normalsize\bfseries\headfam}%
1569}
1570\newcommand\subparagraph{%
1571 \@startsection%
1572 {subparagraph}%
1573 {5}%
1574 {\parindent}%
1575 {0pt\@plus.5ex\@minus.1ex}%
1576 {-1em}%
1577 {\reset@font\normalsize\bfseries\headfam}%
1578}
1579\fi
1580% \end{macrocode}
1581%
1582% \subsection{Section number formatting}
1583%
1584% \begin{macro}{\@seccntformat}
1585%
1586% The macro is given a section counter and must format it in some nice way.
1587%
1588% \begin{macrocode}
1589\def\@seccntformat#1{%
1590 \llap{\csname the#1\endcsname{\normalsize\quad}\hfil}%
1591}
1592%
1593% \subsection{Top level sectioning}
1594%
1595% \begin{macro}{\@topsect}
1596%
1597% Articles are divided into sections; other documents are divided into
1598% chapters. Things like the table of contents need to know which.
1599%
1600% \begin{macrocode}
1601\if@article
c3f26ad3 1602 \def\@topsect@star{\section*}
1603 \let\@topsect\section
1ffa9044 1604\else
c3f26ad3 1605 \let\@topsect@star\chapter
1ffa9044 1606 \let\@topsect\chapter
1607\fi
1608% \end{macrocode}
1609%
1610% \end{macro}
1611%
1612%
1613% \section{List handling}
1614%
1615% A surprising number of \LaTeX's environments are defined in terms of
1616% lists, many of which hide the fact by putting the entire text in one big
1617% item.
1618%
1619% This part of the document class has to set up lots of list parameters.
1620% This is largely the same as the standard classes, altered slightly to cope
1621% with the different paragraph spacing.
1622%
1623% \subsection{General list parameters}
1624%
1625% Default left margins for lists:
1626%
1627% \begin{macrocode}
1628\if@twocolumn
1629 \leftmargini2em
1630\else
1631 \leftmargini2.2em
1632\fi
1633\leftmarginii2em
1634\leftmarginiii1.87em
1635\leftmarginiv1.7em
1636\if@twocolumn
1637 \leftmarginv.5em
1638 \leftmarginvi.5em
1639\else
1640 \leftmarginv1em
1641 \leftmarginvi1em
1642\fi
1643% \end{macrocode}
1644%
1645% Other spacing defaults:
1646%
1647% \begin{macrocode}
1648\leftmargin\leftmargini
1649\labelsep.5em
1650\labelwidth\leftmargini
1651\advance\labelwidth-\labelsep
1652\partopsep\z@\@plus1\p@\@minus1\p@
1653% \end{macrocode}
1654%
1655% Interline penalties:
1656%
1657% \begin{macrocode}
1658\@beginparpenalty -\@lowpenalty
1659\@endparpenalty -\@lowpenalty
1660\@itempenalty -\@lowpenalty
1661% \end{macrocode}
1662%
1663% Now we define the defaults for the list environments. These have managed
1664% to migrate from the size options into the main document class.
1665%
1666% \begin{macrocode}
1667\def\@listI{%
1668 \leftmargin\leftmargini%
1669 \parsep\parskip%
1670 \topsep\z@%
1671 \itemsep\z@%
1672}
1673\let\@listi\@listI
1674\@listi\topsep\parskip%
1675\def\@listii{%
1676 \leftmargin\leftmarginii%
1677 \labelwidth\leftmarginii%
1678 \advance\labelwidth-\labelsep%
1679}
1680\def\@listiii{%
1681 \leftmargin\leftmarginiii%
1682 \labelwidth\leftmarginiii%
1683 \advance\labelwidth-\labelsep%
c3f26ad3 1684% \partopsep\p@\@plus\z@\@minus\p@%
1ffa9044 1685}
1686\def\@listiv{%
1687 \leftmargin\leftmarginiv%
1688 \labelwidth\leftmarginiv%
1689 \advance\labelwidth-\labelsep%
1690}
1691\def\@listv{%
1692 \leftmargin\leftmarginv%
1693 \labelwidth\leftmarginv%
1694 \advance\labelwidth-\labelsep%
1695}
1696\def\@listvi{%
1697 \leftmargin\leftmarginvi%
1698 \labelwidth\leftmarginvi%
1699 \advance\labelwidth-\labelsep%
1700}
1701% \end{macrocode}
1702%
1703% \subsection{Enumerated lists}
1704%
1705% We busily redefine all the counters for enumerated lists, and how to
1706% typeset them.
1707%
1708% How to typeset the numbers:
1709%
1710% \begin{macrocode}
1711\renewcommand\theenumi{\arabic{enumi}}
1712\renewcommand\theenumii{\alph{enumii}}
1713\renewcommand\theenumiii{\roman{enumiii}}
1714\renewcommand\theenumiv{\Alph{enumiv}}
1715% \end{macrocode}
1716%
1717% Typesetting the item labels:
1718%
1719% \begin{macrocode}
1720\newcommand\labelenumi{\theenumi.}
1721\newcommand\labelenumii{(\theenumii)}
1722\newcommand\labelenumiii{\theenumiii.}
1723\newcommand\labelenumiv{\theenumiv.}
1724% \end{macrocode}
1725%
1726% And finally how to typeset references to the items:
1727%
1728% \begin{macrocode}
1729\renewcommand\p@enumii{\theenumi}
1730\renewcommand\p@enumiii{\theenumi(\theenumii)}
1731\renewcommand\p@enumiv{\p@enumiii\theenumiii}
1732% \end{macrocode}
1733%
1734% \subsection{Itemized lists}
1735%
1736% We set up the various bullet shapes for the itemized lists.
1737%
1738% \begin{macrocode}
1739\newcommand\labelitemi{$\m@th\bullet$}
1740\newcommand\labelitemii{\normalfont\bfseries --}
1741\newcommand\labelitemiii{$\m@th\ast$}
1742\newcommand\labelitemiv{$\m@th\cdot$}
1743% \end{macrocode}
1744%
1745% \subsection{Description lists}
1746%
1747% This has been redefined a little to make it more sensible. The old version
1748% had a weird |\hspace\labelsep| in the labelling macro. This has now been
1749% added into the main list definition. You can now redefine
1750% |\descriptionlabel| without fear of messing up the spacing.
1751%
1752% \begin{environment}{description}
1753%
1754% Here we set up the main list parameters. The label width is zeroed to
1755% ensure that the text is always indented nicely.
1756%
1757% \begin{macrocode}
1758\def\description{%
1759 \list{}{%
1760 \labelwidth\z@%
1761 \itemindent-\leftmargin%
1762 \advance\itemindent\labelsep%
1763 \def\makelabel{\descriptionlabel}%
1764 }%
1765}
1766\let\enddescription\endlist
1767% \end{macrocode}
1768%
1769% \begin{macro}{\descriptionlabel}
1770%
1771% This typesets a description label. Redefine it the obvious way for
1772% different exciting effects.
1773%
1774% \begin{macrocode}
1775\def\descriptionlabel#1{\normalfont\bfseries #1}
1776% \end{macrocode}
1777%
1778% \end{macro}
1779% \end{environment}
1780%
1781% \subsection{Other list-based environments}
1782%
1783% Several other standard environments are defined in terms of lists. These
1784% are all dealt with here.
1785%
1786% \begin{environment}{verse}
1787%
1788% The \env{verse} environment is specially fiddled so that |\\| works as it
1789% should. There's nothing else exciting about it.
1790%
1791% \begin{macrocode}
1792\newenvironment{verse}{%
1793 \let\\\@centercr%
1794 \list{}{%
1795 \itemsep\z@%
1796 \itemindent-1.5em%
1797 \listparindent\itemindent%
1798 \rightmargin\leftmargin%
1799 \advance\leftmargin1.5em%
1800 }%
1801 \item[]%
1802}{%
1803 \endlist%
1804}
1805% \end{macrocode}
1806% \end{environment}
1807%
1808% \begin{environment}{quotation}
1809%
1810% The \env{quotation} environment is a pretty standard display, except that
1811% we kill off inter-paragraph space. The current definition means that
1812% \env{quotation}s are typeset in normal indented-paragraph style, which
1813% is inconsistent with the rest of the document style.
1814%
1815% \begin{macrocode}
1816\newenvironment{quotation}{%
1817 \list{}{%
1818 \listparindent\z@%
1819 \itemindent\listparindent%
1820 \rightmargin\leftmargin%
1821 }%
1822 \item[]%
1823}{%
1824 \endlist%
1825}
1826% \end{macrocode}
1827% \end{environment}
1828%
1829% \begin{environment}{quote}
1830%
1831% This is even simpler. We just pull in the right margin a bit.
1832%
1833% \begin{macrocode}
1834\newenvironment{quote}{%
1835 \list{}{%
1836 \rightmargin\leftmargin%
1837 }%
1838 \item[]%
1839}{%
1840 \endlist%
1841}
1842% \end{macrocode}
1843% \end{environment}
1844%
1845% \begin{environment}{display}
1846%
1847% The \env{display} environment is intended for any other displays which you
1848% need to typeset. This is \emph{not} a standard environment.
1849%
1850% \begin{macrocode}
1851\newenvironment{display}{%
1852 \list{}{%
1853 \leftmargin1em%
1854 \rightmargin\leftmargin%
1855 \labelsep\z@%
1856 \labelwidth\z@%
1857 }%
1858 \item[]\relax%
1859}{%
1860 \endlist%
1861}
1862% \end{macrocode}
1863% \end{environment}
1864%
1865% And some quick hacking of the theorem environment.
1866%
1867% \section{Other parameters}
1868%
1869% We define some miscellaneous parameters for standard environments.
1870%
1871% \begin{macrocode}
1872\arraycolsep5\p@
1873\tabcolsep6\p@
1874\arrayrulewidth.4\p@
1875\doublerulesep2\p@
1876\tabbingsep\labelsep
1877\skip\@mpfootins\skip\footins
1878\fboxsep3\p@
1879\fboxrule.4\p@
1880%
1881\if@article
1882 \renewcommand\theequation{\arabic{equation}}
1883\else
1884 \@addtoreset{equation}{chapter}
1885 \renewcommand\theequation{\thechapter.\arabic{equation}}
1886\fi
1887% \end{macrocode}
1888%
1889% \section{Floats}
1890%
1891% Since raw \LaTeX\ doesn't actually define any floating objects, we have
1892% to do some of the work here. This isn't actually terribly arduous. For
1893% a float called \synt{float}, we have to define the following macros:
1894%
1895% \begin{description}
1896% \let\descriptionlabel\relax
1897%
1898% \item[\texttt{\bslash fps@}\synt{float}] is the default float positioning
1899% argument for the float type.
1900%
1901% \item[\texttt{\bslash ftype@}\synt{float}] is a flag bit for the float
1902% type. This is used in \LaTeX's |\output| routine to identify floats of
1903% this type.
1904%
1905% \item[\texttt{\bslash ext@}\synt{float}] is the file extension for the
1906% list of these floats (e.g., \lit{lof} for figures).
1907%
1908% \item[\texttt{\bslash fnum@}\synt{float}] is a macro which generates the
1909% caption number. For figures, this expands to `|Figure~\thefigure|'.
1910%
1911% \end{description}
1912%
1913% We must also define |\@makecaption|, which typesets a float caption in
1914% an appropriate way, and an environment for each type of float.
1915%
1916% \subsection{Figures}
1917%
1918% This is all fairly straightforward stuff. First, we create a counter for
1919% figures:
1920%
1921% \begin{macrocode}
1922\newcounter{figure}[chapter]
1923\if@article
1924 \renewcommand\thefigure{\@arabic\c@figure}
1925\else
1926 \renewcommand\thefigure{\thechapter.\@arabic\c@figure}
1927\fi
1928% \end{macrocode}
1929%
1930% Now we define all the macros \LaTeX\ requires.
1931%
1932% \begin{macrocode}
1933\if@herefloats\def\fps@figure{htbp}\else\def\fps@figure{tbp}\fi
1934\def\ftype@figure{1}
1935\def\ext@figure{lof}
1936\def\fnum@figure{\figurename~\thefigure}
1937% \end{macrocode}
1938%
1939% \begin{environment}{figure}
1940% \begin{environment}{figure*}
1941%
1942% Finally, we create the \env{figure} and \env{figure$*$} environments.
1943%
1944% \begin{macrocode}
1945\newenvironment{figure}{\@float{figure}}{\end@float}
1946\newenvironment{figure*}{\@dblfloat{figure}}{\end@dblfloat}
1947% \end{macrocode}
1948% \end{environment}
1949% \end{environment}
1950%
1951% \subsection{Tables}
1952%
1953% This is pretty similar to the figure handling.
1954%
1955% \begin{macrocode}
1956\newcounter{table}[chapter]
1957\if@article
1958 \renewcommand\thetable{\@arabic\c@table}
1959\else
1960 \renewcommand\thetable{\thechapter.\@arabic\c@table}
1961\fi
1962%
1963\if@herefloats\def\fps@table{htbp}\else\def\fps@table{tbp}\fi
1964\def\ftype@table{2}
1965\def\ext@table{lot}
1966\def\fnum@table{\tablename~\thetable}
1967%
1968\newenvironment{table}{\@float{table}}{\end@float}
1969\newenvironment{table*}{\@dblfloat{table}}{\end@dblfloat}
1970% \end{macrocode}
1971%
1972% \subsection{Other float parameters}
1973%
1974% \begin{macro}{\@makecaption}
1975%
1976% The |\@makecaption| macro is called to display a float caption. It will
1977% typeset its argument either centred in a box, if it is short enough, or
1978% in a paragraph if it is longer than a line.
1979%
1980% \begin{macrocode}
1981\newlength\abovecaptionskip
1982\newlength\belowcaptionskip
1983\abovecaptionskip10\p@
1984\belowcaptionskip0\p@
1985%
c3f26ad3 1986\long\def\captionstyle#1#2{\itshape #1: #2}
1ffa9044 1987\long\def\@makecaption#1#2{%
1988 \vskip\abovecaptionskip%
c3f26ad3 1989 \sbox\@tempboxa{\captionstyle{#1}{#2}}%
1ffa9044 1990 \ifdim\wd\@tempboxa>\hsize%
c3f26ad3 1991 \unhbox\@tempboxa\par%
1ffa9044 1992 \else%
c3f26ad3 1993 \hb@xt@\hsize{\hfil\unhbox\@tempboxa\hfil}%
1ffa9044 1994 \fi%
1995 \vskip\belowcaptionskip%
1996}
1997% \end{macrocode}
1998% \end{macro}
1999%
2000% \section{Font commands}
2001%
2002% We allow the `old' font commands to do sensible \textsf{NFSS} things, since
2003% we don't have any legacy documents. This means that we have proper
2004% abbreviations for font changes. We also add |\nm| to return to a normal
2005% font, whatever that may mean.
2006%
2007% \begin{macrocode}
2008\DeclareOldFontCommand{\rm}{\rmfamily}{\mathrm}
2009\DeclareOldFontCommand{\sf}{\sffamily}{\mathsf}
2010\DeclareOldFontCommand{\tt}{\ttfamily}{\mathtt}
2011\DeclareOldFontCommand{\bf}{\bfseries}{\mathbf}
2012\DeclareOldFontCommand{\md}{\mdseries}{\@nomath\md}
2013\DeclareOldFontCommand{\it}{\itshape}{\mathit}
2014\DeclareOldFontCommand{\up}{\upshape}{\@nomath\up}
2015\DeclareOldFontCommand{\sl}{\slshape}{\@nomath\sl}
2016\DeclareOldFontCommand{\sc}{\scshape}{\@nomath\sc}
2017\DeclareOldFontCommand{\nm}{\normalfont}{\mathnormal}
2018% \end{macrocode}
2019%
2020% Now we define some special commands which only work in maths mode. It
2021% seems that older versions of \LaTeX\ (in particular, that at Warwick
2022% University) don't define these commands initially, so we'd better not
2023% use |\renewcommand| after all. We also dispose of lots of messing with
2024% |\protect| by using |\DeclareRobustCommand|.
2025%
2026% \begin{macrocode}
2027\DeclareRobustCommand\cal{\@fontswitch{\relax}{\mathcal}}
2028\DeclareRobustCommand\pmit{\@fontswitch{\relax}{\mathnormal}}
2029% \end{macrocode}
2030%
2031% \section{Tables of contents}
2032%
2033% This section deals with tables of contents, and lists of figures.
2034%
2035% \subsection{Contents}
2036%
2037% First, we have to define some parameters.
2038%
2039% \begin{macrocode}
2040\newcommand\@pnumwidth{2em}
2041\newcommand\@tocrmarg {3em}
2042\newcommand\@dotsep{4.5}
2043\setcounter{tocdepth}{\if@runinsubsubsec1\else2\fi}
2044% \end{macrocode}
2045%
2046% \begin{macro}{\tableofcontents}
2047%
2048% This is the main command for setting up tables of contents. We ensure
2049% a single-page layout, put in the chapter heading, read in the contents
2050% file, and then restore the old layout.
2051%
2052% \begin{macrocode}
c3f26ad3 2053\def\@tocthing#1#2{%
2054 \@ifnextchar[{\@tocthing@i{#1}{#2}}{\@tocthing@i{#1}{#2}[\relax][\relax]}%
2055}
2056\def\@tocthing@i#1#2[#3][#4]{%
2057 \if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi%
2058 \@topsect@star{#1}#3{\parskip\z@\@starttoc{#2}}#4%
2059 \if@restonecol\twocolumn\fi%
1ffa9044 2060}
c3f26ad3 2061\newcommand\tableofcontents{\@tocthing\contentsname{toc}}
1ffa9044 2062% \end{macrocode}
2063% \end{macro}
2064%
2065% Each section type \synt{type} is typeset by a command |\l@|\synt{type}:
2066% for example, the |\l@chapter| command typesets the entry for a chapter
2067% heading.
2068%
2069% \begin{macro}{\l@part}
2070%
2071% This command is vaguely interesting. We'll explore in detail.
2072%
2073% \begin{macrocode}
2074\def\l@part#1#2{%
2075% \end{macrocode}
2076%
2077% We don't typeset the entry if |tocdepth| tells us not to. What kind of
2078% stupid user is going to disable \emph{all} the contents items.
2079%
2080% \begin{macrocode}
2081 \ifnum\c@tocdepth>-2\relax%
2082% \end{macrocode}
2083%
2084% Before we start, we try to break above the title. Later, we'll disable
2085% breaking afterwards. We then leave some vertical space.
2086%
2087% \begin{macrocode}
2088 \addpenalty{-\@highpenalty}%
2089 \addvspace{2.25em\@plus\p@}%
2090% \end{macrocode}
2091%
2092% We open a group, to avoid messing other things up. The |\numberline|
2093% macro, which numbers the entry on the left, typesets its argument in a box
2094% of width |\@tempdima|, which we must set up. We then set up the values
2095% of |\rightskip| and |\parfillskip| to avoid printing over the page number.
2096% We also make |\interlinepenalty| infinite to suppress breaking pages in
2097% the middle of the title.
2098%
2099% \begin{macrocode}
2100 \begingroup%
2101 \@tempdima3em%
2102 \parindent\z@%
2103 \rightskip\@pnumwidth%
2104 \parfillskip-\@pnumwidth%
2105 \interlinepenalty\@M
2106% \end{macrocode}
2107%
2108% Time to typeset the actual title. This is fairly simple, apart from
2109% a complicated mixture of glue and penalties, which handles a line break
2110% right at the end of the title.
2111%
2112% \begin{macrocode}
2113 {%
2114 \leavevmode%
2115 \large\bfseries {#1}%
2116 \nobreak\hfil\penalty\@highpenalty\hbox{}\nobreak\hfil%
2117 \hb@xt@\@pnumwidth{\hss #2}%
2118 }%
2119% \end{macrocode}
2120%
2121% Now we end the paragraph and suppress page breaking here.
2122%
2123% \begin{macrocode}
2124 \par%
2125 \nobreak%
2126 \global\@nobreaktrue%
2127 \everypar{\global\@nobreakfalse\everypar{}}%
2128 \endgroup%
2129 \fi%
2130}
2131% \end{macrocode}
2132% \end{macro}
2133%
2134% \begin{macro}{\@artsw}
2135%
2136% Define a macro named after the first or second argument depending on
2137% whether the document is an article.
2138%
2139% \begin{macrocode}
2140\def\@artsw#1#2#3{%
2141 \edef\@tempa{#1\if@article\noexpand#3\else\noexpand#2\fi}%
2142 \@tempa%
2143}
2144% \end{macrocode}
2145%
2146% \end{macro}
2147%
2148% \begin{macro}{\l@chapter}
2149%
2150% This is terribly similar to the previous macro.
2151%
2152% \begin{macrocode}
2153\@artsw\def\l@chapter\l@section#1#2{%
2154 \ifnum\c@tocdepth >\m@ne%
2155 \addpenalty{-\@highpenalty}%
2156 \vskip1.0em\@plus\p@%
2157 \setlength\@tempdima{2em}%
2158 \begingroup%
2159 \interlinepenalty\@M
2160 \parindent\z@%
2161 \rightskip\@pnumwidth%
2162 \parfillskip-\@pnumwidth%
2163 \leavevmode%
2164 \bfseries%
2165 \advance\leftskip\@tempdima%
2166 \hskip-\leftskip%
2167 {#1}%
2168 \nobreak\hfil\penalty\@highpenalty\hbox{}\nobreak\hfil%
2169 \hb@xt@\@pnumwidth{\hss #2}%
2170 \par%
2171 \penalty\@highpenalty%
2172 \endgroup%
2173 \fi%
2174}
2175% \end{macrocode}
2176% \end{macro}
2177%
2178% The other types are all defined in terms of |\@dottedtocline|, which is
2179% redefined beloew.
2180%
2181% \begin{macrocode}
2182\@artsw\def\l@section\l@subsection{\@dottedtocline{1}{2em}{2.5em}}
2183\@artsw\def\l@subsection\l@subsubsection{\@dottedtocline{2}{4.5em}{3.2em}}
2184\@artsw\def\l@subsubsection\l@paragraph{\@dottedtocline{3}{7.7em}{4.1em}}
2185\@artsw\def\l@paragraph\l@subparagraph{\@dottedtocline{4}{10.5em}{5em}}
2186\@artsw\def\l@subparagraph\@tempa{\@dottedtocline{5}{12.5em}{6em}}
2187% \end{macrocode}
2188%
2189% \begin{macro}{\@dottedtocline}
2190%
2191% This is actually a part of the \LaTeX\ kernel, although it's not quite
2192% right the way it is. We've improved the handling of line breaks after the
2193% title.
2194%
2195% \begin{macrocode}
2196\def\@dottedtocline#1#2#3#4#5{%
2197% \end{macrocode}
2198%
2199% We have to make sure that we're meant to typeset this contents entry.
2200%
2201% \begin{macrocode}
2202 \ifnum#1>\c@tocdepth\else%
2203% \end{macrocode}
2204%
2205% Now we add in a little stretchy space.
2206%
2207% \begin{macrocode}
2208 \vskip\z@\@plus.2\p@%
2209% \end{macrocode}
2210%
2211% Set up the paragraph layout now. We forbid page breaks in the middle of
2212% the title.
2213%
2214% \begin{macrocode}
2215 {%
2216 \leftskip#2\relax%
2217 \rightskip\@tocrmarg%
2218 \parfillskip-\rightskip%
2219 \parindent#2\relax%
2220 \@afterindenttrue%
2221 \interlinepenalty\@M%
2222% \end{macrocode}
2223%
2224% Now we typeset the actual title.
2225%
2226% \begin{macrocode}
2227 \leavevmode%
2228 \@tempdima#3\relax%
2229 \advance\leftskip\@tempdima%
2230 \hbox{}%
2231 \hskip-\leftskip%
2232 {#4}%
2233% \end{macrocode}
2234%
2235% This is the clever bit. After the actual title, we add the following
2236% items:
2237%
2238% \begin{itemize}
2239%
2240% \item A |\nobreak| penalty, to stop a break from eating the glue.
2241%
2242% \item A glob of |\hfil| glue. If there's a line break after this glue,
2243% the title is set flush left as a result of this. Otherwise, it is ignored
2244% because the leaders are |\hfill|.
2245%
2246% \item A penalty. This is a reasonable place to break the line if
2247% necessary.
2248%
2249% \item An empty |\hbox|. This stops the following glue from being discarded
2250% at the beginning of a new line.
2251%
2252% \item Another |\nobreak|, which stops a break at the following glue item.
2253%
2254% \item The dotted |\leaders|, which have |\hfill| stretchiness. This forces
2255% the page number to be flush right.
2256%
2257% \end{itemize}
2258%
2259% The net result of all this is we can now cope with a line break at the
2260% end of the title, before the page number, which means that the dots are
2261% put on the next line. The original \LaTeX\ version forced the last word
2262% of the title onto the next line as well, which can cause underful boxes.
2263%
2264% \begin{macrocode}
2265 \nobreak\hfil\penalty\@highpenalty\hbox{}\nobreak%
2266 \leaders\hbox{$\m@th\mkern\@dotsep mu.\mkern\@dotsep mu$}\hfill%
2267 \hb@xt@\@pnumwidth{\hfil\reset@font\rmfamily#5}\par%
2268 }%
2269 \fi%
2270}
2271% \end{macrocode}
2272% \end{macro}
2273%
2274% \subsection{Lists of figures and tables}
2275%
2276% These macros are terribly similar to the other ones.
2277%
2278% \begin{macrocode}
c3f26ad3 2279\newcommand\listoffigures{\@tocthing\listfigurename{lof}}
2280\newcommand\l@figure{\@dottedtocline{0}{0pt}{2em}}
2281\newcommand\listoftables{\@tocthing\listtablename{lot}}
1ffa9044 2282\let\l@table\l@figure
2283% \end{macrocode}
2284%
2285% \section{Bibliography}
2286%
2287% This isn't actually terribly interesting.
2288%
2289% \begin{environment}{thebibliography}
2290%
2291% \begin{macrocode}
2292\newdimen\bibindent
2293\bibindent1.5em
2294%
2295\newenvironment{thebibliography}[1]{%
2296 \@topsect\bibname%
2297 \list{\@biblabel{\arabic{enumiv}}}%
2298 {\settowidth\labelwidth{\@biblabel{#1}}%
2299 \leftmargin\labelwidth%
2300 \advance\leftmargin\labelsep%
2301 \if@openbib%
2302 \advance\leftmargin\bibindent%
2303 \itemindent-\bibindent%
2304 \listparindent\itemindent%
2305 \parsep\z@%
2306 \fi%
2307 \usecounter{enumiv}%
2308 \let\p@enumiv\@empty%
2309 \renewcommand\theenumiv{\arabic{enumiv}}}%
2310 \if@openbib%
2311 \renewcommand\newblock{\par}%
2312 \else%
2313 \renewcommand\newblock{\hskip.11em\@plus.33em\@minus.07em}%
2314 \fi%
2315 \sloppy%
2316 \clubpenalty4000%
2317 \widowpenalty4000%
2318 \sfcode`\.\@m%
2319}{%
2320 \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
2321 \endlist%
2322}
2323%
2324\newcommand\newblock{}
2325% \end{macrocode}
2326% \end{environment}
2327%
2328% \section{Index}
2329%
2330% Defines the \env{theindex} environment.
2331%
2332% \begin{environment}{theindex}
2333%
2334% The macros are fairly simple. We change to a two column layout, and
2335% redefine |\item| appropriately.
2336%
2337% \begin{macrocode}
2338\newenvironment{theindex}{%
2339 \columnseprule\z@%
2340 \columnsep35\p@%
2341 \@topsect\indexname%
2342 \if@twocolumn\else%
2343 \begin{multicols}{2}%
2344 \fi%
2345 \parskip\z@\@plus.3\p@\relax%
2346 \raggedright%
2347 \let\item\@idxitem%
2348}{%
2349 \if@twocolumn\else%
2350 \end{multicols}%
2351 \fi%
2352}
2353% \end{macrocode}
2354% \end{environment}
2355%
2356% Now we define the item and spacing macros.
2357%
2358% \begin{macrocode}
2359\newcommand\@idxitem {\par\hangindent 40\p@}
2360\newcommand\subitem {\par\hangindent 40\p@ \hspace*{20\p@}}
2361\newcommand\subsubitem{\par\hangindent 40\p@ \hspace*{30\p@}}
2362\newcommand\indexspace{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
2363% \end{macrocode}
2364%
2365% \begin{macro}{\passim}
2366%
2367% The |passim| encapsulator is used to typeset the word `\textit{passim}'
2368% after a page range.
2369%
2370% \begin{macrocode}
2371\def\passim#1{#1 \textit{passim}} % Passim encapsulator for indices
2372% \end{macrocode}
2373% \end{macro}
2374%
2375% Other useful commands for indexing:
2376%
2377% \begin{description*}
2378% \def\descriptionlabel#1{\ttfamily \bslash #1}
2379%
2380% \item[Term] typesets its argument in italics, and adds it to the index.
2381%
2382% \item[term] typesets its first argument in italics, and adds its second
2383% to the index.
2384%
2385% \item[Index] typesets its argument normally, and adds it to the index.
2386%
2387% \end{description*}
2388%
2389% \begin{macrocode}
2390\def\Term#1{\emph{#1}\index{#1}}
2391\def\term#1{\emph{#1}\index}
2392\def\Index#1{#1\index{#1}}
2393% \end{macrocode}
2394%
2395% \section{Footnotes}
2396%
2397% \begin{macro}{\footnoterule}
2398%
2399% This macro typesets the rule above footnotes. This is a bit more complex
2400% than the default: we try and typeset the rule to be at most 1\,in wide,
2401% although if the column isn't wide enough, we use $4\over10$~of the
2402% box width instead.
2403%
2404% \begin{macrocode}
2405\def\footnoterule{%
2406 \@tempdima.4\columnwidth%
2407 \ifdim\@tempdima>1in\relax%
2408 \@tempdima1in\relax%
2409 \fi%
2410 \kern-3\p@%
2411 \hrule\@width\@tempdima%
2412 \kern2.6\p@%
2413}
2414% \end{macrocode}
2415% \end{macro}
2416%
2417% We number footnotes within chapters:
2418%
2419% \begin{macrocode}
2420\@addtoreset{footnote}{chapter}
2421% \end{macrocode}
2422%
2423% \begin{macro}{\@makefntext}
2424%
2425% This is the macro which actually typesets a footnote. This is rather
2426% complicated. It's based on example code from \file{classes.dtx} which
2427% doesn't actually work properly.
2428%
2429% \begin{macrocode}
2430\long\def\@makefntext#1{%
2431% \end{macrocode}
2432%
2433% First, we redefine |\par| to set up the correct paragraph shape. This
2434% is indented from the left margin by a small amount.
2435%
2436% \begin{macrocode}
2437 \@setpar{%
2438 \@@par%
2439 \@tempdima\hsize%
2440 \advance\@tempdima-1.6em%
2441 \parshape\@ne1.6em\@tempdima%
2442 }%
2443% \end{macrocode}
2444%
2445% Now we set up some parameters so that \env{list} environments work properly
2446% within the footnote. We also clear |\parindent| to prevent nasty
2447% indentation. The |\par| sets up the paragraph shape for the next
2448% paragraph: we're in vertical mode already, so it does nothing else.
2449%
2450% \begin{macrocode}
2451 \advance\linewidth-1.6em%
2452 \advance\@totalleftmargin1.6em%
2453 \par%
2454 \parindent\z@%
2455% \end{macrocode}
2456%
2457% We leave vertical mode to stop the hbox created by |\llap| from being
2458% stacked vertically. Then we typeset the footnote mark, and put in the
2459% main text. Finally we leave some space afterwards, to space out the next
2460% footnote.
2461%
2462% \begin{macrocode}
2463 \leavevmode%
2464 \llap{\@makefnmark\enspace}#1\par%
2465 \vskip\parskip%
2466}
2467% \end{macrocode}
2468% \end{macro}
2469%
2470% \begin{macro}{\@makecol}
2471%
2472% The standard \LaTeX\ output routine messes up footnotes a bit, in my
2473% opinion:
2474% \begin{itemize}
2475%
2476% \item If a page is cut off short, because the next item won't fit (e.g.,
2477% a section heading), then footnotes are added right below the end
2478% of the text, which can look strange.
2479%
2480% \item Footnotes are displayed \emph{above} floats at the bottom of a page,
2481% which also looks strange.
2482%
2483% \item The |\@makefntext| routine above needs to add vertical space between
2484% footnotes, but this leaves a gap at the very bottom. We remove this
2485% gap with an |\unskip|.
2486%
2487% \end{itemize}
2488%
2489% \begin{macrocode}
2490\def\@makecol{%
2491 \setbox\@outputbox \box\@cclv
2492 \xdef\@freelist{\@freelist\@midlist}%
2493 \global \let \@midlist \@empty
2494 \@combinefloats
2495 \ifvoid\footins \else
2496 \setbox\@outputbox \vbox {%
2497 \boxmaxdepth \@maxdepth
2498 \unvbox \@outputbox
2499 \vskip \skip\footins
2500 \vfil
2501 \footnoterule
2502 \unvbox \footins
2503 \unskip
2504 }%
2505 \fi
2506 \ifvbox\@kludgeins
2507 \@makespecialcolbox
2508 \else
2509 \setbox\@outputbox \vbox to\@colht {%
2510 \@texttop
2511 \dimen@ \dp\@outputbox
2512 \unvbox \@outputbox
2513 \vskip -\dimen@
2514 \@textbottom
2515 }%
2516 \fi
2517 \global \maxdepth \@maxdepth
2518}
2519% \end{macrocode}
2520% \end{macro}
2521%
2522% \section{Tidying up}
2523%
2524% This section gathers together various other useful bits of standard
2525% document class setting.
2526%
2527% \subsection{Item names}
2528%
2529% These commands typeset bits of text. They can then be redefined by
2530% \package{babel} and suchlike.
2531%
2532% \begin{macrocode}
2533\newcommand\contentsname{Contents}
c3f26ad3 2534\newcommand\listfigurename{List of figures}
2535\newcommand\listtablename{List of tables}
1ffa9044 2536\if@article\newcommand\bibname{References}
2537\else\newcommand\bibname{Bibliography}\fi
2538\newcommand\indexname{Index}
2539\newcommand\figurename{Figure}
2540\newcommand\tablename{Table}
2541\newcommand\partname{Part}
2542\newcommand\abstractname{Abstract}
2543\newcommand\chaptername{Chapter}
2544\newcommand\appendixname{Appendix}
2545\newcommand\today{\number\day\space\ifcase\month\or
2546 January\or February\or March\or April\or May\or June\or
2547 July\or August\or September\or October\or November\or December\fi
2548 \space\number\year}
2549% \end{macrocode}
2550%
2551% \subsection{Final fiddling for two columns}
2552%
2553% \begin{macrocode}
2554\columnsep10\p@
2555\columnseprule\z@
2556\pagestyle{headings}
2557\pagenumbering{arabic} % Arabic page numbers
2558\if@twocolumn
2559 \twocolumn
2560 \sloppy
2561 \flushbottom
2562\else
2563 \onecolumn
2564\fi
2565% \end{macrocode}
2566%
2567% \section{The \protect\env{central} environment}
2568%
2569% Because of the strange layout of the pages, text which is centred using
2570% normal \LaTeX\ commands is centred in the text area, not on the page,
2571% which is undesirable for large headings, like part headings.
2572%
2573% \begin{environment}{central}
2574%
2575% The \env{central} environment typesets its contents centrally on the page.
2576% It should only be used from outer vertical mode.
2577%
2578% The code just creates a box of the appropriate size and moves it into the
2579% right place.
2580%
2581% \begin{macrocode}
2582\newenvironment{central}{%
2583 \par%
2584 \vbox\bgroup\moveleft\leftindent\vbox\bgroup%
2585 \textwidth\paperwidth%
2586 \advance\textwidth-2\pagesurround\relax%
2587 \hsize\textwidth%
2588 \hrule\@height\z@\@depth\z@\@width\hsize%
2589}{%
2590 \egroup%
2591 \egroup%
2592}
2593% \end{macrocode}
2594% \end{environment}
2595%
2596% \section{Headers and footers}
2597%
2598% The \strayman\ class uses \package{fancyheadings} for its headers
2599% and footers. This has already been included in the preamble. We now
2600% need to fix a few problems with \package{fancyheadings} and set up some
2601% macros.
2602%
2603% \begin{macro}{\title}
2604%
2605% We extend |\title|, and give it an optional argument. It can now specify
2606% the document title as used by |\maketitle| and the running title for the
2607% header separately.
2608%
2609% We store the running header in the macro |\@headertitle|, which is
2610% initially empty.
2611%
2612% \begin{macrocode}
2613\def\@headertitle{}
2614% \end{macrocode}
2615%
2616% Now we define the |\title| macro, using |\@dblarg| to duplicate the
2617% mandatory argument if the optional one is omitted.
2618%
2619% \begin{macrocode}
2620\def\title{\@dblarg\title@i}
2621\def\title@i[#1]#2{%
2622 \gdef\@title{#2}%
2623 \gdef\@headertitle{#1}%
2624}
2625% \end{macrocode}
2626% \end{macro}
2627%
2628% \begin{macro}{\innerhead}
2629% \begin{macro}{\innerfoot}
2630%
2631% We allow the user to specify an `inner heading' which is displayed on the
2632% inside of the header on of each page. This can be used for security
2633% classifications, for example. Any \package{fancyheadings} commands can
2634% be used to control the header, which is expanded on each page.
2635%
2636% \begin{macrocode}
2637\def\l@innerhead{}
2638\def\r@innerhead{}
2639\def\l@innerfoot{}
2640\def\r@innerfoot{}
2641\def\innerhead{\@dblarg\innerhead@i}
2642\def\innerhead@i[#1]#2{%
2643 \def\l@innerhead{#1}%
2644 \def\r@innerhead{#2}%
2645}
2646\def\innerfoot{\@dblarg\innerfoot@i}
2647\def\innerfoot@i[#1]#2{%
2648 \def\l@innerfoot{#1}%
2649 \def\r@innerfoot{#2}%
2650}
2651% \end{macrocode}
2652% \end{macro}
2653% \end{macro}
2654%
2655% The next step is to set up the headings:
2656%
2657% \begin{macrocode}
2658\let\headrulewidth\z@
2659\headwidth\textwidth
2660 \advance\headwidth\leftindent
2661\fancypagestyle{headings}{%
2662 \fancyhf{}
2663 \fancyhead[LE]{\bfseries\@headertitle}
2664 \if@article\fancyhead[RO]{\rightmark}\else\fancyhead[RO]{\leftmark}\fi
2665 \fancyhead[RE]{\l@innerhead} \fancyhead[LO]{\r@innerhead}
2666 \fancyfoot[RE]{\l@innerfoot} \fancyfoot[LO]{\r@innerfoot}
2667 \fancyfoot[LE,RO]{\thepage}
2668}
2669\fancypagestyle{plain}{%
2670 \fancyhf{}%
2671 \fancyfoot[RE]{\l@innerfoot} \fancyfoot[LO]{\r@innerfoot}
2672 \fancyfoot[LE,RO]{\thepage}%
2673}
2674\let\ps@fancy\ps@@fancy
2675% \end{macrocode}
2676%
2677% The \package{fancyheadings} package by default expects pages to be
2678% symmetrical. We have to redefine the |\ps@fancy| macro to make it
2679% work properly.
2680%
2681% \begin{macrocode}
2682\def\@lodd{\ifodd\c@page\hss\else\relax\fi}
2683\def\@rodd{\ifodd\c@page\relax\else\hss\fi}
2684% \end{macrocode}
2685%
2686% Finally, we can choose the page style we want:
2687%
2688% \begin{macrocode}
2689\pagestyle{headings}
2690% \end{macrocode}
2691%
2692% \section{Parbox alteration}
2693%
2694% The standard \LaTeX\ |\parbox| command, and the \env{minipage} environment,
2695% reset |\parskip| to zero, which is inconsistent with the document style.
2696% We amend |\@arrayparboxrestore|, the macro which sets up the paragraph
2697% style for parboxes.
2698%
2699% First, we define a macro explaining how the parbox should set the spacing.
2700%
2701% \begin{macrocode}
2702\def\parboxparskip{2ex}
2703% \end{macrocode}
2704%
2705% Next, we redefine the macro. This is taken directly from the \LaTeXe
2706% source.
2707%
2708% \begin{macrocode}
2709\def\@arrayparboxrestore{%
2710 \let\par\@@par
2711 \let\-\@dischyph
2712 \let\'\@acci\let\`\@accii\let\=\@acciii
2713 \parindent\z@ \parskip\z@
2714 \everypar{\parskip\parboxparskip\everypar{}}%
2715 \linewidth\hsize
2716 \@totalleftmargin\z@
2717 \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
2718 \parfillskip\@flushglue \lineskip\normallineskip
2719 \baselineskip\normalbaselineskip
2720 \@noskipsectrue% % The comp.text.tex gurus said it should be
2721 \sloppy}
2722% \end{macrocode}
2723%
2724%
2725% \section{Other features}
2726%
2727% At the end is a miscellany of useful features.
2728%
2729% \subsection{Other typesetting conventions}
2730%
2731% Some items need typesetting in particular ways.
2732%
2733% \begin{macrocode}
2734\let\key\textit
2735\let\button\textbf
2736\def\submenu{\ensuremath\Rightarrow}
2737\let\name\relax
2738\def\file#1{\mbox{\itshape #1\/}}
2739% \end{macrocode}
2740%
2741% \subsection{And finally}
2742%
2743% \begin{macrocode}
2744\sloppy
2745\raggedbottom
2746\def\riscos{RISC~OS}
2747\hyphenpenalty1000
2748%</strayman>
2749% \end{macrocode}
2750%
2751% \Finale
2752%
2753\endinput