Rename option to shell-command-dont-erase-buffer
[emacs.git] / doc / misc / texinfo.tex
blob5e260ed8f9c3b12d99da96f2b794fb9cd565448a
1 % texinfo.tex -- TeX macros to handle Texinfo files.
2 %
3 % Load plain if necessary, i.e., if running under initex.
4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
6 \def\texinfoversion{2016-08-16.20}
8 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10 % 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
11 % Free Software Foundation, Inc.
13 % This texinfo.tex file is free software: you can redistribute it and/or
14 % modify it under the terms of the GNU General Public License as
15 % published by the Free Software Foundation, either version 3 of the
16 % License, or (at your option) any later version.
18 % This texinfo.tex file is distributed in the hope that it will be
19 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 % General Public License for more details.
23 % You should have received a copy of the GNU General Public License
24 % along with this program. If not, see <http://www.gnu.org/licenses/>.
26 % As a special exception, when this file is read by TeX when processing
27 % a Texinfo source document, you may use the result without
28 % restriction. This Exception is an additional permission under section 7
29 % of the GNU General Public License, version 3 ("GPLv3").
31 % Please try the latest version of texinfo.tex before submitting bug
32 % reports; you can get the latest version from:
33 % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
34 % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
35 % http://www.gnu.org/software/texinfo/ (the Texinfo home page)
36 % The texinfo.tex in any given distribution could well be out
37 % of date, so if that's what you're using, please check.
39 % Send bug reports to bug-texinfo@gnu.org. Please include including a
40 % complete document in each bug report with which we can reproduce the
41 % problem. Patches are, of course, greatly appreciated.
43 % To process a Texinfo manual with TeX, it's most reliable to use the
44 % texi2dvi shell script that comes with the distribution. For a simple
45 % manual foo.texi, however, you can get away with this:
46 % tex foo.texi
47 % texindex foo.??
48 % tex foo.texi
49 % tex foo.texi
50 % dvips foo.dvi -o # or whatever; this makes foo.ps.
51 % The extra TeX runs get the cross-reference information correct.
52 % Sometimes one run after texindex suffices, and sometimes you need more
53 % than two; texi2dvi does it as many times as necessary.
55 % It is possible to adapt texinfo.tex for other languages, to some
56 % extent. You can get the existing language-specific files from the
57 % full Texinfo distribution.
59 % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
62 \message{Loading texinfo [version \texinfoversion]:}
64 % If in a .fmt file, print the version number
65 % and turn on active characters that we couldn't do earlier because
66 % they might have appeared in the input file name.
67 \everyjob{\message{[Texinfo version \texinfoversion]}%
68 \catcode`+=\active \catcode`\_=\active}
70 % LaTeX's \typeout. This ensures that the messages it is used for
71 % are identical in format to the corresponding ones from latex/pdflatex.
72 \def\typeout{\immediate\write17}%
74 \chardef\other=12
76 % We never want plain's \outer definition of \+ in Texinfo.
77 % For @tex, we can use \tabalign.
78 \let\+ = \relax
80 % Save some plain tex macros whose names we will redefine.
81 \let\ptexb=\b
82 \let\ptexbullet=\bullet
83 \let\ptexc=\c
84 \let\ptexcomma=\,
85 \let\ptexdot=\.
86 \let\ptexdots=\dots
87 \let\ptexend=\end
88 \let\ptexequiv=\equiv
89 \let\ptexexclam=\!
90 \let\ptexfootnote=\footnote
91 \let\ptexgtr=>
92 \let\ptexhat=^
93 \let\ptexi=\i
94 \let\ptexindent=\indent
95 \let\ptexinsert=\insert
96 \let\ptexlbrace=\{
97 \let\ptexless=<
98 \let\ptexnewwrite\newwrite
99 \let\ptexnoindent=\noindent
100 \let\ptexplus=+
101 \let\ptexraggedright=\raggedright
102 \let\ptexrbrace=\}
103 \let\ptexslash=\/
104 \let\ptexsp=\sp
105 \let\ptexstar=\*
106 \let\ptexsup=\sup
107 \let\ptext=\t
108 \let\ptextop=\top
109 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
111 % If this character appears in an error message or help string, it
112 % starts a new line in the output.
113 \newlinechar = `^^J
115 % Use TeX 3.0's \inputlineno to get the line number, for better error
116 % messages, but if we're using an old version of TeX, don't do anything.
118 \ifx\inputlineno\thisisundefined
119 \let\linenumber = \empty % Pre-3.0.
120 \else
121 \def\linenumber{l.\the\inputlineno:\space}
124 % Set up fixed words for English if not already set.
125 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
126 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
127 \ifx\putworderror\undefined \gdef\putworderror{error}\fi
128 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
129 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
130 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
131 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
132 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
133 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
134 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
135 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
136 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
137 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
138 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
139 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
140 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
141 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
142 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
143 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
144 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
146 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
147 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
148 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
149 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
150 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
151 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
152 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
153 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
154 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
155 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
156 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
157 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
159 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
160 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
161 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
162 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
163 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
165 % Give the space character the catcode for a space.
166 \def\spaceisspace{\catcode`\ =10\relax}
168 \chardef\dashChar = `\-
169 \chardef\slashChar = `\/
170 \chardef\underChar = `\_
172 % Ignore a token.
174 \def\gobble#1{}
176 % The following is used inside several \edef's.
177 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
179 % Hyphenation fixes.
180 \hyphenation{
181 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
182 ap-pen-dix bit-map bit-maps
183 data-base data-bases eshell fall-ing half-way long-est man-u-script
184 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
185 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
186 spell-ing spell-ings
187 stand-alone strong-est time-stamp time-stamps which-ever white-space
188 wide-spread wrap-around
191 % Sometimes it is convenient to have everything in the transcript file
192 % and nothing on the terminal. We don't just call \tracingall here,
193 % since that produces some useless output on the terminal. We also make
194 % some effort to order the tracing commands to reduce output in the log
195 % file; cf. trace.sty in LaTeX.
197 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
198 \def\loggingall{%
199 \tracingstats2
200 \tracingpages1
201 \tracinglostchars2 % 2 gives us more in etex
202 \tracingparagraphs1
203 \tracingoutput1
204 \tracingmacros2
205 \tracingrestores1
206 \showboxbreadth\maxdimen \showboxdepth\maxdimen
207 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
208 \tracingscantokens1
209 \tracingifs1
210 \tracinggroups1
211 \tracingnesting2
212 \tracingassigns1
214 \tracingcommands3 % 3 gives us more in etex
215 \errorcontextlines16
218 % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
219 % aren't perfect, it's not the end of the world, being an error message,
220 % after all.
222 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
223 \def\doerrormsg#1{\errmessage{#1}}
225 % add check for \lastpenalty to plain's definitions. If the last thing
226 % we did was a \nobreak, we don't want to insert more space.
228 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
229 \removelastskip\penalty-50\smallskip\fi\fi}
230 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
231 \removelastskip\penalty-100\medskip\fi\fi}
232 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
233 \removelastskip\penalty-200\bigskip\fi\fi}
235 %\f Output routine
238 % For a final copy, take out the rectangles
239 % that mark overfull boxes (in case you have decided
240 % that the text looks ok even though it passes the margin).
242 \def\finalout{\overfullrule=0pt }
244 % Do @cropmarks to get crop marks.
246 \newif\ifcropmarks
247 \let\cropmarks = \cropmarkstrue
249 % Dimensions to add cropmarks at corners.
250 % Added by P. A. MacKay, 12 Nov. 1986
252 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
253 \newdimen\cornerlong \cornerlong=1pc
254 \newdimen\cornerthick \cornerthick=.3pt
255 \newdimen\topandbottommargin \topandbottommargin=.75in
257 % Output a mark which sets \thischapter, \thissection and \thiscolor.
258 % We dump everything together because we only have one kind of mark.
259 % This works because we only use \botmark / \topmark, not \firstmark.
261 % A mark contains a subexpression of the \ifcase ... \fi construct.
262 % \get*marks macros below extract the needed part using \ifcase.
264 % Another complication is to let the user choose whether \thischapter
265 % (\thissection) refers to the chapter (section) in effect at the top
266 % of a page, or that at the bottom of a page.
268 % \domark is called twice inside \chapmacro, to add one
269 % mark before the section break, and one after.
270 % In the second call \prevchapterdefs is the same as \lastchapterdefs,
271 % and \prevsectiondefs is the same as \lastsectiondefs.
272 % Then if the page is not broken at the mark, some of the previous
273 % section appears on the page, and we can get the name of this section
274 % from \firstmark for @everyheadingmarks top.
275 % @everyheadingmarks bottom uses \botmark.
277 % See page 260 of The TeXbook.
278 \def\domark{%
279 \toks0=\expandafter{\lastchapterdefs}%
280 \toks2=\expandafter{\lastsectiondefs}%
281 \toks4=\expandafter{\prevchapterdefs}%
282 \toks6=\expandafter{\prevsectiondefs}%
283 \toks8=\expandafter{\lastcolordefs}%
284 \mark{%
285 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
286 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
287 \noexpand\else \the\toks8 % 2: color marks
291 % \gettopheadingmarks, \getbottomheadingmarks,
292 % \getcolormarks - extract needed part of mark.
294 % \topmark doesn't work for the very first chapter (after the title
295 % page or the contents), so we use \firstmark there -- this gets us
296 % the mark with the chapter defs, unless the user sneaks in, e.g.,
297 % @setcolor (or @url, or @link, etc.) between @contents and the very
298 % first @chapter.
299 \def\gettopheadingmarks{%
300 \ifcase0\topmark\fi
301 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
303 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
304 \def\getcolormarks{\ifcase2\topmark\fi}
306 % Avoid "undefined control sequence" errors.
307 \def\lastchapterdefs{}
308 \def\lastsectiondefs{}
309 \def\lastsection{}
310 \def\prevchapterdefs{}
311 \def\prevsectiondefs{}
312 \def\lastcolordefs{}
314 % Margin to add to right of even pages, to left of odd pages.
315 \newdimen\bindingoffset
316 \newdimen\normaloffset
317 \newdimen\txipagewidth \newdimen\txipageheight
319 % Main output routine.
321 \chardef\PAGE = 255
322 \output = {\onepageout{\pagecontents\PAGE}}
324 \newbox\headlinebox
325 \newbox\footlinebox
327 % \onepageout takes a vbox as an argument.
328 % \shipout a vbox for a single page, adding an optional header, footer,
329 % cropmarks, and footnote. This also causes index entries for this page
330 % to be written to the auxiliary files.
332 \def\onepageout#1{%
333 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
335 \ifodd\pageno \advance\hoffset by \bindingoffset
336 \else \advance\hoffset by -\bindingoffset\fi
338 % Common context changes for both heading and footing.
339 % Do this outside of the \shipout so @code etc. will be expanded in
340 % the headline as they should be, not taken literally (outputting ''code).
341 \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
343 % Retrieve the information for the headings from the marks in the page,
344 % and call Plain TeX's \makeheadline and \makefootline, which use the
345 % values in \headline and \footline.
347 % This is used to check if we are on the first page of a chapter.
348 \ifcase1\topmark\fi
349 \let\prevchaptername\thischaptername
350 \ifcase0\firstmark\fi
351 \let\curchaptername\thischaptername
353 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
354 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
356 \ifx\curchaptername\prevchaptername
357 \let\thischapterheading\thischapter
358 \else
359 % \thischapterheading is the same as \thischapter except it is blank
360 % for the first page of a chapter. This is to prevent the chapter name
361 % being shown twice.
362 \def\thischapterheading{}%
365 \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
366 \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
369 % Set context for writing to auxiliary files like index files.
370 % Have to do this stuff outside the \shipout because we want it to
371 % take effect in \write's, yet the group defined by the \vbox ends
372 % before the \shipout runs.
374 \indexdummies % don't expand commands in the output.
375 \normalturnoffactive % \ in index entries must not stay \, e.g., if
376 % the page break happens to be in the middle of an example.
377 % We don't want .vr (or whatever) entries like this:
378 % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
379 % "\acronym" won't work when it's read back in;
380 % it needs to be
381 % {\code {{\backslashcurfont }acronym}
382 \shipout\vbox{%
383 % Do this early so pdf references go to the beginning of the page.
384 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
386 \ifcropmarks \vbox to \outervsize\bgroup
387 \hsize = \outerhsize
388 \vskip-\topandbottommargin
389 \vtop to0pt{%
390 \line{\ewtop\hfil\ewtop}%
391 \nointerlineskip
392 \line{%
393 \vbox{\moveleft\cornerthick\nstop}%
394 \hfill
395 \vbox{\moveright\cornerthick\nstop}%
397 \vss}%
398 \vskip\topandbottommargin
399 \line\bgroup
400 \hfil % center the page within the outer (page) hsize.
401 \ifodd\pageno\hskip\bindingoffset\fi
402 \vbox\bgroup
405 \unvbox\headlinebox
406 \pagebody{#1}%
407 \ifdim\ht\footlinebox > 0pt
408 % Only leave this space if the footline is nonempty.
409 % (We lessened \vsize for it in \oddfootingyyy.)
410 % The \baselineskip=24pt in plain's \makefootline has no effect.
411 \vskip 24pt
412 \unvbox\footlinebox
415 \ifcropmarks
416 \egroup % end of \vbox\bgroup
417 \hfil\egroup % end of (centering) \line\bgroup
418 \vskip\topandbottommargin plus1fill minus1fill
419 \boxmaxdepth = \cornerthick
420 \vbox to0pt{\vss
421 \line{%
422 \vbox{\moveleft\cornerthick\nsbot}%
423 \hfill
424 \vbox{\moveright\cornerthick\nsbot}%
426 \nointerlineskip
427 \line{\ewbot\hfil\ewbot}%
429 \egroup % \vbox from first cropmarks clause
431 }% end of \shipout\vbox
432 }% end of group with \indexdummies
433 \advancepageno
434 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
437 \newinsert\margin \dimen\margin=\maxdimen
439 % Main part of page, including any footnotes
440 \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
441 {\catcode`\@ =11
442 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
443 % marginal hacks, juha@viisa.uucp (Juha Takala)
444 \ifvoid\margin\else % marginal info is present
445 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
446 \dimen@=\dp#1\relax \unvbox#1\relax
447 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
448 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
451 % Here are the rules for the cropmarks. Note that they are
452 % offset so that the space between them is truly \outerhsize or \outervsize
453 % (P. A. MacKay, 12 November, 1986)
455 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
456 \def\nstop{\vbox
457 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
458 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
459 \def\nsbot{\vbox
460 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
463 % Argument parsing
465 % Parse an argument, then pass it to #1. The argument is the rest of
466 % the input line (except we remove a trailing comment). #1 should be a
467 % macro which expects an ordinary undelimited TeX argument.
468 % For example, \def\foo{\parsearg\fooxxx}.
470 \def\parsearg{\parseargusing{}}
471 \def\parseargusing#1#2{%
472 \def\argtorun{#2}%
473 \begingroup
474 \obeylines
475 \spaceisspace
477 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
480 {\obeylines %
481 \gdef\parseargline#1^^M{%
482 \endgroup % End of the group started in \parsearg.
483 \argremovecomment #1\comment\ArgTerm%
487 % First remove any @comment, then any @c comment. Also remove a @texinfoc
488 % comment (see \scanmacro for details). Pass the result on to \argcheckspaces.
489 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
490 \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
491 \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
493 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
495 % \argremovec might leave us with trailing space, e.g.,
496 % @end itemize @c foo
497 % This space token undergoes the same procedure and is eventually removed
498 % by \finishparsearg.
500 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
501 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
502 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
503 \def\temp{#3}%
504 \ifx\temp\empty
505 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
506 \let\temp\finishparsearg
507 \else
508 \let\temp\argcheckspaces
510 % Put the space token in:
511 \temp#1 #3\ArgTerm
514 % If a _delimited_ argument is enclosed in braces, they get stripped; so
515 % to get _exactly_ the rest of the line, we had to prevent such situation.
516 % We prepended an \empty token at the very beginning and we expand it now,
517 % just before passing the control to \argtorun.
518 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
519 % either the null string, or it ends with \^^M---thus there is no danger
520 % that a pair of braces would be stripped.
522 % But first, we have to remove the trailing space token.
524 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
527 % \parseargdef - define a command taking an argument on the line
529 % \parseargdef\foo{...}
530 % is roughly equivalent to
531 % \def\foo{\parsearg\Xfoo}
532 % \def\Xfoo#1{...}
533 \def\parseargdef#1{%
534 \expandafter \doparseargdef \csname\string#1\endcsname #1%
536 \def\doparseargdef#1#2{%
537 \def#2{\parsearg#1}%
538 \def#1##1%
541 % Several utility definitions with active space:
543 \obeyspaces
544 \gdef\obeyedspace{ }
546 % Make each space character in the input produce a normal interword
547 % space in the output. Don't allow a line break at this space, as this
548 % is used only in environments like @example, where each line of input
549 % should produce a line of output anyway.
551 \gdef\sepspaces{\obeyspaces\let =\tie}
553 % If an index command is used in an @example environment, any spaces
554 % therein should become regular spaces in the raw index file, not the
555 % expansion of \tie (\leavevmode \penalty \@M \ ).
556 \gdef\unsepspaces{\let =\space}
560 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
562 % Define the framework for environments in texinfo.tex. It's used like this:
564 % \envdef\foo{...}
565 % \def\Efoo{...}
567 % It's the responsibility of \envdef to insert \begingroup before the
568 % actual body; @end closes the group after calling \Efoo. \envdef also
569 % defines \thisenv, so the current environment is known; @end checks
570 % whether the environment name matches. The \checkenv macro can also be
571 % used to check whether the current environment is the one expected.
573 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
574 % are not treated as environments; they don't open a group. (The
575 % implementation of @end takes care not to call \endgroup in this
576 % special case.)
579 % At run-time, environments start with this:
580 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
581 % initialize
582 \let\thisenv\empty
584 % ... but they get defined via ``\envdef\foo{...}'':
585 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
586 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
588 % Check whether we're in the right environment:
589 \def\checkenv#1{%
590 \def\temp{#1}%
591 \ifx\thisenv\temp
592 \else
593 \badenverr
597 % Environment mismatch, #1 expected:
598 \def\badenverr{%
599 \errhelp = \EMsimple
600 \errmessage{This command can appear only \inenvironment\temp,
601 not \inenvironment\thisenv}%
603 \def\inenvironment#1{%
604 \ifx#1\empty
605 outside of any environment%
606 \else
607 in environment \expandafter\string#1%
611 % @end foo executes the definition of \Efoo.
612 % But first, it executes a specialized version of \checkenv
614 \parseargdef\end{%
615 \if 1\csname iscond.#1\endcsname
616 \else
617 % The general wording of \badenverr may not be ideal.
618 \expandafter\checkenv\csname#1\endcsname
619 \csname E#1\endcsname
620 \endgroup
624 \newhelp\EMsimple{Press RETURN to continue.}
627 % Be sure we're in horizontal mode when doing a tie, since we make space
628 % equivalent to this in @example-like environments. Otherwise, a space
629 % at the beginning of a line will start with \penalty -- and
630 % since \penalty is valid in vertical mode, we'd end up putting the
631 % penalty on the vertical list instead of in the new paragraph.
632 {\catcode`@ = 11
633 % Avoid using \@M directly, because that causes trouble
634 % if the definition is written into an index file.
635 \global\let\tiepenalty = \@M
636 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
639 % @: forces normal size whitespace following.
640 \def\:{\spacefactor=1000 }
642 % @* forces a line break.
643 \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
645 % @/ allows a line break.
646 \let\/=\allowbreak
648 % @. is an end-of-sentence period.
649 \def\.{.\spacefactor=\endofsentencespacefactor\space}
651 % @! is an end-of-sentence bang.
652 \def\!{!\spacefactor=\endofsentencespacefactor\space}
654 % @? is an end-of-sentence query.
655 \def\?{?\spacefactor=\endofsentencespacefactor\space}
657 % @frenchspacing on|off says whether to put extra space after punctuation.
659 \def\onword{on}
660 \def\offword{off}
662 \parseargdef\frenchspacing{%
663 \def\temp{#1}%
664 \ifx\temp\onword \plainfrenchspacing
665 \else\ifx\temp\offword \plainnonfrenchspacing
666 \else
667 \errhelp = \EMsimple
668 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
669 \fi\fi
672 % @w prevents a word break. Without the \leavevmode, @w at the
673 % beginning of a paragraph, when TeX is still in vertical mode, would
674 % produce a whole line of output instead of starting the paragraph.
675 \def\w#1{\leavevmode\hbox{#1}}
677 % @group ... @end group forces ... to be all on one page, by enclosing
678 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
679 % to keep its height that of a normal line. According to the rules for
680 % \topskip (p.114 of the TeXbook), the glue inserted is
681 % max (\topskip - \ht (first item), 0). If that height is large,
682 % therefore, no glue is inserted, and the space between the headline and
683 % the text is small, which looks bad.
685 % Another complication is that the group might be very large. This can
686 % cause the glue on the previous page to be unduly stretched, because it
687 % does not have much material. In this case, it's better to add an
688 % explicit \vfill so that the extra space is at the bottom. The
689 % threshold for doing this is if the group is more than \vfilllimit
690 % percent of a page (\vfilllimit can be changed inside of @tex).
692 \newbox\groupbox
693 \def\vfilllimit{0.7}
695 \envdef\group{%
696 \ifnum\catcode`\^^M=\active \else
697 \errhelp = \groupinvalidhelp
698 \errmessage{@group invalid in context where filling is enabled}%
700 \startsavinginserts
702 \setbox\groupbox = \vtop\bgroup
703 % Do @comment since we are called inside an environment such as
704 % @example, where each end-of-line in the input causes an
705 % end-of-line in the output. We don't want the end-of-line after
706 % the `@group' to put extra space in the output. Since @group
707 % should appear on a line by itself (according to the Texinfo
708 % manual), we don't worry about eating any user text.
709 \comment
712 % The \vtop produces a box with normal height and large depth; thus, TeX puts
713 % \baselineskip glue before it, and (when the next line of text is done)
714 % \lineskip glue after it. Thus, space below is not quite equal to space
715 % above. But it's pretty close.
716 \def\Egroup{%
717 % To get correct interline space between the last line of the group
718 % and the first line afterwards, we have to propagate \prevdepth.
719 \endgraf % Not \par, as it may have been set to \lisppar.
720 \global\dimen1 = \prevdepth
721 \egroup % End the \vtop.
722 \addgroupbox
723 \prevdepth = \dimen1
724 \checkinserts
727 \def\addgroupbox{
728 % \dimen0 is the vertical size of the group's box.
729 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
730 % \dimen2 is how much space is left on the page (more or less).
731 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
732 % if the group doesn't fit on the current page, and it's a big big
733 % group, force a page break.
734 \ifdim \dimen0 > \dimen2
735 \ifdim \pagetotal < \vfilllimit\txipageheight
736 \page
739 \box\groupbox
743 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
744 % message, so this ends up printing `@group can only ...'.
746 \newhelp\groupinvalidhelp{%
747 group can only be used in environments such as @example,^^J%
748 where each line of input produces a line of output.}
750 % @need space-in-mils
751 % forces a page break if there is not space-in-mils remaining.
753 \newdimen\mil \mil=0.001in
755 \parseargdef\need{%
756 % Ensure vertical mode, so we don't make a big box in the middle of a
757 % paragraph.
758 \par
760 % If the @need value is less than one line space, it's useless.
761 \dimen0 = #1\mil
762 \dimen2 = \ht\strutbox
763 \advance\dimen2 by \dp\strutbox
764 \ifdim\dimen0 > \dimen2
766 % Do a \strut just to make the height of this box be normal, so the
767 % normal leading is inserted relative to the preceding line.
768 % And a page break here is fine.
769 \vtop to #1\mil{\strut\vfil}%
771 % TeX does not even consider page breaks if a penalty added to the
772 % main vertical list is 10000 or more. But in order to see if the
773 % empty box we just added fits on the page, we must make it consider
774 % page breaks. On the other hand, we don't want to actually break the
775 % page after the empty box. So we use a penalty of 9999.
777 % There is an extremely small chance that TeX will actually break the
778 % page at this \penalty, if there are no other feasible breakpoints in
779 % sight. (If the user is using lots of big @group commands, which
780 % almost-but-not-quite fill up a page, TeX will have a hard time doing
781 % good page breaking, for example.) However, I could not construct an
782 % example where a page broke at this \penalty; if it happens in a real
783 % document, then we can reconsider our strategy.
784 \penalty9999
786 % Back up by the size of the box, whether we did a page break or not.
787 \kern -#1\mil
789 % Do not allow a page break right after this kern.
790 \nobreak
794 % @br forces paragraph break (and is undocumented).
796 \let\br = \par
798 % @page forces the start of a new page.
800 \def\page{\par\vfill\supereject}
802 % @exdent text....
803 % outputs text on separate line in roman font, starting at standard page margin
805 % This records the amount of indent in the innermost environment.
806 % That's how much \exdent should take out.
807 \newskip\exdentamount
809 % This defn is used inside fill environments such as @defun.
810 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
812 % This defn is used inside nofill environments such as @example.
813 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
814 \leftline{\hskip\leftskip{\rm#1}}}}
816 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
817 % paragraph. For more general purposes, use the \margin insertion
818 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
820 \newskip\inmarginspacing \inmarginspacing=1cm
821 \def\strutdepth{\dp\strutbox}
823 \def\doinmargin#1#2{\strut\vadjust{%
824 \nobreak
825 \kern-\strutdepth
826 \vtop to \strutdepth{%
827 \baselineskip=\strutdepth
828 \vss
829 % if you have multiple lines of stuff to put here, you'll need to
830 % make the vbox yourself of the appropriate size.
831 \ifx#1l%
832 \llap{\ignorespaces #2\hskip\inmarginspacing}%
833 \else
834 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
836 \null
839 \def\inleftmargin{\doinmargin l}
840 \def\inrightmargin{\doinmargin r}
842 % @inmargin{TEXT [, RIGHT-TEXT]}
843 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
844 % else use TEXT for both).
846 \def\inmargin#1{\parseinmargin #1,,\finish}
847 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
848 \setbox0 = \hbox{\ignorespaces #2}%
849 \ifdim\wd0 > 0pt
850 \def\lefttext{#1}% have both texts
851 \def\righttext{#2}%
852 \else
853 \def\lefttext{#1}% have only one text
854 \def\righttext{#1}%
857 \ifodd\pageno
858 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
859 \else
860 \def\temp{\inleftmargin\lefttext}%
862 \temp
865 % @| inserts a changebar to the left of the current line. It should
866 % surround any changed text. This approach does *not* work if the
867 % change spans more than two lines of output. To handle that, we would
868 % have adopt a much more difficult approach (putting marks into the main
869 % vertical list for the beginning and end of each change). This command
870 % is not documented, not supported, and doesn't work.
872 \def\|{%
873 % \vadjust can only be used in horizontal mode.
874 \leavevmode
876 % Append this vertical mode material after the current line in the output.
877 \vadjust{%
878 % We want to insert a rule with the height and depth of the current
879 % leading; that is exactly what \strutbox is supposed to record.
880 \vskip-\baselineskip
882 % \vadjust-items are inserted at the left edge of the type. So
883 % the \llap here moves out into the left-hand margin.
884 \llap{%
886 % For a thicker or thinner bar, change the `1pt'.
887 \vrule height\baselineskip width1pt
889 % This is the space between the bar and the text.
890 \hskip 12pt
895 % @include FILE -- \input text of FILE.
897 \def\include{\parseargusing\filenamecatcodes\includezzz}
898 \def\includezzz#1{%
899 \pushthisfilestack
900 \def\thisfile{#1}%
902 \makevalueexpandable % we want to expand any @value in FILE.
903 \turnoffactive % and allow special characters in the expansion
904 \indexnofonts % Allow `@@' and other weird things in file names.
905 \wlog{texinfo.tex: doing @include of #1^^J}%
906 \edef\temp{\noexpand\input #1 }%
908 % This trickery is to read FILE outside of a group, in case it makes
909 % definitions, etc.
910 \expandafter
911 }\temp
912 \popthisfilestack
914 \def\filenamecatcodes{%
915 \catcode`\\=\other
916 \catcode`~=\other
917 \catcode`^=\other
918 \catcode`_=\other
919 \catcode`|=\other
920 \catcode`<=\other
921 \catcode`>=\other
922 \catcode`+=\other
923 \catcode`-=\other
924 \catcode`\`=\other
925 \catcode`\'=\other
928 \def\pushthisfilestack{%
929 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
931 \def\pushthisfilestackX{%
932 \expandafter\pushthisfilestackY\thisfile\StackTerm
934 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
935 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
938 \def\popthisfilestack{\errthisfilestackempty}
939 \def\errthisfilestackempty{\errmessage{Internal error:
940 the stack of filenames is empty.}}
942 \def\thisfile{}
944 % @center line
945 % outputs that line, centered.
947 \parseargdef\center{%
948 \ifhmode
949 \let\centersub\centerH
950 \else
951 \let\centersub\centerV
953 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
954 \let\centersub\relax % don't let the definition persist, just in case
956 \def\centerH#1{{%
957 \hfil\break
958 \advance\hsize by -\leftskip
959 \advance\hsize by -\rightskip
960 \line{#1}%
961 \break
964 \newcount\centerpenalty
965 \def\centerV#1{%
966 % The idea here is the same as in \startdefun, \cartouche, etc.: if
967 % @center is the first thing after a section heading, we need to wipe
968 % out the negative parskip inserted by \sectionheading, but still
969 % prevent a page break here.
970 \centerpenalty = \lastpenalty
971 \ifnum\centerpenalty>10000 \vskip\parskip \fi
972 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
973 \line{\kern\leftskip #1\kern\rightskip}%
976 % @sp n outputs n lines of vertical space
978 \parseargdef\sp{\vskip #1\baselineskip}
980 % @comment ...line which is ignored...
981 % @c is the same as @comment
982 % @ignore ... @end ignore is another way to write a comment
984 \def\comment{\begingroup \catcode`\^^M=\active%
985 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other\commentxxx}%
987 {\catcode`\^^M=\active%
988 \gdef\commentxxx#1^^M{\endgroup%
989 \futurelet\nexttoken\commentxxxx}%
990 \gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}%
993 \def\c{\begingroup \catcode`\^^M=\active%
994 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
995 \cxxx}
996 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
997 % See comment in \scanmacro about why the definitions of @c and @comment differ
999 % @paragraphindent NCHARS
1000 % We'll use ems for NCHARS, close enough.
1001 % NCHARS can also be the word `asis' or `none'.
1002 % We cannot feasibly implement @paragraphindent asis, though.
1004 \def\asisword{asis} % no translation, these are keywords
1005 \def\noneword{none}
1007 \parseargdef\paragraphindent{%
1008 \def\temp{#1}%
1009 \ifx\temp\asisword
1010 \else
1011 \ifx\temp\noneword
1012 \defaultparindent = 0pt
1013 \else
1014 \defaultparindent = #1em
1017 \parindent = \defaultparindent
1020 % @exampleindent NCHARS
1021 % We'll use ems for NCHARS like @paragraphindent.
1022 % It seems @exampleindent asis isn't necessary, but
1023 % I preserve it to make it similar to @paragraphindent.
1024 \parseargdef\exampleindent{%
1025 \def\temp{#1}%
1026 \ifx\temp\asisword
1027 \else
1028 \ifx\temp\noneword
1029 \lispnarrowing = 0pt
1030 \else
1031 \lispnarrowing = #1em
1036 % @firstparagraphindent WORD
1037 % If WORD is `none', then suppress indentation of the first paragraph
1038 % after a section heading. If WORD is `insert', then do indent at such
1039 % paragraphs.
1041 % The paragraph indentation is suppressed or not by calling
1042 % \suppressfirstparagraphindent, which the sectioning commands do.
1043 % We switch the definition of this back and forth according to WORD.
1044 % By default, we suppress indentation.
1046 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
1047 \def\insertword{insert}
1049 \parseargdef\firstparagraphindent{%
1050 \def\temp{#1}%
1051 \ifx\temp\noneword
1052 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
1053 \else\ifx\temp\insertword
1054 \let\suppressfirstparagraphindent = \relax
1055 \else
1056 \errhelp = \EMsimple
1057 \errmessage{Unknown @firstparagraphindent option `\temp'}%
1058 \fi\fi
1061 % Here is how we actually suppress indentation. Redefine \everypar to
1062 % \kern backwards by \parindent, and then reset itself to empty.
1064 % We also make \indent itself not actually do anything until the next
1065 % paragraph.
1067 \gdef\dosuppressfirstparagraphindent{%
1068 \gdef\indent {\restorefirstparagraphindent \indent}%
1069 \gdef\noindent{\restorefirstparagraphindent \noindent}%
1070 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
1073 \gdef\restorefirstparagraphindent{%
1074 \global\let\indent = \ptexindent
1075 \global\let\noindent = \ptexnoindent
1076 \global\everypar = {}%
1080 % @refill is a no-op.
1081 \let\refill=\relax
1083 % @setfilename INFO-FILENAME - ignored
1084 \let\setfilename=\comment
1086 % @bye.
1087 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1090 \message{pdf,}
1091 % adobe `portable' document format
1092 \newcount\tempnum
1093 \newcount\lnkcount
1094 \newtoks\filename
1095 \newcount\filenamelength
1096 \newcount\pgn
1097 \newtoks\toksA
1098 \newtoks\toksB
1099 \newtoks\toksC
1100 \newtoks\toksD
1101 \newbox\boxA
1102 \newbox\boxB
1103 \newcount\countA
1104 \newif\ifpdf
1105 \newif\ifpdfmakepagedest
1108 % For LuaTeX
1111 \newif\iftxiuseunicodedestname
1112 \txiuseunicodedestnamefalse % For pdfTeX etc.
1114 \ifx\luatexversion\thisisundefined
1115 \else
1116 % Use Unicode destination names
1117 \txiuseunicodedestnametrue
1118 % Escape PDF strings with converting UTF-16 from UTF-8
1119 \begingroup
1120 \catcode`\%=12
1121 \directlua{
1122 function UTF16oct(str)
1123 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1124 for c in string.utfvalues(str) do
1125 if c < 0x10000 then
1126 tex.sprint(
1127 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1128 string.char(0x5c) .. string.char(0x25) .. '03o',
1129 (c / 256), (c % 256)))
1130 else
1131 c = c - 0x10000
1132 local c_hi = c / 1024 + 0xd800
1133 local c_lo = c % 1024 + 0xdc00
1134 tex.sprint(
1135 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1136 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1137 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1138 string.char(0x5c) .. string.char(0x25) .. '03o',
1139 (c_hi / 256), (c_hi % 256),
1140 (c_lo / 256), (c_lo % 256)))
1145 \endgroup
1146 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1147 % Escape PDF strings without converting
1148 \begingroup
1149 \directlua{
1150 function PDFescstr(str)
1151 for c in string.bytes(str) do
1152 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1153 tex.sprint(
1154 string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1156 else
1157 tex.sprint(string.char(c))
1162 \endgroup
1163 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1164 \ifnum\luatexversion>84
1165 % For LuaTeX >= 0.85
1166 \def\pdfdest{\pdfextension dest}
1167 \let\pdfoutput\outputmode
1168 \def\pdfliteral{\pdfextension literal}
1169 \def\pdfcatalog{\pdfextension catalog}
1170 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1171 \let\pdfximage\saveimageresource
1172 \let\pdfrefximage\useimageresource
1173 \let\pdflastximage\lastsavedimageresourceindex
1174 \def\pdfendlink{\pdfextension endlink\relax}
1175 \def\pdfoutline{\pdfextension outline}
1176 \def\pdfstartlink{\pdfextension startlink}
1177 \def\pdffontattr{\pdfextension fontattr}
1178 \def\pdfobj{\pdfextension obj}
1179 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1180 \let\pdfpagewidth\pagewidth
1181 \let\pdfpageheight\pageheight
1182 \edef\pdfhorigin{\pdfvariable horigin}
1183 \edef\pdfvorigin{\pdfvariable vorigin}
1187 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1188 % can be set). So we test for \relax and 0 as well as being undefined.
1189 \ifx\pdfoutput\thisisundefined
1190 \else
1191 \ifx\pdfoutput\relax
1192 \else
1193 \ifcase\pdfoutput
1194 \else
1195 \pdftrue
1200 % PDF uses PostScript string constants for the names of xref targets,
1201 % for display in the outlines, and in other places. Thus, we have to
1202 % double any backslashes. Otherwise, a name like "\node" will be
1203 % interpreted as a newline (\n), followed by o, d, e. Not good.
1205 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1206 % related messages. The final outcome is that it is up to the TeX user
1207 % to double the backslashes and otherwise make the string valid, so
1208 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1209 % do this reliably, so we use it.
1211 % #1 is a control sequence in which to do the replacements,
1212 % which we \xdef.
1213 \def\txiescapepdf#1{%
1214 \ifx\pdfescapestring\thisisundefined
1215 % No primitive available; should we give a warning or log?
1216 % Many times it won't matter.
1217 \xdef#1{#1}%
1218 \else
1219 % The expandable \pdfescapestring primitive escapes parentheses,
1220 % backslashes, and other special chars.
1221 \xdef#1{\pdfescapestring{#1}}%
1224 \def\txiescapepdfutfsixteen#1{%
1225 \ifx\pdfescapestrutfsixteen\thisisundefined
1226 % No UTF-16 converting macro available.
1227 \txiescapepdf{#1}%
1228 \else
1229 \xdef#1{\pdfescapestrutfsixteen{#1}}%
1233 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1234 with PDF output, and none of those formats could be found. (.eps cannot
1235 be supported due to the design of the PDF format; use regular TeX (DVI
1236 output) for that.)}
1238 \ifpdf
1240 % Color manipulation macros using ideas from pdfcolor.tex,
1241 % except using rgb instead of cmyk; the latter is said to render as a
1242 % very dark gray on-screen and a very dark halftone in print, instead
1243 % of actual black. The dark red here is dark enough to print on paper as
1244 % nearly black, but still distinguishable for online viewing. We use
1245 % black by default, though.
1246 \def\rgbDarkRed{0.50 0.09 0.12}
1247 \def\rgbBlack{0 0 0}
1249 % rg sets the color for filling (usual text, etc.);
1250 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1251 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1253 % Set color, and create a mark which defines \thiscolor accordingly,
1254 % so that \makeheadline knows which color to restore.
1255 \def\setcolor#1{%
1256 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1257 \domark
1258 \pdfsetcolor{#1}%
1261 \def\maincolor{\rgbBlack}
1262 \pdfsetcolor{\maincolor}
1263 \edef\thiscolor{\maincolor}
1264 \def\lastcolordefs{}
1266 \def\makefootline{%
1267 \baselineskip24pt
1268 \line{\pdfsetcolor{\maincolor}\the\footline}%
1271 \def\makeheadline{%
1272 \vbox to 0pt{%
1273 \vskip-22.5pt
1274 \line{%
1275 \vbox to8.5pt{}%
1276 % Extract \thiscolor definition from the marks.
1277 \getcolormarks
1278 % Typeset the headline with \maincolor, then restore the color.
1279 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1281 \vss
1283 \nointerlineskip
1287 \pdfcatalog{/PageMode /UseOutlines}
1289 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1290 \def\dopdfimage#1#2#3{%
1291 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1292 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1294 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1295 % others). Let's try in that order, PDF first since if
1296 % someone has a scalable image, presumably better to use that than a
1297 % bitmap.
1298 \let\pdfimgext=\empty
1299 \begingroup
1300 \openin 1 #1.pdf \ifeof 1
1301 \openin 1 #1.PDF \ifeof 1
1302 \openin 1 #1.png \ifeof 1
1303 \openin 1 #1.jpg \ifeof 1
1304 \openin 1 #1.jpeg \ifeof 1
1305 \openin 1 #1.JPG \ifeof 1
1306 \errhelp = \nopdfimagehelp
1307 \errmessage{Could not find image file #1 for pdf}%
1308 \else \gdef\pdfimgext{JPG}%
1310 \else \gdef\pdfimgext{jpeg}%
1312 \else \gdef\pdfimgext{jpg}%
1314 \else \gdef\pdfimgext{png}%
1316 \else \gdef\pdfimgext{PDF}%
1318 \else \gdef\pdfimgext{pdf}%
1320 \closein 1
1321 \endgroup
1323 % without \immediate, ancient pdftex seg faults when the same image is
1324 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1325 \ifnum\pdftexversion < 14
1326 \immediate\pdfimage
1327 \else
1328 \immediate\pdfximage
1330 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1331 \ifdim \wd2 >0pt height \pdfimageheight \fi
1332 \ifnum\pdftexversion<13
1333 #1.\pdfimgext
1334 \else
1335 {#1.\pdfimgext}%
1337 \ifnum\pdftexversion < 14 \else
1338 \pdfrefximage \pdflastximage
1339 \fi}
1341 \def\setpdfdestname#1{{%
1342 % We have to set dummies so commands such as @code, and characters
1343 % such as \, aren't expanded when present in a section title.
1344 \indexnofonts
1345 \makevalueexpandable
1346 \turnoffactive
1347 \iftxiuseunicodedestname
1348 \ifx \declaredencoding \latone
1349 % Pass through Latin-1 characters.
1350 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1351 \else
1352 \ifx \declaredencoding \utfeight
1353 % Pass through Unicode characters.
1354 \else
1355 % Use ASCII approximations in destination names.
1356 \passthroughcharsfalse
1359 \else
1360 % Use ASCII approximations in destination names.
1361 \passthroughcharsfalse
1363 \def\pdfdestname{#1}%
1364 \txiescapepdf\pdfdestname
1367 \def\setpdfoutlinetext#1{{%
1368 \indexnofonts
1369 \makevalueexpandable
1370 \turnoffactive
1371 \ifx \declaredencoding \latone
1372 % The PDF format can use an extended form of Latin-1 in bookmark
1373 % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1374 % the "PDFDocEncoding".
1375 \passthroughcharstrue
1376 % Pass through Latin-1 characters.
1377 % LuaTeX: Convert to Unicode
1378 % pdfTeX: Use Latin-1 as PDFDocEncoding
1379 \def\pdfoutlinetext{#1}%
1380 \else
1381 \ifx \declaredencoding \utfeight
1382 \ifx\luatexversion\thisisundefined
1383 % For pdfTeX with UTF-8.
1384 % TODO: the PDF format can use UTF-16 in bookmark strings,
1385 % but the code for this isn't done yet.
1386 % Use ASCII approximations.
1387 \passthroughcharsfalse
1388 \def\pdfoutlinetext{#1}%
1389 \else
1390 % For LuaTeX with UTF-8.
1391 % Pass through Unicode characters for title texts.
1392 \passthroughcharstrue
1393 \def\pdfoutlinetext{#1}%
1395 \else
1396 % For non-Latin-1 or non-UTF-8 encodings.
1397 % Use ASCII approximations.
1398 \passthroughcharsfalse
1399 \def\pdfoutlinetext{#1}%
1402 % LuaTeX: Convert to UTF-16
1403 % pdfTeX: Use Latin-1 as PDFDocEncoding
1404 \txiescapepdfutfsixteen\pdfoutlinetext
1407 \def\pdfmkdest#1{%
1408 \setpdfdestname{#1}%
1409 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1412 % used to mark target names; must be expandable.
1413 \def\pdfmkpgn#1{#1}
1415 % by default, use black for everything.
1416 \def\urlcolor{\rgbBlack}
1417 \def\linkcolor{\rgbBlack}
1418 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1420 % Adding outlines to PDF; macros for calculating structure of outlines
1421 % come from Petr Olsak
1422 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1423 \else \csname#1\endcsname \fi}
1424 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1425 \advance\tempnum by 1
1426 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1428 % #1 is the section text, which is what will be displayed in the
1429 % outline by the pdf viewer. #2 is the pdf expression for the number
1430 % of subentries (or empty, for subsubsections). #3 is the node text,
1431 % which might be empty if this toc entry had no corresponding node.
1432 % #4 is the page number
1434 \def\dopdfoutline#1#2#3#4{%
1435 % Generate a link to the node text if that exists; else, use the
1436 % page number. We could generate a destination for the section
1437 % text in the case where a section has no node, but it doesn't
1438 % seem worth the trouble, since most documents are normally structured.
1439 \setpdfoutlinetext{#1}
1440 \setpdfdestname{#3}
1441 \ifx\pdfdestname\empty
1442 \def\pdfdestname{#4}%
1445 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
1448 \def\pdfmakeoutlines{%
1449 \begingroup
1450 % Read toc silently, to get counts of subentries for \pdfoutline.
1451 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1452 \def\numchapentry##1##2##3##4{%
1453 \def\thischapnum{##2}%
1454 \def\thissecnum{0}%
1455 \def\thissubsecnum{0}%
1457 \def\numsecentry##1##2##3##4{%
1458 \advancenumber{chap\thischapnum}%
1459 \def\thissecnum{##2}%
1460 \def\thissubsecnum{0}%
1462 \def\numsubsecentry##1##2##3##4{%
1463 \advancenumber{sec\thissecnum}%
1464 \def\thissubsecnum{##2}%
1466 \def\numsubsubsecentry##1##2##3##4{%
1467 \advancenumber{subsec\thissubsecnum}%
1469 \def\thischapnum{0}%
1470 \def\thissecnum{0}%
1471 \def\thissubsecnum{0}%
1473 % use \def rather than \let here because we redefine \chapentry et
1474 % al. a second time, below.
1475 \def\appentry{\numchapentry}%
1476 \def\appsecentry{\numsecentry}%
1477 \def\appsubsecentry{\numsubsecentry}%
1478 \def\appsubsubsecentry{\numsubsubsecentry}%
1479 \def\unnchapentry{\numchapentry}%
1480 \def\unnsecentry{\numsecentry}%
1481 \def\unnsubsecentry{\numsubsecentry}%
1482 \def\unnsubsubsecentry{\numsubsubsecentry}%
1483 \readdatafile{toc}%
1485 % Read toc second time, this time actually producing the outlines.
1486 % The `-' means take the \expnumber as the absolute number of
1487 % subentries, which we calculated on our first read of the .toc above.
1489 % We use the node names as the destinations.
1490 \def\numchapentry##1##2##3##4{%
1491 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1492 \def\numsecentry##1##2##3##4{%
1493 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1494 \def\numsubsecentry##1##2##3##4{%
1495 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1496 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1497 \dopdfoutline{##1}{}{##3}{##4}}%
1499 % PDF outlines are displayed using system fonts, instead of
1500 % document fonts. Therefore we cannot use special characters,
1501 % since the encoding is unknown. For example, the eogonek from
1502 % Latin 2 (0xea) gets translated to a | character. Info from
1503 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1505 % TODO this right, we have to translate 8-bit characters to
1506 % their "best" equivalent, based on the @documentencoding. Too
1507 % much work for too little return. Just use the ASCII equivalents
1508 % we use for the index sort strings.
1510 \indexnofonts
1511 \setupdatafile
1512 % We can have normal brace characters in the PDF outlines, unlike
1513 % Texinfo index files. So set that up.
1514 \def\{{\lbracecharliteral}%
1515 \def\}{\rbracecharliteral}%
1516 \catcode`\\=\active \otherbackslash
1517 \input \tocreadfilename
1518 \endgroup
1520 {\catcode`[=1 \catcode`]=2
1521 \catcode`{=\other \catcode`}=\other
1522 \gdef\lbracecharliteral[{]%
1523 \gdef\rbracecharliteral[}]%
1526 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1527 \ifx\PP\D\let\nextsp\relax
1528 \else\let\nextsp\skipspaces
1529 \addtokens{\filename}{\PP}%
1530 \advance\filenamelength by 1
1532 \nextsp}
1533 \def\getfilename#1{%
1534 \filenamelength=0
1535 % If we don't expand the argument now, \skipspaces will get
1536 % snagged on things like "@value{foo}".
1537 \edef\temp{#1}%
1538 \expandafter\skipspaces\temp|\relax
1540 \ifnum\pdftexversion < 14
1541 \let \startlink \pdfannotlink
1542 \else
1543 \let \startlink \pdfstartlink
1545 % make a live url in pdf output.
1546 \def\pdfurl#1{%
1547 \begingroup
1548 % it seems we really need yet another set of dummies; have not
1549 % tried to figure out what each command should do in the context
1550 % of @url. for now, just make @/ a no-op, that's the only one
1551 % people have actually reported a problem with.
1553 \normalturnoffactive
1554 \def\@{@}%
1555 \let\/=\empty
1556 \makevalueexpandable
1557 % do we want to go so far as to use \indexnofonts instead of just
1558 % special-casing \var here?
1559 \def\var##1{##1}%
1561 \leavevmode\setcolor{\urlcolor}%
1562 \startlink attr{/Border [0 0 0]}%
1563 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1564 \endgroup}
1565 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1566 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1567 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1568 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1569 \def\maketoks{%
1570 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1571 \ifx\first0\adn0
1572 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1573 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1574 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1575 \else
1576 \ifnum0=\countA\else\makelink\fi
1577 \ifx\first.\let\next=\done\else
1578 \let\next=\maketoks
1579 \addtokens{\toksB}{\the\toksD}
1580 \ifx\first,\addtokens{\toksB}{\space}\fi
1582 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1583 \next}
1584 \def\makelink{\addtokens{\toksB}%
1585 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1586 \def\pdflink#1{%
1587 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1588 \setcolor{\linkcolor}#1\endlink}
1589 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1590 \else
1591 % non-pdf mode
1592 \let\pdfmkdest = \gobble
1593 \let\pdfurl = \gobble
1594 \let\endlink = \relax
1595 \let\setcolor = \gobble
1596 \let\pdfsetcolor = \gobble
1597 \let\pdfmakeoutlines = \relax
1598 \fi % \ifx\pdfoutput
1601 % For XeTeX
1603 \ifx\XeTeXrevision\thisisundefined
1604 \else
1606 % XeTeX version check
1608 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1609 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1610 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1611 % For avoiding PDF destination name replacement, we use this special
1612 % instead of xdvipdfmx's command line option `-C 0x0010'.
1613 \special{dvipdfmx:config C 0x0010}
1614 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1615 % It can handle Unicode destination names for PDF.
1616 \txiuseunicodedestnametrue
1617 \else
1618 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1619 % `dvipdfmx:config' special.
1620 % So for avoiding PDF destination name replacement,
1621 % xdvipdfmx's command line option `-C 0x0010' is necessary.
1623 % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1624 % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1625 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1626 \txiuseunicodedestnamefalse
1629 % Color support
1631 \def\rgbDarkRed{0.50 0.09 0.12}
1632 \def\rgbBlack{0 0 0}
1634 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1636 % Set color, and create a mark which defines \thiscolor accordingly,
1637 % so that \makeheadline knows which color to restore.
1638 \def\setcolor#1{%
1639 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1640 \domark
1641 \pdfsetcolor{#1}%
1644 \def\maincolor{\rgbBlack}
1645 \pdfsetcolor{\maincolor}
1646 \edef\thiscolor{\maincolor}
1647 \def\lastcolordefs{}
1649 \def\makefootline{%
1650 \baselineskip24pt
1651 \line{\pdfsetcolor{\maincolor}\the\footline}%
1654 \def\makeheadline{%
1655 \vbox to 0pt{%
1656 \vskip-22.5pt
1657 \line{%
1658 \vbox to8.5pt{}%
1659 % Extract \thiscolor definition from the marks.
1660 \getcolormarks
1661 % Typeset the headline with \maincolor, then restore the color.
1662 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1664 \vss
1666 \nointerlineskip
1669 % PDF outline support
1671 % Emulate pdfTeX primitive
1672 \def\pdfdest name#1 xyz{%
1673 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1676 \def\setpdfdestname#1{{%
1677 % We have to set dummies so commands such as @code, and characters
1678 % such as \, aren't expanded when present in a section title.
1679 \indexnofonts
1680 \makevalueexpandable
1681 \turnoffactive
1682 \iftxiuseunicodedestname
1683 % Pass through Unicode characters.
1684 \else
1685 % Use ASCII approximations in destination names.
1686 \passthroughcharsfalse
1688 \def\pdfdestname{#1}%
1689 \txiescapepdf\pdfdestname
1692 \def\setpdfoutlinetext#1{{%
1693 \turnoffactive
1694 % Always use Unicode characters in title texts.
1695 \def\pdfoutlinetext{#1}%
1696 % For XeTeX, xdvipdfmx converts to UTF-16.
1697 % So we do not convert.
1698 \txiescapepdf\pdfoutlinetext
1701 \def\pdfmkdest#1{%
1702 \setpdfdestname{#1}%
1703 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1706 % by default, use black for everything.
1707 \def\urlcolor{\rgbBlack}
1708 \def\linkcolor{\rgbBlack}
1709 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1711 \def\dopdfoutline#1#2#3#4{%
1712 \setpdfoutlinetext{#1}
1713 \setpdfdestname{#3}
1714 \ifx\pdfdestname\empty
1715 \def\pdfdestname{#4}%
1718 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1719 << /S /GoTo /D (\pdfdestname) >> >> }%
1722 \def\pdfmakeoutlines{%
1723 \begingroup
1725 % For XeTeX, counts of subentries are not necessary.
1726 % Therefore, we read toc only once.
1728 % We use node names as destinations.
1729 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1730 \def\numchapentry##1##2##3##4{%
1731 \dopdfoutline{##1}{1}{##3}{##4}}%
1732 \def\numsecentry##1##2##3##4{%
1733 \dopdfoutline{##1}{2}{##3}{##4}}%
1734 \def\numsubsecentry##1##2##3##4{%
1735 \dopdfoutline{##1}{3}{##3}{##4}}%
1736 \def\numsubsubsecentry##1##2##3##4{%
1737 \dopdfoutline{##1}{4}{##3}{##4}}%
1739 \let\appentry\numchapentry%
1740 \let\appsecentry\numsecentry%
1741 \let\appsubsecentry\numsubsecentry%
1742 \let\appsubsubsecentry\numsubsubsecentry%
1743 \let\unnchapentry\numchapentry%
1744 \let\unnsecentry\numsecentry%
1745 \let\unnsubsecentry\numsubsecentry%
1746 \let\unnsubsubsecentry\numsubsubsecentry%
1748 % For XeTeX, xdvipdfmx converts strings to UTF-16.
1749 % Therefore, the encoding and the language may not be considered.
1751 \indexnofonts
1752 \setupdatafile
1753 % We can have normal brace characters in the PDF outlines, unlike
1754 % Texinfo index files. So set that up.
1755 \def\{{\lbracecharliteral}%
1756 \def\}{\rbracecharliteral}%
1757 \catcode`\\=\active \otherbackslash
1758 \input \tocreadfilename
1759 \endgroup
1761 {\catcode`[=1 \catcode`]=2
1762 \catcode`{=\other \catcode`}=\other
1763 \gdef\lbracecharliteral[{]%
1764 \gdef\rbracecharliteral[}]%
1767 \special{pdf:docview << /PageMode /UseOutlines >> }
1768 % ``\special{pdf:tounicode ...}'' is not necessary
1769 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1770 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1771 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1772 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1774 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1775 \ifx\PP\D\let\nextsp\relax
1776 \else\let\nextsp\skipspaces
1777 \addtokens{\filename}{\PP}%
1778 \advance\filenamelength by 1
1780 \nextsp}
1781 \def\getfilename#1{%
1782 \filenamelength=0
1783 % If we don't expand the argument now, \skipspaces will get
1784 % snagged on things like "@value{foo}".
1785 \edef\temp{#1}%
1786 \expandafter\skipspaces\temp|\relax
1788 % make a live url in pdf output.
1789 \def\pdfurl#1{%
1790 \begingroup
1791 % it seems we really need yet another set of dummies; have not
1792 % tried to figure out what each command should do in the context
1793 % of @url. for now, just make @/ a no-op, that's the only one
1794 % people have actually reported a problem with.
1796 \normalturnoffactive
1797 \def\@{@}%
1798 \let\/=\empty
1799 \makevalueexpandable
1800 % do we want to go so far as to use \indexnofonts instead of just
1801 % special-casing \var here?
1802 \def\var##1{##1}%
1804 \leavevmode\setcolor{\urlcolor}%
1805 \special{pdf:bann << /Border [0 0 0]
1806 /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1807 \endgroup}
1808 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1809 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1810 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1811 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1812 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1813 \def\maketoks{%
1814 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1815 \ifx\first0\adn0
1816 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1817 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1818 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1819 \else
1820 \ifnum0=\countA\else\makelink\fi
1821 \ifx\first.\let\next=\done\else
1822 \let\next=\maketoks
1823 \addtokens{\toksB}{\the\toksD}
1824 \ifx\first,\addtokens{\toksB}{\space}\fi
1826 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1827 \next}
1828 \def\makelink{\addtokens{\toksB}%
1829 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1830 \def\pdflink#1{%
1831 \special{pdf:bann << /Border [0 0 0]
1832 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1833 \setcolor{\linkcolor}#1\endlink}
1834 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1837 % @image support
1839 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1840 \def\doxeteximage#1#2#3{%
1841 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1842 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1844 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1845 % others). Let's try in that order, PDF first since if
1846 % someone has a scalable image, presumably better to use that than a
1847 % bitmap.
1848 \let\xeteximgext=\empty
1849 \begingroup
1850 \openin 1 #1.pdf \ifeof 1
1851 \openin 1 #1.PDF \ifeof 1
1852 \openin 1 #1.png \ifeof 1
1853 \openin 1 #1.jpg \ifeof 1
1854 \openin 1 #1.jpeg \ifeof 1
1855 \openin 1 #1.JPG \ifeof 1
1856 \errmessage{Could not find image file #1 for XeTeX}%
1857 \else \gdef\xeteximgext{JPG}%
1859 \else \gdef\xeteximgext{jpeg}%
1861 \else \gdef\xeteximgext{jpg}%
1863 \else \gdef\xeteximgext{png}%
1865 \else \gdef\xeteximgext{PDF}%
1867 \else \gdef\xeteximgext{pdf}%
1869 \closein 1
1870 \endgroup
1872 \def\xetexpdfext{pdf}%
1873 \ifx\xeteximgext\xetexpdfext
1874 \XeTeXpdffile "#1".\xeteximgext ""
1875 \else
1876 \def\xetexpdfext{PDF}%
1877 \ifx\xeteximgext\xetexpdfext
1878 \XeTeXpdffile "#1".\xeteximgext ""
1879 \else
1880 \XeTeXpicfile "#1".\xeteximgext ""
1883 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1884 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1888 \message{fonts,}
1890 % Change the current font style to #1, remembering it in \curfontstyle.
1891 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1892 % italics, not bold italics.
1894 \def\setfontstyle#1{%
1895 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1896 \csname ten#1\endcsname % change the current font
1899 % Select #1 fonts with the current style.
1901 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1903 \def\rm{\fam=0 \setfontstyle{rm}}
1904 \def\it{\fam=\itfam \setfontstyle{it}}
1905 \def\sl{\fam=\slfam \setfontstyle{sl}}
1906 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1907 \def\tt{\fam=\ttfam \setfontstyle{tt}}
1909 % Unfortunately, we have to override this for titles and the like, since
1910 % in those cases "rm" is bold. Sigh.
1911 \def\rmisbold{\rm\def\curfontstyle{bf}}
1913 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1914 % So we set up a \sf.
1915 \newfam\sffam
1916 \def\sf{\fam=\sffam \setfontstyle{sf}}
1917 \let\li = \sf % Sometimes we call it \li, not \sf.
1919 % We don't need math for this font style.
1920 \def\ttsl{\setfontstyle{ttsl}}
1923 % Set the baselineskip to #1, and the lineskip and strut size
1924 % correspondingly. There is no deep meaning behind these magic numbers
1925 % used as factors; they just match (closely enough) what Knuth defined.
1927 \def\lineskipfactor{.08333}
1928 \def\strutheightpercent{.70833}
1929 \def\strutdepthpercent {.29167}
1931 % can get a sort of poor man's double spacing by redefining this.
1932 \def\baselinefactor{1}
1934 \newdimen\textleading
1935 \def\setleading#1{%
1936 \dimen0 = #1\relax
1937 \normalbaselineskip = \baselinefactor\dimen0
1938 \normallineskip = \lineskipfactor\normalbaselineskip
1939 \normalbaselines
1940 \setbox\strutbox =\hbox{%
1941 \vrule width0pt height\strutheightpercent\baselineskip
1942 depth \strutdepthpercent \baselineskip
1946 % PDF CMaps. See also LaTeX's t1.cmap.
1948 % do nothing with this by default.
1949 \expandafter\let\csname cmapOT1\endcsname\gobble
1950 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1951 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1953 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1954 % (\pdffontattr was introduced many years ago, but people still run
1955 % older pdftex's; it's easy to conditionalize, so we do.)
1956 \ifpdf \ifx\pdffontattr\thisisundefined \else
1957 \begingroup
1958 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1959 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1960 %%DocumentNeededResources: ProcSet (CIDInit)
1961 %%IncludeResource: ProcSet (CIDInit)
1962 %%BeginResource: CMap (TeX-OT1-0)
1963 %%Title: (TeX-OT1-0 TeX OT1 0)
1964 %%Version: 1.000
1965 %%EndComments
1966 /CIDInit /ProcSet findresource begin
1967 12 dict begin
1968 begincmap
1969 /CIDSystemInfo
1970 << /Registry (TeX)
1971 /Ordering (OT1)
1972 /Supplement 0
1973 >> def
1974 /CMapName /TeX-OT1-0 def
1975 /CMapType 2 def
1976 1 begincodespacerange
1977 <00> <7F>
1978 endcodespacerange
1979 8 beginbfrange
1980 <00> <01> <0393>
1981 <09> <0A> <03A8>
1982 <23> <26> <0023>
1983 <28> <3B> <0028>
1984 <3F> <5B> <003F>
1985 <5D> <5E> <005D>
1986 <61> <7A> <0061>
1987 <7B> <7C> <2013>
1988 endbfrange
1989 40 beginbfchar
1990 <02> <0398>
1991 <03> <039B>
1992 <04> <039E>
1993 <05> <03A0>
1994 <06> <03A3>
1995 <07> <03D2>
1996 <08> <03A6>
1997 <0B> <00660066>
1998 <0C> <00660069>
1999 <0D> <0066006C>
2000 <0E> <006600660069>
2001 <0F> <00660066006C>
2002 <10> <0131>
2003 <11> <0237>
2004 <12> <0060>
2005 <13> <00B4>
2006 <14> <02C7>
2007 <15> <02D8>
2008 <16> <00AF>
2009 <17> <02DA>
2010 <18> <00B8>
2011 <19> <00DF>
2012 <1A> <00E6>
2013 <1B> <0153>
2014 <1C> <00F8>
2015 <1D> <00C6>
2016 <1E> <0152>
2017 <1F> <00D8>
2018 <21> <0021>
2019 <22> <201D>
2020 <27> <2019>
2021 <3C> <00A1>
2022 <3D> <003D>
2023 <3E> <00BF>
2024 <5C> <201C>
2025 <5F> <02D9>
2026 <60> <2018>
2027 <7D> <02DD>
2028 <7E> <007E>
2029 <7F> <00A8>
2030 endbfchar
2031 endcmap
2032 CMapName currentdict /CMap defineresource pop
2035 %%EndResource
2036 %%EOF
2037 }\endgroup
2038 \expandafter\edef\csname cmapOT1\endcsname#1{%
2039 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2042 % \cmapOT1IT
2043 \begingroup
2044 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2045 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2046 %%DocumentNeededResources: ProcSet (CIDInit)
2047 %%IncludeResource: ProcSet (CIDInit)
2048 %%BeginResource: CMap (TeX-OT1IT-0)
2049 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
2050 %%Version: 1.000
2051 %%EndComments
2052 /CIDInit /ProcSet findresource begin
2053 12 dict begin
2054 begincmap
2055 /CIDSystemInfo
2056 << /Registry (TeX)
2057 /Ordering (OT1IT)
2058 /Supplement 0
2059 >> def
2060 /CMapName /TeX-OT1IT-0 def
2061 /CMapType 2 def
2062 1 begincodespacerange
2063 <00> <7F>
2064 endcodespacerange
2065 8 beginbfrange
2066 <00> <01> <0393>
2067 <09> <0A> <03A8>
2068 <25> <26> <0025>
2069 <28> <3B> <0028>
2070 <3F> <5B> <003F>
2071 <5D> <5E> <005D>
2072 <61> <7A> <0061>
2073 <7B> <7C> <2013>
2074 endbfrange
2075 42 beginbfchar
2076 <02> <0398>
2077 <03> <039B>
2078 <04> <039E>
2079 <05> <03A0>
2080 <06> <03A3>
2081 <07> <03D2>
2082 <08> <03A6>
2083 <0B> <00660066>
2084 <0C> <00660069>
2085 <0D> <0066006C>
2086 <0E> <006600660069>
2087 <0F> <00660066006C>
2088 <10> <0131>
2089 <11> <0237>
2090 <12> <0060>
2091 <13> <00B4>
2092 <14> <02C7>
2093 <15> <02D8>
2094 <16> <00AF>
2095 <17> <02DA>
2096 <18> <00B8>
2097 <19> <00DF>
2098 <1A> <00E6>
2099 <1B> <0153>
2100 <1C> <00F8>
2101 <1D> <00C6>
2102 <1E> <0152>
2103 <1F> <00D8>
2104 <21> <0021>
2105 <22> <201D>
2106 <23> <0023>
2107 <24> <00A3>
2108 <27> <2019>
2109 <3C> <00A1>
2110 <3D> <003D>
2111 <3E> <00BF>
2112 <5C> <201C>
2113 <5F> <02D9>
2114 <60> <2018>
2115 <7D> <02DD>
2116 <7E> <007E>
2117 <7F> <00A8>
2118 endbfchar
2119 endcmap
2120 CMapName currentdict /CMap defineresource pop
2123 %%EndResource
2124 %%EOF
2125 }\endgroup
2126 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2127 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2130 % \cmapOT1TT
2131 \begingroup
2132 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2133 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2134 %%DocumentNeededResources: ProcSet (CIDInit)
2135 %%IncludeResource: ProcSet (CIDInit)
2136 %%BeginResource: CMap (TeX-OT1TT-0)
2137 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2138 %%Version: 1.000
2139 %%EndComments
2140 /CIDInit /ProcSet findresource begin
2141 12 dict begin
2142 begincmap
2143 /CIDSystemInfo
2144 << /Registry (TeX)
2145 /Ordering (OT1TT)
2146 /Supplement 0
2147 >> def
2148 /CMapName /TeX-OT1TT-0 def
2149 /CMapType 2 def
2150 1 begincodespacerange
2151 <00> <7F>
2152 endcodespacerange
2153 5 beginbfrange
2154 <00> <01> <0393>
2155 <09> <0A> <03A8>
2156 <21> <26> <0021>
2157 <28> <5F> <0028>
2158 <61> <7E> <0061>
2159 endbfrange
2160 32 beginbfchar
2161 <02> <0398>
2162 <03> <039B>
2163 <04> <039E>
2164 <05> <03A0>
2165 <06> <03A3>
2166 <07> <03D2>
2167 <08> <03A6>
2168 <0B> <2191>
2169 <0C> <2193>
2170 <0D> <0027>
2171 <0E> <00A1>
2172 <0F> <00BF>
2173 <10> <0131>
2174 <11> <0237>
2175 <12> <0060>
2176 <13> <00B4>
2177 <14> <02C7>
2178 <15> <02D8>
2179 <16> <00AF>
2180 <17> <02DA>
2181 <18> <00B8>
2182 <19> <00DF>
2183 <1A> <00E6>
2184 <1B> <0153>
2185 <1C> <00F8>
2186 <1D> <00C6>
2187 <1E> <0152>
2188 <1F> <00D8>
2189 <20> <2423>
2190 <27> <2019>
2191 <60> <2018>
2192 <7F> <00A8>
2193 endbfchar
2194 endcmap
2195 CMapName currentdict /CMap defineresource pop
2198 %%EndResource
2199 %%EOF
2200 }\endgroup
2201 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2202 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2204 \fi\fi
2207 % Set the font macro #1 to the font named \fontprefix#2.
2208 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2209 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2210 % Example:
2211 % #1 = \textrm
2212 % #2 = \rmshape
2213 % #3 = 10
2214 % #4 = \mainmagstep
2215 % #5 = OT1
2217 \def\setfont#1#2#3#4#5{%
2218 \font#1=\fontprefix#2#3 scaled #4
2219 \csname cmap#5\endcsname#1%
2221 % This is what gets called when #5 of \setfont is empty.
2222 \let\cmap\gobble
2224 % (end of cmaps)
2226 % Use cm as the default font prefix.
2227 % To specify the font prefix, you must define \fontprefix
2228 % before you read in texinfo.tex.
2229 \ifx\fontprefix\thisisundefined
2230 \def\fontprefix{cm}
2232 % Support font families that don't use the same naming scheme as CM.
2233 \def\rmshape{r}
2234 \def\rmbshape{bx} % where the normal face is bold
2235 \def\bfshape{b}
2236 \def\bxshape{bx}
2237 \def\ttshape{tt}
2238 \def\ttbshape{tt}
2239 \def\ttslshape{sltt}
2240 \def\itshape{ti}
2241 \def\itbshape{bxti}
2242 \def\slshape{sl}
2243 \def\slbshape{bxsl}
2244 \def\sfshape{ss}
2245 \def\sfbshape{ss}
2246 \def\scshape{csc}
2247 \def\scbshape{csc}
2249 % Definitions for a main text size of 11pt. (The default in Texinfo.)
2251 \def\definetextfontsizexi{%
2252 % Text fonts (11.2pt, magstep1).
2253 \def\textnominalsize{11pt}
2254 \edef\mainmagstep{\magstephalf}
2255 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2256 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2257 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2258 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2259 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2260 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2261 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2262 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2263 \font\texti=cmmi10 scaled \mainmagstep
2264 \font\textsy=cmsy10 scaled \mainmagstep
2265 \def\textecsize{1095}
2267 % A few fonts for @defun names and args.
2268 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2269 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2270 \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
2271 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2272 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
2273 \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
2275 % Fonts for indices, footnotes, small examples (9pt).
2276 \def\smallnominalsize{9pt}
2277 \setfont\smallrm\rmshape{9}{1000}{OT1}
2278 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2279 \setfont\smallbf\bfshape{10}{900}{OT1}
2280 \setfont\smallit\itshape{9}{1000}{OT1IT}
2281 \setfont\smallsl\slshape{9}{1000}{OT1}
2282 \setfont\smallsf\sfshape{9}{1000}{OT1}
2283 \setfont\smallsc\scshape{10}{900}{OT1}
2284 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2285 \font\smalli=cmmi9
2286 \font\smallsy=cmsy9
2287 \def\smallecsize{0900}
2289 % Fonts for small examples (8pt).
2290 \def\smallernominalsize{8pt}
2291 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2292 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2293 \setfont\smallerbf\bfshape{10}{800}{OT1}
2294 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2295 \setfont\smallersl\slshape{8}{1000}{OT1}
2296 \setfont\smallersf\sfshape{8}{1000}{OT1}
2297 \setfont\smallersc\scshape{10}{800}{OT1}
2298 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2299 \font\smalleri=cmmi8
2300 \font\smallersy=cmsy8
2301 \def\smallerecsize{0800}
2303 % Fonts for title page (20.4pt):
2304 \def\titlenominalsize{20pt}
2305 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2306 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2307 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2308 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2309 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2310 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2311 \let\titlebf=\titlerm
2312 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2313 \font\titlei=cmmi12 scaled \magstep3
2314 \font\titlesy=cmsy10 scaled \magstep4
2315 \def\titleecsize{2074}
2317 % Chapter (and unnumbered) fonts (17.28pt).
2318 \def\chapnominalsize{17pt}
2319 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2320 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2321 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2322 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2323 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2324 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2325 \let\chapbf=\chaprm
2326 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2327 \font\chapi=cmmi12 scaled \magstep2
2328 \font\chapsy=cmsy10 scaled \magstep3
2329 \def\chapecsize{1728}
2331 % Section fonts (14.4pt).
2332 \def\secnominalsize{14pt}
2333 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2334 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2335 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2336 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2337 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2338 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2339 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2340 \let\secbf\secrm
2341 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2342 \font\seci=cmmi12 scaled \magstep1
2343 \font\secsy=cmsy10 scaled \magstep2
2344 \def\sececsize{1440}
2346 % Subsection fonts (13.15pt).
2347 \def\ssecnominalsize{13pt}
2348 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2349 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2350 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2351 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2352 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2353 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2354 \let\ssecbf\ssecrm
2355 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2356 \font\sseci=cmmi12 scaled \magstephalf
2357 \font\ssecsy=cmsy10 scaled 1315
2358 \def\ssececsize{1200}
2360 % Reduced fonts for @acro in text (10pt).
2361 \def\reducednominalsize{10pt}
2362 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2363 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2364 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2365 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2366 \setfont\reducedsl\slshape{10}{1000}{OT1}
2367 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2368 \setfont\reducedsc\scshape{10}{1000}{OT1}
2369 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2370 \font\reducedi=cmmi10
2371 \font\reducedsy=cmsy10
2372 \def\reducedecsize{1000}
2374 \textleading = 13.2pt % line spacing for 11pt CM
2375 \textfonts % reset the current fonts
2377 } % end of 11pt text font size definitions, \definetextfontsizexi
2380 % Definitions to make the main text be 10pt Computer Modern, with
2381 % section, chapter, etc., sizes following suit. This is for the GNU
2382 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2383 % future. Used with @smallbook, which sets the leading to 12pt.
2385 \def\definetextfontsizex{%
2386 % Text fonts (10pt).
2387 \def\textnominalsize{10pt}
2388 \edef\mainmagstep{1000}
2389 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2390 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2391 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2392 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2393 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2394 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2395 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2396 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2397 \font\texti=cmmi10 scaled \mainmagstep
2398 \font\textsy=cmsy10 scaled \mainmagstep
2399 \def\textecsize{1000}
2401 % A few fonts for @defun names and args.
2402 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2403 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2404 \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
2405 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2406 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
2407 \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
2409 % Fonts for indices, footnotes, small examples (9pt).
2410 \def\smallnominalsize{9pt}
2411 \setfont\smallrm\rmshape{9}{1000}{OT1}
2412 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2413 \setfont\smallbf\bfshape{10}{900}{OT1}
2414 \setfont\smallit\itshape{9}{1000}{OT1IT}
2415 \setfont\smallsl\slshape{9}{1000}{OT1}
2416 \setfont\smallsf\sfshape{9}{1000}{OT1}
2417 \setfont\smallsc\scshape{10}{900}{OT1}
2418 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2419 \font\smalli=cmmi9
2420 \font\smallsy=cmsy9
2421 \def\smallecsize{0900}
2423 % Fonts for small examples (8pt).
2424 \def\smallernominalsize{8pt}
2425 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2426 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2427 \setfont\smallerbf\bfshape{10}{800}{OT1}
2428 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2429 \setfont\smallersl\slshape{8}{1000}{OT1}
2430 \setfont\smallersf\sfshape{8}{1000}{OT1}
2431 \setfont\smallersc\scshape{10}{800}{OT1}
2432 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2433 \font\smalleri=cmmi8
2434 \font\smallersy=cmsy8
2435 \def\smallerecsize{0800}
2437 % Fonts for title page (20.4pt):
2438 \def\titlenominalsize{20pt}
2439 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2440 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2441 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2442 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2443 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2444 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2445 \let\titlebf=\titlerm
2446 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2447 \font\titlei=cmmi12 scaled \magstep3
2448 \font\titlesy=cmsy10 scaled \magstep4
2449 \def\titleecsize{2074}
2451 % Chapter fonts (14.4pt).
2452 \def\chapnominalsize{14pt}
2453 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2454 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2455 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2456 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2457 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2458 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2459 \let\chapbf\chaprm
2460 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2461 \font\chapi=cmmi12 scaled \magstep1
2462 \font\chapsy=cmsy10 scaled \magstep2
2463 \def\chapecsize{1440}
2465 % Section fonts (12pt).
2466 \def\secnominalsize{12pt}
2467 \setfont\secrm\rmbshape{12}{1000}{OT1}
2468 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2469 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2470 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2471 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2472 \setfont\secsf\sfbshape{12}{1000}{OT1}
2473 \let\secbf\secrm
2474 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2475 \font\seci=cmmi12
2476 \font\secsy=cmsy10 scaled \magstep1
2477 \def\sececsize{1200}
2479 % Subsection fonts (10pt).
2480 \def\ssecnominalsize{10pt}
2481 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2482 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2483 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2484 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2485 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2486 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2487 \let\ssecbf\ssecrm
2488 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2489 \font\sseci=cmmi10
2490 \font\ssecsy=cmsy10
2491 \def\ssececsize{1000}
2493 % Reduced fonts for @acro in text (9pt).
2494 \def\reducednominalsize{9pt}
2495 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2496 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2497 \setfont\reducedbf\bfshape{10}{900}{OT1}
2498 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2499 \setfont\reducedsl\slshape{9}{1000}{OT1}
2500 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2501 \setfont\reducedsc\scshape{10}{900}{OT1}
2502 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2503 \font\reducedi=cmmi9
2504 \font\reducedsy=cmsy9
2505 \def\reducedecsize{0900}
2507 \divide\parskip by 2 % reduce space between paragraphs
2508 \textleading = 12pt % line spacing for 10pt CM
2509 \textfonts % reset the current fonts
2511 } % end of 10pt text font size definitions, \definetextfontsizex
2514 % We provide the user-level command
2515 % @fonttextsize 10
2516 % (or 11) to redefine the text font size. pt is assumed.
2518 \def\xiword{11}
2519 \def\xword{10}
2520 \def\xwordpt{10pt}
2522 \parseargdef\fonttextsize{%
2523 \def\textsizearg{#1}%
2524 %\wlog{doing @fonttextsize \textsizearg}%
2526 % Set \globaldefs so that documents can use this inside @tex, since
2527 % makeinfo 4.8 does not support it, but we need it nonetheless.
2529 \begingroup \globaldefs=1
2530 \ifx\textsizearg\xword \definetextfontsizex
2531 \else \ifx\textsizearg\xiword \definetextfontsizexi
2532 \else
2533 \errhelp=\EMsimple
2534 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2535 \fi\fi
2536 \endgroup
2539 % In order for the font changes to affect most math symbols and letters,
2540 % we have to define the \textfont of the standard families. We don't
2541 % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
2543 \def\resetmathfonts{%
2544 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2545 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2546 \textfont\ttfam=\tentt \textfont\sffam=\tensf
2549 % The font-changing commands redefine the meanings of \tenSTYLE, instead
2550 % of just \STYLE. We do this because \STYLE needs to also set the
2551 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2552 % \tenSTYLE to set the current font.
2554 % Each font-changing command also sets the names \lsize (one size lower)
2555 % and \lllsize (three sizes lower). These relative commands are used
2556 % in, e.g., the LaTeX logo and acronyms.
2558 % This all needs generalizing, badly.
2560 \def\textfonts{%
2561 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2562 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2563 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2564 \let\tenttsl=\textttsl
2565 \def\curfontsize{text}%
2566 \def\lsize{reduced}\def\lllsize{smaller}%
2567 \resetmathfonts \setleading{\textleading}}
2568 \def\titlefonts{%
2569 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2570 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2571 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2572 \let\tenttsl=\titlettsl
2573 \def\curfontsize{title}%
2574 \def\lsize{chap}\def\lllsize{subsec}%
2575 \resetmathfonts \setleading{27pt}}
2576 \def\titlefont#1{{\titlefonts\rmisbold #1}}
2577 \def\chapfonts{%
2578 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2579 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2580 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2581 \let\tenttsl=\chapttsl
2582 \def\curfontsize{chap}%
2583 \def\lsize{sec}\def\lllsize{text}%
2584 \resetmathfonts \setleading{19pt}}
2585 \def\secfonts{%
2586 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2587 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2588 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2589 \let\tenttsl=\secttsl
2590 \def\curfontsize{sec}%
2591 \def\lsize{subsec}\def\lllsize{reduced}%
2592 \resetmathfonts \setleading{17pt}}
2593 \def\subsecfonts{%
2594 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2595 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2596 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2597 \let\tenttsl=\ssecttsl
2598 \def\curfontsize{ssec}%
2599 \def\lsize{text}\def\lllsize{small}%
2600 \resetmathfonts \setleading{15pt}}
2601 \let\subsubsecfonts = \subsecfonts
2602 \def\reducedfonts{%
2603 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2604 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2605 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2606 \let\tenttsl=\reducedttsl
2607 \def\curfontsize{reduced}%
2608 \def\lsize{small}\def\lllsize{smaller}%
2609 \resetmathfonts \setleading{10.5pt}}
2610 \def\smallfonts{%
2611 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2612 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2613 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2614 \let\tenttsl=\smallttsl
2615 \def\curfontsize{small}%
2616 \def\lsize{smaller}\def\lllsize{smaller}%
2617 \resetmathfonts \setleading{10.5pt}}
2618 \def\smallerfonts{%
2619 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2620 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2621 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2622 \let\tenttsl=\smallerttsl
2623 \def\curfontsize{smaller}%
2624 \def\lsize{smaller}\def\lllsize{smaller}%
2625 \resetmathfonts \setleading{9.5pt}}
2627 % Fonts for short table of contents.
2628 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2629 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2630 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2631 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2633 % Define these just so they can be easily changed for other fonts.
2634 \def\angleleft{$\langle$}
2635 \def\angleright{$\rangle$}
2637 % Set the fonts to use with the @small... environments.
2638 \let\smallexamplefonts = \smallfonts
2640 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2641 % can fit this many characters:
2642 % 8.5x11=86 smallbook=72 a4=90 a5=69
2643 % If we use \scriptfonts (8pt), then we can fit this many characters:
2644 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2645 % For me, subjectively, the few extra characters that fit aren't worth
2646 % the additional smallness of 8pt. So I'm making the default 9pt.
2648 % By the way, for comparison, here's what fits with @example (10pt):
2649 % 8.5x11=71 smallbook=60 a4=75 a5=58
2650 % --karl, 24jan03.
2652 % Set up the default fonts, so we can use them for creating boxes.
2654 \definetextfontsizexi
2657 \message{markup,}
2659 % Check if we are currently using a typewriter font. Since all the
2660 % Computer Modern typewriter fonts have zero interword stretch (and
2661 % shrink), and it is reasonable to expect all typewriter fonts to have
2662 % this property, we can check that font parameter.
2664 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2666 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2667 % define and register \INITMACRO to be called on markup style changes.
2668 % \INITMACRO can check \currentmarkupstyle for the innermost
2669 % style and the set of \ifmarkupSTYLE switches for all styles
2670 % currently in effect.
2671 \newif\ifmarkupvar
2672 \newif\ifmarkupsamp
2673 \newif\ifmarkupkey
2674 %\newif\ifmarkupfile % @file == @samp.
2675 %\newif\ifmarkupoption % @option == @samp.
2676 \newif\ifmarkupcode
2677 \newif\ifmarkupkbd
2678 %\newif\ifmarkupenv % @env == @code.
2679 %\newif\ifmarkupcommand % @command == @code.
2680 \newif\ifmarkuptex % @tex (and part of @math, for now).
2681 \newif\ifmarkupexample
2682 \newif\ifmarkupverb
2683 \newif\ifmarkupverbatim
2685 \let\currentmarkupstyle\empty
2687 \def\setupmarkupstyle#1{%
2688 \csname markup#1true\endcsname
2689 \def\currentmarkupstyle{#1}%
2690 \markupstylesetup
2693 \let\markupstylesetup\empty
2695 \def\defmarkupstylesetup#1{%
2696 \expandafter\def\expandafter\markupstylesetup
2697 \expandafter{\markupstylesetup #1}%
2698 \def#1%
2701 % Markup style setup for left and right quotes.
2702 \defmarkupstylesetup\markupsetuplq{%
2703 \expandafter\let\expandafter \temp
2704 \csname markupsetuplq\currentmarkupstyle\endcsname
2705 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2708 \defmarkupstylesetup\markupsetuprq{%
2709 \expandafter\let\expandafter \temp
2710 \csname markupsetuprq\currentmarkupstyle\endcsname
2711 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2715 \catcode`\'=\active
2716 \catcode`\`=\active
2718 \gdef\markupsetuplqdefault{\let`\lq}
2719 \gdef\markupsetuprqdefault{\let'\rq}
2721 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2722 \gdef\markupsetcodequoteright{\let'\codequoteright}
2725 \let\markupsetuplqcode \markupsetcodequoteleft
2726 \let\markupsetuprqcode \markupsetcodequoteright
2728 \let\markupsetuplqexample \markupsetcodequoteleft
2729 \let\markupsetuprqexample \markupsetcodequoteright
2731 \let\markupsetuplqkbd \markupsetcodequoteleft
2732 \let\markupsetuprqkbd \markupsetcodequoteright
2734 \let\markupsetuplqsamp \markupsetcodequoteleft
2735 \let\markupsetuprqsamp \markupsetcodequoteright
2737 \let\markupsetuplqverb \markupsetcodequoteleft
2738 \let\markupsetuprqverb \markupsetcodequoteright
2740 \let\markupsetuplqverbatim \markupsetcodequoteleft
2741 \let\markupsetuprqverbatim \markupsetcodequoteright
2743 % Allow an option to not use regular directed right quote/apostrophe
2744 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2745 % The undirected quote is ugly, so don't make it the default, but it
2746 % works for pasting with more pdf viewers (at least evince), the
2747 % lilypond developers report. xpdf does work with the regular 0x27.
2749 \def\codequoteright{%
2750 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2751 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2753 \else \char'15 \fi
2754 \else \char'15 \fi
2757 % and a similar option for the left quote char vs. a grave accent.
2758 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2759 % the code environments to do likewise.
2761 \def\codequoteleft{%
2762 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2763 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2764 % [Knuth] pp. 380,381,391
2765 % \relax disables Spanish ligatures ?` and !` of \tt font.
2766 \relax`%
2767 \else \char'22 \fi
2768 \else \char'22 \fi
2771 % Commands to set the quote options.
2773 \parseargdef\codequoteundirected{%
2774 \def\temp{#1}%
2775 \ifx\temp\onword
2776 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2777 = t%
2778 \else\ifx\temp\offword
2779 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2780 = \relax
2781 \else
2782 \errhelp = \EMsimple
2783 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2784 \fi\fi
2787 \parseargdef\codequotebacktick{%
2788 \def\temp{#1}%
2789 \ifx\temp\onword
2790 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2791 = t%
2792 \else\ifx\temp\offword
2793 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2794 = \relax
2795 \else
2796 \errhelp = \EMsimple
2797 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2798 \fi\fi
2801 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2802 \def\noligaturesquoteleft{\relax\lq}
2804 % Count depth in font-changes, for error checks
2805 \newcount\fontdepth \fontdepth=0
2807 % Font commands.
2809 % #1 is the font command (\sl or \it), #2 is the text to slant.
2810 % If we are in a monospaced environment, however, 1) always use \ttsl,
2811 % and 2) do not add an italic correction.
2812 \def\dosmartslant#1#2{%
2813 \ifusingtt
2814 {{\ttsl #2}\let\next=\relax}%
2815 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2816 \next
2818 \def\smartslanted{\dosmartslant\sl}
2819 \def\smartitalic{\dosmartslant\it}
2821 % Output an italic correction unless \next (presumed to be the following
2822 % character) is such as not to need one.
2823 \def\smartitaliccorrection{%
2824 \ifx\next,%
2825 \else\ifx\next-%
2826 \else\ifx\next.%
2827 \else\ifx\next\.%
2828 \else\ifx\next\comma%
2829 \else\ptexslash
2830 \fi\fi\fi\fi\fi
2831 \aftersmartic
2834 % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2835 \def\ttslanted#1{{\ttsl #1}}
2837 % @cite is like \smartslanted except unconditionally use \sl. We never want
2838 % ttsl for book titles, do we?
2839 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2841 \def\aftersmartic{}
2842 \def\var#1{%
2843 \let\saveaftersmartic = \aftersmartic
2844 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2845 \smartslanted{#1}%
2848 \let\i=\smartitalic
2849 \let\slanted=\smartslanted
2850 \let\dfn=\smartslanted
2851 \let\emph=\smartitalic
2853 % Explicit font changes: @r, @sc, undocumented @ii.
2854 \def\r#1{{\rm #1}} % roman font
2855 \def\sc#1{{\smallcaps#1}} % smallcaps font
2856 \def\ii#1{{\it #1}} % italic font
2858 % @b, explicit bold. Also @strong.
2859 \def\b#1{{\bf #1}}
2860 \let\strong=\b
2862 % @sansserif, explicit sans.
2863 \def\sansserif#1{{\sf #1}}
2865 % We can't just use \exhyphenpenalty, because that only has effect at
2866 % the end of a paragraph. Restore normal hyphenation at the end of the
2867 % group within which \nohyphenation is presumably called.
2869 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2870 \def\restorehyphenation{\hyphenchar\font = `- }
2872 % Set sfcode to normal for the chars that usually have another value.
2873 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2874 % sometimes \x has an active definition that messes things up.
2876 \catcode`@=11
2877 \def\plainfrenchspacing{%
2878 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2879 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2880 \def\endofsentencespacefactor{1000}% for @. and friends
2882 \def\plainnonfrenchspacing{%
2883 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2884 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2885 \def\endofsentencespacefactor{3000}% for @. and friends
2887 \catcode`@=\other
2888 \def\endofsentencespacefactor{3000}% default
2890 % @t, explicit typewriter.
2891 \def\t#1{%
2892 {\tt \rawbackslash \plainfrenchspacing #1}%
2893 \null
2896 % @samp.
2897 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2899 % @indicateurl is \samp, that is, with quotes.
2900 \let\indicateurl=\samp
2902 % @code (and similar) prints in typewriter, but with spaces the same
2903 % size as normal in the surrounding text, without hyphenation, etc.
2904 % This is a subroutine for that.
2905 \def\tclose#1{%
2907 % Change normal interword space to be same as for the current font.
2908 \spaceskip = \fontdimen2\font
2910 % Switch to typewriter.
2913 % But `\ ' produces the large typewriter interword space.
2914 \def\ {{\spaceskip = 0pt{} }}%
2916 % Turn off hyphenation.
2917 \nohyphenation
2919 \rawbackslash
2920 \plainfrenchspacing
2923 \null % reset spacefactor to 1000
2926 % We *must* turn on hyphenation at `-' and `_' in @code.
2927 % (But see \codedashfinish below.)
2928 % Otherwise, it is too hard to avoid overfull hboxes
2929 % in the Emacs manual, the Library manual, etc.
2931 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2932 % both hyphenation at - and hyphenation within words.
2933 % We must therefore turn them both off (\tclose does that)
2934 % and arrange explicitly to hyphenate at a dash. -- rms.
2936 \catcode`\-=\active \catcode`\_=\active
2937 \catcode`\'=\active \catcode`\`=\active
2938 \global\let'=\rq \global\let`=\lq % default definitions
2940 \global\def\code{\begingroup
2941 \setupmarkupstyle{code}%
2942 % The following should really be moved into \setupmarkupstyle handlers.
2943 \catcode\dashChar=\active \catcode\underChar=\active
2944 \ifallowcodebreaks
2945 \let-\codedash
2946 \let_\codeunder
2947 \else
2948 \let-\normaldash
2949 \let_\realunder
2951 % Given -foo (with a single dash), we do not want to allow a break
2952 % after the hyphen.
2953 \global\let\codedashprev=\codedash
2955 \codex
2958 \gdef\codedash{\futurelet\next\codedashfinish}
2959 \gdef\codedashfinish{%
2960 \normaldash % always output the dash character itself.
2962 % Now, output a discretionary to allow a line break, unless
2963 % (a) the next character is a -, or
2964 % (b) the preceding character is a -.
2965 % E.g., given --posix, we do not want to allow a break after either -.
2966 % Given --foo-bar, we do want to allow a break between the - and the b.
2967 \ifx\next\codedash \else
2968 \ifx\codedashprev\codedash
2969 \else \discretionary{}{}{}\fi
2971 % we need the space after the = for the case when \next itself is a
2972 % space token; it would get swallowed otherwise. As in @code{- a}.
2973 \global\let\codedashprev= \next
2976 \def\normaldash{-}
2978 \def\codex #1{\tclose{#1}\endgroup}
2980 \def\codeunder{%
2981 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2982 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2983 % will therefore expand the active definition of _, which is us
2984 % (inside @code that is), therefore an endless loop.
2985 \ifusingtt{\ifmmode
2986 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2987 \else\normalunderscore \fi
2988 \discretionary{}{}{}}%
2989 {\_}%
2992 % An additional complication: the above will allow breaks after, e.g.,
2993 % each of the four underscores in __typeof__. This is bad.
2994 % @allowcodebreaks provides a document-level way to turn breaking at -
2995 % and _ on and off.
2997 \newif\ifallowcodebreaks \allowcodebreakstrue
2999 \def\keywordtrue{true}
3000 \def\keywordfalse{false}
3002 \parseargdef\allowcodebreaks{%
3003 \def\txiarg{#1}%
3004 \ifx\txiarg\keywordtrue
3005 \allowcodebreakstrue
3006 \else\ifx\txiarg\keywordfalse
3007 \allowcodebreaksfalse
3008 \else
3009 \errhelp = \EMsimple
3010 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
3011 \fi\fi
3014 % For @command, @env, @file, @option quotes seem unnecessary,
3015 % so use \code rather than \samp.
3016 \let\command=\code
3017 \let\env=\code
3018 \let\file=\code
3019 \let\option=\code
3021 % @uref (abbreviation for `urlref') aka @url takes an optional
3022 % (comma-separated) second argument specifying the text to display and
3023 % an optional third arg as text to display instead of (rather than in
3024 % addition to) the url itself. First (mandatory) arg is the url.
3026 % TeX-only option to allow changing PDF output to show only the second
3027 % arg (if given), and not the url (which is then just the link target).
3028 \newif\ifurefurlonlylink
3030 % The main macro is \urefbreak, which allows breaking at expected
3031 % places within the url. (There used to be another version, which
3032 % didn't support automatic breaking.)
3033 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
3034 \let\uref=\urefbreak
3036 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
3037 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
3038 \unsepspaces
3039 \pdfurl{#1}%
3040 \setbox0 = \hbox{\ignorespaces #3}%
3041 \ifdim\wd0 > 0pt
3042 \unhbox0 % third arg given, show only that
3043 \else
3044 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
3045 \ifdim\wd0 > 0pt
3046 \ifpdf
3047 % For pdfTeX and LuaTeX
3048 \ifurefurlonlylink
3049 % PDF plus option to not display url, show just arg
3050 \unhbox0
3051 \else
3052 % PDF, normally display both arg and url for consistency,
3053 % visibility, if the pdf is eventually used to print, etc.
3054 \unhbox0\ (\urefcode{#1})%
3056 \else
3057 \ifx\XeTeXrevision\thisisundefined
3058 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3059 \else
3060 % For XeTeX
3061 \ifurefurlonlylink
3062 % PDF plus option to not display url, show just arg
3063 \unhbox0
3064 \else
3065 % PDF, normally display both arg and url for consistency,
3066 % visibility, if the pdf is eventually used to print, etc.
3067 \unhbox0\ (\urefcode{#1})%
3071 \else
3072 \urefcode{#1}% only url given, so show it
3075 \endlink
3076 \endgroup}
3078 % Allow line breaks around only a few characters (only).
3079 \def\urefcatcodes{%
3080 \catcode`\&=\active \catcode`\.=\active
3081 \catcode`\#=\active \catcode`\?=\active
3082 \catcode`\/=\active
3085 \urefcatcodes
3087 \global\def\urefcode{\begingroup
3088 \setupmarkupstyle{code}%
3089 \urefcatcodes
3090 \let&\urefcodeamp
3091 \let.\urefcodedot
3092 \let#\urefcodehash
3093 \let?\urefcodequest
3094 \let/\urefcodeslash
3095 \codex
3098 % By default, they are just regular characters.
3099 \global\def&{\normalamp}
3100 \global\def.{\normaldot}
3101 \global\def#{\normalhash}
3102 \global\def?{\normalquest}
3103 \global\def/{\normalslash}
3106 % we put a little stretch before and after the breakable chars, to help
3107 % line breaking of long url's. The unequal skips make look better in
3108 % cmtt at least, especially for dots.
3109 \def\urefprestretchamount{.13em}
3110 \def\urefpoststretchamount{.1em}
3111 \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
3112 \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
3114 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
3115 \def\urefcodedot{\urefprestretch .\urefpoststretch}
3116 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
3117 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
3118 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3120 \catcode`\/=\active
3121 \global\def\urefcodeslashfinish{%
3122 \urefprestretch \slashChar
3123 % Allow line break only after the final / in a sequence of
3124 % slashes, to avoid line break between the slashes in http://.
3125 \ifx\next/\else \urefpoststretch \fi
3129 % One more complication: by default we'll break after the special
3130 % characters, but some people like to break before the special chars, so
3131 % allow that. Also allow no breaking at all, for manual control.
3133 \parseargdef\urefbreakstyle{%
3134 \def\txiarg{#1}%
3135 \ifx\txiarg\wordnone
3136 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3137 \else\ifx\txiarg\wordbefore
3138 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
3139 \else\ifx\txiarg\wordafter
3140 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
3141 \else
3142 \errhelp = \EMsimple
3143 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3144 \fi\fi\fi
3146 \def\wordafter{after}
3147 \def\wordbefore{before}
3148 \def\wordnone{none}
3150 \urefbreakstyle after
3152 % @url synonym for @uref, since that's how everyone uses it.
3154 \let\url=\uref
3156 % rms does not like angle brackets --karl, 17may97.
3157 % So now @email is just like @uref, unless we are pdf.
3159 %\def\email#1{\angleleft{\tt #1}\angleright}
3160 \ifpdf
3161 \def\email#1{\doemail#1,,\finish}
3162 \def\doemail#1,#2,#3\finish{\begingroup
3163 \unsepspaces
3164 \pdfurl{mailto:#1}%
3165 \setbox0 = \hbox{\ignorespaces #2}%
3166 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3167 \endlink
3168 \endgroup}
3169 \else
3170 \ifx\XeTeXrevision\thisisundefined
3171 \let\email=\uref
3172 \else
3173 \def\email#1{\doemail#1,,\finish}
3174 \def\doemail#1,#2,#3\finish{\begingroup
3175 \unsepspaces
3176 \pdfurl{mailto:#1}%
3177 \setbox0 = \hbox{\ignorespaces #2}%
3178 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3179 \endlink
3180 \endgroup}
3184 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3185 % `example' (@kbd uses ttsl only inside of @example and friends),
3186 % or `code' (@kbd uses normal tty font always).
3187 \parseargdef\kbdinputstyle{%
3188 \def\txiarg{#1}%
3189 \ifx\txiarg\worddistinct
3190 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3191 \else\ifx\txiarg\wordexample
3192 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3193 \else\ifx\txiarg\wordcode
3194 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3195 \else
3196 \errhelp = \EMsimple
3197 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3198 \fi\fi\fi
3200 \def\worddistinct{distinct}
3201 \def\wordexample{example}
3202 \def\wordcode{code}
3204 % Default is `distinct'.
3205 \kbdinputstyle distinct
3207 % @kbd is like @code, except that if the argument is just one @key command,
3208 % then @kbd has no effect.
3209 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
3211 \def\xkey{\key}
3212 \def\kbdsub#1#2#3\par{%
3213 \def\one{#1}\def\three{#3}\def\threex{??}%
3214 \ifx\one\xkey\ifx\threex\three \key{#2}%
3215 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
3216 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
3219 % definition of @key that produces a lozenge. Doesn't adjust to text size.
3220 %\setfont\keyrm\rmshape{8}{1000}{OT1}
3221 %\font\keysy=cmsy9
3222 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3223 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3224 % \vbox{\hrule\kern-0.4pt
3225 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3226 % \kern-0.4pt\hrule}%
3227 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3229 % definition of @key with no lozenge. If the current font is already
3230 % monospace, don't change it; that way, we respect @kbdinputstyle. But
3231 % if it isn't monospace, then use \tt.
3233 \def\key#1{{\setupmarkupstyle{key}%
3234 \nohyphenation
3235 \ifmonospace\else\tt\fi
3236 #1}\null}
3238 % @clicksequence{File @click{} Open ...}
3239 \def\clicksequence#1{\begingroup #1\endgroup}
3241 % @clickstyle @arrow (by default)
3242 \parseargdef\clickstyle{\def\click{#1}}
3243 \def\click{\arrow}
3245 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3246 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3248 \def\dmn#1{\thinspace #1}
3250 % @acronym for "FBI", "NATO", and the like.
3251 % We print this one point size smaller, since it's intended for
3252 % all-uppercase.
3254 \def\acronym#1{\doacronym #1,,\finish}
3255 \def\doacronym#1,#2,#3\finish{%
3256 {\selectfonts\lsize #1}%
3257 \def\temp{#2}%
3258 \ifx\temp\empty \else
3259 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3261 \null % reset \spacefactor=1000
3264 % @abbr for "Comput. J." and the like.
3265 % No font change, but don't do end-of-sentence spacing.
3267 \def\abbr#1{\doabbr #1,,\finish}
3268 \def\doabbr#1,#2,#3\finish{%
3269 {\plainfrenchspacing #1}%
3270 \def\temp{#2}%
3271 \ifx\temp\empty \else
3272 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3274 \null % reset \spacefactor=1000
3277 % @asis just yields its argument. Used with @table, for example.
3279 \def\asis#1{#1}
3281 % @math outputs its argument in math mode.
3283 % One complication: _ usually means subscripts, but it could also mean
3284 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
3285 % _ active, and distinguish by seeing if the current family is \slfam,
3286 % which is what @var uses.
3288 \catcode`\_ = \active
3289 \gdef\mathunderscore{%
3290 \catcode`\_=\active
3291 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3294 % Another complication: we want \\ (and @\) to output a math (or tt) \.
3295 % FYI, plain.tex uses \\ as a temporary control sequence (for no
3296 % particular reason), but this is not advertised and we don't care.
3298 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3299 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3301 \def\math{%
3302 \ifmmode\else % only go into math if not in math mode already
3303 \tex
3304 \mathunderscore
3305 \let\\ = \mathbackslash
3306 \mathactive
3307 % make the texinfo accent commands work in math mode
3308 \let\"=\ddot
3309 \let\'=\acute
3310 \let\==\bar
3311 \let\^=\hat
3312 \let\`=\grave
3313 \let\u=\breve
3314 \let\v=\check
3315 \let\~=\tilde
3316 \let\dotaccent=\dot
3317 % have to provide another name for sup operator
3318 \let\mathopsup=\sup
3319 $\expandafter\finishmath\fi
3321 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3323 % Some active characters (such as <) are spaced differently in math.
3324 % We have to reset their definitions in case the @math was an argument
3325 % to a command which sets the catcodes (such as @item or @section).
3328 \catcode`^ = \active
3329 \catcode`< = \active
3330 \catcode`> = \active
3331 \catcode`+ = \active
3332 \catcode`' = \active
3333 \gdef\mathactive{%
3334 \let^ = \ptexhat
3335 \let< = \ptexless
3336 \let> = \ptexgtr
3337 \let+ = \ptexplus
3338 \let' = \ptexquoteright
3342 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3343 % If in text, use math to place as sub/superscript, but switch
3344 % into text mode, with smaller fonts. This is a different font than the
3345 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3346 % fix it (significant additions to font machinery) until someone notices.
3348 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3349 \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
3351 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3352 \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
3354 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3355 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3356 % except specified as a normal braced arg, so no newlines to worry about.
3358 \def\outfmtnametex{tex}
3360 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3361 \long\def\doinlinefmt#1,#2,\finish{%
3362 \def\inlinefmtname{#1}%
3363 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3366 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3367 % FMTNAME is tex, else ELSE-TEXT.
3368 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3369 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3370 \def\inlinefmtname{#1}%
3371 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3374 % For raw, must switch into @tex before parsing the argument, to avoid
3375 % setting catcodes prematurely. Doing it this way means that, for
3376 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3377 % ignored. But this isn't important because if people want a literal
3378 % *right* brace they would have to use a command anyway, so they may as
3379 % well use a command to get a left brace too. We could re-use the
3380 % delimiter character idea from \verb, but it seems like overkill.
3382 \long\def\inlineraw{\tex \doinlineraw}
3383 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3384 \def\doinlinerawtwo#1,#2,\finish{%
3385 \def\inlinerawname{#1}%
3386 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3387 \endgroup % close group opened by \tex.
3390 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3392 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3393 \long\def\doinlineifset#1,#2,\finish{%
3394 \def\inlinevarname{#1}%
3395 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3396 \else\ignorespaces#2\fi
3399 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3401 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3402 \long\def\doinlineifclear#1,#2,\finish{%
3403 \def\inlinevarname{#1}%
3404 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3408 \message{glyphs,}
3409 % and logos.
3411 % @@ prints an @, as does @atchar{}.
3412 \def\@{\char64 }
3413 \let\atchar=\@
3415 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3416 \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
3417 \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
3418 \let\{=\lbracechar
3419 \let\}=\rbracechar
3421 % @comma{} to avoid , parsing problems.
3422 \let\comma = ,
3424 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3425 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3426 \let\, = \ptexc
3427 \let\dotaccent = \ptexdot
3428 \def\ringaccent#1{{\accent23 #1}}
3429 \let\tieaccent = \ptext
3430 \let\ubaraccent = \ptexb
3431 \let\udotaccent = \d
3433 % Other special characters: @questiondown @exclamdown @ordf @ordm
3434 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3435 \def\questiondown{?`}
3436 \def\exclamdown{!`}
3437 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
3438 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
3440 % Dotless i and dotless j, used for accents.
3441 \def\imacro{i}
3442 \def\jmacro{j}
3443 \def\dotless#1{%
3444 \def\temp{#1}%
3445 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3446 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3447 \else \errmessage{@dotless can be used only with i or j}%
3448 \fi\fi
3451 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3452 % period following counts as ending a sentence. (Idea found in latex.)
3454 \edef\TeX{\TeX \spacefactor=1000 }
3456 % @LaTeX{} logo. Not quite the same results as the definition in
3457 % latex.ltx, since we use a different font for the raised A; it's most
3458 % convenient for us to use an explicitly smaller font, rather than using
3459 % the \scriptstyle font (since we don't reset \scriptstyle and
3460 % \scriptscriptstyle).
3462 \def\LaTeX{%
3463 L\kern-.36em
3464 {\setbox0=\hbox{T}%
3465 \vbox to \ht0{\hbox{%
3466 \ifx\textnominalsize\xwordpt
3467 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
3468 % Revert to plain's \scriptsize, which is 7pt.
3469 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3470 \else
3471 % For 11pt, we can use our lllsize.
3472 \selectfonts\lllsize A%
3475 \vss
3477 \kern-.15em
3478 \TeX
3481 % Some math mode symbols. Define \ensuremath to switch into math mode
3482 % unless we are already there. Expansion tricks may not be needed here,
3483 % but safer, and can't hurt.
3484 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3485 \def\ensuredmath#1{$\relax#1$}
3487 \def\bullet{\ensuremath\ptexbullet}
3488 \def\geq{\ensuremath\ge}
3489 \def\leq{\ensuremath\le}
3490 \def\minus{\ensuremath-}
3492 % @dots{} outputs an ellipsis using the current font.
3493 % We do .5em per period so that it has the same spacing in the cm
3494 % typewriter fonts as three actual period characters; on the other hand,
3495 % in other typewriter fonts three periods are wider than 1.5em. So do
3496 % whichever is larger.
3498 \def\dots{%
3499 \leavevmode
3500 \setbox0=\hbox{...}% get width of three periods
3501 \ifdim\wd0 > 1.5em
3502 \dimen0 = \wd0
3503 \else
3504 \dimen0 = 1.5em
3506 \hbox to \dimen0{%
3507 \hskip 0pt plus.25fil
3508 .\hskip 0pt plus1fil
3509 .\hskip 0pt plus1fil
3510 .\hskip 0pt plus.5fil
3514 % @enddots{} is an end-of-sentence ellipsis.
3516 \def\enddots{%
3517 \dots
3518 \spacefactor=\endofsentencespacefactor
3521 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3523 % Since these characters are used in examples, they should be an even number of
3524 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3526 \def\point{$\star$}
3527 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3528 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3529 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3530 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3531 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3533 % The @error{} command.
3534 % Adapted from the TeXbook's \boxit.
3536 \newbox\errorbox
3538 {\tentt \global\dimen0 = 3em}% Width of the box.
3539 \dimen2 = .55pt % Thickness of rules
3540 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3541 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3543 \setbox\errorbox=\hbox to \dimen0{\hfil
3544 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3545 \advance\hsize by -2\dimen2 % Rules.
3546 \vbox{%
3547 \hrule height\dimen2
3548 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3549 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3550 \kern3pt\vrule width\dimen2}% Space to right.
3551 \hrule height\dimen2}
3552 \hfil}
3554 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3556 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3558 \def\pounds{{\it\$}}
3560 % @euro{} comes from a separate font, depending on the current style.
3561 % We use the free feym* fonts from the eurosym package by Henrik
3562 % Theiling, which support regular, slanted, bold and bold slanted (and
3563 % "outlined" (blackboard board, sort of) versions, which we don't need).
3564 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3566 % Although only regular is the truly official Euro symbol, we ignore
3567 % that. The Euro is designed to be slightly taller than the regular
3568 % font height.
3570 % feymr - regular
3571 % feymo - slanted
3572 % feybr - bold
3573 % feybo - bold slanted
3575 % There is no good (free) typewriter version, to my knowledge.
3576 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3577 % Hmm.
3579 % Also doesn't work in math. Do we need to do math with euro symbols?
3580 % Hope not.
3583 \def\euro{{\eurofont e}}
3584 \def\eurofont{%
3585 % We set the font at each command, rather than predefining it in
3586 % \textfonts and the other font-switching commands, so that
3587 % installations which never need the symbol don't have to have the
3588 % font installed.
3590 % There is only one designed size (nominal 10pt), so we always scale
3591 % that to the current nominal size.
3593 % By the way, simply using "at 1em" works for cmr10 and the like, but
3594 % does not work for cmbx10 and other extended/shrunken fonts.
3596 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3598 \ifx\curfontstyle\bfstylename
3599 % bold:
3600 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3601 \else
3602 % regular:
3603 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3605 \thiseurofont
3608 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3609 % sometimes we redefine the original macro, and the alias should reflect
3610 % the redefinition.
3612 % Use LaTeX names for the Icelandic letters.
3613 \def\DH{{\ecfont \char"D0}} % Eth
3614 \def\dh{{\ecfont \char"F0}} % eth
3615 \def\TH{{\ecfont \char"DE}} % Thorn
3616 \def\th{{\ecfont \char"FE}} % thorn
3618 \def\guillemetleft{{\ecfont \char"13}}
3619 \def\guillemotleft{\guillemetleft}
3620 \def\guillemetright{{\ecfont \char"14}}
3621 \def\guillemotright{\guillemetright}
3622 \def\guilsinglleft{{\ecfont \char"0E}}
3623 \def\guilsinglright{{\ecfont \char"0F}}
3624 \def\quotedblbase{{\ecfont \char"12}}
3625 \def\quotesinglbase{{\ecfont \char"0D}}
3627 % This positioning is not perfect (see the ogonek LaTeX package), but
3628 % we have the precomposed glyphs for the most common cases. We put the
3629 % tests to use those glyphs in the single \ogonek macro so we have fewer
3630 % dummy definitions to worry about for index entries, etc.
3632 % ogonek is also used with other letters in Lithuanian (IOU), but using
3633 % the precomposed glyphs for those is not so easy since they aren't in
3634 % the same EC font.
3635 \def\ogonek#1{{%
3636 \def\temp{#1}%
3637 \ifx\temp\macrocharA\Aogonek
3638 \else\ifx\temp\macrochara\aogonek
3639 \else\ifx\temp\macrocharE\Eogonek
3640 \else\ifx\temp\macrochare\eogonek
3641 \else
3642 \ecfont \setbox0=\hbox{#1}%
3643 \ifdim\ht0=1ex\accent"0C #1%
3644 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3646 \fi\fi\fi\fi
3649 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3650 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3651 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3652 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3654 % Use the European Computer Modern fonts (cm-super in outline format)
3655 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3656 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3657 % package and follow the same conventions.
3659 \def\ecfont{\etcfont{e}}
3660 \def\tcfont{\etcfont{t}}
3662 \def\etcfont#1{%
3663 % We can't distinguish serif/sans and italic/slanted, but this
3664 % is used for crude hacks anyway (like adding French and German
3665 % quotes to documents typeset with CM, where we lose kerning), so
3666 % hopefully nobody will notice/care.
3667 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3668 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3669 \ifmonospace
3670 % typewriter:
3671 \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3672 \else
3673 \ifx\curfontstyle\bfstylename
3674 % bold:
3675 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3676 \else
3677 % regular:
3678 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3681 \thisecfont
3684 % @registeredsymbol - R in a circle. The font for the R should really
3685 % be smaller yet, but lllsize is the best we can do for now.
3686 % Adapted from the plain.tex definition of \copyright.
3688 \def\registeredsymbol{%
3689 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3690 \hfil\crcr\Orb}}%
3694 % @textdegree - the normal degrees sign.
3696 \def\textdegree{$^\circ$}
3698 % Laurent Siebenmann reports \Orb undefined with:
3699 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3700 % so we'll define it if necessary.
3702 \ifx\Orb\thisisundefined
3703 \def\Orb{\mathhexbox20D}
3706 % Quotes.
3707 \chardef\quotedblleft="5C
3708 \chardef\quotedblright=`\"
3709 \chardef\quoteleft=`\`
3710 \chardef\quoteright=`\'
3713 \message{page headings,}
3715 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3716 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3718 % First the title page. Must do @settitle before @titlepage.
3719 \newif\ifseenauthor
3720 \newif\iffinishedtitlepage
3722 % @setcontentsaftertitlepage used to do an implicit @contents or
3723 % @shortcontents after @end titlepage, but it is now obsolete.
3724 \def\setcontentsaftertitlepage{%
3725 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3726 command; move your @contents command if you want the contents
3727 after the title page.}}%
3728 \def\setshortcontentsaftertitlepage{%
3729 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3730 command; move your @shortcontents and @contents commands if you
3731 want the contents after the title page.}}%
3733 \parseargdef\shorttitlepage{%
3734 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3735 \endgroup\page\hbox{}\page}
3737 \envdef\titlepage{%
3738 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3739 \begingroup
3740 \parindent=0pt \textfonts
3741 % Leave some space at the very top of the page.
3742 \vglue\titlepagetopglue
3743 % No rule at page bottom unless we print one at the top with @title.
3744 \finishedtitlepagetrue
3746 % Most title ``pages'' are actually two pages long, with space
3747 % at the top of the second. We don't want the ragged left on the second.
3748 \let\oldpage = \page
3749 \def\page{%
3750 \iffinishedtitlepage\else
3751 \finishtitlepage
3753 \let\page = \oldpage
3754 \page
3755 \null
3759 \def\Etitlepage{%
3760 \iffinishedtitlepage\else
3761 \finishtitlepage
3763 % It is important to do the page break before ending the group,
3764 % because the headline and footline are only empty inside the group.
3765 % If we use the new definition of \page, we always get a blank page
3766 % after the title page, which we certainly don't want.
3767 \oldpage
3768 \endgroup
3770 % Need this before the \...aftertitlepage checks so that if they are
3771 % in effect the toc pages will come out with page numbers.
3772 \HEADINGSon
3775 \def\finishtitlepage{%
3776 \vskip4pt \hrule height 2pt width \hsize
3777 \vskip\titlepagebottomglue
3778 \finishedtitlepagetrue
3781 % Settings used for typesetting titles: no hyphenation, no indentation,
3782 % don't worry much about spacing, ragged right. This should be used
3783 % inside a \vbox, and fonts need to be set appropriately first. Because
3784 % it is always used for titles, nothing else, we call \rmisbold. \par
3785 % should be specified before the end of the \vbox, since a vbox is a group.
3787 \def\raggedtitlesettings{%
3788 \rmisbold
3789 \hyphenpenalty=10000
3790 \parindent=0pt
3791 \tolerance=5000
3792 \ptexraggedright
3795 % Macros to be used within @titlepage:
3797 \let\subtitlerm=\tenrm
3798 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3800 \parseargdef\title{%
3801 \checkenv\titlepage
3802 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3803 % print a rule at the page bottom also.
3804 \finishedtitlepagefalse
3805 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3808 \parseargdef\subtitle{%
3809 \checkenv\titlepage
3810 {\subtitlefont \rightline{#1}}%
3813 % @author should come last, but may come many times.
3814 % It can also be used inside @quotation.
3816 \parseargdef\author{%
3817 \def\temp{\quotation}%
3818 \ifx\thisenv\temp
3819 \def\quotationauthor{#1}% printed in \Equotation.
3820 \else
3821 \checkenv\titlepage
3822 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3823 {\secfonts\rmisbold \leftline{#1}}%
3828 % Set up page headings and footings.
3830 \let\thispage=\folio
3832 \newtoks\evenheadline % headline on even pages
3833 \newtoks\oddheadline % headline on odd pages
3834 \newtoks\evenfootline % footline on even pages
3835 \newtoks\oddfootline % footline on odd pages
3837 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3838 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3839 \else \the\evenheadline \fi}}
3840 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3841 \else \the\evenfootline \fi}\HEADINGShook}
3842 \let\HEADINGShook=\relax
3844 % Commands to set those variables.
3845 % For example, this is what @headings on does
3846 % @evenheading @thistitle|@thispage|@thischapter
3847 % @oddheading @thischapter|@thispage|@thistitle
3848 % @evenfooting @thisfile||
3849 % @oddfooting ||@thisfile
3852 \def\evenheading{\parsearg\evenheadingxxx}
3853 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3854 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3855 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3857 \def\oddheading{\parsearg\oddheadingxxx}
3858 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3859 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3860 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3862 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3864 \def\evenfooting{\parsearg\evenfootingxxx}
3865 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3866 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3867 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3869 \def\oddfooting{\parsearg\oddfootingxxx}
3870 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3871 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3872 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3874 % Leave some space for the footline. Hopefully ok to assume
3875 % @evenfooting will not be used by itself.
3876 \global\advance\txipageheight by -12pt
3877 \global\advance\vsize by -12pt
3880 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3882 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3883 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3885 % The same set of arguments for:
3887 % @oddheadingmarks
3888 % @evenfootingmarks
3889 % @oddfootingmarks
3890 % @everyheadingmarks
3891 % @everyfootingmarks
3893 % These define \getoddheadingmarks, \getevenheadingmarks,
3894 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3895 % \gettopheadingmarks, \getbottomheadingmarks.
3897 \def\evenheadingmarks{\headingmarks{even}{heading}}
3898 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3899 \def\evenfootingmarks{\headingmarks{even}{footing}}
3900 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3901 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3902 \headingmarks{odd}{heading}{#1} }
3903 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3904 \headingmarks{odd}{footing}{#1} }
3905 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3906 \def\headingmarks#1#2#3 {%
3907 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3908 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3911 \everyheadingmarks bottom
3912 \everyfootingmarks bottom
3914 % @headings double turns headings on for double-sided printing.
3915 % @headings single turns headings on for single-sided printing.
3916 % @headings off turns them off.
3917 % @headings on same as @headings double, retained for compatibility.
3918 % @headings after turns on double-sided headings after this page.
3919 % @headings doubleafter turns on double-sided headings after this page.
3920 % @headings singleafter turns on single-sided headings after this page.
3921 % By default, they are off at the start of a document,
3922 % and turned `on' after @end titlepage.
3924 \parseargdef\headings{\csname HEADINGS#1\endcsname}
3926 \def\headingsoff{% non-global headings elimination
3927 \evenheadline={\hfil}\evenfootline={\hfil}%
3928 \oddheadline={\hfil}\oddfootline={\hfil}%
3931 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3932 \HEADINGSoff % it's the default
3934 % When we turn headings on, set the page number to 1.
3935 % For double-sided printing, put current file name in lower left corner,
3936 % chapter name on inside top of right hand pages, document
3937 % title on inside top of left hand pages, and page numbers on outside top
3938 % edge of all pages.
3939 \def\HEADINGSdouble{%
3940 \global\pageno=1
3941 \global\evenfootline={\hfil}
3942 \global\oddfootline={\hfil}
3943 \global\evenheadline={\line{\folio\hfil\thistitle}}
3944 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3945 \global\let\contentsalignmacro = \chapoddpage
3947 \let\contentsalignmacro = \chappager
3949 % For single-sided printing, chapter title goes across top left of page,
3950 % page number on top right.
3951 \def\HEADINGSsingle{%
3952 \global\pageno=1
3953 \global\evenfootline={\hfil}
3954 \global\oddfootline={\hfil}
3955 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3956 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3957 \global\let\contentsalignmacro = \chappager
3959 \def\HEADINGSon{\HEADINGSdouble}
3961 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3962 \let\HEADINGSdoubleafter=\HEADINGSafter
3963 \def\HEADINGSdoublex{%
3964 \global\evenfootline={\hfil}
3965 \global\oddfootline={\hfil}
3966 \global\evenheadline={\line{\folio\hfil\thistitle}}
3967 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3968 \global\let\contentsalignmacro = \chapoddpage
3971 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3972 \def\HEADINGSsinglex{%
3973 \global\evenfootline={\hfil}
3974 \global\oddfootline={\hfil}
3975 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3976 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3977 \global\let\contentsalignmacro = \chappager
3980 % Subroutines used in generating headings
3981 % This produces Day Month Year style of output.
3982 % Only define if not already defined, in case a txi-??.tex file has set
3983 % up a different format (e.g., txi-cs.tex does this).
3984 \ifx\today\thisisundefined
3985 \def\today{%
3986 \number\day\space
3987 \ifcase\month
3988 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3989 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3990 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3992 \space\number\year}
3995 % @settitle line... specifies the title of the document, for headings.
3996 % It generates no output of its own.
3997 \def\thistitle{\putwordNoTitle}
3998 \def\settitle{\parsearg{\gdef\thistitle}}
4001 \message{tables,}
4002 % Tables -- @table, @ftable, @vtable, @item(x).
4004 % default indentation of table text
4005 \newdimen\tableindent \tableindent=.8in
4006 % default indentation of @itemize and @enumerate text
4007 \newdimen\itemindent \itemindent=.3in
4008 % margin between end of table item and start of table text.
4009 \newdimen\itemmargin \itemmargin=.1in
4011 % used internally for \itemindent minus \itemmargin
4012 \newdimen\itemmax
4014 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
4015 % these defs.
4016 % They also define \itemindex
4017 % to index the item name in whatever manner is desired (perhaps none).
4019 \newif\ifitemxneedsnegativevskip
4021 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4023 \def\internalBitem{\smallbreak \parsearg\itemzzz}
4024 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
4026 \def\itemzzz #1{\begingroup %
4027 \advance\hsize by -\rightskip
4028 \advance\hsize by -\tableindent
4029 \setbox0=\hbox{\itemindicate{#1}}%
4030 \itemindex{#1}%
4031 \nobreak % This prevents a break before @itemx.
4033 % If the item text does not fit in the space we have, put it on a line
4034 % by itself, and do not allow a page break either before or after that
4035 % line. We do not start a paragraph here because then if the next
4036 % command is, e.g., @kindex, the whatsit would get put into the
4037 % horizontal list on a line by itself, resulting in extra blank space.
4038 \ifdim \wd0>\itemmax
4040 % Make this a paragraph so we get the \parskip glue and wrapping,
4041 % but leave it ragged-right.
4042 \begingroup
4043 \advance\leftskip by-\tableindent
4044 \advance\hsize by\tableindent
4045 \advance\rightskip by0pt plus1fil\relax
4046 \leavevmode\unhbox0\par
4047 \endgroup
4049 % We're going to be starting a paragraph, but we don't want the
4050 % \parskip glue -- logically it's part of the @item we just started.
4051 \nobreak \vskip-\parskip
4053 % Stop a page break at the \parskip glue coming up. However, if
4054 % what follows is an environment such as @example, there will be no
4055 % \parskip glue; then the negative vskip we just inserted would
4056 % cause the example and the item to crash together. So we use this
4057 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4058 % \parskip glue after all. Section titles are handled this way also.
4060 \penalty 10001
4061 \endgroup
4062 \itemxneedsnegativevskipfalse
4063 \else
4064 % The item text fits into the space. Start a paragraph, so that the
4065 % following text (if any) will end up on the same line.
4066 \noindent
4067 % Do this with kerns and \unhbox so that if there is a footnote in
4068 % the item text, it can migrate to the main vertical list and
4069 % eventually be printed.
4070 \nobreak\kern-\tableindent
4071 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4072 \unhbox0
4073 \nobreak\kern\dimen0
4074 \endgroup
4075 \itemxneedsnegativevskiptrue
4079 \def\item{\errmessage{@item while not in a list environment}}
4080 \def\itemx{\errmessage{@itemx while not in a list environment}}
4082 % @table, @ftable, @vtable.
4083 \envdef\table{%
4084 \let\itemindex\gobble
4085 \tablecheck{table}%
4087 \envdef\ftable{%
4088 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4089 \tablecheck{ftable}%
4091 \envdef\vtable{%
4092 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4093 \tablecheck{vtable}%
4095 \def\tablecheck#1{%
4096 \ifnum \the\catcode`\^^M=\active
4097 \endgroup
4098 \errmessage{This command won't work in this context; perhaps the problem is
4099 that we are \inenvironment\thisenv}%
4100 \def\next{\doignore{#1}}%
4101 \else
4102 \let\next\tablex
4104 \next
4106 \def\tablex#1{%
4107 \def\itemindicate{#1}%
4108 \parsearg\tabley
4110 \def\tabley#1{%
4112 \makevalueexpandable
4113 \edef\temp{\noexpand\tablez #1\space\space\space}%
4114 \expandafter
4115 }\temp \endtablez
4117 \def\tablez #1 #2 #3 #4\endtablez{%
4118 \aboveenvbreak
4119 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4120 \ifnum 0#2>0 \tableindent=#2\mil \fi
4121 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4122 \itemmax=\tableindent
4123 \advance \itemmax by -\itemmargin
4124 \advance \leftskip by \tableindent
4125 \exdentamount=\tableindent
4126 \parindent = 0pt
4127 \parskip = \smallskipamount
4128 \ifdim \parskip=0pt \parskip=2pt \fi
4129 \let\item = \internalBitem
4130 \let\itemx = \internalBitemx
4132 \def\Etable{\endgraf\afterenvbreak}
4133 \let\Eftable\Etable
4134 \let\Evtable\Etable
4135 \let\Eitemize\Etable
4136 \let\Eenumerate\Etable
4138 % This is the counter used by @enumerate, which is really @itemize
4140 \newcount \itemno
4142 \envdef\itemize{\parsearg\doitemize}
4144 \def\doitemize#1{%
4145 \aboveenvbreak
4146 \itemmax=\itemindent
4147 \advance\itemmax by -\itemmargin
4148 \advance\leftskip by \itemindent
4149 \exdentamount=\itemindent
4150 \parindent=0pt
4151 \parskip=\smallskipamount
4152 \ifdim\parskip=0pt \parskip=2pt \fi
4154 % Try typesetting the item mark so that if the document erroneously says
4155 % something like @itemize @samp (intending @table), there's an error
4156 % right away at the @itemize. It's not the best error message in the
4157 % world, but it's better than leaving it to the @item. This means if
4158 % the user wants an empty mark, they have to say @w{} not just @w.
4159 \def\itemcontents{#1}%
4160 \setbox0 = \hbox{\itemcontents}%
4162 % @itemize with no arg is equivalent to @itemize @bullet.
4163 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4165 \let\item=\itemizeitem
4168 % Definition of @item while inside @itemize and @enumerate.
4170 \def\itemizeitem{%
4171 \advance\itemno by 1 % for enumerations
4172 {\let\par=\endgraf \smallbreak}% reasonable place to break
4174 % If the document has an @itemize directly after a section title, a
4175 % \nobreak will be last on the list, and \sectionheading will have
4176 % done a \vskip-\parskip. In that case, we don't want to zero
4177 % parskip, or the item text will crash with the heading. On the
4178 % other hand, when there is normal text preceding the item (as there
4179 % usually is), we do want to zero parskip, or there would be too much
4180 % space. In that case, we won't have a \nobreak before. At least
4181 % that's the theory.
4182 \ifnum\lastpenalty<10000 \parskip=0in \fi
4183 \noindent
4184 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4186 \ifinner\else
4187 \vadjust{\penalty 1200}% not good to break after first line of item.
4189 % We can be in inner vertical mode in a footnote, although an
4190 % @itemize looks awful there.
4192 \flushcr
4195 % \splitoff TOKENS\endmark defines \first to be the first token in
4196 % TOKENS, and \rest to be the remainder.
4198 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4200 % Allow an optional argument of an uppercase letter, lowercase letter,
4201 % or number, to specify the first label in the enumerated list. No
4202 % argument is the same as `1'.
4204 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4205 \def\enumeratey #1 #2\endenumeratey{%
4206 % If we were given no argument, pretend we were given `1'.
4207 \def\thearg{#1}%
4208 \ifx\thearg\empty \def\thearg{1}\fi
4210 % Detect if the argument is a single token. If so, it might be a
4211 % letter. Otherwise, the only valid thing it can be is a number.
4212 % (We will always have one token, because of the test we just made.
4213 % This is a good thing, since \splitoff doesn't work given nothing at
4214 % all -- the first parameter is undelimited.)
4215 \expandafter\splitoff\thearg\endmark
4216 \ifx\rest\empty
4217 % Only one token in the argument. It could still be anything.
4218 % A ``lowercase letter'' is one whose \lccode is nonzero.
4219 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4220 % not equal to itself.
4221 % Otherwise, we assume it's a number.
4223 % We need the \relax at the end of the \ifnum lines to stop TeX from
4224 % continuing to look for a <number>.
4226 \ifnum\lccode\expandafter`\thearg=0\relax
4227 \numericenumerate % a number (we hope)
4228 \else
4229 % It's a letter.
4230 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4231 \lowercaseenumerate % lowercase letter
4232 \else
4233 \uppercaseenumerate % uppercase letter
4236 \else
4237 % Multiple tokens in the argument. We hope it's a number.
4238 \numericenumerate
4242 % An @enumerate whose labels are integers. The starting integer is
4243 % given in \thearg.
4245 \def\numericenumerate{%
4246 \itemno = \thearg
4247 \startenumeration{\the\itemno}%
4250 % The starting (lowercase) letter is in \thearg.
4251 \def\lowercaseenumerate{%
4252 \itemno = \expandafter`\thearg
4253 \startenumeration{%
4254 % Be sure we're not beyond the end of the alphabet.
4255 \ifnum\itemno=0
4256 \errmessage{No more lowercase letters in @enumerate; get a bigger
4257 alphabet}%
4259 \char\lccode\itemno
4263 % The starting (uppercase) letter is in \thearg.
4264 \def\uppercaseenumerate{%
4265 \itemno = \expandafter`\thearg
4266 \startenumeration{%
4267 % Be sure we're not beyond the end of the alphabet.
4268 \ifnum\itemno=0
4269 \errmessage{No more uppercase letters in @enumerate; get a bigger
4270 alphabet}
4272 \char\uccode\itemno
4276 % Call \doitemize, adding a period to the first argument and supplying the
4277 % common last two arguments. Also subtract one from the initial value in
4278 % \itemno, since @item increments \itemno.
4280 \def\startenumeration#1{%
4281 \advance\itemno by -1
4282 \doitemize{#1.}\flushcr
4285 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
4286 % to @enumerate.
4288 \def\alphaenumerate{\enumerate{a}}
4289 \def\capsenumerate{\enumerate{A}}
4290 \def\Ealphaenumerate{\Eenumerate}
4291 \def\Ecapsenumerate{\Eenumerate}
4294 % @multitable macros
4295 % Amy Hendrickson, 8/18/94, 3/6/96
4297 % @multitable ... @end multitable will make as many columns as desired.
4298 % Contents of each column will wrap at width given in preamble. Width
4299 % can be specified either with sample text given in a template line,
4300 % or in percent of \hsize, the current width of text on page.
4302 % Table can continue over pages but will only break between lines.
4304 % To make preamble:
4306 % Either define widths of columns in terms of percent of \hsize:
4307 % @multitable @columnfractions .25 .3 .45
4308 % @item ...
4310 % Numbers following @columnfractions are the percent of the total
4311 % current hsize to be used for each column. You may use as many
4312 % columns as desired.
4315 % Or use a template:
4316 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4317 % @item ...
4318 % using the widest term desired in each column.
4320 % Each new table line starts with @item, each subsequent new column
4321 % starts with @tab. Empty columns may be produced by supplying @tab's
4322 % with nothing between them for as many times as empty columns are needed,
4323 % ie, @tab@tab@tab will produce two empty columns.
4325 % @item, @tab do not need to be on their own lines, but it will not hurt
4326 % if they are.
4328 % Sample multitable:
4330 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4331 % @item first col stuff @tab second col stuff @tab third col
4332 % @item
4333 % first col stuff
4334 % @tab
4335 % second col stuff
4336 % @tab
4337 % third col
4338 % @item first col stuff @tab second col stuff
4339 % @tab Many paragraphs of text may be used in any column.
4341 % They will wrap at the width determined by the template.
4342 % @item@tab@tab This will be in third column.
4343 % @end multitable
4345 % Default dimensions may be reset by user.
4346 % @multitableparskip is vertical space between paragraphs in table.
4347 % @multitableparindent is paragraph indent in table.
4348 % @multitablecolmargin is horizontal space to be left between columns.
4349 % @multitablelinespace is space to leave between table items, baseline
4350 % to baseline.
4351 % 0pt means it depends on current normal line spacing.
4353 \newskip\multitableparskip
4354 \newskip\multitableparindent
4355 \newdimen\multitablecolspace
4356 \newskip\multitablelinespace
4357 \multitableparskip=0pt
4358 \multitableparindent=6pt
4359 \multitablecolspace=12pt
4360 \multitablelinespace=0pt
4362 % Macros used to set up halign preamble:
4364 \let\endsetuptable\relax
4365 \def\xendsetuptable{\endsetuptable}
4366 \let\columnfractions\relax
4367 \def\xcolumnfractions{\columnfractions}
4368 \newif\ifsetpercent
4370 % #1 is the @columnfraction, usually a decimal number like .5, but might
4371 % be just 1. We just use it, whatever it is.
4373 \def\pickupwholefraction#1 {%
4374 \global\advance\colcount by 1
4375 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4376 \setuptable
4379 \newcount\colcount
4380 \def\setuptable#1{%
4381 \def\firstarg{#1}%
4382 \ifx\firstarg\xendsetuptable
4383 \let\go = \relax
4384 \else
4385 \ifx\firstarg\xcolumnfractions
4386 \global\setpercenttrue
4387 \else
4388 \ifsetpercent
4389 \let\go\pickupwholefraction
4390 \else
4391 \global\advance\colcount by 1
4392 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4393 % separator; typically that is always in the input, anyway.
4394 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4397 \ifx\go\pickupwholefraction
4398 % Put the argument back for the \pickupwholefraction call, so
4399 % we'll always have a period there to be parsed.
4400 \def\go{\pickupwholefraction#1}%
4401 \else
4402 \let\go = \setuptable
4403 \fi%
4408 % multitable-only commands.
4410 % @headitem starts a heading row, which we typeset in bold. Assignments
4411 % have to be global since we are inside the implicit group of an
4412 % alignment entry. \everycr below resets \everytab so we don't have to
4413 % undo it ourselves.
4414 \def\headitemfont{\b}% for people to use in the template row; not changeable
4415 \def\headitem{%
4416 \checkenv\multitable
4417 \crcr
4418 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4419 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4420 \the\everytab % for the first item
4423 % default for tables with no headings.
4424 \let\headitemcrhook=\relax
4426 % A \tab used to include \hskip1sp. But then the space in a template
4427 % line is not enough. That is bad. So let's go back to just `&' until
4428 % we again encounter the problem the 1sp was intended to solve.
4429 % --karl, nathan@acm.org, 20apr99.
4430 \def\tab{\checkenv\multitable &\the\everytab}%
4432 % @multitable ... @end multitable definitions:
4434 \newtoks\everytab % insert after every tab.
4436 \envdef\multitable{%
4437 \vskip\parskip
4438 \startsavinginserts
4440 % @item within a multitable starts a normal row.
4441 % We use \def instead of \let so that if one of the multitable entries
4442 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4443 % \endtemplate) expanding \doitemize.
4444 \def\item{\crcr}%
4446 \tolerance=9500
4447 \hbadness=9500
4448 \setmultitablespacing
4449 \parskip=\multitableparskip
4450 \parindent=\multitableparindent
4451 \overfullrule=0pt
4452 \global\colcount=0
4454 \everycr = {%
4455 \noalign{%
4456 \global\everytab={}% Reset from possible headitem.
4457 \global\colcount=0 % Reset the column counter.
4459 % Check for saved footnotes, etc.:
4460 \checkinserts
4462 % Perhaps a \nobreak, then reset:
4463 \headitemcrhook
4464 \global\let\headitemcrhook=\relax
4468 \parsearg\domultitable
4470 \def\domultitable#1{%
4471 % To parse everything between @multitable and @item:
4472 \setuptable#1 \endsetuptable
4474 % This preamble sets up a generic column definition, which will
4475 % be used as many times as user calls for columns.
4476 % \vtop will set a single line and will also let text wrap and
4477 % continue for many paragraphs if desired.
4478 \halign\bgroup &%
4479 \global\advance\colcount by 1
4480 \multistrut
4481 \vtop{%
4482 % Use the current \colcount to find the correct column width:
4483 \hsize=\expandafter\csname col\the\colcount\endcsname
4485 % In order to keep entries from bumping into each other
4486 % we will add a \leftskip of \multitablecolspace to all columns after
4487 % the first one.
4489 % If a template has been used, we will add \multitablecolspace
4490 % to the width of each template entry.
4492 % If the user has set preamble in terms of percent of \hsize we will
4493 % use that dimension as the width of the column, and the \leftskip
4494 % will keep entries from bumping into each other. Table will start at
4495 % left margin and final column will justify at right margin.
4497 % Make sure we don't inherit \rightskip from the outer environment.
4498 \rightskip=0pt
4499 \ifnum\colcount=1
4500 % The first column will be indented with the surrounding text.
4501 \advance\hsize by\leftskip
4502 \else
4503 \ifsetpercent \else
4504 % If user has not set preamble in terms of percent of \hsize
4505 % we will advance \hsize by \multitablecolspace.
4506 \advance\hsize by \multitablecolspace
4508 % In either case we will make \leftskip=\multitablecolspace:
4509 \leftskip=\multitablecolspace
4511 % Ignoring space at the beginning and end avoids an occasional spurious
4512 % blank line, when TeX decides to break the line at the space before the
4513 % box from the multistrut, so the strut ends up on a line by itself.
4514 % For example:
4515 % @multitable @columnfractions .11 .89
4516 % @item @code{#}
4517 % @tab Legal holiday which is valid in major parts of the whole country.
4518 % Is automatically provided with highlighting sequences respectively
4519 % marking characters.
4520 \noindent\ignorespaces##\unskip\multistrut
4521 }\cr
4523 \def\Emultitable{%
4524 \crcr
4525 \egroup % end the \halign
4526 \global\setpercentfalse
4529 \def\setmultitablespacing{%
4530 \def\multistrut{\strut}% just use the standard line spacing
4532 % Compute \multitablelinespace (if not defined by user) for use in
4533 % \multitableparskip calculation. We used define \multistrut based on
4534 % this, but (ironically) that caused the spacing to be off.
4535 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4536 \ifdim\multitablelinespace=0pt
4537 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4538 \global\advance\multitablelinespace by-\ht0
4540 % Test to see if parskip is larger than space between lines of
4541 % table. If not, do nothing.
4542 % If so, set to same dimension as multitablelinespace.
4543 \ifdim\multitableparskip>\multitablelinespace
4544 \global\multitableparskip=\multitablelinespace
4545 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4546 % than skip between lines in the table.
4547 \fi%
4548 \ifdim\multitableparskip=0pt
4549 \global\multitableparskip=\multitablelinespace
4550 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4551 % than skip between lines in the table.
4552 \fi}
4555 \message{conditionals,}
4557 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4558 % @ifnotxml always succeed. They currently do nothing; we don't
4559 % attempt to check whether the conditionals are properly nested. But we
4560 % have to remember that they are conditionals, so that @end doesn't
4561 % attempt to close an environment group.
4563 \def\makecond#1{%
4564 \expandafter\let\csname #1\endcsname = \relax
4565 \expandafter\let\csname iscond.#1\endcsname = 1
4567 \makecond{iftex}
4568 \makecond{ifnotdocbook}
4569 \makecond{ifnothtml}
4570 \makecond{ifnotinfo}
4571 \makecond{ifnotplaintext}
4572 \makecond{ifnotxml}
4574 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4576 \def\direntry{\doignore{direntry}}
4577 \def\documentdescription{\doignore{documentdescription}}
4578 \def\docbook{\doignore{docbook}}
4579 \def\html{\doignore{html}}
4580 \def\ifdocbook{\doignore{ifdocbook}}
4581 \def\ifhtml{\doignore{ifhtml}}
4582 \def\ifinfo{\doignore{ifinfo}}
4583 \def\ifnottex{\doignore{ifnottex}}
4584 \def\ifplaintext{\doignore{ifplaintext}}
4585 \def\ifxml{\doignore{ifxml}}
4586 \def\ignore{\doignore{ignore}}
4587 \def\menu{\doignore{menu}}
4588 \def\xml{\doignore{xml}}
4590 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4592 % A count to remember the depth of nesting.
4593 \newcount\doignorecount
4595 \def\doignore#1{\begingroup
4596 % Scan in ``verbatim'' mode:
4597 \obeylines
4598 \catcode`\@ = \other
4599 \catcode`\{ = \other
4600 \catcode`\} = \other
4602 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4603 \spaceisspace
4605 % Count number of #1's that we've seen.
4606 \doignorecount = 0
4608 % Swallow text until we reach the matching `@end #1'.
4609 \dodoignore{#1}%
4612 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4613 \obeylines %
4615 \gdef\dodoignore#1{%
4616 % #1 contains the command name as a string, e.g., `ifinfo'.
4618 % Define a command to find the next `@end #1'.
4619 \long\def\doignoretext##1^^M@end #1{%
4620 \doignoretextyyy##1^^M@#1\_STOP_}%
4622 % And this command to find another #1 command, at the beginning of a
4623 % line. (Otherwise, we would consider a line `@c @ifset', for
4624 % example, to count as an @ifset for nesting.)
4625 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4627 % And now expand that command.
4628 \doignoretext ^^M%
4632 \def\doignoreyyy#1{%
4633 \def\temp{#1}%
4634 \ifx\temp\empty % Nothing found.
4635 \let\next\doignoretextzzz
4636 \else % Found a nested condition, ...
4637 \advance\doignorecount by 1
4638 \let\next\doignoretextyyy % ..., look for another.
4639 % If we're here, #1 ends with ^^M\ifinfo (for example).
4641 \next #1% the token \_STOP_ is present just after this macro.
4644 % We have to swallow the remaining "\_STOP_".
4646 \def\doignoretextzzz#1{%
4647 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4648 \let\next\enddoignore
4649 \else % Still inside a nested condition.
4650 \advance\doignorecount by -1
4651 \let\next\doignoretext % Look for the next @end.
4653 \next
4656 % Finish off ignored text.
4657 { \obeylines%
4658 % Ignore anything after the last `@end #1'; this matters in verbatim
4659 % environments, where otherwise the newline after an ignored conditional
4660 % would result in a blank line in the output.
4661 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4665 % @set VAR sets the variable VAR to an empty value.
4666 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4668 % Since we want to separate VAR from REST-OF-LINE (which might be
4669 % empty), we can't just use \parsearg; we have to insert a space of our
4670 % own to delimit the rest of the line, and then take it out again if we
4671 % didn't need it.
4672 % We rely on the fact that \parsearg sets \catcode`\ =10.
4674 \parseargdef\set{\setyyy#1 \endsetyyy}
4675 \def\setyyy#1 #2\endsetyyy{%
4677 \makevalueexpandable
4678 \def\temp{#2}%
4679 \edef\next{\gdef\makecsname{SET#1}}%
4680 \ifx\temp\empty
4681 \next{}%
4682 \else
4683 \setzzz#2\endsetzzz
4687 % Remove the trailing space \setxxx inserted.
4688 \def\setzzz#1 \endsetzzz{\next{#1}}
4690 % @clear VAR clears (i.e., unsets) the variable VAR.
4692 \parseargdef\clear{%
4694 \makevalueexpandable
4695 \global\expandafter\let\csname SET#1\endcsname=\relax
4699 % @value{foo} gets the text saved in variable foo.
4700 \def\value{\begingroup\makevalueexpandable\valuexxx}
4701 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4703 \catcode`\-=\active \catcode`\_=\active
4705 \gdef\makevalueexpandable{%
4706 \let\value = \expandablevalue
4707 % We don't want these characters active, ...
4708 \catcode`\-=\other \catcode`\_=\other
4709 % ..., but we might end up with active ones in the argument if
4710 % we're called from @code, as @code{@value{foo-bar_}}, though.
4711 % So \let them to their normal equivalents.
4712 \let-\normaldash \let_\normalunderscore
4716 % We have this subroutine so that we can handle at least some @value's
4717 % properly in indexes (we call \makevalueexpandable in \indexdummies).
4718 % The command has to be fully expandable (if the variable is set), since
4719 % the result winds up in the index file. This means that if the
4720 % variable's value contains other Texinfo commands, it's almost certain
4721 % it will fail (although perhaps we could fix that with sufficient work
4722 % to do a one-level expansion on the result, instead of complete).
4724 % Unfortunately, this has the consequence that when _ is in the *value*
4725 % of an @set, it does not print properly in the roman fonts (get the cmr
4726 % dot accent at position 126 instead). No fix comes to mind, and it's
4727 % been this way since 2003 or earlier, so just ignore it.
4729 \def\expandablevalue#1{%
4730 \expandafter\ifx\csname SET#1\endcsname\relax
4731 {[No value for ``#1'']}%
4732 \message{Variable `#1', used in @value, is not set.}%
4733 \else
4734 \csname SET#1\endcsname
4738 % Like \expandablevalue, but completely expandable (the \message in the
4739 % definition above operates at the execution level of TeX). Used when
4740 % writing to auxiliary files, due to the expansion that \write does.
4741 % If flag is undefined, pass through an unexpanded @value command: maybe it
4742 % will be set by the time it is read back in.
4744 % NB flag names containing - or _ may not work here.
4745 \def\dummyvalue#1{%
4746 \expandafter\ifx\csname SET#1\endcsname\relax
4747 \noexpand\value{#1}%
4748 \else
4749 \csname SET#1\endcsname
4753 % Used for @value's in index entries to form the sort key: expand the @value
4754 % if possible, otherwise sort late.
4755 \def\indexnofontsvalue#1{%
4756 \expandafter\ifx\csname SET#1\endcsname\relax
4757 ZZZZZZZ
4758 \else
4759 \csname SET#1\endcsname
4763 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4764 % with @set.
4766 % To get the special treatment we need for `@end ifset,' we call
4767 % \makecond and then redefine.
4769 \makecond{ifset}
4770 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4771 \def\doifset#1#2{%
4773 \makevalueexpandable
4774 \let\next=\empty
4775 \expandafter\ifx\csname SET#2\endcsname\relax
4776 #1% If not set, redefine \next.
4778 \expandafter
4779 }\next
4781 \def\ifsetfail{\doignore{ifset}}
4783 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4784 % defined with @set, or has been undefined with @clear.
4786 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4787 % above code: if the variable is not set, do nothing, if it is set,
4788 % then redefine \next to \ifclearfail.
4790 \makecond{ifclear}
4791 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4792 \def\ifclearfail{\doignore{ifclear}}
4794 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4795 % without the @) is in fact defined. We can only feasibly check at the
4796 % TeX level, so something like `mathcode' is going to considered
4797 % defined even though it is not a Texinfo command.
4799 \makecond{ifcommanddefined}
4800 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4802 \def\doifcmddefined#1#2{{%
4803 \makevalueexpandable
4804 \let\next=\empty
4805 \expandafter\ifx\csname #2\endcsname\relax
4806 #1% If not defined, \let\next as above.
4808 \expandafter
4809 }\next
4811 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4813 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4814 \makecond{ifcommandnotdefined}
4815 \def\ifcommandnotdefined{%
4816 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4817 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4819 % Set the `txicommandconditionals' variable, so documents have a way to
4820 % test if the @ifcommand...defined conditionals are available.
4821 \set txicommandconditionals
4823 % @dircategory CATEGORY -- specify a category of the dir file
4824 % which this file should belong to. Ignore this in TeX.
4825 \let\dircategory=\comment
4827 % @defininfoenclose.
4828 \let\definfoenclose=\comment
4831 \message{indexing,}
4832 % Index generation facilities
4834 % Define \newwrite to be identical to plain tex's \newwrite
4835 % except not \outer, so it can be used within macros and \if's.
4836 \edef\newwrite{\makecsname{ptexnewwrite}}
4838 % \newindex {foo} defines an index named IX.
4839 % It automatically defines \IXindex such that
4840 % \IXindex ...rest of line... puts an entry in the index IX.
4841 % It also defines \IXindfile to be the number of the output channel for
4842 % the file that accumulates this index. The file's extension is IX.
4843 % The name of an index should be no more than 2 characters long
4844 % for the sake of vms.
4846 \def\newindex#1{%
4847 \expandafter\chardef\csname#1indfile\endcsname=0
4848 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4849 \noexpand\doindex{#1}}
4852 % @defindex foo == \newindex{foo}
4854 \def\defindex{\parsearg\newindex}
4856 % Define @defcodeindex, like @defindex except put all entries in @code.
4858 \def\defcodeindex{\parsearg\newcodeindex}
4860 \def\newcodeindex#1{%
4861 \expandafter\chardef\csname#1indfile\endcsname=0
4862 \expandafter\xdef\csname#1index\endcsname{%
4863 \noexpand\docodeindex{#1}}%
4866 % The default indices:
4867 \newindex{cp}% concepts,
4868 \newcodeindex{fn}% functions,
4869 \newcodeindex{vr}% variables,
4870 \newcodeindex{tp}% types,
4871 \newcodeindex{ky}% keys
4872 \newcodeindex{pg}% and programs.
4875 % @synindex foo bar makes index foo feed into index bar.
4876 % Do this instead of @defindex foo if you don't want it as a separate index.
4878 % @syncodeindex foo bar similar, but put all entries made for index foo
4879 % inside @code.
4881 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4882 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4884 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4885 % #3 the target index (bar).
4886 \def\dosynindex#1#2#3{%
4887 \requireopenindexfile{#3}%
4888 % redefine \fooindfile:
4889 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4890 \expandafter\let\csname#2indfile\endcsname=\temp
4891 % redefine \fooindex:
4892 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4895 % Define \doindex, the driver for all index macros.
4896 % Argument #1 is generated by the calling \fooindex macro,
4897 % and it is the two-letter name of the index.
4899 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4900 \def\doindexxxx #1{\doind{\indexname}{#1}}
4902 % like the previous two, but they put @code around the argument.
4903 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4904 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
4907 % Used when writing an index entry out to an index file to prevent
4908 % expansion of Texinfo commands that can appear in an index entry.
4910 \def\indexdummies{%
4911 \escapechar = `\\ % use backslash in output files.
4912 \definedummyletter\@%
4913 \definedummyletter\ %
4915 % For texindex which always views { and } as separators.
4916 \def\{{\lbracechar{}}%
4917 \def\}{\rbracechar{}}%
4919 % Do the redefinitions.
4920 \definedummies
4923 % Used for the aux and toc files, where @ is the escape character.
4925 \def\atdummies{%
4926 \definedummyletter\@%
4927 \definedummyletter\ %
4928 \definedummyletter\{%
4929 \definedummyletter\}%
4931 % Do the redefinitions.
4932 \definedummies
4933 \otherbackslash
4936 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4937 % preventing its expansion. This is used only for control words,
4938 % not control letters, because the \space would be incorrect for
4939 % control characters, but is needed to separate the control word
4940 % from whatever follows.
4942 % These can be used both for control words that take an argument and
4943 % those that do not. If it is followed by {arg} in the input, then
4944 % that will dutifully get written to the index (or wherever).
4946 % For control letters, we have \definedummyletter, which omits the
4947 % space.
4949 \def\definedummyword #1{\def#1{\string#1\space}}%
4950 \def\definedummyletter#1{\def#1{\string#1}}%
4951 \let\definedummyaccent\definedummyletter
4953 % Called from \indexdummies and \atdummies, to effectively prevent
4954 % the expansion of commands.
4956 \def\definedummies{%
4958 \let\commondummyword\definedummyword
4959 \let\commondummyletter\definedummyletter
4960 \let\commondummyaccent\definedummyaccent
4961 \commondummiesnofonts
4963 \definedummyletter\_%
4964 \definedummyletter\-%
4966 % Non-English letters.
4967 \definedummyword\AA
4968 \definedummyword\AE
4969 \definedummyword\DH
4970 \definedummyword\L
4971 \definedummyword\O
4972 \definedummyword\OE
4973 \definedummyword\TH
4974 \definedummyword\aa
4975 \definedummyword\ae
4976 \definedummyword\dh
4977 \definedummyword\exclamdown
4978 \definedummyword\l
4979 \definedummyword\o
4980 \definedummyword\oe
4981 \definedummyword\ordf
4982 \definedummyword\ordm
4983 \definedummyword\questiondown
4984 \definedummyword\ss
4985 \definedummyword\th
4987 % Although these internal commands shouldn't show up, sometimes they do.
4988 \definedummyword\bf
4989 \definedummyword\gtr
4990 \definedummyword\hat
4991 \definedummyword\less
4992 \definedummyword\sf
4993 \definedummyword\sl
4994 \definedummyword\tclose
4995 \definedummyword\tt
4997 \definedummyword\LaTeX
4998 \definedummyword\TeX
5000 % Assorted special characters.
5001 \definedummyword\atchar
5002 \definedummyword\arrow
5003 \definedummyword\bullet
5004 \definedummyword\comma
5005 \definedummyword\copyright
5006 \definedummyword\registeredsymbol
5007 \definedummyword\dots
5008 \definedummyword\enddots
5009 \definedummyword\entrybreak
5010 \definedummyword\equiv
5011 \definedummyword\error
5012 \definedummyword\euro
5013 \definedummyword\expansion
5014 \definedummyword\geq
5015 \definedummyword\guillemetleft
5016 \definedummyword\guillemetright
5017 \definedummyword\guilsinglleft
5018 \definedummyword\guilsinglright
5019 \definedummyword\lbracechar
5020 \definedummyword\leq
5021 \definedummyword\mathopsup
5022 \definedummyword\minus
5023 \definedummyword\ogonek
5024 \definedummyword\pounds
5025 \definedummyword\point
5026 \definedummyword\print
5027 \definedummyword\quotedblbase
5028 \definedummyword\quotedblleft
5029 \definedummyword\quotedblright
5030 \definedummyword\quoteleft
5031 \definedummyword\quoteright
5032 \definedummyword\quotesinglbase
5033 \definedummyword\rbracechar
5034 \definedummyword\result
5035 \definedummyword\sub
5036 \definedummyword\sup
5037 \definedummyword\textdegree
5039 % We want to disable all macros so that they are not expanded by \write.
5040 \macrolist
5041 \let\value\dummyvalue
5043 \normalturnoffactive
5046 % \commondummiesnofonts: common to \definedummies and \indexnofonts.
5047 % Define \commondummyletter, \commondummyaccent and \commondummyword before
5048 % using. Used for accents, font commands, and various control letters.
5050 \def\commondummiesnofonts{%
5051 % Control letters and accents.
5052 \commondummyletter\!%
5053 \commondummyaccent\"%
5054 \commondummyaccent\'%
5055 \commondummyletter\*%
5056 \commondummyaccent\,%
5057 \commondummyletter\.%
5058 \commondummyletter\/%
5059 \commondummyletter\:%
5060 \commondummyaccent\=%
5061 \commondummyletter\?%
5062 \commondummyaccent\^%
5063 \commondummyaccent\`%
5064 \commondummyaccent\~%
5065 \commondummyword\u
5066 \commondummyword\v
5067 \commondummyword\H
5068 \commondummyword\dotaccent
5069 \commondummyword\ogonek
5070 \commondummyword\ringaccent
5071 \commondummyword\tieaccent
5072 \commondummyword\ubaraccent
5073 \commondummyword\udotaccent
5074 \commondummyword\dotless
5076 % Texinfo font commands.
5077 \commondummyword\b
5078 \commondummyword\i
5079 \commondummyword\r
5080 \commondummyword\sansserif
5081 \commondummyword\sc
5082 \commondummyword\slanted
5083 \commondummyword\t
5085 % Commands that take arguments.
5086 \commondummyword\abbr
5087 \commondummyword\acronym
5088 \commondummyword\anchor
5089 \commondummyword\cite
5090 \commondummyword\code
5091 \commondummyword\command
5092 \commondummyword\dfn
5093 \commondummyword\dmn
5094 \commondummyword\email
5095 \commondummyword\emph
5096 \commondummyword\env
5097 \commondummyword\file
5098 \commondummyword\image
5099 \commondummyword\indicateurl
5100 \commondummyword\inforef
5101 \commondummyword\kbd
5102 \commondummyword\key
5103 \commondummyword\math
5104 \commondummyword\option
5105 \commondummyword\pxref
5106 \commondummyword\ref
5107 \commondummyword\samp
5108 \commondummyword\strong
5109 \commondummyword\tie
5110 \commondummyword\U
5111 \commondummyword\uref
5112 \commondummyword\url
5113 \commondummyword\var
5114 \commondummyword\verb
5115 \commondummyword\w
5116 \commondummyword\xref
5119 % For testing: output @{ and @} in index sort strings as \{ and \}.
5120 \newif\ifusebracesinindexes
5122 \let\indexlbrace\relax
5123 \let\indexrbrace\relax
5125 {\catcode`\@=0
5126 \catcode`\\=13
5127 @gdef@backslashdisappear{@def\{}}
5131 \catcode`\<=13
5132 \catcode`\-=13
5133 \catcode`\`=13
5134 \gdef\indexnonalnumdisappear{%
5135 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
5136 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5137 % (Introduced for FSFS 2nd ed.)
5138 \let`=\empty
5141 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
5142 \backslashdisappear
5145 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
5146 \def-{}%
5148 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
5149 \def<{}%
5151 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
5152 \def\@{}%
5156 \gdef\indexnonalnumreappear{%
5157 \useindexbackslash
5158 \let-\normaldash
5159 \let<\normalless
5160 \def\@{@}%
5165 % \indexnofonts is used when outputting the strings to sort the index
5166 % by, and when constructing control sequence names. It eliminates all
5167 % control sequences and just writes whatever the best ASCII sort string
5168 % would be for a given command (usually its argument).
5170 \def\indexnofonts{%
5171 % Accent commands should become @asis.
5172 \def\commondummyaccent##1{\let##1\asis}%
5173 % We can just ignore other control letters.
5174 \def\commondummyletter##1{\let##1\empty}%
5175 % All control words become @asis by default; overrides below.
5176 \let\commondummyword\commondummyaccent
5177 \commondummiesnofonts
5179 % Don't no-op \tt, since it isn't a user-level command
5180 % and is used in the definitions of the active chars like <, >, |, etc.
5181 % Likewise with the other plain tex font commands.
5182 %\let\tt=\asis
5184 \def\ { }%
5185 \def\@{@}%
5186 \def\_{\normalunderscore}%
5187 \def\-{}% @- shouldn't affect sorting
5189 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5190 \uccode`\1=`\} \uppercase{\def\}{1}}%
5191 \let\lbracechar\{%
5192 \let\rbracechar\}%
5194 % Non-English letters.
5195 \def\AA{AA}%
5196 \def\AE{AE}%
5197 \def\DH{DZZ}%
5198 \def\L{L}%
5199 \def\OE{OE}%
5200 \def\O{O}%
5201 \def\TH{TH}%
5202 \def\aa{aa}%
5203 \def\ae{ae}%
5204 \def\dh{dzz}%
5205 \def\exclamdown{!}%
5206 \def\l{l}%
5207 \def\oe{oe}%
5208 \def\ordf{a}%
5209 \def\ordm{o}%
5210 \def\o{o}%
5211 \def\questiondown{?}%
5212 \def\ss{ss}%
5213 \def\th{th}%
5215 \def\LaTeX{LaTeX}%
5216 \def\TeX{TeX}%
5218 % Assorted special characters. \defglyph gives the control sequence a
5219 % definition that removes the {} that follows its use.
5220 \defglyph\atchar{@}%
5221 \defglyph\arrow{->}%
5222 \defglyph\bullet{bullet}%
5223 \defglyph\comma{,}%
5224 \defglyph\copyright{copyright}%
5225 \defglyph\dots{...}%
5226 \defglyph\enddots{...}%
5227 \defglyph\equiv{==}%
5228 \defglyph\error{error}%
5229 \defglyph\euro{euro}%
5230 \defglyph\expansion{==>}%
5231 \defglyph\geq{>=}%
5232 \defglyph\guillemetleft{<<}%
5233 \defglyph\guillemetright{>>}%
5234 \defglyph\guilsinglleft{<}%
5235 \defglyph\guilsinglright{>}%
5236 \defglyph\leq{<=}%
5237 \defglyph\lbracechar{\{}%
5238 \defglyph\minus{-}%
5239 \defglyph\point{.}%
5240 \defglyph\pounds{pounds}%
5241 \defglyph\print{-|}%
5242 \defglyph\quotedblbase{"}%
5243 \defglyph\quotedblleft{"}%
5244 \defglyph\quotedblright{"}%
5245 \defglyph\quoteleft{`}%
5246 \defglyph\quoteright{'}%
5247 \defglyph\quotesinglbase{,}%
5248 \defglyph\rbracechar{\}}%
5249 \defglyph\registeredsymbol{R}%
5250 \defglyph\result{=>}%
5251 \defglyph\textdegree{o}%
5253 % We need to get rid of all macros, leaving only the arguments (if present).
5254 % Of course this is not nearly correct, but it is the best we can do for now.
5255 % makeinfo does not expand macros in the argument to @deffn, which ends up
5256 % writing an index entry, and texindex isn't prepared for an index sort entry
5257 % that starts with \.
5259 % Since macro invocations are followed by braces, we can just redefine them
5260 % to take a single TeX argument. The case of a macro invocation that
5261 % goes to end-of-line is not handled.
5263 \macrolist
5264 \let\value\indexnofontsvalue
5266 \def\defglyph#1#2{\def#1##1{#2}} % see above
5271 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
5273 % Most index entries go through here, but \dosubind is the general case.
5274 % #1 is the index name, #2 is the entry text.
5275 \def\doind#1#2{\dosubind{#1}{#2}{}}
5277 % There is also \dosubind {index}{topic}{subtopic}
5278 % which makes an entry in a two-level index such as the operation index.
5279 % TODO: Two-level index? Operation index?
5281 % Workhorse for all indexes.
5282 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
5283 % empty if called from \doind, as we usually are (the main exception
5284 % is with most defuns, which call us directly).
5286 \def\dosubind#1#2#3{%
5287 \iflinks
5289 \requireopenindexfile{#1}%
5290 % Store the main index entry text (including the third arg).
5291 \toks0 = {#2}%
5292 % If third arg is present, precede it with a space.
5293 \def\thirdarg{#3}%
5294 \ifx\thirdarg\empty \else
5295 \toks0 = \expandafter{\the\toks0 \space #3}%
5298 \edef\writeto{\csname#1indfile\endcsname}%
5300 \safewhatsit\dosubindwrite
5305 % Check if an index file has been opened, and if not, open it.
5306 \def\requireopenindexfile#1{%
5307 \ifnum\csname #1indfile\endcsname=0
5308 \expandafter\newwrite \csname#1indfile\endcsname
5309 \edef\suffix{#1}%
5310 % A .fls suffix would conflict with the file extension for the output
5311 % of -recorder, so use .f1s instead.
5312 \ifx\suffix\indexisfl\def\suffix{f1}\fi
5313 % Open the file
5314 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5315 % Using \immediate above here prevents an object entering into the current
5316 % box, which could confound checks such as those in \safewhatsit for
5317 % preceding skips.
5318 \typeout{Writing index file \jobname.\suffix}%
5319 \fi}
5320 \def\indexisfl{fl}
5322 % Output \ as {\indexbackslash}, because \ is an escape character in
5323 % the index files.
5324 \let\indexbackslash=\relax
5325 {\catcode`\@=0 \catcode`\\=\active
5326 @gdef@useindexbackslash{@def\{{@indexbackslash}}}
5329 % Definition for writing index entry text.
5330 \def\sortas#1{\ignorespaces}%
5332 % Definition for writing index entry sort key. Should occur at the at
5333 % the beginning of the index entry, like
5334 % @cindex @sortas{september} \september
5335 % The \ignorespaces takes care of following space, but there's no way
5336 % to remove space before it.
5338 \catcode`\-=13
5339 \gdef\indexwritesortas{%
5340 \begingroup
5341 \indexnonalnumreappear
5342 \indexwritesortasxxx}
5343 \gdef\indexwritesortasxxx#1{%
5344 \xdef\indexsortkey{#1}\endgroup}
5348 % Write the entry in \toks0 to the index file.
5350 \def\dosubindwrite{%
5351 % Put the index entry in the margin if desired.
5352 \ifx\SETmarginindex\relax\else
5353 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
5356 % Remember, we are within a group.
5357 \indexdummies % Must do this here, since \bf, etc expand at this stage
5358 \useindexbackslash % \indexbackslash isn't defined now so it will be output
5359 % as is; and it will print as backslash.
5360 % The braces around \indexbrace are recognized by texindex.
5362 % Get the string to sort by, by processing the index entry with all
5363 % font commands turned off.
5364 {\indexnofonts
5365 \def\lbracechar{{\indexlbrace}}%
5366 \def\rbracechar{{\indexrbrace}}%
5367 \let\{=\lbracechar
5368 \let\}=\rbracechar
5369 \indexnonalnumdisappear
5370 \xdef\indexsortkey{}%
5371 \let\sortas=\indexwritesortas
5372 \edef\temp{\the\toks0}%
5373 \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
5374 \ifx\indexsortkey\empty
5375 \xdef\indexsortkey{\temp}%
5376 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
5380 % Set up the complete index entry, with both the sort key and
5381 % the original text, including any font commands. We write
5382 % three arguments to \entry to the .?? file (four in the
5383 % subentry case), texindex reduces to two when writing the .??s
5384 % sorted result.
5385 \edef\temp{%
5386 \write\writeto{%
5387 \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
5389 \temp
5391 \newbox\dummybox % used above
5393 % Take care of unwanted page breaks/skips around a whatsit:
5395 % If a skip is the last thing on the list now, preserve it
5396 % by backing up by \lastskip, doing the \write, then inserting
5397 % the skip again. Otherwise, the whatsit generated by the
5398 % \write or \pdfdest will make \lastskip zero. The result is that
5399 % sequences like this:
5400 % @end defun
5401 % @tindex whatever
5402 % @defun ...
5403 % will have extra space inserted, because the \medbreak in the
5404 % start of the @defun won't see the skip inserted by the @end of
5405 % the previous defun.
5407 % But don't do any of this if we're not in vertical mode. We
5408 % don't want to do a \vskip and prematurely end a paragraph.
5410 % Avoid page breaks due to these extra skips, too.
5412 % But wait, there is a catch there:
5413 % We'll have to check whether \lastskip is zero skip. \ifdim is not
5414 % sufficient for this purpose, as it ignores stretch and shrink parts
5415 % of the skip. The only way seems to be to check the textual
5416 % representation of the skip.
5418 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5419 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5421 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5423 \newskip\whatsitskip
5424 \newcount\whatsitpenalty
5426 % ..., ready, GO:
5428 \def\safewhatsit#1{\ifhmode
5430 \else
5431 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5432 \whatsitskip = \lastskip
5433 \edef\lastskipmacro{\the\lastskip}%
5434 \whatsitpenalty = \lastpenalty
5436 % If \lastskip is nonzero, that means the last item was a
5437 % skip. And since a skip is discardable, that means this
5438 % -\whatsitskip glue we're inserting is preceded by a
5439 % non-discardable item, therefore it is not a potential
5440 % breakpoint, therefore no \nobreak needed.
5441 \ifx\lastskipmacro\zeroskipmacro
5442 \else
5443 \vskip-\whatsitskip
5448 \ifx\lastskipmacro\zeroskipmacro
5449 % If \lastskip was zero, perhaps the last item was a penalty, and
5450 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5451 % to re-insert the same penalty (values >10000 are used for various
5452 % signals); since we just inserted a non-discardable item, any
5453 % following glue (such as a \parskip) would be a breakpoint. For example:
5454 % @deffn deffn-whatever
5455 % @vindex index-whatever
5456 % Description.
5457 % would allow a break between the index-whatever whatsit
5458 % and the "Description." paragraph.
5459 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5460 \else
5461 % On the other hand, if we had a nonzero \lastskip,
5462 % this make-up glue would be preceded by a non-discardable item
5463 % (the whatsit from the \write), so we must insert a \nobreak.
5464 \nobreak\vskip\whatsitskip
5466 \fi}
5468 % The index entry written in the file actually looks like
5469 % \entry {sortstring}{page}{topic}
5470 % or
5471 % \entry {sortstring}{page}{topic}{subtopic}
5472 % The texindex program reads in these files and writes files
5473 % containing these kinds of lines:
5474 % \initial {c}
5475 % before the first topic whose initial is c
5476 % \entry {topic}{pagelist}
5477 % for a topic that is used without subtopics
5478 % \primary {topic}
5479 % for the beginning of a topic that is used with subtopics
5480 % \secondary {subtopic}{pagelist}
5481 % for each subtopic.
5483 % Define the user-accessible indexing commands
5484 % @findex, @vindex, @kindex, @cindex.
5486 \def\findex {\fnindex}
5487 \def\kindex {\kyindex}
5488 \def\cindex {\cpindex}
5489 \def\vindex {\vrindex}
5490 \def\tindex {\tpindex}
5491 \def\pindex {\pgindex}
5493 \def\cindexsub {\begingroup\obeylines\cindexsub}
5494 {\obeylines %
5495 \gdef\cindexsub "#1" #2^^M{\endgroup %
5496 \dosubind{cp}{#2}{#1}}}
5498 % Define the macros used in formatting output of the sorted index material.
5500 % @printindex causes a particular index (the ??s file) to get printed.
5501 % It does not print any chapter heading (usually an @unnumbered).
5503 \parseargdef\printindex{\begingroup
5504 \dobreak \chapheadingskip{10000}%
5506 \smallfonts \rm
5507 \tolerance = 9500
5508 \plainfrenchspacing
5509 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5511 % See if the index file exists and is nonempty.
5512 % Change catcode of @ here so that if the index file contains
5513 % \initial {@}
5514 % as its first line, TeX doesn't complain about mismatched braces
5515 % (because it thinks @} is a control sequence).
5516 \catcode`\@ = 12
5517 % See comment in \requireopenindexfile.
5518 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5519 \openin 1 \jobname.\indexname s
5520 \ifeof 1
5521 % \enddoublecolumns gets confused if there is no text in the index,
5522 % and it loses the chapter title and the aux file entries for the
5523 % index. The easiest way to prevent this problem is to make sure
5524 % there is some text.
5525 \putwordIndexNonexistent
5526 \typeout{No file \jobname.\indexname s.}%
5527 \else
5528 \catcode`\\ = 0
5530 % If the index file exists but is empty, then \openin leaves \ifeof
5531 % false. We have to make TeX try to read something from the file, so
5532 % it can discover if there is anything in it.
5533 \read 1 to \thisline
5534 \ifeof 1
5535 \putwordIndexIsEmpty
5536 \else
5537 % Index files are almost Texinfo source, but we use \ as the escape
5538 % character. It would be better to use @, but that's too big a change
5539 % to make right now.
5540 \def\indexbackslash{\ttbackslash}%
5541 \let\indexlbrace\{ % Likewise, set these sequences for braces
5542 \let\indexrbrace\} % used in the sort key.
5543 \begindoublecolumns
5544 \let\entrywidowpenalty=\indexwidowpenalty
5546 % Read input from the index file line by line.
5547 \loopdo
5548 \ifeof1
5549 \let\firsttoken\relax
5550 \else
5551 \read 1 to \nextline
5552 \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
5553 \act
5555 \thisline
5557 \ifeof1\else
5558 \let\thisline\nextline
5559 \repeat
5561 \enddoublecolumns
5564 \closein 1
5565 \endgroup}
5567 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
5568 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
5570 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
5571 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
5573 % These macros are used by the sorted index file itself.
5574 % Change them to control the appearance of the index.
5576 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5577 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5578 \catcode`\$=3
5579 \gdef\initialglyphs{%
5580 % Some changes for non-alphabetic characters. Using the glyphs from the
5581 % math fonts looks more consistent than the typewriter font used elsewhere
5582 % for these characters.
5583 \def\indexbackslash{\math{\backslash}}%
5584 \let\\=\indexbackslash
5586 % Can't get bold backslash so don't use bold forward slash
5587 \catcode`\/=13
5588 \def/{{\secrmnotbold \normalslash}}%
5589 \def-{{\normaldash\normaldash}}% en dash `--'
5590 \def^{{\chapbf \normalcaret}}%
5591 \def~{{\chapbf \normaltilde}}%
5592 \def\_{%
5593 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5594 \def|{$\vert$}%
5595 \def<{$\less$}%
5596 \def>{$\gtr$}%
5597 \def+{$\normalplus$}%
5600 \def\initial{%
5601 \bgroup
5602 \initialglyphs
5603 \initialx
5606 \def\initialx#1{%
5607 % Remove any glue we may have, we'll be inserting our own.
5608 \removelastskip
5610 % We like breaks before the index initials, so insert a bonus.
5611 % The glue before the bonus allows a little bit of space at the
5612 % bottom of a column to reduce an increase in inter-line spacing.
5613 \nobreak
5614 \vskip 0pt plus 5\baselineskip
5615 \penalty -300
5616 \vskip 0pt plus -5\baselineskip
5618 % Typeset the initial. Making this add up to a whole number of
5619 % baselineskips increases the chance of the dots lining up from column
5620 % to column. It still won't often be perfect, because of the stretch
5621 % we need before each entry, but it's better.
5623 % No shrink because it confuses \balancecolumns.
5624 \vskip 1.67\baselineskip plus 1\baselineskip
5625 \leftline{\secfonts \kern-0.05em \secbf #1}%
5626 % \secfonts is inside the argument of \leftline so that the change of
5627 % \baselineskip will not affect any glue inserted before the vbox that
5628 % \leftline creates.
5629 % Do our best not to break after the initial.
5630 \nobreak
5631 \vskip .33\baselineskip plus .1\baselineskip
5632 \egroup % \initialglyphs
5635 \newdimen\entryrightmargin
5636 \entryrightmargin=0pt
5638 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5639 % then page number (#2) flushed to the right margin. It is used for index
5640 % and table of contents entries. The paragraph is indented by \leftskip.
5642 \def\entry{%
5643 \begingroup
5645 % For pdfTeX and XeTeX.
5646 % The redefinition of \domark stops marks being added in \pdflink to
5647 % preserve coloured links across page boundaries. Otherwise the marks
5648 % would get in the way of \lastbox in \insertindexentrybox.
5649 \let\domark\relax
5651 % Start a new paragraph if necessary, so our assignments below can't
5652 % affect previous text.
5653 \par
5655 % No extra space above this paragraph.
5656 \parskip = 0in
5658 % When reading the text of entry, convert explicit line breaks
5659 % from @* into spaces. The user might give these in long section
5660 % titles, for instance.
5661 \def\*{\unskip\space\ignorespaces}%
5662 \def\entrybreak{\hfil\break}% An undocumented command
5664 % Swallow the left brace of the text (first parameter):
5665 \afterassignment\doentry
5666 \let\temp =
5668 \def\entrybreak{\unskip\space\ignorespaces}%
5669 \def\doentry{%
5670 % Save the text of the entry
5671 \global\setbox\boxA=\hbox\bgroup
5672 \bgroup % Instead of the swallowed brace.
5673 \noindent
5674 \aftergroup\finishentry
5675 % And now comes the text of the entry.
5676 % Not absorbing as a macro argument reduces the chance of problems
5677 % with catcodes occurring.
5679 {\catcode`\@=11
5680 \gdef\finishentry#1{%
5681 \egroup % end box A
5682 \dimen@ = \wd\boxA % Length of text of entry
5683 \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
5684 % #1 is the page number.
5686 % Get the width of the page numbers, and only use
5687 % leaders if they are present.
5688 \global\setbox\boxB = \hbox{#1}%
5689 \ifdim\wd\boxB = 0pt
5690 \null\nobreak\hfill\ %
5691 \else
5693 \null\nobreak\indexdotfill % Have leaders before the page number.
5695 \ifpdf
5696 \pdfgettoks#1.%
5697 \hskip\skip\thinshrinkable\the\toksA
5698 \else
5699 \ifx\XeTeXrevision\thisisundefined
5700 \hskip\skip\thinshrinkable #1%
5701 \else
5702 \pdfgettoks#1.%
5703 \hskip\skip\thinshrinkable\the\toksA
5707 \egroup % end \boxA
5708 \ifdim\wd\boxB = 0pt
5709 \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
5710 \else
5711 \global\setbox\entryindexbox=\vbox\bgroup
5712 % We want the text of the entries to be aligned to the left, and the
5713 % page numbers to be aligned to the right.
5715 \parindent = 0pt
5716 \advance\leftskip by 0pt plus 1fil
5717 \advance\leftskip by 0pt plus -1fill
5718 \rightskip = 0pt plus -1fil
5719 \advance\rightskip by 0pt plus 1fill
5720 % Cause last line, which could consist of page numbers on their own
5721 % if the list of page numbers is long, to be aligned to the right.
5722 \parfillskip=0pt plus -1fill
5724 \advance\rightskip by \entryrightmargin
5725 % Determine how far we can stretch into the margin.
5726 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5727 % fit on one line in @letterpaper format.
5728 \ifdim\entryrightmargin>2.1em
5729 \dimen@i=2.1em
5730 \else
5731 \dimen@i=0em
5733 \advance \parfillskip by 0pt minus 1\dimen@i
5735 \dimen@ii = \hsize
5736 \advance\dimen@ii by -1\leftskip
5737 \advance\dimen@ii by -1\entryrightmargin
5738 \advance\dimen@ii by 1\dimen@i
5739 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5740 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5741 \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
5742 \dimen@ii = \hsize
5743 \ifnum\dimen@>\dimen@ii
5744 % If the entry is too long, use the whole line
5745 \dimen@ = \dimen@ii
5747 \advance\leftskip by 0pt plus 1fill % ragged right
5748 \advance \dimen@ by 1\rightskip
5749 \parshape = 2 0pt \dimen@ 0em \dimen@ii
5750 % Ideally we'd add a finite glue at the end of the first line only,
5751 % instead of using \parshape with explicit line lengths, but TeX
5752 % doesn't seem to provide a way to do such a thing.
5754 \leftskip = 1em
5755 \parindent = -1em
5756 \fi\fi
5757 \indent % start paragraph
5758 \unhbox\boxA
5760 % Do not prefer a separate line ending with a hyphen to fewer lines.
5761 \finalhyphendemerits = 0
5763 % Word spacing - no stretch
5764 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5766 \linepenalty=1000 % Discourage line breaks.
5767 \hyphenpenalty=5000 % Discourage hyphenation.
5769 \par % format the paragraph
5770 \egroup % The \vbox
5772 \endgroup
5773 % delay text of entry until after penalty
5774 \bgroup\aftergroup\insertindexentrybox
5775 \entrywidowpenalty
5778 \newskip\thinshrinkable
5779 \skip\thinshrinkable=.15em minus .15em
5781 \newbox\entryindexbox
5782 \def\insertindexentrybox{%
5783 \ourunvbox\entryindexbox
5786 % Use \lastbox to take apart vbox box by box, and add each sub-box
5787 % to the current vertical list.
5788 \def\ourunvbox#1{%
5789 \bgroup % for local binding of \delayedbox
5790 % Remove the last box from box #1
5791 \global\setbox#1=\vbox{%
5792 \unvbox#1%
5793 \unskip % remove any glue
5794 \unpenalty
5795 \global\setbox\interbox=\lastbox
5797 \setbox\delayedbox=\box\interbox
5798 \ifdim\ht#1=0pt\else
5799 \ourunvbox#1 % Repeat on what's left of the box
5800 \nobreak
5802 \box\delayedbox
5803 \egroup
5805 \newbox\delayedbox
5806 \newbox\interbox
5808 % Default is no penalty
5809 \let\entrywidowpenalty\egroup
5811 % Used from \printindex. \firsttoken should be the first token
5812 % after the \entry. If it's not another \entry, we are at the last
5813 % line of a group of index entries, so insert a penalty to discourage
5814 % widowed index entries.
5815 \long\def\indexwidowpenalty{%
5816 \def\isentry{\entry}%
5817 \ifx\firsttoken\isentry
5818 \else
5819 \penalty 9000
5821 \egroup % now comes the box added with \aftergroup
5824 % Like plain.tex's \dotfill, except uses up at least 1 em.
5825 % The filll stretch here overpowers both the fil and fill stretch to push
5826 % the page number to the right.
5827 \def\indexdotfill{\cleaders
5828 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5831 \def\primary #1{\line{#1\hfil}}
5833 \newskip\secondaryindent \secondaryindent=0.5cm
5834 \def\secondary#1#2{{%
5835 \parfillskip=0in
5836 \parskip=0in
5837 \hangindent=1in
5838 \hangafter=1
5839 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5840 \ifpdf
5841 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5842 \else
5843 \ifx\XeTeXrevision\thisisundefined
5845 \else
5846 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5849 \par
5852 % Define two-column mode, which we use to typeset indexes.
5853 % Adapted from the TeXbook, page 416, which is to say,
5854 % the manmac.tex format used to print the TeXbook itself.
5855 \catcode`\@=11 % private names
5857 \newbox\partialpage
5858 \newdimen\doublecolumnhsize
5860 % Use inside an output routine to save \topmark and \firstmark
5861 \def\savemarks{%
5862 \global\savedtopmark=\expandafter{\topmark }%
5863 \global\savedfirstmark=\expandafter{\firstmark }%
5865 \newtoks\savedtopmark
5866 \newtoks\savedfirstmark
5868 % Set \topmark and \firstmark for next time \output runs.
5869 % Can't be run from withinside \output (because any material
5870 % added while an output routine is active, including
5871 % penalties, is saved for after it finishes). The page so far
5872 % should be empty, otherwise what's on it will be thrown away.
5873 \def\restoremarks{%
5874 \mark{\the\savedtopmark}%
5875 \bgroup\output = {%
5876 \setbox\dummybox=\box\PAGE
5877 }abc\eject\egroup
5878 % "abc" because output routine doesn't fire for a completely empty page.
5879 \mark{\the\savedfirstmark}%
5882 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5883 % If not much space left on page, start a new page.
5884 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5886 % Grab any single-column material above us.
5887 \output = {%
5889 % Here is a possibility not foreseen in manmac: if we accumulate a
5890 % whole lot of material, we might end up calling this \output
5891 % routine twice in a row (see the doublecol-lose test, which is
5892 % essentially a couple of indexes with @setchapternewpage off). In
5893 % that case we just ship out what is in \partialpage with the normal
5894 % output routine. Generally, \partialpage will be empty when this
5895 % runs and this will be a no-op. See the indexspread.tex test case.
5896 \ifvoid\partialpage \else
5897 \onepageout{\pagecontents\partialpage}%
5900 \global\setbox\partialpage = \vbox{%
5901 % Unvbox the main output page.
5902 \unvbox\PAGE
5903 \kern-\topskip \kern\baselineskip
5905 \savemarks
5907 \eject % run that output routine to set \partialpage
5908 \restoremarks
5910 % We recover the two marks that the last output routine saved in order
5911 % to propagate the information in marks added around a chapter heading,
5912 % which could be otherwise be lost by the time the final page is output.
5915 % Use the double-column output routine for subsequent pages.
5916 \output = {\doublecolumnout}%
5918 % Change the page size parameters. We could do this once outside this
5919 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5920 % format, but then we repeat the same computation. Repeating a couple
5921 % of assignments once per index is clearly meaningless for the
5922 % execution time, so we may as well do it in one place.
5924 % First we halve the line length, less a little for the gutter between
5925 % the columns. We compute the gutter based on the line length, so it
5926 % changes automatically with the paper format. The magic constant
5927 % below is chosen so that the gutter has the same value (well, +-<1pt)
5928 % as it did when we hard-coded it.
5930 % We put the result in a separate register, \doublecolumhsize, so we
5931 % can restore it in \pagesofar, after \hsize itself has (potentially)
5932 % been clobbered.
5934 \doublecolumnhsize = \hsize
5935 \advance\doublecolumnhsize by -.04154\hsize
5936 \divide\doublecolumnhsize by 2
5937 \hsize = \doublecolumnhsize
5939 % Double the \vsize as well. (We don't need a separate register here,
5940 % since nobody clobbers \vsize.)
5941 \vsize = 2\vsize
5943 % For the benefit of balancing columns
5944 \advance\baselineskip by 0pt plus 0.5pt
5947 % The double-column output routine for all double-column pages except
5948 % the last, which is done by \balancecolumns.
5950 \def\doublecolumnout{%
5952 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5953 % Get the available space for the double columns -- the normal
5954 % (undoubled) page height minus any material left over from the
5955 % previous page.
5956 \dimen@ = \vsize
5957 \divide\dimen@ by 2
5958 \advance\dimen@ by -\ht\partialpage
5960 % box0 will be the left-hand column, box2 the right.
5961 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
5962 \onepageout\pagesofar
5963 \unvbox255
5964 \penalty\outputpenalty
5967 % Re-output the contents of the output page -- any previous material,
5968 % followed by the two boxes we just split, in box0 and box2.
5969 \def\pagesofar{%
5970 \unvbox\partialpage
5972 \hsize = \doublecolumnhsize
5973 \wd0=\hsize \wd2=\hsize
5974 \hbox to\txipagewidth{\box0\hfil\box2}%
5978 % Finished with with double columns.
5979 \def\enddoublecolumns{%
5980 % The following penalty ensures that the page builder is exercised
5981 % _before_ we change the output routine. This is necessary in the
5982 % following situation:
5984 % The last section of the index consists only of a single entry.
5985 % Before this section, \pagetotal is less than \pagegoal, so no
5986 % break occurs before the last section starts. However, the last
5987 % section, consisting of \initial and the single \entry, does not
5988 % fit on the page and has to be broken off. Without the following
5989 % penalty the page builder will not be exercised until \eject
5990 % below, and by that time we'll already have changed the output
5991 % routine to the \balancecolumns version, so the next-to-last
5992 % double-column page will be processed with \balancecolumns, which
5993 % is wrong: The two columns will go to the main vertical list, with
5994 % the broken-off section in the recent contributions. As soon as
5995 % the output routine finishes, TeX starts reconsidering the page
5996 % break. The two columns and the broken-off section both fit on the
5997 % page, because the two columns now take up only half of the page
5998 % goal. When TeX sees \eject from below which follows the final
5999 % section, it invokes the new output routine that we've set after
6000 % \balancecolumns below; \onepageout will try to fit the two columns
6001 % and the final section into the vbox of \txipageheight (see
6002 % \pagebody), causing an overfull box.
6004 % Note that glue won't work here, because glue does not exercise the
6005 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
6006 \penalty0
6008 \output = {%
6009 % Split the last of the double-column material.
6010 \savemarks
6011 \balancecolumns
6013 % Having called \balancecolumns once, we do not
6014 % want to call it again. Therefore, reset \output to its normal
6015 % definition right away.
6016 \global\output = {\onepageout{\pagecontents\PAGE}}%
6018 \eject
6019 \endgroup % started in \begindoublecolumns
6020 \restoremarks
6021 % Leave the double-column material on the current page, no automatic
6022 % page break.
6023 \box\balancedcolumns
6025 % \pagegoal was set to the doubled \vsize above, since we restarted
6026 % the current page. We're now back to normal single-column
6027 % typesetting, so reset \pagegoal to the normal \vsize (after the
6028 % \endgroup where \vsize got restored).
6029 \pagegoal = \vsize
6031 \newbox\balancedcolumns
6032 \setbox\balancedcolumns=\vbox{shouldnt see this}%
6034 % Only called for the last of the double column material. \doublecolumnout
6035 % does the others.
6036 \def\balancecolumns{%
6037 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
6038 \dimen@ = \ht0
6039 \advance\dimen@ by \topskip
6040 \advance\dimen@ by-\baselineskip
6041 \ifdim\dimen@<5\baselineskip
6042 % Don't split a short final column in two.
6043 \setbox2=\vbox{}%
6044 \else
6045 \divide\dimen@ by 2 % target to split to
6046 \dimen@ii = \dimen@
6047 \splittopskip = \topskip
6048 % Loop until left column is at least as high as the right column.
6050 \vbadness = 10000
6051 \loop
6052 \global\setbox3 = \copy0
6053 \global\setbox1 = \vsplit3 to \dimen@
6054 \ifdim\ht1<\ht3
6055 \global\advance\dimen@ by 1pt
6056 \repeat
6058 % Now the left column is in box 1, and the right column in box 3.
6059 % Check whether the left column has come out higher than the page itself.
6060 % (Note that we have doubled \vsize for the double columns, so
6061 % the actual height of the page is 0.5\vsize).
6062 \ifdim2\ht1>\vsize
6063 % Just split the last of the double column material roughly in half.
6064 \setbox2=\box0
6065 \setbox0 = \vsplit2 to \dimen@ii
6066 \setbox0=\vbox to \dimen@ii {\unvbox0\vfill}%
6067 \setbox2=\vbox to \dimen@ii {\unvbox2\vfill}%
6068 \else
6069 % Compare the heights of the two columns.
6070 \ifdim4\ht1>5\ht3
6071 % Column heights are too different, so don't make their bottoms
6072 % flush with each other.
6073 \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
6074 \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
6075 \else
6076 % Make column bottoms flush with each other.
6077 \setbox2=\vbox to\ht1{\unvbox3\unskip}%
6078 \setbox0=\vbox to\ht1{\unvbox1\unskip}%
6083 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
6085 \catcode`\@ = \other
6088 \message{sectioning,}
6089 % Chapters, sections, etc.
6091 % Let's start with @part.
6092 \outer\parseargdef\part{\partzzz{#1}}
6093 \def\partzzz#1{%
6094 \chapoddpage
6095 \null
6096 \vskip.3\vsize % move it down on the page a bit
6097 \begingroup
6098 \noindent \titlefonts\rmisbold #1\par % the text
6099 \let\lastnode=\empty % no node to associate with
6100 \writetocentry{part}{#1}{}% but put it in the toc
6101 \headingsoff % no headline or footline on the part page
6102 % This outputs a mark at the end of the page that clears \thischapter
6103 % and \thissection, as is done in \startcontents.
6104 \let\pchapsepmacro\relax
6105 \chapmacro{}{Yomitfromtoc}{}%
6106 \chapoddpage
6107 \endgroup
6110 % \unnumberedno is an oxymoron. But we count the unnumbered
6111 % sections so that we can refer to them unambiguously in the pdf
6112 % outlines by their "section number". We avoid collisions with chapter
6113 % numbers by starting them at 10000. (If a document ever has 10000
6114 % chapters, we're in trouble anyway, I'm sure.)
6115 \newcount\unnumberedno \unnumberedno = 10000
6116 \newcount\chapno
6117 \newcount\secno \secno=0
6118 \newcount\subsecno \subsecno=0
6119 \newcount\subsubsecno \subsubsecno=0
6121 % This counter is funny since it counts through charcodes of letters A, B, ...
6122 \newcount\appendixno \appendixno = `\@
6124 % \def\appendixletter{\char\the\appendixno}
6125 % We do the following ugly conditional instead of the above simple
6126 % construct for the sake of pdftex, which needs the actual
6127 % letter in the expansion, not just typeset.
6129 \def\appendixletter{%
6130 \ifnum\appendixno=`A A%
6131 \else\ifnum\appendixno=`B B%
6132 \else\ifnum\appendixno=`C C%
6133 \else\ifnum\appendixno=`D D%
6134 \else\ifnum\appendixno=`E E%
6135 \else\ifnum\appendixno=`F F%
6136 \else\ifnum\appendixno=`G G%
6137 \else\ifnum\appendixno=`H H%
6138 \else\ifnum\appendixno=`I I%
6139 \else\ifnum\appendixno=`J J%
6140 \else\ifnum\appendixno=`K K%
6141 \else\ifnum\appendixno=`L L%
6142 \else\ifnum\appendixno=`M M%
6143 \else\ifnum\appendixno=`N N%
6144 \else\ifnum\appendixno=`O O%
6145 \else\ifnum\appendixno=`P P%
6146 \else\ifnum\appendixno=`Q Q%
6147 \else\ifnum\appendixno=`R R%
6148 \else\ifnum\appendixno=`S S%
6149 \else\ifnum\appendixno=`T T%
6150 \else\ifnum\appendixno=`U U%
6151 \else\ifnum\appendixno=`V V%
6152 \else\ifnum\appendixno=`W W%
6153 \else\ifnum\appendixno=`X X%
6154 \else\ifnum\appendixno=`Y Y%
6155 \else\ifnum\appendixno=`Z Z%
6156 % The \the is necessary, despite appearances, because \appendixletter is
6157 % expanded while writing the .toc file. \char\appendixno is not
6158 % expandable, thus it is written literally, thus all appendixes come out
6159 % with the same letter (or @) in the toc without it.
6160 \else\char\the\appendixno
6161 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6162 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6164 % Each @chapter defines these (using marks) as the number+name, number
6165 % and name of the chapter. Page headings and footings can use
6166 % these. @section does likewise.
6167 \def\thischapter{}
6168 \def\thischapternum{}
6169 \def\thischaptername{}
6170 \def\thissection{}
6171 \def\thissectionnum{}
6172 \def\thissectionname{}
6174 \newcount\absseclevel % used to calculate proper heading level
6175 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6177 % @raisesections: treat @section as chapter, @subsection as section, etc.
6178 \def\raisesections{\global\advance\secbase by -1}
6179 \let\up=\raisesections % original BFox name
6181 % @lowersections: treat @chapter as section, @section as subsection, etc.
6182 \def\lowersections{\global\advance\secbase by 1}
6183 \let\down=\lowersections % original BFox name
6185 % we only have subsub.
6186 \chardef\maxseclevel = 3
6188 % A numbered section within an unnumbered changes to unnumbered too.
6189 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
6190 \chardef\unnlevel = \maxseclevel
6192 % Trace whether the current chapter is an appendix or not:
6193 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6194 \def\chapheadtype{N}
6196 % Choose a heading macro
6197 % #1 is heading type
6198 % #2 is heading level
6199 % #3 is text for heading
6200 \def\genhead#1#2#3{%
6201 % Compute the abs. sec. level:
6202 \absseclevel=#2
6203 \advance\absseclevel by \secbase
6204 % Make sure \absseclevel doesn't fall outside the range:
6205 \ifnum \absseclevel < 0
6206 \absseclevel = 0
6207 \else
6208 \ifnum \absseclevel > 3
6209 \absseclevel = 3
6212 % The heading type:
6213 \def\headtype{#1}%
6214 \if \headtype U%
6215 \ifnum \absseclevel < \unnlevel
6216 \chardef\unnlevel = \absseclevel
6218 \else
6219 % Check for appendix sections:
6220 \ifnum \absseclevel = 0
6221 \edef\chapheadtype{\headtype}%
6222 \else
6223 \if \headtype A\if \chapheadtype N%
6224 \errmessage{@appendix... within a non-appendix chapter}%
6225 \fi\fi
6227 % Check for numbered within unnumbered:
6228 \ifnum \absseclevel > \unnlevel
6229 \def\headtype{U}%
6230 \else
6231 \chardef\unnlevel = 3
6234 % Now print the heading:
6235 \if \headtype U%
6236 \ifcase\absseclevel
6237 \unnumberedzzz{#3}%
6238 \or \unnumberedseczzz{#3}%
6239 \or \unnumberedsubseczzz{#3}%
6240 \or \unnumberedsubsubseczzz{#3}%
6242 \else
6243 \if \headtype A%
6244 \ifcase\absseclevel
6245 \appendixzzz{#3}%
6246 \or \appendixsectionzzz{#3}%
6247 \or \appendixsubseczzz{#3}%
6248 \or \appendixsubsubseczzz{#3}%
6250 \else
6251 \ifcase\absseclevel
6252 \chapterzzz{#3}%
6253 \or \seczzz{#3}%
6254 \or \numberedsubseczzz{#3}%
6255 \or \numberedsubsubseczzz{#3}%
6259 \suppressfirstparagraphindent
6262 % an interface:
6263 \def\numhead{\genhead N}
6264 \def\apphead{\genhead A}
6265 \def\unnmhead{\genhead U}
6267 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6268 % all lower-level sectioning counters to zero.
6270 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
6271 % (e.g., figures), q.v. By default (before any chapter), that is empty.
6272 \let\chaplevelprefix = \empty
6274 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6275 \def\chapterzzz#1{%
6276 % section resetting is \global in case the chapter is in a group, such
6277 % as an @include file.
6278 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6279 \global\advance\chapno by 1
6281 % Used for \float.
6282 \gdef\chaplevelprefix{\the\chapno.}%
6283 \resetallfloatnos
6285 % \putwordChapter can contain complex things in translations.
6286 \toks0=\expandafter{\putwordChapter}%
6287 \message{\the\toks0 \space \the\chapno}%
6289 % Write the actual heading.
6290 \chapmacro{#1}{Ynumbered}{\the\chapno}%
6292 % So @section and the like are numbered underneath this chapter.
6293 \global\let\section = \numberedsec
6294 \global\let\subsection = \numberedsubsec
6295 \global\let\subsubsection = \numberedsubsubsec
6298 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6300 \def\appendixzzz#1{%
6301 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6302 \global\advance\appendixno by 1
6303 \gdef\chaplevelprefix{\appendixletter.}%
6304 \resetallfloatnos
6306 % \putwordAppendix can contain complex things in translations.
6307 \toks0=\expandafter{\putwordAppendix}%
6308 \message{\the\toks0 \space \appendixletter}%
6310 \chapmacro{#1}{Yappendix}{\appendixletter}%
6312 \global\let\section = \appendixsec
6313 \global\let\subsection = \appendixsubsec
6314 \global\let\subsubsection = \appendixsubsubsec
6317 % normally unnmhead0 calls unnumberedzzz:
6318 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
6319 \def\unnumberedzzz#1{%
6320 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6321 \global\advance\unnumberedno by 1
6323 % Since an unnumbered has no number, no prefix for figures.
6324 \global\let\chaplevelprefix = \empty
6325 \resetallfloatnos
6327 % This used to be simply \message{#1}, but TeX fully expands the
6328 % argument to \message. Therefore, if #1 contained @-commands, TeX
6329 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6330 % expanded @cite (which turns out to cause errors because \cite is meant
6331 % to be executed, not expanded).
6333 % Anyway, we don't want the fully-expanded definition of @cite to appear
6334 % as a result of the \message, we just want `@cite' itself. We use
6335 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6336 % simply yielding the contents of <toks register>. (We also do this for
6337 % the toc entries.)
6338 \toks0 = {#1}%
6339 \message{(\the\toks0)}%
6341 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6343 \global\let\section = \unnumberedsec
6344 \global\let\subsection = \unnumberedsubsec
6345 \global\let\subsubsection = \unnumberedsubsubsec
6348 % @centerchap is like @unnumbered, but the heading is centered.
6349 \outer\parseargdef\centerchap{%
6350 \let\centerparametersmaybe = \centerparameters
6351 \unnmhead0{#1}%
6352 \let\centerparametersmaybe = \relax
6355 % @top is like @unnumbered.
6356 \let\top\unnumbered
6358 % Sections.
6360 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6361 \def\seczzz#1{%
6362 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6363 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6366 % normally calls appendixsectionzzz:
6367 \outer\parseargdef\appendixsection{\apphead1{#1}}
6368 \def\appendixsectionzzz#1{%
6369 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6370 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6372 \let\appendixsec\appendixsection
6374 % normally calls unnumberedseczzz:
6375 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6376 \def\unnumberedseczzz#1{%
6377 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6378 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6381 % Subsections.
6383 % normally calls numberedsubseczzz:
6384 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6385 \def\numberedsubseczzz#1{%
6386 \global\subsubsecno=0 \global\advance\subsecno by 1
6387 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6390 % normally calls appendixsubseczzz:
6391 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6392 \def\appendixsubseczzz#1{%
6393 \global\subsubsecno=0 \global\advance\subsecno by 1
6394 \sectionheading{#1}{subsec}{Yappendix}%
6395 {\appendixletter.\the\secno.\the\subsecno}%
6398 % normally calls unnumberedsubseczzz:
6399 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6400 \def\unnumberedsubseczzz#1{%
6401 \global\subsubsecno=0 \global\advance\subsecno by 1
6402 \sectionheading{#1}{subsec}{Ynothing}%
6403 {\the\unnumberedno.\the\secno.\the\subsecno}%
6406 % Subsubsections.
6408 % normally numberedsubsubseczzz:
6409 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6410 \def\numberedsubsubseczzz#1{%
6411 \global\advance\subsubsecno by 1
6412 \sectionheading{#1}{subsubsec}{Ynumbered}%
6413 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6416 % normally appendixsubsubseczzz:
6417 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6418 \def\appendixsubsubseczzz#1{%
6419 \global\advance\subsubsecno by 1
6420 \sectionheading{#1}{subsubsec}{Yappendix}%
6421 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6424 % normally unnumberedsubsubseczzz:
6425 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6426 \def\unnumberedsubsubseczzz#1{%
6427 \global\advance\subsubsecno by 1
6428 \sectionheading{#1}{subsubsec}{Ynothing}%
6429 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6432 % These macros control what the section commands do, according
6433 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6434 % Define them by default for a numbered chapter.
6435 \let\section = \numberedsec
6436 \let\subsection = \numberedsubsec
6437 \let\subsubsection = \numberedsubsubsec
6439 % Define @majorheading, @heading and @subheading
6441 \def\majorheading{%
6442 {\advance\chapheadingskip by 10pt \chapbreak }%
6443 \parsearg\chapheadingzzz
6446 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6447 \def\chapheadingzzz#1{%
6448 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6449 \nobreak\bigskip \nobreak
6450 \suppressfirstparagraphindent
6453 % @heading, @subheading, @subsubheading.
6454 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6455 \suppressfirstparagraphindent}
6456 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6457 \suppressfirstparagraphindent}
6458 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6459 \suppressfirstparagraphindent}
6461 % These macros generate a chapter, section, etc. heading only
6462 % (including whitespace, linebreaking, etc. around it),
6463 % given all the information in convenient, parsed form.
6465 % Args are the skip and penalty (usually negative)
6466 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6468 % Parameter controlling skip before chapter headings (if needed)
6469 \newskip\chapheadingskip
6471 % Define plain chapter starts, and page on/off switching for it.
6472 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6474 % Start a new page
6475 \def\chappager{\par\vfill\supereject}
6477 % \chapoddpage - start on an odd page for a new chapter
6478 % Because \domark is called before \chapoddpage, the filler page will
6479 % get the headings for the next chapter, which is wrong. But we don't
6480 % care -- we just disable all headings on the filler page.
6481 \def\chapoddpage{%
6482 \chappager
6483 \ifodd\pageno \else
6484 \begingroup
6485 \headingsoff
6486 \null
6487 \chappager
6488 \endgroup
6492 \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
6494 \def\CHAPPAGoff{%
6495 \global\let\contentsalignmacro = \chappager
6496 \global\let\pchapsepmacro=\chapbreak
6497 \global\let\pagealignmacro=\chappager}
6499 \def\CHAPPAGon{%
6500 \global\let\contentsalignmacro = \chappager
6501 \global\let\pchapsepmacro=\chappager
6502 \global\let\pagealignmacro=\chappager
6503 \global\def\HEADINGSon{\HEADINGSsingle}}
6505 \def\CHAPPAGodd{%
6506 \global\let\contentsalignmacro = \chapoddpage
6507 \global\let\pchapsepmacro=\chapoddpage
6508 \global\let\pagealignmacro=\chapoddpage
6509 \global\def\HEADINGSon{\HEADINGSdouble}}
6511 \CHAPPAGon
6513 % \chapmacro - Chapter opening.
6515 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6516 % Yappendix, Yomitfromtoc), #3 the chapter number.
6517 % Not used for @heading series.
6519 % To test against our argument.
6520 \def\Ynothingkeyword{Ynothing}
6521 \def\Yappendixkeyword{Yappendix}
6522 \def\Yomitfromtockeyword{Yomitfromtoc}
6524 \def\chapmacro#1#2#3{%
6525 \expandafter\ifx\thisenv\titlepage\else
6526 \checkenv{}% chapters, etc., should not start inside an environment.
6528 % FIXME: \chapmacro is currently called from inside \titlepage when
6529 % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
6530 % this should probably be done by \sectionheading with an option to print
6531 % in chapter size.
6533 % Insert the first mark before the heading break (see notes for \domark).
6534 \let\prevchapterdefs=\lastchapterdefs
6535 \let\prevsectiondefs=\lastsectiondefs
6536 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6537 \gdef\thissection{}}%
6539 \def\temptype{#2}%
6540 \ifx\temptype\Ynothingkeyword
6541 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6542 \gdef\thischapter{\thischaptername}}%
6543 \else\ifx\temptype\Yomitfromtockeyword
6544 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6545 \gdef\thischapter{}}%
6546 \else\ifx\temptype\Yappendixkeyword
6547 \toks0={#1}%
6548 \xdef\lastchapterdefs{%
6549 \gdef\noexpand\thischaptername{\the\toks0}%
6550 \gdef\noexpand\thischapternum{\appendixletter}%
6551 % \noexpand\putwordAppendix avoids expanding indigestible
6552 % commands in some of the translations.
6553 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6554 \noexpand\thischapternum:
6555 \noexpand\thischaptername}%
6557 \else
6558 \toks0={#1}%
6559 \xdef\lastchapterdefs{%
6560 \gdef\noexpand\thischaptername{\the\toks0}%
6561 \gdef\noexpand\thischapternum{\the\chapno}%
6562 % \noexpand\putwordChapter avoids expanding indigestible
6563 % commands in some of the translations.
6564 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6565 \noexpand\thischapternum:
6566 \noexpand\thischaptername}%
6568 \fi\fi\fi
6570 % Output the mark. Pass it through \safewhatsit, to take care of
6571 % the preceding space.
6572 \safewhatsit\domark
6574 % Insert the chapter heading break.
6575 \pchapsepmacro
6577 % Now the second mark, after the heading break. No break points
6578 % between here and the heading.
6579 \let\prevchapterdefs=\lastchapterdefs
6580 \let\prevsectiondefs=\lastsectiondefs
6581 \domark
6584 \chapfonts \rmisbold
6585 \let\footnote=\errfootnoteheading % give better error message
6587 % Have to define \lastsection before calling \donoderef, because the
6588 % xref code eventually uses it. On the other hand, it has to be called
6589 % after \pchapsepmacro, or the headline will change too soon.
6590 \gdef\lastsection{#1}%
6592 % Only insert the separating space if we have a chapter/appendix
6593 % number, and don't print the unnumbered ``number''.
6594 \ifx\temptype\Ynothingkeyword
6595 \setbox0 = \hbox{}%
6596 \def\toctype{unnchap}%
6597 \else\ifx\temptype\Yomitfromtockeyword
6598 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6599 \def\toctype{omit}%
6600 \else\ifx\temptype\Yappendixkeyword
6601 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6602 \def\toctype{app}%
6603 \else
6604 \setbox0 = \hbox{#3\enspace}%
6605 \def\toctype{numchap}%
6606 \fi\fi\fi
6608 % Write the toc entry for this chapter. Must come before the
6609 % \donoderef, because we include the current node name in the toc
6610 % entry, and \donoderef resets it to empty.
6611 \writetocentry{\toctype}{#1}{#3}%
6613 % For pdftex, we have to write out the node definition (aka, make
6614 % the pdfdest) after any page break, but before the actual text has
6615 % been typeset. If the destination for the pdf outline is after the
6616 % text, then jumping from the outline may wind up with the text not
6617 % being visible, for instance under high magnification.
6618 \donoderef{#2}%
6620 % Typeset the actual heading.
6621 \nobreak % Avoid page breaks at the interline glue.
6622 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6623 \unhbox0 #1\par}%
6625 \nobreak\bigskip % no page break after a chapter title
6626 \nobreak
6629 % @centerchap -- centered and unnumbered.
6630 \let\centerparametersmaybe = \relax
6631 \def\centerparameters{%
6632 \advance\rightskip by 3\rightskip
6633 \leftskip = \rightskip
6634 \parfillskip = 0pt
6638 % Section titles. These macros combine the section number parts and
6639 % call the generic \sectionheading to do the printing.
6641 \newskip\secheadingskip
6642 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6644 % Subsection titles.
6645 \newskip\subsecheadingskip
6646 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6648 % Subsubsection titles.
6649 \def\subsubsecheadingskip{\subsecheadingskip}
6650 \def\subsubsecheadingbreak{\subsecheadingbreak}
6653 % Print any size, any type, section title.
6655 % #1 is the text of the title,
6656 % #2 is the section level (sec/subsec/subsubsec),
6657 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6658 % #4 is the section number.
6660 \def\seckeyword{sec}
6662 \def\sectionheading#1#2#3#4{%
6664 \def\sectionlevel{#2}%
6665 \def\temptype{#3}%
6667 % It is ok for the @heading series commands to appear inside an
6668 % environment (it's been historically allowed, though the logic is
6669 % dubious), but not the others.
6670 \ifx\temptype\Yomitfromtockeyword\else
6671 \checkenv{}% non-@*heading should not be in an environment.
6673 \let\footnote=\errfootnoteheading
6675 % Switch to the right set of fonts.
6676 \csname #2fonts\endcsname \rmisbold
6678 % Insert first mark before the heading break (see notes for \domark).
6679 \let\prevsectiondefs=\lastsectiondefs
6680 \ifx\temptype\Ynothingkeyword
6681 \ifx\sectionlevel\seckeyword
6682 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6683 \gdef\thissection{\thissectionname}}%
6685 \else\ifx\temptype\Yomitfromtockeyword
6686 % Don't redefine \thissection.
6687 \else\ifx\temptype\Yappendixkeyword
6688 \ifx\sectionlevel\seckeyword
6689 \toks0={#1}%
6690 \xdef\lastsectiondefs{%
6691 \gdef\noexpand\thissectionname{\the\toks0}%
6692 \gdef\noexpand\thissectionnum{#4}%
6693 % \noexpand\putwordSection avoids expanding indigestible
6694 % commands in some of the translations.
6695 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6696 \noexpand\thissectionnum:
6697 \noexpand\thissectionname}%
6700 \else
6701 \ifx\sectionlevel\seckeyword
6702 \toks0={#1}%
6703 \xdef\lastsectiondefs{%
6704 \gdef\noexpand\thissectionname{\the\toks0}%
6705 \gdef\noexpand\thissectionnum{#4}%
6706 % \noexpand\putwordSection avoids expanding indigestible
6707 % commands in some of the translations.
6708 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6709 \noexpand\thissectionnum:
6710 \noexpand\thissectionname}%
6713 \fi\fi\fi
6715 % Go into vertical mode. Usually we'll already be there, but we
6716 % don't want the following whatsit to end up in a preceding paragraph
6717 % if the document didn't happen to have a blank line.
6718 \par
6720 % Output the mark. Pass it through \safewhatsit, to take care of
6721 % the preceding space.
6722 \safewhatsit\domark
6724 % Insert space above the heading.
6725 \csname #2headingbreak\endcsname
6727 % Now the second mark, after the heading break. No break points
6728 % between here and the heading.
6729 \global\let\prevsectiondefs=\lastsectiondefs
6730 \domark
6732 % Only insert the space after the number if we have a section number.
6733 \ifx\temptype\Ynothingkeyword
6734 \setbox0 = \hbox{}%
6735 \def\toctype{unn}%
6736 \gdef\lastsection{#1}%
6737 \else\ifx\temptype\Yomitfromtockeyword
6738 % for @headings -- no section number, don't include in toc,
6739 % and don't redefine \lastsection.
6740 \setbox0 = \hbox{}%
6741 \def\toctype{omit}%
6742 \let\sectionlevel=\empty
6743 \else\ifx\temptype\Yappendixkeyword
6744 \setbox0 = \hbox{#4\enspace}%
6745 \def\toctype{app}%
6746 \gdef\lastsection{#1}%
6747 \else
6748 \setbox0 = \hbox{#4\enspace}%
6749 \def\toctype{num}%
6750 \gdef\lastsection{#1}%
6751 \fi\fi\fi
6753 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6754 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6756 % Write the node reference (= pdf destination for pdftex).
6757 % Again, see comments in \chapmacro.
6758 \donoderef{#3}%
6760 % Interline glue will be inserted when the vbox is completed.
6761 % That glue will be a valid breakpoint for the page, since it'll be
6762 % preceded by a whatsit (usually from the \donoderef, or from the
6763 % \writetocentry if there was no node). We don't want to allow that
6764 % break, since then the whatsits could end up on page n while the
6765 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6766 \nobreak
6768 % Output the actual section heading.
6769 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6770 \hangindent=\wd0 % zero if no section number
6771 \unhbox0 #1}%
6773 % Add extra space after the heading -- half of whatever came above it.
6774 % Don't allow stretch, though.
6775 \kern .5 \csname #2headingskip\endcsname
6777 % Do not let the kern be a potential breakpoint, as it would be if it
6778 % was followed by glue.
6779 \nobreak
6781 % We'll almost certainly start a paragraph next, so don't let that
6782 % glue accumulate. (Not a breakpoint because it's preceded by a
6783 % discardable item.) However, when a paragraph is not started next
6784 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6785 % or the negative glue will cause weirdly wrong output, typically
6786 % obscuring the section heading with something else.
6787 \vskip-\parskip
6789 % This is so the last item on the main vertical list is a known
6790 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6791 % and do the needful.
6792 \penalty 10001
6796 \message{toc,}
6797 % Table of contents.
6798 \newwrite\tocfile
6800 % Write an entry to the toc file, opening it if necessary.
6801 % Called from @chapter, etc.
6803 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6804 % We append the current node name (if any) and page number as additional
6805 % arguments for the \{chap,sec,...}entry macros which will eventually
6806 % read this. The node name is used in the pdf outlines as the
6807 % destination to jump to.
6809 % We open the .toc file for writing here instead of at @setfilename (or
6810 % any other fixed time) so that @contents can be anywhere in the document.
6811 % But if #1 is `omit', then we don't do anything. This is used for the
6812 % table of contents chapter openings themselves.
6814 \newif\iftocfileopened
6815 \def\omitkeyword{omit}%
6817 \def\writetocentry#1#2#3{%
6818 \edef\writetoctype{#1}%
6819 \ifx\writetoctype\omitkeyword \else
6820 \iftocfileopened\else
6821 \immediate\openout\tocfile = \jobname.toc
6822 \global\tocfileopenedtrue
6825 \iflinks
6826 {\atdummies
6827 \edef\temp{%
6828 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6829 \temp
6834 % Tell \shipout to create a pdf destination on each page, if we're
6835 % writing pdf. These are used in the table of contents. We can't
6836 % just write one on every page because the title pages are numbered
6837 % 1 and 2 (the page numbers aren't printed), and so are the first
6838 % two pages of the document. Thus, we'd have two destinations named
6839 % `1', and two named `2'.
6840 \ifpdf
6841 \global\pdfmakepagedesttrue
6842 \else
6843 \ifx\XeTeXrevision\thisisundefined
6844 \else
6845 \global\pdfmakepagedesttrue
6851 % These characters do not print properly in the Computer Modern roman
6852 % fonts, so we must take special care. This is more or less redundant
6853 % with the Texinfo input format setup at the end of this file.
6855 \def\activecatcodes{%
6856 \catcode`\"=\active
6857 \catcode`\$=\active
6858 \catcode`\<=\active
6859 \catcode`\>=\active
6860 \catcode`\\=\active
6861 \catcode`\^=\active
6862 \catcode`\_=\active
6863 \catcode`\|=\active
6864 \catcode`\~=\active
6868 % Read the toc file, which is essentially Texinfo input.
6869 \def\readtocfile{%
6870 \setupdatafile
6871 \activecatcodes
6872 \input \tocreadfilename
6875 \newskip\contentsrightmargin \contentsrightmargin=1in
6876 \newcount\savepageno
6877 \newcount\lastnegativepageno \lastnegativepageno = -1
6879 % Prepare to read what we've written to \tocfile.
6881 \def\startcontents#1{%
6882 % If @setchapternewpage on, and @headings double, the contents should
6883 % start on an odd page, unlike chapters. Thus, we maintain
6884 % \contentsalignmacro in parallel with \pagealignmacro.
6885 % From: Torbjorn Granlund <tege@matematik.su.se>
6886 \contentsalignmacro
6887 \immediate\closeout\tocfile
6889 % Don't need to put `Contents' or `Short Contents' in the headline.
6890 % It is abundantly clear what they are.
6891 \chapmacro{#1}{Yomitfromtoc}{}%
6893 \savepageno = \pageno
6894 \begingroup % Set up to handle contents files properly.
6895 \raggedbottom % Worry more about breakpoints than the bottom.
6896 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6898 % Roman numerals for page numbers.
6899 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6902 % redefined for the two-volume lispref. We always output on
6903 % \jobname.toc even if this is redefined.
6905 \def\tocreadfilename{\jobname.toc}
6907 % Normal (long) toc.
6909 \def\contents{%
6910 \startcontents{\putwordTOC}%
6911 \openin 1 \tocreadfilename\space
6912 \ifeof 1 \else
6913 \readtocfile
6915 \vfill \eject
6916 \contentsalignmacro % in case @setchapternewpage odd is in effect
6917 \ifeof 1 \else
6918 \pdfmakeoutlines
6920 \closein 1
6921 \endgroup
6922 \lastnegativepageno = \pageno
6923 \global\pageno = \savepageno
6926 % And just the chapters.
6927 \def\summarycontents{%
6928 \startcontents{\putwordShortTOC}%
6930 \let\partentry = \shortpartentry
6931 \let\numchapentry = \shortchapentry
6932 \let\appentry = \shortchapentry
6933 \let\unnchapentry = \shortunnchapentry
6934 % We want a true roman here for the page numbers.
6935 \secfonts
6936 \let\rm=\shortcontrm \let\bf=\shortcontbf
6937 \let\sl=\shortcontsl \let\tt=\shortconttt
6939 \hyphenpenalty = 10000
6940 \advance\baselineskip by 1pt % Open it up a little.
6941 \def\numsecentry##1##2##3##4{}
6942 \let\appsecentry = \numsecentry
6943 \let\unnsecentry = \numsecentry
6944 \let\numsubsecentry = \numsecentry
6945 \let\appsubsecentry = \numsecentry
6946 \let\unnsubsecentry = \numsecentry
6947 \let\numsubsubsecentry = \numsecentry
6948 \let\appsubsubsecentry = \numsecentry
6949 \let\unnsubsubsecentry = \numsecentry
6950 \openin 1 \tocreadfilename\space
6951 \ifeof 1 \else
6952 \readtocfile
6954 \closein 1
6955 \vfill \eject
6956 \contentsalignmacro % in case @setchapternewpage odd is in effect
6957 \endgroup
6958 \lastnegativepageno = \pageno
6959 \global\pageno = \savepageno
6961 \let\shortcontents = \summarycontents
6963 % Typeset the label for a chapter or appendix for the short contents.
6964 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6966 \def\shortchaplabel#1{%
6967 % This space should be enough, since a single number is .5em, and the
6968 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6969 % But use \hss just in case.
6970 % (This space doesn't include the extra space that gets added after
6971 % the label; that gets put in by \shortchapentry above.)
6973 % We'd like to right-justify chapter numbers, but that looks strange
6974 % with appendix letters. And right-justifying numbers and
6975 % left-justifying letters looks strange when there is less than 10
6976 % chapters. Have to read the whole toc once to know how many chapters
6977 % there are before deciding ...
6978 \hbox to 1em{#1\hss}%
6981 % These macros generate individual entries in the table of contents.
6982 % The first argument is the chapter or section name.
6983 % The last argument is the page number.
6984 % The arguments in between are the chapter number, section number, ...
6986 % Parts, in the main contents. Replace the part number, which doesn't
6987 % exist, with an empty box. Let's hope all the numbers have the same width.
6988 % Also ignore the page number, which is conventionally not printed.
6989 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6990 \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6992 % Parts, in the short toc.
6993 \def\shortpartentry#1#2#3#4{%
6994 \penalty-300
6995 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6996 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6999 % Chapters, in the main contents.
7000 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
7002 % Chapters, in the short toc.
7003 % See comments in \dochapentry re vbox and related settings.
7004 \def\shortchapentry#1#2#3#4{%
7005 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
7008 % Appendices, in the main contents.
7009 % Need the word Appendix, and a fixed-size box.
7011 \def\appendixbox#1{%
7012 % We use M since it's probably the widest letter.
7013 \setbox0 = \hbox{\putwordAppendix{} M}%
7014 \hbox to \wd0{\putwordAppendix{} #1\hss}}
7016 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
7018 % Unnumbered chapters.
7019 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
7020 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
7022 % Sections.
7023 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
7024 \let\appsecentry=\numsecentry
7025 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
7027 % Subsections.
7028 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
7029 \let\appsubsecentry=\numsubsecentry
7030 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
7032 % And subsubsections.
7033 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
7034 \let\appsubsubsecentry=\numsubsubsecentry
7035 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
7037 % This parameter controls the indentation of the various levels.
7038 % Same as \defaultparindent.
7039 \newdimen\tocindent \tocindent = 15pt
7041 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
7042 % page number.
7044 % If the toc has to be broken over pages, we want it to be at chapters
7045 % if at all possible; hence the \penalty.
7046 \def\dochapentry#1#2{%
7047 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
7048 \begingroup
7049 % Move the page numbers slightly to the right
7050 \advance\entryrightmargin by -0.05em
7051 \chapentryfonts
7052 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7053 \endgroup
7054 \nobreak\vskip .25\baselineskip plus.1\baselineskip
7057 \def\dosecentry#1#2{\begingroup
7058 \secentryfonts \leftskip=\tocindent
7059 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7060 \endgroup}
7062 \def\dosubsecentry#1#2{\begingroup
7063 \subsecentryfonts \leftskip=2\tocindent
7064 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7065 \endgroup}
7067 \def\dosubsubsecentry#1#2{\begingroup
7068 \subsubsecentryfonts \leftskip=3\tocindent
7069 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7070 \endgroup}
7072 % We use the same \entry macro as for the index entries.
7073 \let\tocentry = \entry
7075 % Space between chapter (or whatever) number and the title.
7076 \def\labelspace{\hskip1em \relax}
7078 \def\dopageno#1{{\rm #1}}
7079 \def\doshortpageno#1{{\rm #1}}
7081 \def\chapentryfonts{\secfonts \rm}
7082 \def\secentryfonts{\textfonts}
7083 \def\subsecentryfonts{\textfonts}
7084 \def\subsubsecentryfonts{\textfonts}
7087 \message{environments,}
7088 % @foo ... @end foo.
7090 % @tex ... @end tex escapes into raw TeX temporarily.
7091 % One exception: @ is still an escape character, so that @end tex works.
7092 % But \@ or @@ will get a plain @ character.
7094 \envdef\tex{%
7095 \setupmarkupstyle{tex}%
7096 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
7097 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
7098 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
7099 \catcode `\%=14
7100 \catcode `\+=\other
7101 \catcode `\"=\other
7102 \catcode `\|=\other
7103 \catcode `\<=\other
7104 \catcode `\>=\other
7105 \catcode `\`=\other
7106 \catcode `\'=\other
7108 % ' is active in math mode (mathcode"8000). So reset it, and all our
7109 % other math active characters (just in case), to plain's definitions.
7110 \mathactive
7112 % Inverse of the list at the beginning of the file.
7113 \let\b=\ptexb
7114 \let\bullet=\ptexbullet
7115 \let\c=\ptexc
7116 \let\,=\ptexcomma
7117 \let\.=\ptexdot
7118 \let\dots=\ptexdots
7119 \let\equiv=\ptexequiv
7120 \let\!=\ptexexclam
7121 \let\i=\ptexi
7122 \let\indent=\ptexindent
7123 \let\noindent=\ptexnoindent
7124 \let\{=\ptexlbrace
7125 \let\+=\tabalign
7126 \let\}=\ptexrbrace
7127 \let\/=\ptexslash
7128 \let\sp=\ptexsp
7129 \let\*=\ptexstar
7130 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7131 \let\t=\ptext
7132 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7133 \let\frenchspacing=\plainfrenchspacing
7135 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7136 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7137 \def\@{@}%
7139 % There is no need to define \Etex.
7141 % Define @lisp ... @end lisp.
7142 % @lisp environment forms a group so it can rebind things,
7143 % including the definition of @end lisp (which normally is erroneous).
7145 % Amount to narrow the margins by for @lisp.
7146 \newskip\lispnarrowing \lispnarrowing=0.4in
7148 % This is the definition that ^^M gets inside @lisp, @example, and other
7149 % such environments. \null is better than a space, since it doesn't
7150 % have any width.
7151 \def\lisppar{\null\endgraf}
7153 % This space is always present above and below environments.
7154 \newskip\envskipamount \envskipamount = 0pt
7156 % Make spacing and below environment symmetrical. We use \parskip here
7157 % to help in doing that, since in @example-like environments \parskip
7158 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7159 % start of the next paragraph will insert \parskip.
7161 \def\aboveenvbreak{{%
7162 % =10000 instead of <10000 because of a special case in \itemzzz and
7163 % \sectionheading, q.v.
7164 \ifnum \lastpenalty=10000 \else
7165 \advance\envskipamount by \parskip
7166 \endgraf
7167 \ifdim\lastskip<\envskipamount
7168 \removelastskip
7169 \ifnum\lastpenalty<10000
7170 % Penalize breaking before the environment, because preceding text
7171 % often leads into it.
7172 \penalty100
7174 \vskip\envskipamount
7179 \def\afterenvbreak{{%
7180 % =10000 instead of <10000 because of a special case in \itemzzz and
7181 % \sectionheading, q.v.
7182 \ifnum \lastpenalty=10000 \else
7183 \advance\envskipamount by \parskip
7184 \endgraf
7185 \ifdim\lastskip<\envskipamount
7186 \removelastskip
7187 % it's not a good place to break if the last penalty was \nobreak
7188 % or better ...
7189 \ifnum\lastpenalty<10000 \penalty-50 \fi
7190 \vskip\envskipamount
7195 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7196 % also clear it, so that its embedded environments do the narrowing again.
7197 \let\nonarrowing=\relax
7199 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7200 % environment contents.
7201 \font\circle=lcircle10
7202 \newdimen\circthick
7203 \newdimen\cartouter\newdimen\cartinner
7204 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7205 \circthick=\fontdimen8\circle
7207 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7208 \def\ctr{{\hskip 6pt\circle\char'010}}
7209 \def\cbl{{\circle\char'012\hskip -6pt}}
7210 \def\cbr{{\hskip 6pt\circle\char'011}}
7211 \def\carttop{\hbox to \cartouter{\hskip\lskip
7212 \ctl\leaders\hrule height\circthick\hfil\ctr
7213 \hskip\rskip}}
7214 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7215 \cbl\leaders\hrule height\circthick\hfil\cbr
7216 \hskip\rskip}}
7218 \newskip\lskip\newskip\rskip
7220 \envdef\cartouche{%
7221 \ifhmode\par\fi % can't be in the midst of a paragraph.
7222 \startsavinginserts
7223 \lskip=\leftskip \rskip=\rightskip
7224 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7225 \cartinner=\hsize \advance\cartinner by-\lskip
7226 \advance\cartinner by-\rskip
7227 \cartouter=\hsize
7228 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
7229 % side, and for 6pt waste from
7230 % each corner char, and rule thickness
7231 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7233 % If this cartouche directly follows a sectioning command, we need the
7234 % \parskip glue (backspaced over by default) or the cartouche can
7235 % collide with the section heading.
7236 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7238 \setbox\groupbox=\vbox\bgroup
7239 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7240 \carttop
7241 \hbox\bgroup
7242 \hskip\lskip
7243 \vrule\kern3pt
7244 \vbox\bgroup
7245 \kern3pt
7246 \hsize=\cartinner
7247 \baselineskip=\normbskip
7248 \lineskip=\normlskip
7249 \parskip=\normpskip
7250 \vskip -\parskip
7251 \comment % For explanation, see the end of def\group.
7253 \def\Ecartouche{%
7254 \ifhmode\par\fi
7255 \kern3pt
7256 \egroup
7257 \kern3pt\vrule
7258 \hskip\rskip
7259 \egroup
7260 \cartbot
7261 \egroup
7262 \addgroupbox
7263 \checkinserts
7267 % This macro is called at the beginning of all the @example variants,
7268 % inside a group.
7269 \newdimen\nonfillparindent
7270 \def\nonfillstart{%
7271 \aboveenvbreak
7272 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7273 \sepspaces % Make spaces be word-separators rather than space tokens.
7274 \let\par = \lisppar % don't ignore blank lines
7275 \obeylines % each line of input is a line of output
7276 \parskip = 0pt
7277 % Turn off paragraph indentation but redefine \indent to emulate
7278 % the normal \indent.
7279 \nonfillparindent=\parindent
7280 \parindent = 0pt
7281 \let\indent\nonfillindent
7283 \emergencystretch = 0pt % don't try to avoid overfull boxes
7284 \ifx\nonarrowing\relax
7285 \advance \leftskip by \lispnarrowing
7286 \exdentamount=\lispnarrowing
7287 \else
7288 \let\nonarrowing = \relax
7290 \let\exdent=\nofillexdent
7293 \begingroup
7294 \obeyspaces
7295 % We want to swallow spaces (but not other tokens) after the fake
7296 % @indent in our nonfill-environments, where spaces are normally
7297 % active and set to @tie, resulting in them not being ignored after
7298 % @indent.
7299 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7300 \gdef\nonfillindentcheck{%
7301 \ifx\temp %
7302 \expandafter\nonfillindentgobble%
7303 \else%
7304 \leavevmode\nonfillindentbox%
7305 \fi%
7307 \endgroup
7308 \def\nonfillindentgobble#1{\nonfillindent}
7309 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7311 % If you want all examples etc. small: @set dispenvsize small.
7312 % If you want even small examples the full size: @set dispenvsize nosmall.
7313 % This affects the following displayed environments:
7314 % @example, @display, @format, @lisp
7316 \def\smallword{small}
7317 \def\nosmallword{nosmall}
7318 \let\SETdispenvsize\relax
7319 \def\setnormaldispenv{%
7320 \ifx\SETdispenvsize\smallword
7321 % end paragraph for sake of leading, in case document has no blank
7322 % line. This is redundant with what happens in \aboveenvbreak, but
7323 % we need to do it before changing the fonts, and it's inconvenient
7324 % to change the fonts afterward.
7325 \ifnum \lastpenalty=10000 \else \endgraf \fi
7326 \smallexamplefonts \rm
7329 \def\setsmalldispenv{%
7330 \ifx\SETdispenvsize\nosmallword
7331 \else
7332 \ifnum \lastpenalty=10000 \else \endgraf \fi
7333 \smallexamplefonts \rm
7337 % We often define two environments, @foo and @smallfoo.
7338 % Let's do it in one command. #1 is the env name, #2 the definition.
7339 \def\makedispenvdef#1#2{%
7340 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7341 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7342 \expandafter\let\csname E#1\endcsname \afterenvbreak
7343 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7346 % Define two environment synonyms (#1 and #2) for an environment.
7347 \def\maketwodispenvdef#1#2#3{%
7348 \makedispenvdef{#1}{#3}%
7349 \makedispenvdef{#2}{#3}%
7352 % @lisp: indented, narrowed, typewriter font;
7353 % @example: same as @lisp.
7355 % @smallexample and @smalllisp: use smaller fonts.
7356 % Originally contributed by Pavel@xerox.
7358 \maketwodispenvdef{lisp}{example}{%
7359 \nonfillstart
7360 \tt\setupmarkupstyle{example}%
7361 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7362 \gobble % eat return
7364 % @display/@smalldisplay: same as @lisp except keep current font.
7366 \makedispenvdef{display}{%
7367 \nonfillstart
7368 \gobble
7371 % @format/@smallformat: same as @display except don't narrow margins.
7373 \makedispenvdef{format}{%
7374 \let\nonarrowing = t%
7375 \nonfillstart
7376 \gobble
7379 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7380 \envdef\flushleft{%
7381 \let\nonarrowing = t%
7382 \nonfillstart
7383 \gobble
7385 \let\Eflushleft = \afterenvbreak
7387 % @flushright.
7389 \envdef\flushright{%
7390 \let\nonarrowing = t%
7391 \nonfillstart
7392 \advance\leftskip by 0pt plus 1fill\relax
7393 \gobble
7395 \let\Eflushright = \afterenvbreak
7398 % @raggedright does more-or-less normal line breaking but no right
7399 % justification. From plain.tex. Don't stretch around special
7400 % characters in urls in this environment, since the stretch at the right
7401 % should be enough.
7402 \envdef\raggedright{%
7403 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7404 \def\urefprestretchamount{0pt}%
7405 \def\urefpoststretchamount{0pt}%
7407 \let\Eraggedright\par
7409 \envdef\raggedleft{%
7410 \parindent=0pt \leftskip0pt plus2em
7411 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7412 \hbadness=10000 % Last line will usually be underfull, so turn off
7413 % badness reporting.
7415 \let\Eraggedleft\par
7417 \envdef\raggedcenter{%
7418 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
7419 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7420 \hbadness=10000 % Last line will usually be underfull, so turn off
7421 % badness reporting.
7423 \let\Eraggedcenter\par
7426 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7427 % and narrows the margins. We keep \parskip nonzero in general, since
7428 % we're doing normal filling. So, when using \aboveenvbreak and
7429 % \afterenvbreak, temporarily make \parskip 0.
7431 \makedispenvdef{quotation}{\quotationstart}
7433 \def\quotationstart{%
7434 \indentedblockstart % same as \indentedblock, but increase right margin too.
7435 \ifx\nonarrowing\relax
7436 \advance\rightskip by \lispnarrowing
7438 \parsearg\quotationlabel
7441 % We have retained a nonzero parskip for the environment, since we're
7442 % doing normal filling.
7444 \def\Equotation{%
7445 \par
7446 \ifx\quotationauthor\thisisundefined\else
7447 % indent a bit.
7448 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7450 {\parskip=0pt \afterenvbreak}%
7452 \def\Esmallquotation{\Equotation}
7454 % If we're given an argument, typeset it in bold with a colon after.
7455 \def\quotationlabel#1{%
7456 \def\temp{#1}%
7457 \ifx\temp\empty \else
7458 {\bf #1: }%
7462 % @indentedblock is like @quotation, but indents only on the left and
7463 % has no optional argument.
7465 \makedispenvdef{indentedblock}{\indentedblockstart}
7467 \def\indentedblockstart{%
7468 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7469 \parindent=0pt
7471 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7472 \ifx\nonarrowing\relax
7473 \advance\leftskip by \lispnarrowing
7474 \exdentamount = \lispnarrowing
7475 \else
7476 \let\nonarrowing = \relax
7480 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7482 \def\Eindentedblock{%
7483 \par
7484 {\parskip=0pt \afterenvbreak}%
7486 \def\Esmallindentedblock{\Eindentedblock}
7489 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7490 % If we want to allow any <char> as delimiter,
7491 % we need the curly braces so that makeinfo sees the @verb command, eg:
7492 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7494 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7496 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7497 % active too. Otherwise, they get lost as the first character on a
7498 % verbatim line.
7499 \def\dospecials{%
7500 \do\ \do\\\do\{\do\}\do\$\do\&%
7501 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7502 \do\<\do\>\do\|\do\@\do+\do\"%
7503 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7504 % @set txicodequotebacktick will not have effect on @verb and
7505 % @verbatim, and ?` and !` ligatures won't get disabled.
7506 %\do\`\do\'%
7509 % [Knuth] p. 380
7510 \def\uncatcodespecials{%
7511 \def\do##1{\catcode`##1=\other}\dospecials}
7513 % Setup for the @verb command.
7515 % Eight spaces for a tab
7516 \begingroup
7517 \catcode`\^^I=\active
7518 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7519 \endgroup
7521 \def\setupverb{%
7522 \tt % easiest (and conventionally used) font for verbatim
7523 \def\par{\leavevmode\endgraf}%
7524 \setupmarkupstyle{verb}%
7525 \tabeightspaces
7526 % Respect line breaks,
7527 % print special symbols as themselves, and
7528 % make each space count
7529 % must do in this order:
7530 \obeylines \uncatcodespecials \sepspaces
7533 % Setup for the @verbatim environment
7535 % Real tab expansion.
7536 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7538 % We typeset each line of the verbatim in an \hbox, so we can handle
7539 % tabs. The \global is in case the verbatim line starts with an accent,
7540 % or some other command that starts with a begin-group. Otherwise, the
7541 % entire \verbbox would disappear at the corresponding end-group, before
7542 % it is typeset. Meanwhile, we can't have nested verbatim commands
7543 % (can we?), so the \global won't be overwriting itself.
7544 \newbox\verbbox
7545 \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
7547 \begingroup
7548 \catcode`\^^I=\active
7549 \gdef\tabexpand{%
7550 \catcode`\^^I=\active
7551 \def^^I{\leavevmode\egroup
7552 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7553 \divide\dimen\verbbox by\tabw
7554 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7555 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7556 \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
7559 \endgroup
7561 % start the verbatim environment.
7562 \def\setupverbatim{%
7563 \let\nonarrowing = t%
7564 \nonfillstart
7565 \tt % easiest (and conventionally used) font for verbatim
7566 % The \leavevmode here is for blank lines. Otherwise, we would
7567 % never \starttabox and the \egroup would end verbatim mode.
7568 \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
7569 \tabexpand
7570 \setupmarkupstyle{verbatim}%
7571 % Respect line breaks,
7572 % print special symbols as themselves, and
7573 % make each space count.
7574 % Must do in this order:
7575 \obeylines \uncatcodespecials \sepspaces
7576 \everypar{\starttabbox}%
7579 % Do the @verb magic: verbatim text is quoted by unique
7580 % delimiter characters. Before first delimiter expect a
7581 % right brace, after last delimiter expect closing brace:
7583 % \def\doverb'{'<char>#1<char>'}'{#1}
7585 % [Knuth] p. 382; only eat outer {}
7586 \begingroup
7587 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7588 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7589 \endgroup
7591 \def\verb{\begingroup\setupverb\doverb}
7594 % Do the @verbatim magic: define the macro \doverbatim so that
7595 % the (first) argument ends when '@end verbatim' is reached, ie:
7597 % \def\doverbatim#1@end verbatim{#1}
7599 % For Texinfo it's a lot easier than for LaTeX,
7600 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7601 % we need not redefine '\', '{' and '}'.
7603 % Inspired by LaTeX's verbatim command set [latex.ltx]
7605 \begingroup
7606 \catcode`\ =\active
7607 \obeylines %
7608 % ignore everything up to the first ^^M, that's the newline at the end
7609 % of the @verbatim input line itself. Otherwise we get an extra blank
7610 % line in the output.
7611 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
7612 % We really want {...\end verbatim} in the body of the macro, but
7613 % without the active space; thus we have to use \xdef and \gobble.
7614 \endgroup
7616 \envdef\verbatim{%
7617 \setupverbatim\doverbatim
7619 \let\Everbatim = \afterenvbreak
7622 % @verbatiminclude FILE - insert text of file in verbatim environment.
7624 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7626 \def\doverbatiminclude#1{%
7628 \makevalueexpandable
7629 \setupverbatim
7630 \indexnofonts % Allow `@@' and other weird things in file names.
7631 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7632 \input #1
7633 \afterenvbreak
7637 % @copying ... @end copying.
7638 % Save the text away for @insertcopying later.
7640 % We save the uninterpreted tokens, rather than creating a box.
7641 % Saving the text in a box would be much easier, but then all the
7642 % typesetting commands (@smallbook, font changes, etc.) have to be done
7643 % beforehand -- and a) we want @copying to be done first in the source
7644 % file; b) letting users define the frontmatter in as flexible order as
7645 % possible is desirable.
7647 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7648 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7650 \def\insertcopying{%
7651 \begingroup
7652 \parindent = 0pt % paragraph indentation looks wrong on title page
7653 \scanexp\copyingtext
7654 \endgroup
7658 \message{defuns,}
7659 % @defun etc.
7661 \newskip\defbodyindent \defbodyindent=.4in
7662 \newskip\defargsindent \defargsindent=50pt
7663 \newskip\deflastargmargin \deflastargmargin=18pt
7664 \newcount\defunpenalty
7666 % Start the processing of @deffn:
7667 \def\startdefun{%
7668 \ifnum\lastpenalty<10000
7669 \medbreak
7670 \defunpenalty=10003 % Will keep this @deffn together with the
7671 % following @def command, see below.
7672 \else
7673 % If there are two @def commands in a row, we'll have a \nobreak,
7674 % which is there to keep the function description together with its
7675 % header. But if there's nothing but headers, we need to allow a
7676 % break somewhere. Check specifically for penalty 10002, inserted
7677 % by \printdefunline, instead of 10000, since the sectioning
7678 % commands also insert a nobreak penalty, and we don't want to allow
7679 % a break between a section heading and a defun.
7681 % As a further refinement, we avoid "club" headers by signalling
7682 % with penalty of 10003 after the very first @deffn in the
7683 % sequence (see above), and penalty of 10002 after any following
7684 % @def command.
7685 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7687 % Similarly, after a section heading, do not allow a break.
7688 % But do insert the glue.
7689 \medskip % preceded by discardable penalty, so not a breakpoint
7692 \parindent=0in
7693 \advance\leftskip by \defbodyindent
7694 \exdentamount=\defbodyindent
7697 \def\dodefunx#1{%
7698 % First, check whether we are in the right environment:
7699 \checkenv#1%
7701 % As above, allow line break if we have multiple x headers in a row.
7702 % It's not a great place, though.
7703 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7705 % And now, it's time to reuse the body of the original defun:
7706 \expandafter\gobbledefun#1%
7708 \def\gobbledefun#1\startdefun{}
7710 % \printdefunline \deffnheader{text}
7712 \def\printdefunline#1#2{%
7713 \begingroup
7714 % call \deffnheader:
7715 #1#2 \endheader
7716 % common ending:
7717 \interlinepenalty = 10000
7718 \advance\rightskip by 0pt plus 1fil\relax
7719 \endgraf
7720 \nobreak\vskip -\parskip
7721 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7722 % Some of the @defun-type tags do not enable magic parentheses,
7723 % rendering the following check redundant. But we don't optimize.
7724 \checkparencounts
7725 \endgroup
7728 \def\Edefun{\endgraf\medbreak}
7730 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7731 % the only thing remaining is to define \deffnheader.
7733 \def\makedefun#1{%
7734 \expandafter\let\csname E#1\endcsname = \Edefun
7735 \edef\temp{\noexpand\domakedefun
7736 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7737 \temp
7740 % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7742 % Define \deffn and \deffnx, without parameters.
7743 % \deffnheader has to be defined explicitly.
7745 \def\domakedefun#1#2#3{%
7746 \envdef#1{%
7747 \startdefun
7748 \doingtypefnfalse % distinguish typed functions from all else
7749 \parseargusing\activeparens{\printdefunline#3}%
7751 \def#2{\dodefunx#1}%
7752 \def#3%
7755 \newif\ifdoingtypefn % doing typed function?
7756 \newif\ifrettypeownline % typeset return type on its own line?
7758 % @deftypefnnewline on|off says whether the return type of typed functions
7759 % are printed on their own line. This affects @deftypefn, @deftypefun,
7760 % @deftypeop, and @deftypemethod.
7762 \parseargdef\deftypefnnewline{%
7763 \def\temp{#1}%
7764 \ifx\temp\onword
7765 \expandafter\let\csname SETtxideftypefnnl\endcsname
7766 = \empty
7767 \else\ifx\temp\offword
7768 \expandafter\let\csname SETtxideftypefnnl\endcsname
7769 = \relax
7770 \else
7771 \errhelp = \EMsimple
7772 \errmessage{Unknown @txideftypefnnl value `\temp',
7773 must be on|off}%
7774 \fi\fi
7777 % Untyped functions:
7779 % @deffn category name args
7780 \makedefun{deffn}{\deffngeneral{}}
7782 % @deffn category class name args
7783 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7785 % \defopon {category on}class name args
7786 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7788 % \deffngeneral {subind}category name args
7790 \def\deffngeneral#1#2 #3 #4\endheader{%
7791 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
7792 \dosubind{fn}{\code{#3}}{#1}%
7793 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7796 % Typed functions:
7798 % @deftypefn category type name args
7799 \makedefun{deftypefn}{\deftypefngeneral{}}
7801 % @deftypeop category class type name args
7802 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7804 % \deftypeopon {category on}class type name args
7805 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7807 % \deftypefngeneral {subind}category type name args
7809 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7810 \dosubind{fn}{\code{#4}}{#1}%
7811 \doingtypefntrue
7812 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7815 % Typed variables:
7817 % @deftypevr category type var args
7818 \makedefun{deftypevr}{\deftypecvgeneral{}}
7820 % @deftypecv category class type var args
7821 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7823 % \deftypecvof {category of}class type var args
7824 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7826 % \deftypecvgeneral {subind}category type var args
7828 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7829 \dosubind{vr}{\code{#4}}{#1}%
7830 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7833 % Untyped variables:
7835 % @defvr category var args
7836 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7838 % @defcv category class var args
7839 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7841 % \defcvof {category of}class var args
7842 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7844 % Types:
7846 % @deftp category name args
7847 \makedefun{deftp}#1 #2 #3\endheader{%
7848 \doind{tp}{\code{#2}}%
7849 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7852 % Remaining @defun-like shortcuts:
7853 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7854 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7855 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7856 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7857 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7858 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7859 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7860 \makedefun{defmethod}{\defopon\putwordMethodon}
7861 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7862 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7863 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7865 % \defname, which formats the name of the @def (not the args).
7866 % #1 is the category, such as "Function".
7867 % #2 is the return type, if any.
7868 % #3 is the function name.
7870 % We are followed by (but not passed) the arguments, if any.
7872 \def\defname#1#2#3{%
7873 \par
7874 % Get the values of \leftskip and \rightskip as they were outside the @def...
7875 \advance\leftskip by -\defbodyindent
7877 % Determine if we are typesetting the return type of a typed function
7878 % on a line by itself.
7879 \rettypeownlinefalse
7880 \ifdoingtypefn % doing a typed function specifically?
7881 % then check user option for putting return type on its own line:
7882 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7883 \rettypeownlinetrue
7887 % How we'll format the category name. Putting it in brackets helps
7888 % distinguish it from the body text that may end up on the next line
7889 % just below it.
7890 \def\temp{#1}%
7891 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7893 % Figure out line sizes for the paragraph shape. We'll always have at
7894 % least two.
7895 \tempnum = 2
7897 % The first line needs space for \box0; but if \rightskip is nonzero,
7898 % we need only space for the part of \box0 which exceeds it:
7899 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7901 % If doing a return type on its own line, we'll have another line.
7902 \ifrettypeownline
7903 \advance\tempnum by 1
7904 \def\maybeshapeline{0in \hsize}%
7905 \else
7906 \def\maybeshapeline{}%
7909 % The continuations:
7910 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7912 % The final paragraph shape:
7913 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7915 % Put the category name at the right margin.
7916 \noindent
7917 \hbox to 0pt{%
7918 \hfil\box0 \kern-\hsize
7919 % \hsize has to be shortened this way:
7920 \kern\leftskip
7921 % Intentionally do not respect \rightskip, since we need the space.
7924 % Allow all lines to be underfull without complaint:
7925 \tolerance=10000 \hbadness=10000
7926 \exdentamount=\defbodyindent
7928 % defun fonts. We use typewriter by default (used to be bold) because:
7929 % . we're printing identifiers, they should be in tt in principle.
7930 % . in languages with many accents, such as Czech or French, it's
7931 % common to leave accents off identifiers. The result looks ok in
7932 % tt, but exceedingly strange in rm.
7933 % . we don't want -- and --- to be treated as ligatures.
7934 % . this still does not fix the ?` and !` ligatures, but so far no
7935 % one has made identifiers using them :).
7936 \df \tt
7937 \def\temp{#2}% text of the return type
7938 \ifx\temp\empty\else
7939 \tclose{\temp}% typeset the return type
7940 \ifrettypeownline
7941 % put return type on its own line; prohibit line break following:
7942 \hfil\vadjust{\nobreak}\break
7943 \else
7944 \space % type on same line, so just followed by a space
7946 \fi % no return type
7947 #3% output function name
7949 {\rm\enskip}% hskip 0.5 em of \tenrm
7951 \boldbrax
7952 % arguments will be output next, if any.
7955 % Print arguments in slanted roman (not ttsl), inconsistently with using
7956 % tt for the name. This is because literal text is sometimes needed in
7957 % the argument list (groff manual), and ttsl and tt are not very
7958 % distinguishable. Prevent hyphenation at `-' chars.
7960 \def\defunargs#1{%
7961 % use sl by default (not ttsl),
7962 % tt for the names.
7963 \df \sl \hyphenchar\font=0
7965 % On the other hand, if an argument has two dashes (for instance), we
7966 % want a way to get ttsl. We used to recommend @var for that, so
7967 % leave the code in, but it's strange for @var to lead to typewriter.
7968 % Nowadays we recommend @code, since the difference between a ttsl hyphen
7969 % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7970 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7972 \sl\hyphenchar\font=45
7975 % We want ()&[] to print specially on the defun line.
7977 \def\activeparens{%
7978 \catcode`\(=\active \catcode`\)=\active
7979 \catcode`\[=\active \catcode`\]=\active
7980 \catcode`\&=\active
7983 % Make control sequences which act like normal parenthesis chars.
7984 \let\lparen = ( \let\rparen = )
7986 % Be sure that we always have a definition for `(', etc. For example,
7987 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7988 % so TeX would otherwise complain about undefined control sequence.
7990 \activeparens
7991 \global\let(=\lparen \global\let)=\rparen
7992 \global\let[=\lbrack \global\let]=\rbrack
7993 \global\let& = \&
7995 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7996 \gdef\magicamp{\let&=\amprm}
7999 \newcount\parencount
8001 % If we encounter &foo, then turn on ()-hacking afterwards
8002 \newif\ifampseen
8003 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
8005 \def\parenfont{%
8006 \ifampseen
8007 % At the first level, print parens in roman,
8008 % otherwise use the default font.
8009 \ifnum \parencount=1 \rm \fi
8010 \else
8011 % The \sf parens (in \boldbrax) actually are a little bolder than
8012 % the contained text. This is especially needed for [ and ] .
8016 \def\infirstlevel#1{%
8017 \ifampseen
8018 \ifnum\parencount=1
8023 \def\bfafterword#1 {#1 \bf}
8025 \def\opnr{%
8026 \global\advance\parencount by 1
8027 {\parenfont(}%
8028 \infirstlevel \bfafterword
8030 \def\clnr{%
8031 {\parenfont)}%
8032 \infirstlevel \sl
8033 \global\advance\parencount by -1
8036 \newcount\brackcount
8037 \def\lbrb{%
8038 \global\advance\brackcount by 1
8039 {\bf[}%
8041 \def\rbrb{%
8042 {\bf]}%
8043 \global\advance\brackcount by -1
8046 \def\checkparencounts{%
8047 \ifnum\parencount=0 \else \badparencount \fi
8048 \ifnum\brackcount=0 \else \badbrackcount \fi
8050 % these should not use \errmessage; the glibc manual, at least, actually
8051 % has such constructs (when documenting function pointers).
8052 \def\badparencount{%
8053 \message{Warning: unbalanced parentheses in @def...}%
8054 \global\parencount=0
8056 \def\badbrackcount{%
8057 \message{Warning: unbalanced square brackets in @def...}%
8058 \global\brackcount=0
8062 \message{macros,}
8063 % @macro.
8065 % To do this right we need a feature of e-TeX, \scantokens,
8066 % which we arrange to emulate with a temporary file in ordinary TeX.
8067 \ifx\eTeXversion\thisisundefined
8068 \newwrite\macscribble
8069 \def\scantokens#1{%
8070 \toks0={#1}%
8071 \immediate\openout\macscribble=\jobname.tmp
8072 \immediate\write\macscribble{\the\toks0}%
8073 \immediate\closeout\macscribble
8074 \input \jobname.tmp
8078 \let\aftermacroxxx\relax
8079 \def\aftermacro{\aftermacroxxx}
8081 % alias because \c means cedilla in @tex or @math
8082 \let\texinfoc=\c
8084 \newcount\savedcatcodeone
8085 \newcount\savedcatcodetwo
8087 % Used at the time of macro expansion.
8088 % Argument is macro body with arguments substituted
8089 \def\scanmacro#1{%
8090 \newlinechar`\^^M
8091 \def\xeatspaces{\eatspaces}%
8093 % Temporarily undo catcode changes of \printindex. Set catcode of @ to
8094 % 0 so that @-commands in macro expansions aren't printed literally when
8095 % formatting an index file, where \ is used as the escape character.
8096 \savedcatcodeone=\catcode`\@
8097 \savedcatcodetwo=\catcode`\\
8098 \catcode`\@=0
8099 \catcode`\\=\active
8101 % Process the macro body under the current catcode regime.
8102 \scantokens{#1@texinfoc}\aftermacro%
8104 \catcode`\@=\savedcatcodeone
8105 \catcode`\\=\savedcatcodetwo
8107 % The \texinfoc is to remove the \newlinechar added by \scantokens, and
8108 % can be noticed by \parsearg.
8109 % The \aftermacro allows a \comment at the end of the macro definition
8110 % to duplicate itself past the final \newlinechar added by \scantokens:
8111 % this is used in the definition of \group to comment out a newline. We
8112 % don't do the same for \c to support Texinfo files with macros that ended
8113 % with a @c, which should no longer be necessary.
8114 % We avoid surrounding the call to \scantokens with \bgroup and \egroup
8115 % to allow macros to open or close groups themselves.
8118 % Used for copying and captions
8119 \def\scanexp#1{%
8120 \expandafter\scanmacro\expandafter{#1}%
8123 \newcount\paramno % Count of parameters
8124 \newtoks\macname % Macro name
8125 \newif\ifrecursive % Is it recursive?
8127 % List of all defined macros in the form
8128 % \commondummyword\macro1\commondummyword\macro2...
8129 % Currently is also contains all @aliases; the list can be split
8130 % if there is a need.
8131 \def\macrolist{}
8133 % Add the macro to \macrolist
8134 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
8135 \def\addtomacrolistxxx#1{%
8136 \toks0 = \expandafter{\macrolist\commondummyword#1}%
8137 \xdef\macrolist{\the\toks0}%
8140 % Utility routines.
8141 % This does \let #1 = #2, with \csnames; that is,
8142 % \let \csname#1\endcsname = \csname#2\endcsname
8143 % (except of course we have to play expansion games).
8145 \def\cslet#1#2{%
8146 \expandafter\let
8147 \csname#1\expandafter\endcsname
8148 \csname#2\endcsname
8151 % Trim leading and trailing spaces off a string.
8152 % Concepts from aro-bend problem 15 (see CTAN).
8153 {\catcode`\@=11
8154 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
8155 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
8156 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
8157 \def\unbrace#1{#1}
8158 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
8161 % Trim a single trailing ^^M off a string.
8162 {\catcode`\^^M=\other \catcode`\Q=3%
8163 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8164 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8165 \gdef\eatcrb#1Q#2Q{#1}%
8168 % Macro bodies are absorbed as an argument in a context where
8169 % all characters are catcode 10, 11 or 12, except \ which is active
8170 % (as in normal texinfo). It is necessary to change the definition of \
8171 % to recognize macro arguments; this is the job of \mbodybackslash.
8173 % Non-ASCII encodings make 8-bit characters active, so un-activate
8174 % them to avoid their expansion. Must do this non-globally, to
8175 % confine the change to the current group.
8177 % It's necessary to have hard CRs when the macro is executed. This is
8178 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8179 % body, and then making it the \newlinechar in \scanmacro.
8181 \def\scanctxt{% used as subroutine
8182 \catcode`\"=\other
8183 \catcode`\+=\other
8184 \catcode`\<=\other
8185 \catcode`\>=\other
8186 \catcode`\^=\other
8187 \catcode`\_=\other
8188 \catcode`\|=\other
8189 \catcode`\~=\other
8190 \passthroughcharstrue
8193 \def\scanargctxt{% used for copying and captions, not macros.
8194 \scanctxt
8195 \catcode`\@=\other
8196 \catcode`\\=\other
8197 \catcode`\^^M=\other
8200 \def\macrobodyctxt{% used for @macro definitions
8201 \scanctxt
8202 \catcode`\ =\other
8203 \catcode`\@=\other
8204 \catcode`\{=\other
8205 \catcode`\}=\other
8206 \catcode`\^^M=\other
8207 \usembodybackslash
8210 % Used when scanning braced macro arguments. Note, however, that catcode
8211 % changes here are ineffectual if the macro invocation was nested inside
8212 % an argument to another Texinfo command.
8213 \def\macroargctxt{%
8214 \scanctxt
8215 \catcode`\ =\active
8216 \catcode`\^^M=\other
8217 \catcode`\\=\active
8220 \def\macrolineargctxt{% used for whole-line arguments without braces
8221 \scanctxt
8222 \catcode`\{=\other
8223 \catcode`\}=\other
8226 % \mbodybackslash is the definition of \ in @macro bodies.
8227 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8228 % where N is the macro parameter number.
8229 % We define \csname macarg.\endcsname to be \realbackslash, so
8230 % \\ in macro replacement text gets you a backslash.
8232 {\catcode`@=0 @catcode`@\=@active
8233 @gdef@usembodybackslash{@let\=@mbodybackslash}
8234 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8236 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8238 \def\margbackslash#1{\char`\#1 }
8240 \def\macro{\recursivefalse\parsearg\macroxxx}
8241 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8243 \def\macroxxx#1{%
8244 \getargs{#1}% now \macname is the macname and \argl the arglist
8245 \ifx\argl\empty % no arguments
8246 \paramno=0\relax
8247 \else
8248 \expandafter\parsemargdef \argl;%
8249 \if\paramno>256\relax
8250 \ifx\eTeXversion\thisisundefined
8251 \errhelp = \EMsimple
8252 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8256 \if1\csname ismacro.\the\macname\endcsname
8257 \message{Warning: redefining \the\macname}%
8258 \else
8259 \expandafter\ifx\csname \the\macname\endcsname \relax
8260 \else \errmessage{Macro name \the\macname\space already defined}\fi
8261 \global\cslet{macsave.\the\macname}{\the\macname}%
8262 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8263 \addtomacrolist{\the\macname}%
8265 \begingroup \macrobodyctxt
8266 \ifrecursive \expandafter\parsermacbody
8267 \else \expandafter\parsemacbody
8268 \fi}
8270 \parseargdef\unmacro{%
8271 \if1\csname ismacro.#1\endcsname
8272 \global\cslet{#1}{macsave.#1}%
8273 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8274 % Remove the macro name from \macrolist:
8275 \begingroup
8276 \expandafter\let\csname#1\endcsname \relax
8277 \let\commondummyword\unmacrodo
8278 \xdef\macrolist{\macrolist}%
8279 \endgroup
8280 \else
8281 \errmessage{Macro #1 not defined}%
8285 % Called by \do from \dounmacro on each macro. The idea is to omit any
8286 % macro definitions that have been changed to \relax.
8288 \def\unmacrodo#1{%
8289 \ifx #1\relax
8290 % remove this
8291 \else
8292 \noexpand\commondummyword \noexpand#1%
8296 % \getargs -- Parse the arguments to a @macro line. Set \macname to
8297 % the name of the macro, and \argl to the braced argument list.
8298 \def\getargs#1{\getargsxxx#1{}}
8299 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8300 \def\getmacname#1 #2\relax{\macname={#1}}
8301 \def\getmacargs#1{\def\argl{#1}}
8302 % This made use of the feature that if the last token of a
8303 % <parameter list> is #, then the preceding argument is delimited by
8304 % an opening brace, and that opening brace is not consumed.
8306 % Parse the optional {params} list to @macro or @rmacro.
8307 % Set \paramno to the number of arguments,
8308 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8309 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
8310 % list to some hook where the argument is to be expanded. If there are
8311 % less than 10 arguments that hook is to be replaced by ##N where N
8312 % is the position in that list, that is to say the macro arguments are to be
8313 % defined `a la TeX in the macro body.
8315 % That gets used by \mbodybackslash (above).
8317 % If there are 10 or more arguments, a different technique is used: see
8318 % \parsemmanyargdef.
8320 \def\parsemargdef#1;{%
8321 \paramno=0\def\paramlist{}%
8322 \let\hash\relax
8323 % \hash is redefined to `#' later to get it into definitions
8324 \let\xeatspaces\relax
8325 \parsemargdefxxx#1,;,%
8326 \ifnum\paramno<10\relax\else
8327 \paramno0\relax
8328 \parsemmanyargdef@@#1,;,% 10 or more arguments
8331 \def\parsemargdefxxx#1,{%
8332 \if#1;\let\next=\relax
8333 \else \let\next=\parsemargdefxxx
8334 \advance\paramno by 1
8335 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8336 {\xeatspaces{\hash\the\paramno}}%
8337 \edef\paramlist{\paramlist\hash\the\paramno,}%
8338 \fi\next}
8340 % \parsemacbody, \parsermacbody
8342 % Read recursive and nonrecursive macro bodies. (They're different since
8343 % rec and nonrec macros end differently.)
8345 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
8346 % body to be transformed.
8347 % Set \macrobody to the body of the macro, and call \defmacro.
8349 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8350 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8351 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8352 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8354 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8355 \edef\texiatcatcode{\the\catcode`\@}
8356 \catcode `@=11\relax
8358 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8360 % If there are 10 or more arguments, a different technique is used, where the
8361 % hook remains in the body, and when macro is to be expanded the body is
8362 % processed again to replace the arguments.
8364 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8365 % argument N value and then \edef the body (nothing else will expand because of
8366 % the catcode regime under which the body was input).
8368 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8369 % arguments, no macro can have more than 256 arguments (else error).
8371 % In case that there are 10 or more arguments we parse again the arguments
8372 % list to set new definitions for the \macarg.BLAH macros corresponding to
8373 % each BLAH argument. It was anyhow needed to parse already once this list
8374 % in order to count the arguments, and as macros with at most 9 arguments
8375 % are by far more frequent than macro with 10 or more arguments, defining
8376 % twice the \macarg.BLAH macros does not cost too much processing power.
8377 \def\parsemmanyargdef@@#1,{%
8378 \if#1;\let\next=\relax
8379 \else
8380 \let\next=\parsemmanyargdef@@
8381 \edef\tempb{\eatspaces{#1}}%
8382 \expandafter\def\expandafter\tempa
8383 \expandafter{\csname macarg.\tempb\endcsname}%
8384 % Note that we need some extra \noexpand\noexpand, this is because we
8385 % don't want \the to be expanded in the \parsermacbody as it uses an
8386 % \xdef .
8387 \expandafter\edef\tempa
8388 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8389 \advance\paramno by 1\relax
8390 \fi\next}
8393 \let\endargs@\relax
8394 \let\nil@\relax
8395 \def\nilm@{\nil@}%
8396 \long\def\nillm@{\nil@}%
8398 % This macro is expanded during the Texinfo macro expansion, not during its
8399 % definition. It gets all the arguments' values and assigns them to macros
8400 % macarg.ARGNAME
8402 % #1 is the macro name
8403 % #2 is the list of argument names
8404 % #3 is the list of argument values
8405 \def\getargvals@#1#2#3{%
8406 \def\macargdeflist@{}%
8407 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8408 \def\paramlist{#2,\nil@}%
8409 \def\macroname{#1}%
8410 \begingroup
8411 \macroargctxt
8412 \def\argvaluelist{#3,\nil@}%
8413 \def\@tempa{#3}%
8414 \ifx\@tempa\empty
8415 \setemptyargvalues@
8416 \else
8417 \getargvals@@
8420 \def\getargvals@@{%
8421 \ifx\paramlist\nilm@
8422 % Some sanity check needed here that \argvaluelist is also empty.
8423 \ifx\argvaluelist\nillm@
8424 \else
8425 \errhelp = \EMsimple
8426 \errmessage{Too many arguments in macro `\macroname'!}%
8428 \let\next\macargexpandinbody@
8429 \else
8430 \ifx\argvaluelist\nillm@
8431 % No more arguments values passed to macro. Set remaining named-arg
8432 % macros to empty.
8433 \let\next\setemptyargvalues@
8434 \else
8435 % pop current arg name into \@tempb
8436 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8437 \expandafter\@tempa\expandafter{\paramlist}%
8438 % pop current argument value into \@tempc
8439 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8440 \expandafter\@tempa\expandafter{\argvaluelist}%
8441 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8442 % First place the new argument macro definition into \@tempd
8443 \expandafter\macname\expandafter{\@tempc}%
8444 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8445 \expandafter\def\expandafter\@tempe\expandafter{%
8446 \csname macarg.\@tempb\endcsname}%
8447 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8448 \push@\@tempd\macargdeflist@
8449 \let\next\getargvals@@
8452 \next
8455 \def\push@#1#2{%
8456 \expandafter\expandafter\expandafter\def
8457 \expandafter\expandafter\expandafter#2%
8458 \expandafter\expandafter\expandafter{%
8459 \expandafter#1#2}%
8462 % Replace arguments by their values in the macro body, and place the result
8463 % in macro \@tempa.
8465 \def\macvalstoargs@{%
8466 % To do this we use the property that token registers that are \the'ed
8467 % within an \edef expand only once. So we are going to place all argument
8468 % values into respective token registers.
8470 % First we save the token context, and initialize argument numbering.
8471 \begingroup
8472 \paramno0\relax
8473 % Then, for each argument number #N, we place the corresponding argument
8474 % value into a new token list register \toks#N
8475 \expandafter\putargsintokens@\saveparamlist@,;,%
8476 % Then, we expand the body so that argument are replaced by their
8477 % values. The trick for values not to be expanded themselves is that they
8478 % are within tokens and that tokens expand only once in an \edef .
8479 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8480 % Now we restore the token stack pointer to free the token list registers
8481 % which we have used, but we make sure that expanded body is saved after
8482 % group.
8483 \expandafter
8484 \endgroup
8485 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8488 % Define the named-macro outside of this group and then close this group.
8490 \def\macargexpandinbody@{%
8491 \expandafter
8492 \endgroup
8493 \macargdeflist@
8494 % First the replace in body the macro arguments by their values, the result
8495 % is in \@tempa .
8496 \macvalstoargs@
8497 % Then we point at the \norecurse or \gobble (for recursive) macro value
8498 % with \@tempb .
8499 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8500 % Depending on whether it is recursive or not, we need some tailing
8501 % \egroup .
8502 \ifx\@tempb\gobble
8503 \let\@tempc\relax
8504 \else
8505 \let\@tempc\egroup
8507 % And now we do the real job:
8508 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8509 \@tempd
8512 \def\putargsintokens@#1,{%
8513 \if#1;\let\next\relax
8514 \else
8515 \let\next\putargsintokens@
8516 % First we allocate the new token list register, and give it a temporary
8517 % alias \@tempb .
8518 \toksdef\@tempb\the\paramno
8519 % Then we place the argument value into that token list register.
8520 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8521 \expandafter\@tempb\expandafter{\@tempa}%
8522 \advance\paramno by 1\relax
8524 \next
8527 % Trailing missing arguments are set to empty.
8529 \def\setemptyargvalues@{%
8530 \ifx\paramlist\nilm@
8531 \let\next\macargexpandinbody@
8532 \else
8533 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8534 \let\next\setemptyargvalues@
8536 \next
8539 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8540 \expandafter\def\expandafter\@tempa\expandafter{%
8541 \expandafter\def\csname macarg.#1\endcsname{}}%
8542 \push@\@tempa\macargdeflist@
8543 \def\paramlist{#2}%
8546 % #1 is the element target macro
8547 % #2 is the list macro
8548 % #3,#4\endargs@ is the list value
8549 \def\pop@#1#2#3,#4\endargs@{%
8550 \def#1{#3}%
8551 \def#2{#4}%
8553 \long\def\longpop@#1#2#3,#4\endargs@{%
8554 \long\def#1{#3}%
8555 \long\def#2{#4}%
8559 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8562 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8563 % \macrobody has the body of the macro in it, with placeholders for
8564 % its parameters, looking like "\xeatspaces{\hash 1}".
8565 % \paramno is the number of parameters
8566 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8567 % There are four cases: macros of zero, one, up to nine, and many arguments.
8568 % \xdef is used so that macro definitions will survive the file
8569 % they're defined in: @include reads the file inside a group.
8571 \def\defmacro{%
8572 \let\hash=##% convert placeholders to macro parameter chars
8573 \ifnum\paramno=1
8574 \def\xeatspaces##1{##1}%
8575 % This removes the pair of braces around the argument. We don't
8576 % use \eatspaces, because this can cause ends of lines to be lost
8577 % when the argument to \eatspaces is read, leading to line-based
8578 % commands like "@itemize" not being read correctly.
8579 \else
8580 \let\xeatspaces\relax % suppress expansion
8582 \ifcase\paramno
8584 \expandafter\xdef\csname\the\macname\endcsname{%
8585 \noexpand\scanmacro{\macrobody}}%
8586 \or % 1
8587 \expandafter\xdef\csname\the\macname\endcsname{%
8588 \bgroup
8589 \noexpand\braceorline
8590 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8591 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8592 \egroup
8593 \noexpand\scanmacro{\macrobody}%
8595 \else % at most 9
8596 \ifnum\paramno<10\relax
8597 % @MACNAME sets the context for reading the macro argument
8598 % @MACNAME@@ gets the argument, processes backslashes and appends a
8599 % comma.
8600 % @MACNAME@@@ removes braces surrounding the argument list.
8601 % @MACNAME@@@@ scans the macro body with arguments substituted.
8602 \expandafter\xdef\csname\the\macname\endcsname{%
8603 \bgroup
8604 \noexpand\expandafter % This \expandafter skip any spaces after the
8605 \noexpand\macroargctxt % macro before we change the catcode of space.
8606 \noexpand\expandafter
8607 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8608 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8609 \noexpand\passargtomacro
8610 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8611 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8612 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8613 \expandafter\expandafter
8614 \expandafter\xdef
8615 \expandafter\expandafter
8616 \csname\the\macname @@@@\endcsname\paramlist{%
8617 \egroup\noexpand\scanmacro{\macrobody}}%
8618 \else % 10 or more:
8619 \expandafter\xdef\csname\the\macname\endcsname{%
8620 \noexpand\getargvals@{\the\macname}{\argl}%
8622 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8623 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8625 \fi}
8627 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8629 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8634 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8635 @catcode`@_=11 % private names
8636 @catcode`@!=11 % used as argument separator
8638 % \passargtomacro#1#2 -
8639 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8640 % compressed to one.
8642 % This implementation works by expansion, and not execution (so we cannot use
8643 % \def or similar). This reduces the risk of this failing in contexts where
8644 % complete expansion is done with no execution (for example, in writing out to
8645 % an auxiliary file for an index entry).
8647 % State is kept in the input stream: the argument passed to
8648 % @look_ahead, @gobble_and_check_finish and @add_segment is
8650 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8652 % where:
8653 % THE_MACRO - name of the macro we want to call
8654 % ARG_RESULT - argument list we build to pass to that macro
8655 % PENDING_BS - either a backslash or nothing
8656 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8658 @gdef@passargtomacro#1#2{%
8659 @add_segment #1!{}@relax#2\@_finish\%
8661 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8663 % #1 - THE_MACRO ARG_RESULT
8664 % #2 - PENDING_BS
8665 % #3 - NEXT_TOKEN
8666 % #4 used to look ahead
8668 % If the next token is not a backslash, process the rest of the argument;
8669 % otherwise, remove the next token.
8670 @gdef@look_ahead#1!#2#3#4{%
8671 @ifx#4\%
8672 @expandafter@gobble_and_check_finish
8673 @else
8674 @expandafter@add_segment
8675 @fi#1!{#2}#4#4%
8678 % #1 - THE_MACRO ARG_RESULT
8679 % #2 - PENDING_BS
8680 % #3 - NEXT_TOKEN
8681 % #4 should be a backslash, which is gobbled.
8682 % #5 looks ahead
8684 % Double backslash found. Add a single backslash, and look ahead.
8685 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8686 @add_segment#1\!{}#5#5%
8689 @gdef@is_fi{@fi}
8691 % #1 - THE_MACRO ARG_RESULT
8692 % #2 - PENDING_BS
8693 % #3 - NEXT_TOKEN
8694 % #4 is input stream until next backslash
8696 % Input stream is either at the start of the argument, or just after a
8697 % backslash sequence, either a lone backslash, or a doubled backslash.
8698 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8699 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8700 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8701 % a backslash just before the start of the input stream that has not been
8702 % added to ARG_RESULT.
8703 @gdef@add_segment#1!#2#3#4\{%
8704 @ifx#3@_finish
8705 @call_the_macro#1!%
8706 @else
8707 % append the pending backslash to the result, followed by the next segment
8708 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8709 % this @fi is discarded by @look_ahead.
8710 % we can't get rid of it with \expandafter because we don't know how
8711 % long #4 is.
8714 % #1 - THE_MACRO
8715 % #2 - ARG_RESULT
8716 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8717 % conditional.
8718 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8723 % \braceorline MAC is used for a one-argument macro MAC. It checks
8724 % whether the next non-whitespace character is a {. It sets the context
8725 % for reading the argument (slightly different in the two cases). Then,
8726 % to read the argument, in the whole-line case, it then calls the regular
8727 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8729 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8730 \def\braceorlinexxx{%
8731 \ifx\nchar\bgroup
8732 \macroargctxt
8733 \expandafter\passargtomacro
8734 \else
8735 \macrolineargctxt\expandafter\parsearg
8736 \fi \macnamexxx}
8739 % @alias.
8740 % We need some trickery to remove the optional spaces around the equal
8741 % sign. Make them active and then expand them all to nothing.
8743 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8744 \def\aliasxxx #1{\aliasyyy#1\relax}
8745 \def\aliasyyy #1=#2\relax{%
8747 \expandafter\let\obeyedspace=\empty
8748 \addtomacrolist{#1}%
8749 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8751 \next
8755 \message{cross references,}
8757 \newwrite\auxfile
8758 \newif\ifhavexrefs % True if xref values are known.
8759 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8761 % @inforef is relatively simple.
8762 \def\inforef #1{\inforefzzz #1,,,,**}
8763 \def\inforefzzz #1,#2,#3,#4**{%
8764 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8765 node \samp{\ignorespaces#1{}}}
8767 % @node's only job in TeX is to define \lastnode, which is used in
8768 % cross-references. The @node line might or might not have commas, and
8769 % might or might not have spaces before the first comma, like:
8770 % @node foo , bar , ...
8771 % We don't want such trailing spaces in the node name.
8773 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8775 % also remove a trailing comma, in case of something like this:
8776 % @node Help-Cross, , , Cross-refs
8777 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8778 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
8780 \let\nwnode=\node
8781 \let\lastnode=\empty
8783 % Write a cross-reference definition for the current node. #1 is the
8784 % type (Ynumbered, Yappendix, Ynothing).
8786 \def\donoderef#1{%
8787 \ifx\lastnode\empty\else
8788 \setref{\lastnode}{#1}%
8789 \global\let\lastnode=\empty
8793 % @anchor{NAME} -- define xref target at arbitrary point.
8795 \newcount\savesfregister
8797 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8798 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8799 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8801 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8802 % anchor), which consists of three parts:
8803 % 1) NAME-title - the current sectioning name taken from \lastsection,
8804 % or the anchor name.
8805 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8806 % empty for anchors.
8807 % 3) NAME-pg - the page number.
8809 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8810 % floats, there is an additional part, which is not written here:
8811 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8813 \def\setref#1#2{%
8814 \pdfmkdest{#1}%
8815 \iflinks
8817 \requireauxfile
8818 \atdummies % preserve commands, but don't expand them
8819 % match definition in \xrdef, \refx, \xrefX.
8820 \def\value##1{##1}%
8821 \edef\writexrdef##1##2{%
8822 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8823 ##1}{##2}}% these are parameters of \writexrdef
8825 \toks0 = \expandafter{\lastsection}%
8826 \immediate \writexrdef{title}{\the\toks0 }%
8827 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8828 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8833 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8834 % automatically in xrefs, if the third arg is not explicitly specified.
8835 % This was provided as a "secret" @set xref-automatic-section-title
8836 % variable, now it's official.
8838 \parseargdef\xrefautomaticsectiontitle{%
8839 \def\temp{#1}%
8840 \ifx\temp\onword
8841 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8842 = \empty
8843 \else\ifx\temp\offword
8844 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8845 = \relax
8846 \else
8847 \errhelp = \EMsimple
8848 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8849 must be on|off}%
8850 \fi\fi
8853 % \f
8854 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8855 % the node name, #2 the name of the Info cross-reference, #3 the printed
8856 % node name, #4 the name of the Info file, #5 the name of the printed
8857 % manual. All but the node name can be omitted.
8859 \def\pxref{\putwordsee{} \xrefXX}
8860 \def\xref{\putwordSee{} \xrefXX}
8861 \def\ref{\xrefXX}
8863 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8864 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8866 \newbox\toprefbox
8867 \newbox\printedrefnamebox
8868 \newbox\infofilenamebox
8869 \newbox\printedmanualbox
8871 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8872 \unsepspaces
8874 % Get args without leading/trailing spaces.
8875 \def\printedrefname{\ignorespaces #3}%
8876 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8878 \def\infofilename{\ignorespaces #4}%
8879 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8881 \def\printedmanual{\ignorespaces #5}%
8882 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8884 % If the printed reference name (arg #3) was not explicitly given in
8885 % the @xref, figure out what we want to use.
8886 \ifdim \wd\printedrefnamebox = 0pt
8887 % No printed node name was explicitly given.
8888 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8889 % Not auto section-title: use node name inside the square brackets.
8890 \def\printedrefname{\ignorespaces #1}%
8891 \else
8892 % Auto section-title: use chapter/section title inside
8893 % the square brackets if we have it.
8894 \ifdim \wd\printedmanualbox > 0pt
8895 % It is in another manual, so we don't have it; use node name.
8896 \def\printedrefname{\ignorespaces #1}%
8897 \else
8898 \ifhavexrefs
8899 % We (should) know the real title if we have the xref values.
8900 \def\printedrefname{\refx{#1-title}{}}%
8901 \else
8902 % Otherwise just copy the Info node name.
8903 \def\printedrefname{\ignorespaces #1}%
8904 \fi%
8909 % Make link in pdf output.
8910 \ifpdf
8911 % For pdfTeX and LuaTeX
8912 {\indexnofonts
8913 \makevalueexpandable
8914 \turnoffactive
8915 % This expands tokens, so do it after making catcode changes, so _
8916 % etc. don't get their TeX definitions. This ignores all spaces in
8917 % #4, including (wrongly) those in the middle of the filename.
8918 \getfilename{#4}%
8920 % This (wrongly) does not take account of leading or trailing
8921 % spaces in #1, which should be ignored.
8922 \setpdfdestname{#1}%
8924 \ifx\pdfdestname\empty
8925 \def\pdfdestname{Top}% no empty targets
8928 \leavevmode
8929 \startlink attr{/Border [0 0 0]}%
8930 \ifnum\filenamelength>0
8931 goto file{\the\filename.pdf} name{\pdfdestname}%
8932 \else
8933 goto name{\pdfmkpgn{\pdfdestname}}%
8936 \setcolor{\linkcolor}%
8937 \else
8938 \ifx\XeTeXrevision\thisisundefined
8939 \else
8940 % For XeTeX
8941 {\indexnofonts
8942 \makevalueexpandable
8943 \turnoffactive
8944 % This expands tokens, so do it after making catcode changes, so _
8945 % etc. don't get their TeX definitions. This ignores all spaces in
8946 % #4, including (wrongly) those in the middle of the filename.
8947 \getfilename{#4}%
8949 % This (wrongly) does not take account of leading or trailing
8950 % spaces in #1, which should be ignored.
8951 \setpdfdestname{#1}%
8953 \ifx\pdfdestname\empty
8954 \def\pdfdestname{Top}% no empty targets
8957 \leavevmode
8958 \ifnum\filenamelength>0
8959 % With default settings,
8960 % XeTeX (xdvipdfmx) replaces link destination names with integers.
8961 % In this case, the replaced destination names of
8962 % remote PDFs are no longer known. In order to avoid a replacement,
8963 % you can use xdvipdfmx's command line option `-C 0x0010'.
8964 % If you use XeTeX 0.99996+ (TeX Live 2016+),
8965 % this command line option is no longer necessary
8966 % because we can use the `dvipdfmx:config' special.
8967 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8968 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
8969 \else
8970 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8971 << /S /GoTo /D (\pdfdestname) >> >>}%
8974 \setcolor{\linkcolor}%
8978 % Have to otherify everything special to allow the \csname to
8979 % include an _ in the xref name, etc.
8980 \indexnofonts
8981 \turnoffactive
8982 \def\value##1{##1}%
8983 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8984 \csname XR#1-title\endcsname
8987 % Float references are printed completely differently: "Figure 1.2"
8988 % instead of "[somenode], p.3". \iffloat distinguishes them by
8989 % \Xthisreftitle being set to a magic string.
8990 \iffloat\Xthisreftitle
8991 % If the user specified the print name (third arg) to the ref,
8992 % print it instead of our usual "Figure 1.2".
8993 \ifdim\wd\printedrefnamebox = 0pt
8994 \refx{#1-snt}{}%
8995 \else
8996 \printedrefname
8999 % If the user also gave the printed manual name (fifth arg), append
9000 % "in MANUALNAME".
9001 \ifdim \wd\printedmanualbox > 0pt
9002 \space \putwordin{} \cite{\printedmanual}%
9004 \else
9005 % node/anchor (non-float) references.
9007 % If we use \unhbox to print the node names, TeX does not insert
9008 % empty discretionaries after hyphens, which means that it will not
9009 % find a line break at a hyphen in a node names. Since some manuals
9010 % are best written with fairly long node names, containing hyphens,
9011 % this is a loss. Therefore, we give the text of the node name
9012 % again, so it is as if TeX is seeing it for the first time.
9014 \ifdim \wd\printedmanualbox > 0pt
9015 % Cross-manual reference with a printed manual name.
9017 \crossmanualxref{\cite{\printedmanual\unskip}}%
9019 \else\ifdim \wd\infofilenamebox > 0pt
9020 % Cross-manual reference with only an info filename (arg 4), no
9021 % printed manual name (arg 5). This is essentially the same as
9022 % the case above; we output the filename, since we have nothing else.
9024 \crossmanualxref{\code{\infofilename\unskip}}%
9026 \else
9027 % Reference within this manual.
9029 % _ (for example) has to be the character _ for the purposes of the
9030 % control sequence corresponding to the node, but it has to expand
9031 % into the usual \leavevmode...\vrule stuff for purposes of
9032 % printing. So we \turnoffactive for the \refx-snt, back on for the
9033 % printing, back off for the \refx-pg.
9034 {\turnoffactive
9035 % Only output a following space if the -snt ref is nonempty; for
9036 % @unnumbered and @anchor, it won't be.
9037 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
9038 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
9040 % output the `[mynode]' via the macro below so it can be overridden.
9041 \xrefprintnodename\printedrefname
9043 % But we always want a comma and a space:
9044 ,\space
9046 % output the `page 3'.
9047 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
9048 % Add a , if xref followed by a space
9049 \if\space\noexpand\tokenafterxref ,%
9050 \else\ifx\ \tokenafterxref ,% @TAB
9051 \else\ifx\*\tokenafterxref ,% @*
9052 \else\ifx\ \tokenafterxref ,% @SPACE
9053 \else\ifx\
9054 \tokenafterxref ,% @NL
9055 \else\ifx\tie\tokenafterxref ,% @tie
9056 \fi\fi\fi\fi\fi\fi
9057 \fi\fi
9059 \endlink
9060 \endgroup}
9062 % Output a cross-manual xref to #1. Used just above (twice).
9064 % Only include the text "Section ``foo'' in" if the foo is neither
9065 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
9066 % "see The Foo Manual", the idea being to refer to the whole manual.
9068 % But, this being TeX, we can't easily compare our node name against the
9069 % string "Top" while ignoring the possible spaces before and after in
9070 % the input. By adding the arbitrary 7sp below, we make it much less
9071 % likely that a real node name would have the same width as "Top" (e.g.,
9072 % in a monospaced font). Hopefully it will never happen in practice.
9074 % For the same basic reason, we retypeset the "Top" at every
9075 % reference, since the current font is indeterminate.
9077 \def\crossmanualxref#1{%
9078 \setbox\toprefbox = \hbox{Top\kern7sp}%
9079 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
9080 \ifdim \wd2 > 7sp % nonempty?
9081 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
9082 \putwordSection{} ``\printedrefname'' \putwordin{}\space
9088 % This macro is called from \xrefX for the `[nodename]' part of xref
9089 % output. It's a separate macro only so it can be changed more easily,
9090 % since square brackets don't work well in some documents. Particularly
9091 % one that Bob is working on :).
9093 \def\xrefprintnodename#1{[#1]}
9095 % Things referred to by \setref.
9097 \def\Ynothing{}
9098 \def\Yomitfromtoc{}
9099 \def\Ynumbered{%
9100 \ifnum\secno=0
9101 \putwordChapter@tie \the\chapno
9102 \else \ifnum\subsecno=0
9103 \putwordSection@tie \the\chapno.\the\secno
9104 \else \ifnum\subsubsecno=0
9105 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9106 \else
9107 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9108 \fi\fi\fi
9110 \def\Yappendix{%
9111 \ifnum\secno=0
9112 \putwordAppendix@tie @char\the\appendixno{}%
9113 \else \ifnum\subsecno=0
9114 \putwordSection@tie @char\the\appendixno.\the\secno
9115 \else \ifnum\subsubsecno=0
9116 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9117 \else
9118 \putwordSection@tie
9119 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9120 \fi\fi\fi
9123 % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
9124 % is output afterwards if non-empty.
9125 \def\refx#1#2{%
9126 \requireauxfile
9128 \indexnofonts
9129 \otherbackslash
9130 \def\value##1{##1}%
9131 \expandafter\global\expandafter\let\expandafter\thisrefX
9132 \csname XR#1\endcsname
9134 \ifx\thisrefX\relax
9135 % If not defined, say something at least.
9136 \angleleft un\-de\-fined\angleright
9137 \iflinks
9138 \ifhavexrefs
9139 {\toks0 = {#1}% avoid expansion of possibly-complex value
9140 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9141 \else
9142 \ifwarnedxrefs\else
9143 \global\warnedxrefstrue
9144 \message{Cross reference values unknown; you must run TeX again.}%
9148 \else
9149 % It's defined, so just use it.
9150 \thisrefX
9152 #2% Output the suffix in any case.
9155 % This is the macro invoked by entries in the aux file. Define a control
9156 % sequence for a cross-reference target (we prepend XR to the control sequence
9157 % name to avoid collisions). The value is the page number. If this is a float
9158 % type, we have more work to do.
9160 \def\xrdef#1#2{%
9161 {% Expand the node or anchor name to remove control sequences.
9162 % \turnoffactive stops 8-bit characters being changed to commands
9163 % like @'e. \refx does the same to retrieve the value in the definition.
9164 \indexnofonts
9165 \turnoffactive
9166 \def\value##1{##1}%
9167 \xdef\safexrefname{#1}%
9170 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
9172 % Was that xref control sequence that we just defined for a float?
9173 \expandafter\iffloat\csname XR\safexrefname\endcsname
9174 % it was a float, and we have the (safe) float type in \iffloattype.
9175 \expandafter\let\expandafter\floatlist
9176 \csname floatlist\iffloattype\endcsname
9178 % Is this the first time we've seen this float type?
9179 \expandafter\ifx\floatlist\relax
9180 \toks0 = {\do}% yes, so just \do
9181 \else
9182 % had it before, so preserve previous elements in list.
9183 \toks0 = \expandafter{\floatlist\do}%
9186 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9187 % for later use in \listoffloats.
9188 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9189 {\safexrefname}}%
9193 % If working on a large document in chapters, it is convenient to
9194 % be able to disable indexing, cross-referencing, and contents, for test runs.
9195 % This is done with @novalidate at the beginning of the file.
9197 \newif\iflinks \linkstrue % by default we want the aux files.
9198 \let\novalidate = \linksfalse
9200 % Used when writing to the aux file, or when using data from it.
9201 \def\requireauxfile{%
9202 \iflinks
9203 \tryauxfile
9204 % Open the new aux file. TeX will close it automatically at exit.
9205 \immediate\openout\auxfile=\jobname.aux
9207 \global\let\requireauxfile=\relax % Only do this once.
9210 % Read the last existing aux file, if any. No error if none exists.
9212 \def\tryauxfile{%
9213 \openin 1 \jobname.aux
9214 \ifeof 1 \else
9215 \readdatafile{aux}%
9216 \global\havexrefstrue
9218 \closein 1
9221 \def\setupdatafile{%
9222 \catcode`\^^@=\other
9223 \catcode`\^^A=\other
9224 \catcode`\^^B=\other
9225 \catcode`\^^C=\other
9226 \catcode`\^^D=\other
9227 \catcode`\^^E=\other
9228 \catcode`\^^F=\other
9229 \catcode`\^^G=\other
9230 \catcode`\^^H=\other
9231 \catcode`\^^K=\other
9232 \catcode`\^^L=\other
9233 \catcode`\^^N=\other
9234 \catcode`\^^P=\other
9235 \catcode`\^^Q=\other
9236 \catcode`\^^R=\other
9237 \catcode`\^^S=\other
9238 \catcode`\^^T=\other
9239 \catcode`\^^U=\other
9240 \catcode`\^^V=\other
9241 \catcode`\^^W=\other
9242 \catcode`\^^X=\other
9243 \catcode`\^^Z=\other
9244 \catcode`\^^[=\other
9245 \catcode`\^^\=\other
9246 \catcode`\^^]=\other
9247 \catcode`\^^^=\other
9248 \catcode`\^^_=\other
9249 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
9250 % in xref tags, i.e., node names. But since ^^e4 notation isn't
9251 % supported in the main text, it doesn't seem desirable. Furthermore,
9252 % that is not enough: for node names that actually contain a ^
9253 % character, we would end up writing a line like this: 'xrdef {'hat
9254 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
9255 % argument, and \hat is not an expandable control sequence. It could
9256 % all be worked out, but why? Either we support ^^ or we don't.
9258 % The other change necessary for this was to define \auxhat:
9259 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
9260 % and then to call \auxhat in \setq.
9262 \catcode`\^=\other
9264 % Special characters. Should be turned off anyway, but...
9265 \catcode`\~=\other
9266 \catcode`\[=\other
9267 \catcode`\]=\other
9268 \catcode`\"=\other
9269 \catcode`\_=\other
9270 \catcode`\|=\other
9271 \catcode`\<=\other
9272 \catcode`\>=\other
9273 \catcode`\$=\other
9274 \catcode`\#=\other
9275 \catcode`\&=\other
9276 \catcode`\%=\other
9277 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9279 % This is to support \ in node names and titles, since the \
9280 % characters end up in a \csname. It's easier than
9281 % leaving it active and making its active definition an actual \
9282 % character. What I don't understand is why it works in the *value*
9283 % of the xrdef. Seems like it should be a catcode12 \, and that
9284 % should not typeset properly. But it works, so I'm moving on for
9285 % now. --karl, 15jan04.
9286 \catcode`\\=\other
9288 % @ is our escape character in .aux files, and we need braces.
9289 \catcode`\{=1
9290 \catcode`\}=2
9291 \catcode`\@=0
9294 \def\readdatafile#1{%
9295 \begingroup
9296 \setupdatafile
9297 \input\jobname.#1
9298 \endgroup}
9301 \message{insertions,}
9302 % including footnotes.
9304 \newcount \footnoteno
9306 % The trailing space in the following definition for supereject is
9307 % vital for proper filling; pages come out unaligned when you do a
9308 % pagealignmacro call if that space before the closing brace is
9309 % removed. (Generally, numeric constants should always be followed by a
9310 % space to prevent strange expansion errors.)
9311 \def\supereject{\par\penalty -20000\footnoteno =0 }
9313 % @footnotestyle is meaningful for Info output only.
9314 \let\footnotestyle=\comment
9316 {\catcode `\@=11
9318 % Auto-number footnotes. Otherwise like plain.
9319 \gdef\footnote{%
9320 \global\advance\footnoteno by \@ne
9321 \edef\thisfootno{$^{\the\footnoteno}$}%
9323 % In case the footnote comes at the end of a sentence, preserve the
9324 % extra spacing after we do the footnote number.
9325 \let\@sf\empty
9326 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9328 % Remove inadvertent blank space before typesetting the footnote number.
9329 \unskip
9330 \thisfootno\@sf
9331 \dofootnote
9334 % Don't bother with the trickery in plain.tex to not require the
9335 % footnote text as a parameter. Our footnotes don't need to be so general.
9337 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9338 % \parseargline) fails inside footnotes because the tokens are fixed when
9339 % the footnote is read. --karl, 16nov96.
9341 \gdef\dofootnote{%
9342 \insert\footins\bgroup
9344 % Nested footnotes are not supported in TeX, that would take a lot
9345 % more work. (\startsavinginserts does not suffice.)
9346 \let\footnote=\errfootnotenest
9348 % We want to typeset this text as a normal paragraph, even if the
9349 % footnote reference occurs in (for example) a display environment.
9350 % So reset some parameters.
9351 \hsize=\txipagewidth
9352 \interlinepenalty\interfootnotelinepenalty
9353 \splittopskip\ht\strutbox % top baseline for broken footnotes
9354 \splitmaxdepth\dp\strutbox
9355 \floatingpenalty\@MM
9356 \leftskip\z@skip
9357 \rightskip\z@skip
9358 \spaceskip\z@skip
9359 \xspaceskip\z@skip
9360 \parindent\defaultparindent
9362 \smallfonts \rm
9364 % Because we use hanging indentation in footnotes, a @noindent appears
9365 % to exdent this text, so make it be a no-op. makeinfo does not use
9366 % hanging indentation so @noindent can still be needed within footnote
9367 % text after an @example or the like (not that this is good style).
9368 \let\noindent = \relax
9370 % Hang the footnote text off the number. Use \everypar in case the
9371 % footnote extends for more than one paragraph.
9372 \everypar = {\hang}%
9373 \textindent{\thisfootno}%
9375 % Don't crash into the line above the footnote text. Since this
9376 % expands into a box, it must come within the paragraph, lest it
9377 % provide a place where TeX can split the footnote.
9378 \footstrut
9380 % Invoke rest of plain TeX footnote routine.
9381 \futurelet\next\fo@t
9383 }%end \catcode `\@=11
9385 \def\errfootnotenest{%
9386 \errhelp=\EMsimple
9387 \errmessage{Nested footnotes not supported in texinfo.tex,
9388 even though they work in makeinfo; sorry}
9391 \def\errfootnoteheading{%
9392 \errhelp=\EMsimple
9393 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9396 % In case a @footnote appears in a vbox, save the footnote text and create
9397 % the real \insert just after the vbox finished. Otherwise, the insertion
9398 % would be lost.
9399 % Similarly, if a @footnote appears inside an alignment, save the footnote
9400 % text to a box and make the \insert when a row of the table is finished.
9401 % And the same can be done for other insert classes. --kasal, 16nov03.
9403 % Replace the \insert primitive by a cheating macro.
9404 % Deeper inside, just make sure that the saved insertions are not spilled
9405 % out prematurely.
9407 \def\startsavinginserts{%
9408 \ifx \insert\ptexinsert
9409 \let\insert\saveinsert
9410 \else
9411 \let\checkinserts\relax
9415 % This \insert replacement works for both \insert\footins{foo} and
9416 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9418 \def\saveinsert#1{%
9419 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9420 \afterassignment\next
9421 % swallow the left brace
9422 \let\temp =
9424 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9425 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9427 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9429 \def\placesaveins#1{%
9430 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9431 {\box#1}%
9434 % eat @SAVE -- beware, all of them have catcode \other:
9436 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9437 \gdef\gobblesave @SAVE{}
9440 % initialization:
9441 \def\newsaveins #1{%
9442 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9443 \next
9445 \def\newsaveinsX #1{%
9446 \csname newbox\endcsname #1%
9447 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9448 \checksaveins #1}%
9451 % initialize:
9452 \let\checkinserts\empty
9453 \newsaveins\footins
9454 \newsaveins\margin
9457 % @image. We use the macros from epsf.tex to support this.
9458 % If epsf.tex is not installed and @image is used, we complain.
9460 % Check for and read epsf.tex up front. If we read it only at @image
9461 % time, we might be inside a group, and then its definitions would get
9462 % undone and the next image would fail.
9463 \openin 1 = epsf.tex
9464 \ifeof 1 \else
9465 % Do not bother showing banner with epsf.tex v2.7k (available in
9466 % doc/epsf.tex and on ctan).
9467 \def\epsfannounce{\toks0 = }%
9468 \input epsf.tex
9470 \closein 1
9472 % We will only complain once about lack of epsf.tex.
9473 \newif\ifwarnednoepsf
9474 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9475 work. It is also included in the Texinfo distribution, or you can get
9476 it from ftp://tug.org/tex/epsf.tex.}
9478 \def\image#1{%
9479 \ifx\epsfbox\thisisundefined
9480 \ifwarnednoepsf \else
9481 \errhelp = \noepsfhelp
9482 \errmessage{epsf.tex not found, images will be ignored}%
9483 \global\warnednoepsftrue
9485 \else
9486 \imagexxx #1,,,,,\finish
9490 % Arguments to @image:
9491 % #1 is (mandatory) image filename; we tack on .eps extension.
9492 % #2 is (optional) width, #3 is (optional) height.
9493 % #4 is (ignored optional) html alt text.
9494 % #5 is (ignored optional) extension.
9495 % #6 is just the usual extra ignored arg for parsing stuff.
9496 \newif\ifimagevmode
9497 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9498 \catcode`\^^M = 5 % in case we're inside an example
9499 \normalturnoffactive % allow _ et al. in names
9500 \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
9501 % If the image is by itself, center it.
9502 \ifvmode
9503 \imagevmodetrue
9504 \else \ifx\centersub\centerV
9505 % for @center @image, we need a vbox so we can have our vertical space
9506 \imagevmodetrue
9507 \vbox\bgroup % vbox has better behavior than vtop herev
9508 \fi\fi
9510 \ifimagevmode
9511 \nobreak\medskip
9512 % Usually we'll have text after the image which will insert
9513 % \parskip glue, so insert it here too to equalize the space
9514 % above and below.
9515 \nobreak\vskip\parskip
9516 \nobreak
9519 % Leave vertical mode so that indentation from an enclosing
9520 % environment such as @quotation is respected.
9521 % However, if we're at the top level, we don't want the
9522 % normal paragraph indentation.
9523 % On the other hand, if we are in the case of @center @image, we don't
9524 % want to start a paragraph, which will create a hsize-width box and
9525 % eradicate the centering.
9526 \ifx\centersub\centerV\else \noindent \fi
9528 % Output the image.
9529 \ifpdf
9530 % For pdfTeX and LuaTeX <= 0.80
9531 \dopdfimage{#1}{#2}{#3}%
9532 \else
9533 \ifx\XeTeXrevision\thisisundefined
9534 % For epsf.tex
9535 % \epsfbox itself resets \epsf?size at each figure.
9536 \setbox0 = \hbox{\ignorespaces #2}%
9537 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9538 \setbox0 = \hbox{\ignorespaces #3}%
9539 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9540 \epsfbox{#1.eps}%
9541 \else
9542 % For XeTeX
9543 \doxeteximage{#1}{#2}{#3}%
9547 \ifimagevmode
9548 \medskip % space after a standalone image
9549 \fi
9550 \ifx\centersub\centerV \egroup \fi
9551 \endgroup}
9554 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9555 % etc. We don't actually implement floating yet, we always include the
9556 % float "here". But it seemed the best name for the future.
9558 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9560 % There may be a space before second and/or third parameter; delete it.
9561 \def\eatcommaspace#1, {#1,}
9563 % #1 is the optional FLOATTYPE, the text label for this float, typically
9564 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9565 % this float will not be numbered and cannot be referred to.
9567 % #2 is the optional xref label. Also must be present for the float to
9568 % be referable.
9570 % #3 is the optional positioning argument; for now, it is ignored. It
9571 % will somehow specify the positions allowed to float to (here, top, bottom).
9573 % We keep a separate counter for each FLOATTYPE, which we reset at each
9574 % chapter-level command.
9575 \let\resetallfloatnos=\empty
9577 \def\dofloat#1,#2,#3,#4\finish{%
9578 \let\thiscaption=\empty
9579 \let\thisshortcaption=\empty
9581 % don't lose footnotes inside @float.
9583 % BEWARE: when the floats start float, we have to issue warning whenever an
9584 % insert appears inside a float which could possibly float. --kasal, 26may04
9586 \startsavinginserts
9588 % We can't be used inside a paragraph.
9589 \par
9591 \vtop\bgroup
9592 \def\floattype{#1}%
9593 \def\floatlabel{#2}%
9594 \def\floatloc{#3}% we do nothing with this yet.
9596 \ifx\floattype\empty
9597 \let\safefloattype=\empty
9598 \else
9600 % the floattype might have accents or other special characters,
9601 % but we need to use it in a control sequence name.
9602 \indexnofonts
9603 \turnoffactive
9604 \xdef\safefloattype{\floattype}%
9608 % If label is given but no type, we handle that as the empty type.
9609 \ifx\floatlabel\empty \else
9610 % We want each FLOATTYPE to be numbered separately (Figure 1,
9611 % Table 1, Figure 2, ...). (And if no label, no number.)
9613 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9614 \global\advance\floatno by 1
9617 % This magic value for \lastsection is output by \setref as the
9618 % XREFLABEL-title value. \xrefX uses it to distinguish float
9619 % labels (which have a completely different output format) from
9620 % node and anchor labels. And \xrdef uses it to construct the
9621 % lists of floats.
9623 \edef\lastsection{\floatmagic=\safefloattype}%
9624 \setref{\floatlabel}{Yfloat}%
9628 % start with \parskip glue, I guess.
9629 \vskip\parskip
9631 % Don't suppress indentation if a float happens to start a section.
9632 \restorefirstparagraphindent
9635 % we have these possibilities:
9636 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9637 % @float Foo,lbl & no caption: Foo 1.1
9638 % @float Foo & @caption{Cap}: Foo: Cap
9639 % @float Foo & no caption: Foo
9640 % @float ,lbl & Caption{Cap}: 1.1: Cap
9641 % @float ,lbl & no caption: 1.1
9642 % @float & @caption{Cap}: Cap
9643 % @float & no caption:
9645 \def\Efloat{%
9646 \let\floatident = \empty
9648 % In all cases, if we have a float type, it comes first.
9649 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9651 % If we have an xref label, the number comes next.
9652 \ifx\floatlabel\empty \else
9653 \ifx\floattype\empty \else % if also had float type, need tie first.
9654 \appendtomacro\floatident{\tie}%
9656 % the number.
9657 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9660 % Start the printed caption with what we've constructed in
9661 % \floatident, but keep it separate; we need \floatident again.
9662 \let\captionline = \floatident
9664 \ifx\thiscaption\empty \else
9665 \ifx\floatident\empty \else
9666 \appendtomacro\captionline{: }% had ident, so need a colon between
9669 % caption text.
9670 \appendtomacro\captionline{\scanexp\thiscaption}%
9673 % If we have anything to print, print it, with space before.
9674 % Eventually this needs to become an \insert.
9675 \ifx\captionline\empty \else
9676 \vskip.5\parskip
9677 \captionline
9679 % Space below caption.
9680 \vskip\parskip
9683 % If have an xref label, write the list of floats info. Do this
9684 % after the caption, to avoid chance of it being a breakpoint.
9685 \ifx\floatlabel\empty \else
9686 % Write the text that goes in the lof to the aux file as
9687 % \floatlabel-lof. Besides \floatident, we include the short
9688 % caption if specified, else the full caption if specified, else nothing.
9690 \requireauxfile
9691 \atdummies
9693 \ifx\thisshortcaption\empty
9694 \def\gtemp{\thiscaption}%
9695 \else
9696 \def\gtemp{\thisshortcaption}%
9698 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9699 \ifx\gtemp\empty \else : \gtemp \fi}}%
9702 \egroup % end of \vtop
9704 \checkinserts
9707 % Append the tokens #2 to the definition of macro #1, not expanding either.
9709 \def\appendtomacro#1#2{%
9710 \expandafter\def\expandafter#1\expandafter{#1#2}%
9713 % @caption, @shortcaption
9715 \def\caption{\docaption\thiscaption}
9716 \def\shortcaption{\docaption\thisshortcaption}
9717 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9718 \def\defcaption#1#2{\egroup \def#1{#2}}
9720 % The parameter is the control sequence identifying the counter we are
9721 % going to use. Create it if it doesn't exist and assign it to \floatno.
9722 \def\getfloatno#1{%
9723 \ifx#1\relax
9724 % Haven't seen this figure type before.
9725 \csname newcount\endcsname #1%
9727 % Remember to reset this floatno at the next chap.
9728 \expandafter\gdef\expandafter\resetallfloatnos
9729 \expandafter{\resetallfloatnos #1=0 }%
9731 \let\floatno#1%
9734 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9735 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9736 % first read the @float command.
9738 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9740 % Magic string used for the XREFLABEL-title value, so \xrefX can
9741 % distinguish floats from other xref types.
9742 \def\floatmagic{!!float!!}
9744 % #1 is the control sequence we are passed; we expand into a conditional
9745 % which is true if #1 represents a float ref. That is, the magic
9746 % \lastsection value which we \setref above.
9748 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9750 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9751 % (safe) float type for this float. We set \iffloattype to #2.
9753 \def\doiffloat#1=#2=#3\finish{%
9754 \def\temp{#1}%
9755 \def\iffloattype{#2}%
9756 \ifx\temp\floatmagic
9759 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9761 \parseargdef\listoffloats{%
9762 \def\floattype{#1}% floattype
9764 % the floattype might have accents or other special characters,
9765 % but we need to use it in a control sequence name.
9766 \indexnofonts
9767 \turnoffactive
9768 \xdef\safefloattype{\floattype}%
9771 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9772 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9773 \ifhavexrefs
9774 % if the user said @listoffloats foo but never @float foo.
9775 \message{\linenumber No `\safefloattype' floats to list.}%
9777 \else
9778 \begingroup
9779 \leftskip=\tocindent % indent these entries like a toc
9780 \let\do=\listoffloatsdo
9781 \csname floatlist\safefloattype\endcsname
9782 \endgroup
9786 % This is called on each entry in a list of floats. We're passed the
9787 % xref label, in the form LABEL-title, which is how we save it in the
9788 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9789 % has the text we're supposed to typeset here.
9791 % Figures without xref labels will not be included in the list (since
9792 % they won't appear in the aux file).
9794 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9795 \def\listoffloatsdoentry#1-title\finish{{%
9796 % Can't fully expand XR#1-lof because it can contain anything. Just
9797 % pass the control sequence. On the other hand, XR#1-pg is just the
9798 % page number, and we want to fully expand that so we can get a link
9799 % in pdf output.
9800 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9802 % use the same \entry macro we use to generate the TOC and index.
9803 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9804 \writeentry
9808 \message{localization,}
9810 % For single-language documents, @documentlanguage is usually given very
9811 % early, just after @documentencoding. Single argument is the language
9812 % (de) or locale (de_DE) abbreviation.
9815 \catcode`\_ = \active
9816 \globaldefs=1
9817 \parseargdef\documentlanguage{%
9818 \tex % read txi-??.tex file in plain TeX.
9819 % Read the file by the name they passed if it exists.
9820 \let_ = \normalunderscore % normal _ character for filename test
9821 \openin 1 txi-#1.tex
9822 \ifeof 1
9823 \documentlanguagetrywithoutunderscore #1_\finish
9824 \else
9825 \globaldefs = 1 % everything in the txi-LL files needs to persist
9826 \input txi-#1.tex
9828 \closein 1
9829 \endgroup % end raw TeX
9832 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9833 % try txi-de.tex.
9835 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9836 \openin 1 txi-#1.tex
9837 \ifeof 1
9838 \errhelp = \nolanghelp
9839 \errmessage{Cannot read language file txi-#1.tex}%
9840 \else
9841 \globaldefs = 1 % everything in the txi-LL files needs to persist
9842 \input txi-#1.tex
9844 \closein 1
9846 }% end of special _ catcode
9848 \newhelp\nolanghelp{The given language definition file cannot be found or
9849 is empty. Maybe you need to install it? Putting it in the current
9850 directory should work if nowhere else does.}
9852 % This macro is called from txi-??.tex files; the first argument is the
9853 % \language name to set (without the "\lang@" prefix), the second and
9854 % third args are \{left,right}hyphenmin.
9856 % The language names to pass are determined when the format is built.
9857 % See the etex.log file created at that time, e.g.,
9858 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9860 % With TeX Live 2008, etex now includes hyphenation patterns for all
9861 % available languages. This means we can support hyphenation in
9862 % Texinfo, at least to some extent. (This still doesn't solve the
9863 % accented characters problem.)
9865 \catcode`@=11
9866 \def\txisetlanguage#1#2#3{%
9867 % do not set the language if the name is undefined in the current TeX.
9868 \expandafter\ifx\csname lang@#1\endcsname \relax
9869 \message{no patterns for #1}%
9870 \else
9871 \global\language = \csname lang@#1\endcsname
9873 % but there is no harm in adjusting the hyphenmin values regardless.
9874 \global\lefthyphenmin = #2\relax
9875 \global\righthyphenmin = #3\relax
9878 % XeTeX and LuaTeX can handle Unicode natively.
9879 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9880 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9882 \newif\iftxinativeunicodecapable
9883 \newif\iftxiusebytewiseio
9885 \ifx\XeTeXrevision\thisisundefined
9886 \ifx\luatexversion\thisisundefined
9887 \txinativeunicodecapablefalse
9888 \txiusebytewiseiotrue
9889 \else
9890 \txinativeunicodecapabletrue
9891 \txiusebytewiseiofalse
9893 \else
9894 \txinativeunicodecapabletrue
9895 \txiusebytewiseiofalse
9898 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9899 % for non-UTF-8 (byte-wise) encodings.
9901 \def\setbytewiseio{%
9902 \ifx\XeTeXrevision\thisisundefined
9903 \else
9904 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9905 \XeTeXinputencoding "bytes" % For document root file
9906 % Unfortunately, there seems to be no corresponding XeTeX command for
9907 % output encoding. This is a problem for auxiliary index and TOC files.
9908 % The only solution would be perhaps to write out @U{...} sequences in
9909 % place of non-ASCII characters.
9912 \ifx\luatexversion\thisisundefined
9913 \else
9914 \directlua{
9915 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9916 local function convert_char (char)
9917 return utf8_char(byte(char))
9920 local function convert_line (line)
9921 return gsub(line, ".", convert_char)
9924 callback.register("process_input_buffer", convert_line)
9926 local function convert_line_out (line)
9927 local line_out = ""
9928 for c in string.utfvalues(line) do
9929 line_out = line_out .. string.char(c)
9931 return line_out
9934 callback.register("process_output_buffer", convert_line_out)
9938 \txiusebytewiseiotrue
9942 % Helpers for encodings.
9943 % Set the catcode of characters 128 through 255 to the specified number.
9945 \def\setnonasciicharscatcode#1{%
9946 \count255=128
9947 \loop\ifnum\count255<256
9948 \global\catcode\count255=#1\relax
9949 \advance\count255 by 1
9950 \repeat
9953 \def\setnonasciicharscatcodenonglobal#1{%
9954 \count255=128
9955 \loop\ifnum\count255<256
9956 \catcode\count255=#1\relax
9957 \advance\count255 by 1
9958 \repeat
9961 % @documentencoding sets the definition of non-ASCII characters
9962 % according to the specified encoding.
9964 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9965 \def\documentencodingzzz#1{%
9967 % Encoding being declared for the document.
9968 \def\declaredencoding{\csname #1.enc\endcsname}%
9970 % Supported encodings: names converted to tokens in order to be able
9971 % to compare them with \ifx.
9972 \def\ascii{\csname US-ASCII.enc\endcsname}%
9973 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9974 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9975 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9976 \def\utfeight{\csname UTF-8.enc\endcsname}%
9978 \ifx \declaredencoding \ascii
9979 \asciichardefs
9981 \else \ifx \declaredencoding \lattwo
9982 \iftxinativeunicodecapable
9983 \setbytewiseio
9985 \setnonasciicharscatcode\active
9986 \lattwochardefs
9988 \else \ifx \declaredencoding \latone
9989 \iftxinativeunicodecapable
9990 \setbytewiseio
9992 \setnonasciicharscatcode\active
9993 \latonechardefs
9995 \else \ifx \declaredencoding \latnine
9996 \iftxinativeunicodecapable
9997 \setbytewiseio
9999 \setnonasciicharscatcode\active
10000 \latninechardefs
10002 \else \ifx \declaredencoding \utfeight
10003 \iftxinativeunicodecapable
10004 % For native Unicode handling (XeTeX and LuaTeX)
10005 \nativeunicodechardefs
10006 \else
10007 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
10008 \setnonasciicharscatcode\active
10009 % since we already invoked \utfeightchardefs at the top level
10010 % (below), do not re-invoke it, otherwise our check for duplicated
10011 % definitions gets triggered. Making non-ascii chars active is
10012 % sufficient.
10015 \else
10016 \message{Ignoring unknown document encoding: #1.}%
10018 \fi % utfeight
10019 \fi % latnine
10020 \fi % latone
10021 \fi % lattwo
10022 \fi % ascii
10024 \ifx\XeTeXrevision\thisisundefined
10025 \else
10026 \ifx \declaredencoding \utfeight
10027 \else
10028 \ifx \declaredencoding \ascii
10029 \else
10030 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
10031 non-ASCII characters in auxiliary files.}%
10037 % emacs-page
10038 % A message to be logged when using a character that isn't available
10039 % the default font encoding (OT1).
10041 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
10043 % Take account of \c (plain) vs. \, (Texinfo) difference.
10044 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
10046 % First, make active non-ASCII characters in order for them to be
10047 % correctly categorized when TeX reads the replacement text of
10048 % macros containing the character definitions.
10049 \setnonasciicharscatcode\active
10052 \def\gdefchar#1#2{%
10053 \gdef#1{%
10054 \ifpassthroughchars
10055 \string#1%
10056 \else
10061 % Latin1 (ISO-8859-1) character definitions.
10062 \def\latonechardefs{%
10063 \gdefchar^^a0{\tie}
10064 \gdefchar^^a1{\exclamdown}
10065 \gdefchar^^a2{{\tcfont \char162}} % cent
10066 \gdefchar^^a3{\pounds}
10067 \gdefchar^^a4{{\tcfont \char164}} % currency
10068 \gdefchar^^a5{{\tcfont \char165}} % yen
10069 \gdefchar^^a6{{\tcfont \char166}} % broken bar
10070 \gdefchar^^a7{\S}
10071 \gdefchar^^a8{\"{}}
10072 \gdefchar^^a9{\copyright}
10073 \gdefchar^^aa{\ordf}
10074 \gdefchar^^ab{\guillemetleft}
10075 \gdefchar^^ac{\ensuremath\lnot}
10076 \gdefchar^^ad{\-}
10077 \gdefchar^^ae{\registeredsymbol}
10078 \gdefchar^^af{\={}}
10080 \gdefchar^^b0{\textdegree}
10081 \gdefchar^^b1{$\pm$}
10082 \gdefchar^^b2{$^2$}
10083 \gdefchar^^b3{$^3$}
10084 \gdefchar^^b4{\'{}}
10085 \gdefchar^^b5{$\mu$}
10086 \gdefchar^^b6{\P}
10087 \gdefchar^^b7{\ensuremath\cdot}
10088 \gdefchar^^b8{\cedilla\ }
10089 \gdefchar^^b9{$^1$}
10090 \gdefchar^^ba{\ordm}
10091 \gdefchar^^bb{\guillemetright}
10092 \gdefchar^^bc{$1\over4$}
10093 \gdefchar^^bd{$1\over2$}
10094 \gdefchar^^be{$3\over4$}
10095 \gdefchar^^bf{\questiondown}
10097 \gdefchar^^c0{\`A}
10098 \gdefchar^^c1{\'A}
10099 \gdefchar^^c2{\^A}
10100 \gdefchar^^c3{\~A}
10101 \gdefchar^^c4{\"A}
10102 \gdefchar^^c5{\ringaccent A}
10103 \gdefchar^^c6{\AE}
10104 \gdefchar^^c7{\cedilla C}
10105 \gdefchar^^c8{\`E}
10106 \gdefchar^^c9{\'E}
10107 \gdefchar^^ca{\^E}
10108 \gdefchar^^cb{\"E}
10109 \gdefchar^^cc{\`I}
10110 \gdefchar^^cd{\'I}
10111 \gdefchar^^ce{\^I}
10112 \gdefchar^^cf{\"I}
10114 \gdefchar^^d0{\DH}
10115 \gdefchar^^d1{\~N}
10116 \gdefchar^^d2{\`O}
10117 \gdefchar^^d3{\'O}
10118 \gdefchar^^d4{\^O}
10119 \gdefchar^^d5{\~O}
10120 \gdefchar^^d6{\"O}
10121 \gdefchar^^d7{$\times$}
10122 \gdefchar^^d8{\O}
10123 \gdefchar^^d9{\`U}
10124 \gdefchar^^da{\'U}
10125 \gdefchar^^db{\^U}
10126 \gdefchar^^dc{\"U}
10127 \gdefchar^^dd{\'Y}
10128 \gdefchar^^de{\TH}
10129 \gdefchar^^df{\ss}
10131 \gdefchar^^e0{\`a}
10132 \gdefchar^^e1{\'a}
10133 \gdefchar^^e2{\^a}
10134 \gdefchar^^e3{\~a}
10135 \gdefchar^^e4{\"a}
10136 \gdefchar^^e5{\ringaccent a}
10137 \gdefchar^^e6{\ae}
10138 \gdefchar^^e7{\cedilla c}
10139 \gdefchar^^e8{\`e}
10140 \gdefchar^^e9{\'e}
10141 \gdefchar^^ea{\^e}
10142 \gdefchar^^eb{\"e}
10143 \gdefchar^^ec{\`{\dotless i}}
10144 \gdefchar^^ed{\'{\dotless i}}
10145 \gdefchar^^ee{\^{\dotless i}}
10146 \gdefchar^^ef{\"{\dotless i}}
10148 \gdefchar^^f0{\dh}
10149 \gdefchar^^f1{\~n}
10150 \gdefchar^^f2{\`o}
10151 \gdefchar^^f3{\'o}
10152 \gdefchar^^f4{\^o}
10153 \gdefchar^^f5{\~o}
10154 \gdefchar^^f6{\"o}
10155 \gdefchar^^f7{$\div$}
10156 \gdefchar^^f8{\o}
10157 \gdefchar^^f9{\`u}
10158 \gdefchar^^fa{\'u}
10159 \gdefchar^^fb{\^u}
10160 \gdefchar^^fc{\"u}
10161 \gdefchar^^fd{\'y}
10162 \gdefchar^^fe{\th}
10163 \gdefchar^^ff{\"y}
10166 % Latin9 (ISO-8859-15) encoding character definitions.
10167 \def\latninechardefs{%
10168 % Encoding is almost identical to Latin1.
10169 \latonechardefs
10171 \gdefchar^^a4{\euro}
10172 \gdefchar^^a6{\v S}
10173 \gdefchar^^a8{\v s}
10174 \gdefchar^^b4{\v Z}
10175 \gdefchar^^b8{\v z}
10176 \gdefchar^^bc{\OE}
10177 \gdefchar^^bd{\oe}
10178 \gdefchar^^be{\"Y}
10181 % Latin2 (ISO-8859-2) character definitions.
10182 \def\lattwochardefs{%
10183 \gdefchar^^a0{\tie}
10184 \gdefchar^^a1{\ogonek{A}}
10185 \gdefchar^^a2{\u{}}
10186 \gdefchar^^a3{\L}
10187 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10188 \gdefchar^^a5{\v L}
10189 \gdefchar^^a6{\'S}
10190 \gdefchar^^a7{\S}
10191 \gdefchar^^a8{\"{}}
10192 \gdefchar^^a9{\v S}
10193 \gdefchar^^aa{\cedilla S}
10194 \gdefchar^^ab{\v T}
10195 \gdefchar^^ac{\'Z}
10196 \gdefchar^^ad{\-}
10197 \gdefchar^^ae{\v Z}
10198 \gdefchar^^af{\dotaccent Z}
10200 \gdefchar^^b0{\textdegree}
10201 \gdefchar^^b1{\ogonek{a}}
10202 \gdefchar^^b2{\ogonek{ }}
10203 \gdefchar^^b3{\l}
10204 \gdefchar^^b4{\'{}}
10205 \gdefchar^^b5{\v l}
10206 \gdefchar^^b6{\'s}
10207 \gdefchar^^b7{\v{}}
10208 \gdefchar^^b8{\cedilla\ }
10209 \gdefchar^^b9{\v s}
10210 \gdefchar^^ba{\cedilla s}
10211 \gdefchar^^bb{\v t}
10212 \gdefchar^^bc{\'z}
10213 \gdefchar^^bd{\H{}}
10214 \gdefchar^^be{\v z}
10215 \gdefchar^^bf{\dotaccent z}
10217 \gdefchar^^c0{\'R}
10218 \gdefchar^^c1{\'A}
10219 \gdefchar^^c2{\^A}
10220 \gdefchar^^c3{\u A}
10221 \gdefchar^^c4{\"A}
10222 \gdefchar^^c5{\'L}
10223 \gdefchar^^c6{\'C}
10224 \gdefchar^^c7{\cedilla C}
10225 \gdefchar^^c8{\v C}
10226 \gdefchar^^c9{\'E}
10227 \gdefchar^^ca{\ogonek{E}}
10228 \gdefchar^^cb{\"E}
10229 \gdefchar^^cc{\v E}
10230 \gdefchar^^cd{\'I}
10231 \gdefchar^^ce{\^I}
10232 \gdefchar^^cf{\v D}
10234 \gdefchar^^d0{\DH}
10235 \gdefchar^^d1{\'N}
10236 \gdefchar^^d2{\v N}
10237 \gdefchar^^d3{\'O}
10238 \gdefchar^^d4{\^O}
10239 \gdefchar^^d5{\H O}
10240 \gdefchar^^d6{\"O}
10241 \gdefchar^^d7{$\times$}
10242 \gdefchar^^d8{\v R}
10243 \gdefchar^^d9{\ringaccent U}
10244 \gdefchar^^da{\'U}
10245 \gdefchar^^db{\H U}
10246 \gdefchar^^dc{\"U}
10247 \gdefchar^^dd{\'Y}
10248 \gdefchar^^de{\cedilla T}
10249 \gdefchar^^df{\ss}
10251 \gdefchar^^e0{\'r}
10252 \gdefchar^^e1{\'a}
10253 \gdefchar^^e2{\^a}
10254 \gdefchar^^e3{\u a}
10255 \gdefchar^^e4{\"a}
10256 \gdefchar^^e5{\'l}
10257 \gdefchar^^e6{\'c}
10258 \gdefchar^^e7{\cedilla c}
10259 \gdefchar^^e8{\v c}
10260 \gdefchar^^e9{\'e}
10261 \gdefchar^^ea{\ogonek{e}}
10262 \gdefchar^^eb{\"e}
10263 \gdefchar^^ec{\v e}
10264 \gdefchar^^ed{\'{\dotless{i}}}
10265 \gdefchar^^ee{\^{\dotless{i}}}
10266 \gdefchar^^ef{\v d}
10268 \gdefchar^^f0{\dh}
10269 \gdefchar^^f1{\'n}
10270 \gdefchar^^f2{\v n}
10271 \gdefchar^^f3{\'o}
10272 \gdefchar^^f4{\^o}
10273 \gdefchar^^f5{\H o}
10274 \gdefchar^^f6{\"o}
10275 \gdefchar^^f7{$\div$}
10276 \gdefchar^^f8{\v r}
10277 \gdefchar^^f9{\ringaccent u}
10278 \gdefchar^^fa{\'u}
10279 \gdefchar^^fb{\H u}
10280 \gdefchar^^fc{\"u}
10281 \gdefchar^^fd{\'y}
10282 \gdefchar^^fe{\cedilla t}
10283 \gdefchar^^ff{\dotaccent{}}
10286 % UTF-8 character definitions.
10288 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10289 % changes for Texinfo conventions. It is included here under the GPL by
10290 % permission from Frank Mittelbach and the LaTeX team.
10292 \newcount\countUTFx
10293 \newcount\countUTFy
10294 \newcount\countUTFz
10296 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10297 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10299 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10300 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10302 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10303 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10305 \gdef\UTFviiiDefined#1{%
10306 \ifx #1\relax
10307 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10308 \else
10309 \expandafter #1%
10313 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10314 \begingroup
10315 \catcode`\~13
10316 \catcode`\$12
10317 \catcode`\"12
10319 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10320 % substituting ~ and $ with a character token of that value.
10321 \def\UTFviiiLoop{%
10322 \global\catcode\countUTFx\active
10323 \uccode`\~\countUTFx
10324 \uccode`\$\countUTFx
10325 \uppercase\expandafter{\UTFviiiTmp}%
10326 \advance\countUTFx by 1
10327 \ifnum\countUTFx < \countUTFy
10328 \expandafter\UTFviiiLoop
10329 \fi}
10331 % For bytes other than the first in a UTF-8 sequence. Not expected to
10332 % be expanded except when writing to auxiliary files.
10333 \countUTFx = "80
10334 \countUTFy = "C2
10335 \def\UTFviiiTmp{%
10336 \gdef~{%
10337 \ifpassthroughchars $\fi}}%
10338 \UTFviiiLoop
10340 \countUTFx = "C2
10341 \countUTFy = "E0
10342 \def\UTFviiiTmp{%
10343 \gdef~{%
10344 \ifpassthroughchars $%
10345 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10346 \UTFviiiLoop
10348 \countUTFx = "E0
10349 \countUTFy = "F0
10350 \def\UTFviiiTmp{%
10351 \gdef~{%
10352 \ifpassthroughchars $%
10353 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10354 \UTFviiiLoop
10356 \countUTFx = "F0
10357 \countUTFy = "F4
10358 \def\UTFviiiTmp{%
10359 \gdef~{%
10360 \ifpassthroughchars $%
10361 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10363 \UTFviiiLoop
10364 \endgroup
10366 \def\globallet{\global\let} % save some \expandafter's below
10368 % @U{xxxx} to produce U+xxxx, if we support it.
10369 \def\U#1{%
10370 \expandafter\ifx\csname uni:#1\endcsname \relax
10371 \iftxinativeunicodecapable
10372 % All Unicode characters can be used if native Unicode handling is
10373 % active. However, if the font does not have the glyph,
10374 % letters are missing.
10375 \begingroup
10376 \uccode`\.="#1\relax
10377 \uppercase{.}
10378 \endgroup
10379 \else
10380 \errhelp = \EMsimple
10381 \errmessage{Unicode character U+#1 not supported, sorry}%
10383 \else
10384 \csname uni:#1\endcsname
10388 % These macros are used here to construct the name of a control
10389 % sequence to be defined.
10390 \def\UTFviiiTwoOctetsName#1#2{%
10391 \csname u8:#1\string #2\endcsname}%
10392 \def\UTFviiiThreeOctetsName#1#2#3{%
10393 \csname u8:#1\string #2\string #3\endcsname}%
10394 \def\UTFviiiFourOctetsName#1#2#3#4{%
10395 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10397 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10398 % provide a definition macro to replace a Unicode character;
10399 % this gets used by the @U command
10401 \begingroup
10402 \catcode`\"=12
10403 \catcode`\<=12
10404 \catcode`\.=12
10405 \catcode`\,=12
10406 \catcode`\;=12
10407 \catcode`\!=12
10408 \catcode`\~=13
10409 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10410 \countUTFz = "#1\relax
10411 \begingroup
10412 \parseXMLCharref
10414 % Give \u8:... its definition. The sequence of seven \expandafter's
10415 % expands after the \gdef three times, e.g.
10417 % 1. \UTFviiTwoOctetsName B1 B2
10418 % 2. \csname u8:B1 \string B2 \endcsname
10419 % 3. \u8: B1 B2 (a single control sequence token)
10421 \expandafter\expandafter
10422 \expandafter\expandafter
10423 \expandafter\expandafter
10424 \expandafter\gdef \UTFviiiTmp{#2}%
10426 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10427 \message{Internal error, already defined: #1}%
10430 % define an additional control sequence for this code point.
10431 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10432 \endgroup}
10434 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10435 % to the corresponding UTF-8 sequence.
10436 \gdef\parseXMLCharref{%
10437 \ifnum\countUTFz < "A0\relax
10438 \errhelp = \EMsimple
10439 \errmessage{Cannot define Unicode char value < 00A0}%
10440 \else\ifnum\countUTFz < "800\relax
10441 \parseUTFviiiA,%
10442 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10443 \else\ifnum\countUTFz < "10000\relax
10444 \parseUTFviiiA;%
10445 \parseUTFviiiA,%
10446 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10447 \else
10448 \parseUTFviiiA;%
10449 \parseUTFviiiA,%
10450 \parseUTFviiiA!%
10451 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10452 \fi\fi\fi
10455 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10456 % It must be a non-initial byte in the sequence.
10457 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10458 % of the bytes.
10459 \gdef\parseUTFviiiA#1{%
10460 \countUTFx = \countUTFz
10461 \divide\countUTFz by 64
10462 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10463 \multiply\countUTFz by 64
10465 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10466 % in order to get the last five bits.
10467 \advance\countUTFx by -\countUTFz
10469 % Convert this to the byte in the UTF-8 sequence.
10470 \advance\countUTFx by 128
10471 \uccode `#1\countUTFx
10472 \countUTFz = \countUTFy}
10474 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10475 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10476 % sequence.
10477 % #2 is one of the \UTFviii*OctetsName macros.
10478 % #3 is always a full stop (.)
10479 % #4 is a template for the other bytes in the sequence. The values for these
10480 % bytes is substituted in here with \uppercase using the \uccode's.
10481 \gdef\parseUTFviiiB#1#2#3#4{%
10482 \advance\countUTFz by "#10\relax
10483 \uccode `#3\countUTFz
10484 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10485 \endgroup
10487 % For native Unicode handling (XeTeX and LuaTeX),
10488 % provide a definition macro that sets a catcode to `other' non-globally
10490 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10491 \catcode"#1=\other
10494 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10495 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10496 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10497 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10498 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10500 % Many of our renditions are less than wonderful, and all the missing
10501 % characters are available somewhere. Loading the necessary fonts
10502 % awaits user request. We can't truly support Unicode without
10503 % reimplementing everything that's been done in LaTeX for many years,
10504 % plus probably using luatex or xetex, and who knows what else.
10505 % We won't be doing that here in this simple file. But we can try to at
10506 % least make most of the characters not bomb out.
10508 \def\unicodechardefs{%
10509 \DeclareUnicodeCharacter{00A0}{\tie}%
10510 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10511 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10512 \DeclareUnicodeCharacter{00A3}{\pounds}%
10513 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10514 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10515 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10516 \DeclareUnicodeCharacter{00A7}{\S}%
10517 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10518 \DeclareUnicodeCharacter{00A9}{\copyright}%
10519 \DeclareUnicodeCharacter{00AA}{\ordf}%
10520 \DeclareUnicodeCharacter{00AB}{\guillemetleft}%
10521 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10522 \DeclareUnicodeCharacter{00AD}{\-}%
10523 \DeclareUnicodeCharacter{00AE}{\registeredsymbol}%
10524 \DeclareUnicodeCharacter{00AF}{\={ }}%
10526 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
10527 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10528 \DeclareUnicodeCharacter{00B2}{$^2$}%
10529 \DeclareUnicodeCharacter{00B3}{$^3$}%
10530 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10531 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10532 \DeclareUnicodeCharacter{00B6}{\P}%
10533 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10534 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10535 \DeclareUnicodeCharacter{00B9}{$^1$}%
10536 \DeclareUnicodeCharacter{00BA}{\ordm}%
10537 \DeclareUnicodeCharacter{00BB}{\guillemetright}%
10538 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10539 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10540 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10541 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10543 \DeclareUnicodeCharacter{00C0}{\`A}%
10544 \DeclareUnicodeCharacter{00C1}{\'A}%
10545 \DeclareUnicodeCharacter{00C2}{\^A}%
10546 \DeclareUnicodeCharacter{00C3}{\~A}%
10547 \DeclareUnicodeCharacter{00C4}{\"A}%
10548 \DeclareUnicodeCharacter{00C5}{\AA}%
10549 \DeclareUnicodeCharacter{00C6}{\AE}%
10550 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10551 \DeclareUnicodeCharacter{00C8}{\`E}%
10552 \DeclareUnicodeCharacter{00C9}{\'E}%
10553 \DeclareUnicodeCharacter{00CA}{\^E}%
10554 \DeclareUnicodeCharacter{00CB}{\"E}%
10555 \DeclareUnicodeCharacter{00CC}{\`I}%
10556 \DeclareUnicodeCharacter{00CD}{\'I}%
10557 \DeclareUnicodeCharacter{00CE}{\^I}%
10558 \DeclareUnicodeCharacter{00CF}{\"I}%
10560 \DeclareUnicodeCharacter{00D0}{\DH}%
10561 \DeclareUnicodeCharacter{00D1}{\~N}%
10562 \DeclareUnicodeCharacter{00D2}{\`O}%
10563 \DeclareUnicodeCharacter{00D3}{\'O}%
10564 \DeclareUnicodeCharacter{00D4}{\^O}%
10565 \DeclareUnicodeCharacter{00D5}{\~O}%
10566 \DeclareUnicodeCharacter{00D6}{\"O}%
10567 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10568 \DeclareUnicodeCharacter{00D8}{\O}%
10569 \DeclareUnicodeCharacter{00D9}{\`U}%
10570 \DeclareUnicodeCharacter{00DA}{\'U}%
10571 \DeclareUnicodeCharacter{00DB}{\^U}%
10572 \DeclareUnicodeCharacter{00DC}{\"U}%
10573 \DeclareUnicodeCharacter{00DD}{\'Y}%
10574 \DeclareUnicodeCharacter{00DE}{\TH}%
10575 \DeclareUnicodeCharacter{00DF}{\ss}%
10577 \DeclareUnicodeCharacter{00E0}{\`a}%
10578 \DeclareUnicodeCharacter{00E1}{\'a}%
10579 \DeclareUnicodeCharacter{00E2}{\^a}%
10580 \DeclareUnicodeCharacter{00E3}{\~a}%
10581 \DeclareUnicodeCharacter{00E4}{\"a}%
10582 \DeclareUnicodeCharacter{00E5}{\aa}%
10583 \DeclareUnicodeCharacter{00E6}{\ae}%
10584 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10585 \DeclareUnicodeCharacter{00E8}{\`e}%
10586 \DeclareUnicodeCharacter{00E9}{\'e}%
10587 \DeclareUnicodeCharacter{00EA}{\^e}%
10588 \DeclareUnicodeCharacter{00EB}{\"e}%
10589 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10590 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10591 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10592 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10594 \DeclareUnicodeCharacter{00F0}{\dh}%
10595 \DeclareUnicodeCharacter{00F1}{\~n}%
10596 \DeclareUnicodeCharacter{00F2}{\`o}%
10597 \DeclareUnicodeCharacter{00F3}{\'o}%
10598 \DeclareUnicodeCharacter{00F4}{\^o}%
10599 \DeclareUnicodeCharacter{00F5}{\~o}%
10600 \DeclareUnicodeCharacter{00F6}{\"o}%
10601 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10602 \DeclareUnicodeCharacter{00F8}{\o}%
10603 \DeclareUnicodeCharacter{00F9}{\`u}%
10604 \DeclareUnicodeCharacter{00FA}{\'u}%
10605 \DeclareUnicodeCharacter{00FB}{\^u}%
10606 \DeclareUnicodeCharacter{00FC}{\"u}%
10607 \DeclareUnicodeCharacter{00FD}{\'y}%
10608 \DeclareUnicodeCharacter{00FE}{\th}%
10609 \DeclareUnicodeCharacter{00FF}{\"y}%
10611 \DeclareUnicodeCharacter{0100}{\=A}%
10612 \DeclareUnicodeCharacter{0101}{\=a}%
10613 \DeclareUnicodeCharacter{0102}{\u{A}}%
10614 \DeclareUnicodeCharacter{0103}{\u{a}}%
10615 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10616 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10617 \DeclareUnicodeCharacter{0106}{\'C}%
10618 \DeclareUnicodeCharacter{0107}{\'c}%
10619 \DeclareUnicodeCharacter{0108}{\^C}%
10620 \DeclareUnicodeCharacter{0109}{\^c}%
10621 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10622 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10623 \DeclareUnicodeCharacter{010C}{\v{C}}%
10624 \DeclareUnicodeCharacter{010D}{\v{c}}%
10625 \DeclareUnicodeCharacter{010E}{\v{D}}%
10626 \DeclareUnicodeCharacter{010F}{d'}%
10628 \DeclareUnicodeCharacter{0110}{\DH}%
10629 \DeclareUnicodeCharacter{0111}{\dh}%
10630 \DeclareUnicodeCharacter{0112}{\=E}%
10631 \DeclareUnicodeCharacter{0113}{\=e}%
10632 \DeclareUnicodeCharacter{0114}{\u{E}}%
10633 \DeclareUnicodeCharacter{0115}{\u{e}}%
10634 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10635 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10636 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10637 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10638 \DeclareUnicodeCharacter{011A}{\v{E}}%
10639 \DeclareUnicodeCharacter{011B}{\v{e}}%
10640 \DeclareUnicodeCharacter{011C}{\^G}%
10641 \DeclareUnicodeCharacter{011D}{\^g}%
10642 \DeclareUnicodeCharacter{011E}{\u{G}}%
10643 \DeclareUnicodeCharacter{011F}{\u{g}}%
10645 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10646 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10647 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10648 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10649 \DeclareUnicodeCharacter{0124}{\^H}%
10650 \DeclareUnicodeCharacter{0125}{\^h}%
10651 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10652 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10653 \DeclareUnicodeCharacter{0128}{\~I}%
10654 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10655 \DeclareUnicodeCharacter{012A}{\=I}%
10656 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10657 \DeclareUnicodeCharacter{012C}{\u{I}}%
10658 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10659 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10660 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10662 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10663 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10664 \DeclareUnicodeCharacter{0132}{IJ}%
10665 \DeclareUnicodeCharacter{0133}{ij}%
10666 \DeclareUnicodeCharacter{0134}{\^J}%
10667 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10668 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10669 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10670 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10671 \DeclareUnicodeCharacter{0139}{\'L}%
10672 \DeclareUnicodeCharacter{013A}{\'l}%
10673 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10674 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10675 \DeclareUnicodeCharacter{013D}{L'}% should kern
10676 \DeclareUnicodeCharacter{013E}{l'}% should kern
10677 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10679 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10680 \DeclareUnicodeCharacter{0141}{\L}%
10681 \DeclareUnicodeCharacter{0142}{\l}%
10682 \DeclareUnicodeCharacter{0143}{\'N}%
10683 \DeclareUnicodeCharacter{0144}{\'n}%
10684 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10685 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10686 \DeclareUnicodeCharacter{0147}{\v{N}}%
10687 \DeclareUnicodeCharacter{0148}{\v{n}}%
10688 \DeclareUnicodeCharacter{0149}{'n}%
10689 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10690 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10691 \DeclareUnicodeCharacter{014C}{\=O}%
10692 \DeclareUnicodeCharacter{014D}{\=o}%
10693 \DeclareUnicodeCharacter{014E}{\u{O}}%
10694 \DeclareUnicodeCharacter{014F}{\u{o}}%
10696 \DeclareUnicodeCharacter{0150}{\H{O}}%
10697 \DeclareUnicodeCharacter{0151}{\H{o}}%
10698 \DeclareUnicodeCharacter{0152}{\OE}%
10699 \DeclareUnicodeCharacter{0153}{\oe}%
10700 \DeclareUnicodeCharacter{0154}{\'R}%
10701 \DeclareUnicodeCharacter{0155}{\'r}%
10702 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10703 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10704 \DeclareUnicodeCharacter{0158}{\v{R}}%
10705 \DeclareUnicodeCharacter{0159}{\v{r}}%
10706 \DeclareUnicodeCharacter{015A}{\'S}%
10707 \DeclareUnicodeCharacter{015B}{\'s}%
10708 \DeclareUnicodeCharacter{015C}{\^S}%
10709 \DeclareUnicodeCharacter{015D}{\^s}%
10710 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10711 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10713 \DeclareUnicodeCharacter{0160}{\v{S}}%
10714 \DeclareUnicodeCharacter{0161}{\v{s}}%
10715 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10716 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10717 \DeclareUnicodeCharacter{0164}{\v{T}}%
10718 \DeclareUnicodeCharacter{0165}{\v{t}}%
10719 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10720 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10721 \DeclareUnicodeCharacter{0168}{\~U}%
10722 \DeclareUnicodeCharacter{0169}{\~u}%
10723 \DeclareUnicodeCharacter{016A}{\=U}%
10724 \DeclareUnicodeCharacter{016B}{\=u}%
10725 \DeclareUnicodeCharacter{016C}{\u{U}}%
10726 \DeclareUnicodeCharacter{016D}{\u{u}}%
10727 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10728 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10730 \DeclareUnicodeCharacter{0170}{\H{U}}%
10731 \DeclareUnicodeCharacter{0171}{\H{u}}%
10732 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10733 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10734 \DeclareUnicodeCharacter{0174}{\^W}%
10735 \DeclareUnicodeCharacter{0175}{\^w}%
10736 \DeclareUnicodeCharacter{0176}{\^Y}%
10737 \DeclareUnicodeCharacter{0177}{\^y}%
10738 \DeclareUnicodeCharacter{0178}{\"Y}%
10739 \DeclareUnicodeCharacter{0179}{\'Z}%
10740 \DeclareUnicodeCharacter{017A}{\'z}%
10741 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10742 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10743 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10744 \DeclareUnicodeCharacter{017E}{\v{z}}%
10745 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10747 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10748 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10749 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10750 \DeclareUnicodeCharacter{01C7}{LJ}%
10751 \DeclareUnicodeCharacter{01C8}{Lj}%
10752 \DeclareUnicodeCharacter{01C9}{lj}%
10753 \DeclareUnicodeCharacter{01CA}{NJ}%
10754 \DeclareUnicodeCharacter{01CB}{Nj}%
10755 \DeclareUnicodeCharacter{01CC}{nj}%
10756 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10757 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10758 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10760 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10761 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10762 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10763 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10764 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10766 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10767 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10768 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10769 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10770 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10771 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10773 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10774 \DeclareUnicodeCharacter{01F1}{DZ}%
10775 \DeclareUnicodeCharacter{01F2}{Dz}%
10776 \DeclareUnicodeCharacter{01F3}{dz}%
10777 \DeclareUnicodeCharacter{01F4}{\'G}%
10778 \DeclareUnicodeCharacter{01F5}{\'g}%
10779 \DeclareUnicodeCharacter{01F8}{\`N}%
10780 \DeclareUnicodeCharacter{01F9}{\`n}%
10781 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10782 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10783 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10784 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10786 \DeclareUnicodeCharacter{021E}{\v{H}}%
10787 \DeclareUnicodeCharacter{021F}{\v{h}}%
10789 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10790 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10791 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10792 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10793 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10794 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10796 \DeclareUnicodeCharacter{0232}{\=Y}%
10797 \DeclareUnicodeCharacter{0233}{\=y}%
10798 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10800 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10802 % Greek letters upper case
10803 \DeclareUnicodeCharacter{0391}{{\it A}}%
10804 \DeclareUnicodeCharacter{0392}{{\it B}}%
10805 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10806 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10807 \DeclareUnicodeCharacter{0395}{{\it E}}%
10808 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10809 \DeclareUnicodeCharacter{0397}{{\it H}}%
10810 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10811 \DeclareUnicodeCharacter{0399}{{\it I}}%
10812 \DeclareUnicodeCharacter{039A}{{\it K}}%
10813 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10814 \DeclareUnicodeCharacter{039C}{{\it M}}%
10815 \DeclareUnicodeCharacter{039D}{{\it N}}%
10816 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10817 \DeclareUnicodeCharacter{039F}{{\it O}}%
10818 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10819 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10820 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10821 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10822 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10823 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10824 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10825 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10826 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10827 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10829 % Vowels with accents
10830 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10831 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10832 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10833 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10834 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10835 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10837 % Standalone accent
10838 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10840 % Greek letters lower case
10841 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10842 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10843 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10844 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10845 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10846 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10847 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10848 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10849 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10850 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10851 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10852 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10853 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10854 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10855 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10856 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10857 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10858 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10859 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10860 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10861 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10862 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10863 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10864 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10865 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10867 % More Greek vowels with accents
10868 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10869 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10870 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10871 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10872 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10874 % Variant Greek letters
10875 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10876 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10877 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10879 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10880 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10881 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10882 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10883 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10884 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10885 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10886 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10887 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10888 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10889 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10890 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10892 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10893 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10895 \DeclareUnicodeCharacter{1E20}{\=G}%
10896 \DeclareUnicodeCharacter{1E21}{\=g}%
10897 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10898 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10899 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10900 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10901 \DeclareUnicodeCharacter{1E26}{\"H}%
10902 \DeclareUnicodeCharacter{1E27}{\"h}%
10904 \DeclareUnicodeCharacter{1E30}{\'K}%
10905 \DeclareUnicodeCharacter{1E31}{\'k}%
10906 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10907 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10908 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10909 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10910 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10911 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10912 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10913 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10914 \DeclareUnicodeCharacter{1E3E}{\'M}%
10915 \DeclareUnicodeCharacter{1E3F}{\'m}%
10917 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10918 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10919 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10920 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10921 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10922 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10923 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10924 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10925 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10926 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10928 \DeclareUnicodeCharacter{1E54}{\'P}%
10929 \DeclareUnicodeCharacter{1E55}{\'p}%
10930 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10931 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10932 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10933 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10934 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10935 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10936 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10937 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10939 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10940 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10941 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10942 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10943 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10944 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10945 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10946 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10947 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10948 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10950 \DeclareUnicodeCharacter{1E7C}{\~V}%
10951 \DeclareUnicodeCharacter{1E7D}{\~v}%
10952 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10953 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10955 \DeclareUnicodeCharacter{1E80}{\`W}%
10956 \DeclareUnicodeCharacter{1E81}{\`w}%
10957 \DeclareUnicodeCharacter{1E82}{\'W}%
10958 \DeclareUnicodeCharacter{1E83}{\'w}%
10959 \DeclareUnicodeCharacter{1E84}{\"W}%
10960 \DeclareUnicodeCharacter{1E85}{\"w}%
10961 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10962 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10963 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10964 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10965 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10966 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10967 \DeclareUnicodeCharacter{1E8C}{\"X}%
10968 \DeclareUnicodeCharacter{1E8D}{\"x}%
10969 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10970 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10972 \DeclareUnicodeCharacter{1E90}{\^Z}%
10973 \DeclareUnicodeCharacter{1E91}{\^z}%
10974 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10975 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10976 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10977 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
10978 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
10979 \DeclareUnicodeCharacter{1E97}{\"t}%
10980 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
10981 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
10983 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
10984 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
10986 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
10987 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
10988 \DeclareUnicodeCharacter{1EBC}{\~E}%
10989 \DeclareUnicodeCharacter{1EBD}{\~e}%
10991 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
10992 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
10993 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
10994 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
10996 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
10997 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
10999 \DeclareUnicodeCharacter{1EF2}{\`Y}%
11000 \DeclareUnicodeCharacter{1EF3}{\`y}%
11001 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
11003 \DeclareUnicodeCharacter{1EF8}{\~Y}%
11004 \DeclareUnicodeCharacter{1EF9}{\~y}%
11006 % Punctuation
11007 \DeclareUnicodeCharacter{2013}{--}%
11008 \DeclareUnicodeCharacter{2014}{---}%
11009 \DeclareUnicodeCharacter{2018}{\quoteleft}%
11010 \DeclareUnicodeCharacter{2019}{\quoteright}%
11011 \DeclareUnicodeCharacter{201A}{\quotesinglbase}%
11012 \DeclareUnicodeCharacter{201C}{\quotedblleft}%
11013 \DeclareUnicodeCharacter{201D}{\quotedblright}%
11014 \DeclareUnicodeCharacter{201E}{\quotedblbase}%
11015 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
11016 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
11017 \DeclareUnicodeCharacter{2022}{\bullet}%
11018 \DeclareUnicodeCharacter{202F}{\thinspace}%
11019 \DeclareUnicodeCharacter{2026}{\dots}%
11020 \DeclareUnicodeCharacter{2039}{\guilsinglleft}%
11021 \DeclareUnicodeCharacter{203A}{\guilsinglright}%
11023 \DeclareUnicodeCharacter{20AC}{\euro}%
11025 \DeclareUnicodeCharacter{2192}{\expansion}%
11026 \DeclareUnicodeCharacter{21D2}{\result}%
11028 % Mathematical symbols
11029 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
11030 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
11031 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
11032 \DeclareUnicodeCharacter{2212}{\minus}%
11033 \DeclareUnicodeCharacter{2217}{\ast}%
11034 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
11035 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
11036 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
11037 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
11038 \DeclareUnicodeCharacter{2261}{\equiv}%
11039 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
11040 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
11041 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
11042 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
11044 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
11045 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
11046 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
11047 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
11048 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
11049 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
11050 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
11051 \DeclareUnicodeCharacter{2127}{\ensuremath\mho}%
11052 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11053 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11054 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11055 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11056 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11057 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11058 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11059 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11060 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11061 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11062 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11063 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11064 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11065 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11066 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11067 \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}%
11068 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11069 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11070 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11071 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11072 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11073 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11074 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11075 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11076 \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}%
11077 \DeclareUnicodeCharacter{2201}{\ensuremath\complement}%
11078 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11079 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11080 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11081 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11082 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11083 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11084 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11085 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11086 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11087 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11088 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11089 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11090 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11091 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11092 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11093 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11094 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11095 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11096 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11097 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11098 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11099 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11100 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11101 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11102 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11103 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11104 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11105 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11106 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11107 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11108 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11109 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11110 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11111 \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}%
11112 \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}%
11113 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11114 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11115 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11116 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11117 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11118 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11119 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11120 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11121 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11122 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11123 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11124 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11125 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11126 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11127 \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}%
11128 \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}%
11129 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11130 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11131 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11132 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11133 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11134 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11135 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11136 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11137 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11138 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11139 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11140 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11141 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11142 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11144 \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}%
11145 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11146 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11147 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11148 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11149 \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}%
11150 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11151 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11152 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11153 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11154 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11155 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11156 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11157 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11158 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11159 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11160 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11161 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11162 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11163 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11164 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11165 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11166 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11167 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11168 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11169 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11170 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11171 \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}%
11172 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11173 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11174 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11176 \global\mathchardef\checkmark="1370% actually the square root sign
11177 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11178 }% end of \unicodechardefs
11180 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11181 % It makes the setting that replace UTF-8 byte sequence.
11182 \def\utfeightchardefs{%
11183 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11184 \unicodechardefs
11187 % Whether the active definitions of non-ASCII characters expand to
11188 % non-active tokens with the same character code. This is used to
11189 % write characters literally, instead of using active definitions for
11190 % printing the correct glyphs.
11191 \newif\ifpassthroughchars
11192 \passthroughcharsfalse
11194 % For native Unicode handling (XeTeX and LuaTeX),
11195 % provide a definition macro to replace/pass-through a Unicode character
11197 \def\DeclareUnicodeCharacterNative#1#2{%
11198 \catcode"#1=\active
11199 \def\dodeclareunicodecharacternative##1##2##3{%
11200 \begingroup
11201 \uccode`\~="##2\relax
11202 \uppercase{\gdef~}{%
11203 \ifpassthroughchars
11204 ##1%
11205 \else
11206 ##3%
11209 \endgroup
11211 \begingroup
11212 \uccode`\.="#1\relax
11213 \uppercase{\def\UTFNativeTmp{.}}%
11214 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11215 \endgroup
11218 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11219 % It activates the setting that replaces Unicode characters.
11220 \def\nativeunicodechardefs{%
11221 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11222 \unicodechardefs
11225 % For native Unicode handling (XeTeX and LuaTeX),
11226 % make the character token expand
11227 % to the sequences given in \unicodechardefs for printing.
11228 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11229 \def\UTFAtUTmp{#2}
11230 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11233 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11234 \def\nativeunicodechardefsatu{%
11235 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11236 \unicodechardefs
11239 % US-ASCII character definitions.
11240 \def\asciichardefs{% nothing need be done
11241 \relax
11244 % define all Unicode characters we know about, for the sake of @U.
11245 \iftxinativeunicodecapable
11246 \nativeunicodechardefsatu
11247 \else
11248 \utfeightchardefs
11252 % Make non-ASCII characters printable again for compatibility with
11253 % existing Texinfo documents that may use them, even without declaring a
11254 % document encoding.
11256 \setnonasciicharscatcode \other
11259 \message{formatting,}
11261 \newdimen\defaultparindent \defaultparindent = 15pt
11263 \chapheadingskip = 15pt plus 4pt minus 2pt
11264 \secheadingskip = 12pt plus 3pt minus 2pt
11265 \subsecheadingskip = 9pt plus 2pt minus 2pt
11267 % Prevent underfull vbox error messages.
11268 \vbadness = 10000
11270 % Don't be very finicky about underfull hboxes, either.
11271 \hbadness = 6666
11273 % Following George Bush, get rid of widows and orphans.
11274 \widowpenalty=10000
11275 \clubpenalty=10000
11277 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11278 % using an old version of TeX, don't do anything. We want the amount of
11279 % stretch added to depend on the line length, hence the dependence on
11280 % \hsize. We call this whenever the paper size is set.
11282 \def\setemergencystretch{%
11283 \ifx\emergencystretch\thisisundefined
11284 % Allow us to assign to \emergencystretch anyway.
11285 \def\emergencystretch{\dimen0}%
11286 \else
11287 \emergencystretch = .15\hsize
11291 % Parameters in order: 1) textheight; 2) textwidth;
11292 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11293 % 7) physical page height; 8) physical page width.
11295 % We also call \setleading{\textleading}, so the caller should define
11296 % \textleading. The caller should also set \parskip.
11298 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11299 \voffset = #3\relax
11300 \topskip = #6\relax
11301 \splittopskip = \topskip
11303 \vsize = #1\relax
11304 \advance\vsize by \topskip
11305 \outervsize = \vsize
11306 \advance\outervsize by 2\topandbottommargin
11307 \txipageheight = \vsize
11309 \hsize = #2\relax
11310 \outerhsize = \hsize
11311 \advance\outerhsize by 0.5in
11312 \txipagewidth = \hsize
11314 \normaloffset = #4\relax
11315 \bindingoffset = #5\relax
11317 \ifpdf
11318 \pdfpageheight #7\relax
11319 \pdfpagewidth #8\relax
11320 % if we don't reset these, they will remain at "1 true in" of
11321 % whatever layout pdftex was dumped with.
11322 \pdfhorigin = 1 true in
11323 \pdfvorigin = 1 true in
11324 \else
11325 \ifx\XeTeXrevision\thisisundefined
11326 \else
11327 \pdfpageheight #7\relax
11328 \pdfpagewidth #8\relax
11329 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11333 \setleading{\textleading}
11335 \parindent = \defaultparindent
11336 \setemergencystretch
11339 % @letterpaper (the default).
11340 \def\letterpaper{{\globaldefs = 1
11341 \parskip = 3pt plus 2pt minus 1pt
11342 \textleading = 13.2pt
11344 % If page is nothing but text, make it come out even.
11345 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11346 {\voffset}{.25in}%
11347 {\bindingoffset}{36pt}%
11348 {11in}{8.5in}%
11351 % Use @smallbook to reset parameters for 7x9.25 trim size.
11352 \def\smallbook{{\globaldefs = 1
11353 \parskip = 2pt plus 1pt
11354 \textleading = 12pt
11356 \internalpagesizes{7.5in}{5in}%
11357 {-.2in}{0in}%
11358 {\bindingoffset}{16pt}%
11359 {9.25in}{7in}%
11361 \lispnarrowing = 0.3in
11362 \tolerance = 700
11363 \hfuzz = 1pt
11364 \contentsrightmargin = 0pt
11365 \defbodyindent = .5cm
11368 % Use @smallerbook to reset parameters for 6x9 trim size.
11369 % (Just testing, parameters still in flux.)
11370 \def\smallerbook{{\globaldefs = 1
11371 \parskip = 1.5pt plus 1pt
11372 \textleading = 12pt
11374 \internalpagesizes{7.4in}{4.8in}%
11375 {-.2in}{-.4in}%
11376 {0pt}{14pt}%
11377 {9in}{6in}%
11379 \lispnarrowing = 0.25in
11380 \tolerance = 700
11381 \hfuzz = 1pt
11382 \contentsrightmargin = 0pt
11383 \defbodyindent = .4cm
11386 % Use @afourpaper to print on European A4 paper.
11387 \def\afourpaper{{\globaldefs = 1
11388 \parskip = 3pt plus 2pt minus 1pt
11389 \textleading = 13.2pt
11391 % Double-side printing via postscript on Laserjet 4050
11392 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11393 % To change the settings for a different printer or situation, adjust
11394 % \normaloffset until the front-side and back-side texts align. Then
11395 % do the same for \bindingoffset. You can set these for testing in
11396 % your texinfo source file like this:
11397 % @tex
11398 % \global\normaloffset = -6mm
11399 % \global\bindingoffset = 10mm
11400 % @end tex
11401 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11402 {\voffset}{\hoffset}%
11403 {\bindingoffset}{44pt}%
11404 {297mm}{210mm}%
11406 \tolerance = 700
11407 \hfuzz = 1pt
11408 \contentsrightmargin = 0pt
11409 \defbodyindent = 5mm
11412 % Use @afivepaper to print on European A5 paper.
11413 % From romildo@urano.iceb.ufop.br, 2 July 2000.
11414 % He also recommends making @example and @lisp be small.
11415 \def\afivepaper{{\globaldefs = 1
11416 \parskip = 2pt plus 1pt minus 0.1pt
11417 \textleading = 12.5pt
11419 \internalpagesizes{160mm}{120mm}%
11420 {\voffset}{\hoffset}%
11421 {\bindingoffset}{8pt}%
11422 {210mm}{148mm}%
11424 \lispnarrowing = 0.2in
11425 \tolerance = 800
11426 \hfuzz = 1.2pt
11427 \contentsrightmargin = 0pt
11428 \defbodyindent = 2mm
11429 \tableindent = 12mm
11432 % A specific text layout, 24x15cm overall, intended for A4 paper.
11433 \def\afourlatex{{\globaldefs = 1
11434 \afourpaper
11435 \internalpagesizes{237mm}{150mm}%
11436 {\voffset}{4.6mm}%
11437 {\bindingoffset}{7mm}%
11438 {297mm}{210mm}%
11440 % Must explicitly reset to 0 because we call \afourpaper.
11441 \globaldefs = 0
11444 % Use @afourwide to print on A4 paper in landscape format.
11445 \def\afourwide{{\globaldefs = 1
11446 \afourpaper
11447 \internalpagesizes{241mm}{165mm}%
11448 {\voffset}{-2.95mm}%
11449 {\bindingoffset}{7mm}%
11450 {297mm}{210mm}%
11451 \globaldefs = 0
11454 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11455 % Perhaps we should allow setting the margins, \topskip, \parskip,
11456 % and/or leading, also. Or perhaps we should compute them somehow.
11458 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11459 \def\pagesizesyyy#1,#2,#3\finish{{%
11460 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11461 \globaldefs = 1
11463 \parskip = 3pt plus 2pt minus 1pt
11464 \setleading{\textleading}%
11466 \dimen0 = #1\relax
11467 \advance\dimen0 by \voffset
11469 \dimen2 = \hsize
11470 \advance\dimen2 by \normaloffset
11472 \internalpagesizes{#1}{\hsize}%
11473 {\voffset}{\normaloffset}%
11474 {\bindingoffset}{44pt}%
11475 {\dimen0}{\dimen2}%
11478 % Set default to letter.
11480 \letterpaper
11483 \message{and turning on texinfo input format.}
11485 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11487 % DEL is a comment character, in case @c does not suffice.
11488 \catcode`\^^? = 14
11490 % Define macros to output various characters with catcode for normal text.
11491 \catcode`\"=\other \def\normaldoublequote{"}
11492 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11493 \catcode`\+=\other \def\normalplus{+}
11494 \catcode`\<=\other \def\normalless{<}
11495 \catcode`\>=\other \def\normalgreater{>}
11496 \catcode`\^=\other \def\normalcaret{^}
11497 \catcode`\_=\other \def\normalunderscore{_}
11498 \catcode`\|=\other \def\normalverticalbar{|}
11499 \catcode`\~=\other \def\normaltilde{~}
11501 % This macro is used to make a character print one way in \tt
11502 % (where it can probably be output as-is), and another way in other fonts,
11503 % where something hairier probably needs to be done.
11505 % #1 is what to print if we are indeed using \tt; #2 is what to print
11506 % otherwise. Since all the Computer Modern typewriter fonts have zero
11507 % interword stretch (and shrink), and it is reasonable to expect all
11508 % typewriter fonts to have this, we can check that font parameter.
11510 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
11512 % Same as above, but check for italic font. Actually this also catches
11513 % non-italic slanted fonts since it is impossible to distinguish them from
11514 % italic fonts. But since this is only used by $ and it uses \sl anyway
11515 % this is not a problem.
11516 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
11518 % Set catcodes for Texinfo file
11520 % Active characters for printing the wanted glyph.
11521 % Most of these we simply print from the \tt font, but for some, we can
11522 % use math or other variants that look better in normal text.
11524 \catcode`\"=\active
11525 \def\activedoublequote{{\tt\char34}}
11526 \let"=\activedoublequote
11527 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11528 \chardef\hatchar=`\^
11529 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11531 \catcode`\_=\active
11532 \def_{\ifusingtt\normalunderscore\_}
11533 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11534 \let\realunder=_
11536 \catcode`\|=\active \def|{{\tt\char124}}
11538 \chardef \less=`\<
11539 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11540 \chardef \gtr=`\>
11541 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11542 \catcode`\+=\active \def+{{\tt \char 43}}
11543 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11544 \catcode`\-=\active \let-=\normaldash
11547 % used for headline/footline in the output routine, in case the page
11548 % breaks in the middle of an @tex block.
11549 \def\texinfochars{%
11550 \let< = \activeless
11551 \let> = \activegtr
11552 \let~ = \activetilde
11553 \let^ = \activehat
11554 \markupsetuplqdefault \markupsetuprqdefault
11555 \let\b = \strong
11556 \let\i = \smartitalic
11557 % in principle, all other definitions in \tex have to be undone too.
11560 % Used sometimes to turn off (effectively) the active characters even after
11561 % parsing them.
11562 \def\turnoffactive{%
11563 \normalturnoffactive
11564 \otherbackslash
11567 \catcode`\@=0
11569 % \backslashcurfont outputs one backslash character in current font,
11570 % as in \char`\\.
11571 \global\chardef\backslashcurfont=`\\
11572 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
11574 % \realbackslash is an actual character `\' with catcode other, and
11575 % \doublebackslash is two of them (for the pdf outlines).
11576 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
11578 % In Texinfo, backslash is an active character; it prints the backslash
11579 % in fixed width font.
11580 \catcode`\\=\active % @ for escape char from now on.
11582 % Print a typewriter backslash. For math mode, we can't simply use
11583 % \backslashcurfont: the story here is that in math mode, the \char
11584 % of \backslashcurfont ends up printing the roman \ from the math symbol
11585 % font (because \char in math mode uses the \mathcode, and plain.tex
11586 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11587 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11588 % ignored family value; char position "5C). We can't use " for the
11589 % usual hex value because it has already been made active.
11591 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11592 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11594 % \rawbackslash defines an active \ to do \backslashcurfont.
11595 % \otherbackslash defines an active \ to be a literal `\' character with
11596 % catcode other. We switch back and forth between these.
11597 @gdef@rawbackslash{@let\=@backslashcurfont}
11598 @gdef@otherbackslash{@let\=@realbackslash}
11600 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11601 % the literal character `\'.
11603 {@catcode`- = @active
11604 @gdef@normalturnoffactive{%
11605 @passthroughcharstrue
11606 @let-=@normaldash
11607 @let"=@normaldoublequote
11608 @let$=@normaldollar %$ font-lock fix
11609 @let+=@normalplus
11610 @let<=@normalless
11611 @let>=@normalgreater
11612 @let^=@normalcaret
11613 @let_=@normalunderscore
11614 @let|=@normalverticalbar
11615 @let~=@normaltilde
11616 @let\=@ttbackslash
11617 @markupsetuplqdefault
11618 @markupsetuprqdefault
11619 @unsepspaces
11623 % If a .fmt file is being used, characters that might appear in a file
11624 % name cannot be active until we have parsed the command line.
11625 % So turn them off again, and have @fixbackslash turn them back on.
11626 @catcode`+=@other @catcode`@_=@other
11628 % \enablebackslashhack - allow file to begin `\input texinfo'
11630 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11631 % That is what \eatinput is for; after that, the `\' should revert to printing
11632 % a backslash.
11633 % If the file did not have a `\input texinfo', then it is turned off after
11634 % the first line; otherwise the first `\' in the file would cause an error.
11635 % This is used on the very last line of this file, texinfo.tex.
11636 % We also use @c to call @fixbackslash, in case ends of lines are hidden.
11638 @catcode`@^=7
11639 @catcode`@^^M=13@gdef@enablebackslashhack{%
11640 @global@let\ = @eatinput%
11641 @catcode`@^^M=13%
11642 @def@c{@fixbackslash@c}%
11643 % Definition for the newline at the end of this file.
11644 @def ^^M{@let^^M@secondlinenl}%
11645 % Definition for a newline in the main Texinfo file.
11646 @gdef @secondlinenl{@fixbackslash}%
11649 {@catcode`@^=7 @catcode`@^^M=13%
11650 @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11652 % Emergency active definition of newline, in case an active newline token
11653 % appears by mistake.
11654 {@catcode`@^=7 @catcode13=13%
11655 @gdef@enableemergencynewline{%
11656 @gdef^^M{%
11657 @par%
11658 %<warning: active newline>@par%
11662 @gdef@fixbackslash{%
11663 @ifx\@eatinput @let\ = @ttbackslash @fi
11664 @catcode13=5 % regular end of line
11665 @enableemergencynewline
11666 @let@c=@texinfoc
11667 % Also turn back on active characters that might appear in the input
11668 % file name, in case not using a pre-dumped format.
11669 @catcode`+=@active
11670 @catcode`@_=@active
11672 % If texinfo.cnf is present on the system, read it.
11673 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11674 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11675 % directly in this file, texinfo.tex, makes it possible to make a format
11676 % file for Texinfo.
11678 @openin 1 texinfo.cnf
11679 @ifeof 1 @else @input texinfo.cnf @fi
11680 @closein 1
11684 % Say @foo, not \foo, in error messages.
11685 @escapechar = `@@
11687 % These (along with & and #) are made active for url-breaking, so need
11688 % active definitions as the normal characters.
11689 @def@normaldot{.}
11690 @def@normalquest{?}
11691 @def@normalslash{/}
11693 % These look ok in all fonts, so just make them not special.
11694 % @hashchar{} gets its own user-level command, because of #line.
11695 @catcode`@& = @other @def@normalamp{&}
11696 @catcode`@# = @other @def@normalhash{#}
11697 @catcode`@% = @other @def@normalpercent{%}
11699 @let @hashchar = @normalhash
11701 @c Finally, make ` and ' active, so that txicodequoteundirected and
11702 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11703 @c don't make ` and ' active, @code will not get them as active chars.
11704 @c Do this last of all since we use ` in the previous @catcode assignments.
11705 @catcode`@'=@active
11706 @catcode`@`=@active
11707 @markupsetuplqdefault
11708 @markupsetuprqdefault
11710 @c Local variables:
11711 @c eval: (add-hook 'write-file-hooks 'time-stamp)
11712 @c page-delimiter: "^\\\\message\\|emacs-page"
11713 @c time-stamp-start: "def\\\\texinfoversion{"
11714 @c time-stamp-format: "%:y-%02m-%02d.%02H"
11715 @c time-stamp-end: "}"
11716 @c End:
11718 @c vim:sw=2:
11720 @ignore
11721 arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
11722 @end ignore
11723 @enablebackslashhack