Update from gnulib
[emacs.git] / doc / misc / texinfo.tex
blob5a1f728da480290fbe913a905b424287d0cab014
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-03.13}
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 \ifx\luatexversion\thisisundefined
1112 \else
1113 % Escape PDF strings UTF-8 to UTF-16
1114 \begingroup
1115 \catcode`\%=12
1116 \directlua{
1117 function UTF16oct(str)
1118 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1119 for c in string.utfvalues(str) do
1120 if c < 0x10000 then
1121 tex.sprint(
1122 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1123 string.char(0x5c) .. string.char(0x25) .. '03o',
1124 (c / 256), (c % 256)))
1125 else
1126 c = c - 0x10000
1127 local c_hi = c / 1024 + 0xd800
1128 local c_lo = c % 1024 + 0xdc00
1129 tex.sprint(
1130 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1131 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1132 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1133 string.char(0x5c) .. string.char(0x25) .. '03o',
1134 (c_hi / 256), (c_hi % 256),
1135 (c_lo / 256), (c_lo % 256)))
1140 \endgroup
1141 \def\pdfescapestring#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1142 \ifnum\luatexversion>84
1143 % For LuaTeX >= 0.85
1144 \def\pdfdest{\pdfextension dest}
1145 \let\pdfoutput\outputmode
1146 \def\pdfliteral{\pdfextension literal}
1147 \def\pdfcatalog{\pdfextension catalog}
1148 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1149 \let\pdfximage\saveimageresource
1150 \let\pdfrefximage\useimageresource
1151 \let\pdflastximage\lastsavedimageresourceindex
1152 \def\pdfendlink{\pdfextension endlink\relax}
1153 \def\pdfoutline{\pdfextension outline}
1154 \def\pdfstartlink{\pdfextension startlink}
1155 \def\pdffontattr{\pdfextension fontattr}
1156 \def\pdfobj{\pdfextension obj}
1157 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1158 \let\pdfpagewidth\pagewidth
1159 \let\pdfpageheight\pageheight
1160 \edef\pdfhorigin{\pdfvariable horigin}
1161 \edef\pdfvorigin{\pdfvariable vorigin}
1165 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1166 % can be set). So we test for \relax and 0 as well as being undefined.
1167 \ifx\pdfoutput\thisisundefined
1168 \else
1169 \ifx\pdfoutput\relax
1170 \else
1171 \ifcase\pdfoutput
1172 \else
1173 \pdftrue
1178 % PDF uses PostScript string constants for the names of xref targets,
1179 % for display in the outlines, and in other places. Thus, we have to
1180 % double any backslashes. Otherwise, a name like "\node" will be
1181 % interpreted as a newline (\n), followed by o, d, e. Not good.
1183 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1184 % related messages. The final outcome is that it is up to the TeX user
1185 % to double the backslashes and otherwise make the string valid, so
1186 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1187 % do this reliably, so we use it.
1189 % #1 is a control sequence in which to do the replacements,
1190 % which we \xdef.
1191 \def\txiescapepdf#1{%
1192 \ifx\pdfescapestring\thisisundefined
1193 % No primitive available; should we give a warning or log?
1194 % Many times it won't matter.
1195 \xdef#1{#1}%
1196 \else
1197 % The expandable \pdfescapestring primitive escapes parentheses,
1198 % backslashes, and other special chars.
1199 \xdef#1{\pdfescapestring{#1}}%
1203 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1204 with PDF output, and none of those formats could be found. (.eps cannot
1205 be supported due to the design of the PDF format; use regular TeX (DVI
1206 output) for that.)}
1208 \ifpdf
1210 % Color manipulation macros using ideas from pdfcolor.tex,
1211 % except using rgb instead of cmyk; the latter is said to render as a
1212 % very dark gray on-screen and a very dark halftone in print, instead
1213 % of actual black. The dark red here is dark enough to print on paper as
1214 % nearly black, but still distinguishable for online viewing. We use
1215 % black by default, though.
1216 \def\rgbDarkRed{0.50 0.09 0.12}
1217 \def\rgbBlack{0 0 0}
1219 % rg sets the color for filling (usual text, etc.);
1220 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1221 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1223 % Set color, and create a mark which defines \thiscolor accordingly,
1224 % so that \makeheadline knows which color to restore.
1225 \def\setcolor#1{%
1226 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1227 \domark
1228 \pdfsetcolor{#1}%
1231 \def\maincolor{\rgbBlack}
1232 \pdfsetcolor{\maincolor}
1233 \edef\thiscolor{\maincolor}
1234 \def\lastcolordefs{}
1236 \def\makefootline{%
1237 \baselineskip24pt
1238 \line{\pdfsetcolor{\maincolor}\the\footline}%
1241 \def\makeheadline{%
1242 \vbox to 0pt{%
1243 \vskip-22.5pt
1244 \line{%
1245 \vbox to8.5pt{}%
1246 % Extract \thiscolor definition from the marks.
1247 \getcolormarks
1248 % Typeset the headline with \maincolor, then restore the color.
1249 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1251 \vss
1253 \nointerlineskip
1257 \pdfcatalog{/PageMode /UseOutlines}
1259 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1260 \def\dopdfimage#1#2#3{%
1261 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1262 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1264 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1265 % others). Let's try in that order, PDF first since if
1266 % someone has a scalable image, presumably better to use that than a
1267 % bitmap.
1268 \let\pdfimgext=\empty
1269 \begingroup
1270 \openin 1 #1.pdf \ifeof 1
1271 \openin 1 #1.PDF \ifeof 1
1272 \openin 1 #1.png \ifeof 1
1273 \openin 1 #1.jpg \ifeof 1
1274 \openin 1 #1.jpeg \ifeof 1
1275 \openin 1 #1.JPG \ifeof 1
1276 \errhelp = \nopdfimagehelp
1277 \errmessage{Could not find image file #1 for pdf}%
1278 \else \gdef\pdfimgext{JPG}%
1280 \else \gdef\pdfimgext{jpeg}%
1282 \else \gdef\pdfimgext{jpg}%
1284 \else \gdef\pdfimgext{png}%
1286 \else \gdef\pdfimgext{PDF}%
1288 \else \gdef\pdfimgext{pdf}%
1290 \closein 1
1291 \endgroup
1293 % without \immediate, ancient pdftex seg faults when the same image is
1294 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1295 \ifnum\pdftexversion < 14
1296 \immediate\pdfimage
1297 \else
1298 \immediate\pdfximage
1300 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1301 \ifdim \wd2 >0pt height \pdfimageheight \fi
1302 \ifnum\pdftexversion<13
1303 #1.\pdfimgext
1304 \else
1305 {#1.\pdfimgext}%
1307 \ifnum\pdftexversion < 14 \else
1308 \pdfrefximage \pdflastximage
1309 \fi}
1311 \def\pdfmkdest#1{{%
1312 % We have to set dummies so commands such as @code, and characters
1313 % such as \, aren't expanded when present in a section title.
1314 \indexnofonts
1315 \makevalueexpandable
1316 \turnoffactive
1317 % Use ASCII approximations in destination names.
1318 \passthroughcharsfalse
1319 \def\pdfdestname{#1}%
1320 \txiescapepdf\pdfdestname
1321 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1324 % used to mark target names; must be expandable.
1325 \def\pdfmkpgn#1{#1}
1327 % by default, use black for everything.
1328 \def\urlcolor{\rgbBlack}
1329 \def\linkcolor{\rgbBlack}
1330 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1332 % Adding outlines to PDF; macros for calculating structure of outlines
1333 % come from Petr Olsak
1334 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1335 \else \csname#1\endcsname \fi}
1336 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1337 \advance\tempnum by 1
1338 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1340 % #1 is the section text, which is what will be displayed in the
1341 % outline by the pdf viewer. #2 is the pdf expression for the number
1342 % of subentries (or empty, for subsubsections). #3 is the node text,
1343 % which might be empty if this toc entry had no corresponding node.
1344 % #4 is the page number
1346 \def\dopdfoutline#1#2#3#4{%
1347 % Generate a link to the node text if that exists; else, use the
1348 % page number. We could generate a destination for the section
1349 % text in the case where a section has no node, but it doesn't
1350 % seem worth the trouble, since most documents are normally structured.
1352 \ifx\luatexversion\thisisundefined \else
1353 \turnoffactive % LuaTeX can use Unicode strings for PDF
1355 \edef\pdfoutlinedest{#3}%
1356 \ifx\pdfoutlinedest\empty
1357 \def\pdfoutlinedest{#4}%
1358 \else
1359 \txiescapepdf\pdfoutlinedest
1362 % Also escape PDF chars in the display string.
1363 \bgroup
1364 \ifx \declaredencoding \latone
1365 % The PDF format can use an extended form of Latin-1 in bookmark
1366 % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1367 % the "PDFDocEncoding".
1368 \passthroughcharstrue
1370 \ifx \declaredencoding \utfeight
1371 % TODO: the PDF format can use UTF-16 in bookmark strings, but the
1372 % code for this isn't done yet.
1374 \globaldefs=1
1375 \edef\pdfoutlinetext{#1}%
1376 \txiescapepdf\pdfoutlinetext
1377 \egroup
1379 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1383 \def\pdfmakeoutlines{%
1384 \begingroup
1385 % Read toc silently, to get counts of subentries for \pdfoutline.
1386 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1387 \def\numchapentry##1##2##3##4{%
1388 \def\thischapnum{##2}%
1389 \def\thissecnum{0}%
1390 \def\thissubsecnum{0}%
1392 \def\numsecentry##1##2##3##4{%
1393 \advancenumber{chap\thischapnum}%
1394 \def\thissecnum{##2}%
1395 \def\thissubsecnum{0}%
1397 \def\numsubsecentry##1##2##3##4{%
1398 \advancenumber{sec\thissecnum}%
1399 \def\thissubsecnum{##2}%
1401 \def\numsubsubsecentry##1##2##3##4{%
1402 \advancenumber{subsec\thissubsecnum}%
1404 \def\thischapnum{0}%
1405 \def\thissecnum{0}%
1406 \def\thissubsecnum{0}%
1408 % use \def rather than \let here because we redefine \chapentry et
1409 % al. a second time, below.
1410 \def\appentry{\numchapentry}%
1411 \def\appsecentry{\numsecentry}%
1412 \def\appsubsecentry{\numsubsecentry}%
1413 \def\appsubsubsecentry{\numsubsubsecentry}%
1414 \def\unnchapentry{\numchapentry}%
1415 \def\unnsecentry{\numsecentry}%
1416 \def\unnsubsecentry{\numsubsecentry}%
1417 \def\unnsubsubsecentry{\numsubsubsecentry}%
1418 \readdatafile{toc}%
1420 % Read toc second time, this time actually producing the outlines.
1421 % The `-' means take the \expnumber as the absolute number of
1422 % subentries, which we calculated on our first read of the .toc above.
1424 % We use the node names as the destinations.
1425 \def\numchapentry##1##2##3##4{%
1426 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1427 \def\numsecentry##1##2##3##4{%
1428 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1429 \def\numsubsecentry##1##2##3##4{%
1430 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1431 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1432 \dopdfoutline{##1}{}{##3}{##4}}%
1434 % PDF outlines are displayed using system fonts, instead of
1435 % document fonts. Therefore we cannot use special characters,
1436 % since the encoding is unknown. For example, the eogonek from
1437 % Latin 2 (0xea) gets translated to a | character. Info from
1438 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1440 % TODO this right, we have to translate 8-bit characters to
1441 % their "best" equivalent, based on the @documentencoding. Too
1442 % much work for too little return. Just use the ASCII equivalents
1443 % we use for the index sort strings.
1445 \indexnofonts
1446 \setupdatafile
1447 % We can have normal brace characters in the PDF outlines, unlike
1448 % Texinfo index files. So set that up.
1449 \def\{{\lbracecharliteral}%
1450 \def\}{\rbracecharliteral}%
1451 \catcode`\\=\active \otherbackslash
1452 \input \tocreadfilename
1453 \endgroup
1455 {\catcode`[=1 \catcode`]=2
1456 \catcode`{=\other \catcode`}=\other
1457 \gdef\lbracecharliteral[{]%
1458 \gdef\rbracecharliteral[}]%
1461 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1462 \ifx\PP\D\let\nextsp\relax
1463 \else\let\nextsp\skipspaces
1464 \addtokens{\filename}{\PP}%
1465 \advance\filenamelength by 1
1467 \nextsp}
1468 \def\getfilename#1{%
1469 \filenamelength=0
1470 % If we don't expand the argument now, \skipspaces will get
1471 % snagged on things like "@value{foo}".
1472 \edef\temp{#1}%
1473 \expandafter\skipspaces\temp|\relax
1475 \ifnum\pdftexversion < 14
1476 \let \startlink \pdfannotlink
1477 \else
1478 \let \startlink \pdfstartlink
1480 % make a live url in pdf output.
1481 \def\pdfurl#1{%
1482 \begingroup
1483 % it seems we really need yet another set of dummies; have not
1484 % tried to figure out what each command should do in the context
1485 % of @url. for now, just make @/ a no-op, that's the only one
1486 % people have actually reported a problem with.
1488 \normalturnoffactive
1489 \def\@{@}%
1490 \let\/=\empty
1491 \makevalueexpandable
1492 % do we want to go so far as to use \indexnofonts instead of just
1493 % special-casing \var here?
1494 \def\var##1{##1}%
1496 \leavevmode\setcolor{\urlcolor}%
1497 \startlink attr{/Border [0 0 0]}%
1498 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1499 \endgroup}
1500 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1501 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1502 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1503 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1504 \def\maketoks{%
1505 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1506 \ifx\first0\adn0
1507 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1508 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1509 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1510 \else
1511 \ifnum0=\countA\else\makelink\fi
1512 \ifx\first.\let\next=\done\else
1513 \let\next=\maketoks
1514 \addtokens{\toksB}{\the\toksD}
1515 \ifx\first,\addtokens{\toksB}{\space}\fi
1517 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1518 \next}
1519 \def\makelink{\addtokens{\toksB}%
1520 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1521 \def\pdflink#1{%
1522 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1523 \setcolor{\linkcolor}#1\endlink}
1524 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1525 \else
1526 % non-pdf mode
1527 \let\pdfmkdest = \gobble
1528 \let\pdfurl = \gobble
1529 \let\endlink = \relax
1530 \let\setcolor = \gobble
1531 \let\pdfsetcolor = \gobble
1532 \let\pdfmakeoutlines = \relax
1533 \fi % \ifx\pdfoutput
1536 % For XeTeX
1538 \newif\iftxiuseunicodedestname
1539 \ifx\XeTeXrevision\thisisundefined
1540 \else
1542 % XeTeX version check
1544 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1545 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1546 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1547 % For avoiding PDF destination name replacement, we use this special
1548 % instead of xdvipdfmx's command line option `-C 0x0010'.
1549 \special{dvipdfmx:config C 0x0010}
1550 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1551 % It can handle Unicode destination names for PDF.
1552 \txiuseunicodedestnametrue
1553 \else
1554 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1555 % `dvipdfmx:config' special.
1556 % So for avoiding PDF destination name replacement,
1557 % xdvipdfmx's command line option `-C 0x0010' is necessary.
1559 % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1560 % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1561 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1562 \txiuseunicodedestnamefalse
1565 % Color support
1567 \def\rgbDarkRed{0.50 0.09 0.12}
1568 \def\rgbBlack{0 0 0}
1570 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1572 % Set color, and create a mark which defines \thiscolor accordingly,
1573 % so that \makeheadline knows which color to restore.
1574 \def\setcolor#1{%
1575 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1576 \domark
1577 \pdfsetcolor{#1}%
1580 \def\maincolor{\rgbBlack}
1581 \pdfsetcolor{\maincolor}
1582 \edef\thiscolor{\maincolor}
1583 \def\lastcolordefs{}
1585 \def\makefootline{%
1586 \baselineskip24pt
1587 \line{\pdfsetcolor{\maincolor}\the\footline}%
1590 \def\makeheadline{%
1591 \vbox to 0pt{%
1592 \vskip-22.5pt
1593 \line{%
1594 \vbox to8.5pt{}%
1595 % Extract \thiscolor definition from the marks.
1596 \getcolormarks
1597 % Typeset the headline with \maincolor, then restore the color.
1598 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1600 \vss
1602 \nointerlineskip
1605 % PDF outline support
1607 % Emulate pdfTeX primitive
1608 \def\pdfdest name#1 xyz{%
1609 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1611 \def\pdfmkdest#1{{%
1612 % We have to set dummies so commands such as @code, and characters
1613 % such as \, aren't expanded when present in a section title.
1614 \indexnofonts
1615 \iftxiuseunicodedestname
1616 \def\pdfdestname{#1}% Pass through Unicode characters.
1617 \else
1618 \edef\pdfdestname{#1}% Replace Unicode characters with ASCII.
1620 \turnoffactive
1621 \makevalueexpandable
1622 \txiescapepdf\pdfdestname
1623 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1626 % by default, use black for everything.
1627 \def\urlcolor{\rgbBlack}
1628 \def\linkcolor{\rgbBlack}
1629 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1631 \def\dopdfoutline#1#2#3#4{%
1632 \iftxiuseunicodedestname
1633 \def\pdfoutlinedest{#3}% Pass through Unicode characters.
1634 \else
1635 \edef\pdfoutlinedest{#3}% Replace Unicode characters with ASCII.
1637 \ifx\pdfoutlinedest\empty
1638 \def\pdfoutlinedest{#4}%
1641 \turnoffactive
1642 \txiescapepdf\pdfoutlinedest
1643 \edef\pdfoutlinetext{#1}%
1644 \txiescapepdf\pdfoutlinetext
1646 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1647 << /S /GoTo /D (\pdfoutlinedest) >> >> }%
1651 \def\pdfmakeoutlines{%
1652 \begingroup
1654 % For XeTeX, counts of subentries are not necessary.
1655 % Therefore, we read toc only once.
1657 % We use node names as destinations.
1658 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1659 \def\numchapentry##1##2##3##4{%
1660 \dopdfoutline{##1}{1}{##3}{##4}}%
1661 \def\numsecentry##1##2##3##4{%
1662 \dopdfoutline{##1}{2}{##3}{##4}}%
1663 \def\numsubsecentry##1##2##3##4{%
1664 \dopdfoutline{##1}{3}{##3}{##4}}%
1665 \def\numsubsubsecentry##1##2##3##4{%
1666 \dopdfoutline{##1}{4}{##3}{##4}}%
1668 \let\appentry\numchapentry%
1669 \let\appsecentry\numsecentry%
1670 \let\appsubsecentry\numsubsecentry%
1671 \let\appsubsubsecentry\numsubsubsecentry%
1672 \let\unnchapentry\numchapentry%
1673 \let\unnsecentry\numsecentry%
1674 \let\unnsubsecentry\numsubsecentry%
1675 \let\unnsubsubsecentry\numsubsubsecentry%
1677 % For XeTeX, xdvipdfmx converts strings to UTF-16.
1678 % Therefore, the encoding and the language may not be considered.
1680 \indexnofonts
1681 \setupdatafile
1682 % We can have normal brace characters in the PDF outlines, unlike
1683 % Texinfo index files. So set that up.
1684 \def\{{\lbracecharliteral}%
1685 \def\}{\rbracecharliteral}%
1686 \catcode`\\=\active \otherbackslash
1687 \input \tocreadfilename
1688 \endgroup
1690 {\catcode`[=1 \catcode`]=2
1691 \catcode`{=\other \catcode`}=\other
1692 \gdef\lbracecharliteral[{]%
1693 \gdef\rbracecharliteral[}]%
1696 \special{pdf:docview << /PageMode /UseOutlines >> }
1697 % ``\special{pdf:tounicode ...}'' is not necessary
1698 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1699 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1700 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1701 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1703 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1704 \ifx\PP\D\let\nextsp\relax
1705 \else\let\nextsp\skipspaces
1706 \addtokens{\filename}{\PP}%
1707 \advance\filenamelength by 1
1709 \nextsp}
1710 \def\getfilename#1{%
1711 \filenamelength=0
1712 % If we don't expand the argument now, \skipspaces will get
1713 % snagged on things like "@value{foo}".
1714 \edef\temp{#1}%
1715 \expandafter\skipspaces\temp|\relax
1717 % make a live url in pdf output.
1718 \def\pdfurl#1{%
1719 \begingroup
1720 % it seems we really need yet another set of dummies; have not
1721 % tried to figure out what each command should do in the context
1722 % of @url. for now, just make @/ a no-op, that's the only one
1723 % people have actually reported a problem with.
1725 \normalturnoffactive
1726 \def\@{@}%
1727 \let\/=\empty
1728 \makevalueexpandable
1729 % do we want to go so far as to use \indexnofonts instead of just
1730 % special-casing \var here?
1731 \def\var##1{##1}%
1733 \leavevmode\setcolor{\urlcolor}%
1734 \special{pdf:bann << /Border [0 0 0]
1735 /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1736 \endgroup}
1737 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1738 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1739 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1740 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1741 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1742 \def\maketoks{%
1743 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1744 \ifx\first0\adn0
1745 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1746 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1747 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1748 \else
1749 \ifnum0=\countA\else\makelink\fi
1750 \ifx\first.\let\next=\done\else
1751 \let\next=\maketoks
1752 \addtokens{\toksB}{\the\toksD}
1753 \ifx\first,\addtokens{\toksB}{\space}\fi
1755 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1756 \next}
1757 \def\makelink{\addtokens{\toksB}%
1758 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1759 \def\pdflink#1{%
1760 \special{pdf:bann << /Border [0 0 0]
1761 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1762 \setcolor{\linkcolor}#1\endlink}
1763 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1766 % @image support
1768 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1769 \def\doxeteximage#1#2#3{%
1770 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1771 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1773 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1774 % others). Let's try in that order, PDF first since if
1775 % someone has a scalable image, presumably better to use that than a
1776 % bitmap.
1777 \let\xeteximgext=\empty
1778 \begingroup
1779 \openin 1 #1.pdf \ifeof 1
1780 \openin 1 #1.PDF \ifeof 1
1781 \openin 1 #1.png \ifeof 1
1782 \openin 1 #1.jpg \ifeof 1
1783 \openin 1 #1.jpeg \ifeof 1
1784 \openin 1 #1.JPG \ifeof 1
1785 \errmessage{Could not find image file #1 for XeTeX}%
1786 \else \gdef\xeteximgext{JPG}%
1788 \else \gdef\xeteximgext{jpeg}%
1790 \else \gdef\xeteximgext{jpg}%
1792 \else \gdef\xeteximgext{png}%
1794 \else \gdef\xeteximgext{PDF}%
1796 \else \gdef\xeteximgext{pdf}%
1798 \closein 1
1799 \endgroup
1801 \def\xetexpdfext{pdf}%
1802 \ifx\xeteximgext\xetexpdfext
1803 \XeTeXpdffile "#1".\xeteximgext ""
1804 \else
1805 \def\xetexpdfext{PDF}%
1806 \ifx\xeteximgext\xetexpdfext
1807 \XeTeXpdffile "#1".\xeteximgext ""
1808 \else
1809 \XeTeXpicfile "#1".\xeteximgext ""
1812 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1813 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1817 \message{fonts,}
1819 % Change the current font style to #1, remembering it in \curfontstyle.
1820 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1821 % italics, not bold italics.
1823 \def\setfontstyle#1{%
1824 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1825 \csname ten#1\endcsname % change the current font
1828 % Select #1 fonts with the current style.
1830 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1832 \def\rm{\fam=0 \setfontstyle{rm}}
1833 \def\it{\fam=\itfam \setfontstyle{it}}
1834 \def\sl{\fam=\slfam \setfontstyle{sl}}
1835 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1836 \def\tt{\fam=\ttfam \setfontstyle{tt}}
1838 % Unfortunately, we have to override this for titles and the like, since
1839 % in those cases "rm" is bold. Sigh.
1840 \def\rmisbold{\rm\def\curfontstyle{bf}}
1842 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1843 % So we set up a \sf.
1844 \newfam\sffam
1845 \def\sf{\fam=\sffam \setfontstyle{sf}}
1846 \let\li = \sf % Sometimes we call it \li, not \sf.
1848 % We don't need math for this font style.
1849 \def\ttsl{\setfontstyle{ttsl}}
1852 % Set the baselineskip to #1, and the lineskip and strut size
1853 % correspondingly. There is no deep meaning behind these magic numbers
1854 % used as factors; they just match (closely enough) what Knuth defined.
1856 \def\lineskipfactor{.08333}
1857 \def\strutheightpercent{.70833}
1858 \def\strutdepthpercent {.29167}
1860 % can get a sort of poor man's double spacing by redefining this.
1861 \def\baselinefactor{1}
1863 \newdimen\textleading
1864 \def\setleading#1{%
1865 \dimen0 = #1\relax
1866 \normalbaselineskip = \baselinefactor\dimen0
1867 \normallineskip = \lineskipfactor\normalbaselineskip
1868 \normalbaselines
1869 \setbox\strutbox =\hbox{%
1870 \vrule width0pt height\strutheightpercent\baselineskip
1871 depth \strutdepthpercent \baselineskip
1875 % PDF CMaps. See also LaTeX's t1.cmap.
1877 % do nothing with this by default.
1878 \expandafter\let\csname cmapOT1\endcsname\gobble
1879 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1880 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1882 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1883 % (\pdffontattr was introduced many years ago, but people still run
1884 % older pdftex's; it's easy to conditionalize, so we do.)
1885 \ifpdf \ifx\pdffontattr\thisisundefined \else
1886 \begingroup
1887 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1888 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1889 %%DocumentNeededResources: ProcSet (CIDInit)
1890 %%IncludeResource: ProcSet (CIDInit)
1891 %%BeginResource: CMap (TeX-OT1-0)
1892 %%Title: (TeX-OT1-0 TeX OT1 0)
1893 %%Version: 1.000
1894 %%EndComments
1895 /CIDInit /ProcSet findresource begin
1896 12 dict begin
1897 begincmap
1898 /CIDSystemInfo
1899 << /Registry (TeX)
1900 /Ordering (OT1)
1901 /Supplement 0
1902 >> def
1903 /CMapName /TeX-OT1-0 def
1904 /CMapType 2 def
1905 1 begincodespacerange
1906 <00> <7F>
1907 endcodespacerange
1908 8 beginbfrange
1909 <00> <01> <0393>
1910 <09> <0A> <03A8>
1911 <23> <26> <0023>
1912 <28> <3B> <0028>
1913 <3F> <5B> <003F>
1914 <5D> <5E> <005D>
1915 <61> <7A> <0061>
1916 <7B> <7C> <2013>
1917 endbfrange
1918 40 beginbfchar
1919 <02> <0398>
1920 <03> <039B>
1921 <04> <039E>
1922 <05> <03A0>
1923 <06> <03A3>
1924 <07> <03D2>
1925 <08> <03A6>
1926 <0B> <00660066>
1927 <0C> <00660069>
1928 <0D> <0066006C>
1929 <0E> <006600660069>
1930 <0F> <00660066006C>
1931 <10> <0131>
1932 <11> <0237>
1933 <12> <0060>
1934 <13> <00B4>
1935 <14> <02C7>
1936 <15> <02D8>
1937 <16> <00AF>
1938 <17> <02DA>
1939 <18> <00B8>
1940 <19> <00DF>
1941 <1A> <00E6>
1942 <1B> <0153>
1943 <1C> <00F8>
1944 <1D> <00C6>
1945 <1E> <0152>
1946 <1F> <00D8>
1947 <21> <0021>
1948 <22> <201D>
1949 <27> <2019>
1950 <3C> <00A1>
1951 <3D> <003D>
1952 <3E> <00BF>
1953 <5C> <201C>
1954 <5F> <02D9>
1955 <60> <2018>
1956 <7D> <02DD>
1957 <7E> <007E>
1958 <7F> <00A8>
1959 endbfchar
1960 endcmap
1961 CMapName currentdict /CMap defineresource pop
1964 %%EndResource
1965 %%EOF
1966 }\endgroup
1967 \expandafter\edef\csname cmapOT1\endcsname#1{%
1968 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1971 % \cmapOT1IT
1972 \begingroup
1973 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1974 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1975 %%DocumentNeededResources: ProcSet (CIDInit)
1976 %%IncludeResource: ProcSet (CIDInit)
1977 %%BeginResource: CMap (TeX-OT1IT-0)
1978 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1979 %%Version: 1.000
1980 %%EndComments
1981 /CIDInit /ProcSet findresource begin
1982 12 dict begin
1983 begincmap
1984 /CIDSystemInfo
1985 << /Registry (TeX)
1986 /Ordering (OT1IT)
1987 /Supplement 0
1988 >> def
1989 /CMapName /TeX-OT1IT-0 def
1990 /CMapType 2 def
1991 1 begincodespacerange
1992 <00> <7F>
1993 endcodespacerange
1994 8 beginbfrange
1995 <00> <01> <0393>
1996 <09> <0A> <03A8>
1997 <25> <26> <0025>
1998 <28> <3B> <0028>
1999 <3F> <5B> <003F>
2000 <5D> <5E> <005D>
2001 <61> <7A> <0061>
2002 <7B> <7C> <2013>
2003 endbfrange
2004 42 beginbfchar
2005 <02> <0398>
2006 <03> <039B>
2007 <04> <039E>
2008 <05> <03A0>
2009 <06> <03A3>
2010 <07> <03D2>
2011 <08> <03A6>
2012 <0B> <00660066>
2013 <0C> <00660069>
2014 <0D> <0066006C>
2015 <0E> <006600660069>
2016 <0F> <00660066006C>
2017 <10> <0131>
2018 <11> <0237>
2019 <12> <0060>
2020 <13> <00B4>
2021 <14> <02C7>
2022 <15> <02D8>
2023 <16> <00AF>
2024 <17> <02DA>
2025 <18> <00B8>
2026 <19> <00DF>
2027 <1A> <00E6>
2028 <1B> <0153>
2029 <1C> <00F8>
2030 <1D> <00C6>
2031 <1E> <0152>
2032 <1F> <00D8>
2033 <21> <0021>
2034 <22> <201D>
2035 <23> <0023>
2036 <24> <00A3>
2037 <27> <2019>
2038 <3C> <00A1>
2039 <3D> <003D>
2040 <3E> <00BF>
2041 <5C> <201C>
2042 <5F> <02D9>
2043 <60> <2018>
2044 <7D> <02DD>
2045 <7E> <007E>
2046 <7F> <00A8>
2047 endbfchar
2048 endcmap
2049 CMapName currentdict /CMap defineresource pop
2052 %%EndResource
2053 %%EOF
2054 }\endgroup
2055 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2056 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2059 % \cmapOT1TT
2060 \begingroup
2061 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2062 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2063 %%DocumentNeededResources: ProcSet (CIDInit)
2064 %%IncludeResource: ProcSet (CIDInit)
2065 %%BeginResource: CMap (TeX-OT1TT-0)
2066 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2067 %%Version: 1.000
2068 %%EndComments
2069 /CIDInit /ProcSet findresource begin
2070 12 dict begin
2071 begincmap
2072 /CIDSystemInfo
2073 << /Registry (TeX)
2074 /Ordering (OT1TT)
2075 /Supplement 0
2076 >> def
2077 /CMapName /TeX-OT1TT-0 def
2078 /CMapType 2 def
2079 1 begincodespacerange
2080 <00> <7F>
2081 endcodespacerange
2082 5 beginbfrange
2083 <00> <01> <0393>
2084 <09> <0A> <03A8>
2085 <21> <26> <0021>
2086 <28> <5F> <0028>
2087 <61> <7E> <0061>
2088 endbfrange
2089 32 beginbfchar
2090 <02> <0398>
2091 <03> <039B>
2092 <04> <039E>
2093 <05> <03A0>
2094 <06> <03A3>
2095 <07> <03D2>
2096 <08> <03A6>
2097 <0B> <2191>
2098 <0C> <2193>
2099 <0D> <0027>
2100 <0E> <00A1>
2101 <0F> <00BF>
2102 <10> <0131>
2103 <11> <0237>
2104 <12> <0060>
2105 <13> <00B4>
2106 <14> <02C7>
2107 <15> <02D8>
2108 <16> <00AF>
2109 <17> <02DA>
2110 <18> <00B8>
2111 <19> <00DF>
2112 <1A> <00E6>
2113 <1B> <0153>
2114 <1C> <00F8>
2115 <1D> <00C6>
2116 <1E> <0152>
2117 <1F> <00D8>
2118 <20> <2423>
2119 <27> <2019>
2120 <60> <2018>
2121 <7F> <00A8>
2122 endbfchar
2123 endcmap
2124 CMapName currentdict /CMap defineresource pop
2127 %%EndResource
2128 %%EOF
2129 }\endgroup
2130 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2131 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2133 \fi\fi
2136 % Set the font macro #1 to the font named \fontprefix#2.
2137 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2138 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2139 % Example:
2140 % #1 = \textrm
2141 % #2 = \rmshape
2142 % #3 = 10
2143 % #4 = \mainmagstep
2144 % #5 = OT1
2146 \def\setfont#1#2#3#4#5{%
2147 \font#1=\fontprefix#2#3 scaled #4
2148 \csname cmap#5\endcsname#1%
2150 % This is what gets called when #5 of \setfont is empty.
2151 \let\cmap\gobble
2153 % (end of cmaps)
2155 % Use cm as the default font prefix.
2156 % To specify the font prefix, you must define \fontprefix
2157 % before you read in texinfo.tex.
2158 \ifx\fontprefix\thisisundefined
2159 \def\fontprefix{cm}
2161 % Support font families that don't use the same naming scheme as CM.
2162 \def\rmshape{r}
2163 \def\rmbshape{bx} % where the normal face is bold
2164 \def\bfshape{b}
2165 \def\bxshape{bx}
2166 \def\ttshape{tt}
2167 \def\ttbshape{tt}
2168 \def\ttslshape{sltt}
2169 \def\itshape{ti}
2170 \def\itbshape{bxti}
2171 \def\slshape{sl}
2172 \def\slbshape{bxsl}
2173 \def\sfshape{ss}
2174 \def\sfbshape{ss}
2175 \def\scshape{csc}
2176 \def\scbshape{csc}
2178 % Definitions for a main text size of 11pt. (The default in Texinfo.)
2180 \def\definetextfontsizexi{%
2181 % Text fonts (11.2pt, magstep1).
2182 \def\textnominalsize{11pt}
2183 \edef\mainmagstep{\magstephalf}
2184 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2185 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2186 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2187 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2188 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2189 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2190 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2191 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2192 \font\texti=cmmi10 scaled \mainmagstep
2193 \font\textsy=cmsy10 scaled \mainmagstep
2194 \def\textecsize{1095}
2196 % A few fonts for @defun names and args.
2197 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2198 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2199 \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
2200 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2201 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
2202 \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
2204 % Fonts for indices, footnotes, small examples (9pt).
2205 \def\smallnominalsize{9pt}
2206 \setfont\smallrm\rmshape{9}{1000}{OT1}
2207 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2208 \setfont\smallbf\bfshape{10}{900}{OT1}
2209 \setfont\smallit\itshape{9}{1000}{OT1IT}
2210 \setfont\smallsl\slshape{9}{1000}{OT1}
2211 \setfont\smallsf\sfshape{9}{1000}{OT1}
2212 \setfont\smallsc\scshape{10}{900}{OT1}
2213 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2214 \font\smalli=cmmi9
2215 \font\smallsy=cmsy9
2216 \def\smallecsize{0900}
2218 % Fonts for small examples (8pt).
2219 \def\smallernominalsize{8pt}
2220 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2221 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2222 \setfont\smallerbf\bfshape{10}{800}{OT1}
2223 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2224 \setfont\smallersl\slshape{8}{1000}{OT1}
2225 \setfont\smallersf\sfshape{8}{1000}{OT1}
2226 \setfont\smallersc\scshape{10}{800}{OT1}
2227 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2228 \font\smalleri=cmmi8
2229 \font\smallersy=cmsy8
2230 \def\smallerecsize{0800}
2232 % Fonts for title page (20.4pt):
2233 \def\titlenominalsize{20pt}
2234 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2235 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2236 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2237 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2238 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2239 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2240 \let\titlebf=\titlerm
2241 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2242 \font\titlei=cmmi12 scaled \magstep3
2243 \font\titlesy=cmsy10 scaled \magstep4
2244 \def\titleecsize{2074}
2246 % Chapter (and unnumbered) fonts (17.28pt).
2247 \def\chapnominalsize{17pt}
2248 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2249 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2250 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2251 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2252 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2253 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2254 \let\chapbf=\chaprm
2255 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2256 \font\chapi=cmmi12 scaled \magstep2
2257 \font\chapsy=cmsy10 scaled \magstep3
2258 \def\chapecsize{1728}
2260 % Section fonts (14.4pt).
2261 \def\secnominalsize{14pt}
2262 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2263 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2264 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2265 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2266 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2267 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2268 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2269 \let\secbf\secrm
2270 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2271 \font\seci=cmmi12 scaled \magstep1
2272 \font\secsy=cmsy10 scaled \magstep2
2273 \def\sececsize{1440}
2275 % Subsection fonts (13.15pt).
2276 \def\ssecnominalsize{13pt}
2277 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2278 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2279 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2280 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2281 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2282 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2283 \let\ssecbf\ssecrm
2284 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2285 \font\sseci=cmmi12 scaled \magstephalf
2286 \font\ssecsy=cmsy10 scaled 1315
2287 \def\ssececsize{1200}
2289 % Reduced fonts for @acro in text (10pt).
2290 \def\reducednominalsize{10pt}
2291 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2292 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2293 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2294 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2295 \setfont\reducedsl\slshape{10}{1000}{OT1}
2296 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2297 \setfont\reducedsc\scshape{10}{1000}{OT1}
2298 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2299 \font\reducedi=cmmi10
2300 \font\reducedsy=cmsy10
2301 \def\reducedecsize{1000}
2303 \textleading = 13.2pt % line spacing for 11pt CM
2304 \textfonts % reset the current fonts
2306 } % end of 11pt text font size definitions, \definetextfontsizexi
2309 % Definitions to make the main text be 10pt Computer Modern, with
2310 % section, chapter, etc., sizes following suit. This is for the GNU
2311 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2312 % future. Used with @smallbook, which sets the leading to 12pt.
2314 \def\definetextfontsizex{%
2315 % Text fonts (10pt).
2316 \def\textnominalsize{10pt}
2317 \edef\mainmagstep{1000}
2318 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2319 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2320 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2321 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2322 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2323 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2324 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2325 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2326 \font\texti=cmmi10 scaled \mainmagstep
2327 \font\textsy=cmsy10 scaled \mainmagstep
2328 \def\textecsize{1000}
2330 % A few fonts for @defun names and args.
2331 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2332 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2333 \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
2334 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2335 \def\df{\let\tentt=\deftt \let\tenbf = \defbf
2336 \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
2338 % Fonts for indices, footnotes, small examples (9pt).
2339 \def\smallnominalsize{9pt}
2340 \setfont\smallrm\rmshape{9}{1000}{OT1}
2341 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2342 \setfont\smallbf\bfshape{10}{900}{OT1}
2343 \setfont\smallit\itshape{9}{1000}{OT1IT}
2344 \setfont\smallsl\slshape{9}{1000}{OT1}
2345 \setfont\smallsf\sfshape{9}{1000}{OT1}
2346 \setfont\smallsc\scshape{10}{900}{OT1}
2347 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2348 \font\smalli=cmmi9
2349 \font\smallsy=cmsy9
2350 \def\smallecsize{0900}
2352 % Fonts for small examples (8pt).
2353 \def\smallernominalsize{8pt}
2354 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2355 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2356 \setfont\smallerbf\bfshape{10}{800}{OT1}
2357 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2358 \setfont\smallersl\slshape{8}{1000}{OT1}
2359 \setfont\smallersf\sfshape{8}{1000}{OT1}
2360 \setfont\smallersc\scshape{10}{800}{OT1}
2361 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2362 \font\smalleri=cmmi8
2363 \font\smallersy=cmsy8
2364 \def\smallerecsize{0800}
2366 % Fonts for title page (20.4pt):
2367 \def\titlenominalsize{20pt}
2368 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2369 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2370 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2371 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2372 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2373 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2374 \let\titlebf=\titlerm
2375 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2376 \font\titlei=cmmi12 scaled \magstep3
2377 \font\titlesy=cmsy10 scaled \magstep4
2378 \def\titleecsize{2074}
2380 % Chapter fonts (14.4pt).
2381 \def\chapnominalsize{14pt}
2382 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2383 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2384 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2385 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2386 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2387 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2388 \let\chapbf\chaprm
2389 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2390 \font\chapi=cmmi12 scaled \magstep1
2391 \font\chapsy=cmsy10 scaled \magstep2
2392 \def\chapecsize{1440}
2394 % Section fonts (12pt).
2395 \def\secnominalsize{12pt}
2396 \setfont\secrm\rmbshape{12}{1000}{OT1}
2397 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2398 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2399 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2400 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2401 \setfont\secsf\sfbshape{12}{1000}{OT1}
2402 \let\secbf\secrm
2403 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2404 \font\seci=cmmi12
2405 \font\secsy=cmsy10 scaled \magstep1
2406 \def\sececsize{1200}
2408 % Subsection fonts (10pt).
2409 \def\ssecnominalsize{10pt}
2410 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2411 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2412 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2413 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2414 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2415 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2416 \let\ssecbf\ssecrm
2417 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2418 \font\sseci=cmmi10
2419 \font\ssecsy=cmsy10
2420 \def\ssececsize{1000}
2422 % Reduced fonts for @acro in text (9pt).
2423 \def\reducednominalsize{9pt}
2424 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2425 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2426 \setfont\reducedbf\bfshape{10}{900}{OT1}
2427 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2428 \setfont\reducedsl\slshape{9}{1000}{OT1}
2429 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2430 \setfont\reducedsc\scshape{10}{900}{OT1}
2431 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2432 \font\reducedi=cmmi9
2433 \font\reducedsy=cmsy9
2434 \def\reducedecsize{0900}
2436 \divide\parskip by 2 % reduce space between paragraphs
2437 \textleading = 12pt % line spacing for 10pt CM
2438 \textfonts % reset the current fonts
2440 } % end of 10pt text font size definitions, \definetextfontsizex
2443 % We provide the user-level command
2444 % @fonttextsize 10
2445 % (or 11) to redefine the text font size. pt is assumed.
2447 \def\xiword{11}
2448 \def\xword{10}
2449 \def\xwordpt{10pt}
2451 \parseargdef\fonttextsize{%
2452 \def\textsizearg{#1}%
2453 %\wlog{doing @fonttextsize \textsizearg}%
2455 % Set \globaldefs so that documents can use this inside @tex, since
2456 % makeinfo 4.8 does not support it, but we need it nonetheless.
2458 \begingroup \globaldefs=1
2459 \ifx\textsizearg\xword \definetextfontsizex
2460 \else \ifx\textsizearg\xiword \definetextfontsizexi
2461 \else
2462 \errhelp=\EMsimple
2463 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2464 \fi\fi
2465 \endgroup
2468 % In order for the font changes to affect most math symbols and letters,
2469 % we have to define the \textfont of the standard families. We don't
2470 % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
2472 \def\resetmathfonts{%
2473 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2474 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2475 \textfont\ttfam=\tentt \textfont\sffam=\tensf
2478 % The font-changing commands redefine the meanings of \tenSTYLE, instead
2479 % of just \STYLE. We do this because \STYLE needs to also set the
2480 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2481 % \tenSTYLE to set the current font.
2483 % Each font-changing command also sets the names \lsize (one size lower)
2484 % and \lllsize (three sizes lower). These relative commands are used
2485 % in, e.g., the LaTeX logo and acronyms.
2487 % This all needs generalizing, badly.
2489 \def\textfonts{%
2490 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2491 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2492 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2493 \let\tenttsl=\textttsl
2494 \def\curfontsize{text}%
2495 \def\lsize{reduced}\def\lllsize{smaller}%
2496 \resetmathfonts \setleading{\textleading}}
2497 \def\titlefonts{%
2498 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2499 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2500 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2501 \let\tenttsl=\titlettsl
2502 \def\curfontsize{title}%
2503 \def\lsize{chap}\def\lllsize{subsec}%
2504 \resetmathfonts \setleading{27pt}}
2505 \def\titlefont#1{{\titlefonts\rmisbold #1}}
2506 \def\chapfonts{%
2507 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2508 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2509 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2510 \let\tenttsl=\chapttsl
2511 \def\curfontsize{chap}%
2512 \def\lsize{sec}\def\lllsize{text}%
2513 \resetmathfonts \setleading{19pt}}
2514 \def\secfonts{%
2515 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2516 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2517 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2518 \let\tenttsl=\secttsl
2519 \def\curfontsize{sec}%
2520 \def\lsize{subsec}\def\lllsize{reduced}%
2521 \resetmathfonts \setleading{17pt}}
2522 \def\subsecfonts{%
2523 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2524 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2525 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2526 \let\tenttsl=\ssecttsl
2527 \def\curfontsize{ssec}%
2528 \def\lsize{text}\def\lllsize{small}%
2529 \resetmathfonts \setleading{15pt}}
2530 \let\subsubsecfonts = \subsecfonts
2531 \def\reducedfonts{%
2532 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2533 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2534 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2535 \let\tenttsl=\reducedttsl
2536 \def\curfontsize{reduced}%
2537 \def\lsize{small}\def\lllsize{smaller}%
2538 \resetmathfonts \setleading{10.5pt}}
2539 \def\smallfonts{%
2540 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2541 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2542 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2543 \let\tenttsl=\smallttsl
2544 \def\curfontsize{small}%
2545 \def\lsize{smaller}\def\lllsize{smaller}%
2546 \resetmathfonts \setleading{10.5pt}}
2547 \def\smallerfonts{%
2548 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2549 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2550 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2551 \let\tenttsl=\smallerttsl
2552 \def\curfontsize{smaller}%
2553 \def\lsize{smaller}\def\lllsize{smaller}%
2554 \resetmathfonts \setleading{9.5pt}}
2556 % Fonts for short table of contents.
2557 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2558 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2559 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2560 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2562 % Define these just so they can be easily changed for other fonts.
2563 \def\angleleft{$\langle$}
2564 \def\angleright{$\rangle$}
2566 % Set the fonts to use with the @small... environments.
2567 \let\smallexamplefonts = \smallfonts
2569 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2570 % can fit this many characters:
2571 % 8.5x11=86 smallbook=72 a4=90 a5=69
2572 % If we use \scriptfonts (8pt), then we can fit this many characters:
2573 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2574 % For me, subjectively, the few extra characters that fit aren't worth
2575 % the additional smallness of 8pt. So I'm making the default 9pt.
2577 % By the way, for comparison, here's what fits with @example (10pt):
2578 % 8.5x11=71 smallbook=60 a4=75 a5=58
2579 % --karl, 24jan03.
2581 % Set up the default fonts, so we can use them for creating boxes.
2583 \definetextfontsizexi
2586 \message{markup,}
2588 % Check if we are currently using a typewriter font. Since all the
2589 % Computer Modern typewriter fonts have zero interword stretch (and
2590 % shrink), and it is reasonable to expect all typewriter fonts to have
2591 % this property, we can check that font parameter.
2593 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2595 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2596 % define and register \INITMACRO to be called on markup style changes.
2597 % \INITMACRO can check \currentmarkupstyle for the innermost
2598 % style and the set of \ifmarkupSTYLE switches for all styles
2599 % currently in effect.
2600 \newif\ifmarkupvar
2601 \newif\ifmarkupsamp
2602 \newif\ifmarkupkey
2603 %\newif\ifmarkupfile % @file == @samp.
2604 %\newif\ifmarkupoption % @option == @samp.
2605 \newif\ifmarkupcode
2606 \newif\ifmarkupkbd
2607 %\newif\ifmarkupenv % @env == @code.
2608 %\newif\ifmarkupcommand % @command == @code.
2609 \newif\ifmarkuptex % @tex (and part of @math, for now).
2610 \newif\ifmarkupexample
2611 \newif\ifmarkupverb
2612 \newif\ifmarkupverbatim
2614 \let\currentmarkupstyle\empty
2616 \def\setupmarkupstyle#1{%
2617 \csname markup#1true\endcsname
2618 \def\currentmarkupstyle{#1}%
2619 \markupstylesetup
2622 \let\markupstylesetup\empty
2624 \def\defmarkupstylesetup#1{%
2625 \expandafter\def\expandafter\markupstylesetup
2626 \expandafter{\markupstylesetup #1}%
2627 \def#1%
2630 % Markup style setup for left and right quotes.
2631 \defmarkupstylesetup\markupsetuplq{%
2632 \expandafter\let\expandafter \temp
2633 \csname markupsetuplq\currentmarkupstyle\endcsname
2634 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2637 \defmarkupstylesetup\markupsetuprq{%
2638 \expandafter\let\expandafter \temp
2639 \csname markupsetuprq\currentmarkupstyle\endcsname
2640 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2644 \catcode`\'=\active
2645 \catcode`\`=\active
2647 \gdef\markupsetuplqdefault{\let`\lq}
2648 \gdef\markupsetuprqdefault{\let'\rq}
2650 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2651 \gdef\markupsetcodequoteright{\let'\codequoteright}
2654 \let\markupsetuplqcode \markupsetcodequoteleft
2655 \let\markupsetuprqcode \markupsetcodequoteright
2657 \let\markupsetuplqexample \markupsetcodequoteleft
2658 \let\markupsetuprqexample \markupsetcodequoteright
2660 \let\markupsetuplqkbd \markupsetcodequoteleft
2661 \let\markupsetuprqkbd \markupsetcodequoteright
2663 \let\markupsetuplqsamp \markupsetcodequoteleft
2664 \let\markupsetuprqsamp \markupsetcodequoteright
2666 \let\markupsetuplqverb \markupsetcodequoteleft
2667 \let\markupsetuprqverb \markupsetcodequoteright
2669 \let\markupsetuplqverbatim \markupsetcodequoteleft
2670 \let\markupsetuprqverbatim \markupsetcodequoteright
2672 % Allow an option to not use regular directed right quote/apostrophe
2673 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2674 % The undirected quote is ugly, so don't make it the default, but it
2675 % works for pasting with more pdf viewers (at least evince), the
2676 % lilypond developers report. xpdf does work with the regular 0x27.
2678 \def\codequoteright{%
2679 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2680 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2682 \else \char'15 \fi
2683 \else \char'15 \fi
2686 % and a similar option for the left quote char vs. a grave accent.
2687 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2688 % the code environments to do likewise.
2690 \def\codequoteleft{%
2691 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2692 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2693 % [Knuth] pp. 380,381,391
2694 % \relax disables Spanish ligatures ?` and !` of \tt font.
2695 \relax`%
2696 \else \char'22 \fi
2697 \else \char'22 \fi
2700 % Commands to set the quote options.
2702 \parseargdef\codequoteundirected{%
2703 \def\temp{#1}%
2704 \ifx\temp\onword
2705 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2706 = t%
2707 \else\ifx\temp\offword
2708 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2709 = \relax
2710 \else
2711 \errhelp = \EMsimple
2712 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2713 \fi\fi
2716 \parseargdef\codequotebacktick{%
2717 \def\temp{#1}%
2718 \ifx\temp\onword
2719 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2720 = t%
2721 \else\ifx\temp\offword
2722 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2723 = \relax
2724 \else
2725 \errhelp = \EMsimple
2726 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2727 \fi\fi
2730 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2731 \def\noligaturesquoteleft{\relax\lq}
2733 % Count depth in font-changes, for error checks
2734 \newcount\fontdepth \fontdepth=0
2736 % Font commands.
2738 % #1 is the font command (\sl or \it), #2 is the text to slant.
2739 % If we are in a monospaced environment, however, 1) always use \ttsl,
2740 % and 2) do not add an italic correction.
2741 \def\dosmartslant#1#2{%
2742 \ifusingtt
2743 {{\ttsl #2}\let\next=\relax}%
2744 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2745 \next
2747 \def\smartslanted{\dosmartslant\sl}
2748 \def\smartitalic{\dosmartslant\it}
2750 % Output an italic correction unless \next (presumed to be the following
2751 % character) is such as not to need one.
2752 \def\smartitaliccorrection{%
2753 \ifx\next,%
2754 \else\ifx\next-%
2755 \else\ifx\next.%
2756 \else\ifx\next\.%
2757 \else\ifx\next\comma%
2758 \else\ptexslash
2759 \fi\fi\fi\fi\fi
2760 \aftersmartic
2763 % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2764 \def\ttslanted#1{{\ttsl #1}}
2766 % @cite is like \smartslanted except unconditionally use \sl. We never want
2767 % ttsl for book titles, do we?
2768 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2770 \def\aftersmartic{}
2771 \def\var#1{%
2772 \let\saveaftersmartic = \aftersmartic
2773 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2774 \smartslanted{#1}%
2777 \let\i=\smartitalic
2778 \let\slanted=\smartslanted
2779 \let\dfn=\smartslanted
2780 \let\emph=\smartitalic
2782 % Explicit font changes: @r, @sc, undocumented @ii.
2783 \def\r#1{{\rm #1}} % roman font
2784 \def\sc#1{{\smallcaps#1}} % smallcaps font
2785 \def\ii#1{{\it #1}} % italic font
2787 % @b, explicit bold. Also @strong.
2788 \def\b#1{{\bf #1}}
2789 \let\strong=\b
2791 % @sansserif, explicit sans.
2792 \def\sansserif#1{{\sf #1}}
2794 % We can't just use \exhyphenpenalty, because that only has effect at
2795 % the end of a paragraph. Restore normal hyphenation at the end of the
2796 % group within which \nohyphenation is presumably called.
2798 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2799 \def\restorehyphenation{\hyphenchar\font = `- }
2801 % Set sfcode to normal for the chars that usually have another value.
2802 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2803 % sometimes \x has an active definition that messes things up.
2805 \catcode`@=11
2806 \def\plainfrenchspacing{%
2807 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2808 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2809 \def\endofsentencespacefactor{1000}% for @. and friends
2811 \def\plainnonfrenchspacing{%
2812 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2813 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2814 \def\endofsentencespacefactor{3000}% for @. and friends
2816 \catcode`@=\other
2817 \def\endofsentencespacefactor{3000}% default
2819 % @t, explicit typewriter.
2820 \def\t#1{%
2821 {\tt \rawbackslash \plainfrenchspacing #1}%
2822 \null
2825 % @samp.
2826 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2828 % @indicateurl is \samp, that is, with quotes.
2829 \let\indicateurl=\samp
2831 % @code (and similar) prints in typewriter, but with spaces the same
2832 % size as normal in the surrounding text, without hyphenation, etc.
2833 % This is a subroutine for that.
2834 \def\tclose#1{%
2836 % Change normal interword space to be same as for the current font.
2837 \spaceskip = \fontdimen2\font
2839 % Switch to typewriter.
2842 % But `\ ' produces the large typewriter interword space.
2843 \def\ {{\spaceskip = 0pt{} }}%
2845 % Turn off hyphenation.
2846 \nohyphenation
2848 \rawbackslash
2849 \plainfrenchspacing
2852 \null % reset spacefactor to 1000
2855 % We *must* turn on hyphenation at `-' and `_' in @code.
2856 % (But see \codedashfinish below.)
2857 % Otherwise, it is too hard to avoid overfull hboxes
2858 % in the Emacs manual, the Library manual, etc.
2860 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2861 % both hyphenation at - and hyphenation within words.
2862 % We must therefore turn them both off (\tclose does that)
2863 % and arrange explicitly to hyphenate at a dash. -- rms.
2865 \catcode`\-=\active \catcode`\_=\active
2866 \catcode`\'=\active \catcode`\`=\active
2867 \global\let'=\rq \global\let`=\lq % default definitions
2869 \global\def\code{\begingroup
2870 \setupmarkupstyle{code}%
2871 % The following should really be moved into \setupmarkupstyle handlers.
2872 \catcode\dashChar=\active \catcode\underChar=\active
2873 \ifallowcodebreaks
2874 \let-\codedash
2875 \let_\codeunder
2876 \else
2877 \let-\normaldash
2878 \let_\realunder
2880 % Given -foo (with a single dash), we do not want to allow a break
2881 % after the hyphen.
2882 \global\let\codedashprev=\codedash
2884 \codex
2887 \gdef\codedash{\futurelet\next\codedashfinish}
2888 \gdef\codedashfinish{%
2889 \normaldash % always output the dash character itself.
2891 % Now, output a discretionary to allow a line break, unless
2892 % (a) the next character is a -, or
2893 % (b) the preceding character is a -.
2894 % E.g., given --posix, we do not want to allow a break after either -.
2895 % Given --foo-bar, we do want to allow a break between the - and the b.
2896 \ifx\next\codedash \else
2897 \ifx\codedashprev\codedash
2898 \else \discretionary{}{}{}\fi
2900 % we need the space after the = for the case when \next itself is a
2901 % space token; it would get swallowed otherwise. As in @code{- a}.
2902 \global\let\codedashprev= \next
2905 \def\normaldash{-}
2907 \def\codex #1{\tclose{#1}\endgroup}
2909 \def\codeunder{%
2910 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2911 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2912 % will therefore expand the active definition of _, which is us
2913 % (inside @code that is), therefore an endless loop.
2914 \ifusingtt{\ifmmode
2915 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2916 \else\normalunderscore \fi
2917 \discretionary{}{}{}}%
2918 {\_}%
2921 % An additional complication: the above will allow breaks after, e.g.,
2922 % each of the four underscores in __typeof__. This is bad.
2923 % @allowcodebreaks provides a document-level way to turn breaking at -
2924 % and _ on and off.
2926 \newif\ifallowcodebreaks \allowcodebreakstrue
2928 \def\keywordtrue{true}
2929 \def\keywordfalse{false}
2931 \parseargdef\allowcodebreaks{%
2932 \def\txiarg{#1}%
2933 \ifx\txiarg\keywordtrue
2934 \allowcodebreakstrue
2935 \else\ifx\txiarg\keywordfalse
2936 \allowcodebreaksfalse
2937 \else
2938 \errhelp = \EMsimple
2939 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2940 \fi\fi
2943 % For @command, @env, @file, @option quotes seem unnecessary,
2944 % so use \code rather than \samp.
2945 \let\command=\code
2946 \let\env=\code
2947 \let\file=\code
2948 \let\option=\code
2950 % @uref (abbreviation for `urlref') aka @url takes an optional
2951 % (comma-separated) second argument specifying the text to display and
2952 % an optional third arg as text to display instead of (rather than in
2953 % addition to) the url itself. First (mandatory) arg is the url.
2955 % TeX-only option to allow changing PDF output to show only the second
2956 % arg (if given), and not the url (which is then just the link target).
2957 \newif\ifurefurlonlylink
2959 % The main macro is \urefbreak, which allows breaking at expected
2960 % places within the url. (There used to be another version, which
2961 % didn't support automatic breaking.)
2962 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2963 \let\uref=\urefbreak
2965 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2966 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2967 \unsepspaces
2968 \pdfurl{#1}%
2969 \setbox0 = \hbox{\ignorespaces #3}%
2970 \ifdim\wd0 > 0pt
2971 \unhbox0 % third arg given, show only that
2972 \else
2973 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
2974 \ifdim\wd0 > 0pt
2975 \ifpdf
2976 % For pdfTeX and LuaTeX
2977 \ifurefurlonlylink
2978 % PDF plus option to not display url, show just arg
2979 \unhbox0
2980 \else
2981 % PDF, normally display both arg and url for consistency,
2982 % visibility, if the pdf is eventually used to print, etc.
2983 \unhbox0\ (\urefcode{#1})%
2985 \else
2986 \ifx\XeTeXrevision\thisisundefined
2987 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
2988 \else
2989 % For XeTeX
2990 \ifurefurlonlylink
2991 % PDF plus option to not display url, show just arg
2992 \unhbox0
2993 \else
2994 % PDF, normally display both arg and url for consistency,
2995 % visibility, if the pdf is eventually used to print, etc.
2996 \unhbox0\ (\urefcode{#1})%
3000 \else
3001 \urefcode{#1}% only url given, so show it
3004 \endlink
3005 \endgroup}
3007 % Allow line breaks around only a few characters (only).
3008 \def\urefcatcodes{%
3009 \catcode`\&=\active \catcode`\.=\active
3010 \catcode`\#=\active \catcode`\?=\active
3011 \catcode`\/=\active
3014 \urefcatcodes
3016 \global\def\urefcode{\begingroup
3017 \setupmarkupstyle{code}%
3018 \urefcatcodes
3019 \let&\urefcodeamp
3020 \let.\urefcodedot
3021 \let#\urefcodehash
3022 \let?\urefcodequest
3023 \let/\urefcodeslash
3024 \codex
3027 % By default, they are just regular characters.
3028 \global\def&{\normalamp}
3029 \global\def.{\normaldot}
3030 \global\def#{\normalhash}
3031 \global\def?{\normalquest}
3032 \global\def/{\normalslash}
3035 % we put a little stretch before and after the breakable chars, to help
3036 % line breaking of long url's. The unequal skips make look better in
3037 % cmtt at least, especially for dots.
3038 \def\urefprestretchamount{.13em}
3039 \def\urefpoststretchamount{.1em}
3040 \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
3041 \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
3043 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
3044 \def\urefcodedot{\urefprestretch .\urefpoststretch}
3045 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
3046 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
3047 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3049 \catcode`\/=\active
3050 \global\def\urefcodeslashfinish{%
3051 \urefprestretch \slashChar
3052 % Allow line break only after the final / in a sequence of
3053 % slashes, to avoid line break between the slashes in http://.
3054 \ifx\next/\else \urefpoststretch \fi
3058 % One more complication: by default we'll break after the special
3059 % characters, but some people like to break before the special chars, so
3060 % allow that. Also allow no breaking at all, for manual control.
3062 \parseargdef\urefbreakstyle{%
3063 \def\txiarg{#1}%
3064 \ifx\txiarg\wordnone
3065 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3066 \else\ifx\txiarg\wordbefore
3067 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
3068 \else\ifx\txiarg\wordafter
3069 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
3070 \else
3071 \errhelp = \EMsimple
3072 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3073 \fi\fi\fi
3075 \def\wordafter{after}
3076 \def\wordbefore{before}
3077 \def\wordnone{none}
3079 \urefbreakstyle after
3081 % @url synonym for @uref, since that's how everyone uses it.
3083 \let\url=\uref
3085 % rms does not like angle brackets --karl, 17may97.
3086 % So now @email is just like @uref, unless we are pdf.
3088 %\def\email#1{\angleleft{\tt #1}\angleright}
3089 \ifpdf
3090 \def\email#1{\doemail#1,,\finish}
3091 \def\doemail#1,#2,#3\finish{\begingroup
3092 \unsepspaces
3093 \pdfurl{mailto:#1}%
3094 \setbox0 = \hbox{\ignorespaces #2}%
3095 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3096 \endlink
3097 \endgroup}
3098 \else
3099 \ifx\XeTeXrevision\thisisundefined
3100 \let\email=\uref
3101 \else
3102 \def\email#1{\doemail#1,,\finish}
3103 \def\doemail#1,#2,#3\finish{\begingroup
3104 \unsepspaces
3105 \pdfurl{mailto:#1}%
3106 \setbox0 = \hbox{\ignorespaces #2}%
3107 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3108 \endlink
3109 \endgroup}
3113 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3114 % `example' (@kbd uses ttsl only inside of @example and friends),
3115 % or `code' (@kbd uses normal tty font always).
3116 \parseargdef\kbdinputstyle{%
3117 \def\txiarg{#1}%
3118 \ifx\txiarg\worddistinct
3119 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3120 \else\ifx\txiarg\wordexample
3121 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3122 \else\ifx\txiarg\wordcode
3123 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3124 \else
3125 \errhelp = \EMsimple
3126 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3127 \fi\fi\fi
3129 \def\worddistinct{distinct}
3130 \def\wordexample{example}
3131 \def\wordcode{code}
3133 % Default is `distinct'.
3134 \kbdinputstyle distinct
3136 % @kbd is like @code, except that if the argument is just one @key command,
3137 % then @kbd has no effect.
3138 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
3140 \def\xkey{\key}
3141 \def\kbdsub#1#2#3\par{%
3142 \def\one{#1}\def\three{#3}\def\threex{??}%
3143 \ifx\one\xkey\ifx\threex\three \key{#2}%
3144 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
3145 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
3148 % definition of @key that produces a lozenge. Doesn't adjust to text size.
3149 %\setfont\keyrm\rmshape{8}{1000}{OT1}
3150 %\font\keysy=cmsy9
3151 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3152 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3153 % \vbox{\hrule\kern-0.4pt
3154 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3155 % \kern-0.4pt\hrule}%
3156 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3158 % definition of @key with no lozenge. If the current font is already
3159 % monospace, don't change it; that way, we respect @kbdinputstyle. But
3160 % if it isn't monospace, then use \tt.
3162 \def\key#1{{\setupmarkupstyle{key}%
3163 \nohyphenation
3164 \ifmonospace\else\tt\fi
3165 #1}\null}
3167 % @clicksequence{File @click{} Open ...}
3168 \def\clicksequence#1{\begingroup #1\endgroup}
3170 % @clickstyle @arrow (by default)
3171 \parseargdef\clickstyle{\def\click{#1}}
3172 \def\click{\arrow}
3174 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3175 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3177 \def\dmn#1{\thinspace #1}
3179 % @acronym for "FBI", "NATO", and the like.
3180 % We print this one point size smaller, since it's intended for
3181 % all-uppercase.
3183 \def\acronym#1{\doacronym #1,,\finish}
3184 \def\doacronym#1,#2,#3\finish{%
3185 {\selectfonts\lsize #1}%
3186 \def\temp{#2}%
3187 \ifx\temp\empty \else
3188 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3190 \null % reset \spacefactor=1000
3193 % @abbr for "Comput. J." and the like.
3194 % No font change, but don't do end-of-sentence spacing.
3196 \def\abbr#1{\doabbr #1,,\finish}
3197 \def\doabbr#1,#2,#3\finish{%
3198 {\plainfrenchspacing #1}%
3199 \def\temp{#2}%
3200 \ifx\temp\empty \else
3201 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3203 \null % reset \spacefactor=1000
3206 % @asis just yields its argument. Used with @table, for example.
3208 \def\asis#1{#1}
3210 % @math outputs its argument in math mode.
3212 % One complication: _ usually means subscripts, but it could also mean
3213 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
3214 % _ active, and distinguish by seeing if the current family is \slfam,
3215 % which is what @var uses.
3217 \catcode`\_ = \active
3218 \gdef\mathunderscore{%
3219 \catcode`\_=\active
3220 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3223 % Another complication: we want \\ (and @\) to output a math (or tt) \.
3224 % FYI, plain.tex uses \\ as a temporary control sequence (for no
3225 % particular reason), but this is not advertised and we don't care.
3227 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3228 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3230 \def\math{%
3231 \ifmmode\else % only go into math if not in math mode already
3232 \tex
3233 \mathunderscore
3234 \let\\ = \mathbackslash
3235 \mathactive
3236 % make the texinfo accent commands work in math mode
3237 \let\"=\ddot
3238 \let\'=\acute
3239 \let\==\bar
3240 \let\^=\hat
3241 \let\`=\grave
3242 \let\u=\breve
3243 \let\v=\check
3244 \let\~=\tilde
3245 \let\dotaccent=\dot
3246 % have to provide another name for sup operator
3247 \let\mathopsup=\sup
3248 $\expandafter\finishmath\fi
3250 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3252 % Some active characters (such as <) are spaced differently in math.
3253 % We have to reset their definitions in case the @math was an argument
3254 % to a command which sets the catcodes (such as @item or @section).
3257 \catcode`^ = \active
3258 \catcode`< = \active
3259 \catcode`> = \active
3260 \catcode`+ = \active
3261 \catcode`' = \active
3262 \gdef\mathactive{%
3263 \let^ = \ptexhat
3264 \let< = \ptexless
3265 \let> = \ptexgtr
3266 \let+ = \ptexplus
3267 \let' = \ptexquoteright
3271 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3272 % If in text, use math to place as sub/superscript, but switch
3273 % into text mode, with smaller fonts. This is a different font than the
3274 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3275 % fix it (significant additions to font machinery) until someone notices.
3277 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3278 \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
3280 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3281 \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
3283 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3284 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3285 % except specified as a normal braced arg, so no newlines to worry about.
3287 \def\outfmtnametex{tex}
3289 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3290 \long\def\doinlinefmt#1,#2,\finish{%
3291 \def\inlinefmtname{#1}%
3292 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3295 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3296 % FMTNAME is tex, else ELSE-TEXT.
3297 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3298 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3299 \def\inlinefmtname{#1}%
3300 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3303 % For raw, must switch into @tex before parsing the argument, to avoid
3304 % setting catcodes prematurely. Doing it this way means that, for
3305 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3306 % ignored. But this isn't important because if people want a literal
3307 % *right* brace they would have to use a command anyway, so they may as
3308 % well use a command to get a left brace too. We could re-use the
3309 % delimiter character idea from \verb, but it seems like overkill.
3311 \long\def\inlineraw{\tex \doinlineraw}
3312 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3313 \def\doinlinerawtwo#1,#2,\finish{%
3314 \def\inlinerawname{#1}%
3315 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3316 \endgroup % close group opened by \tex.
3319 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3321 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3322 \long\def\doinlineifset#1,#2,\finish{%
3323 \def\inlinevarname{#1}%
3324 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3325 \else\ignorespaces#2\fi
3328 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3330 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3331 \long\def\doinlineifclear#1,#2,\finish{%
3332 \def\inlinevarname{#1}%
3333 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3337 \message{glyphs,}
3338 % and logos.
3340 % @@ prints an @, as does @atchar{}.
3341 \def\@{\char64 }
3342 \let\atchar=\@
3344 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3345 \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
3346 \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
3347 \let\{=\lbracechar
3348 \let\}=\rbracechar
3350 % @comma{} to avoid , parsing problems.
3351 \let\comma = ,
3353 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3354 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3355 \let\, = \ptexc
3356 \let\dotaccent = \ptexdot
3357 \def\ringaccent#1{{\accent23 #1}}
3358 \let\tieaccent = \ptext
3359 \let\ubaraccent = \ptexb
3360 \let\udotaccent = \d
3362 % Other special characters: @questiondown @exclamdown @ordf @ordm
3363 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3364 \def\questiondown{?`}
3365 \def\exclamdown{!`}
3366 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
3367 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
3369 % Dotless i and dotless j, used for accents.
3370 \def\imacro{i}
3371 \def\jmacro{j}
3372 \def\dotless#1{%
3373 \def\temp{#1}%
3374 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3375 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3376 \else \errmessage{@dotless can be used only with i or j}%
3377 \fi\fi
3380 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3381 % period following counts as ending a sentence. (Idea found in latex.)
3383 \edef\TeX{\TeX \spacefactor=1000 }
3385 % @LaTeX{} logo. Not quite the same results as the definition in
3386 % latex.ltx, since we use a different font for the raised A; it's most
3387 % convenient for us to use an explicitly smaller font, rather than using
3388 % the \scriptstyle font (since we don't reset \scriptstyle and
3389 % \scriptscriptstyle).
3391 \def\LaTeX{%
3392 L\kern-.36em
3393 {\setbox0=\hbox{T}%
3394 \vbox to \ht0{\hbox{%
3395 \ifx\textnominalsize\xwordpt
3396 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
3397 % Revert to plain's \scriptsize, which is 7pt.
3398 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3399 \else
3400 % For 11pt, we can use our lllsize.
3401 \selectfonts\lllsize A%
3404 \vss
3406 \kern-.15em
3407 \TeX
3410 % Some math mode symbols. Define \ensuremath to switch into math mode
3411 % unless we are already there. Expansion tricks may not be needed here,
3412 % but safer, and can't hurt.
3413 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3414 \def\ensuredmath#1{$\relax#1$}
3416 \def\bullet{\ensuremath\ptexbullet}
3417 \def\geq{\ensuremath\ge}
3418 \def\leq{\ensuremath\le}
3419 \def\minus{\ensuremath-}
3421 % @dots{} outputs an ellipsis using the current font.
3422 % We do .5em per period so that it has the same spacing in the cm
3423 % typewriter fonts as three actual period characters; on the other hand,
3424 % in other typewriter fonts three periods are wider than 1.5em. So do
3425 % whichever is larger.
3427 \def\dots{%
3428 \leavevmode
3429 \setbox0=\hbox{...}% get width of three periods
3430 \ifdim\wd0 > 1.5em
3431 \dimen0 = \wd0
3432 \else
3433 \dimen0 = 1.5em
3435 \hbox to \dimen0{%
3436 \hskip 0pt plus.25fil
3437 .\hskip 0pt plus1fil
3438 .\hskip 0pt plus1fil
3439 .\hskip 0pt plus.5fil
3443 % @enddots{} is an end-of-sentence ellipsis.
3445 \def\enddots{%
3446 \dots
3447 \spacefactor=\endofsentencespacefactor
3450 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3452 % Since these characters are used in examples, they should be an even number of
3453 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3455 \def\point{$\star$}
3456 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3457 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3458 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3459 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3460 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3462 % The @error{} command.
3463 % Adapted from the TeXbook's \boxit.
3465 \newbox\errorbox
3467 {\tentt \global\dimen0 = 3em}% Width of the box.
3468 \dimen2 = .55pt % Thickness of rules
3469 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3470 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3472 \setbox\errorbox=\hbox to \dimen0{\hfil
3473 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3474 \advance\hsize by -2\dimen2 % Rules.
3475 \vbox{%
3476 \hrule height\dimen2
3477 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3478 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3479 \kern3pt\vrule width\dimen2}% Space to right.
3480 \hrule height\dimen2}
3481 \hfil}
3483 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3485 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3487 \def\pounds{{\it\$}}
3489 % @euro{} comes from a separate font, depending on the current style.
3490 % We use the free feym* fonts from the eurosym package by Henrik
3491 % Theiling, which support regular, slanted, bold and bold slanted (and
3492 % "outlined" (blackboard board, sort of) versions, which we don't need).
3493 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3495 % Although only regular is the truly official Euro symbol, we ignore
3496 % that. The Euro is designed to be slightly taller than the regular
3497 % font height.
3499 % feymr - regular
3500 % feymo - slanted
3501 % feybr - bold
3502 % feybo - bold slanted
3504 % There is no good (free) typewriter version, to my knowledge.
3505 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3506 % Hmm.
3508 % Also doesn't work in math. Do we need to do math with euro symbols?
3509 % Hope not.
3512 \def\euro{{\eurofont e}}
3513 \def\eurofont{%
3514 % We set the font at each command, rather than predefining it in
3515 % \textfonts and the other font-switching commands, so that
3516 % installations which never need the symbol don't have to have the
3517 % font installed.
3519 % There is only one designed size (nominal 10pt), so we always scale
3520 % that to the current nominal size.
3522 % By the way, simply using "at 1em" works for cmr10 and the like, but
3523 % does not work for cmbx10 and other extended/shrunken fonts.
3525 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3527 \ifx\curfontstyle\bfstylename
3528 % bold:
3529 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3530 \else
3531 % regular:
3532 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3534 \thiseurofont
3537 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3538 % sometimes we redefine the original macro, and the alias should reflect
3539 % the redefinition.
3541 % Use LaTeX names for the Icelandic letters.
3542 \def\DH{{\ecfont \char"D0}} % Eth
3543 \def\dh{{\ecfont \char"F0}} % eth
3544 \def\TH{{\ecfont \char"DE}} % Thorn
3545 \def\th{{\ecfont \char"FE}} % thorn
3547 \def\guillemetleft{{\ecfont \char"13}}
3548 \def\guillemotleft{\guillemetleft}
3549 \def\guillemetright{{\ecfont \char"14}}
3550 \def\guillemotright{\guillemetright}
3551 \def\guilsinglleft{{\ecfont \char"0E}}
3552 \def\guilsinglright{{\ecfont \char"0F}}
3553 \def\quotedblbase{{\ecfont \char"12}}
3554 \def\quotesinglbase{{\ecfont \char"0D}}
3556 % This positioning is not perfect (see the ogonek LaTeX package), but
3557 % we have the precomposed glyphs for the most common cases. We put the
3558 % tests to use those glyphs in the single \ogonek macro so we have fewer
3559 % dummy definitions to worry about for index entries, etc.
3561 % ogonek is also used with other letters in Lithuanian (IOU), but using
3562 % the precomposed glyphs for those is not so easy since they aren't in
3563 % the same EC font.
3564 \def\ogonek#1{{%
3565 \def\temp{#1}%
3566 \ifx\temp\macrocharA\Aogonek
3567 \else\ifx\temp\macrochara\aogonek
3568 \else\ifx\temp\macrocharE\Eogonek
3569 \else\ifx\temp\macrochare\eogonek
3570 \else
3571 \ecfont \setbox0=\hbox{#1}%
3572 \ifdim\ht0=1ex\accent"0C #1%
3573 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3575 \fi\fi\fi\fi
3578 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3579 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3580 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3581 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3583 % Use the European Computer Modern fonts (cm-super in outline format)
3584 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3585 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3586 % package and follow the same conventions.
3588 \def\ecfont{\etcfont{e}}
3589 \def\tcfont{\etcfont{t}}
3591 \def\etcfont#1{%
3592 % We can't distinguish serif/sans and italic/slanted, but this
3593 % is used for crude hacks anyway (like adding French and German
3594 % quotes to documents typeset with CM, where we lose kerning), so
3595 % hopefully nobody will notice/care.
3596 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3597 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3598 \ifmonospace
3599 % typewriter:
3600 \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3601 \else
3602 \ifx\curfontstyle\bfstylename
3603 % bold:
3604 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3605 \else
3606 % regular:
3607 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3610 \thisecfont
3613 % @registeredsymbol - R in a circle. The font for the R should really
3614 % be smaller yet, but lllsize is the best we can do for now.
3615 % Adapted from the plain.tex definition of \copyright.
3617 \def\registeredsymbol{%
3618 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3619 \hfil\crcr\Orb}}%
3623 % @textdegree - the normal degrees sign.
3625 \def\textdegree{$^\circ$}
3627 % Laurent Siebenmann reports \Orb undefined with:
3628 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3629 % so we'll define it if necessary.
3631 \ifx\Orb\thisisundefined
3632 \def\Orb{\mathhexbox20D}
3635 % Quotes.
3636 \chardef\quotedblleft="5C
3637 \chardef\quotedblright=`\"
3638 \chardef\quoteleft=`\`
3639 \chardef\quoteright=`\'
3642 \message{page headings,}
3644 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3645 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3647 % First the title page. Must do @settitle before @titlepage.
3648 \newif\ifseenauthor
3649 \newif\iffinishedtitlepage
3651 % @setcontentsaftertitlepage used to do an implicit @contents or
3652 % @shortcontents after @end titlepage, but it is now obsolete.
3653 \def\setcontentsaftertitlepage{%
3654 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3655 command; move your @contents command if you want the contents
3656 after the title page.}}%
3657 \def\setshortcontentsaftertitlepage{%
3658 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3659 command; move your @shortcontents and @contents commands if you
3660 want the contents after the title page.}}%
3662 \parseargdef\shorttitlepage{%
3663 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3664 \endgroup\page\hbox{}\page}
3666 \envdef\titlepage{%
3667 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3668 \begingroup
3669 \parindent=0pt \textfonts
3670 % Leave some space at the very top of the page.
3671 \vglue\titlepagetopglue
3672 % No rule at page bottom unless we print one at the top with @title.
3673 \finishedtitlepagetrue
3675 % Most title ``pages'' are actually two pages long, with space
3676 % at the top of the second. We don't want the ragged left on the second.
3677 \let\oldpage = \page
3678 \def\page{%
3679 \iffinishedtitlepage\else
3680 \finishtitlepage
3682 \let\page = \oldpage
3683 \page
3684 \null
3688 \def\Etitlepage{%
3689 \iffinishedtitlepage\else
3690 \finishtitlepage
3692 % It is important to do the page break before ending the group,
3693 % because the headline and footline are only empty inside the group.
3694 % If we use the new definition of \page, we always get a blank page
3695 % after the title page, which we certainly don't want.
3696 \oldpage
3697 \endgroup
3699 % Need this before the \...aftertitlepage checks so that if they are
3700 % in effect the toc pages will come out with page numbers.
3701 \HEADINGSon
3704 \def\finishtitlepage{%
3705 \vskip4pt \hrule height 2pt width \hsize
3706 \vskip\titlepagebottomglue
3707 \finishedtitlepagetrue
3710 % Settings used for typesetting titles: no hyphenation, no indentation,
3711 % don't worry much about spacing, ragged right. This should be used
3712 % inside a \vbox, and fonts need to be set appropriately first. Because
3713 % it is always used for titles, nothing else, we call \rmisbold. \par
3714 % should be specified before the end of the \vbox, since a vbox is a group.
3716 \def\raggedtitlesettings{%
3717 \rmisbold
3718 \hyphenpenalty=10000
3719 \parindent=0pt
3720 \tolerance=5000
3721 \ptexraggedright
3724 % Macros to be used within @titlepage:
3726 \let\subtitlerm=\tenrm
3727 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3729 \parseargdef\title{%
3730 \checkenv\titlepage
3731 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3732 % print a rule at the page bottom also.
3733 \finishedtitlepagefalse
3734 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3737 \parseargdef\subtitle{%
3738 \checkenv\titlepage
3739 {\subtitlefont \rightline{#1}}%
3742 % @author should come last, but may come many times.
3743 % It can also be used inside @quotation.
3745 \parseargdef\author{%
3746 \def\temp{\quotation}%
3747 \ifx\thisenv\temp
3748 \def\quotationauthor{#1}% printed in \Equotation.
3749 \else
3750 \checkenv\titlepage
3751 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3752 {\secfonts\rmisbold \leftline{#1}}%
3757 % Set up page headings and footings.
3759 \let\thispage=\folio
3761 \newtoks\evenheadline % headline on even pages
3762 \newtoks\oddheadline % headline on odd pages
3763 \newtoks\evenfootline % footline on even pages
3764 \newtoks\oddfootline % footline on odd pages
3766 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3767 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3768 \else \the\evenheadline \fi}}
3769 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3770 \else \the\evenfootline \fi}\HEADINGShook}
3771 \let\HEADINGShook=\relax
3773 % Commands to set those variables.
3774 % For example, this is what @headings on does
3775 % @evenheading @thistitle|@thispage|@thischapter
3776 % @oddheading @thischapter|@thispage|@thistitle
3777 % @evenfooting @thisfile||
3778 % @oddfooting ||@thisfile
3781 \def\evenheading{\parsearg\evenheadingxxx}
3782 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3783 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3784 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3786 \def\oddheading{\parsearg\oddheadingxxx}
3787 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3788 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3789 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3791 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3793 \def\evenfooting{\parsearg\evenfootingxxx}
3794 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3795 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3796 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3798 \def\oddfooting{\parsearg\oddfootingxxx}
3799 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3800 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3801 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3803 % Leave some space for the footline. Hopefully ok to assume
3804 % @evenfooting will not be used by itself.
3805 \global\advance\txipageheight by -12pt
3806 \global\advance\vsize by -12pt
3809 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3811 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3812 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3814 % The same set of arguments for:
3816 % @oddheadingmarks
3817 % @evenfootingmarks
3818 % @oddfootingmarks
3819 % @everyheadingmarks
3820 % @everyfootingmarks
3822 % These define \getoddheadingmarks, \getevenheadingmarks,
3823 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3824 % \gettopheadingmarks, \getbottomheadingmarks.
3826 \def\evenheadingmarks{\headingmarks{even}{heading}}
3827 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3828 \def\evenfootingmarks{\headingmarks{even}{footing}}
3829 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3830 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3831 \headingmarks{odd}{heading}{#1} }
3832 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3833 \headingmarks{odd}{footing}{#1} }
3834 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3835 \def\headingmarks#1#2#3 {%
3836 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3837 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3840 \everyheadingmarks bottom
3841 \everyfootingmarks bottom
3843 % @headings double turns headings on for double-sided printing.
3844 % @headings single turns headings on for single-sided printing.
3845 % @headings off turns them off.
3846 % @headings on same as @headings double, retained for compatibility.
3847 % @headings after turns on double-sided headings after this page.
3848 % @headings doubleafter turns on double-sided headings after this page.
3849 % @headings singleafter turns on single-sided headings after this page.
3850 % By default, they are off at the start of a document,
3851 % and turned `on' after @end titlepage.
3853 \parseargdef\headings{\csname HEADINGS#1\endcsname}
3855 \def\headingsoff{% non-global headings elimination
3856 \evenheadline={\hfil}\evenfootline={\hfil}%
3857 \oddheadline={\hfil}\oddfootline={\hfil}%
3860 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3861 \HEADINGSoff % it's the default
3863 % When we turn headings on, set the page number to 1.
3864 % For double-sided printing, put current file name in lower left corner,
3865 % chapter name on inside top of right hand pages, document
3866 % title on inside top of left hand pages, and page numbers on outside top
3867 % edge of all pages.
3868 \def\HEADINGSdouble{%
3869 \global\pageno=1
3870 \global\evenfootline={\hfil}
3871 \global\oddfootline={\hfil}
3872 \global\evenheadline={\line{\folio\hfil\thistitle}}
3873 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3874 \global\let\contentsalignmacro = \chapoddpage
3876 \let\contentsalignmacro = \chappager
3878 % For single-sided printing, chapter title goes across top left of page,
3879 % page number on top right.
3880 \def\HEADINGSsingle{%
3881 \global\pageno=1
3882 \global\evenfootline={\hfil}
3883 \global\oddfootline={\hfil}
3884 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3885 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3886 \global\let\contentsalignmacro = \chappager
3888 \def\HEADINGSon{\HEADINGSdouble}
3890 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3891 \let\HEADINGSdoubleafter=\HEADINGSafter
3892 \def\HEADINGSdoublex{%
3893 \global\evenfootline={\hfil}
3894 \global\oddfootline={\hfil}
3895 \global\evenheadline={\line{\folio\hfil\thistitle}}
3896 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3897 \global\let\contentsalignmacro = \chapoddpage
3900 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3901 \def\HEADINGSsinglex{%
3902 \global\evenfootline={\hfil}
3903 \global\oddfootline={\hfil}
3904 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3905 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3906 \global\let\contentsalignmacro = \chappager
3909 % Subroutines used in generating headings
3910 % This produces Day Month Year style of output.
3911 % Only define if not already defined, in case a txi-??.tex file has set
3912 % up a different format (e.g., txi-cs.tex does this).
3913 \ifx\today\thisisundefined
3914 \def\today{%
3915 \number\day\space
3916 \ifcase\month
3917 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3918 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3919 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3921 \space\number\year}
3924 % @settitle line... specifies the title of the document, for headings.
3925 % It generates no output of its own.
3926 \def\thistitle{\putwordNoTitle}
3927 \def\settitle{\parsearg{\gdef\thistitle}}
3930 \message{tables,}
3931 % Tables -- @table, @ftable, @vtable, @item(x).
3933 % default indentation of table text
3934 \newdimen\tableindent \tableindent=.8in
3935 % default indentation of @itemize and @enumerate text
3936 \newdimen\itemindent \itemindent=.3in
3937 % margin between end of table item and start of table text.
3938 \newdimen\itemmargin \itemmargin=.1in
3940 % used internally for \itemindent minus \itemmargin
3941 \newdimen\itemmax
3943 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3944 % these defs.
3945 % They also define \itemindex
3946 % to index the item name in whatever manner is desired (perhaps none).
3948 \newif\ifitemxneedsnegativevskip
3950 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3952 \def\internalBitem{\smallbreak \parsearg\itemzzz}
3953 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
3955 \def\itemzzz #1{\begingroup %
3956 \advance\hsize by -\rightskip
3957 \advance\hsize by -\tableindent
3958 \setbox0=\hbox{\itemindicate{#1}}%
3959 \itemindex{#1}%
3960 \nobreak % This prevents a break before @itemx.
3962 % If the item text does not fit in the space we have, put it on a line
3963 % by itself, and do not allow a page break either before or after that
3964 % line. We do not start a paragraph here because then if the next
3965 % command is, e.g., @kindex, the whatsit would get put into the
3966 % horizontal list on a line by itself, resulting in extra blank space.
3967 \ifdim \wd0>\itemmax
3969 % Make this a paragraph so we get the \parskip glue and wrapping,
3970 % but leave it ragged-right.
3971 \begingroup
3972 \advance\leftskip by-\tableindent
3973 \advance\hsize by\tableindent
3974 \advance\rightskip by0pt plus1fil\relax
3975 \leavevmode\unhbox0\par
3976 \endgroup
3978 % We're going to be starting a paragraph, but we don't want the
3979 % \parskip glue -- logically it's part of the @item we just started.
3980 \nobreak \vskip-\parskip
3982 % Stop a page break at the \parskip glue coming up. However, if
3983 % what follows is an environment such as @example, there will be no
3984 % \parskip glue; then the negative vskip we just inserted would
3985 % cause the example and the item to crash together. So we use this
3986 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3987 % \parskip glue after all. Section titles are handled this way also.
3989 \penalty 10001
3990 \endgroup
3991 \itemxneedsnegativevskipfalse
3992 \else
3993 % The item text fits into the space. Start a paragraph, so that the
3994 % following text (if any) will end up on the same line.
3995 \noindent
3996 % Do this with kerns and \unhbox so that if there is a footnote in
3997 % the item text, it can migrate to the main vertical list and
3998 % eventually be printed.
3999 \nobreak\kern-\tableindent
4000 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4001 \unhbox0
4002 \nobreak\kern\dimen0
4003 \endgroup
4004 \itemxneedsnegativevskiptrue
4008 \def\item{\errmessage{@item while not in a list environment}}
4009 \def\itemx{\errmessage{@itemx while not in a list environment}}
4011 % @table, @ftable, @vtable.
4012 \envdef\table{%
4013 \let\itemindex\gobble
4014 \tablecheck{table}%
4016 \envdef\ftable{%
4017 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4018 \tablecheck{ftable}%
4020 \envdef\vtable{%
4021 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4022 \tablecheck{vtable}%
4024 \def\tablecheck#1{%
4025 \ifnum \the\catcode`\^^M=\active
4026 \endgroup
4027 \errmessage{This command won't work in this context; perhaps the problem is
4028 that we are \inenvironment\thisenv}%
4029 \def\next{\doignore{#1}}%
4030 \else
4031 \let\next\tablex
4033 \next
4035 \def\tablex#1{%
4036 \def\itemindicate{#1}%
4037 \parsearg\tabley
4039 \def\tabley#1{%
4041 \makevalueexpandable
4042 \edef\temp{\noexpand\tablez #1\space\space\space}%
4043 \expandafter
4044 }\temp \endtablez
4046 \def\tablez #1 #2 #3 #4\endtablez{%
4047 \aboveenvbreak
4048 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4049 \ifnum 0#2>0 \tableindent=#2\mil \fi
4050 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4051 \itemmax=\tableindent
4052 \advance \itemmax by -\itemmargin
4053 \advance \leftskip by \tableindent
4054 \exdentamount=\tableindent
4055 \parindent = 0pt
4056 \parskip = \smallskipamount
4057 \ifdim \parskip=0pt \parskip=2pt \fi
4058 \let\item = \internalBitem
4059 \let\itemx = \internalBitemx
4061 \def\Etable{\endgraf\afterenvbreak}
4062 \let\Eftable\Etable
4063 \let\Evtable\Etable
4064 \let\Eitemize\Etable
4065 \let\Eenumerate\Etable
4067 % This is the counter used by @enumerate, which is really @itemize
4069 \newcount \itemno
4071 \envdef\itemize{\parsearg\doitemize}
4073 \def\doitemize#1{%
4074 \aboveenvbreak
4075 \itemmax=\itemindent
4076 \advance\itemmax by -\itemmargin
4077 \advance\leftskip by \itemindent
4078 \exdentamount=\itemindent
4079 \parindent=0pt
4080 \parskip=\smallskipamount
4081 \ifdim\parskip=0pt \parskip=2pt \fi
4083 % Try typesetting the item mark so that if the document erroneously says
4084 % something like @itemize @samp (intending @table), there's an error
4085 % right away at the @itemize. It's not the best error message in the
4086 % world, but it's better than leaving it to the @item. This means if
4087 % the user wants an empty mark, they have to say @w{} not just @w.
4088 \def\itemcontents{#1}%
4089 \setbox0 = \hbox{\itemcontents}%
4091 % @itemize with no arg is equivalent to @itemize @bullet.
4092 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4094 \let\item=\itemizeitem
4097 % Definition of @item while inside @itemize and @enumerate.
4099 \def\itemizeitem{%
4100 \advance\itemno by 1 % for enumerations
4101 {\let\par=\endgraf \smallbreak}% reasonable place to break
4103 % If the document has an @itemize directly after a section title, a
4104 % \nobreak will be last on the list, and \sectionheading will have
4105 % done a \vskip-\parskip. In that case, we don't want to zero
4106 % parskip, or the item text will crash with the heading. On the
4107 % other hand, when there is normal text preceding the item (as there
4108 % usually is), we do want to zero parskip, or there would be too much
4109 % space. In that case, we won't have a \nobreak before. At least
4110 % that's the theory.
4111 \ifnum\lastpenalty<10000 \parskip=0in \fi
4112 \noindent
4113 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4115 \ifinner\else
4116 \vadjust{\penalty 1200}% not good to break after first line of item.
4118 % We can be in inner vertical mode in a footnote, although an
4119 % @itemize looks awful there.
4121 \flushcr
4124 % \splitoff TOKENS\endmark defines \first to be the first token in
4125 % TOKENS, and \rest to be the remainder.
4127 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4129 % Allow an optional argument of an uppercase letter, lowercase letter,
4130 % or number, to specify the first label in the enumerated list. No
4131 % argument is the same as `1'.
4133 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4134 \def\enumeratey #1 #2\endenumeratey{%
4135 % If we were given no argument, pretend we were given `1'.
4136 \def\thearg{#1}%
4137 \ifx\thearg\empty \def\thearg{1}\fi
4139 % Detect if the argument is a single token. If so, it might be a
4140 % letter. Otherwise, the only valid thing it can be is a number.
4141 % (We will always have one token, because of the test we just made.
4142 % This is a good thing, since \splitoff doesn't work given nothing at
4143 % all -- the first parameter is undelimited.)
4144 \expandafter\splitoff\thearg\endmark
4145 \ifx\rest\empty
4146 % Only one token in the argument. It could still be anything.
4147 % A ``lowercase letter'' is one whose \lccode is nonzero.
4148 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4149 % not equal to itself.
4150 % Otherwise, we assume it's a number.
4152 % We need the \relax at the end of the \ifnum lines to stop TeX from
4153 % continuing to look for a <number>.
4155 \ifnum\lccode\expandafter`\thearg=0\relax
4156 \numericenumerate % a number (we hope)
4157 \else
4158 % It's a letter.
4159 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4160 \lowercaseenumerate % lowercase letter
4161 \else
4162 \uppercaseenumerate % uppercase letter
4165 \else
4166 % Multiple tokens in the argument. We hope it's a number.
4167 \numericenumerate
4171 % An @enumerate whose labels are integers. The starting integer is
4172 % given in \thearg.
4174 \def\numericenumerate{%
4175 \itemno = \thearg
4176 \startenumeration{\the\itemno}%
4179 % The starting (lowercase) letter is in \thearg.
4180 \def\lowercaseenumerate{%
4181 \itemno = \expandafter`\thearg
4182 \startenumeration{%
4183 % Be sure we're not beyond the end of the alphabet.
4184 \ifnum\itemno=0
4185 \errmessage{No more lowercase letters in @enumerate; get a bigger
4186 alphabet}%
4188 \char\lccode\itemno
4192 % The starting (uppercase) letter is in \thearg.
4193 \def\uppercaseenumerate{%
4194 \itemno = \expandafter`\thearg
4195 \startenumeration{%
4196 % Be sure we're not beyond the end of the alphabet.
4197 \ifnum\itemno=0
4198 \errmessage{No more uppercase letters in @enumerate; get a bigger
4199 alphabet}
4201 \char\uccode\itemno
4205 % Call \doitemize, adding a period to the first argument and supplying the
4206 % common last two arguments. Also subtract one from the initial value in
4207 % \itemno, since @item increments \itemno.
4209 \def\startenumeration#1{%
4210 \advance\itemno by -1
4211 \doitemize{#1.}\flushcr
4214 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
4215 % to @enumerate.
4217 \def\alphaenumerate{\enumerate{a}}
4218 \def\capsenumerate{\enumerate{A}}
4219 \def\Ealphaenumerate{\Eenumerate}
4220 \def\Ecapsenumerate{\Eenumerate}
4223 % @multitable macros
4224 % Amy Hendrickson, 8/18/94, 3/6/96
4226 % @multitable ... @end multitable will make as many columns as desired.
4227 % Contents of each column will wrap at width given in preamble. Width
4228 % can be specified either with sample text given in a template line,
4229 % or in percent of \hsize, the current width of text on page.
4231 % Table can continue over pages but will only break between lines.
4233 % To make preamble:
4235 % Either define widths of columns in terms of percent of \hsize:
4236 % @multitable @columnfractions .25 .3 .45
4237 % @item ...
4239 % Numbers following @columnfractions are the percent of the total
4240 % current hsize to be used for each column. You may use as many
4241 % columns as desired.
4244 % Or use a template:
4245 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4246 % @item ...
4247 % using the widest term desired in each column.
4249 % Each new table line starts with @item, each subsequent new column
4250 % starts with @tab. Empty columns may be produced by supplying @tab's
4251 % with nothing between them for as many times as empty columns are needed,
4252 % ie, @tab@tab@tab will produce two empty columns.
4254 % @item, @tab do not need to be on their own lines, but it will not hurt
4255 % if they are.
4257 % Sample multitable:
4259 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4260 % @item first col stuff @tab second col stuff @tab third col
4261 % @item
4262 % first col stuff
4263 % @tab
4264 % second col stuff
4265 % @tab
4266 % third col
4267 % @item first col stuff @tab second col stuff
4268 % @tab Many paragraphs of text may be used in any column.
4270 % They will wrap at the width determined by the template.
4271 % @item@tab@tab This will be in third column.
4272 % @end multitable
4274 % Default dimensions may be reset by user.
4275 % @multitableparskip is vertical space between paragraphs in table.
4276 % @multitableparindent is paragraph indent in table.
4277 % @multitablecolmargin is horizontal space to be left between columns.
4278 % @multitablelinespace is space to leave between table items, baseline
4279 % to baseline.
4280 % 0pt means it depends on current normal line spacing.
4282 \newskip\multitableparskip
4283 \newskip\multitableparindent
4284 \newdimen\multitablecolspace
4285 \newskip\multitablelinespace
4286 \multitableparskip=0pt
4287 \multitableparindent=6pt
4288 \multitablecolspace=12pt
4289 \multitablelinespace=0pt
4291 % Macros used to set up halign preamble:
4293 \let\endsetuptable\relax
4294 \def\xendsetuptable{\endsetuptable}
4295 \let\columnfractions\relax
4296 \def\xcolumnfractions{\columnfractions}
4297 \newif\ifsetpercent
4299 % #1 is the @columnfraction, usually a decimal number like .5, but might
4300 % be just 1. We just use it, whatever it is.
4302 \def\pickupwholefraction#1 {%
4303 \global\advance\colcount by 1
4304 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4305 \setuptable
4308 \newcount\colcount
4309 \def\setuptable#1{%
4310 \def\firstarg{#1}%
4311 \ifx\firstarg\xendsetuptable
4312 \let\go = \relax
4313 \else
4314 \ifx\firstarg\xcolumnfractions
4315 \global\setpercenttrue
4316 \else
4317 \ifsetpercent
4318 \let\go\pickupwholefraction
4319 \else
4320 \global\advance\colcount by 1
4321 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4322 % separator; typically that is always in the input, anyway.
4323 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4326 \ifx\go\pickupwholefraction
4327 % Put the argument back for the \pickupwholefraction call, so
4328 % we'll always have a period there to be parsed.
4329 \def\go{\pickupwholefraction#1}%
4330 \else
4331 \let\go = \setuptable
4332 \fi%
4337 % multitable-only commands.
4339 % @headitem starts a heading row, which we typeset in bold. Assignments
4340 % have to be global since we are inside the implicit group of an
4341 % alignment entry. \everycr below resets \everytab so we don't have to
4342 % undo it ourselves.
4343 \def\headitemfont{\b}% for people to use in the template row; not changeable
4344 \def\headitem{%
4345 \checkenv\multitable
4346 \crcr
4347 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4348 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4349 \the\everytab % for the first item
4352 % default for tables with no headings.
4353 \let\headitemcrhook=\relax
4355 % A \tab used to include \hskip1sp. But then the space in a template
4356 % line is not enough. That is bad. So let's go back to just `&' until
4357 % we again encounter the problem the 1sp was intended to solve.
4358 % --karl, nathan@acm.org, 20apr99.
4359 \def\tab{\checkenv\multitable &\the\everytab}%
4361 % @multitable ... @end multitable definitions:
4363 \newtoks\everytab % insert after every tab.
4365 \envdef\multitable{%
4366 \vskip\parskip
4367 \startsavinginserts
4369 % @item within a multitable starts a normal row.
4370 % We use \def instead of \let so that if one of the multitable entries
4371 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4372 % \endtemplate) expanding \doitemize.
4373 \def\item{\crcr}%
4375 \tolerance=9500
4376 \hbadness=9500
4377 \setmultitablespacing
4378 \parskip=\multitableparskip
4379 \parindent=\multitableparindent
4380 \overfullrule=0pt
4381 \global\colcount=0
4383 \everycr = {%
4384 \noalign{%
4385 \global\everytab={}% Reset from possible headitem.
4386 \global\colcount=0 % Reset the column counter.
4388 % Check for saved footnotes, etc.:
4389 \checkinserts
4391 % Perhaps a \nobreak, then reset:
4392 \headitemcrhook
4393 \global\let\headitemcrhook=\relax
4397 \parsearg\domultitable
4399 \def\domultitable#1{%
4400 % To parse everything between @multitable and @item:
4401 \setuptable#1 \endsetuptable
4403 % This preamble sets up a generic column definition, which will
4404 % be used as many times as user calls for columns.
4405 % \vtop will set a single line and will also let text wrap and
4406 % continue for many paragraphs if desired.
4407 \halign\bgroup &%
4408 \global\advance\colcount by 1
4409 \multistrut
4410 \vtop{%
4411 % Use the current \colcount to find the correct column width:
4412 \hsize=\expandafter\csname col\the\colcount\endcsname
4414 % In order to keep entries from bumping into each other
4415 % we will add a \leftskip of \multitablecolspace to all columns after
4416 % the first one.
4418 % If a template has been used, we will add \multitablecolspace
4419 % to the width of each template entry.
4421 % If the user has set preamble in terms of percent of \hsize we will
4422 % use that dimension as the width of the column, and the \leftskip
4423 % will keep entries from bumping into each other. Table will start at
4424 % left margin and final column will justify at right margin.
4426 % Make sure we don't inherit \rightskip from the outer environment.
4427 \rightskip=0pt
4428 \ifnum\colcount=1
4429 % The first column will be indented with the surrounding text.
4430 \advance\hsize by\leftskip
4431 \else
4432 \ifsetpercent \else
4433 % If user has not set preamble in terms of percent of \hsize
4434 % we will advance \hsize by \multitablecolspace.
4435 \advance\hsize by \multitablecolspace
4437 % In either case we will make \leftskip=\multitablecolspace:
4438 \leftskip=\multitablecolspace
4440 % Ignoring space at the beginning and end avoids an occasional spurious
4441 % blank line, when TeX decides to break the line at the space before the
4442 % box from the multistrut, so the strut ends up on a line by itself.
4443 % For example:
4444 % @multitable @columnfractions .11 .89
4445 % @item @code{#}
4446 % @tab Legal holiday which is valid in major parts of the whole country.
4447 % Is automatically provided with highlighting sequences respectively
4448 % marking characters.
4449 \noindent\ignorespaces##\unskip\multistrut
4450 }\cr
4452 \def\Emultitable{%
4453 \crcr
4454 \egroup % end the \halign
4455 \global\setpercentfalse
4458 \def\setmultitablespacing{%
4459 \def\multistrut{\strut}% just use the standard line spacing
4461 % Compute \multitablelinespace (if not defined by user) for use in
4462 % \multitableparskip calculation. We used define \multistrut based on
4463 % this, but (ironically) that caused the spacing to be off.
4464 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4465 \ifdim\multitablelinespace=0pt
4466 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4467 \global\advance\multitablelinespace by-\ht0
4469 % Test to see if parskip is larger than space between lines of
4470 % table. If not, do nothing.
4471 % If so, set to same dimension as multitablelinespace.
4472 \ifdim\multitableparskip>\multitablelinespace
4473 \global\multitableparskip=\multitablelinespace
4474 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4475 % than skip between lines in the table.
4476 \fi%
4477 \ifdim\multitableparskip=0pt
4478 \global\multitableparskip=\multitablelinespace
4479 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4480 % than skip between lines in the table.
4481 \fi}
4484 \message{conditionals,}
4486 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4487 % @ifnotxml always succeed. They currently do nothing; we don't
4488 % attempt to check whether the conditionals are properly nested. But we
4489 % have to remember that they are conditionals, so that @end doesn't
4490 % attempt to close an environment group.
4492 \def\makecond#1{%
4493 \expandafter\let\csname #1\endcsname = \relax
4494 \expandafter\let\csname iscond.#1\endcsname = 1
4496 \makecond{iftex}
4497 \makecond{ifnotdocbook}
4498 \makecond{ifnothtml}
4499 \makecond{ifnotinfo}
4500 \makecond{ifnotplaintext}
4501 \makecond{ifnotxml}
4503 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4505 \def\direntry{\doignore{direntry}}
4506 \def\documentdescription{\doignore{documentdescription}}
4507 \def\docbook{\doignore{docbook}}
4508 \def\html{\doignore{html}}
4509 \def\ifdocbook{\doignore{ifdocbook}}
4510 \def\ifhtml{\doignore{ifhtml}}
4511 \def\ifinfo{\doignore{ifinfo}}
4512 \def\ifnottex{\doignore{ifnottex}}
4513 \def\ifplaintext{\doignore{ifplaintext}}
4514 \def\ifxml{\doignore{ifxml}}
4515 \def\ignore{\doignore{ignore}}
4516 \def\menu{\doignore{menu}}
4517 \def\xml{\doignore{xml}}
4519 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4521 % A count to remember the depth of nesting.
4522 \newcount\doignorecount
4524 \def\doignore#1{\begingroup
4525 % Scan in ``verbatim'' mode:
4526 \obeylines
4527 \catcode`\@ = \other
4528 \catcode`\{ = \other
4529 \catcode`\} = \other
4531 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4532 \spaceisspace
4534 % Count number of #1's that we've seen.
4535 \doignorecount = 0
4537 % Swallow text until we reach the matching `@end #1'.
4538 \dodoignore{#1}%
4541 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4542 \obeylines %
4544 \gdef\dodoignore#1{%
4545 % #1 contains the command name as a string, e.g., `ifinfo'.
4547 % Define a command to find the next `@end #1'.
4548 \long\def\doignoretext##1^^M@end #1{%
4549 \doignoretextyyy##1^^M@#1\_STOP_}%
4551 % And this command to find another #1 command, at the beginning of a
4552 % line. (Otherwise, we would consider a line `@c @ifset', for
4553 % example, to count as an @ifset for nesting.)
4554 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4556 % And now expand that command.
4557 \doignoretext ^^M%
4561 \def\doignoreyyy#1{%
4562 \def\temp{#1}%
4563 \ifx\temp\empty % Nothing found.
4564 \let\next\doignoretextzzz
4565 \else % Found a nested condition, ...
4566 \advance\doignorecount by 1
4567 \let\next\doignoretextyyy % ..., look for another.
4568 % If we're here, #1 ends with ^^M\ifinfo (for example).
4570 \next #1% the token \_STOP_ is present just after this macro.
4573 % We have to swallow the remaining "\_STOP_".
4575 \def\doignoretextzzz#1{%
4576 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4577 \let\next\enddoignore
4578 \else % Still inside a nested condition.
4579 \advance\doignorecount by -1
4580 \let\next\doignoretext % Look for the next @end.
4582 \next
4585 % Finish off ignored text.
4586 { \obeylines%
4587 % Ignore anything after the last `@end #1'; this matters in verbatim
4588 % environments, where otherwise the newline after an ignored conditional
4589 % would result in a blank line in the output.
4590 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4594 % @set VAR sets the variable VAR to an empty value.
4595 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4597 % Since we want to separate VAR from REST-OF-LINE (which might be
4598 % empty), we can't just use \parsearg; we have to insert a space of our
4599 % own to delimit the rest of the line, and then take it out again if we
4600 % didn't need it.
4601 % We rely on the fact that \parsearg sets \catcode`\ =10.
4603 \parseargdef\set{\setyyy#1 \endsetyyy}
4604 \def\setyyy#1 #2\endsetyyy{%
4606 \makevalueexpandable
4607 \def\temp{#2}%
4608 \edef\next{\gdef\makecsname{SET#1}}%
4609 \ifx\temp\empty
4610 \next{}%
4611 \else
4612 \setzzz#2\endsetzzz
4616 % Remove the trailing space \setxxx inserted.
4617 \def\setzzz#1 \endsetzzz{\next{#1}}
4619 % @clear VAR clears (i.e., unsets) the variable VAR.
4621 \parseargdef\clear{%
4623 \makevalueexpandable
4624 \global\expandafter\let\csname SET#1\endcsname=\relax
4628 % @value{foo} gets the text saved in variable foo.
4629 \def\value{\begingroup\makevalueexpandable\valuexxx}
4630 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4632 \catcode`\-=\active \catcode`\_=\active
4634 \gdef\makevalueexpandable{%
4635 \let\value = \expandablevalue
4636 % We don't want these characters active, ...
4637 \catcode`\-=\other \catcode`\_=\other
4638 % ..., but we might end up with active ones in the argument if
4639 % we're called from @code, as @code{@value{foo-bar_}}, though.
4640 % So \let them to their normal equivalents.
4641 \let-\normaldash \let_\normalunderscore
4645 % We have this subroutine so that we can handle at least some @value's
4646 % properly in indexes (we call \makevalueexpandable in \indexdummies).
4647 % The command has to be fully expandable (if the variable is set), since
4648 % the result winds up in the index file. This means that if the
4649 % variable's value contains other Texinfo commands, it's almost certain
4650 % it will fail (although perhaps we could fix that with sufficient work
4651 % to do a one-level expansion on the result, instead of complete).
4653 % Unfortunately, this has the consequence that when _ is in the *value*
4654 % of an @set, it does not print properly in the roman fonts (get the cmr
4655 % dot accent at position 126 instead). No fix comes to mind, and it's
4656 % been this way since 2003 or earlier, so just ignore it.
4658 \def\expandablevalue#1{%
4659 \expandafter\ifx\csname SET#1\endcsname\relax
4660 {[No value for ``#1'']}%
4661 \message{Variable `#1', used in @value, is not set.}%
4662 \else
4663 \csname SET#1\endcsname
4667 % Like \expandablevalue, but completely expandable (the \message in the
4668 % definition above operates at the execution level of TeX). Used when
4669 % writing to auxiliary files, due to the expansion that \write does.
4670 % If flag is undefined, pass through an unexpanded @value command: maybe it
4671 % will be set by the time it is read back in.
4673 % NB flag names containing - or _ may not work here.
4674 \def\dummyvalue#1{%
4675 \expandafter\ifx\csname SET#1\endcsname\relax
4676 \noexpand\value{#1}%
4677 \else
4678 \csname SET#1\endcsname
4682 % Used for @value's in index entries to form the sort key: expand the @value
4683 % if possible, otherwise sort late.
4684 \def\indexnofontsvalue#1{%
4685 \expandafter\ifx\csname SET#1\endcsname\relax
4686 ZZZZZZZ
4687 \else
4688 \csname SET#1\endcsname
4692 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4693 % with @set.
4695 % To get the special treatment we need for `@end ifset,' we call
4696 % \makecond and then redefine.
4698 \makecond{ifset}
4699 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4700 \def\doifset#1#2{%
4702 \makevalueexpandable
4703 \let\next=\empty
4704 \expandafter\ifx\csname SET#2\endcsname\relax
4705 #1% If not set, redefine \next.
4707 \expandafter
4708 }\next
4710 \def\ifsetfail{\doignore{ifset}}
4712 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4713 % defined with @set, or has been undefined with @clear.
4715 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4716 % above code: if the variable is not set, do nothing, if it is set,
4717 % then redefine \next to \ifclearfail.
4719 \makecond{ifclear}
4720 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4721 \def\ifclearfail{\doignore{ifclear}}
4723 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4724 % without the @) is in fact defined. We can only feasibly check at the
4725 % TeX level, so something like `mathcode' is going to considered
4726 % defined even though it is not a Texinfo command.
4728 \makecond{ifcommanddefined}
4729 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4731 \def\doifcmddefined#1#2{{%
4732 \makevalueexpandable
4733 \let\next=\empty
4734 \expandafter\ifx\csname #2\endcsname\relax
4735 #1% If not defined, \let\next as above.
4737 \expandafter
4738 }\next
4740 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4742 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4743 \makecond{ifcommandnotdefined}
4744 \def\ifcommandnotdefined{%
4745 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4746 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4748 % Set the `txicommandconditionals' variable, so documents have a way to
4749 % test if the @ifcommand...defined conditionals are available.
4750 \set txicommandconditionals
4752 % @dircategory CATEGORY -- specify a category of the dir file
4753 % which this file should belong to. Ignore this in TeX.
4754 \let\dircategory=\comment
4756 % @defininfoenclose.
4757 \let\definfoenclose=\comment
4760 \message{indexing,}
4761 % Index generation facilities
4763 % Define \newwrite to be identical to plain tex's \newwrite
4764 % except not \outer, so it can be used within macros and \if's.
4765 \edef\newwrite{\makecsname{ptexnewwrite}}
4767 % \newindex {foo} defines an index named IX.
4768 % It automatically defines \IXindex such that
4769 % \IXindex ...rest of line... puts an entry in the index IX.
4770 % It also defines \IXindfile to be the number of the output channel for
4771 % the file that accumulates this index. The file's extension is IX.
4772 % The name of an index should be no more than 2 characters long
4773 % for the sake of vms.
4775 \def\newindex#1{%
4776 \expandafter\chardef\csname#1indfile\endcsname=0
4777 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4778 \noexpand\doindex{#1}}
4781 % @defindex foo == \newindex{foo}
4783 \def\defindex{\parsearg\newindex}
4785 % Define @defcodeindex, like @defindex except put all entries in @code.
4787 \def\defcodeindex{\parsearg\newcodeindex}
4789 \def\newcodeindex#1{%
4790 \expandafter\chardef\csname#1indfile\endcsname=0
4791 \expandafter\xdef\csname#1index\endcsname{%
4792 \noexpand\docodeindex{#1}}%
4795 % The default indices:
4796 \newindex{cp}% concepts,
4797 \newcodeindex{fn}% functions,
4798 \newcodeindex{vr}% variables,
4799 \newcodeindex{tp}% types,
4800 \newcodeindex{ky}% keys
4801 \newcodeindex{pg}% and programs.
4804 % @synindex foo bar makes index foo feed into index bar.
4805 % Do this instead of @defindex foo if you don't want it as a separate index.
4807 % @syncodeindex foo bar similar, but put all entries made for index foo
4808 % inside @code.
4810 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4811 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4813 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4814 % #3 the target index (bar).
4815 \def\dosynindex#1#2#3{%
4816 \requireopenindexfile{#3}%
4817 % redefine \fooindfile:
4818 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4819 \expandafter\let\csname#2indfile\endcsname=\temp
4820 % redefine \fooindex:
4821 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4824 % Define \doindex, the driver for all index macros.
4825 % Argument #1 is generated by the calling \fooindex macro,
4826 % and it is the two-letter name of the index.
4828 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4829 \def\doindexxxx #1{\doind{\indexname}{#1}}
4831 % like the previous two, but they put @code around the argument.
4832 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4833 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
4836 % Used when writing an index entry out to an index file to prevent
4837 % expansion of Texinfo commands that can appear in an index entry.
4839 \def\indexdummies{%
4840 \escapechar = `\\ % use backslash in output files.
4841 \definedummyletter\@%
4842 \definedummyletter\ %
4844 % For texindex which always views { and } as separators.
4845 \def\{{\lbracechar}%
4846 \def\}{\rbracechar}%
4848 % Do the redefinitions.
4849 \definedummies
4852 % Used for the aux and toc files, where @ is the escape character.
4854 \def\atdummies{%
4855 \definedummyletter\@%
4856 \definedummyletter\ %
4857 \definedummyletter\{%
4858 \definedummyletter\}%
4860 % Do the redefinitions.
4861 \definedummies
4862 \otherbackslash
4865 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4866 % preventing its expansion. This is used only for control words,
4867 % not control letters, because the \space would be incorrect for
4868 % control characters, but is needed to separate the control word
4869 % from whatever follows.
4871 % These can be used both for control words that take an argument and
4872 % those that do not. If it is followed by {arg} in the input, then
4873 % that will dutifully get written to the index (or wherever).
4875 % For control letters, we have \definedummyletter, which omits the
4876 % space.
4878 \def\definedummyword #1{\def#1{\string#1\space}}%
4879 \def\definedummyletter#1{\def#1{\string#1}}%
4880 \let\definedummyaccent\definedummyletter
4882 % Called from \indexdummies and \atdummies, to effectively prevent
4883 % the expansion of commands.
4885 \def\definedummies{%
4887 \let\commondummyword\definedummyword
4888 \let\commondummyletter\definedummyletter
4889 \let\commondummyaccent\definedummyaccent
4890 \commondummiesnofonts
4892 \definedummyletter\_%
4893 \definedummyletter\-%
4895 % Non-English letters.
4896 \definedummyword\AA
4897 \definedummyword\AE
4898 \definedummyword\DH
4899 \definedummyword\L
4900 \definedummyword\O
4901 \definedummyword\OE
4902 \definedummyword\TH
4903 \definedummyword\aa
4904 \definedummyword\ae
4905 \definedummyword\dh
4906 \definedummyword\exclamdown
4907 \definedummyword\l
4908 \definedummyword\o
4909 \definedummyword\oe
4910 \definedummyword\ordf
4911 \definedummyword\ordm
4912 \definedummyword\questiondown
4913 \definedummyword\ss
4914 \definedummyword\th
4916 % Although these internal commands shouldn't show up, sometimes they do.
4917 \definedummyword\bf
4918 \definedummyword\gtr
4919 \definedummyword\hat
4920 \definedummyword\less
4921 \definedummyword\sf
4922 \definedummyword\sl
4923 \definedummyword\tclose
4924 \definedummyword\tt
4926 \definedummyword\LaTeX
4927 \definedummyword\TeX
4929 % Assorted special characters.
4930 \definedummyword\arrow
4931 \definedummyword\bullet
4932 \definedummyword\comma
4933 \definedummyword\copyright
4934 \definedummyword\registeredsymbol
4935 \definedummyword\dots
4936 \definedummyword\enddots
4937 \definedummyword\entrybreak
4938 \definedummyword\equiv
4939 \definedummyword\error
4940 \definedummyword\euro
4941 \definedummyword\expansion
4942 \definedummyword\geq
4943 \definedummyword\guillemetleft
4944 \definedummyword\guillemetright
4945 \definedummyword\guilsinglleft
4946 \definedummyword\guilsinglright
4947 \definedummyword\lbracechar
4948 \definedummyword\leq
4949 \definedummyword\mathopsup
4950 \definedummyword\minus
4951 \definedummyword\ogonek
4952 \definedummyword\pounds
4953 \definedummyword\point
4954 \definedummyword\print
4955 \definedummyword\quotedblbase
4956 \definedummyword\quotedblleft
4957 \definedummyword\quotedblright
4958 \definedummyword\quoteleft
4959 \definedummyword\quoteright
4960 \definedummyword\quotesinglbase
4961 \definedummyword\rbracechar
4962 \definedummyword\result
4963 \definedummyword\sub
4964 \definedummyword\sup
4965 \definedummyword\textdegree
4967 % We want to disable all macros so that they are not expanded by \write.
4968 \macrolist
4969 \let\value\dummyvalue
4971 \normalturnoffactive
4974 % \commondummiesnofonts: common to \definedummies and \indexnofonts.
4975 % Define \commondummyletter, \commondummyaccent and \commondummyword before
4976 % using. Used for accents, font commands, and various control letters.
4978 \def\commondummiesnofonts{%
4979 % Control letters and accents.
4980 \commondummyletter\!%
4981 \commondummyaccent\"%
4982 \commondummyaccent\'%
4983 \commondummyletter\*%
4984 \commondummyaccent\,%
4985 \commondummyletter\.%
4986 \commondummyletter\/%
4987 \commondummyletter\:%
4988 \commondummyaccent\=%
4989 \commondummyletter\?%
4990 \commondummyaccent\^%
4991 \commondummyaccent\`%
4992 \commondummyaccent\~%
4993 \commondummyword\u
4994 \commondummyword\v
4995 \commondummyword\H
4996 \commondummyword\dotaccent
4997 \commondummyword\ogonek
4998 \commondummyword\ringaccent
4999 \commondummyword\tieaccent
5000 \commondummyword\ubaraccent
5001 \commondummyword\udotaccent
5002 \commondummyword\dotless
5004 % Texinfo font commands.
5005 \commondummyword\b
5006 \commondummyword\i
5007 \commondummyword\r
5008 \commondummyword\sansserif
5009 \commondummyword\sc
5010 \commondummyword\slanted
5011 \commondummyword\t
5013 % Commands that take arguments.
5014 \commondummyword\abbr
5015 \commondummyword\acronym
5016 \commondummyword\anchor
5017 \commondummyword\cite
5018 \commondummyword\code
5019 \commondummyword\command
5020 \commondummyword\dfn
5021 \commondummyword\dmn
5022 \commondummyword\email
5023 \commondummyword\emph
5024 \commondummyword\env
5025 \commondummyword\file
5026 \commondummyword\image
5027 \commondummyword\indicateurl
5028 \commondummyword\inforef
5029 \commondummyword\kbd
5030 \commondummyword\key
5031 \commondummyword\math
5032 \commondummyword\option
5033 \commondummyword\pxref
5034 \commondummyword\ref
5035 \commondummyword\samp
5036 \commondummyword\strong
5037 \commondummyword\tie
5038 \commondummyword\U
5039 \commondummyword\uref
5040 \commondummyword\url
5041 \commondummyword\var
5042 \commondummyword\verb
5043 \commondummyword\w
5044 \commondummyword\xref
5047 % For testing: output @{ and @} in index sort strings as \{ and \}.
5048 \newif\ifusebracesinindexes
5050 \let\indexlbrace\relax
5051 \let\indexrbrace\relax
5053 {\catcode`\@=0
5054 \catcode`\\=13
5055 @gdef@backslashdisappear{@def\{}}
5059 \catcode`\<=13
5060 \catcode`\-=13
5061 \catcode`\`=13
5062 \gdef\indexnonalnumdisappear{%
5063 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
5064 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5065 % (Introduced for FSFS 2nd ed.)
5066 \let`=\empty
5069 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
5070 \backslashdisappear
5073 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
5074 \def-{}%
5076 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
5077 \def<{}%
5079 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
5080 \def\@{}%
5084 \gdef\indexnonalnumreappear{%
5085 \useindexbackslash
5086 \let-\normaldash
5087 \let<\normalless
5088 \def\@{@}%
5093 % \indexnofonts is used when outputting the strings to sort the index
5094 % by, and when constructing control sequence names. It eliminates all
5095 % control sequences and just writes whatever the best ASCII sort string
5096 % would be for a given command (usually its argument).
5098 \def\indexnofonts{%
5099 % Accent commands should become @asis.
5100 \def\commondummyaccent##1{\let##1\asis}%
5101 % We can just ignore other control letters.
5102 \def\commondummyletter##1{\let##1\empty}%
5103 % All control words become @asis by default; overrides below.
5104 \let\commondummyword\commondummyaccent
5105 \commondummiesnofonts
5107 % Don't no-op \tt, since it isn't a user-level command
5108 % and is used in the definitions of the active chars like <, >, |, etc.
5109 % Likewise with the other plain tex font commands.
5110 %\let\tt=\asis
5112 \def\ { }%
5113 \def\@{@}%
5114 \def\_{\normalunderscore}%
5115 \def\-{}% @- shouldn't affect sorting
5117 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5118 \uccode`\1=`\} \uppercase{\def\}{1}}%
5119 \let\lbracechar\{%
5120 \let\rbracechar\}%
5122 % Non-English letters.
5123 \def\AA{AA}%
5124 \def\AE{AE}%
5125 \def\DH{DZZ}%
5126 \def\L{L}%
5127 \def\OE{OE}%
5128 \def\O{O}%
5129 \def\TH{TH}%
5130 \def\aa{aa}%
5131 \def\ae{ae}%
5132 \def\dh{dzz}%
5133 \def\exclamdown{!}%
5134 \def\l{l}%
5135 \def\oe{oe}%
5136 \def\ordf{a}%
5137 \def\ordm{o}%
5138 \def\o{o}%
5139 \def\questiondown{?}%
5140 \def\ss{ss}%
5141 \def\th{th}%
5143 \def\LaTeX{LaTeX}%
5144 \def\TeX{TeX}%
5146 % Assorted special characters.
5147 % (The following {} will end up in the sort string, but that's ok.)
5148 \def\arrow{->}%
5149 \def\bullet{bullet}%
5150 \def\comma{,}%
5151 \def\copyright{copyright}%
5152 \def\dots{...}%
5153 \def\enddots{...}%
5154 \def\equiv{==}%
5155 \def\error{error}%
5156 \def\euro{euro}%
5157 \def\expansion{==>}%
5158 \def\geq{>=}%
5159 \def\guillemetleft{<<}%
5160 \def\guillemetright{>>}%
5161 \def\guilsinglleft{<}%
5162 \def\guilsinglright{>}%
5163 \def\leq{<=}%
5164 \def\minus{-}%
5165 \def\point{.}%
5166 \def\pounds{pounds}%
5167 \def\print{-|}%
5168 \def\quotedblbase{"}%
5169 \def\quotedblleft{"}%
5170 \def\quotedblright{"}%
5171 \def\quoteleft{`}%
5172 \def\quoteright{'}%
5173 \def\quotesinglbase{,}%
5174 \def\registeredsymbol{R}%
5175 \def\result{=>}%
5176 \def\textdegree{o}%
5178 % We need to get rid of all macros, leaving only the arguments (if present).
5179 % Of course this is not nearly correct, but it is the best we can do for now.
5180 % makeinfo does not expand macros in the argument to @deffn, which ends up
5181 % writing an index entry, and texindex isn't prepared for an index sort entry
5182 % that starts with \.
5184 % Since macro invocations are followed by braces, we can just redefine them
5185 % to take a single TeX argument. The case of a macro invocation that
5186 % goes to end-of-line is not handled.
5188 \macrolist
5189 \let\value\indexnofontsvalue
5195 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
5197 % Most index entries go through here, but \dosubind is the general case.
5198 % #1 is the index name, #2 is the entry text.
5199 \def\doind#1#2{\dosubind{#1}{#2}{}}
5201 % There is also \dosubind {index}{topic}{subtopic}
5202 % which makes an entry in a two-level index such as the operation index.
5203 % TODO: Two-level index? Operation index?
5205 % Workhorse for all indexes.
5206 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
5207 % empty if called from \doind, as we usually are (the main exception
5208 % is with most defuns, which call us directly).
5210 \def\dosubind#1#2#3{%
5211 \iflinks
5213 \requireopenindexfile{#1}%
5214 % Store the main index entry text (including the third arg).
5215 \toks0 = {#2}%
5216 % If third arg is present, precede it with a space.
5217 \def\thirdarg{#3}%
5218 \ifx\thirdarg\empty \else
5219 \toks0 = \expandafter{\the\toks0 \space #3}%
5222 \edef\writeto{\csname#1indfile\endcsname}%
5224 \safewhatsit\dosubindwrite
5229 % Check if an index file has been opened, and if not, open it.
5230 \def\requireopenindexfile#1{%
5231 \ifnum\csname #1indfile\endcsname=0
5232 \expandafter\newwrite \csname#1indfile\endcsname
5233 \edef\suffix{#1}%
5234 % A .fls suffix would conflict with the file extension for the output
5235 % of -recorder, so use .f1s instead.
5236 \ifx\suffix\indexisfl\def\suffix{f1}\fi
5237 % Open the file
5238 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5239 % Using \immediate above here prevents an object entering into the current
5240 % box, which could confound checks such as those in \safewhatsit for
5241 % preceding skips.
5242 \typeout{Writing index file \jobname.\suffix}%
5243 \fi}
5244 \def\indexisfl{fl}
5246 % Output \ as {\indexbackslash}, because \ is an escape character in
5247 % the index files.
5248 \let\indexbackslash=\relax
5249 {\catcode`\@=0 \catcode`\\=\active
5250 @gdef@useindexbackslash{@def\{{@indexbackslash}}}
5253 % Definition for writing index entry text.
5254 \def\sortas#1{\ignorespaces}%
5256 % Definition for writing index entry sort key. Should occur at the at
5257 % the beginning of the index entry, like
5258 % @cindex @sortas{september} \september
5259 % The \ignorespaces takes care of following space, but there's no way
5260 % to remove space before it.
5262 \catcode`\-=13
5263 \gdef\indexwritesortas{%
5264 \begingroup
5265 \indexnonalnumreappear
5266 \indexwritesortasxxx}
5267 \gdef\indexwritesortasxxx#1{%
5268 \xdef\indexsortkey{#1}\endgroup}
5272 % Write the entry in \toks0 to the index file.
5274 \def\dosubindwrite{%
5275 % Put the index entry in the margin if desired.
5276 \ifx\SETmarginindex\relax\else
5277 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
5280 % Remember, we are within a group.
5281 \indexdummies % Must do this here, since \bf, etc expand at this stage
5282 \useindexbackslash % \indexbackslash isn't defined now so it will be output
5283 % as is; and it will print as backslash.
5284 % The braces around \indexbrace are recognized by texindex.
5286 % Get the string to sort by, by processing the index entry with all
5287 % font commands turned off.
5288 {\indexnofonts
5289 \def\lbracechar{{\indexlbrace}}%
5290 \def\rbracechar{{\indexrbrace}}%
5291 \let\{=\lbracechar
5292 \let\}=\rbracechar
5293 \indexnonalnumdisappear
5294 \xdef\indexsortkey{}%
5295 \let\sortas=\indexwritesortas
5296 \edef\temp{\the\toks0}%
5297 \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
5298 \ifx\indexsortkey\empty
5299 \xdef\indexsortkey{\temp}%
5300 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
5304 % Set up the complete index entry, with both the sort key and
5305 % the original text, including any font commands. We write
5306 % three arguments to \entry to the .?? file (four in the
5307 % subentry case), texindex reduces to two when writing the .??s
5308 % sorted result.
5309 \edef\temp{%
5310 \write\writeto{%
5311 \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
5313 \temp
5315 \newbox\dummybox % used above
5317 % Take care of unwanted page breaks/skips around a whatsit:
5319 % If a skip is the last thing on the list now, preserve it
5320 % by backing up by \lastskip, doing the \write, then inserting
5321 % the skip again. Otherwise, the whatsit generated by the
5322 % \write or \pdfdest will make \lastskip zero. The result is that
5323 % sequences like this:
5324 % @end defun
5325 % @tindex whatever
5326 % @defun ...
5327 % will have extra space inserted, because the \medbreak in the
5328 % start of the @defun won't see the skip inserted by the @end of
5329 % the previous defun.
5331 % But don't do any of this if we're not in vertical mode. We
5332 % don't want to do a \vskip and prematurely end a paragraph.
5334 % Avoid page breaks due to these extra skips, too.
5336 % But wait, there is a catch there:
5337 % We'll have to check whether \lastskip is zero skip. \ifdim is not
5338 % sufficient for this purpose, as it ignores stretch and shrink parts
5339 % of the skip. The only way seems to be to check the textual
5340 % representation of the skip.
5342 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5343 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5345 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5347 \newskip\whatsitskip
5348 \newcount\whatsitpenalty
5350 % ..., ready, GO:
5352 \def\safewhatsit#1{\ifhmode
5354 \else
5355 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5356 \whatsitskip = \lastskip
5357 \edef\lastskipmacro{\the\lastskip}%
5358 \whatsitpenalty = \lastpenalty
5360 % If \lastskip is nonzero, that means the last item was a
5361 % skip. And since a skip is discardable, that means this
5362 % -\whatsitskip glue we're inserting is preceded by a
5363 % non-discardable item, therefore it is not a potential
5364 % breakpoint, therefore no \nobreak needed.
5365 \ifx\lastskipmacro\zeroskipmacro
5366 \else
5367 \vskip-\whatsitskip
5372 \ifx\lastskipmacro\zeroskipmacro
5373 % If \lastskip was zero, perhaps the last item was a penalty, and
5374 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5375 % to re-insert the same penalty (values >10000 are used for various
5376 % signals); since we just inserted a non-discardable item, any
5377 % following glue (such as a \parskip) would be a breakpoint. For example:
5378 % @deffn deffn-whatever
5379 % @vindex index-whatever
5380 % Description.
5381 % would allow a break between the index-whatever whatsit
5382 % and the "Description." paragraph.
5383 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5384 \else
5385 % On the other hand, if we had a nonzero \lastskip,
5386 % this make-up glue would be preceded by a non-discardable item
5387 % (the whatsit from the \write), so we must insert a \nobreak.
5388 \nobreak\vskip\whatsitskip
5390 \fi}
5392 % The index entry written in the file actually looks like
5393 % \entry {sortstring}{page}{topic}
5394 % or
5395 % \entry {sortstring}{page}{topic}{subtopic}
5396 % The texindex program reads in these files and writes files
5397 % containing these kinds of lines:
5398 % \initial {c}
5399 % before the first topic whose initial is c
5400 % \entry {topic}{pagelist}
5401 % for a topic that is used without subtopics
5402 % \primary {topic}
5403 % for the beginning of a topic that is used with subtopics
5404 % \secondary {subtopic}{pagelist}
5405 % for each subtopic.
5407 % Define the user-accessible indexing commands
5408 % @findex, @vindex, @kindex, @cindex.
5410 \def\findex {\fnindex}
5411 \def\kindex {\kyindex}
5412 \def\cindex {\cpindex}
5413 \def\vindex {\vrindex}
5414 \def\tindex {\tpindex}
5415 \def\pindex {\pgindex}
5417 \def\cindexsub {\begingroup\obeylines\cindexsub}
5418 {\obeylines %
5419 \gdef\cindexsub "#1" #2^^M{\endgroup %
5420 \dosubind{cp}{#2}{#1}}}
5422 % Define the macros used in formatting output of the sorted index material.
5424 % @printindex causes a particular index (the ??s file) to get printed.
5425 % It does not print any chapter heading (usually an @unnumbered).
5427 \parseargdef\printindex{\begingroup
5428 \dobreak \chapheadingskip{10000}%
5430 \smallfonts \rm
5431 \tolerance = 9500
5432 \plainfrenchspacing
5433 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5435 % See if the index file exists and is nonempty.
5436 % Change catcode of @ here so that if the index file contains
5437 % \initial {@}
5438 % as its first line, TeX doesn't complain about mismatched braces
5439 % (because it thinks @} is a control sequence).
5440 \catcode`\@ = 12
5441 % See comment in \requireopenindexfile.
5442 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5443 \openin 1 \jobname.\indexname s
5444 \ifeof 1
5445 % \enddoublecolumns gets confused if there is no text in the index,
5446 % and it loses the chapter title and the aux file entries for the
5447 % index. The easiest way to prevent this problem is to make sure
5448 % there is some text.
5449 \putwordIndexNonexistent
5450 \typeout{No file \jobname.\indexname s.}%
5451 \else
5452 \catcode`\\ = 0
5454 % If the index file exists but is empty, then \openin leaves \ifeof
5455 % false. We have to make TeX try to read something from the file, so
5456 % it can discover if there is anything in it.
5457 \read 1 to \thisline
5458 \ifeof 1
5459 \putwordIndexIsEmpty
5460 \else
5461 % Index files are almost Texinfo source, but we use \ as the escape
5462 % character. It would be better to use @, but that's too big a change
5463 % to make right now.
5464 \def\indexbackslash{\ttbackslash}%
5465 \let\indexlbrace\{ % Likewise, set these sequences for braces
5466 \let\indexrbrace\} % used in the sort key.
5467 \begindoublecolumns
5468 \let\entryorphanpenalty=\indexorphanpenalty
5470 % Read input from the index file line by line.
5471 \loopdo
5472 \ifeof1
5473 \let\firsttoken\relax
5474 \else
5475 \read 1 to \nextline
5476 \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
5477 \act
5479 \thisline
5481 \ifeof1\else
5482 \let\thisline\nextline
5483 \repeat
5485 \enddoublecolumns
5488 \closein 1
5489 \endgroup}
5491 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
5492 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
5494 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
5495 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
5497 % These macros are used by the sorted index file itself.
5498 % Change them to control the appearance of the index.
5500 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5501 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5502 \catcode`\$=3
5503 \gdef\initialglyphs{%
5504 % Some changes for non-alphabetic characters. Using the glyphs from the
5505 % math fonts looks more consistent than the typewriter font used elsewhere
5506 % for these characters.
5507 \def\indexbackslash{\math{\backslash}}%
5508 \let\\=\indexbackslash
5510 % Can't get bold backslash so don't use bold forward slash
5511 \catcode`\/=13
5512 \def/{{\secrmnotbold \normalslash}}%
5513 \def-{{\normaldash\normaldash}}% en dash `--'
5514 \def^{{\chapbf \normalcaret}}%
5515 \def~{{\chapbf \normaltilde}}%
5516 \def\_{%
5517 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5518 \def|{$\vert$}%
5519 \def<{$\less$}%
5520 \def>{$\gtr$}%
5521 \def+{$\normalplus$}%
5524 \def\initial{%
5525 \bgroup
5526 \initialglyphs
5527 \initialx
5530 \def\initialx#1{%
5531 % Remove any glue we may have, we'll be inserting our own.
5532 \removelastskip
5534 % We like breaks before the index initials, so insert a bonus.
5535 % The glue before the bonus allows a little bit of space at the
5536 % bottom of a column to reduce an increase in inter-line spacing.
5537 \nobreak
5538 \vskip 0pt plus 5\baselineskip
5539 \penalty -300
5540 \vskip 0pt plus -5\baselineskip
5542 % Typeset the initial. Making this add up to a whole number of
5543 % baselineskips increases the chance of the dots lining up from column
5544 % to column. It still won't often be perfect, because of the stretch
5545 % we need before each entry, but it's better.
5547 % No shrink because it confuses \balancecolumns.
5548 \vskip 1.67\baselineskip plus 1\baselineskip
5549 \leftline{\secfonts \kern-0.05em \secbf #1}%
5550 % \secfonts is inside the argument of \leftline so that the change of
5551 % \baselineskip will not affect any glue inserted before the vbox that
5552 % \leftline creates.
5553 % Do our best not to break after the initial.
5554 \nobreak
5555 \vskip .33\baselineskip plus .1\baselineskip
5556 \egroup % \initialglyphs
5559 \newdimen\entryrightmargin
5560 \entryrightmargin=0pt
5562 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5563 % then page number (#2) flushed to the right margin. It is used for index
5564 % and table of contents entries. The paragraph is indented by \leftskip.
5566 \def\entry{%
5567 \begingroup
5569 % Start a new paragraph if necessary, so our assignments below can't
5570 % affect previous text.
5571 \par
5573 % No extra space above this paragraph.
5574 \parskip = 0in
5576 % When reading the text of entry, convert explicit line breaks
5577 % from @* into spaces. The user might give these in long section
5578 % titles, for instance.
5579 \def\*{\unskip\space\ignorespaces}%
5580 \def\entrybreak{\hfil\break}% An undocumented command
5582 % A bit of stretch before each entry for the benefit of balancing
5583 % columns.
5584 \vskip 0pt plus0.5pt
5586 % Swallow the left brace of the text (first parameter):
5587 \afterassignment\doentry
5588 \let\temp =
5590 \def\entrybreak{\unskip\space\ignorespaces}%
5591 \def\doentry{%
5592 % Save the text of the entry
5593 \global\setbox\boxA=\hbox\bgroup
5594 \bgroup % Instead of the swallowed brace.
5595 \noindent
5596 \aftergroup\finishentry
5597 % And now comes the text of the entry.
5598 % Not absorbing as a macro argument reduces the chance of problems
5599 % with catcodes occurring.
5601 {\catcode`\@=11
5602 \gdef\finishentry#1{%
5603 \egroup % end box A
5604 \dimen@ = \wd\boxA % Length of text of entry
5605 \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
5606 % #1 is the page number.
5608 % Get the width of the page numbers, and only use
5609 % leaders if they are present.
5610 \global\setbox\boxB = \hbox{#1}%
5611 \ifdim\wd\boxB = 0pt
5612 \null\nobreak\hfill\ %
5613 \else
5615 \null\nobreak\indexdotfill % Have leaders before the page number.
5617 \ifpdf
5618 \pdfgettoks#1.%
5619 \bgroup\let\domark\relax
5620 \hskip\skip\thinshrinkable\the\toksA
5621 \egroup
5622 % The redefinion of \domark stops marks being added in \pdflink to
5623 % preserve coloured links across page boundaries. Otherwise the marks
5624 % would get in the way of \lastbox in \insertindexentrybox.
5625 \else
5626 \ifx\XeTeXrevision\thisisundefined
5627 \hskip\skip\thinshrinkable #1%
5628 \else
5629 \pdfgettoks#1.%
5630 \bgroup\let\domark\relax
5631 \hskip\skip\thinshrinkable\the\toksA
5632 \egroup
5636 \egroup % end \boxA
5637 \ifdim\wd\boxB = 0pt
5638 \global\setbox\entryindexbox=\vbox{\unhbox\boxA}%
5639 \else
5640 \global\setbox\entryindexbox=\vbox\bgroup
5641 \prevdepth=\entrylinedepth
5642 \noindent
5643 % We want the text of the entries to be aligned to the left, and the
5644 % page numbers to be aligned to the right.
5646 \advance\leftskip by 0pt plus 1fil
5647 \advance\leftskip by 0pt plus -1fill
5648 \rightskip = 0pt plus -1fil
5649 \advance\rightskip by 0pt plus 1fill
5650 % Cause last line, which could consist of page numbers on their own
5651 % if the list of page numbers is long, to be aligned to the right.
5652 \parfillskip=0pt plus -1fill
5654 \hangindent=1em
5656 \advance\rightskip by \entryrightmargin
5657 % Determine how far we can stretch into the margin.
5658 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5659 % fit on one line in @letterpaper format.
5660 \ifdim\entryrightmargin>2.1em
5661 \dimen@i=2.1em
5662 \else
5663 \dimen@i=0em
5665 \advance \parfillskip by 0pt minus 1\dimen@i
5667 \dimen@ii = \hsize
5668 \advance\dimen@ii by -1\leftskip
5669 \advance\dimen@ii by -1\entryrightmargin
5670 \advance\dimen@ii by 1\dimen@i
5671 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5672 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5673 \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
5674 \dimen@ii = \hsize
5675 \advance \dimen@ii by -1em
5676 \ifnum\dimen@>\dimen@ii
5677 % If the entry is too long, use the whole line
5678 \dimen@ = \dimen@ii
5680 \advance\leftskip by 0pt plus 1fill % ragged right
5681 \advance \dimen@ by 1\rightskip
5682 \parshape = 2 0pt \dimen@ 1em \dimen@ii
5683 % Ideally we'd add a finite glue at the end of the first line only, but
5684 % TeX doesn't seem to provide a way to do such a thing.
5685 \fi\fi
5686 \unhbox\boxA
5688 % Do not prefer a separate line ending with a hyphen to fewer lines.
5689 \finalhyphendemerits = 0
5691 % Word spacing - no stretch
5692 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5694 \linepenalty=1000 % Discourage line breaks.
5695 \hyphenpenalty=5000 % Discourage hyphenation.
5697 \par % format the paragraph
5698 \egroup % The \vbox
5700 \endgroup
5701 % delay text of entry until after penalty
5702 \bgroup\aftergroup\insertindexentrybox
5703 \entryorphanpenalty
5706 \newskip\thinshrinkable
5707 \skip\thinshrinkable=.15em minus .15em
5709 \newbox\entryindexbox
5710 \def\insertindexentrybox{%
5711 \copy\entryindexbox
5712 % The following gets the depth of the last box. This is for even
5713 % line spacing when entries span several lines.
5714 \setbox\dummybox\vbox{%
5715 \unvbox\entryindexbox
5716 \nointerlineskip
5717 \lastbox
5718 \global\entrylinedepth=\prevdepth
5720 % Note that we couldn't simply \unvbox\entryindexbox followed by
5721 % \nointerlineskip\lastbox to remove the last box and then reinstate it,
5722 % because this resets how far the box has been \moveleft'ed to 0. \unvbox
5723 % doesn't affect \prevdepth either.
5725 \newdimen\entrylinedepth
5727 % Default is no penalty
5728 \let\entryorphanpenalty\egroup
5730 % Used from \printindex. \firsttoken should be the first token
5731 % after the \entry. If it's not another \entry, we are at the last
5732 % line of a group of index entries, so insert a penalty to discourage
5733 % orphaned index entries.
5734 \long\def\indexorphanpenalty{%
5735 \def\isentry{\entry}%
5736 \ifx\firsttoken\isentry
5737 \else
5738 \unskip\penalty 9000
5739 % The \unskip here stops breaking before the glue. It relies on the
5740 % \vskip above being there, otherwise there is an error
5741 % "You can't use `\unskip' in vertical mode". There has to be glue
5742 % in the current vertical list that hasn't been added to the
5743 % "current page". See Chapter 24 of the TeXbook. This contradicts
5744 % Section 8.3.7 in "TeX by Topic," though.
5746 \egroup % now comes the box added with \aftergroup
5749 % Like plain.tex's \dotfill, except uses up at least 1 em.
5750 % The filll stretch here overpowers both the fil and fill stretch to push
5751 % the page number to the right.
5752 \def\indexdotfill{\cleaders
5753 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5756 \def\primary #1{\line{#1\hfil}}
5758 \newskip\secondaryindent \secondaryindent=0.5cm
5759 \def\secondary#1#2{{%
5760 \parfillskip=0in
5761 \parskip=0in
5762 \hangindent=1in
5763 \hangafter=1
5764 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5765 \ifpdf
5766 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5767 \else
5768 \ifx\XeTeXrevision\thisisundefined
5770 \else
5771 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5774 \par
5777 % Define two-column mode, which we use to typeset indexes.
5778 % Adapted from the TeXbook, page 416, which is to say,
5779 % the manmac.tex format used to print the TeXbook itself.
5780 \catcode`\@=11 % private names
5782 \newbox\partialpage
5783 \newdimen\doublecolumnhsize
5784 \newdimen\doublecolumntopgap
5785 \doublecolumntopgap = 0pt
5787 % Use inside an output routine to save \topmark and \firstmark
5788 \def\savemarks{%
5789 \global\savedtopmark=\expandafter{\topmark }%
5790 \global\savedfirstmark=\expandafter{\firstmark }%
5792 \newtoks\savedtopmark
5793 \newtoks\savedfirstmark
5795 % Set \topmark and \firstmark for next time \output runs.
5796 % Can't be run from withinside \output (because any material
5797 % added while an output routine is active, including
5798 % penalties, is saved for after it finishes). The page so far
5799 % should be empty, otherwise what's on it will be thrown away.
5800 \def\restoremarks{%
5801 \mark{\the\savedtopmark}%
5802 \bgroup\output = {%
5803 \setbox\dummybox=\box\PAGE
5804 }abc\eject\egroup
5805 % "abc" because output routine doesn't fire for a completely empty page.
5806 \mark{\the\savedfirstmark}%
5809 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5810 % If not much space left on page, start a new page.
5811 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5813 % Grab any single-column material above us.
5814 \output = {%
5816 % Here is a possibility not foreseen in manmac: if we accumulate a
5817 % whole lot of material, we might end up calling this \output
5818 % routine twice in a row (see the doublecol-lose test, which is
5819 % essentially a couple of indexes with @setchapternewpage off). In
5820 % that case we just ship out what is in \partialpage with the normal
5821 % output routine. Generally, \partialpage will be empty when this
5822 % runs and this will be a no-op. See the indexspread.tex test case.
5823 \ifvoid\partialpage \else
5824 \onepageout{\pagecontents\partialpage}%
5827 \global\setbox\partialpage = \vbox{%
5828 % Unvbox the main output page.
5829 \unvbox\PAGE
5830 \kern-\topskip \kern\baselineskip
5832 \savemarks
5834 \eject % run that output routine to set \partialpage
5835 \restoremarks
5837 % We recover the two marks that the last output routine saved in order
5838 % to propagate the information in marks added around a chapter heading,
5839 % which could be otherwise be lost by the time the final page is output.
5842 % Use the double-column output routine for subsequent pages.
5843 \output = {\doublecolumnout}%
5845 % Change the page size parameters. We could do this once outside this
5846 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5847 % format, but then we repeat the same computation. Repeating a couple
5848 % of assignments once per index is clearly meaningless for the
5849 % execution time, so we may as well do it in one place.
5851 % First we halve the line length, less a little for the gutter between
5852 % the columns. We compute the gutter based on the line length, so it
5853 % changes automatically with the paper format. The magic constant
5854 % below is chosen so that the gutter has the same value (well, +-<1pt)
5855 % as it did when we hard-coded it.
5857 % We put the result in a separate register, \doublecolumhsize, so we
5858 % can restore it in \pagesofar, after \hsize itself has (potentially)
5859 % been clobbered.
5861 \doublecolumnhsize = \hsize
5862 \advance\doublecolumnhsize by -.04154\hsize
5863 \divide\doublecolumnhsize by 2
5864 \hsize = \doublecolumnhsize
5866 % Double the \vsize as well. (We don't need a separate register here,
5867 % since nobody clobbers \vsize.)
5868 \global\doublecolumntopgap = \topskip
5869 \global\advance\doublecolumntopgap by -1\baselineskip
5870 \advance\vsize by -1\doublecolumntopgap
5871 \vsize = 2\vsize
5872 \topskip=0pt
5873 \global\entrylinedepth=0pt\relax
5876 % The double-column output routine for all double-column pages except
5877 % the last, which is done by \balancecolumns.
5879 \def\doublecolumnout{%
5881 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5882 % Get the available space for the double columns -- the normal
5883 % (undoubled) page height minus any material left over from the
5884 % previous page.
5885 \dimen@ = \vsize
5886 \divide\dimen@ by 2
5887 \advance\dimen@ by -\ht\partialpage
5889 % box0 will be the left-hand column, box2 the right.
5890 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
5891 \onepageout\pagesofar
5892 \unvbox255
5893 \penalty\outputpenalty
5896 % Re-output the contents of the output page -- any previous material,
5897 % followed by the two boxes we just split, in box0 and box2.
5898 \def\pagesofar{%
5899 \unvbox\partialpage
5901 \hsize = \doublecolumnhsize
5902 \wd0=\hsize \wd2=\hsize
5903 \vbox{%
5904 \vskip\doublecolumntopgap
5905 \hbox to\txipagewidth{\box0\hfil\box2}}%
5909 % Finished with with double columns.
5910 \def\enddoublecolumns{%
5911 % The following penalty ensures that the page builder is exercised
5912 % _before_ we change the output routine. This is necessary in the
5913 % following situation:
5915 % The last section of the index consists only of a single entry.
5916 % Before this section, \pagetotal is less than \pagegoal, so no
5917 % break occurs before the last section starts. However, the last
5918 % section, consisting of \initial and the single \entry, does not
5919 % fit on the page and has to be broken off. Without the following
5920 % penalty the page builder will not be exercised until \eject
5921 % below, and by that time we'll already have changed the output
5922 % routine to the \balancecolumns version, so the next-to-last
5923 % double-column page will be processed with \balancecolumns, which
5924 % is wrong: The two columns will go to the main vertical list, with
5925 % the broken-off section in the recent contributions. As soon as
5926 % the output routine finishes, TeX starts reconsidering the page
5927 % break. The two columns and the broken-off section both fit on the
5928 % page, because the two columns now take up only half of the page
5929 % goal. When TeX sees \eject from below which follows the final
5930 % section, it invokes the new output routine that we've set after
5931 % \balancecolumns below; \onepageout will try to fit the two columns
5932 % and the final section into the vbox of \txipageheight (see
5933 % \pagebody), causing an overfull box.
5935 % Note that glue won't work here, because glue does not exercise the
5936 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5937 \penalty0
5939 \output = {%
5940 % Split the last of the double-column material.
5941 \savemarks
5942 \balancecolumns
5944 % Having called \balancecolumns once, we do not
5945 % want to call it again. Therefore, reset \output to its normal
5946 % definition right away.
5947 \global\output = {\onepageout{\pagecontents\PAGE}}%
5949 \eject
5950 \endgroup % started in \begindoublecolumns
5951 \restoremarks
5952 % Leave the double-column material on the current page, no automatic
5953 % page break.
5954 \box\balancedcolumns
5956 % \pagegoal was set to the doubled \vsize above, since we restarted
5957 % the current page. We're now back to normal single-column
5958 % typesetting, so reset \pagegoal to the normal \vsize (after the
5959 % \endgroup where \vsize got restored).
5960 \pagegoal = \vsize
5962 \newbox\balancedcolumns
5963 \setbox\balancedcolumns=\vbox{shouldnt see this}%
5965 % Only called for the last of the double column material. \doublecolumnout
5966 % does the others.
5967 \def\balancecolumns{%
5968 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
5969 \dimen@ = \ht0
5970 \advance\dimen@ by \topskip
5971 \advance\dimen@ by-\baselineskip
5972 \ifdim\dimen@<5\baselineskip
5973 % Don't split a short final column in two.
5974 \setbox2=\vbox{}%
5975 \else
5976 \divide\dimen@ by 2 % target to split to
5977 \dimen@ii = \dimen@
5978 \splittopskip = \topskip
5979 % Loop until left column is at least as high as the right column.
5981 \vbadness = 10000
5982 \loop
5983 \global\setbox3 = \copy0
5984 \global\setbox1 = \vsplit3 to \dimen@
5985 % Remove glue from bottom of columns to compare
5986 % apparent heights.
5987 \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}%
5988 \global\setbox3 = \vbox{\unvbox3\unpenalty\unskip}%
5989 \ifdim\ht1<\ht3
5990 \global\advance\dimen@ by 1pt
5991 \repeat
5993 % Now the left column is in box 1, and the right column in box 3.
5994 % Check whether the left column has come out higher than the page itself.
5995 % (Note that we have doubled \vsize for the double columns, so
5996 % the actual height of the page is 0.5\vsize).
5997 \ifdim2\ht1>\vsize
5998 % Just split the last of the double column material roughly in half.
5999 \setbox2=\box0
6000 \setbox0 = \vsplit2 to \dimen@ii
6001 \setbox0=\vbox to\dimen@ii{\unvbox0}%
6002 \setbox2=\vbox to\dimen@ii{\unvbox2}%
6003 \else
6004 % Compare the heights of the two columns.
6005 \ifdim4\ht1>5\ht3
6006 % Column heights are too different, so don't make their bottoms
6007 % flush with each other.
6008 \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
6009 \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
6010 \else
6011 % Make column bottoms flush with each other.
6012 \setbox0=\vbox to\dimen@{\unvbox1}%
6013 \setbox2=\vbox to\dimen@{\unvbox3}%
6018 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
6020 \catcode`\@ = \other
6023 \message{sectioning,}
6024 % Chapters, sections, etc.
6026 % Let's start with @part.
6027 \outer\parseargdef\part{\partzzz{#1}}
6028 \def\partzzz#1{%
6029 \chapoddpage
6030 \null
6031 \vskip.3\vsize % move it down on the page a bit
6032 \begingroup
6033 \noindent \titlefonts\rmisbold #1\par % the text
6034 \let\lastnode=\empty % no node to associate with
6035 \writetocentry{part}{#1}{}% but put it in the toc
6036 \headingsoff % no headline or footline on the part page
6037 % This outputs a mark at the end of the page that clears \thischapter
6038 % and \thissection, as is done in \startcontents.
6039 \let\pchapsepmacro\relax
6040 \chapmacro{}{Yomitfromtoc}{}%
6041 \chapoddpage
6042 \endgroup
6045 % \unnumberedno is an oxymoron. But we count the unnumbered
6046 % sections so that we can refer to them unambiguously in the pdf
6047 % outlines by their "section number". We avoid collisions with chapter
6048 % numbers by starting them at 10000. (If a document ever has 10000
6049 % chapters, we're in trouble anyway, I'm sure.)
6050 \newcount\unnumberedno \unnumberedno = 10000
6051 \newcount\chapno
6052 \newcount\secno \secno=0
6053 \newcount\subsecno \subsecno=0
6054 \newcount\subsubsecno \subsubsecno=0
6056 % This counter is funny since it counts through charcodes of letters A, B, ...
6057 \newcount\appendixno \appendixno = `\@
6059 % \def\appendixletter{\char\the\appendixno}
6060 % We do the following ugly conditional instead of the above simple
6061 % construct for the sake of pdftex, which needs the actual
6062 % letter in the expansion, not just typeset.
6064 \def\appendixletter{%
6065 \ifnum\appendixno=`A A%
6066 \else\ifnum\appendixno=`B B%
6067 \else\ifnum\appendixno=`C C%
6068 \else\ifnum\appendixno=`D D%
6069 \else\ifnum\appendixno=`E E%
6070 \else\ifnum\appendixno=`F F%
6071 \else\ifnum\appendixno=`G G%
6072 \else\ifnum\appendixno=`H H%
6073 \else\ifnum\appendixno=`I I%
6074 \else\ifnum\appendixno=`J J%
6075 \else\ifnum\appendixno=`K K%
6076 \else\ifnum\appendixno=`L L%
6077 \else\ifnum\appendixno=`M M%
6078 \else\ifnum\appendixno=`N N%
6079 \else\ifnum\appendixno=`O O%
6080 \else\ifnum\appendixno=`P P%
6081 \else\ifnum\appendixno=`Q Q%
6082 \else\ifnum\appendixno=`R R%
6083 \else\ifnum\appendixno=`S S%
6084 \else\ifnum\appendixno=`T T%
6085 \else\ifnum\appendixno=`U U%
6086 \else\ifnum\appendixno=`V V%
6087 \else\ifnum\appendixno=`W W%
6088 \else\ifnum\appendixno=`X X%
6089 \else\ifnum\appendixno=`Y Y%
6090 \else\ifnum\appendixno=`Z Z%
6091 % The \the is necessary, despite appearances, because \appendixletter is
6092 % expanded while writing the .toc file. \char\appendixno is not
6093 % expandable, thus it is written literally, thus all appendixes come out
6094 % with the same letter (or @) in the toc without it.
6095 \else\char\the\appendixno
6096 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6097 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6099 % Each @chapter defines these (using marks) as the number+name, number
6100 % and name of the chapter. Page headings and footings can use
6101 % these. @section does likewise.
6102 \def\thischapter{}
6103 \def\thischapternum{}
6104 \def\thischaptername{}
6105 \def\thissection{}
6106 \def\thissectionnum{}
6107 \def\thissectionname{}
6109 \newcount\absseclevel % used to calculate proper heading level
6110 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6112 % @raisesections: treat @section as chapter, @subsection as section, etc.
6113 \def\raisesections{\global\advance\secbase by -1}
6114 \let\up=\raisesections % original BFox name
6116 % @lowersections: treat @chapter as section, @section as subsection, etc.
6117 \def\lowersections{\global\advance\secbase by 1}
6118 \let\down=\lowersections % original BFox name
6120 % we only have subsub.
6121 \chardef\maxseclevel = 3
6123 % A numbered section within an unnumbered changes to unnumbered too.
6124 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
6125 \chardef\unnlevel = \maxseclevel
6127 % Trace whether the current chapter is an appendix or not:
6128 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6129 \def\chapheadtype{N}
6131 % Choose a heading macro
6132 % #1 is heading type
6133 % #2 is heading level
6134 % #3 is text for heading
6135 \def\genhead#1#2#3{%
6136 % Compute the abs. sec. level:
6137 \absseclevel=#2
6138 \advance\absseclevel by \secbase
6139 % Make sure \absseclevel doesn't fall outside the range:
6140 \ifnum \absseclevel < 0
6141 \absseclevel = 0
6142 \else
6143 \ifnum \absseclevel > 3
6144 \absseclevel = 3
6147 % The heading type:
6148 \def\headtype{#1}%
6149 \if \headtype U%
6150 \ifnum \absseclevel < \unnlevel
6151 \chardef\unnlevel = \absseclevel
6153 \else
6154 % Check for appendix sections:
6155 \ifnum \absseclevel = 0
6156 \edef\chapheadtype{\headtype}%
6157 \else
6158 \if \headtype A\if \chapheadtype N%
6159 \errmessage{@appendix... within a non-appendix chapter}%
6160 \fi\fi
6162 % Check for numbered within unnumbered:
6163 \ifnum \absseclevel > \unnlevel
6164 \def\headtype{U}%
6165 \else
6166 \chardef\unnlevel = 3
6169 % Now print the heading:
6170 \if \headtype U%
6171 \ifcase\absseclevel
6172 \unnumberedzzz{#3}%
6173 \or \unnumberedseczzz{#3}%
6174 \or \unnumberedsubseczzz{#3}%
6175 \or \unnumberedsubsubseczzz{#3}%
6177 \else
6178 \if \headtype A%
6179 \ifcase\absseclevel
6180 \appendixzzz{#3}%
6181 \or \appendixsectionzzz{#3}%
6182 \or \appendixsubseczzz{#3}%
6183 \or \appendixsubsubseczzz{#3}%
6185 \else
6186 \ifcase\absseclevel
6187 \chapterzzz{#3}%
6188 \or \seczzz{#3}%
6189 \or \numberedsubseczzz{#3}%
6190 \or \numberedsubsubseczzz{#3}%
6194 \suppressfirstparagraphindent
6197 % an interface:
6198 \def\numhead{\genhead N}
6199 \def\apphead{\genhead A}
6200 \def\unnmhead{\genhead U}
6202 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6203 % all lower-level sectioning counters to zero.
6205 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
6206 % (e.g., figures), q.v. By default (before any chapter), that is empty.
6207 \let\chaplevelprefix = \empty
6209 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6210 \def\chapterzzz#1{%
6211 % section resetting is \global in case the chapter is in a group, such
6212 % as an @include file.
6213 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6214 \global\advance\chapno by 1
6216 % Used for \float.
6217 \gdef\chaplevelprefix{\the\chapno.}%
6218 \resetallfloatnos
6220 % \putwordChapter can contain complex things in translations.
6221 \toks0=\expandafter{\putwordChapter}%
6222 \message{\the\toks0 \space \the\chapno}%
6224 % Write the actual heading.
6225 \chapmacro{#1}{Ynumbered}{\the\chapno}%
6227 % So @section and the like are numbered underneath this chapter.
6228 \global\let\section = \numberedsec
6229 \global\let\subsection = \numberedsubsec
6230 \global\let\subsubsection = \numberedsubsubsec
6233 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6235 \def\appendixzzz#1{%
6236 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6237 \global\advance\appendixno by 1
6238 \gdef\chaplevelprefix{\appendixletter.}%
6239 \resetallfloatnos
6241 % \putwordAppendix can contain complex things in translations.
6242 \toks0=\expandafter{\putwordAppendix}%
6243 \message{\the\toks0 \space \appendixletter}%
6245 \chapmacro{#1}{Yappendix}{\appendixletter}%
6247 \global\let\section = \appendixsec
6248 \global\let\subsection = \appendixsubsec
6249 \global\let\subsubsection = \appendixsubsubsec
6252 % normally unnmhead0 calls unnumberedzzz:
6253 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
6254 \def\unnumberedzzz#1{%
6255 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6256 \global\advance\unnumberedno by 1
6258 % Since an unnumbered has no number, no prefix for figures.
6259 \global\let\chaplevelprefix = \empty
6260 \resetallfloatnos
6262 % This used to be simply \message{#1}, but TeX fully expands the
6263 % argument to \message. Therefore, if #1 contained @-commands, TeX
6264 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6265 % expanded @cite (which turns out to cause errors because \cite is meant
6266 % to be executed, not expanded).
6268 % Anyway, we don't want the fully-expanded definition of @cite to appear
6269 % as a result of the \message, we just want `@cite' itself. We use
6270 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6271 % simply yielding the contents of <toks register>. (We also do this for
6272 % the toc entries.)
6273 \toks0 = {#1}%
6274 \message{(\the\toks0)}%
6276 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6278 \global\let\section = \unnumberedsec
6279 \global\let\subsection = \unnumberedsubsec
6280 \global\let\subsubsection = \unnumberedsubsubsec
6283 % @centerchap is like @unnumbered, but the heading is centered.
6284 \outer\parseargdef\centerchap{%
6285 \let\centerparametersmaybe = \centerparameters
6286 \unnmhead0{#1}%
6287 \let\centerparametersmaybe = \relax
6290 % @top is like @unnumbered.
6291 \let\top\unnumbered
6293 % Sections.
6295 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6296 \def\seczzz#1{%
6297 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6298 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6301 % normally calls appendixsectionzzz:
6302 \outer\parseargdef\appendixsection{\apphead1{#1}}
6303 \def\appendixsectionzzz#1{%
6304 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6305 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6307 \let\appendixsec\appendixsection
6309 % normally calls unnumberedseczzz:
6310 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6311 \def\unnumberedseczzz#1{%
6312 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6313 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6316 % Subsections.
6318 % normally calls numberedsubseczzz:
6319 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6320 \def\numberedsubseczzz#1{%
6321 \global\subsubsecno=0 \global\advance\subsecno by 1
6322 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6325 % normally calls appendixsubseczzz:
6326 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6327 \def\appendixsubseczzz#1{%
6328 \global\subsubsecno=0 \global\advance\subsecno by 1
6329 \sectionheading{#1}{subsec}{Yappendix}%
6330 {\appendixletter.\the\secno.\the\subsecno}%
6333 % normally calls unnumberedsubseczzz:
6334 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6335 \def\unnumberedsubseczzz#1{%
6336 \global\subsubsecno=0 \global\advance\subsecno by 1
6337 \sectionheading{#1}{subsec}{Ynothing}%
6338 {\the\unnumberedno.\the\secno.\the\subsecno}%
6341 % Subsubsections.
6343 % normally numberedsubsubseczzz:
6344 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6345 \def\numberedsubsubseczzz#1{%
6346 \global\advance\subsubsecno by 1
6347 \sectionheading{#1}{subsubsec}{Ynumbered}%
6348 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6351 % normally appendixsubsubseczzz:
6352 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6353 \def\appendixsubsubseczzz#1{%
6354 \global\advance\subsubsecno by 1
6355 \sectionheading{#1}{subsubsec}{Yappendix}%
6356 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6359 % normally unnumberedsubsubseczzz:
6360 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6361 \def\unnumberedsubsubseczzz#1{%
6362 \global\advance\subsubsecno by 1
6363 \sectionheading{#1}{subsubsec}{Ynothing}%
6364 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6367 % These macros control what the section commands do, according
6368 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6369 % Define them by default for a numbered chapter.
6370 \let\section = \numberedsec
6371 \let\subsection = \numberedsubsec
6372 \let\subsubsection = \numberedsubsubsec
6374 % Define @majorheading, @heading and @subheading
6376 \def\majorheading{%
6377 {\advance\chapheadingskip by 10pt \chapbreak }%
6378 \parsearg\chapheadingzzz
6381 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6382 \def\chapheadingzzz#1{%
6383 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6384 \nobreak\bigskip \nobreak
6385 \suppressfirstparagraphindent
6388 % @heading, @subheading, @subsubheading.
6389 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6390 \suppressfirstparagraphindent}
6391 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6392 \suppressfirstparagraphindent}
6393 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6394 \suppressfirstparagraphindent}
6396 % These macros generate a chapter, section, etc. heading only
6397 % (including whitespace, linebreaking, etc. around it),
6398 % given all the information in convenient, parsed form.
6400 % Args are the skip and penalty (usually negative)
6401 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6403 % Parameter controlling skip before chapter headings (if needed)
6404 \newskip\chapheadingskip
6406 % Define plain chapter starts, and page on/off switching for it.
6407 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6409 % Start a new page
6410 \def\chappager{\par\vfill\supereject}
6412 % \chapoddpage - start on an odd page for a new chapter
6413 % Because \domark is called before \chapoddpage, the filler page will
6414 % get the headings for the next chapter, which is wrong. But we don't
6415 % care -- we just disable all headings on the filler page.
6416 \def\chapoddpage{%
6417 \chappager
6418 \ifodd\pageno \else
6419 \begingroup
6420 \headingsoff
6421 \null
6422 \chappager
6423 \endgroup
6427 \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
6429 \def\CHAPPAGoff{%
6430 \global\let\contentsalignmacro = \chappager
6431 \global\let\pchapsepmacro=\chapbreak
6432 \global\let\pagealignmacro=\chappager}
6434 \def\CHAPPAGon{%
6435 \global\let\contentsalignmacro = \chappager
6436 \global\let\pchapsepmacro=\chappager
6437 \global\let\pagealignmacro=\chappager
6438 \global\def\HEADINGSon{\HEADINGSsingle}}
6440 \def\CHAPPAGodd{%
6441 \global\let\contentsalignmacro = \chapoddpage
6442 \global\let\pchapsepmacro=\chapoddpage
6443 \global\let\pagealignmacro=\chapoddpage
6444 \global\def\HEADINGSon{\HEADINGSdouble}}
6446 \CHAPPAGon
6448 % \chapmacro - Chapter opening.
6450 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6451 % Yappendix, Yomitfromtoc), #3 the chapter number.
6452 % Not used for @heading series.
6454 % To test against our argument.
6455 \def\Ynothingkeyword{Ynothing}
6456 \def\Yappendixkeyword{Yappendix}
6457 \def\Yomitfromtockeyword{Yomitfromtoc}
6459 \def\chapmacro#1#2#3{%
6460 \expandafter\ifx\thisenv\titlepage\else
6461 \checkenv{}% chapters, etc., should not start inside an environment.
6463 % FIXME: \chapmacro is currently called from inside \titlepage when
6464 % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
6465 % this should probably be done by \sectionheading with an option to print
6466 % in chapter size.
6468 % Insert the first mark before the heading break (see notes for \domark).
6469 \let\prevchapterdefs=\lastchapterdefs
6470 \let\prevsectiondefs=\lastsectiondefs
6471 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6472 \gdef\thissection{}}%
6474 \def\temptype{#2}%
6475 \ifx\temptype\Ynothingkeyword
6476 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6477 \gdef\thischapter{\thischaptername}}%
6478 \else\ifx\temptype\Yomitfromtockeyword
6479 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6480 \gdef\thischapter{}}%
6481 \else\ifx\temptype\Yappendixkeyword
6482 \toks0={#1}%
6483 \xdef\lastchapterdefs{%
6484 \gdef\noexpand\thischaptername{\the\toks0}%
6485 \gdef\noexpand\thischapternum{\appendixletter}%
6486 % \noexpand\putwordAppendix avoids expanding indigestible
6487 % commands in some of the translations.
6488 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6489 \noexpand\thischapternum:
6490 \noexpand\thischaptername}%
6492 \else
6493 \toks0={#1}%
6494 \xdef\lastchapterdefs{%
6495 \gdef\noexpand\thischaptername{\the\toks0}%
6496 \gdef\noexpand\thischapternum{\the\chapno}%
6497 % \noexpand\putwordChapter avoids expanding indigestible
6498 % commands in some of the translations.
6499 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6500 \noexpand\thischapternum:
6501 \noexpand\thischaptername}%
6503 \fi\fi\fi
6505 % Output the mark. Pass it through \safewhatsit, to take care of
6506 % the preceding space.
6507 \safewhatsit\domark
6509 % Insert the chapter heading break.
6510 \pchapsepmacro
6512 % Now the second mark, after the heading break. No break points
6513 % between here and the heading.
6514 \let\prevchapterdefs=\lastchapterdefs
6515 \let\prevsectiondefs=\lastsectiondefs
6516 \domark
6519 \chapfonts \rmisbold
6520 \let\footnote=\errfootnoteheading % give better error message
6522 % Have to define \lastsection before calling \donoderef, because the
6523 % xref code eventually uses it. On the other hand, it has to be called
6524 % after \pchapsepmacro, or the headline will change too soon.
6525 \gdef\lastsection{#1}%
6527 % Only insert the separating space if we have a chapter/appendix
6528 % number, and don't print the unnumbered ``number''.
6529 \ifx\temptype\Ynothingkeyword
6530 \setbox0 = \hbox{}%
6531 \def\toctype{unnchap}%
6532 \else\ifx\temptype\Yomitfromtockeyword
6533 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6534 \def\toctype{omit}%
6535 \else\ifx\temptype\Yappendixkeyword
6536 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6537 \def\toctype{app}%
6538 \else
6539 \setbox0 = \hbox{#3\enspace}%
6540 \def\toctype{numchap}%
6541 \fi\fi\fi
6543 % Write the toc entry for this chapter. Must come before the
6544 % \donoderef, because we include the current node name in the toc
6545 % entry, and \donoderef resets it to empty.
6546 \writetocentry{\toctype}{#1}{#3}%
6548 % For pdftex, we have to write out the node definition (aka, make
6549 % the pdfdest) after any page break, but before the actual text has
6550 % been typeset. If the destination for the pdf outline is after the
6551 % text, then jumping from the outline may wind up with the text not
6552 % being visible, for instance under high magnification.
6553 \donoderef{#2}%
6555 % Typeset the actual heading.
6556 \nobreak % Avoid page breaks at the interline glue.
6557 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6558 \unhbox0 #1\par}%
6560 \nobreak\bigskip % no page break after a chapter title
6561 \nobreak
6564 % @centerchap -- centered and unnumbered.
6565 \let\centerparametersmaybe = \relax
6566 \def\centerparameters{%
6567 \advance\rightskip by 3\rightskip
6568 \leftskip = \rightskip
6569 \parfillskip = 0pt
6573 % Section titles. These macros combine the section number parts and
6574 % call the generic \sectionheading to do the printing.
6576 \newskip\secheadingskip
6577 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6579 % Subsection titles.
6580 \newskip\subsecheadingskip
6581 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6583 % Subsubsection titles.
6584 \def\subsubsecheadingskip{\subsecheadingskip}
6585 \def\subsubsecheadingbreak{\subsecheadingbreak}
6588 % Print any size, any type, section title.
6590 % #1 is the text of the title,
6591 % #2 is the section level (sec/subsec/subsubsec),
6592 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6593 % #4 is the section number.
6595 \def\seckeyword{sec}
6597 \def\sectionheading#1#2#3#4{%
6599 \def\sectionlevel{#2}%
6600 \def\temptype{#3}%
6602 % It is ok for the @heading series commands to appear inside an
6603 % environment (it's been historically allowed, though the logic is
6604 % dubious), but not the others.
6605 \ifx\temptype\Yomitfromtockeyword\else
6606 \checkenv{}% non-@*heading should not be in an environment.
6608 \let\footnote=\errfootnoteheading
6610 % Switch to the right set of fonts.
6611 \csname #2fonts\endcsname \rmisbold
6613 % Insert first mark before the heading break (see notes for \domark).
6614 \let\prevsectiondefs=\lastsectiondefs
6615 \ifx\temptype\Ynothingkeyword
6616 \ifx\sectionlevel\seckeyword
6617 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6618 \gdef\thissection{\thissectionname}}%
6620 \else\ifx\temptype\Yomitfromtockeyword
6621 % Don't redefine \thissection.
6622 \else\ifx\temptype\Yappendixkeyword
6623 \ifx\sectionlevel\seckeyword
6624 \toks0={#1}%
6625 \xdef\lastsectiondefs{%
6626 \gdef\noexpand\thissectionname{\the\toks0}%
6627 \gdef\noexpand\thissectionnum{#4}%
6628 % \noexpand\putwordSection avoids expanding indigestible
6629 % commands in some of the translations.
6630 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6631 \noexpand\thissectionnum:
6632 \noexpand\thissectionname}%
6635 \else
6636 \ifx\sectionlevel\seckeyword
6637 \toks0={#1}%
6638 \xdef\lastsectiondefs{%
6639 \gdef\noexpand\thissectionname{\the\toks0}%
6640 \gdef\noexpand\thissectionnum{#4}%
6641 % \noexpand\putwordSection avoids expanding indigestible
6642 % commands in some of the translations.
6643 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6644 \noexpand\thissectionnum:
6645 \noexpand\thissectionname}%
6648 \fi\fi\fi
6650 % Go into vertical mode. Usually we'll already be there, but we
6651 % don't want the following whatsit to end up in a preceding paragraph
6652 % if the document didn't happen to have a blank line.
6653 \par
6655 % Output the mark. Pass it through \safewhatsit, to take care of
6656 % the preceding space.
6657 \safewhatsit\domark
6659 % Insert space above the heading.
6660 \csname #2headingbreak\endcsname
6662 % Now the second mark, after the heading break. No break points
6663 % between here and the heading.
6664 \global\let\prevsectiondefs=\lastsectiondefs
6665 \domark
6667 % Only insert the space after the number if we have a section number.
6668 \ifx\temptype\Ynothingkeyword
6669 \setbox0 = \hbox{}%
6670 \def\toctype{unn}%
6671 \gdef\lastsection{#1}%
6672 \else\ifx\temptype\Yomitfromtockeyword
6673 % for @headings -- no section number, don't include in toc,
6674 % and don't redefine \lastsection.
6675 \setbox0 = \hbox{}%
6676 \def\toctype{omit}%
6677 \let\sectionlevel=\empty
6678 \else\ifx\temptype\Yappendixkeyword
6679 \setbox0 = \hbox{#4\enspace}%
6680 \def\toctype{app}%
6681 \gdef\lastsection{#1}%
6682 \else
6683 \setbox0 = \hbox{#4\enspace}%
6684 \def\toctype{num}%
6685 \gdef\lastsection{#1}%
6686 \fi\fi\fi
6688 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6689 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6691 % Write the node reference (= pdf destination for pdftex).
6692 % Again, see comments in \chapmacro.
6693 \donoderef{#3}%
6695 % Interline glue will be inserted when the vbox is completed.
6696 % That glue will be a valid breakpoint for the page, since it'll be
6697 % preceded by a whatsit (usually from the \donoderef, or from the
6698 % \writetocentry if there was no node). We don't want to allow that
6699 % break, since then the whatsits could end up on page n while the
6700 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6701 \nobreak
6703 % Output the actual section heading.
6704 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6705 \hangindent=\wd0 % zero if no section number
6706 \unhbox0 #1}%
6708 % Add extra space after the heading -- half of whatever came above it.
6709 % Don't allow stretch, though.
6710 \kern .5 \csname #2headingskip\endcsname
6712 % Do not let the kern be a potential breakpoint, as it would be if it
6713 % was followed by glue.
6714 \nobreak
6716 % We'll almost certainly start a paragraph next, so don't let that
6717 % glue accumulate. (Not a breakpoint because it's preceded by a
6718 % discardable item.) However, when a paragraph is not started next
6719 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6720 % or the negative glue will cause weirdly wrong output, typically
6721 % obscuring the section heading with something else.
6722 \vskip-\parskip
6724 % This is so the last item on the main vertical list is a known
6725 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6726 % and do the needful.
6727 \penalty 10001
6731 \message{toc,}
6732 % Table of contents.
6733 \newwrite\tocfile
6735 % Write an entry to the toc file, opening it if necessary.
6736 % Called from @chapter, etc.
6738 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6739 % We append the current node name (if any) and page number as additional
6740 % arguments for the \{chap,sec,...}entry macros which will eventually
6741 % read this. The node name is used in the pdf outlines as the
6742 % destination to jump to.
6744 % We open the .toc file for writing here instead of at @setfilename (or
6745 % any other fixed time) so that @contents can be anywhere in the document.
6746 % But if #1 is `omit', then we don't do anything. This is used for the
6747 % table of contents chapter openings themselves.
6749 \newif\iftocfileopened
6750 \def\omitkeyword{omit}%
6752 \def\writetocentry#1#2#3{%
6753 \edef\writetoctype{#1}%
6754 \ifx\writetoctype\omitkeyword \else
6755 \iftocfileopened\else
6756 \immediate\openout\tocfile = \jobname.toc
6757 \global\tocfileopenedtrue
6760 \iflinks
6761 {\atdummies
6762 \edef\temp{%
6763 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6764 \temp
6769 % Tell \shipout to create a pdf destination on each page, if we're
6770 % writing pdf. These are used in the table of contents. We can't
6771 % just write one on every page because the title pages are numbered
6772 % 1 and 2 (the page numbers aren't printed), and so are the first
6773 % two pages of the document. Thus, we'd have two destinations named
6774 % `1', and two named `2'.
6775 \ifpdf
6776 \global\pdfmakepagedesttrue
6777 \else
6778 \ifx\XeTeXrevision\thisisundefined
6779 \else
6780 \global\pdfmakepagedesttrue
6786 % These characters do not print properly in the Computer Modern roman
6787 % fonts, so we must take special care. This is more or less redundant
6788 % with the Texinfo input format setup at the end of this file.
6790 \def\activecatcodes{%
6791 \catcode`\"=\active
6792 \catcode`\$=\active
6793 \catcode`\<=\active
6794 \catcode`\>=\active
6795 \catcode`\\=\active
6796 \catcode`\^=\active
6797 \catcode`\_=\active
6798 \catcode`\|=\active
6799 \catcode`\~=\active
6803 % Read the toc file, which is essentially Texinfo input.
6804 \def\readtocfile{%
6805 \setupdatafile
6806 \activecatcodes
6807 \input \tocreadfilename
6810 \newskip\contentsrightmargin \contentsrightmargin=1in
6811 \newcount\savepageno
6812 \newcount\lastnegativepageno \lastnegativepageno = -1
6814 % Prepare to read what we've written to \tocfile.
6816 \def\startcontents#1{%
6817 % If @setchapternewpage on, and @headings double, the contents should
6818 % start on an odd page, unlike chapters. Thus, we maintain
6819 % \contentsalignmacro in parallel with \pagealignmacro.
6820 % From: Torbjorn Granlund <tege@matematik.su.se>
6821 \contentsalignmacro
6822 \immediate\closeout\tocfile
6824 % Don't need to put `Contents' or `Short Contents' in the headline.
6825 % It is abundantly clear what they are.
6826 \chapmacro{#1}{Yomitfromtoc}{}%
6828 \savepageno = \pageno
6829 \begingroup % Set up to handle contents files properly.
6830 \raggedbottom % Worry more about breakpoints than the bottom.
6831 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6833 % Roman numerals for page numbers.
6834 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6837 % redefined for the two-volume lispref. We always output on
6838 % \jobname.toc even if this is redefined.
6840 \def\tocreadfilename{\jobname.toc}
6842 % Normal (long) toc.
6844 \def\contents{%
6845 \startcontents{\putwordTOC}%
6846 \openin 1 \tocreadfilename\space
6847 \ifeof 1 \else
6848 \readtocfile
6850 \vfill \eject
6851 \contentsalignmacro % in case @setchapternewpage odd is in effect
6852 \ifeof 1 \else
6853 \pdfmakeoutlines
6855 \closein 1
6856 \endgroup
6857 \lastnegativepageno = \pageno
6858 \global\pageno = \savepageno
6861 % And just the chapters.
6862 \def\summarycontents{%
6863 \startcontents{\putwordShortTOC}%
6865 \let\partentry = \shortpartentry
6866 \let\numchapentry = \shortchapentry
6867 \let\appentry = \shortchapentry
6868 \let\unnchapentry = \shortunnchapentry
6869 % We want a true roman here for the page numbers.
6870 \secfonts
6871 \let\rm=\shortcontrm \let\bf=\shortcontbf
6872 \let\sl=\shortcontsl \let\tt=\shortconttt
6874 \hyphenpenalty = 10000
6875 \advance\baselineskip by 1pt % Open it up a little.
6876 \def\numsecentry##1##2##3##4{}
6877 \let\appsecentry = \numsecentry
6878 \let\unnsecentry = \numsecentry
6879 \let\numsubsecentry = \numsecentry
6880 \let\appsubsecentry = \numsecentry
6881 \let\unnsubsecentry = \numsecentry
6882 \let\numsubsubsecentry = \numsecentry
6883 \let\appsubsubsecentry = \numsecentry
6884 \let\unnsubsubsecentry = \numsecentry
6885 \openin 1 \tocreadfilename\space
6886 \ifeof 1 \else
6887 \readtocfile
6889 \closein 1
6890 \vfill \eject
6891 \contentsalignmacro % in case @setchapternewpage odd is in effect
6892 \endgroup
6893 \lastnegativepageno = \pageno
6894 \global\pageno = \savepageno
6896 \let\shortcontents = \summarycontents
6898 % Typeset the label for a chapter or appendix for the short contents.
6899 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6901 \def\shortchaplabel#1{%
6902 % This space should be enough, since a single number is .5em, and the
6903 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6904 % But use \hss just in case.
6905 % (This space doesn't include the extra space that gets added after
6906 % the label; that gets put in by \shortchapentry above.)
6908 % We'd like to right-justify chapter numbers, but that looks strange
6909 % with appendix letters. And right-justifying numbers and
6910 % left-justifying letters looks strange when there is less than 10
6911 % chapters. Have to read the whole toc once to know how many chapters
6912 % there are before deciding ...
6913 \hbox to 1em{#1\hss}%
6916 % These macros generate individual entries in the table of contents.
6917 % The first argument is the chapter or section name.
6918 % The last argument is the page number.
6919 % The arguments in between are the chapter number, section number, ...
6921 % Parts, in the main contents. Replace the part number, which doesn't
6922 % exist, with an empty box. Let's hope all the numbers have the same width.
6923 % Also ignore the page number, which is conventionally not printed.
6924 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6925 \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6927 % Parts, in the short toc.
6928 \def\shortpartentry#1#2#3#4{%
6929 \penalty-300
6930 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6931 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6934 % Chapters, in the main contents.
6935 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6937 % Chapters, in the short toc.
6938 % See comments in \dochapentry re vbox and related settings.
6939 \def\shortchapentry#1#2#3#4{%
6940 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6943 % Appendices, in the main contents.
6944 % Need the word Appendix, and a fixed-size box.
6946 \def\appendixbox#1{%
6947 % We use M since it's probably the widest letter.
6948 \setbox0 = \hbox{\putwordAppendix{} M}%
6949 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6951 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6953 % Unnumbered chapters.
6954 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6955 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6957 % Sections.
6958 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6959 \let\appsecentry=\numsecentry
6960 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6962 % Subsections.
6963 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6964 \let\appsubsecentry=\numsubsecentry
6965 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6967 % And subsubsections.
6968 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6969 \let\appsubsubsecentry=\numsubsubsecentry
6970 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6972 % This parameter controls the indentation of the various levels.
6973 % Same as \defaultparindent.
6974 \newdimen\tocindent \tocindent = 15pt
6976 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6977 % page number.
6979 % If the toc has to be broken over pages, we want it to be at chapters
6980 % if at all possible; hence the \penalty.
6981 \def\dochapentry#1#2{%
6982 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6983 \begingroup
6984 % Move the page numbers slightly to the right
6985 \advance\entryrightmargin by -0.05em
6986 \chapentryfonts
6987 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6988 \endgroup
6989 \nobreak\vskip .25\baselineskip plus.1\baselineskip
6992 \def\dosecentry#1#2{\begingroup
6993 \secentryfonts \leftskip=\tocindent
6994 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6995 \endgroup}
6997 \def\dosubsecentry#1#2{\begingroup
6998 \subsecentryfonts \leftskip=2\tocindent
6999 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7000 \endgroup}
7002 \def\dosubsubsecentry#1#2{\begingroup
7003 \subsubsecentryfonts \leftskip=3\tocindent
7004 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7005 \endgroup}
7007 % We use the same \entry macro as for the index entries.
7008 \let\tocentry = \entry
7010 % Space between chapter (or whatever) number and the title.
7011 \def\labelspace{\hskip1em \relax}
7013 \def\dopageno#1{{\rm #1}}
7014 \def\doshortpageno#1{{\rm #1}}
7016 \def\chapentryfonts{\secfonts \rm}
7017 \def\secentryfonts{\textfonts}
7018 \def\subsecentryfonts{\textfonts}
7019 \def\subsubsecentryfonts{\textfonts}
7022 \message{environments,}
7023 % @foo ... @end foo.
7025 % @tex ... @end tex escapes into raw TeX temporarily.
7026 % One exception: @ is still an escape character, so that @end tex works.
7027 % But \@ or @@ will get a plain @ character.
7029 \envdef\tex{%
7030 \setupmarkupstyle{tex}%
7031 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
7032 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
7033 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
7034 \catcode `\%=14
7035 \catcode `\+=\other
7036 \catcode `\"=\other
7037 \catcode `\|=\other
7038 \catcode `\<=\other
7039 \catcode `\>=\other
7040 \catcode `\`=\other
7041 \catcode `\'=\other
7043 % ' is active in math mode (mathcode"8000). So reset it, and all our
7044 % other math active characters (just in case), to plain's definitions.
7045 \mathactive
7047 % Inverse of the list at the beginning of the file.
7048 \let\b=\ptexb
7049 \let\bullet=\ptexbullet
7050 \let\c=\ptexc
7051 \let\,=\ptexcomma
7052 \let\.=\ptexdot
7053 \let\dots=\ptexdots
7054 \let\equiv=\ptexequiv
7055 \let\!=\ptexexclam
7056 \let\i=\ptexi
7057 \let\indent=\ptexindent
7058 \let\noindent=\ptexnoindent
7059 \let\{=\ptexlbrace
7060 \let\+=\tabalign
7061 \let\}=\ptexrbrace
7062 \let\/=\ptexslash
7063 \let\sp=\ptexsp
7064 \let\*=\ptexstar
7065 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7066 \let\t=\ptext
7067 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7068 \let\frenchspacing=\plainfrenchspacing
7070 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7071 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7072 \def\@{@}%
7074 % There is no need to define \Etex.
7076 % Define @lisp ... @end lisp.
7077 % @lisp environment forms a group so it can rebind things,
7078 % including the definition of @end lisp (which normally is erroneous).
7080 % Amount to narrow the margins by for @lisp.
7081 \newskip\lispnarrowing \lispnarrowing=0.4in
7083 % This is the definition that ^^M gets inside @lisp, @example, and other
7084 % such environments. \null is better than a space, since it doesn't
7085 % have any width.
7086 \def\lisppar{\null\endgraf}
7088 % This space is always present above and below environments.
7089 \newskip\envskipamount \envskipamount = 0pt
7091 % Make spacing and below environment symmetrical. We use \parskip here
7092 % to help in doing that, since in @example-like environments \parskip
7093 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7094 % start of the next paragraph will insert \parskip.
7096 \def\aboveenvbreak{{%
7097 % =10000 instead of <10000 because of a special case in \itemzzz and
7098 % \sectionheading, q.v.
7099 \ifnum \lastpenalty=10000 \else
7100 \advance\envskipamount by \parskip
7101 \endgraf
7102 \ifdim\lastskip<\envskipamount
7103 \removelastskip
7104 \ifnum\lastpenalty<10000
7105 % Penalize breaking before the environment, because preceding text
7106 % often leads into it.
7107 \penalty100
7109 \vskip\envskipamount
7114 \def\afterenvbreak{{%
7115 % =10000 instead of <10000 because of a special case in \itemzzz and
7116 % \sectionheading, q.v.
7117 \ifnum \lastpenalty=10000 \else
7118 \advance\envskipamount by \parskip
7119 \endgraf
7120 \ifdim\lastskip<\envskipamount
7121 \removelastskip
7122 % it's not a good place to break if the last penalty was \nobreak
7123 % or better ...
7124 \ifnum\lastpenalty<10000 \penalty-50 \fi
7125 \vskip\envskipamount
7130 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7131 % also clear it, so that its embedded environments do the narrowing again.
7132 \let\nonarrowing=\relax
7134 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7135 % environment contents.
7136 \font\circle=lcircle10
7137 \newdimen\circthick
7138 \newdimen\cartouter\newdimen\cartinner
7139 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7140 \circthick=\fontdimen8\circle
7142 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7143 \def\ctr{{\hskip 6pt\circle\char'010}}
7144 \def\cbl{{\circle\char'012\hskip -6pt}}
7145 \def\cbr{{\hskip 6pt\circle\char'011}}
7146 \def\carttop{\hbox to \cartouter{\hskip\lskip
7147 \ctl\leaders\hrule height\circthick\hfil\ctr
7148 \hskip\rskip}}
7149 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7150 \cbl\leaders\hrule height\circthick\hfil\cbr
7151 \hskip\rskip}}
7153 \newskip\lskip\newskip\rskip
7155 \envdef\cartouche{%
7156 \ifhmode\par\fi % can't be in the midst of a paragraph.
7157 \startsavinginserts
7158 \lskip=\leftskip \rskip=\rightskip
7159 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7160 \cartinner=\hsize \advance\cartinner by-\lskip
7161 \advance\cartinner by-\rskip
7162 \cartouter=\hsize
7163 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
7164 % side, and for 6pt waste from
7165 % each corner char, and rule thickness
7166 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7168 % If this cartouche directly follows a sectioning command, we need the
7169 % \parskip glue (backspaced over by default) or the cartouche can
7170 % collide with the section heading.
7171 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7173 \setbox\groupbox=\vbox\bgroup
7174 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7175 \carttop
7176 \hbox\bgroup
7177 \hskip\lskip
7178 \vrule\kern3pt
7179 \vbox\bgroup
7180 \kern3pt
7181 \hsize=\cartinner
7182 \baselineskip=\normbskip
7183 \lineskip=\normlskip
7184 \parskip=\normpskip
7185 \vskip -\parskip
7186 \comment % For explanation, see the end of def\group.
7188 \def\Ecartouche{%
7189 \ifhmode\par\fi
7190 \kern3pt
7191 \egroup
7192 \kern3pt\vrule
7193 \hskip\rskip
7194 \egroup
7195 \cartbot
7196 \egroup
7197 \addgroupbox
7198 \checkinserts
7202 % This macro is called at the beginning of all the @example variants,
7203 % inside a group.
7204 \newdimen\nonfillparindent
7205 \def\nonfillstart{%
7206 \aboveenvbreak
7207 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7208 \sepspaces % Make spaces be word-separators rather than space tokens.
7209 \let\par = \lisppar % don't ignore blank lines
7210 \obeylines % each line of input is a line of output
7211 \parskip = 0pt
7212 % Turn off paragraph indentation but redefine \indent to emulate
7213 % the normal \indent.
7214 \nonfillparindent=\parindent
7215 \parindent = 0pt
7216 \let\indent\nonfillindent
7218 \emergencystretch = 0pt % don't try to avoid overfull boxes
7219 \ifx\nonarrowing\relax
7220 \advance \leftskip by \lispnarrowing
7221 \exdentamount=\lispnarrowing
7222 \else
7223 \let\nonarrowing = \relax
7225 \let\exdent=\nofillexdent
7228 \begingroup
7229 \obeyspaces
7230 % We want to swallow spaces (but not other tokens) after the fake
7231 % @indent in our nonfill-environments, where spaces are normally
7232 % active and set to @tie, resulting in them not being ignored after
7233 % @indent.
7234 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7235 \gdef\nonfillindentcheck{%
7236 \ifx\temp %
7237 \expandafter\nonfillindentgobble%
7238 \else%
7239 \leavevmode\nonfillindentbox%
7240 \fi%
7242 \endgroup
7243 \def\nonfillindentgobble#1{\nonfillindent}
7244 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7246 % If you want all examples etc. small: @set dispenvsize small.
7247 % If you want even small examples the full size: @set dispenvsize nosmall.
7248 % This affects the following displayed environments:
7249 % @example, @display, @format, @lisp
7251 \def\smallword{small}
7252 \def\nosmallword{nosmall}
7253 \let\SETdispenvsize\relax
7254 \def\setnormaldispenv{%
7255 \ifx\SETdispenvsize\smallword
7256 % end paragraph for sake of leading, in case document has no blank
7257 % line. This is redundant with what happens in \aboveenvbreak, but
7258 % we need to do it before changing the fonts, and it's inconvenient
7259 % to change the fonts afterward.
7260 \ifnum \lastpenalty=10000 \else \endgraf \fi
7261 \smallexamplefonts \rm
7264 \def\setsmalldispenv{%
7265 \ifx\SETdispenvsize\nosmallword
7266 \else
7267 \ifnum \lastpenalty=10000 \else \endgraf \fi
7268 \smallexamplefonts \rm
7272 % We often define two environments, @foo and @smallfoo.
7273 % Let's do it in one command. #1 is the env name, #2 the definition.
7274 \def\makedispenvdef#1#2{%
7275 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7276 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7277 \expandafter\let\csname E#1\endcsname \afterenvbreak
7278 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7281 % Define two environment synonyms (#1 and #2) for an environment.
7282 \def\maketwodispenvdef#1#2#3{%
7283 \makedispenvdef{#1}{#3}%
7284 \makedispenvdef{#2}{#3}%
7287 % @lisp: indented, narrowed, typewriter font;
7288 % @example: same as @lisp.
7290 % @smallexample and @smalllisp: use smaller fonts.
7291 % Originally contributed by Pavel@xerox.
7293 \maketwodispenvdef{lisp}{example}{%
7294 \nonfillstart
7295 \tt\setupmarkupstyle{example}%
7296 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7297 \gobble % eat return
7299 % @display/@smalldisplay: same as @lisp except keep current font.
7301 \makedispenvdef{display}{%
7302 \nonfillstart
7303 \gobble
7306 % @format/@smallformat: same as @display except don't narrow margins.
7308 \makedispenvdef{format}{%
7309 \let\nonarrowing = t%
7310 \nonfillstart
7311 \gobble
7314 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7315 \envdef\flushleft{%
7316 \let\nonarrowing = t%
7317 \nonfillstart
7318 \gobble
7320 \let\Eflushleft = \afterenvbreak
7322 % @flushright.
7324 \envdef\flushright{%
7325 \let\nonarrowing = t%
7326 \nonfillstart
7327 \advance\leftskip by 0pt plus 1fill\relax
7328 \gobble
7330 \let\Eflushright = \afterenvbreak
7333 % @raggedright does more-or-less normal line breaking but no right
7334 % justification. From plain.tex. Don't stretch around special
7335 % characters in urls in this environment, since the stretch at the right
7336 % should be enough.
7337 \envdef\raggedright{%
7338 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7339 \def\urefprestretchamount{0pt}%
7340 \def\urefpoststretchamount{0pt}%
7342 \let\Eraggedright\par
7344 \envdef\raggedleft{%
7345 \parindent=0pt \leftskip0pt plus2em
7346 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7347 \hbadness=10000 % Last line will usually be underfull, so turn off
7348 % badness reporting.
7350 \let\Eraggedleft\par
7352 \envdef\raggedcenter{%
7353 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
7354 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7355 \hbadness=10000 % Last line will usually be underfull, so turn off
7356 % badness reporting.
7358 \let\Eraggedcenter\par
7361 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7362 % and narrows the margins. We keep \parskip nonzero in general, since
7363 % we're doing normal filling. So, when using \aboveenvbreak and
7364 % \afterenvbreak, temporarily make \parskip 0.
7366 \makedispenvdef{quotation}{\quotationstart}
7368 \def\quotationstart{%
7369 \indentedblockstart % same as \indentedblock, but increase right margin too.
7370 \ifx\nonarrowing\relax
7371 \advance\rightskip by \lispnarrowing
7373 \parsearg\quotationlabel
7376 % We have retained a nonzero parskip for the environment, since we're
7377 % doing normal filling.
7379 \def\Equotation{%
7380 \par
7381 \ifx\quotationauthor\thisisundefined\else
7382 % indent a bit.
7383 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7385 {\parskip=0pt \afterenvbreak}%
7387 \def\Esmallquotation{\Equotation}
7389 % If we're given an argument, typeset it in bold with a colon after.
7390 \def\quotationlabel#1{%
7391 \def\temp{#1}%
7392 \ifx\temp\empty \else
7393 {\bf #1: }%
7397 % @indentedblock is like @quotation, but indents only on the left and
7398 % has no optional argument.
7400 \makedispenvdef{indentedblock}{\indentedblockstart}
7402 \def\indentedblockstart{%
7403 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7404 \parindent=0pt
7406 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7407 \ifx\nonarrowing\relax
7408 \advance\leftskip by \lispnarrowing
7409 \exdentamount = \lispnarrowing
7410 \else
7411 \let\nonarrowing = \relax
7415 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7417 \def\Eindentedblock{%
7418 \par
7419 {\parskip=0pt \afterenvbreak}%
7421 \def\Esmallindentedblock{\Eindentedblock}
7424 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7425 % If we want to allow any <char> as delimiter,
7426 % we need the curly braces so that makeinfo sees the @verb command, eg:
7427 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7429 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7431 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7432 % active too. Otherwise, they get lost as the first character on a
7433 % verbatim line.
7434 \def\dospecials{%
7435 \do\ \do\\\do\{\do\}\do\$\do\&%
7436 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7437 \do\<\do\>\do\|\do\@\do+\do\"%
7438 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7439 % @set txicodequotebacktick will not have effect on @verb and
7440 % @verbatim, and ?` and !` ligatures won't get disabled.
7441 %\do\`\do\'%
7444 % [Knuth] p. 380
7445 \def\uncatcodespecials{%
7446 \def\do##1{\catcode`##1=\other}\dospecials}
7448 % Setup for the @verb command.
7450 % Eight spaces for a tab
7451 \begingroup
7452 \catcode`\^^I=\active
7453 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7454 \endgroup
7456 \def\setupverb{%
7457 \tt % easiest (and conventionally used) font for verbatim
7458 \def\par{\leavevmode\endgraf}%
7459 \setupmarkupstyle{verb}%
7460 \tabeightspaces
7461 % Respect line breaks,
7462 % print special symbols as themselves, and
7463 % make each space count
7464 % must do in this order:
7465 \obeylines \uncatcodespecials \sepspaces
7468 % Setup for the @verbatim environment
7470 % Real tab expansion.
7471 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7473 % We typeset each line of the verbatim in an \hbox, so we can handle
7474 % tabs. The \global is in case the verbatim line starts with an accent,
7475 % or some other command that starts with a begin-group. Otherwise, the
7476 % entire \verbbox would disappear at the corresponding end-group, before
7477 % it is typeset. Meanwhile, we can't have nested verbatim commands
7478 % (can we?), so the \global won't be overwriting itself.
7479 \newbox\verbbox
7480 \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
7482 \begingroup
7483 \catcode`\^^I=\active
7484 \gdef\tabexpand{%
7485 \catcode`\^^I=\active
7486 \def^^I{\leavevmode\egroup
7487 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7488 \divide\dimen\verbbox by\tabw
7489 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7490 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7491 \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
7494 \endgroup
7496 % start the verbatim environment.
7497 \def\setupverbatim{%
7498 \let\nonarrowing = t%
7499 \nonfillstart
7500 \tt % easiest (and conventionally used) font for verbatim
7501 % The \leavevmode here is for blank lines. Otherwise, we would
7502 % never \starttabox and the \egroup would end verbatim mode.
7503 \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
7504 \tabexpand
7505 \setupmarkupstyle{verbatim}%
7506 % Respect line breaks,
7507 % print special symbols as themselves, and
7508 % make each space count.
7509 % Must do in this order:
7510 \obeylines \uncatcodespecials \sepspaces
7511 \everypar{\starttabbox}%
7514 % Do the @verb magic: verbatim text is quoted by unique
7515 % delimiter characters. Before first delimiter expect a
7516 % right brace, after last delimiter expect closing brace:
7518 % \def\doverb'{'<char>#1<char>'}'{#1}
7520 % [Knuth] p. 382; only eat outer {}
7521 \begingroup
7522 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7523 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7524 \endgroup
7526 \def\verb{\begingroup\setupverb\doverb}
7529 % Do the @verbatim magic: define the macro \doverbatim so that
7530 % the (first) argument ends when '@end verbatim' is reached, ie:
7532 % \def\doverbatim#1@end verbatim{#1}
7534 % For Texinfo it's a lot easier than for LaTeX,
7535 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7536 % we need not redefine '\', '{' and '}'.
7538 % Inspired by LaTeX's verbatim command set [latex.ltx]
7540 \begingroup
7541 \catcode`\ =\active
7542 \obeylines %
7543 % ignore everything up to the first ^^M, that's the newline at the end
7544 % of the @verbatim input line itself. Otherwise we get an extra blank
7545 % line in the output.
7546 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
7547 % We really want {...\end verbatim} in the body of the macro, but
7548 % without the active space; thus we have to use \xdef and \gobble.
7549 \endgroup
7551 \envdef\verbatim{%
7552 \setupverbatim\doverbatim
7554 \let\Everbatim = \afterenvbreak
7557 % @verbatiminclude FILE - insert text of file in verbatim environment.
7559 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7561 \def\doverbatiminclude#1{%
7563 \makevalueexpandable
7564 \setupverbatim
7565 \indexnofonts % Allow `@@' and other weird things in file names.
7566 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7567 \input #1
7568 \afterenvbreak
7572 % @copying ... @end copying.
7573 % Save the text away for @insertcopying later.
7575 % We save the uninterpreted tokens, rather than creating a box.
7576 % Saving the text in a box would be much easier, but then all the
7577 % typesetting commands (@smallbook, font changes, etc.) have to be done
7578 % beforehand -- and a) we want @copying to be done first in the source
7579 % file; b) letting users define the frontmatter in as flexible order as
7580 % possible is desirable.
7582 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7583 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7585 \def\insertcopying{%
7586 \begingroup
7587 \parindent = 0pt % paragraph indentation looks wrong on title page
7588 \scanexp\copyingtext
7589 \endgroup
7593 \message{defuns,}
7594 % @defun etc.
7596 \newskip\defbodyindent \defbodyindent=.4in
7597 \newskip\defargsindent \defargsindent=50pt
7598 \newskip\deflastargmargin \deflastargmargin=18pt
7599 \newcount\defunpenalty
7601 % Start the processing of @deffn:
7602 \def\startdefun{%
7603 \ifnum\lastpenalty<10000
7604 \medbreak
7605 \defunpenalty=10003 % Will keep this @deffn together with the
7606 % following @def command, see below.
7607 \else
7608 % If there are two @def commands in a row, we'll have a \nobreak,
7609 % which is there to keep the function description together with its
7610 % header. But if there's nothing but headers, we need to allow a
7611 % break somewhere. Check specifically for penalty 10002, inserted
7612 % by \printdefunline, instead of 10000, since the sectioning
7613 % commands also insert a nobreak penalty, and we don't want to allow
7614 % a break between a section heading and a defun.
7616 % As a further refinement, we avoid "club" headers by signalling
7617 % with penalty of 10003 after the very first @deffn in the
7618 % sequence (see above), and penalty of 10002 after any following
7619 % @def command.
7620 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7622 % Similarly, after a section heading, do not allow a break.
7623 % But do insert the glue.
7624 \medskip % preceded by discardable penalty, so not a breakpoint
7627 \parindent=0in
7628 \advance\leftskip by \defbodyindent
7629 \exdentamount=\defbodyindent
7632 \def\dodefunx#1{%
7633 % First, check whether we are in the right environment:
7634 \checkenv#1%
7636 % As above, allow line break if we have multiple x headers in a row.
7637 % It's not a great place, though.
7638 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7640 % And now, it's time to reuse the body of the original defun:
7641 \expandafter\gobbledefun#1%
7643 \def\gobbledefun#1\startdefun{}
7645 % \printdefunline \deffnheader{text}
7647 \def\printdefunline#1#2{%
7648 \begingroup
7649 % call \deffnheader:
7650 #1#2 \endheader
7651 % common ending:
7652 \interlinepenalty = 10000
7653 \advance\rightskip by 0pt plus 1fil\relax
7654 \endgraf
7655 \nobreak\vskip -\parskip
7656 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7657 % Some of the @defun-type tags do not enable magic parentheses,
7658 % rendering the following check redundant. But we don't optimize.
7659 \checkparencounts
7660 \endgroup
7663 \def\Edefun{\endgraf\medbreak}
7665 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7666 % the only thing remaining is to define \deffnheader.
7668 \def\makedefun#1{%
7669 \expandafter\let\csname E#1\endcsname = \Edefun
7670 \edef\temp{\noexpand\domakedefun
7671 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7672 \temp
7675 % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7677 % Define \deffn and \deffnx, without parameters.
7678 % \deffnheader has to be defined explicitly.
7680 \def\domakedefun#1#2#3{%
7681 \envdef#1{%
7682 \startdefun
7683 \doingtypefnfalse % distinguish typed functions from all else
7684 \parseargusing\activeparens{\printdefunline#3}%
7686 \def#2{\dodefunx#1}%
7687 \def#3%
7690 \newif\ifdoingtypefn % doing typed function?
7691 \newif\ifrettypeownline % typeset return type on its own line?
7693 % @deftypefnnewline on|off says whether the return type of typed functions
7694 % are printed on their own line. This affects @deftypefn, @deftypefun,
7695 % @deftypeop, and @deftypemethod.
7697 \parseargdef\deftypefnnewline{%
7698 \def\temp{#1}%
7699 \ifx\temp\onword
7700 \expandafter\let\csname SETtxideftypefnnl\endcsname
7701 = \empty
7702 \else\ifx\temp\offword
7703 \expandafter\let\csname SETtxideftypefnnl\endcsname
7704 = \relax
7705 \else
7706 \errhelp = \EMsimple
7707 \errmessage{Unknown @txideftypefnnl value `\temp',
7708 must be on|off}%
7709 \fi\fi
7712 % Untyped functions:
7714 % @deffn category name args
7715 \makedefun{deffn}{\deffngeneral{}}
7717 % @deffn category class name args
7718 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7720 % \defopon {category on}class name args
7721 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7723 % \deffngeneral {subind}category name args
7725 \def\deffngeneral#1#2 #3 #4\endheader{%
7726 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
7727 \dosubind{fn}{\code{#3}}{#1}%
7728 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7731 % Typed functions:
7733 % @deftypefn category type name args
7734 \makedefun{deftypefn}{\deftypefngeneral{}}
7736 % @deftypeop category class type name args
7737 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7739 % \deftypeopon {category on}class type name args
7740 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7742 % \deftypefngeneral {subind}category type name args
7744 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7745 \dosubind{fn}{\code{#4}}{#1}%
7746 \doingtypefntrue
7747 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7750 % Typed variables:
7752 % @deftypevr category type var args
7753 \makedefun{deftypevr}{\deftypecvgeneral{}}
7755 % @deftypecv category class type var args
7756 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7758 % \deftypecvof {category of}class type var args
7759 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7761 % \deftypecvgeneral {subind}category type var args
7763 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7764 \dosubind{vr}{\code{#4}}{#1}%
7765 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7768 % Untyped variables:
7770 % @defvr category var args
7771 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7773 % @defcv category class var args
7774 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7776 % \defcvof {category of}class var args
7777 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7779 % Types:
7781 % @deftp category name args
7782 \makedefun{deftp}#1 #2 #3\endheader{%
7783 \doind{tp}{\code{#2}}%
7784 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7787 % Remaining @defun-like shortcuts:
7788 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7789 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7790 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7791 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7792 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7793 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7794 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7795 \makedefun{defmethod}{\defopon\putwordMethodon}
7796 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7797 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7798 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7800 % \defname, which formats the name of the @def (not the args).
7801 % #1 is the category, such as "Function".
7802 % #2 is the return type, if any.
7803 % #3 is the function name.
7805 % We are followed by (but not passed) the arguments, if any.
7807 \def\defname#1#2#3{%
7808 \par
7809 % Get the values of \leftskip and \rightskip as they were outside the @def...
7810 \advance\leftskip by -\defbodyindent
7812 % Determine if we are typesetting the return type of a typed function
7813 % on a line by itself.
7814 \rettypeownlinefalse
7815 \ifdoingtypefn % doing a typed function specifically?
7816 % then check user option for putting return type on its own line:
7817 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7818 \rettypeownlinetrue
7822 % How we'll format the category name. Putting it in brackets helps
7823 % distinguish it from the body text that may end up on the next line
7824 % just below it.
7825 \def\temp{#1}%
7826 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7828 % Figure out line sizes for the paragraph shape. We'll always have at
7829 % least two.
7830 \tempnum = 2
7832 % The first line needs space for \box0; but if \rightskip is nonzero,
7833 % we need only space for the part of \box0 which exceeds it:
7834 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7836 % If doing a return type on its own line, we'll have another line.
7837 \ifrettypeownline
7838 \advance\tempnum by 1
7839 \def\maybeshapeline{0in \hsize}%
7840 \else
7841 \def\maybeshapeline{}%
7844 % The continuations:
7845 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7847 % The final paragraph shape:
7848 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7850 % Put the category name at the right margin.
7851 \noindent
7852 \hbox to 0pt{%
7853 \hfil\box0 \kern-\hsize
7854 % \hsize has to be shortened this way:
7855 \kern\leftskip
7856 % Intentionally do not respect \rightskip, since we need the space.
7859 % Allow all lines to be underfull without complaint:
7860 \tolerance=10000 \hbadness=10000
7861 \exdentamount=\defbodyindent
7863 % defun fonts. We use typewriter by default (used to be bold) because:
7864 % . we're printing identifiers, they should be in tt in principle.
7865 % . in languages with many accents, such as Czech or French, it's
7866 % common to leave accents off identifiers. The result looks ok in
7867 % tt, but exceedingly strange in rm.
7868 % . we don't want -- and --- to be treated as ligatures.
7869 % . this still does not fix the ?` and !` ligatures, but so far no
7870 % one has made identifiers using them :).
7871 \df \tt
7872 \def\temp{#2}% text of the return type
7873 \ifx\temp\empty\else
7874 \tclose{\temp}% typeset the return type
7875 \ifrettypeownline
7876 % put return type on its own line; prohibit line break following:
7877 \hfil\vadjust{\nobreak}\break
7878 \else
7879 \space % type on same line, so just followed by a space
7881 \fi % no return type
7882 #3% output function name
7884 {\rm\enskip}% hskip 0.5 em of \tenrm
7886 \boldbrax
7887 % arguments will be output next, if any.
7890 % Print arguments in slanted roman (not ttsl), inconsistently with using
7891 % tt for the name. This is because literal text is sometimes needed in
7892 % the argument list (groff manual), and ttsl and tt are not very
7893 % distinguishable. Prevent hyphenation at `-' chars.
7895 \def\defunargs#1{%
7896 % use sl by default (not ttsl),
7897 % tt for the names.
7898 \df \sl \hyphenchar\font=0
7900 % On the other hand, if an argument has two dashes (for instance), we
7901 % want a way to get ttsl. We used to recommend @var for that, so
7902 % leave the code in, but it's strange for @var to lead to typewriter.
7903 % Nowadays we recommend @code, since the difference between a ttsl hyphen
7904 % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7905 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7907 \sl\hyphenchar\font=45
7910 % We want ()&[] to print specially on the defun line.
7912 \def\activeparens{%
7913 \catcode`\(=\active \catcode`\)=\active
7914 \catcode`\[=\active \catcode`\]=\active
7915 \catcode`\&=\active
7918 % Make control sequences which act like normal parenthesis chars.
7919 \let\lparen = ( \let\rparen = )
7921 % Be sure that we always have a definition for `(', etc. For example,
7922 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7923 % so TeX would otherwise complain about undefined control sequence.
7925 \activeparens
7926 \global\let(=\lparen \global\let)=\rparen
7927 \global\let[=\lbrack \global\let]=\rbrack
7928 \global\let& = \&
7930 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7931 \gdef\magicamp{\let&=\amprm}
7934 \newcount\parencount
7936 % If we encounter &foo, then turn on ()-hacking afterwards
7937 \newif\ifampseen
7938 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
7940 \def\parenfont{%
7941 \ifampseen
7942 % At the first level, print parens in roman,
7943 % otherwise use the default font.
7944 \ifnum \parencount=1 \rm \fi
7945 \else
7946 % The \sf parens (in \boldbrax) actually are a little bolder than
7947 % the contained text. This is especially needed for [ and ] .
7951 \def\infirstlevel#1{%
7952 \ifampseen
7953 \ifnum\parencount=1
7958 \def\bfafterword#1 {#1 \bf}
7960 \def\opnr{%
7961 \global\advance\parencount by 1
7962 {\parenfont(}%
7963 \infirstlevel \bfafterword
7965 \def\clnr{%
7966 {\parenfont)}%
7967 \infirstlevel \sl
7968 \global\advance\parencount by -1
7971 \newcount\brackcount
7972 \def\lbrb{%
7973 \global\advance\brackcount by 1
7974 {\bf[}%
7976 \def\rbrb{%
7977 {\bf]}%
7978 \global\advance\brackcount by -1
7981 \def\checkparencounts{%
7982 \ifnum\parencount=0 \else \badparencount \fi
7983 \ifnum\brackcount=0 \else \badbrackcount \fi
7985 % these should not use \errmessage; the glibc manual, at least, actually
7986 % has such constructs (when documenting function pointers).
7987 \def\badparencount{%
7988 \message{Warning: unbalanced parentheses in @def...}%
7989 \global\parencount=0
7991 \def\badbrackcount{%
7992 \message{Warning: unbalanced square brackets in @def...}%
7993 \global\brackcount=0
7997 \message{macros,}
7998 % @macro.
8000 % To do this right we need a feature of e-TeX, \scantokens,
8001 % which we arrange to emulate with a temporary file in ordinary TeX.
8002 \ifx\eTeXversion\thisisundefined
8003 \newwrite\macscribble
8004 \def\scantokens#1{%
8005 \toks0={#1}%
8006 \immediate\openout\macscribble=\jobname.tmp
8007 \immediate\write\macscribble{\the\toks0}%
8008 \immediate\closeout\macscribble
8009 \input \jobname.tmp
8013 \let\aftermacroxxx\relax
8014 \def\aftermacro{\aftermacroxxx}
8016 % alias because \c means cedilla in @tex or @math
8017 \let\texinfoc=\c
8019 \newcount\savedcatcodeone
8020 \newcount\savedcatcodetwo
8022 % Used at the time of macro expansion.
8023 % Argument is macro body with arguments substituted
8024 \def\scanmacro#1{%
8025 \newlinechar`\^^M
8026 \def\xeatspaces{\eatspaces}%
8028 % Temporarily undo catcode changes of \printindex. Set catcode of @ to
8029 % 0 so that @-commands in macro expansions aren't printed literally when
8030 % formatting an index file, where \ is used as the escape character.
8031 \savedcatcodeone=\catcode`\@
8032 \savedcatcodetwo=\catcode`\\
8033 \catcode`\@=0
8034 \catcode`\\=\active
8036 % Process the macro body under the current catcode regime.
8037 \scantokens{#1@texinfoc}\aftermacro%
8039 \catcode`\@=\savedcatcodeone
8040 \catcode`\\=\savedcatcodetwo
8042 % The \texinfoc is to remove the \newlinechar added by \scantokens, and
8043 % can be noticed by \parsearg.
8044 % The \aftermacro allows a \comment at the end of the macro definition
8045 % to duplicate itself past the final \newlinechar added by \scantokens:
8046 % this is used in the definition of \group to comment out a newline. We
8047 % don't do the same for \c to support Texinfo files with macros that ended
8048 % with a @c, which should no longer be necessary.
8049 % We avoid surrounding the call to \scantokens with \bgroup and \egroup
8050 % to allow macros to open or close groups themselves.
8053 % Used for copying and captions
8054 \def\scanexp#1{%
8055 \expandafter\scanmacro\expandafter{#1}%
8058 \newcount\paramno % Count of parameters
8059 \newtoks\macname % Macro name
8060 \newif\ifrecursive % Is it recursive?
8062 % List of all defined macros in the form
8063 % \commondummyword\macro1\commondummyword\macro2...
8064 % Currently is also contains all @aliases; the list can be split
8065 % if there is a need.
8066 \def\macrolist{}
8068 % Add the macro to \macrolist
8069 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
8070 \def\addtomacrolistxxx#1{%
8071 \toks0 = \expandafter{\macrolist\commondummyword#1}%
8072 \xdef\macrolist{\the\toks0}%
8075 % Utility routines.
8076 % This does \let #1 = #2, with \csnames; that is,
8077 % \let \csname#1\endcsname = \csname#2\endcsname
8078 % (except of course we have to play expansion games).
8080 \def\cslet#1#2{%
8081 \expandafter\let
8082 \csname#1\expandafter\endcsname
8083 \csname#2\endcsname
8086 % Trim leading and trailing spaces off a string.
8087 % Concepts from aro-bend problem 15 (see CTAN).
8088 {\catcode`\@=11
8089 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
8090 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
8091 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
8092 \def\unbrace#1{#1}
8093 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
8096 % Trim a single trailing ^^M off a string.
8097 {\catcode`\^^M=\other \catcode`\Q=3%
8098 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8099 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8100 \gdef\eatcrb#1Q#2Q{#1}%
8103 % Macro bodies are absorbed as an argument in a context where
8104 % all characters are catcode 10, 11 or 12, except \ which is active
8105 % (as in normal texinfo). It is necessary to change the definition of \
8106 % to recognize macro arguments; this is the job of \mbodybackslash.
8108 % Non-ASCII encodings make 8-bit characters active, so un-activate
8109 % them to avoid their expansion. Must do this non-globally, to
8110 % confine the change to the current group.
8112 % It's necessary to have hard CRs when the macro is executed. This is
8113 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8114 % body, and then making it the \newlinechar in \scanmacro.
8116 \def\scanctxt{% used as subroutine
8117 \catcode`\"=\other
8118 \catcode`\+=\other
8119 \catcode`\<=\other
8120 \catcode`\>=\other
8121 \catcode`\^=\other
8122 \catcode`\_=\other
8123 \catcode`\|=\other
8124 \catcode`\~=\other
8125 \passthroughcharstrue
8128 \def\scanargctxt{% used for copying and captions, not macros.
8129 \scanctxt
8130 \catcode`\@=\other
8131 \catcode`\\=\other
8132 \catcode`\^^M=\other
8135 \def\macrobodyctxt{% used for @macro definitions
8136 \scanctxt
8137 \catcode`\ =\other
8138 \catcode`\@=\other
8139 \catcode`\{=\other
8140 \catcode`\}=\other
8141 \catcode`\^^M=\other
8142 \usembodybackslash
8145 % Used when scanning braced macro arguments. Note, however, that catcode
8146 % changes here are ineffectual if the macro invocation was nested inside
8147 % an argument to another Texinfo command.
8148 \def\macroargctxt{%
8149 \scanctxt
8150 \catcode`\ =\active
8151 \catcode`\^^M=\other
8152 \catcode`\\=\active
8155 \def\macrolineargctxt{% used for whole-line arguments without braces
8156 \scanctxt
8157 \catcode`\{=\other
8158 \catcode`\}=\other
8161 % \mbodybackslash is the definition of \ in @macro bodies.
8162 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8163 % where N is the macro parameter number.
8164 % We define \csname macarg.\endcsname to be \realbackslash, so
8165 % \\ in macro replacement text gets you a backslash.
8167 {\catcode`@=0 @catcode`@\=@active
8168 @gdef@usembodybackslash{@let\=@mbodybackslash}
8169 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8171 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8173 \def\margbackslash#1{\char`\#1 }
8175 \def\macro{\recursivefalse\parsearg\macroxxx}
8176 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8178 \def\macroxxx#1{%
8179 \getargs{#1}% now \macname is the macname and \argl the arglist
8180 \ifx\argl\empty % no arguments
8181 \paramno=0\relax
8182 \else
8183 \expandafter\parsemargdef \argl;%
8184 \if\paramno>256\relax
8185 \ifx\eTeXversion\thisisundefined
8186 \errhelp = \EMsimple
8187 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8191 \if1\csname ismacro.\the\macname\endcsname
8192 \message{Warning: redefining \the\macname}%
8193 \else
8194 \expandafter\ifx\csname \the\macname\endcsname \relax
8195 \else \errmessage{Macro name \the\macname\space already defined}\fi
8196 \global\cslet{macsave.\the\macname}{\the\macname}%
8197 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8198 \addtomacrolist{\the\macname}%
8200 \begingroup \macrobodyctxt
8201 \ifrecursive \expandafter\parsermacbody
8202 \else \expandafter\parsemacbody
8203 \fi}
8205 \parseargdef\unmacro{%
8206 \if1\csname ismacro.#1\endcsname
8207 \global\cslet{#1}{macsave.#1}%
8208 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8209 % Remove the macro name from \macrolist:
8210 \begingroup
8211 \expandafter\let\csname#1\endcsname \relax
8212 \let\commondummyword\unmacrodo
8213 \xdef\macrolist{\macrolist}%
8214 \endgroup
8215 \else
8216 \errmessage{Macro #1 not defined}%
8220 % Called by \do from \dounmacro on each macro. The idea is to omit any
8221 % macro definitions that have been changed to \relax.
8223 \def\unmacrodo#1{%
8224 \ifx #1\relax
8225 % remove this
8226 \else
8227 \noexpand\commondummyword \noexpand#1%
8231 % \getargs -- Parse the arguments to a @macro line. Set \macname to
8232 % the name of the macro, and \argl to the braced argument list.
8233 \def\getargs#1{\getargsxxx#1{}}
8234 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8235 \def\getmacname#1 #2\relax{\macname={#1}}
8236 \def\getmacargs#1{\def\argl{#1}}
8237 % This made use of the feature that if the last token of a
8238 % <parameter list> is #, then the preceding argument is delimited by
8239 % an opening brace, and that opening brace is not consumed.
8241 % Parse the optional {params} list to @macro or @rmacro.
8242 % Set \paramno to the number of arguments,
8243 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8244 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
8245 % list to some hook where the argument is to be expanded. If there are
8246 % less than 10 arguments that hook is to be replaced by ##N where N
8247 % is the position in that list, that is to say the macro arguments are to be
8248 % defined `a la TeX in the macro body.
8250 % That gets used by \mbodybackslash (above).
8252 % If there are 10 or more arguments, a different technique is used: see
8253 % \parsemmanyargdef.
8255 \def\parsemargdef#1;{%
8256 \paramno=0\def\paramlist{}%
8257 \let\hash\relax
8258 % \hash is redefined to `#' later to get it into definitions
8259 \let\xeatspaces\relax
8260 \parsemargdefxxx#1,;,%
8261 \ifnum\paramno<10\relax\else
8262 \paramno0\relax
8263 \parsemmanyargdef@@#1,;,% 10 or more arguments
8266 \def\parsemargdefxxx#1,{%
8267 \if#1;\let\next=\relax
8268 \else \let\next=\parsemargdefxxx
8269 \advance\paramno by 1
8270 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8271 {\xeatspaces{\hash\the\paramno}}%
8272 \edef\paramlist{\paramlist\hash\the\paramno,}%
8273 \fi\next}
8275 % \parsemacbody, \parsermacbody
8277 % Read recursive and nonrecursive macro bodies. (They're different since
8278 % rec and nonrec macros end differently.)
8280 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
8281 % body to be transformed.
8282 % Set \macrobody to the body of the macro, and call \defmacro.
8284 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8285 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8286 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8287 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8289 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8290 \edef\texiatcatcode{\the\catcode`\@}
8291 \catcode `@=11\relax
8293 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8295 % If there are 10 or more arguments, a different technique is used, where the
8296 % hook remains in the body, and when macro is to be expanded the body is
8297 % processed again to replace the arguments.
8299 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8300 % argument N value and then \edef the body (nothing else will expand because of
8301 % the catcode regime under which the body was input).
8303 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8304 % arguments, no macro can have more than 256 arguments (else error).
8306 % In case that there are 10 or more arguments we parse again the arguments
8307 % list to set new definitions for the \macarg.BLAH macros corresponding to
8308 % each BLAH argument. It was anyhow needed to parse already once this list
8309 % in order to count the arguments, and as macros with at most 9 arguments
8310 % are by far more frequent than macro with 10 or more arguments, defining
8311 % twice the \macarg.BLAH macros does not cost too much processing power.
8312 \def\parsemmanyargdef@@#1,{%
8313 \if#1;\let\next=\relax
8314 \else
8315 \let\next=\parsemmanyargdef@@
8316 \edef\tempb{\eatspaces{#1}}%
8317 \expandafter\def\expandafter\tempa
8318 \expandafter{\csname macarg.\tempb\endcsname}%
8319 % Note that we need some extra \noexpand\noexpand, this is because we
8320 % don't want \the to be expanded in the \parsermacbody as it uses an
8321 % \xdef .
8322 \expandafter\edef\tempa
8323 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8324 \advance\paramno by 1\relax
8325 \fi\next}
8328 \let\endargs@\relax
8329 \let\nil@\relax
8330 \def\nilm@{\nil@}%
8331 \long\def\nillm@{\nil@}%
8333 % This macro is expanded during the Texinfo macro expansion, not during its
8334 % definition. It gets all the arguments' values and assigns them to macros
8335 % macarg.ARGNAME
8337 % #1 is the macro name
8338 % #2 is the list of argument names
8339 % #3 is the list of argument values
8340 \def\getargvals@#1#2#3{%
8341 \def\macargdeflist@{}%
8342 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8343 \def\paramlist{#2,\nil@}%
8344 \def\macroname{#1}%
8345 \begingroup
8346 \macroargctxt
8347 \def\argvaluelist{#3,\nil@}%
8348 \def\@tempa{#3}%
8349 \ifx\@tempa\empty
8350 \setemptyargvalues@
8351 \else
8352 \getargvals@@
8355 \def\getargvals@@{%
8356 \ifx\paramlist\nilm@
8357 % Some sanity check needed here that \argvaluelist is also empty.
8358 \ifx\argvaluelist\nillm@
8359 \else
8360 \errhelp = \EMsimple
8361 \errmessage{Too many arguments in macro `\macroname'!}%
8363 \let\next\macargexpandinbody@
8364 \else
8365 \ifx\argvaluelist\nillm@
8366 % No more arguments values passed to macro. Set remaining named-arg
8367 % macros to empty.
8368 \let\next\setemptyargvalues@
8369 \else
8370 % pop current arg name into \@tempb
8371 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8372 \expandafter\@tempa\expandafter{\paramlist}%
8373 % pop current argument value into \@tempc
8374 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8375 \expandafter\@tempa\expandafter{\argvaluelist}%
8376 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8377 % First place the new argument macro definition into \@tempd
8378 \expandafter\macname\expandafter{\@tempc}%
8379 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8380 \expandafter\def\expandafter\@tempe\expandafter{%
8381 \csname macarg.\@tempb\endcsname}%
8382 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8383 \push@\@tempd\macargdeflist@
8384 \let\next\getargvals@@
8387 \next
8390 \def\push@#1#2{%
8391 \expandafter\expandafter\expandafter\def
8392 \expandafter\expandafter\expandafter#2%
8393 \expandafter\expandafter\expandafter{%
8394 \expandafter#1#2}%
8397 % Replace arguments by their values in the macro body, and place the result
8398 % in macro \@tempa.
8400 \def\macvalstoargs@{%
8401 % To do this we use the property that token registers that are \the'ed
8402 % within an \edef expand only once. So we are going to place all argument
8403 % values into respective token registers.
8405 % First we save the token context, and initialize argument numbering.
8406 \begingroup
8407 \paramno0\relax
8408 % Then, for each argument number #N, we place the corresponding argument
8409 % value into a new token list register \toks#N
8410 \expandafter\putargsintokens@\saveparamlist@,;,%
8411 % Then, we expand the body so that argument are replaced by their
8412 % values. The trick for values not to be expanded themselves is that they
8413 % are within tokens and that tokens expand only once in an \edef .
8414 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8415 % Now we restore the token stack pointer to free the token list registers
8416 % which we have used, but we make sure that expanded body is saved after
8417 % group.
8418 \expandafter
8419 \endgroup
8420 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8423 % Define the named-macro outside of this group and then close this group.
8425 \def\macargexpandinbody@{%
8426 \expandafter
8427 \endgroup
8428 \macargdeflist@
8429 % First the replace in body the macro arguments by their values, the result
8430 % is in \@tempa .
8431 \macvalstoargs@
8432 % Then we point at the \norecurse or \gobble (for recursive) macro value
8433 % with \@tempb .
8434 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8435 % Depending on whether it is recursive or not, we need some tailing
8436 % \egroup .
8437 \ifx\@tempb\gobble
8438 \let\@tempc\relax
8439 \else
8440 \let\@tempc\egroup
8442 % And now we do the real job:
8443 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8444 \@tempd
8447 \def\putargsintokens@#1,{%
8448 \if#1;\let\next\relax
8449 \else
8450 \let\next\putargsintokens@
8451 % First we allocate the new token list register, and give it a temporary
8452 % alias \@tempb .
8453 \toksdef\@tempb\the\paramno
8454 % Then we place the argument value into that token list register.
8455 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8456 \expandafter\@tempb\expandafter{\@tempa}%
8457 \advance\paramno by 1\relax
8459 \next
8462 % Trailing missing arguments are set to empty.
8464 \def\setemptyargvalues@{%
8465 \ifx\paramlist\nilm@
8466 \let\next\macargexpandinbody@
8467 \else
8468 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8469 \let\next\setemptyargvalues@
8471 \next
8474 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8475 \expandafter\def\expandafter\@tempa\expandafter{%
8476 \expandafter\def\csname macarg.#1\endcsname{}}%
8477 \push@\@tempa\macargdeflist@
8478 \def\paramlist{#2}%
8481 % #1 is the element target macro
8482 % #2 is the list macro
8483 % #3,#4\endargs@ is the list value
8484 \def\pop@#1#2#3,#4\endargs@{%
8485 \def#1{#3}%
8486 \def#2{#4}%
8488 \long\def\longpop@#1#2#3,#4\endargs@{%
8489 \long\def#1{#3}%
8490 \long\def#2{#4}%
8494 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8497 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8498 % \macrobody has the body of the macro in it, with placeholders for
8499 % its parameters, looking like "\xeatspaces{\hash 1}".
8500 % \paramno is the number of parameters
8501 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8502 % There are four cases: macros of zero, one, up to nine, and many arguments.
8503 % \xdef is used so that macro definitions will survive the file
8504 % they're defined in: @include reads the file inside a group.
8506 \def\defmacro{%
8507 \let\hash=##% convert placeholders to macro parameter chars
8508 \ifnum\paramno=1
8509 \def\xeatspaces##1{##1}%
8510 % This removes the pair of braces around the argument. We don't
8511 % use \eatspaces, because this can cause ends of lines to be lost
8512 % when the argument to \eatspaces is read, leading to line-based
8513 % commands like "@itemize" not being read correctly.
8514 \else
8515 \let\xeatspaces\relax % suppress expansion
8517 \ifcase\paramno
8519 \expandafter\xdef\csname\the\macname\endcsname{%
8520 \noexpand\scanmacro{\macrobody}}%
8521 \or % 1
8522 \expandafter\xdef\csname\the\macname\endcsname{%
8523 \bgroup
8524 \noexpand\braceorline
8525 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8526 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8527 \egroup
8528 \noexpand\scanmacro{\macrobody}%
8530 \else % at most 9
8531 \ifnum\paramno<10\relax
8532 % @MACNAME sets the context for reading the macro argument
8533 % @MACNAME@@ gets the argument, processes backslashes and appends a
8534 % comma.
8535 % @MACNAME@@@ removes braces surrounding the argument list.
8536 % @MACNAME@@@@ scans the macro body with arguments substituted.
8537 \expandafter\xdef\csname\the\macname\endcsname{%
8538 \bgroup
8539 \noexpand\expandafter % This \expandafter skip any spaces after the
8540 \noexpand\macroargctxt % macro before we change the catcode of space.
8541 \noexpand\expandafter
8542 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8543 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8544 \noexpand\passargtomacro
8545 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8546 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8547 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8548 \expandafter\expandafter
8549 \expandafter\xdef
8550 \expandafter\expandafter
8551 \csname\the\macname @@@@\endcsname\paramlist{%
8552 \egroup\noexpand\scanmacro{\macrobody}}%
8553 \else % 10 or more:
8554 \expandafter\xdef\csname\the\macname\endcsname{%
8555 \noexpand\getargvals@{\the\macname}{\argl}%
8557 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8558 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8560 \fi}
8562 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8564 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8569 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8570 @catcode`@_=11 % private names
8571 @catcode`@!=11 % used as argument separator
8573 % \passargtomacro#1#2 -
8574 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8575 % compressed to one.
8577 % This implementation works by expansion, and not execution (so we cannot use
8578 % \def or similar). This reduces the risk of this failing in contexts where
8579 % complete expansion is done with no execution (for example, in writing out to
8580 % an auxiliary file for an index entry).
8582 % State is kept in the input stream: the argument passed to
8583 % @look_ahead, @gobble_and_check_finish and @add_segment is
8585 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8587 % where:
8588 % THE_MACRO - name of the macro we want to call
8589 % ARG_RESULT - argument list we build to pass to that macro
8590 % PENDING_BS - either a backslash or nothing
8591 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8593 @gdef@passargtomacro#1#2{%
8594 @add_segment #1!{}@relax#2\@_finish\%
8596 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8598 % #1 - THE_MACRO ARG_RESULT
8599 % #2 - PENDING_BS
8600 % #3 - NEXT_TOKEN
8601 % #4 used to look ahead
8603 % If the next token is not a backslash, process the rest of the argument;
8604 % otherwise, remove the next token.
8605 @gdef@look_ahead#1!#2#3#4{%
8606 @ifx#4\%
8607 @expandafter@gobble_and_check_finish
8608 @else
8609 @expandafter@add_segment
8610 @fi#1!{#2}#4#4%
8613 % #1 - THE_MACRO ARG_RESULT
8614 % #2 - PENDING_BS
8615 % #3 - NEXT_TOKEN
8616 % #4 should be a backslash, which is gobbled.
8617 % #5 looks ahead
8619 % Double backslash found. Add a single backslash, and look ahead.
8620 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8621 @add_segment#1\!{}#5#5%
8624 @gdef@is_fi{@fi}
8626 % #1 - THE_MACRO ARG_RESULT
8627 % #2 - PENDING_BS
8628 % #3 - NEXT_TOKEN
8629 % #4 is input stream until next backslash
8631 % Input stream is either at the start of the argument, or just after a
8632 % backslash sequence, either a lone backslash, or a doubled backslash.
8633 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8634 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8635 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8636 % a backslash just before the start of the input stream that has not been
8637 % added to ARG_RESULT.
8638 @gdef@add_segment#1!#2#3#4\{%
8639 @ifx#3@_finish
8640 @call_the_macro#1!%
8641 @else
8642 % append the pending backslash to the result, followed by the next segment
8643 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8644 % this @fi is discarded by @look_ahead.
8645 % we can't get rid of it with \expandafter because we don't know how
8646 % long #4 is.
8649 % #1 - THE_MACRO
8650 % #2 - ARG_RESULT
8651 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8652 % conditional.
8653 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8658 % \braceorline MAC is used for a one-argument macro MAC. It checks
8659 % whether the next non-whitespace character is a {. It sets the context
8660 % for reading the argument (slightly different in the two cases). Then,
8661 % to read the argument, in the whole-line case, it then calls the regular
8662 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8664 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8665 \def\braceorlinexxx{%
8666 \ifx\nchar\bgroup
8667 \macroargctxt
8668 \expandafter\passargtomacro
8669 \else
8670 \macrolineargctxt\expandafter\parsearg
8671 \fi \macnamexxx}
8674 % @alias.
8675 % We need some trickery to remove the optional spaces around the equal
8676 % sign. Make them active and then expand them all to nothing.
8678 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8679 \def\aliasxxx #1{\aliasyyy#1\relax}
8680 \def\aliasyyy #1=#2\relax{%
8682 \expandafter\let\obeyedspace=\empty
8683 \addtomacrolist{#1}%
8684 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8686 \next
8690 \message{cross references,}
8692 \newwrite\auxfile
8693 \newif\ifhavexrefs % True if xref values are known.
8694 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8696 % @inforef is relatively simple.
8697 \def\inforef #1{\inforefzzz #1,,,,**}
8698 \def\inforefzzz #1,#2,#3,#4**{%
8699 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8700 node \samp{\ignorespaces#1{}}}
8702 % @node's only job in TeX is to define \lastnode, which is used in
8703 % cross-references. The @node line might or might not have commas, and
8704 % might or might not have spaces before the first comma, like:
8705 % @node foo , bar , ...
8706 % We don't want such trailing spaces in the node name.
8708 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8710 % also remove a trailing comma, in case of something like this:
8711 % @node Help-Cross, , , Cross-refs
8712 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8713 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
8715 \let\nwnode=\node
8716 \let\lastnode=\empty
8718 % Write a cross-reference definition for the current node. #1 is the
8719 % type (Ynumbered, Yappendix, Ynothing).
8721 \def\donoderef#1{%
8722 \ifx\lastnode\empty\else
8723 \setref{\lastnode}{#1}%
8724 \global\let\lastnode=\empty
8728 % @anchor{NAME} -- define xref target at arbitrary point.
8730 \newcount\savesfregister
8732 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8733 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8734 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8736 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8737 % anchor), which consists of three parts:
8738 % 1) NAME-title - the current sectioning name taken from \lastsection,
8739 % or the anchor name.
8740 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8741 % empty for anchors.
8742 % 3) NAME-pg - the page number.
8744 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8745 % floats, there is an additional part, which is not written here:
8746 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8748 \def\setref#1#2{%
8749 \pdfmkdest{#1}%
8750 \iflinks
8752 \requireauxfile
8753 \atdummies % preserve commands, but don't expand them
8754 % match definition in \xrdef, \refx, \xrefX.
8755 \def\value##1{##1}%
8756 \edef\writexrdef##1##2{%
8757 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8758 ##1}{##2}}% these are parameters of \writexrdef
8760 \toks0 = \expandafter{\lastsection}%
8761 \immediate \writexrdef{title}{\the\toks0 }%
8762 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8763 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8768 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8769 % automatically in xrefs, if the third arg is not explicitly specified.
8770 % This was provided as a "secret" @set xref-automatic-section-title
8771 % variable, now it's official.
8773 \parseargdef\xrefautomaticsectiontitle{%
8774 \def\temp{#1}%
8775 \ifx\temp\onword
8776 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8777 = \empty
8778 \else\ifx\temp\offword
8779 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8780 = \relax
8781 \else
8782 \errhelp = \EMsimple
8783 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8784 must be on|off}%
8785 \fi\fi
8788 % \f
8789 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8790 % the node name, #2 the name of the Info cross-reference, #3 the printed
8791 % node name, #4 the name of the Info file, #5 the name of the printed
8792 % manual. All but the node name can be omitted.
8794 \def\pxref{\putwordsee{} \xrefXX}
8795 \def\xref{\putwordSee{} \xrefXX}
8796 \def\ref{\xrefXX}
8798 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8799 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8801 \newbox\toprefbox
8802 \newbox\printedrefnamebox
8803 \newbox\infofilenamebox
8804 \newbox\printedmanualbox
8806 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8807 \unsepspaces
8809 % Get args without leading/trailing spaces.
8810 \def\printedrefname{\ignorespaces #3}%
8811 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8813 \def\infofilename{\ignorespaces #4}%
8814 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8816 \def\printedmanual{\ignorespaces #5}%
8817 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8819 % If the printed reference name (arg #3) was not explicitly given in
8820 % the @xref, figure out what we want to use.
8821 \ifdim \wd\printedrefnamebox = 0pt
8822 % No printed node name was explicitly given.
8823 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8824 % Not auto section-title: use node name inside the square brackets.
8825 \def\printedrefname{\ignorespaces #1}%
8826 \else
8827 % Auto section-title: use chapter/section title inside
8828 % the square brackets if we have it.
8829 \ifdim \wd\printedmanualbox > 0pt
8830 % It is in another manual, so we don't have it; use node name.
8831 \def\printedrefname{\ignorespaces #1}%
8832 \else
8833 \ifhavexrefs
8834 % We (should) know the real title if we have the xref values.
8835 \def\printedrefname{\refx{#1-title}{}}%
8836 \else
8837 % Otherwise just copy the Info node name.
8838 \def\printedrefname{\ignorespaces #1}%
8839 \fi%
8844 % Make link in pdf output.
8845 \ifpdf
8846 % For pdfTeX and LuaTeX
8847 {\indexnofonts
8848 \makevalueexpandable
8850 % This (wrongly) does not take account of leading or trailing
8851 % spaces in #1, which should be ignored.
8852 \ifx\luatexversion\thisisundefined
8853 \edef\pdfxrefdest{#1}% pdfTeX: Replace Unicode characters with ASCII.
8854 \else
8855 \def\pdfxrefdest{#1}% LuaTeX: Pass through Unicode characters.
8857 \turnoffactive
8858 % This expands tokens, so do it after making catcode changes, so _
8859 % etc. don't get their TeX definitions. This ignores all spaces in
8860 % #4, including (wrongly) those in the middle of the filename.
8861 \getfilename{#4}%
8863 \ifx\pdfxrefdest\empty
8864 \def\pdfxrefdest{Top}% no empty targets
8865 \else
8866 \txiescapepdf\pdfxrefdest % escape PDF special chars
8869 \leavevmode
8870 \startlink attr{/Border [0 0 0]}%
8871 \ifnum\filenamelength>0
8872 goto file{\the\filename.pdf} name{\pdfxrefdest}%
8873 \else
8874 goto name{\pdfmkpgn{\pdfxrefdest}}%
8877 \setcolor{\linkcolor}%
8878 \else
8879 \ifx\XeTeXrevision\thisisundefined
8880 \else
8881 % For XeTeX
8882 {\indexnofonts
8883 \makevalueexpandable
8885 % This (wrongly) does not take account of leading or trailing
8886 % spaces in #1, which should be ignored.
8887 \iftxiuseunicodedestname
8888 \def\pdfxrefdest{#1}% Pass through Unicode characters.
8889 \else
8890 \edef\pdfxrefdest{#1}% Replace Unicode characters with ASCII.
8892 \turnoffactive
8893 % This expands tokens, so do it after making catcode changes, so _
8894 % etc. don't get their TeX definitions. This ignores all spaces in
8895 % #4, including (wrongly) those in the middle of the filename.
8896 \getfilename{#4}%
8898 \ifx\pdfxrefdest\empty
8899 \def\pdfxrefdest{Top}% no empty targets
8900 \else
8901 \txiescapepdf\pdfxrefdest % escape PDF special chars
8904 \leavevmode
8905 \ifnum\filenamelength>0
8906 % With default settings,
8907 % XeTeX (xdvipdfmx) replaces link destination names with integers.
8908 % In this case, the replaced destination names of
8909 % remote PDFs are no longer known. In order to avoid a replacement,
8910 % you can use xdvipdfmx's command line option `-C 0x0010'.
8911 % If you use XeTeX 0.99996+ (TeX Live 2016+),
8912 % this command line option is no longer necessary
8913 % because we can use the `dvipdfmx:config' special.
8914 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8915 << /S /GoToR /F (\the\filename.pdf) /D (\pdfxrefdest) >> >>}%
8916 \else
8917 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8918 << /S /GoTo /D (\pdfxrefdest) >> >>}%
8921 \setcolor{\linkcolor}%
8925 % Have to otherify everything special to allow the \csname to
8926 % include an _ in the xref name, etc.
8927 \indexnofonts
8928 \turnoffactive
8929 \def\value##1{##1}%
8930 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8931 \csname XR#1-title\endcsname
8934 % Float references are printed completely differently: "Figure 1.2"
8935 % instead of "[somenode], p.3". \iffloat distinguishes them by
8936 % \Xthisreftitle being set to a magic string.
8937 \iffloat\Xthisreftitle
8938 % If the user specified the print name (third arg) to the ref,
8939 % print it instead of our usual "Figure 1.2".
8940 \ifdim\wd\printedrefnamebox = 0pt
8941 \refx{#1-snt}{}%
8942 \else
8943 \printedrefname
8946 % If the user also gave the printed manual name (fifth arg), append
8947 % "in MANUALNAME".
8948 \ifdim \wd\printedmanualbox > 0pt
8949 \space \putwordin{} \cite{\printedmanual}%
8951 \else
8952 % node/anchor (non-float) references.
8954 % If we use \unhbox to print the node names, TeX does not insert
8955 % empty discretionaries after hyphens, which means that it will not
8956 % find a line break at a hyphen in a node names. Since some manuals
8957 % are best written with fairly long node names, containing hyphens,
8958 % this is a loss. Therefore, we give the text of the node name
8959 % again, so it is as if TeX is seeing it for the first time.
8961 \ifdim \wd\printedmanualbox > 0pt
8962 % Cross-manual reference with a printed manual name.
8964 \crossmanualxref{\cite{\printedmanual\unskip}}%
8966 \else\ifdim \wd\infofilenamebox > 0pt
8967 % Cross-manual reference with only an info filename (arg 4), no
8968 % printed manual name (arg 5). This is essentially the same as
8969 % the case above; we output the filename, since we have nothing else.
8971 \crossmanualxref{\code{\infofilename\unskip}}%
8973 \else
8974 % Reference within this manual.
8976 % _ (for example) has to be the character _ for the purposes of the
8977 % control sequence corresponding to the node, but it has to expand
8978 % into the usual \leavevmode...\vrule stuff for purposes of
8979 % printing. So we \turnoffactive for the \refx-snt, back on for the
8980 % printing, back off for the \refx-pg.
8981 {\turnoffactive
8982 % Only output a following space if the -snt ref is nonempty; for
8983 % @unnumbered and @anchor, it won't be.
8984 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
8985 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8987 % output the `[mynode]' via the macro below so it can be overridden.
8988 \xrefprintnodename\printedrefname
8990 % But we always want a comma and a space:
8991 ,\space
8993 % output the `page 3'.
8994 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
8995 % Add a , if xref followed by a space
8996 \if\space\noexpand\tokenafterxref ,%
8997 \else\ifx\ \tokenafterxref ,% @TAB
8998 \else\ifx\*\tokenafterxref ,% @*
8999 \else\ifx\ \tokenafterxref ,% @SPACE
9000 \else\ifx\
9001 \tokenafterxref ,% @NL
9002 \else\ifx\tie\tokenafterxref ,% @tie
9003 \fi\fi\fi\fi\fi\fi
9004 \fi\fi
9006 \endlink
9007 \endgroup}
9009 % Output a cross-manual xref to #1. Used just above (twice).
9011 % Only include the text "Section ``foo'' in" if the foo is neither
9012 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
9013 % "see The Foo Manual", the idea being to refer to the whole manual.
9015 % But, this being TeX, we can't easily compare our node name against the
9016 % string "Top" while ignoring the possible spaces before and after in
9017 % the input. By adding the arbitrary 7sp below, we make it much less
9018 % likely that a real node name would have the same width as "Top" (e.g.,
9019 % in a monospaced font). Hopefully it will never happen in practice.
9021 % For the same basic reason, we retypeset the "Top" at every
9022 % reference, since the current font is indeterminate.
9024 \def\crossmanualxref#1{%
9025 \setbox\toprefbox = \hbox{Top\kern7sp}%
9026 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
9027 \ifdim \wd2 > 7sp % nonempty?
9028 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
9029 \putwordSection{} ``\printedrefname'' \putwordin{}\space
9035 % This macro is called from \xrefX for the `[nodename]' part of xref
9036 % output. It's a separate macro only so it can be changed more easily,
9037 % since square brackets don't work well in some documents. Particularly
9038 % one that Bob is working on :).
9040 \def\xrefprintnodename#1{[#1]}
9042 % Things referred to by \setref.
9044 \def\Ynothing{}
9045 \def\Yomitfromtoc{}
9046 \def\Ynumbered{%
9047 \ifnum\secno=0
9048 \putwordChapter@tie \the\chapno
9049 \else \ifnum\subsecno=0
9050 \putwordSection@tie \the\chapno.\the\secno
9051 \else \ifnum\subsubsecno=0
9052 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9053 \else
9054 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9055 \fi\fi\fi
9057 \def\Yappendix{%
9058 \ifnum\secno=0
9059 \putwordAppendix@tie @char\the\appendixno{}%
9060 \else \ifnum\subsecno=0
9061 \putwordSection@tie @char\the\appendixno.\the\secno
9062 \else \ifnum\subsubsecno=0
9063 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9064 \else
9065 \putwordSection@tie
9066 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9067 \fi\fi\fi
9070 % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
9071 % is output afterwards if non-empty.
9072 \def\refx#1#2{%
9073 \requireauxfile
9075 \indexnofonts
9076 \otherbackslash
9077 \def\value##1{##1}%
9078 \expandafter\global\expandafter\let\expandafter\thisrefX
9079 \csname XR#1\endcsname
9081 \ifx\thisrefX\relax
9082 % If not defined, say something at least.
9083 \angleleft un\-de\-fined\angleright
9084 \iflinks
9085 \ifhavexrefs
9086 {\toks0 = {#1}% avoid expansion of possibly-complex value
9087 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9088 \else
9089 \ifwarnedxrefs\else
9090 \global\warnedxrefstrue
9091 \message{Cross reference values unknown; you must run TeX again.}%
9095 \else
9096 % It's defined, so just use it.
9097 \thisrefX
9099 #2% Output the suffix in any case.
9102 % This is the macro invoked by entries in the aux file. Define a control
9103 % sequence for a cross-reference target (we prepend XR to the control sequence
9104 % name to avoid collisions). The value is the page number. If this is a float
9105 % type, we have more work to do.
9107 \def\xrdef#1#2{%
9108 {% Expand the node or anchor name to remove control sequences.
9109 % \turnoffactive stops 8-bit characters being changed to commands
9110 % like @'e. \refx does the same to retrieve the value in the definition.
9111 \indexnofonts
9112 \turnoffactive
9113 \def\value##1{##1}%
9114 \xdef\safexrefname{#1}%
9117 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
9119 % Was that xref control sequence that we just defined for a float?
9120 \expandafter\iffloat\csname XR\safexrefname\endcsname
9121 % it was a float, and we have the (safe) float type in \iffloattype.
9122 \expandafter\let\expandafter\floatlist
9123 \csname floatlist\iffloattype\endcsname
9125 % Is this the first time we've seen this float type?
9126 \expandafter\ifx\floatlist\relax
9127 \toks0 = {\do}% yes, so just \do
9128 \else
9129 % had it before, so preserve previous elements in list.
9130 \toks0 = \expandafter{\floatlist\do}%
9133 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9134 % for later use in \listoffloats.
9135 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9136 {\safexrefname}}%
9140 % If working on a large document in chapters, it is convenient to
9141 % be able to disable indexing, cross-referencing, and contents, for test runs.
9142 % This is done with @novalidate at the beginning of the file.
9144 \newif\iflinks \linkstrue % by default we want the aux files.
9145 \let\novalidate = \linksfalse
9147 % Used when writing to the aux file, or when using data from it.
9148 \def\requireauxfile{%
9149 \iflinks
9150 \tryauxfile
9151 % Open the new aux file. TeX will close it automatically at exit.
9152 \immediate\openout\auxfile=\jobname.aux
9154 \global\let\requireauxfile=\relax % Only do this once.
9157 % Read the last existing aux file, if any. No error if none exists.
9159 \def\tryauxfile{%
9160 \openin 1 \jobname.aux
9161 \ifeof 1 \else
9162 \readdatafile{aux}%
9163 \global\havexrefstrue
9165 \closein 1
9168 \def\setupdatafile{%
9169 \catcode`\^^@=\other
9170 \catcode`\^^A=\other
9171 \catcode`\^^B=\other
9172 \catcode`\^^C=\other
9173 \catcode`\^^D=\other
9174 \catcode`\^^E=\other
9175 \catcode`\^^F=\other
9176 \catcode`\^^G=\other
9177 \catcode`\^^H=\other
9178 \catcode`\^^K=\other
9179 \catcode`\^^L=\other
9180 \catcode`\^^N=\other
9181 \catcode`\^^P=\other
9182 \catcode`\^^Q=\other
9183 \catcode`\^^R=\other
9184 \catcode`\^^S=\other
9185 \catcode`\^^T=\other
9186 \catcode`\^^U=\other
9187 \catcode`\^^V=\other
9188 \catcode`\^^W=\other
9189 \catcode`\^^X=\other
9190 \catcode`\^^Z=\other
9191 \catcode`\^^[=\other
9192 \catcode`\^^\=\other
9193 \catcode`\^^]=\other
9194 \catcode`\^^^=\other
9195 \catcode`\^^_=\other
9196 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
9197 % in xref tags, i.e., node names. But since ^^e4 notation isn't
9198 % supported in the main text, it doesn't seem desirable. Furthermore,
9199 % that is not enough: for node names that actually contain a ^
9200 % character, we would end up writing a line like this: 'xrdef {'hat
9201 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
9202 % argument, and \hat is not an expandable control sequence. It could
9203 % all be worked out, but why? Either we support ^^ or we don't.
9205 % The other change necessary for this was to define \auxhat:
9206 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
9207 % and then to call \auxhat in \setq.
9209 \catcode`\^=\other
9211 % Special characters. Should be turned off anyway, but...
9212 \catcode`\~=\other
9213 \catcode`\[=\other
9214 \catcode`\]=\other
9215 \catcode`\"=\other
9216 \catcode`\_=\other
9217 \catcode`\|=\other
9218 \catcode`\<=\other
9219 \catcode`\>=\other
9220 \catcode`\$=\other
9221 \catcode`\#=\other
9222 \catcode`\&=\other
9223 \catcode`\%=\other
9224 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9226 % This is to support \ in node names and titles, since the \
9227 % characters end up in a \csname. It's easier than
9228 % leaving it active and making its active definition an actual \
9229 % character. What I don't understand is why it works in the *value*
9230 % of the xrdef. Seems like it should be a catcode12 \, and that
9231 % should not typeset properly. But it works, so I'm moving on for
9232 % now. --karl, 15jan04.
9233 \catcode`\\=\other
9235 % @ is our escape character in .aux files, and we need braces.
9236 \catcode`\{=1
9237 \catcode`\}=2
9238 \catcode`\@=0
9241 \def\readdatafile#1{%
9242 \begingroup
9243 \setupdatafile
9244 \input\jobname.#1
9245 \endgroup}
9248 \message{insertions,}
9249 % including footnotes.
9251 \newcount \footnoteno
9253 % The trailing space in the following definition for supereject is
9254 % vital for proper filling; pages come out unaligned when you do a
9255 % pagealignmacro call if that space before the closing brace is
9256 % removed. (Generally, numeric constants should always be followed by a
9257 % space to prevent strange expansion errors.)
9258 \def\supereject{\par\penalty -20000\footnoteno =0 }
9260 % @footnotestyle is meaningful for Info output only.
9261 \let\footnotestyle=\comment
9263 {\catcode `\@=11
9265 % Auto-number footnotes. Otherwise like plain.
9266 \gdef\footnote{%
9267 \global\advance\footnoteno by \@ne
9268 \edef\thisfootno{$^{\the\footnoteno}$}%
9270 % In case the footnote comes at the end of a sentence, preserve the
9271 % extra spacing after we do the footnote number.
9272 \let\@sf\empty
9273 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9275 % Remove inadvertent blank space before typesetting the footnote number.
9276 \unskip
9277 \thisfootno\@sf
9278 \dofootnote
9281 % Don't bother with the trickery in plain.tex to not require the
9282 % footnote text as a parameter. Our footnotes don't need to be so general.
9284 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9285 % \parseargline) fails inside footnotes because the tokens are fixed when
9286 % the footnote is read. --karl, 16nov96.
9288 \gdef\dofootnote{%
9289 \insert\footins\bgroup
9291 % Nested footnotes are not supported in TeX, that would take a lot
9292 % more work. (\startsavinginserts does not suffice.)
9293 \let\footnote=\errfootnotenest
9295 % We want to typeset this text as a normal paragraph, even if the
9296 % footnote reference occurs in (for example) a display environment.
9297 % So reset some parameters.
9298 \hsize=\txipagewidth
9299 \interlinepenalty\interfootnotelinepenalty
9300 \splittopskip\ht\strutbox % top baseline for broken footnotes
9301 \splitmaxdepth\dp\strutbox
9302 \floatingpenalty\@MM
9303 \leftskip\z@skip
9304 \rightskip\z@skip
9305 \spaceskip\z@skip
9306 \xspaceskip\z@skip
9307 \parindent\defaultparindent
9309 \smallfonts \rm
9311 % Because we use hanging indentation in footnotes, a @noindent appears
9312 % to exdent this text, so make it be a no-op. makeinfo does not use
9313 % hanging indentation so @noindent can still be needed within footnote
9314 % text after an @example or the like (not that this is good style).
9315 \let\noindent = \relax
9317 % Hang the footnote text off the number. Use \everypar in case the
9318 % footnote extends for more than one paragraph.
9319 \everypar = {\hang}%
9320 \textindent{\thisfootno}%
9322 % Don't crash into the line above the footnote text. Since this
9323 % expands into a box, it must come within the paragraph, lest it
9324 % provide a place where TeX can split the footnote.
9325 \footstrut
9327 % Invoke rest of plain TeX footnote routine.
9328 \futurelet\next\fo@t
9330 }%end \catcode `\@=11
9332 \def\errfootnotenest{%
9333 \errhelp=\EMsimple
9334 \errmessage{Nested footnotes not supported in texinfo.tex,
9335 even though they work in makeinfo; sorry}
9338 \def\errfootnoteheading{%
9339 \errhelp=\EMsimple
9340 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9343 % In case a @footnote appears in a vbox, save the footnote text and create
9344 % the real \insert just after the vbox finished. Otherwise, the insertion
9345 % would be lost.
9346 % Similarly, if a @footnote appears inside an alignment, save the footnote
9347 % text to a box and make the \insert when a row of the table is finished.
9348 % And the same can be done for other insert classes. --kasal, 16nov03.
9350 % Replace the \insert primitive by a cheating macro.
9351 % Deeper inside, just make sure that the saved insertions are not spilled
9352 % out prematurely.
9354 \def\startsavinginserts{%
9355 \ifx \insert\ptexinsert
9356 \let\insert\saveinsert
9357 \else
9358 \let\checkinserts\relax
9362 % This \insert replacement works for both \insert\footins{foo} and
9363 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9365 \def\saveinsert#1{%
9366 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9367 \afterassignment\next
9368 % swallow the left brace
9369 \let\temp =
9371 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9372 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9374 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9376 \def\placesaveins#1{%
9377 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9378 {\box#1}%
9381 % eat @SAVE -- beware, all of them have catcode \other:
9383 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9384 \gdef\gobblesave @SAVE{}
9387 % initialization:
9388 \def\newsaveins #1{%
9389 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9390 \next
9392 \def\newsaveinsX #1{%
9393 \csname newbox\endcsname #1%
9394 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9395 \checksaveins #1}%
9398 % initialize:
9399 \let\checkinserts\empty
9400 \newsaveins\footins
9401 \newsaveins\margin
9404 % @image. We use the macros from epsf.tex to support this.
9405 % If epsf.tex is not installed and @image is used, we complain.
9407 % Check for and read epsf.tex up front. If we read it only at @image
9408 % time, we might be inside a group, and then its definitions would get
9409 % undone and the next image would fail.
9410 \openin 1 = epsf.tex
9411 \ifeof 1 \else
9412 % Do not bother showing banner with epsf.tex v2.7k (available in
9413 % doc/epsf.tex and on ctan).
9414 \def\epsfannounce{\toks0 = }%
9415 \input epsf.tex
9417 \closein 1
9419 % We will only complain once about lack of epsf.tex.
9420 \newif\ifwarnednoepsf
9421 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9422 work. It is also included in the Texinfo distribution, or you can get
9423 it from ftp://tug.org/tex/epsf.tex.}
9425 \def\image#1{%
9426 \ifx\epsfbox\thisisundefined
9427 \ifwarnednoepsf \else
9428 \errhelp = \noepsfhelp
9429 \errmessage{epsf.tex not found, images will be ignored}%
9430 \global\warnednoepsftrue
9432 \else
9433 \imagexxx #1,,,,,\finish
9437 % Arguments to @image:
9438 % #1 is (mandatory) image filename; we tack on .eps extension.
9439 % #2 is (optional) width, #3 is (optional) height.
9440 % #4 is (ignored optional) html alt text.
9441 % #5 is (ignored optional) extension.
9442 % #6 is just the usual extra ignored arg for parsing stuff.
9443 \newif\ifimagevmode
9444 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9445 \catcode`\^^M = 5 % in case we're inside an example
9446 \normalturnoffactive % allow _ et al. in names
9447 \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
9448 % If the image is by itself, center it.
9449 \ifvmode
9450 \imagevmodetrue
9451 \else \ifx\centersub\centerV
9452 % for @center @image, we need a vbox so we can have our vertical space
9453 \imagevmodetrue
9454 \vbox\bgroup % vbox has better behavior than vtop herev
9455 \fi\fi
9457 \ifimagevmode
9458 \nobreak\medskip
9459 % Usually we'll have text after the image which will insert
9460 % \parskip glue, so insert it here too to equalize the space
9461 % above and below.
9462 \nobreak\vskip\parskip
9463 \nobreak
9466 % Leave vertical mode so that indentation from an enclosing
9467 % environment such as @quotation is respected.
9468 % However, if we're at the top level, we don't want the
9469 % normal paragraph indentation.
9470 % On the other hand, if we are in the case of @center @image, we don't
9471 % want to start a paragraph, which will create a hsize-width box and
9472 % eradicate the centering.
9473 \ifx\centersub\centerV\else \noindent \fi
9475 % Output the image.
9476 \ifpdf
9477 % For pdfTeX and LuaTeX <= 0.80
9478 \dopdfimage{#1}{#2}{#3}%
9479 \else
9480 \ifx\XeTeXrevision\thisisundefined
9481 % For epsf.tex
9482 % \epsfbox itself resets \epsf?size at each figure.
9483 \setbox0 = \hbox{\ignorespaces #2}%
9484 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9485 \setbox0 = \hbox{\ignorespaces #3}%
9486 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9487 \epsfbox{#1.eps}%
9488 \else
9489 % For XeTeX
9490 \doxeteximage{#1}{#2}{#3}%
9494 \ifimagevmode
9495 \medskip % space after a standalone image
9496 \fi
9497 \ifx\centersub\centerV \egroup \fi
9498 \endgroup}
9501 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9502 % etc. We don't actually implement floating yet, we always include the
9503 % float "here". But it seemed the best name for the future.
9505 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9507 % There may be a space before second and/or third parameter; delete it.
9508 \def\eatcommaspace#1, {#1,}
9510 % #1 is the optional FLOATTYPE, the text label for this float, typically
9511 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9512 % this float will not be numbered and cannot be referred to.
9514 % #2 is the optional xref label. Also must be present for the float to
9515 % be referable.
9517 % #3 is the optional positioning argument; for now, it is ignored. It
9518 % will somehow specify the positions allowed to float to (here, top, bottom).
9520 % We keep a separate counter for each FLOATTYPE, which we reset at each
9521 % chapter-level command.
9522 \let\resetallfloatnos=\empty
9524 \def\dofloat#1,#2,#3,#4\finish{%
9525 \let\thiscaption=\empty
9526 \let\thisshortcaption=\empty
9528 % don't lose footnotes inside @float.
9530 % BEWARE: when the floats start float, we have to issue warning whenever an
9531 % insert appears inside a float which could possibly float. --kasal, 26may04
9533 \startsavinginserts
9535 % We can't be used inside a paragraph.
9536 \par
9538 \vtop\bgroup
9539 \def\floattype{#1}%
9540 \def\floatlabel{#2}%
9541 \def\floatloc{#3}% we do nothing with this yet.
9543 \ifx\floattype\empty
9544 \let\safefloattype=\empty
9545 \else
9547 % the floattype might have accents or other special characters,
9548 % but we need to use it in a control sequence name.
9549 \indexnofonts
9550 \turnoffactive
9551 \xdef\safefloattype{\floattype}%
9555 % If label is given but no type, we handle that as the empty type.
9556 \ifx\floatlabel\empty \else
9557 % We want each FLOATTYPE to be numbered separately (Figure 1,
9558 % Table 1, Figure 2, ...). (And if no label, no number.)
9560 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9561 \global\advance\floatno by 1
9564 % This magic value for \lastsection is output by \setref as the
9565 % XREFLABEL-title value. \xrefX uses it to distinguish float
9566 % labels (which have a completely different output format) from
9567 % node and anchor labels. And \xrdef uses it to construct the
9568 % lists of floats.
9570 \edef\lastsection{\floatmagic=\safefloattype}%
9571 \setref{\floatlabel}{Yfloat}%
9575 % start with \parskip glue, I guess.
9576 \vskip\parskip
9578 % Don't suppress indentation if a float happens to start a section.
9579 \restorefirstparagraphindent
9582 % we have these possibilities:
9583 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9584 % @float Foo,lbl & no caption: Foo 1.1
9585 % @float Foo & @caption{Cap}: Foo: Cap
9586 % @float Foo & no caption: Foo
9587 % @float ,lbl & Caption{Cap}: 1.1: Cap
9588 % @float ,lbl & no caption: 1.1
9589 % @float & @caption{Cap}: Cap
9590 % @float & no caption:
9592 \def\Efloat{%
9593 \let\floatident = \empty
9595 % In all cases, if we have a float type, it comes first.
9596 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9598 % If we have an xref label, the number comes next.
9599 \ifx\floatlabel\empty \else
9600 \ifx\floattype\empty \else % if also had float type, need tie first.
9601 \appendtomacro\floatident{\tie}%
9603 % the number.
9604 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9607 % Start the printed caption with what we've constructed in
9608 % \floatident, but keep it separate; we need \floatident again.
9609 \let\captionline = \floatident
9611 \ifx\thiscaption\empty \else
9612 \ifx\floatident\empty \else
9613 \appendtomacro\captionline{: }% had ident, so need a colon between
9616 % caption text.
9617 \appendtomacro\captionline{\scanexp\thiscaption}%
9620 % If we have anything to print, print it, with space before.
9621 % Eventually this needs to become an \insert.
9622 \ifx\captionline\empty \else
9623 \vskip.5\parskip
9624 \captionline
9626 % Space below caption.
9627 \vskip\parskip
9630 % If have an xref label, write the list of floats info. Do this
9631 % after the caption, to avoid chance of it being a breakpoint.
9632 \ifx\floatlabel\empty \else
9633 % Write the text that goes in the lof to the aux file as
9634 % \floatlabel-lof. Besides \floatident, we include the short
9635 % caption if specified, else the full caption if specified, else nothing.
9637 \requireauxfile
9638 \atdummies
9640 \ifx\thisshortcaption\empty
9641 \def\gtemp{\thiscaption}%
9642 \else
9643 \def\gtemp{\thisshortcaption}%
9645 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9646 \ifx\gtemp\empty \else : \gtemp \fi}}%
9649 \egroup % end of \vtop
9651 \checkinserts
9654 % Append the tokens #2 to the definition of macro #1, not expanding either.
9656 \def\appendtomacro#1#2{%
9657 \expandafter\def\expandafter#1\expandafter{#1#2}%
9660 % @caption, @shortcaption
9662 \def\caption{\docaption\thiscaption}
9663 \def\shortcaption{\docaption\thisshortcaption}
9664 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9665 \def\defcaption#1#2{\egroup \def#1{#2}}
9667 % The parameter is the control sequence identifying the counter we are
9668 % going to use. Create it if it doesn't exist and assign it to \floatno.
9669 \def\getfloatno#1{%
9670 \ifx#1\relax
9671 % Haven't seen this figure type before.
9672 \csname newcount\endcsname #1%
9674 % Remember to reset this floatno at the next chap.
9675 \expandafter\gdef\expandafter\resetallfloatnos
9676 \expandafter{\resetallfloatnos #1=0 }%
9678 \let\floatno#1%
9681 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9682 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9683 % first read the @float command.
9685 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9687 % Magic string used for the XREFLABEL-title value, so \xrefX can
9688 % distinguish floats from other xref types.
9689 \def\floatmagic{!!float!!}
9691 % #1 is the control sequence we are passed; we expand into a conditional
9692 % which is true if #1 represents a float ref. That is, the magic
9693 % \lastsection value which we \setref above.
9695 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9697 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9698 % (safe) float type for this float. We set \iffloattype to #2.
9700 \def\doiffloat#1=#2=#3\finish{%
9701 \def\temp{#1}%
9702 \def\iffloattype{#2}%
9703 \ifx\temp\floatmagic
9706 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9708 \parseargdef\listoffloats{%
9709 \def\floattype{#1}% floattype
9711 % the floattype might have accents or other special characters,
9712 % but we need to use it in a control sequence name.
9713 \indexnofonts
9714 \turnoffactive
9715 \xdef\safefloattype{\floattype}%
9718 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9719 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9720 \ifhavexrefs
9721 % if the user said @listoffloats foo but never @float foo.
9722 \message{\linenumber No `\safefloattype' floats to list.}%
9724 \else
9725 \begingroup
9726 \leftskip=\tocindent % indent these entries like a toc
9727 \let\do=\listoffloatsdo
9728 \csname floatlist\safefloattype\endcsname
9729 \endgroup
9733 % This is called on each entry in a list of floats. We're passed the
9734 % xref label, in the form LABEL-title, which is how we save it in the
9735 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9736 % has the text we're supposed to typeset here.
9738 % Figures without xref labels will not be included in the list (since
9739 % they won't appear in the aux file).
9741 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9742 \def\listoffloatsdoentry#1-title\finish{{%
9743 % Can't fully expand XR#1-lof because it can contain anything. Just
9744 % pass the control sequence. On the other hand, XR#1-pg is just the
9745 % page number, and we want to fully expand that so we can get a link
9746 % in pdf output.
9747 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9749 % use the same \entry macro we use to generate the TOC and index.
9750 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9751 \writeentry
9755 \message{localization,}
9757 % For single-language documents, @documentlanguage is usually given very
9758 % early, just after @documentencoding. Single argument is the language
9759 % (de) or locale (de_DE) abbreviation.
9762 \catcode`\_ = \active
9763 \globaldefs=1
9764 \parseargdef\documentlanguage{%
9765 \tex % read txi-??.tex file in plain TeX.
9766 % Read the file by the name they passed if it exists.
9767 \let_ = \normalunderscore % normal _ character for filename test
9768 \openin 1 txi-#1.tex
9769 \ifeof 1
9770 \documentlanguagetrywithoutunderscore #1_\finish
9771 \else
9772 \globaldefs = 1 % everything in the txi-LL files needs to persist
9773 \input txi-#1.tex
9775 \closein 1
9776 \endgroup % end raw TeX
9779 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9780 % try txi-de.tex.
9782 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9783 \openin 1 txi-#1.tex
9784 \ifeof 1
9785 \errhelp = \nolanghelp
9786 \errmessage{Cannot read language file txi-#1.tex}%
9787 \else
9788 \globaldefs = 1 % everything in the txi-LL files needs to persist
9789 \input txi-#1.tex
9791 \closein 1
9793 }% end of special _ catcode
9795 \newhelp\nolanghelp{The given language definition file cannot be found or
9796 is empty. Maybe you need to install it? Putting it in the current
9797 directory should work if nowhere else does.}
9799 % This macro is called from txi-??.tex files; the first argument is the
9800 % \language name to set (without the "\lang@" prefix), the second and
9801 % third args are \{left,right}hyphenmin.
9803 % The language names to pass are determined when the format is built.
9804 % See the etex.log file created at that time, e.g.,
9805 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9807 % With TeX Live 2008, etex now includes hyphenation patterns for all
9808 % available languages. This means we can support hyphenation in
9809 % Texinfo, at least to some extent. (This still doesn't solve the
9810 % accented characters problem.)
9812 \catcode`@=11
9813 \def\txisetlanguage#1#2#3{%
9814 % do not set the language if the name is undefined in the current TeX.
9815 \expandafter\ifx\csname lang@#1\endcsname \relax
9816 \message{no patterns for #1}%
9817 \else
9818 \global\language = \csname lang@#1\endcsname
9820 % but there is no harm in adjusting the hyphenmin values regardless.
9821 \global\lefthyphenmin = #2\relax
9822 \global\righthyphenmin = #3\relax
9825 % XeTeX and LuaTeX can handle Unicode natively.
9826 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9827 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9829 \newif\iftxinativeunicodecapable
9830 \newif\iftxiusebytewiseio
9832 \ifx\XeTeXrevision\thisisundefined
9833 \ifx\luatexversion\thisisundefined
9834 \txinativeunicodecapablefalse
9835 \txiusebytewiseiotrue
9836 \else
9837 \txinativeunicodecapabletrue
9838 \txiusebytewiseiofalse
9840 \else
9841 \txinativeunicodecapabletrue
9842 \txiusebytewiseiofalse
9845 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9846 % for non-UTF-8 (byte-wise) encodings.
9848 \def\setbytewiseio{%
9849 \ifx\XeTeXrevision\thisisundefined
9850 \else
9851 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9852 \XeTeXinputencoding "bytes" % For document root file
9853 % Unfortunately, there seems to be no corresponding XeTeX command for
9854 % output encoding. This is a problem for auxiliary index and TOC files.
9855 % The only solution would be perhaps to write out @U{...} sequences in
9856 % place of non-ASCII characters.
9859 \ifx\luatexversion\thisisundefined
9860 \else
9861 \directlua{
9862 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9863 local function convert_char (char)
9864 return utf8_char(byte(char))
9867 local function convert_line (line)
9868 return gsub(line, ".", convert_char)
9871 callback.register("process_input_buffer", convert_line)
9873 local function convert_line_out (line)
9874 local line_out = ""
9875 for c in string.utfvalues(line) do
9876 line_out = line_out .. string.char(c)
9878 return line_out
9881 callback.register("process_output_buffer", convert_line_out)
9885 \txiusebytewiseiotrue
9889 % Helpers for encodings.
9890 % Set the catcode of characters 128 through 255 to the specified number.
9892 \def\setnonasciicharscatcode#1{%
9893 \count255=128
9894 \loop\ifnum\count255<256
9895 \global\catcode\count255=#1\relax
9896 \advance\count255 by 1
9897 \repeat
9900 \def\setnonasciicharscatcodenonglobal#1{%
9901 \count255=128
9902 \loop\ifnum\count255<256
9903 \catcode\count255=#1\relax
9904 \advance\count255 by 1
9905 \repeat
9908 % @documentencoding sets the definition of non-ASCII characters
9909 % according to the specified encoding.
9911 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9912 \def\documentencodingzzz#1{%
9914 % Encoding being declared for the document.
9915 \def\declaredencoding{\csname #1.enc\endcsname}%
9917 % Supported encodings: names converted to tokens in order to be able
9918 % to compare them with \ifx.
9919 \def\ascii{\csname US-ASCII.enc\endcsname}%
9920 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9921 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9922 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9923 \def\utfeight{\csname UTF-8.enc\endcsname}%
9925 \ifx \declaredencoding \ascii
9926 \asciichardefs
9928 \else \ifx \declaredencoding \lattwo
9929 \iftxinativeunicodecapable
9930 \setbytewiseio
9932 \setnonasciicharscatcode\active
9933 \lattwochardefs
9935 \else \ifx \declaredencoding \latone
9936 \iftxinativeunicodecapable
9937 \setbytewiseio
9939 \setnonasciicharscatcode\active
9940 \latonechardefs
9942 \else \ifx \declaredencoding \latnine
9943 \iftxinativeunicodecapable
9944 \setbytewiseio
9946 \setnonasciicharscatcode\active
9947 \latninechardefs
9949 \else \ifx \declaredencoding \utfeight
9950 \iftxinativeunicodecapable
9951 % For native Unicode handling (XeTeX and LuaTeX)
9952 \nativeunicodechardefs
9953 \else
9954 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
9955 \setnonasciicharscatcode\active
9956 % since we already invoked \utfeightchardefs at the top level
9957 % (below), do not re-invoke it, otherwise our check for duplicated
9958 % definitions gets triggered. Making non-ascii chars active is
9959 % sufficient.
9962 \else
9963 \message{Ignoring unknown document encoding: #1.}%
9965 \fi % utfeight
9966 \fi % latnine
9967 \fi % latone
9968 \fi % lattwo
9969 \fi % ascii
9971 \ifx\XeTeXrevision\thisisundefined
9972 \else
9973 \ifx \declaredencoding \utfeight
9974 \else
9975 \ifx \declaredencoding \ascii
9976 \else
9977 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
9978 non-ASCII characters in auxiallity files.}%
9984 % emacs-page
9985 % A message to be logged when using a character that isn't available
9986 % the default font encoding (OT1).
9988 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9990 % Take account of \c (plain) vs. \, (Texinfo) difference.
9991 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9993 % First, make active non-ASCII characters in order for them to be
9994 % correctly categorized when TeX reads the replacement text of
9995 % macros containing the character definitions.
9996 \setnonasciicharscatcode\active
9999 \def\gdefchar#1#2{%
10000 \gdef#1{%
10001 \ifpassthroughchars
10002 \string#1%
10003 \else
10008 % Latin1 (ISO-8859-1) character definitions.
10009 \def\latonechardefs{%
10010 \gdefchar^^a0{\tie}
10011 \gdefchar^^a1{\exclamdown}
10012 \gdefchar^^a2{{\tcfont \char162}} % cent
10013 \gdefchar^^a3{\pounds}
10014 \gdefchar^^a4{{\tcfont \char164}} % currency
10015 \gdefchar^^a5{{\tcfont \char165}} % yen
10016 \gdefchar^^a6{{\tcfont \char166}} % broken bar
10017 \gdefchar^^a7{\S}
10018 \gdefchar^^a8{\"{}}
10019 \gdefchar^^a9{\copyright}
10020 \gdefchar^^aa{\ordf}
10021 \gdefchar^^ab{\guillemetleft}
10022 \gdefchar^^ac{\ensuremath\lnot}
10023 \gdefchar^^ad{\-}
10024 \gdefchar^^ae{\registeredsymbol}
10025 \gdefchar^^af{\={}}
10027 \gdefchar^^b0{\textdegree}
10028 \gdefchar^^b1{$\pm$}
10029 \gdefchar^^b2{$^2$}
10030 \gdefchar^^b3{$^3$}
10031 \gdefchar^^b4{\'{}}
10032 \gdefchar^^b5{$\mu$}
10033 \gdefchar^^b6{\P}
10034 \gdefchar^^b7{\ensuremath\cdot}
10035 \gdefchar^^b8{\cedilla\ }
10036 \gdefchar^^b9{$^1$}
10037 \gdefchar^^ba{\ordm}
10038 \gdefchar^^bb{\guillemetright}
10039 \gdefchar^^bc{$1\over4$}
10040 \gdefchar^^bd{$1\over2$}
10041 \gdefchar^^be{$3\over4$}
10042 \gdefchar^^bf{\questiondown}
10044 \gdefchar^^c0{\`A}
10045 \gdefchar^^c1{\'A}
10046 \gdefchar^^c2{\^A}
10047 \gdefchar^^c3{\~A}
10048 \gdefchar^^c4{\"A}
10049 \gdefchar^^c5{\ringaccent A}
10050 \gdefchar^^c6{\AE}
10051 \gdefchar^^c7{\cedilla C}
10052 \gdefchar^^c8{\`E}
10053 \gdefchar^^c9{\'E}
10054 \gdefchar^^ca{\^E}
10055 \gdefchar^^cb{\"E}
10056 \gdefchar^^cc{\`I}
10057 \gdefchar^^cd{\'I}
10058 \gdefchar^^ce{\^I}
10059 \gdefchar^^cf{\"I}
10061 \gdefchar^^d0{\DH}
10062 \gdefchar^^d1{\~N}
10063 \gdefchar^^d2{\`O}
10064 \gdefchar^^d3{\'O}
10065 \gdefchar^^d4{\^O}
10066 \gdefchar^^d5{\~O}
10067 \gdefchar^^d6{\"O}
10068 \gdefchar^^d7{$\times$}
10069 \gdefchar^^d8{\O}
10070 \gdefchar^^d9{\`U}
10071 \gdefchar^^da{\'U}
10072 \gdefchar^^db{\^U}
10073 \gdefchar^^dc{\"U}
10074 \gdefchar^^dd{\'Y}
10075 \gdefchar^^de{\TH}
10076 \gdefchar^^df{\ss}
10078 \gdefchar^^e0{\`a}
10079 \gdefchar^^e1{\'a}
10080 \gdefchar^^e2{\^a}
10081 \gdefchar^^e3{\~a}
10082 \gdefchar^^e4{\"a}
10083 \gdefchar^^e5{\ringaccent a}
10084 \gdefchar^^e6{\ae}
10085 \gdefchar^^e7{\cedilla c}
10086 \gdefchar^^e8{\`e}
10087 \gdefchar^^e9{\'e}
10088 \gdefchar^^ea{\^e}
10089 \gdefchar^^eb{\"e}
10090 \gdefchar^^ec{\`{\dotless i}}
10091 \gdefchar^^ed{\'{\dotless i}}
10092 \gdefchar^^ee{\^{\dotless i}}
10093 \gdefchar^^ef{\"{\dotless i}}
10095 \gdefchar^^f0{\dh}
10096 \gdefchar^^f1{\~n}
10097 \gdefchar^^f2{\`o}
10098 \gdefchar^^f3{\'o}
10099 \gdefchar^^f4{\^o}
10100 \gdefchar^^f5{\~o}
10101 \gdefchar^^f6{\"o}
10102 \gdefchar^^f7{$\div$}
10103 \gdefchar^^f8{\o}
10104 \gdefchar^^f9{\`u}
10105 \gdefchar^^fa{\'u}
10106 \gdefchar^^fb{\^u}
10107 \gdefchar^^fc{\"u}
10108 \gdefchar^^fd{\'y}
10109 \gdefchar^^fe{\th}
10110 \gdefchar^^ff{\"y}
10113 % Latin9 (ISO-8859-15) encoding character definitions.
10114 \def\latninechardefs{%
10115 % Encoding is almost identical to Latin1.
10116 \latonechardefs
10118 \gdefchar^^a4{\euro}
10119 \gdefchar^^a6{\v S}
10120 \gdefchar^^a8{\v s}
10121 \gdefchar^^b4{\v Z}
10122 \gdefchar^^b8{\v z}
10123 \gdefchar^^bc{\OE}
10124 \gdefchar^^bd{\oe}
10125 \gdefchar^^be{\"Y}
10128 % Latin2 (ISO-8859-2) character definitions.
10129 \def\lattwochardefs{%
10130 \gdefchar^^a0{\tie}
10131 \gdefchar^^a1{\ogonek{A}}
10132 \gdefchar^^a2{\u{}}
10133 \gdefchar^^a3{\L}
10134 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10135 \gdefchar^^a5{\v L}
10136 \gdefchar^^a6{\'S}
10137 \gdefchar^^a7{\S}
10138 \gdefchar^^a8{\"{}}
10139 \gdefchar^^a9{\v S}
10140 \gdefchar^^aa{\cedilla S}
10141 \gdefchar^^ab{\v T}
10142 \gdefchar^^ac{\'Z}
10143 \gdefchar^^ad{\-}
10144 \gdefchar^^ae{\v Z}
10145 \gdefchar^^af{\dotaccent Z}
10147 \gdefchar^^b0{\textdegree}
10148 \gdefchar^^b1{\ogonek{a}}
10149 \gdefchar^^b2{\ogonek{ }}
10150 \gdefchar^^b3{\l}
10151 \gdefchar^^b4{\'{}}
10152 \gdefchar^^b5{\v l}
10153 \gdefchar^^b6{\'s}
10154 \gdefchar^^b7{\v{}}
10155 \gdefchar^^b8{\cedilla\ }
10156 \gdefchar^^b9{\v s}
10157 \gdefchar^^ba{\cedilla s}
10158 \gdefchar^^bb{\v t}
10159 \gdefchar^^bc{\'z}
10160 \gdefchar^^bd{\H{}}
10161 \gdefchar^^be{\v z}
10162 \gdefchar^^bf{\dotaccent z}
10164 \gdefchar^^c0{\'R}
10165 \gdefchar^^c1{\'A}
10166 \gdefchar^^c2{\^A}
10167 \gdefchar^^c3{\u A}
10168 \gdefchar^^c4{\"A}
10169 \gdefchar^^c5{\'L}
10170 \gdefchar^^c6{\'C}
10171 \gdefchar^^c7{\cedilla C}
10172 \gdefchar^^c8{\v C}
10173 \gdefchar^^c9{\'E}
10174 \gdefchar^^ca{\ogonek{E}}
10175 \gdefchar^^cb{\"E}
10176 \gdefchar^^cc{\v E}
10177 \gdefchar^^cd{\'I}
10178 \gdefchar^^ce{\^I}
10179 \gdefchar^^cf{\v D}
10181 \gdefchar^^d0{\DH}
10182 \gdefchar^^d1{\'N}
10183 \gdefchar^^d2{\v N}
10184 \gdefchar^^d3{\'O}
10185 \gdefchar^^d4{\^O}
10186 \gdefchar^^d5{\H O}
10187 \gdefchar^^d6{\"O}
10188 \gdefchar^^d7{$\times$}
10189 \gdefchar^^d8{\v R}
10190 \gdefchar^^d9{\ringaccent U}
10191 \gdefchar^^da{\'U}
10192 \gdefchar^^db{\H U}
10193 \gdefchar^^dc{\"U}
10194 \gdefchar^^dd{\'Y}
10195 \gdefchar^^de{\cedilla T}
10196 \gdefchar^^df{\ss}
10198 \gdefchar^^e0{\'r}
10199 \gdefchar^^e1{\'a}
10200 \gdefchar^^e2{\^a}
10201 \gdefchar^^e3{\u a}
10202 \gdefchar^^e4{\"a}
10203 \gdefchar^^e5{\'l}
10204 \gdefchar^^e6{\'c}
10205 \gdefchar^^e7{\cedilla c}
10206 \gdefchar^^e8{\v c}
10207 \gdefchar^^e9{\'e}
10208 \gdefchar^^ea{\ogonek{e}}
10209 \gdefchar^^eb{\"e}
10210 \gdefchar^^ec{\v e}
10211 \gdefchar^^ed{\'{\dotless{i}}}
10212 \gdefchar^^ee{\^{\dotless{i}}}
10213 \gdefchar^^ef{\v d}
10215 \gdefchar^^f0{\dh}
10216 \gdefchar^^f1{\'n}
10217 \gdefchar^^f2{\v n}
10218 \gdefchar^^f3{\'o}
10219 \gdefchar^^f4{\^o}
10220 \gdefchar^^f5{\H o}
10221 \gdefchar^^f6{\"o}
10222 \gdefchar^^f7{$\div$}
10223 \gdefchar^^f8{\v r}
10224 \gdefchar^^f9{\ringaccent u}
10225 \gdefchar^^fa{\'u}
10226 \gdefchar^^fb{\H u}
10227 \gdefchar^^fc{\"u}
10228 \gdefchar^^fd{\'y}
10229 \gdefchar^^fe{\cedilla t}
10230 \gdefchar^^ff{\dotaccent{}}
10233 % UTF-8 character definitions.
10235 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10236 % changes for Texinfo conventions. It is included here under the GPL by
10237 % permission from Frank Mittelbach and the LaTeX team.
10239 \newcount\countUTFx
10240 \newcount\countUTFy
10241 \newcount\countUTFz
10243 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10244 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10246 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10247 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10249 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10250 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10252 \gdef\UTFviiiDefined#1{%
10253 \ifx #1\relax
10254 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10255 \else
10256 \expandafter #1%
10260 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10261 \begingroup
10262 \catcode`\~13
10263 \catcode`\$12
10264 \catcode`\"12
10266 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10267 % substituting ~ and $ with a character token of that value.
10268 \def\UTFviiiLoop{%
10269 \global\catcode\countUTFx\active
10270 \uccode`\~\countUTFx
10271 \uccode`\$\countUTFx
10272 \uppercase\expandafter{\UTFviiiTmp}%
10273 \advance\countUTFx by 1
10274 \ifnum\countUTFx < \countUTFy
10275 \expandafter\UTFviiiLoop
10276 \fi}
10278 % For bytes other than the first in a UTF-8 sequence. Not expected to
10279 % be expanded except when writing to auxiliary files.
10280 \countUTFx = "80
10281 \countUTFy = "C2
10282 \def\UTFviiiTmp{%
10283 \gdef~{%
10284 \ifpassthroughchars $\fi}}%
10285 \UTFviiiLoop
10287 \countUTFx = "C2
10288 \countUTFy = "E0
10289 \def\UTFviiiTmp{%
10290 \gdef~{%
10291 \ifpassthroughchars $%
10292 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10293 \UTFviiiLoop
10295 \countUTFx = "E0
10296 \countUTFy = "F0
10297 \def\UTFviiiTmp{%
10298 \gdef~{%
10299 \ifpassthroughchars $%
10300 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10301 \UTFviiiLoop
10303 \countUTFx = "F0
10304 \countUTFy = "F4
10305 \def\UTFviiiTmp{%
10306 \gdef~{%
10307 \ifpassthroughchars $%
10308 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10310 \UTFviiiLoop
10311 \endgroup
10313 \def\globallet{\global\let} % save some \expandafter's below
10315 % @U{xxxx} to produce U+xxxx, if we support it.
10316 \def\U#1{%
10317 \expandafter\ifx\csname uni:#1\endcsname \relax
10318 \iftxinativeunicodecapable
10319 % All Unicode characters can be used if native Unicode handling is
10320 % active. However, if the font does not have the glyph,
10321 % letters are missing.
10322 \begingroup
10323 \uccode`\.="#1\relax
10324 \uppercase{.}
10325 \endgroup
10326 \else
10327 \errhelp = \EMsimple
10328 \errmessage{Unicode character U+#1 not supported, sorry}%
10330 \else
10331 \csname uni:#1\endcsname
10335 % These macros are used here to construct the name of a control
10336 % sequence to be defined.
10337 \def\UTFviiiTwoOctetsName#1#2{%
10338 \csname u8:#1\string #2\endcsname}%
10339 \def\UTFviiiThreeOctetsName#1#2#3{%
10340 \csname u8:#1\string #2\string #3\endcsname}%
10341 \def\UTFviiiFourOctetsName#1#2#3#4{%
10342 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10344 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10345 % provide a definition macro to replace a Unicode character;
10346 % this gets used by the @U command
10348 \begingroup
10349 \catcode`\"=12
10350 \catcode`\<=12
10351 \catcode`\.=12
10352 \catcode`\,=12
10353 \catcode`\;=12
10354 \catcode`\!=12
10355 \catcode`\~=13
10356 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10357 \countUTFz = "#1\relax
10358 \begingroup
10359 \parseXMLCharref
10361 % Give \u8:... its definition. The sequence of seven \expandafter's
10362 % expands after the \gdef three times, e.g.
10364 % 1. \UTFviiTwoOctetsName B1 B2
10365 % 2. \csname u8:B1 \string B2 \endcsname
10366 % 3. \u8: B1 B2 (a single control sequence token)
10368 \expandafter\expandafter
10369 \expandafter\expandafter
10370 \expandafter\expandafter
10371 \expandafter\gdef \UTFviiiTmp{#2}%
10373 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10374 \message{Internal error, already defined: #1}%
10377 % define an additional control sequence for this code point.
10378 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10379 \endgroup}
10381 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10382 % to the corresponding UTF-8 sequence.
10383 \gdef\parseXMLCharref{%
10384 \ifnum\countUTFz < "A0\relax
10385 \errhelp = \EMsimple
10386 \errmessage{Cannot define Unicode char value < 00A0}%
10387 \else\ifnum\countUTFz < "800\relax
10388 \parseUTFviiiA,%
10389 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10390 \else\ifnum\countUTFz < "10000\relax
10391 \parseUTFviiiA;%
10392 \parseUTFviiiA,%
10393 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10394 \else
10395 \parseUTFviiiA;%
10396 \parseUTFviiiA,%
10397 \parseUTFviiiA!%
10398 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10399 \fi\fi\fi
10402 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10403 % It must be a non-initial byte in the sequence.
10404 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10405 % of the bytes.
10406 \gdef\parseUTFviiiA#1{%
10407 \countUTFx = \countUTFz
10408 \divide\countUTFz by 64
10409 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10410 \multiply\countUTFz by 64
10412 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10413 % in order to get the last five bits.
10414 \advance\countUTFx by -\countUTFz
10416 % Convert this to the byte in the UTF-8 sequence.
10417 \advance\countUTFx by 128
10418 \uccode `#1\countUTFx
10419 \countUTFz = \countUTFy}
10421 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10422 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10423 % sequence.
10424 % #2 is one of the \UTFviii*OctetsName macros.
10425 % #3 is always a full stop (.)
10426 % #4 is a template for the other bytes in the sequence. The values for these
10427 % bytes is substituted in here with \uppercase using the \uccode's.
10428 \gdef\parseUTFviiiB#1#2#3#4{%
10429 \advance\countUTFz by "#10\relax
10430 \uccode `#3\countUTFz
10431 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10432 \endgroup
10434 % For native Unicode handling (XeTeX and LuaTeX),
10435 % provide a definition macro that sets a catcode to `other' non-globally
10437 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10438 \catcode"#1=\other
10441 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10442 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10443 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10444 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10445 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10447 % Many of our renditions are less than wonderful, and all the missing
10448 % characters are available somewhere. Loading the necessary fonts
10449 % awaits user request. We can't truly support Unicode without
10450 % reimplementing everything that's been done in LaTeX for many years,
10451 % plus probably using luatex or xetex, and who knows what else.
10452 % We won't be doing that here in this simple file. But we can try to at
10453 % least make most of the characters not bomb out.
10455 \def\unicodechardefs{%
10456 \DeclareUnicodeCharacter{00A0}{\tie}%
10457 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10458 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10459 \DeclareUnicodeCharacter{00A3}{\pounds}%
10460 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10461 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10462 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10463 \DeclareUnicodeCharacter{00A7}{\S}%
10464 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10465 \DeclareUnicodeCharacter{00A9}{\copyright}%
10466 \DeclareUnicodeCharacter{00AA}{\ordf}%
10467 \DeclareUnicodeCharacter{00AB}{\guillemetleft}%
10468 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10469 \DeclareUnicodeCharacter{00AD}{\-}%
10470 \DeclareUnicodeCharacter{00AE}{\registeredsymbol}%
10471 \DeclareUnicodeCharacter{00AF}{\={ }}%
10473 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
10474 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10475 \DeclareUnicodeCharacter{00B2}{$^2$}%
10476 \DeclareUnicodeCharacter{00B3}{$^3$}%
10477 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10478 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10479 \DeclareUnicodeCharacter{00B6}{\P}%
10480 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10481 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10482 \DeclareUnicodeCharacter{00B9}{$^1$}%
10483 \DeclareUnicodeCharacter{00BA}{\ordm}%
10484 \DeclareUnicodeCharacter{00BB}{\guillemetright}%
10485 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10486 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10487 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10488 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10490 \DeclareUnicodeCharacter{00C0}{\`A}%
10491 \DeclareUnicodeCharacter{00C1}{\'A}%
10492 \DeclareUnicodeCharacter{00C2}{\^A}%
10493 \DeclareUnicodeCharacter{00C3}{\~A}%
10494 \DeclareUnicodeCharacter{00C4}{\"A}%
10495 \DeclareUnicodeCharacter{00C5}{\AA}%
10496 \DeclareUnicodeCharacter{00C6}{\AE}%
10497 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10498 \DeclareUnicodeCharacter{00C8}{\`E}%
10499 \DeclareUnicodeCharacter{00C9}{\'E}%
10500 \DeclareUnicodeCharacter{00CA}{\^E}%
10501 \DeclareUnicodeCharacter{00CB}{\"E}%
10502 \DeclareUnicodeCharacter{00CC}{\`I}%
10503 \DeclareUnicodeCharacter{00CD}{\'I}%
10504 \DeclareUnicodeCharacter{00CE}{\^I}%
10505 \DeclareUnicodeCharacter{00CF}{\"I}%
10507 \DeclareUnicodeCharacter{00D0}{\DH}%
10508 \DeclareUnicodeCharacter{00D1}{\~N}%
10509 \DeclareUnicodeCharacter{00D2}{\`O}%
10510 \DeclareUnicodeCharacter{00D3}{\'O}%
10511 \DeclareUnicodeCharacter{00D4}{\^O}%
10512 \DeclareUnicodeCharacter{00D5}{\~O}%
10513 \DeclareUnicodeCharacter{00D6}{\"O}%
10514 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10515 \DeclareUnicodeCharacter{00D8}{\O}%
10516 \DeclareUnicodeCharacter{00D9}{\`U}%
10517 \DeclareUnicodeCharacter{00DA}{\'U}%
10518 \DeclareUnicodeCharacter{00DB}{\^U}%
10519 \DeclareUnicodeCharacter{00DC}{\"U}%
10520 \DeclareUnicodeCharacter{00DD}{\'Y}%
10521 \DeclareUnicodeCharacter{00DE}{\TH}%
10522 \DeclareUnicodeCharacter{00DF}{\ss}%
10524 \DeclareUnicodeCharacter{00E0}{\`a}%
10525 \DeclareUnicodeCharacter{00E1}{\'a}%
10526 \DeclareUnicodeCharacter{00E2}{\^a}%
10527 \DeclareUnicodeCharacter{00E3}{\~a}%
10528 \DeclareUnicodeCharacter{00E4}{\"a}%
10529 \DeclareUnicodeCharacter{00E5}{\aa}%
10530 \DeclareUnicodeCharacter{00E6}{\ae}%
10531 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10532 \DeclareUnicodeCharacter{00E8}{\`e}%
10533 \DeclareUnicodeCharacter{00E9}{\'e}%
10534 \DeclareUnicodeCharacter{00EA}{\^e}%
10535 \DeclareUnicodeCharacter{00EB}{\"e}%
10536 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10537 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10538 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10539 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10541 \DeclareUnicodeCharacter{00F0}{\dh}%
10542 \DeclareUnicodeCharacter{00F1}{\~n}%
10543 \DeclareUnicodeCharacter{00F2}{\`o}%
10544 \DeclareUnicodeCharacter{00F3}{\'o}%
10545 \DeclareUnicodeCharacter{00F4}{\^o}%
10546 \DeclareUnicodeCharacter{00F5}{\~o}%
10547 \DeclareUnicodeCharacter{00F6}{\"o}%
10548 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10549 \DeclareUnicodeCharacter{00F8}{\o}%
10550 \DeclareUnicodeCharacter{00F9}{\`u}%
10551 \DeclareUnicodeCharacter{00FA}{\'u}%
10552 \DeclareUnicodeCharacter{00FB}{\^u}%
10553 \DeclareUnicodeCharacter{00FC}{\"u}%
10554 \DeclareUnicodeCharacter{00FD}{\'y}%
10555 \DeclareUnicodeCharacter{00FE}{\th}%
10556 \DeclareUnicodeCharacter{00FF}{\"y}%
10558 \DeclareUnicodeCharacter{0100}{\=A}%
10559 \DeclareUnicodeCharacter{0101}{\=a}%
10560 \DeclareUnicodeCharacter{0102}{\u{A}}%
10561 \DeclareUnicodeCharacter{0103}{\u{a}}%
10562 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10563 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10564 \DeclareUnicodeCharacter{0106}{\'C}%
10565 \DeclareUnicodeCharacter{0107}{\'c}%
10566 \DeclareUnicodeCharacter{0108}{\^C}%
10567 \DeclareUnicodeCharacter{0109}{\^c}%
10568 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10569 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10570 \DeclareUnicodeCharacter{010C}{\v{C}}%
10571 \DeclareUnicodeCharacter{010D}{\v{c}}%
10572 \DeclareUnicodeCharacter{010E}{\v{D}}%
10573 \DeclareUnicodeCharacter{010F}{d'}%
10575 \DeclareUnicodeCharacter{0110}{\DH}%
10576 \DeclareUnicodeCharacter{0111}{\dh}%
10577 \DeclareUnicodeCharacter{0112}{\=E}%
10578 \DeclareUnicodeCharacter{0113}{\=e}%
10579 \DeclareUnicodeCharacter{0114}{\u{E}}%
10580 \DeclareUnicodeCharacter{0115}{\u{e}}%
10581 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10582 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10583 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10584 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10585 \DeclareUnicodeCharacter{011A}{\v{E}}%
10586 \DeclareUnicodeCharacter{011B}{\v{e}}%
10587 \DeclareUnicodeCharacter{011C}{\^G}%
10588 \DeclareUnicodeCharacter{011D}{\^g}%
10589 \DeclareUnicodeCharacter{011E}{\u{G}}%
10590 \DeclareUnicodeCharacter{011F}{\u{g}}%
10592 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10593 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10594 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10595 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10596 \DeclareUnicodeCharacter{0124}{\^H}%
10597 \DeclareUnicodeCharacter{0125}{\^h}%
10598 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10599 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10600 \DeclareUnicodeCharacter{0128}{\~I}%
10601 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10602 \DeclareUnicodeCharacter{012A}{\=I}%
10603 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10604 \DeclareUnicodeCharacter{012C}{\u{I}}%
10605 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10606 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10607 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10609 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10610 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10611 \DeclareUnicodeCharacter{0132}{IJ}%
10612 \DeclareUnicodeCharacter{0133}{ij}%
10613 \DeclareUnicodeCharacter{0134}{\^J}%
10614 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10615 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10616 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10617 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10618 \DeclareUnicodeCharacter{0139}{\'L}%
10619 \DeclareUnicodeCharacter{013A}{\'l}%
10620 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10621 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10622 \DeclareUnicodeCharacter{013D}{L'}% should kern
10623 \DeclareUnicodeCharacter{013E}{l'}% should kern
10624 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10626 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10627 \DeclareUnicodeCharacter{0141}{\L}%
10628 \DeclareUnicodeCharacter{0142}{\l}%
10629 \DeclareUnicodeCharacter{0143}{\'N}%
10630 \DeclareUnicodeCharacter{0144}{\'n}%
10631 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10632 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10633 \DeclareUnicodeCharacter{0147}{\v{N}}%
10634 \DeclareUnicodeCharacter{0148}{\v{n}}%
10635 \DeclareUnicodeCharacter{0149}{'n}%
10636 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10637 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10638 \DeclareUnicodeCharacter{014C}{\=O}%
10639 \DeclareUnicodeCharacter{014D}{\=o}%
10640 \DeclareUnicodeCharacter{014E}{\u{O}}%
10641 \DeclareUnicodeCharacter{014F}{\u{o}}%
10643 \DeclareUnicodeCharacter{0150}{\H{O}}%
10644 \DeclareUnicodeCharacter{0151}{\H{o}}%
10645 \DeclareUnicodeCharacter{0152}{\OE}%
10646 \DeclareUnicodeCharacter{0153}{\oe}%
10647 \DeclareUnicodeCharacter{0154}{\'R}%
10648 \DeclareUnicodeCharacter{0155}{\'r}%
10649 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10650 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10651 \DeclareUnicodeCharacter{0158}{\v{R}}%
10652 \DeclareUnicodeCharacter{0159}{\v{r}}%
10653 \DeclareUnicodeCharacter{015A}{\'S}%
10654 \DeclareUnicodeCharacter{015B}{\'s}%
10655 \DeclareUnicodeCharacter{015C}{\^S}%
10656 \DeclareUnicodeCharacter{015D}{\^s}%
10657 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10658 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10660 \DeclareUnicodeCharacter{0160}{\v{S}}%
10661 \DeclareUnicodeCharacter{0161}{\v{s}}%
10662 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10663 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10664 \DeclareUnicodeCharacter{0164}{\v{T}}%
10665 \DeclareUnicodeCharacter{0165}{\v{t}}%
10666 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10667 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10668 \DeclareUnicodeCharacter{0168}{\~U}%
10669 \DeclareUnicodeCharacter{0169}{\~u}%
10670 \DeclareUnicodeCharacter{016A}{\=U}%
10671 \DeclareUnicodeCharacter{016B}{\=u}%
10672 \DeclareUnicodeCharacter{016C}{\u{U}}%
10673 \DeclareUnicodeCharacter{016D}{\u{u}}%
10674 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10675 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10677 \DeclareUnicodeCharacter{0170}{\H{U}}%
10678 \DeclareUnicodeCharacter{0171}{\H{u}}%
10679 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10680 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10681 \DeclareUnicodeCharacter{0174}{\^W}%
10682 \DeclareUnicodeCharacter{0175}{\^w}%
10683 \DeclareUnicodeCharacter{0176}{\^Y}%
10684 \DeclareUnicodeCharacter{0177}{\^y}%
10685 \DeclareUnicodeCharacter{0178}{\"Y}%
10686 \DeclareUnicodeCharacter{0179}{\'Z}%
10687 \DeclareUnicodeCharacter{017A}{\'z}%
10688 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10689 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10690 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10691 \DeclareUnicodeCharacter{017E}{\v{z}}%
10692 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10694 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10695 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10696 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10697 \DeclareUnicodeCharacter{01C7}{LJ}%
10698 \DeclareUnicodeCharacter{01C8}{Lj}%
10699 \DeclareUnicodeCharacter{01C9}{lj}%
10700 \DeclareUnicodeCharacter{01CA}{NJ}%
10701 \DeclareUnicodeCharacter{01CB}{Nj}%
10702 \DeclareUnicodeCharacter{01CC}{nj}%
10703 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10704 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10705 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10707 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10708 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10709 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10710 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10711 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10713 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10714 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10715 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10716 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10717 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10718 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10720 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10721 \DeclareUnicodeCharacter{01F1}{DZ}%
10722 \DeclareUnicodeCharacter{01F2}{Dz}%
10723 \DeclareUnicodeCharacter{01F3}{dz}%
10724 \DeclareUnicodeCharacter{01F4}{\'G}%
10725 \DeclareUnicodeCharacter{01F5}{\'g}%
10726 \DeclareUnicodeCharacter{01F8}{\`N}%
10727 \DeclareUnicodeCharacter{01F9}{\`n}%
10728 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10729 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10730 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10731 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10733 \DeclareUnicodeCharacter{021E}{\v{H}}%
10734 \DeclareUnicodeCharacter{021F}{\v{h}}%
10736 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10737 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10738 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10739 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10740 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10741 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10743 \DeclareUnicodeCharacter{0232}{\=Y}%
10744 \DeclareUnicodeCharacter{0233}{\=y}%
10745 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10747 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10749 % Greek letters upper case
10750 \DeclareUnicodeCharacter{0391}{{\it A}}%
10751 \DeclareUnicodeCharacter{0392}{{\it B}}%
10752 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10753 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10754 \DeclareUnicodeCharacter{0395}{{\it E}}%
10755 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10756 \DeclareUnicodeCharacter{0397}{{\it H}}%
10757 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10758 \DeclareUnicodeCharacter{0399}{{\it I}}%
10759 \DeclareUnicodeCharacter{039A}{{\it K}}%
10760 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10761 \DeclareUnicodeCharacter{039C}{{\it M}}%
10762 \DeclareUnicodeCharacter{039D}{{\it N}}%
10763 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10764 \DeclareUnicodeCharacter{039F}{{\it O}}%
10765 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10766 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10767 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10768 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10769 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10770 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10771 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10772 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10773 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10774 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10776 % Vowels with accents
10777 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10778 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10779 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10780 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10781 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10782 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10784 % Standalone accent
10785 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10787 % Greek letters lower case
10788 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10789 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10790 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10791 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10792 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10793 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10794 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10795 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10796 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10797 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10798 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10799 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10800 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10801 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10802 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10803 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10804 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10805 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10806 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10807 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10808 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10809 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10810 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10811 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10812 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10814 % More Greek vowels with accents
10815 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10816 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10817 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10818 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10819 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10821 % Variant Greek letters
10822 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10823 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10824 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10826 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10827 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10828 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10829 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10830 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10831 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10832 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10833 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10834 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10835 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10836 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10837 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10839 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10840 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10842 \DeclareUnicodeCharacter{1E20}{\=G}%
10843 \DeclareUnicodeCharacter{1E21}{\=g}%
10844 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10845 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10846 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10847 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10848 \DeclareUnicodeCharacter{1E26}{\"H}%
10849 \DeclareUnicodeCharacter{1E27}{\"h}%
10851 \DeclareUnicodeCharacter{1E30}{\'K}%
10852 \DeclareUnicodeCharacter{1E31}{\'k}%
10853 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10854 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10855 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10856 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10857 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10858 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10859 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10860 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10861 \DeclareUnicodeCharacter{1E3E}{\'M}%
10862 \DeclareUnicodeCharacter{1E3F}{\'m}%
10864 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10865 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10866 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10867 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10868 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10869 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10870 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10871 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10872 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10873 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10875 \DeclareUnicodeCharacter{1E54}{\'P}%
10876 \DeclareUnicodeCharacter{1E55}{\'p}%
10877 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10878 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10879 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10880 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10881 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10882 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10883 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10884 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10886 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10887 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10888 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10889 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10890 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10891 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10892 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10893 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10894 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10895 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10897 \DeclareUnicodeCharacter{1E7C}{\~V}%
10898 \DeclareUnicodeCharacter{1E7D}{\~v}%
10899 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10900 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10902 \DeclareUnicodeCharacter{1E80}{\`W}%
10903 \DeclareUnicodeCharacter{1E81}{\`w}%
10904 \DeclareUnicodeCharacter{1E82}{\'W}%
10905 \DeclareUnicodeCharacter{1E83}{\'w}%
10906 \DeclareUnicodeCharacter{1E84}{\"W}%
10907 \DeclareUnicodeCharacter{1E85}{\"w}%
10908 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10909 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10910 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10911 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10912 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10913 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10914 \DeclareUnicodeCharacter{1E8C}{\"X}%
10915 \DeclareUnicodeCharacter{1E8D}{\"x}%
10916 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10917 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10919 \DeclareUnicodeCharacter{1E90}{\^Z}%
10920 \DeclareUnicodeCharacter{1E91}{\^z}%
10921 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10922 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10923 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10924 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
10925 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
10926 \DeclareUnicodeCharacter{1E97}{\"t}%
10927 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
10928 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
10930 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
10931 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
10933 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
10934 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
10935 \DeclareUnicodeCharacter{1EBC}{\~E}%
10936 \DeclareUnicodeCharacter{1EBD}{\~e}%
10938 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
10939 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
10940 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
10941 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
10943 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
10944 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
10946 \DeclareUnicodeCharacter{1EF2}{\`Y}%
10947 \DeclareUnicodeCharacter{1EF3}{\`y}%
10948 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
10950 \DeclareUnicodeCharacter{1EF8}{\~Y}%
10951 \DeclareUnicodeCharacter{1EF9}{\~y}%
10953 % Punctuation
10954 \DeclareUnicodeCharacter{2013}{--}%
10955 \DeclareUnicodeCharacter{2014}{---}%
10956 \DeclareUnicodeCharacter{2018}{\quoteleft}%
10957 \DeclareUnicodeCharacter{2019}{\quoteright}%
10958 \DeclareUnicodeCharacter{201A}{\quotesinglbase}%
10959 \DeclareUnicodeCharacter{201C}{\quotedblleft}%
10960 \DeclareUnicodeCharacter{201D}{\quotedblright}%
10961 \DeclareUnicodeCharacter{201E}{\quotedblbase}%
10962 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
10963 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
10964 \DeclareUnicodeCharacter{2022}{\bullet}%
10965 \DeclareUnicodeCharacter{202F}{\thinspace}%
10966 \DeclareUnicodeCharacter{2026}{\dots}%
10967 \DeclareUnicodeCharacter{2039}{\guilsinglleft}%
10968 \DeclareUnicodeCharacter{203A}{\guilsinglright}%
10970 \DeclareUnicodeCharacter{20AC}{\euro}%
10972 \DeclareUnicodeCharacter{2192}{\expansion}%
10973 \DeclareUnicodeCharacter{21D2}{\result}%
10975 % Mathematical symbols
10976 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
10977 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
10978 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
10979 \DeclareUnicodeCharacter{2212}{\minus}%
10980 \DeclareUnicodeCharacter{2217}{\ast}%
10981 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
10982 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
10983 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
10984 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
10985 \DeclareUnicodeCharacter{2261}{\equiv}%
10986 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
10987 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
10988 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
10989 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
10991 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
10992 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
10993 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
10994 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
10995 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
10996 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
10997 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
10998 \DeclareUnicodeCharacter{2127}{\ensuremath\mho}%
10999 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11000 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11001 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11002 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11003 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11004 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11005 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11006 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11007 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11008 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11009 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11010 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11011 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11012 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11013 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11014 \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}%
11015 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11016 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11017 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11018 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11019 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11020 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11021 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11022 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11023 \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}%
11024 \DeclareUnicodeCharacter{2201}{\ensuremath\complement}%
11025 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11026 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11027 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11028 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11029 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11030 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11031 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11032 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11033 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11034 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11035 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11036 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11037 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11038 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11039 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11040 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11041 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11042 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11043 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11044 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11045 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11046 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11047 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11048 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11049 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11050 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11051 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11052 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11053 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11054 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11055 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11056 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11057 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11058 \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}%
11059 \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}%
11060 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11061 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11062 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11063 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11064 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11065 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11066 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11067 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11068 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11069 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11070 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11071 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11072 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11073 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11074 \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}%
11075 \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}%
11076 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11077 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11078 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11079 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11080 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11081 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11082 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11083 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11084 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11085 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11086 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11087 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11088 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11089 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11091 \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}%
11092 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11093 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11094 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11095 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11096 \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}%
11097 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11098 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11099 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11100 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11101 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11102 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11103 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11104 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11105 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11106 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11107 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11108 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11109 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11110 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11111 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11112 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11113 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11114 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11115 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11116 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11117 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11118 \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}%
11119 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11120 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11121 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11123 \global\mathchardef\checkmark="1370% actually the square root sign
11124 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11125 }% end of \unicodechardefs
11127 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11128 % It makes the setting that replace UTF-8 byte sequence.
11129 \def\utfeightchardefs{%
11130 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11131 \unicodechardefs
11134 % Whether the active definitions of non-ASCII characters expand to
11135 % non-active tokens with the same character code. This is used to
11136 % write characters literally, instead of using active definitions for
11137 % printing the correct glyphs.
11138 \newif\ifpassthroughchars
11139 \passthroughcharsfalse
11141 % For native Unicode handling (XeTeX and LuaTeX),
11142 % provide a definition macro to replace/pass-through a Unicode character
11144 \def\DeclareUnicodeCharacterNative#1#2{%
11145 \catcode"#1=\active
11146 \def\dodeclareunicodecharacternative##1##2##3{%
11147 \begingroup
11148 \uccode`\~="##2\relax
11149 \uppercase{\gdef~}{%
11150 \ifpassthroughchars
11151 ##1%
11152 \else
11153 ##3%
11156 \endgroup
11158 \begingroup
11159 \uccode`\.="#1\relax
11160 \uppercase{\def\UTFNativeTmp{.}}%
11161 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11162 \endgroup
11165 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11166 % It activates the setting that replaces Unicode characters.
11167 \def\nativeunicodechardefs{%
11168 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11169 \unicodechardefs
11172 % For native Unicode handling (XeTeX and LuaTeX),
11173 % make the character token expand
11174 % to the sequences given in \unicodechardefs for printing.
11175 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11176 \def\UTFAtUTmp{#2}
11177 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11180 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11181 \def\nativeunicodechardefsatu{%
11182 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11183 \unicodechardefs
11186 % US-ASCII character definitions.
11187 \def\asciichardefs{% nothing need be done
11188 \relax
11191 % define all Unicode characters we know about, for the sake of @U.
11192 \iftxinativeunicodecapable
11193 \nativeunicodechardefsatu
11194 \else
11195 \utfeightchardefs
11199 % Make non-ASCII characters printable again for compatibility with
11200 % existing Texinfo documents that may use them, even without declaring a
11201 % document encoding.
11203 \setnonasciicharscatcode \other
11206 \message{formatting,}
11208 \newdimen\defaultparindent \defaultparindent = 15pt
11210 \chapheadingskip = 15pt plus 4pt minus 2pt
11211 \secheadingskip = 12pt plus 3pt minus 2pt
11212 \subsecheadingskip = 9pt plus 2pt minus 2pt
11214 % Prevent underfull vbox error messages.
11215 \vbadness = 10000
11217 % Don't be very finicky about underfull hboxes, either.
11218 \hbadness = 6666
11220 % Following George Bush, get rid of widows and orphans.
11221 \widowpenalty=10000
11222 \clubpenalty=10000
11224 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11225 % using an old version of TeX, don't do anything. We want the amount of
11226 % stretch added to depend on the line length, hence the dependence on
11227 % \hsize. We call this whenever the paper size is set.
11229 \def\setemergencystretch{%
11230 \ifx\emergencystretch\thisisundefined
11231 % Allow us to assign to \emergencystretch anyway.
11232 \def\emergencystretch{\dimen0}%
11233 \else
11234 \emergencystretch = .15\hsize
11238 % Parameters in order: 1) textheight; 2) textwidth;
11239 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11240 % 7) physical page height; 8) physical page width.
11242 % We also call \setleading{\textleading}, so the caller should define
11243 % \textleading. The caller should also set \parskip.
11245 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11246 \voffset = #3\relax
11247 \topskip = #6\relax
11248 \splittopskip = \topskip
11250 \vsize = #1\relax
11251 \advance\vsize by \topskip
11252 \outervsize = \vsize
11253 \advance\outervsize by 2\topandbottommargin
11254 \txipageheight = \vsize
11256 \hsize = #2\relax
11257 \outerhsize = \hsize
11258 \advance\outerhsize by 0.5in
11259 \txipagewidth = \hsize
11261 \normaloffset = #4\relax
11262 \bindingoffset = #5\relax
11264 \ifpdf
11265 \pdfpageheight #7\relax
11266 \pdfpagewidth #8\relax
11267 % if we don't reset these, they will remain at "1 true in" of
11268 % whatever layout pdftex was dumped with.
11269 \pdfhorigin = 1 true in
11270 \pdfvorigin = 1 true in
11271 \else
11272 \ifx\XeTeXrevision\thisisundefined
11273 \else
11274 \pdfpageheight #7\relax
11275 \pdfpagewidth #8\relax
11276 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11280 \setleading{\textleading}
11282 \parindent = \defaultparindent
11283 \setemergencystretch
11286 % @letterpaper (the default).
11287 \def\letterpaper{{\globaldefs = 1
11288 \parskip = 3pt plus 2pt minus 1pt
11289 \textleading = 13.2pt
11291 % If page is nothing but text, make it come out even.
11292 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11293 {\voffset}{.25in}%
11294 {\bindingoffset}{36pt}%
11295 {11in}{8.5in}%
11298 % Use @smallbook to reset parameters for 7x9.25 trim size.
11299 \def\smallbook{{\globaldefs = 1
11300 \parskip = 2pt plus 1pt
11301 \textleading = 12pt
11303 \internalpagesizes{7.5in}{5in}%
11304 {-.2in}{0in}%
11305 {\bindingoffset}{16pt}%
11306 {9.25in}{7in}%
11308 \lispnarrowing = 0.3in
11309 \tolerance = 700
11310 \hfuzz = 1pt
11311 \contentsrightmargin = 0pt
11312 \defbodyindent = .5cm
11315 % Use @smallerbook to reset parameters for 6x9 trim size.
11316 % (Just testing, parameters still in flux.)
11317 \def\smallerbook{{\globaldefs = 1
11318 \parskip = 1.5pt plus 1pt
11319 \textleading = 12pt
11321 \internalpagesizes{7.4in}{4.8in}%
11322 {-.2in}{-.4in}%
11323 {0pt}{14pt}%
11324 {9in}{6in}%
11326 \lispnarrowing = 0.25in
11327 \tolerance = 700
11328 \hfuzz = 1pt
11329 \contentsrightmargin = 0pt
11330 \defbodyindent = .4cm
11333 % Use @afourpaper to print on European A4 paper.
11334 \def\afourpaper{{\globaldefs = 1
11335 \parskip = 3pt plus 2pt minus 1pt
11336 \textleading = 13.2pt
11338 % Double-side printing via postscript on Laserjet 4050
11339 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11340 % To change the settings for a different printer or situation, adjust
11341 % \normaloffset until the front-side and back-side texts align. Then
11342 % do the same for \bindingoffset. You can set these for testing in
11343 % your texinfo source file like this:
11344 % @tex
11345 % \global\normaloffset = -6mm
11346 % \global\bindingoffset = 10mm
11347 % @end tex
11348 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11349 {\voffset}{\hoffset}%
11350 {\bindingoffset}{44pt}%
11351 {297mm}{210mm}%
11353 \tolerance = 700
11354 \hfuzz = 1pt
11355 \contentsrightmargin = 0pt
11356 \defbodyindent = 5mm
11359 % Use @afivepaper to print on European A5 paper.
11360 % From romildo@urano.iceb.ufop.br, 2 July 2000.
11361 % He also recommends making @example and @lisp be small.
11362 \def\afivepaper{{\globaldefs = 1
11363 \parskip = 2pt plus 1pt minus 0.1pt
11364 \textleading = 12.5pt
11366 \internalpagesizes{160mm}{120mm}%
11367 {\voffset}{\hoffset}%
11368 {\bindingoffset}{8pt}%
11369 {210mm}{148mm}%
11371 \lispnarrowing = 0.2in
11372 \tolerance = 800
11373 \hfuzz = 1.2pt
11374 \contentsrightmargin = 0pt
11375 \defbodyindent = 2mm
11376 \tableindent = 12mm
11379 % A specific text layout, 24x15cm overall, intended for A4 paper.
11380 \def\afourlatex{{\globaldefs = 1
11381 \afourpaper
11382 \internalpagesizes{237mm}{150mm}%
11383 {\voffset}{4.6mm}%
11384 {\bindingoffset}{7mm}%
11385 {297mm}{210mm}%
11387 % Must explicitly reset to 0 because we call \afourpaper.
11388 \globaldefs = 0
11391 % Use @afourwide to print on A4 paper in landscape format.
11392 \def\afourwide{{\globaldefs = 1
11393 \afourpaper
11394 \internalpagesizes{241mm}{165mm}%
11395 {\voffset}{-2.95mm}%
11396 {\bindingoffset}{7mm}%
11397 {297mm}{210mm}%
11398 \globaldefs = 0
11401 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11402 % Perhaps we should allow setting the margins, \topskip, \parskip,
11403 % and/or leading, also. Or perhaps we should compute them somehow.
11405 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11406 \def\pagesizesyyy#1,#2,#3\finish{{%
11407 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11408 \globaldefs = 1
11410 \parskip = 3pt plus 2pt minus 1pt
11411 \setleading{\textleading}%
11413 \dimen0 = #1\relax
11414 \advance\dimen0 by \voffset
11416 \dimen2 = \hsize
11417 \advance\dimen2 by \normaloffset
11419 \internalpagesizes{#1}{\hsize}%
11420 {\voffset}{\normaloffset}%
11421 {\bindingoffset}{44pt}%
11422 {\dimen0}{\dimen2}%
11425 % Set default to letter.
11427 \letterpaper
11430 \message{and turning on texinfo input format.}
11432 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11434 % DEL is a comment character, in case @c does not suffice.
11435 \catcode`\^^? = 14
11437 % Define macros to output various characters with catcode for normal text.
11438 \catcode`\"=\other \def\normaldoublequote{"}
11439 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11440 \catcode`\+=\other \def\normalplus{+}
11441 \catcode`\<=\other \def\normalless{<}
11442 \catcode`\>=\other \def\normalgreater{>}
11443 \catcode`\^=\other \def\normalcaret{^}
11444 \catcode`\_=\other \def\normalunderscore{_}
11445 \catcode`\|=\other \def\normalverticalbar{|}
11446 \catcode`\~=\other \def\normaltilde{~}
11448 % This macro is used to make a character print one way in \tt
11449 % (where it can probably be output as-is), and another way in other fonts,
11450 % where something hairier probably needs to be done.
11452 % #1 is what to print if we are indeed using \tt; #2 is what to print
11453 % otherwise. Since all the Computer Modern typewriter fonts have zero
11454 % interword stretch (and shrink), and it is reasonable to expect all
11455 % typewriter fonts to have this, we can check that font parameter.
11457 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
11459 % Same as above, but check for italic font. Actually this also catches
11460 % non-italic slanted fonts since it is impossible to distinguish them from
11461 % italic fonts. But since this is only used by $ and it uses \sl anyway
11462 % this is not a problem.
11463 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
11465 % Set catcodes for Texinfo file
11467 % Active characters for printing the wanted glyph.
11468 % Most of these we simply print from the \tt font, but for some, we can
11469 % use math or other variants that look better in normal text.
11471 \catcode`\"=\active
11472 \def\activedoublequote{{\tt\char34}}
11473 \let"=\activedoublequote
11474 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11475 \chardef\hatchar=`\^
11476 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11478 \catcode`\_=\active
11479 \def_{\ifusingtt\normalunderscore\_}
11480 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11481 \let\realunder=_
11483 \catcode`\|=\active \def|{{\tt\char124}}
11485 \chardef \less=`\<
11486 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11487 \chardef \gtr=`\>
11488 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11489 \catcode`\+=\active \def+{{\tt \char 43}}
11490 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11491 \catcode`\-=\active \let-=\normaldash
11494 % used for headline/footline in the output routine, in case the page
11495 % breaks in the middle of an @tex block.
11496 \def\texinfochars{%
11497 \let< = \activeless
11498 \let> = \activegtr
11499 \let~ = \activetilde
11500 \let^ = \activehat
11501 \markupsetuplqdefault \markupsetuprqdefault
11502 \let\b = \strong
11503 \let\i = \smartitalic
11504 % in principle, all other definitions in \tex have to be undone too.
11507 % Used sometimes to turn off (effectively) the active characters even after
11508 % parsing them.
11509 \def\turnoffactive{%
11510 \normalturnoffactive
11511 \otherbackslash
11514 \catcode`\@=0
11516 % \backslashcurfont outputs one backslash character in current font,
11517 % as in \char`\\.
11518 \global\chardef\backslashcurfont=`\\
11519 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
11521 % \realbackslash is an actual character `\' with catcode other, and
11522 % \doublebackslash is two of them (for the pdf outlines).
11523 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
11525 % In Texinfo, backslash is an active character; it prints the backslash
11526 % in fixed width font.
11527 \catcode`\\=\active % @ for escape char from now on.
11529 % Print a typewriter backslash. For math mode, we can't simply use
11530 % \backslashcurfont: the story here is that in math mode, the \char
11531 % of \backslashcurfont ends up printing the roman \ from the math symbol
11532 % font (because \char in math mode uses the \mathcode, and plain.tex
11533 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11534 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11535 % ignored family value; char position "5C). We can't use " for the
11536 % usual hex value because it has already been made active.
11538 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11539 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11541 % \rawbackslash defines an active \ to do \backslashcurfont.
11542 % \otherbackslash defines an active \ to be a literal `\' character with
11543 % catcode other. We switch back and forth between these.
11544 @gdef@rawbackslash{@let\=@backslashcurfont}
11545 @gdef@otherbackslash{@let\=@realbackslash}
11547 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11548 % the literal character `\'.
11550 {@catcode`- = @active
11551 @gdef@normalturnoffactive{%
11552 @passthroughcharstrue
11553 @let-=@normaldash
11554 @let"=@normaldoublequote
11555 @let$=@normaldollar %$ font-lock fix
11556 @let+=@normalplus
11557 @let<=@normalless
11558 @let>=@normalgreater
11559 @let^=@normalcaret
11560 @let_=@normalunderscore
11561 @let|=@normalverticalbar
11562 @let~=@normaltilde
11563 @let\=@ttbackslash
11564 @markupsetuplqdefault
11565 @markupsetuprqdefault
11566 @unsepspaces
11570 % If a .fmt file is being used, characters that might appear in a file
11571 % name cannot be active until we have parsed the command line.
11572 % So turn them off again, and have @fixbackslash turn them back on.
11573 @catcode`+=@other @catcode`@_=@other
11575 % \enablebackslashhack - allow file to begin `\input texinfo'
11577 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11578 % That is what \eatinput is for; after that, the `\' should revert to printing
11579 % a backslash.
11580 % If the file did not have a `\input texinfo', then it is turned off after
11581 % the first line; otherwise the first `\' in the file would cause an error.
11582 % This is used on the very last line of this file, texinfo.tex.
11583 % We also use @c to call @fixbackslash, in case ends of lines are hidden.
11585 @catcode`@^=7
11586 @catcode`@^^M=13@gdef@enablebackslashhack{%
11587 @global@let\ = @eatinput%
11588 @catcode`@^^M=13%
11589 @def@c{@fixbackslash@c}%
11590 % Definition for the newline at the end of this file.
11591 @def ^^M{@let^^M@secondlinenl}%
11592 % Definition for a newline in the main Texinfo file.
11593 @gdef @secondlinenl{@fixbackslash}%
11596 {@catcode`@^=7 @catcode`@^^M=13%
11597 @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11599 % Emergency active definition of newline, in case an active newline token
11600 % appears by mistake.
11601 {@catcode`@^=7 @catcode13=13%
11602 @gdef@enableemergencynewline{%
11603 @gdef^^M{%
11604 @par%
11605 %<warning: active newline>@par%
11609 @gdef@fixbackslash{%
11610 @ifx\@eatinput @let\ = @ttbackslash @fi
11611 @catcode13=5 % regular end of line
11612 @enableemergencynewline
11613 @let@c=@texinfoc
11614 % Also turn back on active characters that might appear in the input
11615 % file name, in case not using a pre-dumped format.
11616 @catcode`+=@active
11617 @catcode`@_=@active
11619 % If texinfo.cnf is present on the system, read it.
11620 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11621 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11622 % directly in this file, texinfo.tex, makes it possible to make a format
11623 % file for Texinfo.
11625 @openin 1 texinfo.cnf
11626 @ifeof 1 @else @input texinfo.cnf @fi
11627 @closein 1
11631 % Say @foo, not \foo, in error messages.
11632 @escapechar = `@@
11634 % These (along with & and #) are made active for url-breaking, so need
11635 % active definitions as the normal characters.
11636 @def@normaldot{.}
11637 @def@normalquest{?}
11638 @def@normalslash{/}
11640 % These look ok in all fonts, so just make them not special.
11641 % @hashchar{} gets its own user-level command, because of #line.
11642 @catcode`@& = @other @def@normalamp{&}
11643 @catcode`@# = @other @def@normalhash{#}
11644 @catcode`@% = @other @def@normalpercent{%}
11646 @let @hashchar = @normalhash
11648 @c Finally, make ` and ' active, so that txicodequoteundirected and
11649 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11650 @c don't make ` and ' active, @code will not get them as active chars.
11651 @c Do this last of all since we use ` in the previous @catcode assignments.
11652 @catcode`@'=@active
11653 @catcode`@`=@active
11654 @markupsetuplqdefault
11655 @markupsetuprqdefault
11657 @c Local variables:
11658 @c eval: (add-hook 'write-file-hooks 'time-stamp)
11659 @c page-delimiter: "^\\\\message\\|emacs-page"
11660 @c time-stamp-start: "def\\\\texinfoversion{"
11661 @c time-stamp-format: "%:y-%02m-%02d.%02H"
11662 @c time-stamp-end: "}"
11663 @c End:
11665 @c vim:sw=2:
11667 @ignore
11668 arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
11669 @end ignore
11670 @enablebackslashhack