1457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% texinfo.tex -- TeX macros to handle Texinfo files.
2457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
3457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Load plain if necessary, i.e., if running under initex.
4457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\texinfoversion{2013-02-01.11}
7457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
11457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
12457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This texinfo.tex file is free software: you can redistribute it and/or
13457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% modify it under the terms of the GNU General Public License as
14457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% published by the Free Software Foundation, either version 3 of the
15457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% License, or (at your option) any later version.
16457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
17457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This texinfo.tex file is distributed in the hope that it will be
18457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% General Public License for more details.
21457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
22457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% You should have received a copy of the GNU General Public License
23457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% along with this program.  If not, see <http://www.gnu.org/licenses/>.
24457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
25457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% As a special exception, when this file is read by TeX when processing
26457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% a Texinfo source document, you may use the result without
27457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% restriction. This Exception is an additional permission under section 7
28457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% of the GNU General Public License, version 3 ("GPLv3").
29457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
30457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Please try the latest version of texinfo.tex before submitting bug
31457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% reports; you can get the latest version from:
32457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
33457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
34457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   http://www.gnu.org/software/texinfo/ (the Texinfo home page)
35457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The texinfo.tex in any given distribution could well be out
36457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% of date, so if that's what you're using, please check.
37457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
38457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Send bug reports to bug-texinfo@gnu.org.  Please include including a
39457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% complete document in each bug report with which we can reproduce the
40457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% problem.  Patches are, of course, greatly appreciated.
41457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
42457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% To process a Texinfo manual with TeX, it's most reliable to use the
43457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% texi2dvi shell script that comes with the distribution.  For a simple
44457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% manual foo.texi, however, you can get away with this:
45457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   tex foo.texi
46457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   texindex foo.??
47457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   tex foo.texi
48457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   tex foo.texi
49457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
50457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The extra TeX runs get the cross-reference information correct.
51457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Sometimes one run after texindex suffices, and sometimes you need more
52457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% than two; texi2dvi does it as many times as necessary.
53457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
54457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It is possible to adapt texinfo.tex for other languages, to some
55457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% extent.  You can get the existing language-specific files from the
56457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% full Texinfo distribution.
57457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
58457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
59457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
60457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
61457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{Loading texinfo [version \texinfoversion]:}
62457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
63457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If in a .fmt file, print the version number
64457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and turn on active characters that we couldn't do earlier because
65457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% they might have appeared in the input file name.
66457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\everyjob{\message{[Texinfo version \texinfoversion]}%
67457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`+=\active \catcode`\_=\active}
68457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
69457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\other=12
70457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
71457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We never want plain's \outer definition of \+ in Texinfo.
72457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For @tex, we can use \tabalign.
73457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\+ = \relax
74457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
75457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Save some plain tex macros whose names we will redefine.
76457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexb=\b
77457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexbullet=\bullet
78457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexc=\c
79457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexcomma=\,
80457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexdot=\.
81457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexdots=\dots
82457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexend=\end
83457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexequiv=\equiv
84457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexexclam=\!
85457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexfootnote=\footnote
86457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexgtr=>
87457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexhat=^
88457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexi=\i
89457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexindent=\indent
90457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexinsert=\insert
91457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexlbrace=\{
92457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexless=<
93457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexnewwrite\newwrite
94457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexnoindent=\noindent
95457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexplus=+
96457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexraggedright=\raggedright
97457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexrbrace=\}
98457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexslash=\/
99457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptexstar=\*
100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptext=\t
101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ptextop=\top
102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If this character appears in an error message or help string, it
105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% starts a new line in the output.
106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newlinechar = `^^J
107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use TeX 3.0's \inputlineno to get the line number, for better error
109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% messages, but if we're using an old version of TeX, don't do anything.
110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\inputlineno\thisisundefined
112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\linenumber = \empty % Pre-3.0.
113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\else
114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\linenumber{l.\the\inputlineno:\space}
115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set up fixed words for English if not already set.
118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putworderror\undefined     \gdef\putworderror{error}\fi
121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Since the category of space is not known, we have to be careful.
159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\spacecat = 10
160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\spaceisspace{\catcode`\ =\spacecat}
161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% sometimes characters are active, so we need control sequences.
163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\ampChar   = `\&
164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\colonChar = `\:
165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\commaChar = `\,
166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\dashChar  = `\-
167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\dotChar   = `\.
168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\exclamChar= `\!
169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\hashChar  = `\#
170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\lquoteChar= `\`
171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\questChar = `\?
172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\rquoteChar= `\'
173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\semiChar  = `\;
174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\slashChar = `\/
175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\underChar = `\_
176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Ignore a token.
178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\gobble#1{}
180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The following is used inside several \edef's.
182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Hyphenation fixes.
185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\hyphenation{
186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  ap-pen-dix bit-map bit-maps
188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  data-base data-bases eshell fall-ing half-way long-est man-u-script
189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  spell-ing spell-ings
192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  stand-alone strong-est time-stamp time-stamps which-ever white-space
193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  wide-spread wrap-around
194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Margin to add to right of even pages, to left of odd pages.
197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\bindingoffset
198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\normaloffset
199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\pagewidth \newdimen\pageheight
200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For a final copy, take out the rectangles
202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% that mark overfull boxes (in case you have decided
203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% that the text looks ok even though it passes the margin).
204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\finalout{\overfullrule=0pt }
206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Sometimes it is convenient to have everything in the transcript file
208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and nothing on the terminal.  We don't just call \tracingall here,
209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% since that produces some useless output on the terminal.  We also make
210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% some effort to order the tracing commands to reduce output in the log
211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% file; cf. trace.sty in LaTeX.
212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\loggingall{%
215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tracingstats2
216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tracingpages1
217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tracinglostchars2  % 2 gives us more in etex
218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tracingparagraphs1
219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tracingoutput1
220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tracingmacros2
221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tracingrestores1
222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \showboxbreadth\maxdimen \showboxdepth\maxdimen
223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \tracingscantokens1
225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \tracingifs1
226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \tracinggroups1
227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \tracingnesting2
228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \tracingassigns1
229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tracingcommands3  % 3 gives us more in etex
231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \errorcontextlines16
232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}%
233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% aren't perfect, it's not the end of the world, being an error message,
236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% after all.
237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\errormsg{\begingroup \indexnofonts \doerrormsg}
239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doerrormsg#1{\errmessage{#1}}
240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% add check for \lastpenalty to plain's definitions.  If the last thing
242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we did was a \nobreak, we don't want to insert more space.
243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \removelastskip\penalty-50\smallskip\fi\fi}
246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \removelastskip\penalty-100\medskip\fi\fi}
248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \removelastskip\penalty-200\bigskip\fi\fi}
250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Do @cropmarks to get crop marks.
252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifcropmarks
254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\cropmarks = \cropmarkstrue
255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Dimensions to add cropmarks at corners.
257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Added by P. A. MacKay, 12 Nov. 1986
258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\cornerlong  \cornerlong=1pc
261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\cornerthick \cornerthick=.3pt
262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\topandbottommargin \topandbottommargin=.75in
263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Output a mark which sets \thischapter, \thissection and \thiscolor.
265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We dump everything together because we only have one kind of mark.
266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This works because we only use \botmark / \topmark, not \firstmark.
267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A mark contains a subexpression of the \ifcase ... \fi construct.
269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \get*marks macros below extract the needed part using \ifcase.
270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Another complication is to let the user choose whether \thischapter
272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (\thissection) refers to the chapter (section) in effect at the top
273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% of a page, or that at the bottom of a page.  The solution is
274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% described on page 260 of The TeXbook.  It involves outputting two
275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% marks for the sectioning macros, one before the section break, and
276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% one after.  I won't pretend I can describe this better than DEK...
277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\domark{%
278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toks0=\expandafter{\lastchapterdefs}%
279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toks2=\expandafter{\lastsectiondefs}%
280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toks4=\expandafter{\prevchapterdefs}%
281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toks6=\expandafter{\prevsectiondefs}%
282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toks8=\expandafter{\lastcolordefs}%
283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \mark{%
284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                   \the\toks0 \the\toks2
285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \noexpand\or \the\toks4 \the\toks6
286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \noexpand\else \the\toks8
287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \topmark doesn't work for the very first chapter (after the title
290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% page or the contents), so we use \firstmark there -- this gets us
291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the mark with the chapter defs, unless the user sneaks in, e.g.,
292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @setcolor (or @url, or @link, etc.) between @contents and the very
293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% first @chapter.
294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\gettopheadingmarks{%
295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifcase0\topmark\fi
296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getbottomheadingmarks{\ifcase1\botmark\fi}
299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getcolormarks{\ifcase2\topmark\fi}
300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Avoid "undefined control sequence" errors.
302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lastchapterdefs{}
303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lastsectiondefs{}
304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\prevchapterdefs{}
305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\prevsectiondefs{}
306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lastcolordefs{}
307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Main output routine.
309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\PAGE = 255
310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\output = {\onepageout{\pagecontents\PAGE}}
311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\headlinebox
313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\footlinebox
314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \onepageout takes a vbox as an argument.  Note that \pagecontents
316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% does insertions, but you have to call it yourself.
317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\onepageout#1{%
318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifodd\pageno  \advance\hoffset by \bindingoffset
321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \advance\hoffset by -\bindingoffset\fi
322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Do this outside of the \shipout so @code etc. will be expanded in
324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the headline as they should be, not taken literally (outputting ''code).
325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Have to do this stuff outside the \shipout because we want it to
332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % take effect in \write's, yet the group defined by the \vbox ends
333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % before the \shipout runs.
334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indexdummies         % don't expand commands in the output.
336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique               % the page break happens to be in the middle of an example.
338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique               % We don't want .vr (or whatever) entries like this:
339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique               % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique               % "\acronym" won't work when it's read back in;
341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique               % it needs to be
342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique               % {\code {{\tt \backslashcurfont }acronym}
343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \shipout\vbox{%
344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Do this early so pdf references go to the beginning of the page.
345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifcropmarks \vbox to \outervsize\bgroup
348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \hsize = \outerhsize
349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \vskip-\topandbottommargin
350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \vtop to0pt{%
351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \line{\ewtop\hfil\ewtop}%
352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \nointerlineskip
353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \line{%
354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \vbox{\moveleft\cornerthick\nstop}%
355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \hfill
356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \vbox{\moveright\cornerthick\nstop}%
357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          }%
358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \vss}%
359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \vskip\topandbottommargin
360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \line\bgroup
361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \hfil % center the page within the outer (page) hsize.
362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \ifodd\pageno\hskip\bindingoffset\fi
363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \vbox\bgroup
364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \unvbox\headlinebox
367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \pagebody{#1}%
368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifdim\ht\footlinebox > 0pt
369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % Only leave this space if the footline is nonempty.
370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % (We lessened \vsize for it in \oddfootingyyy.)
371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % The \baselineskip=24pt in plain's \makefootline has no effect.
372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \vskip 24pt
373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \unvbox\footlinebox
374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifcropmarks
377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \egroup % end of \vbox\bgroup
378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \hfil\egroup % end of (centering) \line\bgroup
379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \vskip\topandbottommargin plus1fill minus1fill
380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \boxmaxdepth = \cornerthick
381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \vbox to0pt{\vss
382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \line{%
383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \vbox{\moveleft\cornerthick\nsbot}%
384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \hfill
385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \vbox{\moveright\cornerthick\nsbot}%
386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          }%
387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \nointerlineskip
388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \line{\ewbot\hfil\ewbot}%
389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        }%
390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \egroup % \vbox from first cropmarks clause
391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }% end of \shipout\vbox
393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }% end of group with \indexdummies
394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advancepageno
395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newinsert\margin \dimen\margin=\maxdimen
399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`\@ =11
402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% marginal hacks, juha@viisa.uucp (Juha Takala)
404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifvoid\margin\else % marginal info is present
405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\dimen@=\dp#1\relax \unvbox#1\relax
407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Here are the rules for the cropmarks.  Note that they are
412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% offset so that the space between them is truly \outerhsize or \outervsize
413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (P. A. MacKay, 12 November, 1986)
414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\nstop{\vbox
417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\nsbot{\vbox
420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Parse an argument, then pass it to #1.  The argument is the rest of
423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the input line (except we remove a trailing comment).  #1 should be a
424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% macro which expects an ordinary undelimited TeX argument.
425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\parsearg{\parseargusing{}}
427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\parseargusing#1#2{%
428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\argtorun{#2}%
429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \obeylines
431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \spaceisspace
432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    #1%
433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\obeylines %
437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\parseargline#1^^M{%
438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup % End of the group started in \parsearg.
439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \argremovecomment #1\comment\ArgTerm%
440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% First remove any @comment, then any @c comment.
444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \argremovec might leave us with trailing space, e.g.,
450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%    @end itemize  @c foo
451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This space token undergoes the same procedure and is eventually removed
452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% by \finishparsearg.
453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#3}%
458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\empty
459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\temp\finishparsearg
461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\temp\argcheckspaces
463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Put the space token in:
465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \temp#1 #3\ArgTerm
466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If a _delimited_ argument is enclosed in braces, they get stripped; so
469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to get _exactly_ the rest of the line, we had to prevent such situation.
470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We prepended an \empty token at the very beginning and we expand it now,
471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% just before passing the control to \argtorun.
472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% either the null string, or it ends with \^^M---thus there is no danger
474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% that a pair of braces would be stripped.
475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But first, we have to remove the trailing space token.
477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \parseargdef\foo{...}
481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%	is roughly equivalent to
482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \def\foo{\parsearg\Xfoo}
483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \def\Xfoo#1{...}
484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% favourite TeX trick.  --kasal, 16nov03
487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\parseargdef#1{%
489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter \doparseargdef \csname\string#1\endcsname #1%
490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doparseargdef#1#2{%
492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def#2{\parsearg#1}%
493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def#1##1%
494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Several utility definitions with active space:
497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \obeyspaces
499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\obeyedspace{ }
500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Make each space character in the input produce a normal interword
502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % space in the output.  Don't allow a line break at this space, as this
503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % is used only in environments like @example, where each line of input
504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % should produce a line of output anyway.
505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\sepspaces{\obeyspaces\let =\tie}
507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If an index command is used in an @example environment, any spaces
509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % therein should become regular spaces in the raw index file, not the
510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % expansion of \tie (\leavevmode \penalty \@M \ ).
511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\unsepspaces{\let =\space}
512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define the framework for environments in texinfo.tex.  It's used like this:
518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   \envdef\foo{...}
520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   \def\Efoo{...}
521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It's the responsibility of \envdef to insert \begingroup before the
523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% actual body; @end closes the group after calling \Efoo.  \envdef also
524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% defines \thisenv, so the current environment is known; @end checks
525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% whether the environment name matches.  The \checkenv macro can also be
526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% used to check whether the current environment is the one expected.
527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% are not treated as environments; they don't open a group.  (The
530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% implementation of @end takes care not to call \endgroup in this
531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% special case.)
532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% At run-time, environments start with this:
535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\startenvironment#1{\begingroup\def\thisenv{#1}}
536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% initialize
537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\thisenv\empty
538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ... but they get defined via ``\envdef\foo{...}'':
540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Check whether we're in the right environment:
544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\checkenv#1{%
545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\thisenv\temp
547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \badenverr
549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Environment mismatch, #1 expected:
553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\badenverr{%
554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \errhelp = \EMsimple
555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \errmessage{This command can appear only \inenvironment\temp,
556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    not \inenvironment\thisenv}%
557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\inenvironment#1{%
559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx#1\empty
560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    outside of any environment%
561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    in environment \expandafter\string#1%
563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @end foo executes the definition of \Efoo.
567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But first, it executes a specialized version of \checkenv
568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\end{%
570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \if 1\csname iscond.#1\endcsname
571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % The general wording of \badenverr may not be ideal.
573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\checkenv\csname#1\endcsname
574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \csname E#1\endcsname
575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newhelp\EMsimple{Press RETURN to continue.}
580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Be sure we're in horizontal mode when doing a tie, since we make space
583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% equivalent to this in @example-like environments. Otherwise, a space
584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% at the beginning of a line will start with \penalty -- and
585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% since \penalty is valid in vertical mode, we'd end up putting the
586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% penalty on the vertical list instead of in the new paragraph.
587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`@ = 11
588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique % Avoid using \@M directly, because that causes trouble
589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique % if the definition is written into an index file.
590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique \global\let\tiepenalty = \@M
591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique \gdef\tie{\leavevmode\penalty\tiepenalty\ }
592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @: forces normal size whitespace following.
595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\:{\spacefactor=1000 }
596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @* forces a line break.
598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\*{\unskip\hfil\break\hbox{}\ignorespaces}
599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @/ allows a line break.
601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\/=\allowbreak
602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @. is an end-of-sentence period.
604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\.{.\spacefactor=\endofsentencespacefactor\space}
605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @! is an end-of-sentence bang.
607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\!{!\spacefactor=\endofsentencespacefactor\space}
608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @? is an end-of-sentence query.
610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\?{?\spacefactor=\endofsentencespacefactor\space}
611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @frenchspacing on|off  says whether to put extra space after punctuation.
613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\onword{on}
615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\offword{off}
616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\frenchspacing{%
618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\onword \plainfrenchspacing
620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\offword \plainnonfrenchspacing
621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @w prevents a word break.  Without the \leavevmode, @w at the
628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% beginning of a paragraph, when TeX is still in vertical mode, would
629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% produce a whole line of output instead of starting the paragraph.
630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\w#1{\leavevmode\hbox{#1}}
631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @group ... @end group forces ... to be all on one page, by enclosing
633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to keep its height that of a normal line.  According to the rules for
635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \topskip (p.114 of the TeXbook), the glue inserted is
636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% max (\topskip - \ht (first item), 0).  If that height is large,
637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% therefore, no glue is inserted, and the space between the headline and
638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the text is small, which looks bad.
639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Another complication is that the group might be very large.  This can
641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% cause the glue on the previous page to be unduly stretched, because it
642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% does not have much material.  In this case, it's better to add an
643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% explicit \vfill so that the extra space is at the bottom.  The
644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% threshold for doing this is if the group is more than \vfilllimit
645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% percent of a page (\vfilllimit can be changed inside of @tex).
646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\groupbox
648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\vfilllimit{0.7}
649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\group{%
651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\catcode`\^^M=\active \else
652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \groupinvalidhelp
653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{@group invalid in context where filling is enabled}%
654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startsavinginserts
656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox\groupbox = \vtop\bgroup
658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Do @comment since we are called inside an environment such as
659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % @example, where each end-of-line in the input causes an
660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % end-of-line in the output.  We don't want the end-of-line after
661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % the `@group' to put extra space in the output.  Since @group
662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % should appear on a line by itself (according to the Texinfo
663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % manual), we don't worry about eating any user text.
664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \comment
665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The \vtop produces a box with normal height and large depth; thus, TeX puts
668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \baselineskip glue before it, and (when the next line of text is done)
669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \lineskip glue after it.  Thus, space below is not quite equal to space
670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% above.  But it's pretty close.
671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Egroup{%
672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % To get correct interline space between the last line of the group
673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % and the first line afterwards, we have to propagate \prevdepth.
674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgraf % Not \par, as it may have been set to \lisppar.
675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\dimen1 = \prevdepth
676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \egroup           % End the \vtop.
677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \dimen0 is the vertical size of the group's box.
678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \dimen2 is how much space is left on the page (more or less).
680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % if the group doesn't fit on the current page, and it's a big big
682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % group, force a page break.
683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim \dimen0 > \dimen2
684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim \pagetotal < \vfilllimit\pageheight
685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \page
686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \box\groupbox
689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \prevdepth = \dimen1
690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \checkinserts
691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% message, so this ends up printing `@group can only ...'.
695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newhelp\groupinvalidhelp{%
697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piquegroup can only be used in environments such as @example,^^J%
698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piquewhere each line of input produces a line of output.}
699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @need space-in-mils
701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% forces a page break if there is not space-in-mils remaining.
702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\mil  \mil=0.001in
704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\need{%
706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Ensure vertical mode, so we don't make a big box in the middle of a
707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % paragraph.
708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \par
709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If the @need value is less than one line space, it's useless.
711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen0 = #1\mil
712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen2 = \ht\strutbox
713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\dimen2 by \dp\strutbox
714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim\dimen0 > \dimen2
715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Do a \strut just to make the height of this box be normal, so the
717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % normal leading is inserted relative to the preceding line.
718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % And a page break here is fine.
719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vtop to #1\mil{\strut\vfil}%
720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % TeX does not even consider page breaks if a penalty added to the
722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % main vertical list is 10000 or more.  But in order to see if the
723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % empty box we just added fits on the page, we must make it consider
724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % page breaks.  On the other hand, we don't want to actually break the
725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % page after the empty box.  So we use a penalty of 9999.
726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % There is an extremely small chance that TeX will actually break the
728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % page at this \penalty, if there are no other feasible breakpoints in
729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % sight.  (If the user is using lots of big @group commands, which
730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % almost-but-not-quite fill up a page, TeX will have a hard time doing
731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % good page breaking, for example.)  However, I could not construct an
732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % example where a page broke at this \penalty; if it happens in a real
733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % document, then we can reconsider our strategy.
734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \penalty9999
735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Back up by the size of the box, whether we did a page break or not.
737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \kern -#1\mil
738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Do not allow a page break right after this kern.
740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak
741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @br   forces paragraph break (and is undocumented).
745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\br = \par
747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @page forces the start of a new page.
749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\page{\par\vfill\supereject}
751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @exdent text....
753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% outputs text on separate line in roman font, starting at standard page margin
754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This records the amount of indent in the innermost environment.
756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% That's how much \exdent should take out.
757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\exdentamount
758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This defn is used inside fill environments such as @defun.
760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This defn is used inside nofill environments such as @example.
763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \leftline{\hskip\leftskip{\rm#1}}}}
765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% paragraph.  For more general purposes, use the \margin insertion
768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\inmarginspacing \inmarginspacing=1cm
771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\strutdepth{\dp\strutbox}
772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doinmargin#1#2{\strut\vadjust{%
774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak
775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \kern-\strutdepth
776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vtop to \strutdepth{%
777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \baselineskip=\strutdepth
778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vss
779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % if you have multiple lines of stuff to put here, you'll need to
780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % make the vbox yourself of the appropriate size.
781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx#1l%
782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \llap{\ignorespaces #2\hskip\inmarginspacing}%
783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \null
787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\inleftmargin{\doinmargin l}
790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\inrightmargin{\doinmargin r}
791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @inmargin{TEXT [, RIGHT-TEXT]}
793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% else use TEXT for both).
795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\inmargin#1{\parseinmargin #1,,\finish}
797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0 = \hbox{\ignorespaces #2}%
799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim\wd0 > 0pt
800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\lefttext{#1}%  have both texts
801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\righttext{#2}%
802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\lefttext{#1}%  have only one text
804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\righttext{#1}%
805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifodd\pageno
808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\temp{\inleftmargin\lefttext}%
811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \temp
813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @| inserts a changebar to the left of the current line.  It should
816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% surround any changed text.  This approach does *not* work if the
817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% change spans more than two lines of output.  To handle that, we would
818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% have adopt a much more difficult approach (putting marks into the main
819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% vertical list for the beginning and end of each change).  This command
820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% is not documented, not supported, and doesn't work.
821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\|{%
823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \vadjust can only be used in horizontal mode.
824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \leavevmode
825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Append this vertical mode material after the current line in the output.
827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vadjust{%
828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % We want to insert a rule with the height and depth of the current
829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % leading; that is exactly what \strutbox is supposed to record.
830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vskip-\baselineskip
831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \vadjust-items are inserted at the left edge of the type.  So
833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % the \llap here moves out into the left-hand margin.
834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \llap{%
835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % For a thicker or thinner bar, change the `1pt'.
837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \vrule height\baselineskip width1pt
838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % This is the space between the bar and the text.
840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \hskip 12pt
841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @include FILE -- \input text of FILE.
846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\include{\parseargusing\filenamecatcodes\includezzz}
848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\includezzz#1{%
849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pushthisfilestack
850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\thisfile{#1}%
851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makevalueexpandable  % we want to expand any @value in FILE.
853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \turnoffactive        % and allow special characters in the expansion
854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indexnofonts         % Allow `@@' and other weird things in file names.
855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \wlog{texinfo.tex: doing @include of #1^^J}%
856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\temp{\noexpand\input #1 }%
857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % This trickery is to read FILE outside of a group, in case it makes
859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % definitions, etc.
860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter
861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }\temp
862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \popthisfilestack
863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\filenamecatcodes{%
865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\\=\other
866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`~=\other
867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`^=\other
868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`_=\other
869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`|=\other
870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`<=\other
871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`>=\other
872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`+=\other
873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`-=\other
874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\`=\other
875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\'=\other
876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pushthisfilestack{%
879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pushthisfilestackX{%
882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\pushthisfilestackY\thisfile\StackTerm
883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\popthisfilestack{\errthisfilestackempty}
889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\errthisfilestackempty{\errmessage{Internal error:
890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  the stack of filenames is empty.}}
891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\thisfile{}
893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @center line
895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% outputs that line, centered.
896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\center{%
898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifhmode
899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\centersub\centerH
900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\centersub\centerV
902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \centersub{\hfil \ignorespaces#1\unskip \hfil}%
904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\centersub\relax % don't let the definition persist, just in case
905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\centerH#1{{%
907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hfil\break
908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\hsize by -\leftskip
909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\hsize by -\rightskip
910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \line{#1}%
911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \break
912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\centerpenalty
915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\centerV#1{%
916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The idea here is the same as in \startdefun, \cartouche, etc.: if
917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @center is the first thing after a section heading, we need to wipe
918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % out the negative parskip inserted by \sectionheading, but still
919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % prevent a page break here.
920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \centerpenalty = \lastpenalty
921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\centerpenalty>10000 \vskip\parskip \fi
922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \line{\kern\leftskip #1\kern\rightskip}%
924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @sp n   outputs n lines of vertical space
927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\sp{\vskip #1\baselineskip}
929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @comment ...line which is ignored...
931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @c is the same as @comment
932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @ignore ... @end ignore  is another way to write a comment
933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\comment{\begingroup \catcode`\^^M=\other%
935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\commentxxx}
937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\c=\comment
940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @paragraphindent NCHARS
942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We'll use ems for NCHARS, close enough.
943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% NCHARS can also be the word `asis' or `none'.
944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We cannot feasibly implement @paragraphindent asis, though.
945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\asisword{asis} % no translation, these are keywords
947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\noneword{none}
948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\paragraphindent{%
950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\asisword
952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\temp\noneword
954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \defaultparindent = 0pt
955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \defaultparindent = #1em
957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent = \defaultparindent
960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @exampleindent NCHARS
963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We'll use ems for NCHARS like @paragraphindent.
964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It seems @exampleindent asis isn't necessary, but
965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% I preserve it to make it similar to @paragraphindent.
966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\exampleindent{%
967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\asisword
969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\temp\noneword
971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \lispnarrowing = 0pt
972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \lispnarrowing = #1em
974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @firstparagraphindent WORD
979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If WORD is `none', then suppress indentation of the first paragraph
980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% after a section heading.  If WORD is `insert', then do indent at such
981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% paragraphs.
982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The paragraph indentation is suppressed or not by calling
984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \suppressfirstparagraphindent, which the sectioning commands do.
985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We switch the definition of this back and forth according to WORD.
986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% By default, we suppress indentation.
987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\insertword{insert}
990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\firstparagraphindent{%
992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\noneword
994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\insertword
996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\suppressfirstparagraphindent = \relax
997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @firstparagraphindent option `\temp'}%
1000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
1001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Here is how we actually suppress indentation.  Redefine \everypar to
1004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \kern backwards by \parindent, and then reset itself to empty.
1005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We also make \indent itself not actually do anything until the next
1007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% paragraph.
1008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\dosuppressfirstparagraphindent{%
1010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\indent{%
1011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \restorefirstparagraphindent
1012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indent
1013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
1014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\noindent{%
1015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \restorefirstparagraphindent
1016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \noindent
1017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
1018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\everypar = {%
1019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \kern -\parindent
1020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \restorefirstparagraphindent
1021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
1022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\restorefirstparagraphindent{%
1025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global \let \indent = \ptexindent
1026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global \let \noindent = \ptexnoindent
1027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global \everypar = {}%
1028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @refill is a no-op.
1032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\refill=\relax
1033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If working on a large document in chapters, it is convenient to
1035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% be able to disable indexing, cross-referencing, and contents, for test runs.
1036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is done with @novalidate (before @setfilename).
1037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\iflinks \linkstrue % by default we want the aux files.
1039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\novalidate = \linksfalse
1040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @setfilename is done at the beginning of every texinfo file.
1042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% So open here the files we need to have open while reading the input.
1043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This makes it possible to make a .fmt file for texinfo.
1044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setfilename{%
1045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
1046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \iflinks
1047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \tryauxfile
1048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     % Open the new aux file.  TeX will close it automatically at exit.
1049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \immediate\openout\auxfile=\jobname.aux
1050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \fi % \openindices needs to do some work in any case.
1051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \openindices
1052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \let\setfilename=\comment % Ignore extra @setfilename cmds.
1053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   %
1054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % If texinfo.cnf is present on the system, read it.
1055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % Useful for site-wide @afourpaper, etc.
1056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \openin 1 texinfo.cnf
1057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \ifeof 1 \else \input texinfo.cnf \fi
1058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \closein 1
1059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   %
1060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \comment % Ignore the actual filename.
1061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Called from \setfilename.
1064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\openindices{%
1066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \newindex{cp}%
1067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \newcodeindex{fn}%
1068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \newcodeindex{vr}%
1069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \newcodeindex{tp}%
1070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \newcodeindex{ky}%
1071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \newcodeindex{pg}%
1072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @bye.
1075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{pdf,}
1079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% adobe `portable' document format
1080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\tempnum
1081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\lnkcount
1082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\filename
1083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\filenamelength
1084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\pgn
1085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\toksA
1086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\toksB
1087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\toksC
1088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\toksD
1089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\boxA
1090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\countA
1091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifpdf
1092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifpdfmakepagedest
1093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% can be set).  So we test for \relax and 0 as well as being undefined.
1096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\pdfoutput\thisisundefined
1097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\else
1098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\pdfoutput\relax
1099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
1100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifcase\pdfoutput
1101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
1102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \pdftrue
1103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
1104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
1105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
1106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% PDF uses PostScript string constants for the names of xref targets,
1108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% for display in the outlines, and in other places.  Thus, we have to
1109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% double any backslashes.  Otherwise, a name like "\node" will be
1110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% interpreted as a newline (\n), followed by o, d, e.  Not good.
1111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
1112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% related messages.  The final outcome is that it is up to the TeX user
1114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to double the backslashes and otherwise make the string valid, so
1115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
1116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% do this reliably, so we use it.
1117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is a control sequence in which to do the replacements,
1119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% which we \xdef.
1120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\txiescapepdf#1{%
1121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\pdfescapestring\thisisundefined
1122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % No primitive available; should we give a warning or log?
1123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Many times it won't matter.
1124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
1125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % The expandable \pdfescapestring primitive escapes parentheses,
1126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % backslashes, and other special chars.
1127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef#1{\pdfescapestring{#1}}%
1128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
1129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piquewith PDF output, and none of those formats could be found.  (.eps cannot
1133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piquebe supported due to the design of the PDF format; use regular TeX (DVI
1134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueoutput) for that.)}
1135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifpdf
1137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Color manipulation macros based on pdfcolor.tex,
1139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % except using rgb instead of cmyk; the latter is said to render as a
1140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % very dark gray on-screen and a very dark halftone in print, instead
1141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % of actual black.
1142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\rgbDarkRed{0.50 0.09 0.12}
1143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\rgbBlack{0 0 0}
1144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % k sets the color for filling (usual text, etc.);
1146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % K sets the color for stroking (thin rules, e.g., normal _'s).
1147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
1148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Set color, and create a mark which defines \thiscolor accordingly,
1150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % so that \makeheadline knows which color to restore.
1151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\setcolor#1{%
1152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \domark
1154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdfsetcolor{#1}%
1155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
1156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\maincolor{\rgbBlack}
1158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pdfsetcolor{\maincolor}
1159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\thiscolor{\maincolor}
1160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lastcolordefs{}
1161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\makefootline{%
1163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \baselineskip24pt
1164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \line{\pdfsetcolor{\maincolor}\the\footline}%
1165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
1166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\makeheadline{%
1168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vbox to 0pt{%
1169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \vskip-22.5pt
1170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \line{%
1171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \vbox to8.5pt{}%
1172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % Extract \thiscolor definition from the marks.
1173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \getcolormarks
1174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % Typeset the headline with \maincolor, then restore the color.
1175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
1177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \vss
1178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
1179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nointerlineskip
1180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
1181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pdfcatalog{/PageMode /UseOutlines}
1184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\dopdfimage#1#2#3{%
1187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
1190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % others).  Let's try in that order, PDF first since if
1192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % someone has a scalable image, presumably better to use that than a
1193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % bitmap.
1194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\pdfimgext=\empty
1195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \begingroup
1196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \openin 1 #1.pdf \ifeof 1
1197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \openin 1 #1.PDF \ifeof 1
1198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \openin 1 #1.png \ifeof 1
1199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \openin 1 #1.jpg \ifeof 1
1200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique              \openin 1 #1.jpeg \ifeof 1
1201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                \openin 1 #1.JPG \ifeof 1
1202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                  \errhelp = \nopdfimagehelp
1203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                  \errmessage{Could not find image file #1 for pdf}%
1204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                \else \gdef\pdfimgext{JPG}%
1205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                \fi
1206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique              \else \gdef\pdfimgext{jpeg}%
1207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique              \fi
1208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \else \gdef\pdfimgext{jpg}%
1209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \fi
1210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \else \gdef\pdfimgext{png}%
1211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \fi
1212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \else \gdef\pdfimgext{PDF}%
1213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \fi
1214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else \gdef\pdfimgext{pdf}%
1215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
1216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \closein 1
1217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
1218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
1219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % without \immediate, ancient pdftex seg faults when the same image is
1220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
1221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\pdftexversion < 14
1222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \immediate\pdfimage
1223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
1224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \immediate\pdfximage
1225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
1226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifdim \wd0 >0pt width \pdfimagewidth \fi
1227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifdim \wd2 >0pt height \pdfimageheight \fi
1228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifnum\pdftexversion<13
1229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         #1.\pdfimgext
1230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \else
1231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         {#1.\pdfimgext}%
1232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \fi
1233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\pdftexversion < 14 \else
1234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \pdfrefximage \pdflastximage
1235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi}
1236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\pdfmkdest#1{{%
1238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % We have to set dummies so commands such as @code, and characters
1239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % such as \, aren't expanded when present in a section title.
1240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indexnofonts
1241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \turnoffactive
1242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makevalueexpandable
1243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\pdfdestname{#1}%
1244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \txiescapepdf\pdfdestname
1245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }}
1247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % used to mark target names; must be expandable.
1249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\pdfmkpgn#1{#1}
1250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % by default, use a color that is dark enough to print on paper as
1252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % nearly black, but still distinguishable for online viewing.
1253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\urlcolor{\rgbDarkRed}
1254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\linkcolor{\rgbDarkRed}
1255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\endlink{\setcolor{\maincolor}\pdfendlink}
1256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Adding outlines to PDF; macros for calculating structure of outlines
1258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % come from Petr Olsak
1259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else \csname#1\endcsname \fi}
1261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\tempnum by 1
1263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % #1 is the section text, which is what will be displayed in the
1266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % outline by the pdf viewer.  #2 is the pdf expression for the number
1267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % of subentries (or empty, for subsubsections).  #3 is the node text,
1268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % which might be empty if this toc entry had no corresponding node.
1269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % #4 is the page number
1270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\dopdfoutline#1#2#3#4{%
1272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Generate a link to the node text if that exists; else, use the
1273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % page number.  We could generate a destination for the section
1274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % text in the case where a section has no node, but it doesn't
1275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % seem worth the trouble, since most documents are normally structured.
1276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\pdfoutlinedest{#3}%
1277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\pdfoutlinedest\empty
1278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\pdfoutlinedest{#4}%
1279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
1280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \txiescapepdf\pdfoutlinedest
1281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
1282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
1283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Also escape PDF chars in the display string.
1284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\pdfoutlinetext{#1}%
1285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \txiescapepdf\pdfoutlinetext
1286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
1287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
1289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\pdfmakeoutlines{%
1291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \begingroup
1292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Read toc silently, to get counts of subentries for \pdfoutline.
1293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\partentry##1##2##3##4{}% ignore parts in the outlines
1294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\numchapentry##1##2##3##4{%
1295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\def\thischapnum{##2}%
1296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\def\thissecnum{0}%
1297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\def\thissubsecnum{0}%
1298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
1299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\numsecentry##1##2##3##4{%
1300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\advancenumber{chap\thischapnum}%
1301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\def\thissecnum{##2}%
1302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\def\thissubsecnum{0}%
1303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
1304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\numsubsecentry##1##2##3##4{%
1305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\advancenumber{sec\thissecnum}%
1306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\def\thissubsecnum{##2}%
1307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
1308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\numsubsubsecentry##1##2##3##4{%
1309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\advancenumber{subsec\thissubsecnum}%
1310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
1311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\thischapnum{0}%
1312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\thissecnum{0}%
1313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\thissubsecnum{0}%
1314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
1315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % use \def rather than \let here because we redefine \chapentry et
1316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % al. a second time, below.
1317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\appentry{\numchapentry}%
1318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\appsecentry{\numsecentry}%
1319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\appsubsecentry{\numsubsecentry}%
1320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\appsubsubsecentry{\numsubsubsecentry}%
1321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\unnchapentry{\numchapentry}%
1322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\unnsecentry{\numsecentry}%
1323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\unnsubsecentry{\numsubsecentry}%
1324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\unnsubsubsecentry{\numsubsubsecentry}%
1325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \readdatafile{toc}%
1326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
1327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Read toc second time, this time actually producing the outlines.
1328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % The `-' means take the \expnumber as the absolute number of
1329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % subentries, which we calculated on our first read of the .toc above.
1330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
1331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % We use the node names as the destinations.
1332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\numchapentry##1##2##3##4{%
1333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\numsecentry##1##2##3##4{%
1335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\numsubsecentry##1##2##3##4{%
1337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\numsubsubsecentry##1##2##3##4{% count is always zero
1339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \dopdfoutline{##1}{}{##3}{##4}}%
1340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
1341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % PDF outlines are displayed using system fonts, instead of
1342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % document fonts.  Therefore we cannot use special characters,
1343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % since the encoding is unknown.  For example, the eogonek from
1344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Latin 2 (0xea) gets translated to a | character.  Info from
1345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
1347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % TODO this right, we have to translate 8-bit characters to
1348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % their "best" equivalent, based on the @documentencoding.  Too
1349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % much work for too little return.  Just use the ASCII equivalents
1350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % we use for the index sort strings.
1351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % 
1352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \indexnofonts
1353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setupdatafile
1354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % We can have normal brace characters in the PDF outlines, unlike
1355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Texinfo index files.  So set that up.
1356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\{{\lbracecharliteral}%
1357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\}{\rbracecharliteral}%
1358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \catcode`\\=\active \otherbackslash
1359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \input \tocreadfilename
1360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
1361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
1362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\catcode`[=1 \catcode`]=2
1363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \catcode`{=\other \catcode`}=\other
1364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \gdef\lbracecharliteral[{]%
1365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \gdef\rbracecharliteral[}]%
1366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  ]
1367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
1368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\PP\D\let\nextsp\relax
1370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\let\nextsp\skipspaces
1371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \addtokens{\filename}{\PP}%
1372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \advance\filenamelength by 1
1373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
1374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nextsp}
1375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\getfilename#1{%
1376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \filenamelength=0
1377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If we don't expand the argument now, \skipspaces will get
1378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % snagged on things like "@value{foo}".
1379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\temp{#1}%
1380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\skipspaces\temp|\relax
1381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
1382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\pdftexversion < 14
1383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let \startlink \pdfannotlink
1384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
1385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let \startlink \pdfstartlink
1386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
1387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % make a live url in pdf output.
1388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\pdfurl#1{%
1389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \begingroup
1390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % it seems we really need yet another set of dummies; have not
1391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % tried to figure out what each command should do in the context
1392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % of @url.  for now, just make @/ a no-op, that's the only one
1393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % people have actually reported a problem with.
1394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
1395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \normalturnoffactive
1396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\@{@}%
1397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \let\/=\empty
1398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \makevalueexpandable
1399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % do we want to go so far as to use \indexnofonts instead of just
1400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % special-casing \var here?
1401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\var##1{##1}%
1402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
1403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \leavevmode\setcolor{\urlcolor}%
1404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \startlink attr{/Border [0 0 0]}%
1405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup}
1407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\maketoks{%
1412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\first0\adn0
1414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
1418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifnum0=\countA\else\makelink\fi
1419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifx\first.\let\next=\done\else
1420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \let\next=\maketoks
1421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \addtokens{\toksB}{\the\toksD}
1422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \ifx\first,\addtokens{\toksB}{\space}\fi
1423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
1424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \next}
1426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\makelink{\addtokens{\toksB}%
1427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\pdflink#1{%
1429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setcolor{\linkcolor}#1\endlink}
1431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\else
1433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % non-pdf mode
1434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\pdfmkdest = \gobble
1435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\pdfurl = \gobble
1436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\endlink = \relax
1437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\setcolor = \gobble
1438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\pdfsetcolor = \gobble
1439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\pdfmakeoutlines = \relax
1440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi  % \ifx\pdfoutput
1441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{fonts,}
1444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Change the current font style to #1, remembering it in \curfontstyle.
1446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% italics, not bold italics.
1448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setfontstyle#1{%
1450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \csname ten#1\endcsname  % change the current font
1452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Select #1 fonts with the current style.
1455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\rm{\fam=0 \setfontstyle{rm}}
1459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\it{\fam=\itfam \setfontstyle{it}}
1460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sl{\fam=\slfam \setfontstyle{sl}}
1461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tt{\fam=\ttfam \setfontstyle{tt}}
1463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Unfortunately, we have to override this for titles and the like, since
1465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in those cases "rm" is bold.  Sigh.
1466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\rmisbold{\rm\def\curfontstyle{bf}}
1467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Texinfo sort of supports the sans serif font style, which plain TeX does not.
1469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% So we set up a \sf.
1470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newfam\sffam
1471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sf{\fam=\sffam \setfontstyle{sf}}
1472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\li = \sf % Sometimes we call it \li, not \sf.
1473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We don't need math for this font style.
1475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ttsl{\setfontstyle{ttsl}}
1476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set the baselineskip to #1, and the lineskip and strut size
1479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% correspondingly.  There is no deep meaning behind these magic numbers
1480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% used as factors; they just match (closely enough) what Knuth defined.
1481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lineskipfactor{.08333}
1483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\strutheightpercent{.70833}
1484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\strutdepthpercent {.29167}
1485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% can get a sort of poor man's double spacing by redefining this.
1487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\baselinefactor{1}
1488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\textleading
1490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setleading#1{%
1491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen0 = #1\relax
1492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \normalbaselineskip = \baselinefactor\dimen0
1493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \normallineskip = \lineskipfactor\normalbaselineskip
1494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \normalbaselines
1495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox\strutbox =\hbox{%
1496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vrule width0pt height\strutheightpercent\baselineskip
1497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    depth \strutdepthpercent \baselineskip
1498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
1499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% PDF CMaps.  See also LaTeX's t1.cmap.
1502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% do nothing with this by default.
1504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\expandafter\let\csname cmapOT1\endcsname\gobble
1505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\expandafter\let\csname cmapOT1IT\endcsname\gobble
1506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\expandafter\let\csname cmapOT1TT\endcsname\gobble
1507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% if we are producing pdf, and we have \pdffontattr, then define cmaps.
1509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (\pdffontattr was introduced many years ago, but people still run
1510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% older pdftex's; it's easy to conditionalize, so we do.)
1511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifpdf \ifx\pdffontattr\thisisundefined \else
1512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
1513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%DocumentNeededResources: ProcSet (CIDInit)
1516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%IncludeResource: ProcSet (CIDInit)
1517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%BeginResource: CMap (TeX-OT1-0)
1518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%Title: (TeX-OT1-0 TeX OT1 0)
1519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%Version: 1.000
1520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EndComments
1521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CIDInit /ProcSet findresource begin
1522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique12 dict begin
1523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piquebegincmap
1524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CIDSystemInfo
1525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<< /Registry (TeX)
1526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/Ordering (OT1)
1527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/Supplement 0
1528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique>> def
1529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CMapName /TeX-OT1-0 def
1530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CMapType 2 def
1531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique1 begincodespacerange
1532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<00> <7F>
1533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendcodespacerange
1534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique8 beginbfrange
1535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<00> <01> <0393>
1536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<09> <0A> <03A8>
1537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<23> <26> <0023>
1538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<28> <3B> <0028>
1539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<3F> <5B> <003F>
1540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<5D> <5E> <005D>
1541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<61> <7A> <0061>
1542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7B> <7C> <2013>
1543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendbfrange
1544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique40 beginbfchar
1545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<02> <0398>
1546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<03> <039B>
1547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<04> <039E>
1548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<05> <03A0>
1549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<06> <03A3>
1550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<07> <03D2>
1551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<08> <03A6>
1552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0B> <00660066>
1553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0C> <00660069>
1554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0D> <0066006C>
1555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0E> <006600660069>
1556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0F> <00660066006C>
1557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<10> <0131>
1558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<11> <0237>
1559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<12> <0060>
1560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<13> <00B4>
1561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<14> <02C7>
1562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<15> <02D8>
1563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<16> <00AF>
1564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<17> <02DA>
1565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<18> <00B8>
1566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<19> <00DF>
1567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1A> <00E6>
1568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1B> <0153>
1569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1C> <00F8>
1570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1D> <00C6>
1571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1E> <0152>
1572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1F> <00D8>
1573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<21> <0021>
1574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<22> <201D>
1575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<27> <2019>
1576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<3C> <00A1>
1577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<3D> <003D>
1578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<3E> <00BF>
1579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<5C> <201C>
1580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<5F> <02D9>
1581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<60> <2018>
1582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7D> <02DD>
1583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7E> <007E>
1584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7F> <00A8>
1585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendbfchar
1586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendcmap
1587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd PiqueCMapName currentdict /CMap defineresource pop
1588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueend
1589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueend
1590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EndResource
1591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EOF
1592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }\endgroup
1593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\edef\csname cmapOT1\endcsname#1{%
1594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
1596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \cmapOT1IT
1598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
1599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%DocumentNeededResources: ProcSet (CIDInit)
1602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%IncludeResource: ProcSet (CIDInit)
1603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%BeginResource: CMap (TeX-OT1IT-0)
1604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%Version: 1.000
1606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EndComments
1607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CIDInit /ProcSet findresource begin
1608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique12 dict begin
1609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piquebegincmap
1610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CIDSystemInfo
1611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<< /Registry (TeX)
1612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/Ordering (OT1IT)
1613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/Supplement 0
1614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique>> def
1615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CMapName /TeX-OT1IT-0 def
1616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CMapType 2 def
1617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique1 begincodespacerange
1618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<00> <7F>
1619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendcodespacerange
1620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique8 beginbfrange
1621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<00> <01> <0393>
1622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<09> <0A> <03A8>
1623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<25> <26> <0025>
1624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<28> <3B> <0028>
1625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<3F> <5B> <003F>
1626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<5D> <5E> <005D>
1627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<61> <7A> <0061>
1628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7B> <7C> <2013>
1629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendbfrange
1630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique42 beginbfchar
1631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<02> <0398>
1632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<03> <039B>
1633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<04> <039E>
1634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<05> <03A0>
1635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<06> <03A3>
1636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<07> <03D2>
1637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<08> <03A6>
1638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0B> <00660066>
1639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0C> <00660069>
1640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0D> <0066006C>
1641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0E> <006600660069>
1642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0F> <00660066006C>
1643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<10> <0131>
1644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<11> <0237>
1645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<12> <0060>
1646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<13> <00B4>
1647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<14> <02C7>
1648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<15> <02D8>
1649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<16> <00AF>
1650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<17> <02DA>
1651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<18> <00B8>
1652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<19> <00DF>
1653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1A> <00E6>
1654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1B> <0153>
1655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1C> <00F8>
1656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1D> <00C6>
1657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1E> <0152>
1658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1F> <00D8>
1659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<21> <0021>
1660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<22> <201D>
1661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<23> <0023>
1662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<24> <00A3>
1663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<27> <2019>
1664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<3C> <00A1>
1665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<3D> <003D>
1666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<3E> <00BF>
1667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<5C> <201C>
1668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<5F> <02D9>
1669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<60> <2018>
1670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7D> <02DD>
1671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7E> <007E>
1672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7F> <00A8>
1673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendbfchar
1674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendcmap
1675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd PiqueCMapName currentdict /CMap defineresource pop
1676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueend
1677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueend
1678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EndResource
1679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EOF
1680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }\endgroup
1681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
1684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \cmapOT1TT
1686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
1687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%DocumentNeededResources: ProcSet (CIDInit)
1690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%IncludeResource: ProcSet (CIDInit)
1691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%BeginResource: CMap (TeX-OT1TT-0)
1692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%Version: 1.000
1694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EndComments
1695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CIDInit /ProcSet findresource begin
1696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique12 dict begin
1697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piquebegincmap
1698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CIDSystemInfo
1699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<< /Registry (TeX)
1700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/Ordering (OT1TT)
1701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/Supplement 0
1702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique>> def
1703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CMapName /TeX-OT1TT-0 def
1704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique/CMapType 2 def
1705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique1 begincodespacerange
1706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<00> <7F>
1707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendcodespacerange
1708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique5 beginbfrange
1709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<00> <01> <0393>
1710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<09> <0A> <03A8>
1711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<21> <26> <0021>
1712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<28> <5F> <0028>
1713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<61> <7E> <0061>
1714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendbfrange
1715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique32 beginbfchar
1716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<02> <0398>
1717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<03> <039B>
1718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<04> <039E>
1719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<05> <03A0>
1720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<06> <03A3>
1721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<07> <03D2>
1722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<08> <03A6>
1723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0B> <2191>
1724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0C> <2193>
1725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0D> <0027>
1726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0E> <00A1>
1727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<0F> <00BF>
1728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<10> <0131>
1729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<11> <0237>
1730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<12> <0060>
1731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<13> <00B4>
1732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<14> <02C7>
1733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<15> <02D8>
1734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<16> <00AF>
1735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<17> <02DA>
1736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<18> <00B8>
1737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<19> <00DF>
1738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1A> <00E6>
1739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1B> <0153>
1740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1C> <00F8>
1741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1D> <00C6>
1742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1E> <0152>
1743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<1F> <00D8>
1744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<20> <2423>
1745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<27> <2019>
1746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<60> <2018>
1747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique<7F> <00A8>
1748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendbfchar
1749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueendcmap
1750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd PiqueCMapName currentdict /CMap defineresource pop
1751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueend
1752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueend
1753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EndResource
1754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%%EOF
1755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }\endgroup
1756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
1759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi\fi
1760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set the font macro #1 to the font named \fontprefix#2.
1763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
1765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Example:
1766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 = \textrm
1767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #2 = \rmshape
1768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #3 = 10
1769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #4 = \mainmagstep
1770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #5 = OT1
1771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setfont#1#2#3#4#5{%
1773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \font#1=\fontprefix#2#3 scaled #4
1774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \csname cmap#5\endcsname#1%
1775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
1776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is what gets called when #5 of \setfont is empty.
1777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\cmap\gobble
1778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (end of cmaps)
1780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use cm as the default font prefix.
1782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% To specify the font prefix, you must define \fontprefix
1783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% before you read in texinfo.tex.
1784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\fontprefix\thisisundefined
1785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\fontprefix{cm}
1786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
1787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Support font families that don't use the same naming scheme as CM.
1788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\rmshape{r}
1789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\rmbshape{bx}               % where the normal face is bold
1790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\bfshape{b}
1791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\bxshape{bx}
1792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ttshape{tt}
1793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ttbshape{tt}
1794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ttslshape{sltt}
1795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\itshape{ti}
1796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\itbshape{bxti}
1797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\slshape{sl}
1798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\slbshape{bxsl}
1799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sfshape{ss}
1800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sfbshape{ss}
1801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\scshape{csc}
1802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\scbshape{csc}
1803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Definitions for a main text size of 11pt.  (The default in Texinfo.)
1805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\definetextfontsizexi{%
1807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Text fonts (11.2pt, magstep1).
1808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\textnominalsize{11pt}
1809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\edef\mainmagstep{\magstephalf}
1810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\texti=cmmi10 scaled \mainmagstep
1819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\textsy=cmsy10 scaled \mainmagstep
1820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\textecsize{1095}
1821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A few fonts for @defun names and args.
1823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\defbf\bfshape{10}{\magstep1}{OT1}
1824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Fonts for indices, footnotes, small examples (9pt).
1829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallnominalsize{9pt}
1830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallrm\rmshape{9}{1000}{OT1}
1831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smalltt\ttshape{9}{1000}{OT1TT}
1832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallbf\bfshape{10}{900}{OT1}
1833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallit\itshape{9}{1000}{OT1IT}
1834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallsl\slshape{9}{1000}{OT1}
1835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallsf\sfshape{9}{1000}{OT1}
1836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallsc\scshape{10}{900}{OT1}
1837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\smalli=cmmi9
1839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\smallsy=cmsy9
1840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallecsize{0900}
1841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Fonts for small examples (8pt).
1843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallernominalsize{8pt}
1844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallerrm\rmshape{8}{1000}{OT1}
1845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallertt\ttshape{8}{1000}{OT1TT}
1846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallerbf\bfshape{10}{800}{OT1}
1847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallerit\itshape{8}{1000}{OT1IT}
1848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallersl\slshape{8}{1000}{OT1}
1849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallersf\sfshape{8}{1000}{OT1}
1850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallersc\scshape{10}{800}{OT1}
1851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\smalleri=cmmi8
1853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\smallersy=cmsy8
1854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallerecsize{0800}
1855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Fonts for title page (20.4pt):
1857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\titlenominalsize{20pt}
1858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\titlebf=\titlerm
1865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\titlei=cmmi12 scaled \magstep3
1867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\titlesy=cmsy10 scaled \magstep4
1868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\titleecsize{2074}
1869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Chapter (and unnumbered) fonts (17.28pt).
1871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapnominalsize{17pt}
1872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
1873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
1874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
1875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
1876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
1877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapsf\sfbshape{17}{1000}{OT1}
1878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\chapbf=\chaprm
1879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
1880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\chapi=cmmi12 scaled \magstep2
1881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\chapsy=cmsy10 scaled \magstep3
1882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapecsize{1728}
1883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Section fonts (14.4pt).
1885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\secnominalsize{14pt}
1886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
1887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
1888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secsl\slbshape{10}{\magstep2}{OT1}
1889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
1890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
1891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
1892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\secbf\secrm
1893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secsc\scbshape{10}{\magstep2}{OT1}
1894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\seci=cmmi12 scaled \magstep1
1895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\secsy=cmsy10 scaled \magstep2
1896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sececsize{1440}
1897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subsection fonts (13.15pt).
1899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ssecnominalsize{13pt}
1900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
1901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecit\itbshape{10}{1315}{OT1IT}
1902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecsl\slbshape{10}{1315}{OT1}
1903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
1904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
1905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
1906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ssecbf\ssecrm
1907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecsc\scbshape{10}{1315}{OT1}
1908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\sseci=cmmi12 scaled \magstephalf
1909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\ssecsy=cmsy10 scaled 1315
1910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ssececsize{1200}
1911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Reduced fonts for @acro in text (10pt).
1913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\reducednominalsize{10pt}
1914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedrm\rmshape{10}{1000}{OT1}
1915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
1916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedbf\bfshape{10}{1000}{OT1}
1917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedit\itshape{10}{1000}{OT1IT}
1918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedsl\slshape{10}{1000}{OT1}
1919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedsf\sfshape{10}{1000}{OT1}
1920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedsc\scshape{10}{1000}{OT1}
1921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
1922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\reducedi=cmmi10
1923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\reducedsy=cmsy10
1924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\reducedecsize{1000}
1925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\textleading = 13.2pt % line spacing for 11pt CM
1927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\textfonts            % reset the current fonts
1928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\rm
1929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique} % end of 11pt text font size definitions, \definetextfontsizexi
1930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Definitions to make the main text be 10pt Computer Modern, with
1933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% section, chapter, etc., sizes following suit.  This is for the GNU
1934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Press printing of the Emacs 22 manual.  Maybe other manuals in the
1935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% future.  Used with @smallbook, which sets the leading to 12pt.
1936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
1937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\definetextfontsizex{%
1938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Text fonts (10pt).
1939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\textnominalsize{10pt}
1940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\edef\mainmagstep{1000}
1941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\texti=cmmi10 scaled \mainmagstep
1950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\textsy=cmsy10 scaled \mainmagstep
1951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\textecsize{1000}
1952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A few fonts for @defun names and args.
1954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
1955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
1956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
1957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Fonts for indices, footnotes, small examples (9pt).
1960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallnominalsize{9pt}
1961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallrm\rmshape{9}{1000}{OT1}
1962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smalltt\ttshape{9}{1000}{OT1TT}
1963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallbf\bfshape{10}{900}{OT1}
1964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallit\itshape{9}{1000}{OT1IT}
1965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallsl\slshape{9}{1000}{OT1}
1966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallsf\sfshape{9}{1000}{OT1}
1967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallsc\scshape{10}{900}{OT1}
1968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\smalli=cmmi9
1970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\smallsy=cmsy9
1971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallecsize{0900}
1972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Fonts for small examples (8pt).
1974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallernominalsize{8pt}
1975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallerrm\rmshape{8}{1000}{OT1}
1976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallertt\ttshape{8}{1000}{OT1TT}
1977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallerbf\bfshape{10}{800}{OT1}
1978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallerit\itshape{8}{1000}{OT1IT}
1979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallersl\slshape{8}{1000}{OT1}
1980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallersf\sfshape{8}{1000}{OT1}
1981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallersc\scshape{10}{800}{OT1}
1982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\smalleri=cmmi8
1984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\smallersy=cmsy8
1985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallerecsize{0800}
1986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
1987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Fonts for title page (20.4pt):
1988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\titlenominalsize{20pt}
1989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\titlebf=\titlerm
1996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\titlei=cmmi12 scaled \magstep3
1998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\titlesy=cmsy10 scaled \magstep4
1999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\titleecsize{2074}
2000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Chapter fonts (14.4pt).
2002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapnominalsize{14pt}
2003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\chapbf\chaprm
2010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\chapi=cmmi12 scaled \magstep1
2012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\chapsy=cmsy10 scaled \magstep2
2013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapecsize{1440}
2014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Section fonts (12pt).
2016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\secnominalsize{12pt}
2017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secrm\rmbshape{12}{1000}{OT1}
2018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secsl\slbshape{10}{\magstep1}{OT1}
2020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\sectt\ttbshape{12}{1000}{OT1TT}
2021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secsf\sfbshape{12}{1000}{OT1}
2023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\secbf\secrm
2024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\secsc\scbshape{10}{\magstep1}{OT1}
2025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\seci=cmmi12
2026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\secsy=cmsy10 scaled \magstep1
2027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sececsize{1200}
2028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subsection fonts (10pt).
2030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ssecnominalsize{10pt}
2031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecrm\rmbshape{10}{1000}{OT1}
2032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecit\itbshape{10}{1000}{OT1IT}
2033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecsl\slbshape{10}{1000}{OT1}
2034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecsf\sfbshape{10}{1000}{OT1}
2037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ssecbf\ssecrm
2038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\ssecsc\scbshape{10}{1000}{OT1}
2039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\sseci=cmmi10
2040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\ssecsy=cmsy10
2041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ssececsize{1000}
2042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Reduced fonts for @acro in text (9pt).
2044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\reducednominalsize{9pt}
2045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedrm\rmshape{9}{1000}{OT1}
2046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedbf\bfshape{10}{900}{OT1}
2048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedit\itshape{9}{1000}{OT1IT}
2049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedsl\slshape{9}{1000}{OT1}
2050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedsf\sfshape{9}{1000}{OT1}
2051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedsc\scshape{10}{900}{OT1}
2052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\reducedi=cmmi9
2054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\reducedsy=cmsy9
2055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\reducedecsize{0900}
2056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\divide\parskip by 2  % reduce space between paragraphs
2058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\textleading = 12pt   % line spacing for 10pt CM
2059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\textfonts            % reset the current fonts
2060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\rm
2061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique} % end of 10pt text font size definitions, \definetextfontsizex
2062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We provide the user-level command
2065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @fonttextsize 10
2066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (or 11) to redefine the text font size.  pt is assumed.
2067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xiword{11}
2069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xword{10}
2070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xwordpt{10pt}
2071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\fonttextsize{%
2073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\textsizearg{#1}%
2074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %\wlog{doing @fonttextsize \textsizearg}%
2075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
2076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Set \globaldefs so that documents can use this inside @tex, since
2077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % makeinfo 4.8 does not support it, but we need it nonetheless.
2078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
2079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique \begingroup \globaldefs=1
2080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\textsizearg\xword \definetextfontsizex
2081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifx\textsizearg\xiword \definetextfontsizexi
2082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp=\EMsimple
2084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
2086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique \endgroup
2087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% In order for the font changes to affect most math symbols and letters,
2091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we have to define the \textfont of the standard families.  Since
2092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% texinfo doesn't allow for producing subscripts and superscripts except
2093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in the main text, we don't bother to reset \scriptfont and
2094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \scriptscriptfont (which would also require loading a lot more fonts).
2095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\resetmathfonts{%
2097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textfont\ttfam=\tentt \textfont\sffam=\tensf
2100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The font-changing commands redefine the meanings of \tenSTYLE, instead
2103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% of just \STYLE.  We do this because \STYLE needs to also set the
2104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
2105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \tenSTYLE to set the current font.
2106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Each font-changing command also sets the names \lsize (one size lower)
2108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and \lllsize (three sizes lower).  These relative commands are used in
2109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the LaTeX logo and acronyms.
2110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This all needs generalizing, badly.
2112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\textfonts{%
2114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenttsl=\textttsl
2118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontsize{text}%
2119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lsize{reduced}\def\lllsize{smaller}%
2120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetmathfonts \setleading{\textleading}}
2121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\titlefonts{%
2122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenttsl=\titlettsl
2126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontsize{title}%
2127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lsize{chap}\def\lllsize{subsec}%
2128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetmathfonts \setleading{27pt}}
2129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\titlefont#1{{\titlefonts\rmisbold #1}}
2130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapfonts{%
2131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenttsl=\chapttsl
2135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontsize{chap}%
2136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lsize{sec}\def\lllsize{text}%
2137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetmathfonts \setleading{19pt}}
2138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\secfonts{%
2139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenttsl=\secttsl
2143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontsize{sec}%
2144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lsize{subsec}\def\lllsize{reduced}%
2145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetmathfonts \setleading{16pt}}
2146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\subsecfonts{%
2147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenttsl=\ssecttsl
2151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontsize{ssec}%
2152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lsize{text}\def\lllsize{small}%
2153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetmathfonts \setleading{15pt}}
2154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\subsubsecfonts = \subsecfonts
2155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\reducedfonts{%
2156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenttsl=\reducedttsl
2160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontsize{reduced}%
2161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lsize{small}\def\lllsize{smaller}%
2162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetmathfonts \setleading{10.5pt}}
2163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallfonts{%
2164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenttsl=\smallttsl
2168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontsize{small}%
2169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lsize{smaller}\def\lllsize{smaller}%
2170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetmathfonts \setleading{10.5pt}}
2171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallerfonts{%
2172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tenttsl=\smallerttsl
2176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\curfontsize{smaller}%
2177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lsize{smaller}\def\lllsize{smaller}%
2178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetmathfonts \setleading{9.5pt}}
2179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Fonts for short table of contents.
2181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\shortcontrm\rmshape{12}{1000}{OT1}
2182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
2183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\shortcontsl\slshape{12}{1000}{OT1}
2184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define these just so they can be easily changed for other fonts.
2187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\angleleft{$\langle$}
2188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\angleright{$\rangle$}
2189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set the fonts to use with the @small... environments.
2191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\smallexamplefonts = \smallfonts
2192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
2194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% can fit this many characters:
2195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   8.5x11=86   smallbook=72  a4=90  a5=69
2196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If we use \scriptfonts (8pt), then we can fit this many characters:
2197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   8.5x11=90+  smallbook=80  a4=90+  a5=77
2198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For me, subjectively, the few extra characters that fit aren't worth
2199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the additional smallness of 8pt.  So I'm making the default 9pt.
2200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% By the way, for comparison, here's what fits with @example (10pt):
2202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   8.5x11=71  smallbook=60  a4=75  a5=58
2203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% --karl, 24jan03.
2204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set up the default fonts, so we can use them for creating boxes.
2206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\definetextfontsizexi
2208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{markup,}
2211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Check if we are currently using a typewriter font.  Since all the
2213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Computer Modern typewriter fonts have zero interword stretch (and
2214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% shrink), and it is reasonable to expect all typewriter fonts to have
2215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% this property, we can check that font parameter.
2216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
2220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% define and register \INITMACRO to be called on markup style changes.
2221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \INITMACRO can check \currentmarkupstyle for the innermost
2222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% style and the set of \ifmarkupSTYLE switches for all styles
2223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% currently in effect.
2224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkupvar
2225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkupsamp
2226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkupkey
2227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\newif\ifmarkupfile % @file == @samp.
2228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\newif\ifmarkupoption % @option == @samp.
2229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkupcode
2230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkupkbd
2231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\newif\ifmarkupenv % @env == @code.
2232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\newif\ifmarkupcommand % @command == @code.
2233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkuptex % @tex (and part of @math, for now).
2234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkupexample
2235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkupverb
2236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifmarkupverbatim
2237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\currentmarkupstyle\empty
2239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setupmarkupstyle#1{%
2241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \csname markup#1true\endcsname
2242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\currentmarkupstyle{#1}%
2243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \markupstylesetup
2244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupstylesetup\empty
2247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defmarkupstylesetup#1{%
2249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\def\expandafter\markupstylesetup
2250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter{\markupstylesetup #1}%
2251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def#1%
2252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Markup style setup for left and right quotes.
2255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\defmarkupstylesetup\markupsetuplq{%
2256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\expandafter \temp
2257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \csname markupsetuplq\currentmarkupstyle\endcsname
2258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\defmarkupstylesetup\markupsetuprq{%
2262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\expandafter \temp
2263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \csname markupsetuprq\currentmarkupstyle\endcsname
2264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
2268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\'=\active
2269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\`=\active
2270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\markupsetuplqdefault{\let`\lq}
2272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\markupsetuprqdefault{\let'\rq}
2273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\markupsetcodequoteleft{\let`\codequoteleft}
2275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\markupsetcodequoteright{\let'\codequoteright}
2276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuplqcode \markupsetcodequoteleft
2279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuprqcode \markupsetcodequoteright
2280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuplqexample \markupsetcodequoteleft
2282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuprqexample \markupsetcodequoteright
2283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuplqkbd     \markupsetcodequoteleft
2285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuprqkbd     \markupsetcodequoteright
2286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuplqsamp \markupsetcodequoteleft
2288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuprqsamp \markupsetcodequoteright
2289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuplqverb \markupsetcodequoteleft
2291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuprqverb \markupsetcodequoteright
2292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuplqverbatim \markupsetcodequoteleft
2294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\markupsetuprqverbatim \markupsetcodequoteright
2295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Allow an option to not use regular directed right quote/apostrophe
2297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The undirected quote is ugly, so don't make it the default, but it
2299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% works for pasting with more pdf viewers (at least evince), the
2300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% lilypond developers report.  xpdf does work with the regular 0x27.
2301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\codequoteright{%
2303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      '%
2306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else \char'15 \fi
2307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \char'15 \fi
2308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and a similar option for the left quote char vs. a grave accent.
2311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Modern fonts display ASCII 0x60 as a grave accent, so some people like
2312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the code environments to do likewise.
2313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\codequoteleft{%
2315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % [Knuth] pp. 380,381,391
2318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % \relax disables Spanish ligatures ?` and !` of \tt font.
2319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \relax`%
2320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else \char'22 \fi
2321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \char'22 \fi
2322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Commands to set the quote options.
2325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
2326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\codequoteundirected{%
2327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
2328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\onword
2329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname SETtxicodequoteundirected\endcsname
2330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      = t%
2331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\offword
2332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname SETtxicodequoteundirected\endcsname
2333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      = \relax
2334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
2336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
2338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\codequotebacktick{%
2341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
2342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\onword
2343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname SETtxicodequotebacktick\endcsname
2344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      = t%
2345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\offword
2346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname SETtxicodequotebacktick\endcsname
2347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      = \relax
2348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
2350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
2352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\noligaturesquoteleft{\relax\lq}
2356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Count depth in font-changes, for error checks
2358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\fontdepth \fontdepth=0
2359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Font commands.
2361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the font command (\sl or \it), #2 is the text to slant.
2363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If we are in a monospaced environment, however, 1) always use \ttsl,
2364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and 2) do not add an italic correction.
2365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dosmartslant#1#2{%
2366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifusingtt 
2367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {{\ttsl #2}\let\next=\relax}%
2368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next
2370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smartslanted{\dosmartslant\sl}
2372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smartitalic{\dosmartslant\it}
2373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Output an italic correction unless \next (presumed to be the following
2375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% character) is such as not to need one.
2376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smartitaliccorrection{%
2377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\next,%
2378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\next-%
2379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\next.%
2380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ptexslash
2381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi
2382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \aftersmartic
2383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Unconditional use \ttsl, and no ic.  @var is set to this for defuns.
2386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ttslanted#1{{\ttsl #1}}
2387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @cite is like \smartslanted except unconditionally use \sl.  We never want
2389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ttsl for book titles, do we?
2390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\aftersmartic{}
2393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\var#1{%
2394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\saveaftersmartic = \aftersmartic
2395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \smartslanted{#1}%
2397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\i=\smartitalic
2400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\slanted=\smartslanted
2401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\dfn=\smartslanted
2402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\emph=\smartitalic
2403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Explicit font changes: @r, @sc, undocumented @ii.
2405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\r#1{{\rm #1}}              % roman font
2406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sc#1{{\smallcaps#1}}       % smallcaps font
2407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ii#1{{\it #1}}             % italic font
2408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @b, explicit bold.  Also @strong.
2410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\b#1{{\bf #1}}
2411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\strong=\b
2412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @sansserif, explicit sans.
2414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sansserif#1{{\sf #1}}
2415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We can't just use \exhyphenpenalty, because that only has effect at
2417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the end of a paragraph.  Restore normal hyphenation at the end of the
2418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% group within which \nohyphenation is presumably called.
2419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
2421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\restorehyphenation{\hyphenchar\font = `- }
2422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set sfcode to normal for the chars that usually have another value.
2424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Can't use plain's \frenchspacing because it uses the `\x notation, and
2425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% sometimes \x has an active definition that messes things up.
2426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`@=11
2428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\plainfrenchspacing{%
2429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
2430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
2431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\endofsentencespacefactor{1000}% for @. and friends
2432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
2433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\plainnonfrenchspacing{%
2434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\endofsentencespacefactor{3000}% for @. and friends
2437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
2438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`@=\other
2439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\endofsentencespacefactor{3000}% default
2440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @t, explicit typewriter.
2442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\t#1{%
2443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\tt \rawbackslash \plainfrenchspacing #1}%
2444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \null
2445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @samp.
2448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @indicateurl is \samp, that is, with quotes.
2451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\indicateurl=\samp
2452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @code (and similar) prints in typewriter, but with spaces the same
2454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% size as normal in the surrounding text, without hyphenation, etc.
2455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is a subroutine for that.
2456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tclose#1{%
2457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
2458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Change normal interword space to be same as for the current font.
2459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \spaceskip = \fontdimen2\font
2460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
2461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Switch to typewriter.
2462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \tt
2463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
2464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % But `\ ' produces the large typewriter interword space.
2465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\ {{\spaceskip = 0pt{} }}%
2466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
2467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Turn off hyphenation.
2468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nohyphenation
2469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
2470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \rawbackslash
2471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \plainfrenchspacing
2472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    #1%
2473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
2474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \null % reset spacefactor to 1000
2475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We *must* turn on hyphenation at `-' and `_' in @code.
2478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Otherwise, it is too hard to avoid overfull hboxes
2479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in the Emacs manual, the Library manual, etc.
2480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Unfortunately, TeX uses one parameter (\hyphenchar) to control
2482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% both hyphenation at - and hyphenation within words.
2483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We must therefore turn them both off (\tclose does that)
2484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and arrange explicitly to hyphenate at a dash.
2485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  -- rms.
2486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
2487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\-=\active \catcode`\_=\active
2488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\'=\active \catcode`\`=\active
2489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let'=\rq \global\let`=\lq  % default definitions
2490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
2491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\def\code{\begingroup
2492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setupmarkupstyle{code}%
2493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % The following should really be moved into \setupmarkupstyle handlers.
2494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode\dashChar=\active  \catcode\underChar=\active
2495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifallowcodebreaks
2496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \let-\codedash
2497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \let_\codeunder
2498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
2499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \let-\normaldash
2500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \let_\realunder
2501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
2502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \codex
2503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
2504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\codex #1{\tclose{#1}\endgroup}
2507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\normaldash{-}
2509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\codedash{-\discretionary{}{}{}}
2510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\codeunder{%
2511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
2512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % will therefore expand the active definition of _, which is us
2514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % (inside @code that is), therefore an endless loop.
2515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifusingtt{\ifmmode
2516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique             \else\normalunderscore \fi
2518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique             \discretionary{}{}{}}%
2519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            {\_}%
2520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% An additional complication: the above will allow breaks after, e.g.,
2523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% each of the four underscores in __typeof__.  This is bad.
2524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @allowcodebreaks provides a document-level way to turn breaking at -
2525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and _ on and off.
2526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifallowcodebreaks  \allowcodebreakstrue
2528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\keywordtrue{true}
2530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\keywordfalse{false}
2531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\allowcodebreaks{%
2533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\txiarg{#1}%
2534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\txiarg\keywordtrue
2535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \allowcodebreakstrue
2536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\txiarg\keywordfalse
2537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \allowcodebreaksfalse
2538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
2540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
2542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For @command, @env, @file, @option quotes seem unnecessary,
2545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% so use \code rather than \samp.
2546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\command=\code
2547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\env=\code
2548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\file=\code
2549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\option=\code
2550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @uref (abbreviation for `urlref') takes an optional (comma-separated)
2552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% second argument specifying the text to display and an optional third
2553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% arg as text to display instead of (rather than in addition to) the url
2554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% itself.  First (mandatory) arg is the url.
2555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (This \urefnobreak definition isn't used now, leaving it for a while
2556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% for comparison.)
2557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
2558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
2559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \unsepspaces
2560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pdfurl{#1}%
2561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0 = \hbox{\ignorespaces #3}%
2562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim\wd0 > 0pt
2563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \unhbox0 % third arg given, show only that
2564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setbox0 = \hbox{\ignorespaces #2}%
2566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim\wd0 > 0pt
2567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifpdf
2568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \unhbox0             % PDF: 2nd arg given, show only it
2569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
2570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
2571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
2572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
2573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \code{#1}% only url given, so show it
2574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
2575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
2576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endlink
2577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
2578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This \urefbreak definition is the active one.
2580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\uref=\urefbreak
2582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \unsepspaces
2585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pdfurl{#1}%
2586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0 = \hbox{\ignorespaces #3}%
2587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim\wd0 > 0pt
2588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \unhbox0 % third arg given, show only that
2589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setbox0 = \hbox{\ignorespaces #2}%
2591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim\wd0 > 0pt
2592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifpdf
2593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \unhbox0             % PDF: 2nd arg given, show only it
2594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
2595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
2596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
2597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
2598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \urefcode{#1}% only url given, so show it
2599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
2600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
2601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endlink
2602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
2603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Allow line breaks around only a few characters (only).
2605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefcatcodes{%
2606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode\ampChar=\active   \catcode\dotChar=\active
2607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode\hashChar=\active  \catcode\questChar=\active
2608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode\slashChar=\active
2609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
2611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \urefcatcodes
2612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
2613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\def\urefcode{\begingroup
2614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setupmarkupstyle{code}%
2615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \urefcatcodes
2616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let&\urefcodeamp
2617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let.\urefcodedot
2618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let#\urefcodehash
2619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let?\urefcodequest
2620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let/\urefcodeslash
2621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \codex
2622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
2623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
2624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % By default, they are just regular characters.
2625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\def&{\normalamp}
2626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\def.{\normaldot}
2627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\def#{\normalhash}
2628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\def?{\normalquest}
2629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\def/{\normalslash}
2630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we put a little stretch before and after the breakable chars, to help
2633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% line breaking of long url's.  The unequal skips make look better in
2634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% cmtt at least, especially for dots.
2635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
2636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
2637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefcodedot{\urefprestretch .\urefpoststretch}
2640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefcodehash{\urefprestretch \#\urefpoststretch}
2641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefcodequest{\urefprestretch ?\urefpoststretch}
2642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
2644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\/=\active
2645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\def\urefcodeslashfinish{%
2646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \urefprestretch \slashChar
2647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Allow line break only after the final / in a sequence of
2648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % slashes, to avoid line break between the slashes in http://.
2649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\next/\else \urefpoststretch \fi
2650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
2651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% One more complication: by default we'll break after the special
2654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% characters, but some people like to break before the special chars, so
2655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% allow that.  Also allow no breaking at all, for manual control.
2656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
2657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\urefbreakstyle{%
2658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\txiarg{#1}%
2659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\txiarg\wordnone
2660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\txiarg\wordbefore
2662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\txiarg\wordafter
2664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
2667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi
2669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\wordafter{after}
2671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\wordbefore{before}
2672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\wordnone{none}
2673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\urefbreakstyle after
2675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @url synonym for @uref, since that's how everyone uses it.
2677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\url=\uref
2679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% rms does not like angle brackets --karl, 17may97.
2681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% So now @email is just like @uref, unless we are pdf.
2682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\def\email#1{\angleleft{\tt #1}\angleright}
2684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifpdf
2685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\email#1{\doemail#1,,\finish}
2686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\doemail#1,#2,#3\finish{\begingroup
2687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \unsepspaces
2688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdfurl{mailto:#1}%
2689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setbox0 = \hbox{\ignorespaces #2}%
2690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endlink
2692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup}
2693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\else
2694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\email=\uref
2695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
2696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   `example' (@kbd uses ttsl only inside of @example and friends),
2699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   or `code' (@kbd uses normal tty font always).
2700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\kbdinputstyle{%
2701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\txiarg{#1}%
2702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\txiarg\worddistinct
2703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\txiarg\wordexample
2705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\txiarg\wordcode
2707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
2710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi
2712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\worddistinct{distinct}
2714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\wordexample{example}
2715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\wordcode{code}
2716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Default is `distinct'.
2718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\kbdinputstyle distinct
2719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @kbd is like @code, except that if the argument is just one @key command,
2721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% then @kbd has no effect.
2722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
2723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xkey{\key}
2725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\kbdsub#1#2#3\par{%
2726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\one{#1}\def\three{#3}\def\threex{??}%
2727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\one\xkey\ifx\threex\three \key{#2}%
2728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% definition of @key that produces a lozenge.  Doesn't adjust to text size.
2733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\setfont\keyrm\rmshape{8}{1000}{OT1}
2734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\font\keysy=cmsy9
2735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%    \vbox{\hrule\kern-0.4pt
2738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%    \kern-0.4pt\hrule}%
2740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% definition of @key with no lozenge.  If the current font is already
2743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% monospace, don't change it; that way, we respect @kbdinputstyle.  But
2744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% if it isn't monospace, then use \tt.
2745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\key#1{{\setupmarkupstyle{key}%
2747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nohyphenation
2748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifmonospace\else\tt\fi
2749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  #1}\null}
2750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @clicksequence{File @click{} Open ...}
2752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\clicksequence#1{\begingroup #1\endgroup}
2753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @clickstyle @arrow   (by default)
2755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\clickstyle{\def\click{#1}}
2756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\click{\arrow}
2757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
2759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dmn#1{\thinspace #1}
2762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @l was never documented to mean ``switch to the Lisp font'',
2764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and it is not used as such in any manual I can find.  We need it for
2765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Polish suppressed-l.  --karl, 22sep96.
2766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%\def\l#1{{\li #1}\null}
2767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @acronym for "FBI", "NATO", and the like.
2769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We print this one point size smaller, since it's intended for
2770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% all-uppercase.
2771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\acronym#1{\doacronym #1,,\finish}
2773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doacronym#1,#2,#3\finish{%
2774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\selectfonts\lsize #1}%
2775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#2}%
2776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\empty \else
2777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \space ({\unsepspaces \ignorespaces \temp \unskip})%
2778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
2779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \null % reset \spacefactor=1000
2780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @abbr for "Comput. J." and the like.
2783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% No font change, but don't do end-of-sentence spacing.
2784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\abbr#1{\doabbr #1,,\finish}
2786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doabbr#1,#2,#3\finish{%
2787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\plainfrenchspacing #1}%
2788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#2}%
2789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\empty \else
2790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \space ({\unsepspaces \ignorespaces \temp \unskip})%
2791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
2792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \null % reset \spacefactor=1000
2793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @asis just yields its argument.  Used with @table, for example.
2796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\asis#1{#1}
2798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @math outputs its argument in math mode.
2800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% One complication: _ usually means subscripts, but it could also mean
2802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
2803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% _ active, and distinguish by seeing if the current family is \slfam,
2804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% which is what @var uses.
2805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
2806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\_ = \active
2807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\mathunderscore{%
2808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\_=\active
2809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
2811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Another complication: we want \\ (and @\) to output a math (or tt) \.
2813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% FYI, plain.tex uses \\ as a temporary control sequence (for no
2814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% particular reason), but this is not advertised and we don't care.
2815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\math{%
2820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tex
2821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \mathunderscore
2822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\\ = \mathbackslash
2823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \mathactive
2824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % make the texinfo accent commands work in math mode
2825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\"=\ddot
2826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\'=\acute
2827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\==\bar
2828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\^=\hat
2829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\`=\grave
2830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\u=\breve
2831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\v=\check
2832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\~=\tilde
2833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\dotaccent=\dot
2834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  $\finishmath
2835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
2837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Some active characters (such as <) are spaced differently in math.
2839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We have to reset their definitions in case the @math was an argument
2840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to a command which sets the catcodes (such as @item or @section).
2841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
2843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`^ = \active
2844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`< = \active
2845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`> = \active
2846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`+ = \active
2847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`' = \active
2848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\mathactive{%
2849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let^ = \ptexhat
2850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let< = \ptexless
2851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let> = \ptexgtr
2852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let+ = \ptexplus
2853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let' = \ptexquoteright
2854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
2855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ctrl is no longer a Texinfo command, but leave this definition for fun.
2858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ctrl #1{{\tt \rawbackslash \hat}#1}
2859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
2861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
2862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% except specified as a normal braced arg, so no newlines to worry about.
2863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
2864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\outfmtnametex{tex}
2865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
2867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\doinlinefmt#1,#2,\finish{%
2868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\inlinefmtname{#1}%
2869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
2870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For raw, must switch into @tex before parsing the argument, to avoid
2872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% setting catcodes prematurely.  Doing it this way means that, for
2873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% example, @inlineraw{html, foo{bar} gets a parse error instead of being
2874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ignored.  But this isn't important because if people want a literal
2875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% *right* brace they would have to use a command anyway, so they may as
2876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% well use a command to get a left brace too.  We could re-use the
2877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% delimiter character idea from \verb, but it seems like overkill.
2878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
2879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\inlineraw{\tex \doinlineraw}
2880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
2881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doinlinerawtwo#1,#2,\finish{%
2882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\inlinerawname{#1}%
2883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
2884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup % close group opened by \tex.
2885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{glyphs,}
2889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and logos.
2890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @@ prints an @, as does @atchar{}.
2892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\@{\char64 }
2893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\atchar=\@
2894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
2896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Unless we're in typewriter, use \ecfont because the CM text fonts do
2897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% not have braces, and we don't want to switch into math.
2898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
2899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
2900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\{=\mylbrace \let\lbracechar=\{
2901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\}=\myrbrace \let\rbracechar=\}
2902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
2903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Definitions to produce \{ and \} commands for indices,
2904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % and @{ and @} for the aux/toc files.
2905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\{ = \other \catcode`\} = \other
2906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\[ = 1 \catcode`\] = 2
2907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\! = 0 \catcode`\\ = \other
2908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  !gdef!lbracecmd[\{]%
2909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  !gdef!rbracecmd[\}]%
2910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  !gdef!lbraceatcmd[@{]%
2911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  !gdef!rbraceatcmd[@}]%
2912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique!endgroup
2913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @comma{} to avoid , parsing problems.
2915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\comma = ,
2916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
2918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
2919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\, = \ptexc
2920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\dotaccent = \ptexdot
2921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ringaccent#1{{\accent23 #1}}
2922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\tieaccent = \ptext
2923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\ubaraccent = \ptexb
2924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\udotaccent = \d
2925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Other special characters: @questiondown @exclamdown @ordf @ordm
2927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
2928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\questiondown{?`}
2929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\exclamdown{!`}
2930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
2931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
2932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Dotless i and dotless j, used for accents.
2934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\imacro{i}
2935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\jmacro{j}
2936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dotless#1{%
2937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
2938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
2939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
2940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \errmessage{@dotless can be used only with i or j}%
2941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
2942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The \TeX{} logo, as in plain, but resetting the spacing so that a
2945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% period following counts as ending a sentence.  (Idea found in latex.)
2946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\edef\TeX{\TeX \spacefactor=1000 }
2948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @LaTeX{} logo.  Not quite the same results as the definition in
2950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% latex.ltx, since we use a different font for the raised A; it's most
2951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% convenient for us to use an explicitly smaller font, rather than using
2952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the \scriptstyle font (since we don't reset \scriptstyle and
2953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \scriptscriptstyle).
2954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\LaTeX{%
2956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  L\kern-.36em
2957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\setbox0=\hbox{T}%
2958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \vbox to \ht0{\hbox{%
2959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \ifx\textnominalsize\xwordpt
2960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
2961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % Revert to plain's \scriptsize, which is 7pt.
2962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \count255=\the\fam $\fam\count255 \scriptstyle A$%
2963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \else
2964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % For 11pt, we can use our lllsize.
2965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \selectfonts\lllsize A%
2966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \fi
2967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     }%
2968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \vss
2969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }}%
2970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \kern-.15em
2971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \TeX
2972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
2973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Some math mode symbols.
2975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\bullet{$\ptexbullet$}
2976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\geq{\ifmmode \ge\else $\ge$\fi}
2977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\leq{\ifmmode \le\else $\le$\fi}
2978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\minus{\ifmmode -\else $-$\fi}
2979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
2980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @dots{} outputs an ellipsis using the current font.
2981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We do .5em per period so that it has the same spacing in the cm
2982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% typewriter fonts as three actual period characters; on the other hand,
2983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in other typewriter fonts three periods are wider than 1.5em.  So do
2984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% whichever is larger.
2985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
2986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dots{%
2987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \leavevmode
2988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0=\hbox{...}% get width of three periods
2989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim\wd0 > 1.5em
2990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \dimen0 = \wd0
2991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
2992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \dimen0 = 1.5em
2993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
2994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbox to \dimen0{%
2995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \hskip 0pt plus.25fil
2996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    .\hskip 0pt plus1fil
2997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    .\hskip 0pt plus1fil
2998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    .\hskip 0pt plus.5fil
2999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
3000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @enddots{} is an end-of-sentence ellipsis.
3003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\enddots{%
3005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dots
3006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \spacefactor=\endofsentencespacefactor
3007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Since these characters are used in examples, they should be an even number of
3012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \tt widths. Each \tt character is 1en, so two makes it 1em.
3013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\point{$\star$}
3015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The @error{} command.
3022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Adapted from the TeXbook's \boxit.
3023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\errorbox
3025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\tentt \global\dimen0 = 3em}% Width of the box.
3027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\dimen2 = .55pt % Thickness of rules
3028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The text. (`r' is open on the right, `e' somewhat less so on the left.)
3029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setbox\errorbox=\hbox to \dimen0{\hfil
3032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \advance\hsize by -2\dimen2 % Rules.
3034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \vbox{%
3035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \hrule height\dimen2
3036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
3037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \kern3pt\vrule width\dimen2}% Space to right.
3039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \hrule height\dimen2}
3040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \hfil}
3041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\error{\leavevmode\lower.7ex\copy\errorbox}
3043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pounds{{\it\$}}
3047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @euro{} comes from a separate font, depending on the current style.
3049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We use the free feym* fonts from the eurosym package by Henrik
3050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Theiling, which support regular, slanted, bold and bold slanted (and
3051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% "outlined" (blackboard board, sort of) versions, which we don't need).
3052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Although only regular is the truly official Euro symbol, we ignore
3055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% that.  The Euro is designed to be slightly taller than the regular
3056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% font height.
3057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% feymr - regular
3059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% feymo - slanted
3060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% feybr - bold
3061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% feybo - bold slanted
3062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% There is no good (free) typewriter version, to my knowledge.
3064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Hmm.
3066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Also doesn't work in math.  Do we need to do math with euro symbols?
3068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Hope not.
3069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\euro{{\eurofont e}}
3072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\eurofont{%
3073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We set the font at each command, rather than predefining it in
3074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \textfonts and the other font-switching commands, so that
3075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % installations which never need the symbol don't have to have the
3076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % font installed.
3077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % There is only one designed size (nominal 10pt), so we always scale
3079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % that to the current nominal size.
3080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % By the way, simply using "at 1em" works for cmr10 and the like, but
3082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % does not work for cmbx10 and other extended/shrunken fonts.
3083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\curfontstyle\bfstylename
3087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % bold:
3088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
3090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % regular:
3091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \thiseurofont
3094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Glyphs from the EC fonts.  We don't use \let for the aliases, because
3097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% sometimes we redefine the original macro, and the alias should reflect
3098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the redefinition.
3099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use LaTeX names for the Icelandic letters.
3101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\DH{{\ecfont \char"D0}} % Eth
3102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dh{{\ecfont \char"F0}} % eth
3103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\TH{{\ecfont \char"DE}} % Thorn
3104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\th{{\ecfont \char"FE}} % thorn
3105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\guillemetleft{{\ecfont \char"13}}
3107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\guillemotleft{\guillemetleft}
3108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\guillemetright{{\ecfont \char"14}}
3109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\guillemotright{\guillemetright}
3110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\guilsinglleft{{\ecfont \char"0E}}
3111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\guilsinglright{{\ecfont \char"0F}}
3112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\quotedblbase{{\ecfont \char"12}}
3113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\quotesinglbase{{\ecfont \char"0D}}
3114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This positioning is not perfect (see the ogonek LaTeX package), but
3116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we have the precomposed glyphs for the most common cases.  We put the
3117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% tests to use those glyphs in the single \ogonek macro so we have fewer
3118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% dummy definitions to worry about for index entries, etc.
3119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ogonek is also used with other letters in Lithuanian (IOU), but using
3121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the precomposed glyphs for those is not so easy since they aren't in
3122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the same EC font.
3123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ogonek#1{{%
3124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
3125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\macrocharA\Aogonek
3126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\macrochara\aogonek
3127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\macrocharE\Eogonek
3128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\macrochare\eogonek
3129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
3130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ecfont \setbox0=\hbox{#1}%
3131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim\ht0=1ex\accent"0C #1%
3132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
3134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi\fi
3135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
3136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
3143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ecfont{%
3144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We can't distinguish serif/sans and italic/slanted, but this
3145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % is used for crude hacks anyway (like adding French and German
3146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % quotes to documents typeset with CM, where we lose kerning), so
3147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % hopefully nobody will notice/care.
3148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifmonospace
3151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % typewriter:
3152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \font\thisecfont = ectt\ecsize \space at \nominalsize
3153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
3154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\curfontstyle\bfstylename
3155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % bold:
3156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
3157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
3158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % regular:
3159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
3161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \thisecfont
3163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @registeredsymbol - R in a circle.  The font for the R should really
3166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% be smaller yet, but lllsize is the best we can do for now.
3167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Adapted from the plain.tex definition of \copyright.
3168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\registeredsymbol{%
3170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique               \hfil\crcr\Orb}}%
3172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }$%
3173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @textdegree - the normal degrees sign.
3176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\textdegree{$^\circ$}
3178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Laurent Siebenmann reports \Orb undefined with:
3180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
3181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% so we'll define it if necessary.
3182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\Orb\thisisundefined
3184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Orb{\mathhexbox20D}
3185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
3186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Quotes.
3188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\quotedblleft="5C
3189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\quotedblright=`\"
3190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\quoteleft=`\`
3191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\quoteright=`\'
3192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{page headings,}
3195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\titlepagetopglue \titlepagetopglue = 1.5in
3197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% First the title page.  Must do @settitle before @titlepage.
3200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifseenauthor
3201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\iffinishedtitlepage
3202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Do an implicit @contents or @shortcontents after @end titlepage if the
3204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
3205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifsetcontentsaftertitlepage
3207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifsetshortcontentsaftertitlepage
3209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\shorttitlepage{%
3212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup\page\hbox{}\page}
3214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\titlepage{%
3216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Open one extra group, as we want to close it in the middle of \Etitlepage.
3217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
3218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \parindent=0pt \textfonts
3219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Leave some space at the very top of the page.
3220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vglue\titlepagetopglue
3221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % No rule at page bottom unless we print one at the top with @title.
3222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \finishedtitlepagetrue
3223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
3224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Most title ``pages'' are actually two pages long, with space
3225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % at the top of the second.  We don't want the ragged left on the second.
3226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\oldpage = \page
3227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\page{%
3228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \iffinishedtitlepage\else
3229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	 \finishtitlepage
3230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
3231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \let\page = \oldpage
3232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \page
3233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \null
3234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
3235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Etitlepage{%
3238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \iffinishedtitlepage\else
3239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\finishtitlepage
3240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
3241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % It is important to do the page break before ending the group,
3242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % because the headline and footline are only empty inside the group.
3243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If we use the new definition of \page, we always get a blank page
3244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % after the title page, which we certainly don't want.
3245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \oldpage
3246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
3247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Need this before the \...aftertitlepage checks so that if they are
3249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % in effect the toc pages will come out with page numbers.
3250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \HEADINGSon
3251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If they want short, they certainly want long too.
3253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifsetshortcontentsaftertitlepage
3254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \shortcontents
3255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \contents
3256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\let\shortcontents = \relax
3257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\let\contents = \relax
3258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifsetcontentsaftertitlepage
3261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \contents
3262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\let\contents = \relax
3263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\let\shortcontents = \relax
3264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\finishtitlepage{%
3268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip4pt \hrule height 2pt width \hsize
3269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip\titlepagebottomglue
3270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \finishedtitlepagetrue
3271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Settings used for typesetting titles: no hyphenation, no indentation,
3274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% don't worry much about spacing, ragged right.  This should be used
3275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% inside a \vbox, and fonts need to be set appropriately first.  Because
3276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% it is always used for titles, nothing else, we call \rmisbold.  \par
3277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% should be specified before the end of the \vbox, since a vbox is a group.
3278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
3279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\raggedtitlesettings{%
3280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \rmisbold
3281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hyphenpenalty=10000
3282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent=0pt
3283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tolerance=5000
3284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ptexraggedright
3285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Macros to be used within @titlepage:
3288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\subtitlerm=\tenrm
3290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\title{%
3293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \checkenv\titlepage
3294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vbox{\titlefonts \raggedtitlesettings #1\par}%
3295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % print a rule at the page bottom also.
3296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \finishedtitlepagefalse
3297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\subtitle{%
3301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \checkenv\titlepage
3302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\subtitlefont \rightline{#1}}%
3303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @author should come last, but may come many times.
3306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It can also be used inside @quotation.
3307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\author{%
3309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{\quotation}%
3310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\thisenv\temp
3311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\quotationauthor{#1}% printed in \Equotation.
3312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
3313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \checkenv\titlepage
3314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {\secfonts\rmisbold \leftline{#1}}%
3316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set up page headings and footings.
3321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\thispage=\folio
3323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\evenheadline    % headline on even pages
3325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\oddheadline     % headline on odd pages
3326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\evenfootline    % footline on even pages
3327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\oddfootline     % footline on odd pages
3328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Now make TeX use those variables
3330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                            \else \the\evenheadline \fi}}
3332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                            \else \the\evenfootline \fi}\HEADINGShook}
3334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\HEADINGShook=\relax
3335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Commands to set those variables.
3337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For example, this is what  @headings on  does
3338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @evenheading @thistitle|@thispage|@thischapter
3339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @oddheading @thischapter|@thispage|@thistitle
3340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @evenfooting @thisfile||
3341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @oddfooting ||@thisfile
3342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\evenheading{\parsearg\evenheadingxxx}
3345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\oddheading{\parsearg\oddheadingxxx}
3350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\evenfooting{\parsearg\evenfootingxxx}
3357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\oddfooting{\parsearg\oddfootingxxx}
3362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Leave some space for the footline.  Hopefully ok to assume
3367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @evenfooting will not be used by itself.
3368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\pageheight by -12pt
3369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\vsize by -12pt
3370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @evenheadingmarks top     \thischapter <- chapter at the top of a page
3375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
3376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The same set of arguments for:
3378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @oddheadingmarks
3380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @evenfootingmarks
3381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @oddfootingmarks
3382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @everyheadingmarks
3383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @everyfootingmarks
3384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\evenheadingmarks{\headingmarks{even}{heading}}
3386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\oddheadingmarks{\headingmarks{odd}{heading}}
3387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\evenfootingmarks{\headingmarks{even}{footing}}
3388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\oddfootingmarks{\headingmarks{odd}{footing}}
3389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                          \headingmarks{odd}{heading}{#1} }
3391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                          \headingmarks{odd}{footing}{#1} }
3393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\headingmarks#1#2#3 {%
3395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\expandafter\let\csname get#1#2marks\endcsname \temp
3397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\everyheadingmarks bottom
3400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\everyfootingmarks bottom
3401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @headings double      turns headings on for double-sided printing.
3403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @headings single      turns headings on for single-sided printing.
3404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @headings off         turns them off.
3405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @headings on          same as @headings double, retained for compatibility.
3406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @headings after       turns on double-sided headings after this page.
3407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @headings doubleafter turns on double-sided headings after this page.
3408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @headings singleafter turns on single-sided headings after this page.
3409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% By default, they are off at the start of a document,
3410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and turned `on' after @end titlepage.
3411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\headings #1 {\csname HEADINGS#1\endcsname}
3413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\headingsoff{% non-global headings elimination
3415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \evenheadline={\hfil}\evenfootline={\hfil}%
3416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \oddheadline={\hfil}\oddfootline={\hfil}%
3417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\HEADINGSoff  % it's the default
3421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% When we turn headings on, set the page number to 1.
3423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For double-sided printing, put current file name in lower left corner,
3424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% chapter name on inside top of right hand pages, document
3425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% title on inside top of left hand pages, and page numbers on outside top
3426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% edge of all pages.
3427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\HEADINGSdouble{%
3428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\pageno=1
3429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenfootline={\hfil}
3430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddfootline={\hfil}
3431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenheadline={\line{\folio\hfil\thistitle}}
3432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddheadline={\line{\thischapter\hfil\folio}}
3433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\contentsalignmacro = \chapoddpage
3434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\contentsalignmacro = \chappager
3436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For single-sided printing, chapter title goes across top left of page,
3438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% page number on top right.
3439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\HEADINGSsingle{%
3440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\pageno=1
3441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenfootline={\hfil}
3442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddfootline={\hfil}
3443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenheadline={\line{\thischapter\hfil\folio}}
3444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddheadline={\line{\thischapter\hfil\folio}}
3445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\contentsalignmacro = \chappager
3446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\HEADINGSon{\HEADINGSdouble}
3448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\HEADINGSdoubleafter=\HEADINGSafter
3451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\HEADINGSdoublex{%
3452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenfootline={\hfil}
3453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddfootline={\hfil}
3454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenheadline={\line{\folio\hfil\thistitle}}
3455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddheadline={\line{\thischapter\hfil\folio}}
3456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\contentsalignmacro = \chapoddpage
3457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\HEADINGSsinglex{%
3461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenfootline={\hfil}
3462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddfootline={\hfil}
3463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\evenheadline={\line{\thischapter\hfil\folio}}
3464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\oddheadline={\line{\thischapter\hfil\folio}}
3465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\contentsalignmacro = \chappager
3466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subroutines used in generating headings
3469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This produces Day Month Year style of output.
3470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Only define if not already defined, in case a txi-??.tex file has set
3471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% up a different format (e.g., txi-cs.tex does this).
3472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\today\thisisundefined
3473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\today{%
3474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \number\day\space
3475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifcase\month
3476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \space\number\year}
3481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
3482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @settitle line...  specifies the title of the document, for headings.
3484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It generates no output of its own.
3485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\thistitle{\putwordNoTitle}
3486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\settitle{\parsearg{\gdef\thistitle}}
3487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{tables,}
3490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Tables -- @table, @ftable, @vtable, @item(x).
3491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% default indentation of table text
3493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\tableindent \tableindent=.8in
3494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% default indentation of @itemize and @enumerate text
3495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\itemindent  \itemindent=.3in
3496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% margin between end of table item and start of table text.
3497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\itemmargin  \itemmargin=.1in
3498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% used internally for \itemindent minus \itemmargin
3500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\itemmax
3501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% these defs.
3504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% They also define \itemindex
3505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to index the item name in whatever manner is desired (perhaps none).
3506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifitemxneedsnegativevskip
3508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\internalBitem{\smallbreak \parsearg\itemzzz}
3512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\internalBitemx{\itemxpar \parsearg\itemzzz}
3513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\itemzzz #1{\begingroup %
3515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\hsize by -\rightskip
3516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\hsize by -\tableindent
3517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0=\hbox{\itemindicate{#1}}%
3518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \itemindex{#1}%
3519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak % This prevents a break before @itemx.
3520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If the item text does not fit in the space we have, put it on a line
3522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % by itself, and do not allow a page break either before or after that
3523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % line.  We do not start a paragraph here because then if the next
3524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % command is, e.g., @kindex, the whatsit would get put into the
3525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % horizontal list on a line by itself, resulting in extra blank space.
3526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim \wd0>\itemmax
3527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
3528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Make this a paragraph so we get the \parskip glue and wrapping,
3529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % but leave it ragged-right.
3530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \begingroup
3531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \advance\leftskip by-\tableindent
3532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \advance\hsize by\tableindent
3533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \advance\rightskip by0pt plus1fil\relax
3534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \leavevmode\unhbox0\par
3535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
3536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
3537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % We're going to be starting a paragraph, but we don't want the
3538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \parskip glue -- logically it's part of the @item we just started.
3539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak \vskip-\parskip
3540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
3541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Stop a page break at the \parskip glue coming up.  However, if
3542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % what follows is an environment such as @example, there will be no
3543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \parskip glue; then the negative vskip we just inserted would
3544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % cause the example and the item to crash together.  So we use this
3545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \parskip glue after all.  Section titles are handled this way also.
3547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
3548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \penalty 10001
3549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
3550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \itemxneedsnegativevskipfalse
3551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
3552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % The item text fits into the space.  Start a paragraph, so that the
3553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % following text (if any) will end up on the same line.
3554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \noindent
3555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Do this with kerns and \unhbox so that if there is a footnote in
3556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % the item text, it can migrate to the main vertical list and
3557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % eventually be printed.
3558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak\kern-\tableindent
3559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \unhbox0
3561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak\kern\dimen0
3562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
3563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \itemxneedsnegativevskiptrue
3564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\item{\errmessage{@item while not in a list environment}}
3568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\itemx{\errmessage{@itemx while not in a list environment}}
3569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @table, @ftable, @vtable.
3571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\table{%
3572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\itemindex\gobble
3573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tablecheck{table}%
3574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\ftable{%
3576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tablecheck{ftable}%
3578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\vtable{%
3580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tablecheck{vtable}%
3582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tablecheck#1{%
3584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum \the\catcode`\^^M=\active
3585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
3586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{This command won't work in this context; perhaps the problem is
3587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      that we are \inenvironment\thisenv}%
3588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\next{\doignore{#1}}%
3589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
3590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next\tablex
3591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next
3593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tablex#1{%
3595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\itemindicate{#1}%
3596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parsearg\tabley
3597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tabley#1{%
3599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
3600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makevalueexpandable
3601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\temp{\noexpand\tablez #1\space\space\space}%
3602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter
3603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }\temp \endtablez
3604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tablez #1 #2 #3 #4\endtablez{%
3606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \aboveenvbreak
3607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum 0#2>0 \tableindent=#2\mil \fi
3609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \itemmax=\tableindent
3611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance \itemmax by -\itemmargin
3612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance \leftskip by \tableindent
3613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \exdentamount=\tableindent
3614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent = 0pt
3615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip = \smallskipamount
3616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim \parskip=0pt \parskip=2pt \fi
3617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\item = \internalBitem
3618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\itemx = \internalBitemx
3619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Etable{\endgraf\afterenvbreak}
3621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Eftable\Etable
3622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Evtable\Etable
3623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Eitemize\Etable
3624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Eenumerate\Etable
3625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is the counter used by @enumerate, which is really @itemize
3627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount \itemno
3629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\itemize{\parsearg\doitemize}
3631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doitemize#1{%
3633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \aboveenvbreak
3634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \itemmax=\itemindent
3635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\itemmax by -\itemmargin
3636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\leftskip by \itemindent
3637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \exdentamount=\itemindent
3638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent=0pt
3639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip=\smallskipamount
3640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim\parskip=0pt \parskip=2pt \fi
3641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Try typesetting the item mark that if the document erroneously says
3643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % something like @itemize @samp (intending @table), there's an error
3644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % right away at the @itemize.  It's not the best error message in the
3645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % world, but it's better than leaving it to the @item.  This means if
3646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the user wants an empty mark, they have to say @w{} not just @w.
3647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\itemcontents{#1}%
3648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0 = \hbox{\itemcontents}%
3649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @itemize with no arg is equivalent to @itemize @bullet.
3651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\item=\itemizeitem
3654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Definition of @item while inside @itemize and @enumerate.
3657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\itemizeitem{%
3659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\itemno by 1  % for enumerations
3660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\let\par=\endgraf \smallbreak}% reasonable place to break
3661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
3662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % If the document has an @itemize directly after a section title, a
3663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % \nobreak will be last on the list, and \sectionheading will have
3664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % done a \vskip-\parskip.  In that case, we don't want to zero
3665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % parskip, or the item text will crash with the heading.  On the
3666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % other hand, when there is normal text preceding the item (as there
3667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % usually is), we do want to zero parskip, or there would be too much
3668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % space.  In that case, we won't have a \nobreak before.  At least
3669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % that's the theory.
3670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \ifnum\lastpenalty<10000 \parskip=0in \fi
3671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \noindent
3672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   %
3674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \vadjust{\penalty 1200}}% not good to break after first line of item.
3675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \flushcr
3676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \splitoff TOKENS\endmark defines \first to be the first token in
3679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% TOKENS, and \rest to be the remainder.
3680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Allow an optional argument of an uppercase letter, lowercase letter,
3684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% or number, to specify the first label in the enumerated list.  No
3685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% argument is the same as `1'.
3686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
3688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\enumeratey #1 #2\endenumeratey{%
3689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If we were given no argument, pretend we were given `1'.
3690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\thearg{#1}%
3691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\thearg\empty \def\thearg{1}\fi
3692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Detect if the argument is a single token.  If so, it might be a
3694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % letter.  Otherwise, the only valid thing it can be is a number.
3695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % (We will always have one token, because of the test we just made.
3696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % This is a good thing, since \splitoff doesn't work given nothing at
3697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % all -- the first parameter is undelimited.)
3698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\splitoff\thearg\endmark
3699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\rest\empty
3700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Only one token in the argument.  It could still be anything.
3701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % A ``lowercase letter'' is one whose \lccode is nonzero.
3702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %   not equal to itself.
3704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Otherwise, we assume it's a number.
3705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
3706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % We need the \relax at the end of the \ifnum lines to stop TeX from
3707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % continuing to look for a <number>.
3708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
3709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\lccode\expandafter`\thearg=0\relax
3710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \numericenumerate % a number (we hope)
3711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
3712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % It's a letter.
3713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \lowercaseenumerate % lowercase letter
3715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
3716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \uppercaseenumerate % uppercase letter
3717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
3718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
3719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
3720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Multiple tokens in the argument.  We hope it's a number.
3721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \numericenumerate
3722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% An @enumerate whose labels are integers.  The starting integer is
3726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% given in \thearg.
3727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numericenumerate{%
3729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \itemno = \thearg
3730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startenumeration{\the\itemno}%
3731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The starting (lowercase) letter is in \thearg.
3734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lowercaseenumerate{%
3735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \itemno = \expandafter`\thearg
3736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startenumeration{%
3737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Be sure we're not beyond the end of the alphabet.
3738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\itemno=0
3739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \errmessage{No more lowercase letters in @enumerate; get a bigger
3740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                  alphabet}%
3741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
3742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \char\lccode\itemno
3743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
3744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The starting (uppercase) letter is in \thearg.
3747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\uppercaseenumerate{%
3748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \itemno = \expandafter`\thearg
3749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startenumeration{%
3750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Be sure we're not beyond the end of the alphabet.
3751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\itemno=0
3752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \errmessage{No more uppercase letters in @enumerate; get a bigger
3753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                  alphabet}
3754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
3755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \char\uccode\itemno
3756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
3757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Call \doitemize, adding a period to the first argument and supplying the
3760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% common last two arguments.  Also subtract one from the initial value in
3761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \itemno, since @item increments \itemno.
3762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\startenumeration#1{%
3764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\itemno by -1
3765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \doitemize{#1.}\flushcr
3766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to @enumerate.
3770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\alphaenumerate{\enumerate{a}}
3772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\capsenumerate{\enumerate{A}}
3773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Ealphaenumerate{\Eenumerate}
3774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Ecapsenumerate{\Eenumerate}
3775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @multitable macros
3778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Amy Hendrickson, 8/18/94, 3/6/96
3779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @multitable ... @end multitable will make as many columns as desired.
3781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Contents of each column will wrap at width given in preamble.  Width
3782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% can be specified either with sample text given in a template line,
3783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% or in percent of \hsize, the current width of text on page.
3784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Table can continue over pages but will only break between lines.
3786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% To make preamble:
3788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Either define widths of columns in terms of percent of \hsize:
3790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @multitable @columnfractions .25 .3 .45
3791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @item ...
3792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   Numbers following @columnfractions are the percent of the total
3794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   current hsize to be used for each column. You may use as many
3795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   columns as desired.
3796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Or use a template:
3799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @item ...
3801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   using the widest term desired in each column.
3802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Each new table line starts with @item, each subsequent new column
3804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% starts with @tab. Empty columns may be produced by supplying @tab's
3805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% with nothing between them for as many times as empty columns are needed,
3806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ie, @tab@tab@tab will produce two empty columns.
3807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @item, @tab do not need to be on their own lines, but it will not hurt
3809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% if they are.
3810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Sample multitable:
3812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @item first col stuff @tab second col stuff @tab third col
3815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @item
3816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   first col stuff
3817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @tab
3818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   second col stuff
3819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @tab
3820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   third col
3821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @item first col stuff @tab second col stuff
3822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @tab Many paragraphs of text may be used in any column.
3823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%         They will wrap at the width determined by the template.
3825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @item@tab@tab This will be in third column.
3826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   @end multitable
3827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Default dimensions may be reset by user.
3829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @multitableparskip is vertical space between paragraphs in table.
3830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @multitableparindent is paragraph indent in table.
3831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @multitablecolmargin is horizontal space to be left between columns.
3832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @multitablelinespace is space to leave between table items, baseline
3833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%                                                            to baseline.
3834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   0pt means it depends on current normal line spacing.
3835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\multitableparskip
3837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\multitableparindent
3838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\multitablecolspace
3839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\multitablelinespace
3840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\multitableparskip=0pt
3841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\multitableparindent=6pt
3842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\multitablecolspace=12pt
3843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\multitablelinespace=0pt
3844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Macros used to set up halign preamble:
3846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\endsetuptable\relax
3848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xendsetuptable{\endsetuptable}
3849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\columnfractions\relax
3850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xcolumnfractions{\columnfractions}
3851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifsetpercent
3852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the @columnfraction, usually a decimal number like .5, but might
3854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% be just 1.  We just use it, whatever it is.
3855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pickupwholefraction#1 {%
3857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\colcount by 1
3858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setuptable
3860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\colcount
3863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setuptable#1{%
3864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\firstarg{#1}%
3865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\firstarg\xendsetuptable
3866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\go = \relax
3867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
3868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\firstarg\xcolumnfractions
3869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\setpercenttrue
3870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
3871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifsetpercent
3872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \let\go\pickupwholefraction
3873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
3874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \global\advance\colcount by 1
3875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                   % separator; typically that is always in the input, anyway.
3877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
3879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
3880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\go\pickupwholefraction
3881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Put the argument back for the \pickupwholefraction call, so
3882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % we'll always have a period there to be parsed.
3883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\go{\pickupwholefraction#1}%
3884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
3885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \let\go = \setuptable
3886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi%
3887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
3888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \go
3889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% multitable-only commands.
3892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @headitem starts a heading row, which we typeset in bold.
3894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Assignments have to be global since we are inside the implicit group
3895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% of an alignment entry.  \everycr resets \everytab so we don't have to
3896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% undo it ourselves.
3897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\headitemfont{\b}% for people to use in the template row; not changeable
3898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\headitem{%
3899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \checkenv\multitable
3900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \crcr
3901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\everytab={\bf}% can't use \headitemfont since the parsing differs
3902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \the\everytab % for the first item
3903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}%
3904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A \tab used to include \hskip1sp.  But then the space in a template
3906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% line is not enough.  That is bad.  So let's go back to just `&' until
3907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we again encounter the problem the 1sp was intended to solve.
3908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%					--karl, nathan@acm.org, 20apr99.
3909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tab{\checkenv\multitable &\the\everytab}%
3910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
3911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @multitable ... @end multitable definitions:
3912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\everytab  % insert after every tab.
3914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
3915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\multitable{%
3916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip\parskip
3917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startsavinginserts
3918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @item within a multitable starts a normal row.
3920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We use \def instead of \let so that if one of the multitable entries
3921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % contains an @itemize, we don't choke on the \item (seen as \crcr aka
3922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \endtemplate) expanding \doitemize.
3923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\item{\crcr}%
3924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tolerance=9500
3926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbadness=9500
3927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setmultitablespacing
3928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip=\multitableparskip
3929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent=\multitableparindent
3930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \overfullrule=0pt
3931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\colcount=0
3932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \everycr = {%
3934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \noalign{%
3935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\everytab={}%
3936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\colcount=0 % Reset the column counter.
3937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Check for saved footnotes, etc.
3938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \checkinserts
3939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Keeps underfull box messages off when table breaks over pages.
3940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %\filbreak
3941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	% Maybe so, but it also creates really weird page breaks when the
3942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	% table breaks over pages. Wouldn't \vfil be better?  Wait until the
3943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	% problem manifests itself, so it can be fixed for real --karl.
3944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
3945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
3946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parsearg\domultitable
3948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
3949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\domultitable#1{%
3950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % To parse everything between @multitable and @item:
3951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setuptable#1 \endsetuptable
3952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
3953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % This preamble sets up a generic column definition, which will
3954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % be used as many times as user calls for columns.
3955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \vtop will set a single line and will also let text wrap and
3956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % continue for many paragraphs if desired.
3957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \halign\bgroup &%
3958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\advance\colcount by 1
3959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \multistrut
3960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vtop{%
3961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Use the current \colcount to find the correct column width:
3962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \hsize=\expandafter\csname col\the\colcount\endcsname
3963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
3964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % In order to keep entries from bumping into each other
3965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % we will add a \leftskip of \multitablecolspace to all columns after
3966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % the first one.
3967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
3968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % If a template has been used, we will add \multitablecolspace
3969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % to the width of each template entry.
3970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
3971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % If the user has set preamble in terms of percent of \hsize we will
3972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % use that dimension as the width of the column, and the \leftskip
3973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % will keep entries from bumping into each other.  Table will start at
3974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % left margin and final column will justify at right margin.
3975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
3976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Make sure we don't inherit \rightskip from the outer environment.
3977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \rightskip=0pt
3978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifnum\colcount=1
3979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	% The first column will be indented with the surrounding text.
3980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\advance\hsize by\leftskip
3981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
3982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\ifsetpercent \else
3983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  % If user has not set preamble in terms of percent of \hsize
3984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  % we will advance \hsize by \multitablecolspace.
3985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \advance\hsize by \multitablecolspace
3986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\fi
3987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % In either case we will make \leftskip=\multitablecolspace:
3988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \leftskip=\multitablecolspace
3989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
3990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Ignoring space at the beginning and end avoids an occasional spurious
3991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % blank line, when TeX decides to break the line at the space before the
3992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % box from the multistrut, so the strut ends up on a line by itself.
3993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % For example:
3994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % @multitable @columnfractions .11 .89
3995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % @item @code{#}
3996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % @tab Legal holiday which is valid in major parts of the whole country.
3997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Is automatically provided with highlighting sequences respectively
3998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % marking characters.
3999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \noindent\ignorespaces##\unskip\multistrut
4000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }\cr
4001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Emultitable{%
4003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \crcr
4004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \egroup % end the \halign
4005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\setpercentfalse
4006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setmultitablespacing{%
4009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\multistrut{\strut}% just use the standard line spacing
4010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Compute \multitablelinespace (if not defined by user) for use in
4012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \multitableparskip calculation.  We used define \multistrut based on
4013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % this, but (ironically) that caused the spacing to be off.
4014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifdim\multitablelinespace=0pt
4016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\advance\multitablelinespace by-\ht0
4018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
4019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Test to see if parskip is larger than space between lines of
4020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% table. If not, do nothing.
4021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%        If so, set to same dimension as multitablelinespace.
4022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifdim\multitableparskip>\multitablelinespace
4023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\multitableparskip=\multitablelinespace
4024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                      % than skip between lines in the table.
4026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi%
4027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifdim\multitableparskip=0pt
4028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\multitableparskip=\multitablelinespace
4029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                      % than skip between lines in the table.
4031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi}
4032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{conditionals,}
4035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @ifnotxml always succeed.  They currently do nothing; we don't
4038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% attempt to check whether the conditionals are properly nested.  But we
4039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% have to remember that they are conditionals, so that @end doesn't
4040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% attempt to close an environment group.
4041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\makecond#1{%
4043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\csname #1\endcsname = \relax
4044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\csname iscond.#1\endcsname = 1
4045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{iftex}
4047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifnotdocbook}
4048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifnothtml}
4049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifnotinfo}
4050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifnotplaintext}
4051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifnotxml}
4052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Ignore @ignore, @ifhtml, @ifinfo, and the like.
4054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\direntry{\doignore{direntry}}
4056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\documentdescription{\doignore{documentdescription}}
4057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\docbook{\doignore{docbook}}
4058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\html{\doignore{html}}
4059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifdocbook{\doignore{ifdocbook}}
4060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifhtml{\doignore{ifhtml}}
4061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifinfo{\doignore{ifinfo}}
4062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifnottex{\doignore{ifnottex}}
4063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifplaintext{\doignore{ifplaintext}}
4064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifxml{\doignore{ifxml}}
4065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ignore{\doignore{ignore}}
4066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\menu{\doignore{menu}}
4067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xml{\doignore{xml}}
4068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Ignore text until a line `@end #1', keeping track of nested conditionals.
4070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A count to remember the depth of nesting.
4072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\doignorecount
4073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doignore#1{\begingroup
4075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Scan in ``verbatim'' mode:
4076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \obeylines
4077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\@ = \other
4078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\{ = \other
4079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\} = \other
4080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Make sure that spaces turn into tokens that match what \doignoretext wants.
4082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \spaceisspace
4083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Count number of #1's that we've seen.
4085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \doignorecount = 0
4086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Swallow text until we reach the matching `@end #1'.
4088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dodoignore{#1}%
4089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \obeylines %
4093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\dodoignore#1{%
4095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % #1 contains the command name as a string, e.g., `ifinfo'.
4096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Define a command to find the next `@end #1'.
4098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \long\def\doignoretext##1^^M@end #1{%
4099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \doignoretextyyy##1^^M@#1\_STOP_}%
4100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % And this command to find another #1 command, at the beginning of a
4102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % line.  (Otherwise, we would consider a line `@c @ifset', for
4103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % example, to count as an @ifset for nesting.)
4104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % And now expand that command.
4107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \doignoretext ^^M%
4108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
4109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doignoreyyy#1{%
4112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
4113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\empty			% Nothing found.
4114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next\doignoretextzzz
4115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else					% Found a nested condition, ...
4116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\doignorecount by 1
4117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next\doignoretextyyy		% ..., look for another.
4118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If we're here, #1 ends with ^^M\ifinfo (for example).
4119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next #1% the token \_STOP_ is present just after this macro.
4121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We have to swallow the remaining "\_STOP_".
4124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doignoretextzzz#1{%
4126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\doignorecount = 0	% We have just found the outermost @end.
4127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next\enddoignore
4128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else				% Still inside a nested condition.
4129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\doignorecount by -1
4130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next\doignoretext      % Look for the next @end.
4131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next
4133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Finish off ignored text.
4136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{ \obeylines%
4137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Ignore anything after the last `@end #1'; this matters in verbatim
4138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % environments, where otherwise the newline after an ignored conditional
4139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % would result in a blank line in the output.
4140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @set VAR sets the variable VAR to an empty value.
4145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Since we want to separate VAR from REST-OF-LINE (which might be
4148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% empty), we can't just use \parsearg; we have to insert a space of our
4149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% own to delimit the rest of the line, and then take it out again if we
4150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% didn't need it.
4151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We rely on the fact that \parsearg sets \catcode`\ =10.
4152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\set{\setyyy#1 \endsetyyy}
4154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setyyy#1 #2\endsetyyy{%
4155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
4156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makevalueexpandable
4157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\temp{#2}%
4158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\next{\gdef\makecsname{SET#1}}%
4159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\temp\empty
4160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \next{}%
4161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
4162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setzzz#2\endsetzzz
4163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
4164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
4165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Remove the trailing space \setxxx inserted.
4167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setzzz#1 \endsetzzz{\next{#1}}
4168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @clear VAR clears (i.e., unsets) the variable VAR.
4170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\clear{%
4172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
4173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makevalueexpandable
4174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\expandafter\let\csname SET#1\endcsname=\relax
4175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
4176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @value{foo} gets the text saved in variable foo.
4179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\value{\begingroup\makevalueexpandable\valuexxx}
4180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\valuexxx#1{\expandablevalue{#1}\endgroup}
4181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
4182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\- = \active \catcode`\_ = \active
4183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\makevalueexpandable{%
4185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\value = \expandablevalue
4186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % We don't want these characters active, ...
4187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\-=\other \catcode`\_=\other
4188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % ..., but we might end up with active ones in the argument if
4189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % we're called from @code, as @code{@value{foo-bar_}}, though.
4190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % So \let them to their normal equivalents.
4191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let-\normaldash \let_\normalunderscore
4192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
4193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We have this subroutine so that we can handle at least some @value's
4196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% properly in indexes (we call \makevalueexpandable in \indexdummies).
4197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The command has to be fully expandable (if the variable is set), since
4198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the result winds up in the index file.  This means that if the
4199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% variable's value contains other Texinfo commands, it's almost certain
4200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% it will fail (although perhaps we could fix that with sufficient work
4201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to do a one-level expansion on the result, instead of complete).
4202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\expandablevalue#1{%
4204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\ifx\csname SET#1\endcsname\relax
4205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {[No value for ``#1'']}%
4206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \message{Variable `#1', used in @value, is not set.}%
4207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
4208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \csname SET#1\endcsname
4209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% with @set.
4214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% To get special treatment of `@end ifset,' call \makeond and the redefine.
4216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifset}
4218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doifset#1#2{%
4220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
4221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makevalueexpandable
4222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next=\empty
4223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\ifx\csname SET#2\endcsname\relax
4224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      #1% If not set, redefine \next.
4225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
4226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter
4227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }\next
4228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifsetfail{\doignore{ifset}}
4230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @ifclear VAR ... @end executes the `...' iff VAR has never been
4232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% defined with @set, or has been undefined with @clear.
4233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The `\else' inside the `\doifset' parameter is a trick to reuse the
4235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% above code: if the variable is not set, do nothing, if it is set,
4236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% then redefine \next to \ifclearfail.
4237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifclear}
4239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifclearfail{\doignore{ifclear}}
4241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% without the @) is in fact defined.  We can only feasibly check at the
4244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% TeX level, so something like `mathcode' is going to considered
4245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% defined even though it is not a Texinfo command.
4246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
4247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifcommanddefined}
4248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doifcmddefined#1#2{{%
4251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makevalueexpandable
4252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next=\empty
4253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\ifx\csname #2\endcsname\relax
4254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      #1% If not defined, \let\next as above.
4255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
4256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter
4257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }\next
4258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makecond{ifcommandnotdefined}
4263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifcommandnotdefined{%
4264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set the `txicommandconditionals' variable, so documents have a way to
4268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% test if the @ifcommand...defined conditionals are available.
4269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\set txicommandconditionals
4270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @dircategory CATEGORY  -- specify a category of the dir file
4272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% which this file should belong to.  Ignore this in TeX.
4273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\dircategory=\comment
4274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @defininfoenclose.
4276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\definfoenclose=\comment
4277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{indexing,}
4280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Index generation facilities
4281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define \newwrite to be identical to plain tex's \newwrite
4283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% except not \outer, so it can be used within macros and \if's.
4284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\edef\newwrite{\makecsname{ptexnewwrite}}
4285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \newindex {foo} defines an index named foo.
4287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It automatically defines \fooindex such that
4288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \fooindex ...rest of line... puts an entry in the index foo.
4289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It also defines \fooindfile to be the number of the output channel for
4290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the file that accumulates this index.  The file's extension is foo.
4291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The name of an index should be no more than 2 characters long
4292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% for the sake of vms.
4293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\newindex#1{%
4295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \iflinks
4296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\newwrite \csname#1indfile\endcsname
4297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
4298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
4300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \noexpand\doindex{#1}}
4301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @defindex foo  ==  \newindex{foo}
4304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defindex{\parsearg\newindex}
4306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define @defcodeindex, like @defindex except put all entries in @code.
4308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defcodeindex{\parsearg\newcodeindex}
4310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\newcodeindex#1{%
4312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \iflinks
4313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\newwrite \csname#1indfile\endcsname
4314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \openout \csname#1indfile\endcsname \jobname.#1
4315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\xdef\csname#1index\endcsname{%
4317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \noexpand\docodeindex{#1}}%
4318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @synindex foo bar    makes index foo feed into index bar.
4322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Do this instead of @defindex foo if you don't want it as a separate index.
4323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @syncodeindex foo bar   similar, but put all entries made for index foo
4325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% inside @code.
4326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #3 the target index (bar).
4332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dosynindex#1#2#3{%
4333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Only do \closeout if we haven't already done it, else we'll end up
4334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % closing the target index.
4335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter \ifx\csname donesynindex#2\endcsname \relax
4336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % The \closeout helps reduce unnecessary open files; the limit on the
4337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Acorn RISC OS is a mere 16 files.
4338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\closeout\csname#2indfile\endcsname
4339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname donesynindex#2\endcsname = 1
4340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % redefine \fooindfile:
4342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\csname#2indfile\endcsname=\temp
4344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % redefine \fooindex:
4345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define \doindex, the driver for all \fooindex macros.
4349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Argument #1 is generated by the calling \fooindex macro,
4350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  and it is "foo", the name of the index.
4351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \doindex just uses \parsearg; it calls \doind for the actual work.
4353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is because \doind is more useful to call from other macros.
4354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% There is also \dosubind {index}{topic}{subtopic}
4356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% which makes an entry in a two-level index such as the operation index.
4357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
4359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\singleindexer #1{\doind{\indexname}{#1}}
4360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% like the previous two, but they put @code around the argument.
4362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
4363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
4364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Take care of Texinfo commands that can appear in an index entry.
4366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Since there are some commands we want to expand, and others we don't,
4367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we have to laboriously prevent expansion for those that we don't.
4368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\indexdummies{%
4370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \escapechar = `\\     % use backslash in output files.
4371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\ {\realbackslash\space }%
4373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Need these unexpandable (because we define \tt as a dummy)
4375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % definitions when @{ or @} appear in index entry text.  Also, more
4376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % complicated, when \tex is in effect and \{ is a \delimiter again.
4377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We can't use \lbracecmd and \rbracecmd because texindex assumes
4378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % braces and backslashes are used only as delimiters.  Perhaps we
4379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % should define @lbrace and @rbrace commands a la @comma.
4380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\{{{\tt\char123}}%
4381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\}{{\tt\char125}}%
4382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % I don't entirely understand this, but when an index entry is
4384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % generated from a macro call, the \endinput which \scanmacro inserts
4385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % causes processing to be prematurely terminated.  This is,
4386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % apparently, because \indexsorttmp is fully expanded, and \endinput
4387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % is an expandable command.  The redefinition below makes \endinput
4388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % disappear altogether for that purpose -- although logging shows that
4389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % processing continues to some further point.  On the other hand, it
4390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % seems \endinput does not hurt in the printed index arg, since that
4391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % is still getting written without apparent harm.
4392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Sample source (mac-idx3.tex, reported by Graham Percival to
4394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % help-texinfo, 22may06):
4395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @macro funindex {WORD}
4396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @findex xyz
4397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @end macro
4398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % ...
4399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @funindex commtest
4400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The above is not enough to reproduce the bug, but it gives the flavor.
4402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Sample whatsit resulting:
4404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
4405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % So:
4407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\endinput = \empty
4408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Do the redefinitions.
4410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \commondummies
4411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For the aux and toc files, @ is the escape character.  So we want to
4414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% redefine everything using @ as the escape character (instead of
4415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \realbackslash, still used for index files).  When everything uses @,
4416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% this will be simpler.
4417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\atdummies{%
4419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\@{@@}%
4420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\ {@ }%
4421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\{ = \lbraceatcmd
4422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\} = \rbraceatcmd
4423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Do the redefinitions.
4425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \commondummies
4426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \otherbackslash
4427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Called from \indexdummies and \atdummies.
4430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\commondummies{%
4432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \definedummyword defines \#1 as \string\#1\space, thus effectively
4434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % preventing its expansion.  This is used only for control words,
4435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % not control letters, because the \space would be incorrect for
4436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % control characters, but is needed to separate the control word
4437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % from whatever follows.
4438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % For control letters, we have \definedummyletter, which omits the
4440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % space.
4441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % These can be used both for control words that take an argument and
4443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % those that do not.  If it is followed by {arg} in the input, then
4444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % that will dutifully get written to the index (or wherever).
4445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\definedummyword  ##1{\def##1{\string##1\space}}%
4447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\definedummyletter##1{\def##1{\string##1}}%
4448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\definedummyaccent\definedummyletter
4449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \commondummiesnofonts
4451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyletter\_%
4453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyletter\-%
4454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Non-English letters.
4456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\AA
4457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\AE
4458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\DH
4459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\L
4460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\O
4461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\OE
4462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\TH
4463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\aa
4464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ae
4465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\dh
4466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\exclamdown
4467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\l
4468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\o
4469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\oe
4470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ordf
4471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ordm
4472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\questiondown
4473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ss
4474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\th
4475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Although these internal commands shouldn't show up, sometimes they do.
4477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\bf
4478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\gtr
4479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\hat
4480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\less
4481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\sf
4482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\sl
4483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\tclose
4484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\tt
4485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\LaTeX
4487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\TeX
4488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Assorted special characters.
4490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\arrow
4491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\bullet
4492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\comma
4493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\copyright
4494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\registeredsymbol
4495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\dots
4496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\enddots
4497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\entrybreak
4498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\equiv
4499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\error
4500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\euro
4501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\expansion
4502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\geq
4503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\guillemetleft
4504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\guillemetright
4505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\guilsinglleft
4506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\guilsinglright
4507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\lbracechar
4508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\leq
4509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\minus
4510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ogonek
4511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\pounds
4512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\point
4513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\print
4514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\quotedblbase
4515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\quotedblleft
4516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\quotedblright
4517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\quoteleft
4518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\quoteright
4519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\quotesinglbase
4520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\rbracechar
4521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\result
4522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\textdegree
4523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We want to disable all macros so that they are not expanded by \write.
4525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \macrolist
4526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \normalturnoffactive
4528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Handle some cases of @value -- where it does not contain any
4530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % (non-fully-expandable) commands.
4531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \makevalueexpandable
4532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \commondummiesnofonts: common to \commondummies and \indexnofonts.
4535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\commondummiesnofonts{%
4537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Control letters and accents.
4538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyletter\!%
4539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyaccent\"%
4540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyaccent\'%
4541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyletter\*%
4542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyaccent\,%
4543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyletter\.%
4544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyletter\/%
4545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyletter\:%
4546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyaccent\=%
4547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyletter\?%
4548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyaccent\^%
4549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyaccent\`%
4550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyaccent\~%
4551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\u
4552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\v
4553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\H
4554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\dotaccent
4555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ogonek
4556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ringaccent
4557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\tieaccent
4558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ubaraccent
4559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\udotaccent
4560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\dotless
4561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Texinfo font commands.
4563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\b
4564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\i
4565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\r
4566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\sansserif
4567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\sc
4568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\slanted
4569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\t
4570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Commands that take arguments.
4572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\abbr
4573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\acronym
4574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\anchor
4575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\cite
4576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\code
4577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\command
4578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\dfn
4579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\dmn
4580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\email
4581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\emph
4582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\env
4583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\file
4584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\image
4585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\indicateurl
4586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\inforef
4587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\kbd
4588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\key
4589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\math
4590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\option
4591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\pxref
4592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\ref
4593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\samp
4594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\strong
4595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\tie
4596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\uref
4597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\url
4598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\var
4599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\verb
4600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\w
4601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \definedummyword\xref
4602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \indexnofonts is used when outputting the strings to sort the index
4605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% by, and when constructing control sequence names.  It eliminates all
4606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% control sequences and just writes whatever the best ASCII sort string
4607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% would be for a given command (usually its argument).
4608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\indexnofonts{%
4610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Accent commands should become @asis.
4611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\definedummyaccent##1{\let##1\asis}%
4612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We can just ignore other control letters.
4613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\definedummyletter##1{\let##1\empty}%
4614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % All control words become @asis by default; overrides below.
4615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\definedummyword\definedummyaccent
4616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \commondummiesnofonts
4618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Don't no-op \tt, since it isn't a user-level command
4620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % and is used in the definitions of the active chars like <, >, |, etc.
4621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Likewise with the other plain tex font commands.
4622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %\let\tt=\asis
4623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\ { }%
4625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\@{@}%
4626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\_{\normalunderscore}%
4627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\-{}% @- shouldn't affect sorting
4628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Unfortunately, texindex is not prepared to handle braces in the
4630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % content at all.  So for index sorting, we map @{ and @} to strings
4631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % starting with |, since that ASCII character is between ASCII { and }.
4632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\{{|a}%
4633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lbracechar{|a}%
4634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\}{|b}%
4636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\rbracechar{|b}%
4637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Non-English letters.
4639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\AA{AA}%
4640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\AE{AE}%
4641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\DH{DZZ}%
4642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\L{L}%
4643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\OE{OE}%
4644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\O{O}%
4645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\TH{ZZZ}%
4646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\aa{aa}%
4647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\ae{ae}%
4648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\dh{dzz}%
4649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\exclamdown{!}%
4650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\l{l}%
4651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\oe{oe}%
4652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\ordf{a}%
4653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\ordm{o}%
4654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\o{o}%
4655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\questiondown{?}%
4656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\ss{ss}%
4657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\th{zzz}%
4658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\LaTeX{LaTeX}%
4660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\TeX{TeX}%
4661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Assorted special characters.
4663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % (The following {} will end up in the sort string, but that's ok.)
4664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\arrow{->}%
4665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\bullet{bullet}%
4666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\comma{,}%
4667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\copyright{copyright}%
4668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\dots{...}%
4669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\enddots{...}%
4670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\equiv{==}%
4671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\error{error}%
4672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\euro{euro}%
4673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\expansion{==>}%
4674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\geq{>=}%
4675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\guillemetleft{<<}%
4676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\guillemetright{>>}%
4677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\guilsinglleft{<}%
4678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\guilsinglright{>}%
4679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\leq{<=}%
4680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\minus{-}%
4681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\point{.}%
4682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\pounds{pounds}%
4683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\print{-|}%
4684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\quotedblbase{"}%
4685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\quotedblleft{"}%
4686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\quotedblright{"}%
4687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\quoteleft{`}%
4688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\quoteright{'}%
4689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\quotesinglbase{,}%
4690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\registeredsymbol{R}%
4691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\result{=>}%
4692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\textdegree{o}%
4693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
4695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \indexlquoteignore \fi
4696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We need to get rid of all macros, leaving only the arguments (if present).
4698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Of course this is not nearly correct, but it is the best we can do for now.
4699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % makeinfo does not expand macros in the argument to @deffn, which ends up
4700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % writing an index entry, and texindex isn't prepared for an index sort entry
4701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % that starts with \.
4702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Since macro invocations are followed by braces, we can just redefine them
4704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % to take a single TeX argument.  The case of a macro invocation that
4705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % goes to end-of-line is not handled.
4706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \macrolist
4708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
4711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ignore left quotes in the sort term.
4712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`\`=\active
4713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique \gdef\indexlquoteignore{\let`=\empty}}
4714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\indexbackslash=0  %overridden during \printindex.
4716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Most index entries go through here, but \dosubind is the general case.
4719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the index name, #2 is the entry text.
4720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doind#1#2{\dosubind{#1}{#2}{}}
4721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Workhorse for all \fooindexes.
4723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is name of index, #2 is stuff to put there, #3 is subentry --
4724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% empty if called from \doind, as we usually are (the main exception
4725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% is with most defuns, which call us directly).
4726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dosubind#1#2#3{%
4728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \iflinks
4729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
4730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Store the main index entry text (including the third arg).
4731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \toks0 = {#2}%
4732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If third arg is present, precede it with a space.
4733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\thirdarg{#3}%
4734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\thirdarg\empty \else
4735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \toks0 = \expandafter{\the\toks0 \space #3}%
4736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
4737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\writeto{\csname#1indfile\endcsname}%
4739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \safewhatsit\dosubindwrite
4741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
4742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Write the entry in \toks0 to the index file:
4746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dosubindwrite{%
4748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Put the index entry in the margin if desired.
4749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\SETmarginindex\relax\else
4750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
4751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Remember, we are within a group.
4754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \indexdummies % Must do this here, since \bf, etc expand at this stage
4755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
4756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % so it will be output as is; and it will print as backslash.
4757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Process the index entry with all font commands turned off, to
4759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % get the string to sort by.
4760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\indexnofonts
4761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \edef\temp{\the\toks0}% need full expansion
4762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \xdef\indexsorttmp{\temp}%
4763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
4764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Set up the complete index entry, with both the sort key and
4766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the original text, including any font commands.  We write
4767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % three arguments to \entry to the .?? file (four in the
4768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % subentry case), texindex reduces to two when writing the .??s
4769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % sorted result.
4770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\temp{%
4771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \write\writeto{%
4772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
4773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
4774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \temp
4775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
4776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Take care of unwanted page breaks/skips around a whatsit:
4778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If a skip is the last thing on the list now, preserve it
4780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% by backing up by \lastskip, doing the \write, then inserting
4781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the skip again.  Otherwise, the whatsit generated by the
4782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \write or \pdfdest will make \lastskip zero.  The result is that
4783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% sequences like this:
4784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @end defun
4785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @tindex whatever
4786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @defun ...
4787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% will have extra space inserted, because the \medbreak in the
4788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% start of the @defun won't see the skip inserted by the @end of
4789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the previous defun.
4790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But don't do any of this if we're not in vertical mode.  We
4792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% don't want to do a \vskip and prematurely end a paragraph.
4793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Avoid page breaks due to these extra skips, too.
4795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But wait, there is a catch there:
4797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We'll have to check whether \lastskip is zero skip.  \ifdim is not
4798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% sufficient for this purpose, as it ignores stretch and shrink parts
4799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% of the skip.  The only way seems to be to check the textual
4800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% representation of the skip.
4801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The following is almost like \def\zeroskipmacro{0.0pt} except that
4803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
4804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
4806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\whatsitskip
4808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\whatsitpenalty
4809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ..., ready, GO:
4811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\safewhatsit#1{\ifhmode
4813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  #1%
4814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique \else
4815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
4816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \whatsitskip = \lastskip
4817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\lastskipmacro{\the\lastskip}%
4818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \whatsitpenalty = \lastpenalty
4819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If \lastskip is nonzero, that means the last item was a
4821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % skip.  And since a skip is discardable, that means this
4822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % -\whatsitskip glue we're inserting is preceded by a
4823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % non-discardable item, therefore it is not a potential
4824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % breakpoint, therefore no \nobreak needed.
4825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\lastskipmacro\zeroskipmacro
4826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
4827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vskip-\whatsitskip
4828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  #1%
4831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\lastskipmacro\zeroskipmacro
4833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If \lastskip was zero, perhaps the last item was a penalty, and
4834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
4835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % to re-insert the same penalty (values >10000 are used for various
4836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % signals); since we just inserted a non-discardable item, any
4837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % following glue (such as a \parskip) would be a breakpoint.  For example:
4838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %   @deffn deffn-whatever
4839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %   @vindex index-whatever
4840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %   Description.
4841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % would allow a break between the index-whatever whatsit
4842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % and the "Description." paragraph.
4843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
4844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
4845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % On the other hand, if we had a nonzero \lastskip,
4846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % this make-up glue would be preceded by a non-discardable item
4847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % (the whatsit from the \write), so we must insert a \nobreak.
4848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak\vskip\whatsitskip
4849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi}
4851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The index entry written in the file actually looks like
4853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  \entry {sortstring}{page}{topic}
4854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% or
4855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  \entry {sortstring}{page}{topic}{subtopic}
4856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The texindex program reads in these files and writes files
4857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% containing these kinds of lines:
4858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  \initial {c}
4859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%     before the first topic whose initial is c
4860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  \entry {topic}{pagelist}
4861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%     for a topic that is used without subtopics
4862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  \primary {topic}
4863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%     for the beginning of a topic that is used with subtopics
4864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  \secondary {subtopic}{pagelist}
4865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%     for each subtopic.
4866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define the user-accessible indexing commands
4868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @findex, @vindex, @kindex, @cindex.
4869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\findex {\fnindex}
4871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\kindex {\kyindex}
4872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\cindex {\cpindex}
4873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\vindex {\vrindex}
4874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tindex {\tpindex}
4875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pindex {\pgindex}
4876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\cindexsub {\begingroup\obeylines\cindexsub}
4878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\obeylines %
4879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\cindexsub "#1" #2^^M{\endgroup %
4880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\dosubind{cp}{#2}{#1}}}
4881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define the macros used in formatting output of the sorted index material.
4883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @printindex causes a particular index (the ??s file) to get printed.
4885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It does not print any chapter heading (usually an @unnumbered).
4886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\printindex{\begingroup
4888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dobreak \chapheadingskip{10000}%
4889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \smallfonts \rm
4891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tolerance = 9500
4892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \plainfrenchspacing
4893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \everypar = {}% don't want the \kern\-parindent from indentation suppression.
4894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % See if the index file exists and is nonempty.
4896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Change catcode of @ here so that if the index file contains
4897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \initial {@}
4898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % as its first line, TeX doesn't complain about mismatched braces
4899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % (because it thinks @} is a control sequence).
4900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\@ = 11
4901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \openin 1 \jobname.#1s
4902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifeof 1
4903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \enddoublecolumns gets confused if there is no text in the index,
4904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % and it loses the chapter title and the aux file entries for the
4905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % index.  The easiest way to prevent this problem is to make sure
4906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % there is some text.
4907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \putwordIndexNonexistent
4908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
4909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If the index file exists but is empty, then \openin leaves \ifeof
4911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % false.  We have to make TeX try to read something from the file, so
4912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % it can discover if there is anything in it.
4913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \read 1 to \temp
4914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifeof 1
4915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \putwordIndexIsEmpty
4916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
4917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Index files are almost Texinfo source, but we use \ as the escape
4918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % character.  It would be better to use @, but that's too big a change
4919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % to make right now.
4920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\indexbackslash{\backslashcurfont}%
4921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \catcode`\\ = 0
4922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \escapechar = `\\
4923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \begindoublecolumns
4924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \input \jobname.#1s
4925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \enddoublecolumns
4926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
4927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
4928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \closein 1
4929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
4930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% These macros are used by the sorted index file itself.
4932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Change them to control the appearance of the index.
4933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\initial#1{{%
4935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Some minor font changes for the special characters.
4936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
4937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Remove any glue we may have, we'll be inserting our own.
4939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \removelastskip
4940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We like breaks before the index initials, so insert a bonus.
4942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak
4943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip 0pt plus 3\baselineskip
4944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \penalty 0
4945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip 0pt plus -3\baselineskip
4946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Typeset the initial.  Making this add up to a whole number of
4948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % baselineskips increases the chance of the dots lining up from column
4949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % to column.  It still won't often be perfect, because of the stretch
4950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % we need before each entry, but it's better.
4951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
4952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % No shrink because it confuses \balancecolumns.
4953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip 1.67\baselineskip plus .5\baselineskip
4954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \leftline{\secbf #1}%
4955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Do our best not to break after the initial.
4956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak
4957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip .33\baselineskip plus .1\baselineskip
4958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
4959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
4960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
4961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% then page number (#2) flushed to the right margin.  It is used for index
4962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and table of contents entries.  The paragraph is indented by \leftskip.
4963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
4964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A straightforward implementation would start like this:
4965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%	\def\entry#1#2{...
4966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But this freezes the catcodes in the argument, and can cause problems to
4967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @code, which sets - active.  This problem was fixed by a kludge---
4968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ``-'' was active throughout whole index, but this isn't really right.
4969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The right solution is to prevent \entry from swallowing the whole text.
4970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%                                 --kasal, 21nov03
4971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\entry{%
4972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
4973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Start a new paragraph if necessary, so our assignments below can't
4975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % affect previous text.
4976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \par
4977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Do not fill out the last line with white space.
4979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \parfillskip = 0in
4980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % No extra space above this paragraph.
4982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \parskip = 0in
4983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Do not prefer a separate line ending with a hyphen to fewer lines.
4985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \finalhyphendemerits = 0
4986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \hangindent is only relevant when the entry text and page number
4988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % don't both fit on one line.  In that case, bob suggests starting the
4989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % dots pretty far over on the line.  Unfortunately, a large
4990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % indentation looks wrong when the entry text itself is broken across
4991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % lines.  So we use a small indentation and put up with long leaders.
4992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \hangafter is reset to 1 (which is the value we want) at the start
4994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % of each paragraph, so we need not do anything with that.
4995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \hangindent = 2em
4996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
4997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % When the entry text needs to be broken, just fill out the first line
4998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % with blank space.
4999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \rightskip = 0pt plus1fil
5000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % A bit of stretch before each entry for the benefit of balancing
5002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % columns.
5003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vskip 0pt plus1pt
5004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % When reading the text of entry, convert explicit line breaks
5006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % from @* into spaces.  The user might give these in long section
5007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % titles, for instance.
5008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\*{\unskip\space\ignorespaces}%
5009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\entrybreak{\hfil\break}%
5010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Swallow the left brace of the text (first parameter):
5012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \afterassignment\doentry
5013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\temp =
5014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\entrybreak{\unskip\space\ignorespaces}%
5016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doentry{%
5017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \bgroup % Instead of the swallowed brace.
5018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \noindent
5019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \aftergroup\finishentry
5020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % And now comes the text of the entry.
5021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\finishentry#1{%
5023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % #1 is the page number.
5024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % The following is kludged to not output a line of dots in the index if
5026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % there are no page numbers.  The next person who breaks this will be
5027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % cursed by a Unix daemon.
5028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setbox\boxA = \hbox{#1}%
5029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim\wd\boxA = 0pt
5030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ %
5031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
5032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
5033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % If we must, put the page number on a line of its own, and fill out
5034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % this line with blank space.  (The \hfil is overwhelmed with the
5035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % fill leaders glue in \indexdotfill if the page number does fit.)
5036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \hfil\penalty50
5037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \null\nobreak\indexdotfill % Have leaders before the page number.
5038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
5039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % The `\ ' here is removed by the implicit \unskip that TeX does as
5040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % part of (the primitive) \par.  Without it, a spurious underfull
5041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % \hbox ensues.
5042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifpdf
5043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\pdfgettoks#1.%
5044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\ \the\toksA
5045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
5046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\ #1%
5047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
5048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \par
5050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
5051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Like plain.tex's \dotfill, except uses up at least 1 em.
5054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\indexdotfill{\cleaders
5055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
5056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\primary #1{\line{#1\hfil}}
5058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\secondaryindent \secondaryindent=0.5cm
5060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\secondary#1#2{{%
5061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parfillskip=0in
5062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip=0in
5063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hangindent=1in
5064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hangafter=1
5065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifpdf
5067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
5069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    #2
5070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
5071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \par
5072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
5073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define two-column mode, which we use to typeset indexes.
5075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Adapted from the TeXbook, page 416, which is to say,
5076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the manmac.tex format used to print the TeXbook itself.
5077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\@=11
5078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\partialpage
5080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\doublecolumnhsize
5081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Grab any single-column material above us.
5084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \output = {%
5085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Here is a possibility not foreseen in manmac: if we accumulate a
5087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % whole lot of material, we might end up calling this \output
5088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % routine twice in a row (see the doublecol-lose test, which is
5089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % essentially a couple of indexes with @setchapternewpage off).  In
5090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % that case we just ship out what is in \partialpage with the normal
5091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % output routine.  Generally, \partialpage will be empty when this
5092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % runs and this will be a no-op.  See the indexspread.tex test case.
5093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifvoid\partialpage \else
5094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \onepageout{\pagecontents\partialpage}%
5095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\setbox\partialpage = \vbox{%
5098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Unvbox the main output page.
5099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \unvbox\PAGE
5100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \kern-\topskip \kern\baselineskip
5101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
5102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
5103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \eject % run that output routine to set \partialpage
5104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Use the double-column output routine for subsequent pages.
5106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \output = {\doublecolumnout}%
5107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Change the page size parameters.  We could do this once outside this
5109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % format, but then we repeat the same computation.  Repeating a couple
5111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % of assignments once per index is clearly meaningless for the
5112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % execution time, so we may as well do it in one place.
5113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % First we halve the line length, less a little for the gutter between
5115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the columns.  We compute the gutter based on the line length, so it
5116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % changes automatically with the paper format.  The magic constant
5117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % below is chosen so that the gutter has the same value (well, +-<1pt)
5118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % as it did when we hard-coded it.
5119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We put the result in a separate register, \doublecolumhsize, so we
5121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % can restore it in \pagesofar, after \hsize itself has (potentially)
5122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % been clobbered.
5123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \doublecolumnhsize = \hsize
5125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\doublecolumnhsize by -.04154\hsize
5126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \divide\doublecolumnhsize by 2
5127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hsize = \doublecolumnhsize
5128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Double the \vsize as well.  (We don't need a separate register here,
5130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % since nobody clobbers \vsize.)
5131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vsize = 2\vsize
5132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The double-column output routine for all double-column pages except
5135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the last.
5136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doublecolumnout{%
5138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \splittopskip=\topskip \splitmaxdepth=\maxdepth
5139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Get the available space for the double columns -- the normal
5140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % (undoubled) page height minus any material left over from the
5141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % previous page.
5142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen@ = \vsize
5143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \divide\dimen@ by 2
5144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\dimen@ by -\ht\partialpage
5145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % box0 will be the left-hand column, box2 the right.
5147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
5148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \onepageout\pagesofar
5149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \unvbox255
5150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \penalty\outputpenalty
5151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Re-output the contents of the output page -- any previous material,
5154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% followed by the two boxes we just split, in box0 and box2.
5155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pagesofar{%
5156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \unvbox\partialpage
5157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hsize = \doublecolumnhsize
5159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \wd0=\hsize \wd2=\hsize
5160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbox to\pagewidth{\box0\hfil\box2}%
5161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% All done with double columns.
5164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\enddoublecolumns{%
5165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The following penalty ensures that the page builder is exercised
5166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % _before_ we change the output routine.  This is necessary in the
5167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % following situation:
5168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The last section of the index consists only of a single entry.
5170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Before this section, \pagetotal is less than \pagegoal, so no
5171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % break occurs before the last section starts.  However, the last
5172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % section, consisting of \initial and the single \entry, does not
5173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % fit on the page and has to be broken off.  Without the following
5174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % penalty the page builder will not be exercised until \eject
5175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % below, and by that time we'll already have changed the output
5176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % routine to the \balancecolumns version, so the next-to-last
5177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % double-column page will be processed with \balancecolumns, which
5178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % is wrong:  The two columns will go to the main vertical list, with
5179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the broken-off section in the recent contributions.  As soon as
5180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the output routine finishes, TeX starts reconsidering the page
5181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % break.  The two columns and the broken-off section both fit on the
5182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % page, because the two columns now take up only half of the page
5183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % goal.  When TeX sees \eject from below which follows the final
5184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % section, it invokes the new output routine that we've set after
5185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \balancecolumns below; \onepageout will try to fit the two columns
5186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % and the final section into the vbox of \pageheight (see
5187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \pagebody), causing an overfull box.
5188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Note that glue won't work here, because glue does not exercise the
5190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \penalty0
5192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \output = {%
5194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Split the last of the double-column material.  Leave it on the
5195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % current page, no automatic page break.
5196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \balancecolumns
5197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If we end up splitting too much material for the current page,
5199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % though, there will be another page break right after this \output
5200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % invocation ends.  Having called \balancecolumns once, we do not
5201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % want to call it again.  Therefore, reset \output to its normal
5202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % definition right away.  (We hope \balancecolumns will never be
5203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % called on to balance too much material, but if it is, this makes
5204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % the output somewhat more palatable.)
5205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\output = {\onepageout{\pagecontents\PAGE}}%
5206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
5207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \eject
5208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup % started in \begindoublecolumns
5209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \pagegoal was set to the doubled \vsize above, since we restarted
5211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the current page.  We're now back to normal single-column
5212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % typesetting, so reset \pagegoal to the normal \vsize (after the
5213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \endgroup where \vsize got restored).
5214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pagegoal = \vsize
5215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Called at the end of the double column material.
5218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\balancecolumns{%
5219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
5220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen@ = \ht0
5221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\dimen@ by \topskip
5222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\dimen@ by-\baselineskip
5223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \divide\dimen@ by 2 % target to split to
5224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
5225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \splittopskip = \topskip
5226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Loop until we get a decent breakpoint.
5227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
5228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vbadness = 10000
5229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \loop
5230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\setbox3 = \copy0
5231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\setbox1 = \vsplit3 to \dimen@
5232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim\ht3>\dimen@
5233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\advance\dimen@ by 1pt
5234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \repeat
5235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
5236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
5237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0=\vbox to\dimen@{\unvbox1}%
5238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox2=\vbox to\dimen@{\unvbox3}%
5239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pagesofar
5241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\@ = \other
5243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{sectioning,}
5246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Chapters, sections, etc.
5247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Let's start with @part.
5249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\part{\partzzz{#1}}
5250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\partzzz#1{%
5251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \chapoddpage
5252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \null
5253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip.3\vsize  % move it down on the page a bit
5254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
5255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \noindent \titlefonts\rmisbold #1\par % the text
5256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\lastnode=\empty      % no node to associate with
5257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \writetocentry{part}{#1}{}% but put it in the toc
5258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \headingsoff              % no headline or footline on the part page
5259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \chapoddpage
5260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
5261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \unnumberedno is an oxymoron.  But we count the unnumbered
5264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% sections so that we can refer to them unambiguously in the pdf
5265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% outlines by their "section number".  We avoid collisions with chapter
5266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% numbers by starting them at 10000.  (If a document ever has 10000
5267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% chapters, we're in trouble anyway, I'm sure.)
5268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\unnumberedno \unnumberedno = 10000
5269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\chapno
5270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\secno        \secno=0
5271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\subsecno     \subsecno=0
5272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\subsubsecno  \subsubsecno=0
5273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This counter is funny since it counts through charcodes of letters A, B, ...
5275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\appendixno  \appendixno = `\@
5276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \def\appendixletter{\char\the\appendixno}
5278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We do the following ugly conditional instead of the above simple
5279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% construct for the sake of pdftex, which needs the actual
5280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% letter in the expansion, not just typeset.
5281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\appendixletter{%
5283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\appendixno=`A A%
5284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`B B%
5285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`C C%
5286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`D D%
5287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`E E%
5288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`F F%
5289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`G G%
5290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`H H%
5291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`I I%
5292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`J J%
5293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`K K%
5294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`L L%
5295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`M M%
5296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`N N%
5297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`O O%
5298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`P P%
5299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`Q Q%
5300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`R R%
5301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`S S%
5302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`T T%
5303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`U U%
5304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`V V%
5305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`W W%
5306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`X X%
5307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`Y Y%
5308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifnum\appendixno=`Z Z%
5309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The \the is necessary, despite appearances, because \appendixletter is
5310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % expanded while writing the .toc file.  \char\appendixno is not
5311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % expandable, thus it is written literally, thus all appendixes come out
5312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % with the same letter (or @) in the toc without it.
5313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\char\the\appendixno
5314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
5315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
5316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Each @chapter defines these (using marks) as the number+name, number
5318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and name of the chapter.  Page headings and footings can use
5319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% these.  @section does likewise.
5320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\thischapter{}
5321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\thischapternum{}
5322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\thischaptername{}
5323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\thissection{}
5324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\thissectionnum{}
5325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\thissectionname{}
5326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\absseclevel % used to calculate proper heading level
5328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
5329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @raisesections: treat @section as chapter, @subsection as section, etc.
5331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\raisesections{\global\advance\secbase by -1}
5332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\up=\raisesections % original BFox name
5333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @lowersections: treat @chapter as section, @section as subsection, etc.
5335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lowersections{\global\advance\secbase by 1}
5336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\down=\lowersections % original BFox name
5337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we only have subsub.
5339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\maxseclevel = 3
5340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A numbered section within an unnumbered changes to unnumbered too.
5342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% To achieve this, remember the "biggest" unnum. sec. we are currently in:
5343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\unnlevel = \maxseclevel
5344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Trace whether the current chapter is an appendix or not:
5346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
5347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapheadtype{N}
5348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Choose a heading macro
5350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is heading type
5351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #2 is heading level
5352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #3 is text for heading
5353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\genhead#1#2#3{%
5354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Compute the abs. sec. level:
5355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \absseclevel=#2
5356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\absseclevel by \secbase
5357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Make sure \absseclevel doesn't fall outside the range:
5358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum \absseclevel < 0
5359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \absseclevel = 0
5360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
5361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum \absseclevel > 3
5362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \absseclevel = 3
5363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
5365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The heading type:
5366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\headtype{#1}%
5367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \if \headtype U%
5368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum \absseclevel < \unnlevel
5369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \chardef\unnlevel = \absseclevel
5370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
5372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Check for appendix sections:
5373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum \absseclevel = 0
5374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \edef\chapheadtype{\headtype}%
5375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
5376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \if \headtype A\if \chapheadtype N%
5377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\errmessage{@appendix... within a non-appendix chapter}%
5378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi\fi
5379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Check for numbered within unnumbered:
5381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum \absseclevel > \unnlevel
5382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\headtype{U}%
5383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
5384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \chardef\unnlevel = 3
5385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
5387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Now print the heading:
5388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \if \headtype U%
5389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifcase\absseclevel
5390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\unnumberedzzz{#3}%
5391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \or \unnumberedseczzz{#3}%
5392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \or \unnumberedsubseczzz{#3}%
5393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \or \unnumberedsubsubseczzz{#3}%
5394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
5396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \if \headtype A%
5397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifcase\absseclevel
5398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \appendixzzz{#3}%
5399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \or \appendixsectionzzz{#3}%
5400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \or \appendixsubseczzz{#3}%
5401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \or \appendixsubsubseczzz{#3}%
5402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
5403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
5404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifcase\absseclevel
5405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \chapterzzz{#3}%
5406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \or \seczzz{#3}%
5407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \or \numberedsubseczzz{#3}%
5408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \or \numberedsubsubseczzz{#3}%
5409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
5410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
5412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \suppressfirstparagraphindent
5413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% an interface:
5416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numhead{\genhead N}
5417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\apphead{\genhead A}
5418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnmhead{\genhead U}
5419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
5421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% all lower-level sectioning counters to zero.
5422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Also set \chaplevelprefix, which we prepend to @float sequence numbers
5424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (e.g., figures), q.v.  By default (before any chapter), that is empty.
5425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\chaplevelprefix = \empty
5426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
5428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapterzzz#1{%
5429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % section resetting is \global in case the chapter is in a group, such
5430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % as an @include file.
5431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\advance\chapno by 1
5433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Used for \float.
5435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\chaplevelprefix{\the\chapno.}%
5436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetallfloatnos
5437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \putwordChapter can contain complex things in translations.
5439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toks0=\expandafter{\putwordChapter}%
5440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \message{\the\toks0 \space \the\chapno}%
5441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Write the actual heading.
5443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \chapmacro{#1}{Ynumbered}{\the\chapno}%
5444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % So @section and the like are numbered underneath this chapter.
5446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\section = \numberedsec
5447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\subsection = \numberedsubsec
5448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\subsubsection = \numberedsubsubsec
5449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
5452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\appendixzzz#1{%
5454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\advance\appendixno by 1
5456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\chaplevelprefix{\appendixletter.}%
5457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetallfloatnos
5458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \putwordAppendix can contain complex things in translations.
5460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toks0=\expandafter{\putwordAppendix}%
5461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \message{\the\toks0 \space \appendixletter}%
5462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \chapmacro{#1}{Yappendix}{\appendixletter}%
5464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\section = \appendixsec
5466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\subsection = \appendixsubsec
5467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\subsubsection = \appendixsubsubsec
5468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally unnmhead0 calls unnumberedzzz:
5471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\unnumbered{\unnmhead0{#1}}
5472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnumberedzzz#1{%
5473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\advance\unnumberedno by 1
5475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Since an unnumbered has no number, no prefix for figures.
5477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\chaplevelprefix = \empty
5478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \resetallfloatnos
5479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % This used to be simply \message{#1}, but TeX fully expands the
5481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % argument to \message.  Therefore, if #1 contained @-commands, TeX
5482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
5483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % expanded @cite (which turns out to cause errors because \cite is meant
5484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % to be executed, not expanded).
5485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Anyway, we don't want the fully-expanded definition of @cite to appear
5487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % as a result of the \message, we just want `@cite' itself.  We use
5488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \the<toks register> to achieve this: TeX expands \the<toks> only once,
5489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % simply yielding the contents of <toks register>.  (We also do this for
5490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the toc entries.)
5491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toks0 = {#1}%
5492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \message{(\the\toks0)}%
5493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
5495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\section = \unnumberedsec
5497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\subsection = \unnumberedsubsec
5498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\subsubsection = \unnumberedsubsubsec
5499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @centerchap is like @unnumbered, but the heading is centered.
5502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\centerchap{%
5503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Well, we could do the following in a group, but that would break
5504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % an assumption that \chapmacro is called at the outermost level.
5505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Thus we are safer this way:		--kasal, 24feb04
5506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\centerparametersmaybe = \centerparameters
5507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \unnmhead0{#1}%
5508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\centerparametersmaybe = \relax
5509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @top is like @unnumbered.
5512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\top\unnumbered
5513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Sections.
5515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
5516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
5517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\seczzz#1{%
5518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
5519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
5520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally calls appendixsectionzzz:
5523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\appendixsection{\apphead1{#1}}
5524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\appendixsectionzzz#1{%
5525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
5526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
5527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\appendixsec\appendixsection
5529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally calls unnumberedseczzz:
5531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
5532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnumberedseczzz#1{%
5533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
5534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
5535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subsections.
5538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
5539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally calls numberedsubseczzz:
5540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\numberedsubsec{\numhead2{#1}}
5541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numberedsubseczzz#1{%
5542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\subsubsecno=0  \global\advance\subsecno by 1
5543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
5544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally calls appendixsubseczzz:
5547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\appendixsubsec{\apphead2{#1}}
5548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\appendixsubseczzz#1{%
5549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\subsubsecno=0  \global\advance\subsecno by 1
5550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{subsec}{Yappendix}%
5551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                 {\appendixletter.\the\secno.\the\subsecno}%
5552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally calls unnumberedsubseczzz:
5555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
5556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnumberedsubseczzz#1{%
5557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\subsubsecno=0  \global\advance\subsecno by 1
5558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{subsec}{Ynothing}%
5559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                 {\the\unnumberedno.\the\secno.\the\subsecno}%
5560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subsubsections.
5563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
5564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally numberedsubsubseczzz:
5565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
5566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numberedsubsubseczzz#1{%
5567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\subsubsecno by 1
5568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{subsubsec}{Ynumbered}%
5569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
5570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally appendixsubsubseczzz:
5573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
5574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\appendixsubsubseczzz#1{%
5575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\subsubsecno by 1
5576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{subsubsec}{Yappendix}%
5577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
5578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% normally unnumberedsubsubseczzz:
5581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
5582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnumberedsubsubseczzz#1{%
5583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\subsubsecno by 1
5584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sectionheading{#1}{subsubsec}{Ynothing}%
5585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
5586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% These macros control what the section commands do, according
5589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
5590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define them by default for a numbered chapter.
5591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\section = \numberedsec
5592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\subsection = \numberedsubsec
5593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\subsubsection = \numberedsubsubsec
5594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define @majorheading, @heading and @subheading
5596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\majorheading{%
5598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\advance\chapheadingskip by 10pt \chapbreak }%
5599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parsearg\chapheadingzzz
5600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
5603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapheadingzzz#1{%
5604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vbox{\chapfonts \raggedtitlesettings #1\par}%
5605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak\bigskip \nobreak
5606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \suppressfirstparagraphindent
5607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @heading, @subheading, @subsubheading.
5610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
5611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \suppressfirstparagraphindent}
5612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
5613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \suppressfirstparagraphindent}
5614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
5615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \suppressfirstparagraphindent}
5616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% These macros generate a chapter, section, etc. heading only
5618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (including whitespace, linebreaking, etc. around it),
5619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% given all the information in convenient, parsed form.
5620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Args are the skip and penalty (usually negative)
5622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
5623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Parameter controlling skip before chapter headings (if needed)
5625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\chapheadingskip
5626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define plain chapter starts, and page on/off switching for it.
5628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapbreak{\dobreak \chapheadingskip {-4000}}
5629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chappager{\par\vfill\supereject}
5630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Because \domark is called before \chapoddpage, the filler page will
5631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% get the headings for the next chapter, which is wrong.  But we don't
5632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% care -- we just disable all headings on the filler page.
5633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapoddpage{%
5634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \chappager
5635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifodd\pageno \else
5636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \begingroup
5637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \headingsoff
5638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \null
5639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \chappager
5640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
5641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
5642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
5645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\CHAPPAGoff{%
5647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\contentsalignmacro = \chappager
5648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\pchapsepmacro=\chapbreak
5649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\pagealignmacro=\chappager}
5650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\CHAPPAGon{%
5652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\contentsalignmacro = \chappager
5653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\pchapsepmacro=\chappager
5654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\pagealignmacro=\chappager
5655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\def\HEADINGSon{\HEADINGSsingle}}
5656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\CHAPPAGodd{%
5658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\contentsalignmacro = \chapoddpage
5659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\pchapsepmacro=\chapoddpage
5660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\pagealignmacro=\chapoddpage
5661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\def\HEADINGSon{\HEADINGSdouble}}
5662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\CHAPPAGon
5664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Chapter opening.
5666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
5668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Yappendix, Yomitfromtoc), #3 the chapter number.
5669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% To test against our argument.
5671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Ynothingkeyword{Ynothing}
5672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Yomitfromtockeyword{Yomitfromtoc}
5673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Yappendixkeyword{Yappendix}
5674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapmacro#1#2#3{%
5676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Insert the first mark before the heading break (see notes for \domark).
5677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\prevchapterdefs=\lastchapterdefs
5678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\prevsectiondefs=\lastsectiondefs
5679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
5680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                        \gdef\thissection{}}%
5681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temptype{#2}%
5683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temptype\Ynothingkeyword
5684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                          \gdef\thischapter{\thischaptername}}%
5686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temptype\Yomitfromtockeyword
5687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                          \gdef\thischapter{}}%
5689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temptype\Yappendixkeyword
5690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \toks0={#1}%
5691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef\lastchapterdefs{%
5692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\noexpand\thischaptername{\the\toks0}%
5693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\noexpand\thischapternum{\appendixletter}%
5694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % \noexpand\putwordAppendix avoids expanding indigestible
5695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % commands in some of the translations.
5696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
5697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                 \noexpand\thischapternum:
5698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                 \noexpand\thischaptername}%
5699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
5700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
5701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \toks0={#1}%
5702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef\lastchapterdefs{%
5703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\noexpand\thischaptername{\the\toks0}%
5704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\noexpand\thischapternum{\the\chapno}%
5705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % \noexpand\putwordChapter avoids expanding indigestible
5706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % commands in some of the translations.
5707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
5708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                 \noexpand\thischapternum:
5709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                 \noexpand\thischaptername}%
5710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
5711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi
5712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Output the mark.  Pass it through \safewhatsit, to take care of
5714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the preceding space.
5715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \safewhatsit\domark
5716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Insert the chapter heading break.
5718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pchapsepmacro
5719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Now the second mark, after the heading break.  No break points
5721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % between here and the heading.
5722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\prevchapterdefs=\lastchapterdefs
5723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\prevsectiondefs=\lastsectiondefs
5724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \domark
5725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
5727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \chapfonts \rmisbold
5728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Have to define \lastsection before calling \donoderef, because the
5730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % xref code eventually uses it.  On the other hand, it has to be called
5731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % after \pchapsepmacro, or the headline will change too soon.
5732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \gdef\lastsection{#1}%
5733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Only insert the separating space if we have a chapter/appendix
5735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % number, and don't print the unnumbered ``number''.
5736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\temptype\Ynothingkeyword
5737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setbox0 = \hbox{}%
5738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\toctype{unnchap}%
5739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\temptype\Yomitfromtockeyword
5740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
5741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\toctype{omit}%
5742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\temptype\Yappendixkeyword
5743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
5744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\toctype{app}%
5745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
5746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setbox0 = \hbox{#3\enspace}%
5747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\toctype{numchap}%
5748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi\fi\fi
5749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Write the toc entry for this chapter.  Must come before the
5751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \donoderef, because we include the current node name in the toc
5752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % entry, and \donoderef resets it to empty.
5753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \writetocentry{\toctype}{#1}{#3}%
5754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % For pdftex, we have to write out the node definition (aka, make
5756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % the pdfdest) after any page break, but before the actual text has
5757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % been typeset.  If the destination for the pdf outline is after the
5758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % text, then jumping from the outline may wind up with the text not
5759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % being visible, for instance under high magnification.
5760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \donoderef{#2}%
5761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Typeset the actual heading.
5763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak % Avoid page breaks at the interline glue.
5764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
5765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \unhbox0 #1\par}%
5766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
5767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak\bigskip % no page break after a chapter title
5768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak
5769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @centerchap -- centered and unnumbered.
5772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\centerparametersmaybe = \relax
5773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\centerparameters{%
5774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\rightskip by 3\rightskip
5775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \leftskip = \rightskip
5776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parfillskip = 0pt
5777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% I don't think this chapter style is supported any more, so I'm not
5781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% updating it with the new noderef stuff.  We'll see.  --karl, 11aug03.
5782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
5784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnchfopen #1{%
5786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \chapoddpage
5787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vbox{\chapfonts \raggedtitlesettings #1\par}%
5788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak\bigskip\nobreak
5789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chfopen #1#2{\chapoddpage {\chapfonts
5791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
5792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\par\penalty 5000 %
5793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\centerchfopen #1{%
5795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \chapoddpage
5796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
5797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak\bigskip \nobreak
5798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\CHAPFopen{%
5800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\chapmacro=\chfopen
5801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let\centerchapmacro=\centerchfopen}
5802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Section titles.  These macros combine the section number parts and
5805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% call the generic \sectionheading to do the printing.
5806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\secheadingskip
5808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
5809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subsection titles.
5811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\subsecheadingskip
5812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
5813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subsubsection titles.
5815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\subsubsecheadingskip{\subsecheadingskip}
5816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\subsubsecheadingbreak{\subsecheadingbreak}
5817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Print any size, any type, section title.
5820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
5822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
5823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% section number.
5824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\seckeyword{sec}
5826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\sectionheading#1#2#3#4{%
5828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
5829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \checkenv{}% should not be in an environment.
5830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Switch to the right set of fonts.
5832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \csname #2fonts\endcsname \rmisbold
5833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\sectionlevel{#2}%
5835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\temptype{#3}%
5836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Insert first mark before the heading break (see notes for \domark).
5838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\prevsectiondefs=\lastsectiondefs
5839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\temptype\Ynothingkeyword
5840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifx\sectionlevel\seckeyword
5841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
5842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                              \gdef\thissection{\thissectionname}}%
5843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
5844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\temptype\Yomitfromtockeyword
5845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Don't redefine \thissection.
5846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\temptype\Yappendixkeyword
5847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifx\sectionlevel\seckeyword
5848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \toks0={#1}%
5849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \xdef\lastsectiondefs{%
5850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \gdef\noexpand\thissectionname{\the\toks0}%
5851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \gdef\noexpand\thissectionnum{#4}%
5852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          % \noexpand\putwordSection avoids expanding indigestible
5853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          % commands in some of the translations.
5854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \gdef\noexpand\thissection{\noexpand\putwordSection{}
5855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                     \noexpand\thissectionnum:
5856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                     \noexpand\thissectionname}%
5857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        }%
5858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
5859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
5860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifx\sectionlevel\seckeyword
5861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \toks0={#1}%
5862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \xdef\lastsectiondefs{%
5863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \gdef\noexpand\thissectionname{\the\toks0}%
5864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \gdef\noexpand\thissectionnum{#4}%
5865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          % \noexpand\putwordSection avoids expanding indigestible
5866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          % commands in some of the translations.
5867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \gdef\noexpand\thissection{\noexpand\putwordSection{}
5868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                     \noexpand\thissectionnum:
5869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                                     \noexpand\thissectionname}%
5870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        }%
5871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
5872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi\fi\fi
5873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Go into vertical mode.  Usually we'll already be there, but we
5875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % don't want the following whatsit to end up in a preceding paragraph
5876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % if the document didn't happen to have a blank line.
5877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \par
5878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Output the mark.  Pass it through \safewhatsit, to take care of
5880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % the preceding space.
5881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \safewhatsit\domark
5882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Insert space above the heading.
5884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \csname #2headingbreak\endcsname
5885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Now the second mark, after the heading break.  No break points
5887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % between here and the heading.
5888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\prevsectiondefs=\lastsectiondefs
5889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \domark
5890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Only insert the space after the number if we have a section number.
5892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\temptype\Ynothingkeyword
5893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setbox0 = \hbox{}%
5894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\toctype{unn}%
5895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\lastsection{#1}%
5896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\temptype\Yomitfromtockeyword
5897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % for @headings -- no section number, don't include in toc,
5898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % and don't redefine \lastsection.
5899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setbox0 = \hbox{}%
5900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\toctype{omit}%
5901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \let\sectionlevel=\empty
5902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifx\temptype\Yappendixkeyword
5903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setbox0 = \hbox{#4\enspace}%
5904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\toctype{app}%
5905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\lastsection{#1}%
5906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
5907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \setbox0 = \hbox{#4\enspace}%
5908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\toctype{num}%
5909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \gdef\lastsection{#1}%
5910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi\fi\fi
5911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Write the toc entry (before \donoderef).  See comments in \chapmacro.
5913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \writetocentry{\toctype\sectionlevel}{#1}{#4}%
5914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Write the node reference (= pdf destination for pdftex).
5916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Again, see comments in \chapmacro.
5917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \donoderef{#3}%
5918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Interline glue will be inserted when the vbox is completed.
5920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % That glue will be a valid breakpoint for the page, since it'll be
5921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % preceded by a whatsit (usually from the \donoderef, or from the
5922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \writetocentry if there was no node).  We don't want to allow that
5923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % break, since then the whatsits could end up on page n while the
5924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
5925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak
5926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Output the actual section heading.
5928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
5929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \hangindent=\wd0  % zero if no section number
5930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \unhbox0 #1}%
5931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
5932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Add extra space after the heading -- half of whatever came above it.
5933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Don't allow stretch, though.
5934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \kern .5 \csname #2headingskip\endcsname
5935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Do not let the kern be a potential breakpoint, as it would be if it
5937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % was followed by glue.
5938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nobreak
5939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We'll almost certainly start a paragraph next, so don't let that
5941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % glue accumulate.  (Not a breakpoint because it's preceded by a
5942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % discardable item.)  However, when a paragraph is not started next
5943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
5944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % or the negative glue will cause weirdly wrong output, typically
5945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % obscuring the section heading with something else.
5946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip-\parskip
5947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % This is so the last item on the main vertical list is a known
5949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \penalty > 10000, so \startdefun, etc., can recognize the situation
5950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % and do the needful.
5951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \penalty 10001
5952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
5953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{toc,}
5956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Table of contents.
5957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newwrite\tocfile
5958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
5959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Write an entry to the toc file, opening it if necessary.
5960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Called from @chapter, etc.
5961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
5963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We append the current node name (if any) and page number as additional
5964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% arguments for the \{chap,sec,...}entry macros which will eventually
5965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% read this.  The node name is used in the pdf outlines as the
5966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% destination to jump to.
5967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We open the .toc file for writing here instead of at @setfilename (or
5969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% any other fixed time) so that @contents can be anywhere in the document.
5970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But if #1 is `omit', then we don't do anything.  This is used for the
5971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% table of contents chapter openings themselves.
5972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\iftocfileopened
5974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\omitkeyword{omit}%
5975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
5976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\writetocentry#1#2#3{%
5977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\writetoctype{#1}%
5978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\writetoctype\omitkeyword \else
5979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \iftocfileopened\else
5980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \immediate\openout\tocfile = \jobname.toc
5981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\tocfileopenedtrue
5982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
5984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \iflinks
5985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      {\atdummies
5986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \edef\temp{%
5987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
5988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \temp
5989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
5990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
5991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
5992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
5993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Tell \shipout to create a pdf destination on each page, if we're
5994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % writing pdf.  These are used in the table of contents.  We can't
5995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % just write one on every page because the title pages are numbered
5996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % 1 and 2 (the page numbers aren't printed), and so are the first
5997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % two pages of the document.  Thus, we'd have two destinations named
5998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % `1', and two named `2'.
5999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifpdf \global\pdfmakepagedesttrue \fi
6000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% These characters do not print properly in the Computer Modern roman
6004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% fonts, so we must take special care.  This is more or less redundant
6005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% with the Texinfo input format setup at the end of this file.
6006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\activecatcodes{%
6008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\"=\active
6009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\$=\active
6010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\<=\active
6011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\>=\active
6012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\\=\active
6013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^=\active
6014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\_=\active
6015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\|=\active
6016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\~=\active
6017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Read the toc file, which is essentially Texinfo input.
6021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\readtocfile{%
6022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setupdatafile
6023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \activecatcodes
6024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \input \tocreadfilename
6025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\contentsrightmargin \contentsrightmargin=1in
6028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\savepageno
6029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\lastnegativepageno \lastnegativepageno = -1
6030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Prepare to read what we've written to \tocfile.
6032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\startcontents#1{%
6034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If @setchapternewpage on, and @headings double, the contents should
6035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % start on an odd page, unlike chapters.  Thus, we maintain
6036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \contentsalignmacro in parallel with \pagealignmacro.
6037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % From: Torbjorn Granlund <tege@matematik.su.se>
6038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \contentsalignmacro
6039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \immediate\closeout\tocfile
6040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Don't need to put `Contents' or `Short Contents' in the headline.
6042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % It is abundantly clear what they are.
6043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \chapmacro{#1}{Yomitfromtoc}{}%
6044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \savepageno = \pageno
6046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup                  % Set up to handle contents files properly.
6047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \raggedbottom              % Worry more about breakpoints than the bottom.
6048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\hsize by -\contentsrightmargin % Don't use the full line length.
6049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
6050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Roman numerals for page numbers.
6051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% redefined for the two-volume lispref.  We always output on
6055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \jobname.toc even if this is redefined.
6056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tocreadfilename{\jobname.toc}
6058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Normal (long) toc.
6060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\contents{%
6062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startcontents{\putwordTOC}%
6063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \openin 1 \tocreadfilename\space
6064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifeof 1 \else
6065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \readtocfile
6066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
6067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vfill \eject
6068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \contentsalignmacro % in case @setchapternewpage odd is in effect
6069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifeof 1 \else
6070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \pdfmakeoutlines
6071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
6072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \closein 1
6073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
6074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \lastnegativepageno = \pageno
6075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\pageno = \savepageno
6076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% And just the chapters.
6079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\summarycontents{%
6080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startcontents{\putwordShortTOC}%
6081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
6082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\partentry = \shortpartentry
6083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\numchapentry = \shortchapentry
6084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\appentry = \shortchapentry
6085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\unnchapentry = \shortunnchapentry
6086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % We want a true roman here for the page numbers.
6087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \secfonts
6088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\rm=\shortcontrm \let\bf=\shortcontbf
6089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\sl=\shortcontsl \let\tt=\shortconttt
6090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \rm
6091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \hyphenpenalty = 10000
6092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\baselineskip by 1pt % Open it up a little.
6093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\numsecentry##1##2##3##4{}
6094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\appsecentry = \numsecentry
6095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\unnsecentry = \numsecentry
6096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\numsubsecentry = \numsecentry
6097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\appsubsecentry = \numsecentry
6098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\unnsubsecentry = \numsecentry
6099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\numsubsubsecentry = \numsecentry
6100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\appsubsubsecentry = \numsecentry
6101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\unnsubsubsecentry = \numsecentry
6102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \openin 1 \tocreadfilename\space
6103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifeof 1 \else
6104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \readtocfile
6105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
6106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \closein 1
6107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vfill \eject
6108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \contentsalignmacro % in case @setchapternewpage odd is in effect
6109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
6110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \lastnegativepageno = \pageno
6111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\pageno = \savepageno
6112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\shortcontents = \summarycontents
6114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Typeset the label for a chapter or appendix for the short contents.
6116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\shortchaplabel#1{%
6119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % This space should be enough, since a single number is .5em, and the
6120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % widest letter (M) is 1em, at least in the Computer Modern fonts.
6121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % But use \hss just in case.
6122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % (This space doesn't include the extra space that gets added after
6123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the label; that gets put in by \shortchapentry above.)
6124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We'd like to right-justify chapter numbers, but that looks strange
6126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % with appendix letters.  And right-justifying numbers and
6127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % left-justifying letters looks strange when there is less than 10
6128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % chapters.  Have to read the whole toc once to know how many chapters
6129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % there are before deciding ...
6130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbox to 1em{#1\hss}%
6131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% These macros generate individual entries in the table of contents.
6134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The first argument is the chapter or section name.
6135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The last argument is the page number.
6136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The arguments in between are the chapter number, section number, ...
6137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Parts, in the main contents.  Replace the part number, which doesn't
6139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% exist, with an empty box.  Let's hope all the numbers have the same width.
6140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Also ignore the page number, which is conventionally not printed.
6141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Parts, in the short toc.
6145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\shortpartentry#1#2#3#4{%
6146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \penalty-300
6147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Chapters, in the main contents.
6152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Chapters, in the short toc.
6155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% See comments in \dochapentry re vbox and related settings.
6156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\shortchapentry#1#2#3#4{%
6157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Appendices, in the main contents.
6161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Need the word Appendix, and a fixed-size box.
6162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\appendixbox#1{%
6164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We use M since it's probably the widest letter.
6165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0 = \hbox{\putwordAppendix{} M}%
6166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbox to \wd0{\putwordAppendix{} #1\hss}}
6167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
6169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Unnumbered chapters.
6171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Sections.
6175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\appsecentry=\numsecentry
6177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subsections.
6180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\appsubsecentry=\numsubsecentry
6182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% And subsubsections.
6185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\appsubsubsecentry=\numsubsubsecentry
6187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This parameter controls the indentation of the various levels.
6190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Same as \defaultparindent.
6191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\tocindent \tocindent = 15pt
6192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Now for the actual typesetting. In all these, #1 is the text and #2 is the
6194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% page number.
6195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If the toc has to be broken over pages, we want it to be at chapters
6197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% if at all possible; hence the \penalty.
6198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dochapentry#1#2{%
6199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \begingroup
6201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \chapentryfonts
6202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \endgroup
6204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \nobreak\vskip .25\baselineskip plus.1\baselineskip
6205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dosecentry#1#2{\begingroup
6208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \secentryfonts \leftskip=\tocindent
6209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
6211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dosubsecentry#1#2{\begingroup
6213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \subsecentryfonts \leftskip=2\tocindent
6214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
6216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dosubsubsecentry#1#2{\begingroup
6218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \subsubsecentryfonts \leftskip=3\tocindent
6219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
6221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We use the same \entry macro as for the index entries.
6223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\tocentry = \entry
6224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Space between chapter (or whatever) number and the title.
6226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\labelspace{\hskip1em \relax}
6227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dopageno#1{{\rm #1}}
6229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doshortpageno#1{{\rm #1}}
6230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\chapentryfonts{\secfonts \rm}
6232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\secentryfonts{\textfonts}
6233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\subsecentryfonts{\textfonts}
6234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\subsubsecentryfonts{\textfonts}
6235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{environments,}
6238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @foo ... @end foo.
6239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @tex ... @end tex    escapes into raw TeX temporarily.
6241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% One exception: @ is still an escape character, so that @end tex works.
6242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But \@ or @@ will get a plain @ character.
6243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\tex{%
6245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setupmarkupstyle{tex}%
6246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\%=14
6250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\+=\other
6251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\"=\other
6252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\|=\other
6253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\<=\other
6254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode `\>=\other
6255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\`=\other
6256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\'=\other
6257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \escapechar=`\\
6258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % ' is active in math mode (mathcode"8000).  So reset it, and all our
6260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % other math active characters (just in case), to plain's definitions.
6261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \mathactive
6262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\b=\ptexb
6264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\bullet=\ptexbullet
6265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\c=\ptexc
6266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\,=\ptexcomma
6267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\.=\ptexdot
6268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\dots=\ptexdots
6269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\equiv=\ptexequiv
6270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\!=\ptexexclam
6271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\i=\ptexi
6272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\indent=\ptexindent
6273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\noindent=\ptexnoindent
6274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\{=\ptexlbrace
6275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\+=\tabalign
6276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\}=\ptexrbrace
6277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\/=\ptexslash
6278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\*=\ptexstar
6279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\t=\ptext
6280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter \let\csname top\endcsname=\ptextop  % outer
6281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\frenchspacing=\plainfrenchspacing
6282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
6284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
6285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\@{@}%
6286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% There is no need to define \Etex.
6288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define @lisp ... @end lisp.
6290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @lisp environment forms a group so it can rebind things,
6291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% including the definition of @end lisp (which normally is erroneous).
6292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Amount to narrow the margins by for @lisp.
6294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\lispnarrowing \lispnarrowing=0.4in
6295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is the definition that ^^M gets inside @lisp, @example, and other
6297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% such environments.  \null is better than a space, since it doesn't
6298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% have any width.
6299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lisppar{\null\endgraf}
6300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This space is always present above and below environments.
6302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\envskipamount \envskipamount = 0pt
6303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Make spacing and below environment symmetrical.  We use \parskip here
6305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to help in doing that, since in @example-like environments \parskip
6306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% is reset to zero; thus the \afterenvbreak inserts no space -- but the
6307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% start of the next paragraph will insert \parskip.
6308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\aboveenvbreak{{%
6310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % =10000 instead of <10000 because of a special case in \itemzzz and
6311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \sectionheading, q.v.
6312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum \lastpenalty=10000 \else
6313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\envskipamount by \parskip
6314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgraf
6315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim\lastskip<\envskipamount
6316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \removelastskip
6317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % it's not a good place to break if the last penalty was \nobreak
6318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % or better ...
6319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifnum\lastpenalty<10000 \penalty-50 \fi
6320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \vskip\envskipamount
6321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
6322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
6324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\afterenvbreak = \aboveenvbreak
6326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
6328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% also clear it, so that its embedded environments do the narrowing again.
6329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\nonarrowing=\relax
6330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
6332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% environment contents.
6333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\font\circle=lcircle10
6334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\circthick
6335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\cartouter\newdimen\cartinner
6336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\normbskip\newskip\normpskip\newskip\normlskip
6337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\circthick=\fontdimen8\circle
6338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
6340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ctr{{\hskip 6pt\circle\char'010}}
6341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\cbl{{\circle\char'012\hskip -6pt}}
6342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\cbr{{\hskip 6pt\circle\char'011}}
6343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\carttop{\hbox to \cartouter{\hskip\lskip
6344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \ctl\leaders\hrule height\circthick\hfil\ctr
6345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \hskip\rskip}}
6346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\cartbot{\hbox to \cartouter{\hskip\lskip
6347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \cbl\leaders\hrule height\circthick\hfil\cbr
6348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \hskip\rskip}}
6349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\lskip\newskip\rskip
6351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\cartouche{%
6353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifhmode\par\fi  % can't be in the midst of a paragraph.
6354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startsavinginserts
6355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \lskip=\leftskip \rskip=\rightskip
6356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \leftskip=0pt\rightskip=0pt % we want these *outside*.
6357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \cartinner=\hsize \advance\cartinner by-\lskip
6358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\cartinner by-\rskip
6359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \cartouter=\hsize
6360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\cartouter by 18.4pt	% allow for 3pt kerns on either
6361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique				% side, and for 6pt waste from
6362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique				% each corner char, and rule thickness
6363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
6364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Flag to tell @lisp, etc., not to narrow margin.
6365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\nonarrowing = t%
6366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If this cartouche directly follows a sectioning command, we need the
6368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \parskip glue (backspaced over by default) or the cartouche can
6369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % collide with the section heading.
6370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
6371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vbox\bgroup
6373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \baselineskip=0pt\parskip=0pt\lineskip=0pt
6374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \carttop
6375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \hbox\bgroup
6376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \hskip\lskip
6377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \vrule\kern3pt
6378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \vbox\bgroup
6379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \kern3pt
6380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \hsize=\cartinner
6381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \baselineskip=\normbskip
6382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \lineskip=\normlskip
6383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \parskip=\normpskip
6384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \vskip -\parskip
6385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \comment % For explanation, see the end of def\group.
6386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Ecartouche{%
6388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique              \ifhmode\par\fi
6389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \kern3pt
6390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \egroup
6391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \kern3pt\vrule
6392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \hskip\rskip
6393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \egroup
6394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \cartbot
6395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \egroup
6396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \checkinserts
6397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This macro is called at the beginning of all the @example variants,
6401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% inside a group.
6402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\nonfillparindent
6403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\nonfillstart{%
6404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \aboveenvbreak
6405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hfuzz = 12pt % Don't be fussy
6406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sepspaces % Make spaces be word-separators rather than space tokens.
6407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\par = \lisppar % don't ignore blank lines
6408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \obeylines % each line of input is a line of output
6409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip = 0pt
6410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Turn off paragraph indentation but redefine \indent to emulate
6411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the normal \indent.
6412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nonfillparindent=\parindent
6413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent = 0pt
6414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\indent\nonfillindent
6415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \emergencystretch = 0pt % don't try to avoid overfull boxes
6417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\nonarrowing\relax
6418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance \leftskip by \lispnarrowing
6419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \exdentamount=\lispnarrowing
6420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
6421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\nonarrowing = \relax
6422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\exdent=\nofillexdent
6424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
6427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\obeyspaces
6428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We want to swallow spaces (but not other tokens) after the fake
6429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @indent in our nonfill-environments, where spaces are normally
6430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% active and set to @tie, resulting in them not being ignored after
6431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @indent.
6432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
6433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\nonfillindentcheck{%
6434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\temp %
6435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\expandafter\nonfillindentgobble%
6436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\else%
6437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\leavevmode\nonfillindentbox%
6438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi%
6439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}%
6440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup
6441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\nonfillindentgobble#1{\nonfillindent}
6442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
6443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If you want all examples etc. small: @set dispenvsize small.
6445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If you want even small examples the full size: @set dispenvsize nosmall.
6446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This affects the following displayed environments:
6447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%    @example, @display, @format, @lisp
6448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallword{small}
6450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\nosmallword{nosmall}
6451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\SETdispenvsize\relax
6452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setnormaldispenv{%
6453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\SETdispenvsize\smallword
6454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % end paragraph for sake of leading, in case document has no blank
6455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % line.  This is redundant with what happens in \aboveenvbreak, but
6456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % we need to do it before changing the fonts, and it's inconvenient
6457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % to change the fonts afterward.
6458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum \lastpenalty=10000 \else \endgraf \fi
6459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \smallexamplefonts \rm
6460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setsmalldispenv{%
6463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\SETdispenvsize\nosmallword
6464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
6465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum \lastpenalty=10000 \else \endgraf \fi
6466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \smallexamplefonts \rm
6467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We often define two environments, @foo and @smallfoo.
6471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Let's do it in one command.  #1 is the env name, #2 the definition.
6472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\makedispenvdef#1#2{%
6473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
6474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
6475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\csname E#1\endcsname \afterenvbreak
6476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
6477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define two environment synonyms (#1 and #2) for an environment.
6480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\maketwodispenvdef#1#2#3{%
6481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \makedispenvdef{#1}{#3}%
6482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \makedispenvdef{#2}{#3}%
6483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @lisp: indented, narrowed, typewriter font;
6486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @example: same as @lisp.
6487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @smallexample and @smalllisp: use smaller fonts.
6489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Originally contributed by Pavel@xerox.
6490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\maketwodispenvdef{lisp}{example}{%
6492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nonfillstart
6493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tt\setupmarkupstyle{example}%
6494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
6495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gobble % eat return
6496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @display/@smalldisplay: same as @lisp except keep current font.
6498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedispenvdef{display}{%
6500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nonfillstart
6501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gobble
6502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @format/@smallformat: same as @display except don't narrow margins.
6505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedispenvdef{format}{%
6507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\nonarrowing = t%
6508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nonfillstart
6509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gobble
6510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
6513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\flushleft{%
6514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\nonarrowing = t%
6515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nonfillstart
6516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gobble
6517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Eflushleft = \afterenvbreak
6519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @flushright.
6521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\flushright{%
6523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\nonarrowing = t%
6524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nonfillstart
6525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\leftskip by 0pt plus 1fill\relax
6526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gobble
6527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Eflushright = \afterenvbreak
6529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @raggedright does more-or-less normal line breaking but no right
6532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% justification.  From plain.tex.
6533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\raggedright{%
6534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
6535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Eraggedright\par
6537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\raggedleft{%
6539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent=0pt \leftskip0pt plus2em
6540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbadness=10000 % Last line will usually be underfull, so turn off
6542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                  % badness reporting.
6543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Eraggedleft\par
6545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\raggedcenter{%
6547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
6548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbadness=10000 % Last line will usually be underfull, so turn off
6550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                  % badness reporting.
6551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Eraggedcenter\par
6553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @quotation does normal linebreaking (hence we can't use \nonfillstart)
6556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and narrows the margins.  We keep \parskip nonzero in general, since
6557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we're doing normal filling.  So, when using \aboveenvbreak and
6558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \afterenvbreak, temporarily make \parskip 0.
6559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedispenvdef{quotation}{\quotationstart}
6561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\quotationstart{%
6563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \indentedblockstart % same as \indentedblock, but increase right margin too.
6564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\nonarrowing\relax
6565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\rightskip by \lispnarrowing
6566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parsearg\quotationlabel
6568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We have retained a nonzero parskip for the environment, since we're
6571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% doing normal filling.
6572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Equotation{%
6574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \par
6575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\quotationauthor\thisisundefined\else
6576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % indent a bit.
6577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
6578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\parskip=0pt \afterenvbreak}%
6580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Esmallquotation{\Equotation}
6582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If we're given an argument, typeset it in bold with a colon after.
6584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\quotationlabel#1{%
6585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
6586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\empty \else
6587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {\bf #1: }%
6588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @indentedblock is like @quotation, but indents only on the left and
6592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% has no optional argument.
6593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
6594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedispenvdef{indentedblock}{\indentedblockstart}
6595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\indentedblockstart{%
6597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
6598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent=0pt
6599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
6601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\nonarrowing\relax
6602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\leftskip by \lispnarrowing
6603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \exdentamount = \lispnarrowing
6604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
6605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\nonarrowing = \relax
6606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Keep a nonzero parskip for the environment, since we're doing normal filling.
6610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Eindentedblock{%
6612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \par
6613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\parskip=0pt \afterenvbreak}%
6614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Esmallindentedblock{\Eindentedblock}
6616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
6619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If we want to allow any <char> as delimiter,
6620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we need the curly braces so that makeinfo sees the @verb command, eg:
6621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
6622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
6624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% [Knuth] p.344; only we need to do the other characters Texinfo sets
6626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% active too.  Otherwise, they get lost as the first character on a
6627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% verbatim line.
6628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dospecials{%
6629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \do\ \do\\\do\{\do\}\do\$\do\&%
6630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
6631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \do\<\do\>\do\|\do\@\do+\do\"%
6632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Don't do the quotes -- if we do, @set txicodequoteundirected and
6633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @set txicodequotebacktick will not have effect on @verb and
6634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @verbatim, and ?` and !` ligatures won't get disabled.
6635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %\do\`\do\'%
6636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% [Knuth] p. 380
6639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\uncatcodespecials{%
6640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\do##1{\catcode`##1=\other}\dospecials}
6641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Setup for the @verb command.
6643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Eight spaces for a tab
6645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
6646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^I=\active
6647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
6648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup
6649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setupverb{%
6651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tt  % easiest (and conventionally used) font for verbatim
6652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\par{\leavevmode\endgraf}%
6653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setupmarkupstyle{verb}%
6654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tabeightspaces
6655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Respect line breaks,
6656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % print special symbols as themselves, and
6657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % make each space count
6658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % must do in this order:
6659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \obeylines \uncatcodespecials \sepspaces
6660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Setup for the @verbatim environment
6663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Real tab expansion.
6665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
6666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We typeset each line of the verbatim in an \hbox, so we can handle
6668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% tabs.  The \global is in case the verbatim line starts with an accent,
6669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% or some other command that starts with a begin-group.  Otherwise, the
6670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% entire \verbbox would disappear at the corresponding end-group, before
6671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% it is typeset.  Meanwhile, we can't have nested verbatim commands
6672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (can we?), so the \global won't be overwriting itself.
6673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\verbbox
6674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
6675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
6677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^I=\active
6678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\tabexpand{%
6679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \catcode`\^^I=\active
6680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def^^I{\leavevmode\egroup
6681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
6682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \divide\dimen\verbbox by\tabw
6683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
6684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
6685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
6686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
6687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
6688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup
6689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% start the verbatim environment.
6691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setupverbatim{%
6692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\nonarrowing = t%
6693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \nonfillstart
6694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tt % easiest (and conventionally used) font for verbatim
6695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The \leavevmode here is for blank lines.  Otherwise, we would
6696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % never \starttabox and the \egroup would end verbatim mode.
6697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
6698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tabexpand
6699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setupmarkupstyle{verbatim}%
6700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Respect line breaks,
6701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % print special symbols as themselves, and
6702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % make each space count.
6703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Must do in this order:
6704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \obeylines \uncatcodespecials \sepspaces
6705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \everypar{\starttabbox}%
6706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Do the @verb magic: verbatim text is quoted by unique
6709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% delimiter characters.  Before first delimiter expect a
6710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% right brace, after last delimiter expect closing brace:
6711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%    \def\doverb'{'<char>#1<char>'}'{#1}
6713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% [Knuth] p. 382; only eat outer {}
6715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
6716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
6717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
6718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup
6719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\verb{\begingroup\setupverb\doverb}
6721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Do the @verbatim magic: define the macro \doverbatim so that
6724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the (first) argument ends when '@end verbatim' is reached, ie:
6725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%     \def\doverbatim#1@end verbatim{#1}
6727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For Texinfo it's a lot easier than for LaTeX,
6729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
6730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we need not redefine '\', '{' and '}'.
6731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Inspired by LaTeX's verbatim command set [latex.ltx]
6733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
6735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\ =\active
6736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \obeylines %
6737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % ignore everything up to the first ^^M, that's the newline at the end
6738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % of the @verbatim input line itself.  Otherwise we get an extra blank
6739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % line in the output.
6740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
6741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We really want {...\end verbatim} in the body of the macro, but
6742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % without the active space; thus we have to use \xdef and \gobble.
6743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup
6744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envdef\verbatim{%
6746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setupverbatim\doverbatim
6747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\Everbatim = \afterenvbreak
6749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @verbatiminclude FILE - insert text of file in verbatim environment.
6752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
6754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doverbatiminclude#1{%
6756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
6757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makevalueexpandable
6758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setupverbatim
6759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indexnofonts       % Allow `@@' and other weird things in file names.
6760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
6761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \input #1
6762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \afterenvbreak
6763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
6764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @copying ... @end copying.
6767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Save the text away for @insertcopying later.
6768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We save the uninterpreted tokens, rather than creating a box.
6770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Saving the text in a box would be much easier, but then all the
6771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% typesetting commands (@smallbook, font changes, etc.) have to be done
6772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% beforehand -- and a) we want @copying to be done first in the source
6773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% file; b) letting users define the frontmatter in as flexible order as
6774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% possible is very desirable.
6775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
6777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
6778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\insertcopying{%
6780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
6781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \parindent = 0pt  % paragraph indentation looks wrong on title page
6782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \scanexp\copyingtext
6783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
6784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{defuns,}
6788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @defun etc.
6789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\defbodyindent \defbodyindent=.4in
6791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\defargsindent \defargsindent=50pt
6792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newskip\deflastargmargin \deflastargmargin=18pt
6793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\defunpenalty
6794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Start the processing of @deffn:
6796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\startdefun{%
6797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\lastpenalty<10000
6798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \medbreak
6799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \defunpenalty=10003 % Will keep this @deffn together with the
6800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                        % following @def command, see below.
6801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
6802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If there are two @def commands in a row, we'll have a \nobreak,
6803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % which is there to keep the function description together with its
6804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % header.  But if there's nothing but headers, we need to allow a
6805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % break somewhere.  Check specifically for penalty 10002, inserted
6806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % by \printdefunline, instead of 10000, since the sectioning
6807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % commands also insert a nobreak penalty, and we don't want to allow
6808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % a break between a section heading and a defun.
6809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
6810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % As a further refinement, we avoid "club" headers by signalling
6811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % with penalty of 10003 after the very first @deffn in the
6812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % sequence (see above), and penalty of 10002 after any following
6813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % @def command.
6814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
6815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
6816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Similarly, after a section heading, do not allow a break.
6817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % But do insert the glue.
6818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \medskip  % preceded by discardable penalty, so not a breakpoint
6819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
6820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent=0in
6822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\leftskip by \defbodyindent
6823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \exdentamount=\defbodyindent
6824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dodefunx#1{%
6827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % First, check whether we are in the right environment:
6828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \checkenv#1%
6829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % As above, allow line break if we have multiple x headers in a row.
6831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % It's not a great place, though.
6832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
6833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
6834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % And now, it's time to reuse the body of the original defun:
6835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\gobbledefun#1%
6836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\gobbledefun#1\startdefun{}
6838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \printdefunline \deffnheader{text}
6840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\printdefunline#1#2{%
6842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
6843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % call \deffnheader:
6844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    #1#2 \endheader
6845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % common ending:
6846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \interlinepenalty = 10000
6847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\rightskip by 0pt plus 1fil\relax
6848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgraf
6849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak\vskip -\parskip
6850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \penalty\defunpenalty  % signal to \startdefun and \dodefunx
6851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Some of the @defun-type tags do not enable magic parentheses,
6852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % rendering the following check redundant.  But we don't optimize.
6853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \checkparencounts
6854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
6855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Edefun{\endgraf\medbreak}
6858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
6860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the only thing remaining is to define \deffnheader.
6861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\makedefun#1{%
6863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\csname E#1\endcsname = \Edefun
6864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\temp{\noexpand\domakedefun
6865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
6866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \temp
6867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \domakedefun \deffn \deffnx \deffnheader
6870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define \deffn and \deffnx, without parameters.
6872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \deffnheader has to be defined explicitly.
6873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\domakedefun#1#2#3{%
6875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \envdef#1{%
6876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \startdefun
6877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \doingtypefnfalse    % distinguish typed functions from all else
6878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \parseargusing\activeparens{\printdefunline#3}%
6879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
6880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def#2{\dodefunx#1}%
6881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def#3%
6882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifdoingtypefn       % doing typed function?
6885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifrettypeownline    % typeset return type on its own line?
6886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deftypefnnewline on|off says whether the return type of typed functions
6888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% are printed on their own line.  This affects @deftypefn, @deftypefun,
6889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deftypeop, and @deftypemethod.
6890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
6891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\deftypefnnewline{%
6892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
6893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\onword
6894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname SETtxideftypefnnl\endcsname
6895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      = \empty
6896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\offword
6897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname SETtxideftypefnnl\endcsname
6898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      = \relax
6899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
6900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
6901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @txideftypefnnl value `\temp',
6902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                must be on|off}%
6903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
6904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Untyped functions:
6907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deffn category name args
6909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deffn}{\deffngeneral{}}
6910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deffn category class name args
6912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
6913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \defopon {category on}class name args
6915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
6916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \deffngeneral {subind}category name args
6918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\deffngeneral#1#2 #3 #4\endheader{%
6920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
6921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dosubind{fn}{\code{#3}}{#1}%
6922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
6923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Typed functions:
6926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deftypefn category type name args
6928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftypefn}{\deftypefngeneral{}}
6929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deftypeop category class type name args
6931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
6932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \deftypeopon {category on}class type name args
6934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
6935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \deftypefngeneral {subind}category type name args
6937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
6939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dosubind{fn}{\code{#4}}{#1}%
6940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \doingtypefntrue
6941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Typed variables:
6945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deftypevr category type var args
6947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftypevr}{\deftypecvgeneral{}}
6948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deftypecv category class type var args
6950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
6951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \deftypecvof {category of}class type var args
6953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
6954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \deftypecvgeneral {subind}category type var args
6956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
6958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dosubind{vr}{\code{#4}}{#1}%
6959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Untyped variables:
6963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @defvr category var args
6965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
6966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @defcv category class var args
6968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
6969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \defcvof {category of}class var args
6971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
6972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Types:
6974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @deftp category name args
6976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftp}#1 #2 #3\endheader{%
6977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \doind{tp}{\code{#2}}%
6978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \defname{#1}{}{#2}\defunargs{#3\unskip}%
6979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
6980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Remaining @defun-like shortcuts:
6982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defun}{\deffnheader{\putwordDeffunc} }
6983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defmac}{\deffnheader{\putwordDefmac} }
6984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defspec}{\deffnheader{\putwordDefspec} }
6985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
6986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defvar}{\defvrheader{\putwordDefvar} }
6987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defopt}{\defvrheader{\putwordDefopt} }
6988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
6989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defmethod}{\defopon\putwordMethodon}
6990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
6991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
6992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
6993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
6994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \defname, which formats the name of the @def (not the args).
6995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the category, such as "Function".
6996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #2 is the return type, if any.
6997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #3 is the function name.
6998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
6999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We are followed by (but not passed) the arguments, if any.
7000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defname#1#2#3{%
7002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \par
7003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Get the values of \leftskip and \rightskip as they were outside the @def...
7004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\leftskip by -\defbodyindent
7005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Determine if we are typesetting the return type of a typed function
7007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % on a line by itself.
7008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \rettypeownlinefalse
7009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdoingtypefn  % doing a typed function specifically?
7010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % then check user option for putting return type on its own line:
7011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \rettypeownlinetrue
7013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
7014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % How we'll format the category name.  Putting it in brackets helps
7017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % distinguish it from the body text that may end up on the next line
7018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % just below it.
7019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
7020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Figure out line sizes for the paragraph shape.  We'll always have at
7023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % least two.
7024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tempnum = 2
7025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The first line needs space for \box0; but if \rightskip is nonzero,
7027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % we need only space for the part of \box0 which exceeds it:
7028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
7029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If doing a return type on its own line, we'll have another line.
7031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifrettypeownline
7032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\tempnum by 1
7033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\maybeshapeline{0in \hsize}%
7034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\maybeshapeline{}%
7036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The continuations:
7039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen2=\hsize  \advance\dimen2 by -\defargsindent
7040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The final paragraph shape:
7042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
7043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Put the category name at the right margin.
7045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \noindent
7046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hbox to 0pt{%
7047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \hfil\box0 \kern-\hsize
7048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \hsize has to be shortened this way:
7049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \kern\leftskip
7050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Intentionally do not respect \rightskip, since we need the space.
7051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
7052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Allow all lines to be underfull without complaint:
7054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tolerance=10000 \hbadness=10000
7055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \exdentamount=\defbodyindent
7056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
7057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % defun fonts. We use typewriter by default (used to be bold) because:
7058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % . we're printing identifiers, they should be in tt in principle.
7059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % . in languages with many accents, such as Czech or French, it's
7060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %   common to leave accents off identifiers.  The result looks ok in
7061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %   tt, but exceedingly strange in rm.
7062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % . we don't want -- and --- to be treated as ligatures.
7063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % . this still does not fix the ?` and !` ligatures, but so far no
7064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %   one has made identifiers using them :).
7065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \df \tt
7066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\temp{#2}% text of the return type
7067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\temp\empty\else
7068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \tclose{\temp}% typeset the return type
7069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifrettypeownline
7070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % put return type on its own line; prohibit line break following:
7071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \hfil\vadjust{\nobreak}\break  
7072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
7073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \space  % type on same line, so just followed by a space
7074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
7075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi           % no return type
7076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    #3% output function name
7077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
7078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\rm\enskip}% hskip 0.5 em of \tenrm
7079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \boldbrax
7081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % arguments will be output next, if any.
7082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Print arguments in slanted roman (not ttsl), inconsistently with using
7085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% tt for the name.  This is because literal text is sometimes needed in
7086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the argument list (groff manual), and ttsl and tt are not very
7087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% distinguishable.  Prevent hyphenation at `-' chars.
7088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defunargs#1{%
7090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % use sl by default (not ttsl),
7091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % tt for the names.
7092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \df \sl \hyphenchar\font=0
7093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % On the other hand, if an argument has two dashes (for instance), we
7095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % want a way to get ttsl.  We used to recommend @var for that, so
7096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % leave the code in, but it's strange for @var to lead to typewriter.
7097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Nowadays we recommend @code, since the difference between a ttsl hyphen
7098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % and a tt hyphen is pretty tiny.  @code also disables ?` !`.
7099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  #1%
7101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \sl\hyphenchar\font=45
7102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We want ()&[] to print specially on the defun line.
7105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\activeparens{%
7107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\(=\active \catcode`\)=\active
7108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\[=\active \catcode`\]=\active
7109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\&=\active
7110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Make control sequences which act like normal parenthesis chars.
7113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\lparen = ( \let\rparen = )
7114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Be sure that we always have a definition for `(', etc.  For example,
7116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% if the fn name has parens in it, \boldbrax will not be in effect yet,
7117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% so TeX would otherwise complain about undefined control sequence.
7118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
7119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \activeparens
7120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let(=\lparen \global\let)=\rparen
7121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let[=\lbrack \global\let]=\rbrack
7122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\let& = \&
7123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\magicamp{\let&=\amprm}
7126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\parencount
7129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If we encounter &foo, then turn on ()-hacking afterwards
7131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifampseen
7132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\amprm#1 {\ampseentrue{\bf\&#1 }}
7133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\parenfont{%
7135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifampseen
7136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % At the first level, print parens in roman,
7137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % otherwise use the default font.
7138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum \parencount=1 \rm \fi
7139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % The \sf parens (in \boldbrax) actually are a little bolder than
7141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % the contained text.  This is especially needed for [ and ] .
7142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \sf
7143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\infirstlevel#1{%
7146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifampseen
7147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\parencount=1
7148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      #1%
7149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
7150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\bfafterword#1 {#1 \bf}
7153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\opnr{%
7155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\parencount by 1
7156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\parenfont(}%
7157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \infirstlevel \bfafterword
7158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\clnr{%
7160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\parenfont)}%
7161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \infirstlevel \sl
7162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\parencount by -1
7163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\brackcount
7166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lbrb{%
7167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\brackcount by 1
7168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\bf[}%
7169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\rbrb{%
7171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {\bf]}%
7172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\brackcount by -1
7173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\checkparencounts{%
7176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\parencount=0 \else \badparencount \fi
7177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\brackcount=0 \else \badbrackcount \fi
7178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% these should not use \errmessage; the glibc manual, at least, actually
7180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% has such constructs (when documenting function pointers).
7181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\badparencount{%
7182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \message{Warning: unbalanced parentheses in @def...}%
7183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\parencount=0
7184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\badbrackcount{%
7186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \message{Warning: unbalanced square brackets in @def...}%
7187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\brackcount=0
7188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{macros,}
7192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @macro.
7193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% To do this right we need a feature of e-TeX, \scantokens,
7195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% which we arrange to emulate with a temporary file in ordinary TeX.
7196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifx\eTeXversion\thisisundefined
7197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \newwrite\macscribble
7198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\scantokens#1{%
7199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \toks0={#1}%
7200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \immediate\openout\macscribble=\jobname.tmp
7201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \immediate\write\macscribble{\the\toks0}%
7202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \immediate\closeout\macscribble
7203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \input \jobname.tmp
7204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
7205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
7206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\scanmacro#1{\begingroup
7208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \newlinechar`\^^M
7209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\xeatspaces\eatspaces
7210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Undo catcode changes of \startcontents and \doprintindex
7212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % When called from @insertcopying or (short)caption, we need active
7213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % backslash to get it printed correctly.  Previously, we had
7214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \catcode`\\=\other instead.  We'll see whether a problem appears
7215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % with macro expansion.				--kasal, 19aug04
7216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
7217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % ... and for \example:
7219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \spaceisspace
7220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The \empty here causes a following catcode 5 newline to be eaten as
7222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % part of reading whitespace after a control sequence.  It does not
7223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % eat a catcode 13 newline.  There's no good way to handle the two
7224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
7225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % would then have different behavior).  See the Macro Details node in
7226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the manual for the workaround we recommend for macros and
7227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % line-oriented commands.
7228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % 
7229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \scantokens{#1\empty}%
7230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
7231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\scanexp#1{%
7233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\temp{\noexpand\scanmacro{#1}}%
7234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \temp
7235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\paramno   % Count of parameters
7238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newtoks\macname    % Macro name
7239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifrecursive  % Is it recursive?
7240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% List of all defined macros in the form
7242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%    \definedummyword\macro1\definedummyword\macro2...
7243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Currently is also contains all @aliases; the list can be split
7244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% if there is a need.
7245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\macrolist{}
7246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Add the macro to \macrolist
7248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\addtomacrolistxxx#1{%
7250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \toks0 = \expandafter{\macrolist\definedummyword#1}%
7251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \xdef\macrolist{\the\toks0}%
7252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Utility routines.
7255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This does \let #1 = #2, with \csnames; that is,
7256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%   \let \csname#1\endcsname = \csname#2\endcsname
7257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (except of course we have to play expansion games).
7258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\cslet#1#2{%
7260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let
7261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \csname#1\expandafter\endcsname
7262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \csname#2\endcsname
7263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Trim leading and trailing spaces off a string.
7266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Concepts from aro-bend problem 15 (see CTAN).
7267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`\@=11
7268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unbrace#1{#1}
7272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\unbrace{\gdef\trim@@@ #1 } #2@{#1}
7273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Trim a single trailing ^^M off a string.
7276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`\^^M=\other \catcode`\Q=3%
7277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\eatcr #1{\eatcra #1Q^^MQ}%
7278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
7279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\eatcrb#1Q#2Q{#1}%
7280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Macro bodies are absorbed as an argument in a context where
7283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% all characters are catcode 10, 11 or 12, except \ which is active
7284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (as in normal texinfo). It is necessary to change the definition of \
7285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to recognize macro arguments; this is the job of \mbodybackslash.
7286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Non-ASCII encodings make 8-bit characters active, so un-activate
7288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% them to avoid their expansion.  Must do this non-globally, to
7289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% confine the change to the current group.
7290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It's necessary to have hard CRs when the macro is executed. This is
7292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% done by making ^^M (\endlinechar) catcode 12 when reading the macro
7293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% body, and then making it the \newlinechar in \scanmacro.
7294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\scanctxt{% used as subroutine
7296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\"=\other
7297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\+=\other
7298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\<=\other
7299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\>=\other
7300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\@=\other
7301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^=\other
7302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\_=\other
7303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\|=\other
7304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\~=\other
7305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
7306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\scanargctxt{% used for copying and captions, not macros.
7309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \scanctxt
7310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\\=\other
7311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^M=\other
7312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\macrobodyctxt{% used for @macro definitions
7315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \scanctxt
7316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\{=\other
7317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\}=\other
7318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^M=\other
7319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \usembodybackslash
7320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\macroargctxt{% used when scanning invocations
7323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \scanctxt
7324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\\=0
7325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% why catcode 0 for \ in the above?  To recognize \\ \{ \} as "escapes"
7327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% for the single characters \ { }.  Thus, we end up with the "commands"
7328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% that would be written @\ @{ @} in a Texinfo document.
7329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
7330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We already have @{ and @}.  For @\, we define it here, and only for
7331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% this purpose, to produce a typewriter backslash (so, the @\ that we
7332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% define for @math can't be used with @macro calls):
7333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\\{\normalbackslash}%
7335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
7336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We would like to do this for \, too, since that is what makeinfo does.
7337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But it is not possible, because Texinfo already has a command @, for a
7338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% cedilla accent.  Documents must use @comma{} instead.
7339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \anythingelse will almost certainly be an error of some kind.
7341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \mbodybackslash is the definition of \ in @macro bodies.
7344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% It maps \foo\ => \csname macarg.foo\endcsname => #N
7345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% where N is the macro parameter number.
7346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We define \csname macarg.\endcsname to be \realbackslash, so
7347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \\ in macro replacement text gets you a backslash.
7348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`@=0 @catcode`@\=@active
7350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique @gdef@usembodybackslash{@let\=@mbodybackslash}
7351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
7352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\expandafter\def\csname macarg.\endcsname{\realbackslash}
7354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\margbackslash#1{\char`\#1 }
7356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\macro{\recursivefalse\parsearg\macroxxx}
7358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\rmacro{\recursivetrue\parsearg\macroxxx}
7359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\macroxxx#1{%
7361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \getargs{#1}% now \macname is the macname and \argl the arglist
7362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\argl\empty       % no arguments
7363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \paramno=0\relax
7364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \expandafter\parsemargdef \argl;%
7366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \if\paramno>256\relax
7367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \ifx\eTeXversion\thisisundefined
7368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \errhelp = \EMsimple
7369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
7370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \fi
7371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \fi
7372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \if1\csname ismacro.\the\macname\endcsname
7374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \message{Warning: redefining \the\macname}%
7375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \expandafter\ifx\csname \the\macname\endcsname \relax
7377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \else \errmessage{Macro name \the\macname\space already defined}\fi
7378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \global\cslet{macsave.\the\macname}{\the\macname}%
7379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
7380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \addtomacrolist{\the\macname}%
7381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup \macrobodyctxt
7383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifrecursive \expandafter\parsermacbody
7384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \expandafter\parsemacbody
7385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi}
7386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\unmacro{%
7388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \if1\csname ismacro.#1\endcsname
7389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\cslet{#1}{macsave.#1}%
7390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\expandafter\let \csname ismacro.#1\endcsname=0%
7391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Remove the macro name from \macrolist:
7392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \begingroup
7393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\let\csname#1\endcsname \relax
7394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \let\definedummyword\unmacrodo
7395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \xdef\macrolist{\macrolist}%
7396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
7397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Macro #1 not defined}%
7399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Called by \do from \dounmacro on each macro.  The idea is to omit any
7403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% macro definitions that have been changed to \relax.
7404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\unmacrodo#1{%
7406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx #1\relax
7407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % remove this
7408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \noexpand\definedummyword \noexpand#1%
7410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This makes use of the obscure feature that if the last token of a
7414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% <parameter list> is #, then the preceding argument is delimited by
7415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% an opening brace, and that opening brace is not consumed.
7416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getargs#1{\getargsxxx#1{}}
7417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
7418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getmacname#1 #2\relax{\macname={#1}}
7419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getmacargs#1{\def\argl{#1}}
7420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For macro processing make @ a letter so that we can make Texinfo private macro names.
7422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\edef\texiatcatcode{\the\catcode`\@}
7423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode `@=11\relax
7424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Parse the optional {params} list.  Set up \paramno and \paramlist
7426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% so \defmacro knows what to do.  Define \macarg.BLAH for each BLAH
7427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in the params list to some hook where the argument si to be expanded.  If
7428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% there are less than 10 arguments that hook is to be replaced by ##N where N
7429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% is the position in that list, that is to say the macro arguments are to be
7430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% defined `a la TeX in the macro body.  
7431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% That gets used by \mbodybackslash (above).
7433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We need to get `macro parameter char #' into several definitions.
7435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The technique used is stolen from LaTeX: let \hash be something
7436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% unexpandable, insert that wherever you need a #, and then redefine
7437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% it to # just before using the token list produced.
7438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The same technique is used to protect \eatspaces till just before
7440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the macro is used.
7441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If there are 10 or more arguments, a different technique is used, where the
7443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% hook remains in the body, and when macro is to be expanded the body is
7444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% processed again to replace the arguments.
7445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
7447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% argument N value and then \edef  the body (nothing else will expand because of
7448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the catcode regime underwhich the body was input).
7449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If you compile with TeX (not eTeX), and you have macros with 10 or more
7451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% arguments, you need that no macro has more than 256 arguments, otherwise an
7452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% error is produced.
7453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\parsemargdef#1;{%
7454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \paramno=0\def\paramlist{}%
7455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\hash\relax
7456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\xeatspaces\relax
7457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parsemargdefxxx#1,;,%
7458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % In case that there are 10 or more arguments we parse again the arguments
7459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % list to set new definitions for the \macarg.BLAH macros corresponding to
7460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % each BLAH argument. It was anyhow needed to parse already once this list
7461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % in order to count the arguments, and as macros with at most 9 arguments
7462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % are by far more frequent than macro with 10 or more arguments, defining
7463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % twice the \macarg.BLAH macros does not cost too much processing power.
7464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\paramno<10\relax\else
7465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \paramno0\relax
7466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \parsemmanyargdef@@#1,;,% 10 or more arguments
7467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\parsemargdefxxx#1,{%
7470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \if#1;\let\next=\relax
7471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \let\next=\parsemargdefxxx
7472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\paramno by 1
7473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
7474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        {\xeatspaces{\hash\the\paramno}}%
7475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\paramlist{\paramlist\hash\the\paramno,}%
7476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\next}
7477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\parsemmanyargdef@@#1,{%
7479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \if#1;\let\next=\relax
7480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else 
7481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next=\parsemmanyargdef@@
7482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\tempb{\eatspaces{#1}}%
7483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\def\expandafter\tempa
7484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \expandafter{\csname macarg.\tempb\endcsname}%
7485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Note that we need some extra \noexpand\noexpand, this is because we
7486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % don't want \the  to be expanded in the \parsermacbody  as it uses an
7487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \xdef .
7488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\edef\tempa
7489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
7490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\paramno by 1\relax
7491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\next}
7492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% These two commands read recursive and nonrecursive macro bodies.
7494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (They're different since rec and nonrec macros end differently.)
7495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode `\@\texiatcatcode
7498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\parsemacbody#1@end macro%
7499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
7500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\parsermacbody#1@end rmacro%
7501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
7502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode `\@=11\relax
7503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\endargs@\relax
7505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\nil@\relax
7506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\nilm@{\nil@}%
7507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\nillm@{\nil@}%
7508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This macro is expanded during the Texinfo macro expansion, not during its
7510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% definition.  It gets all the arguments values and assigns them to macros
7511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% macarg.ARGNAME
7512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the macro name
7514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #2 is the list of argument names
7515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #3 is the list of argument values
7516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getargvals@#1#2#3{%
7517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\macargdeflist@{}%
7518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
7519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\paramlist{#2,\nil@}%
7520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\macroname{#1}%
7521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
7522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \macroargctxt
7523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\argvaluelist{#3,\nil@}%
7524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\@tempa{#3}%
7525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\@tempa\empty
7526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setemptyargvalues@
7527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \getargvals@@
7529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
7533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getargvals@@{%
7534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\paramlist\nilm@
7535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Some sanity check needed here that \argvaluelist is also empty.
7536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifx\argvaluelist\nillm@
7537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
7538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \errhelp = \EMsimple
7539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \errmessage{Too many arguments in macro `\macroname'!}%
7540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
7541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \let\next\macargexpandinbody@
7542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\argvaluelist\nillm@
7544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % No more arguments values passed to macro.  Set remaining named-arg
7545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % macros to empty.
7546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \let\next\setemptyargvalues@
7547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
7548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % pop current arg name into \@tempb
7549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
7550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\@tempa\expandafter{\paramlist}%
7551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % pop current argument value into \@tempc
7552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
7553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\@tempa\expandafter{\argvaluelist}%
7554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % Here \@tempb is the current arg name and \@tempc is the current arg value.
7555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % First place the new argument macro definition into \@tempd
7556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \expandafter\macname\expandafter{\@tempc}%
7557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \expandafter\let\csname macarg.\@tempb\endcsname\relax
7558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \expandafter\def\expandafter\@tempe\expandafter{%
7559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \csname macarg.\@tempb\endcsname}%
7560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \edef\@tempd{\long\def\@tempe{\the\macname}}%
7561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \push@\@tempd\macargdeflist@
7562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \let\next\getargvals@@
7563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
7564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next
7566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\push@#1#2{%
7569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\expandafter\expandafter\def
7570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\expandafter\expandafter#2%
7571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\expandafter\expandafter{%
7572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter#1#2}%
7573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Replace arguments by their values in the macro body, and place the result
7576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in macro \@tempa
7577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\macvalstoargs@{%
7578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %  To do this we use the property that token registers that are \the'ed
7579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % within an \edef  expand only once. So we are going to place all argument
7580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % values into respective token registers.
7581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % First we save the token context, and initialize argument numbering.
7583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \begingroup
7584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \paramno0\relax
7585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Then, for each argument number #N, we place the corresponding argument
7586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % value into a new token list register \toks#N
7587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\putargsintokens@\saveparamlist@,;,%
7588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Then, we expand the body so that argument are replaced by their
7589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % values. The trick for values not to be expanded themselves is that they
7590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % are within tokens and that tokens expand only once in an \edef .
7591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \edef\@tempc{\csname mac.\macroname .body\endcsname}%
7592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Now we restore the token stack pointer to free the token list registers
7593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % which we have used, but we make sure that expanded body is saved after
7594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % group.
7595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter
7596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
7597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
7598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
7599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\macargexpandinbody@{% 
7601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %% Define the named-macro outside of this group and then close this group. 
7602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter
7603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup
7604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \macargdeflist@
7605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % First the replace in body the macro arguments by their values, the result
7606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % is in \@tempa .
7607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \macvalstoargs@
7608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Then we point at the \norecurse or \gobble (for recursive) macro value
7609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % with \@tempb .
7610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
7611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Depending on whether it is recursive or not, we need some tailing
7612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \egroup .
7613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\@tempb\gobble
7614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \let\@tempc\relax
7615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \let\@tempc\egroup
7617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % And now we do the real job:
7619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
7620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \@tempd
7621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\putargsintokens@#1,{%
7624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \if#1;\let\next\relax
7625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next\putargsintokens@
7627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % First we allocate the new token list register, and give it a temporary
7628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % alias \@tempb .
7629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \toksdef\@tempb\the\paramno
7630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Then we place the argument value into that token list register.
7631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
7632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\@tempb\expandafter{\@tempa}%
7633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\paramno by 1\relax
7634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next
7636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Save the token stack pointer into macro #1
7639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
7640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Restore the token stack pointer from number in macro #1
7641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
7642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% newtoks that can be used non \outer .
7643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
7644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Tailing missing arguments are set to empty
7646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setemptyargvalues@{%
7647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\paramlist\nilm@
7648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next\macargexpandinbody@
7649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\setemptyargvaluesparser@\paramlist\endargs@
7651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\next\setemptyargvalues@
7652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next
7654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setemptyargvaluesparser@#1,#2\endargs@{%
7657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\def\expandafter\@tempa\expandafter{%
7658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\def\csname macarg.#1\endcsname{}}%
7659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \push@\@tempa\macargdeflist@
7660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\paramlist{#2}%
7661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the element target macro
7664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #2 is the list macro
7665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #3,#4\endargs@ is the list value
7666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pop@#1#2#3,#4\endargs@{%
7667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \def#1{#3}%
7668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \def#2{#4}%
7669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\long\def\longpop@#1#2#3,#4\endargs@{%
7671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \long\def#1{#3}%
7672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \long\def#2{#4}%
7673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This defines a Texinfo @macro. There are eight cases: recursive and
7676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% nonrecursive macros of zero, one, up to nine, and many arguments.
7677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Much magic with \expandafter here.
7678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \xdef is used so that macro definitions will survive the file
7679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% they're defined in; @include reads the file inside a group.
7680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defmacro{%
7682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\hash=##% convert placeholders to macro parameter chars
7683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifrecursive
7684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifcase\paramno
7685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % 0
7686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\xdef\csname\the\macname\endcsname{%
7687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \noexpand\scanmacro{\temp}}%
7688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \or % 1
7689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\xdef\csname\the\macname\endcsname{%
7690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \bgroup\noexpand\macroargctxt
7691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \noexpand\braceorline
7692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
7693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
7694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \egroup\noexpand\scanmacro{\temp}}%
7695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
7696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifnum\paramno<10\relax % at most 9
7697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\xdef\csname\the\macname\endcsname{%
7698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique           \bgroup\noexpand\macroargctxt
7699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique           \noexpand\csname\the\macname xx\endcsname}%
7700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
7701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
7702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\expandafter
7703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\xdef
7704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\expandafter
7705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \csname\the\macname xxx\endcsname
7706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \paramlist{\egroup\noexpand\scanmacro{\temp}}%
7707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else % 10 or more
7708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\xdef\csname\the\macname\endcsname{%
7709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \noexpand\getargvals@{\the\macname}{\argl}%
7710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        }%    
7711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
7712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
7713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
7714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
7715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifcase\paramno
7717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % 0
7718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\xdef\csname\the\macname\endcsname{%
7719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \noexpand\norecurse{\the\macname}%
7720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \noexpand\scanmacro{\temp}\egroup}%
7721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \or % 1
7722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\xdef\csname\the\macname\endcsname{%
7723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \bgroup\noexpand\macroargctxt
7724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \noexpand\braceorline
7725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
7726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
7727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \egroup
7728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \noexpand\norecurse{\the\macname}%
7729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \noexpand\scanmacro{\temp}\egroup}%
7730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else % at most 9
7731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifnum\paramno<10\relax
7732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\xdef\csname\the\macname\endcsname{%
7733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique           \bgroup\noexpand\macroargctxt
7734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique           \expandafter\noexpand\csname\the\macname xx\endcsname}%
7735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
7736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
7737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\expandafter
7738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\xdef
7739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\expandafter
7740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \csname\the\macname xxx\endcsname
7741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \paramlist{%
7742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \egroup
7743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \noexpand\norecurse{\the\macname}%
7744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique            \noexpand\scanmacro{\temp}\egroup}%
7745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else % 10 or more:
7746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter\xdef\csname\the\macname\endcsname{%
7747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \noexpand\getargvals@{\the\macname}{\argl}%
7748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        }%
7749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
7750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
7751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
7752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
7753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi}
7754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode `\@\texiatcatcode\relax
7756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
7758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \braceorline decides whether the next nonwhitespace character is a
7760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% {.  If so it reads up to the closing }, if not, it reads the whole
7761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% line.  Whatever was read is then fed to the next control sequence
7762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% as an argument (by \parsebrace or \parsearg).
7763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
7764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
7765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\braceorlinexxx{%
7766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\nchar\bgroup\else
7767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\parsearg
7768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi \macnamexxx}
7769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @alias.
7772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We need some trickery to remove the optional spaces around the equal
7773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% sign.  Make them active and then expand them all to nothing.
7774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\alias{\parseargusing\obeyspaces\aliasxxx}
7776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\aliasxxx #1{\aliasyyy#1\relax}
7777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\aliasyyy #1=#2\relax{%
7778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
7779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\obeyedspace=\empty
7780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \addtomacrolist{#1}%
7781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
7782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
7783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next
7784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{cross references,}
7788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newwrite\auxfile
7790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifhavexrefs    % True if xref values are known.
7791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
7792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @inforef is relatively simple.
7794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\inforef #1{\inforefzzz #1,,,,**}
7795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\inforefzzz #1,#2,#3,#4**{%
7796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
7797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  node \samp{\ignorespaces#1{}}}
7798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @node's only job in TeX is to define \lastnode, which is used in
7800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% cross-references.  The @node line might or might not have commas, and
7801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% might or might not have spaces before the first comma, like:
7802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @node foo , bar , ...
7803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We don't want such trailing spaces in the node name.
7804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
7806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% also remove a trailing comma, in case of something like this:
7808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @node Help-Cross,  ,  , Cross-refs
7809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
7810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
7811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\nwnode=\node
7813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\lastnode=\empty
7814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Write a cross-reference definition for the current node.  #1 is the
7816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% type (Ynumbered, Yappendix, Ynothing).
7817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\donoderef#1{%
7819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\lastnode\empty\else
7820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setref{\lastnode}{#1}%
7821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\let\lastnode=\empty
7822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @anchor{NAME} -- define xref target at arbitrary point.
7826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\savesfregister
7828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
7830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
7831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
7832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
7834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% anchor), which consists of three parts:
7835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 1) NAME-title - the current sectioning name taken from \lastsection,
7836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%                 or the anchor name.
7837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 2) NAME-snt   - section number and type, passed as the SNT arg, or
7838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%                 empty for anchors.
7839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 3) NAME-pg    - the page number.
7840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is called from \donoderef, \anchor, and \dofloat.  In the case of
7842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% floats, there is an additional part, which is not written here:
7843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 4) NAME-lof   - the text as it should appear in a @listoffloats.
7844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setref#1#2{%
7846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pdfmkdest{#1}%
7847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \iflinks
7848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {%
7849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \atdummies  % preserve commands, but don't expand them
7850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \edef\writexrdef##1##2{%
7851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
7852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  ##1}{##2}}% these are parameters of \writexrdef
7853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
7854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \toks0 = \expandafter{\lastsection}%
7855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \immediate \writexrdef{title}{\the\toks0 }%
7856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
7857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
7858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
7859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @xrefautosectiontitle on|off says whether @section(ing) names are used
7863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% automatically in xrefs, if the third arg is not explicitly specified.
7864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This was provided as a "secret" @set xref-automatic-section-title
7865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% variable, now it's official.
7866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
7867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\xrefautomaticsectiontitle{%
7868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
7869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\onword
7870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname SETxref-automatic-section-title\endcsname
7871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      = \empty
7872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else\ifx\temp\offword
7873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\csname SETxref-automatic-section-title\endcsname
7874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      = \relax
7875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \EMsimple
7877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
7878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                must be on|off}%
7879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
7880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
7881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
7882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
7883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
7884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the node name, #2 the name of the Info cross-reference, #3 the printed
7885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% node name, #4 the name of the Info file, #5 the name of the printed
7886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% manual.  All but the node name can be omitted.
7887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
7889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
7890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ref#1{\xrefX[#1,,,,,,,]}
7891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\toprefbox
7893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\printedrefnamebox
7894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\infofilenamebox
7895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newbox\printedmanualbox
7896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
7897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
7898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \unsepspaces
7899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Get args without leading/trailing spaces.
7901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\printedrefname{\ignorespaces #3}%
7902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
7903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\infofilename{\ignorespaces #4}%
7905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
7906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\printedmanual{\ignorespaces #5}%
7908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
7909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If the printed reference name (arg #3) was not explicitly given in
7911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % the @xref, figure out what we want to use.
7912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim \wd\printedrefnamebox = 0pt
7913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % No printed node name was explicitly given.
7914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
7915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Not auto section-title: use node name inside the square brackets.
7916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\printedrefname{\ignorespaces #1}%
7917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
7918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Auto section-title: use chapter/section title inside
7919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % the square brackets if we have it.
7920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifdim \wd\printedmanualbox > 0pt
7921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % It is in another manual, so we don't have it; use node name.
7922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \def\printedrefname{\ignorespaces #1}%
7923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
7924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \ifhavexrefs
7925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          % We (should) know the real title if we have the xref values.
7926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \def\printedrefname{\refx{#1-title}{}}%
7927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \else
7928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          % Otherwise just copy the Info node name.
7929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \def\printedrefname{\ignorespaces #1}%
7930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \fi%
7931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
7932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
7933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Make link in pdf output.
7936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifpdf
7937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {\indexnofonts
7938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \turnoffactive
7939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \makevalueexpandable
7940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     % This expands tokens, so do it after making catcode changes, so _
7941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     % etc. don't get their TeX definitions.  This ignores all spaces in
7942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     % #4, including (wrongly) those in the middle of the filename.
7943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \getfilename{#4}%
7944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     %
7945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     % This (wrongly) does not take account of leading or trailing
7946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     % spaces in #1, which should be ignored.
7947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \edef\pdfxrefdest{#1}%
7948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \ifx\pdfxrefdest\empty
7949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \def\pdfxrefdest{Top}% no empty targets
7950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \else
7951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \txiescapepdf\pdfxrefdest  % escape PDF special chars
7952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \fi
7953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     %
7954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \leavevmode
7955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \startlink attr{/Border [0 0 0]}%
7956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \ifnum\filenamelength>0
7957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       goto file{\the\filename.pdf} name{\pdfxrefdest}%
7958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \else
7959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       goto name{\pdfmkpgn{\pdfxrefdest}}%
7960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \fi
7961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
7962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setcolor{\linkcolor}%
7963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
7964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
7965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Float references are printed completely differently: "Figure 1.2"
7966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % instead of "[somenode], p.3".  We distinguish them by the
7967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % LABEL-title being set to a magic string.
7968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
7969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Have to otherify everything special to allow the \csname to
7970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % include an _ in the xref name, etc.
7971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indexnofonts
7972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \turnoffactive
7973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\global\expandafter\let\expandafter\Xthisreftitle
7974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \csname XR#1-title\endcsname
7975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
7976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \iffloat\Xthisreftitle
7977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If the user specified the print name (third arg) to the ref,
7978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % print it instead of our usual "Figure 1.2".
7979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim\wd\printedrefnamebox = 0pt
7980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \refx{#1-snt}{}%
7981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
7982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \printedrefname
7983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
7984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
7985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If the user also gave the printed manual name (fifth arg), append
7986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % "in MANUALNAME".
7987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim \wd\printedmanualbox > 0pt
7988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \space \putwordin{} \cite{\printedmanual}%
7989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
7990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
7991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % node/anchor (non-float) references.
7992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % 
7993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If we use \unhbox to print the node names, TeX does not insert
7994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % empty discretionaries after hyphens, which means that it will not
7995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % find a line break at a hyphen in a node names.  Since some manuals
7996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % are best written with fairly long node names, containing hyphens,
7997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % this is a loss.  Therefore, we give the text of the node name
7998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % again, so it is as if TeX is seeing it for the first time.
7999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % 
8000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim \wd\printedmanualbox > 0pt
8001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Cross-manual reference with a printed manual name.
8002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % 
8003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \crossmanualxref{\cite{\printedmanual\unskip}}%
8004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifdim \wd\infofilenamebox > 0pt
8006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Cross-manual reference with only an info filename (arg 4), no
8007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % printed manual name (arg 5).  This is essentially the same as
8008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % the case above; we output the filename, since we have nothing else.
8009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % 
8010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \crossmanualxref{\code{\infofilename\unskip}}%
8011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
8013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Reference within this manual.
8014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
8015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % _ (for example) has to be the character _ for the purposes of the
8016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % control sequence corresponding to the node, but it has to expand
8017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % into the usual \leavevmode...\vrule stuff for purposes of
8018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % printing. So we \turnoffactive for the \refx-snt, back on for the
8019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % printing, back off for the \refx-pg.
8020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      {\turnoffactive
8021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % Only output a following space if the -snt ref is nonempty; for
8022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       % @unnumbered and @anchor, it won't be.
8023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
8024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
8026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % output the `[mynode]' via the macro below so it can be overridden.
8027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \xrefprintnodename\printedrefname
8028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
8029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % But we always want a comma and a space:
8030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      ,\space
8031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
8032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % output the `page 3'.
8033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
8034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi\fi
8035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endlink
8037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
8038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Output a cross-manual xref to #1.  Used just above (twice).
8040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
8041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Only include the text "Section ``foo'' in" if the foo is neither
8042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
8043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% "see The Foo Manual", the idea being to refer to the whole manual.
8044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
8045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% But, this being TeX, we can't easily compare our node name against the
8046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% string "Top" while ignoring the possible spaces before and after in
8047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the input.  By adding the arbitrary 7sp below, we make it much less
8048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% likely that a real node name would have the same width as "Top" (e.g.,
8049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in a monospaced font).  Hopefully it will never happen in practice.
8050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
8051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For the same basic reason, we retypeset the "Top" at every
8052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% reference, since the current font is indeterminate.
8053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 
8054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\crossmanualxref#1{%
8055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox\toprefbox = \hbox{Top\kern7sp}%
8056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
8057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifdim \wd2 > 7sp  % nonempty?
8058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
8059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \putwordSection{} ``\printedrefname'' \putwordin{}\space
8060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  #1%
8063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This macro is called from \xrefX for the `[nodename]' part of xref
8066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% output.  It's a separate macro only so it can be changed more easily,
8067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% since square brackets don't work well in some documents.  Particularly
8068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% one that Bob is working on :).
8069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xrefprintnodename#1{[#1]}
8071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Things referred to by \setref.
8073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Ynothing{}
8075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Yomitfromtoc{}
8076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Ynumbered{%
8077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\secno=0
8078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \putwordChapter@tie \the\chapno
8079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifnum\subsecno=0
8080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \putwordSection@tie \the\chapno.\the\secno
8081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifnum\subsubsecno=0
8082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
8083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
8085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi
8086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Yappendix{%
8088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifnum\secno=0
8089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \putwordAppendix@tie @char\the\appendixno{}%
8090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifnum\subsecno=0
8091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \putwordSection@tie @char\the\appendixno.\the\secno
8092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifnum\subsubsecno=0
8093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
8094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \putwordSection@tie
8096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
8097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi\fi
8098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
8101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If its value is nonempty, SUFFIX is output afterward.
8102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\refx#1#2{%
8104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
8105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indexnofonts
8106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \otherbackslash
8107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\global\expandafter\let\expandafter\thisrefX
8108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \csname XR#1\endcsname
8109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
8110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\thisrefX\relax
8111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If not defined, say something at least.
8112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \angleleft un\-de\-fined\angleright
8113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \iflinks
8114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifhavexrefs
8115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        {\toks0 = {#1}% avoid expansion of possibly-complex value
8116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique         \message{\linenumber Undefined cross reference `\the\toks0'.}}%
8117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \else
8118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \ifwarnedxrefs\else
8119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \global\warnedxrefstrue
8120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique          \message{Cross reference values unknown; you must run TeX again.}%
8121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \fi
8122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
8123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % It's defined, so just use it.
8126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \thisrefX
8127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  #2% Output the suffix in any case.
8129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is the macro invoked by entries in the aux file.  Usually it's
8132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% just a \def (we prepend XR to the control sequence name to avoid
8133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% collisions).  But if this is a float type, we have more work to do.
8134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\xrdef#1#2{%
8136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {% The node name might contain 8-bit characters, which in our current
8137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % implementation are changed to commands like @'e.  Don't let these
8138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   % mess up the control sequence name.
8139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indexnofonts
8140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \turnoffactive
8141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef\safexrefname{#1}%
8142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
8143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
8145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Was that xref control sequence that we just defined for a float?
8147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\iffloat\csname XR\safexrefname\endcsname
8148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % it was a float, and we have the (safe) float type in \iffloattype.
8149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\let\expandafter\floatlist
8150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \csname floatlist\iffloattype\endcsname
8151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Is this the first time we've seen this float type?
8153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\ifx\floatlist\relax
8154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \toks0 = {\do}% yes, so just \do
8155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
8156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % had it before, so preserve previous elements in list.
8157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \toks0 = \expandafter{\floatlist\do}%
8158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Remember this xref in the control sequence \floatlistFLOATTYPE,
8161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % for later use in \listoffloats.
8162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
8163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      {\safexrefname}}%
8164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Read the last existing aux file, if any.  No error if none exists.
8168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\tryauxfile{%
8170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \openin 1 \jobname.aux
8171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifeof 1 \else
8172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \readdatafile{aux}%
8173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\havexrefstrue
8174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \closein 1
8176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setupdatafile{%
8179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^@=\other
8180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^A=\other
8181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^B=\other
8182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^C=\other
8183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^D=\other
8184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^E=\other
8185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^F=\other
8186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^G=\other
8187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^H=\other
8188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^K=\other
8189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^L=\other
8190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^N=\other
8191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^P=\other
8192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^Q=\other
8193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^R=\other
8194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^S=\other
8195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^T=\other
8196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^U=\other
8197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^V=\other
8198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^W=\other
8199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^X=\other
8200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^Z=\other
8201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^[=\other
8202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^\=\other
8203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^]=\other
8204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^^=\other
8205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^_=\other
8206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
8207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
8208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % supported in the main text, it doesn't seem desirable.  Furthermore,
8209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % that is not enough: for node names that actually contain a ^
8210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % character, we would end up writing a line like this: 'xrdef {'hat
8211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
8212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % argument, and \hat is not an expandable control sequence.  It could
8213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % all be worked out, but why?  Either we support ^^ or we don't.
8214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % The other change necessary for this was to define \auxhat:
8216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
8217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % and then to call \auxhat in \setq.
8218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^=\other
8220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Special characters.  Should be turned off anyway, but...
8222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\~=\other
8223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\[=\other
8224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\]=\other
8225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\"=\other
8226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\_=\other
8227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\|=\other
8228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\<=\other
8229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\>=\other
8230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\$=\other
8231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\#=\other
8232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\&=\other
8233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\%=\other
8234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
8235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % This is to support \ in node names and titles, since the \
8237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % characters end up in a \csname.  It's easier than
8238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % leaving it active and making its active definition an actual \
8239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % character.  What I don't understand is why it works in the *value*
8240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % of the xrdef.  Seems like it should be a catcode12 \, and that
8241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % should not typeset properly.  But it works, so I'm moving on for
8242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % now.  --karl, 15jan04.
8243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\\=\other
8244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Make the characters 128-255 be printing characters.
8246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
8247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \count1=128
8248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\loop{%
8249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \catcode\count1=\other
8250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \advance\count1 by 1
8251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifnum \count1<256 \loop \fi
8252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    }%
8253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
8254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @ is our escape character in .aux files, and we need braces.
8256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\{=1
8257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\}=2
8258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\@=0
8259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\readdatafile#1{%
8262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
8263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setupdatafile
8264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \input\jobname.#1
8265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
8266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{insertions,}
8269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% including footnotes.
8270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount \footnoteno
8272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The trailing space in the following definition for supereject is
8274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% vital for proper filling; pages come out unaligned when you do a
8275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% pagealignmacro call if that space before the closing brace is
8276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% removed. (Generally, numeric constants should always be followed by a
8277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% space to prevent strange expansion errors.)
8278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\supereject{\par\penalty -20000\footnoteno =0 }
8279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @footnotestyle is meaningful for Info output only.
8281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\footnotestyle=\comment
8282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode `\@=11
8284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Auto-number footnotes.  Otherwise like plain.
8286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\footnote{%
8287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\indent=\ptexindent
8288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\noindent=\ptexnoindent
8289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\advance\footnoteno by \@ne
8290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\thisfootno{$^{\the\footnoteno}$}%
8291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % In case the footnote comes at the end of a sentence, preserve the
8293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % extra spacing after we do the footnote number.
8294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\@sf\empty
8295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
8296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Remove inadvertent blank space before typesetting the footnote number.
8298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \unskip
8299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \thisfootno\@sf
8300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dofootnote
8301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}%
8302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Don't bother with the trickery in plain.tex to not require the
8304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% footnote text as a parameter.  Our footnotes don't need to be so general.
8305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Oh yes, they do; otherwise, @ifset (and anything else that uses
8307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \parseargline) fails inside footnotes because the tokens are fixed when
8308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the footnote is read.  --karl, 16nov96.
8309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\dofootnote{%
8311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \insert\footins\bgroup
8312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We want to typeset this text as a normal paragraph, even if the
8313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % footnote reference occurs in (for example) a display environment.
8314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % So reset some parameters.
8315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hsize=\pagewidth
8316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \interlinepenalty\interfootnotelinepenalty
8317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \splittopskip\ht\strutbox % top baseline for broken footnotes
8318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \splitmaxdepth\dp\strutbox
8319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \floatingpenalty\@MM
8320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \leftskip\z@skip
8321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \rightskip\z@skip
8322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \spaceskip\z@skip
8323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \xspaceskip\z@skip
8324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent\defaultparindent
8325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \smallfonts \rm
8327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Because we use hanging indentation in footnotes, a @noindent appears
8329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % to exdent this text, so make it be a no-op.  makeinfo does not use
8330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % hanging indentation so @noindent can still be needed within footnote
8331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % text after an @example or the like (not that this is good style).
8332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\noindent = \relax
8333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Hang the footnote text off the number.  Use \everypar in case the
8335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % footnote extends for more than one paragraph.
8336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \everypar = {\hang}%
8337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textindent{\thisfootno}%
8338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Don't crash into the line above the footnote text.  Since this
8340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % expands into a box, it must come within the paragraph, lest it
8341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % provide a place where TeX can split the footnote.
8342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \footstrut
8343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Invoke rest of plain TeX footnote routine.
8345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \futurelet\next\fo@t
8346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}%end \catcode `\@=11
8348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% In case a @footnote appears in a vbox, save the footnote text and create
8350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the real \insert just after the vbox finished.  Otherwise, the insertion
8351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% would be lost.
8352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Similarly, if a @footnote appears inside an alignment, save the footnote
8353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% text to a box and make the \insert when a row of the table is finished.
8354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% And the same can be done for other insert classes.  --kasal, 16nov03.
8355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Replace the \insert primitive by a cheating macro.
8357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Deeper inside, just make sure that the saved insertions are not spilled
8358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% out prematurely.
8359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\startsavinginserts{%
8361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx \insert\ptexinsert
8362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\insert\saveinsert
8363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\checkinserts\relax
8365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This \insert replacement works for both \insert\footins{foo} and
8369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
8370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\saveinsert#1{%
8372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\next{\noexpand\savetobox \makeSAVEname#1}%
8373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \afterassignment\next
8374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % swallow the left brace
8375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\temp =
8376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
8378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
8379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
8381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\placesaveins#1{%
8383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
8384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    {\box#1}%
8385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% eat @SAVE -- beware, all of them have catcode \other:
8388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
8389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
8390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\gobblesave @SAVE{}
8391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% initialization:
8394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\newsaveins #1{%
8395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
8396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \next
8397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\newsaveinsX #1{%
8399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \csname newbox\endcsname #1%
8400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
8401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \checksaveins #1}%
8402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% initialize:
8405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\checkinserts\empty
8406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newsaveins\footins
8407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newsaveins\margin
8408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @image.  We use the macros from epsf.tex to support this.
8411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If epsf.tex is not installed and @image is used, we complain.
8412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Check for and read epsf.tex up front.  If we read it only at @image
8414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% time, we might be inside a group, and then its definitions would get
8415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% undone and the next image would fail.
8416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\openin 1 = epsf.tex
8417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\ifeof 1 \else
8418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Do not bother showing banner with epsf.tex v2.7k (available in
8419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % doc/epsf.tex and on ctan).
8420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\epsfannounce{\toks0 = }%
8421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \input epsf.tex
8422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\fi
8423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\closein 1
8424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We will only complain once about lack of epsf.tex.
8426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifwarnednoepsf
8427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newhelp\noepsfhelp{epsf.tex must be installed for images to
8428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  work.  It is also included in the Texinfo distribution, or you can get
8429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  it from ftp://tug.org/tex/epsf.tex.}
8430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\image#1{%
8432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\epsfbox\thisisundefined
8433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifwarnednoepsf \else
8434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \errhelp = \noepsfhelp
8435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \errmessage{epsf.tex not found, images will be ignored}%
8436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\warnednoepsftrue
8437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \imagexxx #1,,,,,\finish
8440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Arguments to @image:
8444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is (mandatory) image filename; we tack on .eps extension.
8445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #2 is (optional) width, #3 is (optional) height.
8446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #4 is (ignored optional) html alt text.
8447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #5 is (ignored optional) extension.
8448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #6 is just the usual extra ignored arg for parsing stuff.
8449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newif\ifimagevmode
8450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
8451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\^^M = 5     % in case we're inside an example
8452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \normalturnoffactive  % allow _ et al. in names
8453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If the image is by itself, center it.
8454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifvmode
8455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \imagevmodetrue
8456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifx\centersub\centerV
8457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % for @center @image, we need a vbox so we can have our vertical space
8458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \imagevmodetrue
8459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vbox\bgroup % vbox has better behavior than vtop herev
8460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi\fi
8461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifimagevmode
8463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak\medskip
8464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Usually we'll have text after the image which will insert
8465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \parskip glue, so insert it here too to equalize the space
8466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % above and below.
8467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak\vskip\parskip
8468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \nobreak
8469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Leave vertical mode so that indentation from an enclosing
8472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %  environment such as @quotation is respected.
8473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % However, if we're at the top level, we don't want the
8474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %  normal paragraph indentation.
8475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % On the other hand, if we are in the case of @center @image, we don't
8476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %  want to start a paragraph, which will create a hsize-width box and
8477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %  eradicate the centering.
8478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\centersub\centerV\else \noindent \fi
8479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Output the image.
8481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifpdf
8482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \dopdfimage{#1}{#2}{#3}%
8483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \epsfbox itself resets \epsf?size at each figure.
8485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
8486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
8487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \epsfbox{#1.eps}%
8488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifimagevmode
8491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \medskip  % space after a standalone image
8492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi  
8493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\centersub\centerV \egroup \fi
8494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
8495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
8498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% etc.  We don't actually implement floating yet, we always include the
8499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% float "here".  But it seemed the best name for the future.
8500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
8502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% There may be a space before second and/or third parameter; delete it.
8504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\eatcommaspace#1, {#1,}
8505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the optional FLOATTYPE, the text label for this float, typically
8507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
8508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% this float will not be numbered and cannot be referred to.
8509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #2 is the optional xref label.  Also must be present for the float to
8511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% be referable.
8512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #3 is the optional positioning argument; for now, it is ignored.  It
8514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% will somehow specify the positions allowed to float to (here, top, bottom).
8515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We keep a separate counter for each FLOATTYPE, which we reset at each
8517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% chapter-level command.
8518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\resetallfloatnos=\empty
8519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\dofloat#1,#2,#3,#4\finish{%
8521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\thiscaption=\empty
8522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\thisshortcaption=\empty
8523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % don't lose footnotes inside @float.
8525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % BEWARE: when the floats start float, we have to issue warning whenever an
8527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % insert appears inside a float which could possibly float. --kasal, 26may04
8528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \startsavinginserts
8530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % We can't be used inside a paragraph.
8532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \par
8533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vtop\bgroup
8535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\floattype{#1}%
8536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\floatlabel{#2}%
8537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\floatloc{#3}% we do nothing with this yet.
8538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\floattype\empty
8540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \let\safefloattype=\empty
8541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
8542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      {%
8543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % the floattype might have accents or other special characters,
8544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % but we need to use it in a control sequence name.
8545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \indexnofonts
8546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \turnoffactive
8547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \xdef\safefloattype{\floattype}%
8548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
8549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If label is given but no type, we handle that as the empty type.
8552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\floatlabel\empty \else
8553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % We want each FLOATTYPE to be numbered separately (Figure 1,
8554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Table 1, Figure 2, ...).  (And if no label, no number.)
8555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
8556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\getfloatno\csname\safefloattype floatno\endcsname
8557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\advance\floatno by 1
8558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
8559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      {%
8560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % This magic value for \lastsection is output by \setref as the
8561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % XREFLABEL-title value.  \xrefX uses it to distinguish float
8562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % labels (which have a completely different output format) from
8563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % node and anchor labels.  And \xrdef uses it to construct the
8564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % lists of floats.
8565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        %
8566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \edef\lastsection{\floatmagic=\safefloattype}%
8567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \setref{\floatlabel}{Yfloat}%
8568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
8569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % start with \parskip glue, I guess.
8572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \vskip\parskip
8573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Don't suppress indentation if a float happens to start a section.
8575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \restorefirstparagraphindent
8576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% we have these possibilities:
8579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
8580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float Foo,lbl & no caption:    Foo 1.1
8581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float Foo & @caption{Cap}:     Foo: Cap
8582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float Foo & no caption:        Foo
8583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float ,lbl & Caption{Cap}:     1.1: Cap
8584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float ,lbl & no caption:       1.1
8585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float & @caption{Cap}:         Cap
8586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @float & no caption:
8587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Efloat{%
8589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\floatident = \empty
8590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % In all cases, if we have a float type, it comes first.
8592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\floattype\empty \else \def\floatident{\floattype}\fi
8593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If we have an xref label, the number comes next.
8595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\floatlabel\empty \else
8596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifx\floattype\empty \else % if also had float type, need tie first.
8597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \appendtomacro\floatident{\tie}%
8598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
8599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % the number.
8600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
8601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Start the printed caption with what we've constructed in
8604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % \floatident, but keep it separate; we need \floatident again.
8605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \let\captionline = \floatident
8606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\thiscaption\empty \else
8608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \ifx\floatident\empty \else
8609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\appendtomacro\captionline{: }% had ident, so need a colon between
8610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \fi
8611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
8612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % caption text.
8613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \appendtomacro\captionline{\scanexp\thiscaption}%
8614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If we have anything to print, print it, with space before.
8617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Eventually this needs to become an \insert.
8618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\captionline\empty \else
8619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \vskip.5\parskip
8620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \captionline
8621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
8622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Space below caption.
8623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \vskip\parskip
8624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %
8626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % If have an xref label, write the list of floats info.  Do this
8627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % after the caption, to avoid chance of it being a breakpoint.
8628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifx\floatlabel\empty \else
8629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Write the text that goes in the lof to the aux file as
8630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % \floatlabel-lof.  Besides \floatident, we include the short
8631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % caption if specified, else the full caption if specified, else nothing.
8632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      {%
8633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \atdummies
8634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        %
8635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % since we read the caption text in the macro world, where ^^M
8636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % is turned into a normal character, we have to scan it back, so
8637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        % we don't write the literal three characters "^^M" into the aux file.
8638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	\scanexp{%
8639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \xdef\noexpand\gtemp{%
8640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	    \ifx\thisshortcaption\empty
8641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \thiscaption
8642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	    \else
8643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	      \thisshortcaption
8644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	    \fi
8645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  }%
8646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	}%
8647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
8648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique	  \ifx\gtemp\empty \else : \gtemp \fi}}%
8649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      }%
8650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \egroup  % end of \vtop
8652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % place the captured inserts
8654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % BEWARE: when the floats start floating, we have to issue warning
8656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % whenever an insert appears inside a float which could possibly
8657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % float. --kasal, 26may04
8658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \checkinserts
8660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Append the tokens #2 to the definition of macro #1, not expanding either.
8663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\appendtomacro#1#2{%
8665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\def\expandafter#1\expandafter{#1#2}%
8666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @caption, @shortcaption
8669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\caption{\docaption\thiscaption}
8671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\shortcaption{\docaption\thisshortcaption}
8672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
8673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\defcaption#1#2{\egroup \def#1{#2}}
8674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The parameter is the control sequence identifying the counter we are
8676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% going to use.  Create it if it doesn't exist and assign it to \floatno.
8677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\getfloatno#1{%
8678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx#1\relax
8679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Haven't seen this figure type before.
8680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \csname newcount\endcsname #1%
8681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      %
8682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % Remember to reset this floatno at the next chap.
8683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\gdef\expandafter\resetallfloatnos
8684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \expandafter{\resetallfloatnos #1=0 }%
8685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let\floatno#1%
8687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \setref calls this to get the XREFLABEL-snt value.  We want an @xref
8690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
8691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% first read the @float command.
8692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
8694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Magic string used for the XREFLABEL-title value, so \xrefX can
8696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% distinguish floats from other xref types.
8697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\floatmagic{!!float!!}
8698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is the control sequence we are passed; we expand into a conditional
8700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% which is true if #1 represents a float ref.  That is, the magic
8701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \lastsection value which we \setref above.
8702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\iffloat#1{\expandafter\doiffloat#1==\finish}
8704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is (maybe) the \floatmagic string.  If so, #2 will be the
8706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (safe) float type for this float.  We set \iffloattype to #2.
8707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\doiffloat#1=#2=#3\finish{%
8709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\temp{#1}%
8710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\iffloattype{#2}%
8711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\temp\floatmagic
8712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
8715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\listoffloats{%
8717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\floattype{#1}% floattype
8718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  {%
8719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % the floattype might have accents or other special characters,
8720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % but we need to use it in a control sequence name.
8721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \indexnofonts
8722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \turnoffactive
8723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef\safefloattype{\floattype}%
8724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }%
8725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
8727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
8728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifhavexrefs
8729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      % if the user said @listoffloats foo but never @float foo.
8730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \message{\linenumber No `\safefloattype' floats to list.}%
8731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \begingroup
8734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \leftskip=\tocindent  % indent these entries like a toc
8735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \let\do=\listoffloatsdo
8736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \csname floatlist\safefloattype\endcsname
8737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup
8738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is called on each entry in a list of floats.  We're passed the
8742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% xref label, in the form LABEL-title, which is how we save it in the
8743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% aux file.  We strip off the -title and look up \XRLABEL-lof, which
8744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% has the text we're supposed to typeset here.
8745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Figures without xref labels will not be included in the list (since
8747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% they won't appear in the aux file).
8748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
8750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\listoffloatsdoentry#1-title\finish{{%
8751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Can't fully expand XR#1-lof because it can contain anything.  Just
8752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % pass the control sequence.  On the other hand, XR#1-pg is just the
8753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % page number, and we want to fully expand that so we can get a link
8754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % in pdf output.
8755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \toksA = \expandafter{\csname XR#1-lof\endcsname}%
8756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % use the same \entry macro we use to generate the TOC and index.
8758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
8759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \writeentry
8760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
8761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{localization,}
8764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% For single-language documents, @documentlanguage is usually given very
8766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% early, just after @documentencoding.  Single argument is the language
8767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (de) or locale (de_DE) abbreviation.
8768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{
8770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\_ = \active
8771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \globaldefs=1
8772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\documentlanguage{\begingroup
8773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \let_=\normalunderscore  % normal _ character for filenames
8774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tex % read txi-??.tex file in plain TeX.
8775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Read the file by the name they passed if it exists.
8776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \openin 1 txi-#1.tex
8777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifeof 1
8778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \documentlanguagetrywithoutunderscore{#1_\finish}%
8779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
8780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \globaldefs = 1  % everything in the txi-LL files needs to persist
8781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \input txi-#1.tex
8782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi
8783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \closein 1
8784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \endgroup % end raw TeX
8785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup}
8786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If they passed de_DE, and txi-de_DE.tex doesn't exist,
8788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% try txi-de.tex.
8789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
8791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \openin 1 txi-#1.tex
8792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifeof 1
8793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errhelp = \nolanghelp
8794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \errmessage{Cannot read language file txi-#1.tex}%
8795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \globaldefs = 1  % everything in the txi-LL files needs to persist
8797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \input txi-#1.tex
8798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \closein 1
8800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}% end of special _ catcode
8802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newhelp\nolanghelp{The given language definition file cannot be found or
8804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piqueis empty.  Maybe you need to install it?  Putting it in the current
8805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Piquedirectory should work if nowhere else does.}
8806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This macro is called from txi-??.tex files; the first argument is the
8808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \language name to set (without the "\lang@" prefix), the second and
8809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% third args are \{left,right}hyphenmin.
8810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The language names to pass are determined when the format is built.
8812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% See the etex.log file created at that time, e.g.,
8813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
8814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% With TeX Live 2008, etex now includes hyphenation patterns for all
8816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% available languages.  This means we can support hyphenation in
8817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Texinfo, at least to some extent.  (This still doesn't solve the
8818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% accented characters problem.)
8819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`@=11
8821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\txisetlanguage#1#2#3{%
8822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % do not set the language if the name is undefined in the current TeX.
8823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \expandafter\ifx\csname lang@#1\endcsname \relax
8824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \message{no patterns for #1}%
8825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\language = \csname lang@#1\endcsname
8827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
8828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % but there is no harm in adjusting the hyphenmin values regardless.
8829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\lefthyphenmin = #2\relax
8830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \global\righthyphenmin = #3\relax
8831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Helpers for encodings.
8834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set the catcode of characters 128 through 255 to the specified number.
8835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setnonasciicharscatcode#1{%
8837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \count255=128
8838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \loop\ifnum\count255<256
8839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \global\catcode\count255=#1\relax
8840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \advance\count255 by 1
8841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \repeat
8842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setnonasciicharscatcodenonglobal#1{%
8845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \count255=128
8846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \loop\ifnum\count255<256
8847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \catcode\count255=#1\relax
8848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \advance\count255 by 1
8849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \repeat
8850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @documentencoding sets the definition of non-ASCII characters
8853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% according to the specified encoding.
8854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\documentencoding{%
8856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Encoding being declared for the document.
8857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\declaredencoding{\csname #1.enc\endcsname}%
8858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Supported encodings: names converted to tokens in order to be able
8860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % to compare them with \ifx.
8861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\ascii{\csname US-ASCII.enc\endcsname}%
8862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\latnine{\csname ISO-8859-15.enc\endcsname}%
8863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\latone{\csname ISO-8859-1.enc\endcsname}%
8864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
8865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\utfeight{\csname UTF-8.enc\endcsname}%
8866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx \declaredencoding \ascii
8868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \asciichardefs
8869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifx \declaredencoding \lattwo
8871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \setnonasciicharscatcode\active
8872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \lattwochardefs
8873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifx \declaredencoding \latone
8875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \setnonasciicharscatcode\active
8876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \latonechardefs
8877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifx \declaredencoding \latnine
8879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \setnonasciicharscatcode\active
8880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \latninechardefs
8881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else \ifx \declaredencoding \utfeight
8883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \setnonasciicharscatcode\active
8884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique     \utfeightchardefs
8885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
8887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \message{Unknown document encoding #1, ignoring.}%
8888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi % utfeight
8890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi % latnine
8891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi % latone
8892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi % lattwo
8893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi % ascii
8894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
8895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A message to be logged when using a character that isn't available
8897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the default font encoding (OT1).
8898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
8900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Take account of \c (plain) vs. \, (Texinfo) difference.
8902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
8903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
8904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% First, make active non-ASCII characters in order for them to be
8905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% correctly categorized when TeX reads the replacement text of
8906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% macros containing the character definitions.
8907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setnonasciicharscatcode\active
8908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
8909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Latin1 (ISO-8859-1) character definitions.
8910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\latonechardefs{%
8911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a0{\tie}
8912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a1{\exclamdown}
8913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a2{\missingcharmsg{CENT SIGN}}
8914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a3{{\pounds}}
8915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
8916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a5{\missingcharmsg{YEN SIGN}}
8917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a6{\missingcharmsg{BROKEN BAR}}
8918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a7{\S}
8919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a8{\"{}}
8920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a9{\copyright}
8921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^aa{\ordf}
8922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ab{\guillemetleft}
8923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ac{$\lnot$}
8924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ad{\-}
8925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ae{\registeredsymbol}
8926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^af{\={}}
8927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b0{\textdegree}
8929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b1{$\pm$}
8930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b2{$^2$}
8931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b3{$^3$}
8932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b4{\'{}}
8933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b5{$\mu$}
8934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b6{\P}
8935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b7{$^.$}
8937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b8{\cedilla\ }
8938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b9{$^1$}
8939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ba{\ordm}
8940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bb{\guillemetright}
8942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bc{$1\over4$}
8943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bd{$1\over2$}
8944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^be{$3\over4$}
8945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bf{\questiondown}
8946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c0{\`A}
8948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c1{\'A}
8949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c2{\^A}
8950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c3{\~A}
8951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c4{\"A}
8952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c5{\ringaccent A}
8953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c6{\AE}
8954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c7{\cedilla C}
8955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c8{\`E}
8956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c9{\'E}
8957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ca{\^E}
8958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^cb{\"E}
8959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^cc{\`I}
8960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^cd{\'I}
8961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ce{\^I}
8962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^cf{\"I}
8963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d0{\DH}
8965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d1{\~N}
8966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d2{\`O}
8967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d3{\'O}
8968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d4{\^O}
8969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d5{\~O}
8970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d6{\"O}
8971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d7{$\times$}
8972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d8{\O}
8973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d9{\`U}
8974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^da{\'U}
8975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^db{\^U}
8976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^dc{\"U}
8977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^dd{\'Y}
8978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^de{\TH}
8979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^df{\ss}
8980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e0{\`a}
8982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e1{\'a}
8983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e2{\^a}
8984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e3{\~a}
8985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e4{\"a}
8986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e5{\ringaccent a}
8987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e6{\ae}
8988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e7{\cedilla c}
8989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e8{\`e}
8990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e9{\'e}
8991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ea{\^e}
8992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^eb{\"e}
8993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ec{\`{\dotless i}}
8994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ed{\'{\dotless i}}
8995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ee{\^{\dotless i}}
8996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ef{\"{\dotless i}}
8997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
8998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f0{\dh}
8999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f1{\~n}
9000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f2{\`o}
9001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f3{\'o}
9002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f4{\^o}
9003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f5{\~o}
9004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f6{\"o}
9005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f7{$\div$}
9006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f8{\o}
9007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f9{\`u}
9008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fa{\'u}
9009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fb{\^u}
9010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fc{\"u}
9011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fd{\'y}
9012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fe{\th}
9013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ff{\"y}
9014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
9015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Latin9 (ISO-8859-15) encoding character definitions.
9017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\latninechardefs{%
9018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Encoding is almost identical to Latin1.
9019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \latonechardefs
9020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a4{\euro}
9022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a6{\v S}
9023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a8{\v s}
9024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b4{\v Z}
9025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b8{\v z}
9026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bc{\OE}
9027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bd{\oe}
9028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^be{\"Y}
9029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
9030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Latin2 (ISO-8859-2) character definitions.
9032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\lattwochardefs{%
9033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a0{\tie}
9034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a1{\ogonek{A}}
9035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a2{\u{}}
9036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a3{\L}
9037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
9038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a5{\v L}
9039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a6{\'S}
9040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a7{\S}
9041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a8{\"{}}
9042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^a9{\v S}
9043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^aa{\cedilla S}
9044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ab{\v T}
9045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ac{\'Z}
9046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ad{\-}
9047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ae{\v Z}
9048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^af{\dotaccent Z}
9049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b0{\textdegree}
9051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b1{\ogonek{a}}
9052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b2{\ogonek{ }}
9053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b3{\l}
9054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b4{\'{}}
9055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b5{\v l}
9056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b6{\'s}
9057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b7{\v{}}
9058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b8{\cedilla\ }
9059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^b9{\v s}
9060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ba{\cedilla s}
9061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bb{\v t}
9062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bc{\'z}
9063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bd{\H{}}
9064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^be{\v z}
9065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^bf{\dotaccent z}
9066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c0{\'R}
9068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c1{\'A}
9069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c2{\^A}
9070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c3{\u A}
9071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c4{\"A}
9072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c5{\'L}
9073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c6{\'C}
9074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c7{\cedilla C}
9075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c8{\v C}
9076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^c9{\'E}
9077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ca{\ogonek{E}}
9078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^cb{\"E}
9079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^cc{\v E}
9080457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^cd{\'I}
9081457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ce{\^I}
9082457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^cf{\v D}
9083457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9084457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d0{\DH}
9085457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d1{\'N}
9086457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d2{\v N}
9087457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d3{\'O}
9088457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d4{\^O}
9089457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d5{\H O}
9090457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d6{\"O}
9091457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d7{$\times$}
9092457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d8{\v R}
9093457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^d9{\ringaccent U}
9094457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^da{\'U}
9095457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^db{\H U}
9096457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^dc{\"U}
9097457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^dd{\'Y}
9098457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^de{\cedilla T}
9099457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^df{\ss}
9100457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9101457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e0{\'r}
9102457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e1{\'a}
9103457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e2{\^a}
9104457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e3{\u a}
9105457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e4{\"a}
9106457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e5{\'l}
9107457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e6{\'c}
9108457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e7{\cedilla c}
9109457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e8{\v c}
9110457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^e9{\'e}
9111457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ea{\ogonek{e}}
9112457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^eb{\"e}
9113457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ec{\v e}
9114457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ed{\'{\dotless{i}}}
9115457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ee{\^{\dotless{i}}}
9116457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ef{\v d}
9117457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9118457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f0{\dh}
9119457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f1{\'n}
9120457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f2{\v n}
9121457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f3{\'o}
9122457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f4{\^o}
9123457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f5{\H o}
9124457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f6{\"o}
9125457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f7{$\div$}
9126457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f8{\v r}
9127457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^f9{\ringaccent u}
9128457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fa{\'u}
9129457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fb{\H u}
9130457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fc{\"u}
9131457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fd{\'y}
9132457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^fe{\cedilla t}
9133457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef^^ff{\dotaccent{}}
9134457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
9135457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9136457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% UTF-8 character definitions.
9137457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9138457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This code to support UTF-8 is based on LaTeX's utf8.def, with some
9139457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% changes for Texinfo conventions.  It is included here under the GPL by
9140457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% permission from Frank Mittelbach and the LaTeX team.
9141457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9142457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\countUTFx
9143457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\countUTFy
9144457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newcount\countUTFz
9145457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9146457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\UTFviiiTwoOctets#1#2{\expandafter
9147457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \UTFviiiDefined\csname u8:#1\string #2\endcsname}
9148457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9149457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
9150457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
9151457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9152457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
9153457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
9154457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9155457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\gdef\UTFviiiDefined#1{%
9156457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx #1\relax
9157457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
9158457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
9159457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \expandafter #1%
9160457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
9161457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
9162457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9163457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
9164457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\~13
9165457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\"12
9166457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9167457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\UTFviiiLoop{%
9168457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \global\catcode\countUTFx\active
9169457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \uccode`\~\countUTFx
9170457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \uppercase\expandafter{\UTFviiiTmp}%
9171457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\countUTFx by 1
9172457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\countUTFx < \countUTFy
9173457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\UTFviiiLoop
9174457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi}
9175457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9176457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \countUTFx = "C2
9177457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \countUTFy = "E0
9178457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\UTFviiiTmp{%
9179457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
9180457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \UTFviiiLoop
9181457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9182457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \countUTFx = "E0
9183457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \countUTFy = "F0
9184457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\UTFviiiTmp{%
9185457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
9186457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \UTFviiiLoop
9187457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9188457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \countUTFx = "F0
9189457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \countUTFy = "F4
9190457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \def\UTFviiiTmp{%
9191457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \xdef~{\noexpand\UTFviiiFourOctets\string~}}
9192457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \UTFviiiLoop
9193457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup
9194457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9195457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\begingroup
9196457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\"=12
9197457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\<=12
9198457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\.=12
9199457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\,=12
9200457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\;=12
9201457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\!=12
9202457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \catcode`\~=13
9203457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9204457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\DeclareUnicodeCharacter#1#2{%
9205457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \countUTFz = "#1\relax
9206457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
9207457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \begingroup
9208457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseXMLCharref
9209457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\UTFviiiTwoOctets##1##2{%
9210457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \csname u8:##1\string ##2\endcsname}%
9211457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\UTFviiiThreeOctets##1##2##3{%
9212457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \csname u8:##1\string ##2\string ##3\endcsname}%
9213457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \def\UTFviiiFourOctets##1##2##3##4{%
9214457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique        \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
9215457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \expandafter\expandafter\expandafter\expandafter
9216457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \expandafter\expandafter\expandafter
9217457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique       \gdef\UTFviiiTmp{#2}%
9218457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \endgroup}
9219457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9220457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\parseXMLCharref{%
9221457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \ifnum\countUTFz < "A0\relax
9222457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \errhelp = \EMsimple
9223457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \errmessage{Cannot define Unicode char value < 00A0}%
9224457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifnum\countUTFz < "800\relax
9225457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiA,%
9226457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiB C\UTFviiiTwoOctets.,%
9227457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else\ifnum\countUTFz < "10000\relax
9228457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiA;%
9229457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiA,%
9230457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
9231457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \else
9232457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiA;%
9233457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiA,%
9234457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiA!%
9235457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique      \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
9236457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \fi\fi\fi
9237457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  }
9238457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9239457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\parseUTFviiiA#1{%
9240457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \countUTFx = \countUTFz
9241457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \divide\countUTFz by 64
9242457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \countUTFy = \countUTFz
9243457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \multiply\countUTFz by 64
9244457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\countUTFx by -\countUTFz
9245457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\countUTFx by 128
9246457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \uccode `#1\countUTFx
9247457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \countUTFz = \countUTFy}
9248457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9249457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \gdef\parseUTFviiiB#1#2#3#4{%
9250457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \advance\countUTFz by "#10\relax
9251457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \uccode `#3\countUTFz
9252457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
9253457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\endgroup
9254457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9255457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\utfeightchardefs{%
9256457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00A0}{\tie}
9257457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00A1}{\exclamdown}
9258457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00A3}{\pounds}
9259457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00A8}{\"{ }}
9260457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00A9}{\copyright}
9261457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00AA}{\ordf}
9262457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00AB}{\guillemetleft}
9263457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00AD}{\-}
9264457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
9265457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00AF}{\={ }}
9266457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9267457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
9268457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00B4}{\'{ }}
9269457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
9270457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00BA}{\ordm}
9271457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00BB}{\guillemetright}
9272457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00BF}{\questiondown}
9273457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9274457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C0}{\`A}
9275457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C1}{\'A}
9276457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C2}{\^A}
9277457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C3}{\~A}
9278457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C4}{\"A}
9279457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C5}{\AA}
9280457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C6}{\AE}
9281457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
9282457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C8}{\`E}
9283457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00C9}{\'E}
9284457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00CA}{\^E}
9285457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00CB}{\"E}
9286457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00CC}{\`I}
9287457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00CD}{\'I}
9288457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00CE}{\^I}
9289457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00CF}{\"I}
9290457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9291457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D0}{\DH}
9292457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D1}{\~N}
9293457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D2}{\`O}
9294457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D3}{\'O}
9295457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D4}{\^O}
9296457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D5}{\~O}
9297457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D6}{\"O}
9298457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D8}{\O}
9299457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00D9}{\`U}
9300457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00DA}{\'U}
9301457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00DB}{\^U}
9302457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00DC}{\"U}
9303457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00DD}{\'Y}
9304457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00DE}{\TH}
9305457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00DF}{\ss}
9306457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9307457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E0}{\`a}
9308457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E1}{\'a}
9309457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E2}{\^a}
9310457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E3}{\~a}
9311457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E4}{\"a}
9312457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E5}{\aa}
9313457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E6}{\ae}
9314457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
9315457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E8}{\`e}
9316457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00E9}{\'e}
9317457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00EA}{\^e}
9318457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00EB}{\"e}
9319457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
9320457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
9321457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
9322457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
9323457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9324457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F0}{\dh}
9325457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F1}{\~n}
9326457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F2}{\`o}
9327457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F3}{\'o}
9328457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F4}{\^o}
9329457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F5}{\~o}
9330457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F6}{\"o}
9331457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F8}{\o}
9332457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00F9}{\`u}
9333457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00FA}{\'u}
9334457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00FB}{\^u}
9335457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00FC}{\"u}
9336457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00FD}{\'y}
9337457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00FE}{\th}
9338457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{00FF}{\"y}
9339457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9340457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0100}{\=A}
9341457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0101}{\=a}
9342457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0102}{\u{A}}
9343457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0103}{\u{a}}
9344457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0104}{\ogonek{A}}
9345457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0105}{\ogonek{a}}
9346457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0106}{\'C}
9347457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0107}{\'c}
9348457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0108}{\^C}
9349457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0109}{\^c}
9350457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0118}{\ogonek{E}}
9351457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0119}{\ogonek{e}}
9352457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
9353457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
9354457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{010C}{\v{C}}
9355457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{010D}{\v{c}}
9356457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{010E}{\v{D}}
9357457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9358457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0112}{\=E}
9359457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0113}{\=e}
9360457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0114}{\u{E}}
9361457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0115}{\u{e}}
9362457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
9363457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
9364457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{011A}{\v{E}}
9365457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{011B}{\v{e}}
9366457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{011C}{\^G}
9367457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{011D}{\^g}
9368457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{011E}{\u{G}}
9369457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{011F}{\u{g}}
9370457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9371457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
9372457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
9373457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0124}{\^H}
9374457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0125}{\^h}
9375457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0128}{\~I}
9376457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
9377457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{012A}{\=I}
9378457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
9379457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{012C}{\u{I}}
9380457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
9381457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9382457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
9383457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0131}{\dotless{i}}
9384457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0132}{IJ}
9385457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0133}{ij}
9386457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0134}{\^J}
9387457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
9388457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0139}{\'L}
9389457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{013A}{\'l}
9390457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9391457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0141}{\L}
9392457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0142}{\l}
9393457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0143}{\'N}
9394457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0144}{\'n}
9395457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0147}{\v{N}}
9396457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0148}{\v{n}}
9397457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{014C}{\=O}
9398457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{014D}{\=o}
9399457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{014E}{\u{O}}
9400457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{014F}{\u{o}}
9401457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9402457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0150}{\H{O}}
9403457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0151}{\H{o}}
9404457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0152}{\OE}
9405457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0153}{\oe}
9406457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0154}{\'R}
9407457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0155}{\'r}
9408457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0158}{\v{R}}
9409457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0159}{\v{r}}
9410457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{015A}{\'S}
9411457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{015B}{\'s}
9412457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{015C}{\^S}
9413457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{015D}{\^s}
9414457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{015E}{\cedilla{S}}
9415457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{015F}{\cedilla{s}}
9416457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9417457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0160}{\v{S}}
9418457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0161}{\v{s}}
9419457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0162}{\cedilla{t}}
9420457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0163}{\cedilla{T}}
9421457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0164}{\v{T}}
9422457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9423457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0168}{\~U}
9424457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0169}{\~u}
9425457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{016A}{\=U}
9426457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{016B}{\=u}
9427457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{016C}{\u{U}}
9428457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{016D}{\u{u}}
9429457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
9430457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
9431457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9432457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0170}{\H{U}}
9433457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0171}{\H{u}}
9434457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0174}{\^W}
9435457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0175}{\^w}
9436457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0176}{\^Y}
9437457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0177}{\^y}
9438457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0178}{\"Y}
9439457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0179}{\'Z}
9440457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{017A}{\'z}
9441457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
9442457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
9443457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{017D}{\v{Z}}
9444457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{017E}{\v{z}}
9445457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9446457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01C4}{D\v{Z}}
9447457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01C5}{D\v{z}}
9448457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01C6}{d\v{z}}
9449457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01C7}{LJ}
9450457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01C8}{Lj}
9451457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01C9}{lj}
9452457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01CA}{NJ}
9453457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01CB}{Nj}
9454457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01CC}{nj}
9455457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01CD}{\v{A}}
9456457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01CE}{\v{a}}
9457457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01CF}{\v{I}}
9458457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9459457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
9460457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01D1}{\v{O}}
9461457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01D2}{\v{o}}
9462457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01D3}{\v{U}}
9463457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01D4}{\v{u}}
9464457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9465457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01E2}{\={\AE}}
9466457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01E3}{\={\ae}}
9467457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01E6}{\v{G}}
9468457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01E7}{\v{g}}
9469457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01E8}{\v{K}}
9470457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01E9}{\v{k}}
9471457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9472457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
9473457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01F1}{DZ}
9474457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01F2}{Dz}
9475457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01F3}{dz}
9476457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01F4}{\'G}
9477457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01F5}{\'g}
9478457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01F8}{\`N}
9479457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01F9}{\`n}
9480457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01FC}{\'{\AE}}
9481457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01FD}{\'{\ae}}
9482457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01FE}{\'{\O}}
9483457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{01FF}{\'{\o}}
9484457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9485457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{021E}{\v{H}}
9486457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{021F}{\v{h}}
9487457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9488457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
9489457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
9490457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0228}{\cedilla{E}}
9491457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0229}{\cedilla{e}}
9492457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
9493457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
9494457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9495457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0232}{\=Y}
9496457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0233}{\=y}
9497457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{0237}{\dotless{j}}
9498457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9499457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
9500457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9501457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
9502457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
9503457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
9504457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
9505457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
9506457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
9507457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
9508457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
9509457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
9510457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
9511457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
9512457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
9513457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9514457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
9515457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
9516457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9517457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E20}{\=G}
9518457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E21}{\=g}
9519457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
9520457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
9521457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
9522457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
9523457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E26}{\"H}
9524457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E27}{\"h}
9525457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9526457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E30}{\'K}
9527457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E31}{\'k}
9528457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
9529457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
9530457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
9531457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
9532457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
9533457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
9534457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
9535457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
9536457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E3E}{\'M}
9537457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E3F}{\'m}
9538457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9539457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
9540457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
9541457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
9542457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
9543457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
9544457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
9545457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
9546457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
9547457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
9548457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
9549457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9550457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E54}{\'P}
9551457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E55}{\'p}
9552457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
9553457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
9554457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
9555457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
9556457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
9557457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
9558457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
9559457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
9560457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9561457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
9562457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
9563457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
9564457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
9565457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
9566457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
9567457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
9568457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
9569457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
9570457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
9571457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9572457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E7C}{\~V}
9573457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E7D}{\~v}
9574457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
9575457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
9576457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9577457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E80}{\`W}
9578457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E81}{\`w}
9579457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E82}{\'W}
9580457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E83}{\'w}
9581457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E84}{\"W}
9582457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E85}{\"w}
9583457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
9584457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
9585457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
9586457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
9587457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
9588457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
9589457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E8C}{\"X}
9590457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E8D}{\"x}
9591457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
9592457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
9593457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9594457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E90}{\^Z}
9595457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E91}{\^z}
9596457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
9597457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
9598457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
9599457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
9600457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
9601457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E97}{\"t}
9602457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
9603457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
9604457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9605457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
9606457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
9607457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9608457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
9609457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
9610457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EBC}{\~E}
9611457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EBD}{\~e}
9612457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9613457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
9614457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
9615457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
9616457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
9617457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9618457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
9619457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
9620457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9621457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EF2}{\`Y}
9622457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EF3}{\`y}
9623457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
9624457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9625457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EF8}{\~Y}
9626457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{1EF9}{\~y}
9627457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9628457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2013}{--}
9629457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2014}{---}
9630457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2018}{\quoteleft}
9631457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2019}{\quoteright}
9632457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{201A}{\quotesinglbase}
9633457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{201C}{\quotedblleft}
9634457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{201D}{\quotedblright}
9635457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{201E}{\quotedblbase}
9636457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2022}{\bullet}
9637457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2026}{\dots}
9638457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2039}{\guilsinglleft}
9639457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{203A}{\guilsinglright}
9640457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{20AC}{\euro}
9641457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9642457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2192}{\expansion}
9643457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{21D2}{\result}
9644457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9645457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2212}{\minus}
9646457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2217}{\point}
9647457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \DeclareUnicodeCharacter{2261}{\equiv}
9648457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}% end of \utfeightchardefs
9649457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9650457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9651457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% US-ASCII character definitions.
9652457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\asciichardefs{% nothing need be done
9653457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   \relax
9654457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
9655457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9656457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Make non-ASCII characters printable again for compatibility with
9657457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% existing Texinfo documents that may use them, even without declaring a
9658457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% document encoding.
9659457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9660457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\setnonasciicharscatcode \other
9661457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9662457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9663457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{formatting,}
9664457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9665457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\newdimen\defaultparindent \defaultparindent = 15pt
9666457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9667457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chapheadingskip = 15pt plus 4pt minus 2pt
9668457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\secheadingskip = 12pt plus 3pt minus 2pt
9669457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\subsecheadingskip = 9pt plus 2pt minus 2pt
9670457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9671457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Prevent underfull vbox error messages.
9672457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\vbadness = 10000
9673457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9674457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Don't be very finicky about underfull hboxes, either.
9675457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\hbadness = 6666
9676457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9677457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Following George Bush, get rid of widows and orphans.
9678457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\widowpenalty=10000
9679457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\clubpenalty=10000
9680457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9681457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
9682457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% using an old version of TeX, don't do anything.  We want the amount of
9683457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% stretch added to depend on the line length, hence the dependence on
9684457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \hsize.  We call this whenever the paper size is set.
9685457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9686457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\setemergencystretch{%
9687457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifx\emergencystretch\thisisundefined
9688457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % Allow us to assign to \emergencystretch anyway.
9689457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \def\emergencystretch{\dimen0}%
9690457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \else
9691457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \emergencystretch = .15\hsize
9692457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
9693457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
9694457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9695457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Parameters in order: 1) textheight; 2) textwidth;
9696457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
9697457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% 7) physical page height; 8) physical page width.
9698457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9699457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% We also call \setleading{\textleading}, so the caller should define
9700457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \textleading.  The caller should also set \parskip.
9701457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9702457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\internalpagesizes#1#2#3#4#5#6#7#8{%
9703457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \voffset = #3\relax
9704457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \topskip = #6\relax
9705457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \splittopskip = \topskip
9706457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9707457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \vsize = #1\relax
9708457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\vsize by \topskip
9709457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \outervsize = \vsize
9710457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\outervsize by 2\topandbottommargin
9711457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pageheight = \vsize
9712457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9713457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hsize = #2\relax
9714457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \outerhsize = \hsize
9715457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\outerhsize by 0.5in
9716457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \pagewidth = \hsize
9717457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9718457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \normaloffset = #4\relax
9719457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \bindingoffset = #5\relax
9720457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9721457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \ifpdf
9722457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdfpageheight #7\relax
9723457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdfpagewidth #8\relax
9724457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % if we don't reset these, they will remain at "1 true in" of
9725457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    % whatever layout pdftex was dumped with.
9726457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdfhorigin = 1 true in
9727457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique    \pdfvorigin = 1 true in
9728457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \fi
9729457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9730457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setleading{\textleading}
9731457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9732457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parindent = \defaultparindent
9733457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setemergencystretch
9734457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
9735457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9736457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @letterpaper (the default).
9737457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\letterpaper{{\globaldefs = 1
9738457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip = 3pt plus 2pt minus 1pt
9739457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textleading = 13.2pt
9740457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9741457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % If page is nothing but text, make it come out even.
9742457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \internalpagesizes{607.2pt}{6in}% that's 46 lines
9743457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\voffset}{.25in}%
9744457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\bindingoffset}{36pt}%
9745457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {11in}{8.5in}%
9746457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
9747457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9748457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use @smallbook to reset parameters for 7x9.25 trim size.
9749457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallbook{{\globaldefs = 1
9750457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip = 2pt plus 1pt
9751457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textleading = 12pt
9752457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9753457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \internalpagesizes{7.5in}{5in}%
9754457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {-.2in}{0in}%
9755457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\bindingoffset}{16pt}%
9756457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {9.25in}{7in}%
9757457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9758457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \lispnarrowing = 0.3in
9759457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tolerance = 700
9760457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hfuzz = 1pt
9761457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \contentsrightmargin = 0pt
9762457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \defbodyindent = .5cm
9763457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
9764457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9765457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use @smallerbook to reset parameters for 6x9 trim size.
9766457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (Just testing, parameters still in flux.)
9767457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\smallerbook{{\globaldefs = 1
9768457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip = 1.5pt plus 1pt
9769457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textleading = 12pt
9770457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9771457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \internalpagesizes{7.4in}{4.8in}%
9772457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {-.2in}{-.4in}%
9773457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {0pt}{14pt}%
9774457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {9in}{6in}%
9775457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9776457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \lispnarrowing = 0.25in
9777457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tolerance = 700
9778457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hfuzz = 1pt
9779457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \contentsrightmargin = 0pt
9780457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \defbodyindent = .4cm
9781457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
9782457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9783457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use @afourpaper to print on European A4 paper.
9784457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\afourpaper{{\globaldefs = 1
9785457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip = 3pt plus 2pt minus 1pt
9786457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textleading = 13.2pt
9787457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9788457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Double-side printing via postscript on Laserjet 4050
9789457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
9790457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % To change the settings for a different printer or situation, adjust
9791457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \normaloffset until the front-side and back-side texts align.  Then
9792457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % do the same for \bindingoffset.  You can set these for testing in
9793457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % your texinfo source file like this:
9794457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @tex
9795457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \global\normaloffset = -6mm
9796457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % \global\bindingoffset = 10mm
9797457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % @end tex
9798457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \internalpagesizes{673.2pt}{160mm}% that's 51 lines
9799457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\voffset}{\hoffset}%
9800457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\bindingoffset}{44pt}%
9801457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {297mm}{210mm}%
9802457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9803457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tolerance = 700
9804457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hfuzz = 1pt
9805457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \contentsrightmargin = 0pt
9806457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \defbodyindent = 5mm
9807457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
9808457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9809457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use @afivepaper to print on European A5 paper.
9810457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% From romildo@urano.iceb.ufop.br, 2 July 2000.
9811457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% He also recommends making @example and @lisp be small.
9812457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\afivepaper{{\globaldefs = 1
9813457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip = 2pt plus 1pt minus 0.1pt
9814457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \textleading = 12.5pt
9815457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9816457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \internalpagesizes{160mm}{120mm}%
9817457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\voffset}{\hoffset}%
9818457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\bindingoffset}{8pt}%
9819457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {210mm}{148mm}%
9820457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9821457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \lispnarrowing = 0.2in
9822457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tolerance = 800
9823457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \hfuzz = 1.2pt
9824457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \contentsrightmargin = 0pt
9825457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \defbodyindent = 2mm
9826457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \tableindent = 12mm
9827457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
9828457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9829457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% A specific text layout, 24x15cm overall, intended for A4 paper.
9830457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\afourlatex{{\globaldefs = 1
9831457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \afourpaper
9832457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \internalpagesizes{237mm}{150mm}%
9833457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\voffset}{4.6mm}%
9834457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\bindingoffset}{7mm}%
9835457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {297mm}{210mm}%
9836457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9837457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  % Must explicitly reset to 0 because we call \afourpaper.
9838457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \globaldefs = 0
9839457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
9840457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9841457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Use @afourwide to print on A4 paper in landscape format.
9842457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\afourwide{{\globaldefs = 1
9843457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \afourpaper
9844457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \internalpagesizes{241mm}{165mm}%
9845457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\voffset}{-2.95mm}%
9846457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\bindingoffset}{7mm}%
9847457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {297mm}{210mm}%
9848457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \globaldefs = 0
9849457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
9850457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9851457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
9852457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Perhaps we should allow setting the margins, \topskip, \parskip,
9853457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% and/or leading, also. Or perhaps we should compute them somehow.
9854457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9855457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
9856457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\pagesizesyyy#1,#2,#3\finish{{%
9857457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
9858457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \globaldefs = 1
9859457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9860457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \parskip = 3pt plus 2pt minus 1pt
9861457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \setleading{\textleading}%
9862457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9863457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen0 = #1\relax
9864457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\dimen0 by \voffset
9865457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9866457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \dimen2 = \hsize
9867457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \advance\dimen2 by \normaloffset
9868457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  %
9869457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \internalpagesizes{#1}{\hsize}%
9870457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\voffset}{\normaloffset}%
9871457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\bindingoffset}{44pt}%
9872457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique                    {\dimen0}{\dimen2}%
9873457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}}
9874457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9875457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Set default to letter.
9876457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9877457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\letterpaper
9878457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9879457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9880457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\message{and turning on texinfo input format.}
9881457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9882457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def^^L{\par} % remove \outer, so ^L can appear in an @comment
9883457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9884457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% DEL is a comment character, in case @c does not suffice.
9885457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\^^? = 14
9886457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9887457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Define macros to output various characters with catcode for normal text.
9888457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\"=\other \def\normaldoublequote{"}
9889457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
9890457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\+=\other \def\normalplus{+}
9891457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\<=\other \def\normalless{<}
9892457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\>=\other \def\normalgreater{>}
9893457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\^=\other \def\normalcaret{^}
9894457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\_=\other \def\normalunderscore{_}
9895457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\|=\other \def\normalverticalbar{|}
9896457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\~=\other \def\normaltilde{~}
9897457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9898457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This macro is used to make a character print one way in \tt
9899457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (where it can probably be output as-is), and another way in other fonts,
9900457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% where something hairier probably needs to be done.
9901457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9902457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% #1 is what to print if we are indeed using \tt; #2 is what to print
9903457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% otherwise.  Since all the Computer Modern typewriter fonts have zero
9904457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% interword stretch (and shrink), and it is reasonable to expect all
9905457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% typewriter fonts to have this, we can check that font parameter.
9906457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9907457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
9908457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9909457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Same as above, but check for italic font.  Actually this also catches
9910457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% non-italic slanted fonts since it is impossible to distinguish them from
9911457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% italic fonts.  But since this is only used by $ and it uses \sl anyway
9912457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% this is not a problem.
9913457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
9914457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9915457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Turn off all special characters except @
9916457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% (and those which the user can use as if they were ordinary).
9917457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Most of these we simply print from the \tt font, but for some, we can
9918457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% use math or other variants that look better in normal text.
9919457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9920457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\"=\active
9921457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\activedoublequote{{\tt\char34}}
9922457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let"=\activedoublequote
9923457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\~=\active
9924457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def~{{\tt\char126}}
9925457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef\hat=`\^
9926457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\^=\active
9927457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def^{{\tt \hat}}
9928457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9929457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\_=\active
9930457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def_{\ifusingtt\normalunderscore\_}
9931457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\let\realunder=_
9932457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Subroutine for the previous macro.
9933457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
9934457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9935457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\|=\active
9936457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def|{{\tt\char124}}
9937457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef \less=`\<
9938457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\<=\active
9939457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def<{{\tt \less}}
9940457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\chardef \gtr=`\>
9941457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\>=\active
9942457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def>{{\tt \gtr}}
9943457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\+=\active
9944457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def+{{\tt \char 43}}
9945457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\$=\active
9946457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
9947457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9948457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If a .fmt file is being used, characters that might appear in a file
9949457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% name cannot be active until we have parsed the command line.
9950457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% So turn them off again, and have \everyjob (or @setfilename) turn them on.
9951457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \otherifyactive is called near the end of this file.
9952457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
9953457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9954457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Used sometimes to turn off (effectively) the active characters even after
9955457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% parsing them.
9956457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\def\turnoffactive{%
9957457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \normalturnoffactive
9958457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  \otherbackslash
9959457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
9960457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9961457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\@=0
9962457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9963457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \backslashcurfont outputs one backslash character in current font,
9964457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% as in \char`\\.
9965457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\chardef\backslashcurfont=`\\
9966457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
9967457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9968457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \realbackslash is an actual character `\' with catcode other, and
9969457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \doublebackslash is two of them (for the pdf outlines).
9970457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
9971457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9972457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% In texinfo, backslash is an active character; it prints the backslash
9973457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in fixed width font.
9974457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique\catcode`\\=\active  % @ for escape char from now on.
9975457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9976457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% The story here is that in math mode, the \char of \backslashcurfont
9977457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ends up printing the roman \ from the math symbol font (because \char
9978457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% in math mode uses the \mathcode, and plain.tex sets
9979457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \mathcode`\\="026E).  It seems better for @backslashchar{} to always
9980457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% print a typewriter backslash, hence we use an explicit \mathchar,
9981457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
9982457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% ignored family value; char position "5C).  We can't use " for the
9983457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% usual hex value because it has already been made active.
9984457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
9985457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
9986457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9987457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% On startup, @fixbackslash assigns:
9988457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%  @let \ = @normalbackslash
9989457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \rawbackslash defines an active \ to do \backslashcurfont.
9990457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% \otherbackslash defines an active \ to be a literal `\' character with
9991457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% catcode other.  We switch back and forth between these.
9992457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@gdef@rawbackslash{@let\=@backslashcurfont}
9993457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@gdef@otherbackslash{@let\=@realbackslash}
9994457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
9995457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
9996457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the literal character `\'.  Also revert - to its normal character, in
9997457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% case the active - from code has slipped in.
9998457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
9999457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique{@catcode`- = @active
10000457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique @gdef@normalturnoffactive{%
10001457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let-=@normaldash
10002457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let"=@normaldoublequote
10003457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let$=@normaldollar %$ font-lock fix
10004457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let+=@normalplus
10005457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let<=@normalless
10006457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let>=@normalgreater
10007457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let\=@normalbackslash
10008457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let^=@normalcaret
10009457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let_=@normalunderscore
10010457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let|=@normalverticalbar
10011457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @let~=@normaltilde
10012457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @markupsetuplqdefault
10013457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @markupsetuprqdefault
10014457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   @unsepspaces
10015457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique }
10016457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
10017457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10018457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Make _ and + \other characters, temporarily.
10019457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% This is canceled by @fixbackslash.
10020457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@otherifyactive
10021457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10022457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
10023457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% That is what \eatinput is for; after that, the `\' should revert to printing
10024457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% a backslash.
10025457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
10026457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@gdef@eatinput input texinfo{@fixbackslash}
10027457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@global@let\ = @eatinput
10028457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10029457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% On the other hand, perhaps the file did not have a `\input texinfo'. Then
10030457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% the first `\' in the file would cause an error. This macro tries to fix
10031457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% that, assuming it is called before the first `\' could plausibly occur.
10032457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Also turn back on active characters that might appear in the input
10033457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% file name, in case not using a pre-dumped format.
10034457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique%
10035457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@gdef@fixbackslash{%
10036457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  @ifx\@eatinput @let\ = @normalbackslash @fi
10037457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  @catcode`+=@active
10038457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique  @catcode`@_=@active
10039457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique}
10040457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10041457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% Say @foo, not \foo, in error messages.
10042457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@escapechar = `@@
10043457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10044457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% These (along with & and #) are made active for url-breaking, so need
10045457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% active definitions as the normal characters.
10046457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@def@normaldot{.}
10047457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@def@normalquest{?}
10048457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@def@normalslash{/}
10049457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10050457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% These look ok in all fonts, so just make them not special.
10051457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique% @hashchar{} gets its own user-level command, because of #line.
10052457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@catcode`@& = @other @def@normalamp{&}
10053457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@catcode`@# = @other @def@normalhash{#}
10054457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@catcode`@% = @other @def@normalpercent{%}
10055457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10056457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@let @hashchar = @normalhash
10057457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10058457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c Finally, make ` and ' active, so that txicodequoteundirected and
10059457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
10060457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c don't make ` and ' active, @code will not get them as active chars.
10061457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c Do this last of all since we use ` in the previous @catcode assignments.
10062457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@catcode`@'=@active
10063457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@catcode`@`=@active
10064457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@markupsetuplqdefault
10065457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@markupsetuprqdefault
10066457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10067457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c Local variables:
10068457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c eval: (add-hook 'write-file-hooks 'time-stamp)
10069457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c page-delimiter: "^\\\\message"
10070457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c time-stamp-start: "def\\\\texinfoversion{"
10071457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c time-stamp-format: "%:y-%02m-%02d.%02H"
10072457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c time-stamp-end: "}"
10073457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c End:
10074457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10075457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@c vim:sw=2:
10076457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique
10077457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@ignore
10078457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique   arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
10079457ba79995d512b9e8c07061fe10d4cd88273b2Lloyd Pique@end ignore
10080