xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/doc/include/texinfo.tex (revision 36ac495d2b3ea2b9d96377b2143ebfedac224b92)
1*36ac495dSmrg% texinfo.tex -- TeX macros to handle Texinfo files.
2*36ac495dSmrg%
3*36ac495dSmrg% Load plain if necessary, i.e., if running under initex.
4*36ac495dSmrg\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5*36ac495dSmrg%
6*36ac495dSmrg\def\texinfoversion{2012-06-05.14}
7*36ac495dSmrg%
8*36ac495dSmrg% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9*36ac495dSmrg% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10*36ac495dSmrg% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
11*36ac495dSmrg%
12*36ac495dSmrg% This texinfo.tex file is free software: you can redistribute it and/or
13*36ac495dSmrg% modify it under the terms of the GNU General Public License as
14*36ac495dSmrg% published by the Free Software Foundation, either version 3 of the
15*36ac495dSmrg% License, or (at your option) any later version.
16*36ac495dSmrg%
17*36ac495dSmrg% This texinfo.tex file is distributed in the hope that it will be
18*36ac495dSmrg% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19*36ac495dSmrg% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20*36ac495dSmrg% General Public License for more details.
21*36ac495dSmrg%
22*36ac495dSmrg% You should have received a copy of the GNU General Public License
23*36ac495dSmrg% along with this program.  If not, see <http://www.gnu.org/licenses/>.
24*36ac495dSmrg%
25*36ac495dSmrg% As a special exception, when this file is read by TeX when processing
26*36ac495dSmrg% a Texinfo source document, you may use the result without
27*36ac495dSmrg% restriction.  (This has been our intent since Texinfo was invented.)
28*36ac495dSmrg%
29*36ac495dSmrg% Please try the latest version of texinfo.tex before submitting bug
30*36ac495dSmrg% reports; you can get the latest version from:
31*36ac495dSmrg%   http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
32*36ac495dSmrg%   http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
33*36ac495dSmrg%   http://www.gnu.org/software/texinfo/ (the Texinfo home page)
34*36ac495dSmrg% The texinfo.tex in any given distribution could well be out
35*36ac495dSmrg% of date, so if that's what you're using, please check.
36*36ac495dSmrg%
37*36ac495dSmrg% Send bug reports to bug-texinfo@gnu.org.  Please include including a
38*36ac495dSmrg% complete document in each bug report with which we can reproduce the
39*36ac495dSmrg% problem.  Patches are, of course, greatly appreciated.
40*36ac495dSmrg%
41*36ac495dSmrg% To process a Texinfo manual with TeX, it's most reliable to use the
42*36ac495dSmrg% texi2dvi shell script that comes with the distribution.  For a simple
43*36ac495dSmrg% manual foo.texi, however, you can get away with this:
44*36ac495dSmrg%   tex foo.texi
45*36ac495dSmrg%   texindex foo.??
46*36ac495dSmrg%   tex foo.texi
47*36ac495dSmrg%   tex foo.texi
48*36ac495dSmrg%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
49*36ac495dSmrg% The extra TeX runs get the cross-reference information correct.
50*36ac495dSmrg% Sometimes one run after texindex suffices, and sometimes you need more
51*36ac495dSmrg% than two; texi2dvi does it as many times as necessary.
52*36ac495dSmrg%
53*36ac495dSmrg% It is possible to adapt texinfo.tex for other languages, to some
54*36ac495dSmrg% extent.  You can get the existing language-specific files from the
55*36ac495dSmrg% full Texinfo distribution.
56*36ac495dSmrg%
57*36ac495dSmrg% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
58*36ac495dSmrg
59*36ac495dSmrg
60*36ac495dSmrg\message{Loading texinfo [version \texinfoversion]:}
61*36ac495dSmrg
62*36ac495dSmrg% If in a .fmt file, print the version number
63*36ac495dSmrg% and turn on active characters that we couldn't do earlier because
64*36ac495dSmrg% they might have appeared in the input file name.
65*36ac495dSmrg\everyjob{\message{[Texinfo version \texinfoversion]}%
66*36ac495dSmrg  \catcode`+=\active \catcode`\_=\active}
67*36ac495dSmrg
68*36ac495dSmrg\chardef\other=12
69*36ac495dSmrg
70*36ac495dSmrg% We never want plain's \outer definition of \+ in Texinfo.
71*36ac495dSmrg% For @tex, we can use \tabalign.
72*36ac495dSmrg\let\+ = \relax
73*36ac495dSmrg
74*36ac495dSmrg% Save some plain tex macros whose names we will redefine.
75*36ac495dSmrg\let\ptexb=\b
76*36ac495dSmrg\let\ptexbullet=\bullet
77*36ac495dSmrg\let\ptexc=\c
78*36ac495dSmrg\let\ptexcomma=\,
79*36ac495dSmrg\let\ptexdot=\.
80*36ac495dSmrg\let\ptexdots=\dots
81*36ac495dSmrg\let\ptexend=\end
82*36ac495dSmrg\let\ptexequiv=\equiv
83*36ac495dSmrg\let\ptexexclam=\!
84*36ac495dSmrg\let\ptexfootnote=\footnote
85*36ac495dSmrg\let\ptexgtr=>
86*36ac495dSmrg\let\ptexhat=^
87*36ac495dSmrg\let\ptexi=\i
88*36ac495dSmrg\let\ptexindent=\indent
89*36ac495dSmrg\let\ptexinsert=\insert
90*36ac495dSmrg\let\ptexlbrace=\{
91*36ac495dSmrg\let\ptexless=<
92*36ac495dSmrg\let\ptexnewwrite\newwrite
93*36ac495dSmrg\let\ptexnoindent=\noindent
94*36ac495dSmrg\let\ptexplus=+
95*36ac495dSmrg\let\ptexraggedright=\raggedright
96*36ac495dSmrg\let\ptexrbrace=\}
97*36ac495dSmrg\let\ptexslash=\/
98*36ac495dSmrg\let\ptexstar=\*
99*36ac495dSmrg\let\ptext=\t
100*36ac495dSmrg\let\ptextop=\top
101*36ac495dSmrg{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
102*36ac495dSmrg
103*36ac495dSmrg% If this character appears in an error message or help string, it
104*36ac495dSmrg% starts a new line in the output.
105*36ac495dSmrg\newlinechar = `^^J
106*36ac495dSmrg
107*36ac495dSmrg% Use TeX 3.0's \inputlineno to get the line number, for better error
108*36ac495dSmrg% messages, but if we're using an old version of TeX, don't do anything.
109*36ac495dSmrg%
110*36ac495dSmrg\ifx\inputlineno\thisisundefined
111*36ac495dSmrg  \let\linenumber = \empty % Pre-3.0.
112*36ac495dSmrg\else
113*36ac495dSmrg  \def\linenumber{l.\the\inputlineno:\space}
114*36ac495dSmrg\fi
115*36ac495dSmrg
116*36ac495dSmrg% Set up fixed words for English if not already set.
117*36ac495dSmrg\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
118*36ac495dSmrg\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
119*36ac495dSmrg\ifx\putworderror\undefined     \gdef\putworderror{error}\fi
120*36ac495dSmrg\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
121*36ac495dSmrg\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
122*36ac495dSmrg\ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
123*36ac495dSmrg\ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
124*36ac495dSmrg\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
125*36ac495dSmrg\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
126*36ac495dSmrg\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
127*36ac495dSmrg\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
128*36ac495dSmrg\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
129*36ac495dSmrg\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
130*36ac495dSmrg\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
131*36ac495dSmrg\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
132*36ac495dSmrg\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
133*36ac495dSmrg\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
134*36ac495dSmrg\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
135*36ac495dSmrg\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
136*36ac495dSmrg\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
137*36ac495dSmrg%
138*36ac495dSmrg\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
139*36ac495dSmrg\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
140*36ac495dSmrg\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
141*36ac495dSmrg\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
142*36ac495dSmrg\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
143*36ac495dSmrg\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
144*36ac495dSmrg\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
145*36ac495dSmrg\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
146*36ac495dSmrg\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
147*36ac495dSmrg\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
148*36ac495dSmrg\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
149*36ac495dSmrg\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
150*36ac495dSmrg%
151*36ac495dSmrg\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
152*36ac495dSmrg\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
153*36ac495dSmrg\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
154*36ac495dSmrg\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
155*36ac495dSmrg\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
156*36ac495dSmrg
157*36ac495dSmrg% Since the category of space is not known, we have to be careful.
158*36ac495dSmrg\chardef\spacecat = 10
159*36ac495dSmrg\def\spaceisspace{\catcode`\ =\spacecat}
160*36ac495dSmrg
161*36ac495dSmrg% sometimes characters are active, so we need control sequences.
162*36ac495dSmrg\chardef\ampChar   = `\&
163*36ac495dSmrg\chardef\colonChar = `\:
164*36ac495dSmrg\chardef\commaChar = `\,
165*36ac495dSmrg\chardef\dashChar  = `\-
166*36ac495dSmrg\chardef\dotChar   = `\.
167*36ac495dSmrg\chardef\exclamChar= `\!
168*36ac495dSmrg\chardef\hashChar  = `\#
169*36ac495dSmrg\chardef\lquoteChar= `\`
170*36ac495dSmrg\chardef\questChar = `\?
171*36ac495dSmrg\chardef\rquoteChar= `\'
172*36ac495dSmrg\chardef\semiChar  = `\;
173*36ac495dSmrg\chardef\slashChar = `\/
174*36ac495dSmrg\chardef\underChar = `\_
175*36ac495dSmrg
176*36ac495dSmrg% Ignore a token.
177*36ac495dSmrg%
178*36ac495dSmrg\def\gobble#1{}
179*36ac495dSmrg
180*36ac495dSmrg% The following is used inside several \edef's.
181*36ac495dSmrg\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
182*36ac495dSmrg
183*36ac495dSmrg% Hyphenation fixes.
184*36ac495dSmrg\hyphenation{
185*36ac495dSmrg  Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
186*36ac495dSmrg  ap-pen-dix bit-map bit-maps
187*36ac495dSmrg  data-base data-bases eshell fall-ing half-way long-est man-u-script
188*36ac495dSmrg  man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
189*36ac495dSmrg  par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
190*36ac495dSmrg  spell-ing spell-ings
191*36ac495dSmrg  stand-alone strong-est time-stamp time-stamps which-ever white-space
192*36ac495dSmrg  wide-spread wrap-around
193*36ac495dSmrg}
194*36ac495dSmrg
195*36ac495dSmrg% Margin to add to right of even pages, to left of odd pages.
196*36ac495dSmrg\newdimen\bindingoffset
197*36ac495dSmrg\newdimen\normaloffset
198*36ac495dSmrg\newdimen\pagewidth \newdimen\pageheight
199*36ac495dSmrg
200*36ac495dSmrg% For a final copy, take out the rectangles
201*36ac495dSmrg% that mark overfull boxes (in case you have decided
202*36ac495dSmrg% that the text looks ok even though it passes the margin).
203*36ac495dSmrg%
204*36ac495dSmrg\def\finalout{\overfullrule=0pt }
205*36ac495dSmrg
206*36ac495dSmrg% Sometimes it is convenient to have everything in the transcript file
207*36ac495dSmrg% and nothing on the terminal.  We don't just call \tracingall here,
208*36ac495dSmrg% since that produces some useless output on the terminal.  We also make
209*36ac495dSmrg% some effort to order the tracing commands to reduce output in the log
210*36ac495dSmrg% file; cf. trace.sty in LaTeX.
211*36ac495dSmrg%
212*36ac495dSmrg\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
213*36ac495dSmrg\def\loggingall{%
214*36ac495dSmrg  \tracingstats2
215*36ac495dSmrg  \tracingpages1
216*36ac495dSmrg  \tracinglostchars2  % 2 gives us more in etex
217*36ac495dSmrg  \tracingparagraphs1
218*36ac495dSmrg  \tracingoutput1
219*36ac495dSmrg  \tracingmacros2
220*36ac495dSmrg  \tracingrestores1
221*36ac495dSmrg  \showboxbreadth\maxdimen \showboxdepth\maxdimen
222*36ac495dSmrg  \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
223*36ac495dSmrg    \tracingscantokens1
224*36ac495dSmrg    \tracingifs1
225*36ac495dSmrg    \tracinggroups1
226*36ac495dSmrg    \tracingnesting2
227*36ac495dSmrg    \tracingassigns1
228*36ac495dSmrg  \fi
229*36ac495dSmrg  \tracingcommands3  % 3 gives us more in etex
230*36ac495dSmrg  \errorcontextlines16
231*36ac495dSmrg}%
232*36ac495dSmrg
233*36ac495dSmrg% @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
234*36ac495dSmrg% aren't perfect, it's not the end of the world, being an error message,
235*36ac495dSmrg% after all.
236*36ac495dSmrg%
237*36ac495dSmrg\def\errormsg{\begingroup \indexnofonts \doerrormsg}
238*36ac495dSmrg\def\doerrormsg#1{\errmessage{#1}}
239*36ac495dSmrg
240*36ac495dSmrg% add check for \lastpenalty to plain's definitions.  If the last thing
241*36ac495dSmrg% we did was a \nobreak, we don't want to insert more space.
242*36ac495dSmrg%
243*36ac495dSmrg\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
244*36ac495dSmrg  \removelastskip\penalty-50\smallskip\fi\fi}
245*36ac495dSmrg\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
246*36ac495dSmrg  \removelastskip\penalty-100\medskip\fi\fi}
247*36ac495dSmrg\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
248*36ac495dSmrg  \removelastskip\penalty-200\bigskip\fi\fi}
249*36ac495dSmrg
250*36ac495dSmrg% Do @cropmarks to get crop marks.
251*36ac495dSmrg%
252*36ac495dSmrg\newif\ifcropmarks
253*36ac495dSmrg\let\cropmarks = \cropmarkstrue
254*36ac495dSmrg%
255*36ac495dSmrg% Dimensions to add cropmarks at corners.
256*36ac495dSmrg% Added by P. A. MacKay, 12 Nov. 1986
257*36ac495dSmrg%
258*36ac495dSmrg\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
259*36ac495dSmrg\newdimen\cornerlong  \cornerlong=1pc
260*36ac495dSmrg\newdimen\cornerthick \cornerthick=.3pt
261*36ac495dSmrg\newdimen\topandbottommargin \topandbottommargin=.75in
262*36ac495dSmrg
263*36ac495dSmrg% Output a mark which sets \thischapter, \thissection and \thiscolor.
264*36ac495dSmrg% We dump everything together because we only have one kind of mark.
265*36ac495dSmrg% This works because we only use \botmark / \topmark, not \firstmark.
266*36ac495dSmrg%
267*36ac495dSmrg% A mark contains a subexpression of the \ifcase ... \fi construct.
268*36ac495dSmrg% \get*marks macros below extract the needed part using \ifcase.
269*36ac495dSmrg%
270*36ac495dSmrg% Another complication is to let the user choose whether \thischapter
271*36ac495dSmrg% (\thissection) refers to the chapter (section) in effect at the top
272*36ac495dSmrg% of a page, or that at the bottom of a page.  The solution is
273*36ac495dSmrg% described on page 260 of The TeXbook.  It involves outputting two
274*36ac495dSmrg% marks for the sectioning macros, one before the section break, and
275*36ac495dSmrg% one after.  I won't pretend I can describe this better than DEK...
276*36ac495dSmrg\def\domark{%
277*36ac495dSmrg  \toks0=\expandafter{\lastchapterdefs}%
278*36ac495dSmrg  \toks2=\expandafter{\lastsectiondefs}%
279*36ac495dSmrg  \toks4=\expandafter{\prevchapterdefs}%
280*36ac495dSmrg  \toks6=\expandafter{\prevsectiondefs}%
281*36ac495dSmrg  \toks8=\expandafter{\lastcolordefs}%
282*36ac495dSmrg  \mark{%
283*36ac495dSmrg                   \the\toks0 \the\toks2
284*36ac495dSmrg      \noexpand\or \the\toks4 \the\toks6
285*36ac495dSmrg    \noexpand\else \the\toks8
286*36ac495dSmrg  }%
287*36ac495dSmrg}
288*36ac495dSmrg% \topmark doesn't work for the very first chapter (after the title
289*36ac495dSmrg% page or the contents), so we use \firstmark there -- this gets us
290*36ac495dSmrg% the mark with the chapter defs, unless the user sneaks in, e.g.,
291*36ac495dSmrg% @setcolor (or @url, or @link, etc.) between @contents and the very
292*36ac495dSmrg% first @chapter.
293*36ac495dSmrg\def\gettopheadingmarks{%
294*36ac495dSmrg  \ifcase0\topmark\fi
295*36ac495dSmrg  \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
296*36ac495dSmrg}
297*36ac495dSmrg\def\getbottomheadingmarks{\ifcase1\botmark\fi}
298*36ac495dSmrg\def\getcolormarks{\ifcase2\topmark\fi}
299*36ac495dSmrg
300*36ac495dSmrg% Avoid "undefined control sequence" errors.
301*36ac495dSmrg\def\lastchapterdefs{}
302*36ac495dSmrg\def\lastsectiondefs{}
303*36ac495dSmrg\def\prevchapterdefs{}
304*36ac495dSmrg\def\prevsectiondefs{}
305*36ac495dSmrg\def\lastcolordefs{}
306*36ac495dSmrg
307*36ac495dSmrg% Main output routine.
308*36ac495dSmrg\chardef\PAGE = 255
309*36ac495dSmrg\output = {\onepageout{\pagecontents\PAGE}}
310*36ac495dSmrg
311*36ac495dSmrg\newbox\headlinebox
312*36ac495dSmrg\newbox\footlinebox
313*36ac495dSmrg
314*36ac495dSmrg% \onepageout takes a vbox as an argument.  Note that \pagecontents
315*36ac495dSmrg% does insertions, but you have to call it yourself.
316*36ac495dSmrg\def\onepageout#1{%
317*36ac495dSmrg  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
318*36ac495dSmrg  %
319*36ac495dSmrg  \ifodd\pageno  \advance\hoffset by \bindingoffset
320*36ac495dSmrg  \else \advance\hoffset by -\bindingoffset\fi
321*36ac495dSmrg  %
322*36ac495dSmrg  % Do this outside of the \shipout so @code etc. will be expanded in
323*36ac495dSmrg  % the headline as they should be, not taken literally (outputting ''code).
324*36ac495dSmrg  \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
325*36ac495dSmrg  \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
326*36ac495dSmrg  \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
327*36ac495dSmrg  \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
328*36ac495dSmrg  %
329*36ac495dSmrg  {%
330*36ac495dSmrg    % Have to do this stuff outside the \shipout because we want it to
331*36ac495dSmrg    % take effect in \write's, yet the group defined by the \vbox ends
332*36ac495dSmrg    % before the \shipout runs.
333*36ac495dSmrg    %
334*36ac495dSmrg    \indexdummies         % don't expand commands in the output.
335*36ac495dSmrg    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
336*36ac495dSmrg               % the page break happens to be in the middle of an example.
337*36ac495dSmrg               % We don't want .vr (or whatever) entries like this:
338*36ac495dSmrg               % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
339*36ac495dSmrg               % "\acronym" won't work when it's read back in;
340*36ac495dSmrg               % it needs to be
341*36ac495dSmrg               % {\code {{\tt \backslashcurfont }acronym}
342*36ac495dSmrg    \shipout\vbox{%
343*36ac495dSmrg      % Do this early so pdf references go to the beginning of the page.
344*36ac495dSmrg      \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
345*36ac495dSmrg      %
346*36ac495dSmrg      \ifcropmarks \vbox to \outervsize\bgroup
347*36ac495dSmrg        \hsize = \outerhsize
348*36ac495dSmrg        \vskip-\topandbottommargin
349*36ac495dSmrg        \vtop to0pt{%
350*36ac495dSmrg          \line{\ewtop\hfil\ewtop}%
351*36ac495dSmrg          \nointerlineskip
352*36ac495dSmrg          \line{%
353*36ac495dSmrg            \vbox{\moveleft\cornerthick\nstop}%
354*36ac495dSmrg            \hfill
355*36ac495dSmrg            \vbox{\moveright\cornerthick\nstop}%
356*36ac495dSmrg          }%
357*36ac495dSmrg          \vss}%
358*36ac495dSmrg        \vskip\topandbottommargin
359*36ac495dSmrg        \line\bgroup
360*36ac495dSmrg          \hfil % center the page within the outer (page) hsize.
361*36ac495dSmrg          \ifodd\pageno\hskip\bindingoffset\fi
362*36ac495dSmrg          \vbox\bgroup
363*36ac495dSmrg      \fi
364*36ac495dSmrg      %
365*36ac495dSmrg      \unvbox\headlinebox
366*36ac495dSmrg      \pagebody{#1}%
367*36ac495dSmrg      \ifdim\ht\footlinebox > 0pt
368*36ac495dSmrg        % Only leave this space if the footline is nonempty.
369*36ac495dSmrg        % (We lessened \vsize for it in \oddfootingyyy.)
370*36ac495dSmrg        % The \baselineskip=24pt in plain's \makefootline has no effect.
371*36ac495dSmrg        \vskip 24pt
372*36ac495dSmrg        \unvbox\footlinebox
373*36ac495dSmrg      \fi
374*36ac495dSmrg      %
375*36ac495dSmrg      \ifcropmarks
376*36ac495dSmrg          \egroup % end of \vbox\bgroup
377*36ac495dSmrg        \hfil\egroup % end of (centering) \line\bgroup
378*36ac495dSmrg        \vskip\topandbottommargin plus1fill minus1fill
379*36ac495dSmrg        \boxmaxdepth = \cornerthick
380*36ac495dSmrg        \vbox to0pt{\vss
381*36ac495dSmrg          \line{%
382*36ac495dSmrg            \vbox{\moveleft\cornerthick\nsbot}%
383*36ac495dSmrg            \hfill
384*36ac495dSmrg            \vbox{\moveright\cornerthick\nsbot}%
385*36ac495dSmrg          }%
386*36ac495dSmrg          \nointerlineskip
387*36ac495dSmrg          \line{\ewbot\hfil\ewbot}%
388*36ac495dSmrg        }%
389*36ac495dSmrg      \egroup % \vbox from first cropmarks clause
390*36ac495dSmrg      \fi
391*36ac495dSmrg    }% end of \shipout\vbox
392*36ac495dSmrg  }% end of group with \indexdummies
393*36ac495dSmrg  \advancepageno
394*36ac495dSmrg  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
395*36ac495dSmrg}
396*36ac495dSmrg
397*36ac495dSmrg\newinsert\margin \dimen\margin=\maxdimen
398*36ac495dSmrg
399*36ac495dSmrg\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
400*36ac495dSmrg{\catcode`\@ =11
401*36ac495dSmrg\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
402*36ac495dSmrg% marginal hacks, juha@viisa.uucp (Juha Takala)
403*36ac495dSmrg\ifvoid\margin\else % marginal info is present
404*36ac495dSmrg  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
405*36ac495dSmrg\dimen@=\dp#1\relax \unvbox#1\relax
406*36ac495dSmrg\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
407*36ac495dSmrg\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
408*36ac495dSmrg}
409*36ac495dSmrg
410*36ac495dSmrg% Here are the rules for the cropmarks.  Note that they are
411*36ac495dSmrg% offset so that the space between them is truly \outerhsize or \outervsize
412*36ac495dSmrg% (P. A. MacKay, 12 November, 1986)
413*36ac495dSmrg%
414*36ac495dSmrg\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
415*36ac495dSmrg\def\nstop{\vbox
416*36ac495dSmrg  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
417*36ac495dSmrg\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
418*36ac495dSmrg\def\nsbot{\vbox
419*36ac495dSmrg  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
420*36ac495dSmrg
421*36ac495dSmrg% Parse an argument, then pass it to #1.  The argument is the rest of
422*36ac495dSmrg% the input line (except we remove a trailing comment).  #1 should be a
423*36ac495dSmrg% macro which expects an ordinary undelimited TeX argument.
424*36ac495dSmrg%
425*36ac495dSmrg\def\parsearg{\parseargusing{}}
426*36ac495dSmrg\def\parseargusing#1#2{%
427*36ac495dSmrg  \def\argtorun{#2}%
428*36ac495dSmrg  \begingroup
429*36ac495dSmrg    \obeylines
430*36ac495dSmrg    \spaceisspace
431*36ac495dSmrg    #1%
432*36ac495dSmrg    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
433*36ac495dSmrg}
434*36ac495dSmrg
435*36ac495dSmrg{\obeylines %
436*36ac495dSmrg  \gdef\parseargline#1^^M{%
437*36ac495dSmrg    \endgroup % End of the group started in \parsearg.
438*36ac495dSmrg    \argremovecomment #1\comment\ArgTerm%
439*36ac495dSmrg  }%
440*36ac495dSmrg}
441*36ac495dSmrg
442*36ac495dSmrg% First remove any @comment, then any @c comment.
443*36ac495dSmrg\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
444*36ac495dSmrg\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
445*36ac495dSmrg
446*36ac495dSmrg% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
447*36ac495dSmrg%
448*36ac495dSmrg% \argremovec might leave us with trailing space, e.g.,
449*36ac495dSmrg%    @end itemize  @c foo
450*36ac495dSmrg% This space token undergoes the same procedure and is eventually removed
451*36ac495dSmrg% by \finishparsearg.
452*36ac495dSmrg%
453*36ac495dSmrg\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
454*36ac495dSmrg\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
455*36ac495dSmrg\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
456*36ac495dSmrg  \def\temp{#3}%
457*36ac495dSmrg  \ifx\temp\empty
458*36ac495dSmrg    % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
459*36ac495dSmrg    \let\temp\finishparsearg
460*36ac495dSmrg  \else
461*36ac495dSmrg    \let\temp\argcheckspaces
462*36ac495dSmrg  \fi
463*36ac495dSmrg  % Put the space token in:
464*36ac495dSmrg  \temp#1 #3\ArgTerm
465*36ac495dSmrg}
466*36ac495dSmrg
467*36ac495dSmrg% If a _delimited_ argument is enclosed in braces, they get stripped; so
468*36ac495dSmrg% to get _exactly_ the rest of the line, we had to prevent such situation.
469*36ac495dSmrg% We prepended an \empty token at the very beginning and we expand it now,
470*36ac495dSmrg% just before passing the control to \argtorun.
471*36ac495dSmrg% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
472*36ac495dSmrg% either the null string, or it ends with \^^M---thus there is no danger
473*36ac495dSmrg% that a pair of braces would be stripped.
474*36ac495dSmrg%
475*36ac495dSmrg% But first, we have to remove the trailing space token.
476*36ac495dSmrg%
477*36ac495dSmrg\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
478*36ac495dSmrg
479*36ac495dSmrg% \parseargdef\foo{...}
480*36ac495dSmrg%	is roughly equivalent to
481*36ac495dSmrg% \def\foo{\parsearg\Xfoo}
482*36ac495dSmrg% \def\Xfoo#1{...}
483*36ac495dSmrg%
484*36ac495dSmrg% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
485*36ac495dSmrg% favourite TeX trick.  --kasal, 16nov03
486*36ac495dSmrg
487*36ac495dSmrg\def\parseargdef#1{%
488*36ac495dSmrg  \expandafter \doparseargdef \csname\string#1\endcsname #1%
489*36ac495dSmrg}
490*36ac495dSmrg\def\doparseargdef#1#2{%
491*36ac495dSmrg  \def#2{\parsearg#1}%
492*36ac495dSmrg  \def#1##1%
493*36ac495dSmrg}
494*36ac495dSmrg
495*36ac495dSmrg% Several utility definitions with active space:
496*36ac495dSmrg{
497*36ac495dSmrg  \obeyspaces
498*36ac495dSmrg  \gdef\obeyedspace{ }
499*36ac495dSmrg
500*36ac495dSmrg  % Make each space character in the input produce a normal interword
501*36ac495dSmrg  % space in the output.  Don't allow a line break at this space, as this
502*36ac495dSmrg  % is used only in environments like @example, where each line of input
503*36ac495dSmrg  % should produce a line of output anyway.
504*36ac495dSmrg  %
505*36ac495dSmrg  \gdef\sepspaces{\obeyspaces\let =\tie}
506*36ac495dSmrg
507*36ac495dSmrg  % If an index command is used in an @example environment, any spaces
508*36ac495dSmrg  % therein should become regular spaces in the raw index file, not the
509*36ac495dSmrg  % expansion of \tie (\leavevmode \penalty \@M \ ).
510*36ac495dSmrg  \gdef\unsepspaces{\let =\space}
511*36ac495dSmrg}
512*36ac495dSmrg
513*36ac495dSmrg
514*36ac495dSmrg\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
515*36ac495dSmrg
516*36ac495dSmrg% Define the framework for environments in texinfo.tex.  It's used like this:
517*36ac495dSmrg%
518*36ac495dSmrg%   \envdef\foo{...}
519*36ac495dSmrg%   \def\Efoo{...}
520*36ac495dSmrg%
521*36ac495dSmrg% It's the responsibility of \envdef to insert \begingroup before the
522*36ac495dSmrg% actual body; @end closes the group after calling \Efoo.  \envdef also
523*36ac495dSmrg% defines \thisenv, so the current environment is known; @end checks
524*36ac495dSmrg% whether the environment name matches.  The \checkenv macro can also be
525*36ac495dSmrg% used to check whether the current environment is the one expected.
526*36ac495dSmrg%
527*36ac495dSmrg% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
528*36ac495dSmrg% are not treated as environments; they don't open a group.  (The
529*36ac495dSmrg% implementation of @end takes care not to call \endgroup in this
530*36ac495dSmrg% special case.)
531*36ac495dSmrg
532*36ac495dSmrg
533*36ac495dSmrg% At run-time, environments start with this:
534*36ac495dSmrg\def\startenvironment#1{\begingroup\def\thisenv{#1}}
535*36ac495dSmrg% initialize
536*36ac495dSmrg\let\thisenv\empty
537*36ac495dSmrg
538*36ac495dSmrg% ... but they get defined via ``\envdef\foo{...}'':
539*36ac495dSmrg\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
540*36ac495dSmrg\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
541*36ac495dSmrg
542*36ac495dSmrg% Check whether we're in the right environment:
543*36ac495dSmrg\def\checkenv#1{%
544*36ac495dSmrg  \def\temp{#1}%
545*36ac495dSmrg  \ifx\thisenv\temp
546*36ac495dSmrg  \else
547*36ac495dSmrg    \badenverr
548*36ac495dSmrg  \fi
549*36ac495dSmrg}
550*36ac495dSmrg
551*36ac495dSmrg% Environment mismatch, #1 expected:
552*36ac495dSmrg\def\badenverr{%
553*36ac495dSmrg  \errhelp = \EMsimple
554*36ac495dSmrg  \errmessage{This command can appear only \inenvironment\temp,
555*36ac495dSmrg    not \inenvironment\thisenv}%
556*36ac495dSmrg}
557*36ac495dSmrg\def\inenvironment#1{%
558*36ac495dSmrg  \ifx#1\empty
559*36ac495dSmrg    outside of any environment%
560*36ac495dSmrg  \else
561*36ac495dSmrg    in environment \expandafter\string#1%
562*36ac495dSmrg  \fi
563*36ac495dSmrg}
564*36ac495dSmrg
565*36ac495dSmrg% @end foo executes the definition of \Efoo.
566*36ac495dSmrg% But first, it executes a specialized version of \checkenv
567*36ac495dSmrg%
568*36ac495dSmrg\parseargdef\end{%
569*36ac495dSmrg  \if 1\csname iscond.#1\endcsname
570*36ac495dSmrg  \else
571*36ac495dSmrg    % The general wording of \badenverr may not be ideal.
572*36ac495dSmrg    \expandafter\checkenv\csname#1\endcsname
573*36ac495dSmrg    \csname E#1\endcsname
574*36ac495dSmrg    \endgroup
575*36ac495dSmrg  \fi
576*36ac495dSmrg}
577*36ac495dSmrg
578*36ac495dSmrg\newhelp\EMsimple{Press RETURN to continue.}
579*36ac495dSmrg
580*36ac495dSmrg
581*36ac495dSmrg% Be sure we're in horizontal mode when doing a tie, since we make space
582*36ac495dSmrg% equivalent to this in @example-like environments. Otherwise, a space
583*36ac495dSmrg% at the beginning of a line will start with \penalty -- and
584*36ac495dSmrg% since \penalty is valid in vertical mode, we'd end up putting the
585*36ac495dSmrg% penalty on the vertical list instead of in the new paragraph.
586*36ac495dSmrg{\catcode`@ = 11
587*36ac495dSmrg % Avoid using \@M directly, because that causes trouble
588*36ac495dSmrg % if the definition is written into an index file.
589*36ac495dSmrg \global\let\tiepenalty = \@M
590*36ac495dSmrg \gdef\tie{\leavevmode\penalty\tiepenalty\ }
591*36ac495dSmrg}
592*36ac495dSmrg
593*36ac495dSmrg% @: forces normal size whitespace following.
594*36ac495dSmrg\def\:{\spacefactor=1000 }
595*36ac495dSmrg
596*36ac495dSmrg% @* forces a line break.
597*36ac495dSmrg\def\*{\hfil\break\hbox{}\ignorespaces}
598*36ac495dSmrg
599*36ac495dSmrg% @/ allows a line break.
600*36ac495dSmrg\let\/=\allowbreak
601*36ac495dSmrg
602*36ac495dSmrg% @. is an end-of-sentence period.
603*36ac495dSmrg\def\.{.\spacefactor=\endofsentencespacefactor\space}
604*36ac495dSmrg
605*36ac495dSmrg% @! is an end-of-sentence bang.
606*36ac495dSmrg\def\!{!\spacefactor=\endofsentencespacefactor\space}
607*36ac495dSmrg
608*36ac495dSmrg% @? is an end-of-sentence query.
609*36ac495dSmrg\def\?{?\spacefactor=\endofsentencespacefactor\space}
610*36ac495dSmrg
611*36ac495dSmrg% @frenchspacing on|off  says whether to put extra space after punctuation.
612*36ac495dSmrg%
613*36ac495dSmrg\def\onword{on}
614*36ac495dSmrg\def\offword{off}
615*36ac495dSmrg%
616*36ac495dSmrg\parseargdef\frenchspacing{%
617*36ac495dSmrg  \def\temp{#1}%
618*36ac495dSmrg  \ifx\temp\onword \plainfrenchspacing
619*36ac495dSmrg  \else\ifx\temp\offword \plainnonfrenchspacing
620*36ac495dSmrg  \else
621*36ac495dSmrg    \errhelp = \EMsimple
622*36ac495dSmrg    \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
623*36ac495dSmrg  \fi\fi
624*36ac495dSmrg}
625*36ac495dSmrg
626*36ac495dSmrg% @w prevents a word break.  Without the \leavevmode, @w at the
627*36ac495dSmrg% beginning of a paragraph, when TeX is still in vertical mode, would
628*36ac495dSmrg% produce a whole line of output instead of starting the paragraph.
629*36ac495dSmrg\def\w#1{\leavevmode\hbox{#1}}
630*36ac495dSmrg
631*36ac495dSmrg% @group ... @end group forces ... to be all on one page, by enclosing
632*36ac495dSmrg% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
633*36ac495dSmrg% to keep its height that of a normal line.  According to the rules for
634*36ac495dSmrg% \topskip (p.114 of the TeXbook), the glue inserted is
635*36ac495dSmrg% max (\topskip - \ht (first item), 0).  If that height is large,
636*36ac495dSmrg% therefore, no glue is inserted, and the space between the headline and
637*36ac495dSmrg% the text is small, which looks bad.
638*36ac495dSmrg%
639*36ac495dSmrg% Another complication is that the group might be very large.  This can
640*36ac495dSmrg% cause the glue on the previous page to be unduly stretched, because it
641*36ac495dSmrg% does not have much material.  In this case, it's better to add an
642*36ac495dSmrg% explicit \vfill so that the extra space is at the bottom.  The
643*36ac495dSmrg% threshold for doing this is if the group is more than \vfilllimit
644*36ac495dSmrg% percent of a page (\vfilllimit can be changed inside of @tex).
645*36ac495dSmrg%
646*36ac495dSmrg\newbox\groupbox
647*36ac495dSmrg\def\vfilllimit{0.7}
648*36ac495dSmrg%
649*36ac495dSmrg\envdef\group{%
650*36ac495dSmrg  \ifnum\catcode`\^^M=\active \else
651*36ac495dSmrg    \errhelp = \groupinvalidhelp
652*36ac495dSmrg    \errmessage{@group invalid in context where filling is enabled}%
653*36ac495dSmrg  \fi
654*36ac495dSmrg  \startsavinginserts
655*36ac495dSmrg  %
656*36ac495dSmrg  \setbox\groupbox = \vtop\bgroup
657*36ac495dSmrg    % Do @comment since we are called inside an environment such as
658*36ac495dSmrg    % @example, where each end-of-line in the input causes an
659*36ac495dSmrg    % end-of-line in the output.  We don't want the end-of-line after
660*36ac495dSmrg    % the `@group' to put extra space in the output.  Since @group
661*36ac495dSmrg    % should appear on a line by itself (according to the Texinfo
662*36ac495dSmrg    % manual), we don't worry about eating any user text.
663*36ac495dSmrg    \comment
664*36ac495dSmrg}
665*36ac495dSmrg%
666*36ac495dSmrg% The \vtop produces a box with normal height and large depth; thus, TeX puts
667*36ac495dSmrg% \baselineskip glue before it, and (when the next line of text is done)
668*36ac495dSmrg% \lineskip glue after it.  Thus, space below is not quite equal to space
669*36ac495dSmrg% above.  But it's pretty close.
670*36ac495dSmrg\def\Egroup{%
671*36ac495dSmrg    % To get correct interline space between the last line of the group
672*36ac495dSmrg    % and the first line afterwards, we have to propagate \prevdepth.
673*36ac495dSmrg    \endgraf % Not \par, as it may have been set to \lisppar.
674*36ac495dSmrg    \global\dimen1 = \prevdepth
675*36ac495dSmrg  \egroup           % End the \vtop.
676*36ac495dSmrg  % \dimen0 is the vertical size of the group's box.
677*36ac495dSmrg  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
678*36ac495dSmrg  % \dimen2 is how much space is left on the page (more or less).
679*36ac495dSmrg  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
680*36ac495dSmrg  % if the group doesn't fit on the current page, and it's a big big
681*36ac495dSmrg  % group, force a page break.
682*36ac495dSmrg  \ifdim \dimen0 > \dimen2
683*36ac495dSmrg    \ifdim \pagetotal < \vfilllimit\pageheight
684*36ac495dSmrg      \page
685*36ac495dSmrg    \fi
686*36ac495dSmrg  \fi
687*36ac495dSmrg  \box\groupbox
688*36ac495dSmrg  \prevdepth = \dimen1
689*36ac495dSmrg  \checkinserts
690*36ac495dSmrg}
691*36ac495dSmrg%
692*36ac495dSmrg% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
693*36ac495dSmrg% message, so this ends up printing `@group can only ...'.
694*36ac495dSmrg%
695*36ac495dSmrg\newhelp\groupinvalidhelp{%
696*36ac495dSmrggroup can only be used in environments such as @example,^^J%
697*36ac495dSmrgwhere each line of input produces a line of output.}
698*36ac495dSmrg
699*36ac495dSmrg% @need space-in-mils
700*36ac495dSmrg% forces a page break if there is not space-in-mils remaining.
701*36ac495dSmrg
702*36ac495dSmrg\newdimen\mil  \mil=0.001in
703*36ac495dSmrg
704*36ac495dSmrg\parseargdef\need{%
705*36ac495dSmrg  % Ensure vertical mode, so we don't make a big box in the middle of a
706*36ac495dSmrg  % paragraph.
707*36ac495dSmrg  \par
708*36ac495dSmrg  %
709*36ac495dSmrg  % If the @need value is less than one line space, it's useless.
710*36ac495dSmrg  \dimen0 = #1\mil
711*36ac495dSmrg  \dimen2 = \ht\strutbox
712*36ac495dSmrg  \advance\dimen2 by \dp\strutbox
713*36ac495dSmrg  \ifdim\dimen0 > \dimen2
714*36ac495dSmrg    %
715*36ac495dSmrg    % Do a \strut just to make the height of this box be normal, so the
716*36ac495dSmrg    % normal leading is inserted relative to the preceding line.
717*36ac495dSmrg    % And a page break here is fine.
718*36ac495dSmrg    \vtop to #1\mil{\strut\vfil}%
719*36ac495dSmrg    %
720*36ac495dSmrg    % TeX does not even consider page breaks if a penalty added to the
721*36ac495dSmrg    % main vertical list is 10000 or more.  But in order to see if the
722*36ac495dSmrg    % empty box we just added fits on the page, we must make it consider
723*36ac495dSmrg    % page breaks.  On the other hand, we don't want to actually break the
724*36ac495dSmrg    % page after the empty box.  So we use a penalty of 9999.
725*36ac495dSmrg    %
726*36ac495dSmrg    % There is an extremely small chance that TeX will actually break the
727*36ac495dSmrg    % page at this \penalty, if there are no other feasible breakpoints in
728*36ac495dSmrg    % sight.  (If the user is using lots of big @group commands, which
729*36ac495dSmrg    % almost-but-not-quite fill up a page, TeX will have a hard time doing
730*36ac495dSmrg    % good page breaking, for example.)  However, I could not construct an
731*36ac495dSmrg    % example where a page broke at this \penalty; if it happens in a real
732*36ac495dSmrg    % document, then we can reconsider our strategy.
733*36ac495dSmrg    \penalty9999
734*36ac495dSmrg    %
735*36ac495dSmrg    % Back up by the size of the box, whether we did a page break or not.
736*36ac495dSmrg    \kern -#1\mil
737*36ac495dSmrg    %
738*36ac495dSmrg    % Do not allow a page break right after this kern.
739*36ac495dSmrg    \nobreak
740*36ac495dSmrg  \fi
741*36ac495dSmrg}
742*36ac495dSmrg
743*36ac495dSmrg% @br   forces paragraph break (and is undocumented).
744*36ac495dSmrg
745*36ac495dSmrg\let\br = \par
746*36ac495dSmrg
747*36ac495dSmrg% @page forces the start of a new page.
748*36ac495dSmrg%
749*36ac495dSmrg\def\page{\par\vfill\supereject}
750*36ac495dSmrg
751*36ac495dSmrg% @exdent text....
752*36ac495dSmrg% outputs text on separate line in roman font, starting at standard page margin
753*36ac495dSmrg
754*36ac495dSmrg% This records the amount of indent in the innermost environment.
755*36ac495dSmrg% That's how much \exdent should take out.
756*36ac495dSmrg\newskip\exdentamount
757*36ac495dSmrg
758*36ac495dSmrg% This defn is used inside fill environments such as @defun.
759*36ac495dSmrg\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
760*36ac495dSmrg
761*36ac495dSmrg% This defn is used inside nofill environments such as @example.
762*36ac495dSmrg\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
763*36ac495dSmrg  \leftline{\hskip\leftskip{\rm#1}}}}
764*36ac495dSmrg
765*36ac495dSmrg% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
766*36ac495dSmrg% paragraph.  For more general purposes, use the \margin insertion
767*36ac495dSmrg% class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
768*36ac495dSmrg%
769*36ac495dSmrg\newskip\inmarginspacing \inmarginspacing=1cm
770*36ac495dSmrg\def\strutdepth{\dp\strutbox}
771*36ac495dSmrg%
772*36ac495dSmrg\def\doinmargin#1#2{\strut\vadjust{%
773*36ac495dSmrg  \nobreak
774*36ac495dSmrg  \kern-\strutdepth
775*36ac495dSmrg  \vtop to \strutdepth{%
776*36ac495dSmrg    \baselineskip=\strutdepth
777*36ac495dSmrg    \vss
778*36ac495dSmrg    % if you have multiple lines of stuff to put here, you'll need to
779*36ac495dSmrg    % make the vbox yourself of the appropriate size.
780*36ac495dSmrg    \ifx#1l%
781*36ac495dSmrg      \llap{\ignorespaces #2\hskip\inmarginspacing}%
782*36ac495dSmrg    \else
783*36ac495dSmrg      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
784*36ac495dSmrg    \fi
785*36ac495dSmrg    \null
786*36ac495dSmrg  }%
787*36ac495dSmrg}}
788*36ac495dSmrg\def\inleftmargin{\doinmargin l}
789*36ac495dSmrg\def\inrightmargin{\doinmargin r}
790*36ac495dSmrg%
791*36ac495dSmrg% @inmargin{TEXT [, RIGHT-TEXT]}
792*36ac495dSmrg% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
793*36ac495dSmrg% else use TEXT for both).
794*36ac495dSmrg%
795*36ac495dSmrg\def\inmargin#1{\parseinmargin #1,,\finish}
796*36ac495dSmrg\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
797*36ac495dSmrg  \setbox0 = \hbox{\ignorespaces #2}%
798*36ac495dSmrg  \ifdim\wd0 > 0pt
799*36ac495dSmrg    \def\lefttext{#1}%  have both texts
800*36ac495dSmrg    \def\righttext{#2}%
801*36ac495dSmrg  \else
802*36ac495dSmrg    \def\lefttext{#1}%  have only one text
803*36ac495dSmrg    \def\righttext{#1}%
804*36ac495dSmrg  \fi
805*36ac495dSmrg  %
806*36ac495dSmrg  \ifodd\pageno
807*36ac495dSmrg    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
808*36ac495dSmrg  \else
809*36ac495dSmrg    \def\temp{\inleftmargin\lefttext}%
810*36ac495dSmrg  \fi
811*36ac495dSmrg  \temp
812*36ac495dSmrg}
813*36ac495dSmrg
814*36ac495dSmrg% @| inserts a changebar to the left of the current line.  It should
815*36ac495dSmrg% surround any changed text.  This approach does *not* work if the
816*36ac495dSmrg% change spans more than two lines of output.  To handle that, we would
817*36ac495dSmrg% have adopt a much more difficult approach (putting marks into the main
818*36ac495dSmrg% vertical list for the beginning and end of each change).  This command
819*36ac495dSmrg% is not documented, not supported, and doesn't work.
820*36ac495dSmrg%
821*36ac495dSmrg\def\|{%
822*36ac495dSmrg  % \vadjust can only be used in horizontal mode.
823*36ac495dSmrg  \leavevmode
824*36ac495dSmrg  %
825*36ac495dSmrg  % Append this vertical mode material after the current line in the output.
826*36ac495dSmrg  \vadjust{%
827*36ac495dSmrg    % We want to insert a rule with the height and depth of the current
828*36ac495dSmrg    % leading; that is exactly what \strutbox is supposed to record.
829*36ac495dSmrg    \vskip-\baselineskip
830*36ac495dSmrg    %
831*36ac495dSmrg    % \vadjust-items are inserted at the left edge of the type.  So
832*36ac495dSmrg    % the \llap here moves out into the left-hand margin.
833*36ac495dSmrg    \llap{%
834*36ac495dSmrg      %
835*36ac495dSmrg      % For a thicker or thinner bar, change the `1pt'.
836*36ac495dSmrg      \vrule height\baselineskip width1pt
837*36ac495dSmrg      %
838*36ac495dSmrg      % This is the space between the bar and the text.
839*36ac495dSmrg      \hskip 12pt
840*36ac495dSmrg    }%
841*36ac495dSmrg  }%
842*36ac495dSmrg}
843*36ac495dSmrg
844*36ac495dSmrg% @include FILE -- \input text of FILE.
845*36ac495dSmrg%
846*36ac495dSmrg\def\include{\parseargusing\filenamecatcodes\includezzz}
847*36ac495dSmrg\def\includezzz#1{%
848*36ac495dSmrg  \pushthisfilestack
849*36ac495dSmrg  \def\thisfile{#1}%
850*36ac495dSmrg  {%
851*36ac495dSmrg    \makevalueexpandable  % we want to expand any @value in FILE.
852*36ac495dSmrg    \turnoffactive        % and allow special characters in the expansion
853*36ac495dSmrg    \indexnofonts         % Allow `@@' and other weird things in file names.
854*36ac495dSmrg    \wlog{texinfo.tex: doing @include of #1^^J}%
855*36ac495dSmrg    \edef\temp{\noexpand\input #1 }%
856*36ac495dSmrg    %
857*36ac495dSmrg    % This trickery is to read FILE outside of a group, in case it makes
858*36ac495dSmrg    % definitions, etc.
859*36ac495dSmrg    \expandafter
860*36ac495dSmrg  }\temp
861*36ac495dSmrg  \popthisfilestack
862*36ac495dSmrg}
863*36ac495dSmrg\def\filenamecatcodes{%
864*36ac495dSmrg  \catcode`\\=\other
865*36ac495dSmrg  \catcode`~=\other
866*36ac495dSmrg  \catcode`^=\other
867*36ac495dSmrg  \catcode`_=\other
868*36ac495dSmrg  \catcode`|=\other
869*36ac495dSmrg  \catcode`<=\other
870*36ac495dSmrg  \catcode`>=\other
871*36ac495dSmrg  \catcode`+=\other
872*36ac495dSmrg  \catcode`-=\other
873*36ac495dSmrg  \catcode`\`=\other
874*36ac495dSmrg  \catcode`\'=\other
875*36ac495dSmrg}
876*36ac495dSmrg
877*36ac495dSmrg\def\pushthisfilestack{%
878*36ac495dSmrg  \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
879*36ac495dSmrg}
880*36ac495dSmrg\def\pushthisfilestackX{%
881*36ac495dSmrg  \expandafter\pushthisfilestackY\thisfile\StackTerm
882*36ac495dSmrg}
883*36ac495dSmrg\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
884*36ac495dSmrg  \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
885*36ac495dSmrg}
886*36ac495dSmrg
887*36ac495dSmrg\def\popthisfilestack{\errthisfilestackempty}
888*36ac495dSmrg\def\errthisfilestackempty{\errmessage{Internal error:
889*36ac495dSmrg  the stack of filenames is empty.}}
890*36ac495dSmrg%
891*36ac495dSmrg\def\thisfile{}
892*36ac495dSmrg
893*36ac495dSmrg% @center line
894*36ac495dSmrg% outputs that line, centered.
895*36ac495dSmrg%
896*36ac495dSmrg\parseargdef\center{%
897*36ac495dSmrg  \ifhmode
898*36ac495dSmrg    \let\centersub\centerH
899*36ac495dSmrg  \else
900*36ac495dSmrg    \let\centersub\centerV
901*36ac495dSmrg  \fi
902*36ac495dSmrg  \centersub{\hfil \ignorespaces#1\unskip \hfil}%
903*36ac495dSmrg  \let\centersub\relax % don't let the definition persist, just in case
904*36ac495dSmrg}
905*36ac495dSmrg\def\centerH#1{{%
906*36ac495dSmrg  \hfil\break
907*36ac495dSmrg  \advance\hsize by -\leftskip
908*36ac495dSmrg  \advance\hsize by -\rightskip
909*36ac495dSmrg  \line{#1}%
910*36ac495dSmrg  \break
911*36ac495dSmrg}}
912*36ac495dSmrg%
913*36ac495dSmrg\newcount\centerpenalty
914*36ac495dSmrg\def\centerV#1{%
915*36ac495dSmrg  % The idea here is the same as in \startdefun, \cartouche, etc.: if
916*36ac495dSmrg  % @center is the first thing after a section heading, we need to wipe
917*36ac495dSmrg  % out the negative parskip inserted by \sectionheading, but still
918*36ac495dSmrg  % prevent a page break here.
919*36ac495dSmrg  \centerpenalty = \lastpenalty
920*36ac495dSmrg  \ifnum\centerpenalty>10000 \vskip\parskip \fi
921*36ac495dSmrg  \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
922*36ac495dSmrg  \line{\kern\leftskip #1\kern\rightskip}%
923*36ac495dSmrg}
924*36ac495dSmrg
925*36ac495dSmrg% @sp n   outputs n lines of vertical space
926*36ac495dSmrg%
927*36ac495dSmrg\parseargdef\sp{\vskip #1\baselineskip}
928*36ac495dSmrg
929*36ac495dSmrg% @comment ...line which is ignored...
930*36ac495dSmrg% @c is the same as @comment
931*36ac495dSmrg% @ignore ... @end ignore  is another way to write a comment
932*36ac495dSmrg%
933*36ac495dSmrg\def\comment{\begingroup \catcode`\^^M=\other%
934*36ac495dSmrg\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
935*36ac495dSmrg\commentxxx}
936*36ac495dSmrg{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
937*36ac495dSmrg%
938*36ac495dSmrg\let\c=\comment
939*36ac495dSmrg
940*36ac495dSmrg% @paragraphindent NCHARS
941*36ac495dSmrg% We'll use ems for NCHARS, close enough.
942*36ac495dSmrg% NCHARS can also be the word `asis' or `none'.
943*36ac495dSmrg% We cannot feasibly implement @paragraphindent asis, though.
944*36ac495dSmrg%
945*36ac495dSmrg\def\asisword{asis} % no translation, these are keywords
946*36ac495dSmrg\def\noneword{none}
947*36ac495dSmrg%
948*36ac495dSmrg\parseargdef\paragraphindent{%
949*36ac495dSmrg  \def\temp{#1}%
950*36ac495dSmrg  \ifx\temp\asisword
951*36ac495dSmrg  \else
952*36ac495dSmrg    \ifx\temp\noneword
953*36ac495dSmrg      \defaultparindent = 0pt
954*36ac495dSmrg    \else
955*36ac495dSmrg      \defaultparindent = #1em
956*36ac495dSmrg    \fi
957*36ac495dSmrg  \fi
958*36ac495dSmrg  \parindent = \defaultparindent
959*36ac495dSmrg}
960*36ac495dSmrg
961*36ac495dSmrg% @exampleindent NCHARS
962*36ac495dSmrg% We'll use ems for NCHARS like @paragraphindent.
963*36ac495dSmrg% It seems @exampleindent asis isn't necessary, but
964*36ac495dSmrg% I preserve it to make it similar to @paragraphindent.
965*36ac495dSmrg\parseargdef\exampleindent{%
966*36ac495dSmrg  \def\temp{#1}%
967*36ac495dSmrg  \ifx\temp\asisword
968*36ac495dSmrg  \else
969*36ac495dSmrg    \ifx\temp\noneword
970*36ac495dSmrg      \lispnarrowing = 0pt
971*36ac495dSmrg    \else
972*36ac495dSmrg      \lispnarrowing = #1em
973*36ac495dSmrg    \fi
974*36ac495dSmrg  \fi
975*36ac495dSmrg}
976*36ac495dSmrg
977*36ac495dSmrg% @firstparagraphindent WORD
978*36ac495dSmrg% If WORD is `none', then suppress indentation of the first paragraph
979*36ac495dSmrg% after a section heading.  If WORD is `insert', then do indent at such
980*36ac495dSmrg% paragraphs.
981*36ac495dSmrg%
982*36ac495dSmrg% The paragraph indentation is suppressed or not by calling
983*36ac495dSmrg% \suppressfirstparagraphindent, which the sectioning commands do.
984*36ac495dSmrg% We switch the definition of this back and forth according to WORD.
985*36ac495dSmrg% By default, we suppress indentation.
986*36ac495dSmrg%
987*36ac495dSmrg\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
988*36ac495dSmrg\def\insertword{insert}
989*36ac495dSmrg%
990*36ac495dSmrg\parseargdef\firstparagraphindent{%
991*36ac495dSmrg  \def\temp{#1}%
992*36ac495dSmrg  \ifx\temp\noneword
993*36ac495dSmrg    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
994*36ac495dSmrg  \else\ifx\temp\insertword
995*36ac495dSmrg    \let\suppressfirstparagraphindent = \relax
996*36ac495dSmrg  \else
997*36ac495dSmrg    \errhelp = \EMsimple
998*36ac495dSmrg    \errmessage{Unknown @firstparagraphindent option `\temp'}%
999*36ac495dSmrg  \fi\fi
1000*36ac495dSmrg}
1001*36ac495dSmrg
1002*36ac495dSmrg% Here is how we actually suppress indentation.  Redefine \everypar to
1003*36ac495dSmrg% \kern backwards by \parindent, and then reset itself to empty.
1004*36ac495dSmrg%
1005*36ac495dSmrg% We also make \indent itself not actually do anything until the next
1006*36ac495dSmrg% paragraph.
1007*36ac495dSmrg%
1008*36ac495dSmrg\gdef\dosuppressfirstparagraphindent{%
1009*36ac495dSmrg  \gdef\indent{%
1010*36ac495dSmrg    \restorefirstparagraphindent
1011*36ac495dSmrg    \indent
1012*36ac495dSmrg  }%
1013*36ac495dSmrg  \gdef\noindent{%
1014*36ac495dSmrg    \restorefirstparagraphindent
1015*36ac495dSmrg    \noindent
1016*36ac495dSmrg  }%
1017*36ac495dSmrg  \global\everypar = {%
1018*36ac495dSmrg    \kern -\parindent
1019*36ac495dSmrg    \restorefirstparagraphindent
1020*36ac495dSmrg  }%
1021*36ac495dSmrg}
1022*36ac495dSmrg
1023*36ac495dSmrg\gdef\restorefirstparagraphindent{%
1024*36ac495dSmrg  \global \let \indent = \ptexindent
1025*36ac495dSmrg  \global \let \noindent = \ptexnoindent
1026*36ac495dSmrg  \global \everypar = {}%
1027*36ac495dSmrg}
1028*36ac495dSmrg
1029*36ac495dSmrg
1030*36ac495dSmrg% @refill is a no-op.
1031*36ac495dSmrg\let\refill=\relax
1032*36ac495dSmrg
1033*36ac495dSmrg% If working on a large document in chapters, it is convenient to
1034*36ac495dSmrg% be able to disable indexing, cross-referencing, and contents, for test runs.
1035*36ac495dSmrg% This is done with @novalidate (before @setfilename).
1036*36ac495dSmrg%
1037*36ac495dSmrg\newif\iflinks \linkstrue % by default we want the aux files.
1038*36ac495dSmrg\let\novalidate = \linksfalse
1039*36ac495dSmrg
1040*36ac495dSmrg% @setfilename is done at the beginning of every texinfo file.
1041*36ac495dSmrg% So open here the files we need to have open while reading the input.
1042*36ac495dSmrg% This makes it possible to make a .fmt file for texinfo.
1043*36ac495dSmrg\def\setfilename{%
1044*36ac495dSmrg   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
1045*36ac495dSmrg   \iflinks
1046*36ac495dSmrg     \tryauxfile
1047*36ac495dSmrg     % Open the new aux file.  TeX will close it automatically at exit.
1048*36ac495dSmrg     \immediate\openout\auxfile=\jobname.aux
1049*36ac495dSmrg   \fi % \openindices needs to do some work in any case.
1050*36ac495dSmrg   \openindices
1051*36ac495dSmrg   \let\setfilename=\comment % Ignore extra @setfilename cmds.
1052*36ac495dSmrg   %
1053*36ac495dSmrg   % If texinfo.cnf is present on the system, read it.
1054*36ac495dSmrg   % Useful for site-wide @afourpaper, etc.
1055*36ac495dSmrg   \openin 1 texinfo.cnf
1056*36ac495dSmrg   \ifeof 1 \else \input texinfo.cnf \fi
1057*36ac495dSmrg   \closein 1
1058*36ac495dSmrg   %
1059*36ac495dSmrg   \comment % Ignore the actual filename.
1060*36ac495dSmrg}
1061*36ac495dSmrg
1062*36ac495dSmrg% Called from \setfilename.
1063*36ac495dSmrg%
1064*36ac495dSmrg\def\openindices{%
1065*36ac495dSmrg  \newindex{cp}%
1066*36ac495dSmrg  \newcodeindex{fn}%
1067*36ac495dSmrg  \newcodeindex{vr}%
1068*36ac495dSmrg  \newcodeindex{tp}%
1069*36ac495dSmrg  \newcodeindex{ky}%
1070*36ac495dSmrg  \newcodeindex{pg}%
1071*36ac495dSmrg}
1072*36ac495dSmrg
1073*36ac495dSmrg% @bye.
1074*36ac495dSmrg\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1075*36ac495dSmrg
1076*36ac495dSmrg
1077*36ac495dSmrg\message{pdf,}
1078*36ac495dSmrg% adobe `portable' document format
1079*36ac495dSmrg\newcount\tempnum
1080*36ac495dSmrg\newcount\lnkcount
1081*36ac495dSmrg\newtoks\filename
1082*36ac495dSmrg\newcount\filenamelength
1083*36ac495dSmrg\newcount\pgn
1084*36ac495dSmrg\newtoks\toksA
1085*36ac495dSmrg\newtoks\toksB
1086*36ac495dSmrg\newtoks\toksC
1087*36ac495dSmrg\newtoks\toksD
1088*36ac495dSmrg\newbox\boxA
1089*36ac495dSmrg\newcount\countA
1090*36ac495dSmrg\newif\ifpdf
1091*36ac495dSmrg\newif\ifpdfmakepagedest
1092*36ac495dSmrg
1093*36ac495dSmrg% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1094*36ac495dSmrg% can be set).  So we test for \relax and 0 as well as being undefined.
1095*36ac495dSmrg\ifx\pdfoutput\thisisundefined
1096*36ac495dSmrg\else
1097*36ac495dSmrg  \ifx\pdfoutput\relax
1098*36ac495dSmrg  \else
1099*36ac495dSmrg    \ifcase\pdfoutput
1100*36ac495dSmrg    \else
1101*36ac495dSmrg      \pdftrue
1102*36ac495dSmrg    \fi
1103*36ac495dSmrg  \fi
1104*36ac495dSmrg\fi
1105*36ac495dSmrg
1106*36ac495dSmrg% PDF uses PostScript string constants for the names of xref targets,
1107*36ac495dSmrg% for display in the outlines, and in other places.  Thus, we have to
1108*36ac495dSmrg% double any backslashes.  Otherwise, a name like "\node" will be
1109*36ac495dSmrg% interpreted as a newline (\n), followed by o, d, e.  Not good.
1110*36ac495dSmrg%
1111*36ac495dSmrg% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1112*36ac495dSmrg% related messages.  The final outcome is that it is up to the TeX user
1113*36ac495dSmrg% to double the backslashes and otherwise make the string valid, so
1114*36ac495dSmrg% that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
1115*36ac495dSmrg% do this reliably, so we use it.
1116*36ac495dSmrg
1117*36ac495dSmrg% #1 is a control sequence in which to do the replacements,
1118*36ac495dSmrg% which we \xdef.
1119*36ac495dSmrg\def\txiescapepdf#1{%
1120*36ac495dSmrg  \ifx\pdfescapestring\thisisundefined
1121*36ac495dSmrg    % No primitive available; should we give a warning or log?
1122*36ac495dSmrg    % Many times it won't matter.
1123*36ac495dSmrg  \else
1124*36ac495dSmrg    % The expandable \pdfescapestring primitive escapes parentheses,
1125*36ac495dSmrg    % backslashes, and other special chars.
1126*36ac495dSmrg    \xdef#1{\pdfescapestring{#1}}%
1127*36ac495dSmrg  \fi
1128*36ac495dSmrg}
1129*36ac495dSmrg
1130*36ac495dSmrg\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1131*36ac495dSmrgwith PDF output, and none of those formats could be found.  (.eps cannot
1132*36ac495dSmrgbe supported due to the design of the PDF format; use regular TeX (DVI
1133*36ac495dSmrgoutput) for that.)}
1134*36ac495dSmrg
1135*36ac495dSmrg\ifpdf
1136*36ac495dSmrg  %
1137*36ac495dSmrg  % Color manipulation macros based on pdfcolor.tex,
1138*36ac495dSmrg  % except using rgb instead of cmyk; the latter is said to render as a
1139*36ac495dSmrg  % very dark gray on-screen and a very dark halftone in print, instead
1140*36ac495dSmrg  % of actual black.
1141*36ac495dSmrg  \def\rgbDarkRed{0.50 0.09 0.12}
1142*36ac495dSmrg  \def\rgbBlack{0 0 0}
1143*36ac495dSmrg  %
1144*36ac495dSmrg  % k sets the color for filling (usual text, etc.);
1145*36ac495dSmrg  % K sets the color for stroking (thin rules, e.g., normal _'s).
1146*36ac495dSmrg  \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
1147*36ac495dSmrg  %
1148*36ac495dSmrg  % Set color, and create a mark which defines \thiscolor accordingly,
1149*36ac495dSmrg  % so that \makeheadline knows which color to restore.
1150*36ac495dSmrg  \def\setcolor#1{%
1151*36ac495dSmrg    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1152*36ac495dSmrg    \domark
1153*36ac495dSmrg    \pdfsetcolor{#1}%
1154*36ac495dSmrg  }
1155*36ac495dSmrg  %
1156*36ac495dSmrg  \def\maincolor{\rgbBlack}
1157*36ac495dSmrg  \pdfsetcolor{\maincolor}
1158*36ac495dSmrg  \edef\thiscolor{\maincolor}
1159*36ac495dSmrg  \def\lastcolordefs{}
1160*36ac495dSmrg  %
1161*36ac495dSmrg  \def\makefootline{%
1162*36ac495dSmrg    \baselineskip24pt
1163*36ac495dSmrg    \line{\pdfsetcolor{\maincolor}\the\footline}%
1164*36ac495dSmrg  }
1165*36ac495dSmrg  %
1166*36ac495dSmrg  \def\makeheadline{%
1167*36ac495dSmrg    \vbox to 0pt{%
1168*36ac495dSmrg      \vskip-22.5pt
1169*36ac495dSmrg      \line{%
1170*36ac495dSmrg        \vbox to8.5pt{}%
1171*36ac495dSmrg        % Extract \thiscolor definition from the marks.
1172*36ac495dSmrg        \getcolormarks
1173*36ac495dSmrg        % Typeset the headline with \maincolor, then restore the color.
1174*36ac495dSmrg        \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1175*36ac495dSmrg      }%
1176*36ac495dSmrg      \vss
1177*36ac495dSmrg    }%
1178*36ac495dSmrg    \nointerlineskip
1179*36ac495dSmrg  }
1180*36ac495dSmrg  %
1181*36ac495dSmrg  %
1182*36ac495dSmrg  \pdfcatalog{/PageMode /UseOutlines}
1183*36ac495dSmrg  %
1184*36ac495dSmrg  % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1185*36ac495dSmrg  \def\dopdfimage#1#2#3{%
1186*36ac495dSmrg    \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1187*36ac495dSmrg    \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1188*36ac495dSmrg    %
1189*36ac495dSmrg    % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1190*36ac495dSmrg    % others).  Let's try in that order, PDF first since if
1191*36ac495dSmrg    % someone has a scalable image, presumably better to use that than a
1192*36ac495dSmrg    % bitmap.
1193*36ac495dSmrg    \let\pdfimgext=\empty
1194*36ac495dSmrg    \begingroup
1195*36ac495dSmrg      \openin 1 #1.pdf \ifeof 1
1196*36ac495dSmrg        \openin 1 #1.PDF \ifeof 1
1197*36ac495dSmrg          \openin 1 #1.png \ifeof 1
1198*36ac495dSmrg            \openin 1 #1.jpg \ifeof 1
1199*36ac495dSmrg              \openin 1 #1.jpeg \ifeof 1
1200*36ac495dSmrg                \openin 1 #1.JPG \ifeof 1
1201*36ac495dSmrg                  \errhelp = \nopdfimagehelp
1202*36ac495dSmrg                  \errmessage{Could not find image file #1 for pdf}%
1203*36ac495dSmrg                \else \gdef\pdfimgext{JPG}%
1204*36ac495dSmrg                \fi
1205*36ac495dSmrg              \else \gdef\pdfimgext{jpeg}%
1206*36ac495dSmrg              \fi
1207*36ac495dSmrg            \else \gdef\pdfimgext{jpg}%
1208*36ac495dSmrg            \fi
1209*36ac495dSmrg          \else \gdef\pdfimgext{png}%
1210*36ac495dSmrg          \fi
1211*36ac495dSmrg        \else \gdef\pdfimgext{PDF}%
1212*36ac495dSmrg        \fi
1213*36ac495dSmrg      \else \gdef\pdfimgext{pdf}%
1214*36ac495dSmrg      \fi
1215*36ac495dSmrg      \closein 1
1216*36ac495dSmrg    \endgroup
1217*36ac495dSmrg    %
1218*36ac495dSmrg    % without \immediate, ancient pdftex seg faults when the same image is
1219*36ac495dSmrg    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
1220*36ac495dSmrg    \ifnum\pdftexversion < 14
1221*36ac495dSmrg      \immediate\pdfimage
1222*36ac495dSmrg    \else
1223*36ac495dSmrg      \immediate\pdfximage
1224*36ac495dSmrg    \fi
1225*36ac495dSmrg      \ifdim \wd0 >0pt width \pdfimagewidth \fi
1226*36ac495dSmrg      \ifdim \wd2 >0pt height \pdfimageheight \fi
1227*36ac495dSmrg      \ifnum\pdftexversion<13
1228*36ac495dSmrg         #1.\pdfimgext
1229*36ac495dSmrg       \else
1230*36ac495dSmrg         {#1.\pdfimgext}%
1231*36ac495dSmrg       \fi
1232*36ac495dSmrg    \ifnum\pdftexversion < 14 \else
1233*36ac495dSmrg      \pdfrefximage \pdflastximage
1234*36ac495dSmrg    \fi}
1235*36ac495dSmrg  %
1236*36ac495dSmrg  \def\pdfmkdest#1{{%
1237*36ac495dSmrg    % We have to set dummies so commands such as @code, and characters
1238*36ac495dSmrg    % such as \, aren't expanded when present in a section title.
1239*36ac495dSmrg    \indexnofonts
1240*36ac495dSmrg    \turnoffactive
1241*36ac495dSmrg    \makevalueexpandable
1242*36ac495dSmrg    \def\pdfdestname{#1}%
1243*36ac495dSmrg    \txiescapepdf\pdfdestname
1244*36ac495dSmrg    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1245*36ac495dSmrg  }}
1246*36ac495dSmrg  %
1247*36ac495dSmrg  % used to mark target names; must be expandable.
1248*36ac495dSmrg  \def\pdfmkpgn#1{#1}
1249*36ac495dSmrg  %
1250*36ac495dSmrg  % by default, use a color that is dark enough to print on paper as
1251*36ac495dSmrg  % nearly black, but still distinguishable for online viewing.
1252*36ac495dSmrg  \def\urlcolor{\rgbDarkRed}
1253*36ac495dSmrg  \def\linkcolor{\rgbDarkRed}
1254*36ac495dSmrg  \def\endlink{\setcolor{\maincolor}\pdfendlink}
1255*36ac495dSmrg  %
1256*36ac495dSmrg  % Adding outlines to PDF; macros for calculating structure of outlines
1257*36ac495dSmrg  % come from Petr Olsak
1258*36ac495dSmrg  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1259*36ac495dSmrg    \else \csname#1\endcsname \fi}
1260*36ac495dSmrg  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1261*36ac495dSmrg    \advance\tempnum by 1
1262*36ac495dSmrg    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1263*36ac495dSmrg  %
1264*36ac495dSmrg  % #1 is the section text, which is what will be displayed in the
1265*36ac495dSmrg  % outline by the pdf viewer.  #2 is the pdf expression for the number
1266*36ac495dSmrg  % of subentries (or empty, for subsubsections).  #3 is the node text,
1267*36ac495dSmrg  % which might be empty if this toc entry had no corresponding node.
1268*36ac495dSmrg  % #4 is the page number
1269*36ac495dSmrg  %
1270*36ac495dSmrg  \def\dopdfoutline#1#2#3#4{%
1271*36ac495dSmrg    % Generate a link to the node text if that exists; else, use the
1272*36ac495dSmrg    % page number.  We could generate a destination for the section
1273*36ac495dSmrg    % text in the case where a section has no node, but it doesn't
1274*36ac495dSmrg    % seem worth the trouble, since most documents are normally structured.
1275*36ac495dSmrg    \edef\pdfoutlinedest{#3}%
1276*36ac495dSmrg    \ifx\pdfoutlinedest\empty
1277*36ac495dSmrg      \def\pdfoutlinedest{#4}%
1278*36ac495dSmrg    \else
1279*36ac495dSmrg      \txiescapepdf\pdfoutlinedest
1280*36ac495dSmrg    \fi
1281*36ac495dSmrg    %
1282*36ac495dSmrg    % Also escape PDF chars in the display string.
1283*36ac495dSmrg    \edef\pdfoutlinetext{#1}%
1284*36ac495dSmrg    \txiescapepdf\pdfoutlinetext
1285*36ac495dSmrg    %
1286*36ac495dSmrg    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1287*36ac495dSmrg  }
1288*36ac495dSmrg  %
1289*36ac495dSmrg  \def\pdfmakeoutlines{%
1290*36ac495dSmrg    \begingroup
1291*36ac495dSmrg      % Read toc silently, to get counts of subentries for \pdfoutline.
1292*36ac495dSmrg      \def\partentry##1##2##3##4{}% ignore parts in the outlines
1293*36ac495dSmrg      \def\numchapentry##1##2##3##4{%
1294*36ac495dSmrg	\def\thischapnum{##2}%
1295*36ac495dSmrg	\def\thissecnum{0}%
1296*36ac495dSmrg	\def\thissubsecnum{0}%
1297*36ac495dSmrg      }%
1298*36ac495dSmrg      \def\numsecentry##1##2##3##4{%
1299*36ac495dSmrg	\advancenumber{chap\thischapnum}%
1300*36ac495dSmrg	\def\thissecnum{##2}%
1301*36ac495dSmrg	\def\thissubsecnum{0}%
1302*36ac495dSmrg      }%
1303*36ac495dSmrg      \def\numsubsecentry##1##2##3##4{%
1304*36ac495dSmrg	\advancenumber{sec\thissecnum}%
1305*36ac495dSmrg	\def\thissubsecnum{##2}%
1306*36ac495dSmrg      }%
1307*36ac495dSmrg      \def\numsubsubsecentry##1##2##3##4{%
1308*36ac495dSmrg	\advancenumber{subsec\thissubsecnum}%
1309*36ac495dSmrg      }%
1310*36ac495dSmrg      \def\thischapnum{0}%
1311*36ac495dSmrg      \def\thissecnum{0}%
1312*36ac495dSmrg      \def\thissubsecnum{0}%
1313*36ac495dSmrg      %
1314*36ac495dSmrg      % use \def rather than \let here because we redefine \chapentry et
1315*36ac495dSmrg      % al. a second time, below.
1316*36ac495dSmrg      \def\appentry{\numchapentry}%
1317*36ac495dSmrg      \def\appsecentry{\numsecentry}%
1318*36ac495dSmrg      \def\appsubsecentry{\numsubsecentry}%
1319*36ac495dSmrg      \def\appsubsubsecentry{\numsubsubsecentry}%
1320*36ac495dSmrg      \def\unnchapentry{\numchapentry}%
1321*36ac495dSmrg      \def\unnsecentry{\numsecentry}%
1322*36ac495dSmrg      \def\unnsubsecentry{\numsubsecentry}%
1323*36ac495dSmrg      \def\unnsubsubsecentry{\numsubsubsecentry}%
1324*36ac495dSmrg      \readdatafile{toc}%
1325*36ac495dSmrg      %
1326*36ac495dSmrg      % Read toc second time, this time actually producing the outlines.
1327*36ac495dSmrg      % The `-' means take the \expnumber as the absolute number of
1328*36ac495dSmrg      % subentries, which we calculated on our first read of the .toc above.
1329*36ac495dSmrg      %
1330*36ac495dSmrg      % We use the node names as the destinations.
1331*36ac495dSmrg      \def\numchapentry##1##2##3##4{%
1332*36ac495dSmrg        \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1333*36ac495dSmrg      \def\numsecentry##1##2##3##4{%
1334*36ac495dSmrg        \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1335*36ac495dSmrg      \def\numsubsecentry##1##2##3##4{%
1336*36ac495dSmrg        \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1337*36ac495dSmrg      \def\numsubsubsecentry##1##2##3##4{% count is always zero
1338*36ac495dSmrg        \dopdfoutline{##1}{}{##3}{##4}}%
1339*36ac495dSmrg      %
1340*36ac495dSmrg      % PDF outlines are displayed using system fonts, instead of
1341*36ac495dSmrg      % document fonts.  Therefore we cannot use special characters,
1342*36ac495dSmrg      % since the encoding is unknown.  For example, the eogonek from
1343*36ac495dSmrg      % Latin 2 (0xea) gets translated to a | character.  Info from
1344*36ac495dSmrg      % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1345*36ac495dSmrg      %
1346*36ac495dSmrg      % TODO this right, we have to translate 8-bit characters to
1347*36ac495dSmrg      % their "best" equivalent, based on the @documentencoding.  Too
1348*36ac495dSmrg      % much work for too little return.  Just use the ASCII equivalents
1349*36ac495dSmrg      % we use for the index sort strings.
1350*36ac495dSmrg      %
1351*36ac495dSmrg      \indexnofonts
1352*36ac495dSmrg      \setupdatafile
1353*36ac495dSmrg      % We can have normal brace characters in the PDF outlines, unlike
1354*36ac495dSmrg      % Texinfo index files.  So set that up.
1355*36ac495dSmrg      \def\{{\lbracecharliteral}%
1356*36ac495dSmrg      \def\}{\rbracecharliteral}%
1357*36ac495dSmrg      \catcode`\\=\active \otherbackslash
1358*36ac495dSmrg      \input \tocreadfilename
1359*36ac495dSmrg    \endgroup
1360*36ac495dSmrg  }
1361*36ac495dSmrg  {\catcode`[=1 \catcode`]=2
1362*36ac495dSmrg   \catcode`{=\other \catcode`}=\other
1363*36ac495dSmrg   \gdef\lbracecharliteral[{]%
1364*36ac495dSmrg   \gdef\rbracecharliteral[}]%
1365*36ac495dSmrg  ]
1366*36ac495dSmrg  %
1367*36ac495dSmrg  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1368*36ac495dSmrg    \ifx\PP\D\let\nextsp\relax
1369*36ac495dSmrg    \else\let\nextsp\skipspaces
1370*36ac495dSmrg      \addtokens{\filename}{\PP}%
1371*36ac495dSmrg      \advance\filenamelength by 1
1372*36ac495dSmrg    \fi
1373*36ac495dSmrg    \nextsp}
1374*36ac495dSmrg  \def\getfilename#1{%
1375*36ac495dSmrg    \filenamelength=0
1376*36ac495dSmrg    % If we don't expand the argument now, \skipspaces will get
1377*36ac495dSmrg    % snagged on things like "@value{foo}".
1378*36ac495dSmrg    \edef\temp{#1}%
1379*36ac495dSmrg    \expandafter\skipspaces\temp|\relax
1380*36ac495dSmrg  }
1381*36ac495dSmrg  \ifnum\pdftexversion < 14
1382*36ac495dSmrg    \let \startlink \pdfannotlink
1383*36ac495dSmrg  \else
1384*36ac495dSmrg    \let \startlink \pdfstartlink
1385*36ac495dSmrg  \fi
1386*36ac495dSmrg  % make a live url in pdf output.
1387*36ac495dSmrg  \def\pdfurl#1{%
1388*36ac495dSmrg    \begingroup
1389*36ac495dSmrg      % it seems we really need yet another set of dummies; have not
1390*36ac495dSmrg      % tried to figure out what each command should do in the context
1391*36ac495dSmrg      % of @url.  for now, just make @/ a no-op, that's the only one
1392*36ac495dSmrg      % people have actually reported a problem with.
1393*36ac495dSmrg      %
1394*36ac495dSmrg      \normalturnoffactive
1395*36ac495dSmrg      \def\@{@}%
1396*36ac495dSmrg      \let\/=\empty
1397*36ac495dSmrg      \makevalueexpandable
1398*36ac495dSmrg      % do we want to go so far as to use \indexnofonts instead of just
1399*36ac495dSmrg      % special-casing \var here?
1400*36ac495dSmrg      \def\var##1{##1}%
1401*36ac495dSmrg      %
1402*36ac495dSmrg      \leavevmode\setcolor{\urlcolor}%
1403*36ac495dSmrg      \startlink attr{/Border [0 0 0]}%
1404*36ac495dSmrg        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1405*36ac495dSmrg    \endgroup}
1406*36ac495dSmrg  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1407*36ac495dSmrg  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1408*36ac495dSmrg  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1409*36ac495dSmrg  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1410*36ac495dSmrg  \def\maketoks{%
1411*36ac495dSmrg    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1412*36ac495dSmrg    \ifx\first0\adn0
1413*36ac495dSmrg    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1414*36ac495dSmrg    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1415*36ac495dSmrg    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1416*36ac495dSmrg    \else
1417*36ac495dSmrg      \ifnum0=\countA\else\makelink\fi
1418*36ac495dSmrg      \ifx\first.\let\next=\done\else
1419*36ac495dSmrg        \let\next=\maketoks
1420*36ac495dSmrg        \addtokens{\toksB}{\the\toksD}
1421*36ac495dSmrg        \ifx\first,\addtokens{\toksB}{\space}\fi
1422*36ac495dSmrg      \fi
1423*36ac495dSmrg    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1424*36ac495dSmrg    \next}
1425*36ac495dSmrg  \def\makelink{\addtokens{\toksB}%
1426*36ac495dSmrg    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1427*36ac495dSmrg  \def\pdflink#1{%
1428*36ac495dSmrg    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1429*36ac495dSmrg    \setcolor{\linkcolor}#1\endlink}
1430*36ac495dSmrg  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1431*36ac495dSmrg\else
1432*36ac495dSmrg  % non-pdf mode
1433*36ac495dSmrg  \let\pdfmkdest = \gobble
1434*36ac495dSmrg  \let\pdfurl = \gobble
1435*36ac495dSmrg  \let\endlink = \relax
1436*36ac495dSmrg  \let\setcolor = \gobble
1437*36ac495dSmrg  \let\pdfsetcolor = \gobble
1438*36ac495dSmrg  \let\pdfmakeoutlines = \relax
1439*36ac495dSmrg\fi  % \ifx\pdfoutput
1440*36ac495dSmrg
1441*36ac495dSmrg
1442*36ac495dSmrg\message{fonts,}
1443*36ac495dSmrg
1444*36ac495dSmrg% Change the current font style to #1, remembering it in \curfontstyle.
1445*36ac495dSmrg% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1446*36ac495dSmrg% italics, not bold italics.
1447*36ac495dSmrg%
1448*36ac495dSmrg\def\setfontstyle#1{%
1449*36ac495dSmrg  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1450*36ac495dSmrg  \csname ten#1\endcsname  % change the current font
1451*36ac495dSmrg}
1452*36ac495dSmrg
1453*36ac495dSmrg% Select #1 fonts with the current style.
1454*36ac495dSmrg%
1455*36ac495dSmrg\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1456*36ac495dSmrg
1457*36ac495dSmrg\def\rm{\fam=0 \setfontstyle{rm}}
1458*36ac495dSmrg\def\it{\fam=\itfam \setfontstyle{it}}
1459*36ac495dSmrg\def\sl{\fam=\slfam \setfontstyle{sl}}
1460*36ac495dSmrg\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1461*36ac495dSmrg\def\tt{\fam=\ttfam \setfontstyle{tt}}
1462*36ac495dSmrg
1463*36ac495dSmrg% Unfortunately, we have to override this for titles and the like, since
1464*36ac495dSmrg% in those cases "rm" is bold.  Sigh.
1465*36ac495dSmrg\def\rmisbold{\rm\def\curfontstyle{bf}}
1466*36ac495dSmrg
1467*36ac495dSmrg% Texinfo sort of supports the sans serif font style, which plain TeX does not.
1468*36ac495dSmrg% So we set up a \sf.
1469*36ac495dSmrg\newfam\sffam
1470*36ac495dSmrg\def\sf{\fam=\sffam \setfontstyle{sf}}
1471*36ac495dSmrg\let\li = \sf % Sometimes we call it \li, not \sf.
1472*36ac495dSmrg
1473*36ac495dSmrg% We don't need math for this font style.
1474*36ac495dSmrg\def\ttsl{\setfontstyle{ttsl}}
1475*36ac495dSmrg
1476*36ac495dSmrg
1477*36ac495dSmrg% Set the baselineskip to #1, and the lineskip and strut size
1478*36ac495dSmrg% correspondingly.  There is no deep meaning behind these magic numbers
1479*36ac495dSmrg% used as factors; they just match (closely enough) what Knuth defined.
1480*36ac495dSmrg%
1481*36ac495dSmrg\def\lineskipfactor{.08333}
1482*36ac495dSmrg\def\strutheightpercent{.70833}
1483*36ac495dSmrg\def\strutdepthpercent {.29167}
1484*36ac495dSmrg%
1485*36ac495dSmrg% can get a sort of poor man's double spacing by redefining this.
1486*36ac495dSmrg\def\baselinefactor{1}
1487*36ac495dSmrg%
1488*36ac495dSmrg\newdimen\textleading
1489*36ac495dSmrg\def\setleading#1{%
1490*36ac495dSmrg  \dimen0 = #1\relax
1491*36ac495dSmrg  \normalbaselineskip = \baselinefactor\dimen0
1492*36ac495dSmrg  \normallineskip = \lineskipfactor\normalbaselineskip
1493*36ac495dSmrg  \normalbaselines
1494*36ac495dSmrg  \setbox\strutbox =\hbox{%
1495*36ac495dSmrg    \vrule width0pt height\strutheightpercent\baselineskip
1496*36ac495dSmrg                    depth \strutdepthpercent \baselineskip
1497*36ac495dSmrg  }%
1498*36ac495dSmrg}
1499*36ac495dSmrg
1500*36ac495dSmrg% PDF CMaps.  See also LaTeX's t1.cmap.
1501*36ac495dSmrg%
1502*36ac495dSmrg% do nothing with this by default.
1503*36ac495dSmrg\expandafter\let\csname cmapOT1\endcsname\gobble
1504*36ac495dSmrg\expandafter\let\csname cmapOT1IT\endcsname\gobble
1505*36ac495dSmrg\expandafter\let\csname cmapOT1TT\endcsname\gobble
1506*36ac495dSmrg
1507*36ac495dSmrg% if we are producing pdf, and we have \pdffontattr, then define cmaps.
1508*36ac495dSmrg% (\pdffontattr was introduced many years ago, but people still run
1509*36ac495dSmrg% older pdftex's; it's easy to conditionalize, so we do.)
1510*36ac495dSmrg\ifpdf \ifx\pdffontattr\thisisundefined \else
1511*36ac495dSmrg  \begingroup
1512*36ac495dSmrg    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1513*36ac495dSmrg    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1514*36ac495dSmrg%%DocumentNeededResources: ProcSet (CIDInit)
1515*36ac495dSmrg%%IncludeResource: ProcSet (CIDInit)
1516*36ac495dSmrg%%BeginResource: CMap (TeX-OT1-0)
1517*36ac495dSmrg%%Title: (TeX-OT1-0 TeX OT1 0)
1518*36ac495dSmrg%%Version: 1.000
1519*36ac495dSmrg%%EndComments
1520*36ac495dSmrg/CIDInit /ProcSet findresource begin
1521*36ac495dSmrg12 dict begin
1522*36ac495dSmrgbegincmap
1523*36ac495dSmrg/CIDSystemInfo
1524*36ac495dSmrg<< /Registry (TeX)
1525*36ac495dSmrg/Ordering (OT1)
1526*36ac495dSmrg/Supplement 0
1527*36ac495dSmrg>> def
1528*36ac495dSmrg/CMapName /TeX-OT1-0 def
1529*36ac495dSmrg/CMapType 2 def
1530*36ac495dSmrg1 begincodespacerange
1531*36ac495dSmrg<00> <7F>
1532*36ac495dSmrgendcodespacerange
1533*36ac495dSmrg8 beginbfrange
1534*36ac495dSmrg<00> <01> <0393>
1535*36ac495dSmrg<09> <0A> <03A8>
1536*36ac495dSmrg<23> <26> <0023>
1537*36ac495dSmrg<28> <3B> <0028>
1538*36ac495dSmrg<3F> <5B> <003F>
1539*36ac495dSmrg<5D> <5E> <005D>
1540*36ac495dSmrg<61> <7A> <0061>
1541*36ac495dSmrg<7B> <7C> <2013>
1542*36ac495dSmrgendbfrange
1543*36ac495dSmrg40 beginbfchar
1544*36ac495dSmrg<02> <0398>
1545*36ac495dSmrg<03> <039B>
1546*36ac495dSmrg<04> <039E>
1547*36ac495dSmrg<05> <03A0>
1548*36ac495dSmrg<06> <03A3>
1549*36ac495dSmrg<07> <03D2>
1550*36ac495dSmrg<08> <03A6>
1551*36ac495dSmrg<0B> <00660066>
1552*36ac495dSmrg<0C> <00660069>
1553*36ac495dSmrg<0D> <0066006C>
1554*36ac495dSmrg<0E> <006600660069>
1555*36ac495dSmrg<0F> <00660066006C>
1556*36ac495dSmrg<10> <0131>
1557*36ac495dSmrg<11> <0237>
1558*36ac495dSmrg<12> <0060>
1559*36ac495dSmrg<13> <00B4>
1560*36ac495dSmrg<14> <02C7>
1561*36ac495dSmrg<15> <02D8>
1562*36ac495dSmrg<16> <00AF>
1563*36ac495dSmrg<17> <02DA>
1564*36ac495dSmrg<18> <00B8>
1565*36ac495dSmrg<19> <00DF>
1566*36ac495dSmrg<1A> <00E6>
1567*36ac495dSmrg<1B> <0153>
1568*36ac495dSmrg<1C> <00F8>
1569*36ac495dSmrg<1D> <00C6>
1570*36ac495dSmrg<1E> <0152>
1571*36ac495dSmrg<1F> <00D8>
1572*36ac495dSmrg<21> <0021>
1573*36ac495dSmrg<22> <201D>
1574*36ac495dSmrg<27> <2019>
1575*36ac495dSmrg<3C> <00A1>
1576*36ac495dSmrg<3D> <003D>
1577*36ac495dSmrg<3E> <00BF>
1578*36ac495dSmrg<5C> <201C>
1579*36ac495dSmrg<5F> <02D9>
1580*36ac495dSmrg<60> <2018>
1581*36ac495dSmrg<7D> <02DD>
1582*36ac495dSmrg<7E> <007E>
1583*36ac495dSmrg<7F> <00A8>
1584*36ac495dSmrgendbfchar
1585*36ac495dSmrgendcmap
1586*36ac495dSmrgCMapName currentdict /CMap defineresource pop
1587*36ac495dSmrgend
1588*36ac495dSmrgend
1589*36ac495dSmrg%%EndResource
1590*36ac495dSmrg%%EOF
1591*36ac495dSmrg    }\endgroup
1592*36ac495dSmrg  \expandafter\edef\csname cmapOT1\endcsname#1{%
1593*36ac495dSmrg    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1594*36ac495dSmrg  }%
1595*36ac495dSmrg%
1596*36ac495dSmrg% \cmapOT1IT
1597*36ac495dSmrg  \begingroup
1598*36ac495dSmrg    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1599*36ac495dSmrg    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1600*36ac495dSmrg%%DocumentNeededResources: ProcSet (CIDInit)
1601*36ac495dSmrg%%IncludeResource: ProcSet (CIDInit)
1602*36ac495dSmrg%%BeginResource: CMap (TeX-OT1IT-0)
1603*36ac495dSmrg%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1604*36ac495dSmrg%%Version: 1.000
1605*36ac495dSmrg%%EndComments
1606*36ac495dSmrg/CIDInit /ProcSet findresource begin
1607*36ac495dSmrg12 dict begin
1608*36ac495dSmrgbegincmap
1609*36ac495dSmrg/CIDSystemInfo
1610*36ac495dSmrg<< /Registry (TeX)
1611*36ac495dSmrg/Ordering (OT1IT)
1612*36ac495dSmrg/Supplement 0
1613*36ac495dSmrg>> def
1614*36ac495dSmrg/CMapName /TeX-OT1IT-0 def
1615*36ac495dSmrg/CMapType 2 def
1616*36ac495dSmrg1 begincodespacerange
1617*36ac495dSmrg<00> <7F>
1618*36ac495dSmrgendcodespacerange
1619*36ac495dSmrg8 beginbfrange
1620*36ac495dSmrg<00> <01> <0393>
1621*36ac495dSmrg<09> <0A> <03A8>
1622*36ac495dSmrg<25> <26> <0025>
1623*36ac495dSmrg<28> <3B> <0028>
1624*36ac495dSmrg<3F> <5B> <003F>
1625*36ac495dSmrg<5D> <5E> <005D>
1626*36ac495dSmrg<61> <7A> <0061>
1627*36ac495dSmrg<7B> <7C> <2013>
1628*36ac495dSmrgendbfrange
1629*36ac495dSmrg42 beginbfchar
1630*36ac495dSmrg<02> <0398>
1631*36ac495dSmrg<03> <039B>
1632*36ac495dSmrg<04> <039E>
1633*36ac495dSmrg<05> <03A0>
1634*36ac495dSmrg<06> <03A3>
1635*36ac495dSmrg<07> <03D2>
1636*36ac495dSmrg<08> <03A6>
1637*36ac495dSmrg<0B> <00660066>
1638*36ac495dSmrg<0C> <00660069>
1639*36ac495dSmrg<0D> <0066006C>
1640*36ac495dSmrg<0E> <006600660069>
1641*36ac495dSmrg<0F> <00660066006C>
1642*36ac495dSmrg<10> <0131>
1643*36ac495dSmrg<11> <0237>
1644*36ac495dSmrg<12> <0060>
1645*36ac495dSmrg<13> <00B4>
1646*36ac495dSmrg<14> <02C7>
1647*36ac495dSmrg<15> <02D8>
1648*36ac495dSmrg<16> <00AF>
1649*36ac495dSmrg<17> <02DA>
1650*36ac495dSmrg<18> <00B8>
1651*36ac495dSmrg<19> <00DF>
1652*36ac495dSmrg<1A> <00E6>
1653*36ac495dSmrg<1B> <0153>
1654*36ac495dSmrg<1C> <00F8>
1655*36ac495dSmrg<1D> <00C6>
1656*36ac495dSmrg<1E> <0152>
1657*36ac495dSmrg<1F> <00D8>
1658*36ac495dSmrg<21> <0021>
1659*36ac495dSmrg<22> <201D>
1660*36ac495dSmrg<23> <0023>
1661*36ac495dSmrg<24> <00A3>
1662*36ac495dSmrg<27> <2019>
1663*36ac495dSmrg<3C> <00A1>
1664*36ac495dSmrg<3D> <003D>
1665*36ac495dSmrg<3E> <00BF>
1666*36ac495dSmrg<5C> <201C>
1667*36ac495dSmrg<5F> <02D9>
1668*36ac495dSmrg<60> <2018>
1669*36ac495dSmrg<7D> <02DD>
1670*36ac495dSmrg<7E> <007E>
1671*36ac495dSmrg<7F> <00A8>
1672*36ac495dSmrgendbfchar
1673*36ac495dSmrgendcmap
1674*36ac495dSmrgCMapName currentdict /CMap defineresource pop
1675*36ac495dSmrgend
1676*36ac495dSmrgend
1677*36ac495dSmrg%%EndResource
1678*36ac495dSmrg%%EOF
1679*36ac495dSmrg    }\endgroup
1680*36ac495dSmrg  \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1681*36ac495dSmrg    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1682*36ac495dSmrg  }%
1683*36ac495dSmrg%
1684*36ac495dSmrg% \cmapOT1TT
1685*36ac495dSmrg  \begingroup
1686*36ac495dSmrg    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1687*36ac495dSmrg    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1688*36ac495dSmrg%%DocumentNeededResources: ProcSet (CIDInit)
1689*36ac495dSmrg%%IncludeResource: ProcSet (CIDInit)
1690*36ac495dSmrg%%BeginResource: CMap (TeX-OT1TT-0)
1691*36ac495dSmrg%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1692*36ac495dSmrg%%Version: 1.000
1693*36ac495dSmrg%%EndComments
1694*36ac495dSmrg/CIDInit /ProcSet findresource begin
1695*36ac495dSmrg12 dict begin
1696*36ac495dSmrgbegincmap
1697*36ac495dSmrg/CIDSystemInfo
1698*36ac495dSmrg<< /Registry (TeX)
1699*36ac495dSmrg/Ordering (OT1TT)
1700*36ac495dSmrg/Supplement 0
1701*36ac495dSmrg>> def
1702*36ac495dSmrg/CMapName /TeX-OT1TT-0 def
1703*36ac495dSmrg/CMapType 2 def
1704*36ac495dSmrg1 begincodespacerange
1705*36ac495dSmrg<00> <7F>
1706*36ac495dSmrgendcodespacerange
1707*36ac495dSmrg5 beginbfrange
1708*36ac495dSmrg<00> <01> <0393>
1709*36ac495dSmrg<09> <0A> <03A8>
1710*36ac495dSmrg<21> <26> <0021>
1711*36ac495dSmrg<28> <5F> <0028>
1712*36ac495dSmrg<61> <7E> <0061>
1713*36ac495dSmrgendbfrange
1714*36ac495dSmrg32 beginbfchar
1715*36ac495dSmrg<02> <0398>
1716*36ac495dSmrg<03> <039B>
1717*36ac495dSmrg<04> <039E>
1718*36ac495dSmrg<05> <03A0>
1719*36ac495dSmrg<06> <03A3>
1720*36ac495dSmrg<07> <03D2>
1721*36ac495dSmrg<08> <03A6>
1722*36ac495dSmrg<0B> <2191>
1723*36ac495dSmrg<0C> <2193>
1724*36ac495dSmrg<0D> <0027>
1725*36ac495dSmrg<0E> <00A1>
1726*36ac495dSmrg<0F> <00BF>
1727*36ac495dSmrg<10> <0131>
1728*36ac495dSmrg<11> <0237>
1729*36ac495dSmrg<12> <0060>
1730*36ac495dSmrg<13> <00B4>
1731*36ac495dSmrg<14> <02C7>
1732*36ac495dSmrg<15> <02D8>
1733*36ac495dSmrg<16> <00AF>
1734*36ac495dSmrg<17> <02DA>
1735*36ac495dSmrg<18> <00B8>
1736*36ac495dSmrg<19> <00DF>
1737*36ac495dSmrg<1A> <00E6>
1738*36ac495dSmrg<1B> <0153>
1739*36ac495dSmrg<1C> <00F8>
1740*36ac495dSmrg<1D> <00C6>
1741*36ac495dSmrg<1E> <0152>
1742*36ac495dSmrg<1F> <00D8>
1743*36ac495dSmrg<20> <2423>
1744*36ac495dSmrg<27> <2019>
1745*36ac495dSmrg<60> <2018>
1746*36ac495dSmrg<7F> <00A8>
1747*36ac495dSmrgendbfchar
1748*36ac495dSmrgendcmap
1749*36ac495dSmrgCMapName currentdict /CMap defineresource pop
1750*36ac495dSmrgend
1751*36ac495dSmrgend
1752*36ac495dSmrg%%EndResource
1753*36ac495dSmrg%%EOF
1754*36ac495dSmrg    }\endgroup
1755*36ac495dSmrg  \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1756*36ac495dSmrg    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1757*36ac495dSmrg  }%
1758*36ac495dSmrg\fi\fi
1759*36ac495dSmrg
1760*36ac495dSmrg
1761*36ac495dSmrg% Set the font macro #1 to the font named \fontprefix#2.
1762*36ac495dSmrg% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1763*36ac495dSmrg% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
1764*36ac495dSmrg% Example:
1765*36ac495dSmrg% #1 = \textrm
1766*36ac495dSmrg% #2 = \rmshape
1767*36ac495dSmrg% #3 = 10
1768*36ac495dSmrg% #4 = \mainmagstep
1769*36ac495dSmrg% #5 = OT1
1770*36ac495dSmrg%
1771*36ac495dSmrg\def\setfont#1#2#3#4#5{%
1772*36ac495dSmrg  \font#1=\fontprefix#2#3 scaled #4
1773*36ac495dSmrg  \csname cmap#5\endcsname#1%
1774*36ac495dSmrg}
1775*36ac495dSmrg% This is what gets called when #5 of \setfont is empty.
1776*36ac495dSmrg\let\cmap\gobble
1777*36ac495dSmrg%
1778*36ac495dSmrg% (end of cmaps)
1779*36ac495dSmrg
1780*36ac495dSmrg% Use cm as the default font prefix.
1781*36ac495dSmrg% To specify the font prefix, you must define \fontprefix
1782*36ac495dSmrg% before you read in texinfo.tex.
1783*36ac495dSmrg\ifx\fontprefix\thisisundefined
1784*36ac495dSmrg\def\fontprefix{cm}
1785*36ac495dSmrg\fi
1786*36ac495dSmrg% Support font families that don't use the same naming scheme as CM.
1787*36ac495dSmrg\def\rmshape{r}
1788*36ac495dSmrg\def\rmbshape{bx}               % where the normal face is bold
1789*36ac495dSmrg\def\bfshape{b}
1790*36ac495dSmrg\def\bxshape{bx}
1791*36ac495dSmrg\def\ttshape{tt}
1792*36ac495dSmrg\def\ttbshape{tt}
1793*36ac495dSmrg\def\ttslshape{sltt}
1794*36ac495dSmrg\def\itshape{ti}
1795*36ac495dSmrg\def\itbshape{bxti}
1796*36ac495dSmrg\def\slshape{sl}
1797*36ac495dSmrg\def\slbshape{bxsl}
1798*36ac495dSmrg\def\sfshape{ss}
1799*36ac495dSmrg\def\sfbshape{ss}
1800*36ac495dSmrg\def\scshape{csc}
1801*36ac495dSmrg\def\scbshape{csc}
1802*36ac495dSmrg
1803*36ac495dSmrg% Definitions for a main text size of 11pt.  (The default in Texinfo.)
1804*36ac495dSmrg%
1805*36ac495dSmrg\def\definetextfontsizexi{%
1806*36ac495dSmrg% Text fonts (11.2pt, magstep1).
1807*36ac495dSmrg\def\textnominalsize{11pt}
1808*36ac495dSmrg\edef\mainmagstep{\magstephalf}
1809*36ac495dSmrg\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1810*36ac495dSmrg\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1811*36ac495dSmrg\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1812*36ac495dSmrg\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1813*36ac495dSmrg\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1814*36ac495dSmrg\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1815*36ac495dSmrg\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1816*36ac495dSmrg\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1817*36ac495dSmrg\font\texti=cmmi10 scaled \mainmagstep
1818*36ac495dSmrg\font\textsy=cmsy10 scaled \mainmagstep
1819*36ac495dSmrg\def\textecsize{1095}
1820*36ac495dSmrg
1821*36ac495dSmrg% A few fonts for @defun names and args.
1822*36ac495dSmrg\setfont\defbf\bfshape{10}{\magstep1}{OT1}
1823*36ac495dSmrg\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1824*36ac495dSmrg\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1825*36ac495dSmrg\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1826*36ac495dSmrg
1827*36ac495dSmrg% Fonts for indices, footnotes, small examples (9pt).
1828*36ac495dSmrg\def\smallnominalsize{9pt}
1829*36ac495dSmrg\setfont\smallrm\rmshape{9}{1000}{OT1}
1830*36ac495dSmrg\setfont\smalltt\ttshape{9}{1000}{OT1TT}
1831*36ac495dSmrg\setfont\smallbf\bfshape{10}{900}{OT1}
1832*36ac495dSmrg\setfont\smallit\itshape{9}{1000}{OT1IT}
1833*36ac495dSmrg\setfont\smallsl\slshape{9}{1000}{OT1}
1834*36ac495dSmrg\setfont\smallsf\sfshape{9}{1000}{OT1}
1835*36ac495dSmrg\setfont\smallsc\scshape{10}{900}{OT1}
1836*36ac495dSmrg\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1837*36ac495dSmrg\font\smalli=cmmi9
1838*36ac495dSmrg\font\smallsy=cmsy9
1839*36ac495dSmrg\def\smallecsize{0900}
1840*36ac495dSmrg
1841*36ac495dSmrg% Fonts for small examples (8pt).
1842*36ac495dSmrg\def\smallernominalsize{8pt}
1843*36ac495dSmrg\setfont\smallerrm\rmshape{8}{1000}{OT1}
1844*36ac495dSmrg\setfont\smallertt\ttshape{8}{1000}{OT1TT}
1845*36ac495dSmrg\setfont\smallerbf\bfshape{10}{800}{OT1}
1846*36ac495dSmrg\setfont\smallerit\itshape{8}{1000}{OT1IT}
1847*36ac495dSmrg\setfont\smallersl\slshape{8}{1000}{OT1}
1848*36ac495dSmrg\setfont\smallersf\sfshape{8}{1000}{OT1}
1849*36ac495dSmrg\setfont\smallersc\scshape{10}{800}{OT1}
1850*36ac495dSmrg\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1851*36ac495dSmrg\font\smalleri=cmmi8
1852*36ac495dSmrg\font\smallersy=cmsy8
1853*36ac495dSmrg\def\smallerecsize{0800}
1854*36ac495dSmrg
1855*36ac495dSmrg% Fonts for title page (20.4pt):
1856*36ac495dSmrg\def\titlenominalsize{20pt}
1857*36ac495dSmrg\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1858*36ac495dSmrg\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1859*36ac495dSmrg\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1860*36ac495dSmrg\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1861*36ac495dSmrg\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1862*36ac495dSmrg\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1863*36ac495dSmrg\let\titlebf=\titlerm
1864*36ac495dSmrg\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1865*36ac495dSmrg\font\titlei=cmmi12 scaled \magstep3
1866*36ac495dSmrg\font\titlesy=cmsy10 scaled \magstep4
1867*36ac495dSmrg\def\titleecsize{2074}
1868*36ac495dSmrg
1869*36ac495dSmrg% Chapter (and unnumbered) fonts (17.28pt).
1870*36ac495dSmrg\def\chapnominalsize{17pt}
1871*36ac495dSmrg\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
1872*36ac495dSmrg\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
1873*36ac495dSmrg\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
1874*36ac495dSmrg\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
1875*36ac495dSmrg\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
1876*36ac495dSmrg\setfont\chapsf\sfbshape{17}{1000}{OT1}
1877*36ac495dSmrg\let\chapbf=\chaprm
1878*36ac495dSmrg\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
1879*36ac495dSmrg\font\chapi=cmmi12 scaled \magstep2
1880*36ac495dSmrg\font\chapsy=cmsy10 scaled \magstep3
1881*36ac495dSmrg\def\chapecsize{1728}
1882*36ac495dSmrg
1883*36ac495dSmrg% Section fonts (14.4pt).
1884*36ac495dSmrg\def\secnominalsize{14pt}
1885*36ac495dSmrg\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
1886*36ac495dSmrg\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
1887*36ac495dSmrg\setfont\secsl\slbshape{10}{\magstep2}{OT1}
1888*36ac495dSmrg\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
1889*36ac495dSmrg\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
1890*36ac495dSmrg\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
1891*36ac495dSmrg\let\secbf\secrm
1892*36ac495dSmrg\setfont\secsc\scbshape{10}{\magstep2}{OT1}
1893*36ac495dSmrg\font\seci=cmmi12 scaled \magstep1
1894*36ac495dSmrg\font\secsy=cmsy10 scaled \magstep2
1895*36ac495dSmrg\def\sececsize{1440}
1896*36ac495dSmrg
1897*36ac495dSmrg% Subsection fonts (13.15pt).
1898*36ac495dSmrg\def\ssecnominalsize{13pt}
1899*36ac495dSmrg\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
1900*36ac495dSmrg\setfont\ssecit\itbshape{10}{1315}{OT1IT}
1901*36ac495dSmrg\setfont\ssecsl\slbshape{10}{1315}{OT1}
1902*36ac495dSmrg\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
1903*36ac495dSmrg\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
1904*36ac495dSmrg\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
1905*36ac495dSmrg\let\ssecbf\ssecrm
1906*36ac495dSmrg\setfont\ssecsc\scbshape{10}{1315}{OT1}
1907*36ac495dSmrg\font\sseci=cmmi12 scaled \magstephalf
1908*36ac495dSmrg\font\ssecsy=cmsy10 scaled 1315
1909*36ac495dSmrg\def\ssececsize{1200}
1910*36ac495dSmrg
1911*36ac495dSmrg% Reduced fonts for @acro in text (10pt).
1912*36ac495dSmrg\def\reducednominalsize{10pt}
1913*36ac495dSmrg\setfont\reducedrm\rmshape{10}{1000}{OT1}
1914*36ac495dSmrg\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
1915*36ac495dSmrg\setfont\reducedbf\bfshape{10}{1000}{OT1}
1916*36ac495dSmrg\setfont\reducedit\itshape{10}{1000}{OT1IT}
1917*36ac495dSmrg\setfont\reducedsl\slshape{10}{1000}{OT1}
1918*36ac495dSmrg\setfont\reducedsf\sfshape{10}{1000}{OT1}
1919*36ac495dSmrg\setfont\reducedsc\scshape{10}{1000}{OT1}
1920*36ac495dSmrg\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
1921*36ac495dSmrg\font\reducedi=cmmi10
1922*36ac495dSmrg\font\reducedsy=cmsy10
1923*36ac495dSmrg\def\reducedecsize{1000}
1924*36ac495dSmrg
1925*36ac495dSmrg\textleading = 13.2pt % line spacing for 11pt CM
1926*36ac495dSmrg\textfonts            % reset the current fonts
1927*36ac495dSmrg\rm
1928*36ac495dSmrg} % end of 11pt text font size definitions, \definetextfontsizexi
1929*36ac495dSmrg
1930*36ac495dSmrg
1931*36ac495dSmrg% Definitions to make the main text be 10pt Computer Modern, with
1932*36ac495dSmrg% section, chapter, etc., sizes following suit.  This is for the GNU
1933*36ac495dSmrg% Press printing of the Emacs 22 manual.  Maybe other manuals in the
1934*36ac495dSmrg% future.  Used with @smallbook, which sets the leading to 12pt.
1935*36ac495dSmrg%
1936*36ac495dSmrg\def\definetextfontsizex{%
1937*36ac495dSmrg% Text fonts (10pt).
1938*36ac495dSmrg\def\textnominalsize{10pt}
1939*36ac495dSmrg\edef\mainmagstep{1000}
1940*36ac495dSmrg\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1941*36ac495dSmrg\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1942*36ac495dSmrg\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1943*36ac495dSmrg\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1944*36ac495dSmrg\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1945*36ac495dSmrg\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1946*36ac495dSmrg\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1947*36ac495dSmrg\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1948*36ac495dSmrg\font\texti=cmmi10 scaled \mainmagstep
1949*36ac495dSmrg\font\textsy=cmsy10 scaled \mainmagstep
1950*36ac495dSmrg\def\textecsize{1000}
1951*36ac495dSmrg
1952*36ac495dSmrg% A few fonts for @defun names and args.
1953*36ac495dSmrg\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
1954*36ac495dSmrg\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
1955*36ac495dSmrg\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
1956*36ac495dSmrg\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1957*36ac495dSmrg
1958*36ac495dSmrg% Fonts for indices, footnotes, small examples (9pt).
1959*36ac495dSmrg\def\smallnominalsize{9pt}
1960*36ac495dSmrg\setfont\smallrm\rmshape{9}{1000}{OT1}
1961*36ac495dSmrg\setfont\smalltt\ttshape{9}{1000}{OT1TT}
1962*36ac495dSmrg\setfont\smallbf\bfshape{10}{900}{OT1}
1963*36ac495dSmrg\setfont\smallit\itshape{9}{1000}{OT1IT}
1964*36ac495dSmrg\setfont\smallsl\slshape{9}{1000}{OT1}
1965*36ac495dSmrg\setfont\smallsf\sfshape{9}{1000}{OT1}
1966*36ac495dSmrg\setfont\smallsc\scshape{10}{900}{OT1}
1967*36ac495dSmrg\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1968*36ac495dSmrg\font\smalli=cmmi9
1969*36ac495dSmrg\font\smallsy=cmsy9
1970*36ac495dSmrg\def\smallecsize{0900}
1971*36ac495dSmrg
1972*36ac495dSmrg% Fonts for small examples (8pt).
1973*36ac495dSmrg\def\smallernominalsize{8pt}
1974*36ac495dSmrg\setfont\smallerrm\rmshape{8}{1000}{OT1}
1975*36ac495dSmrg\setfont\smallertt\ttshape{8}{1000}{OT1TT}
1976*36ac495dSmrg\setfont\smallerbf\bfshape{10}{800}{OT1}
1977*36ac495dSmrg\setfont\smallerit\itshape{8}{1000}{OT1IT}
1978*36ac495dSmrg\setfont\smallersl\slshape{8}{1000}{OT1}
1979*36ac495dSmrg\setfont\smallersf\sfshape{8}{1000}{OT1}
1980*36ac495dSmrg\setfont\smallersc\scshape{10}{800}{OT1}
1981*36ac495dSmrg\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1982*36ac495dSmrg\font\smalleri=cmmi8
1983*36ac495dSmrg\font\smallersy=cmsy8
1984*36ac495dSmrg\def\smallerecsize{0800}
1985*36ac495dSmrg
1986*36ac495dSmrg% Fonts for title page (20.4pt):
1987*36ac495dSmrg\def\titlenominalsize{20pt}
1988*36ac495dSmrg\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1989*36ac495dSmrg\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1990*36ac495dSmrg\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1991*36ac495dSmrg\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1992*36ac495dSmrg\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1993*36ac495dSmrg\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1994*36ac495dSmrg\let\titlebf=\titlerm
1995*36ac495dSmrg\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1996*36ac495dSmrg\font\titlei=cmmi12 scaled \magstep3
1997*36ac495dSmrg\font\titlesy=cmsy10 scaled \magstep4
1998*36ac495dSmrg\def\titleecsize{2074}
1999*36ac495dSmrg
2000*36ac495dSmrg% Chapter fonts (14.4pt).
2001*36ac495dSmrg\def\chapnominalsize{14pt}
2002*36ac495dSmrg\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2003*36ac495dSmrg\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2004*36ac495dSmrg\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2005*36ac495dSmrg\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2006*36ac495dSmrg\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2007*36ac495dSmrg\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2008*36ac495dSmrg\let\chapbf\chaprm
2009*36ac495dSmrg\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2010*36ac495dSmrg\font\chapi=cmmi12 scaled \magstep1
2011*36ac495dSmrg\font\chapsy=cmsy10 scaled \magstep2
2012*36ac495dSmrg\def\chapecsize{1440}
2013*36ac495dSmrg
2014*36ac495dSmrg% Section fonts (12pt).
2015*36ac495dSmrg\def\secnominalsize{12pt}
2016*36ac495dSmrg\setfont\secrm\rmbshape{12}{1000}{OT1}
2017*36ac495dSmrg\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2018*36ac495dSmrg\setfont\secsl\slbshape{10}{\magstep1}{OT1}
2019*36ac495dSmrg\setfont\sectt\ttbshape{12}{1000}{OT1TT}
2020*36ac495dSmrg\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2021*36ac495dSmrg\setfont\secsf\sfbshape{12}{1000}{OT1}
2022*36ac495dSmrg\let\secbf\secrm
2023*36ac495dSmrg\setfont\secsc\scbshape{10}{\magstep1}{OT1}
2024*36ac495dSmrg\font\seci=cmmi12
2025*36ac495dSmrg\font\secsy=cmsy10 scaled \magstep1
2026*36ac495dSmrg\def\sececsize{1200}
2027*36ac495dSmrg
2028*36ac495dSmrg% Subsection fonts (10pt).
2029*36ac495dSmrg\def\ssecnominalsize{10pt}
2030*36ac495dSmrg\setfont\ssecrm\rmbshape{10}{1000}{OT1}
2031*36ac495dSmrg\setfont\ssecit\itbshape{10}{1000}{OT1IT}
2032*36ac495dSmrg\setfont\ssecsl\slbshape{10}{1000}{OT1}
2033*36ac495dSmrg\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2034*36ac495dSmrg\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2035*36ac495dSmrg\setfont\ssecsf\sfbshape{10}{1000}{OT1}
2036*36ac495dSmrg\let\ssecbf\ssecrm
2037*36ac495dSmrg\setfont\ssecsc\scbshape{10}{1000}{OT1}
2038*36ac495dSmrg\font\sseci=cmmi10
2039*36ac495dSmrg\font\ssecsy=cmsy10
2040*36ac495dSmrg\def\ssececsize{1000}
2041*36ac495dSmrg
2042*36ac495dSmrg% Reduced fonts for @acro in text (9pt).
2043*36ac495dSmrg\def\reducednominalsize{9pt}
2044*36ac495dSmrg\setfont\reducedrm\rmshape{9}{1000}{OT1}
2045*36ac495dSmrg\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2046*36ac495dSmrg\setfont\reducedbf\bfshape{10}{900}{OT1}
2047*36ac495dSmrg\setfont\reducedit\itshape{9}{1000}{OT1IT}
2048*36ac495dSmrg\setfont\reducedsl\slshape{9}{1000}{OT1}
2049*36ac495dSmrg\setfont\reducedsf\sfshape{9}{1000}{OT1}
2050*36ac495dSmrg\setfont\reducedsc\scshape{10}{900}{OT1}
2051*36ac495dSmrg\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2052*36ac495dSmrg\font\reducedi=cmmi9
2053*36ac495dSmrg\font\reducedsy=cmsy9
2054*36ac495dSmrg\def\reducedecsize{0900}
2055*36ac495dSmrg
2056*36ac495dSmrg\divide\parskip by 2  % reduce space between paragraphs
2057*36ac495dSmrg\textleading = 12pt   % line spacing for 10pt CM
2058*36ac495dSmrg\textfonts            % reset the current fonts
2059*36ac495dSmrg\rm
2060*36ac495dSmrg} % end of 10pt text font size definitions, \definetextfontsizex
2061*36ac495dSmrg
2062*36ac495dSmrg
2063*36ac495dSmrg% We provide the user-level command
2064*36ac495dSmrg%   @fonttextsize 10
2065*36ac495dSmrg% (or 11) to redefine the text font size.  pt is assumed.
2066*36ac495dSmrg%
2067*36ac495dSmrg\def\xiword{11}
2068*36ac495dSmrg\def\xword{10}
2069*36ac495dSmrg\def\xwordpt{10pt}
2070*36ac495dSmrg%
2071*36ac495dSmrg\parseargdef\fonttextsize{%
2072*36ac495dSmrg  \def\textsizearg{#1}%
2073*36ac495dSmrg  %\wlog{doing @fonttextsize \textsizearg}%
2074*36ac495dSmrg  %
2075*36ac495dSmrg  % Set \globaldefs so that documents can use this inside @tex, since
2076*36ac495dSmrg  % makeinfo 4.8 does not support it, but we need it nonetheless.
2077*36ac495dSmrg  %
2078*36ac495dSmrg \begingroup \globaldefs=1
2079*36ac495dSmrg  \ifx\textsizearg\xword \definetextfontsizex
2080*36ac495dSmrg  \else \ifx\textsizearg\xiword \definetextfontsizexi
2081*36ac495dSmrg  \else
2082*36ac495dSmrg    \errhelp=\EMsimple
2083*36ac495dSmrg    \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2084*36ac495dSmrg  \fi\fi
2085*36ac495dSmrg \endgroup
2086*36ac495dSmrg}
2087*36ac495dSmrg
2088*36ac495dSmrg
2089*36ac495dSmrg% In order for the font changes to affect most math symbols and letters,
2090*36ac495dSmrg% we have to define the \textfont of the standard families.  Since
2091*36ac495dSmrg% texinfo doesn't allow for producing subscripts and superscripts except
2092*36ac495dSmrg% in the main text, we don't bother to reset \scriptfont and
2093*36ac495dSmrg% \scriptscriptfont (which would also require loading a lot more fonts).
2094*36ac495dSmrg%
2095*36ac495dSmrg\def\resetmathfonts{%
2096*36ac495dSmrg  \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2097*36ac495dSmrg  \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2098*36ac495dSmrg  \textfont\ttfam=\tentt \textfont\sffam=\tensf
2099*36ac495dSmrg}
2100*36ac495dSmrg
2101*36ac495dSmrg% The font-changing commands redefine the meanings of \tenSTYLE, instead
2102*36ac495dSmrg% of just \STYLE.  We do this because \STYLE needs to also set the
2103*36ac495dSmrg% current \fam for math mode.  Our \STYLE (e.g., \rm) commands hardwire
2104*36ac495dSmrg% \tenSTYLE to set the current font.
2105*36ac495dSmrg%
2106*36ac495dSmrg% Each font-changing command also sets the names \lsize (one size lower)
2107*36ac495dSmrg% and \lllsize (three sizes lower).  These relative commands are used in
2108*36ac495dSmrg% the LaTeX logo and acronyms.
2109*36ac495dSmrg%
2110*36ac495dSmrg% This all needs generalizing, badly.
2111*36ac495dSmrg%
2112*36ac495dSmrg\def\textfonts{%
2113*36ac495dSmrg  \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2114*36ac495dSmrg  \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2115*36ac495dSmrg  \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2116*36ac495dSmrg  \let\tenttsl=\textttsl
2117*36ac495dSmrg  \def\curfontsize{text}%
2118*36ac495dSmrg  \def\lsize{reduced}\def\lllsize{smaller}%
2119*36ac495dSmrg  \resetmathfonts \setleading{\textleading}}
2120*36ac495dSmrg\def\titlefonts{%
2121*36ac495dSmrg  \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2122*36ac495dSmrg  \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2123*36ac495dSmrg  \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2124*36ac495dSmrg  \let\tenttsl=\titlettsl
2125*36ac495dSmrg  \def\curfontsize{title}%
2126*36ac495dSmrg  \def\lsize{chap}\def\lllsize{subsec}%
2127*36ac495dSmrg  \resetmathfonts \setleading{27pt}}
2128*36ac495dSmrg\def\titlefont#1{{\titlefonts\rmisbold #1}}
2129*36ac495dSmrg\def\chapfonts{%
2130*36ac495dSmrg  \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2131*36ac495dSmrg  \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2132*36ac495dSmrg  \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2133*36ac495dSmrg  \let\tenttsl=\chapttsl
2134*36ac495dSmrg  \def\curfontsize{chap}%
2135*36ac495dSmrg  \def\lsize{sec}\def\lllsize{text}%
2136*36ac495dSmrg  \resetmathfonts \setleading{19pt}}
2137*36ac495dSmrg\def\secfonts{%
2138*36ac495dSmrg  \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2139*36ac495dSmrg  \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2140*36ac495dSmrg  \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2141*36ac495dSmrg  \let\tenttsl=\secttsl
2142*36ac495dSmrg  \def\curfontsize{sec}%
2143*36ac495dSmrg  \def\lsize{subsec}\def\lllsize{reduced}%
2144*36ac495dSmrg  \resetmathfonts \setleading{16pt}}
2145*36ac495dSmrg\def\subsecfonts{%
2146*36ac495dSmrg  \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2147*36ac495dSmrg  \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2148*36ac495dSmrg  \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2149*36ac495dSmrg  \let\tenttsl=\ssecttsl
2150*36ac495dSmrg  \def\curfontsize{ssec}%
2151*36ac495dSmrg  \def\lsize{text}\def\lllsize{small}%
2152*36ac495dSmrg  \resetmathfonts \setleading{15pt}}
2153*36ac495dSmrg\let\subsubsecfonts = \subsecfonts
2154*36ac495dSmrg\def\reducedfonts{%
2155*36ac495dSmrg  \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2156*36ac495dSmrg  \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2157*36ac495dSmrg  \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2158*36ac495dSmrg  \let\tenttsl=\reducedttsl
2159*36ac495dSmrg  \def\curfontsize{reduced}%
2160*36ac495dSmrg  \def\lsize{small}\def\lllsize{smaller}%
2161*36ac495dSmrg  \resetmathfonts \setleading{10.5pt}}
2162*36ac495dSmrg\def\smallfonts{%
2163*36ac495dSmrg  \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2164*36ac495dSmrg  \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2165*36ac495dSmrg  \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2166*36ac495dSmrg  \let\tenttsl=\smallttsl
2167*36ac495dSmrg  \def\curfontsize{small}%
2168*36ac495dSmrg  \def\lsize{smaller}\def\lllsize{smaller}%
2169*36ac495dSmrg  \resetmathfonts \setleading{10.5pt}}
2170*36ac495dSmrg\def\smallerfonts{%
2171*36ac495dSmrg  \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2172*36ac495dSmrg  \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2173*36ac495dSmrg  \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2174*36ac495dSmrg  \let\tenttsl=\smallerttsl
2175*36ac495dSmrg  \def\curfontsize{smaller}%
2176*36ac495dSmrg  \def\lsize{smaller}\def\lllsize{smaller}%
2177*36ac495dSmrg  \resetmathfonts \setleading{9.5pt}}
2178*36ac495dSmrg
2179*36ac495dSmrg% Fonts for short table of contents.
2180*36ac495dSmrg\setfont\shortcontrm\rmshape{12}{1000}{OT1}
2181*36ac495dSmrg\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
2182*36ac495dSmrg\setfont\shortcontsl\slshape{12}{1000}{OT1}
2183*36ac495dSmrg\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2184*36ac495dSmrg
2185*36ac495dSmrg% Define these just so they can be easily changed for other fonts.
2186*36ac495dSmrg\def\angleleft{$\langle$}
2187*36ac495dSmrg\def\angleright{$\rangle$}
2188*36ac495dSmrg
2189*36ac495dSmrg% Set the fonts to use with the @small... environments.
2190*36ac495dSmrg\let\smallexamplefonts = \smallfonts
2191*36ac495dSmrg
2192*36ac495dSmrg% About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
2193*36ac495dSmrg% can fit this many characters:
2194*36ac495dSmrg%   8.5x11=86   smallbook=72  a4=90  a5=69
2195*36ac495dSmrg% If we use \scriptfonts (8pt), then we can fit this many characters:
2196*36ac495dSmrg%   8.5x11=90+  smallbook=80  a4=90+  a5=77
2197*36ac495dSmrg% For me, subjectively, the few extra characters that fit aren't worth
2198*36ac495dSmrg% the additional smallness of 8pt.  So I'm making the default 9pt.
2199*36ac495dSmrg%
2200*36ac495dSmrg% By the way, for comparison, here's what fits with @example (10pt):
2201*36ac495dSmrg%   8.5x11=71  smallbook=60  a4=75  a5=58
2202*36ac495dSmrg% --karl, 24jan03.
2203*36ac495dSmrg
2204*36ac495dSmrg% Set up the default fonts, so we can use them for creating boxes.
2205*36ac495dSmrg%
2206*36ac495dSmrg\definetextfontsizexi
2207*36ac495dSmrg
2208*36ac495dSmrg
2209*36ac495dSmrg\message{markup,}
2210*36ac495dSmrg
2211*36ac495dSmrg% Check if we are currently using a typewriter font.  Since all the
2212*36ac495dSmrg% Computer Modern typewriter fonts have zero interword stretch (and
2213*36ac495dSmrg% shrink), and it is reasonable to expect all typewriter fonts to have
2214*36ac495dSmrg% this property, we can check that font parameter.
2215*36ac495dSmrg%
2216*36ac495dSmrg\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2217*36ac495dSmrg
2218*36ac495dSmrg% Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
2219*36ac495dSmrg% define and register \INITMACRO to be called on markup style changes.
2220*36ac495dSmrg% \INITMACRO can check \currentmarkupstyle for the innermost
2221*36ac495dSmrg% style and the set of \ifmarkupSTYLE switches for all styles
2222*36ac495dSmrg% currently in effect.
2223*36ac495dSmrg\newif\ifmarkupvar
2224*36ac495dSmrg\newif\ifmarkupsamp
2225*36ac495dSmrg\newif\ifmarkupkey
2226*36ac495dSmrg%\newif\ifmarkupfile % @file == @samp.
2227*36ac495dSmrg%\newif\ifmarkupoption % @option == @samp.
2228*36ac495dSmrg\newif\ifmarkupcode
2229*36ac495dSmrg\newif\ifmarkupkbd
2230*36ac495dSmrg%\newif\ifmarkupenv % @env == @code.
2231*36ac495dSmrg%\newif\ifmarkupcommand % @command == @code.
2232*36ac495dSmrg\newif\ifmarkuptex % @tex (and part of @math, for now).
2233*36ac495dSmrg\newif\ifmarkupexample
2234*36ac495dSmrg\newif\ifmarkupverb
2235*36ac495dSmrg\newif\ifmarkupverbatim
2236*36ac495dSmrg
2237*36ac495dSmrg\let\currentmarkupstyle\empty
2238*36ac495dSmrg
2239*36ac495dSmrg\def\setupmarkupstyle#1{%
2240*36ac495dSmrg  \csname markup#1true\endcsname
2241*36ac495dSmrg  \def\currentmarkupstyle{#1}%
2242*36ac495dSmrg  \markupstylesetup
2243*36ac495dSmrg}
2244*36ac495dSmrg
2245*36ac495dSmrg\let\markupstylesetup\empty
2246*36ac495dSmrg
2247*36ac495dSmrg\def\defmarkupstylesetup#1{%
2248*36ac495dSmrg  \expandafter\def\expandafter\markupstylesetup
2249*36ac495dSmrg    \expandafter{\markupstylesetup #1}%
2250*36ac495dSmrg  \def#1%
2251*36ac495dSmrg}
2252*36ac495dSmrg
2253*36ac495dSmrg% Markup style setup for left and right quotes.
2254*36ac495dSmrg\defmarkupstylesetup\markupsetuplq{%
2255*36ac495dSmrg  \expandafter\let\expandafter \temp
2256*36ac495dSmrg    \csname markupsetuplq\currentmarkupstyle\endcsname
2257*36ac495dSmrg  \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2258*36ac495dSmrg}
2259*36ac495dSmrg
2260*36ac495dSmrg\defmarkupstylesetup\markupsetuprq{%
2261*36ac495dSmrg  \expandafter\let\expandafter \temp
2262*36ac495dSmrg    \csname markupsetuprq\currentmarkupstyle\endcsname
2263*36ac495dSmrg  \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2264*36ac495dSmrg}
2265*36ac495dSmrg
2266*36ac495dSmrg{
2267*36ac495dSmrg\catcode`\'=\active
2268*36ac495dSmrg\catcode`\`=\active
2269*36ac495dSmrg
2270*36ac495dSmrg\gdef\markupsetuplqdefault{\let`\lq}
2271*36ac495dSmrg\gdef\markupsetuprqdefault{\let'\rq}
2272*36ac495dSmrg
2273*36ac495dSmrg\gdef\markupsetcodequoteleft{\let`\codequoteleft}
2274*36ac495dSmrg\gdef\markupsetcodequoteright{\let'\codequoteright}
2275*36ac495dSmrg
2276*36ac495dSmrg\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
2277*36ac495dSmrg}
2278*36ac495dSmrg
2279*36ac495dSmrg\let\markupsetuplqcode \markupsetcodequoteleft
2280*36ac495dSmrg\let\markupsetuprqcode \markupsetcodequoteright
2281*36ac495dSmrg%
2282*36ac495dSmrg\let\markupsetuplqexample \markupsetcodequoteleft
2283*36ac495dSmrg\let\markupsetuprqexample \markupsetcodequoteright
2284*36ac495dSmrg%
2285*36ac495dSmrg\let\markupsetuplqsamp \markupsetcodequoteleft
2286*36ac495dSmrg\let\markupsetuprqsamp \markupsetcodequoteright
2287*36ac495dSmrg%
2288*36ac495dSmrg\let\markupsetuplqverb \markupsetcodequoteleft
2289*36ac495dSmrg\let\markupsetuprqverb \markupsetcodequoteright
2290*36ac495dSmrg%
2291*36ac495dSmrg\let\markupsetuplqverbatim \markupsetcodequoteleft
2292*36ac495dSmrg\let\markupsetuprqverbatim \markupsetcodequoteright
2293*36ac495dSmrg
2294*36ac495dSmrg\let\markupsetuplqkbd \markupsetnoligaturesquoteleft
2295*36ac495dSmrg
2296*36ac495dSmrg% Allow an option to not use regular directed right quote/apostrophe
2297*36ac495dSmrg% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2298*36ac495dSmrg% The undirected quote is ugly, so don't make it the default, but it
2299*36ac495dSmrg% works for pasting with more pdf viewers (at least evince), the
2300*36ac495dSmrg% lilypond developers report.  xpdf does work with the regular 0x27.
2301*36ac495dSmrg%
2302*36ac495dSmrg\def\codequoteright{%
2303*36ac495dSmrg  \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2304*36ac495dSmrg    \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2305*36ac495dSmrg      '%
2306*36ac495dSmrg    \else \char'15 \fi
2307*36ac495dSmrg  \else \char'15 \fi
2308*36ac495dSmrg}
2309*36ac495dSmrg%
2310*36ac495dSmrg% and a similar option for the left quote char vs. a grave accent.
2311*36ac495dSmrg% Modern fonts display ASCII 0x60 as a grave accent, so some people like
2312*36ac495dSmrg% the code environments to do likewise.
2313*36ac495dSmrg%
2314*36ac495dSmrg\def\codequoteleft{%
2315*36ac495dSmrg  \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2316*36ac495dSmrg    \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2317*36ac495dSmrg      % [Knuth] pp. 380,381,391
2318*36ac495dSmrg      % \relax disables Spanish ligatures ?` and !` of \tt font.
2319*36ac495dSmrg      \relax`%
2320*36ac495dSmrg    \else \char'22 \fi
2321*36ac495dSmrg  \else \char'22 \fi
2322*36ac495dSmrg}
2323*36ac495dSmrg
2324*36ac495dSmrg% Commands to set the quote options.
2325*36ac495dSmrg%
2326*36ac495dSmrg\parseargdef\codequoteundirected{%
2327*36ac495dSmrg  \def\temp{#1}%
2328*36ac495dSmrg  \ifx\temp\onword
2329*36ac495dSmrg    \expandafter\let\csname SETtxicodequoteundirected\endcsname
2330*36ac495dSmrg      = t%
2331*36ac495dSmrg  \else\ifx\temp\offword
2332*36ac495dSmrg    \expandafter\let\csname SETtxicodequoteundirected\endcsname
2333*36ac495dSmrg      = \relax
2334*36ac495dSmrg  \else
2335*36ac495dSmrg    \errhelp = \EMsimple
2336*36ac495dSmrg    \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2337*36ac495dSmrg  \fi\fi
2338*36ac495dSmrg}
2339*36ac495dSmrg%
2340*36ac495dSmrg\parseargdef\codequotebacktick{%
2341*36ac495dSmrg  \def\temp{#1}%
2342*36ac495dSmrg  \ifx\temp\onword
2343*36ac495dSmrg    \expandafter\let\csname SETtxicodequotebacktick\endcsname
2344*36ac495dSmrg      = t%
2345*36ac495dSmrg  \else\ifx\temp\offword
2346*36ac495dSmrg    \expandafter\let\csname SETtxicodequotebacktick\endcsname
2347*36ac495dSmrg      = \relax
2348*36ac495dSmrg  \else
2349*36ac495dSmrg    \errhelp = \EMsimple
2350*36ac495dSmrg    \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2351*36ac495dSmrg  \fi\fi
2352*36ac495dSmrg}
2353*36ac495dSmrg
2354*36ac495dSmrg% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2355*36ac495dSmrg\def\noligaturesquoteleft{\relax\lq}
2356*36ac495dSmrg
2357*36ac495dSmrg% Count depth in font-changes, for error checks
2358*36ac495dSmrg\newcount\fontdepth \fontdepth=0
2359*36ac495dSmrg
2360*36ac495dSmrg% Font commands.
2361*36ac495dSmrg
2362*36ac495dSmrg% #1 is the font command (\sl or \it), #2 is the text to slant.
2363*36ac495dSmrg% If we are in a monospaced environment, however, 1) always use \ttsl,
2364*36ac495dSmrg% and 2) do not add an italic correction.
2365*36ac495dSmrg\def\dosmartslant#1#2{%
2366*36ac495dSmrg  \ifusingtt
2367*36ac495dSmrg    {{\ttsl #2}\let\next=\relax}%
2368*36ac495dSmrg    {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2369*36ac495dSmrg  \next
2370*36ac495dSmrg}
2371*36ac495dSmrg\def\smartslanted{\dosmartslant\sl}
2372*36ac495dSmrg\def\smartitalic{\dosmartslant\it}
2373*36ac495dSmrg
2374*36ac495dSmrg% Output an italic correction unless \next (presumed to be the following
2375*36ac495dSmrg% character) is such as not to need one.
2376*36ac495dSmrg\def\smartitaliccorrection{%
2377*36ac495dSmrg  \ifx\next,%
2378*36ac495dSmrg  \else\ifx\next-%
2379*36ac495dSmrg  \else\ifx\next.%
2380*36ac495dSmrg  \else\ptexslash
2381*36ac495dSmrg  \fi\fi\fi
2382*36ac495dSmrg  \aftersmartic
2383*36ac495dSmrg}
2384*36ac495dSmrg
2385*36ac495dSmrg% like \smartslanted except unconditionally uses \ttsl, and no ic.
2386*36ac495dSmrg% @var is set to this for defun arguments.
2387*36ac495dSmrg\def\ttslanted#1{{\ttsl #1}}
2388*36ac495dSmrg
2389*36ac495dSmrg% @cite is like \smartslanted except unconditionally use \sl.  We never want
2390*36ac495dSmrg% ttsl for book titles, do we?
2391*36ac495dSmrg\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2392*36ac495dSmrg
2393*36ac495dSmrg\def\aftersmartic{}
2394*36ac495dSmrg\def\var#1{%
2395*36ac495dSmrg  \let\saveaftersmartic = \aftersmartic
2396*36ac495dSmrg  \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2397*36ac495dSmrg  \smartslanted{#1}%
2398*36ac495dSmrg}
2399*36ac495dSmrg
2400*36ac495dSmrg\let\i=\smartitalic
2401*36ac495dSmrg\let\slanted=\smartslanted
2402*36ac495dSmrg\let\dfn=\smartslanted
2403*36ac495dSmrg\let\emph=\smartitalic
2404*36ac495dSmrg
2405*36ac495dSmrg% Explicit font changes: @r, @sc, undocumented @ii.
2406*36ac495dSmrg\def\r#1{{\rm #1}}              % roman font
2407*36ac495dSmrg\def\sc#1{{\smallcaps#1}}       % smallcaps font
2408*36ac495dSmrg\def\ii#1{{\it #1}}             % italic font
2409*36ac495dSmrg
2410*36ac495dSmrg% @b, explicit bold.  Also @strong.
2411*36ac495dSmrg\def\b#1{{\bf #1}}
2412*36ac495dSmrg\let\strong=\b
2413*36ac495dSmrg
2414*36ac495dSmrg% @sansserif, explicit sans.
2415*36ac495dSmrg\def\sansserif#1{{\sf #1}}
2416*36ac495dSmrg
2417*36ac495dSmrg% We can't just use \exhyphenpenalty, because that only has effect at
2418*36ac495dSmrg% the end of a paragraph.  Restore normal hyphenation at the end of the
2419*36ac495dSmrg% group within which \nohyphenation is presumably called.
2420*36ac495dSmrg%
2421*36ac495dSmrg\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
2422*36ac495dSmrg\def\restorehyphenation{\hyphenchar\font = `- }
2423*36ac495dSmrg
2424*36ac495dSmrg% Set sfcode to normal for the chars that usually have another value.
2425*36ac495dSmrg% Can't use plain's \frenchspacing because it uses the `\x notation, and
2426*36ac495dSmrg% sometimes \x has an active definition that messes things up.
2427*36ac495dSmrg%
2428*36ac495dSmrg\catcode`@=11
2429*36ac495dSmrg  \def\plainfrenchspacing{%
2430*36ac495dSmrg    \sfcode\dotChar  =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
2431*36ac495dSmrg    \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
2432*36ac495dSmrg    \def\endofsentencespacefactor{1000}% for @. and friends
2433*36ac495dSmrg  }
2434*36ac495dSmrg  \def\plainnonfrenchspacing{%
2435*36ac495dSmrg    \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2436*36ac495dSmrg    \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2437*36ac495dSmrg    \def\endofsentencespacefactor{3000}% for @. and friends
2438*36ac495dSmrg  }
2439*36ac495dSmrg\catcode`@=\other
2440*36ac495dSmrg\def\endofsentencespacefactor{3000}% default
2441*36ac495dSmrg
2442*36ac495dSmrg% @t, explicit typewriter.
2443*36ac495dSmrg\def\t#1{%
2444*36ac495dSmrg  {\tt \rawbackslash \plainfrenchspacing #1}%
2445*36ac495dSmrg  \null
2446*36ac495dSmrg}
2447*36ac495dSmrg
2448*36ac495dSmrg% @samp.
2449*36ac495dSmrg\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2450*36ac495dSmrg
2451*36ac495dSmrg% definition of @key that produces a lozenge.  Doesn't adjust to text size.
2452*36ac495dSmrg%\setfont\keyrm\rmshape{8}{1000}{OT1}
2453*36ac495dSmrg%\font\keysy=cmsy9
2454*36ac495dSmrg%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2455*36ac495dSmrg%  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2456*36ac495dSmrg%    \vbox{\hrule\kern-0.4pt
2457*36ac495dSmrg%     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2458*36ac495dSmrg%    \kern-0.4pt\hrule}%
2459*36ac495dSmrg%  \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2460*36ac495dSmrg
2461*36ac495dSmrg% definition of @key with no lozenge.  If the current font is already
2462*36ac495dSmrg% monospace, don't change it; that way, we respect @kbdinputstyle.  But
2463*36ac495dSmrg% if it isn't monospace, then use \tt.
2464*36ac495dSmrg%
2465*36ac495dSmrg\def\key#1{{\setupmarkupstyle{key}%
2466*36ac495dSmrg  \nohyphenation
2467*36ac495dSmrg  \ifmonospace\else\tt\fi
2468*36ac495dSmrg  #1}\null}
2469*36ac495dSmrg
2470*36ac495dSmrg% ctrl is no longer a Texinfo command.
2471*36ac495dSmrg\def\ctrl #1{{\tt \rawbackslash \hat}#1}
2472*36ac495dSmrg
2473*36ac495dSmrg% @file, @option are the same as @samp.
2474*36ac495dSmrg\let\file=\samp
2475*36ac495dSmrg\let\option=\samp
2476*36ac495dSmrg
2477*36ac495dSmrg% @code is a modification of @t,
2478*36ac495dSmrg% which makes spaces the same size as normal in the surrounding text.
2479*36ac495dSmrg\def\tclose#1{%
2480*36ac495dSmrg  {%
2481*36ac495dSmrg    % Change normal interword space to be same as for the current font.
2482*36ac495dSmrg    \spaceskip = \fontdimen2\font
2483*36ac495dSmrg    %
2484*36ac495dSmrg    % Switch to typewriter.
2485*36ac495dSmrg    \tt
2486*36ac495dSmrg    %
2487*36ac495dSmrg    % But `\ ' produces the large typewriter interword space.
2488*36ac495dSmrg    \def\ {{\spaceskip = 0pt{} }}%
2489*36ac495dSmrg    %
2490*36ac495dSmrg    % Turn off hyphenation.
2491*36ac495dSmrg    \nohyphenation
2492*36ac495dSmrg    %
2493*36ac495dSmrg    \rawbackslash
2494*36ac495dSmrg    \plainfrenchspacing
2495*36ac495dSmrg    #1%
2496*36ac495dSmrg  }%
2497*36ac495dSmrg  \null % reset spacefactor to 1000
2498*36ac495dSmrg}
2499*36ac495dSmrg
2500*36ac495dSmrg% We *must* turn on hyphenation at `-' and `_' in @code.
2501*36ac495dSmrg% Otherwise, it is too hard to avoid overfull hboxes
2502*36ac495dSmrg% in the Emacs manual, the Library manual, etc.
2503*36ac495dSmrg
2504*36ac495dSmrg% Unfortunately, TeX uses one parameter (\hyphenchar) to control
2505*36ac495dSmrg% both hyphenation at - and hyphenation within words.
2506*36ac495dSmrg% We must therefore turn them both off (\tclose does that)
2507*36ac495dSmrg% and arrange explicitly to hyphenate at a dash.
2508*36ac495dSmrg%  -- rms.
2509*36ac495dSmrg{
2510*36ac495dSmrg  \catcode`\-=\active \catcode`\_=\active
2511*36ac495dSmrg  \catcode`\'=\active \catcode`\`=\active
2512*36ac495dSmrg  \global\let'=\rq \global\let`=\lq  % default definitions
2513*36ac495dSmrg  %
2514*36ac495dSmrg  \global\def\code{\begingroup
2515*36ac495dSmrg    \setupmarkupstyle{code}%
2516*36ac495dSmrg    % The following should really be moved into \setupmarkupstyle handlers.
2517*36ac495dSmrg    \catcode\dashChar=\active  \catcode\underChar=\active
2518*36ac495dSmrg    \ifallowcodebreaks
2519*36ac495dSmrg     \let-\codedash
2520*36ac495dSmrg     \let_\codeunder
2521*36ac495dSmrg    \else
2522*36ac495dSmrg     \let-\realdash
2523*36ac495dSmrg     \let_\realunder
2524*36ac495dSmrg    \fi
2525*36ac495dSmrg    \codex
2526*36ac495dSmrg  }
2527*36ac495dSmrg}
2528*36ac495dSmrg
2529*36ac495dSmrg\def\codex #1{\tclose{#1}\endgroup}
2530*36ac495dSmrg
2531*36ac495dSmrg\def\realdash{-}
2532*36ac495dSmrg\def\codedash{-\discretionary{}{}{}}
2533*36ac495dSmrg\def\codeunder{%
2534*36ac495dSmrg  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
2535*36ac495dSmrg  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2536*36ac495dSmrg  % will therefore expand the active definition of _, which is us
2537*36ac495dSmrg  % (inside @code that is), therefore an endless loop.
2538*36ac495dSmrg  \ifusingtt{\ifmmode
2539*36ac495dSmrg               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2540*36ac495dSmrg             \else\normalunderscore \fi
2541*36ac495dSmrg             \discretionary{}{}{}}%
2542*36ac495dSmrg            {\_}%
2543*36ac495dSmrg}
2544*36ac495dSmrg
2545*36ac495dSmrg% An additional complication: the above will allow breaks after, e.g.,
2546*36ac495dSmrg% each of the four underscores in __typeof__.  This is undesirable in
2547*36ac495dSmrg% some manuals, especially if they don't have long identifiers in
2548*36ac495dSmrg% general.  @allowcodebreaks provides a way to control this.
2549*36ac495dSmrg%
2550*36ac495dSmrg\newif\ifallowcodebreaks  \allowcodebreakstrue
2551*36ac495dSmrg
2552*36ac495dSmrg\def\keywordtrue{true}
2553*36ac495dSmrg\def\keywordfalse{false}
2554*36ac495dSmrg
2555*36ac495dSmrg\parseargdef\allowcodebreaks{%
2556*36ac495dSmrg  \def\txiarg{#1}%
2557*36ac495dSmrg  \ifx\txiarg\keywordtrue
2558*36ac495dSmrg    \allowcodebreakstrue
2559*36ac495dSmrg  \else\ifx\txiarg\keywordfalse
2560*36ac495dSmrg    \allowcodebreaksfalse
2561*36ac495dSmrg  \else
2562*36ac495dSmrg    \errhelp = \EMsimple
2563*36ac495dSmrg    \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2564*36ac495dSmrg  \fi\fi
2565*36ac495dSmrg}
2566*36ac495dSmrg
2567*36ac495dSmrg% @uref (abbreviation for `urlref') takes an optional (comma-separated)
2568*36ac495dSmrg% second argument specifying the text to display and an optional third
2569*36ac495dSmrg% arg as text to display instead of (rather than in addition to) the url
2570*36ac495dSmrg% itself.  First (mandatory) arg is the url.
2571*36ac495dSmrg% (This \urefnobreak definition isn't used now, leaving it for a while
2572*36ac495dSmrg% for comparison.)
2573*36ac495dSmrg\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
2574*36ac495dSmrg\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
2575*36ac495dSmrg  \unsepspaces
2576*36ac495dSmrg  \pdfurl{#1}%
2577*36ac495dSmrg  \setbox0 = \hbox{\ignorespaces #3}%
2578*36ac495dSmrg  \ifdim\wd0 > 0pt
2579*36ac495dSmrg    \unhbox0 % third arg given, show only that
2580*36ac495dSmrg  \else
2581*36ac495dSmrg    \setbox0 = \hbox{\ignorespaces #2}%
2582*36ac495dSmrg    \ifdim\wd0 > 0pt
2583*36ac495dSmrg      \ifpdf
2584*36ac495dSmrg        \unhbox0             % PDF: 2nd arg given, show only it
2585*36ac495dSmrg      \else
2586*36ac495dSmrg        \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
2587*36ac495dSmrg      \fi
2588*36ac495dSmrg    \else
2589*36ac495dSmrg      \code{#1}% only url given, so show it
2590*36ac495dSmrg    \fi
2591*36ac495dSmrg  \fi
2592*36ac495dSmrg  \endlink
2593*36ac495dSmrg\endgroup}
2594*36ac495dSmrg
2595*36ac495dSmrg% This \urefbreak definition is the active one.
2596*36ac495dSmrg\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2597*36ac495dSmrg\let\uref=\urefbreak
2598*36ac495dSmrg\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2599*36ac495dSmrg\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2600*36ac495dSmrg  \unsepspaces
2601*36ac495dSmrg  \pdfurl{#1}%
2602*36ac495dSmrg  \setbox0 = \hbox{\ignorespaces #3}%
2603*36ac495dSmrg  \ifdim\wd0 > 0pt
2604*36ac495dSmrg    \unhbox0 % third arg given, show only that
2605*36ac495dSmrg  \else
2606*36ac495dSmrg    \setbox0 = \hbox{\ignorespaces #2}%
2607*36ac495dSmrg    \ifdim\wd0 > 0pt
2608*36ac495dSmrg      \ifpdf
2609*36ac495dSmrg        \unhbox0             % PDF: 2nd arg given, show only it
2610*36ac495dSmrg      \else
2611*36ac495dSmrg        \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
2612*36ac495dSmrg      \fi
2613*36ac495dSmrg    \else
2614*36ac495dSmrg      \urefcode{#1}% only url given, so show it
2615*36ac495dSmrg    \fi
2616*36ac495dSmrg  \fi
2617*36ac495dSmrg  \endlink
2618*36ac495dSmrg\endgroup}
2619*36ac495dSmrg
2620*36ac495dSmrg% Allow line breaks around only a few characters (only).
2621*36ac495dSmrg\def\urefcatcodes{%
2622*36ac495dSmrg  \catcode\ampChar=\active   \catcode\dotChar=\active
2623*36ac495dSmrg  \catcode\hashChar=\active  \catcode\questChar=\active
2624*36ac495dSmrg  \catcode\slashChar=\active
2625*36ac495dSmrg}
2626*36ac495dSmrg{
2627*36ac495dSmrg  \urefcatcodes
2628*36ac495dSmrg  %
2629*36ac495dSmrg  \global\def\urefcode{\begingroup
2630*36ac495dSmrg    \setupmarkupstyle{code}%
2631*36ac495dSmrg    \urefcatcodes
2632*36ac495dSmrg    \let&\urefcodeamp
2633*36ac495dSmrg    \let.\urefcodedot
2634*36ac495dSmrg    \let#\urefcodehash
2635*36ac495dSmrg    \let?\urefcodequest
2636*36ac495dSmrg    \let/\urefcodeslash
2637*36ac495dSmrg    \codex
2638*36ac495dSmrg  }
2639*36ac495dSmrg  %
2640*36ac495dSmrg  % By default, they are just regular characters.
2641*36ac495dSmrg  \global\def&{\normalamp}
2642*36ac495dSmrg  \global\def.{\normaldot}
2643*36ac495dSmrg  \global\def#{\normalhash}
2644*36ac495dSmrg  \global\def?{\normalquest}
2645*36ac495dSmrg  \global\def/{\normalslash}
2646*36ac495dSmrg}
2647*36ac495dSmrg
2648*36ac495dSmrg% we put a little stretch before and after the breakable chars, to help
2649*36ac495dSmrg% line breaking of long url's.  The unequal skips make look better in
2650*36ac495dSmrg% cmtt at least, especially for dots.
2651*36ac495dSmrg\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
2652*36ac495dSmrg\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
2653*36ac495dSmrg%
2654*36ac495dSmrg\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2655*36ac495dSmrg\def\urefcodedot{\urefprestretch .\urefpoststretch}
2656*36ac495dSmrg\def\urefcodehash{\urefprestretch \#\urefpoststretch}
2657*36ac495dSmrg\def\urefcodequest{\urefprestretch ?\urefpoststretch}
2658*36ac495dSmrg\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2659*36ac495dSmrg{
2660*36ac495dSmrg  \catcode`\/=\active
2661*36ac495dSmrg  \global\def\urefcodeslashfinish{%
2662*36ac495dSmrg    \urefprestretch \slashChar
2663*36ac495dSmrg    % Allow line break only after the final / in a sequence of
2664*36ac495dSmrg    % slashes, to avoid line break between the slashes in http://.
2665*36ac495dSmrg    \ifx\next/\else \urefpoststretch \fi
2666*36ac495dSmrg  }
2667*36ac495dSmrg}
2668*36ac495dSmrg
2669*36ac495dSmrg% One more complication: by default we'll break after the special
2670*36ac495dSmrg% characters, but some people like to break before the special chars, so
2671*36ac495dSmrg% allow that.  Also allow no breaking at all, for manual control.
2672*36ac495dSmrg%
2673*36ac495dSmrg\parseargdef\urefbreakstyle{%
2674*36ac495dSmrg  \def\txiarg{#1}%
2675*36ac495dSmrg  \ifx\txiarg\wordnone
2676*36ac495dSmrg    \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2677*36ac495dSmrg  \else\ifx\txiarg\wordbefore
2678*36ac495dSmrg    \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2679*36ac495dSmrg  \else\ifx\txiarg\wordafter
2680*36ac495dSmrg    \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2681*36ac495dSmrg  \else
2682*36ac495dSmrg    \errhelp = \EMsimple
2683*36ac495dSmrg    \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2684*36ac495dSmrg  \fi\fi\fi
2685*36ac495dSmrg}
2686*36ac495dSmrg\def\wordafter{after}
2687*36ac495dSmrg\def\wordbefore{before}
2688*36ac495dSmrg\def\wordnone{none}
2689*36ac495dSmrg
2690*36ac495dSmrg\urefbreakstyle after
2691*36ac495dSmrg
2692*36ac495dSmrg% @url synonym for @uref, since that's how everyone uses it.
2693*36ac495dSmrg%
2694*36ac495dSmrg\let\url=\uref
2695*36ac495dSmrg
2696*36ac495dSmrg% rms does not like angle brackets --karl, 17may97.
2697*36ac495dSmrg% So now @email is just like @uref, unless we are pdf.
2698*36ac495dSmrg%
2699*36ac495dSmrg%\def\email#1{\angleleft{\tt #1}\angleright}
2700*36ac495dSmrg\ifpdf
2701*36ac495dSmrg  \def\email#1{\doemail#1,,\finish}
2702*36ac495dSmrg  \def\doemail#1,#2,#3\finish{\begingroup
2703*36ac495dSmrg    \unsepspaces
2704*36ac495dSmrg    \pdfurl{mailto:#1}%
2705*36ac495dSmrg    \setbox0 = \hbox{\ignorespaces #2}%
2706*36ac495dSmrg    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2707*36ac495dSmrg    \endlink
2708*36ac495dSmrg  \endgroup}
2709*36ac495dSmrg\else
2710*36ac495dSmrg  \let\email=\uref
2711*36ac495dSmrg\fi
2712*36ac495dSmrg
2713*36ac495dSmrg% @kbd is like @code, except that if the argument is just one @key command,
2714*36ac495dSmrg% then @kbd has no effect.
2715*36ac495dSmrg\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
2716*36ac495dSmrg
2717*36ac495dSmrg% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2718*36ac495dSmrg%   `example' (@kbd uses ttsl only inside of @example and friends),
2719*36ac495dSmrg%   or `code' (@kbd uses normal tty font always).
2720*36ac495dSmrg\parseargdef\kbdinputstyle{%
2721*36ac495dSmrg  \def\txiarg{#1}%
2722*36ac495dSmrg  \ifx\txiarg\worddistinct
2723*36ac495dSmrg    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2724*36ac495dSmrg  \else\ifx\txiarg\wordexample
2725*36ac495dSmrg    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2726*36ac495dSmrg  \else\ifx\txiarg\wordcode
2727*36ac495dSmrg    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2728*36ac495dSmrg  \else
2729*36ac495dSmrg    \errhelp = \EMsimple
2730*36ac495dSmrg    \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2731*36ac495dSmrg  \fi\fi\fi
2732*36ac495dSmrg}
2733*36ac495dSmrg\def\worddistinct{distinct}
2734*36ac495dSmrg\def\wordexample{example}
2735*36ac495dSmrg\def\wordcode{code}
2736*36ac495dSmrg
2737*36ac495dSmrg% Default is `distinct'.
2738*36ac495dSmrg\kbdinputstyle distinct
2739*36ac495dSmrg
2740*36ac495dSmrg\def\xkey{\key}
2741*36ac495dSmrg\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2742*36ac495dSmrg\ifx\one\xkey\ifx\threex\three \key{#2}%
2743*36ac495dSmrg\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2744*36ac495dSmrg\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
2745*36ac495dSmrg
2746*36ac495dSmrg% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2747*36ac495dSmrg\let\indicateurl=\code
2748*36ac495dSmrg\let\env=\code
2749*36ac495dSmrg\let\command=\code
2750*36ac495dSmrg
2751*36ac495dSmrg% @clicksequence{File @click{} Open ...}
2752*36ac495dSmrg\def\clicksequence#1{\begingroup #1\endgroup}
2753*36ac495dSmrg
2754*36ac495dSmrg% @clickstyle @arrow   (by default)
2755*36ac495dSmrg\parseargdef\clickstyle{\def\click{#1}}
2756*36ac495dSmrg\def\click{\arrow}
2757*36ac495dSmrg
2758*36ac495dSmrg% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
2759*36ac495dSmrg% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2760*36ac495dSmrg%
2761*36ac495dSmrg\def\dmn#1{\thinspace #1}
2762*36ac495dSmrg
2763*36ac495dSmrg% @l was never documented to mean ``switch to the Lisp font'',
2764*36ac495dSmrg% and it is not used as such in any manual I can find.  We need it for
2765*36ac495dSmrg% Polish suppressed-l.  --karl, 22sep96.
2766*36ac495dSmrg%\def\l#1{{\li #1}\null}
2767*36ac495dSmrg
2768*36ac495dSmrg% @acronym for "FBI", "NATO", and the like.
2769*36ac495dSmrg% We print this one point size smaller, since it's intended for
2770*36ac495dSmrg% all-uppercase.
2771*36ac495dSmrg%
2772*36ac495dSmrg\def\acronym#1{\doacronym #1,,\finish}
2773*36ac495dSmrg\def\doacronym#1,#2,#3\finish{%
2774*36ac495dSmrg  {\selectfonts\lsize #1}%
2775*36ac495dSmrg  \def\temp{#2}%
2776*36ac495dSmrg  \ifx\temp\empty \else
2777*36ac495dSmrg    \space ({\unsepspaces \ignorespaces \temp \unskip})%
2778*36ac495dSmrg  \fi
2779*36ac495dSmrg  \null % reset \spacefactor=1000
2780*36ac495dSmrg}
2781*36ac495dSmrg
2782*36ac495dSmrg% @abbr for "Comput. J." and the like.
2783*36ac495dSmrg% No font change, but don't do end-of-sentence spacing.
2784*36ac495dSmrg%
2785*36ac495dSmrg\def\abbr#1{\doabbr #1,,\finish}
2786*36ac495dSmrg\def\doabbr#1,#2,#3\finish{%
2787*36ac495dSmrg  {\plainfrenchspacing #1}%
2788*36ac495dSmrg  \def\temp{#2}%
2789*36ac495dSmrg  \ifx\temp\empty \else
2790*36ac495dSmrg    \space ({\unsepspaces \ignorespaces \temp \unskip})%
2791*36ac495dSmrg  \fi
2792*36ac495dSmrg  \null % reset \spacefactor=1000
2793*36ac495dSmrg}
2794*36ac495dSmrg
2795*36ac495dSmrg% @asis just yields its argument.  Used with @table, for example.
2796*36ac495dSmrg%
2797*36ac495dSmrg\def\asis#1{#1}
2798*36ac495dSmrg
2799*36ac495dSmrg% @math outputs its argument in math mode.
2800*36ac495dSmrg%
2801*36ac495dSmrg% One complication: _ usually means subscripts, but it could also mean
2802*36ac495dSmrg% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
2803*36ac495dSmrg% _ active, and distinguish by seeing if the current family is \slfam,
2804*36ac495dSmrg% which is what @var uses.
2805*36ac495dSmrg{
2806*36ac495dSmrg  \catcode`\_ = \active
2807*36ac495dSmrg  \gdef\mathunderscore{%
2808*36ac495dSmrg    \catcode`\_=\active
2809*36ac495dSmrg    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2810*36ac495dSmrg  }
2811*36ac495dSmrg}
2812*36ac495dSmrg% Another complication: we want \\ (and @\) to output a math (or tt) \.
2813*36ac495dSmrg% FYI, plain.tex uses \\ as a temporary control sequence (for no
2814*36ac495dSmrg% particular reason), but this is not advertised and we don't care.
2815*36ac495dSmrg%
2816*36ac495dSmrg% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2817*36ac495dSmrg\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2818*36ac495dSmrg%
2819*36ac495dSmrg\def\math{%
2820*36ac495dSmrg  \tex
2821*36ac495dSmrg  \mathunderscore
2822*36ac495dSmrg  \let\\ = \mathbackslash
2823*36ac495dSmrg  \mathactive
2824*36ac495dSmrg  % make the texinfo accent commands work in math mode
2825*36ac495dSmrg  \let\"=\ddot
2826*36ac495dSmrg  \let\'=\acute
2827*36ac495dSmrg  \let\==\bar
2828*36ac495dSmrg  \let\^=\hat
2829*36ac495dSmrg  \let\`=\grave
2830*36ac495dSmrg  \let\u=\breve
2831*36ac495dSmrg  \let\v=\check
2832*36ac495dSmrg  \let\~=\tilde
2833*36ac495dSmrg  \let\dotaccent=\dot
2834*36ac495dSmrg  $\finishmath
2835*36ac495dSmrg}
2836*36ac495dSmrg\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
2837*36ac495dSmrg
2838*36ac495dSmrg% Some active characters (such as <) are spaced differently in math.
2839*36ac495dSmrg% We have to reset their definitions in case the @math was an argument
2840*36ac495dSmrg% to a command which sets the catcodes (such as @item or @section).
2841*36ac495dSmrg%
2842*36ac495dSmrg{
2843*36ac495dSmrg  \catcode`^ = \active
2844*36ac495dSmrg  \catcode`< = \active
2845*36ac495dSmrg  \catcode`> = \active
2846*36ac495dSmrg  \catcode`+ = \active
2847*36ac495dSmrg  \catcode`' = \active
2848*36ac495dSmrg  \gdef\mathactive{%
2849*36ac495dSmrg    \let^ = \ptexhat
2850*36ac495dSmrg    \let< = \ptexless
2851*36ac495dSmrg    \let> = \ptexgtr
2852*36ac495dSmrg    \let+ = \ptexplus
2853*36ac495dSmrg    \let' = \ptexquoteright
2854*36ac495dSmrg  }
2855*36ac495dSmrg}
2856*36ac495dSmrg
2857*36ac495dSmrg% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
2858*36ac495dSmrg% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
2859*36ac495dSmrg% except specified as a normal braced arg, so no newlines to worry about.
2860*36ac495dSmrg%
2861*36ac495dSmrg\def\outfmtnametex{tex}
2862*36ac495dSmrg%
2863*36ac495dSmrg\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
2864*36ac495dSmrg\long\def\doinlinefmt#1,#2,\finish{%
2865*36ac495dSmrg  \def\inlinefmtname{#1}%
2866*36ac495dSmrg  \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
2867*36ac495dSmrg}
2868*36ac495dSmrg% For raw, must switch into @tex before parsing the argument, to avoid
2869*36ac495dSmrg% setting catcodes prematurely.  Doing it this way means that, for
2870*36ac495dSmrg% example, @inlineraw{html, foo{bar} gets a parse error instead of being
2871*36ac495dSmrg% ignored.  But this isn't important because if people want a literal
2872*36ac495dSmrg% *right* brace they would have to use a command anyway, so they may as
2873*36ac495dSmrg% well use a command to get a left brace too.  We could re-use the
2874*36ac495dSmrg% delimiter character idea from \verb, but it seems like overkill.
2875*36ac495dSmrg%
2876*36ac495dSmrg\long\def\inlineraw{\tex \doinlineraw}
2877*36ac495dSmrg\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
2878*36ac495dSmrg\def\doinlinerawtwo#1,#2,\finish{%
2879*36ac495dSmrg  \def\inlinerawname{#1}%
2880*36ac495dSmrg  \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
2881*36ac495dSmrg  \endgroup % close group opened by \tex.
2882*36ac495dSmrg}
2883*36ac495dSmrg
2884*36ac495dSmrg
2885*36ac495dSmrg\message{glyphs,}
2886*36ac495dSmrg% and logos.
2887*36ac495dSmrg
2888*36ac495dSmrg% @@ prints an @, as does @atchar{}.
2889*36ac495dSmrg\def\@{\char64 }
2890*36ac495dSmrg\let\atchar=\@
2891*36ac495dSmrg
2892*36ac495dSmrg% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
2893*36ac495dSmrg% Unless we're in typewriter, use \ecfont because the CM text fonts do
2894*36ac495dSmrg% not have braces, and we don't want to switch into math.
2895*36ac495dSmrg\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
2896*36ac495dSmrg\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
2897*36ac495dSmrg\let\{=\mylbrace \let\lbracechar=\{
2898*36ac495dSmrg\let\}=\myrbrace \let\rbracechar=\}
2899*36ac495dSmrg\begingroup
2900*36ac495dSmrg  % Definitions to produce \{ and \} commands for indices,
2901*36ac495dSmrg  % and @{ and @} for the aux/toc files.
2902*36ac495dSmrg  \catcode`\{ = \other \catcode`\} = \other
2903*36ac495dSmrg  \catcode`\[ = 1 \catcode`\] = 2
2904*36ac495dSmrg  \catcode`\! = 0 \catcode`\\ = \other
2905*36ac495dSmrg  !gdef!lbracecmd[\{]%
2906*36ac495dSmrg  !gdef!rbracecmd[\}]%
2907*36ac495dSmrg  !gdef!lbraceatcmd[@{]%
2908*36ac495dSmrg  !gdef!rbraceatcmd[@}]%
2909*36ac495dSmrg!endgroup
2910*36ac495dSmrg
2911*36ac495dSmrg% @comma{} to avoid , parsing problems.
2912*36ac495dSmrg\let\comma = ,
2913*36ac495dSmrg
2914*36ac495dSmrg% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
2915*36ac495dSmrg% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
2916*36ac495dSmrg\let\, = \ptexc
2917*36ac495dSmrg\let\dotaccent = \ptexdot
2918*36ac495dSmrg\def\ringaccent#1{{\accent23 #1}}
2919*36ac495dSmrg\let\tieaccent = \ptext
2920*36ac495dSmrg\let\ubaraccent = \ptexb
2921*36ac495dSmrg\let\udotaccent = \d
2922*36ac495dSmrg
2923*36ac495dSmrg% Other special characters: @questiondown @exclamdown @ordf @ordm
2924*36ac495dSmrg% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
2925*36ac495dSmrg\def\questiondown{?`}
2926*36ac495dSmrg\def\exclamdown{!`}
2927*36ac495dSmrg\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
2928*36ac495dSmrg\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
2929*36ac495dSmrg
2930*36ac495dSmrg% Dotless i and dotless j, used for accents.
2931*36ac495dSmrg\def\imacro{i}
2932*36ac495dSmrg\def\jmacro{j}
2933*36ac495dSmrg\def\dotless#1{%
2934*36ac495dSmrg  \def\temp{#1}%
2935*36ac495dSmrg  \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
2936*36ac495dSmrg  \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
2937*36ac495dSmrg  \else \errmessage{@dotless can be used only with i or j}%
2938*36ac495dSmrg  \fi\fi
2939*36ac495dSmrg}
2940*36ac495dSmrg
2941*36ac495dSmrg% The \TeX{} logo, as in plain, but resetting the spacing so that a
2942*36ac495dSmrg% period following counts as ending a sentence.  (Idea found in latex.)
2943*36ac495dSmrg%
2944*36ac495dSmrg\edef\TeX{\TeX \spacefactor=1000 }
2945*36ac495dSmrg
2946*36ac495dSmrg% @LaTeX{} logo.  Not quite the same results as the definition in
2947*36ac495dSmrg% latex.ltx, since we use a different font for the raised A; it's most
2948*36ac495dSmrg% convenient for us to use an explicitly smaller font, rather than using
2949*36ac495dSmrg% the \scriptstyle font (since we don't reset \scriptstyle and
2950*36ac495dSmrg% \scriptscriptstyle).
2951*36ac495dSmrg%
2952*36ac495dSmrg\def\LaTeX{%
2953*36ac495dSmrg  L\kern-.36em
2954*36ac495dSmrg  {\setbox0=\hbox{T}%
2955*36ac495dSmrg   \vbox to \ht0{\hbox{%
2956*36ac495dSmrg     \ifx\textnominalsize\xwordpt
2957*36ac495dSmrg       % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
2958*36ac495dSmrg       % Revert to plain's \scriptsize, which is 7pt.
2959*36ac495dSmrg       \count255=\the\fam $\fam\count255 \scriptstyle A$%
2960*36ac495dSmrg     \else
2961*36ac495dSmrg       % For 11pt, we can use our lllsize.
2962*36ac495dSmrg       \selectfonts\lllsize A%
2963*36ac495dSmrg     \fi
2964*36ac495dSmrg     }%
2965*36ac495dSmrg     \vss
2966*36ac495dSmrg  }}%
2967*36ac495dSmrg  \kern-.15em
2968*36ac495dSmrg  \TeX
2969*36ac495dSmrg}
2970*36ac495dSmrg
2971*36ac495dSmrg% Some math mode symbols.
2972*36ac495dSmrg\def\bullet{$\ptexbullet$}
2973*36ac495dSmrg\def\geq{\ifmmode \ge\else $\ge$\fi}
2974*36ac495dSmrg\def\leq{\ifmmode \le\else $\le$\fi}
2975*36ac495dSmrg\def\minus{\ifmmode -\else $-$\fi}
2976*36ac495dSmrg
2977*36ac495dSmrg% @dots{} outputs an ellipsis using the current font.
2978*36ac495dSmrg% We do .5em per period so that it has the same spacing in the cm
2979*36ac495dSmrg% typewriter fonts as three actual period characters; on the other hand,
2980*36ac495dSmrg% in other typewriter fonts three periods are wider than 1.5em.  So do
2981*36ac495dSmrg% whichever is larger.
2982*36ac495dSmrg%
2983*36ac495dSmrg\def\dots{%
2984*36ac495dSmrg  \leavevmode
2985*36ac495dSmrg  \setbox0=\hbox{...}% get width of three periods
2986*36ac495dSmrg  \ifdim\wd0 > 1.5em
2987*36ac495dSmrg    \dimen0 = \wd0
2988*36ac495dSmrg  \else
2989*36ac495dSmrg    \dimen0 = 1.5em
2990*36ac495dSmrg  \fi
2991*36ac495dSmrg  \hbox to \dimen0{%
2992*36ac495dSmrg    \hskip 0pt plus.25fil
2993*36ac495dSmrg    .\hskip 0pt plus1fil
2994*36ac495dSmrg    .\hskip 0pt plus1fil
2995*36ac495dSmrg    .\hskip 0pt plus.5fil
2996*36ac495dSmrg  }%
2997*36ac495dSmrg}
2998*36ac495dSmrg
2999*36ac495dSmrg% @enddots{} is an end-of-sentence ellipsis.
3000*36ac495dSmrg%
3001*36ac495dSmrg\def\enddots{%
3002*36ac495dSmrg  \dots
3003*36ac495dSmrg  \spacefactor=\endofsentencespacefactor
3004*36ac495dSmrg}
3005*36ac495dSmrg
3006*36ac495dSmrg% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3007*36ac495dSmrg%
3008*36ac495dSmrg% Since these characters are used in examples, they should be an even number of
3009*36ac495dSmrg% \tt widths. Each \tt character is 1en, so two makes it 1em.
3010*36ac495dSmrg%
3011*36ac495dSmrg\def\point{$\star$}
3012*36ac495dSmrg\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3013*36ac495dSmrg\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3014*36ac495dSmrg\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3015*36ac495dSmrg\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3016*36ac495dSmrg\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3017*36ac495dSmrg
3018*36ac495dSmrg% The @error{} command.
3019*36ac495dSmrg% Adapted from the TeXbook's \boxit.
3020*36ac495dSmrg%
3021*36ac495dSmrg\newbox\errorbox
3022*36ac495dSmrg%
3023*36ac495dSmrg{\tentt \global\dimen0 = 3em}% Width of the box.
3024*36ac495dSmrg\dimen2 = .55pt % Thickness of rules
3025*36ac495dSmrg% The text. (`r' is open on the right, `e' somewhat less so on the left.)
3026*36ac495dSmrg\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3027*36ac495dSmrg%
3028*36ac495dSmrg\setbox\errorbox=\hbox to \dimen0{\hfil
3029*36ac495dSmrg   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3030*36ac495dSmrg   \advance\hsize by -2\dimen2 % Rules.
3031*36ac495dSmrg   \vbox{%
3032*36ac495dSmrg      \hrule height\dimen2
3033*36ac495dSmrg      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
3034*36ac495dSmrg         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3035*36ac495dSmrg         \kern3pt\vrule width\dimen2}% Space to right.
3036*36ac495dSmrg      \hrule height\dimen2}
3037*36ac495dSmrg    \hfil}
3038*36ac495dSmrg%
3039*36ac495dSmrg\def\error{\leavevmode\lower.7ex\copy\errorbox}
3040*36ac495dSmrg
3041*36ac495dSmrg% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3042*36ac495dSmrg%
3043*36ac495dSmrg\def\pounds{{\it\$}}
3044*36ac495dSmrg
3045*36ac495dSmrg% @euro{} comes from a separate font, depending on the current style.
3046*36ac495dSmrg% We use the free feym* fonts from the eurosym package by Henrik
3047*36ac495dSmrg% Theiling, which support regular, slanted, bold and bold slanted (and
3048*36ac495dSmrg% "outlined" (blackboard board, sort of) versions, which we don't need).
3049*36ac495dSmrg% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3050*36ac495dSmrg%
3051*36ac495dSmrg% Although only regular is the truly official Euro symbol, we ignore
3052*36ac495dSmrg% that.  The Euro is designed to be slightly taller than the regular
3053*36ac495dSmrg% font height.
3054*36ac495dSmrg%
3055*36ac495dSmrg% feymr - regular
3056*36ac495dSmrg% feymo - slanted
3057*36ac495dSmrg% feybr - bold
3058*36ac495dSmrg% feybo - bold slanted
3059*36ac495dSmrg%
3060*36ac495dSmrg% There is no good (free) typewriter version, to my knowledge.
3061*36ac495dSmrg% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3062*36ac495dSmrg% Hmm.
3063*36ac495dSmrg%
3064*36ac495dSmrg% Also doesn't work in math.  Do we need to do math with euro symbols?
3065*36ac495dSmrg% Hope not.
3066*36ac495dSmrg%
3067*36ac495dSmrg%
3068*36ac495dSmrg\def\euro{{\eurofont e}}
3069*36ac495dSmrg\def\eurofont{%
3070*36ac495dSmrg  % We set the font at each command, rather than predefining it in
3071*36ac495dSmrg  % \textfonts and the other font-switching commands, so that
3072*36ac495dSmrg  % installations which never need the symbol don't have to have the
3073*36ac495dSmrg  % font installed.
3074*36ac495dSmrg  %
3075*36ac495dSmrg  % There is only one designed size (nominal 10pt), so we always scale
3076*36ac495dSmrg  % that to the current nominal size.
3077*36ac495dSmrg  %
3078*36ac495dSmrg  % By the way, simply using "at 1em" works for cmr10 and the like, but
3079*36ac495dSmrg  % does not work for cmbx10 and other extended/shrunken fonts.
3080*36ac495dSmrg  %
3081*36ac495dSmrg  \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3082*36ac495dSmrg  %
3083*36ac495dSmrg  \ifx\curfontstyle\bfstylename
3084*36ac495dSmrg    % bold:
3085*36ac495dSmrg    \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3086*36ac495dSmrg  \else
3087*36ac495dSmrg    % regular:
3088*36ac495dSmrg    \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3089*36ac495dSmrg  \fi
3090*36ac495dSmrg  \thiseurofont
3091*36ac495dSmrg}
3092*36ac495dSmrg
3093*36ac495dSmrg% Glyphs from the EC fonts.  We don't use \let for the aliases, because
3094*36ac495dSmrg% sometimes we redefine the original macro, and the alias should reflect
3095*36ac495dSmrg% the redefinition.
3096*36ac495dSmrg%
3097*36ac495dSmrg% Use LaTeX names for the Icelandic letters.
3098*36ac495dSmrg\def\DH{{\ecfont \char"D0}} % Eth
3099*36ac495dSmrg\def\dh{{\ecfont \char"F0}} % eth
3100*36ac495dSmrg\def\TH{{\ecfont \char"DE}} % Thorn
3101*36ac495dSmrg\def\th{{\ecfont \char"FE}} % thorn
3102*36ac495dSmrg%
3103*36ac495dSmrg\def\guillemetleft{{\ecfont \char"13}}
3104*36ac495dSmrg\def\guillemotleft{\guillemetleft}
3105*36ac495dSmrg\def\guillemetright{{\ecfont \char"14}}
3106*36ac495dSmrg\def\guillemotright{\guillemetright}
3107*36ac495dSmrg\def\guilsinglleft{{\ecfont \char"0E}}
3108*36ac495dSmrg\def\guilsinglright{{\ecfont \char"0F}}
3109*36ac495dSmrg\def\quotedblbase{{\ecfont \char"12}}
3110*36ac495dSmrg\def\quotesinglbase{{\ecfont \char"0D}}
3111*36ac495dSmrg%
3112*36ac495dSmrg% This positioning is not perfect (see the ogonek LaTeX package), but
3113*36ac495dSmrg% we have the precomposed glyphs for the most common cases.  We put the
3114*36ac495dSmrg% tests to use those glyphs in the single \ogonek macro so we have fewer
3115*36ac495dSmrg% dummy definitions to worry about for index entries, etc.
3116*36ac495dSmrg%
3117*36ac495dSmrg% ogonek is also used with other letters in Lithuanian (IOU), but using
3118*36ac495dSmrg% the precomposed glyphs for those is not so easy since they aren't in
3119*36ac495dSmrg% the same EC font.
3120*36ac495dSmrg\def\ogonek#1{{%
3121*36ac495dSmrg  \def\temp{#1}%
3122*36ac495dSmrg  \ifx\temp\macrocharA\Aogonek
3123*36ac495dSmrg  \else\ifx\temp\macrochara\aogonek
3124*36ac495dSmrg  \else\ifx\temp\macrocharE\Eogonek
3125*36ac495dSmrg  \else\ifx\temp\macrochare\eogonek
3126*36ac495dSmrg  \else
3127*36ac495dSmrg    \ecfont \setbox0=\hbox{#1}%
3128*36ac495dSmrg    \ifdim\ht0=1ex\accent"0C #1%
3129*36ac495dSmrg    \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3130*36ac495dSmrg    \fi
3131*36ac495dSmrg  \fi\fi\fi\fi
3132*36ac495dSmrg  }%
3133*36ac495dSmrg}
3134*36ac495dSmrg\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3135*36ac495dSmrg\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3136*36ac495dSmrg\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3137*36ac495dSmrg\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3138*36ac495dSmrg%
3139*36ac495dSmrg% Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
3140*36ac495dSmrg\def\ecfont{%
3141*36ac495dSmrg  % We can't distinguish serif/sans and italic/slanted, but this
3142*36ac495dSmrg  % is used for crude hacks anyway (like adding French and German
3143*36ac495dSmrg  % quotes to documents typeset with CM, where we lose kerning), so
3144*36ac495dSmrg  % hopefully nobody will notice/care.
3145*36ac495dSmrg  \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3146*36ac495dSmrg  \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3147*36ac495dSmrg  \ifx\curfontstyle\bfstylename
3148*36ac495dSmrg    % bold:
3149*36ac495dSmrg    \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
3150*36ac495dSmrg  \else
3151*36ac495dSmrg    % regular:
3152*36ac495dSmrg    \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3153*36ac495dSmrg  \fi
3154*36ac495dSmrg  \thisecfont
3155*36ac495dSmrg}
3156*36ac495dSmrg
3157*36ac495dSmrg% @registeredsymbol - R in a circle.  The font for the R should really
3158*36ac495dSmrg% be smaller yet, but lllsize is the best we can do for now.
3159*36ac495dSmrg% Adapted from the plain.tex definition of \copyright.
3160*36ac495dSmrg%
3161*36ac495dSmrg\def\registeredsymbol{%
3162*36ac495dSmrg  $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3163*36ac495dSmrg               \hfil\crcr\Orb}}%
3164*36ac495dSmrg    }$%
3165*36ac495dSmrg}
3166*36ac495dSmrg
3167*36ac495dSmrg% @textdegree - the normal degrees sign.
3168*36ac495dSmrg%
3169*36ac495dSmrg\def\textdegree{$^\circ$}
3170*36ac495dSmrg
3171*36ac495dSmrg% Laurent Siebenmann reports \Orb undefined with:
3172*36ac495dSmrg%  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
3173*36ac495dSmrg% so we'll define it if necessary.
3174*36ac495dSmrg%
3175*36ac495dSmrg\ifx\Orb\thisisundefined
3176*36ac495dSmrg\def\Orb{\mathhexbox20D}
3177*36ac495dSmrg\fi
3178*36ac495dSmrg
3179*36ac495dSmrg% Quotes.
3180*36ac495dSmrg\chardef\quotedblleft="5C
3181*36ac495dSmrg\chardef\quotedblright=`\"
3182*36ac495dSmrg\chardef\quoteleft=`\`
3183*36ac495dSmrg\chardef\quoteright=`\'
3184*36ac495dSmrg
3185*36ac495dSmrg
3186*36ac495dSmrg\message{page headings,}
3187*36ac495dSmrg
3188*36ac495dSmrg\newskip\titlepagetopglue \titlepagetopglue = 1.5in
3189*36ac495dSmrg\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3190*36ac495dSmrg
3191*36ac495dSmrg% First the title page.  Must do @settitle before @titlepage.
3192*36ac495dSmrg\newif\ifseenauthor
3193*36ac495dSmrg\newif\iffinishedtitlepage
3194*36ac495dSmrg
3195*36ac495dSmrg% Do an implicit @contents or @shortcontents after @end titlepage if the
3196*36ac495dSmrg% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
3197*36ac495dSmrg%
3198*36ac495dSmrg\newif\ifsetcontentsaftertitlepage
3199*36ac495dSmrg \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3200*36ac495dSmrg\newif\ifsetshortcontentsaftertitlepage
3201*36ac495dSmrg \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3202*36ac495dSmrg
3203*36ac495dSmrg\parseargdef\shorttitlepage{%
3204*36ac495dSmrg  \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3205*36ac495dSmrg  \endgroup\page\hbox{}\page}
3206*36ac495dSmrg
3207*36ac495dSmrg\envdef\titlepage{%
3208*36ac495dSmrg  % Open one extra group, as we want to close it in the middle of \Etitlepage.
3209*36ac495dSmrg  \begingroup
3210*36ac495dSmrg    \parindent=0pt \textfonts
3211*36ac495dSmrg    % Leave some space at the very top of the page.
3212*36ac495dSmrg    \vglue\titlepagetopglue
3213*36ac495dSmrg    % No rule at page bottom unless we print one at the top with @title.
3214*36ac495dSmrg    \finishedtitlepagetrue
3215*36ac495dSmrg    %
3216*36ac495dSmrg    % Most title ``pages'' are actually two pages long, with space
3217*36ac495dSmrg    % at the top of the second.  We don't want the ragged left on the second.
3218*36ac495dSmrg    \let\oldpage = \page
3219*36ac495dSmrg    \def\page{%
3220*36ac495dSmrg      \iffinishedtitlepage\else
3221*36ac495dSmrg	 \finishtitlepage
3222*36ac495dSmrg      \fi
3223*36ac495dSmrg      \let\page = \oldpage
3224*36ac495dSmrg      \page
3225*36ac495dSmrg      \null
3226*36ac495dSmrg    }%
3227*36ac495dSmrg}
3228*36ac495dSmrg
3229*36ac495dSmrg\def\Etitlepage{%
3230*36ac495dSmrg    \iffinishedtitlepage\else
3231*36ac495dSmrg	\finishtitlepage
3232*36ac495dSmrg    \fi
3233*36ac495dSmrg    % It is important to do the page break before ending the group,
3234*36ac495dSmrg    % because the headline and footline are only empty inside the group.
3235*36ac495dSmrg    % If we use the new definition of \page, we always get a blank page
3236*36ac495dSmrg    % after the title page, which we certainly don't want.
3237*36ac495dSmrg    \oldpage
3238*36ac495dSmrg  \endgroup
3239*36ac495dSmrg  %
3240*36ac495dSmrg  % Need this before the \...aftertitlepage checks so that if they are
3241*36ac495dSmrg  % in effect the toc pages will come out with page numbers.
3242*36ac495dSmrg  \HEADINGSon
3243*36ac495dSmrg  %
3244*36ac495dSmrg  % If they want short, they certainly want long too.
3245*36ac495dSmrg  \ifsetshortcontentsaftertitlepage
3246*36ac495dSmrg    \shortcontents
3247*36ac495dSmrg    \contents
3248*36ac495dSmrg    \global\let\shortcontents = \relax
3249*36ac495dSmrg    \global\let\contents = \relax
3250*36ac495dSmrg  \fi
3251*36ac495dSmrg  %
3252*36ac495dSmrg  \ifsetcontentsaftertitlepage
3253*36ac495dSmrg    \contents
3254*36ac495dSmrg    \global\let\contents = \relax
3255*36ac495dSmrg    \global\let\shortcontents = \relax
3256*36ac495dSmrg  \fi
3257*36ac495dSmrg}
3258*36ac495dSmrg
3259*36ac495dSmrg\def\finishtitlepage{%
3260*36ac495dSmrg  \vskip4pt \hrule height 2pt width \hsize
3261*36ac495dSmrg  \vskip\titlepagebottomglue
3262*36ac495dSmrg  \finishedtitlepagetrue
3263*36ac495dSmrg}
3264*36ac495dSmrg
3265*36ac495dSmrg% Macros to be used within @titlepage:
3266*36ac495dSmrg
3267*36ac495dSmrg\let\subtitlerm=\tenrm
3268*36ac495dSmrg\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3269*36ac495dSmrg
3270*36ac495dSmrg\parseargdef\title{%
3271*36ac495dSmrg  \checkenv\titlepage
3272*36ac495dSmrg  \leftline{\titlefonts\rmisbold #1}
3273*36ac495dSmrg  % print a rule at the page bottom also.
3274*36ac495dSmrg  \finishedtitlepagefalse
3275*36ac495dSmrg  \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3276*36ac495dSmrg}
3277*36ac495dSmrg
3278*36ac495dSmrg\parseargdef\subtitle{%
3279*36ac495dSmrg  \checkenv\titlepage
3280*36ac495dSmrg  {\subtitlefont \rightline{#1}}%
3281*36ac495dSmrg}
3282*36ac495dSmrg
3283*36ac495dSmrg% @author should come last, but may come many times.
3284*36ac495dSmrg% It can also be used inside @quotation.
3285*36ac495dSmrg%
3286*36ac495dSmrg\parseargdef\author{%
3287*36ac495dSmrg  \def\temp{\quotation}%
3288*36ac495dSmrg  \ifx\thisenv\temp
3289*36ac495dSmrg    \def\quotationauthor{#1}% printed in \Equotation.
3290*36ac495dSmrg  \else
3291*36ac495dSmrg    \checkenv\titlepage
3292*36ac495dSmrg    \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3293*36ac495dSmrg    {\secfonts\rmisbold \leftline{#1}}%
3294*36ac495dSmrg  \fi
3295*36ac495dSmrg}
3296*36ac495dSmrg
3297*36ac495dSmrg
3298*36ac495dSmrg% Set up page headings and footings.
3299*36ac495dSmrg
3300*36ac495dSmrg\let\thispage=\folio
3301*36ac495dSmrg
3302*36ac495dSmrg\newtoks\evenheadline    % headline on even pages
3303*36ac495dSmrg\newtoks\oddheadline     % headline on odd pages
3304*36ac495dSmrg\newtoks\evenfootline    % footline on even pages
3305*36ac495dSmrg\newtoks\oddfootline     % footline on odd pages
3306*36ac495dSmrg
3307*36ac495dSmrg% Now make TeX use those variables
3308*36ac495dSmrg\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3309*36ac495dSmrg                            \else \the\evenheadline \fi}}
3310*36ac495dSmrg\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3311*36ac495dSmrg                            \else \the\evenfootline \fi}\HEADINGShook}
3312*36ac495dSmrg\let\HEADINGShook=\relax
3313*36ac495dSmrg
3314*36ac495dSmrg% Commands to set those variables.
3315*36ac495dSmrg% For example, this is what  @headings on  does
3316*36ac495dSmrg% @evenheading @thistitle|@thispage|@thischapter
3317*36ac495dSmrg% @oddheading @thischapter|@thispage|@thistitle
3318*36ac495dSmrg% @evenfooting @thisfile||
3319*36ac495dSmrg% @oddfooting ||@thisfile
3320*36ac495dSmrg
3321*36ac495dSmrg
3322*36ac495dSmrg\def\evenheading{\parsearg\evenheadingxxx}
3323*36ac495dSmrg\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3324*36ac495dSmrg\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3325*36ac495dSmrg\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3326*36ac495dSmrg
3327*36ac495dSmrg\def\oddheading{\parsearg\oddheadingxxx}
3328*36ac495dSmrg\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3329*36ac495dSmrg\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3330*36ac495dSmrg\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3331*36ac495dSmrg
3332*36ac495dSmrg\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3333*36ac495dSmrg
3334*36ac495dSmrg\def\evenfooting{\parsearg\evenfootingxxx}
3335*36ac495dSmrg\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3336*36ac495dSmrg\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3337*36ac495dSmrg\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3338*36ac495dSmrg
3339*36ac495dSmrg\def\oddfooting{\parsearg\oddfootingxxx}
3340*36ac495dSmrg\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3341*36ac495dSmrg\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3342*36ac495dSmrg  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3343*36ac495dSmrg  %
3344*36ac495dSmrg  % Leave some space for the footline.  Hopefully ok to assume
3345*36ac495dSmrg  % @evenfooting will not be used by itself.
3346*36ac495dSmrg  \global\advance\pageheight by -12pt
3347*36ac495dSmrg  \global\advance\vsize by -12pt
3348*36ac495dSmrg}
3349*36ac495dSmrg
3350*36ac495dSmrg\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3351*36ac495dSmrg
3352*36ac495dSmrg% @evenheadingmarks top     \thischapter <- chapter at the top of a page
3353*36ac495dSmrg% @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
3354*36ac495dSmrg%
3355*36ac495dSmrg% The same set of arguments for:
3356*36ac495dSmrg%
3357*36ac495dSmrg% @oddheadingmarks
3358*36ac495dSmrg% @evenfootingmarks
3359*36ac495dSmrg% @oddfootingmarks
3360*36ac495dSmrg% @everyheadingmarks
3361*36ac495dSmrg% @everyfootingmarks
3362*36ac495dSmrg
3363*36ac495dSmrg\def\evenheadingmarks{\headingmarks{even}{heading}}
3364*36ac495dSmrg\def\oddheadingmarks{\headingmarks{odd}{heading}}
3365*36ac495dSmrg\def\evenfootingmarks{\headingmarks{even}{footing}}
3366*36ac495dSmrg\def\oddfootingmarks{\headingmarks{odd}{footing}}
3367*36ac495dSmrg\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3368*36ac495dSmrg                          \headingmarks{odd}{heading}{#1} }
3369*36ac495dSmrg\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3370*36ac495dSmrg                          \headingmarks{odd}{footing}{#1} }
3371*36ac495dSmrg% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3372*36ac495dSmrg\def\headingmarks#1#2#3 {%
3373*36ac495dSmrg  \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3374*36ac495dSmrg  \global\expandafter\let\csname get#1#2marks\endcsname \temp
3375*36ac495dSmrg}
3376*36ac495dSmrg
3377*36ac495dSmrg\everyheadingmarks bottom
3378*36ac495dSmrg\everyfootingmarks bottom
3379*36ac495dSmrg
3380*36ac495dSmrg% @headings double      turns headings on for double-sided printing.
3381*36ac495dSmrg% @headings single      turns headings on for single-sided printing.
3382*36ac495dSmrg% @headings off         turns them off.
3383*36ac495dSmrg% @headings on          same as @headings double, retained for compatibility.
3384*36ac495dSmrg% @headings after       turns on double-sided headings after this page.
3385*36ac495dSmrg% @headings doubleafter turns on double-sided headings after this page.
3386*36ac495dSmrg% @headings singleafter turns on single-sided headings after this page.
3387*36ac495dSmrg% By default, they are off at the start of a document,
3388*36ac495dSmrg% and turned `on' after @end titlepage.
3389*36ac495dSmrg
3390*36ac495dSmrg\def\headings #1 {\csname HEADINGS#1\endcsname}
3391*36ac495dSmrg
3392*36ac495dSmrg\def\headingsoff{% non-global headings elimination
3393*36ac495dSmrg  \evenheadline={\hfil}\evenfootline={\hfil}%
3394*36ac495dSmrg   \oddheadline={\hfil}\oddfootline={\hfil}%
3395*36ac495dSmrg}
3396*36ac495dSmrg
3397*36ac495dSmrg\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3398*36ac495dSmrg\HEADINGSoff  % it's the default
3399*36ac495dSmrg
3400*36ac495dSmrg% When we turn headings on, set the page number to 1.
3401*36ac495dSmrg% For double-sided printing, put current file name in lower left corner,
3402*36ac495dSmrg% chapter name on inside top of right hand pages, document
3403*36ac495dSmrg% title on inside top of left hand pages, and page numbers on outside top
3404*36ac495dSmrg% edge of all pages.
3405*36ac495dSmrg\def\HEADINGSdouble{%
3406*36ac495dSmrg\global\pageno=1
3407*36ac495dSmrg\global\evenfootline={\hfil}
3408*36ac495dSmrg\global\oddfootline={\hfil}
3409*36ac495dSmrg\global\evenheadline={\line{\folio\hfil\thistitle}}
3410*36ac495dSmrg\global\oddheadline={\line{\thischapter\hfil\folio}}
3411*36ac495dSmrg\global\let\contentsalignmacro = \chapoddpage
3412*36ac495dSmrg}
3413*36ac495dSmrg\let\contentsalignmacro = \chappager
3414*36ac495dSmrg
3415*36ac495dSmrg% For single-sided printing, chapter title goes across top left of page,
3416*36ac495dSmrg% page number on top right.
3417*36ac495dSmrg\def\HEADINGSsingle{%
3418*36ac495dSmrg\global\pageno=1
3419*36ac495dSmrg\global\evenfootline={\hfil}
3420*36ac495dSmrg\global\oddfootline={\hfil}
3421*36ac495dSmrg\global\evenheadline={\line{\thischapter\hfil\folio}}
3422*36ac495dSmrg\global\oddheadline={\line{\thischapter\hfil\folio}}
3423*36ac495dSmrg\global\let\contentsalignmacro = \chappager
3424*36ac495dSmrg}
3425*36ac495dSmrg\def\HEADINGSon{\HEADINGSdouble}
3426*36ac495dSmrg
3427*36ac495dSmrg\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3428*36ac495dSmrg\let\HEADINGSdoubleafter=\HEADINGSafter
3429*36ac495dSmrg\def\HEADINGSdoublex{%
3430*36ac495dSmrg\global\evenfootline={\hfil}
3431*36ac495dSmrg\global\oddfootline={\hfil}
3432*36ac495dSmrg\global\evenheadline={\line{\folio\hfil\thistitle}}
3433*36ac495dSmrg\global\oddheadline={\line{\thischapter\hfil\folio}}
3434*36ac495dSmrg\global\let\contentsalignmacro = \chapoddpage
3435*36ac495dSmrg}
3436*36ac495dSmrg
3437*36ac495dSmrg\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3438*36ac495dSmrg\def\HEADINGSsinglex{%
3439*36ac495dSmrg\global\evenfootline={\hfil}
3440*36ac495dSmrg\global\oddfootline={\hfil}
3441*36ac495dSmrg\global\evenheadline={\line{\thischapter\hfil\folio}}
3442*36ac495dSmrg\global\oddheadline={\line{\thischapter\hfil\folio}}
3443*36ac495dSmrg\global\let\contentsalignmacro = \chappager
3444*36ac495dSmrg}
3445*36ac495dSmrg
3446*36ac495dSmrg% Subroutines used in generating headings
3447*36ac495dSmrg% This produces Day Month Year style of output.
3448*36ac495dSmrg% Only define if not already defined, in case a txi-??.tex file has set
3449*36ac495dSmrg% up a different format (e.g., txi-cs.tex does this).
3450*36ac495dSmrg\ifx\today\thisisundefined
3451*36ac495dSmrg\def\today{%
3452*36ac495dSmrg  \number\day\space
3453*36ac495dSmrg  \ifcase\month
3454*36ac495dSmrg  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3455*36ac495dSmrg  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3456*36ac495dSmrg  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3457*36ac495dSmrg  \fi
3458*36ac495dSmrg  \space\number\year}
3459*36ac495dSmrg\fi
3460*36ac495dSmrg
3461*36ac495dSmrg% @settitle line...  specifies the title of the document, for headings.
3462*36ac495dSmrg% It generates no output of its own.
3463*36ac495dSmrg\def\thistitle{\putwordNoTitle}
3464*36ac495dSmrg\def\settitle{\parsearg{\gdef\thistitle}}
3465*36ac495dSmrg
3466*36ac495dSmrg
3467*36ac495dSmrg\message{tables,}
3468*36ac495dSmrg% Tables -- @table, @ftable, @vtable, @item(x).
3469*36ac495dSmrg
3470*36ac495dSmrg% default indentation of table text
3471*36ac495dSmrg\newdimen\tableindent \tableindent=.8in
3472*36ac495dSmrg% default indentation of @itemize and @enumerate text
3473*36ac495dSmrg\newdimen\itemindent  \itemindent=.3in
3474*36ac495dSmrg% margin between end of table item and start of table text.
3475*36ac495dSmrg\newdimen\itemmargin  \itemmargin=.1in
3476*36ac495dSmrg
3477*36ac495dSmrg% used internally for \itemindent minus \itemmargin
3478*36ac495dSmrg\newdimen\itemmax
3479*36ac495dSmrg
3480*36ac495dSmrg% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3481*36ac495dSmrg% these defs.
3482*36ac495dSmrg% They also define \itemindex
3483*36ac495dSmrg% to index the item name in whatever manner is desired (perhaps none).
3484*36ac495dSmrg
3485*36ac495dSmrg\newif\ifitemxneedsnegativevskip
3486*36ac495dSmrg
3487*36ac495dSmrg\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3488*36ac495dSmrg
3489*36ac495dSmrg\def\internalBitem{\smallbreak \parsearg\itemzzz}
3490*36ac495dSmrg\def\internalBitemx{\itemxpar \parsearg\itemzzz}
3491*36ac495dSmrg
3492*36ac495dSmrg\def\itemzzz #1{\begingroup %
3493*36ac495dSmrg  \advance\hsize by -\rightskip
3494*36ac495dSmrg  \advance\hsize by -\tableindent
3495*36ac495dSmrg  \setbox0=\hbox{\itemindicate{#1}}%
3496*36ac495dSmrg  \itemindex{#1}%
3497*36ac495dSmrg  \nobreak % This prevents a break before @itemx.
3498*36ac495dSmrg  %
3499*36ac495dSmrg  % If the item text does not fit in the space we have, put it on a line
3500*36ac495dSmrg  % by itself, and do not allow a page break either before or after that
3501*36ac495dSmrg  % line.  We do not start a paragraph here because then if the next
3502*36ac495dSmrg  % command is, e.g., @kindex, the whatsit would get put into the
3503*36ac495dSmrg  % horizontal list on a line by itself, resulting in extra blank space.
3504*36ac495dSmrg  \ifdim \wd0>\itemmax
3505*36ac495dSmrg    %
3506*36ac495dSmrg    % Make this a paragraph so we get the \parskip glue and wrapping,
3507*36ac495dSmrg    % but leave it ragged-right.
3508*36ac495dSmrg    \begingroup
3509*36ac495dSmrg      \advance\leftskip by-\tableindent
3510*36ac495dSmrg      \advance\hsize by\tableindent
3511*36ac495dSmrg      \advance\rightskip by0pt plus1fil\relax
3512*36ac495dSmrg      \leavevmode\unhbox0\par
3513*36ac495dSmrg    \endgroup
3514*36ac495dSmrg    %
3515*36ac495dSmrg    % We're going to be starting a paragraph, but we don't want the
3516*36ac495dSmrg    % \parskip glue -- logically it's part of the @item we just started.
3517*36ac495dSmrg    \nobreak \vskip-\parskip
3518*36ac495dSmrg    %
3519*36ac495dSmrg    % Stop a page break at the \parskip glue coming up.  However, if
3520*36ac495dSmrg    % what follows is an environment such as @example, there will be no
3521*36ac495dSmrg    % \parskip glue; then the negative vskip we just inserted would
3522*36ac495dSmrg    % cause the example and the item to crash together.  So we use this
3523*36ac495dSmrg    % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3524*36ac495dSmrg    % \parskip glue after all.  Section titles are handled this way also.
3525*36ac495dSmrg    %
3526*36ac495dSmrg    \penalty 10001
3527*36ac495dSmrg    \endgroup
3528*36ac495dSmrg    \itemxneedsnegativevskipfalse
3529*36ac495dSmrg  \else
3530*36ac495dSmrg    % The item text fits into the space.  Start a paragraph, so that the
3531*36ac495dSmrg    % following text (if any) will end up on the same line.
3532*36ac495dSmrg    \noindent
3533*36ac495dSmrg    % Do this with kerns and \unhbox so that if there is a footnote in
3534*36ac495dSmrg    % the item text, it can migrate to the main vertical list and
3535*36ac495dSmrg    % eventually be printed.
3536*36ac495dSmrg    \nobreak\kern-\tableindent
3537*36ac495dSmrg    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3538*36ac495dSmrg    \unhbox0
3539*36ac495dSmrg    \nobreak\kern\dimen0
3540*36ac495dSmrg    \endgroup
3541*36ac495dSmrg    \itemxneedsnegativevskiptrue
3542*36ac495dSmrg  \fi
3543*36ac495dSmrg}
3544*36ac495dSmrg
3545*36ac495dSmrg\def\item{\errmessage{@item while not in a list environment}}
3546*36ac495dSmrg\def\itemx{\errmessage{@itemx while not in a list environment}}
3547*36ac495dSmrg
3548*36ac495dSmrg% @table, @ftable, @vtable.
3549*36ac495dSmrg\envdef\table{%
3550*36ac495dSmrg  \let\itemindex\gobble
3551*36ac495dSmrg  \tablecheck{table}%
3552*36ac495dSmrg}
3553*36ac495dSmrg\envdef\ftable{%
3554*36ac495dSmrg  \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3555*36ac495dSmrg  \tablecheck{ftable}%
3556*36ac495dSmrg}
3557*36ac495dSmrg\envdef\vtable{%
3558*36ac495dSmrg  \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3559*36ac495dSmrg  \tablecheck{vtable}%
3560*36ac495dSmrg}
3561*36ac495dSmrg\def\tablecheck#1{%
3562*36ac495dSmrg  \ifnum \the\catcode`\^^M=\active
3563*36ac495dSmrg    \endgroup
3564*36ac495dSmrg    \errmessage{This command won't work in this context; perhaps the problem is
3565*36ac495dSmrg      that we are \inenvironment\thisenv}%
3566*36ac495dSmrg    \def\next{\doignore{#1}}%
3567*36ac495dSmrg  \else
3568*36ac495dSmrg    \let\next\tablex
3569*36ac495dSmrg  \fi
3570*36ac495dSmrg  \next
3571*36ac495dSmrg}
3572*36ac495dSmrg\def\tablex#1{%
3573*36ac495dSmrg  \def\itemindicate{#1}%
3574*36ac495dSmrg  \parsearg\tabley
3575*36ac495dSmrg}
3576*36ac495dSmrg\def\tabley#1{%
3577*36ac495dSmrg  {%
3578*36ac495dSmrg    \makevalueexpandable
3579*36ac495dSmrg    \edef\temp{\noexpand\tablez #1\space\space\space}%
3580*36ac495dSmrg    \expandafter
3581*36ac495dSmrg  }\temp \endtablez
3582*36ac495dSmrg}
3583*36ac495dSmrg\def\tablez #1 #2 #3 #4\endtablez{%
3584*36ac495dSmrg  \aboveenvbreak
3585*36ac495dSmrg  \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3586*36ac495dSmrg  \ifnum 0#2>0 \tableindent=#2\mil \fi
3587*36ac495dSmrg  \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3588*36ac495dSmrg  \itemmax=\tableindent
3589*36ac495dSmrg  \advance \itemmax by -\itemmargin
3590*36ac495dSmrg  \advance \leftskip by \tableindent
3591*36ac495dSmrg  \exdentamount=\tableindent
3592*36ac495dSmrg  \parindent = 0pt
3593*36ac495dSmrg  \parskip = \smallskipamount
3594*36ac495dSmrg  \ifdim \parskip=0pt \parskip=2pt \fi
3595*36ac495dSmrg  \let\item = \internalBitem
3596*36ac495dSmrg  \let\itemx = \internalBitemx
3597*36ac495dSmrg}
3598*36ac495dSmrg\def\Etable{\endgraf\afterenvbreak}
3599*36ac495dSmrg\let\Eftable\Etable
3600*36ac495dSmrg\let\Evtable\Etable
3601*36ac495dSmrg\let\Eitemize\Etable
3602*36ac495dSmrg\let\Eenumerate\Etable
3603*36ac495dSmrg
3604*36ac495dSmrg% This is the counter used by @enumerate, which is really @itemize
3605*36ac495dSmrg
3606*36ac495dSmrg\newcount \itemno
3607*36ac495dSmrg
3608*36ac495dSmrg\envdef\itemize{\parsearg\doitemize}
3609*36ac495dSmrg
3610*36ac495dSmrg\def\doitemize#1{%
3611*36ac495dSmrg  \aboveenvbreak
3612*36ac495dSmrg  \itemmax=\itemindent
3613*36ac495dSmrg  \advance\itemmax by -\itemmargin
3614*36ac495dSmrg  \advance\leftskip by \itemindent
3615*36ac495dSmrg  \exdentamount=\itemindent
3616*36ac495dSmrg  \parindent=0pt
3617*36ac495dSmrg  \parskip=\smallskipamount
3618*36ac495dSmrg  \ifdim\parskip=0pt \parskip=2pt \fi
3619*36ac495dSmrg  %
3620*36ac495dSmrg  % Try typesetting the item mark that if the document erroneously says
3621*36ac495dSmrg  % something like @itemize @samp (intending @table), there's an error
3622*36ac495dSmrg  % right away at the @itemize.  It's not the best error message in the
3623*36ac495dSmrg  % world, but it's better than leaving it to the @item.  This means if
3624*36ac495dSmrg  % the user wants an empty mark, they have to say @w{} not just @w.
3625*36ac495dSmrg  \def\itemcontents{#1}%
3626*36ac495dSmrg  \setbox0 = \hbox{\itemcontents}%
3627*36ac495dSmrg  %
3628*36ac495dSmrg  % @itemize with no arg is equivalent to @itemize @bullet.
3629*36ac495dSmrg  \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3630*36ac495dSmrg  %
3631*36ac495dSmrg  \let\item=\itemizeitem
3632*36ac495dSmrg}
3633*36ac495dSmrg
3634*36ac495dSmrg% Definition of @item while inside @itemize and @enumerate.
3635*36ac495dSmrg%
3636*36ac495dSmrg\def\itemizeitem{%
3637*36ac495dSmrg  \advance\itemno by 1  % for enumerations
3638*36ac495dSmrg  {\let\par=\endgraf \smallbreak}% reasonable place to break
3639*36ac495dSmrg  {%
3640*36ac495dSmrg   % If the document has an @itemize directly after a section title, a
3641*36ac495dSmrg   % \nobreak will be last on the list, and \sectionheading will have
3642*36ac495dSmrg   % done a \vskip-\parskip.  In that case, we don't want to zero
3643*36ac495dSmrg   % parskip, or the item text will crash with the heading.  On the
3644*36ac495dSmrg   % other hand, when there is normal text preceding the item (as there
3645*36ac495dSmrg   % usually is), we do want to zero parskip, or there would be too much
3646*36ac495dSmrg   % space.  In that case, we won't have a \nobreak before.  At least
3647*36ac495dSmrg   % that's the theory.
3648*36ac495dSmrg   \ifnum\lastpenalty<10000 \parskip=0in \fi
3649*36ac495dSmrg   \noindent
3650*36ac495dSmrg   \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3651*36ac495dSmrg   %
3652*36ac495dSmrg   \vadjust{\penalty 1200}}% not good to break after first line of item.
3653*36ac495dSmrg  \flushcr
3654*36ac495dSmrg}
3655*36ac495dSmrg
3656*36ac495dSmrg% \splitoff TOKENS\endmark defines \first to be the first token in
3657*36ac495dSmrg% TOKENS, and \rest to be the remainder.
3658*36ac495dSmrg%
3659*36ac495dSmrg\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3660*36ac495dSmrg
3661*36ac495dSmrg% Allow an optional argument of an uppercase letter, lowercase letter,
3662*36ac495dSmrg% or number, to specify the first label in the enumerated list.  No
3663*36ac495dSmrg% argument is the same as `1'.
3664*36ac495dSmrg%
3665*36ac495dSmrg\envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
3666*36ac495dSmrg\def\enumeratey #1 #2\endenumeratey{%
3667*36ac495dSmrg  % If we were given no argument, pretend we were given `1'.
3668*36ac495dSmrg  \def\thearg{#1}%
3669*36ac495dSmrg  \ifx\thearg\empty \def\thearg{1}\fi
3670*36ac495dSmrg  %
3671*36ac495dSmrg  % Detect if the argument is a single token.  If so, it might be a
3672*36ac495dSmrg  % letter.  Otherwise, the only valid thing it can be is a number.
3673*36ac495dSmrg  % (We will always have one token, because of the test we just made.
3674*36ac495dSmrg  % This is a good thing, since \splitoff doesn't work given nothing at
3675*36ac495dSmrg  % all -- the first parameter is undelimited.)
3676*36ac495dSmrg  \expandafter\splitoff\thearg\endmark
3677*36ac495dSmrg  \ifx\rest\empty
3678*36ac495dSmrg    % Only one token in the argument.  It could still be anything.
3679*36ac495dSmrg    % A ``lowercase letter'' is one whose \lccode is nonzero.
3680*36ac495dSmrg    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3681*36ac495dSmrg    %   not equal to itself.
3682*36ac495dSmrg    % Otherwise, we assume it's a number.
3683*36ac495dSmrg    %
3684*36ac495dSmrg    % We need the \relax at the end of the \ifnum lines to stop TeX from
3685*36ac495dSmrg    % continuing to look for a <number>.
3686*36ac495dSmrg    %
3687*36ac495dSmrg    \ifnum\lccode\expandafter`\thearg=0\relax
3688*36ac495dSmrg      \numericenumerate % a number (we hope)
3689*36ac495dSmrg    \else
3690*36ac495dSmrg      % It's a letter.
3691*36ac495dSmrg      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3692*36ac495dSmrg        \lowercaseenumerate % lowercase letter
3693*36ac495dSmrg      \else
3694*36ac495dSmrg        \uppercaseenumerate % uppercase letter
3695*36ac495dSmrg      \fi
3696*36ac495dSmrg    \fi
3697*36ac495dSmrg  \else
3698*36ac495dSmrg    % Multiple tokens in the argument.  We hope it's a number.
3699*36ac495dSmrg    \numericenumerate
3700*36ac495dSmrg  \fi
3701*36ac495dSmrg}
3702*36ac495dSmrg
3703*36ac495dSmrg% An @enumerate whose labels are integers.  The starting integer is
3704*36ac495dSmrg% given in \thearg.
3705*36ac495dSmrg%
3706*36ac495dSmrg\def\numericenumerate{%
3707*36ac495dSmrg  \itemno = \thearg
3708*36ac495dSmrg  \startenumeration{\the\itemno}%
3709*36ac495dSmrg}
3710*36ac495dSmrg
3711*36ac495dSmrg% The starting (lowercase) letter is in \thearg.
3712*36ac495dSmrg\def\lowercaseenumerate{%
3713*36ac495dSmrg  \itemno = \expandafter`\thearg
3714*36ac495dSmrg  \startenumeration{%
3715*36ac495dSmrg    % Be sure we're not beyond the end of the alphabet.
3716*36ac495dSmrg    \ifnum\itemno=0
3717*36ac495dSmrg      \errmessage{No more lowercase letters in @enumerate; get a bigger
3718*36ac495dSmrg                  alphabet}%
3719*36ac495dSmrg    \fi
3720*36ac495dSmrg    \char\lccode\itemno
3721*36ac495dSmrg  }%
3722*36ac495dSmrg}
3723*36ac495dSmrg
3724*36ac495dSmrg% The starting (uppercase) letter is in \thearg.
3725*36ac495dSmrg\def\uppercaseenumerate{%
3726*36ac495dSmrg  \itemno = \expandafter`\thearg
3727*36ac495dSmrg  \startenumeration{%
3728*36ac495dSmrg    % Be sure we're not beyond the end of the alphabet.
3729*36ac495dSmrg    \ifnum\itemno=0
3730*36ac495dSmrg      \errmessage{No more uppercase letters in @enumerate; get a bigger
3731*36ac495dSmrg                  alphabet}
3732*36ac495dSmrg    \fi
3733*36ac495dSmrg    \char\uccode\itemno
3734*36ac495dSmrg  }%
3735*36ac495dSmrg}
3736*36ac495dSmrg
3737*36ac495dSmrg% Call \doitemize, adding a period to the first argument and supplying the
3738*36ac495dSmrg% common last two arguments.  Also subtract one from the initial value in
3739*36ac495dSmrg% \itemno, since @item increments \itemno.
3740*36ac495dSmrg%
3741*36ac495dSmrg\def\startenumeration#1{%
3742*36ac495dSmrg  \advance\itemno by -1
3743*36ac495dSmrg  \doitemize{#1.}\flushcr
3744*36ac495dSmrg}
3745*36ac495dSmrg
3746*36ac495dSmrg% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3747*36ac495dSmrg% to @enumerate.
3748*36ac495dSmrg%
3749*36ac495dSmrg\def\alphaenumerate{\enumerate{a}}
3750*36ac495dSmrg\def\capsenumerate{\enumerate{A}}
3751*36ac495dSmrg\def\Ealphaenumerate{\Eenumerate}
3752*36ac495dSmrg\def\Ecapsenumerate{\Eenumerate}
3753*36ac495dSmrg
3754*36ac495dSmrg
3755*36ac495dSmrg% @multitable macros
3756*36ac495dSmrg% Amy Hendrickson, 8/18/94, 3/6/96
3757*36ac495dSmrg%
3758*36ac495dSmrg% @multitable ... @end multitable will make as many columns as desired.
3759*36ac495dSmrg% Contents of each column will wrap at width given in preamble.  Width
3760*36ac495dSmrg% can be specified either with sample text given in a template line,
3761*36ac495dSmrg% or in percent of \hsize, the current width of text on page.
3762*36ac495dSmrg
3763*36ac495dSmrg% Table can continue over pages but will only break between lines.
3764*36ac495dSmrg
3765*36ac495dSmrg% To make preamble:
3766*36ac495dSmrg%
3767*36ac495dSmrg% Either define widths of columns in terms of percent of \hsize:
3768*36ac495dSmrg%   @multitable @columnfractions .25 .3 .45
3769*36ac495dSmrg%   @item ...
3770*36ac495dSmrg%
3771*36ac495dSmrg%   Numbers following @columnfractions are the percent of the total
3772*36ac495dSmrg%   current hsize to be used for each column. You may use as many
3773*36ac495dSmrg%   columns as desired.
3774*36ac495dSmrg
3775*36ac495dSmrg
3776*36ac495dSmrg% Or use a template:
3777*36ac495dSmrg%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3778*36ac495dSmrg%   @item ...
3779*36ac495dSmrg%   using the widest term desired in each column.
3780*36ac495dSmrg
3781*36ac495dSmrg% Each new table line starts with @item, each subsequent new column
3782*36ac495dSmrg% starts with @tab. Empty columns may be produced by supplying @tab's
3783*36ac495dSmrg% with nothing between them for as many times as empty columns are needed,
3784*36ac495dSmrg% ie, @tab@tab@tab will produce two empty columns.
3785*36ac495dSmrg
3786*36ac495dSmrg% @item, @tab do not need to be on their own lines, but it will not hurt
3787*36ac495dSmrg% if they are.
3788*36ac495dSmrg
3789*36ac495dSmrg% Sample multitable:
3790*36ac495dSmrg
3791*36ac495dSmrg%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3792*36ac495dSmrg%   @item first col stuff @tab second col stuff @tab third col
3793*36ac495dSmrg%   @item
3794*36ac495dSmrg%   first col stuff
3795*36ac495dSmrg%   @tab
3796*36ac495dSmrg%   second col stuff
3797*36ac495dSmrg%   @tab
3798*36ac495dSmrg%   third col
3799*36ac495dSmrg%   @item first col stuff @tab second col stuff
3800*36ac495dSmrg%   @tab Many paragraphs of text may be used in any column.
3801*36ac495dSmrg%
3802*36ac495dSmrg%         They will wrap at the width determined by the template.
3803*36ac495dSmrg%   @item@tab@tab This will be in third column.
3804*36ac495dSmrg%   @end multitable
3805*36ac495dSmrg
3806*36ac495dSmrg% Default dimensions may be reset by user.
3807*36ac495dSmrg% @multitableparskip is vertical space between paragraphs in table.
3808*36ac495dSmrg% @multitableparindent is paragraph indent in table.
3809*36ac495dSmrg% @multitablecolmargin is horizontal space to be left between columns.
3810*36ac495dSmrg% @multitablelinespace is space to leave between table items, baseline
3811*36ac495dSmrg%                                                            to baseline.
3812*36ac495dSmrg%   0pt means it depends on current normal line spacing.
3813*36ac495dSmrg%
3814*36ac495dSmrg\newskip\multitableparskip
3815*36ac495dSmrg\newskip\multitableparindent
3816*36ac495dSmrg\newdimen\multitablecolspace
3817*36ac495dSmrg\newskip\multitablelinespace
3818*36ac495dSmrg\multitableparskip=0pt
3819*36ac495dSmrg\multitableparindent=6pt
3820*36ac495dSmrg\multitablecolspace=12pt
3821*36ac495dSmrg\multitablelinespace=0pt
3822*36ac495dSmrg
3823*36ac495dSmrg% Macros used to set up halign preamble:
3824*36ac495dSmrg%
3825*36ac495dSmrg\let\endsetuptable\relax
3826*36ac495dSmrg\def\xendsetuptable{\endsetuptable}
3827*36ac495dSmrg\let\columnfractions\relax
3828*36ac495dSmrg\def\xcolumnfractions{\columnfractions}
3829*36ac495dSmrg\newif\ifsetpercent
3830*36ac495dSmrg
3831*36ac495dSmrg% #1 is the @columnfraction, usually a decimal number like .5, but might
3832*36ac495dSmrg% be just 1.  We just use it, whatever it is.
3833*36ac495dSmrg%
3834*36ac495dSmrg\def\pickupwholefraction#1 {%
3835*36ac495dSmrg  \global\advance\colcount by 1
3836*36ac495dSmrg  \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3837*36ac495dSmrg  \setuptable
3838*36ac495dSmrg}
3839*36ac495dSmrg
3840*36ac495dSmrg\newcount\colcount
3841*36ac495dSmrg\def\setuptable#1{%
3842*36ac495dSmrg  \def\firstarg{#1}%
3843*36ac495dSmrg  \ifx\firstarg\xendsetuptable
3844*36ac495dSmrg    \let\go = \relax
3845*36ac495dSmrg  \else
3846*36ac495dSmrg    \ifx\firstarg\xcolumnfractions
3847*36ac495dSmrg      \global\setpercenttrue
3848*36ac495dSmrg    \else
3849*36ac495dSmrg      \ifsetpercent
3850*36ac495dSmrg         \let\go\pickupwholefraction
3851*36ac495dSmrg      \else
3852*36ac495dSmrg         \global\advance\colcount by 1
3853*36ac495dSmrg         \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3854*36ac495dSmrg                   % separator; typically that is always in the input, anyway.
3855*36ac495dSmrg         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3856*36ac495dSmrg      \fi
3857*36ac495dSmrg    \fi
3858*36ac495dSmrg    \ifx\go\pickupwholefraction
3859*36ac495dSmrg      % Put the argument back for the \pickupwholefraction call, so
3860*36ac495dSmrg      % we'll always have a period there to be parsed.
3861*36ac495dSmrg      \def\go{\pickupwholefraction#1}%
3862*36ac495dSmrg    \else
3863*36ac495dSmrg      \let\go = \setuptable
3864*36ac495dSmrg    \fi%
3865*36ac495dSmrg  \fi
3866*36ac495dSmrg  \go
3867*36ac495dSmrg}
3868*36ac495dSmrg
3869*36ac495dSmrg% multitable-only commands.
3870*36ac495dSmrg%
3871*36ac495dSmrg% @headitem starts a heading row, which we typeset in bold.
3872*36ac495dSmrg% Assignments have to be global since we are inside the implicit group
3873*36ac495dSmrg% of an alignment entry.  \everycr resets \everytab so we don't have to
3874*36ac495dSmrg% undo it ourselves.
3875*36ac495dSmrg\def\headitemfont{\b}% for people to use in the template row; not changeable
3876*36ac495dSmrg\def\headitem{%
3877*36ac495dSmrg  \checkenv\multitable
3878*36ac495dSmrg  \crcr
3879*36ac495dSmrg  \global\everytab={\bf}% can't use \headitemfont since the parsing differs
3880*36ac495dSmrg  \the\everytab % for the first item
3881*36ac495dSmrg}%
3882*36ac495dSmrg%
3883*36ac495dSmrg% A \tab used to include \hskip1sp.  But then the space in a template
3884*36ac495dSmrg% line is not enough.  That is bad.  So let's go back to just `&' until
3885*36ac495dSmrg% we again encounter the problem the 1sp was intended to solve.
3886*36ac495dSmrg%					--karl, nathan@acm.org, 20apr99.
3887*36ac495dSmrg\def\tab{\checkenv\multitable &\the\everytab}%
3888*36ac495dSmrg
3889*36ac495dSmrg% @multitable ... @end multitable definitions:
3890*36ac495dSmrg%
3891*36ac495dSmrg\newtoks\everytab  % insert after every tab.
3892*36ac495dSmrg%
3893*36ac495dSmrg\envdef\multitable{%
3894*36ac495dSmrg  \vskip\parskip
3895*36ac495dSmrg  \startsavinginserts
3896*36ac495dSmrg  %
3897*36ac495dSmrg  % @item within a multitable starts a normal row.
3898*36ac495dSmrg  % We use \def instead of \let so that if one of the multitable entries
3899*36ac495dSmrg  % contains an @itemize, we don't choke on the \item (seen as \crcr aka
3900*36ac495dSmrg  % \endtemplate) expanding \doitemize.
3901*36ac495dSmrg  \def\item{\crcr}%
3902*36ac495dSmrg  %
3903*36ac495dSmrg  \tolerance=9500
3904*36ac495dSmrg  \hbadness=9500
3905*36ac495dSmrg  \setmultitablespacing
3906*36ac495dSmrg  \parskip=\multitableparskip
3907*36ac495dSmrg  \parindent=\multitableparindent
3908*36ac495dSmrg  \overfullrule=0pt
3909*36ac495dSmrg  \global\colcount=0
3910*36ac495dSmrg  %
3911*36ac495dSmrg  \everycr = {%
3912*36ac495dSmrg    \noalign{%
3913*36ac495dSmrg      \global\everytab={}%
3914*36ac495dSmrg      \global\colcount=0 % Reset the column counter.
3915*36ac495dSmrg      % Check for saved footnotes, etc.
3916*36ac495dSmrg      \checkinserts
3917*36ac495dSmrg      % Keeps underfull box messages off when table breaks over pages.
3918*36ac495dSmrg      %\filbreak
3919*36ac495dSmrg	% Maybe so, but it also creates really weird page breaks when the
3920*36ac495dSmrg	% table breaks over pages. Wouldn't \vfil be better?  Wait until the
3921*36ac495dSmrg	% problem manifests itself, so it can be fixed for real --karl.
3922*36ac495dSmrg    }%
3923*36ac495dSmrg  }%
3924*36ac495dSmrg  %
3925*36ac495dSmrg  \parsearg\domultitable
3926*36ac495dSmrg}
3927*36ac495dSmrg\def\domultitable#1{%
3928*36ac495dSmrg  % To parse everything between @multitable and @item:
3929*36ac495dSmrg  \setuptable#1 \endsetuptable
3930*36ac495dSmrg  %
3931*36ac495dSmrg  % This preamble sets up a generic column definition, which will
3932*36ac495dSmrg  % be used as many times as user calls for columns.
3933*36ac495dSmrg  % \vtop will set a single line and will also let text wrap and
3934*36ac495dSmrg  % continue for many paragraphs if desired.
3935*36ac495dSmrg  \halign\bgroup &%
3936*36ac495dSmrg    \global\advance\colcount by 1
3937*36ac495dSmrg    \multistrut
3938*36ac495dSmrg    \vtop{%
3939*36ac495dSmrg      % Use the current \colcount to find the correct column width:
3940*36ac495dSmrg      \hsize=\expandafter\csname col\the\colcount\endcsname
3941*36ac495dSmrg      %
3942*36ac495dSmrg      % In order to keep entries from bumping into each other
3943*36ac495dSmrg      % we will add a \leftskip of \multitablecolspace to all columns after
3944*36ac495dSmrg      % the first one.
3945*36ac495dSmrg      %
3946*36ac495dSmrg      % If a template has been used, we will add \multitablecolspace
3947*36ac495dSmrg      % to the width of each template entry.
3948*36ac495dSmrg      %
3949*36ac495dSmrg      % If the user has set preamble in terms of percent of \hsize we will
3950*36ac495dSmrg      % use that dimension as the width of the column, and the \leftskip
3951*36ac495dSmrg      % will keep entries from bumping into each other.  Table will start at
3952*36ac495dSmrg      % left margin and final column will justify at right margin.
3953*36ac495dSmrg      %
3954*36ac495dSmrg      % Make sure we don't inherit \rightskip from the outer environment.
3955*36ac495dSmrg      \rightskip=0pt
3956*36ac495dSmrg      \ifnum\colcount=1
3957*36ac495dSmrg	% The first column will be indented with the surrounding text.
3958*36ac495dSmrg	\advance\hsize by\leftskip
3959*36ac495dSmrg      \else
3960*36ac495dSmrg	\ifsetpercent \else
3961*36ac495dSmrg	  % If user has not set preamble in terms of percent of \hsize
3962*36ac495dSmrg	  % we will advance \hsize by \multitablecolspace.
3963*36ac495dSmrg	  \advance\hsize by \multitablecolspace
3964*36ac495dSmrg	\fi
3965*36ac495dSmrg       % In either case we will make \leftskip=\multitablecolspace:
3966*36ac495dSmrg      \leftskip=\multitablecolspace
3967*36ac495dSmrg      \fi
3968*36ac495dSmrg      % Ignoring space at the beginning and end avoids an occasional spurious
3969*36ac495dSmrg      % blank line, when TeX decides to break the line at the space before the
3970*36ac495dSmrg      % box from the multistrut, so the strut ends up on a line by itself.
3971*36ac495dSmrg      % For example:
3972*36ac495dSmrg      % @multitable @columnfractions .11 .89
3973*36ac495dSmrg      % @item @code{#}
3974*36ac495dSmrg      % @tab Legal holiday which is valid in major parts of the whole country.
3975*36ac495dSmrg      % Is automatically provided with highlighting sequences respectively
3976*36ac495dSmrg      % marking characters.
3977*36ac495dSmrg      \noindent\ignorespaces##\unskip\multistrut
3978*36ac495dSmrg    }\cr
3979*36ac495dSmrg}
3980*36ac495dSmrg\def\Emultitable{%
3981*36ac495dSmrg  \crcr
3982*36ac495dSmrg  \egroup % end the \halign
3983*36ac495dSmrg  \global\setpercentfalse
3984*36ac495dSmrg}
3985*36ac495dSmrg
3986*36ac495dSmrg\def\setmultitablespacing{%
3987*36ac495dSmrg  \def\multistrut{\strut}% just use the standard line spacing
3988*36ac495dSmrg  %
3989*36ac495dSmrg  % Compute \multitablelinespace (if not defined by user) for use in
3990*36ac495dSmrg  % \multitableparskip calculation.  We used define \multistrut based on
3991*36ac495dSmrg  % this, but (ironically) that caused the spacing to be off.
3992*36ac495dSmrg  % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
3993*36ac495dSmrg\ifdim\multitablelinespace=0pt
3994*36ac495dSmrg\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
3995*36ac495dSmrg\global\advance\multitablelinespace by-\ht0
3996*36ac495dSmrg\fi
3997*36ac495dSmrg% Test to see if parskip is larger than space between lines of
3998*36ac495dSmrg% table. If not, do nothing.
3999*36ac495dSmrg%        If so, set to same dimension as multitablelinespace.
4000*36ac495dSmrg\ifdim\multitableparskip>\multitablelinespace
4001*36ac495dSmrg\global\multitableparskip=\multitablelinespace
4002*36ac495dSmrg\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4003*36ac495dSmrg                                      % than skip between lines in the table.
4004*36ac495dSmrg\fi%
4005*36ac495dSmrg\ifdim\multitableparskip=0pt
4006*36ac495dSmrg\global\multitableparskip=\multitablelinespace
4007*36ac495dSmrg\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4008*36ac495dSmrg                                      % than skip between lines in the table.
4009*36ac495dSmrg\fi}
4010*36ac495dSmrg
4011*36ac495dSmrg
4012*36ac495dSmrg\message{conditionals,}
4013*36ac495dSmrg
4014*36ac495dSmrg% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4015*36ac495dSmrg% @ifnotxml always succeed.  They currently do nothing; we don't
4016*36ac495dSmrg% attempt to check whether the conditionals are properly nested.  But we
4017*36ac495dSmrg% have to remember that they are conditionals, so that @end doesn't
4018*36ac495dSmrg% attempt to close an environment group.
4019*36ac495dSmrg%
4020*36ac495dSmrg\def\makecond#1{%
4021*36ac495dSmrg  \expandafter\let\csname #1\endcsname = \relax
4022*36ac495dSmrg  \expandafter\let\csname iscond.#1\endcsname = 1
4023*36ac495dSmrg}
4024*36ac495dSmrg\makecond{iftex}
4025*36ac495dSmrg\makecond{ifnotdocbook}
4026*36ac495dSmrg\makecond{ifnothtml}
4027*36ac495dSmrg\makecond{ifnotinfo}
4028*36ac495dSmrg\makecond{ifnotplaintext}
4029*36ac495dSmrg\makecond{ifnotxml}
4030*36ac495dSmrg
4031*36ac495dSmrg% Ignore @ignore, @ifhtml, @ifinfo, and the like.
4032*36ac495dSmrg%
4033*36ac495dSmrg\def\direntry{\doignore{direntry}}
4034*36ac495dSmrg\def\documentdescription{\doignore{documentdescription}}
4035*36ac495dSmrg\def\docbook{\doignore{docbook}}
4036*36ac495dSmrg\def\html{\doignore{html}}
4037*36ac495dSmrg\def\ifdocbook{\doignore{ifdocbook}}
4038*36ac495dSmrg\def\ifhtml{\doignore{ifhtml}}
4039*36ac495dSmrg\def\ifinfo{\doignore{ifinfo}}
4040*36ac495dSmrg\def\ifnottex{\doignore{ifnottex}}
4041*36ac495dSmrg\def\ifplaintext{\doignore{ifplaintext}}
4042*36ac495dSmrg\def\ifxml{\doignore{ifxml}}
4043*36ac495dSmrg\def\ignore{\doignore{ignore}}
4044*36ac495dSmrg\def\menu{\doignore{menu}}
4045*36ac495dSmrg\def\xml{\doignore{xml}}
4046*36ac495dSmrg
4047*36ac495dSmrg% Ignore text until a line `@end #1', keeping track of nested conditionals.
4048*36ac495dSmrg%
4049*36ac495dSmrg% A count to remember the depth of nesting.
4050*36ac495dSmrg\newcount\doignorecount
4051*36ac495dSmrg
4052*36ac495dSmrg\def\doignore#1{\begingroup
4053*36ac495dSmrg  % Scan in ``verbatim'' mode:
4054*36ac495dSmrg  \obeylines
4055*36ac495dSmrg  \catcode`\@ = \other
4056*36ac495dSmrg  \catcode`\{ = \other
4057*36ac495dSmrg  \catcode`\} = \other
4058*36ac495dSmrg  %
4059*36ac495dSmrg  % Make sure that spaces turn into tokens that match what \doignoretext wants.
4060*36ac495dSmrg  \spaceisspace
4061*36ac495dSmrg  %
4062*36ac495dSmrg  % Count number of #1's that we've seen.
4063*36ac495dSmrg  \doignorecount = 0
4064*36ac495dSmrg  %
4065*36ac495dSmrg  % Swallow text until we reach the matching `@end #1'.
4066*36ac495dSmrg  \dodoignore{#1}%
4067*36ac495dSmrg}
4068*36ac495dSmrg
4069*36ac495dSmrg{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4070*36ac495dSmrg  \obeylines %
4071*36ac495dSmrg  %
4072*36ac495dSmrg  \gdef\dodoignore#1{%
4073*36ac495dSmrg    % #1 contains the command name as a string, e.g., `ifinfo'.
4074*36ac495dSmrg    %
4075*36ac495dSmrg    % Define a command to find the next `@end #1'.
4076*36ac495dSmrg    \long\def\doignoretext##1^^M@end #1{%
4077*36ac495dSmrg      \doignoretextyyy##1^^M@#1\_STOP_}%
4078*36ac495dSmrg    %
4079*36ac495dSmrg    % And this command to find another #1 command, at the beginning of a
4080*36ac495dSmrg    % line.  (Otherwise, we would consider a line `@c @ifset', for
4081*36ac495dSmrg    % example, to count as an @ifset for nesting.)
4082*36ac495dSmrg    \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4083*36ac495dSmrg    %
4084*36ac495dSmrg    % And now expand that command.
4085*36ac495dSmrg    \doignoretext ^^M%
4086*36ac495dSmrg  }%
4087*36ac495dSmrg}
4088*36ac495dSmrg
4089*36ac495dSmrg\def\doignoreyyy#1{%
4090*36ac495dSmrg  \def\temp{#1}%
4091*36ac495dSmrg  \ifx\temp\empty			% Nothing found.
4092*36ac495dSmrg    \let\next\doignoretextzzz
4093*36ac495dSmrg  \else					% Found a nested condition, ...
4094*36ac495dSmrg    \advance\doignorecount by 1
4095*36ac495dSmrg    \let\next\doignoretextyyy		% ..., look for another.
4096*36ac495dSmrg    % If we're here, #1 ends with ^^M\ifinfo (for example).
4097*36ac495dSmrg  \fi
4098*36ac495dSmrg  \next #1% the token \_STOP_ is present just after this macro.
4099*36ac495dSmrg}
4100*36ac495dSmrg
4101*36ac495dSmrg% We have to swallow the remaining "\_STOP_".
4102*36ac495dSmrg%
4103*36ac495dSmrg\def\doignoretextzzz#1{%
4104*36ac495dSmrg  \ifnum\doignorecount = 0	% We have just found the outermost @end.
4105*36ac495dSmrg    \let\next\enddoignore
4106*36ac495dSmrg  \else				% Still inside a nested condition.
4107*36ac495dSmrg    \advance\doignorecount by -1
4108*36ac495dSmrg    \let\next\doignoretext      % Look for the next @end.
4109*36ac495dSmrg  \fi
4110*36ac495dSmrg  \next
4111*36ac495dSmrg}
4112*36ac495dSmrg
4113*36ac495dSmrg% Finish off ignored text.
4114*36ac495dSmrg{ \obeylines%
4115*36ac495dSmrg  % Ignore anything after the last `@end #1'; this matters in verbatim
4116*36ac495dSmrg  % environments, where otherwise the newline after an ignored conditional
4117*36ac495dSmrg  % would result in a blank line in the output.
4118*36ac495dSmrg  \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4119*36ac495dSmrg}
4120*36ac495dSmrg
4121*36ac495dSmrg
4122*36ac495dSmrg% @set VAR sets the variable VAR to an empty value.
4123*36ac495dSmrg% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4124*36ac495dSmrg%
4125*36ac495dSmrg% Since we want to separate VAR from REST-OF-LINE (which might be
4126*36ac495dSmrg% empty), we can't just use \parsearg; we have to insert a space of our
4127*36ac495dSmrg% own to delimit the rest of the line, and then take it out again if we
4128*36ac495dSmrg% didn't need it.
4129*36ac495dSmrg% We rely on the fact that \parsearg sets \catcode`\ =10.
4130*36ac495dSmrg%
4131*36ac495dSmrg\parseargdef\set{\setyyy#1 \endsetyyy}
4132*36ac495dSmrg\def\setyyy#1 #2\endsetyyy{%
4133*36ac495dSmrg  {%
4134*36ac495dSmrg    \makevalueexpandable
4135*36ac495dSmrg    \def\temp{#2}%
4136*36ac495dSmrg    \edef\next{\gdef\makecsname{SET#1}}%
4137*36ac495dSmrg    \ifx\temp\empty
4138*36ac495dSmrg      \next{}%
4139*36ac495dSmrg    \else
4140*36ac495dSmrg      \setzzz#2\endsetzzz
4141*36ac495dSmrg    \fi
4142*36ac495dSmrg  }%
4143*36ac495dSmrg}
4144*36ac495dSmrg% Remove the trailing space \setxxx inserted.
4145*36ac495dSmrg\def\setzzz#1 \endsetzzz{\next{#1}}
4146*36ac495dSmrg
4147*36ac495dSmrg% @clear VAR clears (i.e., unsets) the variable VAR.
4148*36ac495dSmrg%
4149*36ac495dSmrg\parseargdef\clear{%
4150*36ac495dSmrg  {%
4151*36ac495dSmrg    \makevalueexpandable
4152*36ac495dSmrg    \global\expandafter\let\csname SET#1\endcsname=\relax
4153*36ac495dSmrg  }%
4154*36ac495dSmrg}
4155*36ac495dSmrg
4156*36ac495dSmrg% @value{foo} gets the text saved in variable foo.
4157*36ac495dSmrg\def\value{\begingroup\makevalueexpandable\valuexxx}
4158*36ac495dSmrg\def\valuexxx#1{\expandablevalue{#1}\endgroup}
4159*36ac495dSmrg{
4160*36ac495dSmrg  \catcode`\- = \active \catcode`\_ = \active
4161*36ac495dSmrg  %
4162*36ac495dSmrg  \gdef\makevalueexpandable{%
4163*36ac495dSmrg    \let\value = \expandablevalue
4164*36ac495dSmrg    % We don't want these characters active, ...
4165*36ac495dSmrg    \catcode`\-=\other \catcode`\_=\other
4166*36ac495dSmrg    % ..., but we might end up with active ones in the argument if
4167*36ac495dSmrg    % we're called from @code, as @code{@value{foo-bar_}}, though.
4168*36ac495dSmrg    % So \let them to their normal equivalents.
4169*36ac495dSmrg    \let-\realdash \let_\normalunderscore
4170*36ac495dSmrg  }
4171*36ac495dSmrg}
4172*36ac495dSmrg
4173*36ac495dSmrg% We have this subroutine so that we can handle at least some @value's
4174*36ac495dSmrg% properly in indexes (we call \makevalueexpandable in \indexdummies).
4175*36ac495dSmrg% The command has to be fully expandable (if the variable is set), since
4176*36ac495dSmrg% the result winds up in the index file.  This means that if the
4177*36ac495dSmrg% variable's value contains other Texinfo commands, it's almost certain
4178*36ac495dSmrg% it will fail (although perhaps we could fix that with sufficient work
4179*36ac495dSmrg% to do a one-level expansion on the result, instead of complete).
4180*36ac495dSmrg%
4181*36ac495dSmrg\def\expandablevalue#1{%
4182*36ac495dSmrg  \expandafter\ifx\csname SET#1\endcsname\relax
4183*36ac495dSmrg    {[No value for ``#1'']}%
4184*36ac495dSmrg    \message{Variable `#1', used in @value, is not set.}%
4185*36ac495dSmrg  \else
4186*36ac495dSmrg    \csname SET#1\endcsname
4187*36ac495dSmrg  \fi
4188*36ac495dSmrg}
4189*36ac495dSmrg
4190*36ac495dSmrg% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4191*36ac495dSmrg% with @set.
4192*36ac495dSmrg%
4193*36ac495dSmrg% To get special treatment of `@end ifset,' call \makeond and the redefine.
4194*36ac495dSmrg%
4195*36ac495dSmrg\makecond{ifset}
4196*36ac495dSmrg\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4197*36ac495dSmrg\def\doifset#1#2{%
4198*36ac495dSmrg  {%
4199*36ac495dSmrg    \makevalueexpandable
4200*36ac495dSmrg    \let\next=\empty
4201*36ac495dSmrg    \expandafter\ifx\csname SET#2\endcsname\relax
4202*36ac495dSmrg      #1% If not set, redefine \next.
4203*36ac495dSmrg    \fi
4204*36ac495dSmrg    \expandafter
4205*36ac495dSmrg  }\next
4206*36ac495dSmrg}
4207*36ac495dSmrg\def\ifsetfail{\doignore{ifset}}
4208*36ac495dSmrg
4209*36ac495dSmrg% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
4210*36ac495dSmrg% defined with @set, or has been undefined with @clear.
4211*36ac495dSmrg%
4212*36ac495dSmrg% The `\else' inside the `\doifset' parameter is a trick to reuse the
4213*36ac495dSmrg% above code: if the variable is not set, do nothing, if it is set,
4214*36ac495dSmrg% then redefine \next to \ifclearfail.
4215*36ac495dSmrg%
4216*36ac495dSmrg\makecond{ifclear}
4217*36ac495dSmrg\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4218*36ac495dSmrg\def\ifclearfail{\doignore{ifclear}}
4219*36ac495dSmrg
4220*36ac495dSmrg% @dircategory CATEGORY  -- specify a category of the dir file
4221*36ac495dSmrg% which this file should belong to.  Ignore this in TeX.
4222*36ac495dSmrg\let\dircategory=\comment
4223*36ac495dSmrg
4224*36ac495dSmrg% @defininfoenclose.
4225*36ac495dSmrg\let\definfoenclose=\comment
4226*36ac495dSmrg
4227*36ac495dSmrg
4228*36ac495dSmrg\message{indexing,}
4229*36ac495dSmrg% Index generation facilities
4230*36ac495dSmrg
4231*36ac495dSmrg% Define \newwrite to be identical to plain tex's \newwrite
4232*36ac495dSmrg% except not \outer, so it can be used within macros and \if's.
4233*36ac495dSmrg\edef\newwrite{\makecsname{ptexnewwrite}}
4234*36ac495dSmrg
4235*36ac495dSmrg% \newindex {foo} defines an index named foo.
4236*36ac495dSmrg% It automatically defines \fooindex such that
4237*36ac495dSmrg% \fooindex ...rest of line... puts an entry in the index foo.
4238*36ac495dSmrg% It also defines \fooindfile to be the number of the output channel for
4239*36ac495dSmrg% the file that accumulates this index.  The file's extension is foo.
4240*36ac495dSmrg% The name of an index should be no more than 2 characters long
4241*36ac495dSmrg% for the sake of vms.
4242*36ac495dSmrg%
4243*36ac495dSmrg\def\newindex#1{%
4244*36ac495dSmrg  \iflinks
4245*36ac495dSmrg    \expandafter\newwrite \csname#1indfile\endcsname
4246*36ac495dSmrg    \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
4247*36ac495dSmrg  \fi
4248*36ac495dSmrg  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
4249*36ac495dSmrg    \noexpand\doindex{#1}}
4250*36ac495dSmrg}
4251*36ac495dSmrg
4252*36ac495dSmrg% @defindex foo  ==  \newindex{foo}
4253*36ac495dSmrg%
4254*36ac495dSmrg\def\defindex{\parsearg\newindex}
4255*36ac495dSmrg
4256*36ac495dSmrg% Define @defcodeindex, like @defindex except put all entries in @code.
4257*36ac495dSmrg%
4258*36ac495dSmrg\def\defcodeindex{\parsearg\newcodeindex}
4259*36ac495dSmrg%
4260*36ac495dSmrg\def\newcodeindex#1{%
4261*36ac495dSmrg  \iflinks
4262*36ac495dSmrg    \expandafter\newwrite \csname#1indfile\endcsname
4263*36ac495dSmrg    \openout \csname#1indfile\endcsname \jobname.#1
4264*36ac495dSmrg  \fi
4265*36ac495dSmrg  \expandafter\xdef\csname#1index\endcsname{%
4266*36ac495dSmrg    \noexpand\docodeindex{#1}}%
4267*36ac495dSmrg}
4268*36ac495dSmrg
4269*36ac495dSmrg
4270*36ac495dSmrg% @synindex foo bar    makes index foo feed into index bar.
4271*36ac495dSmrg% Do this instead of @defindex foo if you don't want it as a separate index.
4272*36ac495dSmrg%
4273*36ac495dSmrg% @syncodeindex foo bar   similar, but put all entries made for index foo
4274*36ac495dSmrg% inside @code.
4275*36ac495dSmrg%
4276*36ac495dSmrg\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4277*36ac495dSmrg\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4278*36ac495dSmrg
4279*36ac495dSmrg% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4280*36ac495dSmrg% #3 the target index (bar).
4281*36ac495dSmrg\def\dosynindex#1#2#3{%
4282*36ac495dSmrg  % Only do \closeout if we haven't already done it, else we'll end up
4283*36ac495dSmrg  % closing the target index.
4284*36ac495dSmrg  \expandafter \ifx\csname donesynindex#2\endcsname \relax
4285*36ac495dSmrg    % The \closeout helps reduce unnecessary open files; the limit on the
4286*36ac495dSmrg    % Acorn RISC OS is a mere 16 files.
4287*36ac495dSmrg    \expandafter\closeout\csname#2indfile\endcsname
4288*36ac495dSmrg    \expandafter\let\csname donesynindex#2\endcsname = 1
4289*36ac495dSmrg  \fi
4290*36ac495dSmrg  % redefine \fooindfile:
4291*36ac495dSmrg  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4292*36ac495dSmrg  \expandafter\let\csname#2indfile\endcsname=\temp
4293*36ac495dSmrg  % redefine \fooindex:
4294*36ac495dSmrg  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4295*36ac495dSmrg}
4296*36ac495dSmrg
4297*36ac495dSmrg% Define \doindex, the driver for all \fooindex macros.
4298*36ac495dSmrg% Argument #1 is generated by the calling \fooindex macro,
4299*36ac495dSmrg%  and it is "foo", the name of the index.
4300*36ac495dSmrg
4301*36ac495dSmrg% \doindex just uses \parsearg; it calls \doind for the actual work.
4302*36ac495dSmrg% This is because \doind is more useful to call from other macros.
4303*36ac495dSmrg
4304*36ac495dSmrg% There is also \dosubind {index}{topic}{subtopic}
4305*36ac495dSmrg% which makes an entry in a two-level index such as the operation index.
4306*36ac495dSmrg
4307*36ac495dSmrg\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
4308*36ac495dSmrg\def\singleindexer #1{\doind{\indexname}{#1}}
4309*36ac495dSmrg
4310*36ac495dSmrg% like the previous two, but they put @code around the argument.
4311*36ac495dSmrg\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
4312*36ac495dSmrg\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
4313*36ac495dSmrg
4314*36ac495dSmrg% Take care of Texinfo commands that can appear in an index entry.
4315*36ac495dSmrg% Since there are some commands we want to expand, and others we don't,
4316*36ac495dSmrg% we have to laboriously prevent expansion for those that we don't.
4317*36ac495dSmrg%
4318*36ac495dSmrg\def\indexdummies{%
4319*36ac495dSmrg  \escapechar = `\\     % use backslash in output files.
4320*36ac495dSmrg  \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4321*36ac495dSmrg  \def\ {\realbackslash\space }%
4322*36ac495dSmrg  %
4323*36ac495dSmrg  % Need these unexpandable (because we define \tt as a dummy)
4324*36ac495dSmrg  % definitions when @{ or @} appear in index entry text.  Also, more
4325*36ac495dSmrg  % complicated, when \tex is in effect and \{ is a \delimiter again.
4326*36ac495dSmrg  % We can't use \lbracecmd and \rbracecmd because texindex assumes
4327*36ac495dSmrg  % braces and backslashes are used only as delimiters.  Perhaps we
4328*36ac495dSmrg  % should define @lbrace and @rbrace commands a la @comma.
4329*36ac495dSmrg  \def\{{{\tt\char123}}%
4330*36ac495dSmrg  \def\}{{\tt\char125}}%
4331*36ac495dSmrg  %
4332*36ac495dSmrg  % I don't entirely understand this, but when an index entry is
4333*36ac495dSmrg  % generated from a macro call, the \endinput which \scanmacro inserts
4334*36ac495dSmrg  % causes processing to be prematurely terminated.  This is,
4335*36ac495dSmrg  % apparently, because \indexsorttmp is fully expanded, and \endinput
4336*36ac495dSmrg  % is an expandable command.  The redefinition below makes \endinput
4337*36ac495dSmrg  % disappear altogether for that purpose -- although logging shows that
4338*36ac495dSmrg  % processing continues to some further point.  On the other hand, it
4339*36ac495dSmrg  % seems \endinput does not hurt in the printed index arg, since that
4340*36ac495dSmrg  % is still getting written without apparent harm.
4341*36ac495dSmrg  %
4342*36ac495dSmrg  % Sample source (mac-idx3.tex, reported by Graham Percival to
4343*36ac495dSmrg  % help-texinfo, 22may06):
4344*36ac495dSmrg  % @macro funindex {WORD}
4345*36ac495dSmrg  % @findex xyz
4346*36ac495dSmrg  % @end macro
4347*36ac495dSmrg  % ...
4348*36ac495dSmrg  % @funindex commtest
4349*36ac495dSmrg  %
4350*36ac495dSmrg  % The above is not enough to reproduce the bug, but it gives the flavor.
4351*36ac495dSmrg  %
4352*36ac495dSmrg  % Sample whatsit resulting:
4353*36ac495dSmrg  % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
4354*36ac495dSmrg  %
4355*36ac495dSmrg  % So:
4356*36ac495dSmrg  \let\endinput = \empty
4357*36ac495dSmrg  %
4358*36ac495dSmrg  % Do the redefinitions.
4359*36ac495dSmrg  \commondummies
4360*36ac495dSmrg}
4361*36ac495dSmrg
4362*36ac495dSmrg% For the aux and toc files, @ is the escape character.  So we want to
4363*36ac495dSmrg% redefine everything using @ as the escape character (instead of
4364*36ac495dSmrg% \realbackslash, still used for index files).  When everything uses @,
4365*36ac495dSmrg% this will be simpler.
4366*36ac495dSmrg%
4367*36ac495dSmrg\def\atdummies{%
4368*36ac495dSmrg  \def\@{@@}%
4369*36ac495dSmrg  \def\ {@ }%
4370*36ac495dSmrg  \let\{ = \lbraceatcmd
4371*36ac495dSmrg  \let\} = \rbraceatcmd
4372*36ac495dSmrg  %
4373*36ac495dSmrg  % Do the redefinitions.
4374*36ac495dSmrg  \commondummies
4375*36ac495dSmrg  \otherbackslash
4376*36ac495dSmrg}
4377*36ac495dSmrg
4378*36ac495dSmrg% Called from \indexdummies and \atdummies.
4379*36ac495dSmrg%
4380*36ac495dSmrg\def\commondummies{%
4381*36ac495dSmrg  %
4382*36ac495dSmrg  % \definedummyword defines \#1 as \string\#1\space, thus effectively
4383*36ac495dSmrg  % preventing its expansion.  This is used only for control words,
4384*36ac495dSmrg  % not control letters, because the \space would be incorrect for
4385*36ac495dSmrg  % control characters, but is needed to separate the control word
4386*36ac495dSmrg  % from whatever follows.
4387*36ac495dSmrg  %
4388*36ac495dSmrg  % For control letters, we have \definedummyletter, which omits the
4389*36ac495dSmrg  % space.
4390*36ac495dSmrg  %
4391*36ac495dSmrg  % These can be used both for control words that take an argument and
4392*36ac495dSmrg  % those that do not.  If it is followed by {arg} in the input, then
4393*36ac495dSmrg  % that will dutifully get written to the index (or wherever).
4394*36ac495dSmrg  %
4395*36ac495dSmrg  \def\definedummyword  ##1{\def##1{\string##1\space}}%
4396*36ac495dSmrg  \def\definedummyletter##1{\def##1{\string##1}}%
4397*36ac495dSmrg  \let\definedummyaccent\definedummyletter
4398*36ac495dSmrg  %
4399*36ac495dSmrg  \commondummiesnofonts
4400*36ac495dSmrg  %
4401*36ac495dSmrg  \definedummyletter\_%
4402*36ac495dSmrg  \definedummyletter\-%
4403*36ac495dSmrg  %
4404*36ac495dSmrg  % Non-English letters.
4405*36ac495dSmrg  \definedummyword\AA
4406*36ac495dSmrg  \definedummyword\AE
4407*36ac495dSmrg  \definedummyword\DH
4408*36ac495dSmrg  \definedummyword\L
4409*36ac495dSmrg  \definedummyword\O
4410*36ac495dSmrg  \definedummyword\OE
4411*36ac495dSmrg  \definedummyword\TH
4412*36ac495dSmrg  \definedummyword\aa
4413*36ac495dSmrg  \definedummyword\ae
4414*36ac495dSmrg  \definedummyword\dh
4415*36ac495dSmrg  \definedummyword\exclamdown
4416*36ac495dSmrg  \definedummyword\l
4417*36ac495dSmrg  \definedummyword\o
4418*36ac495dSmrg  \definedummyword\oe
4419*36ac495dSmrg  \definedummyword\ordf
4420*36ac495dSmrg  \definedummyword\ordm
4421*36ac495dSmrg  \definedummyword\questiondown
4422*36ac495dSmrg  \definedummyword\ss
4423*36ac495dSmrg  \definedummyword\th
4424*36ac495dSmrg  %
4425*36ac495dSmrg  % Although these internal commands shouldn't show up, sometimes they do.
4426*36ac495dSmrg  \definedummyword\bf
4427*36ac495dSmrg  \definedummyword\gtr
4428*36ac495dSmrg  \definedummyword\hat
4429*36ac495dSmrg  \definedummyword\less
4430*36ac495dSmrg  \definedummyword\sf
4431*36ac495dSmrg  \definedummyword\sl
4432*36ac495dSmrg  \definedummyword\tclose
4433*36ac495dSmrg  \definedummyword\tt
4434*36ac495dSmrg  %
4435*36ac495dSmrg  \definedummyword\LaTeX
4436*36ac495dSmrg  \definedummyword\TeX
4437*36ac495dSmrg  %
4438*36ac495dSmrg  % Assorted special characters.
4439*36ac495dSmrg  \definedummyword\arrow
4440*36ac495dSmrg  \definedummyword\bullet
4441*36ac495dSmrg  \definedummyword\comma
4442*36ac495dSmrg  \definedummyword\copyright
4443*36ac495dSmrg  \definedummyword\registeredsymbol
4444*36ac495dSmrg  \definedummyword\dots
4445*36ac495dSmrg  \definedummyword\enddots
4446*36ac495dSmrg  \definedummyword\entrybreak
4447*36ac495dSmrg  \definedummyword\equiv
4448*36ac495dSmrg  \definedummyword\error
4449*36ac495dSmrg  \definedummyword\euro
4450*36ac495dSmrg  \definedummyword\expansion
4451*36ac495dSmrg  \definedummyword\geq
4452*36ac495dSmrg  \definedummyword\guillemetleft
4453*36ac495dSmrg  \definedummyword\guillemetright
4454*36ac495dSmrg  \definedummyword\guilsinglleft
4455*36ac495dSmrg  \definedummyword\guilsinglright
4456*36ac495dSmrg  \definedummyword\lbracechar
4457*36ac495dSmrg  \definedummyword\leq
4458*36ac495dSmrg  \definedummyword\minus
4459*36ac495dSmrg  \definedummyword\ogonek
4460*36ac495dSmrg  \definedummyword\pounds
4461*36ac495dSmrg  \definedummyword\point
4462*36ac495dSmrg  \definedummyword\print
4463*36ac495dSmrg  \definedummyword\quotedblbase
4464*36ac495dSmrg  \definedummyword\quotedblleft
4465*36ac495dSmrg  \definedummyword\quotedblright
4466*36ac495dSmrg  \definedummyword\quoteleft
4467*36ac495dSmrg  \definedummyword\quoteright
4468*36ac495dSmrg  \definedummyword\quotesinglbase
4469*36ac495dSmrg  \definedummyword\rbracechar
4470*36ac495dSmrg  \definedummyword\result
4471*36ac495dSmrg  \definedummyword\textdegree
4472*36ac495dSmrg  %
4473*36ac495dSmrg  % We want to disable all macros so that they are not expanded by \write.
4474*36ac495dSmrg  \macrolist
4475*36ac495dSmrg  %
4476*36ac495dSmrg  \normalturnoffactive
4477*36ac495dSmrg  %
4478*36ac495dSmrg  % Handle some cases of @value -- where it does not contain any
4479*36ac495dSmrg  % (non-fully-expandable) commands.
4480*36ac495dSmrg  \makevalueexpandable
4481*36ac495dSmrg}
4482*36ac495dSmrg
4483*36ac495dSmrg% \commondummiesnofonts: common to \commondummies and \indexnofonts.
4484*36ac495dSmrg%
4485*36ac495dSmrg\def\commondummiesnofonts{%
4486*36ac495dSmrg  % Control letters and accents.
4487*36ac495dSmrg  \definedummyletter\!%
4488*36ac495dSmrg  \definedummyaccent\"%
4489*36ac495dSmrg  \definedummyaccent\'%
4490*36ac495dSmrg  \definedummyletter\*%
4491*36ac495dSmrg  \definedummyaccent\,%
4492*36ac495dSmrg  \definedummyletter\.%
4493*36ac495dSmrg  \definedummyletter\/%
4494*36ac495dSmrg  \definedummyletter\:%
4495*36ac495dSmrg  \definedummyaccent\=%
4496*36ac495dSmrg  \definedummyletter\?%
4497*36ac495dSmrg  \definedummyaccent\^%
4498*36ac495dSmrg  \definedummyaccent\`%
4499*36ac495dSmrg  \definedummyaccent\~%
4500*36ac495dSmrg  \definedummyword\u
4501*36ac495dSmrg  \definedummyword\v
4502*36ac495dSmrg  \definedummyword\H
4503*36ac495dSmrg  \definedummyword\dotaccent
4504*36ac495dSmrg  \definedummyword\ogonek
4505*36ac495dSmrg  \definedummyword\ringaccent
4506*36ac495dSmrg  \definedummyword\tieaccent
4507*36ac495dSmrg  \definedummyword\ubaraccent
4508*36ac495dSmrg  \definedummyword\udotaccent
4509*36ac495dSmrg  \definedummyword\dotless
4510*36ac495dSmrg  %
4511*36ac495dSmrg  % Texinfo font commands.
4512*36ac495dSmrg  \definedummyword\b
4513*36ac495dSmrg  \definedummyword\i
4514*36ac495dSmrg  \definedummyword\r
4515*36ac495dSmrg  \definedummyword\sansserif
4516*36ac495dSmrg  \definedummyword\sc
4517*36ac495dSmrg  \definedummyword\slanted
4518*36ac495dSmrg  \definedummyword\t
4519*36ac495dSmrg  %
4520*36ac495dSmrg  % Commands that take arguments.
4521*36ac495dSmrg  \definedummyword\abbr
4522*36ac495dSmrg  \definedummyword\acronym
4523*36ac495dSmrg  \definedummyword\anchor
4524*36ac495dSmrg  \definedummyword\cite
4525*36ac495dSmrg  \definedummyword\code
4526*36ac495dSmrg  \definedummyword\command
4527*36ac495dSmrg  \definedummyword\dfn
4528*36ac495dSmrg  \definedummyword\dmn
4529*36ac495dSmrg  \definedummyword\email
4530*36ac495dSmrg  \definedummyword\emph
4531*36ac495dSmrg  \definedummyword\env
4532*36ac495dSmrg  \definedummyword\file
4533*36ac495dSmrg  \definedummyword\image
4534*36ac495dSmrg  \definedummyword\indicateurl
4535*36ac495dSmrg  \definedummyword\inforef
4536*36ac495dSmrg  \definedummyword\kbd
4537*36ac495dSmrg  \definedummyword\key
4538*36ac495dSmrg  \definedummyword\math
4539*36ac495dSmrg  \definedummyword\option
4540*36ac495dSmrg  \definedummyword\pxref
4541*36ac495dSmrg  \definedummyword\ref
4542*36ac495dSmrg  \definedummyword\samp
4543*36ac495dSmrg  \definedummyword\strong
4544*36ac495dSmrg  \definedummyword\tie
4545*36ac495dSmrg  \definedummyword\uref
4546*36ac495dSmrg  \definedummyword\url
4547*36ac495dSmrg  \definedummyword\var
4548*36ac495dSmrg  \definedummyword\verb
4549*36ac495dSmrg  \definedummyword\w
4550*36ac495dSmrg  \definedummyword\xref
4551*36ac495dSmrg}
4552*36ac495dSmrg
4553*36ac495dSmrg% \indexnofonts is used when outputting the strings to sort the index
4554*36ac495dSmrg% by, and when constructing control sequence names.  It eliminates all
4555*36ac495dSmrg% control sequences and just writes whatever the best ASCII sort string
4556*36ac495dSmrg% would be for a given command (usually its argument).
4557*36ac495dSmrg%
4558*36ac495dSmrg\def\indexnofonts{%
4559*36ac495dSmrg  % Accent commands should become @asis.
4560*36ac495dSmrg  \def\definedummyaccent##1{\let##1\asis}%
4561*36ac495dSmrg  % We can just ignore other control letters.
4562*36ac495dSmrg  \def\definedummyletter##1{\let##1\empty}%
4563*36ac495dSmrg  % All control words become @asis by default; overrides below.
4564*36ac495dSmrg  \let\definedummyword\definedummyaccent
4565*36ac495dSmrg  %
4566*36ac495dSmrg  \commondummiesnofonts
4567*36ac495dSmrg  %
4568*36ac495dSmrg  % Don't no-op \tt, since it isn't a user-level command
4569*36ac495dSmrg  % and is used in the definitions of the active chars like <, >, |, etc.
4570*36ac495dSmrg  % Likewise with the other plain tex font commands.
4571*36ac495dSmrg  %\let\tt=\asis
4572*36ac495dSmrg  %
4573*36ac495dSmrg  \def\ { }%
4574*36ac495dSmrg  \def\@{@}%
4575*36ac495dSmrg  \def\_{\normalunderscore}%
4576*36ac495dSmrg  \def\-{}% @- shouldn't affect sorting
4577*36ac495dSmrg  %
4578*36ac495dSmrg  % Unfortunately, texindex is not prepared to handle braces in the
4579*36ac495dSmrg  % content at all.  So for index sorting, we map @{ and @} to strings
4580*36ac495dSmrg  % starting with |, since that ASCII character is between ASCII { and }.
4581*36ac495dSmrg  \def\{{|a}%
4582*36ac495dSmrg  \def\lbracechar{|a}%
4583*36ac495dSmrg  %
4584*36ac495dSmrg  \def\}{|b}%
4585*36ac495dSmrg  \def\rbracechar{|b}%
4586*36ac495dSmrg  %
4587*36ac495dSmrg  % Non-English letters.
4588*36ac495dSmrg  \def\AA{AA}%
4589*36ac495dSmrg  \def\AE{AE}%
4590*36ac495dSmrg  \def\DH{DZZ}%
4591*36ac495dSmrg  \def\L{L}%
4592*36ac495dSmrg  \def\OE{OE}%
4593*36ac495dSmrg  \def\O{O}%
4594*36ac495dSmrg  \def\TH{ZZZ}%
4595*36ac495dSmrg  \def\aa{aa}%
4596*36ac495dSmrg  \def\ae{ae}%
4597*36ac495dSmrg  \def\dh{dzz}%
4598*36ac495dSmrg  \def\exclamdown{!}%
4599*36ac495dSmrg  \def\l{l}%
4600*36ac495dSmrg  \def\oe{oe}%
4601*36ac495dSmrg  \def\ordf{a}%
4602*36ac495dSmrg  \def\ordm{o}%
4603*36ac495dSmrg  \def\o{o}%
4604*36ac495dSmrg  \def\questiondown{?}%
4605*36ac495dSmrg  \def\ss{ss}%
4606*36ac495dSmrg  \def\th{zzz}%
4607*36ac495dSmrg  %
4608*36ac495dSmrg  \def\LaTeX{LaTeX}%
4609*36ac495dSmrg  \def\TeX{TeX}%
4610*36ac495dSmrg  %
4611*36ac495dSmrg  % Assorted special characters.
4612*36ac495dSmrg  % (The following {} will end up in the sort string, but that's ok.)
4613*36ac495dSmrg  \def\arrow{->}%
4614*36ac495dSmrg  \def\bullet{bullet}%
4615*36ac495dSmrg  \def\comma{,}%
4616*36ac495dSmrg  \def\copyright{copyright}%
4617*36ac495dSmrg  \def\dots{...}%
4618*36ac495dSmrg  \def\enddots{...}%
4619*36ac495dSmrg  \def\equiv{==}%
4620*36ac495dSmrg  \def\error{error}%
4621*36ac495dSmrg  \def\euro{euro}%
4622*36ac495dSmrg  \def\expansion{==>}%
4623*36ac495dSmrg  \def\geq{>=}%
4624*36ac495dSmrg  \def\guillemetleft{<<}%
4625*36ac495dSmrg  \def\guillemetright{>>}%
4626*36ac495dSmrg  \def\guilsinglleft{<}%
4627*36ac495dSmrg  \def\guilsinglright{>}%
4628*36ac495dSmrg  \def\leq{<=}%
4629*36ac495dSmrg  \def\minus{-}%
4630*36ac495dSmrg  \def\point{.}%
4631*36ac495dSmrg  \def\pounds{pounds}%
4632*36ac495dSmrg  \def\print{-|}%
4633*36ac495dSmrg  \def\quotedblbase{"}%
4634*36ac495dSmrg  \def\quotedblleft{"}%
4635*36ac495dSmrg  \def\quotedblright{"}%
4636*36ac495dSmrg  \def\quoteleft{`}%
4637*36ac495dSmrg  \def\quoteright{'}%
4638*36ac495dSmrg  \def\quotesinglbase{,}%
4639*36ac495dSmrg  \def\registeredsymbol{R}%
4640*36ac495dSmrg  \def\result{=>}%
4641*36ac495dSmrg  \def\textdegree{o}%
4642*36ac495dSmrg  %
4643*36ac495dSmrg  \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
4644*36ac495dSmrg  \else \indexlquoteignore \fi
4645*36ac495dSmrg  %
4646*36ac495dSmrg  % We need to get rid of all macros, leaving only the arguments (if present).
4647*36ac495dSmrg  % Of course this is not nearly correct, but it is the best we can do for now.
4648*36ac495dSmrg  % makeinfo does not expand macros in the argument to @deffn, which ends up
4649*36ac495dSmrg  % writing an index entry, and texindex isn't prepared for an index sort entry
4650*36ac495dSmrg  % that starts with \.
4651*36ac495dSmrg  %
4652*36ac495dSmrg  % Since macro invocations are followed by braces, we can just redefine them
4653*36ac495dSmrg  % to take a single TeX argument.  The case of a macro invocation that
4654*36ac495dSmrg  % goes to end-of-line is not handled.
4655*36ac495dSmrg  %
4656*36ac495dSmrg  \macrolist
4657*36ac495dSmrg}
4658*36ac495dSmrg
4659*36ac495dSmrg% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
4660*36ac495dSmrg% ignore left quotes in the sort term.
4661*36ac495dSmrg{\catcode`\`=\active
4662*36ac495dSmrg \gdef\indexlquoteignore{\let`=\empty}}
4663*36ac495dSmrg
4664*36ac495dSmrg\let\indexbackslash=0  %overridden during \printindex.
4665*36ac495dSmrg\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4666*36ac495dSmrg
4667*36ac495dSmrg% Most index entries go through here, but \dosubind is the general case.
4668*36ac495dSmrg% #1 is the index name, #2 is the entry text.
4669*36ac495dSmrg\def\doind#1#2{\dosubind{#1}{#2}{}}
4670*36ac495dSmrg
4671*36ac495dSmrg% Workhorse for all \fooindexes.
4672*36ac495dSmrg% #1 is name of index, #2 is stuff to put there, #3 is subentry --
4673*36ac495dSmrg% empty if called from \doind, as we usually are (the main exception
4674*36ac495dSmrg% is with most defuns, which call us directly).
4675*36ac495dSmrg%
4676*36ac495dSmrg\def\dosubind#1#2#3{%
4677*36ac495dSmrg  \iflinks
4678*36ac495dSmrg  {%
4679*36ac495dSmrg    % Store the main index entry text (including the third arg).
4680*36ac495dSmrg    \toks0 = {#2}%
4681*36ac495dSmrg    % If third arg is present, precede it with a space.
4682*36ac495dSmrg    \def\thirdarg{#3}%
4683*36ac495dSmrg    \ifx\thirdarg\empty \else
4684*36ac495dSmrg      \toks0 = \expandafter{\the\toks0 \space #3}%
4685*36ac495dSmrg    \fi
4686*36ac495dSmrg    %
4687*36ac495dSmrg    \edef\writeto{\csname#1indfile\endcsname}%
4688*36ac495dSmrg    %
4689*36ac495dSmrg    \safewhatsit\dosubindwrite
4690*36ac495dSmrg  }%
4691*36ac495dSmrg  \fi
4692*36ac495dSmrg}
4693*36ac495dSmrg
4694*36ac495dSmrg% Write the entry in \toks0 to the index file:
4695*36ac495dSmrg%
4696*36ac495dSmrg\def\dosubindwrite{%
4697*36ac495dSmrg  % Put the index entry in the margin if desired.
4698*36ac495dSmrg  \ifx\SETmarginindex\relax\else
4699*36ac495dSmrg    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
4700*36ac495dSmrg  \fi
4701*36ac495dSmrg  %
4702*36ac495dSmrg  % Remember, we are within a group.
4703*36ac495dSmrg  \indexdummies % Must do this here, since \bf, etc expand at this stage
4704*36ac495dSmrg  \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
4705*36ac495dSmrg      % so it will be output as is; and it will print as backslash.
4706*36ac495dSmrg  %
4707*36ac495dSmrg  % Process the index entry with all font commands turned off, to
4708*36ac495dSmrg  % get the string to sort by.
4709*36ac495dSmrg  {\indexnofonts
4710*36ac495dSmrg   \edef\temp{\the\toks0}% need full expansion
4711*36ac495dSmrg   \xdef\indexsorttmp{\temp}%
4712*36ac495dSmrg  }%
4713*36ac495dSmrg  %
4714*36ac495dSmrg  % Set up the complete index entry, with both the sort key and
4715*36ac495dSmrg  % the original text, including any font commands.  We write
4716*36ac495dSmrg  % three arguments to \entry to the .?? file (four in the
4717*36ac495dSmrg  % subentry case), texindex reduces to two when writing the .??s
4718*36ac495dSmrg  % sorted result.
4719*36ac495dSmrg  \edef\temp{%
4720*36ac495dSmrg    \write\writeto{%
4721*36ac495dSmrg      \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
4722*36ac495dSmrg  }%
4723*36ac495dSmrg  \temp
4724*36ac495dSmrg}
4725*36ac495dSmrg
4726*36ac495dSmrg% Take care of unwanted page breaks/skips around a whatsit:
4727*36ac495dSmrg%
4728*36ac495dSmrg% If a skip is the last thing on the list now, preserve it
4729*36ac495dSmrg% by backing up by \lastskip, doing the \write, then inserting
4730*36ac495dSmrg% the skip again.  Otherwise, the whatsit generated by the
4731*36ac495dSmrg% \write or \pdfdest will make \lastskip zero.  The result is that
4732*36ac495dSmrg% sequences like this:
4733*36ac495dSmrg% @end defun
4734*36ac495dSmrg% @tindex whatever
4735*36ac495dSmrg% @defun ...
4736*36ac495dSmrg% will have extra space inserted, because the \medbreak in the
4737*36ac495dSmrg% start of the @defun won't see the skip inserted by the @end of
4738*36ac495dSmrg% the previous defun.
4739*36ac495dSmrg%
4740*36ac495dSmrg% But don't do any of this if we're not in vertical mode.  We
4741*36ac495dSmrg% don't want to do a \vskip and prematurely end a paragraph.
4742*36ac495dSmrg%
4743*36ac495dSmrg% Avoid page breaks due to these extra skips, too.
4744*36ac495dSmrg%
4745*36ac495dSmrg% But wait, there is a catch there:
4746*36ac495dSmrg% We'll have to check whether \lastskip is zero skip.  \ifdim is not
4747*36ac495dSmrg% sufficient for this purpose, as it ignores stretch and shrink parts
4748*36ac495dSmrg% of the skip.  The only way seems to be to check the textual
4749*36ac495dSmrg% representation of the skip.
4750*36ac495dSmrg%
4751*36ac495dSmrg% The following is almost like \def\zeroskipmacro{0.0pt} except that
4752*36ac495dSmrg% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
4753*36ac495dSmrg%
4754*36ac495dSmrg\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
4755*36ac495dSmrg%
4756*36ac495dSmrg\newskip\whatsitskip
4757*36ac495dSmrg\newcount\whatsitpenalty
4758*36ac495dSmrg%
4759*36ac495dSmrg% ..., ready, GO:
4760*36ac495dSmrg%
4761*36ac495dSmrg\def\safewhatsit#1{\ifhmode
4762*36ac495dSmrg  #1%
4763*36ac495dSmrg \else
4764*36ac495dSmrg  % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
4765*36ac495dSmrg  \whatsitskip = \lastskip
4766*36ac495dSmrg  \edef\lastskipmacro{\the\lastskip}%
4767*36ac495dSmrg  \whatsitpenalty = \lastpenalty
4768*36ac495dSmrg  %
4769*36ac495dSmrg  % If \lastskip is nonzero, that means the last item was a
4770*36ac495dSmrg  % skip.  And since a skip is discardable, that means this
4771*36ac495dSmrg  % -\whatsitskip glue we're inserting is preceded by a
4772*36ac495dSmrg  % non-discardable item, therefore it is not a potential
4773*36ac495dSmrg  % breakpoint, therefore no \nobreak needed.
4774*36ac495dSmrg  \ifx\lastskipmacro\zeroskipmacro
4775*36ac495dSmrg  \else
4776*36ac495dSmrg    \vskip-\whatsitskip
4777*36ac495dSmrg  \fi
4778*36ac495dSmrg  %
4779*36ac495dSmrg  #1%
4780*36ac495dSmrg  %
4781*36ac495dSmrg  \ifx\lastskipmacro\zeroskipmacro
4782*36ac495dSmrg    % If \lastskip was zero, perhaps the last item was a penalty, and
4783*36ac495dSmrg    % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
4784*36ac495dSmrg    % to re-insert the same penalty (values >10000 are used for various
4785*36ac495dSmrg    % signals); since we just inserted a non-discardable item, any
4786*36ac495dSmrg    % following glue (such as a \parskip) would be a breakpoint.  For example:
4787*36ac495dSmrg    %   @deffn deffn-whatever
4788*36ac495dSmrg    %   @vindex index-whatever
4789*36ac495dSmrg    %   Description.
4790*36ac495dSmrg    % would allow a break between the index-whatever whatsit
4791*36ac495dSmrg    % and the "Description." paragraph.
4792*36ac495dSmrg    \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
4793*36ac495dSmrg  \else
4794*36ac495dSmrg    % On the other hand, if we had a nonzero \lastskip,
4795*36ac495dSmrg    % this make-up glue would be preceded by a non-discardable item
4796*36ac495dSmrg    % (the whatsit from the \write), so we must insert a \nobreak.
4797*36ac495dSmrg    \nobreak\vskip\whatsitskip
4798*36ac495dSmrg  \fi
4799*36ac495dSmrg\fi}
4800*36ac495dSmrg
4801*36ac495dSmrg% The index entry written in the file actually looks like
4802*36ac495dSmrg%  \entry {sortstring}{page}{topic}
4803*36ac495dSmrg% or
4804*36ac495dSmrg%  \entry {sortstring}{page}{topic}{subtopic}
4805*36ac495dSmrg% The texindex program reads in these files and writes files
4806*36ac495dSmrg% containing these kinds of lines:
4807*36ac495dSmrg%  \initial {c}
4808*36ac495dSmrg%     before the first topic whose initial is c
4809*36ac495dSmrg%  \entry {topic}{pagelist}
4810*36ac495dSmrg%     for a topic that is used without subtopics
4811*36ac495dSmrg%  \primary {topic}
4812*36ac495dSmrg%     for the beginning of a topic that is used with subtopics
4813*36ac495dSmrg%  \secondary {subtopic}{pagelist}
4814*36ac495dSmrg%     for each subtopic.
4815*36ac495dSmrg
4816*36ac495dSmrg% Define the user-accessible indexing commands
4817*36ac495dSmrg% @findex, @vindex, @kindex, @cindex.
4818*36ac495dSmrg
4819*36ac495dSmrg\def\findex {\fnindex}
4820*36ac495dSmrg\def\kindex {\kyindex}
4821*36ac495dSmrg\def\cindex {\cpindex}
4822*36ac495dSmrg\def\vindex {\vrindex}
4823*36ac495dSmrg\def\tindex {\tpindex}
4824*36ac495dSmrg\def\pindex {\pgindex}
4825*36ac495dSmrg
4826*36ac495dSmrg\def\cindexsub {\begingroup\obeylines\cindexsub}
4827*36ac495dSmrg{\obeylines %
4828*36ac495dSmrg\gdef\cindexsub "#1" #2^^M{\endgroup %
4829*36ac495dSmrg\dosubind{cp}{#2}{#1}}}
4830*36ac495dSmrg
4831*36ac495dSmrg% Define the macros used in formatting output of the sorted index material.
4832*36ac495dSmrg
4833*36ac495dSmrg% @printindex causes a particular index (the ??s file) to get printed.
4834*36ac495dSmrg% It does not print any chapter heading (usually an @unnumbered).
4835*36ac495dSmrg%
4836*36ac495dSmrg\parseargdef\printindex{\begingroup
4837*36ac495dSmrg  \dobreak \chapheadingskip{10000}%
4838*36ac495dSmrg  %
4839*36ac495dSmrg  \smallfonts \rm
4840*36ac495dSmrg  \tolerance = 9500
4841*36ac495dSmrg  \plainfrenchspacing
4842*36ac495dSmrg  \everypar = {}% don't want the \kern\-parindent from indentation suppression.
4843*36ac495dSmrg  %
4844*36ac495dSmrg  % See if the index file exists and is nonempty.
4845*36ac495dSmrg  % Change catcode of @ here so that if the index file contains
4846*36ac495dSmrg  % \initial {@}
4847*36ac495dSmrg  % as its first line, TeX doesn't complain about mismatched braces
4848*36ac495dSmrg  % (because it thinks @} is a control sequence).
4849*36ac495dSmrg  \catcode`\@ = 11
4850*36ac495dSmrg  \openin 1 \jobname.#1s
4851*36ac495dSmrg  \ifeof 1
4852*36ac495dSmrg    % \enddoublecolumns gets confused if there is no text in the index,
4853*36ac495dSmrg    % and it loses the chapter title and the aux file entries for the
4854*36ac495dSmrg    % index.  The easiest way to prevent this problem is to make sure
4855*36ac495dSmrg    % there is some text.
4856*36ac495dSmrg    \putwordIndexNonexistent
4857*36ac495dSmrg  \else
4858*36ac495dSmrg    %
4859*36ac495dSmrg    % If the index file exists but is empty, then \openin leaves \ifeof
4860*36ac495dSmrg    % false.  We have to make TeX try to read something from the file, so
4861*36ac495dSmrg    % it can discover if there is anything in it.
4862*36ac495dSmrg    \read 1 to \temp
4863*36ac495dSmrg    \ifeof 1
4864*36ac495dSmrg      \putwordIndexIsEmpty
4865*36ac495dSmrg    \else
4866*36ac495dSmrg      % Index files are almost Texinfo source, but we use \ as the escape
4867*36ac495dSmrg      % character.  It would be better to use @, but that's too big a change
4868*36ac495dSmrg      % to make right now.
4869*36ac495dSmrg      \def\indexbackslash{\backslashcurfont}%
4870*36ac495dSmrg      \catcode`\\ = 0
4871*36ac495dSmrg      \escapechar = `\\
4872*36ac495dSmrg      \begindoublecolumns
4873*36ac495dSmrg      \input \jobname.#1s
4874*36ac495dSmrg      \enddoublecolumns
4875*36ac495dSmrg    \fi
4876*36ac495dSmrg  \fi
4877*36ac495dSmrg  \closein 1
4878*36ac495dSmrg\endgroup}
4879*36ac495dSmrg
4880*36ac495dSmrg% These macros are used by the sorted index file itself.
4881*36ac495dSmrg% Change them to control the appearance of the index.
4882*36ac495dSmrg
4883*36ac495dSmrg\def\initial#1{{%
4884*36ac495dSmrg  % Some minor font changes for the special characters.
4885*36ac495dSmrg  \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
4886*36ac495dSmrg  %
4887*36ac495dSmrg  % Remove any glue we may have, we'll be inserting our own.
4888*36ac495dSmrg  \removelastskip
4889*36ac495dSmrg  %
4890*36ac495dSmrg  % We like breaks before the index initials, so insert a bonus.
4891*36ac495dSmrg  \nobreak
4892*36ac495dSmrg  \vskip 0pt plus 3\baselineskip
4893*36ac495dSmrg  \penalty 0
4894*36ac495dSmrg  \vskip 0pt plus -3\baselineskip
4895*36ac495dSmrg  %
4896*36ac495dSmrg  % Typeset the initial.  Making this add up to a whole number of
4897*36ac495dSmrg  % baselineskips increases the chance of the dots lining up from column
4898*36ac495dSmrg  % to column.  It still won't often be perfect, because of the stretch
4899*36ac495dSmrg  % we need before each entry, but it's better.
4900*36ac495dSmrg  %
4901*36ac495dSmrg  % No shrink because it confuses \balancecolumns.
4902*36ac495dSmrg  \vskip 1.67\baselineskip plus .5\baselineskip
4903*36ac495dSmrg  \leftline{\secbf #1}%
4904*36ac495dSmrg  % Do our best not to break after the initial.
4905*36ac495dSmrg  \nobreak
4906*36ac495dSmrg  \vskip .33\baselineskip plus .1\baselineskip
4907*36ac495dSmrg}}
4908*36ac495dSmrg
4909*36ac495dSmrg% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
4910*36ac495dSmrg% then page number (#2) flushed to the right margin.  It is used for index
4911*36ac495dSmrg% and table of contents entries.  The paragraph is indented by \leftskip.
4912*36ac495dSmrg%
4913*36ac495dSmrg% A straightforward implementation would start like this:
4914*36ac495dSmrg%	\def\entry#1#2{...
4915*36ac495dSmrg% But this freezes the catcodes in the argument, and can cause problems to
4916*36ac495dSmrg% @code, which sets - active.  This problem was fixed by a kludge---
4917*36ac495dSmrg% ``-'' was active throughout whole index, but this isn't really right.
4918*36ac495dSmrg% The right solution is to prevent \entry from swallowing the whole text.
4919*36ac495dSmrg%                                 --kasal, 21nov03
4920*36ac495dSmrg\def\entry{%
4921*36ac495dSmrg  \begingroup
4922*36ac495dSmrg    %
4923*36ac495dSmrg    % Start a new paragraph if necessary, so our assignments below can't
4924*36ac495dSmrg    % affect previous text.
4925*36ac495dSmrg    \par
4926*36ac495dSmrg    %
4927*36ac495dSmrg    % Do not fill out the last line with white space.
4928*36ac495dSmrg    \parfillskip = 0in
4929*36ac495dSmrg    %
4930*36ac495dSmrg    % No extra space above this paragraph.
4931*36ac495dSmrg    \parskip = 0in
4932*36ac495dSmrg    %
4933*36ac495dSmrg    % Do not prefer a separate line ending with a hyphen to fewer lines.
4934*36ac495dSmrg    \finalhyphendemerits = 0
4935*36ac495dSmrg    %
4936*36ac495dSmrg    % \hangindent is only relevant when the entry text and page number
4937*36ac495dSmrg    % don't both fit on one line.  In that case, bob suggests starting the
4938*36ac495dSmrg    % dots pretty far over on the line.  Unfortunately, a large
4939*36ac495dSmrg    % indentation looks wrong when the entry text itself is broken across
4940*36ac495dSmrg    % lines.  So we use a small indentation and put up with long leaders.
4941*36ac495dSmrg    %
4942*36ac495dSmrg    % \hangafter is reset to 1 (which is the value we want) at the start
4943*36ac495dSmrg    % of each paragraph, so we need not do anything with that.
4944*36ac495dSmrg    \hangindent = 2em
4945*36ac495dSmrg    %
4946*36ac495dSmrg    % When the entry text needs to be broken, just fill out the first line
4947*36ac495dSmrg    % with blank space.
4948*36ac495dSmrg    \rightskip = 0pt plus1fil
4949*36ac495dSmrg    %
4950*36ac495dSmrg    % A bit of stretch before each entry for the benefit of balancing
4951*36ac495dSmrg    % columns.
4952*36ac495dSmrg    \vskip 0pt plus1pt
4953*36ac495dSmrg    %
4954*36ac495dSmrg    % When reading the text of entry, convert explicit line breaks
4955*36ac495dSmrg    % from @* into spaces.  The user might give these in long section
4956*36ac495dSmrg    % titles, for instance.
4957*36ac495dSmrg    \def\*{\unskip\space\ignorespaces}%
4958*36ac495dSmrg    \def\entrybreak{\hfil\break}%
4959*36ac495dSmrg    %
4960*36ac495dSmrg    % Swallow the left brace of the text (first parameter):
4961*36ac495dSmrg    \afterassignment\doentry
4962*36ac495dSmrg    \let\temp =
4963*36ac495dSmrg}
4964*36ac495dSmrg\def\entrybreak{\unskip\space\ignorespaces}%
4965*36ac495dSmrg\def\doentry{%
4966*36ac495dSmrg    \bgroup % Instead of the swallowed brace.
4967*36ac495dSmrg      \noindent
4968*36ac495dSmrg      \aftergroup\finishentry
4969*36ac495dSmrg      % And now comes the text of the entry.
4970*36ac495dSmrg}
4971*36ac495dSmrg\def\finishentry#1{%
4972*36ac495dSmrg    % #1 is the page number.
4973*36ac495dSmrg    %
4974*36ac495dSmrg    % The following is kludged to not output a line of dots in the index if
4975*36ac495dSmrg    % there are no page numbers.  The next person who breaks this will be
4976*36ac495dSmrg    % cursed by a Unix daemon.
4977*36ac495dSmrg    \setbox\boxA = \hbox{#1}%
4978*36ac495dSmrg    \ifdim\wd\boxA = 0pt
4979*36ac495dSmrg      \ %
4980*36ac495dSmrg    \else
4981*36ac495dSmrg      %
4982*36ac495dSmrg      % If we must, put the page number on a line of its own, and fill out
4983*36ac495dSmrg      % this line with blank space.  (The \hfil is overwhelmed with the
4984*36ac495dSmrg      % fill leaders glue in \indexdotfill if the page number does fit.)
4985*36ac495dSmrg      \hfil\penalty50
4986*36ac495dSmrg      \null\nobreak\indexdotfill % Have leaders before the page number.
4987*36ac495dSmrg      %
4988*36ac495dSmrg      % The `\ ' here is removed by the implicit \unskip that TeX does as
4989*36ac495dSmrg      % part of (the primitive) \par.  Without it, a spurious underfull
4990*36ac495dSmrg      % \hbox ensues.
4991*36ac495dSmrg      \ifpdf
4992*36ac495dSmrg	\pdfgettoks#1.%
4993*36ac495dSmrg	\ \the\toksA
4994*36ac495dSmrg      \else
4995*36ac495dSmrg	\ #1%
4996*36ac495dSmrg      \fi
4997*36ac495dSmrg    \fi
4998*36ac495dSmrg    \par
4999*36ac495dSmrg  \endgroup
5000*36ac495dSmrg}
5001*36ac495dSmrg
5002*36ac495dSmrg% Like plain.tex's \dotfill, except uses up at least 1 em.
5003*36ac495dSmrg\def\indexdotfill{\cleaders
5004*36ac495dSmrg  \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
5005*36ac495dSmrg
5006*36ac495dSmrg\def\primary #1{\line{#1\hfil}}
5007*36ac495dSmrg
5008*36ac495dSmrg\newskip\secondaryindent \secondaryindent=0.5cm
5009*36ac495dSmrg\def\secondary#1#2{{%
5010*36ac495dSmrg  \parfillskip=0in
5011*36ac495dSmrg  \parskip=0in
5012*36ac495dSmrg  \hangindent=1in
5013*36ac495dSmrg  \hangafter=1
5014*36ac495dSmrg  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5015*36ac495dSmrg  \ifpdf
5016*36ac495dSmrg    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5017*36ac495dSmrg  \else
5018*36ac495dSmrg    #2
5019*36ac495dSmrg  \fi
5020*36ac495dSmrg  \par
5021*36ac495dSmrg}}
5022*36ac495dSmrg
5023*36ac495dSmrg% Define two-column mode, which we use to typeset indexes.
5024*36ac495dSmrg% Adapted from the TeXbook, page 416, which is to say,
5025*36ac495dSmrg% the manmac.tex format used to print the TeXbook itself.
5026*36ac495dSmrg\catcode`\@=11
5027*36ac495dSmrg
5028*36ac495dSmrg\newbox\partialpage
5029*36ac495dSmrg\newdimen\doublecolumnhsize
5030*36ac495dSmrg
5031*36ac495dSmrg\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5032*36ac495dSmrg  % Grab any single-column material above us.
5033*36ac495dSmrg  \output = {%
5034*36ac495dSmrg    %
5035*36ac495dSmrg    % Here is a possibility not foreseen in manmac: if we accumulate a
5036*36ac495dSmrg    % whole lot of material, we might end up calling this \output
5037*36ac495dSmrg    % routine twice in a row (see the doublecol-lose test, which is
5038*36ac495dSmrg    % essentially a couple of indexes with @setchapternewpage off).  In
5039*36ac495dSmrg    % that case we just ship out what is in \partialpage with the normal
5040*36ac495dSmrg    % output routine.  Generally, \partialpage will be empty when this
5041*36ac495dSmrg    % runs and this will be a no-op.  See the indexspread.tex test case.
5042*36ac495dSmrg    \ifvoid\partialpage \else
5043*36ac495dSmrg      \onepageout{\pagecontents\partialpage}%
5044*36ac495dSmrg    \fi
5045*36ac495dSmrg    %
5046*36ac495dSmrg    \global\setbox\partialpage = \vbox{%
5047*36ac495dSmrg      % Unvbox the main output page.
5048*36ac495dSmrg      \unvbox\PAGE
5049*36ac495dSmrg      \kern-\topskip \kern\baselineskip
5050*36ac495dSmrg    }%
5051*36ac495dSmrg  }%
5052*36ac495dSmrg  \eject % run that output routine to set \partialpage
5053*36ac495dSmrg  %
5054*36ac495dSmrg  % Use the double-column output routine for subsequent pages.
5055*36ac495dSmrg  \output = {\doublecolumnout}%
5056*36ac495dSmrg  %
5057*36ac495dSmrg  % Change the page size parameters.  We could do this once outside this
5058*36ac495dSmrg  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5059*36ac495dSmrg  % format, but then we repeat the same computation.  Repeating a couple
5060*36ac495dSmrg  % of assignments once per index is clearly meaningless for the
5061*36ac495dSmrg  % execution time, so we may as well do it in one place.
5062*36ac495dSmrg  %
5063*36ac495dSmrg  % First we halve the line length, less a little for the gutter between
5064*36ac495dSmrg  % the columns.  We compute the gutter based on the line length, so it
5065*36ac495dSmrg  % changes automatically with the paper format.  The magic constant
5066*36ac495dSmrg  % below is chosen so that the gutter has the same value (well, +-<1pt)
5067*36ac495dSmrg  % as it did when we hard-coded it.
5068*36ac495dSmrg  %
5069*36ac495dSmrg  % We put the result in a separate register, \doublecolumhsize, so we
5070*36ac495dSmrg  % can restore it in \pagesofar, after \hsize itself has (potentially)
5071*36ac495dSmrg  % been clobbered.
5072*36ac495dSmrg  %
5073*36ac495dSmrg  \doublecolumnhsize = \hsize
5074*36ac495dSmrg    \advance\doublecolumnhsize by -.04154\hsize
5075*36ac495dSmrg    \divide\doublecolumnhsize by 2
5076*36ac495dSmrg  \hsize = \doublecolumnhsize
5077*36ac495dSmrg  %
5078*36ac495dSmrg  % Double the \vsize as well.  (We don't need a separate register here,
5079*36ac495dSmrg  % since nobody clobbers \vsize.)
5080*36ac495dSmrg  \vsize = 2\vsize
5081*36ac495dSmrg}
5082*36ac495dSmrg
5083*36ac495dSmrg% The double-column output routine for all double-column pages except
5084*36ac495dSmrg% the last.
5085*36ac495dSmrg%
5086*36ac495dSmrg\def\doublecolumnout{%
5087*36ac495dSmrg  \splittopskip=\topskip \splitmaxdepth=\maxdepth
5088*36ac495dSmrg  % Get the available space for the double columns -- the normal
5089*36ac495dSmrg  % (undoubled) page height minus any material left over from the
5090*36ac495dSmrg  % previous page.
5091*36ac495dSmrg  \dimen@ = \vsize
5092*36ac495dSmrg  \divide\dimen@ by 2
5093*36ac495dSmrg  \advance\dimen@ by -\ht\partialpage
5094*36ac495dSmrg  %
5095*36ac495dSmrg  % box0 will be the left-hand column, box2 the right.
5096*36ac495dSmrg  \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
5097*36ac495dSmrg  \onepageout\pagesofar
5098*36ac495dSmrg  \unvbox255
5099*36ac495dSmrg  \penalty\outputpenalty
5100*36ac495dSmrg}
5101*36ac495dSmrg%
5102*36ac495dSmrg% Re-output the contents of the output page -- any previous material,
5103*36ac495dSmrg% followed by the two boxes we just split, in box0 and box2.
5104*36ac495dSmrg\def\pagesofar{%
5105*36ac495dSmrg  \unvbox\partialpage
5106*36ac495dSmrg  %
5107*36ac495dSmrg  \hsize = \doublecolumnhsize
5108*36ac495dSmrg  \wd0=\hsize \wd2=\hsize
5109*36ac495dSmrg  \hbox to\pagewidth{\box0\hfil\box2}%
5110*36ac495dSmrg}
5111*36ac495dSmrg%
5112*36ac495dSmrg% All done with double columns.
5113*36ac495dSmrg\def\enddoublecolumns{%
5114*36ac495dSmrg  % The following penalty ensures that the page builder is exercised
5115*36ac495dSmrg  % _before_ we change the output routine.  This is necessary in the
5116*36ac495dSmrg  % following situation:
5117*36ac495dSmrg  %
5118*36ac495dSmrg  % The last section of the index consists only of a single entry.
5119*36ac495dSmrg  % Before this section, \pagetotal is less than \pagegoal, so no
5120*36ac495dSmrg  % break occurs before the last section starts.  However, the last
5121*36ac495dSmrg  % section, consisting of \initial and the single \entry, does not
5122*36ac495dSmrg  % fit on the page and has to be broken off.  Without the following
5123*36ac495dSmrg  % penalty the page builder will not be exercised until \eject
5124*36ac495dSmrg  % below, and by that time we'll already have changed the output
5125*36ac495dSmrg  % routine to the \balancecolumns version, so the next-to-last
5126*36ac495dSmrg  % double-column page will be processed with \balancecolumns, which
5127*36ac495dSmrg  % is wrong:  The two columns will go to the main vertical list, with
5128*36ac495dSmrg  % the broken-off section in the recent contributions.  As soon as
5129*36ac495dSmrg  % the output routine finishes, TeX starts reconsidering the page
5130*36ac495dSmrg  % break.  The two columns and the broken-off section both fit on the
5131*36ac495dSmrg  % page, because the two columns now take up only half of the page
5132*36ac495dSmrg  % goal.  When TeX sees \eject from below which follows the final
5133*36ac495dSmrg  % section, it invokes the new output routine that we've set after
5134*36ac495dSmrg  % \balancecolumns below; \onepageout will try to fit the two columns
5135*36ac495dSmrg  % and the final section into the vbox of \pageheight (see
5136*36ac495dSmrg  % \pagebody), causing an overfull box.
5137*36ac495dSmrg  %
5138*36ac495dSmrg  % Note that glue won't work here, because glue does not exercise the
5139*36ac495dSmrg  % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5140*36ac495dSmrg  \penalty0
5141*36ac495dSmrg  %
5142*36ac495dSmrg  \output = {%
5143*36ac495dSmrg    % Split the last of the double-column material.  Leave it on the
5144*36ac495dSmrg    % current page, no automatic page break.
5145*36ac495dSmrg    \balancecolumns
5146*36ac495dSmrg    %
5147*36ac495dSmrg    % If we end up splitting too much material for the current page,
5148*36ac495dSmrg    % though, there will be another page break right after this \output
5149*36ac495dSmrg    % invocation ends.  Having called \balancecolumns once, we do not
5150*36ac495dSmrg    % want to call it again.  Therefore, reset \output to its normal
5151*36ac495dSmrg    % definition right away.  (We hope \balancecolumns will never be
5152*36ac495dSmrg    % called on to balance too much material, but if it is, this makes
5153*36ac495dSmrg    % the output somewhat more palatable.)
5154*36ac495dSmrg    \global\output = {\onepageout{\pagecontents\PAGE}}%
5155*36ac495dSmrg  }%
5156*36ac495dSmrg  \eject
5157*36ac495dSmrg  \endgroup % started in \begindoublecolumns
5158*36ac495dSmrg  %
5159*36ac495dSmrg  % \pagegoal was set to the doubled \vsize above, since we restarted
5160*36ac495dSmrg  % the current page.  We're now back to normal single-column
5161*36ac495dSmrg  % typesetting, so reset \pagegoal to the normal \vsize (after the
5162*36ac495dSmrg  % \endgroup where \vsize got restored).
5163*36ac495dSmrg  \pagegoal = \vsize
5164*36ac495dSmrg}
5165*36ac495dSmrg%
5166*36ac495dSmrg% Called at the end of the double column material.
5167*36ac495dSmrg\def\balancecolumns{%
5168*36ac495dSmrg  \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
5169*36ac495dSmrg  \dimen@ = \ht0
5170*36ac495dSmrg  \advance\dimen@ by \topskip
5171*36ac495dSmrg  \advance\dimen@ by-\baselineskip
5172*36ac495dSmrg  \divide\dimen@ by 2 % target to split to
5173*36ac495dSmrg  %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
5174*36ac495dSmrg  \splittopskip = \topskip
5175*36ac495dSmrg  % Loop until we get a decent breakpoint.
5176*36ac495dSmrg  {%
5177*36ac495dSmrg    \vbadness = 10000
5178*36ac495dSmrg    \loop
5179*36ac495dSmrg      \global\setbox3 = \copy0
5180*36ac495dSmrg      \global\setbox1 = \vsplit3 to \dimen@
5181*36ac495dSmrg    \ifdim\ht3>\dimen@
5182*36ac495dSmrg      \global\advance\dimen@ by 1pt
5183*36ac495dSmrg    \repeat
5184*36ac495dSmrg  }%
5185*36ac495dSmrg  %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
5186*36ac495dSmrg  \setbox0=\vbox to\dimen@{\unvbox1}%
5187*36ac495dSmrg  \setbox2=\vbox to\dimen@{\unvbox3}%
5188*36ac495dSmrg  %
5189*36ac495dSmrg  \pagesofar
5190*36ac495dSmrg}
5191*36ac495dSmrg\catcode`\@ = \other
5192*36ac495dSmrg
5193*36ac495dSmrg
5194*36ac495dSmrg\message{sectioning,}
5195*36ac495dSmrg% Chapters, sections, etc.
5196*36ac495dSmrg
5197*36ac495dSmrg% Let's start with @part.
5198*36ac495dSmrg\outer\parseargdef\part{\partzzz{#1}}
5199*36ac495dSmrg\def\partzzz#1{%
5200*36ac495dSmrg  \chapoddpage
5201*36ac495dSmrg  \null
5202*36ac495dSmrg  \vskip.3\vsize  % move it down on the page a bit
5203*36ac495dSmrg  \begingroup
5204*36ac495dSmrg    \noindent \titlefonts\rmisbold #1\par % the text
5205*36ac495dSmrg    \let\lastnode=\empty      % no node to associate with
5206*36ac495dSmrg    \writetocentry{part}{#1}{}% but put it in the toc
5207*36ac495dSmrg    \headingsoff              % no headline or footline on the part page
5208*36ac495dSmrg    \chapoddpage
5209*36ac495dSmrg  \endgroup
5210*36ac495dSmrg}
5211*36ac495dSmrg
5212*36ac495dSmrg% \unnumberedno is an oxymoron.  But we count the unnumbered
5213*36ac495dSmrg% sections so that we can refer to them unambiguously in the pdf
5214*36ac495dSmrg% outlines by their "section number".  We avoid collisions with chapter
5215*36ac495dSmrg% numbers by starting them at 10000.  (If a document ever has 10000
5216*36ac495dSmrg% chapters, we're in trouble anyway, I'm sure.)
5217*36ac495dSmrg\newcount\unnumberedno \unnumberedno = 10000
5218*36ac495dSmrg\newcount\chapno
5219*36ac495dSmrg\newcount\secno        \secno=0
5220*36ac495dSmrg\newcount\subsecno     \subsecno=0
5221*36ac495dSmrg\newcount\subsubsecno  \subsubsecno=0
5222*36ac495dSmrg
5223*36ac495dSmrg% This counter is funny since it counts through charcodes of letters A, B, ...
5224*36ac495dSmrg\newcount\appendixno  \appendixno = `\@
5225*36ac495dSmrg%
5226*36ac495dSmrg% \def\appendixletter{\char\the\appendixno}
5227*36ac495dSmrg% We do the following ugly conditional instead of the above simple
5228*36ac495dSmrg% construct for the sake of pdftex, which needs the actual
5229*36ac495dSmrg% letter in the expansion, not just typeset.
5230*36ac495dSmrg%
5231*36ac495dSmrg\def\appendixletter{%
5232*36ac495dSmrg  \ifnum\appendixno=`A A%
5233*36ac495dSmrg  \else\ifnum\appendixno=`B B%
5234*36ac495dSmrg  \else\ifnum\appendixno=`C C%
5235*36ac495dSmrg  \else\ifnum\appendixno=`D D%
5236*36ac495dSmrg  \else\ifnum\appendixno=`E E%
5237*36ac495dSmrg  \else\ifnum\appendixno=`F F%
5238*36ac495dSmrg  \else\ifnum\appendixno=`G G%
5239*36ac495dSmrg  \else\ifnum\appendixno=`H H%
5240*36ac495dSmrg  \else\ifnum\appendixno=`I I%
5241*36ac495dSmrg  \else\ifnum\appendixno=`J J%
5242*36ac495dSmrg  \else\ifnum\appendixno=`K K%
5243*36ac495dSmrg  \else\ifnum\appendixno=`L L%
5244*36ac495dSmrg  \else\ifnum\appendixno=`M M%
5245*36ac495dSmrg  \else\ifnum\appendixno=`N N%
5246*36ac495dSmrg  \else\ifnum\appendixno=`O O%
5247*36ac495dSmrg  \else\ifnum\appendixno=`P P%
5248*36ac495dSmrg  \else\ifnum\appendixno=`Q Q%
5249*36ac495dSmrg  \else\ifnum\appendixno=`R R%
5250*36ac495dSmrg  \else\ifnum\appendixno=`S S%
5251*36ac495dSmrg  \else\ifnum\appendixno=`T T%
5252*36ac495dSmrg  \else\ifnum\appendixno=`U U%
5253*36ac495dSmrg  \else\ifnum\appendixno=`V V%
5254*36ac495dSmrg  \else\ifnum\appendixno=`W W%
5255*36ac495dSmrg  \else\ifnum\appendixno=`X X%
5256*36ac495dSmrg  \else\ifnum\appendixno=`Y Y%
5257*36ac495dSmrg  \else\ifnum\appendixno=`Z Z%
5258*36ac495dSmrg  % The \the is necessary, despite appearances, because \appendixletter is
5259*36ac495dSmrg  % expanded while writing the .toc file.  \char\appendixno is not
5260*36ac495dSmrg  % expandable, thus it is written literally, thus all appendixes come out
5261*36ac495dSmrg  % with the same letter (or @) in the toc without it.
5262*36ac495dSmrg  \else\char\the\appendixno
5263*36ac495dSmrg  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
5264*36ac495dSmrg  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
5265*36ac495dSmrg
5266*36ac495dSmrg% Each @chapter defines these (using marks) as the number+name, number
5267*36ac495dSmrg% and name of the chapter.  Page headings and footings can use
5268*36ac495dSmrg% these.  @section does likewise.
5269*36ac495dSmrg\def\thischapter{}
5270*36ac495dSmrg\def\thischapternum{}
5271*36ac495dSmrg\def\thischaptername{}
5272*36ac495dSmrg\def\thissection{}
5273*36ac495dSmrg\def\thissectionnum{}
5274*36ac495dSmrg\def\thissectionname{}
5275*36ac495dSmrg
5276*36ac495dSmrg\newcount\absseclevel % used to calculate proper heading level
5277*36ac495dSmrg\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
5278*36ac495dSmrg
5279*36ac495dSmrg% @raisesections: treat @section as chapter, @subsection as section, etc.
5280*36ac495dSmrg\def\raisesections{\global\advance\secbase by -1}
5281*36ac495dSmrg\let\up=\raisesections % original BFox name
5282*36ac495dSmrg
5283*36ac495dSmrg% @lowersections: treat @chapter as section, @section as subsection, etc.
5284*36ac495dSmrg\def\lowersections{\global\advance\secbase by 1}
5285*36ac495dSmrg\let\down=\lowersections % original BFox name
5286*36ac495dSmrg
5287*36ac495dSmrg% we only have subsub.
5288*36ac495dSmrg\chardef\maxseclevel = 3
5289*36ac495dSmrg%
5290*36ac495dSmrg% A numbered section within an unnumbered changes to unnumbered too.
5291*36ac495dSmrg% To achieve this, remember the "biggest" unnum. sec. we are currently in:
5292*36ac495dSmrg\chardef\unnlevel = \maxseclevel
5293*36ac495dSmrg%
5294*36ac495dSmrg% Trace whether the current chapter is an appendix or not:
5295*36ac495dSmrg% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
5296*36ac495dSmrg\def\chapheadtype{N}
5297*36ac495dSmrg
5298*36ac495dSmrg% Choose a heading macro
5299*36ac495dSmrg% #1 is heading type
5300*36ac495dSmrg% #2 is heading level
5301*36ac495dSmrg% #3 is text for heading
5302*36ac495dSmrg\def\genhead#1#2#3{%
5303*36ac495dSmrg  % Compute the abs. sec. level:
5304*36ac495dSmrg  \absseclevel=#2
5305*36ac495dSmrg  \advance\absseclevel by \secbase
5306*36ac495dSmrg  % Make sure \absseclevel doesn't fall outside the range:
5307*36ac495dSmrg  \ifnum \absseclevel < 0
5308*36ac495dSmrg    \absseclevel = 0
5309*36ac495dSmrg  \else
5310*36ac495dSmrg    \ifnum \absseclevel > 3
5311*36ac495dSmrg      \absseclevel = 3
5312*36ac495dSmrg    \fi
5313*36ac495dSmrg  \fi
5314*36ac495dSmrg  % The heading type:
5315*36ac495dSmrg  \def\headtype{#1}%
5316*36ac495dSmrg  \if \headtype U%
5317*36ac495dSmrg    \ifnum \absseclevel < \unnlevel
5318*36ac495dSmrg      \chardef\unnlevel = \absseclevel
5319*36ac495dSmrg    \fi
5320*36ac495dSmrg  \else
5321*36ac495dSmrg    % Check for appendix sections:
5322*36ac495dSmrg    \ifnum \absseclevel = 0
5323*36ac495dSmrg      \edef\chapheadtype{\headtype}%
5324*36ac495dSmrg    \else
5325*36ac495dSmrg      \if \headtype A\if \chapheadtype N%
5326*36ac495dSmrg	\errmessage{@appendix... within a non-appendix chapter}%
5327*36ac495dSmrg      \fi\fi
5328*36ac495dSmrg    \fi
5329*36ac495dSmrg    % Check for numbered within unnumbered:
5330*36ac495dSmrg    \ifnum \absseclevel > \unnlevel
5331*36ac495dSmrg      \def\headtype{U}%
5332*36ac495dSmrg    \else
5333*36ac495dSmrg      \chardef\unnlevel = 3
5334*36ac495dSmrg    \fi
5335*36ac495dSmrg  \fi
5336*36ac495dSmrg  % Now print the heading:
5337*36ac495dSmrg  \if \headtype U%
5338*36ac495dSmrg    \ifcase\absseclevel
5339*36ac495dSmrg	\unnumberedzzz{#3}%
5340*36ac495dSmrg    \or \unnumberedseczzz{#3}%
5341*36ac495dSmrg    \or \unnumberedsubseczzz{#3}%
5342*36ac495dSmrg    \or \unnumberedsubsubseczzz{#3}%
5343*36ac495dSmrg    \fi
5344*36ac495dSmrg  \else
5345*36ac495dSmrg    \if \headtype A%
5346*36ac495dSmrg      \ifcase\absseclevel
5347*36ac495dSmrg	  \appendixzzz{#3}%
5348*36ac495dSmrg      \or \appendixsectionzzz{#3}%
5349*36ac495dSmrg      \or \appendixsubseczzz{#3}%
5350*36ac495dSmrg      \or \appendixsubsubseczzz{#3}%
5351*36ac495dSmrg      \fi
5352*36ac495dSmrg    \else
5353*36ac495dSmrg      \ifcase\absseclevel
5354*36ac495dSmrg	  \chapterzzz{#3}%
5355*36ac495dSmrg      \or \seczzz{#3}%
5356*36ac495dSmrg      \or \numberedsubseczzz{#3}%
5357*36ac495dSmrg      \or \numberedsubsubseczzz{#3}%
5358*36ac495dSmrg      \fi
5359*36ac495dSmrg    \fi
5360*36ac495dSmrg  \fi
5361*36ac495dSmrg  \suppressfirstparagraphindent
5362*36ac495dSmrg}
5363*36ac495dSmrg
5364*36ac495dSmrg% an interface:
5365*36ac495dSmrg\def\numhead{\genhead N}
5366*36ac495dSmrg\def\apphead{\genhead A}
5367*36ac495dSmrg\def\unnmhead{\genhead U}
5368*36ac495dSmrg
5369*36ac495dSmrg% @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
5370*36ac495dSmrg% all lower-level sectioning counters to zero.
5371*36ac495dSmrg%
5372*36ac495dSmrg% Also set \chaplevelprefix, which we prepend to @float sequence numbers
5373*36ac495dSmrg% (e.g., figures), q.v.  By default (before any chapter), that is empty.
5374*36ac495dSmrg\let\chaplevelprefix = \empty
5375*36ac495dSmrg%
5376*36ac495dSmrg\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
5377*36ac495dSmrg\def\chapterzzz#1{%
5378*36ac495dSmrg  % section resetting is \global in case the chapter is in a group, such
5379*36ac495dSmrg  % as an @include file.
5380*36ac495dSmrg  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5381*36ac495dSmrg    \global\advance\chapno by 1
5382*36ac495dSmrg  %
5383*36ac495dSmrg  % Used for \float.
5384*36ac495dSmrg  \gdef\chaplevelprefix{\the\chapno.}%
5385*36ac495dSmrg  \resetallfloatnos
5386*36ac495dSmrg  %
5387*36ac495dSmrg  % \putwordChapter can contain complex things in translations.
5388*36ac495dSmrg  \toks0=\expandafter{\putwordChapter}%
5389*36ac495dSmrg  \message{\the\toks0 \space \the\chapno}%
5390*36ac495dSmrg  %
5391*36ac495dSmrg  % Write the actual heading.
5392*36ac495dSmrg  \chapmacro{#1}{Ynumbered}{\the\chapno}%
5393*36ac495dSmrg  %
5394*36ac495dSmrg  % So @section and the like are numbered underneath this chapter.
5395*36ac495dSmrg  \global\let\section = \numberedsec
5396*36ac495dSmrg  \global\let\subsection = \numberedsubsec
5397*36ac495dSmrg  \global\let\subsubsection = \numberedsubsubsec
5398*36ac495dSmrg}
5399*36ac495dSmrg
5400*36ac495dSmrg\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
5401*36ac495dSmrg%
5402*36ac495dSmrg\def\appendixzzz#1{%
5403*36ac495dSmrg  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5404*36ac495dSmrg    \global\advance\appendixno by 1
5405*36ac495dSmrg  \gdef\chaplevelprefix{\appendixletter.}%
5406*36ac495dSmrg  \resetallfloatnos
5407*36ac495dSmrg  %
5408*36ac495dSmrg  % \putwordAppendix can contain complex things in translations.
5409*36ac495dSmrg  \toks0=\expandafter{\putwordAppendix}%
5410*36ac495dSmrg  \message{\the\toks0 \space \appendixletter}%
5411*36ac495dSmrg  %
5412*36ac495dSmrg  \chapmacro{#1}{Yappendix}{\appendixletter}%
5413*36ac495dSmrg  %
5414*36ac495dSmrg  \global\let\section = \appendixsec
5415*36ac495dSmrg  \global\let\subsection = \appendixsubsec
5416*36ac495dSmrg  \global\let\subsubsection = \appendixsubsubsec
5417*36ac495dSmrg}
5418*36ac495dSmrg
5419*36ac495dSmrg% normally unnmhead0 calls unnumberedzzz:
5420*36ac495dSmrg\outer\parseargdef\unnumbered{\unnmhead0{#1}}
5421*36ac495dSmrg\def\unnumberedzzz#1{%
5422*36ac495dSmrg  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5423*36ac495dSmrg    \global\advance\unnumberedno by 1
5424*36ac495dSmrg  %
5425*36ac495dSmrg  % Since an unnumbered has no number, no prefix for figures.
5426*36ac495dSmrg  \global\let\chaplevelprefix = \empty
5427*36ac495dSmrg  \resetallfloatnos
5428*36ac495dSmrg  %
5429*36ac495dSmrg  % This used to be simply \message{#1}, but TeX fully expands the
5430*36ac495dSmrg  % argument to \message.  Therefore, if #1 contained @-commands, TeX
5431*36ac495dSmrg  % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
5432*36ac495dSmrg  % expanded @cite (which turns out to cause errors because \cite is meant
5433*36ac495dSmrg  % to be executed, not expanded).
5434*36ac495dSmrg  %
5435*36ac495dSmrg  % Anyway, we don't want the fully-expanded definition of @cite to appear
5436*36ac495dSmrg  % as a result of the \message, we just want `@cite' itself.  We use
5437*36ac495dSmrg  % \the<toks register> to achieve this: TeX expands \the<toks> only once,
5438*36ac495dSmrg  % simply yielding the contents of <toks register>.  (We also do this for
5439*36ac495dSmrg  % the toc entries.)
5440*36ac495dSmrg  \toks0 = {#1}%
5441*36ac495dSmrg  \message{(\the\toks0)}%
5442*36ac495dSmrg  %
5443*36ac495dSmrg  \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
5444*36ac495dSmrg  %
5445*36ac495dSmrg  \global\let\section = \unnumberedsec
5446*36ac495dSmrg  \global\let\subsection = \unnumberedsubsec
5447*36ac495dSmrg  \global\let\subsubsection = \unnumberedsubsubsec
5448*36ac495dSmrg}
5449*36ac495dSmrg
5450*36ac495dSmrg% @centerchap is like @unnumbered, but the heading is centered.
5451*36ac495dSmrg\outer\parseargdef\centerchap{%
5452*36ac495dSmrg  % Well, we could do the following in a group, but that would break
5453*36ac495dSmrg  % an assumption that \chapmacro is called at the outermost level.
5454*36ac495dSmrg  % Thus we are safer this way:		--kasal, 24feb04
5455*36ac495dSmrg  \let\centerparametersmaybe = \centerparameters
5456*36ac495dSmrg  \unnmhead0{#1}%
5457*36ac495dSmrg  \let\centerparametersmaybe = \relax
5458*36ac495dSmrg}
5459*36ac495dSmrg
5460*36ac495dSmrg% @top is like @unnumbered.
5461*36ac495dSmrg\let\top\unnumbered
5462*36ac495dSmrg
5463*36ac495dSmrg% Sections.
5464*36ac495dSmrg%
5465*36ac495dSmrg\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
5466*36ac495dSmrg\def\seczzz#1{%
5467*36ac495dSmrg  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
5468*36ac495dSmrg  \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
5469*36ac495dSmrg}
5470*36ac495dSmrg
5471*36ac495dSmrg% normally calls appendixsectionzzz:
5472*36ac495dSmrg\outer\parseargdef\appendixsection{\apphead1{#1}}
5473*36ac495dSmrg\def\appendixsectionzzz#1{%
5474*36ac495dSmrg  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
5475*36ac495dSmrg  \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
5476*36ac495dSmrg}
5477*36ac495dSmrg\let\appendixsec\appendixsection
5478*36ac495dSmrg
5479*36ac495dSmrg% normally calls unnumberedseczzz:
5480*36ac495dSmrg\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
5481*36ac495dSmrg\def\unnumberedseczzz#1{%
5482*36ac495dSmrg  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
5483*36ac495dSmrg  \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
5484*36ac495dSmrg}
5485*36ac495dSmrg
5486*36ac495dSmrg% Subsections.
5487*36ac495dSmrg%
5488*36ac495dSmrg% normally calls numberedsubseczzz:
5489*36ac495dSmrg\outer\parseargdef\numberedsubsec{\numhead2{#1}}
5490*36ac495dSmrg\def\numberedsubseczzz#1{%
5491*36ac495dSmrg  \global\subsubsecno=0  \global\advance\subsecno by 1
5492*36ac495dSmrg  \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
5493*36ac495dSmrg}
5494*36ac495dSmrg
5495*36ac495dSmrg% normally calls appendixsubseczzz:
5496*36ac495dSmrg\outer\parseargdef\appendixsubsec{\apphead2{#1}}
5497*36ac495dSmrg\def\appendixsubseczzz#1{%
5498*36ac495dSmrg  \global\subsubsecno=0  \global\advance\subsecno by 1
5499*36ac495dSmrg  \sectionheading{#1}{subsec}{Yappendix}%
5500*36ac495dSmrg                 {\appendixletter.\the\secno.\the\subsecno}%
5501*36ac495dSmrg}
5502*36ac495dSmrg
5503*36ac495dSmrg% normally calls unnumberedsubseczzz:
5504*36ac495dSmrg\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
5505*36ac495dSmrg\def\unnumberedsubseczzz#1{%
5506*36ac495dSmrg  \global\subsubsecno=0  \global\advance\subsecno by 1
5507*36ac495dSmrg  \sectionheading{#1}{subsec}{Ynothing}%
5508*36ac495dSmrg                 {\the\unnumberedno.\the\secno.\the\subsecno}%
5509*36ac495dSmrg}
5510*36ac495dSmrg
5511*36ac495dSmrg% Subsubsections.
5512*36ac495dSmrg%
5513*36ac495dSmrg% normally numberedsubsubseczzz:
5514*36ac495dSmrg\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
5515*36ac495dSmrg\def\numberedsubsubseczzz#1{%
5516*36ac495dSmrg  \global\advance\subsubsecno by 1
5517*36ac495dSmrg  \sectionheading{#1}{subsubsec}{Ynumbered}%
5518*36ac495dSmrg                 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
5519*36ac495dSmrg}
5520*36ac495dSmrg
5521*36ac495dSmrg% normally appendixsubsubseczzz:
5522*36ac495dSmrg\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
5523*36ac495dSmrg\def\appendixsubsubseczzz#1{%
5524*36ac495dSmrg  \global\advance\subsubsecno by 1
5525*36ac495dSmrg  \sectionheading{#1}{subsubsec}{Yappendix}%
5526*36ac495dSmrg                 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
5527*36ac495dSmrg}
5528*36ac495dSmrg
5529*36ac495dSmrg% normally unnumberedsubsubseczzz:
5530*36ac495dSmrg\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
5531*36ac495dSmrg\def\unnumberedsubsubseczzz#1{%
5532*36ac495dSmrg  \global\advance\subsubsecno by 1
5533*36ac495dSmrg  \sectionheading{#1}{subsubsec}{Ynothing}%
5534*36ac495dSmrg                 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
5535*36ac495dSmrg}
5536*36ac495dSmrg
5537*36ac495dSmrg% These macros control what the section commands do, according
5538*36ac495dSmrg% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
5539*36ac495dSmrg% Define them by default for a numbered chapter.
5540*36ac495dSmrg\let\section = \numberedsec
5541*36ac495dSmrg\let\subsection = \numberedsubsec
5542*36ac495dSmrg\let\subsubsection = \numberedsubsubsec
5543*36ac495dSmrg
5544*36ac495dSmrg% Define @majorheading, @heading and @subheading
5545*36ac495dSmrg
5546*36ac495dSmrg% NOTE on use of \vbox for chapter headings, section headings, and such:
5547*36ac495dSmrg%       1) We use \vbox rather than the earlier \line to permit
5548*36ac495dSmrg%          overlong headings to fold.
5549*36ac495dSmrg%       2) \hyphenpenalty is set to 10000 because hyphenation in a
5550*36ac495dSmrg%          heading is obnoxious; this forbids it.
5551*36ac495dSmrg%       3) Likewise, headings look best if no \parindent is used, and
5552*36ac495dSmrg%          if justification is not attempted.  Hence \raggedright.
5553*36ac495dSmrg
5554*36ac495dSmrg\def\majorheading{%
5555*36ac495dSmrg  {\advance\chapheadingskip by 10pt \chapbreak }%
5556*36ac495dSmrg  \parsearg\chapheadingzzz
5557*36ac495dSmrg}
5558*36ac495dSmrg
5559*36ac495dSmrg\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
5560*36ac495dSmrg\def\chapheadingzzz#1{%
5561*36ac495dSmrg  {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5562*36ac495dSmrg                    \parindent=0pt\ptexraggedright
5563*36ac495dSmrg                    \rmisbold #1\hfill}}%
5564*36ac495dSmrg  \bigskip \par\penalty 200\relax
5565*36ac495dSmrg  \suppressfirstparagraphindent
5566*36ac495dSmrg}
5567*36ac495dSmrg
5568*36ac495dSmrg% @heading, @subheading, @subsubheading.
5569*36ac495dSmrg\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
5570*36ac495dSmrg  \suppressfirstparagraphindent}
5571*36ac495dSmrg\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
5572*36ac495dSmrg  \suppressfirstparagraphindent}
5573*36ac495dSmrg\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
5574*36ac495dSmrg  \suppressfirstparagraphindent}
5575*36ac495dSmrg
5576*36ac495dSmrg% These macros generate a chapter, section, etc. heading only
5577*36ac495dSmrg% (including whitespace, linebreaking, etc. around it),
5578*36ac495dSmrg% given all the information in convenient, parsed form.
5579*36ac495dSmrg
5580*36ac495dSmrg% Args are the skip and penalty (usually negative)
5581*36ac495dSmrg\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
5582*36ac495dSmrg
5583*36ac495dSmrg% Parameter controlling skip before chapter headings (if needed)
5584*36ac495dSmrg\newskip\chapheadingskip
5585*36ac495dSmrg
5586*36ac495dSmrg% Define plain chapter starts, and page on/off switching for it.
5587*36ac495dSmrg\def\chapbreak{\dobreak \chapheadingskip {-4000}}
5588*36ac495dSmrg\def\chappager{\par\vfill\supereject}
5589*36ac495dSmrg% Because \domark is called before \chapoddpage, the filler page will
5590*36ac495dSmrg% get the headings for the next chapter, which is wrong.  But we don't
5591*36ac495dSmrg% care -- we just disable all headings on the filler page.
5592*36ac495dSmrg\def\chapoddpage{%
5593*36ac495dSmrg  \chappager
5594*36ac495dSmrg  \ifodd\pageno \else
5595*36ac495dSmrg    \begingroup
5596*36ac495dSmrg      \headingsoff
5597*36ac495dSmrg      \null
5598*36ac495dSmrg      \chappager
5599*36ac495dSmrg    \endgroup
5600*36ac495dSmrg  \fi
5601*36ac495dSmrg}
5602*36ac495dSmrg
5603*36ac495dSmrg\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
5604*36ac495dSmrg
5605*36ac495dSmrg\def\CHAPPAGoff{%
5606*36ac495dSmrg\global\let\contentsalignmacro = \chappager
5607*36ac495dSmrg\global\let\pchapsepmacro=\chapbreak
5608*36ac495dSmrg\global\let\pagealignmacro=\chappager}
5609*36ac495dSmrg
5610*36ac495dSmrg\def\CHAPPAGon{%
5611*36ac495dSmrg\global\let\contentsalignmacro = \chappager
5612*36ac495dSmrg\global\let\pchapsepmacro=\chappager
5613*36ac495dSmrg\global\let\pagealignmacro=\chappager
5614*36ac495dSmrg\global\def\HEADINGSon{\HEADINGSsingle}}
5615*36ac495dSmrg
5616*36ac495dSmrg\def\CHAPPAGodd{%
5617*36ac495dSmrg\global\let\contentsalignmacro = \chapoddpage
5618*36ac495dSmrg\global\let\pchapsepmacro=\chapoddpage
5619*36ac495dSmrg\global\let\pagealignmacro=\chapoddpage
5620*36ac495dSmrg\global\def\HEADINGSon{\HEADINGSdouble}}
5621*36ac495dSmrg
5622*36ac495dSmrg\CHAPPAGon
5623*36ac495dSmrg
5624*36ac495dSmrg% Chapter opening.
5625*36ac495dSmrg%
5626*36ac495dSmrg% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
5627*36ac495dSmrg% Yappendix, Yomitfromtoc), #3 the chapter number.
5628*36ac495dSmrg%
5629*36ac495dSmrg% To test against our argument.
5630*36ac495dSmrg\def\Ynothingkeyword{Ynothing}
5631*36ac495dSmrg\def\Yomitfromtockeyword{Yomitfromtoc}
5632*36ac495dSmrg\def\Yappendixkeyword{Yappendix}
5633*36ac495dSmrg%
5634*36ac495dSmrg\def\chapmacro#1#2#3{%
5635*36ac495dSmrg  % Insert the first mark before the heading break (see notes for \domark).
5636*36ac495dSmrg  \let\prevchapterdefs=\lastchapterdefs
5637*36ac495dSmrg  \let\prevsectiondefs=\lastsectiondefs
5638*36ac495dSmrg  \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
5639*36ac495dSmrg                        \gdef\thissection{}}%
5640*36ac495dSmrg  %
5641*36ac495dSmrg  \def\temptype{#2}%
5642*36ac495dSmrg  \ifx\temptype\Ynothingkeyword
5643*36ac495dSmrg    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5644*36ac495dSmrg                          \gdef\thischapter{\thischaptername}}%
5645*36ac495dSmrg  \else\ifx\temptype\Yomitfromtockeyword
5646*36ac495dSmrg    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5647*36ac495dSmrg                          \gdef\thischapter{}}%
5648*36ac495dSmrg  \else\ifx\temptype\Yappendixkeyword
5649*36ac495dSmrg    \toks0={#1}%
5650*36ac495dSmrg    \xdef\lastchapterdefs{%
5651*36ac495dSmrg      \gdef\noexpand\thischaptername{\the\toks0}%
5652*36ac495dSmrg      \gdef\noexpand\thischapternum{\appendixletter}%
5653*36ac495dSmrg      % \noexpand\putwordAppendix avoids expanding indigestible
5654*36ac495dSmrg      % commands in some of the translations.
5655*36ac495dSmrg      \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
5656*36ac495dSmrg                                 \noexpand\thischapternum:
5657*36ac495dSmrg                                 \noexpand\thischaptername}%
5658*36ac495dSmrg    }%
5659*36ac495dSmrg  \else
5660*36ac495dSmrg    \toks0={#1}%
5661*36ac495dSmrg    \xdef\lastchapterdefs{%
5662*36ac495dSmrg      \gdef\noexpand\thischaptername{\the\toks0}%
5663*36ac495dSmrg      \gdef\noexpand\thischapternum{\the\chapno}%
5664*36ac495dSmrg      % \noexpand\putwordChapter avoids expanding indigestible
5665*36ac495dSmrg      % commands in some of the translations.
5666*36ac495dSmrg      \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
5667*36ac495dSmrg                                 \noexpand\thischapternum:
5668*36ac495dSmrg                                 \noexpand\thischaptername}%
5669*36ac495dSmrg    }%
5670*36ac495dSmrg  \fi\fi\fi
5671*36ac495dSmrg  %
5672*36ac495dSmrg  % Output the mark.  Pass it through \safewhatsit, to take care of
5673*36ac495dSmrg  % the preceding space.
5674*36ac495dSmrg  \safewhatsit\domark
5675*36ac495dSmrg  %
5676*36ac495dSmrg  % Insert the chapter heading break.
5677*36ac495dSmrg  \pchapsepmacro
5678*36ac495dSmrg  %
5679*36ac495dSmrg  % Now the second mark, after the heading break.  No break points
5680*36ac495dSmrg  % between here and the heading.
5681*36ac495dSmrg  \let\prevchapterdefs=\lastchapterdefs
5682*36ac495dSmrg  \let\prevsectiondefs=\lastsectiondefs
5683*36ac495dSmrg  \domark
5684*36ac495dSmrg  %
5685*36ac495dSmrg  {%
5686*36ac495dSmrg    \chapfonts \rmisbold
5687*36ac495dSmrg    %
5688*36ac495dSmrg    % Have to define \lastsection before calling \donoderef, because the
5689*36ac495dSmrg    % xref code eventually uses it.  On the other hand, it has to be called
5690*36ac495dSmrg    % after \pchapsepmacro, or the headline will change too soon.
5691*36ac495dSmrg    \gdef\lastsection{#1}%
5692*36ac495dSmrg    %
5693*36ac495dSmrg    % Only insert the separating space if we have a chapter/appendix
5694*36ac495dSmrg    % number, and don't print the unnumbered ``number''.
5695*36ac495dSmrg    \ifx\temptype\Ynothingkeyword
5696*36ac495dSmrg      \setbox0 = \hbox{}%
5697*36ac495dSmrg      \def\toctype{unnchap}%
5698*36ac495dSmrg    \else\ifx\temptype\Yomitfromtockeyword
5699*36ac495dSmrg      \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
5700*36ac495dSmrg      \def\toctype{omit}%
5701*36ac495dSmrg    \else\ifx\temptype\Yappendixkeyword
5702*36ac495dSmrg      \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
5703*36ac495dSmrg      \def\toctype{app}%
5704*36ac495dSmrg    \else
5705*36ac495dSmrg      \setbox0 = \hbox{#3\enspace}%
5706*36ac495dSmrg      \def\toctype{numchap}%
5707*36ac495dSmrg    \fi\fi\fi
5708*36ac495dSmrg    %
5709*36ac495dSmrg    % Write the toc entry for this chapter.  Must come before the
5710*36ac495dSmrg    % \donoderef, because we include the current node name in the toc
5711*36ac495dSmrg    % entry, and \donoderef resets it to empty.
5712*36ac495dSmrg    \writetocentry{\toctype}{#1}{#3}%
5713*36ac495dSmrg    %
5714*36ac495dSmrg    % For pdftex, we have to write out the node definition (aka, make
5715*36ac495dSmrg    % the pdfdest) after any page break, but before the actual text has
5716*36ac495dSmrg    % been typeset.  If the destination for the pdf outline is after the
5717*36ac495dSmrg    % text, then jumping from the outline may wind up with the text not
5718*36ac495dSmrg    % being visible, for instance under high magnification.
5719*36ac495dSmrg    \donoderef{#2}%
5720*36ac495dSmrg    %
5721*36ac495dSmrg    % Typeset the actual heading.
5722*36ac495dSmrg    \nobreak % Avoid page breaks at the interline glue.
5723*36ac495dSmrg    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
5724*36ac495dSmrg          \hangindent=\wd0 \centerparametersmaybe
5725*36ac495dSmrg          \unhbox0 #1\par}%
5726*36ac495dSmrg  }%
5727*36ac495dSmrg  \nobreak\bigskip % no page break after a chapter title
5728*36ac495dSmrg  \nobreak
5729*36ac495dSmrg}
5730*36ac495dSmrg
5731*36ac495dSmrg% @centerchap -- centered and unnumbered.
5732*36ac495dSmrg\let\centerparametersmaybe = \relax
5733*36ac495dSmrg\def\centerparameters{%
5734*36ac495dSmrg  \advance\rightskip by 3\rightskip
5735*36ac495dSmrg  \leftskip = \rightskip
5736*36ac495dSmrg  \parfillskip = 0pt
5737*36ac495dSmrg}
5738*36ac495dSmrg
5739*36ac495dSmrg
5740*36ac495dSmrg% I don't think this chapter style is supported any more, so I'm not
5741*36ac495dSmrg% updating it with the new noderef stuff.  We'll see.  --karl, 11aug03.
5742*36ac495dSmrg%
5743*36ac495dSmrg\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
5744*36ac495dSmrg%
5745*36ac495dSmrg\def\unnchfopen #1{%
5746*36ac495dSmrg\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5747*36ac495dSmrg                       \parindent=0pt\ptexraggedright
5748*36ac495dSmrg                       \rmisbold #1\hfill}}\bigskip \par\nobreak
5749*36ac495dSmrg}
5750*36ac495dSmrg\def\chfopen #1#2{\chapoddpage {\chapfonts
5751*36ac495dSmrg\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
5752*36ac495dSmrg\par\penalty 5000 %
5753*36ac495dSmrg}
5754*36ac495dSmrg\def\centerchfopen #1{%
5755*36ac495dSmrg\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
5756*36ac495dSmrg                       \parindent=0pt
5757*36ac495dSmrg                       \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak
5758*36ac495dSmrg}
5759*36ac495dSmrg\def\CHAPFopen{%
5760*36ac495dSmrg  \global\let\chapmacro=\chfopen
5761*36ac495dSmrg  \global\let\centerchapmacro=\centerchfopen}
5762*36ac495dSmrg
5763*36ac495dSmrg
5764*36ac495dSmrg% Section titles.  These macros combine the section number parts and
5765*36ac495dSmrg% call the generic \sectionheading to do the printing.
5766*36ac495dSmrg%
5767*36ac495dSmrg\newskip\secheadingskip
5768*36ac495dSmrg\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
5769*36ac495dSmrg
5770*36ac495dSmrg% Subsection titles.
5771*36ac495dSmrg\newskip\subsecheadingskip
5772*36ac495dSmrg\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
5773*36ac495dSmrg
5774*36ac495dSmrg% Subsubsection titles.
5775*36ac495dSmrg\def\subsubsecheadingskip{\subsecheadingskip}
5776*36ac495dSmrg\def\subsubsecheadingbreak{\subsecheadingbreak}
5777*36ac495dSmrg
5778*36ac495dSmrg
5779*36ac495dSmrg% Print any size, any type, section title.
5780*36ac495dSmrg%
5781*36ac495dSmrg% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
5782*36ac495dSmrg% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
5783*36ac495dSmrg% section number.
5784*36ac495dSmrg%
5785*36ac495dSmrg\def\seckeyword{sec}
5786*36ac495dSmrg%
5787*36ac495dSmrg\def\sectionheading#1#2#3#4{%
5788*36ac495dSmrg  {%
5789*36ac495dSmrg    \checkenv{}% should not be in an environment.
5790*36ac495dSmrg    %
5791*36ac495dSmrg    % Switch to the right set of fonts.
5792*36ac495dSmrg    \csname #2fonts\endcsname \rmisbold
5793*36ac495dSmrg    %
5794*36ac495dSmrg    \def\sectionlevel{#2}%
5795*36ac495dSmrg    \def\temptype{#3}%
5796*36ac495dSmrg    %
5797*36ac495dSmrg    % Insert first mark before the heading break (see notes for \domark).
5798*36ac495dSmrg    \let\prevsectiondefs=\lastsectiondefs
5799*36ac495dSmrg    \ifx\temptype\Ynothingkeyword
5800*36ac495dSmrg      \ifx\sectionlevel\seckeyword
5801*36ac495dSmrg        \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
5802*36ac495dSmrg                              \gdef\thissection{\thissectionname}}%
5803*36ac495dSmrg      \fi
5804*36ac495dSmrg    \else\ifx\temptype\Yomitfromtockeyword
5805*36ac495dSmrg      % Don't redefine \thissection.
5806*36ac495dSmrg    \else\ifx\temptype\Yappendixkeyword
5807*36ac495dSmrg      \ifx\sectionlevel\seckeyword
5808*36ac495dSmrg        \toks0={#1}%
5809*36ac495dSmrg        \xdef\lastsectiondefs{%
5810*36ac495dSmrg          \gdef\noexpand\thissectionname{\the\toks0}%
5811*36ac495dSmrg          \gdef\noexpand\thissectionnum{#4}%
5812*36ac495dSmrg          % \noexpand\putwordSection avoids expanding indigestible
5813*36ac495dSmrg          % commands in some of the translations.
5814*36ac495dSmrg          \gdef\noexpand\thissection{\noexpand\putwordSection{}
5815*36ac495dSmrg                                     \noexpand\thissectionnum:
5816*36ac495dSmrg                                     \noexpand\thissectionname}%
5817*36ac495dSmrg        }%
5818*36ac495dSmrg      \fi
5819*36ac495dSmrg    \else
5820*36ac495dSmrg      \ifx\sectionlevel\seckeyword
5821*36ac495dSmrg        \toks0={#1}%
5822*36ac495dSmrg        \xdef\lastsectiondefs{%
5823*36ac495dSmrg          \gdef\noexpand\thissectionname{\the\toks0}%
5824*36ac495dSmrg          \gdef\noexpand\thissectionnum{#4}%
5825*36ac495dSmrg          % \noexpand\putwordSection avoids expanding indigestible
5826*36ac495dSmrg          % commands in some of the translations.
5827*36ac495dSmrg          \gdef\noexpand\thissection{\noexpand\putwordSection{}
5828*36ac495dSmrg                                     \noexpand\thissectionnum:
5829*36ac495dSmrg                                     \noexpand\thissectionname}%
5830*36ac495dSmrg        }%
5831*36ac495dSmrg      \fi
5832*36ac495dSmrg    \fi\fi\fi
5833*36ac495dSmrg    %
5834*36ac495dSmrg    % Go into vertical mode.  Usually we'll already be there, but we
5835*36ac495dSmrg    % don't want the following whatsit to end up in a preceding paragraph
5836*36ac495dSmrg    % if the document didn't happen to have a blank line.
5837*36ac495dSmrg    \par
5838*36ac495dSmrg    %
5839*36ac495dSmrg    % Output the mark.  Pass it through \safewhatsit, to take care of
5840*36ac495dSmrg    % the preceding space.
5841*36ac495dSmrg    \safewhatsit\domark
5842*36ac495dSmrg    %
5843*36ac495dSmrg    % Insert space above the heading.
5844*36ac495dSmrg    \csname #2headingbreak\endcsname
5845*36ac495dSmrg    %
5846*36ac495dSmrg    % Now the second mark, after the heading break.  No break points
5847*36ac495dSmrg    % between here and the heading.
5848*36ac495dSmrg    \let\prevsectiondefs=\lastsectiondefs
5849*36ac495dSmrg    \domark
5850*36ac495dSmrg    %
5851*36ac495dSmrg    % Only insert the space after the number if we have a section number.
5852*36ac495dSmrg    \ifx\temptype\Ynothingkeyword
5853*36ac495dSmrg      \setbox0 = \hbox{}%
5854*36ac495dSmrg      \def\toctype{unn}%
5855*36ac495dSmrg      \gdef\lastsection{#1}%
5856*36ac495dSmrg    \else\ifx\temptype\Yomitfromtockeyword
5857*36ac495dSmrg      % for @headings -- no section number, don't include in toc,
5858*36ac495dSmrg      % and don't redefine \lastsection.
5859*36ac495dSmrg      \setbox0 = \hbox{}%
5860*36ac495dSmrg      \def\toctype{omit}%
5861*36ac495dSmrg      \let\sectionlevel=\empty
5862*36ac495dSmrg    \else\ifx\temptype\Yappendixkeyword
5863*36ac495dSmrg      \setbox0 = \hbox{#4\enspace}%
5864*36ac495dSmrg      \def\toctype{app}%
5865*36ac495dSmrg      \gdef\lastsection{#1}%
5866*36ac495dSmrg    \else
5867*36ac495dSmrg      \setbox0 = \hbox{#4\enspace}%
5868*36ac495dSmrg      \def\toctype{num}%
5869*36ac495dSmrg      \gdef\lastsection{#1}%
5870*36ac495dSmrg    \fi\fi\fi
5871*36ac495dSmrg    %
5872*36ac495dSmrg    % Write the toc entry (before \donoderef).  See comments in \chapmacro.
5873*36ac495dSmrg    \writetocentry{\toctype\sectionlevel}{#1}{#4}%
5874*36ac495dSmrg    %
5875*36ac495dSmrg    % Write the node reference (= pdf destination for pdftex).
5876*36ac495dSmrg    % Again, see comments in \chapmacro.
5877*36ac495dSmrg    \donoderef{#3}%
5878*36ac495dSmrg    %
5879*36ac495dSmrg    % Interline glue will be inserted when the vbox is completed.
5880*36ac495dSmrg    % That glue will be a valid breakpoint for the page, since it'll be
5881*36ac495dSmrg    % preceded by a whatsit (usually from the \donoderef, or from the
5882*36ac495dSmrg    % \writetocentry if there was no node).  We don't want to allow that
5883*36ac495dSmrg    % break, since then the whatsits could end up on page n while the
5884*36ac495dSmrg    % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
5885*36ac495dSmrg    \nobreak
5886*36ac495dSmrg    %
5887*36ac495dSmrg    % Output the actual section heading.
5888*36ac495dSmrg    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
5889*36ac495dSmrg          \hangindent=\wd0  % zero if no section number
5890*36ac495dSmrg          \unhbox0 #1}%
5891*36ac495dSmrg  }%
5892*36ac495dSmrg  % Add extra space after the heading -- half of whatever came above it.
5893*36ac495dSmrg  % Don't allow stretch, though.
5894*36ac495dSmrg  \kern .5 \csname #2headingskip\endcsname
5895*36ac495dSmrg  %
5896*36ac495dSmrg  % Do not let the kern be a potential breakpoint, as it would be if it
5897*36ac495dSmrg  % was followed by glue.
5898*36ac495dSmrg  \nobreak
5899*36ac495dSmrg  %
5900*36ac495dSmrg  % We'll almost certainly start a paragraph next, so don't let that
5901*36ac495dSmrg  % glue accumulate.  (Not a breakpoint because it's preceded by a
5902*36ac495dSmrg  % discardable item.)  However, when a paragraph is not started next
5903*36ac495dSmrg  % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
5904*36ac495dSmrg  % or the negative glue will cause weirdly wrong output, typically
5905*36ac495dSmrg  % obscuring the section heading with something else.
5906*36ac495dSmrg  \vskip-\parskip
5907*36ac495dSmrg  %
5908*36ac495dSmrg  % This is so the last item on the main vertical list is a known
5909*36ac495dSmrg  % \penalty > 10000, so \startdefun, etc., can recognize the situation
5910*36ac495dSmrg  % and do the needful.
5911*36ac495dSmrg  \penalty 10001
5912*36ac495dSmrg}
5913*36ac495dSmrg
5914*36ac495dSmrg
5915*36ac495dSmrg\message{toc,}
5916*36ac495dSmrg% Table of contents.
5917*36ac495dSmrg\newwrite\tocfile
5918*36ac495dSmrg
5919*36ac495dSmrg% Write an entry to the toc file, opening it if necessary.
5920*36ac495dSmrg% Called from @chapter, etc.
5921*36ac495dSmrg%
5922*36ac495dSmrg% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
5923*36ac495dSmrg% We append the current node name (if any) and page number as additional
5924*36ac495dSmrg% arguments for the \{chap,sec,...}entry macros which will eventually
5925*36ac495dSmrg% read this.  The node name is used in the pdf outlines as the
5926*36ac495dSmrg% destination to jump to.
5927*36ac495dSmrg%
5928*36ac495dSmrg% We open the .toc file for writing here instead of at @setfilename (or
5929*36ac495dSmrg% any other fixed time) so that @contents can be anywhere in the document.
5930*36ac495dSmrg% But if #1 is `omit', then we don't do anything.  This is used for the
5931*36ac495dSmrg% table of contents chapter openings themselves.
5932*36ac495dSmrg%
5933*36ac495dSmrg\newif\iftocfileopened
5934*36ac495dSmrg\def\omitkeyword{omit}%
5935*36ac495dSmrg%
5936*36ac495dSmrg\def\writetocentry#1#2#3{%
5937*36ac495dSmrg  \edef\writetoctype{#1}%
5938*36ac495dSmrg  \ifx\writetoctype\omitkeyword \else
5939*36ac495dSmrg    \iftocfileopened\else
5940*36ac495dSmrg      \immediate\openout\tocfile = \jobname.toc
5941*36ac495dSmrg      \global\tocfileopenedtrue
5942*36ac495dSmrg    \fi
5943*36ac495dSmrg    %
5944*36ac495dSmrg    \iflinks
5945*36ac495dSmrg      {\atdummies
5946*36ac495dSmrg       \edef\temp{%
5947*36ac495dSmrg         \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
5948*36ac495dSmrg       \temp
5949*36ac495dSmrg      }%
5950*36ac495dSmrg    \fi
5951*36ac495dSmrg  \fi
5952*36ac495dSmrg  %
5953*36ac495dSmrg  % Tell \shipout to create a pdf destination on each page, if we're
5954*36ac495dSmrg  % writing pdf.  These are used in the table of contents.  We can't
5955*36ac495dSmrg  % just write one on every page because the title pages are numbered
5956*36ac495dSmrg  % 1 and 2 (the page numbers aren't printed), and so are the first
5957*36ac495dSmrg  % two pages of the document.  Thus, we'd have two destinations named
5958*36ac495dSmrg  % `1', and two named `2'.
5959*36ac495dSmrg  \ifpdf \global\pdfmakepagedesttrue \fi
5960*36ac495dSmrg}
5961*36ac495dSmrg
5962*36ac495dSmrg
5963*36ac495dSmrg% These characters do not print properly in the Computer Modern roman
5964*36ac495dSmrg% fonts, so we must take special care.  This is more or less redundant
5965*36ac495dSmrg% with the Texinfo input format setup at the end of this file.
5966*36ac495dSmrg%
5967*36ac495dSmrg\def\activecatcodes{%
5968*36ac495dSmrg  \catcode`\"=\active
5969*36ac495dSmrg  \catcode`\$=\active
5970*36ac495dSmrg  \catcode`\<=\active
5971*36ac495dSmrg  \catcode`\>=\active
5972*36ac495dSmrg  \catcode`\\=\active
5973*36ac495dSmrg  \catcode`\^=\active
5974*36ac495dSmrg  \catcode`\_=\active
5975*36ac495dSmrg  \catcode`\|=\active
5976*36ac495dSmrg  \catcode`\~=\active
5977*36ac495dSmrg}
5978*36ac495dSmrg
5979*36ac495dSmrg
5980*36ac495dSmrg% Read the toc file, which is essentially Texinfo input.
5981*36ac495dSmrg\def\readtocfile{%
5982*36ac495dSmrg  \setupdatafile
5983*36ac495dSmrg  \activecatcodes
5984*36ac495dSmrg  \input \tocreadfilename
5985*36ac495dSmrg}
5986*36ac495dSmrg
5987*36ac495dSmrg\newskip\contentsrightmargin \contentsrightmargin=1in
5988*36ac495dSmrg\newcount\savepageno
5989*36ac495dSmrg\newcount\lastnegativepageno \lastnegativepageno = -1
5990*36ac495dSmrg
5991*36ac495dSmrg% Prepare to read what we've written to \tocfile.
5992*36ac495dSmrg%
5993*36ac495dSmrg\def\startcontents#1{%
5994*36ac495dSmrg  % If @setchapternewpage on, and @headings double, the contents should
5995*36ac495dSmrg  % start on an odd page, unlike chapters.  Thus, we maintain
5996*36ac495dSmrg  % \contentsalignmacro in parallel with \pagealignmacro.
5997*36ac495dSmrg  % From: Torbjorn Granlund <tege@matematik.su.se>
5998*36ac495dSmrg  \contentsalignmacro
5999*36ac495dSmrg  \immediate\closeout\tocfile
6000*36ac495dSmrg  %
6001*36ac495dSmrg  % Don't need to put `Contents' or `Short Contents' in the headline.
6002*36ac495dSmrg  % It is abundantly clear what they are.
6003*36ac495dSmrg  \chapmacro{#1}{Yomitfromtoc}{}%
6004*36ac495dSmrg  %
6005*36ac495dSmrg  \savepageno = \pageno
6006*36ac495dSmrg  \begingroup                  % Set up to handle contents files properly.
6007*36ac495dSmrg    \raggedbottom              % Worry more about breakpoints than the bottom.
6008*36ac495dSmrg    \advance\hsize by -\contentsrightmargin % Don't use the full line length.
6009*36ac495dSmrg    %
6010*36ac495dSmrg    % Roman numerals for page numbers.
6011*36ac495dSmrg    \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6012*36ac495dSmrg}
6013*36ac495dSmrg
6014*36ac495dSmrg% redefined for the two-volume lispref.  We always output on
6015*36ac495dSmrg% \jobname.toc even if this is redefined.
6016*36ac495dSmrg%
6017*36ac495dSmrg\def\tocreadfilename{\jobname.toc}
6018*36ac495dSmrg
6019*36ac495dSmrg% Normal (long) toc.
6020*36ac495dSmrg%
6021*36ac495dSmrg\def\contents{%
6022*36ac495dSmrg  \startcontents{\putwordTOC}%
6023*36ac495dSmrg    \openin 1 \tocreadfilename\space
6024*36ac495dSmrg    \ifeof 1 \else
6025*36ac495dSmrg      \readtocfile
6026*36ac495dSmrg    \fi
6027*36ac495dSmrg    \vfill \eject
6028*36ac495dSmrg    \contentsalignmacro % in case @setchapternewpage odd is in effect
6029*36ac495dSmrg    \ifeof 1 \else
6030*36ac495dSmrg      \pdfmakeoutlines
6031*36ac495dSmrg    \fi
6032*36ac495dSmrg    \closein 1
6033*36ac495dSmrg  \endgroup
6034*36ac495dSmrg  \lastnegativepageno = \pageno
6035*36ac495dSmrg  \global\pageno = \savepageno
6036*36ac495dSmrg}
6037*36ac495dSmrg
6038*36ac495dSmrg% And just the chapters.
6039*36ac495dSmrg\def\summarycontents{%
6040*36ac495dSmrg  \startcontents{\putwordShortTOC}%
6041*36ac495dSmrg    %
6042*36ac495dSmrg    \let\partentry = \shortpartentry
6043*36ac495dSmrg    \let\numchapentry = \shortchapentry
6044*36ac495dSmrg    \let\appentry = \shortchapentry
6045*36ac495dSmrg    \let\unnchapentry = \shortunnchapentry
6046*36ac495dSmrg    % We want a true roman here for the page numbers.
6047*36ac495dSmrg    \secfonts
6048*36ac495dSmrg    \let\rm=\shortcontrm \let\bf=\shortcontbf
6049*36ac495dSmrg    \let\sl=\shortcontsl \let\tt=\shortconttt
6050*36ac495dSmrg    \rm
6051*36ac495dSmrg    \hyphenpenalty = 10000
6052*36ac495dSmrg    \advance\baselineskip by 1pt % Open it up a little.
6053*36ac495dSmrg    \def\numsecentry##1##2##3##4{}
6054*36ac495dSmrg    \let\appsecentry = \numsecentry
6055*36ac495dSmrg    \let\unnsecentry = \numsecentry
6056*36ac495dSmrg    \let\numsubsecentry = \numsecentry
6057*36ac495dSmrg    \let\appsubsecentry = \numsecentry
6058*36ac495dSmrg    \let\unnsubsecentry = \numsecentry
6059*36ac495dSmrg    \let\numsubsubsecentry = \numsecentry
6060*36ac495dSmrg    \let\appsubsubsecentry = \numsecentry
6061*36ac495dSmrg    \let\unnsubsubsecentry = \numsecentry
6062*36ac495dSmrg    \openin 1 \tocreadfilename\space
6063*36ac495dSmrg    \ifeof 1 \else
6064*36ac495dSmrg      \readtocfile
6065*36ac495dSmrg    \fi
6066*36ac495dSmrg    \closein 1
6067*36ac495dSmrg    \vfill \eject
6068*36ac495dSmrg    \contentsalignmacro % in case @setchapternewpage odd is in effect
6069*36ac495dSmrg  \endgroup
6070*36ac495dSmrg  \lastnegativepageno = \pageno
6071*36ac495dSmrg  \global\pageno = \savepageno
6072*36ac495dSmrg}
6073*36ac495dSmrg\let\shortcontents = \summarycontents
6074*36ac495dSmrg
6075*36ac495dSmrg% Typeset the label for a chapter or appendix for the short contents.
6076*36ac495dSmrg% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6077*36ac495dSmrg%
6078*36ac495dSmrg\def\shortchaplabel#1{%
6079*36ac495dSmrg  % This space should be enough, since a single number is .5em, and the
6080*36ac495dSmrg  % widest letter (M) is 1em, at least in the Computer Modern fonts.
6081*36ac495dSmrg  % But use \hss just in case.
6082*36ac495dSmrg  % (This space doesn't include the extra space that gets added after
6083*36ac495dSmrg  % the label; that gets put in by \shortchapentry above.)
6084*36ac495dSmrg  %
6085*36ac495dSmrg  % We'd like to right-justify chapter numbers, but that looks strange
6086*36ac495dSmrg  % with appendix letters.  And right-justifying numbers and
6087*36ac495dSmrg  % left-justifying letters looks strange when there is less than 10
6088*36ac495dSmrg  % chapters.  Have to read the whole toc once to know how many chapters
6089*36ac495dSmrg  % there are before deciding ...
6090*36ac495dSmrg  \hbox to 1em{#1\hss}%
6091*36ac495dSmrg}
6092*36ac495dSmrg
6093*36ac495dSmrg% These macros generate individual entries in the table of contents.
6094*36ac495dSmrg% The first argument is the chapter or section name.
6095*36ac495dSmrg% The last argument is the page number.
6096*36ac495dSmrg% The arguments in between are the chapter number, section number, ...
6097*36ac495dSmrg
6098*36ac495dSmrg% Parts, in the main contents.  Replace the part number, which doesn't
6099*36ac495dSmrg% exist, with an empty box.  Let's hope all the numbers have the same width.
6100*36ac495dSmrg% Also ignore the page number, which is conventionally not printed.
6101*36ac495dSmrg\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6102*36ac495dSmrg\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6103*36ac495dSmrg%
6104*36ac495dSmrg% Parts, in the short toc.
6105*36ac495dSmrg\def\shortpartentry#1#2#3#4{%
6106*36ac495dSmrg  \penalty-300
6107*36ac495dSmrg  \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6108*36ac495dSmrg  \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6109*36ac495dSmrg}
6110*36ac495dSmrg
6111*36ac495dSmrg% Chapters, in the main contents.
6112*36ac495dSmrg\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6113*36ac495dSmrg%
6114*36ac495dSmrg% Chapters, in the short toc.
6115*36ac495dSmrg% See comments in \dochapentry re vbox and related settings.
6116*36ac495dSmrg\def\shortchapentry#1#2#3#4{%
6117*36ac495dSmrg  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6118*36ac495dSmrg}
6119*36ac495dSmrg
6120*36ac495dSmrg% Appendices, in the main contents.
6121*36ac495dSmrg% Need the word Appendix, and a fixed-size box.
6122*36ac495dSmrg%
6123*36ac495dSmrg\def\appendixbox#1{%
6124*36ac495dSmrg  % We use M since it's probably the widest letter.
6125*36ac495dSmrg  \setbox0 = \hbox{\putwordAppendix{} M}%
6126*36ac495dSmrg  \hbox to \wd0{\putwordAppendix{} #1\hss}}
6127*36ac495dSmrg%
6128*36ac495dSmrg\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
6129*36ac495dSmrg
6130*36ac495dSmrg% Unnumbered chapters.
6131*36ac495dSmrg\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6132*36ac495dSmrg\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6133*36ac495dSmrg
6134*36ac495dSmrg% Sections.
6135*36ac495dSmrg\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6136*36ac495dSmrg\let\appsecentry=\numsecentry
6137*36ac495dSmrg\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6138*36ac495dSmrg
6139*36ac495dSmrg% Subsections.
6140*36ac495dSmrg\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6141*36ac495dSmrg\let\appsubsecentry=\numsubsecentry
6142*36ac495dSmrg\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6143*36ac495dSmrg
6144*36ac495dSmrg% And subsubsections.
6145*36ac495dSmrg\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6146*36ac495dSmrg\let\appsubsubsecentry=\numsubsubsecentry
6147*36ac495dSmrg\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6148*36ac495dSmrg
6149*36ac495dSmrg% This parameter controls the indentation of the various levels.
6150*36ac495dSmrg% Same as \defaultparindent.
6151*36ac495dSmrg\newdimen\tocindent \tocindent = 15pt
6152*36ac495dSmrg
6153*36ac495dSmrg% Now for the actual typesetting. In all these, #1 is the text and #2 is the
6154*36ac495dSmrg% page number.
6155*36ac495dSmrg%
6156*36ac495dSmrg% If the toc has to be broken over pages, we want it to be at chapters
6157*36ac495dSmrg% if at all possible; hence the \penalty.
6158*36ac495dSmrg\def\dochapentry#1#2{%
6159*36ac495dSmrg   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6160*36ac495dSmrg   \begingroup
6161*36ac495dSmrg     \chapentryfonts
6162*36ac495dSmrg     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6163*36ac495dSmrg   \endgroup
6164*36ac495dSmrg   \nobreak\vskip .25\baselineskip plus.1\baselineskip
6165*36ac495dSmrg}
6166*36ac495dSmrg
6167*36ac495dSmrg\def\dosecentry#1#2{\begingroup
6168*36ac495dSmrg  \secentryfonts \leftskip=\tocindent
6169*36ac495dSmrg  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6170*36ac495dSmrg\endgroup}
6171*36ac495dSmrg
6172*36ac495dSmrg\def\dosubsecentry#1#2{\begingroup
6173*36ac495dSmrg  \subsecentryfonts \leftskip=2\tocindent
6174*36ac495dSmrg  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6175*36ac495dSmrg\endgroup}
6176*36ac495dSmrg
6177*36ac495dSmrg\def\dosubsubsecentry#1#2{\begingroup
6178*36ac495dSmrg  \subsubsecentryfonts \leftskip=3\tocindent
6179*36ac495dSmrg  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6180*36ac495dSmrg\endgroup}
6181*36ac495dSmrg
6182*36ac495dSmrg% We use the same \entry macro as for the index entries.
6183*36ac495dSmrg\let\tocentry = \entry
6184*36ac495dSmrg
6185*36ac495dSmrg% Space between chapter (or whatever) number and the title.
6186*36ac495dSmrg\def\labelspace{\hskip1em \relax}
6187*36ac495dSmrg
6188*36ac495dSmrg\def\dopageno#1{{\rm #1}}
6189*36ac495dSmrg\def\doshortpageno#1{{\rm #1}}
6190*36ac495dSmrg
6191*36ac495dSmrg\def\chapentryfonts{\secfonts \rm}
6192*36ac495dSmrg\def\secentryfonts{\textfonts}
6193*36ac495dSmrg\def\subsecentryfonts{\textfonts}
6194*36ac495dSmrg\def\subsubsecentryfonts{\textfonts}
6195*36ac495dSmrg
6196*36ac495dSmrg
6197*36ac495dSmrg\message{environments,}
6198*36ac495dSmrg% @foo ... @end foo.
6199*36ac495dSmrg
6200*36ac495dSmrg% @tex ... @end tex    escapes into raw TeX temporarily.
6201*36ac495dSmrg% One exception: @ is still an escape character, so that @end tex works.
6202*36ac495dSmrg% But \@ or @@ will get a plain @ character.
6203*36ac495dSmrg
6204*36ac495dSmrg\envdef\tex{%
6205*36ac495dSmrg  \setupmarkupstyle{tex}%
6206*36ac495dSmrg  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6207*36ac495dSmrg  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6208*36ac495dSmrg  \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6209*36ac495dSmrg  \catcode `\%=14
6210*36ac495dSmrg  \catcode `\+=\other
6211*36ac495dSmrg  \catcode `\"=\other
6212*36ac495dSmrg  \catcode `\|=\other
6213*36ac495dSmrg  \catcode `\<=\other
6214*36ac495dSmrg  \catcode `\>=\other
6215*36ac495dSmrg  \catcode`\`=\other
6216*36ac495dSmrg  \catcode`\'=\other
6217*36ac495dSmrg  \escapechar=`\\
6218*36ac495dSmrg  %
6219*36ac495dSmrg  % ' is active in math mode (mathcode"8000).  So reset it, and all our
6220*36ac495dSmrg  % other math active characters (just in case), to plain's definitions.
6221*36ac495dSmrg  \mathactive
6222*36ac495dSmrg  %
6223*36ac495dSmrg  \let\b=\ptexb
6224*36ac495dSmrg  \let\bullet=\ptexbullet
6225*36ac495dSmrg  \let\c=\ptexc
6226*36ac495dSmrg  \let\,=\ptexcomma
6227*36ac495dSmrg  \let\.=\ptexdot
6228*36ac495dSmrg  \let\dots=\ptexdots
6229*36ac495dSmrg  \let\equiv=\ptexequiv
6230*36ac495dSmrg  \let\!=\ptexexclam
6231*36ac495dSmrg  \let\i=\ptexi
6232*36ac495dSmrg  \let\indent=\ptexindent
6233*36ac495dSmrg  \let\noindent=\ptexnoindent
6234*36ac495dSmrg  \let\{=\ptexlbrace
6235*36ac495dSmrg  \let\+=\tabalign
6236*36ac495dSmrg  \let\}=\ptexrbrace
6237*36ac495dSmrg  \let\/=\ptexslash
6238*36ac495dSmrg  \let\*=\ptexstar
6239*36ac495dSmrg  \let\t=\ptext
6240*36ac495dSmrg  \expandafter \let\csname top\endcsname=\ptextop  % outer
6241*36ac495dSmrg  \let\frenchspacing=\plainfrenchspacing
6242*36ac495dSmrg  %
6243*36ac495dSmrg  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
6244*36ac495dSmrg  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
6245*36ac495dSmrg  \def\@{@}%
6246*36ac495dSmrg}
6247*36ac495dSmrg% There is no need to define \Etex.
6248*36ac495dSmrg
6249*36ac495dSmrg% Define @lisp ... @end lisp.
6250*36ac495dSmrg% @lisp environment forms a group so it can rebind things,
6251*36ac495dSmrg% including the definition of @end lisp (which normally is erroneous).
6252*36ac495dSmrg
6253*36ac495dSmrg% Amount to narrow the margins by for @lisp.
6254*36ac495dSmrg\newskip\lispnarrowing \lispnarrowing=0.4in
6255*36ac495dSmrg
6256*36ac495dSmrg% This is the definition that ^^M gets inside @lisp, @example, and other
6257*36ac495dSmrg% such environments.  \null is better than a space, since it doesn't
6258*36ac495dSmrg% have any width.
6259*36ac495dSmrg\def\lisppar{\null\endgraf}
6260*36ac495dSmrg
6261*36ac495dSmrg% This space is always present above and below environments.
6262*36ac495dSmrg\newskip\envskipamount \envskipamount = 0pt
6263*36ac495dSmrg
6264*36ac495dSmrg% Make spacing and below environment symmetrical.  We use \parskip here
6265*36ac495dSmrg% to help in doing that, since in @example-like environments \parskip
6266*36ac495dSmrg% is reset to zero; thus the \afterenvbreak inserts no space -- but the
6267*36ac495dSmrg% start of the next paragraph will insert \parskip.
6268*36ac495dSmrg%
6269*36ac495dSmrg\def\aboveenvbreak{{%
6270*36ac495dSmrg  % =10000 instead of <10000 because of a special case in \itemzzz and
6271*36ac495dSmrg  % \sectionheading, q.v.
6272*36ac495dSmrg  \ifnum \lastpenalty=10000 \else
6273*36ac495dSmrg    \advance\envskipamount by \parskip
6274*36ac495dSmrg    \endgraf
6275*36ac495dSmrg    \ifdim\lastskip<\envskipamount
6276*36ac495dSmrg      \removelastskip
6277*36ac495dSmrg      % it's not a good place to break if the last penalty was \nobreak
6278*36ac495dSmrg      % or better ...
6279*36ac495dSmrg      \ifnum\lastpenalty<10000 \penalty-50 \fi
6280*36ac495dSmrg      \vskip\envskipamount
6281*36ac495dSmrg    \fi
6282*36ac495dSmrg  \fi
6283*36ac495dSmrg}}
6284*36ac495dSmrg
6285*36ac495dSmrg\let\afterenvbreak = \aboveenvbreak
6286*36ac495dSmrg
6287*36ac495dSmrg% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
6288*36ac495dSmrg% also clear it, so that its embedded environments do the narrowing again.
6289*36ac495dSmrg\let\nonarrowing=\relax
6290*36ac495dSmrg
6291*36ac495dSmrg% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
6292*36ac495dSmrg% environment contents.
6293*36ac495dSmrg\font\circle=lcircle10
6294*36ac495dSmrg\newdimen\circthick
6295*36ac495dSmrg\newdimen\cartouter\newdimen\cartinner
6296*36ac495dSmrg\newskip\normbskip\newskip\normpskip\newskip\normlskip
6297*36ac495dSmrg\circthick=\fontdimen8\circle
6298*36ac495dSmrg%
6299*36ac495dSmrg\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
6300*36ac495dSmrg\def\ctr{{\hskip 6pt\circle\char'010}}
6301*36ac495dSmrg\def\cbl{{\circle\char'012\hskip -6pt}}
6302*36ac495dSmrg\def\cbr{{\hskip 6pt\circle\char'011}}
6303*36ac495dSmrg\def\carttop{\hbox to \cartouter{\hskip\lskip
6304*36ac495dSmrg        \ctl\leaders\hrule height\circthick\hfil\ctr
6305*36ac495dSmrg        \hskip\rskip}}
6306*36ac495dSmrg\def\cartbot{\hbox to \cartouter{\hskip\lskip
6307*36ac495dSmrg        \cbl\leaders\hrule height\circthick\hfil\cbr
6308*36ac495dSmrg        \hskip\rskip}}
6309*36ac495dSmrg%
6310*36ac495dSmrg\newskip\lskip\newskip\rskip
6311*36ac495dSmrg
6312*36ac495dSmrg\envdef\cartouche{%
6313*36ac495dSmrg  \ifhmode\par\fi  % can't be in the midst of a paragraph.
6314*36ac495dSmrg  \startsavinginserts
6315*36ac495dSmrg  \lskip=\leftskip \rskip=\rightskip
6316*36ac495dSmrg  \leftskip=0pt\rightskip=0pt % we want these *outside*.
6317*36ac495dSmrg  \cartinner=\hsize \advance\cartinner by-\lskip
6318*36ac495dSmrg  \advance\cartinner by-\rskip
6319*36ac495dSmrg  \cartouter=\hsize
6320*36ac495dSmrg  \advance\cartouter by 18.4pt	% allow for 3pt kerns on either
6321*36ac495dSmrg				% side, and for 6pt waste from
6322*36ac495dSmrg				% each corner char, and rule thickness
6323*36ac495dSmrg  \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
6324*36ac495dSmrg  % Flag to tell @lisp, etc., not to narrow margin.
6325*36ac495dSmrg  \let\nonarrowing = t%
6326*36ac495dSmrg  %
6327*36ac495dSmrg  % If this cartouche directly follows a sectioning command, we need the
6328*36ac495dSmrg  % \parskip glue (backspaced over by default) or the cartouche can
6329*36ac495dSmrg  % collide with the section heading.
6330*36ac495dSmrg  \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
6331*36ac495dSmrg  %
6332*36ac495dSmrg  \vbox\bgroup
6333*36ac495dSmrg      \baselineskip=0pt\parskip=0pt\lineskip=0pt
6334*36ac495dSmrg      \carttop
6335*36ac495dSmrg      \hbox\bgroup
6336*36ac495dSmrg	  \hskip\lskip
6337*36ac495dSmrg	  \vrule\kern3pt
6338*36ac495dSmrg	  \vbox\bgroup
6339*36ac495dSmrg	      \kern3pt
6340*36ac495dSmrg	      \hsize=\cartinner
6341*36ac495dSmrg	      \baselineskip=\normbskip
6342*36ac495dSmrg	      \lineskip=\normlskip
6343*36ac495dSmrg	      \parskip=\normpskip
6344*36ac495dSmrg	      \vskip -\parskip
6345*36ac495dSmrg	      \comment % For explanation, see the end of def\group.
6346*36ac495dSmrg}
6347*36ac495dSmrg\def\Ecartouche{%
6348*36ac495dSmrg              \ifhmode\par\fi
6349*36ac495dSmrg	      \kern3pt
6350*36ac495dSmrg	  \egroup
6351*36ac495dSmrg	  \kern3pt\vrule
6352*36ac495dSmrg	  \hskip\rskip
6353*36ac495dSmrg      \egroup
6354*36ac495dSmrg      \cartbot
6355*36ac495dSmrg  \egroup
6356*36ac495dSmrg  \checkinserts
6357*36ac495dSmrg}
6358*36ac495dSmrg
6359*36ac495dSmrg
6360*36ac495dSmrg% This macro is called at the beginning of all the @example variants,
6361*36ac495dSmrg% inside a group.
6362*36ac495dSmrg\newdimen\nonfillparindent
6363*36ac495dSmrg\def\nonfillstart{%
6364*36ac495dSmrg  \aboveenvbreak
6365*36ac495dSmrg  \hfuzz = 12pt % Don't be fussy
6366*36ac495dSmrg  \sepspaces % Make spaces be word-separators rather than space tokens.
6367*36ac495dSmrg  \let\par = \lisppar % don't ignore blank lines
6368*36ac495dSmrg  \obeylines % each line of input is a line of output
6369*36ac495dSmrg  \parskip = 0pt
6370*36ac495dSmrg  % Turn off paragraph indentation but redefine \indent to emulate
6371*36ac495dSmrg  % the normal \indent.
6372*36ac495dSmrg  \nonfillparindent=\parindent
6373*36ac495dSmrg  \parindent = 0pt
6374*36ac495dSmrg  \let\indent\nonfillindent
6375*36ac495dSmrg  %
6376*36ac495dSmrg  \emergencystretch = 0pt % don't try to avoid overfull boxes
6377*36ac495dSmrg  \ifx\nonarrowing\relax
6378*36ac495dSmrg    \advance \leftskip by \lispnarrowing
6379*36ac495dSmrg    \exdentamount=\lispnarrowing
6380*36ac495dSmrg  \else
6381*36ac495dSmrg    \let\nonarrowing = \relax
6382*36ac495dSmrg  \fi
6383*36ac495dSmrg  \let\exdent=\nofillexdent
6384*36ac495dSmrg}
6385*36ac495dSmrg
6386*36ac495dSmrg\begingroup
6387*36ac495dSmrg\obeyspaces
6388*36ac495dSmrg% We want to swallow spaces (but not other tokens) after the fake
6389*36ac495dSmrg% @indent in our nonfill-environments, where spaces are normally
6390*36ac495dSmrg% active and set to @tie, resulting in them not being ignored after
6391*36ac495dSmrg% @indent.
6392*36ac495dSmrg\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
6393*36ac495dSmrg\gdef\nonfillindentcheck{%
6394*36ac495dSmrg\ifx\temp %
6395*36ac495dSmrg\expandafter\nonfillindentgobble%
6396*36ac495dSmrg\else%
6397*36ac495dSmrg\leavevmode\nonfillindentbox%
6398*36ac495dSmrg\fi%
6399*36ac495dSmrg}%
6400*36ac495dSmrg\endgroup
6401*36ac495dSmrg\def\nonfillindentgobble#1{\nonfillindent}
6402*36ac495dSmrg\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
6403*36ac495dSmrg
6404*36ac495dSmrg% If you want all examples etc. small: @set dispenvsize small.
6405*36ac495dSmrg% If you want even small examples the full size: @set dispenvsize nosmall.
6406*36ac495dSmrg% This affects the following displayed environments:
6407*36ac495dSmrg%    @example, @display, @format, @lisp
6408*36ac495dSmrg%
6409*36ac495dSmrg\def\smallword{small}
6410*36ac495dSmrg\def\nosmallword{nosmall}
6411*36ac495dSmrg\let\SETdispenvsize\relax
6412*36ac495dSmrg\def\setnormaldispenv{%
6413*36ac495dSmrg  \ifx\SETdispenvsize\smallword
6414*36ac495dSmrg    % end paragraph for sake of leading, in case document has no blank
6415*36ac495dSmrg    % line.  This is redundant with what happens in \aboveenvbreak, but
6416*36ac495dSmrg    % we need to do it before changing the fonts, and it's inconvenient
6417*36ac495dSmrg    % to change the fonts afterward.
6418*36ac495dSmrg    \ifnum \lastpenalty=10000 \else \endgraf \fi
6419*36ac495dSmrg    \smallexamplefonts \rm
6420*36ac495dSmrg  \fi
6421*36ac495dSmrg}
6422*36ac495dSmrg\def\setsmalldispenv{%
6423*36ac495dSmrg  \ifx\SETdispenvsize\nosmallword
6424*36ac495dSmrg  \else
6425*36ac495dSmrg    \ifnum \lastpenalty=10000 \else \endgraf \fi
6426*36ac495dSmrg    \smallexamplefonts \rm
6427*36ac495dSmrg  \fi
6428*36ac495dSmrg}
6429*36ac495dSmrg
6430*36ac495dSmrg% We often define two environments, @foo and @smallfoo.
6431*36ac495dSmrg% Let's do it in one command.  #1 is the env name, #2 the definition.
6432*36ac495dSmrg\def\makedispenvdef#1#2{%
6433*36ac495dSmrg  \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
6434*36ac495dSmrg  \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
6435*36ac495dSmrg  \expandafter\let\csname E#1\endcsname \afterenvbreak
6436*36ac495dSmrg  \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
6437*36ac495dSmrg}
6438*36ac495dSmrg
6439*36ac495dSmrg% Define two environment synonyms (#1 and #2) for an environment.
6440*36ac495dSmrg\def\maketwodispenvdef#1#2#3{%
6441*36ac495dSmrg  \makedispenvdef{#1}{#3}%
6442*36ac495dSmrg  \makedispenvdef{#2}{#3}%
6443*36ac495dSmrg}
6444*36ac495dSmrg%
6445*36ac495dSmrg% @lisp: indented, narrowed, typewriter font;
6446*36ac495dSmrg% @example: same as @lisp.
6447*36ac495dSmrg%
6448*36ac495dSmrg% @smallexample and @smalllisp: use smaller fonts.
6449*36ac495dSmrg% Originally contributed by Pavel@xerox.
6450*36ac495dSmrg%
6451*36ac495dSmrg\maketwodispenvdef{lisp}{example}{%
6452*36ac495dSmrg  \nonfillstart
6453*36ac495dSmrg  \tt\setupmarkupstyle{example}%
6454*36ac495dSmrg  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
6455*36ac495dSmrg  \gobble % eat return
6456*36ac495dSmrg}
6457*36ac495dSmrg% @display/@smalldisplay: same as @lisp except keep current font.
6458*36ac495dSmrg%
6459*36ac495dSmrg\makedispenvdef{display}{%
6460*36ac495dSmrg  \nonfillstart
6461*36ac495dSmrg  \gobble
6462*36ac495dSmrg}
6463*36ac495dSmrg
6464*36ac495dSmrg% @format/@smallformat: same as @display except don't narrow margins.
6465*36ac495dSmrg%
6466*36ac495dSmrg\makedispenvdef{format}{%
6467*36ac495dSmrg  \let\nonarrowing = t%
6468*36ac495dSmrg  \nonfillstart
6469*36ac495dSmrg  \gobble
6470*36ac495dSmrg}
6471*36ac495dSmrg
6472*36ac495dSmrg% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
6473*36ac495dSmrg\envdef\flushleft{%
6474*36ac495dSmrg  \let\nonarrowing = t%
6475*36ac495dSmrg  \nonfillstart
6476*36ac495dSmrg  \gobble
6477*36ac495dSmrg}
6478*36ac495dSmrg\let\Eflushleft = \afterenvbreak
6479*36ac495dSmrg
6480*36ac495dSmrg% @flushright.
6481*36ac495dSmrg%
6482*36ac495dSmrg\envdef\flushright{%
6483*36ac495dSmrg  \let\nonarrowing = t%
6484*36ac495dSmrg  \nonfillstart
6485*36ac495dSmrg  \advance\leftskip by 0pt plus 1fill\relax
6486*36ac495dSmrg  \gobble
6487*36ac495dSmrg}
6488*36ac495dSmrg\let\Eflushright = \afterenvbreak
6489*36ac495dSmrg
6490*36ac495dSmrg
6491*36ac495dSmrg% @raggedright does more-or-less normal line breaking but no right
6492*36ac495dSmrg% justification.  From plain.tex.
6493*36ac495dSmrg\envdef\raggedright{%
6494*36ac495dSmrg  \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
6495*36ac495dSmrg}
6496*36ac495dSmrg\let\Eraggedright\par
6497*36ac495dSmrg
6498*36ac495dSmrg\envdef\raggedleft{%
6499*36ac495dSmrg  \parindent=0pt \leftskip0pt plus2em
6500*36ac495dSmrg  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6501*36ac495dSmrg  \hbadness=10000 % Last line will usually be underfull, so turn off
6502*36ac495dSmrg                  % badness reporting.
6503*36ac495dSmrg}
6504*36ac495dSmrg\let\Eraggedleft\par
6505*36ac495dSmrg
6506*36ac495dSmrg\envdef\raggedcenter{%
6507*36ac495dSmrg  \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
6508*36ac495dSmrg  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6509*36ac495dSmrg  \hbadness=10000 % Last line will usually be underfull, so turn off
6510*36ac495dSmrg                  % badness reporting.
6511*36ac495dSmrg}
6512*36ac495dSmrg\let\Eraggedcenter\par
6513*36ac495dSmrg
6514*36ac495dSmrg
6515*36ac495dSmrg% @quotation does normal linebreaking (hence we can't use \nonfillstart)
6516*36ac495dSmrg% and narrows the margins.  We keep \parskip nonzero in general, since
6517*36ac495dSmrg% we're doing normal filling.  So, when using \aboveenvbreak and
6518*36ac495dSmrg% \afterenvbreak, temporarily make \parskip 0.
6519*36ac495dSmrg%
6520*36ac495dSmrg\makedispenvdef{quotation}{\quotationstart}
6521*36ac495dSmrg%
6522*36ac495dSmrg\def\quotationstart{%
6523*36ac495dSmrg  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
6524*36ac495dSmrg  \parindent=0pt
6525*36ac495dSmrg  %
6526*36ac495dSmrg  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
6527*36ac495dSmrg  \ifx\nonarrowing\relax
6528*36ac495dSmrg    \advance\leftskip by \lispnarrowing
6529*36ac495dSmrg    \advance\rightskip by \lispnarrowing
6530*36ac495dSmrg    \exdentamount = \lispnarrowing
6531*36ac495dSmrg  \else
6532*36ac495dSmrg    \let\nonarrowing = \relax
6533*36ac495dSmrg  \fi
6534*36ac495dSmrg  \parsearg\quotationlabel
6535*36ac495dSmrg}
6536*36ac495dSmrg
6537*36ac495dSmrg% We have retained a nonzero parskip for the environment, since we're
6538*36ac495dSmrg% doing normal filling.
6539*36ac495dSmrg%
6540*36ac495dSmrg\def\Equotation{%
6541*36ac495dSmrg  \par
6542*36ac495dSmrg  \ifx\quotationauthor\thisisundefined\else
6543*36ac495dSmrg    % indent a bit.
6544*36ac495dSmrg    \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
6545*36ac495dSmrg  \fi
6546*36ac495dSmrg  {\parskip=0pt \afterenvbreak}%
6547*36ac495dSmrg}
6548*36ac495dSmrg\def\Esmallquotation{\Equotation}
6549*36ac495dSmrg
6550*36ac495dSmrg% If we're given an argument, typeset it in bold with a colon after.
6551*36ac495dSmrg\def\quotationlabel#1{%
6552*36ac495dSmrg  \def\temp{#1}%
6553*36ac495dSmrg  \ifx\temp\empty \else
6554*36ac495dSmrg    {\bf #1: }%
6555*36ac495dSmrg  \fi
6556*36ac495dSmrg}
6557*36ac495dSmrg
6558*36ac495dSmrg
6559*36ac495dSmrg% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
6560*36ac495dSmrg% If we want to allow any <char> as delimiter,
6561*36ac495dSmrg% we need the curly braces so that makeinfo sees the @verb command, eg:
6562*36ac495dSmrg% `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
6563*36ac495dSmrg%
6564*36ac495dSmrg% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
6565*36ac495dSmrg%
6566*36ac495dSmrg% [Knuth] p.344; only we need to do the other characters Texinfo sets
6567*36ac495dSmrg% active too.  Otherwise, they get lost as the first character on a
6568*36ac495dSmrg% verbatim line.
6569*36ac495dSmrg\def\dospecials{%
6570*36ac495dSmrg  \do\ \do\\\do\{\do\}\do\$\do\&%
6571*36ac495dSmrg  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
6572*36ac495dSmrg  \do\<\do\>\do\|\do\@\do+\do\"%
6573*36ac495dSmrg  % Don't do the quotes -- if we do, @set txicodequoteundirected and
6574*36ac495dSmrg  % @set txicodequotebacktick will not have effect on @verb and
6575*36ac495dSmrg  % @verbatim, and ?` and !` ligatures won't get disabled.
6576*36ac495dSmrg  %\do\`\do\'%
6577*36ac495dSmrg}
6578*36ac495dSmrg%
6579*36ac495dSmrg% [Knuth] p. 380
6580*36ac495dSmrg\def\uncatcodespecials{%
6581*36ac495dSmrg  \def\do##1{\catcode`##1=\other}\dospecials}
6582*36ac495dSmrg%
6583*36ac495dSmrg% Setup for the @verb command.
6584*36ac495dSmrg%
6585*36ac495dSmrg% Eight spaces for a tab
6586*36ac495dSmrg\begingroup
6587*36ac495dSmrg  \catcode`\^^I=\active
6588*36ac495dSmrg  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
6589*36ac495dSmrg\endgroup
6590*36ac495dSmrg%
6591*36ac495dSmrg\def\setupverb{%
6592*36ac495dSmrg  \tt  % easiest (and conventionally used) font for verbatim
6593*36ac495dSmrg  \def\par{\leavevmode\endgraf}%
6594*36ac495dSmrg  \setupmarkupstyle{verb}%
6595*36ac495dSmrg  \tabeightspaces
6596*36ac495dSmrg  % Respect line breaks,
6597*36ac495dSmrg  % print special symbols as themselves, and
6598*36ac495dSmrg  % make each space count
6599*36ac495dSmrg  % must do in this order:
6600*36ac495dSmrg  \obeylines \uncatcodespecials \sepspaces
6601*36ac495dSmrg}
6602*36ac495dSmrg
6603*36ac495dSmrg% Setup for the @verbatim environment
6604*36ac495dSmrg%
6605*36ac495dSmrg% Real tab expansion.
6606*36ac495dSmrg\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
6607*36ac495dSmrg%
6608*36ac495dSmrg% We typeset each line of the verbatim in an \hbox, so we can handle
6609*36ac495dSmrg% tabs.  The \global is in case the verbatim line starts with an accent,
6610*36ac495dSmrg% or some other command that starts with a begin-group.  Otherwise, the
6611*36ac495dSmrg% entire \verbbox would disappear at the corresponding end-group, before
6612*36ac495dSmrg% it is typeset.  Meanwhile, we can't have nested verbatim commands
6613*36ac495dSmrg% (can we?), so the \global won't be overwriting itself.
6614*36ac495dSmrg\newbox\verbbox
6615*36ac495dSmrg\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
6616*36ac495dSmrg%
6617*36ac495dSmrg\begingroup
6618*36ac495dSmrg  \catcode`\^^I=\active
6619*36ac495dSmrg  \gdef\tabexpand{%
6620*36ac495dSmrg    \catcode`\^^I=\active
6621*36ac495dSmrg    \def^^I{\leavevmode\egroup
6622*36ac495dSmrg      \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
6623*36ac495dSmrg      \divide\dimen\verbbox by\tabw
6624*36ac495dSmrg      \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
6625*36ac495dSmrg      \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
6626*36ac495dSmrg      \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
6627*36ac495dSmrg    }%
6628*36ac495dSmrg  }
6629*36ac495dSmrg\endgroup
6630*36ac495dSmrg
6631*36ac495dSmrg% start the verbatim environment.
6632*36ac495dSmrg\def\setupverbatim{%
6633*36ac495dSmrg  \let\nonarrowing = t%
6634*36ac495dSmrg  \nonfillstart
6635*36ac495dSmrg  \tt % easiest (and conventionally used) font for verbatim
6636*36ac495dSmrg  % The \leavevmode here is for blank lines.  Otherwise, we would
6637*36ac495dSmrg  % never \starttabox and the \egroup would end verbatim mode.
6638*36ac495dSmrg  \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
6639*36ac495dSmrg  \tabexpand
6640*36ac495dSmrg  \setupmarkupstyle{verbatim}%
6641*36ac495dSmrg  % Respect line breaks,
6642*36ac495dSmrg  % print special symbols as themselves, and
6643*36ac495dSmrg  % make each space count.
6644*36ac495dSmrg  % Must do in this order:
6645*36ac495dSmrg  \obeylines \uncatcodespecials \sepspaces
6646*36ac495dSmrg  \everypar{\starttabbox}%
6647*36ac495dSmrg}
6648*36ac495dSmrg
6649*36ac495dSmrg% Do the @verb magic: verbatim text is quoted by unique
6650*36ac495dSmrg% delimiter characters.  Before first delimiter expect a
6651*36ac495dSmrg% right brace, after last delimiter expect closing brace:
6652*36ac495dSmrg%
6653*36ac495dSmrg%    \def\doverb'{'<char>#1<char>'}'{#1}
6654*36ac495dSmrg%
6655*36ac495dSmrg% [Knuth] p. 382; only eat outer {}
6656*36ac495dSmrg\begingroup
6657*36ac495dSmrg  \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
6658*36ac495dSmrg  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
6659*36ac495dSmrg\endgroup
6660*36ac495dSmrg%
6661*36ac495dSmrg\def\verb{\begingroup\setupverb\doverb}
6662*36ac495dSmrg%
6663*36ac495dSmrg%
6664*36ac495dSmrg% Do the @verbatim magic: define the macro \doverbatim so that
6665*36ac495dSmrg% the (first) argument ends when '@end verbatim' is reached, ie:
6666*36ac495dSmrg%
6667*36ac495dSmrg%     \def\doverbatim#1@end verbatim{#1}
6668*36ac495dSmrg%
6669*36ac495dSmrg% For Texinfo it's a lot easier than for LaTeX,
6670*36ac495dSmrg% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
6671*36ac495dSmrg% we need not redefine '\', '{' and '}'.
6672*36ac495dSmrg%
6673*36ac495dSmrg% Inspired by LaTeX's verbatim command set [latex.ltx]
6674*36ac495dSmrg%
6675*36ac495dSmrg\begingroup
6676*36ac495dSmrg  \catcode`\ =\active
6677*36ac495dSmrg  \obeylines %
6678*36ac495dSmrg  % ignore everything up to the first ^^M, that's the newline at the end
6679*36ac495dSmrg  % of the @verbatim input line itself.  Otherwise we get an extra blank
6680*36ac495dSmrg  % line in the output.
6681*36ac495dSmrg  \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
6682*36ac495dSmrg  % We really want {...\end verbatim} in the body of the macro, but
6683*36ac495dSmrg  % without the active space; thus we have to use \xdef and \gobble.
6684*36ac495dSmrg\endgroup
6685*36ac495dSmrg%
6686*36ac495dSmrg\envdef\verbatim{%
6687*36ac495dSmrg    \setupverbatim\doverbatim
6688*36ac495dSmrg}
6689*36ac495dSmrg\let\Everbatim = \afterenvbreak
6690*36ac495dSmrg
6691*36ac495dSmrg
6692*36ac495dSmrg% @verbatiminclude FILE - insert text of file in verbatim environment.
6693*36ac495dSmrg%
6694*36ac495dSmrg\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
6695*36ac495dSmrg%
6696*36ac495dSmrg\def\doverbatiminclude#1{%
6697*36ac495dSmrg  {%
6698*36ac495dSmrg    \makevalueexpandable
6699*36ac495dSmrg    \setupverbatim
6700*36ac495dSmrg    \indexnofonts       % Allow `@@' and other weird things in file names.
6701*36ac495dSmrg    \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
6702*36ac495dSmrg    \input #1
6703*36ac495dSmrg    \afterenvbreak
6704*36ac495dSmrg  }%
6705*36ac495dSmrg}
6706*36ac495dSmrg
6707*36ac495dSmrg% @copying ... @end copying.
6708*36ac495dSmrg% Save the text away for @insertcopying later.
6709*36ac495dSmrg%
6710*36ac495dSmrg% We save the uninterpreted tokens, rather than creating a box.
6711*36ac495dSmrg% Saving the text in a box would be much easier, but then all the
6712*36ac495dSmrg% typesetting commands (@smallbook, font changes, etc.) have to be done
6713*36ac495dSmrg% beforehand -- and a) we want @copying to be done first in the source
6714*36ac495dSmrg% file; b) letting users define the frontmatter in as flexible order as
6715*36ac495dSmrg% possible is very desirable.
6716*36ac495dSmrg%
6717*36ac495dSmrg\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
6718*36ac495dSmrg\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
6719*36ac495dSmrg%
6720*36ac495dSmrg\def\insertcopying{%
6721*36ac495dSmrg  \begingroup
6722*36ac495dSmrg    \parindent = 0pt  % paragraph indentation looks wrong on title page
6723*36ac495dSmrg    \scanexp\copyingtext
6724*36ac495dSmrg  \endgroup
6725*36ac495dSmrg}
6726*36ac495dSmrg
6727*36ac495dSmrg
6728*36ac495dSmrg\message{defuns,}
6729*36ac495dSmrg% @defun etc.
6730*36ac495dSmrg
6731*36ac495dSmrg\newskip\defbodyindent \defbodyindent=.4in
6732*36ac495dSmrg\newskip\defargsindent \defargsindent=50pt
6733*36ac495dSmrg\newskip\deflastargmargin \deflastargmargin=18pt
6734*36ac495dSmrg\newcount\defunpenalty
6735*36ac495dSmrg
6736*36ac495dSmrg% Start the processing of @deffn:
6737*36ac495dSmrg\def\startdefun{%
6738*36ac495dSmrg  \ifnum\lastpenalty<10000
6739*36ac495dSmrg    \medbreak
6740*36ac495dSmrg    \defunpenalty=10003 % Will keep this @deffn together with the
6741*36ac495dSmrg                        % following @def command, see below.
6742*36ac495dSmrg  \else
6743*36ac495dSmrg    % If there are two @def commands in a row, we'll have a \nobreak,
6744*36ac495dSmrg    % which is there to keep the function description together with its
6745*36ac495dSmrg    % header.  But if there's nothing but headers, we need to allow a
6746*36ac495dSmrg    % break somewhere.  Check specifically for penalty 10002, inserted
6747*36ac495dSmrg    % by \printdefunline, instead of 10000, since the sectioning
6748*36ac495dSmrg    % commands also insert a nobreak penalty, and we don't want to allow
6749*36ac495dSmrg    % a break between a section heading and a defun.
6750*36ac495dSmrg    %
6751*36ac495dSmrg    % As a further refinement, we avoid "club" headers by signalling
6752*36ac495dSmrg    % with penalty of 10003 after the very first @deffn in the
6753*36ac495dSmrg    % sequence (see above), and penalty of 10002 after any following
6754*36ac495dSmrg    % @def command.
6755*36ac495dSmrg    \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
6756*36ac495dSmrg    %
6757*36ac495dSmrg    % Similarly, after a section heading, do not allow a break.
6758*36ac495dSmrg    % But do insert the glue.
6759*36ac495dSmrg    \medskip  % preceded by discardable penalty, so not a breakpoint
6760*36ac495dSmrg  \fi
6761*36ac495dSmrg  %
6762*36ac495dSmrg  \parindent=0in
6763*36ac495dSmrg  \advance\leftskip by \defbodyindent
6764*36ac495dSmrg  \exdentamount=\defbodyindent
6765*36ac495dSmrg}
6766*36ac495dSmrg
6767*36ac495dSmrg\def\dodefunx#1{%
6768*36ac495dSmrg  % First, check whether we are in the right environment:
6769*36ac495dSmrg  \checkenv#1%
6770*36ac495dSmrg  %
6771*36ac495dSmrg  % As above, allow line break if we have multiple x headers in a row.
6772*36ac495dSmrg  % It's not a great place, though.
6773*36ac495dSmrg  \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
6774*36ac495dSmrg  %
6775*36ac495dSmrg  % And now, it's time to reuse the body of the original defun:
6776*36ac495dSmrg  \expandafter\gobbledefun#1%
6777*36ac495dSmrg}
6778*36ac495dSmrg\def\gobbledefun#1\startdefun{}
6779*36ac495dSmrg
6780*36ac495dSmrg% \printdefunline \deffnheader{text}
6781*36ac495dSmrg%
6782*36ac495dSmrg\def\printdefunline#1#2{%
6783*36ac495dSmrg  \begingroup
6784*36ac495dSmrg    % call \deffnheader:
6785*36ac495dSmrg    #1#2 \endheader
6786*36ac495dSmrg    % common ending:
6787*36ac495dSmrg    \interlinepenalty = 10000
6788*36ac495dSmrg    \advance\rightskip by 0pt plus 1fil\relax
6789*36ac495dSmrg    \endgraf
6790*36ac495dSmrg    \nobreak\vskip -\parskip
6791*36ac495dSmrg    \penalty\defunpenalty  % signal to \startdefun and \dodefunx
6792*36ac495dSmrg    % Some of the @defun-type tags do not enable magic parentheses,
6793*36ac495dSmrg    % rendering the following check redundant.  But we don't optimize.
6794*36ac495dSmrg    \checkparencounts
6795*36ac495dSmrg  \endgroup
6796*36ac495dSmrg}
6797*36ac495dSmrg
6798*36ac495dSmrg\def\Edefun{\endgraf\medbreak}
6799*36ac495dSmrg
6800*36ac495dSmrg% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
6801*36ac495dSmrg% the only thing remaining is to define \deffnheader.
6802*36ac495dSmrg%
6803*36ac495dSmrg\def\makedefun#1{%
6804*36ac495dSmrg  \expandafter\let\csname E#1\endcsname = \Edefun
6805*36ac495dSmrg  \edef\temp{\noexpand\domakedefun
6806*36ac495dSmrg    \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
6807*36ac495dSmrg  \temp
6808*36ac495dSmrg}
6809*36ac495dSmrg
6810*36ac495dSmrg% \domakedefun \deffn \deffnx \deffnheader
6811*36ac495dSmrg%
6812*36ac495dSmrg% Define \deffn and \deffnx, without parameters.
6813*36ac495dSmrg% \deffnheader has to be defined explicitly.
6814*36ac495dSmrg%
6815*36ac495dSmrg\def\domakedefun#1#2#3{%
6816*36ac495dSmrg  \envdef#1{%
6817*36ac495dSmrg    \startdefun
6818*36ac495dSmrg    \doingtypefnfalse    % distinguish typed functions from all else
6819*36ac495dSmrg    \parseargusing\activeparens{\printdefunline#3}%
6820*36ac495dSmrg  }%
6821*36ac495dSmrg  \def#2{\dodefunx#1}%
6822*36ac495dSmrg  \def#3%
6823*36ac495dSmrg}
6824*36ac495dSmrg
6825*36ac495dSmrg\newif\ifdoingtypefn       % doing typed function?
6826*36ac495dSmrg\newif\ifrettypeownline    % typeset return type on its own line?
6827*36ac495dSmrg
6828*36ac495dSmrg% @deftypefnnewline on|off says whether the return type of typed functions
6829*36ac495dSmrg% are printed on their own line.  This affects @deftypefn, @deftypefun,
6830*36ac495dSmrg% @deftypeop, and @deftypemethod.
6831*36ac495dSmrg%
6832*36ac495dSmrg\parseargdef\deftypefnnewline{%
6833*36ac495dSmrg  \def\temp{#1}%
6834*36ac495dSmrg  \ifx\temp\onword
6835*36ac495dSmrg    \expandafter\let\csname SETtxideftypefnnl\endcsname
6836*36ac495dSmrg      = \empty
6837*36ac495dSmrg  \else\ifx\temp\offword
6838*36ac495dSmrg    \expandafter\let\csname SETtxideftypefnnl\endcsname
6839*36ac495dSmrg      = \relax
6840*36ac495dSmrg  \else
6841*36ac495dSmrg    \errhelp = \EMsimple
6842*36ac495dSmrg    \errmessage{Unknown @txideftypefnnl value `\temp',
6843*36ac495dSmrg                must be on|off}%
6844*36ac495dSmrg  \fi\fi
6845*36ac495dSmrg}
6846*36ac495dSmrg
6847*36ac495dSmrg% Untyped functions:
6848*36ac495dSmrg
6849*36ac495dSmrg% @deffn category name args
6850*36ac495dSmrg\makedefun{deffn}{\deffngeneral{}}
6851*36ac495dSmrg
6852*36ac495dSmrg% @deffn category class name args
6853*36ac495dSmrg\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
6854*36ac495dSmrg
6855*36ac495dSmrg% \defopon {category on}class name args
6856*36ac495dSmrg\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
6857*36ac495dSmrg
6858*36ac495dSmrg% \deffngeneral {subind}category name args
6859*36ac495dSmrg%
6860*36ac495dSmrg\def\deffngeneral#1#2 #3 #4\endheader{%
6861*36ac495dSmrg  % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
6862*36ac495dSmrg  \dosubind{fn}{\code{#3}}{#1}%
6863*36ac495dSmrg  \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
6864*36ac495dSmrg}
6865*36ac495dSmrg
6866*36ac495dSmrg% Typed functions:
6867*36ac495dSmrg
6868*36ac495dSmrg% @deftypefn category type name args
6869*36ac495dSmrg\makedefun{deftypefn}{\deftypefngeneral{}}
6870*36ac495dSmrg
6871*36ac495dSmrg% @deftypeop category class type name args
6872*36ac495dSmrg\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
6873*36ac495dSmrg
6874*36ac495dSmrg% \deftypeopon {category on}class type name args
6875*36ac495dSmrg\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
6876*36ac495dSmrg
6877*36ac495dSmrg% \deftypefngeneral {subind}category type name args
6878*36ac495dSmrg%
6879*36ac495dSmrg\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
6880*36ac495dSmrg  \dosubind{fn}{\code{#4}}{#1}%
6881*36ac495dSmrg  \doingtypefntrue
6882*36ac495dSmrg  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6883*36ac495dSmrg}
6884*36ac495dSmrg
6885*36ac495dSmrg% Typed variables:
6886*36ac495dSmrg
6887*36ac495dSmrg% @deftypevr category type var args
6888*36ac495dSmrg\makedefun{deftypevr}{\deftypecvgeneral{}}
6889*36ac495dSmrg
6890*36ac495dSmrg% @deftypecv category class type var args
6891*36ac495dSmrg\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
6892*36ac495dSmrg
6893*36ac495dSmrg% \deftypecvof {category of}class type var args
6894*36ac495dSmrg\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
6895*36ac495dSmrg
6896*36ac495dSmrg% \deftypecvgeneral {subind}category type var args
6897*36ac495dSmrg%
6898*36ac495dSmrg\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
6899*36ac495dSmrg  \dosubind{vr}{\code{#4}}{#1}%
6900*36ac495dSmrg  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6901*36ac495dSmrg}
6902*36ac495dSmrg
6903*36ac495dSmrg% Untyped variables:
6904*36ac495dSmrg
6905*36ac495dSmrg% @defvr category var args
6906*36ac495dSmrg\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
6907*36ac495dSmrg
6908*36ac495dSmrg% @defcv category class var args
6909*36ac495dSmrg\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
6910*36ac495dSmrg
6911*36ac495dSmrg% \defcvof {category of}class var args
6912*36ac495dSmrg\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
6913*36ac495dSmrg
6914*36ac495dSmrg% Types:
6915*36ac495dSmrg
6916*36ac495dSmrg% @deftp category name args
6917*36ac495dSmrg\makedefun{deftp}#1 #2 #3\endheader{%
6918*36ac495dSmrg  \doind{tp}{\code{#2}}%
6919*36ac495dSmrg  \defname{#1}{}{#2}\defunargs{#3\unskip}%
6920*36ac495dSmrg}
6921*36ac495dSmrg
6922*36ac495dSmrg% Remaining @defun-like shortcuts:
6923*36ac495dSmrg\makedefun{defun}{\deffnheader{\putwordDeffunc} }
6924*36ac495dSmrg\makedefun{defmac}{\deffnheader{\putwordDefmac} }
6925*36ac495dSmrg\makedefun{defspec}{\deffnheader{\putwordDefspec} }
6926*36ac495dSmrg\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
6927*36ac495dSmrg\makedefun{defvar}{\defvrheader{\putwordDefvar} }
6928*36ac495dSmrg\makedefun{defopt}{\defvrheader{\putwordDefopt} }
6929*36ac495dSmrg\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
6930*36ac495dSmrg\makedefun{defmethod}{\defopon\putwordMethodon}
6931*36ac495dSmrg\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
6932*36ac495dSmrg\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
6933*36ac495dSmrg\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
6934*36ac495dSmrg
6935*36ac495dSmrg% \defname, which formats the name of the @def (not the args).
6936*36ac495dSmrg% #1 is the category, such as "Function".
6937*36ac495dSmrg% #2 is the return type, if any.
6938*36ac495dSmrg% #3 is the function name.
6939*36ac495dSmrg%
6940*36ac495dSmrg% We are followed by (but not passed) the arguments, if any.
6941*36ac495dSmrg%
6942*36ac495dSmrg\def\defname#1#2#3{%
6943*36ac495dSmrg  \par
6944*36ac495dSmrg  % Get the values of \leftskip and \rightskip as they were outside the @def...
6945*36ac495dSmrg  \advance\leftskip by -\defbodyindent
6946*36ac495dSmrg  %
6947*36ac495dSmrg  % Determine if we are typesetting the return type of a typed function
6948*36ac495dSmrg  % on a line by itself.
6949*36ac495dSmrg  \rettypeownlinefalse
6950*36ac495dSmrg  \ifdoingtypefn  % doing a typed function specifically?
6951*36ac495dSmrg    % then check user option for putting return type on its own line:
6952*36ac495dSmrg    \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
6953*36ac495dSmrg      \rettypeownlinetrue
6954*36ac495dSmrg    \fi
6955*36ac495dSmrg  \fi
6956*36ac495dSmrg  %
6957*36ac495dSmrg  % How we'll format the category name.  Putting it in brackets helps
6958*36ac495dSmrg  % distinguish it from the body text that may end up on the next line
6959*36ac495dSmrg  % just below it.
6960*36ac495dSmrg  \def\temp{#1}%
6961*36ac495dSmrg  \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
6962*36ac495dSmrg  %
6963*36ac495dSmrg  % Figure out line sizes for the paragraph shape.  We'll always have at
6964*36ac495dSmrg  % least two.
6965*36ac495dSmrg  \tempnum = 2
6966*36ac495dSmrg  %
6967*36ac495dSmrg  % The first line needs space for \box0; but if \rightskip is nonzero,
6968*36ac495dSmrg  % we need only space for the part of \box0 which exceeds it:
6969*36ac495dSmrg  \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
6970*36ac495dSmrg  %
6971*36ac495dSmrg  % If doing a return type on its own line, we'll have another line.
6972*36ac495dSmrg  \ifrettypeownline
6973*36ac495dSmrg    \advance\tempnum by 1
6974*36ac495dSmrg    \def\maybeshapeline{0in \hsize}%
6975*36ac495dSmrg  \else
6976*36ac495dSmrg    \def\maybeshapeline{}%
6977*36ac495dSmrg  \fi
6978*36ac495dSmrg  %
6979*36ac495dSmrg  % The continuations:
6980*36ac495dSmrg  \dimen2=\hsize  \advance\dimen2 by -\defargsindent
6981*36ac495dSmrg  %
6982*36ac495dSmrg  % The final paragraph shape:
6983*36ac495dSmrg  \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
6984*36ac495dSmrg  %
6985*36ac495dSmrg  % Put the category name at the right margin.
6986*36ac495dSmrg  \noindent
6987*36ac495dSmrg  \hbox to 0pt{%
6988*36ac495dSmrg    \hfil\box0 \kern-\hsize
6989*36ac495dSmrg    % \hsize has to be shortened this way:
6990*36ac495dSmrg    \kern\leftskip
6991*36ac495dSmrg    % Intentionally do not respect \rightskip, since we need the space.
6992*36ac495dSmrg  }%
6993*36ac495dSmrg  %
6994*36ac495dSmrg  % Allow all lines to be underfull without complaint:
6995*36ac495dSmrg  \tolerance=10000 \hbadness=10000
6996*36ac495dSmrg  \exdentamount=\defbodyindent
6997*36ac495dSmrg  {%
6998*36ac495dSmrg    % defun fonts. We use typewriter by default (used to be bold) because:
6999*36ac495dSmrg    % . we're printing identifiers, they should be in tt in principle.
7000*36ac495dSmrg    % . in languages with many accents, such as Czech or French, it's
7001*36ac495dSmrg    %   common to leave accents off identifiers.  The result looks ok in
7002*36ac495dSmrg    %   tt, but exceedingly strange in rm.
7003*36ac495dSmrg    % . we don't want -- and --- to be treated as ligatures.
7004*36ac495dSmrg    % . this still does not fix the ?` and !` ligatures, but so far no
7005*36ac495dSmrg    %   one has made identifiers using them :).
7006*36ac495dSmrg    \df \tt
7007*36ac495dSmrg    \def\temp{#2}% text of the return type
7008*36ac495dSmrg    \ifx\temp\empty\else
7009*36ac495dSmrg      \tclose{\temp}% typeset the return type
7010*36ac495dSmrg      \ifrettypeownline
7011*36ac495dSmrg        % put return type on its own line; prohibit line break following:
7012*36ac495dSmrg        \hfil\vadjust{\nobreak}\break
7013*36ac495dSmrg      \else
7014*36ac495dSmrg        \space  % type on same line, so just followed by a space
7015*36ac495dSmrg      \fi
7016*36ac495dSmrg    \fi           % no return type
7017*36ac495dSmrg    #3% output function name
7018*36ac495dSmrg  }%
7019*36ac495dSmrg  {\rm\enskip}% hskip 0.5 em of \tenrm
7020*36ac495dSmrg  %
7021*36ac495dSmrg  \boldbrax
7022*36ac495dSmrg  % arguments will be output next, if any.
7023*36ac495dSmrg}
7024*36ac495dSmrg
7025*36ac495dSmrg% Print arguments in slanted roman (not ttsl), inconsistently with using
7026*36ac495dSmrg% tt for the name.  This is because literal text is sometimes needed in
7027*36ac495dSmrg% the argument list (groff manual), and ttsl and tt are not very
7028*36ac495dSmrg% distinguishable.  Prevent hyphenation at `-' chars.
7029*36ac495dSmrg%
7030*36ac495dSmrg\def\defunargs#1{%
7031*36ac495dSmrg  % use sl by default (not ttsl),
7032*36ac495dSmrg  % tt for the names.
7033*36ac495dSmrg  \df \sl \hyphenchar\font=0
7034*36ac495dSmrg  %
7035*36ac495dSmrg  % On the other hand, if an argument has two dashes (for instance), we
7036*36ac495dSmrg  % want a way to get ttsl.  Let's try @var for that.
7037*36ac495dSmrg  \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7038*36ac495dSmrg  #1%
7039*36ac495dSmrg  \sl\hyphenchar\font=45
7040*36ac495dSmrg}
7041*36ac495dSmrg
7042*36ac495dSmrg% We want ()&[] to print specially on the defun line.
7043*36ac495dSmrg%
7044*36ac495dSmrg\def\activeparens{%
7045*36ac495dSmrg  \catcode`\(=\active \catcode`\)=\active
7046*36ac495dSmrg  \catcode`\[=\active \catcode`\]=\active
7047*36ac495dSmrg  \catcode`\&=\active
7048*36ac495dSmrg}
7049*36ac495dSmrg
7050*36ac495dSmrg% Make control sequences which act like normal parenthesis chars.
7051*36ac495dSmrg\let\lparen = ( \let\rparen = )
7052*36ac495dSmrg
7053*36ac495dSmrg% Be sure that we always have a definition for `(', etc.  For example,
7054*36ac495dSmrg% if the fn name has parens in it, \boldbrax will not be in effect yet,
7055*36ac495dSmrg% so TeX would otherwise complain about undefined control sequence.
7056*36ac495dSmrg{
7057*36ac495dSmrg  \activeparens
7058*36ac495dSmrg  \global\let(=\lparen \global\let)=\rparen
7059*36ac495dSmrg  \global\let[=\lbrack \global\let]=\rbrack
7060*36ac495dSmrg  \global\let& = \&
7061*36ac495dSmrg
7062*36ac495dSmrg  \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7063*36ac495dSmrg  \gdef\magicamp{\let&=\amprm}
7064*36ac495dSmrg}
7065*36ac495dSmrg
7066*36ac495dSmrg\newcount\parencount
7067*36ac495dSmrg
7068*36ac495dSmrg% If we encounter &foo, then turn on ()-hacking afterwards
7069*36ac495dSmrg\newif\ifampseen
7070*36ac495dSmrg\def\amprm#1 {\ampseentrue{\bf\&#1 }}
7071*36ac495dSmrg
7072*36ac495dSmrg\def\parenfont{%
7073*36ac495dSmrg  \ifampseen
7074*36ac495dSmrg    % At the first level, print parens in roman,
7075*36ac495dSmrg    % otherwise use the default font.
7076*36ac495dSmrg    \ifnum \parencount=1 \rm \fi
7077*36ac495dSmrg  \else
7078*36ac495dSmrg    % The \sf parens (in \boldbrax) actually are a little bolder than
7079*36ac495dSmrg    % the contained text.  This is especially needed for [ and ] .
7080*36ac495dSmrg    \sf
7081*36ac495dSmrg  \fi
7082*36ac495dSmrg}
7083*36ac495dSmrg\def\infirstlevel#1{%
7084*36ac495dSmrg  \ifampseen
7085*36ac495dSmrg    \ifnum\parencount=1
7086*36ac495dSmrg      #1%
7087*36ac495dSmrg    \fi
7088*36ac495dSmrg  \fi
7089*36ac495dSmrg}
7090*36ac495dSmrg\def\bfafterword#1 {#1 \bf}
7091*36ac495dSmrg
7092*36ac495dSmrg\def\opnr{%
7093*36ac495dSmrg  \global\advance\parencount by 1
7094*36ac495dSmrg  {\parenfont(}%
7095*36ac495dSmrg  \infirstlevel \bfafterword
7096*36ac495dSmrg}
7097*36ac495dSmrg\def\clnr{%
7098*36ac495dSmrg  {\parenfont)}%
7099*36ac495dSmrg  \infirstlevel \sl
7100*36ac495dSmrg  \global\advance\parencount by -1
7101*36ac495dSmrg}
7102*36ac495dSmrg
7103*36ac495dSmrg\newcount\brackcount
7104*36ac495dSmrg\def\lbrb{%
7105*36ac495dSmrg  \global\advance\brackcount by 1
7106*36ac495dSmrg  {\bf[}%
7107*36ac495dSmrg}
7108*36ac495dSmrg\def\rbrb{%
7109*36ac495dSmrg  {\bf]}%
7110*36ac495dSmrg  \global\advance\brackcount by -1
7111*36ac495dSmrg}
7112*36ac495dSmrg
7113*36ac495dSmrg\def\checkparencounts{%
7114*36ac495dSmrg  \ifnum\parencount=0 \else \badparencount \fi
7115*36ac495dSmrg  \ifnum\brackcount=0 \else \badbrackcount \fi
7116*36ac495dSmrg}
7117*36ac495dSmrg% these should not use \errmessage; the glibc manual, at least, actually
7118*36ac495dSmrg% has such constructs (when documenting function pointers).
7119*36ac495dSmrg\def\badparencount{%
7120*36ac495dSmrg  \message{Warning: unbalanced parentheses in @def...}%
7121*36ac495dSmrg  \global\parencount=0
7122*36ac495dSmrg}
7123*36ac495dSmrg\def\badbrackcount{%
7124*36ac495dSmrg  \message{Warning: unbalanced square brackets in @def...}%
7125*36ac495dSmrg  \global\brackcount=0
7126*36ac495dSmrg}
7127*36ac495dSmrg
7128*36ac495dSmrg
7129*36ac495dSmrg\message{macros,}
7130*36ac495dSmrg% @macro.
7131*36ac495dSmrg
7132*36ac495dSmrg% To do this right we need a feature of e-TeX, \scantokens,
7133*36ac495dSmrg% which we arrange to emulate with a temporary file in ordinary TeX.
7134*36ac495dSmrg\ifx\eTeXversion\thisisundefined
7135*36ac495dSmrg  \newwrite\macscribble
7136*36ac495dSmrg  \def\scantokens#1{%
7137*36ac495dSmrg    \toks0={#1}%
7138*36ac495dSmrg    \immediate\openout\macscribble=\jobname.tmp
7139*36ac495dSmrg    \immediate\write\macscribble{\the\toks0}%
7140*36ac495dSmrg    \immediate\closeout\macscribble
7141*36ac495dSmrg    \input \jobname.tmp
7142*36ac495dSmrg  }
7143*36ac495dSmrg\fi
7144*36ac495dSmrg
7145*36ac495dSmrg\def\scanmacro#1{\begingroup
7146*36ac495dSmrg  \newlinechar`\^^M
7147*36ac495dSmrg  \let\xeatspaces\eatspaces
7148*36ac495dSmrg  %
7149*36ac495dSmrg  % Undo catcode changes of \startcontents and \doprintindex
7150*36ac495dSmrg  % When called from @insertcopying or (short)caption, we need active
7151*36ac495dSmrg  % backslash to get it printed correctly.  Previously, we had
7152*36ac495dSmrg  % \catcode`\\=\other instead.  We'll see whether a problem appears
7153*36ac495dSmrg  % with macro expansion.				--kasal, 19aug04
7154*36ac495dSmrg  \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
7155*36ac495dSmrg  %
7156*36ac495dSmrg  % ... and for \example:
7157*36ac495dSmrg  \spaceisspace
7158*36ac495dSmrg  %
7159*36ac495dSmrg  % The \empty here causes a following catcode 5 newline to be eaten as
7160*36ac495dSmrg  % part of reading whitespace after a control sequence.  It does not
7161*36ac495dSmrg  % eat a catcode 13 newline.  There's no good way to handle the two
7162*36ac495dSmrg  % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
7163*36ac495dSmrg  % would then have different behavior).  See the Macro Details node in
7164*36ac495dSmrg  % the manual for the workaround we recommend for macros and
7165*36ac495dSmrg  % line-oriented commands.
7166*36ac495dSmrg  %
7167*36ac495dSmrg  \scantokens{#1\empty}%
7168*36ac495dSmrg\endgroup}
7169*36ac495dSmrg
7170*36ac495dSmrg\def\scanexp#1{%
7171*36ac495dSmrg  \edef\temp{\noexpand\scanmacro{#1}}%
7172*36ac495dSmrg  \temp
7173*36ac495dSmrg}
7174*36ac495dSmrg
7175*36ac495dSmrg\newcount\paramno   % Count of parameters
7176*36ac495dSmrg\newtoks\macname    % Macro name
7177*36ac495dSmrg\newif\ifrecursive  % Is it recursive?
7178*36ac495dSmrg
7179*36ac495dSmrg% List of all defined macros in the form
7180*36ac495dSmrg%    \definedummyword\macro1\definedummyword\macro2...
7181*36ac495dSmrg% Currently is also contains all @aliases; the list can be split
7182*36ac495dSmrg% if there is a need.
7183*36ac495dSmrg\def\macrolist{}
7184*36ac495dSmrg
7185*36ac495dSmrg% Add the macro to \macrolist
7186*36ac495dSmrg\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7187*36ac495dSmrg\def\addtomacrolistxxx#1{%
7188*36ac495dSmrg     \toks0 = \expandafter{\macrolist\definedummyword#1}%
7189*36ac495dSmrg     \xdef\macrolist{\the\toks0}%
7190*36ac495dSmrg}
7191*36ac495dSmrg
7192*36ac495dSmrg% Utility routines.
7193*36ac495dSmrg% This does \let #1 = #2, with \csnames; that is,
7194*36ac495dSmrg%   \let \csname#1\endcsname = \csname#2\endcsname
7195*36ac495dSmrg% (except of course we have to play expansion games).
7196*36ac495dSmrg%
7197*36ac495dSmrg\def\cslet#1#2{%
7198*36ac495dSmrg  \expandafter\let
7199*36ac495dSmrg  \csname#1\expandafter\endcsname
7200*36ac495dSmrg  \csname#2\endcsname
7201*36ac495dSmrg}
7202*36ac495dSmrg
7203*36ac495dSmrg% Trim leading and trailing spaces off a string.
7204*36ac495dSmrg% Concepts from aro-bend problem 15 (see CTAN).
7205*36ac495dSmrg{\catcode`\@=11
7206*36ac495dSmrg\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7207*36ac495dSmrg\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7208*36ac495dSmrg\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7209*36ac495dSmrg\def\unbrace#1{#1}
7210*36ac495dSmrg\unbrace{\gdef\trim@@@ #1 } #2@{#1}
7211*36ac495dSmrg}
7212*36ac495dSmrg
7213*36ac495dSmrg% Trim a single trailing ^^M off a string.
7214*36ac495dSmrg{\catcode`\^^M=\other \catcode`\Q=3%
7215*36ac495dSmrg\gdef\eatcr #1{\eatcra #1Q^^MQ}%
7216*36ac495dSmrg\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
7217*36ac495dSmrg\gdef\eatcrb#1Q#2Q{#1}%
7218*36ac495dSmrg}
7219*36ac495dSmrg
7220*36ac495dSmrg% Macro bodies are absorbed as an argument in a context where
7221*36ac495dSmrg% all characters are catcode 10, 11 or 12, except \ which is active
7222*36ac495dSmrg% (as in normal texinfo). It is necessary to change the definition of \
7223*36ac495dSmrg% to recognize macro arguments; this is the job of \mbodybackslash.
7224*36ac495dSmrg%
7225*36ac495dSmrg% Non-ASCII encodings make 8-bit characters active, so un-activate
7226*36ac495dSmrg% them to avoid their expansion.  Must do this non-globally, to
7227*36ac495dSmrg% confine the change to the current group.
7228*36ac495dSmrg%
7229*36ac495dSmrg% It's necessary to have hard CRs when the macro is executed. This is
7230*36ac495dSmrg% done by making ^^M (\endlinechar) catcode 12 when reading the macro
7231*36ac495dSmrg% body, and then making it the \newlinechar in \scanmacro.
7232*36ac495dSmrg%
7233*36ac495dSmrg\def\scanctxt{% used as subroutine
7234*36ac495dSmrg  \catcode`\"=\other
7235*36ac495dSmrg  \catcode`\+=\other
7236*36ac495dSmrg  \catcode`\<=\other
7237*36ac495dSmrg  \catcode`\>=\other
7238*36ac495dSmrg  \catcode`\@=\other
7239*36ac495dSmrg  \catcode`\^=\other
7240*36ac495dSmrg  \catcode`\_=\other
7241*36ac495dSmrg  \catcode`\|=\other
7242*36ac495dSmrg  \catcode`\~=\other
7243*36ac495dSmrg  \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
7244*36ac495dSmrg}
7245*36ac495dSmrg
7246*36ac495dSmrg\def\scanargctxt{% used for copying and captions, not macros.
7247*36ac495dSmrg  \scanctxt
7248*36ac495dSmrg  \catcode`\\=\other
7249*36ac495dSmrg  \catcode`\^^M=\other
7250*36ac495dSmrg}
7251*36ac495dSmrg
7252*36ac495dSmrg\def\macrobodyctxt{% used for @macro definitions
7253*36ac495dSmrg  \scanctxt
7254*36ac495dSmrg  \catcode`\{=\other
7255*36ac495dSmrg  \catcode`\}=\other
7256*36ac495dSmrg  \catcode`\^^M=\other
7257*36ac495dSmrg  \usembodybackslash
7258*36ac495dSmrg}
7259*36ac495dSmrg
7260*36ac495dSmrg\def\macroargctxt{% used when scanning invocations
7261*36ac495dSmrg  \scanctxt
7262*36ac495dSmrg  \catcode`\\=0
7263*36ac495dSmrg}
7264*36ac495dSmrg% why catcode 0 for \ in the above?  To recognize \\ \{ \} as "escapes"
7265*36ac495dSmrg% for the single characters \ { }.  Thus, we end up with the "commands"
7266*36ac495dSmrg% that would be written @\ @{ @} in a Texinfo document.
7267*36ac495dSmrg%
7268*36ac495dSmrg% We already have @{ and @}.  For @\, we define it here, and only for
7269*36ac495dSmrg% this purpose, to produce a typewriter backslash (so, the @\ that we
7270*36ac495dSmrg% define for @math can't be used with @macro calls):
7271*36ac495dSmrg%
7272*36ac495dSmrg\def\\{\normalbackslash}%
7273*36ac495dSmrg%
7274*36ac495dSmrg% We would like to do this for \, too, since that is what makeinfo does.
7275*36ac495dSmrg% But it is not possible, because Texinfo already has a command @, for a
7276*36ac495dSmrg% cedilla accent.  Documents must use @comma{} instead.
7277*36ac495dSmrg%
7278*36ac495dSmrg% \anythingelse will almost certainly be an error of some kind.
7279*36ac495dSmrg
7280*36ac495dSmrg
7281*36ac495dSmrg% \mbodybackslash is the definition of \ in @macro bodies.
7282*36ac495dSmrg% It maps \foo\ => \csname macarg.foo\endcsname => #N
7283*36ac495dSmrg% where N is the macro parameter number.
7284*36ac495dSmrg% We define \csname macarg.\endcsname to be \realbackslash, so
7285*36ac495dSmrg% \\ in macro replacement text gets you a backslash.
7286*36ac495dSmrg%
7287*36ac495dSmrg{\catcode`@=0 @catcode`@\=@active
7288*36ac495dSmrg @gdef@usembodybackslash{@let\=@mbodybackslash}
7289*36ac495dSmrg @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
7290*36ac495dSmrg}
7291*36ac495dSmrg\expandafter\def\csname macarg.\endcsname{\realbackslash}
7292*36ac495dSmrg
7293*36ac495dSmrg\def\margbackslash#1{\char`\#1 }
7294*36ac495dSmrg
7295*36ac495dSmrg\def\macro{\recursivefalse\parsearg\macroxxx}
7296*36ac495dSmrg\def\rmacro{\recursivetrue\parsearg\macroxxx}
7297*36ac495dSmrg
7298*36ac495dSmrg\def\macroxxx#1{%
7299*36ac495dSmrg  \getargs{#1}% now \macname is the macname and \argl the arglist
7300*36ac495dSmrg  \ifx\argl\empty       % no arguments
7301*36ac495dSmrg     \paramno=0\relax
7302*36ac495dSmrg  \else
7303*36ac495dSmrg     \expandafter\parsemargdef \argl;%
7304*36ac495dSmrg     \if\paramno>256\relax
7305*36ac495dSmrg       \ifx\eTeXversion\thisisundefined
7306*36ac495dSmrg         \errhelp = \EMsimple
7307*36ac495dSmrg         \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
7308*36ac495dSmrg       \fi
7309*36ac495dSmrg     \fi
7310*36ac495dSmrg  \fi
7311*36ac495dSmrg  \if1\csname ismacro.\the\macname\endcsname
7312*36ac495dSmrg     \message{Warning: redefining \the\macname}%
7313*36ac495dSmrg  \else
7314*36ac495dSmrg     \expandafter\ifx\csname \the\macname\endcsname \relax
7315*36ac495dSmrg     \else \errmessage{Macro name \the\macname\space already defined}\fi
7316*36ac495dSmrg     \global\cslet{macsave.\the\macname}{\the\macname}%
7317*36ac495dSmrg     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
7318*36ac495dSmrg     \addtomacrolist{\the\macname}%
7319*36ac495dSmrg  \fi
7320*36ac495dSmrg  \begingroup \macrobodyctxt
7321*36ac495dSmrg  \ifrecursive \expandafter\parsermacbody
7322*36ac495dSmrg  \else \expandafter\parsemacbody
7323*36ac495dSmrg  \fi}
7324*36ac495dSmrg
7325*36ac495dSmrg\parseargdef\unmacro{%
7326*36ac495dSmrg  \if1\csname ismacro.#1\endcsname
7327*36ac495dSmrg    \global\cslet{#1}{macsave.#1}%
7328*36ac495dSmrg    \global\expandafter\let \csname ismacro.#1\endcsname=0%
7329*36ac495dSmrg    % Remove the macro name from \macrolist:
7330*36ac495dSmrg    \begingroup
7331*36ac495dSmrg      \expandafter\let\csname#1\endcsname \relax
7332*36ac495dSmrg      \let\definedummyword\unmacrodo
7333*36ac495dSmrg      \xdef\macrolist{\macrolist}%
7334*36ac495dSmrg    \endgroup
7335*36ac495dSmrg  \else
7336*36ac495dSmrg    \errmessage{Macro #1 not defined}%
7337*36ac495dSmrg  \fi
7338*36ac495dSmrg}
7339*36ac495dSmrg
7340*36ac495dSmrg% Called by \do from \dounmacro on each macro.  The idea is to omit any
7341*36ac495dSmrg% macro definitions that have been changed to \relax.
7342*36ac495dSmrg%
7343*36ac495dSmrg\def\unmacrodo#1{%
7344*36ac495dSmrg  \ifx #1\relax
7345*36ac495dSmrg    % remove this
7346*36ac495dSmrg  \else
7347*36ac495dSmrg    \noexpand\definedummyword \noexpand#1%
7348*36ac495dSmrg  \fi
7349*36ac495dSmrg}
7350*36ac495dSmrg
7351*36ac495dSmrg% This makes use of the obscure feature that if the last token of a
7352*36ac495dSmrg% <parameter list> is #, then the preceding argument is delimited by
7353*36ac495dSmrg% an opening brace, and that opening brace is not consumed.
7354*36ac495dSmrg\def\getargs#1{\getargsxxx#1{}}
7355*36ac495dSmrg\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
7356*36ac495dSmrg\def\getmacname#1 #2\relax{\macname={#1}}
7357*36ac495dSmrg\def\getmacargs#1{\def\argl{#1}}
7358*36ac495dSmrg
7359*36ac495dSmrg% For macro processing make @ a letter so that we can make Texinfo private macro names.
7360*36ac495dSmrg\edef\texiatcatcode{\the\catcode`\@}
7361*36ac495dSmrg\catcode `@=11\relax
7362*36ac495dSmrg
7363*36ac495dSmrg% Parse the optional {params} list.  Set up \paramno and \paramlist
7364*36ac495dSmrg% so \defmacro knows what to do.  Define \macarg.BLAH for each BLAH
7365*36ac495dSmrg% in the params list to some hook where the argument si to be expanded.  If
7366*36ac495dSmrg% there are less than 10 arguments that hook is to be replaced by ##N where N
7367*36ac495dSmrg% is the position in that list, that is to say the macro arguments are to be
7368*36ac495dSmrg% defined `a la TeX in the macro body.
7369*36ac495dSmrg%
7370*36ac495dSmrg% That gets used by \mbodybackslash (above).
7371*36ac495dSmrg%
7372*36ac495dSmrg% We need to get `macro parameter char #' into several definitions.
7373*36ac495dSmrg% The technique used is stolen from LaTeX: let \hash be something
7374*36ac495dSmrg% unexpandable, insert that wherever you need a #, and then redefine
7375*36ac495dSmrg% it to # just before using the token list produced.
7376*36ac495dSmrg%
7377*36ac495dSmrg% The same technique is used to protect \eatspaces till just before
7378*36ac495dSmrg% the macro is used.
7379*36ac495dSmrg%
7380*36ac495dSmrg% If there are 10 or more arguments, a different technique is used, where the
7381*36ac495dSmrg% hook remains in the body, and when macro is to be expanded the body is
7382*36ac495dSmrg% processed again to replace the arguments.
7383*36ac495dSmrg%
7384*36ac495dSmrg% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
7385*36ac495dSmrg% argument N value and then \edef  the body (nothing else will expand because of
7386*36ac495dSmrg% the catcode regime underwhich the body was input).
7387*36ac495dSmrg%
7388*36ac495dSmrg% If you compile with TeX (not eTeX), and you have macros with 10 or more
7389*36ac495dSmrg% arguments, you need that no macro has more than 256 arguments, otherwise an
7390*36ac495dSmrg% error is produced.
7391*36ac495dSmrg\def\parsemargdef#1;{%
7392*36ac495dSmrg  \paramno=0\def\paramlist{}%
7393*36ac495dSmrg  \let\hash\relax
7394*36ac495dSmrg  \let\xeatspaces\relax
7395*36ac495dSmrg  \parsemargdefxxx#1,;,%
7396*36ac495dSmrg  % In case that there are 10 or more arguments we parse again the arguments
7397*36ac495dSmrg  % list to set new definitions for the \macarg.BLAH macros corresponding to
7398*36ac495dSmrg  % each BLAH argument. It was anyhow needed to parse already once this list
7399*36ac495dSmrg  % in order to count the arguments, and as macros with at most 9 arguments
7400*36ac495dSmrg  % are by far more frequent than macro with 10 or more arguments, defining
7401*36ac495dSmrg  % twice the \macarg.BLAH macros does not cost too much processing power.
7402*36ac495dSmrg  \ifnum\paramno<10\relax\else
7403*36ac495dSmrg    \paramno0\relax
7404*36ac495dSmrg    \parsemmanyargdef@@#1,;,% 10 or more arguments
7405*36ac495dSmrg  \fi
7406*36ac495dSmrg}
7407*36ac495dSmrg\def\parsemargdefxxx#1,{%
7408*36ac495dSmrg  \if#1;\let\next=\relax
7409*36ac495dSmrg  \else \let\next=\parsemargdefxxx
7410*36ac495dSmrg    \advance\paramno by 1
7411*36ac495dSmrg    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
7412*36ac495dSmrg        {\xeatspaces{\hash\the\paramno}}%
7413*36ac495dSmrg    \edef\paramlist{\paramlist\hash\the\paramno,}%
7414*36ac495dSmrg  \fi\next}
7415*36ac495dSmrg
7416*36ac495dSmrg\def\parsemmanyargdef@@#1,{%
7417*36ac495dSmrg  \if#1;\let\next=\relax
7418*36ac495dSmrg  \else
7419*36ac495dSmrg    \let\next=\parsemmanyargdef@@
7420*36ac495dSmrg    \edef\tempb{\eatspaces{#1}}%
7421*36ac495dSmrg    \expandafter\def\expandafter\tempa
7422*36ac495dSmrg       \expandafter{\csname macarg.\tempb\endcsname}%
7423*36ac495dSmrg    % Note that we need some extra \noexpand\noexpand, this is because we
7424*36ac495dSmrg    % don't want \the  to be expanded in the \parsermacbody  as it uses an
7425*36ac495dSmrg    % \xdef .
7426*36ac495dSmrg    \expandafter\edef\tempa
7427*36ac495dSmrg      {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
7428*36ac495dSmrg    \advance\paramno by 1\relax
7429*36ac495dSmrg  \fi\next}
7430*36ac495dSmrg
7431*36ac495dSmrg% These two commands read recursive and nonrecursive macro bodies.
7432*36ac495dSmrg% (They're different since rec and nonrec macros end differently.)
7433*36ac495dSmrg%
7434*36ac495dSmrg
7435*36ac495dSmrg\catcode `\@\texiatcatcode
7436*36ac495dSmrg\long\def\parsemacbody#1@end macro%
7437*36ac495dSmrg{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
7438*36ac495dSmrg\long\def\parsermacbody#1@end rmacro%
7439*36ac495dSmrg{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
7440*36ac495dSmrg\catcode `\@=11\relax
7441*36ac495dSmrg
7442*36ac495dSmrg\let\endargs@\relax
7443*36ac495dSmrg\let\nil@\relax
7444*36ac495dSmrg\def\nilm@{\nil@}%
7445*36ac495dSmrg\long\def\nillm@{\nil@}%
7446*36ac495dSmrg
7447*36ac495dSmrg% This macro is expanded during the Texinfo macro expansion, not during its
7448*36ac495dSmrg% definition.  It gets all the arguments values and assigns them to macros
7449*36ac495dSmrg% macarg.ARGNAME
7450*36ac495dSmrg%
7451*36ac495dSmrg% #1 is the macro name
7452*36ac495dSmrg% #2 is the list of argument names
7453*36ac495dSmrg% #3 is the list of argument values
7454*36ac495dSmrg\def\getargvals@#1#2#3{%
7455*36ac495dSmrg  \def\macargdeflist@{}%
7456*36ac495dSmrg  \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
7457*36ac495dSmrg  \def\paramlist{#2,\nil@}%
7458*36ac495dSmrg  \def\macroname{#1}%
7459*36ac495dSmrg  \begingroup
7460*36ac495dSmrg  \macroargctxt
7461*36ac495dSmrg  \def\argvaluelist{#3,\nil@}%
7462*36ac495dSmrg  \def\@tempa{#3}%
7463*36ac495dSmrg  \ifx\@tempa\empty
7464*36ac495dSmrg    \setemptyargvalues@
7465*36ac495dSmrg  \else
7466*36ac495dSmrg    \getargvals@@
7467*36ac495dSmrg  \fi
7468*36ac495dSmrg}
7469*36ac495dSmrg
7470*36ac495dSmrg%
7471*36ac495dSmrg\def\getargvals@@{%
7472*36ac495dSmrg  \ifx\paramlist\nilm@
7473*36ac495dSmrg      % Some sanity check needed here that \argvaluelist is also empty.
7474*36ac495dSmrg      \ifx\argvaluelist\nillm@
7475*36ac495dSmrg      \else
7476*36ac495dSmrg        \errhelp = \EMsimple
7477*36ac495dSmrg        \errmessage{Too many arguments in macro `\macroname'!}%
7478*36ac495dSmrg      \fi
7479*36ac495dSmrg      \let\next\macargexpandinbody@
7480*36ac495dSmrg  \else
7481*36ac495dSmrg    \ifx\argvaluelist\nillm@
7482*36ac495dSmrg       % No more arguments values passed to macro.  Set remaining named-arg
7483*36ac495dSmrg       % macros to empty.
7484*36ac495dSmrg       \let\next\setemptyargvalues@
7485*36ac495dSmrg    \else
7486*36ac495dSmrg      % pop current arg name into \@tempb
7487*36ac495dSmrg      \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
7488*36ac495dSmrg      \expandafter\@tempa\expandafter{\paramlist}%
7489*36ac495dSmrg       % pop current argument value into \@tempc
7490*36ac495dSmrg      \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
7491*36ac495dSmrg      \expandafter\@tempa\expandafter{\argvaluelist}%
7492*36ac495dSmrg       % Here \@tempb is the current arg name and \@tempc is the current arg value.
7493*36ac495dSmrg       % First place the new argument macro definition into \@tempd
7494*36ac495dSmrg       \expandafter\macname\expandafter{\@tempc}%
7495*36ac495dSmrg       \expandafter\let\csname macarg.\@tempb\endcsname\relax
7496*36ac495dSmrg       \expandafter\def\expandafter\@tempe\expandafter{%
7497*36ac495dSmrg         \csname macarg.\@tempb\endcsname}%
7498*36ac495dSmrg       \edef\@tempd{\long\def\@tempe{\the\macname}}%
7499*36ac495dSmrg       \push@\@tempd\macargdeflist@
7500*36ac495dSmrg       \let\next\getargvals@@
7501*36ac495dSmrg    \fi
7502*36ac495dSmrg  \fi
7503*36ac495dSmrg  \next
7504*36ac495dSmrg}
7505*36ac495dSmrg
7506*36ac495dSmrg\def\push@#1#2{%
7507*36ac495dSmrg  \expandafter\expandafter\expandafter\def
7508*36ac495dSmrg  \expandafter\expandafter\expandafter#2%
7509*36ac495dSmrg  \expandafter\expandafter\expandafter{%
7510*36ac495dSmrg  \expandafter#1#2}%
7511*36ac495dSmrg}
7512*36ac495dSmrg
7513*36ac495dSmrg% Replace arguments by their values in the macro body, and place the result
7514*36ac495dSmrg% in macro \@tempa
7515*36ac495dSmrg\def\macvalstoargs@{%
7516*36ac495dSmrg  %  To do this we use the property that token registers that are \the'ed
7517*36ac495dSmrg  % within an \edef  expand only once. So we are going to place all argument
7518*36ac495dSmrg  % values into respective token registers.
7519*36ac495dSmrg  %
7520*36ac495dSmrg  % First we save the token context, and initialize argument numbering.
7521*36ac495dSmrg  \begingroup
7522*36ac495dSmrg    \paramno0\relax
7523*36ac495dSmrg    % Then, for each argument number #N, we place the corresponding argument
7524*36ac495dSmrg    % value into a new token list register \toks#N
7525*36ac495dSmrg    \expandafter\putargsintokens@\saveparamlist@,;,%
7526*36ac495dSmrg    % Then, we expand the body so that argument are replaced by their
7527*36ac495dSmrg    % values. The trick for values not to be expanded themselves is that they
7528*36ac495dSmrg    % are within tokens and that tokens expand only once in an \edef .
7529*36ac495dSmrg    \edef\@tempc{\csname mac.\macroname .body\endcsname}%
7530*36ac495dSmrg    % Now we restore the token stack pointer to free the token list registers
7531*36ac495dSmrg    % which we have used, but we make sure that expanded body is saved after
7532*36ac495dSmrg    % group.
7533*36ac495dSmrg    \expandafter
7534*36ac495dSmrg  \endgroup
7535*36ac495dSmrg  \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
7536*36ac495dSmrg  }
7537*36ac495dSmrg
7538*36ac495dSmrg\def\macargexpandinbody@{%
7539*36ac495dSmrg  %% Define the named-macro outside of this group and then close this group.
7540*36ac495dSmrg  \expandafter
7541*36ac495dSmrg  \endgroup
7542*36ac495dSmrg  \macargdeflist@
7543*36ac495dSmrg  % First the replace in body the macro arguments by their values, the result
7544*36ac495dSmrg  % is in \@tempa .
7545*36ac495dSmrg  \macvalstoargs@
7546*36ac495dSmrg  % Then we point at the \norecurse or \gobble (for recursive) macro value
7547*36ac495dSmrg  % with \@tempb .
7548*36ac495dSmrg  \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
7549*36ac495dSmrg  % Depending on whether it is recursive or not, we need some tailing
7550*36ac495dSmrg  % \egroup .
7551*36ac495dSmrg  \ifx\@tempb\gobble
7552*36ac495dSmrg     \let\@tempc\relax
7553*36ac495dSmrg  \else
7554*36ac495dSmrg     \let\@tempc\egroup
7555*36ac495dSmrg  \fi
7556*36ac495dSmrg  % And now we do the real job:
7557*36ac495dSmrg  \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
7558*36ac495dSmrg  \@tempd
7559*36ac495dSmrg}
7560*36ac495dSmrg
7561*36ac495dSmrg\def\putargsintokens@#1,{%
7562*36ac495dSmrg  \if#1;\let\next\relax
7563*36ac495dSmrg  \else
7564*36ac495dSmrg    \let\next\putargsintokens@
7565*36ac495dSmrg    % First we allocate the new token list register, and give it a temporary
7566*36ac495dSmrg    % alias \@tempb .
7567*36ac495dSmrg    \toksdef\@tempb\the\paramno
7568*36ac495dSmrg    % Then we place the argument value into that token list register.
7569*36ac495dSmrg    \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
7570*36ac495dSmrg    \expandafter\@tempb\expandafter{\@tempa}%
7571*36ac495dSmrg    \advance\paramno by 1\relax
7572*36ac495dSmrg  \fi
7573*36ac495dSmrg  \next
7574*36ac495dSmrg}
7575*36ac495dSmrg
7576*36ac495dSmrg% Save the token stack pointer into macro #1
7577*36ac495dSmrg\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
7578*36ac495dSmrg% Restore the token stack pointer from number in macro #1
7579*36ac495dSmrg\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
7580*36ac495dSmrg% newtoks that can be used non \outer .
7581*36ac495dSmrg\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
7582*36ac495dSmrg
7583*36ac495dSmrg% Tailing missing arguments are set to empty
7584*36ac495dSmrg\def\setemptyargvalues@{%
7585*36ac495dSmrg  \ifx\paramlist\nilm@
7586*36ac495dSmrg    \let\next\macargexpandinbody@
7587*36ac495dSmrg  \else
7588*36ac495dSmrg    \expandafter\setemptyargvaluesparser@\paramlist\endargs@
7589*36ac495dSmrg    \let\next\setemptyargvalues@
7590*36ac495dSmrg  \fi
7591*36ac495dSmrg  \next
7592*36ac495dSmrg}
7593*36ac495dSmrg
7594*36ac495dSmrg\def\setemptyargvaluesparser@#1,#2\endargs@{%
7595*36ac495dSmrg  \expandafter\def\expandafter\@tempa\expandafter{%
7596*36ac495dSmrg    \expandafter\def\csname macarg.#1\endcsname{}}%
7597*36ac495dSmrg  \push@\@tempa\macargdeflist@
7598*36ac495dSmrg  \def\paramlist{#2}%
7599*36ac495dSmrg}
7600*36ac495dSmrg
7601*36ac495dSmrg% #1 is the element target macro
7602*36ac495dSmrg% #2 is the list macro
7603*36ac495dSmrg% #3,#4\endargs@ is the list value
7604*36ac495dSmrg\def\pop@#1#2#3,#4\endargs@{%
7605*36ac495dSmrg   \def#1{#3}%
7606*36ac495dSmrg   \def#2{#4}%
7607*36ac495dSmrg}
7608*36ac495dSmrg\long\def\longpop@#1#2#3,#4\endargs@{%
7609*36ac495dSmrg   \long\def#1{#3}%
7610*36ac495dSmrg   \long\def#2{#4}%
7611*36ac495dSmrg}
7612*36ac495dSmrg
7613*36ac495dSmrg% This defines a Texinfo @macro. There are eight cases: recursive and
7614*36ac495dSmrg% nonrecursive macros of zero, one, up to nine, and many arguments.
7615*36ac495dSmrg% Much magic with \expandafter here.
7616*36ac495dSmrg% \xdef is used so that macro definitions will survive the file
7617*36ac495dSmrg% they're defined in; @include reads the file inside a group.
7618*36ac495dSmrg%
7619*36ac495dSmrg\def\defmacro{%
7620*36ac495dSmrg  \let\hash=##% convert placeholders to macro parameter chars
7621*36ac495dSmrg  \ifrecursive
7622*36ac495dSmrg    \ifcase\paramno
7623*36ac495dSmrg    % 0
7624*36ac495dSmrg      \expandafter\xdef\csname\the\macname\endcsname{%
7625*36ac495dSmrg        \noexpand\scanmacro{\temp}}%
7626*36ac495dSmrg    \or % 1
7627*36ac495dSmrg      \expandafter\xdef\csname\the\macname\endcsname{%
7628*36ac495dSmrg         \bgroup\noexpand\macroargctxt
7629*36ac495dSmrg         \noexpand\braceorline
7630*36ac495dSmrg         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
7631*36ac495dSmrg      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
7632*36ac495dSmrg         \egroup\noexpand\scanmacro{\temp}}%
7633*36ac495dSmrg    \else
7634*36ac495dSmrg      \ifnum\paramno<10\relax % at most 9
7635*36ac495dSmrg        \expandafter\xdef\csname\the\macname\endcsname{%
7636*36ac495dSmrg           \bgroup\noexpand\macroargctxt
7637*36ac495dSmrg           \noexpand\csname\the\macname xx\endcsname}%
7638*36ac495dSmrg        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
7639*36ac495dSmrg            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
7640*36ac495dSmrg        \expandafter\expandafter
7641*36ac495dSmrg        \expandafter\xdef
7642*36ac495dSmrg        \expandafter\expandafter
7643*36ac495dSmrg          \csname\the\macname xxx\endcsname
7644*36ac495dSmrg            \paramlist{\egroup\noexpand\scanmacro{\temp}}%
7645*36ac495dSmrg      \else % 10 or more
7646*36ac495dSmrg        \expandafter\xdef\csname\the\macname\endcsname{%
7647*36ac495dSmrg          \noexpand\getargvals@{\the\macname}{\argl}%
7648*36ac495dSmrg        }%
7649*36ac495dSmrg        \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
7650*36ac495dSmrg        \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
7651*36ac495dSmrg      \fi
7652*36ac495dSmrg    \fi
7653*36ac495dSmrg  \else
7654*36ac495dSmrg    \ifcase\paramno
7655*36ac495dSmrg    % 0
7656*36ac495dSmrg      \expandafter\xdef\csname\the\macname\endcsname{%
7657*36ac495dSmrg        \noexpand\norecurse{\the\macname}%
7658*36ac495dSmrg        \noexpand\scanmacro{\temp}\egroup}%
7659*36ac495dSmrg    \or % 1
7660*36ac495dSmrg      \expandafter\xdef\csname\the\macname\endcsname{%
7661*36ac495dSmrg         \bgroup\noexpand\macroargctxt
7662*36ac495dSmrg         \noexpand\braceorline
7663*36ac495dSmrg         \expandafter\noexpand\csname\the\macname xxx\endcsname}%
7664*36ac495dSmrg      \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
7665*36ac495dSmrg        \egroup
7666*36ac495dSmrg        \noexpand\norecurse{\the\macname}%
7667*36ac495dSmrg        \noexpand\scanmacro{\temp}\egroup}%
7668*36ac495dSmrg    \else % at most 9
7669*36ac495dSmrg      \ifnum\paramno<10\relax
7670*36ac495dSmrg        \expandafter\xdef\csname\the\macname\endcsname{%
7671*36ac495dSmrg           \bgroup\noexpand\macroargctxt
7672*36ac495dSmrg           \expandafter\noexpand\csname\the\macname xx\endcsname}%
7673*36ac495dSmrg        \expandafter\xdef\csname\the\macname xx\endcsname##1{%
7674*36ac495dSmrg            \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
7675*36ac495dSmrg        \expandafter\expandafter
7676*36ac495dSmrg        \expandafter\xdef
7677*36ac495dSmrg        \expandafter\expandafter
7678*36ac495dSmrg        \csname\the\macname xxx\endcsname
7679*36ac495dSmrg        \paramlist{%
7680*36ac495dSmrg            \egroup
7681*36ac495dSmrg            \noexpand\norecurse{\the\macname}%
7682*36ac495dSmrg            \noexpand\scanmacro{\temp}\egroup}%
7683*36ac495dSmrg      \else % 10 or more:
7684*36ac495dSmrg        \expandafter\xdef\csname\the\macname\endcsname{%
7685*36ac495dSmrg          \noexpand\getargvals@{\the\macname}{\argl}%
7686*36ac495dSmrg        }%
7687*36ac495dSmrg        \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
7688*36ac495dSmrg        \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
7689*36ac495dSmrg      \fi
7690*36ac495dSmrg    \fi
7691*36ac495dSmrg  \fi}
7692*36ac495dSmrg
7693*36ac495dSmrg\catcode `\@\texiatcatcode\relax
7694*36ac495dSmrg
7695*36ac495dSmrg\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
7696*36ac495dSmrg
7697*36ac495dSmrg% \braceorline decides whether the next nonwhitespace character is a
7698*36ac495dSmrg% {.  If so it reads up to the closing }, if not, it reads the whole
7699*36ac495dSmrg% line.  Whatever was read is then fed to the next control sequence
7700*36ac495dSmrg% as an argument (by \parsebrace or \parsearg).
7701*36ac495dSmrg%
7702*36ac495dSmrg\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
7703*36ac495dSmrg\def\braceorlinexxx{%
7704*36ac495dSmrg  \ifx\nchar\bgroup\else
7705*36ac495dSmrg    \expandafter\parsearg
7706*36ac495dSmrg  \fi \macnamexxx}
7707*36ac495dSmrg
7708*36ac495dSmrg
7709*36ac495dSmrg% @alias.
7710*36ac495dSmrg% We need some trickery to remove the optional spaces around the equal
7711*36ac495dSmrg% sign.  Make them active and then expand them all to nothing.
7712*36ac495dSmrg%
7713*36ac495dSmrg\def\alias{\parseargusing\obeyspaces\aliasxxx}
7714*36ac495dSmrg\def\aliasxxx #1{\aliasyyy#1\relax}
7715*36ac495dSmrg\def\aliasyyy #1=#2\relax{%
7716*36ac495dSmrg  {%
7717*36ac495dSmrg    \expandafter\let\obeyedspace=\empty
7718*36ac495dSmrg    \addtomacrolist{#1}%
7719*36ac495dSmrg    \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
7720*36ac495dSmrg  }%
7721*36ac495dSmrg  \next
7722*36ac495dSmrg}
7723*36ac495dSmrg
7724*36ac495dSmrg
7725*36ac495dSmrg\message{cross references,}
7726*36ac495dSmrg
7727*36ac495dSmrg\newwrite\auxfile
7728*36ac495dSmrg\newif\ifhavexrefs    % True if xref values are known.
7729*36ac495dSmrg\newif\ifwarnedxrefs  % True if we warned once that they aren't known.
7730*36ac495dSmrg
7731*36ac495dSmrg% @inforef is relatively simple.
7732*36ac495dSmrg\def\inforef #1{\inforefzzz #1,,,,**}
7733*36ac495dSmrg\def\inforefzzz #1,#2,#3,#4**{%
7734*36ac495dSmrg  \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
7735*36ac495dSmrg  node \samp{\ignorespaces#1{}}}
7736*36ac495dSmrg
7737*36ac495dSmrg% @node's only job in TeX is to define \lastnode, which is used in
7738*36ac495dSmrg% cross-references.  The @node line might or might not have commas, and
7739*36ac495dSmrg% might or might not have spaces before the first comma, like:
7740*36ac495dSmrg% @node foo , bar , ...
7741*36ac495dSmrg% We don't want such trailing spaces in the node name.
7742*36ac495dSmrg%
7743*36ac495dSmrg\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
7744*36ac495dSmrg%
7745*36ac495dSmrg% also remove a trailing comma, in case of something like this:
7746*36ac495dSmrg% @node Help-Cross,  ,  , Cross-refs
7747*36ac495dSmrg\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
7748*36ac495dSmrg\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
7749*36ac495dSmrg
7750*36ac495dSmrg\let\nwnode=\node
7751*36ac495dSmrg\let\lastnode=\empty
7752*36ac495dSmrg
7753*36ac495dSmrg% Write a cross-reference definition for the current node.  #1 is the
7754*36ac495dSmrg% type (Ynumbered, Yappendix, Ynothing).
7755*36ac495dSmrg%
7756*36ac495dSmrg\def\donoderef#1{%
7757*36ac495dSmrg  \ifx\lastnode\empty\else
7758*36ac495dSmrg    \setref{\lastnode}{#1}%
7759*36ac495dSmrg    \global\let\lastnode=\empty
7760*36ac495dSmrg  \fi
7761*36ac495dSmrg}
7762*36ac495dSmrg
7763*36ac495dSmrg% @anchor{NAME} -- define xref target at arbitrary point.
7764*36ac495dSmrg%
7765*36ac495dSmrg\newcount\savesfregister
7766*36ac495dSmrg%
7767*36ac495dSmrg\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
7768*36ac495dSmrg\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
7769*36ac495dSmrg\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
7770*36ac495dSmrg
7771*36ac495dSmrg% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
7772*36ac495dSmrg% anchor), which consists of three parts:
7773*36ac495dSmrg% 1) NAME-title - the current sectioning name taken from \lastsection,
7774*36ac495dSmrg%                 or the anchor name.
7775*36ac495dSmrg% 2) NAME-snt   - section number and type, passed as the SNT arg, or
7776*36ac495dSmrg%                 empty for anchors.
7777*36ac495dSmrg% 3) NAME-pg    - the page number.
7778*36ac495dSmrg%
7779*36ac495dSmrg% This is called from \donoderef, \anchor, and \dofloat.  In the case of
7780*36ac495dSmrg% floats, there is an additional part, which is not written here:
7781*36ac495dSmrg% 4) NAME-lof   - the text as it should appear in a @listoffloats.
7782*36ac495dSmrg%
7783*36ac495dSmrg\def\setref#1#2{%
7784*36ac495dSmrg  \pdfmkdest{#1}%
7785*36ac495dSmrg  \iflinks
7786*36ac495dSmrg    {%
7787*36ac495dSmrg      \atdummies  % preserve commands, but don't expand them
7788*36ac495dSmrg      \edef\writexrdef##1##2{%
7789*36ac495dSmrg	\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
7790*36ac495dSmrg	  ##1}{##2}}% these are parameters of \writexrdef
7791*36ac495dSmrg      }%
7792*36ac495dSmrg      \toks0 = \expandafter{\lastsection}%
7793*36ac495dSmrg      \immediate \writexrdef{title}{\the\toks0 }%
7794*36ac495dSmrg      \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
7795*36ac495dSmrg      \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
7796*36ac495dSmrg    }%
7797*36ac495dSmrg  \fi
7798*36ac495dSmrg}
7799*36ac495dSmrg
7800*36ac495dSmrg% @xrefautosectiontitle on|off says whether @section(ing) names are used
7801*36ac495dSmrg% automatically in xrefs, if the third arg is not explicitly specified.
7802*36ac495dSmrg% This was provided as a "secret" @set xref-automatic-section-title
7803*36ac495dSmrg% variable, now it's official.
7804*36ac495dSmrg%
7805*36ac495dSmrg\parseargdef\xrefautomaticsectiontitle{%
7806*36ac495dSmrg  \def\temp{#1}%
7807*36ac495dSmrg  \ifx\temp\onword
7808*36ac495dSmrg    \expandafter\let\csname SETxref-automatic-section-title\endcsname
7809*36ac495dSmrg      = \empty
7810*36ac495dSmrg  \else\ifx\temp\offword
7811*36ac495dSmrg    \expandafter\let\csname SETxref-automatic-section-title\endcsname
7812*36ac495dSmrg      = \relax
7813*36ac495dSmrg  \else
7814*36ac495dSmrg    \errhelp = \EMsimple
7815*36ac495dSmrg    \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
7816*36ac495dSmrg                must be on|off}%
7817*36ac495dSmrg  \fi\fi
7818*36ac495dSmrg}
7819*36ac495dSmrg
7820*36ac495dSmrg%
7821*36ac495dSmrg% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
7822*36ac495dSmrg% the node name, #2 the name of the Info cross-reference, #3 the printed
7823*36ac495dSmrg% node name, #4 the name of the Info file, #5 the name of the printed
7824*36ac495dSmrg% manual.  All but the node name can be omitted.
7825*36ac495dSmrg%
7826*36ac495dSmrg\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
7827*36ac495dSmrg\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
7828*36ac495dSmrg\def\ref#1{\xrefX[#1,,,,,,,]}
7829*36ac495dSmrg%
7830*36ac495dSmrg\newbox\toprefbox
7831*36ac495dSmrg\newbox\printedrefnamebox
7832*36ac495dSmrg\newbox\infofilenamebox
7833*36ac495dSmrg\newbox\printedmanualbox
7834*36ac495dSmrg%
7835*36ac495dSmrg\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
7836*36ac495dSmrg  \unsepspaces
7837*36ac495dSmrg  %
7838*36ac495dSmrg  % Get args without leading/trailing spaces.
7839*36ac495dSmrg  \def\printedrefname{\ignorespaces #3}%
7840*36ac495dSmrg  \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
7841*36ac495dSmrg  %
7842*36ac495dSmrg  \def\infofilename{\ignorespaces #4}%
7843*36ac495dSmrg  \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
7844*36ac495dSmrg  %
7845*36ac495dSmrg  \def\printedmanual{\ignorespaces #5}%
7846*36ac495dSmrg  \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
7847*36ac495dSmrg  %
7848*36ac495dSmrg  % If the printed reference name (arg #3) was not explicitly given in
7849*36ac495dSmrg  % the @xref, figure out what we want to use.
7850*36ac495dSmrg  \ifdim \wd\printedrefnamebox = 0pt
7851*36ac495dSmrg    % No printed node name was explicitly given.
7852*36ac495dSmrg    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
7853*36ac495dSmrg      % Not auto section-title: use node name inside the square brackets.
7854*36ac495dSmrg      \def\printedrefname{\ignorespaces #1}%
7855*36ac495dSmrg    \else
7856*36ac495dSmrg      % Auto section-title: use chapter/section title inside
7857*36ac495dSmrg      % the square brackets if we have it.
7858*36ac495dSmrg      \ifdim \wd\printedmanualbox > 0pt
7859*36ac495dSmrg        % It is in another manual, so we don't have it; use node name.
7860*36ac495dSmrg        \def\printedrefname{\ignorespaces #1}%
7861*36ac495dSmrg      \else
7862*36ac495dSmrg        \ifhavexrefs
7863*36ac495dSmrg          % We (should) know the real title if we have the xref values.
7864*36ac495dSmrg          \def\printedrefname{\refx{#1-title}{}}%
7865*36ac495dSmrg        \else
7866*36ac495dSmrg          % Otherwise just copy the Info node name.
7867*36ac495dSmrg          \def\printedrefname{\ignorespaces #1}%
7868*36ac495dSmrg        \fi%
7869*36ac495dSmrg      \fi
7870*36ac495dSmrg    \fi
7871*36ac495dSmrg  \fi
7872*36ac495dSmrg  %
7873*36ac495dSmrg  % Make link in pdf output.
7874*36ac495dSmrg  \ifpdf
7875*36ac495dSmrg    {\indexnofonts
7876*36ac495dSmrg     \turnoffactive
7877*36ac495dSmrg     \makevalueexpandable
7878*36ac495dSmrg     % This expands tokens, so do it after making catcode changes, so _
7879*36ac495dSmrg     % etc. don't get their TeX definitions.  This ignores all spaces in
7880*36ac495dSmrg     % #4, including (wrongly) those in the middle of the filename.
7881*36ac495dSmrg     \getfilename{#4}%
7882*36ac495dSmrg     %
7883*36ac495dSmrg     % This (wrongly) does not take account of leading or trailing
7884*36ac495dSmrg     % spaces in #1, which should be ignored.
7885*36ac495dSmrg     \edef\pdfxrefdest{#1}%
7886*36ac495dSmrg     \ifx\pdfxrefdest\empty
7887*36ac495dSmrg       \def\pdfxrefdest{Top}% no empty targets
7888*36ac495dSmrg     \else
7889*36ac495dSmrg       \txiescapepdf\pdfxrefdest  % escape PDF special chars
7890*36ac495dSmrg     \fi
7891*36ac495dSmrg     %
7892*36ac495dSmrg     \leavevmode
7893*36ac495dSmrg     \startlink attr{/Border [0 0 0]}%
7894*36ac495dSmrg     \ifnum\filenamelength>0
7895*36ac495dSmrg       goto file{\the\filename.pdf} name{\pdfxrefdest}%
7896*36ac495dSmrg     \else
7897*36ac495dSmrg       goto name{\pdfmkpgn{\pdfxrefdest}}%
7898*36ac495dSmrg     \fi
7899*36ac495dSmrg    }%
7900*36ac495dSmrg    \setcolor{\linkcolor}%
7901*36ac495dSmrg  \fi
7902*36ac495dSmrg  %
7903*36ac495dSmrg  % Float references are printed completely differently: "Figure 1.2"
7904*36ac495dSmrg  % instead of "[somenode], p.3".  We distinguish them by the
7905*36ac495dSmrg  % LABEL-title being set to a magic string.
7906*36ac495dSmrg  {%
7907*36ac495dSmrg    % Have to otherify everything special to allow the \csname to
7908*36ac495dSmrg    % include an _ in the xref name, etc.
7909*36ac495dSmrg    \indexnofonts
7910*36ac495dSmrg    \turnoffactive
7911*36ac495dSmrg    \expandafter\global\expandafter\let\expandafter\Xthisreftitle
7912*36ac495dSmrg      \csname XR#1-title\endcsname
7913*36ac495dSmrg  }%
7914*36ac495dSmrg  \iffloat\Xthisreftitle
7915*36ac495dSmrg    % If the user specified the print name (third arg) to the ref,
7916*36ac495dSmrg    % print it instead of our usual "Figure 1.2".
7917*36ac495dSmrg    \ifdim\wd\printedrefnamebox = 0pt
7918*36ac495dSmrg      \refx{#1-snt}{}%
7919*36ac495dSmrg    \else
7920*36ac495dSmrg      \printedrefname
7921*36ac495dSmrg    \fi
7922*36ac495dSmrg    %
7923*36ac495dSmrg    % If the user also gave the printed manual name (fifth arg), append
7924*36ac495dSmrg    % "in MANUALNAME".
7925*36ac495dSmrg    \ifdim \wd\printedmanualbox > 0pt
7926*36ac495dSmrg      \space \putwordin{} \cite{\printedmanual}%
7927*36ac495dSmrg    \fi
7928*36ac495dSmrg  \else
7929*36ac495dSmrg    % node/anchor (non-float) references.
7930*36ac495dSmrg    %
7931*36ac495dSmrg    % If we use \unhbox to print the node names, TeX does not insert
7932*36ac495dSmrg    % empty discretionaries after hyphens, which means that it will not
7933*36ac495dSmrg    % find a line break at a hyphen in a node names.  Since some manuals
7934*36ac495dSmrg    % are best written with fairly long node names, containing hyphens,
7935*36ac495dSmrg    % this is a loss.  Therefore, we give the text of the node name
7936*36ac495dSmrg    % again, so it is as if TeX is seeing it for the first time.
7937*36ac495dSmrg    %
7938*36ac495dSmrg    \ifdim \wd\printedmanualbox > 0pt
7939*36ac495dSmrg      % Cross-manual reference with a printed manual name.
7940*36ac495dSmrg      %
7941*36ac495dSmrg      \crossmanualxref{\cite{\printedmanual\unskip}}%
7942*36ac495dSmrg    %
7943*36ac495dSmrg    \else\ifdim \wd\infofilenamebox > 0pt
7944*36ac495dSmrg      % Cross-manual reference with only an info filename (arg 4), no
7945*36ac495dSmrg      % printed manual name (arg 5).  This is essentially the same as
7946*36ac495dSmrg      % the case above; we output the filename, since we have nothing else.
7947*36ac495dSmrg      %
7948*36ac495dSmrg      \crossmanualxref{\code{\infofilename\unskip}}%
7949*36ac495dSmrg    %
7950*36ac495dSmrg    \else
7951*36ac495dSmrg      % Reference within this manual.
7952*36ac495dSmrg      %
7953*36ac495dSmrg      % _ (for example) has to be the character _ for the purposes of the
7954*36ac495dSmrg      % control sequence corresponding to the node, but it has to expand
7955*36ac495dSmrg      % into the usual \leavevmode...\vrule stuff for purposes of
7956*36ac495dSmrg      % printing. So we \turnoffactive for the \refx-snt, back on for the
7957*36ac495dSmrg      % printing, back off for the \refx-pg.
7958*36ac495dSmrg      {\turnoffactive
7959*36ac495dSmrg       % Only output a following space if the -snt ref is nonempty; for
7960*36ac495dSmrg       % @unnumbered and @anchor, it won't be.
7961*36ac495dSmrg       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
7962*36ac495dSmrg       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
7963*36ac495dSmrg      }%
7964*36ac495dSmrg      % output the `[mynode]' via the macro below so it can be overridden.
7965*36ac495dSmrg      \xrefprintnodename\printedrefname
7966*36ac495dSmrg      %
7967*36ac495dSmrg      % But we always want a comma and a space:
7968*36ac495dSmrg      ,\space
7969*36ac495dSmrg      %
7970*36ac495dSmrg      % output the `page 3'.
7971*36ac495dSmrg      \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
7972*36ac495dSmrg    \fi\fi
7973*36ac495dSmrg  \fi
7974*36ac495dSmrg  \endlink
7975*36ac495dSmrg\endgroup}
7976*36ac495dSmrg
7977*36ac495dSmrg% Output a cross-manual xref to #1.  Used just above (twice).
7978*36ac495dSmrg%
7979*36ac495dSmrg% Only include the text "Section ``foo'' in" if the foo is neither
7980*36ac495dSmrg% missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
7981*36ac495dSmrg% "see The Foo Manual", the idea being to refer to the whole manual.
7982*36ac495dSmrg%
7983*36ac495dSmrg% But, this being TeX, we can't easily compare our node name against the
7984*36ac495dSmrg% string "Top" while ignoring the possible spaces before and after in
7985*36ac495dSmrg% the input.  By adding the arbitrary 7sp below, we make it much less
7986*36ac495dSmrg% likely that a real node name would have the same width as "Top" (e.g.,
7987*36ac495dSmrg% in a monospaced font).  Hopefully it will never happen in practice.
7988*36ac495dSmrg%
7989*36ac495dSmrg% For the same basic reason, we retypeset the "Top" at every
7990*36ac495dSmrg% reference, since the current font is indeterminate.
7991*36ac495dSmrg%
7992*36ac495dSmrg\def\crossmanualxref#1{%
7993*36ac495dSmrg  \setbox\toprefbox = \hbox{Top\kern7sp}%
7994*36ac495dSmrg  \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
7995*36ac495dSmrg  \ifdim \wd2 > 7sp  % nonempty?
7996*36ac495dSmrg    \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
7997*36ac495dSmrg      \putwordSection{} ``\printedrefname'' \putwordin{}\space
7998*36ac495dSmrg    \fi
7999*36ac495dSmrg  \fi
8000*36ac495dSmrg  #1%
8001*36ac495dSmrg}
8002*36ac495dSmrg
8003*36ac495dSmrg% This macro is called from \xrefX for the `[nodename]' part of xref
8004*36ac495dSmrg% output.  It's a separate macro only so it can be changed more easily,
8005*36ac495dSmrg% since square brackets don't work well in some documents.  Particularly
8006*36ac495dSmrg% one that Bob is working on :).
8007*36ac495dSmrg%
8008*36ac495dSmrg\def\xrefprintnodename#1{[#1]}
8009*36ac495dSmrg
8010*36ac495dSmrg% Things referred to by \setref.
8011*36ac495dSmrg%
8012*36ac495dSmrg\def\Ynothing{}
8013*36ac495dSmrg\def\Yomitfromtoc{}
8014*36ac495dSmrg\def\Ynumbered{%
8015*36ac495dSmrg  \ifnum\secno=0
8016*36ac495dSmrg    \putwordChapter@tie \the\chapno
8017*36ac495dSmrg  \else \ifnum\subsecno=0
8018*36ac495dSmrg    \putwordSection@tie \the\chapno.\the\secno
8019*36ac495dSmrg  \else \ifnum\subsubsecno=0
8020*36ac495dSmrg    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
8021*36ac495dSmrg  \else
8022*36ac495dSmrg    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
8023*36ac495dSmrg  \fi\fi\fi
8024*36ac495dSmrg}
8025*36ac495dSmrg\def\Yappendix{%
8026*36ac495dSmrg  \ifnum\secno=0
8027*36ac495dSmrg     \putwordAppendix@tie @char\the\appendixno{}%
8028*36ac495dSmrg  \else \ifnum\subsecno=0
8029*36ac495dSmrg     \putwordSection@tie @char\the\appendixno.\the\secno
8030*36ac495dSmrg  \else \ifnum\subsubsecno=0
8031*36ac495dSmrg    \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
8032*36ac495dSmrg  \else
8033*36ac495dSmrg    \putwordSection@tie
8034*36ac495dSmrg      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
8035*36ac495dSmrg  \fi\fi\fi
8036*36ac495dSmrg}
8037*36ac495dSmrg
8038*36ac495dSmrg% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
8039*36ac495dSmrg% If its value is nonempty, SUFFIX is output afterward.
8040*36ac495dSmrg%
8041*36ac495dSmrg\def\refx#1#2{%
8042*36ac495dSmrg  {%
8043*36ac495dSmrg    \indexnofonts
8044*36ac495dSmrg    \otherbackslash
8045*36ac495dSmrg    \expandafter\global\expandafter\let\expandafter\thisrefX
8046*36ac495dSmrg      \csname XR#1\endcsname
8047*36ac495dSmrg  }%
8048*36ac495dSmrg  \ifx\thisrefX\relax
8049*36ac495dSmrg    % If not defined, say something at least.
8050*36ac495dSmrg    \angleleft un\-de\-fined\angleright
8051*36ac495dSmrg    \iflinks
8052*36ac495dSmrg      \ifhavexrefs
8053*36ac495dSmrg        {\toks0 = {#1}% avoid expansion of possibly-complex value
8054*36ac495dSmrg         \message{\linenumber Undefined cross reference `\the\toks0'.}}%
8055*36ac495dSmrg      \else
8056*36ac495dSmrg        \ifwarnedxrefs\else
8057*36ac495dSmrg          \global\warnedxrefstrue
8058*36ac495dSmrg          \message{Cross reference values unknown; you must run TeX again.}%
8059*36ac495dSmrg        \fi
8060*36ac495dSmrg      \fi
8061*36ac495dSmrg    \fi
8062*36ac495dSmrg  \else
8063*36ac495dSmrg    % It's defined, so just use it.
8064*36ac495dSmrg    \thisrefX
8065*36ac495dSmrg  \fi
8066*36ac495dSmrg  #2% Output the suffix in any case.
8067*36ac495dSmrg}
8068*36ac495dSmrg
8069*36ac495dSmrg% This is the macro invoked by entries in the aux file.  Usually it's
8070*36ac495dSmrg% just a \def (we prepend XR to the control sequence name to avoid
8071*36ac495dSmrg% collisions).  But if this is a float type, we have more work to do.
8072*36ac495dSmrg%
8073*36ac495dSmrg\def\xrdef#1#2{%
8074*36ac495dSmrg  {% The node name might contain 8-bit characters, which in our current
8075*36ac495dSmrg   % implementation are changed to commands like @'e.  Don't let these
8076*36ac495dSmrg   % mess up the control sequence name.
8077*36ac495dSmrg    \indexnofonts
8078*36ac495dSmrg    \turnoffactive
8079*36ac495dSmrg    \xdef\safexrefname{#1}%
8080*36ac495dSmrg  }%
8081*36ac495dSmrg  %
8082*36ac495dSmrg  \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
8083*36ac495dSmrg  %
8084*36ac495dSmrg  % Was that xref control sequence that we just defined for a float?
8085*36ac495dSmrg  \expandafter\iffloat\csname XR\safexrefname\endcsname
8086*36ac495dSmrg    % it was a float, and we have the (safe) float type in \iffloattype.
8087*36ac495dSmrg    \expandafter\let\expandafter\floatlist
8088*36ac495dSmrg      \csname floatlist\iffloattype\endcsname
8089*36ac495dSmrg    %
8090*36ac495dSmrg    % Is this the first time we've seen this float type?
8091*36ac495dSmrg    \expandafter\ifx\floatlist\relax
8092*36ac495dSmrg      \toks0 = {\do}% yes, so just \do
8093*36ac495dSmrg    \else
8094*36ac495dSmrg      % had it before, so preserve previous elements in list.
8095*36ac495dSmrg      \toks0 = \expandafter{\floatlist\do}%
8096*36ac495dSmrg    \fi
8097*36ac495dSmrg    %
8098*36ac495dSmrg    % Remember this xref in the control sequence \floatlistFLOATTYPE,
8099*36ac495dSmrg    % for later use in \listoffloats.
8100*36ac495dSmrg    \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
8101*36ac495dSmrg      {\safexrefname}}%
8102*36ac495dSmrg  \fi
8103*36ac495dSmrg}
8104*36ac495dSmrg
8105*36ac495dSmrg% Read the last existing aux file, if any.  No error if none exists.
8106*36ac495dSmrg%
8107*36ac495dSmrg\def\tryauxfile{%
8108*36ac495dSmrg  \openin 1 \jobname.aux
8109*36ac495dSmrg  \ifeof 1 \else
8110*36ac495dSmrg    \readdatafile{aux}%
8111*36ac495dSmrg    \global\havexrefstrue
8112*36ac495dSmrg  \fi
8113*36ac495dSmrg  \closein 1
8114*36ac495dSmrg}
8115*36ac495dSmrg
8116*36ac495dSmrg\def\setupdatafile{%
8117*36ac495dSmrg  \catcode`\^^@=\other
8118*36ac495dSmrg  \catcode`\^^A=\other
8119*36ac495dSmrg  \catcode`\^^B=\other
8120*36ac495dSmrg  \catcode`\^^C=\other
8121*36ac495dSmrg  \catcode`\^^D=\other
8122*36ac495dSmrg  \catcode`\^^E=\other
8123*36ac495dSmrg  \catcode`\^^F=\other
8124*36ac495dSmrg  \catcode`\^^G=\other
8125*36ac495dSmrg  \catcode`\^^H=\other
8126*36ac495dSmrg  \catcode`\^^K=\other
8127*36ac495dSmrg  \catcode`\^^L=\other
8128*36ac495dSmrg  \catcode`\^^N=\other
8129*36ac495dSmrg  \catcode`\^^P=\other
8130*36ac495dSmrg  \catcode`\^^Q=\other
8131*36ac495dSmrg  \catcode`\^^R=\other
8132*36ac495dSmrg  \catcode`\^^S=\other
8133*36ac495dSmrg  \catcode`\^^T=\other
8134*36ac495dSmrg  \catcode`\^^U=\other
8135*36ac495dSmrg  \catcode`\^^V=\other
8136*36ac495dSmrg  \catcode`\^^W=\other
8137*36ac495dSmrg  \catcode`\^^X=\other
8138*36ac495dSmrg  \catcode`\^^Z=\other
8139*36ac495dSmrg  \catcode`\^^[=\other
8140*36ac495dSmrg  \catcode`\^^\=\other
8141*36ac495dSmrg  \catcode`\^^]=\other
8142*36ac495dSmrg  \catcode`\^^^=\other
8143*36ac495dSmrg  \catcode`\^^_=\other
8144*36ac495dSmrg  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
8145*36ac495dSmrg  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
8146*36ac495dSmrg  % supported in the main text, it doesn't seem desirable.  Furthermore,
8147*36ac495dSmrg  % that is not enough: for node names that actually contain a ^
8148*36ac495dSmrg  % character, we would end up writing a line like this: 'xrdef {'hat
8149*36ac495dSmrg  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
8150*36ac495dSmrg  % argument, and \hat is not an expandable control sequence.  It could
8151*36ac495dSmrg  % all be worked out, but why?  Either we support ^^ or we don't.
8152*36ac495dSmrg  %
8153*36ac495dSmrg  % The other change necessary for this was to define \auxhat:
8154*36ac495dSmrg  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
8155*36ac495dSmrg  % and then to call \auxhat in \setq.
8156*36ac495dSmrg  %
8157*36ac495dSmrg  \catcode`\^=\other
8158*36ac495dSmrg  %
8159*36ac495dSmrg  % Special characters.  Should be turned off anyway, but...
8160*36ac495dSmrg  \catcode`\~=\other
8161*36ac495dSmrg  \catcode`\[=\other
8162*36ac495dSmrg  \catcode`\]=\other
8163*36ac495dSmrg  \catcode`\"=\other
8164*36ac495dSmrg  \catcode`\_=\other
8165*36ac495dSmrg  \catcode`\|=\other
8166*36ac495dSmrg  \catcode`\<=\other
8167*36ac495dSmrg  \catcode`\>=\other
8168*36ac495dSmrg  \catcode`\$=\other
8169*36ac495dSmrg  \catcode`\#=\other
8170*36ac495dSmrg  \catcode`\&=\other
8171*36ac495dSmrg  \catcode`\%=\other
8172*36ac495dSmrg  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
8173*36ac495dSmrg  %
8174*36ac495dSmrg  % This is to support \ in node names and titles, since the \
8175*36ac495dSmrg  % characters end up in a \csname.  It's easier than
8176*36ac495dSmrg  % leaving it active and making its active definition an actual \
8177*36ac495dSmrg  % character.  What I don't understand is why it works in the *value*
8178*36ac495dSmrg  % of the xrdef.  Seems like it should be a catcode12 \, and that
8179*36ac495dSmrg  % should not typeset properly.  But it works, so I'm moving on for
8180*36ac495dSmrg  % now.  --karl, 15jan04.
8181*36ac495dSmrg  \catcode`\\=\other
8182*36ac495dSmrg  %
8183*36ac495dSmrg  % Make the characters 128-255 be printing characters.
8184*36ac495dSmrg  {%
8185*36ac495dSmrg    \count1=128
8186*36ac495dSmrg    \def\loop{%
8187*36ac495dSmrg      \catcode\count1=\other
8188*36ac495dSmrg      \advance\count1 by 1
8189*36ac495dSmrg      \ifnum \count1<256 \loop \fi
8190*36ac495dSmrg    }%
8191*36ac495dSmrg  }%
8192*36ac495dSmrg  %
8193*36ac495dSmrg  % @ is our escape character in .aux files, and we need braces.
8194*36ac495dSmrg  \catcode`\{=1
8195*36ac495dSmrg  \catcode`\}=2
8196*36ac495dSmrg  \catcode`\@=0
8197*36ac495dSmrg}
8198*36ac495dSmrg
8199*36ac495dSmrg\def\readdatafile#1{%
8200*36ac495dSmrg\begingroup
8201*36ac495dSmrg  \setupdatafile
8202*36ac495dSmrg  \input\jobname.#1
8203*36ac495dSmrg\endgroup}
8204*36ac495dSmrg
8205*36ac495dSmrg
8206*36ac495dSmrg\message{insertions,}
8207*36ac495dSmrg% including footnotes.
8208*36ac495dSmrg
8209*36ac495dSmrg\newcount \footnoteno
8210*36ac495dSmrg
8211*36ac495dSmrg% The trailing space in the following definition for supereject is
8212*36ac495dSmrg% vital for proper filling; pages come out unaligned when you do a
8213*36ac495dSmrg% pagealignmacro call if that space before the closing brace is
8214*36ac495dSmrg% removed. (Generally, numeric constants should always be followed by a
8215*36ac495dSmrg% space to prevent strange expansion errors.)
8216*36ac495dSmrg\def\supereject{\par\penalty -20000\footnoteno =0 }
8217*36ac495dSmrg
8218*36ac495dSmrg% @footnotestyle is meaningful for Info output only.
8219*36ac495dSmrg\let\footnotestyle=\comment
8220*36ac495dSmrg
8221*36ac495dSmrg{\catcode `\@=11
8222*36ac495dSmrg%
8223*36ac495dSmrg% Auto-number footnotes.  Otherwise like plain.
8224*36ac495dSmrg\gdef\footnote{%
8225*36ac495dSmrg  \let\indent=\ptexindent
8226*36ac495dSmrg  \let\noindent=\ptexnoindent
8227*36ac495dSmrg  \global\advance\footnoteno by \@ne
8228*36ac495dSmrg  \edef\thisfootno{$^{\the\footnoteno}$}%
8229*36ac495dSmrg  %
8230*36ac495dSmrg  % In case the footnote comes at the end of a sentence, preserve the
8231*36ac495dSmrg  % extra spacing after we do the footnote number.
8232*36ac495dSmrg  \let\@sf\empty
8233*36ac495dSmrg  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
8234*36ac495dSmrg  %
8235*36ac495dSmrg  % Remove inadvertent blank space before typesetting the footnote number.
8236*36ac495dSmrg  \unskip
8237*36ac495dSmrg  \thisfootno\@sf
8238*36ac495dSmrg  \dofootnote
8239*36ac495dSmrg}%
8240*36ac495dSmrg
8241*36ac495dSmrg% Don't bother with the trickery in plain.tex to not require the
8242*36ac495dSmrg% footnote text as a parameter.  Our footnotes don't need to be so general.
8243*36ac495dSmrg%
8244*36ac495dSmrg% Oh yes, they do; otherwise, @ifset (and anything else that uses
8245*36ac495dSmrg% \parseargline) fails inside footnotes because the tokens are fixed when
8246*36ac495dSmrg% the footnote is read.  --karl, 16nov96.
8247*36ac495dSmrg%
8248*36ac495dSmrg\gdef\dofootnote{%
8249*36ac495dSmrg  \insert\footins\bgroup
8250*36ac495dSmrg  % We want to typeset this text as a normal paragraph, even if the
8251*36ac495dSmrg  % footnote reference occurs in (for example) a display environment.
8252*36ac495dSmrg  % So reset some parameters.
8253*36ac495dSmrg  \hsize=\pagewidth
8254*36ac495dSmrg  \interlinepenalty\interfootnotelinepenalty
8255*36ac495dSmrg  \splittopskip\ht\strutbox % top baseline for broken footnotes
8256*36ac495dSmrg  \splitmaxdepth\dp\strutbox
8257*36ac495dSmrg  \floatingpenalty\@MM
8258*36ac495dSmrg  \leftskip\z@skip
8259*36ac495dSmrg  \rightskip\z@skip
8260*36ac495dSmrg  \spaceskip\z@skip
8261*36ac495dSmrg  \xspaceskip\z@skip
8262*36ac495dSmrg  \parindent\defaultparindent
8263*36ac495dSmrg  %
8264*36ac495dSmrg  \smallfonts \rm
8265*36ac495dSmrg  %
8266*36ac495dSmrg  % Because we use hanging indentation in footnotes, a @noindent appears
8267*36ac495dSmrg  % to exdent this text, so make it be a no-op.  makeinfo does not use
8268*36ac495dSmrg  % hanging indentation so @noindent can still be needed within footnote
8269*36ac495dSmrg  % text after an @example or the like (not that this is good style).
8270*36ac495dSmrg  \let\noindent = \relax
8271*36ac495dSmrg  %
8272*36ac495dSmrg  % Hang the footnote text off the number.  Use \everypar in case the
8273*36ac495dSmrg  % footnote extends for more than one paragraph.
8274*36ac495dSmrg  \everypar = {\hang}%
8275*36ac495dSmrg  \textindent{\thisfootno}%
8276*36ac495dSmrg  %
8277*36ac495dSmrg  % Don't crash into the line above the footnote text.  Since this
8278*36ac495dSmrg  % expands into a box, it must come within the paragraph, lest it
8279*36ac495dSmrg  % provide a place where TeX can split the footnote.
8280*36ac495dSmrg  \footstrut
8281*36ac495dSmrg  %
8282*36ac495dSmrg  % Invoke rest of plain TeX footnote routine.
8283*36ac495dSmrg  \futurelet\next\fo@t
8284*36ac495dSmrg}
8285*36ac495dSmrg}%end \catcode `\@=11
8286*36ac495dSmrg
8287*36ac495dSmrg% In case a @footnote appears in a vbox, save the footnote text and create
8288*36ac495dSmrg% the real \insert just after the vbox finished.  Otherwise, the insertion
8289*36ac495dSmrg% would be lost.
8290*36ac495dSmrg% Similarly, if a @footnote appears inside an alignment, save the footnote
8291*36ac495dSmrg% text to a box and make the \insert when a row of the table is finished.
8292*36ac495dSmrg% And the same can be done for other insert classes.  --kasal, 16nov03.
8293*36ac495dSmrg
8294*36ac495dSmrg% Replace the \insert primitive by a cheating macro.
8295*36ac495dSmrg% Deeper inside, just make sure that the saved insertions are not spilled
8296*36ac495dSmrg% out prematurely.
8297*36ac495dSmrg%
8298*36ac495dSmrg\def\startsavinginserts{%
8299*36ac495dSmrg  \ifx \insert\ptexinsert
8300*36ac495dSmrg    \let\insert\saveinsert
8301*36ac495dSmrg  \else
8302*36ac495dSmrg    \let\checkinserts\relax
8303*36ac495dSmrg  \fi
8304*36ac495dSmrg}
8305*36ac495dSmrg
8306*36ac495dSmrg% This \insert replacement works for both \insert\footins{foo} and
8307*36ac495dSmrg% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
8308*36ac495dSmrg%
8309*36ac495dSmrg\def\saveinsert#1{%
8310*36ac495dSmrg  \edef\next{\noexpand\savetobox \makeSAVEname#1}%
8311*36ac495dSmrg  \afterassignment\next
8312*36ac495dSmrg  % swallow the left brace
8313*36ac495dSmrg  \let\temp =
8314*36ac495dSmrg}
8315*36ac495dSmrg\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
8316*36ac495dSmrg\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
8317*36ac495dSmrg
8318*36ac495dSmrg\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
8319*36ac495dSmrg
8320*36ac495dSmrg\def\placesaveins#1{%
8321*36ac495dSmrg  \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
8322*36ac495dSmrg    {\box#1}%
8323*36ac495dSmrg}
8324*36ac495dSmrg
8325*36ac495dSmrg% eat @SAVE -- beware, all of them have catcode \other:
8326*36ac495dSmrg{
8327*36ac495dSmrg  \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
8328*36ac495dSmrg  \gdef\gobblesave @SAVE{}
8329*36ac495dSmrg}
8330*36ac495dSmrg
8331*36ac495dSmrg% initialization:
8332*36ac495dSmrg\def\newsaveins #1{%
8333*36ac495dSmrg  \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
8334*36ac495dSmrg  \next
8335*36ac495dSmrg}
8336*36ac495dSmrg\def\newsaveinsX #1{%
8337*36ac495dSmrg  \csname newbox\endcsname #1%
8338*36ac495dSmrg  \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
8339*36ac495dSmrg    \checksaveins #1}%
8340*36ac495dSmrg}
8341*36ac495dSmrg
8342*36ac495dSmrg% initialize:
8343*36ac495dSmrg\let\checkinserts\empty
8344*36ac495dSmrg\newsaveins\footins
8345*36ac495dSmrg\newsaveins\margin
8346*36ac495dSmrg
8347*36ac495dSmrg
8348*36ac495dSmrg% @image.  We use the macros from epsf.tex to support this.
8349*36ac495dSmrg% If epsf.tex is not installed and @image is used, we complain.
8350*36ac495dSmrg%
8351*36ac495dSmrg% Check for and read epsf.tex up front.  If we read it only at @image
8352*36ac495dSmrg% time, we might be inside a group, and then its definitions would get
8353*36ac495dSmrg% undone and the next image would fail.
8354*36ac495dSmrg\openin 1 = epsf.tex
8355*36ac495dSmrg\ifeof 1 \else
8356*36ac495dSmrg  % Do not bother showing banner with epsf.tex v2.7k (available in
8357*36ac495dSmrg  % doc/epsf.tex and on ctan).
8358*36ac495dSmrg  \def\epsfannounce{\toks0 = }%
8359*36ac495dSmrg  \input epsf.tex
8360*36ac495dSmrg\fi
8361*36ac495dSmrg\closein 1
8362*36ac495dSmrg%
8363*36ac495dSmrg% We will only complain once about lack of epsf.tex.
8364*36ac495dSmrg\newif\ifwarnednoepsf
8365*36ac495dSmrg\newhelp\noepsfhelp{epsf.tex must be installed for images to
8366*36ac495dSmrg  work.  It is also included in the Texinfo distribution, or you can get
8367*36ac495dSmrg  it from ftp://tug.org/tex/epsf.tex.}
8368*36ac495dSmrg%
8369*36ac495dSmrg\def\image#1{%
8370*36ac495dSmrg  \ifx\epsfbox\thisisundefined
8371*36ac495dSmrg    \ifwarnednoepsf \else
8372*36ac495dSmrg      \errhelp = \noepsfhelp
8373*36ac495dSmrg      \errmessage{epsf.tex not found, images will be ignored}%
8374*36ac495dSmrg      \global\warnednoepsftrue
8375*36ac495dSmrg    \fi
8376*36ac495dSmrg  \else
8377*36ac495dSmrg    \imagexxx #1,,,,,\finish
8378*36ac495dSmrg  \fi
8379*36ac495dSmrg}
8380*36ac495dSmrg%
8381*36ac495dSmrg% Arguments to @image:
8382*36ac495dSmrg% #1 is (mandatory) image filename; we tack on .eps extension.
8383*36ac495dSmrg% #2 is (optional) width, #3 is (optional) height.
8384*36ac495dSmrg% #4 is (ignored optional) html alt text.
8385*36ac495dSmrg% #5 is (ignored optional) extension.
8386*36ac495dSmrg% #6 is just the usual extra ignored arg for parsing stuff.
8387*36ac495dSmrg\newif\ifimagevmode
8388*36ac495dSmrg\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
8389*36ac495dSmrg  \catcode`\^^M = 5     % in case we're inside an example
8390*36ac495dSmrg  \normalturnoffactive  % allow _ et al. in names
8391*36ac495dSmrg  % If the image is by itself, center it.
8392*36ac495dSmrg  \ifvmode
8393*36ac495dSmrg    \imagevmodetrue
8394*36ac495dSmrg  \else \ifx\centersub\centerV
8395*36ac495dSmrg    % for @center @image, we need a vbox so we can have our vertical space
8396*36ac495dSmrg    \imagevmodetrue
8397*36ac495dSmrg    \vbox\bgroup % vbox has better behavior than vtop herev
8398*36ac495dSmrg  \fi\fi
8399*36ac495dSmrg  %
8400*36ac495dSmrg  \ifimagevmode
8401*36ac495dSmrg    \nobreak\medskip
8402*36ac495dSmrg    % Usually we'll have text after the image which will insert
8403*36ac495dSmrg    % \parskip glue, so insert it here too to equalize the space
8404*36ac495dSmrg    % above and below.
8405*36ac495dSmrg    \nobreak\vskip\parskip
8406*36ac495dSmrg    \nobreak
8407*36ac495dSmrg  \fi
8408*36ac495dSmrg  %
8409*36ac495dSmrg  % Leave vertical mode so that indentation from an enclosing
8410*36ac495dSmrg  %  environment such as @quotation is respected.
8411*36ac495dSmrg  % However, if we're at the top level, we don't want the
8412*36ac495dSmrg  %  normal paragraph indentation.
8413*36ac495dSmrg  % On the other hand, if we are in the case of @center @image, we don't
8414*36ac495dSmrg  %  want to start a paragraph, which will create a hsize-width box and
8415*36ac495dSmrg  %  eradicate the centering.
8416*36ac495dSmrg  \ifx\centersub\centerV\else \noindent \fi
8417*36ac495dSmrg  %
8418*36ac495dSmrg  % Output the image.
8419*36ac495dSmrg  \ifpdf
8420*36ac495dSmrg    \dopdfimage{#1}{#2}{#3}%
8421*36ac495dSmrg  \else
8422*36ac495dSmrg    % \epsfbox itself resets \epsf?size at each figure.
8423*36ac495dSmrg    \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
8424*36ac495dSmrg    \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
8425*36ac495dSmrg    \epsfbox{#1.eps}%
8426*36ac495dSmrg  \fi
8427*36ac495dSmrg  %
8428*36ac495dSmrg  \ifimagevmode
8429*36ac495dSmrg    \medskip  % space after a standalone image
8430*36ac495dSmrg  \fi
8431*36ac495dSmrg  \ifx\centersub\centerV \egroup \fi
8432*36ac495dSmrg\endgroup}
8433*36ac495dSmrg
8434*36ac495dSmrg
8435*36ac495dSmrg% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
8436*36ac495dSmrg% etc.  We don't actually implement floating yet, we always include the
8437*36ac495dSmrg% float "here".  But it seemed the best name for the future.
8438*36ac495dSmrg%
8439*36ac495dSmrg\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
8440*36ac495dSmrg
8441*36ac495dSmrg% There may be a space before second and/or third parameter; delete it.
8442*36ac495dSmrg\def\eatcommaspace#1, {#1,}
8443*36ac495dSmrg
8444*36ac495dSmrg% #1 is the optional FLOATTYPE, the text label for this float, typically
8445*36ac495dSmrg% "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
8446*36ac495dSmrg% this float will not be numbered and cannot be referred to.
8447*36ac495dSmrg%
8448*36ac495dSmrg% #2 is the optional xref label.  Also must be present for the float to
8449*36ac495dSmrg% be referable.
8450*36ac495dSmrg%
8451*36ac495dSmrg% #3 is the optional positioning argument; for now, it is ignored.  It
8452*36ac495dSmrg% will somehow specify the positions allowed to float to (here, top, bottom).
8453*36ac495dSmrg%
8454*36ac495dSmrg% We keep a separate counter for each FLOATTYPE, which we reset at each
8455*36ac495dSmrg% chapter-level command.
8456*36ac495dSmrg\let\resetallfloatnos=\empty
8457*36ac495dSmrg%
8458*36ac495dSmrg\def\dofloat#1,#2,#3,#4\finish{%
8459*36ac495dSmrg  \let\thiscaption=\empty
8460*36ac495dSmrg  \let\thisshortcaption=\empty
8461*36ac495dSmrg  %
8462*36ac495dSmrg  % don't lose footnotes inside @float.
8463*36ac495dSmrg  %
8464*36ac495dSmrg  % BEWARE: when the floats start float, we have to issue warning whenever an
8465*36ac495dSmrg  % insert appears inside a float which could possibly float. --kasal, 26may04
8466*36ac495dSmrg  %
8467*36ac495dSmrg  \startsavinginserts
8468*36ac495dSmrg  %
8469*36ac495dSmrg  % We can't be used inside a paragraph.
8470*36ac495dSmrg  \par
8471*36ac495dSmrg  %
8472*36ac495dSmrg  \vtop\bgroup
8473*36ac495dSmrg    \def\floattype{#1}%
8474*36ac495dSmrg    \def\floatlabel{#2}%
8475*36ac495dSmrg    \def\floatloc{#3}% we do nothing with this yet.
8476*36ac495dSmrg    %
8477*36ac495dSmrg    \ifx\floattype\empty
8478*36ac495dSmrg      \let\safefloattype=\empty
8479*36ac495dSmrg    \else
8480*36ac495dSmrg      {%
8481*36ac495dSmrg        % the floattype might have accents or other special characters,
8482*36ac495dSmrg        % but we need to use it in a control sequence name.
8483*36ac495dSmrg        \indexnofonts
8484*36ac495dSmrg        \turnoffactive
8485*36ac495dSmrg        \xdef\safefloattype{\floattype}%
8486*36ac495dSmrg      }%
8487*36ac495dSmrg    \fi
8488*36ac495dSmrg    %
8489*36ac495dSmrg    % If label is given but no type, we handle that as the empty type.
8490*36ac495dSmrg    \ifx\floatlabel\empty \else
8491*36ac495dSmrg      % We want each FLOATTYPE to be numbered separately (Figure 1,
8492*36ac495dSmrg      % Table 1, Figure 2, ...).  (And if no label, no number.)
8493*36ac495dSmrg      %
8494*36ac495dSmrg      \expandafter\getfloatno\csname\safefloattype floatno\endcsname
8495*36ac495dSmrg      \global\advance\floatno by 1
8496*36ac495dSmrg      %
8497*36ac495dSmrg      {%
8498*36ac495dSmrg        % This magic value for \lastsection is output by \setref as the
8499*36ac495dSmrg        % XREFLABEL-title value.  \xrefX uses it to distinguish float
8500*36ac495dSmrg        % labels (which have a completely different output format) from
8501*36ac495dSmrg        % node and anchor labels.  And \xrdef uses it to construct the
8502*36ac495dSmrg        % lists of floats.
8503*36ac495dSmrg        %
8504*36ac495dSmrg        \edef\lastsection{\floatmagic=\safefloattype}%
8505*36ac495dSmrg        \setref{\floatlabel}{Yfloat}%
8506*36ac495dSmrg      }%
8507*36ac495dSmrg    \fi
8508*36ac495dSmrg    %
8509*36ac495dSmrg    % start with \parskip glue, I guess.
8510*36ac495dSmrg    \vskip\parskip
8511*36ac495dSmrg    %
8512*36ac495dSmrg    % Don't suppress indentation if a float happens to start a section.
8513*36ac495dSmrg    \restorefirstparagraphindent
8514*36ac495dSmrg}
8515*36ac495dSmrg
8516*36ac495dSmrg% we have these possibilities:
8517*36ac495dSmrg% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
8518*36ac495dSmrg% @float Foo,lbl & no caption:    Foo 1.1
8519*36ac495dSmrg% @float Foo & @caption{Cap}:     Foo: Cap
8520*36ac495dSmrg% @float Foo & no caption:        Foo
8521*36ac495dSmrg% @float ,lbl & Caption{Cap}:     1.1: Cap
8522*36ac495dSmrg% @float ,lbl & no caption:       1.1
8523*36ac495dSmrg% @float & @caption{Cap}:         Cap
8524*36ac495dSmrg% @float & no caption:
8525*36ac495dSmrg%
8526*36ac495dSmrg\def\Efloat{%
8527*36ac495dSmrg    \let\floatident = \empty
8528*36ac495dSmrg    %
8529*36ac495dSmrg    % In all cases, if we have a float type, it comes first.
8530*36ac495dSmrg    \ifx\floattype\empty \else \def\floatident{\floattype}\fi
8531*36ac495dSmrg    %
8532*36ac495dSmrg    % If we have an xref label, the number comes next.
8533*36ac495dSmrg    \ifx\floatlabel\empty \else
8534*36ac495dSmrg      \ifx\floattype\empty \else % if also had float type, need tie first.
8535*36ac495dSmrg        \appendtomacro\floatident{\tie}%
8536*36ac495dSmrg      \fi
8537*36ac495dSmrg      % the number.
8538*36ac495dSmrg      \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
8539*36ac495dSmrg    \fi
8540*36ac495dSmrg    %
8541*36ac495dSmrg    % Start the printed caption with what we've constructed in
8542*36ac495dSmrg    % \floatident, but keep it separate; we need \floatident again.
8543*36ac495dSmrg    \let\captionline = \floatident
8544*36ac495dSmrg    %
8545*36ac495dSmrg    \ifx\thiscaption\empty \else
8546*36ac495dSmrg      \ifx\floatident\empty \else
8547*36ac495dSmrg	\appendtomacro\captionline{: }% had ident, so need a colon between
8548*36ac495dSmrg      \fi
8549*36ac495dSmrg      %
8550*36ac495dSmrg      % caption text.
8551*36ac495dSmrg      \appendtomacro\captionline{\scanexp\thiscaption}%
8552*36ac495dSmrg    \fi
8553*36ac495dSmrg    %
8554*36ac495dSmrg    % If we have anything to print, print it, with space before.
8555*36ac495dSmrg    % Eventually this needs to become an \insert.
8556*36ac495dSmrg    \ifx\captionline\empty \else
8557*36ac495dSmrg      \vskip.5\parskip
8558*36ac495dSmrg      \captionline
8559*36ac495dSmrg      %
8560*36ac495dSmrg      % Space below caption.
8561*36ac495dSmrg      \vskip\parskip
8562*36ac495dSmrg    \fi
8563*36ac495dSmrg    %
8564*36ac495dSmrg    % If have an xref label, write the list of floats info.  Do this
8565*36ac495dSmrg    % after the caption, to avoid chance of it being a breakpoint.
8566*36ac495dSmrg    \ifx\floatlabel\empty \else
8567*36ac495dSmrg      % Write the text that goes in the lof to the aux file as
8568*36ac495dSmrg      % \floatlabel-lof.  Besides \floatident, we include the short
8569*36ac495dSmrg      % caption if specified, else the full caption if specified, else nothing.
8570*36ac495dSmrg      {%
8571*36ac495dSmrg        \atdummies
8572*36ac495dSmrg        %
8573*36ac495dSmrg        % since we read the caption text in the macro world, where ^^M
8574*36ac495dSmrg        % is turned into a normal character, we have to scan it back, so
8575*36ac495dSmrg        % we don't write the literal three characters "^^M" into the aux file.
8576*36ac495dSmrg	\scanexp{%
8577*36ac495dSmrg	  \xdef\noexpand\gtemp{%
8578*36ac495dSmrg	    \ifx\thisshortcaption\empty
8579*36ac495dSmrg	      \thiscaption
8580*36ac495dSmrg	    \else
8581*36ac495dSmrg	      \thisshortcaption
8582*36ac495dSmrg	    \fi
8583*36ac495dSmrg	  }%
8584*36ac495dSmrg	}%
8585*36ac495dSmrg        \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
8586*36ac495dSmrg	  \ifx\gtemp\empty \else : \gtemp \fi}}%
8587*36ac495dSmrg      }%
8588*36ac495dSmrg    \fi
8589*36ac495dSmrg  \egroup  % end of \vtop
8590*36ac495dSmrg  %
8591*36ac495dSmrg  % place the captured inserts
8592*36ac495dSmrg  %
8593*36ac495dSmrg  % BEWARE: when the floats start floating, we have to issue warning
8594*36ac495dSmrg  % whenever an insert appears inside a float which could possibly
8595*36ac495dSmrg  % float. --kasal, 26may04
8596*36ac495dSmrg  %
8597*36ac495dSmrg  \checkinserts
8598*36ac495dSmrg}
8599*36ac495dSmrg
8600*36ac495dSmrg% Append the tokens #2 to the definition of macro #1, not expanding either.
8601*36ac495dSmrg%
8602*36ac495dSmrg\def\appendtomacro#1#2{%
8603*36ac495dSmrg  \expandafter\def\expandafter#1\expandafter{#1#2}%
8604*36ac495dSmrg}
8605*36ac495dSmrg
8606*36ac495dSmrg% @caption, @shortcaption
8607*36ac495dSmrg%
8608*36ac495dSmrg\def\caption{\docaption\thiscaption}
8609*36ac495dSmrg\def\shortcaption{\docaption\thisshortcaption}
8610*36ac495dSmrg\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
8611*36ac495dSmrg\def\defcaption#1#2{\egroup \def#1{#2}}
8612*36ac495dSmrg
8613*36ac495dSmrg% The parameter is the control sequence identifying the counter we are
8614*36ac495dSmrg% going to use.  Create it if it doesn't exist and assign it to \floatno.
8615*36ac495dSmrg\def\getfloatno#1{%
8616*36ac495dSmrg  \ifx#1\relax
8617*36ac495dSmrg      % Haven't seen this figure type before.
8618*36ac495dSmrg      \csname newcount\endcsname #1%
8619*36ac495dSmrg      %
8620*36ac495dSmrg      % Remember to reset this floatno at the next chap.
8621*36ac495dSmrg      \expandafter\gdef\expandafter\resetallfloatnos
8622*36ac495dSmrg        \expandafter{\resetallfloatnos #1=0 }%
8623*36ac495dSmrg  \fi
8624*36ac495dSmrg  \let\floatno#1%
8625*36ac495dSmrg}
8626*36ac495dSmrg
8627*36ac495dSmrg% \setref calls this to get the XREFLABEL-snt value.  We want an @xref
8628*36ac495dSmrg% to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
8629*36ac495dSmrg% first read the @float command.
8630*36ac495dSmrg%
8631*36ac495dSmrg\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
8632*36ac495dSmrg
8633*36ac495dSmrg% Magic string used for the XREFLABEL-title value, so \xrefX can
8634*36ac495dSmrg% distinguish floats from other xref types.
8635*36ac495dSmrg\def\floatmagic{!!float!!}
8636*36ac495dSmrg
8637*36ac495dSmrg% #1 is the control sequence we are passed; we expand into a conditional
8638*36ac495dSmrg% which is true if #1 represents a float ref.  That is, the magic
8639*36ac495dSmrg% \lastsection value which we \setref above.
8640*36ac495dSmrg%
8641*36ac495dSmrg\def\iffloat#1{\expandafter\doiffloat#1==\finish}
8642*36ac495dSmrg%
8643*36ac495dSmrg% #1 is (maybe) the \floatmagic string.  If so, #2 will be the
8644*36ac495dSmrg% (safe) float type for this float.  We set \iffloattype to #2.
8645*36ac495dSmrg%
8646*36ac495dSmrg\def\doiffloat#1=#2=#3\finish{%
8647*36ac495dSmrg  \def\temp{#1}%
8648*36ac495dSmrg  \def\iffloattype{#2}%
8649*36ac495dSmrg  \ifx\temp\floatmagic
8650*36ac495dSmrg}
8651*36ac495dSmrg
8652*36ac495dSmrg% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
8653*36ac495dSmrg%
8654*36ac495dSmrg\parseargdef\listoffloats{%
8655*36ac495dSmrg  \def\floattype{#1}% floattype
8656*36ac495dSmrg  {%
8657*36ac495dSmrg    % the floattype might have accents or other special characters,
8658*36ac495dSmrg    % but we need to use it in a control sequence name.
8659*36ac495dSmrg    \indexnofonts
8660*36ac495dSmrg    \turnoffactive
8661*36ac495dSmrg    \xdef\safefloattype{\floattype}%
8662*36ac495dSmrg  }%
8663*36ac495dSmrg  %
8664*36ac495dSmrg  % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
8665*36ac495dSmrg  \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
8666*36ac495dSmrg    \ifhavexrefs
8667*36ac495dSmrg      % if the user said @listoffloats foo but never @float foo.
8668*36ac495dSmrg      \message{\linenumber No `\safefloattype' floats to list.}%
8669*36ac495dSmrg    \fi
8670*36ac495dSmrg  \else
8671*36ac495dSmrg    \begingroup
8672*36ac495dSmrg      \leftskip=\tocindent  % indent these entries like a toc
8673*36ac495dSmrg      \let\do=\listoffloatsdo
8674*36ac495dSmrg      \csname floatlist\safefloattype\endcsname
8675*36ac495dSmrg    \endgroup
8676*36ac495dSmrg  \fi
8677*36ac495dSmrg}
8678*36ac495dSmrg
8679*36ac495dSmrg% This is called on each entry in a list of floats.  We're passed the
8680*36ac495dSmrg% xref label, in the form LABEL-title, which is how we save it in the
8681*36ac495dSmrg% aux file.  We strip off the -title and look up \XRLABEL-lof, which
8682*36ac495dSmrg% has the text we're supposed to typeset here.
8683*36ac495dSmrg%
8684*36ac495dSmrg% Figures without xref labels will not be included in the list (since
8685*36ac495dSmrg% they won't appear in the aux file).
8686*36ac495dSmrg%
8687*36ac495dSmrg\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
8688*36ac495dSmrg\def\listoffloatsdoentry#1-title\finish{{%
8689*36ac495dSmrg  % Can't fully expand XR#1-lof because it can contain anything.  Just
8690*36ac495dSmrg  % pass the control sequence.  On the other hand, XR#1-pg is just the
8691*36ac495dSmrg  % page number, and we want to fully expand that so we can get a link
8692*36ac495dSmrg  % in pdf output.
8693*36ac495dSmrg  \toksA = \expandafter{\csname XR#1-lof\endcsname}%
8694*36ac495dSmrg  %
8695*36ac495dSmrg  % use the same \entry macro we use to generate the TOC and index.
8696*36ac495dSmrg  \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
8697*36ac495dSmrg  \writeentry
8698*36ac495dSmrg}}
8699*36ac495dSmrg
8700*36ac495dSmrg
8701*36ac495dSmrg\message{localization,}
8702*36ac495dSmrg
8703*36ac495dSmrg% For single-language documents, @documentlanguage is usually given very
8704*36ac495dSmrg% early, just after @documentencoding.  Single argument is the language
8705*36ac495dSmrg% (de) or locale (de_DE) abbreviation.
8706*36ac495dSmrg%
8707*36ac495dSmrg{
8708*36ac495dSmrg  \catcode`\_ = \active
8709*36ac495dSmrg  \globaldefs=1
8710*36ac495dSmrg\parseargdef\documentlanguage{\begingroup
8711*36ac495dSmrg  \let_=\normalunderscore  % normal _ character for filenames
8712*36ac495dSmrg  \tex % read txi-??.tex file in plain TeX.
8713*36ac495dSmrg    % Read the file by the name they passed if it exists.
8714*36ac495dSmrg    \openin 1 txi-#1.tex
8715*36ac495dSmrg    \ifeof 1
8716*36ac495dSmrg      \documentlanguagetrywithoutunderscore{#1_\finish}%
8717*36ac495dSmrg    \else
8718*36ac495dSmrg      \globaldefs = 1  % everything in the txi-LL files needs to persist
8719*36ac495dSmrg      \input txi-#1.tex
8720*36ac495dSmrg    \fi
8721*36ac495dSmrg    \closein 1
8722*36ac495dSmrg  \endgroup % end raw TeX
8723*36ac495dSmrg\endgroup}
8724*36ac495dSmrg%
8725*36ac495dSmrg% If they passed de_DE, and txi-de_DE.tex doesn't exist,
8726*36ac495dSmrg% try txi-de.tex.
8727*36ac495dSmrg%
8728*36ac495dSmrg\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
8729*36ac495dSmrg  \openin 1 txi-#1.tex
8730*36ac495dSmrg  \ifeof 1
8731*36ac495dSmrg    \errhelp = \nolanghelp
8732*36ac495dSmrg    \errmessage{Cannot read language file txi-#1.tex}%
8733*36ac495dSmrg  \else
8734*36ac495dSmrg    \globaldefs = 1  % everything in the txi-LL files needs to persist
8735*36ac495dSmrg    \input txi-#1.tex
8736*36ac495dSmrg  \fi
8737*36ac495dSmrg  \closein 1
8738*36ac495dSmrg}
8739*36ac495dSmrg}% end of special _ catcode
8740*36ac495dSmrg%
8741*36ac495dSmrg\newhelp\nolanghelp{The given language definition file cannot be found or
8742*36ac495dSmrgis empty.  Maybe you need to install it?  Putting it in the current
8743*36ac495dSmrgdirectory should work if nowhere else does.}
8744*36ac495dSmrg
8745*36ac495dSmrg% This macro is called from txi-??.tex files; the first argument is the
8746*36ac495dSmrg% \language name to set (without the "\lang@" prefix), the second and
8747*36ac495dSmrg% third args are \{left,right}hyphenmin.
8748*36ac495dSmrg%
8749*36ac495dSmrg% The language names to pass are determined when the format is built.
8750*36ac495dSmrg% See the etex.log file created at that time, e.g.,
8751*36ac495dSmrg% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
8752*36ac495dSmrg%
8753*36ac495dSmrg% With TeX Live 2008, etex now includes hyphenation patterns for all
8754*36ac495dSmrg% available languages.  This means we can support hyphenation in
8755*36ac495dSmrg% Texinfo, at least to some extent.  (This still doesn't solve the
8756*36ac495dSmrg% accented characters problem.)
8757*36ac495dSmrg%
8758*36ac495dSmrg\catcode`@=11
8759*36ac495dSmrg\def\txisetlanguage#1#2#3{%
8760*36ac495dSmrg  % do not set the language if the name is undefined in the current TeX.
8761*36ac495dSmrg  \expandafter\ifx\csname lang@#1\endcsname \relax
8762*36ac495dSmrg    \message{no patterns for #1}%
8763*36ac495dSmrg  \else
8764*36ac495dSmrg    \global\language = \csname lang@#1\endcsname
8765*36ac495dSmrg  \fi
8766*36ac495dSmrg  % but there is no harm in adjusting the hyphenmin values regardless.
8767*36ac495dSmrg  \global\lefthyphenmin = #2\relax
8768*36ac495dSmrg  \global\righthyphenmin = #3\relax
8769*36ac495dSmrg}
8770*36ac495dSmrg
8771*36ac495dSmrg% Helpers for encodings.
8772*36ac495dSmrg% Set the catcode of characters 128 through 255 to the specified number.
8773*36ac495dSmrg%
8774*36ac495dSmrg\def\setnonasciicharscatcode#1{%
8775*36ac495dSmrg   \count255=128
8776*36ac495dSmrg   \loop\ifnum\count255<256
8777*36ac495dSmrg      \global\catcode\count255=#1\relax
8778*36ac495dSmrg      \advance\count255 by 1
8779*36ac495dSmrg   \repeat
8780*36ac495dSmrg}
8781*36ac495dSmrg
8782*36ac495dSmrg\def\setnonasciicharscatcodenonglobal#1{%
8783*36ac495dSmrg   \count255=128
8784*36ac495dSmrg   \loop\ifnum\count255<256
8785*36ac495dSmrg      \catcode\count255=#1\relax
8786*36ac495dSmrg      \advance\count255 by 1
8787*36ac495dSmrg   \repeat
8788*36ac495dSmrg}
8789*36ac495dSmrg
8790*36ac495dSmrg% @documentencoding sets the definition of non-ASCII characters
8791*36ac495dSmrg% according to the specified encoding.
8792*36ac495dSmrg%
8793*36ac495dSmrg\parseargdef\documentencoding{%
8794*36ac495dSmrg  % Encoding being declared for the document.
8795*36ac495dSmrg  \def\declaredencoding{\csname #1.enc\endcsname}%
8796*36ac495dSmrg  %
8797*36ac495dSmrg  % Supported encodings: names converted to tokens in order to be able
8798*36ac495dSmrg  % to compare them with \ifx.
8799*36ac495dSmrg  \def\ascii{\csname US-ASCII.enc\endcsname}%
8800*36ac495dSmrg  \def\latnine{\csname ISO-8859-15.enc\endcsname}%
8801*36ac495dSmrg  \def\latone{\csname ISO-8859-1.enc\endcsname}%
8802*36ac495dSmrg  \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
8803*36ac495dSmrg  \def\utfeight{\csname UTF-8.enc\endcsname}%
8804*36ac495dSmrg  %
8805*36ac495dSmrg  \ifx \declaredencoding \ascii
8806*36ac495dSmrg     \asciichardefs
8807*36ac495dSmrg  %
8808*36ac495dSmrg  \else \ifx \declaredencoding \lattwo
8809*36ac495dSmrg     \setnonasciicharscatcode\active
8810*36ac495dSmrg     \lattwochardefs
8811*36ac495dSmrg  %
8812*36ac495dSmrg  \else \ifx \declaredencoding \latone
8813*36ac495dSmrg     \setnonasciicharscatcode\active
8814*36ac495dSmrg     \latonechardefs
8815*36ac495dSmrg  %
8816*36ac495dSmrg  \else \ifx \declaredencoding \latnine
8817*36ac495dSmrg     \setnonasciicharscatcode\active
8818*36ac495dSmrg     \latninechardefs
8819*36ac495dSmrg  %
8820*36ac495dSmrg  \else \ifx \declaredencoding \utfeight
8821*36ac495dSmrg     \setnonasciicharscatcode\active
8822*36ac495dSmrg     \utfeightchardefs
8823*36ac495dSmrg  %
8824*36ac495dSmrg  \else
8825*36ac495dSmrg    \message{Unknown document encoding #1, ignoring.}%
8826*36ac495dSmrg  %
8827*36ac495dSmrg  \fi % utfeight
8828*36ac495dSmrg  \fi % latnine
8829*36ac495dSmrg  \fi % latone
8830*36ac495dSmrg  \fi % lattwo
8831*36ac495dSmrg  \fi % ascii
8832*36ac495dSmrg}
8833*36ac495dSmrg
8834*36ac495dSmrg% A message to be logged when using a character that isn't available
8835*36ac495dSmrg% the default font encoding (OT1).
8836*36ac495dSmrg%
8837*36ac495dSmrg\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
8838*36ac495dSmrg
8839*36ac495dSmrg% Take account of \c (plain) vs. \, (Texinfo) difference.
8840*36ac495dSmrg\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
8841*36ac495dSmrg
8842*36ac495dSmrg% First, make active non-ASCII characters in order for them to be
8843*36ac495dSmrg% correctly categorized when TeX reads the replacement text of
8844*36ac495dSmrg% macros containing the character definitions.
8845*36ac495dSmrg\setnonasciicharscatcode\active
8846*36ac495dSmrg%
8847*36ac495dSmrg% Latin1 (ISO-8859-1) character definitions.
8848*36ac495dSmrg\def\latonechardefs{%
8849*36ac495dSmrg  \gdef^^a0{\tie}
8850*36ac495dSmrg  \gdef^^a1{\exclamdown}
8851*36ac495dSmrg  \gdef^^a2{\missingcharmsg{CENT SIGN}}
8852*36ac495dSmrg  \gdef^^a3{{\pounds}}
8853*36ac495dSmrg  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
8854*36ac495dSmrg  \gdef^^a5{\missingcharmsg{YEN SIGN}}
8855*36ac495dSmrg  \gdef^^a6{\missingcharmsg{BROKEN BAR}}
8856*36ac495dSmrg  \gdef^^a7{\S}
8857*36ac495dSmrg  \gdef^^a8{\"{}}
8858*36ac495dSmrg  \gdef^^a9{\copyright}
8859*36ac495dSmrg  \gdef^^aa{\ordf}
8860*36ac495dSmrg  \gdef^^ab{\guillemetleft}
8861*36ac495dSmrg  \gdef^^ac{$\lnot$}
8862*36ac495dSmrg  \gdef^^ad{\-}
8863*36ac495dSmrg  \gdef^^ae{\registeredsymbol}
8864*36ac495dSmrg  \gdef^^af{\={}}
8865*36ac495dSmrg  %
8866*36ac495dSmrg  \gdef^^b0{\textdegree}
8867*36ac495dSmrg  \gdef^^b1{$\pm$}
8868*36ac495dSmrg  \gdef^^b2{$^2$}
8869*36ac495dSmrg  \gdef^^b3{$^3$}
8870*36ac495dSmrg  \gdef^^b4{\'{}}
8871*36ac495dSmrg  \gdef^^b5{$\mu$}
8872*36ac495dSmrg  \gdef^^b6{\P}
8873*36ac495dSmrg  %
8874*36ac495dSmrg  \gdef^^b7{$^.$}
8875*36ac495dSmrg  \gdef^^b8{\cedilla\ }
8876*36ac495dSmrg  \gdef^^b9{$^1$}
8877*36ac495dSmrg  \gdef^^ba{\ordm}
8878*36ac495dSmrg  %
8879*36ac495dSmrg  \gdef^^bb{\guillemetright}
8880*36ac495dSmrg  \gdef^^bc{$1\over4$}
8881*36ac495dSmrg  \gdef^^bd{$1\over2$}
8882*36ac495dSmrg  \gdef^^be{$3\over4$}
8883*36ac495dSmrg  \gdef^^bf{\questiondown}
8884*36ac495dSmrg  %
8885*36ac495dSmrg  \gdef^^c0{\`A}
8886*36ac495dSmrg  \gdef^^c1{\'A}
8887*36ac495dSmrg  \gdef^^c2{\^A}
8888*36ac495dSmrg  \gdef^^c3{\~A}
8889*36ac495dSmrg  \gdef^^c4{\"A}
8890*36ac495dSmrg  \gdef^^c5{\ringaccent A}
8891*36ac495dSmrg  \gdef^^c6{\AE}
8892*36ac495dSmrg  \gdef^^c7{\cedilla C}
8893*36ac495dSmrg  \gdef^^c8{\`E}
8894*36ac495dSmrg  \gdef^^c9{\'E}
8895*36ac495dSmrg  \gdef^^ca{\^E}
8896*36ac495dSmrg  \gdef^^cb{\"E}
8897*36ac495dSmrg  \gdef^^cc{\`I}
8898*36ac495dSmrg  \gdef^^cd{\'I}
8899*36ac495dSmrg  \gdef^^ce{\^I}
8900*36ac495dSmrg  \gdef^^cf{\"I}
8901*36ac495dSmrg  %
8902*36ac495dSmrg  \gdef^^d0{\DH}
8903*36ac495dSmrg  \gdef^^d1{\~N}
8904*36ac495dSmrg  \gdef^^d2{\`O}
8905*36ac495dSmrg  \gdef^^d3{\'O}
8906*36ac495dSmrg  \gdef^^d4{\^O}
8907*36ac495dSmrg  \gdef^^d5{\~O}
8908*36ac495dSmrg  \gdef^^d6{\"O}
8909*36ac495dSmrg  \gdef^^d7{$\times$}
8910*36ac495dSmrg  \gdef^^d8{\O}
8911*36ac495dSmrg  \gdef^^d9{\`U}
8912*36ac495dSmrg  \gdef^^da{\'U}
8913*36ac495dSmrg  \gdef^^db{\^U}
8914*36ac495dSmrg  \gdef^^dc{\"U}
8915*36ac495dSmrg  \gdef^^dd{\'Y}
8916*36ac495dSmrg  \gdef^^de{\TH}
8917*36ac495dSmrg  \gdef^^df{\ss}
8918*36ac495dSmrg  %
8919*36ac495dSmrg  \gdef^^e0{\`a}
8920*36ac495dSmrg  \gdef^^e1{\'a}
8921*36ac495dSmrg  \gdef^^e2{\^a}
8922*36ac495dSmrg  \gdef^^e3{\~a}
8923*36ac495dSmrg  \gdef^^e4{\"a}
8924*36ac495dSmrg  \gdef^^e5{\ringaccent a}
8925*36ac495dSmrg  \gdef^^e6{\ae}
8926*36ac495dSmrg  \gdef^^e7{\cedilla c}
8927*36ac495dSmrg  \gdef^^e8{\`e}
8928*36ac495dSmrg  \gdef^^e9{\'e}
8929*36ac495dSmrg  \gdef^^ea{\^e}
8930*36ac495dSmrg  \gdef^^eb{\"e}
8931*36ac495dSmrg  \gdef^^ec{\`{\dotless i}}
8932*36ac495dSmrg  \gdef^^ed{\'{\dotless i}}
8933*36ac495dSmrg  \gdef^^ee{\^{\dotless i}}
8934*36ac495dSmrg  \gdef^^ef{\"{\dotless i}}
8935*36ac495dSmrg  %
8936*36ac495dSmrg  \gdef^^f0{\dh}
8937*36ac495dSmrg  \gdef^^f1{\~n}
8938*36ac495dSmrg  \gdef^^f2{\`o}
8939*36ac495dSmrg  \gdef^^f3{\'o}
8940*36ac495dSmrg  \gdef^^f4{\^o}
8941*36ac495dSmrg  \gdef^^f5{\~o}
8942*36ac495dSmrg  \gdef^^f6{\"o}
8943*36ac495dSmrg  \gdef^^f7{$\div$}
8944*36ac495dSmrg  \gdef^^f8{\o}
8945*36ac495dSmrg  \gdef^^f9{\`u}
8946*36ac495dSmrg  \gdef^^fa{\'u}
8947*36ac495dSmrg  \gdef^^fb{\^u}
8948*36ac495dSmrg  \gdef^^fc{\"u}
8949*36ac495dSmrg  \gdef^^fd{\'y}
8950*36ac495dSmrg  \gdef^^fe{\th}
8951*36ac495dSmrg  \gdef^^ff{\"y}
8952*36ac495dSmrg}
8953*36ac495dSmrg
8954*36ac495dSmrg% Latin9 (ISO-8859-15) encoding character definitions.
8955*36ac495dSmrg\def\latninechardefs{%
8956*36ac495dSmrg  % Encoding is almost identical to Latin1.
8957*36ac495dSmrg  \latonechardefs
8958*36ac495dSmrg  %
8959*36ac495dSmrg  \gdef^^a4{\euro}
8960*36ac495dSmrg  \gdef^^a6{\v S}
8961*36ac495dSmrg  \gdef^^a8{\v s}
8962*36ac495dSmrg  \gdef^^b4{\v Z}
8963*36ac495dSmrg  \gdef^^b8{\v z}
8964*36ac495dSmrg  \gdef^^bc{\OE}
8965*36ac495dSmrg  \gdef^^bd{\oe}
8966*36ac495dSmrg  \gdef^^be{\"Y}
8967*36ac495dSmrg}
8968*36ac495dSmrg
8969*36ac495dSmrg% Latin2 (ISO-8859-2) character definitions.
8970*36ac495dSmrg\def\lattwochardefs{%
8971*36ac495dSmrg  \gdef^^a0{\tie}
8972*36ac495dSmrg  \gdef^^a1{\ogonek{A}}
8973*36ac495dSmrg  \gdef^^a2{\u{}}
8974*36ac495dSmrg  \gdef^^a3{\L}
8975*36ac495dSmrg  \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
8976*36ac495dSmrg  \gdef^^a5{\v L}
8977*36ac495dSmrg  \gdef^^a6{\'S}
8978*36ac495dSmrg  \gdef^^a7{\S}
8979*36ac495dSmrg  \gdef^^a8{\"{}}
8980*36ac495dSmrg  \gdef^^a9{\v S}
8981*36ac495dSmrg  \gdef^^aa{\cedilla S}
8982*36ac495dSmrg  \gdef^^ab{\v T}
8983*36ac495dSmrg  \gdef^^ac{\'Z}
8984*36ac495dSmrg  \gdef^^ad{\-}
8985*36ac495dSmrg  \gdef^^ae{\v Z}
8986*36ac495dSmrg  \gdef^^af{\dotaccent Z}
8987*36ac495dSmrg  %
8988*36ac495dSmrg  \gdef^^b0{\textdegree}
8989*36ac495dSmrg  \gdef^^b1{\ogonek{a}}
8990*36ac495dSmrg  \gdef^^b2{\ogonek{ }}
8991*36ac495dSmrg  \gdef^^b3{\l}
8992*36ac495dSmrg  \gdef^^b4{\'{}}
8993*36ac495dSmrg  \gdef^^b5{\v l}
8994*36ac495dSmrg  \gdef^^b6{\'s}
8995*36ac495dSmrg  \gdef^^b7{\v{}}
8996*36ac495dSmrg  \gdef^^b8{\cedilla\ }
8997*36ac495dSmrg  \gdef^^b9{\v s}
8998*36ac495dSmrg  \gdef^^ba{\cedilla s}
8999*36ac495dSmrg  \gdef^^bb{\v t}
9000*36ac495dSmrg  \gdef^^bc{\'z}
9001*36ac495dSmrg  \gdef^^bd{\H{}}
9002*36ac495dSmrg  \gdef^^be{\v z}
9003*36ac495dSmrg  \gdef^^bf{\dotaccent z}
9004*36ac495dSmrg  %
9005*36ac495dSmrg  \gdef^^c0{\'R}
9006*36ac495dSmrg  \gdef^^c1{\'A}
9007*36ac495dSmrg  \gdef^^c2{\^A}
9008*36ac495dSmrg  \gdef^^c3{\u A}
9009*36ac495dSmrg  \gdef^^c4{\"A}
9010*36ac495dSmrg  \gdef^^c5{\'L}
9011*36ac495dSmrg  \gdef^^c6{\'C}
9012*36ac495dSmrg  \gdef^^c7{\cedilla C}
9013*36ac495dSmrg  \gdef^^c8{\v C}
9014*36ac495dSmrg  \gdef^^c9{\'E}
9015*36ac495dSmrg  \gdef^^ca{\ogonek{E}}
9016*36ac495dSmrg  \gdef^^cb{\"E}
9017*36ac495dSmrg  \gdef^^cc{\v E}
9018*36ac495dSmrg  \gdef^^cd{\'I}
9019*36ac495dSmrg  \gdef^^ce{\^I}
9020*36ac495dSmrg  \gdef^^cf{\v D}
9021*36ac495dSmrg  %
9022*36ac495dSmrg  \gdef^^d0{\DH}
9023*36ac495dSmrg  \gdef^^d1{\'N}
9024*36ac495dSmrg  \gdef^^d2{\v N}
9025*36ac495dSmrg  \gdef^^d3{\'O}
9026*36ac495dSmrg  \gdef^^d4{\^O}
9027*36ac495dSmrg  \gdef^^d5{\H O}
9028*36ac495dSmrg  \gdef^^d6{\"O}
9029*36ac495dSmrg  \gdef^^d7{$\times$}
9030*36ac495dSmrg  \gdef^^d8{\v R}
9031*36ac495dSmrg  \gdef^^d9{\ringaccent U}
9032*36ac495dSmrg  \gdef^^da{\'U}
9033*36ac495dSmrg  \gdef^^db{\H U}
9034*36ac495dSmrg  \gdef^^dc{\"U}
9035*36ac495dSmrg  \gdef^^dd{\'Y}
9036*36ac495dSmrg  \gdef^^de{\cedilla T}
9037*36ac495dSmrg  \gdef^^df{\ss}
9038*36ac495dSmrg  %
9039*36ac495dSmrg  \gdef^^e0{\'r}
9040*36ac495dSmrg  \gdef^^e1{\'a}
9041*36ac495dSmrg  \gdef^^e2{\^a}
9042*36ac495dSmrg  \gdef^^e3{\u a}
9043*36ac495dSmrg  \gdef^^e4{\"a}
9044*36ac495dSmrg  \gdef^^e5{\'l}
9045*36ac495dSmrg  \gdef^^e6{\'c}
9046*36ac495dSmrg  \gdef^^e7{\cedilla c}
9047*36ac495dSmrg  \gdef^^e8{\v c}
9048*36ac495dSmrg  \gdef^^e9{\'e}
9049*36ac495dSmrg  \gdef^^ea{\ogonek{e}}
9050*36ac495dSmrg  \gdef^^eb{\"e}
9051*36ac495dSmrg  \gdef^^ec{\v e}
9052*36ac495dSmrg  \gdef^^ed{\'{\dotless{i}}}
9053*36ac495dSmrg  \gdef^^ee{\^{\dotless{i}}}
9054*36ac495dSmrg  \gdef^^ef{\v d}
9055*36ac495dSmrg  %
9056*36ac495dSmrg  \gdef^^f0{\dh}
9057*36ac495dSmrg  \gdef^^f1{\'n}
9058*36ac495dSmrg  \gdef^^f2{\v n}
9059*36ac495dSmrg  \gdef^^f3{\'o}
9060*36ac495dSmrg  \gdef^^f4{\^o}
9061*36ac495dSmrg  \gdef^^f5{\H o}
9062*36ac495dSmrg  \gdef^^f6{\"o}
9063*36ac495dSmrg  \gdef^^f7{$\div$}
9064*36ac495dSmrg  \gdef^^f8{\v r}
9065*36ac495dSmrg  \gdef^^f9{\ringaccent u}
9066*36ac495dSmrg  \gdef^^fa{\'u}
9067*36ac495dSmrg  \gdef^^fb{\H u}
9068*36ac495dSmrg  \gdef^^fc{\"u}
9069*36ac495dSmrg  \gdef^^fd{\'y}
9070*36ac495dSmrg  \gdef^^fe{\cedilla t}
9071*36ac495dSmrg  \gdef^^ff{\dotaccent{}}
9072*36ac495dSmrg}
9073*36ac495dSmrg
9074*36ac495dSmrg% UTF-8 character definitions.
9075*36ac495dSmrg%
9076*36ac495dSmrg% This code to support UTF-8 is based on LaTeX's utf8.def, with some
9077*36ac495dSmrg% changes for Texinfo conventions.  It is included here under the GPL by
9078*36ac495dSmrg% permission from Frank Mittelbach and the LaTeX team.
9079*36ac495dSmrg%
9080*36ac495dSmrg\newcount\countUTFx
9081*36ac495dSmrg\newcount\countUTFy
9082*36ac495dSmrg\newcount\countUTFz
9083*36ac495dSmrg
9084*36ac495dSmrg\gdef\UTFviiiTwoOctets#1#2{\expandafter
9085*36ac495dSmrg   \UTFviiiDefined\csname u8:#1\string #2\endcsname}
9086*36ac495dSmrg%
9087*36ac495dSmrg\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
9088*36ac495dSmrg   \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
9089*36ac495dSmrg%
9090*36ac495dSmrg\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
9091*36ac495dSmrg   \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
9092*36ac495dSmrg
9093*36ac495dSmrg\gdef\UTFviiiDefined#1{%
9094*36ac495dSmrg  \ifx #1\relax
9095*36ac495dSmrg    \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
9096*36ac495dSmrg  \else
9097*36ac495dSmrg    \expandafter #1%
9098*36ac495dSmrg  \fi
9099*36ac495dSmrg}
9100*36ac495dSmrg
9101*36ac495dSmrg\begingroup
9102*36ac495dSmrg  \catcode`\~13
9103*36ac495dSmrg  \catcode`\"12
9104*36ac495dSmrg
9105*36ac495dSmrg  \def\UTFviiiLoop{%
9106*36ac495dSmrg    \global\catcode\countUTFx\active
9107*36ac495dSmrg    \uccode`\~\countUTFx
9108*36ac495dSmrg    \uppercase\expandafter{\UTFviiiTmp}%
9109*36ac495dSmrg    \advance\countUTFx by 1
9110*36ac495dSmrg    \ifnum\countUTFx < \countUTFy
9111*36ac495dSmrg      \expandafter\UTFviiiLoop
9112*36ac495dSmrg    \fi}
9113*36ac495dSmrg
9114*36ac495dSmrg  \countUTFx = "C2
9115*36ac495dSmrg  \countUTFy = "E0
9116*36ac495dSmrg  \def\UTFviiiTmp{%
9117*36ac495dSmrg    \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
9118*36ac495dSmrg  \UTFviiiLoop
9119*36ac495dSmrg
9120*36ac495dSmrg  \countUTFx = "E0
9121*36ac495dSmrg  \countUTFy = "F0
9122*36ac495dSmrg  \def\UTFviiiTmp{%
9123*36ac495dSmrg    \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
9124*36ac495dSmrg  \UTFviiiLoop
9125*36ac495dSmrg
9126*36ac495dSmrg  \countUTFx = "F0
9127*36ac495dSmrg  \countUTFy = "F4
9128*36ac495dSmrg  \def\UTFviiiTmp{%
9129*36ac495dSmrg    \xdef~{\noexpand\UTFviiiFourOctets\string~}}
9130*36ac495dSmrg  \UTFviiiLoop
9131*36ac495dSmrg\endgroup
9132*36ac495dSmrg
9133*36ac495dSmrg\begingroup
9134*36ac495dSmrg  \catcode`\"=12
9135*36ac495dSmrg  \catcode`\<=12
9136*36ac495dSmrg  \catcode`\.=12
9137*36ac495dSmrg  \catcode`\,=12
9138*36ac495dSmrg  \catcode`\;=12
9139*36ac495dSmrg  \catcode`\!=12
9140*36ac495dSmrg  \catcode`\~=13
9141*36ac495dSmrg
9142*36ac495dSmrg  \gdef\DeclareUnicodeCharacter#1#2{%
9143*36ac495dSmrg    \countUTFz = "#1\relax
9144*36ac495dSmrg    %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
9145*36ac495dSmrg    \begingroup
9146*36ac495dSmrg      \parseXMLCharref
9147*36ac495dSmrg      \def\UTFviiiTwoOctets##1##2{%
9148*36ac495dSmrg        \csname u8:##1\string ##2\endcsname}%
9149*36ac495dSmrg      \def\UTFviiiThreeOctets##1##2##3{%
9150*36ac495dSmrg        \csname u8:##1\string ##2\string ##3\endcsname}%
9151*36ac495dSmrg      \def\UTFviiiFourOctets##1##2##3##4{%
9152*36ac495dSmrg        \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
9153*36ac495dSmrg      \expandafter\expandafter\expandafter\expandafter
9154*36ac495dSmrg       \expandafter\expandafter\expandafter
9155*36ac495dSmrg       \gdef\UTFviiiTmp{#2}%
9156*36ac495dSmrg    \endgroup}
9157*36ac495dSmrg
9158*36ac495dSmrg  \gdef\parseXMLCharref{%
9159*36ac495dSmrg    \ifnum\countUTFz < "A0\relax
9160*36ac495dSmrg      \errhelp = \EMsimple
9161*36ac495dSmrg      \errmessage{Cannot define Unicode char value < 00A0}%
9162*36ac495dSmrg    \else\ifnum\countUTFz < "800\relax
9163*36ac495dSmrg      \parseUTFviiiA,%
9164*36ac495dSmrg      \parseUTFviiiB C\UTFviiiTwoOctets.,%
9165*36ac495dSmrg    \else\ifnum\countUTFz < "10000\relax
9166*36ac495dSmrg      \parseUTFviiiA;%
9167*36ac495dSmrg      \parseUTFviiiA,%
9168*36ac495dSmrg      \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
9169*36ac495dSmrg    \else
9170*36ac495dSmrg      \parseUTFviiiA;%
9171*36ac495dSmrg      \parseUTFviiiA,%
9172*36ac495dSmrg      \parseUTFviiiA!%
9173*36ac495dSmrg      \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
9174*36ac495dSmrg    \fi\fi\fi
9175*36ac495dSmrg  }
9176*36ac495dSmrg
9177*36ac495dSmrg  \gdef\parseUTFviiiA#1{%
9178*36ac495dSmrg    \countUTFx = \countUTFz
9179*36ac495dSmrg    \divide\countUTFz by 64
9180*36ac495dSmrg    \countUTFy = \countUTFz
9181*36ac495dSmrg    \multiply\countUTFz by 64
9182*36ac495dSmrg    \advance\countUTFx by -\countUTFz
9183*36ac495dSmrg    \advance\countUTFx by 128
9184*36ac495dSmrg    \uccode `#1\countUTFx
9185*36ac495dSmrg    \countUTFz = \countUTFy}
9186*36ac495dSmrg
9187*36ac495dSmrg  \gdef\parseUTFviiiB#1#2#3#4{%
9188*36ac495dSmrg    \advance\countUTFz by "#10\relax
9189*36ac495dSmrg    \uccode `#3\countUTFz
9190*36ac495dSmrg    \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
9191*36ac495dSmrg\endgroup
9192*36ac495dSmrg
9193*36ac495dSmrg\def\utfeightchardefs{%
9194*36ac495dSmrg  \DeclareUnicodeCharacter{00A0}{\tie}
9195*36ac495dSmrg  \DeclareUnicodeCharacter{00A1}{\exclamdown}
9196*36ac495dSmrg  \DeclareUnicodeCharacter{00A3}{\pounds}
9197*36ac495dSmrg  \DeclareUnicodeCharacter{00A8}{\"{ }}
9198*36ac495dSmrg  \DeclareUnicodeCharacter{00A9}{\copyright}
9199*36ac495dSmrg  \DeclareUnicodeCharacter{00AA}{\ordf}
9200*36ac495dSmrg  \DeclareUnicodeCharacter{00AB}{\guillemetleft}
9201*36ac495dSmrg  \DeclareUnicodeCharacter{00AD}{\-}
9202*36ac495dSmrg  \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
9203*36ac495dSmrg  \DeclareUnicodeCharacter{00AF}{\={ }}
9204*36ac495dSmrg
9205*36ac495dSmrg  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
9206*36ac495dSmrg  \DeclareUnicodeCharacter{00B4}{\'{ }}
9207*36ac495dSmrg  \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
9208*36ac495dSmrg  \DeclareUnicodeCharacter{00BA}{\ordm}
9209*36ac495dSmrg  \DeclareUnicodeCharacter{00BB}{\guillemetright}
9210*36ac495dSmrg  \DeclareUnicodeCharacter{00BF}{\questiondown}
9211*36ac495dSmrg
9212*36ac495dSmrg  \DeclareUnicodeCharacter{00C0}{\`A}
9213*36ac495dSmrg  \DeclareUnicodeCharacter{00C1}{\'A}
9214*36ac495dSmrg  \DeclareUnicodeCharacter{00C2}{\^A}
9215*36ac495dSmrg  \DeclareUnicodeCharacter{00C3}{\~A}
9216*36ac495dSmrg  \DeclareUnicodeCharacter{00C4}{\"A}
9217*36ac495dSmrg  \DeclareUnicodeCharacter{00C5}{\AA}
9218*36ac495dSmrg  \DeclareUnicodeCharacter{00C6}{\AE}
9219*36ac495dSmrg  \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
9220*36ac495dSmrg  \DeclareUnicodeCharacter{00C8}{\`E}
9221*36ac495dSmrg  \DeclareUnicodeCharacter{00C9}{\'E}
9222*36ac495dSmrg  \DeclareUnicodeCharacter{00CA}{\^E}
9223*36ac495dSmrg  \DeclareUnicodeCharacter{00CB}{\"E}
9224*36ac495dSmrg  \DeclareUnicodeCharacter{00CC}{\`I}
9225*36ac495dSmrg  \DeclareUnicodeCharacter{00CD}{\'I}
9226*36ac495dSmrg  \DeclareUnicodeCharacter{00CE}{\^I}
9227*36ac495dSmrg  \DeclareUnicodeCharacter{00CF}{\"I}
9228*36ac495dSmrg
9229*36ac495dSmrg  \DeclareUnicodeCharacter{00D0}{\DH}
9230*36ac495dSmrg  \DeclareUnicodeCharacter{00D1}{\~N}
9231*36ac495dSmrg  \DeclareUnicodeCharacter{00D2}{\`O}
9232*36ac495dSmrg  \DeclareUnicodeCharacter{00D3}{\'O}
9233*36ac495dSmrg  \DeclareUnicodeCharacter{00D4}{\^O}
9234*36ac495dSmrg  \DeclareUnicodeCharacter{00D5}{\~O}
9235*36ac495dSmrg  \DeclareUnicodeCharacter{00D6}{\"O}
9236*36ac495dSmrg  \DeclareUnicodeCharacter{00D8}{\O}
9237*36ac495dSmrg  \DeclareUnicodeCharacter{00D9}{\`U}
9238*36ac495dSmrg  \DeclareUnicodeCharacter{00DA}{\'U}
9239*36ac495dSmrg  \DeclareUnicodeCharacter{00DB}{\^U}
9240*36ac495dSmrg  \DeclareUnicodeCharacter{00DC}{\"U}
9241*36ac495dSmrg  \DeclareUnicodeCharacter{00DD}{\'Y}
9242*36ac495dSmrg  \DeclareUnicodeCharacter{00DE}{\TH}
9243*36ac495dSmrg  \DeclareUnicodeCharacter{00DF}{\ss}
9244*36ac495dSmrg
9245*36ac495dSmrg  \DeclareUnicodeCharacter{00E0}{\`a}
9246*36ac495dSmrg  \DeclareUnicodeCharacter{00E1}{\'a}
9247*36ac495dSmrg  \DeclareUnicodeCharacter{00E2}{\^a}
9248*36ac495dSmrg  \DeclareUnicodeCharacter{00E3}{\~a}
9249*36ac495dSmrg  \DeclareUnicodeCharacter{00E4}{\"a}
9250*36ac495dSmrg  \DeclareUnicodeCharacter{00E5}{\aa}
9251*36ac495dSmrg  \DeclareUnicodeCharacter{00E6}{\ae}
9252*36ac495dSmrg  \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
9253*36ac495dSmrg  \DeclareUnicodeCharacter{00E8}{\`e}
9254*36ac495dSmrg  \DeclareUnicodeCharacter{00E9}{\'e}
9255*36ac495dSmrg  \DeclareUnicodeCharacter{00EA}{\^e}
9256*36ac495dSmrg  \DeclareUnicodeCharacter{00EB}{\"e}
9257*36ac495dSmrg  \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
9258*36ac495dSmrg  \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
9259*36ac495dSmrg  \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
9260*36ac495dSmrg  \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
9261*36ac495dSmrg
9262*36ac495dSmrg  \DeclareUnicodeCharacter{00F0}{\dh}
9263*36ac495dSmrg  \DeclareUnicodeCharacter{00F1}{\~n}
9264*36ac495dSmrg  \DeclareUnicodeCharacter{00F2}{\`o}
9265*36ac495dSmrg  \DeclareUnicodeCharacter{00F3}{\'o}
9266*36ac495dSmrg  \DeclareUnicodeCharacter{00F4}{\^o}
9267*36ac495dSmrg  \DeclareUnicodeCharacter{00F5}{\~o}
9268*36ac495dSmrg  \DeclareUnicodeCharacter{00F6}{\"o}
9269*36ac495dSmrg  \DeclareUnicodeCharacter{00F8}{\o}
9270*36ac495dSmrg  \DeclareUnicodeCharacter{00F9}{\`u}
9271*36ac495dSmrg  \DeclareUnicodeCharacter{00FA}{\'u}
9272*36ac495dSmrg  \DeclareUnicodeCharacter{00FB}{\^u}
9273*36ac495dSmrg  \DeclareUnicodeCharacter{00FC}{\"u}
9274*36ac495dSmrg  \DeclareUnicodeCharacter{00FD}{\'y}
9275*36ac495dSmrg  \DeclareUnicodeCharacter{00FE}{\th}
9276*36ac495dSmrg  \DeclareUnicodeCharacter{00FF}{\"y}
9277*36ac495dSmrg
9278*36ac495dSmrg  \DeclareUnicodeCharacter{0100}{\=A}
9279*36ac495dSmrg  \DeclareUnicodeCharacter{0101}{\=a}
9280*36ac495dSmrg  \DeclareUnicodeCharacter{0102}{\u{A}}
9281*36ac495dSmrg  \DeclareUnicodeCharacter{0103}{\u{a}}
9282*36ac495dSmrg  \DeclareUnicodeCharacter{0104}{\ogonek{A}}
9283*36ac495dSmrg  \DeclareUnicodeCharacter{0105}{\ogonek{a}}
9284*36ac495dSmrg  \DeclareUnicodeCharacter{0106}{\'C}
9285*36ac495dSmrg  \DeclareUnicodeCharacter{0107}{\'c}
9286*36ac495dSmrg  \DeclareUnicodeCharacter{0108}{\^C}
9287*36ac495dSmrg  \DeclareUnicodeCharacter{0109}{\^c}
9288*36ac495dSmrg  \DeclareUnicodeCharacter{0118}{\ogonek{E}}
9289*36ac495dSmrg  \DeclareUnicodeCharacter{0119}{\ogonek{e}}
9290*36ac495dSmrg  \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
9291*36ac495dSmrg  \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
9292*36ac495dSmrg  \DeclareUnicodeCharacter{010C}{\v{C}}
9293*36ac495dSmrg  \DeclareUnicodeCharacter{010D}{\v{c}}
9294*36ac495dSmrg  \DeclareUnicodeCharacter{010E}{\v{D}}
9295*36ac495dSmrg
9296*36ac495dSmrg  \DeclareUnicodeCharacter{0112}{\=E}
9297*36ac495dSmrg  \DeclareUnicodeCharacter{0113}{\=e}
9298*36ac495dSmrg  \DeclareUnicodeCharacter{0114}{\u{E}}
9299*36ac495dSmrg  \DeclareUnicodeCharacter{0115}{\u{e}}
9300*36ac495dSmrg  \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
9301*36ac495dSmrg  \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
9302*36ac495dSmrg  \DeclareUnicodeCharacter{011A}{\v{E}}
9303*36ac495dSmrg  \DeclareUnicodeCharacter{011B}{\v{e}}
9304*36ac495dSmrg  \DeclareUnicodeCharacter{011C}{\^G}
9305*36ac495dSmrg  \DeclareUnicodeCharacter{011D}{\^g}
9306*36ac495dSmrg  \DeclareUnicodeCharacter{011E}{\u{G}}
9307*36ac495dSmrg  \DeclareUnicodeCharacter{011F}{\u{g}}
9308*36ac495dSmrg
9309*36ac495dSmrg  \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
9310*36ac495dSmrg  \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
9311*36ac495dSmrg  \DeclareUnicodeCharacter{0124}{\^H}
9312*36ac495dSmrg  \DeclareUnicodeCharacter{0125}{\^h}
9313*36ac495dSmrg  \DeclareUnicodeCharacter{0128}{\~I}
9314*36ac495dSmrg  \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
9315*36ac495dSmrg  \DeclareUnicodeCharacter{012A}{\=I}
9316*36ac495dSmrg  \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
9317*36ac495dSmrg  \DeclareUnicodeCharacter{012C}{\u{I}}
9318*36ac495dSmrg  \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
9319*36ac495dSmrg
9320*36ac495dSmrg  \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
9321*36ac495dSmrg  \DeclareUnicodeCharacter{0131}{\dotless{i}}
9322*36ac495dSmrg  \DeclareUnicodeCharacter{0132}{IJ}
9323*36ac495dSmrg  \DeclareUnicodeCharacter{0133}{ij}
9324*36ac495dSmrg  \DeclareUnicodeCharacter{0134}{\^J}
9325*36ac495dSmrg  \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
9326*36ac495dSmrg  \DeclareUnicodeCharacter{0139}{\'L}
9327*36ac495dSmrg  \DeclareUnicodeCharacter{013A}{\'l}
9328*36ac495dSmrg
9329*36ac495dSmrg  \DeclareUnicodeCharacter{0141}{\L}
9330*36ac495dSmrg  \DeclareUnicodeCharacter{0142}{\l}
9331*36ac495dSmrg  \DeclareUnicodeCharacter{0143}{\'N}
9332*36ac495dSmrg  \DeclareUnicodeCharacter{0144}{\'n}
9333*36ac495dSmrg  \DeclareUnicodeCharacter{0147}{\v{N}}
9334*36ac495dSmrg  \DeclareUnicodeCharacter{0148}{\v{n}}
9335*36ac495dSmrg  \DeclareUnicodeCharacter{014C}{\=O}
9336*36ac495dSmrg  \DeclareUnicodeCharacter{014D}{\=o}
9337*36ac495dSmrg  \DeclareUnicodeCharacter{014E}{\u{O}}
9338*36ac495dSmrg  \DeclareUnicodeCharacter{014F}{\u{o}}
9339*36ac495dSmrg
9340*36ac495dSmrg  \DeclareUnicodeCharacter{0150}{\H{O}}
9341*36ac495dSmrg  \DeclareUnicodeCharacter{0151}{\H{o}}
9342*36ac495dSmrg  \DeclareUnicodeCharacter{0152}{\OE}
9343*36ac495dSmrg  \DeclareUnicodeCharacter{0153}{\oe}
9344*36ac495dSmrg  \DeclareUnicodeCharacter{0154}{\'R}
9345*36ac495dSmrg  \DeclareUnicodeCharacter{0155}{\'r}
9346*36ac495dSmrg  \DeclareUnicodeCharacter{0158}{\v{R}}
9347*36ac495dSmrg  \DeclareUnicodeCharacter{0159}{\v{r}}
9348*36ac495dSmrg  \DeclareUnicodeCharacter{015A}{\'S}
9349*36ac495dSmrg  \DeclareUnicodeCharacter{015B}{\'s}
9350*36ac495dSmrg  \DeclareUnicodeCharacter{015C}{\^S}
9351*36ac495dSmrg  \DeclareUnicodeCharacter{015D}{\^s}
9352*36ac495dSmrg  \DeclareUnicodeCharacter{015E}{\cedilla{S}}
9353*36ac495dSmrg  \DeclareUnicodeCharacter{015F}{\cedilla{s}}
9354*36ac495dSmrg
9355*36ac495dSmrg  \DeclareUnicodeCharacter{0160}{\v{S}}
9356*36ac495dSmrg  \DeclareUnicodeCharacter{0161}{\v{s}}
9357*36ac495dSmrg  \DeclareUnicodeCharacter{0162}{\cedilla{t}}
9358*36ac495dSmrg  \DeclareUnicodeCharacter{0163}{\cedilla{T}}
9359*36ac495dSmrg  \DeclareUnicodeCharacter{0164}{\v{T}}
9360*36ac495dSmrg
9361*36ac495dSmrg  \DeclareUnicodeCharacter{0168}{\~U}
9362*36ac495dSmrg  \DeclareUnicodeCharacter{0169}{\~u}
9363*36ac495dSmrg  \DeclareUnicodeCharacter{016A}{\=U}
9364*36ac495dSmrg  \DeclareUnicodeCharacter{016B}{\=u}
9365*36ac495dSmrg  \DeclareUnicodeCharacter{016C}{\u{U}}
9366*36ac495dSmrg  \DeclareUnicodeCharacter{016D}{\u{u}}
9367*36ac495dSmrg  \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
9368*36ac495dSmrg  \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
9369*36ac495dSmrg
9370*36ac495dSmrg  \DeclareUnicodeCharacter{0170}{\H{U}}
9371*36ac495dSmrg  \DeclareUnicodeCharacter{0171}{\H{u}}
9372*36ac495dSmrg  \DeclareUnicodeCharacter{0174}{\^W}
9373*36ac495dSmrg  \DeclareUnicodeCharacter{0175}{\^w}
9374*36ac495dSmrg  \DeclareUnicodeCharacter{0176}{\^Y}
9375*36ac495dSmrg  \DeclareUnicodeCharacter{0177}{\^y}
9376*36ac495dSmrg  \DeclareUnicodeCharacter{0178}{\"Y}
9377*36ac495dSmrg  \DeclareUnicodeCharacter{0179}{\'Z}
9378*36ac495dSmrg  \DeclareUnicodeCharacter{017A}{\'z}
9379*36ac495dSmrg  \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
9380*36ac495dSmrg  \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
9381*36ac495dSmrg  \DeclareUnicodeCharacter{017D}{\v{Z}}
9382*36ac495dSmrg  \DeclareUnicodeCharacter{017E}{\v{z}}
9383*36ac495dSmrg
9384*36ac495dSmrg  \DeclareUnicodeCharacter{01C4}{D\v{Z}}
9385*36ac495dSmrg  \DeclareUnicodeCharacter{01C5}{D\v{z}}
9386*36ac495dSmrg  \DeclareUnicodeCharacter{01C6}{d\v{z}}
9387*36ac495dSmrg  \DeclareUnicodeCharacter{01C7}{LJ}
9388*36ac495dSmrg  \DeclareUnicodeCharacter{01C8}{Lj}
9389*36ac495dSmrg  \DeclareUnicodeCharacter{01C9}{lj}
9390*36ac495dSmrg  \DeclareUnicodeCharacter{01CA}{NJ}
9391*36ac495dSmrg  \DeclareUnicodeCharacter{01CB}{Nj}
9392*36ac495dSmrg  \DeclareUnicodeCharacter{01CC}{nj}
9393*36ac495dSmrg  \DeclareUnicodeCharacter{01CD}{\v{A}}
9394*36ac495dSmrg  \DeclareUnicodeCharacter{01CE}{\v{a}}
9395*36ac495dSmrg  \DeclareUnicodeCharacter{01CF}{\v{I}}
9396*36ac495dSmrg
9397*36ac495dSmrg  \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
9398*36ac495dSmrg  \DeclareUnicodeCharacter{01D1}{\v{O}}
9399*36ac495dSmrg  \DeclareUnicodeCharacter{01D2}{\v{o}}
9400*36ac495dSmrg  \DeclareUnicodeCharacter{01D3}{\v{U}}
9401*36ac495dSmrg  \DeclareUnicodeCharacter{01D4}{\v{u}}
9402*36ac495dSmrg
9403*36ac495dSmrg  \DeclareUnicodeCharacter{01E2}{\={\AE}}
9404*36ac495dSmrg  \DeclareUnicodeCharacter{01E3}{\={\ae}}
9405*36ac495dSmrg  \DeclareUnicodeCharacter{01E6}{\v{G}}
9406*36ac495dSmrg  \DeclareUnicodeCharacter{01E7}{\v{g}}
9407*36ac495dSmrg  \DeclareUnicodeCharacter{01E8}{\v{K}}
9408*36ac495dSmrg  \DeclareUnicodeCharacter{01E9}{\v{k}}
9409*36ac495dSmrg
9410*36ac495dSmrg  \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
9411*36ac495dSmrg  \DeclareUnicodeCharacter{01F1}{DZ}
9412*36ac495dSmrg  \DeclareUnicodeCharacter{01F2}{Dz}
9413*36ac495dSmrg  \DeclareUnicodeCharacter{01F3}{dz}
9414*36ac495dSmrg  \DeclareUnicodeCharacter{01F4}{\'G}
9415*36ac495dSmrg  \DeclareUnicodeCharacter{01F5}{\'g}
9416*36ac495dSmrg  \DeclareUnicodeCharacter{01F8}{\`N}
9417*36ac495dSmrg  \DeclareUnicodeCharacter{01F9}{\`n}
9418*36ac495dSmrg  \DeclareUnicodeCharacter{01FC}{\'{\AE}}
9419*36ac495dSmrg  \DeclareUnicodeCharacter{01FD}{\'{\ae}}
9420*36ac495dSmrg  \DeclareUnicodeCharacter{01FE}{\'{\O}}
9421*36ac495dSmrg  \DeclareUnicodeCharacter{01FF}{\'{\o}}
9422*36ac495dSmrg
9423*36ac495dSmrg  \DeclareUnicodeCharacter{021E}{\v{H}}
9424*36ac495dSmrg  \DeclareUnicodeCharacter{021F}{\v{h}}
9425*36ac495dSmrg
9426*36ac495dSmrg  \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
9427*36ac495dSmrg  \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
9428*36ac495dSmrg  \DeclareUnicodeCharacter{0228}{\cedilla{E}}
9429*36ac495dSmrg  \DeclareUnicodeCharacter{0229}{\cedilla{e}}
9430*36ac495dSmrg  \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
9431*36ac495dSmrg  \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
9432*36ac495dSmrg
9433*36ac495dSmrg  \DeclareUnicodeCharacter{0232}{\=Y}
9434*36ac495dSmrg  \DeclareUnicodeCharacter{0233}{\=y}
9435*36ac495dSmrg  \DeclareUnicodeCharacter{0237}{\dotless{j}}
9436*36ac495dSmrg
9437*36ac495dSmrg  \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
9438*36ac495dSmrg
9439*36ac495dSmrg  \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
9440*36ac495dSmrg  \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
9441*36ac495dSmrg  \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
9442*36ac495dSmrg  \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
9443*36ac495dSmrg  \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
9444*36ac495dSmrg  \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
9445*36ac495dSmrg  \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
9446*36ac495dSmrg  \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
9447*36ac495dSmrg  \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
9448*36ac495dSmrg  \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
9449*36ac495dSmrg  \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
9450*36ac495dSmrg  \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
9451*36ac495dSmrg
9452*36ac495dSmrg  \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
9453*36ac495dSmrg  \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
9454*36ac495dSmrg
9455*36ac495dSmrg  \DeclareUnicodeCharacter{1E20}{\=G}
9456*36ac495dSmrg  \DeclareUnicodeCharacter{1E21}{\=g}
9457*36ac495dSmrg  \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
9458*36ac495dSmrg  \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
9459*36ac495dSmrg  \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
9460*36ac495dSmrg  \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
9461*36ac495dSmrg  \DeclareUnicodeCharacter{1E26}{\"H}
9462*36ac495dSmrg  \DeclareUnicodeCharacter{1E27}{\"h}
9463*36ac495dSmrg
9464*36ac495dSmrg  \DeclareUnicodeCharacter{1E30}{\'K}
9465*36ac495dSmrg  \DeclareUnicodeCharacter{1E31}{\'k}
9466*36ac495dSmrg  \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
9467*36ac495dSmrg  \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
9468*36ac495dSmrg  \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
9469*36ac495dSmrg  \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
9470*36ac495dSmrg  \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
9471*36ac495dSmrg  \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
9472*36ac495dSmrg  \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
9473*36ac495dSmrg  \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
9474*36ac495dSmrg  \DeclareUnicodeCharacter{1E3E}{\'M}
9475*36ac495dSmrg  \DeclareUnicodeCharacter{1E3F}{\'m}
9476*36ac495dSmrg
9477*36ac495dSmrg  \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
9478*36ac495dSmrg  \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
9479*36ac495dSmrg  \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
9480*36ac495dSmrg  \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
9481*36ac495dSmrg  \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
9482*36ac495dSmrg  \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
9483*36ac495dSmrg  \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
9484*36ac495dSmrg  \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
9485*36ac495dSmrg  \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
9486*36ac495dSmrg  \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
9487*36ac495dSmrg
9488*36ac495dSmrg  \DeclareUnicodeCharacter{1E54}{\'P}
9489*36ac495dSmrg  \DeclareUnicodeCharacter{1E55}{\'p}
9490*36ac495dSmrg  \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
9491*36ac495dSmrg  \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
9492*36ac495dSmrg  \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
9493*36ac495dSmrg  \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
9494*36ac495dSmrg  \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
9495*36ac495dSmrg  \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
9496*36ac495dSmrg  \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
9497*36ac495dSmrg  \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
9498*36ac495dSmrg
9499*36ac495dSmrg  \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
9500*36ac495dSmrg  \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
9501*36ac495dSmrg  \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
9502*36ac495dSmrg  \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
9503*36ac495dSmrg  \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
9504*36ac495dSmrg  \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
9505*36ac495dSmrg  \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
9506*36ac495dSmrg  \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
9507*36ac495dSmrg  \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
9508*36ac495dSmrg  \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
9509*36ac495dSmrg
9510*36ac495dSmrg  \DeclareUnicodeCharacter{1E7C}{\~V}
9511*36ac495dSmrg  \DeclareUnicodeCharacter{1E7D}{\~v}
9512*36ac495dSmrg  \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
9513*36ac495dSmrg  \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
9514*36ac495dSmrg
9515*36ac495dSmrg  \DeclareUnicodeCharacter{1E80}{\`W}
9516*36ac495dSmrg  \DeclareUnicodeCharacter{1E81}{\`w}
9517*36ac495dSmrg  \DeclareUnicodeCharacter{1E82}{\'W}
9518*36ac495dSmrg  \DeclareUnicodeCharacter{1E83}{\'w}
9519*36ac495dSmrg  \DeclareUnicodeCharacter{1E84}{\"W}
9520*36ac495dSmrg  \DeclareUnicodeCharacter{1E85}{\"w}
9521*36ac495dSmrg  \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
9522*36ac495dSmrg  \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
9523*36ac495dSmrg  \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
9524*36ac495dSmrg  \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
9525*36ac495dSmrg  \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
9526*36ac495dSmrg  \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
9527*36ac495dSmrg  \DeclareUnicodeCharacter{1E8C}{\"X}
9528*36ac495dSmrg  \DeclareUnicodeCharacter{1E8D}{\"x}
9529*36ac495dSmrg  \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
9530*36ac495dSmrg  \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
9531*36ac495dSmrg
9532*36ac495dSmrg  \DeclareUnicodeCharacter{1E90}{\^Z}
9533*36ac495dSmrg  \DeclareUnicodeCharacter{1E91}{\^z}
9534*36ac495dSmrg  \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
9535*36ac495dSmrg  \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
9536*36ac495dSmrg  \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
9537*36ac495dSmrg  \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
9538*36ac495dSmrg  \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
9539*36ac495dSmrg  \DeclareUnicodeCharacter{1E97}{\"t}
9540*36ac495dSmrg  \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
9541*36ac495dSmrg  \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
9542*36ac495dSmrg
9543*36ac495dSmrg  \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
9544*36ac495dSmrg  \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
9545*36ac495dSmrg
9546*36ac495dSmrg  \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
9547*36ac495dSmrg  \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
9548*36ac495dSmrg  \DeclareUnicodeCharacter{1EBC}{\~E}
9549*36ac495dSmrg  \DeclareUnicodeCharacter{1EBD}{\~e}
9550*36ac495dSmrg
9551*36ac495dSmrg  \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
9552*36ac495dSmrg  \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
9553*36ac495dSmrg  \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
9554*36ac495dSmrg  \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
9555*36ac495dSmrg
9556*36ac495dSmrg  \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
9557*36ac495dSmrg  \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
9558*36ac495dSmrg
9559*36ac495dSmrg  \DeclareUnicodeCharacter{1EF2}{\`Y}
9560*36ac495dSmrg  \DeclareUnicodeCharacter{1EF3}{\`y}
9561*36ac495dSmrg  \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
9562*36ac495dSmrg
9563*36ac495dSmrg  \DeclareUnicodeCharacter{1EF8}{\~Y}
9564*36ac495dSmrg  \DeclareUnicodeCharacter{1EF9}{\~y}
9565*36ac495dSmrg
9566*36ac495dSmrg  \DeclareUnicodeCharacter{2013}{--}
9567*36ac495dSmrg  \DeclareUnicodeCharacter{2014}{---}
9568*36ac495dSmrg  \DeclareUnicodeCharacter{2018}{\quoteleft}
9569*36ac495dSmrg  \DeclareUnicodeCharacter{2019}{\quoteright}
9570*36ac495dSmrg  \DeclareUnicodeCharacter{201A}{\quotesinglbase}
9571*36ac495dSmrg  \DeclareUnicodeCharacter{201C}{\quotedblleft}
9572*36ac495dSmrg  \DeclareUnicodeCharacter{201D}{\quotedblright}
9573*36ac495dSmrg  \DeclareUnicodeCharacter{201E}{\quotedblbase}
9574*36ac495dSmrg  \DeclareUnicodeCharacter{2022}{\bullet}
9575*36ac495dSmrg  \DeclareUnicodeCharacter{2026}{\dots}
9576*36ac495dSmrg  \DeclareUnicodeCharacter{2039}{\guilsinglleft}
9577*36ac495dSmrg  \DeclareUnicodeCharacter{203A}{\guilsinglright}
9578*36ac495dSmrg  \DeclareUnicodeCharacter{20AC}{\euro}
9579*36ac495dSmrg
9580*36ac495dSmrg  \DeclareUnicodeCharacter{2192}{\expansion}
9581*36ac495dSmrg  \DeclareUnicodeCharacter{21D2}{\result}
9582*36ac495dSmrg
9583*36ac495dSmrg  \DeclareUnicodeCharacter{2212}{\minus}
9584*36ac495dSmrg  \DeclareUnicodeCharacter{2217}{\point}
9585*36ac495dSmrg  \DeclareUnicodeCharacter{2261}{\equiv}
9586*36ac495dSmrg}% end of \utfeightchardefs
9587*36ac495dSmrg
9588*36ac495dSmrg
9589*36ac495dSmrg% US-ASCII character definitions.
9590*36ac495dSmrg\def\asciichardefs{% nothing need be done
9591*36ac495dSmrg   \relax
9592*36ac495dSmrg}
9593*36ac495dSmrg
9594*36ac495dSmrg% Make non-ASCII characters printable again for compatibility with
9595*36ac495dSmrg% existing Texinfo documents that may use them, even without declaring a
9596*36ac495dSmrg% document encoding.
9597*36ac495dSmrg%
9598*36ac495dSmrg\setnonasciicharscatcode \other
9599*36ac495dSmrg
9600*36ac495dSmrg
9601*36ac495dSmrg\message{formatting,}
9602*36ac495dSmrg
9603*36ac495dSmrg\newdimen\defaultparindent \defaultparindent = 15pt
9604*36ac495dSmrg
9605*36ac495dSmrg\chapheadingskip = 15pt plus 4pt minus 2pt
9606*36ac495dSmrg\secheadingskip = 12pt plus 3pt minus 2pt
9607*36ac495dSmrg\subsecheadingskip = 9pt plus 2pt minus 2pt
9608*36ac495dSmrg
9609*36ac495dSmrg% Prevent underfull vbox error messages.
9610*36ac495dSmrg\vbadness = 10000
9611*36ac495dSmrg
9612*36ac495dSmrg% Don't be very finicky about underfull hboxes, either.
9613*36ac495dSmrg\hbadness = 6666
9614*36ac495dSmrg
9615*36ac495dSmrg% Following George Bush, get rid of widows and orphans.
9616*36ac495dSmrg\widowpenalty=10000
9617*36ac495dSmrg\clubpenalty=10000
9618*36ac495dSmrg
9619*36ac495dSmrg% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
9620*36ac495dSmrg% using an old version of TeX, don't do anything.  We want the amount of
9621*36ac495dSmrg% stretch added to depend on the line length, hence the dependence on
9622*36ac495dSmrg% \hsize.  We call this whenever the paper size is set.
9623*36ac495dSmrg%
9624*36ac495dSmrg\def\setemergencystretch{%
9625*36ac495dSmrg  \ifx\emergencystretch\thisisundefined
9626*36ac495dSmrg    % Allow us to assign to \emergencystretch anyway.
9627*36ac495dSmrg    \def\emergencystretch{\dimen0}%
9628*36ac495dSmrg  \else
9629*36ac495dSmrg    \emergencystretch = .15\hsize
9630*36ac495dSmrg  \fi
9631*36ac495dSmrg}
9632*36ac495dSmrg
9633*36ac495dSmrg% Parameters in order: 1) textheight; 2) textwidth;
9634*36ac495dSmrg% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
9635*36ac495dSmrg% 7) physical page height; 8) physical page width.
9636*36ac495dSmrg%
9637*36ac495dSmrg% We also call \setleading{\textleading}, so the caller should define
9638*36ac495dSmrg% \textleading.  The caller should also set \parskip.
9639*36ac495dSmrg%
9640*36ac495dSmrg\def\internalpagesizes#1#2#3#4#5#6#7#8{%
9641*36ac495dSmrg  \voffset = #3\relax
9642*36ac495dSmrg  \topskip = #6\relax
9643*36ac495dSmrg  \splittopskip = \topskip
9644*36ac495dSmrg  %
9645*36ac495dSmrg  \vsize = #1\relax
9646*36ac495dSmrg  \advance\vsize by \topskip
9647*36ac495dSmrg  \outervsize = \vsize
9648*36ac495dSmrg  \advance\outervsize by 2\topandbottommargin
9649*36ac495dSmrg  \pageheight = \vsize
9650*36ac495dSmrg  %
9651*36ac495dSmrg  \hsize = #2\relax
9652*36ac495dSmrg  \outerhsize = \hsize
9653*36ac495dSmrg  \advance\outerhsize by 0.5in
9654*36ac495dSmrg  \pagewidth = \hsize
9655*36ac495dSmrg  %
9656*36ac495dSmrg  \normaloffset = #4\relax
9657*36ac495dSmrg  \bindingoffset = #5\relax
9658*36ac495dSmrg  %
9659*36ac495dSmrg  \ifpdf
9660*36ac495dSmrg    \pdfpageheight #7\relax
9661*36ac495dSmrg    \pdfpagewidth #8\relax
9662*36ac495dSmrg    % if we don't reset these, they will remain at "1 true in" of
9663*36ac495dSmrg    % whatever layout pdftex was dumped with.
9664*36ac495dSmrg    \pdfhorigin = 1 true in
9665*36ac495dSmrg    \pdfvorigin = 1 true in
9666*36ac495dSmrg  \fi
9667*36ac495dSmrg  %
9668*36ac495dSmrg  \setleading{\textleading}
9669*36ac495dSmrg  %
9670*36ac495dSmrg  \parindent = \defaultparindent
9671*36ac495dSmrg  \setemergencystretch
9672*36ac495dSmrg}
9673*36ac495dSmrg
9674*36ac495dSmrg% @letterpaper (the default).
9675*36ac495dSmrg\def\letterpaper{{\globaldefs = 1
9676*36ac495dSmrg  \parskip = 3pt plus 2pt minus 1pt
9677*36ac495dSmrg  \textleading = 13.2pt
9678*36ac495dSmrg  %
9679*36ac495dSmrg  % If page is nothing but text, make it come out even.
9680*36ac495dSmrg  \internalpagesizes{607.2pt}{6in}% that's 46 lines
9681*36ac495dSmrg                    {\voffset}{.25in}%
9682*36ac495dSmrg                    {\bindingoffset}{36pt}%
9683*36ac495dSmrg                    {11in}{8.5in}%
9684*36ac495dSmrg}}
9685*36ac495dSmrg
9686*36ac495dSmrg% Use @smallbook to reset parameters for 7x9.25 trim size.
9687*36ac495dSmrg\def\smallbook{{\globaldefs = 1
9688*36ac495dSmrg  \parskip = 2pt plus 1pt
9689*36ac495dSmrg  \textleading = 12pt
9690*36ac495dSmrg  %
9691*36ac495dSmrg  \internalpagesizes{7.5in}{5in}%
9692*36ac495dSmrg                    {-.2in}{0in}%
9693*36ac495dSmrg                    {\bindingoffset}{16pt}%
9694*36ac495dSmrg                    {9.25in}{7in}%
9695*36ac495dSmrg  %
9696*36ac495dSmrg  \lispnarrowing = 0.3in
9697*36ac495dSmrg  \tolerance = 700
9698*36ac495dSmrg  \hfuzz = 1pt
9699*36ac495dSmrg  \contentsrightmargin = 0pt
9700*36ac495dSmrg  \defbodyindent = .5cm
9701*36ac495dSmrg}}
9702*36ac495dSmrg
9703*36ac495dSmrg% Use @smallerbook to reset parameters for 6x9 trim size.
9704*36ac495dSmrg% (Just testing, parameters still in flux.)
9705*36ac495dSmrg\def\smallerbook{{\globaldefs = 1
9706*36ac495dSmrg  \parskip = 1.5pt plus 1pt
9707*36ac495dSmrg  \textleading = 12pt
9708*36ac495dSmrg  %
9709*36ac495dSmrg  \internalpagesizes{7.4in}{4.8in}%
9710*36ac495dSmrg                    {-.2in}{-.4in}%
9711*36ac495dSmrg                    {0pt}{14pt}%
9712*36ac495dSmrg                    {9in}{6in}%
9713*36ac495dSmrg  %
9714*36ac495dSmrg  \lispnarrowing = 0.25in
9715*36ac495dSmrg  \tolerance = 700
9716*36ac495dSmrg  \hfuzz = 1pt
9717*36ac495dSmrg  \contentsrightmargin = 0pt
9718*36ac495dSmrg  \defbodyindent = .4cm
9719*36ac495dSmrg}}
9720*36ac495dSmrg
9721*36ac495dSmrg% Use @afourpaper to print on European A4 paper.
9722*36ac495dSmrg\def\afourpaper{{\globaldefs = 1
9723*36ac495dSmrg  \parskip = 3pt plus 2pt minus 1pt
9724*36ac495dSmrg  \textleading = 13.2pt
9725*36ac495dSmrg  %
9726*36ac495dSmrg  % Double-side printing via postscript on Laserjet 4050
9727*36ac495dSmrg  % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
9728*36ac495dSmrg  % To change the settings for a different printer or situation, adjust
9729*36ac495dSmrg  % \normaloffset until the front-side and back-side texts align.  Then
9730*36ac495dSmrg  % do the same for \bindingoffset.  You can set these for testing in
9731*36ac495dSmrg  % your texinfo source file like this:
9732*36ac495dSmrg  % @tex
9733*36ac495dSmrg  % \global\normaloffset = -6mm
9734*36ac495dSmrg  % \global\bindingoffset = 10mm
9735*36ac495dSmrg  % @end tex
9736*36ac495dSmrg  \internalpagesizes{673.2pt}{160mm}% that's 51 lines
9737*36ac495dSmrg                    {\voffset}{\hoffset}%
9738*36ac495dSmrg                    {\bindingoffset}{44pt}%
9739*36ac495dSmrg                    {297mm}{210mm}%
9740*36ac495dSmrg  %
9741*36ac495dSmrg  \tolerance = 700
9742*36ac495dSmrg  \hfuzz = 1pt
9743*36ac495dSmrg  \contentsrightmargin = 0pt
9744*36ac495dSmrg  \defbodyindent = 5mm
9745*36ac495dSmrg}}
9746*36ac495dSmrg
9747*36ac495dSmrg% Use @afivepaper to print on European A5 paper.
9748*36ac495dSmrg% From romildo@urano.iceb.ufop.br, 2 July 2000.
9749*36ac495dSmrg% He also recommends making @example and @lisp be small.
9750*36ac495dSmrg\def\afivepaper{{\globaldefs = 1
9751*36ac495dSmrg  \parskip = 2pt plus 1pt minus 0.1pt
9752*36ac495dSmrg  \textleading = 12.5pt
9753*36ac495dSmrg  %
9754*36ac495dSmrg  \internalpagesizes{160mm}{120mm}%
9755*36ac495dSmrg                    {\voffset}{\hoffset}%
9756*36ac495dSmrg                    {\bindingoffset}{8pt}%
9757*36ac495dSmrg                    {210mm}{148mm}%
9758*36ac495dSmrg  %
9759*36ac495dSmrg  \lispnarrowing = 0.2in
9760*36ac495dSmrg  \tolerance = 800
9761*36ac495dSmrg  \hfuzz = 1.2pt
9762*36ac495dSmrg  \contentsrightmargin = 0pt
9763*36ac495dSmrg  \defbodyindent = 2mm
9764*36ac495dSmrg  \tableindent = 12mm
9765*36ac495dSmrg}}
9766*36ac495dSmrg
9767*36ac495dSmrg% A specific text layout, 24x15cm overall, intended for A4 paper.
9768*36ac495dSmrg\def\afourlatex{{\globaldefs = 1
9769*36ac495dSmrg  \afourpaper
9770*36ac495dSmrg  \internalpagesizes{237mm}{150mm}%
9771*36ac495dSmrg                    {\voffset}{4.6mm}%
9772*36ac495dSmrg                    {\bindingoffset}{7mm}%
9773*36ac495dSmrg                    {297mm}{210mm}%
9774*36ac495dSmrg  %
9775*36ac495dSmrg  % Must explicitly reset to 0 because we call \afourpaper.
9776*36ac495dSmrg  \globaldefs = 0
9777*36ac495dSmrg}}
9778*36ac495dSmrg
9779*36ac495dSmrg% Use @afourwide to print on A4 paper in landscape format.
9780*36ac495dSmrg\def\afourwide{{\globaldefs = 1
9781*36ac495dSmrg  \afourpaper
9782*36ac495dSmrg  \internalpagesizes{241mm}{165mm}%
9783*36ac495dSmrg                    {\voffset}{-2.95mm}%
9784*36ac495dSmrg                    {\bindingoffset}{7mm}%
9785*36ac495dSmrg                    {297mm}{210mm}%
9786*36ac495dSmrg  \globaldefs = 0
9787*36ac495dSmrg}}
9788*36ac495dSmrg
9789*36ac495dSmrg% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
9790*36ac495dSmrg% Perhaps we should allow setting the margins, \topskip, \parskip,
9791*36ac495dSmrg% and/or leading, also. Or perhaps we should compute them somehow.
9792*36ac495dSmrg%
9793*36ac495dSmrg\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
9794*36ac495dSmrg\def\pagesizesyyy#1,#2,#3\finish{{%
9795*36ac495dSmrg  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
9796*36ac495dSmrg  \globaldefs = 1
9797*36ac495dSmrg  %
9798*36ac495dSmrg  \parskip = 3pt plus 2pt minus 1pt
9799*36ac495dSmrg  \setleading{\textleading}%
9800*36ac495dSmrg  %
9801*36ac495dSmrg  \dimen0 = #1\relax
9802*36ac495dSmrg  \advance\dimen0 by \voffset
9803*36ac495dSmrg  %
9804*36ac495dSmrg  \dimen2 = \hsize
9805*36ac495dSmrg  \advance\dimen2 by \normaloffset
9806*36ac495dSmrg  %
9807*36ac495dSmrg  \internalpagesizes{#1}{\hsize}%
9808*36ac495dSmrg                    {\voffset}{\normaloffset}%
9809*36ac495dSmrg                    {\bindingoffset}{44pt}%
9810*36ac495dSmrg                    {\dimen0}{\dimen2}%
9811*36ac495dSmrg}}
9812*36ac495dSmrg
9813*36ac495dSmrg% Set default to letter.
9814*36ac495dSmrg%
9815*36ac495dSmrg\letterpaper
9816*36ac495dSmrg
9817*36ac495dSmrg
9818*36ac495dSmrg\message{and turning on texinfo input format.}
9819*36ac495dSmrg
9820*36ac495dSmrg\def^^L{\par} % remove \outer, so ^L can appear in an @comment
9821*36ac495dSmrg
9822*36ac495dSmrg% DEL is a comment character, in case @c does not suffice.
9823*36ac495dSmrg\catcode`\^^? = 14
9824*36ac495dSmrg
9825*36ac495dSmrg% Define macros to output various characters with catcode for normal text.
9826*36ac495dSmrg\catcode`\"=\other \def\normaldoublequote{"}
9827*36ac495dSmrg\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
9828*36ac495dSmrg\catcode`\+=\other \def\normalplus{+}
9829*36ac495dSmrg\catcode`\<=\other \def\normalless{<}
9830*36ac495dSmrg\catcode`\>=\other \def\normalgreater{>}
9831*36ac495dSmrg\catcode`\^=\other \def\normalcaret{^}
9832*36ac495dSmrg\catcode`\_=\other \def\normalunderscore{_}
9833*36ac495dSmrg\catcode`\|=\other \def\normalverticalbar{|}
9834*36ac495dSmrg\catcode`\~=\other \def\normaltilde{~}
9835*36ac495dSmrg
9836*36ac495dSmrg% This macro is used to make a character print one way in \tt
9837*36ac495dSmrg% (where it can probably be output as-is), and another way in other fonts,
9838*36ac495dSmrg% where something hairier probably needs to be done.
9839*36ac495dSmrg%
9840*36ac495dSmrg% #1 is what to print if we are indeed using \tt; #2 is what to print
9841*36ac495dSmrg% otherwise.  Since all the Computer Modern typewriter fonts have zero
9842*36ac495dSmrg% interword stretch (and shrink), and it is reasonable to expect all
9843*36ac495dSmrg% typewriter fonts to have this, we can check that font parameter.
9844*36ac495dSmrg%
9845*36ac495dSmrg\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
9846*36ac495dSmrg
9847*36ac495dSmrg% Same as above, but check for italic font.  Actually this also catches
9848*36ac495dSmrg% non-italic slanted fonts since it is impossible to distinguish them from
9849*36ac495dSmrg% italic fonts.  But since this is only used by $ and it uses \sl anyway
9850*36ac495dSmrg% this is not a problem.
9851*36ac495dSmrg\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
9852*36ac495dSmrg
9853*36ac495dSmrg% Turn off all special characters except @
9854*36ac495dSmrg% (and those which the user can use as if they were ordinary).
9855*36ac495dSmrg% Most of these we simply print from the \tt font, but for some, we can
9856*36ac495dSmrg% use math or other variants that look better in normal text.
9857*36ac495dSmrg
9858*36ac495dSmrg\catcode`\"=\active
9859*36ac495dSmrg\def\activedoublequote{{\tt\char34}}
9860*36ac495dSmrg\let"=\activedoublequote
9861*36ac495dSmrg\catcode`\~=\active
9862*36ac495dSmrg\def~{{\tt\char126}}
9863*36ac495dSmrg\chardef\hat=`\^
9864*36ac495dSmrg\catcode`\^=\active
9865*36ac495dSmrg\def^{{\tt \hat}}
9866*36ac495dSmrg
9867*36ac495dSmrg\catcode`\_=\active
9868*36ac495dSmrg\def_{\ifusingtt\normalunderscore\_}
9869*36ac495dSmrg\let\realunder=_
9870*36ac495dSmrg% Subroutine for the previous macro.
9871*36ac495dSmrg\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
9872*36ac495dSmrg
9873*36ac495dSmrg\catcode`\|=\active
9874*36ac495dSmrg\def|{{\tt\char124}}
9875*36ac495dSmrg\chardef \less=`\<
9876*36ac495dSmrg\catcode`\<=\active
9877*36ac495dSmrg\def<{{\tt \less}}
9878*36ac495dSmrg\chardef \gtr=`\>
9879*36ac495dSmrg\catcode`\>=\active
9880*36ac495dSmrg\def>{{\tt \gtr}}
9881*36ac495dSmrg\catcode`\+=\active
9882*36ac495dSmrg\def+{{\tt \char 43}}
9883*36ac495dSmrg\catcode`\$=\active
9884*36ac495dSmrg\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
9885*36ac495dSmrg
9886*36ac495dSmrg% If a .fmt file is being used, characters that might appear in a file
9887*36ac495dSmrg% name cannot be active until we have parsed the command line.
9888*36ac495dSmrg% So turn them off again, and have \everyjob (or @setfilename) turn them on.
9889*36ac495dSmrg% \otherifyactive is called near the end of this file.
9890*36ac495dSmrg\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
9891*36ac495dSmrg
9892*36ac495dSmrg% Used sometimes to turn off (effectively) the active characters even after
9893*36ac495dSmrg% parsing them.
9894*36ac495dSmrg\def\turnoffactive{%
9895*36ac495dSmrg  \normalturnoffactive
9896*36ac495dSmrg  \otherbackslash
9897*36ac495dSmrg}
9898*36ac495dSmrg
9899*36ac495dSmrg\catcode`\@=0
9900*36ac495dSmrg
9901*36ac495dSmrg% \backslashcurfont outputs one backslash character in current font,
9902*36ac495dSmrg% as in \char`\\.
9903*36ac495dSmrg\global\chardef\backslashcurfont=`\\
9904*36ac495dSmrg\global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
9905*36ac495dSmrg
9906*36ac495dSmrg% \realbackslash is an actual character `\' with catcode other, and
9907*36ac495dSmrg% \doublebackslash is two of them (for the pdf outlines).
9908*36ac495dSmrg{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
9909*36ac495dSmrg
9910*36ac495dSmrg% In texinfo, backslash is an active character; it prints the backslash
9911*36ac495dSmrg% in fixed width font.
9912*36ac495dSmrg\catcode`\\=\active  % @ for escape char from now on.
9913*36ac495dSmrg
9914*36ac495dSmrg% The story here is that in math mode, the \char of \backslashcurfont
9915*36ac495dSmrg% ends up printing the roman \ from the math symbol font (because \char
9916*36ac495dSmrg% in math mode uses the \mathcode, and plain.tex sets
9917*36ac495dSmrg% \mathcode`\\="026E).  It seems better for @backslashchar{} to always
9918*36ac495dSmrg% print a typewriter backslash, hence we use an explicit \mathchar,
9919*36ac495dSmrg% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
9920*36ac495dSmrg% ignored family value; char position "5C).  We can't use " for the
9921*36ac495dSmrg% usual hex value because it has already been made active.
9922*36ac495dSmrg@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
9923*36ac495dSmrg@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
9924*36ac495dSmrg
9925*36ac495dSmrg% On startup, @fixbackslash assigns:
9926*36ac495dSmrg%  @let \ = @normalbackslash
9927*36ac495dSmrg% \rawbackslash defines an active \ to do \backslashcurfont.
9928*36ac495dSmrg% \otherbackslash defines an active \ to be a literal `\' character with
9929*36ac495dSmrg% catcode other.  We switch back and forth between these.
9930*36ac495dSmrg@gdef@rawbackslash{@let\=@backslashcurfont}
9931*36ac495dSmrg@gdef@otherbackslash{@let\=@realbackslash}
9932*36ac495dSmrg
9933*36ac495dSmrg% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
9934*36ac495dSmrg% the literal character `\'.
9935*36ac495dSmrg%
9936*36ac495dSmrg@def@normalturnoffactive{%
9937*36ac495dSmrg  @let"=@normaldoublequote
9938*36ac495dSmrg  @let$=@normaldollar %$ font-lock fix
9939*36ac495dSmrg  @let+=@normalplus
9940*36ac495dSmrg  @let<=@normalless
9941*36ac495dSmrg  @let>=@normalgreater
9942*36ac495dSmrg  @let\=@normalbackslash
9943*36ac495dSmrg  @let^=@normalcaret
9944*36ac495dSmrg  @let_=@normalunderscore
9945*36ac495dSmrg  @let|=@normalverticalbar
9946*36ac495dSmrg  @let~=@normaltilde
9947*36ac495dSmrg  @markupsetuplqdefault
9948*36ac495dSmrg  @markupsetuprqdefault
9949*36ac495dSmrg  @unsepspaces
9950*36ac495dSmrg}
9951*36ac495dSmrg
9952*36ac495dSmrg% Make _ and + \other characters, temporarily.
9953*36ac495dSmrg% This is canceled by @fixbackslash.
9954*36ac495dSmrg@otherifyactive
9955*36ac495dSmrg
9956*36ac495dSmrg% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
9957*36ac495dSmrg% That is what \eatinput is for; after that, the `\' should revert to printing
9958*36ac495dSmrg% a backslash.
9959*36ac495dSmrg%
9960*36ac495dSmrg@gdef@eatinput input texinfo{@fixbackslash}
9961*36ac495dSmrg@global@let\ = @eatinput
9962*36ac495dSmrg
9963*36ac495dSmrg% On the other hand, perhaps the file did not have a `\input texinfo'. Then
9964*36ac495dSmrg% the first `\' in the file would cause an error. This macro tries to fix
9965*36ac495dSmrg% that, assuming it is called before the first `\' could plausibly occur.
9966*36ac495dSmrg% Also turn back on active characters that might appear in the input
9967*36ac495dSmrg% file name, in case not using a pre-dumped format.
9968*36ac495dSmrg%
9969*36ac495dSmrg@gdef@fixbackslash{%
9970*36ac495dSmrg  @ifx\@eatinput @let\ = @normalbackslash @fi
9971*36ac495dSmrg  @catcode`+=@active
9972*36ac495dSmrg  @catcode`@_=@active
9973*36ac495dSmrg}
9974*36ac495dSmrg
9975*36ac495dSmrg% Say @foo, not \foo, in error messages.
9976*36ac495dSmrg@escapechar = `@@
9977*36ac495dSmrg
9978*36ac495dSmrg% These (along with & and #) are made active for url-breaking, so need
9979*36ac495dSmrg% active definitions as the normal characters.
9980*36ac495dSmrg@def@normaldot{.}
9981*36ac495dSmrg@def@normalquest{?}
9982*36ac495dSmrg@def@normalslash{/}
9983*36ac495dSmrg
9984*36ac495dSmrg% These look ok in all fonts, so just make them not special.
9985*36ac495dSmrg% @hashchar{} gets its own user-level command, because of #line.
9986*36ac495dSmrg@catcode`@& = @other @def@normalamp{&}
9987*36ac495dSmrg@catcode`@# = @other @def@normalhash{#}
9988*36ac495dSmrg@catcode`@% = @other @def@normalpercent{%}
9989*36ac495dSmrg
9990*36ac495dSmrg@let @hashchar = @normalhash
9991*36ac495dSmrg
9992*36ac495dSmrg@c Finally, make ` and ' active, so that txicodequoteundirected and
9993*36ac495dSmrg@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
9994*36ac495dSmrg@c don't make ` and ' active, @code will not get them as active chars.
9995*36ac495dSmrg@c Do this last of all since we use ` in the previous @catcode assignments.
9996*36ac495dSmrg@catcode`@'=@active
9997*36ac495dSmrg@catcode`@`=@active
9998*36ac495dSmrg@markupsetuplqdefault
9999*36ac495dSmrg@markupsetuprqdefault
10000*36ac495dSmrg
10001*36ac495dSmrg@c Local variables:
10002*36ac495dSmrg@c eval: (add-hook 'write-file-hooks 'time-stamp)
10003*36ac495dSmrg@c page-delimiter: "^\\\\message"
10004*36ac495dSmrg@c time-stamp-start: "def\\\\texinfoversion{"
10005*36ac495dSmrg@c time-stamp-format: "%:y-%02m-%02d.%02H"
10006*36ac495dSmrg@c time-stamp-end: "}"
10007*36ac495dSmrg@c End:
10008*36ac495dSmrg
10009*36ac495dSmrg@c vim:sw=2:
10010*36ac495dSmrg
10011*36ac495dSmrg@ignore
10012*36ac495dSmrg   arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
10013*36ac495dSmrg@end ignore
10014