Fix Dired display and operations on file names with raw bytes
[emacs.git] / doc / misc / texinfo.tex
blobb0179d6b0074c4ce29af0d952b43ad1d1809219b
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{2017-12-26.21}
8 % Copyright 1985-1986, 1988, 1990-2018 Free Software Foundation, Inc.
10 % This texinfo.tex file is free software: you can redistribute it and/or
11 % modify it under the terms of the GNU General Public License as
12 % published by the Free Software Foundation, either version 3 of the
13 % License, or (at your option) any later version.
15 % This texinfo.tex file is distributed in the hope that it will be
16 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 % General Public License for more details.
20 % You should have received a copy of the GNU General Public License
21 % along with this program. If not, see <https://www.gnu.org/licenses/>.
23 % As a special exception, when this file is read by TeX when processing
24 % a Texinfo source document, you may use the result without
25 % restriction. This Exception is an additional permission under section 7
26 % of the GNU General Public License, version 3 ("GPLv3").
28 % Please try the latest version of texinfo.tex before submitting bug
29 % reports; you can get the latest version from:
30 % https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
31 % https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
32 % https://www.gnu.org/software/texinfo/ (the Texinfo home page)
33 % The texinfo.tex in any given distribution could well be out
34 % of date, so if that's what you're using, please check.
36 % Send bug reports to bug-texinfo@gnu.org. Please include including a
37 % complete document in each bug report with which we can reproduce the
38 % problem. Patches are, of course, greatly appreciated.
40 % To process a Texinfo manual with TeX, it's most reliable to use the
41 % texi2dvi shell script that comes with the distribution. For a simple
42 % manual foo.texi, however, you can get away with this:
43 % tex foo.texi
44 % texindex foo.??
45 % tex foo.texi
46 % tex foo.texi
47 % dvips foo.dvi -o # or whatever; this makes foo.ps.
48 % The extra TeX runs get the cross-reference information correct.
49 % Sometimes one run after texindex suffices, and sometimes you need more
50 % than two; texi2dvi does it as many times as necessary.
52 % It is possible to adapt texinfo.tex for other languages, to some
53 % extent. You can get the existing language-specific files from the
54 % full Texinfo distribution.
56 % The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
59 \message{Loading texinfo [version \texinfoversion]:}
61 % If in a .fmt file, print the version number
62 % and turn on active characters that we couldn't do earlier because
63 % they might have appeared in the input file name.
64 \everyjob{\message{[Texinfo version \texinfoversion]}%
65 \catcode`+=\active \catcode`\_=\active}
67 % LaTeX's \typeout. This ensures that the messages it is used for
68 % are identical in format to the corresponding ones from latex/pdflatex.
69 \def\typeout{\immediate\write17}%
71 \chardef\other=12
73 % We never want plain's \outer definition of \+ in Texinfo.
74 % For @tex, we can use \tabalign.
75 \let\+ = \relax
77 % Save some plain tex macros whose names we will redefine.
78 \let\ptexb=\b
79 \let\ptexbullet=\bullet
80 \let\ptexc=\c
81 \let\ptexcomma=\,
82 \let\ptexdot=\.
83 \let\ptexdots=\dots
84 \let\ptexend=\end
85 \let\ptexequiv=\equiv
86 \let\ptexexclam=\!
87 \let\ptexfootnote=\footnote
88 \let\ptexgtr=>
89 \let\ptexhat=^
90 \let\ptexi=\i
91 \let\ptexindent=\indent
92 \let\ptexinsert=\insert
93 \let\ptexlbrace=\{
94 \let\ptexless=<
95 \let\ptexnewwrite\newwrite
96 \let\ptexnoindent=\noindent
97 \let\ptexplus=+
98 \let\ptexraggedright=\raggedright
99 \let\ptexrbrace=\}
100 \let\ptexslash=\/
101 \let\ptexsp=\sp
102 \let\ptexstar=\*
103 \let\ptexsup=\sup
104 \let\ptext=\t
105 \let\ptextop=\top
106 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
108 % If this character appears in an error message or help string, it
109 % starts a new line in the output.
110 \newlinechar = `^^J
112 % Use TeX 3.0's \inputlineno to get the line number, for better error
113 % messages, but if we're using an old version of TeX, don't do anything.
115 \ifx\inputlineno\thisisundefined
116 \let\linenumber = \empty % Pre-3.0.
117 \else
118 \def\linenumber{l.\the\inputlineno:\space}
121 % Set up fixed words for English if not already set.
122 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
123 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
124 \ifx\putworderror\undefined \gdef\putworderror{error}\fi
125 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
126 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
127 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
128 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
129 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
130 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
131 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
132 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
133 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
134 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
135 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
136 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
137 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
138 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
139 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
140 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
141 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
143 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
144 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
145 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
146 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
147 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
148 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
149 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
150 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
151 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
152 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
153 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
154 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
156 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
157 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
158 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
159 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
160 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
162 % Give the space character the catcode for a space.
163 \def\spaceisspace{\catcode`\ =10\relax}
165 % Likewise for ^^M, the end of line character.
166 \def\endlineisspace{\catcode13=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 % @include FILE -- \input text of FILE.
867 \def\include{\parseargusing\filenamecatcodes\includezzz}
868 \def\includezzz#1{%
869 \pushthisfilestack
870 \def\thisfile{#1}%
872 \makevalueexpandable % we want to expand any @value in FILE.
873 \turnoffactive % and allow special characters in the expansion
874 \indexnofonts % Allow `@@' and other weird things in file names.
875 \wlog{texinfo.tex: doing @include of #1^^J}%
876 \edef\temp{\noexpand\input #1 }%
878 % This trickery is to read FILE outside of a group, in case it makes
879 % definitions, etc.
880 \expandafter
881 }\temp
882 \popthisfilestack
884 \def\filenamecatcodes{%
885 \catcode`\\=\other
886 \catcode`~=\other
887 \catcode`^=\other
888 \catcode`_=\other
889 \catcode`|=\other
890 \catcode`<=\other
891 \catcode`>=\other
892 \catcode`+=\other
893 \catcode`-=\other
894 \catcode`\`=\other
895 \catcode`\'=\other
898 \def\pushthisfilestack{%
899 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
901 \def\pushthisfilestackX{%
902 \expandafter\pushthisfilestackY\thisfile\StackTerm
904 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
905 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
908 \def\popthisfilestack{\errthisfilestackempty}
909 \def\errthisfilestackempty{\errmessage{Internal error:
910 the stack of filenames is empty.}}
912 \def\thisfile{}
914 % @center line
915 % outputs that line, centered.
917 \parseargdef\center{%
918 \ifhmode
919 \let\centersub\centerH
920 \else
921 \let\centersub\centerV
923 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
924 \let\centersub\relax % don't let the definition persist, just in case
926 \def\centerH#1{{%
927 \hfil\break
928 \advance\hsize by -\leftskip
929 \advance\hsize by -\rightskip
930 \line{#1}%
931 \break
934 \newcount\centerpenalty
935 \def\centerV#1{%
936 % The idea here is the same as in \startdefun, \cartouche, etc.: if
937 % @center is the first thing after a section heading, we need to wipe
938 % out the negative parskip inserted by \sectionheading, but still
939 % prevent a page break here.
940 \centerpenalty = \lastpenalty
941 \ifnum\centerpenalty>10000 \vskip\parskip \fi
942 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
943 \line{\kern\leftskip #1\kern\rightskip}%
946 % @sp n outputs n lines of vertical space
948 \parseargdef\sp{\vskip #1\baselineskip}
950 % @comment ...line which is ignored...
951 % @c is the same as @comment
952 % @ignore ... @end ignore is another way to write a comment
955 \def\c{\begingroup \catcode`\^^M=\active%
956 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
957 \cxxx}
958 {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
960 \let\comment\c
962 % @paragraphindent NCHARS
963 % We'll use ems for NCHARS, close enough.
964 % NCHARS can also be the word `asis' or `none'.
965 % We cannot feasibly implement @paragraphindent asis, though.
967 \def\asisword{asis} % no translation, these are keywords
968 \def\noneword{none}
970 \parseargdef\paragraphindent{%
971 \def\temp{#1}%
972 \ifx\temp\asisword
973 \else
974 \ifx\temp\noneword
975 \defaultparindent = 0pt
976 \else
977 \defaultparindent = #1em
980 \parindent = \defaultparindent
983 % @exampleindent NCHARS
984 % We'll use ems for NCHARS like @paragraphindent.
985 % It seems @exampleindent asis isn't necessary, but
986 % I preserve it to make it similar to @paragraphindent.
987 \parseargdef\exampleindent{%
988 \def\temp{#1}%
989 \ifx\temp\asisword
990 \else
991 \ifx\temp\noneword
992 \lispnarrowing = 0pt
993 \else
994 \lispnarrowing = #1em
999 % @firstparagraphindent WORD
1000 % If WORD is `none', then suppress indentation of the first paragraph
1001 % after a section heading. If WORD is `insert', then do indent at such
1002 % paragraphs.
1004 % The paragraph indentation is suppressed or not by calling
1005 % \suppressfirstparagraphindent, which the sectioning commands do.
1006 % We switch the definition of this back and forth according to WORD.
1007 % By default, we suppress indentation.
1009 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
1010 \def\insertword{insert}
1012 \parseargdef\firstparagraphindent{%
1013 \def\temp{#1}%
1014 \ifx\temp\noneword
1015 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
1016 \else\ifx\temp\insertword
1017 \let\suppressfirstparagraphindent = \relax
1018 \else
1019 \errhelp = \EMsimple
1020 \errmessage{Unknown @firstparagraphindent option `\temp'}%
1021 \fi\fi
1024 % Here is how we actually suppress indentation. Redefine \everypar to
1025 % \kern backwards by \parindent, and then reset itself to empty.
1027 % We also make \indent itself not actually do anything until the next
1028 % paragraph.
1030 \gdef\dosuppressfirstparagraphindent{%
1031 \gdef\indent {\restorefirstparagraphindent \indent}%
1032 \gdef\noindent{\restorefirstparagraphindent \noindent}%
1033 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
1036 \gdef\restorefirstparagraphindent{%
1037 \global\let\indent = \ptexindent
1038 \global\let\noindent = \ptexnoindent
1039 \global\everypar = {}%
1043 % @refill is a no-op.
1044 \let\refill=\relax
1046 % @setfilename INFO-FILENAME - ignored
1047 \let\setfilename=\comment
1049 % @bye.
1050 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1053 \message{pdf,}
1054 % adobe `portable' document format
1055 \newcount\tempnum
1056 \newcount\lnkcount
1057 \newtoks\filename
1058 \newcount\filenamelength
1059 \newcount\pgn
1060 \newtoks\toksA
1061 \newtoks\toksB
1062 \newtoks\toksC
1063 \newtoks\toksD
1064 \newbox\boxA
1065 \newbox\boxB
1066 \newcount\countA
1067 \newif\ifpdf
1068 \newif\ifpdfmakepagedest
1071 % For LuaTeX
1074 \newif\iftxiuseunicodedestname
1075 \txiuseunicodedestnamefalse % For pdfTeX etc.
1077 \ifx\luatexversion\thisisundefined
1078 \else
1079 % Use Unicode destination names
1080 \txiuseunicodedestnametrue
1081 % Escape PDF strings with converting UTF-16 from UTF-8
1082 \begingroup
1083 \catcode`\%=12
1084 \directlua{
1085 function UTF16oct(str)
1086 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1087 for c in string.utfvalues(str) do
1088 if c < 0x10000 then
1089 tex.sprint(
1090 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1091 string.char(0x5c) .. string.char(0x25) .. '03o',
1092 (c / 256), (c % 256)))
1093 else
1094 c = c - 0x10000
1095 local c_hi = c / 1024 + 0xd800
1096 local c_lo = c % 1024 + 0xdc00
1097 tex.sprint(
1098 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1099 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1100 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1101 string.char(0x5c) .. string.char(0x25) .. '03o',
1102 (c_hi / 256), (c_hi % 256),
1103 (c_lo / 256), (c_lo % 256)))
1108 \endgroup
1109 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1110 % Escape PDF strings without converting
1111 \begingroup
1112 \directlua{
1113 function PDFescstr(str)
1114 for c in string.bytes(str) do
1115 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1116 tex.sprint(
1117 string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1119 else
1120 tex.sprint(string.char(c))
1125 \endgroup
1126 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1127 \ifnum\luatexversion>84
1128 % For LuaTeX >= 0.85
1129 \def\pdfdest{\pdfextension dest}
1130 \let\pdfoutput\outputmode
1131 \def\pdfliteral{\pdfextension literal}
1132 \def\pdfcatalog{\pdfextension catalog}
1133 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1134 \let\pdfximage\saveimageresource
1135 \let\pdfrefximage\useimageresource
1136 \let\pdflastximage\lastsavedimageresourceindex
1137 \def\pdfendlink{\pdfextension endlink\relax}
1138 \def\pdfoutline{\pdfextension outline}
1139 \def\pdfstartlink{\pdfextension startlink}
1140 \def\pdffontattr{\pdfextension fontattr}
1141 \def\pdfobj{\pdfextension obj}
1142 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1143 \let\pdfpagewidth\pagewidth
1144 \let\pdfpageheight\pageheight
1145 \edef\pdfhorigin{\pdfvariable horigin}
1146 \edef\pdfvorigin{\pdfvariable vorigin}
1150 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1151 % can be set). So we test for \relax and 0 as well as being undefined.
1152 \ifx\pdfoutput\thisisundefined
1153 \else
1154 \ifx\pdfoutput\relax
1155 \else
1156 \ifcase\pdfoutput
1157 \else
1158 \pdftrue
1163 % PDF uses PostScript string constants for the names of xref targets,
1164 % for display in the outlines, and in other places. Thus, we have to
1165 % double any backslashes. Otherwise, a name like "\node" will be
1166 % interpreted as a newline (\n), followed by o, d, e. Not good.
1168 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1169 % related messages. The final outcome is that it is up to the TeX user
1170 % to double the backslashes and otherwise make the string valid, so
1171 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1172 % do this reliably, so we use it.
1174 % #1 is a control sequence in which to do the replacements,
1175 % which we \xdef.
1176 \def\txiescapepdf#1{%
1177 \ifx\pdfescapestring\thisisundefined
1178 % No primitive available; should we give a warning or log?
1179 % Many times it won't matter.
1180 \xdef#1{#1}%
1181 \else
1182 % The expandable \pdfescapestring primitive escapes parentheses,
1183 % backslashes, and other special chars.
1184 \xdef#1{\pdfescapestring{#1}}%
1187 \def\txiescapepdfutfsixteen#1{%
1188 \ifx\pdfescapestrutfsixteen\thisisundefined
1189 % No UTF-16 converting macro available.
1190 \txiescapepdf{#1}%
1191 \else
1192 \xdef#1{\pdfescapestrutfsixteen{#1}}%
1196 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1197 with PDF output, and none of those formats could be found. (.eps cannot
1198 be supported due to the design of the PDF format; use regular TeX (DVI
1199 output) for that.)}
1201 \ifpdf
1203 % Color manipulation macros using ideas from pdfcolor.tex,
1204 % except using rgb instead of cmyk; the latter is said to render as a
1205 % very dark gray on-screen and a very dark halftone in print, instead
1206 % of actual black. The dark red here is dark enough to print on paper as
1207 % nearly black, but still distinguishable for online viewing. We use
1208 % black by default, though.
1209 \def\rgbDarkRed{0.50 0.09 0.12}
1210 \def\rgbBlack{0 0 0}
1212 % rg sets the color for filling (usual text, etc.);
1213 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1214 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1216 % Set color, and create a mark which defines \thiscolor accordingly,
1217 % so that \makeheadline knows which color to restore.
1218 \def\setcolor#1{%
1219 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1220 \domark
1221 \pdfsetcolor{#1}%
1224 \def\maincolor{\rgbBlack}
1225 \pdfsetcolor{\maincolor}
1226 \edef\thiscolor{\maincolor}
1227 \def\lastcolordefs{}
1229 \def\makefootline{%
1230 \baselineskip24pt
1231 \line{\pdfsetcolor{\maincolor}\the\footline}%
1234 \def\makeheadline{%
1235 \vbox to 0pt{%
1236 \vskip-22.5pt
1237 \line{%
1238 \vbox to8.5pt{}%
1239 % Extract \thiscolor definition from the marks.
1240 \getcolormarks
1241 % Typeset the headline with \maincolor, then restore the color.
1242 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1244 \vss
1246 \nointerlineskip
1250 \pdfcatalog{/PageMode /UseOutlines}
1252 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1253 \def\dopdfimage#1#2#3{%
1254 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1255 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1257 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1258 % others). Let's try in that order, PDF first since if
1259 % someone has a scalable image, presumably better to use that than a
1260 % bitmap.
1261 \let\pdfimgext=\empty
1262 \begingroup
1263 \openin 1 #1.pdf \ifeof 1
1264 \openin 1 #1.PDF \ifeof 1
1265 \openin 1 #1.png \ifeof 1
1266 \openin 1 #1.jpg \ifeof 1
1267 \openin 1 #1.jpeg \ifeof 1
1268 \openin 1 #1.JPG \ifeof 1
1269 \errhelp = \nopdfimagehelp
1270 \errmessage{Could not find image file #1 for pdf}%
1271 \else \gdef\pdfimgext{JPG}%
1273 \else \gdef\pdfimgext{jpeg}%
1275 \else \gdef\pdfimgext{jpg}%
1277 \else \gdef\pdfimgext{png}%
1279 \else \gdef\pdfimgext{PDF}%
1281 \else \gdef\pdfimgext{pdf}%
1283 \closein 1
1284 \endgroup
1286 % without \immediate, ancient pdftex seg faults when the same image is
1287 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1288 \ifnum\pdftexversion < 14
1289 \immediate\pdfimage
1290 \else
1291 \immediate\pdfximage
1293 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1294 \ifdim \wd2 >0pt height \pdfimageheight \fi
1295 \ifnum\pdftexversion<13
1296 #1.\pdfimgext
1297 \else
1298 {#1.\pdfimgext}%
1300 \ifnum\pdftexversion < 14 \else
1301 \pdfrefximage \pdflastximage
1302 \fi}
1304 \def\setpdfdestname#1{{%
1305 % We have to set dummies so commands such as @code, and characters
1306 % such as \, aren't expanded when present in a section title.
1307 \indexnofonts
1308 \makevalueexpandable
1309 \turnoffactive
1310 \iftxiuseunicodedestname
1311 \ifx \declaredencoding \latone
1312 % Pass through Latin-1 characters.
1313 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1314 \else
1315 \ifx \declaredencoding \utfeight
1316 % Pass through Unicode characters.
1317 \else
1318 % Use ASCII approximations in destination names.
1319 \passthroughcharsfalse
1322 \else
1323 % Use ASCII approximations in destination names.
1324 \passthroughcharsfalse
1326 \def\pdfdestname{#1}%
1327 \txiescapepdf\pdfdestname
1330 \def\setpdfoutlinetext#1{{%
1331 \indexnofonts
1332 \makevalueexpandable
1333 \turnoffactive
1334 \ifx \declaredencoding \latone
1335 % The PDF format can use an extended form of Latin-1 in bookmark
1336 % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1337 % the "PDFDocEncoding".
1338 \passthroughcharstrue
1339 % Pass through Latin-1 characters.
1340 % LuaTeX: Convert to Unicode
1341 % pdfTeX: Use Latin-1 as PDFDocEncoding
1342 \def\pdfoutlinetext{#1}%
1343 \else
1344 \ifx \declaredencoding \utfeight
1345 \ifx\luatexversion\thisisundefined
1346 % For pdfTeX with UTF-8.
1347 % TODO: the PDF format can use UTF-16 in bookmark strings,
1348 % but the code for this isn't done yet.
1349 % Use ASCII approximations.
1350 \passthroughcharsfalse
1351 \def\pdfoutlinetext{#1}%
1352 \else
1353 % For LuaTeX with UTF-8.
1354 % Pass through Unicode characters for title texts.
1355 \passthroughcharstrue
1356 \def\pdfoutlinetext{#1}%
1358 \else
1359 % For non-Latin-1 or non-UTF-8 encodings.
1360 % Use ASCII approximations.
1361 \passthroughcharsfalse
1362 \def\pdfoutlinetext{#1}%
1365 % LuaTeX: Convert to UTF-16
1366 % pdfTeX: Use Latin-1 as PDFDocEncoding
1367 \txiescapepdfutfsixteen\pdfoutlinetext
1370 \def\pdfmkdest#1{%
1371 \setpdfdestname{#1}%
1372 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1375 % used to mark target names; must be expandable.
1376 \def\pdfmkpgn#1{#1}
1378 % by default, use black for everything.
1379 \def\urlcolor{\rgbBlack}
1380 \def\linkcolor{\rgbBlack}
1381 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1383 % Adding outlines to PDF; macros for calculating structure of outlines
1384 % come from Petr Olsak
1385 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1386 \else \csname#1\endcsname \fi}
1387 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1388 \advance\tempnum by 1
1389 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1391 % #1 is the section text, which is what will be displayed in the
1392 % outline by the pdf viewer. #2 is the pdf expression for the number
1393 % of subentries (or empty, for subsubsections). #3 is the node text,
1394 % which might be empty if this toc entry had no corresponding node.
1395 % #4 is the page number
1397 \def\dopdfoutline#1#2#3#4{%
1398 % Generate a link to the node text if that exists; else, use the
1399 % page number. We could generate a destination for the section
1400 % text in the case where a section has no node, but it doesn't
1401 % seem worth the trouble, since most documents are normally structured.
1402 \setpdfoutlinetext{#1}
1403 \setpdfdestname{#3}
1404 \ifx\pdfdestname\empty
1405 \def\pdfdestname{#4}%
1408 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
1411 \def\pdfmakeoutlines{%
1412 \begingroup
1413 % Read toc silently, to get counts of subentries for \pdfoutline.
1414 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1415 \def\numchapentry##1##2##3##4{%
1416 \def\thischapnum{##2}%
1417 \def\thissecnum{0}%
1418 \def\thissubsecnum{0}%
1420 \def\numsecentry##1##2##3##4{%
1421 \advancenumber{chap\thischapnum}%
1422 \def\thissecnum{##2}%
1423 \def\thissubsecnum{0}%
1425 \def\numsubsecentry##1##2##3##4{%
1426 \advancenumber{sec\thissecnum}%
1427 \def\thissubsecnum{##2}%
1429 \def\numsubsubsecentry##1##2##3##4{%
1430 \advancenumber{subsec\thissubsecnum}%
1432 \def\thischapnum{0}%
1433 \def\thissecnum{0}%
1434 \def\thissubsecnum{0}%
1436 % use \def rather than \let here because we redefine \chapentry et
1437 % al. a second time, below.
1438 \def\appentry{\numchapentry}%
1439 \def\appsecentry{\numsecentry}%
1440 \def\appsubsecentry{\numsubsecentry}%
1441 \def\appsubsubsecentry{\numsubsubsecentry}%
1442 \def\unnchapentry{\numchapentry}%
1443 \def\unnsecentry{\numsecentry}%
1444 \def\unnsubsecentry{\numsubsecentry}%
1445 \def\unnsubsubsecentry{\numsubsubsecentry}%
1446 \readdatafile{toc}%
1448 % Read toc second time, this time actually producing the outlines.
1449 % The `-' means take the \expnumber as the absolute number of
1450 % subentries, which we calculated on our first read of the .toc above.
1452 % We use the node names as the destinations.
1453 \def\numchapentry##1##2##3##4{%
1454 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1455 \def\numsecentry##1##2##3##4{%
1456 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1457 \def\numsubsecentry##1##2##3##4{%
1458 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1459 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1460 \dopdfoutline{##1}{}{##3}{##4}}%
1462 % PDF outlines are displayed using system fonts, instead of
1463 % document fonts. Therefore we cannot use special characters,
1464 % since the encoding is unknown. For example, the eogonek from
1465 % Latin 2 (0xea) gets translated to a | character. Info from
1466 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1468 % TODO this right, we have to translate 8-bit characters to
1469 % their "best" equivalent, based on the @documentencoding. Too
1470 % much work for too little return. Just use the ASCII equivalents
1471 % we use for the index sort strings.
1473 \indexnofonts
1474 \setupdatafile
1475 % We can have normal brace characters in the PDF outlines, unlike
1476 % Texinfo index files. So set that up.
1477 \def\{{\lbracecharliteral}%
1478 \def\}{\rbracecharliteral}%
1479 \catcode`\\=\active \otherbackslash
1480 \input \tocreadfilename
1481 \endgroup
1483 {\catcode`[=1 \catcode`]=2
1484 \catcode`{=\other \catcode`}=\other
1485 \gdef\lbracecharliteral[{]%
1486 \gdef\rbracecharliteral[}]%
1489 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1490 \ifx\PP\D\let\nextsp\relax
1491 \else\let\nextsp\skipspaces
1492 \addtokens{\filename}{\PP}%
1493 \advance\filenamelength by 1
1495 \nextsp}
1496 \def\getfilename#1{%
1497 \filenamelength=0
1498 % If we don't expand the argument now, \skipspaces will get
1499 % snagged on things like "@value{foo}".
1500 \edef\temp{#1}%
1501 \expandafter\skipspaces\temp|\relax
1503 \ifnum\pdftexversion < 14
1504 \let \startlink \pdfannotlink
1505 \else
1506 \let \startlink \pdfstartlink
1508 % make a live url in pdf output.
1509 \def\pdfurl#1{%
1510 \begingroup
1511 % it seems we really need yet another set of dummies; have not
1512 % tried to figure out what each command should do in the context
1513 % of @url. for now, just make @/ a no-op, that's the only one
1514 % people have actually reported a problem with.
1516 \normalturnoffactive
1517 \def\@{@}%
1518 \let\/=\empty
1519 \makevalueexpandable
1520 % do we want to go so far as to use \indexnofonts instead of just
1521 % special-casing \var here?
1522 \def\var##1{##1}%
1524 \leavevmode\setcolor{\urlcolor}%
1525 \startlink attr{/Border [0 0 0]}%
1526 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1527 \endgroup}
1528 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1529 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1530 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1531 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1532 \def\maketoks{%
1533 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1534 \ifx\first0\adn0
1535 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1536 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1537 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1538 \else
1539 \ifnum0=\countA\else\makelink\fi
1540 \ifx\first.\let\next=\done\else
1541 \let\next=\maketoks
1542 \addtokens{\toksB}{\the\toksD}
1543 \ifx\first,\addtokens{\toksB}{\space}\fi
1545 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1546 \next}
1547 \def\makelink{\addtokens{\toksB}%
1548 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1549 \def\pdflink#1{%
1550 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1551 \setcolor{\linkcolor}#1\endlink}
1552 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1553 \else
1554 % non-pdf mode
1555 \let\pdfmkdest = \gobble
1556 \let\pdfurl = \gobble
1557 \let\endlink = \relax
1558 \let\setcolor = \gobble
1559 \let\pdfsetcolor = \gobble
1560 \let\pdfmakeoutlines = \relax
1561 \fi % \ifx\pdfoutput
1564 % For XeTeX
1566 \ifx\XeTeXrevision\thisisundefined
1567 \else
1569 % XeTeX version check
1571 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1572 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1573 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1574 % For avoiding PDF destination name replacement, we use this special
1575 % instead of xdvipdfmx's command line option `-C 0x0010'.
1576 \special{dvipdfmx:config C 0x0010}
1577 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1578 % It can handle Unicode destination names for PDF.
1579 \txiuseunicodedestnametrue
1580 \else
1581 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1582 % `dvipdfmx:config' special.
1583 % So for avoiding PDF destination name replacement,
1584 % xdvipdfmx's command line option `-C 0x0010' is necessary.
1586 % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1587 % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1588 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1589 \txiuseunicodedestnamefalse
1592 % Color support
1594 \def\rgbDarkRed{0.50 0.09 0.12}
1595 \def\rgbBlack{0 0 0}
1597 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1599 % Set color, and create a mark which defines \thiscolor accordingly,
1600 % so that \makeheadline knows which color to restore.
1601 \def\setcolor#1{%
1602 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1603 \domark
1604 \pdfsetcolor{#1}%
1607 \def\maincolor{\rgbBlack}
1608 \pdfsetcolor{\maincolor}
1609 \edef\thiscolor{\maincolor}
1610 \def\lastcolordefs{}
1612 \def\makefootline{%
1613 \baselineskip24pt
1614 \line{\pdfsetcolor{\maincolor}\the\footline}%
1617 \def\makeheadline{%
1618 \vbox to 0pt{%
1619 \vskip-22.5pt
1620 \line{%
1621 \vbox to8.5pt{}%
1622 % Extract \thiscolor definition from the marks.
1623 \getcolormarks
1624 % Typeset the headline with \maincolor, then restore the color.
1625 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1627 \vss
1629 \nointerlineskip
1632 % PDF outline support
1634 % Emulate pdfTeX primitive
1635 \def\pdfdest name#1 xyz{%
1636 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1639 \def\setpdfdestname#1{{%
1640 % We have to set dummies so commands such as @code, and characters
1641 % such as \, aren't expanded when present in a section title.
1642 \indexnofonts
1643 \makevalueexpandable
1644 \turnoffactive
1645 \iftxiuseunicodedestname
1646 % Pass through Unicode characters.
1647 \else
1648 % Use ASCII approximations in destination names.
1649 \passthroughcharsfalse
1651 \def\pdfdestname{#1}%
1652 \txiescapepdf\pdfdestname
1655 \def\setpdfoutlinetext#1{{%
1656 \turnoffactive
1657 % Always use Unicode characters in title texts.
1658 \def\pdfoutlinetext{#1}%
1659 % For XeTeX, xdvipdfmx converts to UTF-16.
1660 % So we do not convert.
1661 \txiescapepdf\pdfoutlinetext
1664 \def\pdfmkdest#1{%
1665 \setpdfdestname{#1}%
1666 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1669 % by default, use black for everything.
1670 \def\urlcolor{\rgbBlack}
1671 \def\linkcolor{\rgbBlack}
1672 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1674 \def\dopdfoutline#1#2#3#4{%
1675 \setpdfoutlinetext{#1}
1676 \setpdfdestname{#3}
1677 \ifx\pdfdestname\empty
1678 \def\pdfdestname{#4}%
1681 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1682 << /S /GoTo /D (\pdfdestname) >> >> }%
1685 \def\pdfmakeoutlines{%
1686 \begingroup
1688 % For XeTeX, counts of subentries are not necessary.
1689 % Therefore, we read toc only once.
1691 % We use node names as destinations.
1692 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1693 \def\numchapentry##1##2##3##4{%
1694 \dopdfoutline{##1}{1}{##3}{##4}}%
1695 \def\numsecentry##1##2##3##4{%
1696 \dopdfoutline{##1}{2}{##3}{##4}}%
1697 \def\numsubsecentry##1##2##3##4{%
1698 \dopdfoutline{##1}{3}{##3}{##4}}%
1699 \def\numsubsubsecentry##1##2##3##4{%
1700 \dopdfoutline{##1}{4}{##3}{##4}}%
1702 \let\appentry\numchapentry%
1703 \let\appsecentry\numsecentry%
1704 \let\appsubsecentry\numsubsecentry%
1705 \let\appsubsubsecentry\numsubsubsecentry%
1706 \let\unnchapentry\numchapentry%
1707 \let\unnsecentry\numsecentry%
1708 \let\unnsubsecentry\numsubsecentry%
1709 \let\unnsubsubsecentry\numsubsubsecentry%
1711 % For XeTeX, xdvipdfmx converts strings to UTF-16.
1712 % Therefore, the encoding and the language may not be considered.
1714 \indexnofonts
1715 \setupdatafile
1716 % We can have normal brace characters in the PDF outlines, unlike
1717 % Texinfo index files. So set that up.
1718 \def\{{\lbracecharliteral}%
1719 \def\}{\rbracecharliteral}%
1720 \catcode`\\=\active \otherbackslash
1721 \input \tocreadfilename
1722 \endgroup
1724 {\catcode`[=1 \catcode`]=2
1725 \catcode`{=\other \catcode`}=\other
1726 \gdef\lbracecharliteral[{]%
1727 \gdef\rbracecharliteral[}]%
1730 \special{pdf:docview << /PageMode /UseOutlines >> }
1731 % ``\special{pdf:tounicode ...}'' is not necessary
1732 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1733 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1734 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1735 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1737 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1738 \ifx\PP\D\let\nextsp\relax
1739 \else\let\nextsp\skipspaces
1740 \addtokens{\filename}{\PP}%
1741 \advance\filenamelength by 1
1743 \nextsp}
1744 \def\getfilename#1{%
1745 \filenamelength=0
1746 % If we don't expand the argument now, \skipspaces will get
1747 % snagged on things like "@value{foo}".
1748 \edef\temp{#1}%
1749 \expandafter\skipspaces\temp|\relax
1751 % make a live url in pdf output.
1752 \def\pdfurl#1{%
1753 \begingroup
1754 % it seems we really need yet another set of dummies; have not
1755 % tried to figure out what each command should do in the context
1756 % of @url. for now, just make @/ a no-op, that's the only one
1757 % people have actually reported a problem with.
1759 \normalturnoffactive
1760 \def\@{@}%
1761 \let\/=\empty
1762 \makevalueexpandable
1763 % do we want to go so far as to use \indexnofonts instead of just
1764 % special-casing \var here?
1765 \def\var##1{##1}%
1767 \leavevmode\setcolor{\urlcolor}%
1768 \special{pdf:bann << /Border [0 0 0]
1769 /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1770 \endgroup}
1771 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1772 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1773 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1774 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1775 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1776 \def\maketoks{%
1777 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1778 \ifx\first0\adn0
1779 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1780 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1781 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1782 \else
1783 \ifnum0=\countA\else\makelink\fi
1784 \ifx\first.\let\next=\done\else
1785 \let\next=\maketoks
1786 \addtokens{\toksB}{\the\toksD}
1787 \ifx\first,\addtokens{\toksB}{\space}\fi
1789 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1790 \next}
1791 \def\makelink{\addtokens{\toksB}%
1792 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1793 \def\pdflink#1{%
1794 \special{pdf:bann << /Border [0 0 0]
1795 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1796 \setcolor{\linkcolor}#1\endlink}
1797 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1800 % @image support
1802 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1803 \def\doxeteximage#1#2#3{%
1804 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1805 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1807 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1808 % others). Let's try in that order, PDF first since if
1809 % someone has a scalable image, presumably better to use that than a
1810 % bitmap.
1811 \let\xeteximgext=\empty
1812 \begingroup
1813 \openin 1 #1.pdf \ifeof 1
1814 \openin 1 #1.PDF \ifeof 1
1815 \openin 1 #1.png \ifeof 1
1816 \openin 1 #1.jpg \ifeof 1
1817 \openin 1 #1.jpeg \ifeof 1
1818 \openin 1 #1.JPG \ifeof 1
1819 \errmessage{Could not find image file #1 for XeTeX}%
1820 \else \gdef\xeteximgext{JPG}%
1822 \else \gdef\xeteximgext{jpeg}%
1824 \else \gdef\xeteximgext{jpg}%
1826 \else \gdef\xeteximgext{png}%
1828 \else \gdef\xeteximgext{PDF}%
1830 \else \gdef\xeteximgext{pdf}%
1832 \closein 1
1833 \endgroup
1835 \def\xetexpdfext{pdf}%
1836 \ifx\xeteximgext\xetexpdfext
1837 \XeTeXpdffile "#1".\xeteximgext ""
1838 \else
1839 \def\xetexpdfext{PDF}%
1840 \ifx\xeteximgext\xetexpdfext
1841 \XeTeXpdffile "#1".\xeteximgext ""
1842 \else
1843 \XeTeXpicfile "#1".\xeteximgext ""
1846 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1847 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1853 \message{fonts,}
1855 % Set the baselineskip to #1, and the lineskip and strut size
1856 % correspondingly. There is no deep meaning behind these magic numbers
1857 % used as factors; they just match (closely enough) what Knuth defined.
1859 \def\lineskipfactor{.08333}
1860 \def\strutheightpercent{.70833}
1861 \def\strutdepthpercent {.29167}
1863 % can get a sort of poor man's double spacing by redefining this.
1864 \def\baselinefactor{1}
1866 \newdimen\textleading
1867 \def\setleading#1{%
1868 \dimen0 = #1\relax
1869 \normalbaselineskip = \baselinefactor\dimen0
1870 \normallineskip = \lineskipfactor\normalbaselineskip
1871 \normalbaselines
1872 \setbox\strutbox =\hbox{%
1873 \vrule width0pt height\strutheightpercent\baselineskip
1874 depth \strutdepthpercent \baselineskip
1878 % PDF CMaps. See also LaTeX's t1.cmap.
1880 % do nothing with this by default.
1881 \expandafter\let\csname cmapOT1\endcsname\gobble
1882 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1883 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1885 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1886 % (\pdffontattr was introduced many years ago, but people still run
1887 % older pdftex's; it's easy to conditionalize, so we do.)
1888 \ifpdf \ifx\pdffontattr\thisisundefined \else
1889 \begingroup
1890 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1891 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1892 %%DocumentNeededResources: ProcSet (CIDInit)
1893 %%IncludeResource: ProcSet (CIDInit)
1894 %%BeginResource: CMap (TeX-OT1-0)
1895 %%Title: (TeX-OT1-0 TeX OT1 0)
1896 %%Version: 1.000
1897 %%EndComments
1898 /CIDInit /ProcSet findresource begin
1899 12 dict begin
1900 begincmap
1901 /CIDSystemInfo
1902 << /Registry (TeX)
1903 /Ordering (OT1)
1904 /Supplement 0
1905 >> def
1906 /CMapName /TeX-OT1-0 def
1907 /CMapType 2 def
1908 1 begincodespacerange
1909 <00> <7F>
1910 endcodespacerange
1911 8 beginbfrange
1912 <00> <01> <0393>
1913 <09> <0A> <03A8>
1914 <23> <26> <0023>
1915 <28> <3B> <0028>
1916 <3F> <5B> <003F>
1917 <5D> <5E> <005D>
1918 <61> <7A> <0061>
1919 <7B> <7C> <2013>
1920 endbfrange
1921 40 beginbfchar
1922 <02> <0398>
1923 <03> <039B>
1924 <04> <039E>
1925 <05> <03A0>
1926 <06> <03A3>
1927 <07> <03D2>
1928 <08> <03A6>
1929 <0B> <00660066>
1930 <0C> <00660069>
1931 <0D> <0066006C>
1932 <0E> <006600660069>
1933 <0F> <00660066006C>
1934 <10> <0131>
1935 <11> <0237>
1936 <12> <0060>
1937 <13> <00B4>
1938 <14> <02C7>
1939 <15> <02D8>
1940 <16> <00AF>
1941 <17> <02DA>
1942 <18> <00B8>
1943 <19> <00DF>
1944 <1A> <00E6>
1945 <1B> <0153>
1946 <1C> <00F8>
1947 <1D> <00C6>
1948 <1E> <0152>
1949 <1F> <00D8>
1950 <21> <0021>
1951 <22> <201D>
1952 <27> <2019>
1953 <3C> <00A1>
1954 <3D> <003D>
1955 <3E> <00BF>
1956 <5C> <201C>
1957 <5F> <02D9>
1958 <60> <2018>
1959 <7D> <02DD>
1960 <7E> <007E>
1961 <7F> <00A8>
1962 endbfchar
1963 endcmap
1964 CMapName currentdict /CMap defineresource pop
1967 %%EndResource
1968 %%EOF
1969 }\endgroup
1970 \expandafter\edef\csname cmapOT1\endcsname#1{%
1971 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1974 % \cmapOT1IT
1975 \begingroup
1976 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1977 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1978 %%DocumentNeededResources: ProcSet (CIDInit)
1979 %%IncludeResource: ProcSet (CIDInit)
1980 %%BeginResource: CMap (TeX-OT1IT-0)
1981 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1982 %%Version: 1.000
1983 %%EndComments
1984 /CIDInit /ProcSet findresource begin
1985 12 dict begin
1986 begincmap
1987 /CIDSystemInfo
1988 << /Registry (TeX)
1989 /Ordering (OT1IT)
1990 /Supplement 0
1991 >> def
1992 /CMapName /TeX-OT1IT-0 def
1993 /CMapType 2 def
1994 1 begincodespacerange
1995 <00> <7F>
1996 endcodespacerange
1997 8 beginbfrange
1998 <00> <01> <0393>
1999 <09> <0A> <03A8>
2000 <25> <26> <0025>
2001 <28> <3B> <0028>
2002 <3F> <5B> <003F>
2003 <5D> <5E> <005D>
2004 <61> <7A> <0061>
2005 <7B> <7C> <2013>
2006 endbfrange
2007 42 beginbfchar
2008 <02> <0398>
2009 <03> <039B>
2010 <04> <039E>
2011 <05> <03A0>
2012 <06> <03A3>
2013 <07> <03D2>
2014 <08> <03A6>
2015 <0B> <00660066>
2016 <0C> <00660069>
2017 <0D> <0066006C>
2018 <0E> <006600660069>
2019 <0F> <00660066006C>
2020 <10> <0131>
2021 <11> <0237>
2022 <12> <0060>
2023 <13> <00B4>
2024 <14> <02C7>
2025 <15> <02D8>
2026 <16> <00AF>
2027 <17> <02DA>
2028 <18> <00B8>
2029 <19> <00DF>
2030 <1A> <00E6>
2031 <1B> <0153>
2032 <1C> <00F8>
2033 <1D> <00C6>
2034 <1E> <0152>
2035 <1F> <00D8>
2036 <21> <0021>
2037 <22> <201D>
2038 <23> <0023>
2039 <24> <00A3>
2040 <27> <2019>
2041 <3C> <00A1>
2042 <3D> <003D>
2043 <3E> <00BF>
2044 <5C> <201C>
2045 <5F> <02D9>
2046 <60> <2018>
2047 <7D> <02DD>
2048 <7E> <007E>
2049 <7F> <00A8>
2050 endbfchar
2051 endcmap
2052 CMapName currentdict /CMap defineresource pop
2055 %%EndResource
2056 %%EOF
2057 }\endgroup
2058 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2059 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2062 % \cmapOT1TT
2063 \begingroup
2064 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2065 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2066 %%DocumentNeededResources: ProcSet (CIDInit)
2067 %%IncludeResource: ProcSet (CIDInit)
2068 %%BeginResource: CMap (TeX-OT1TT-0)
2069 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2070 %%Version: 1.000
2071 %%EndComments
2072 /CIDInit /ProcSet findresource begin
2073 12 dict begin
2074 begincmap
2075 /CIDSystemInfo
2076 << /Registry (TeX)
2077 /Ordering (OT1TT)
2078 /Supplement 0
2079 >> def
2080 /CMapName /TeX-OT1TT-0 def
2081 /CMapType 2 def
2082 1 begincodespacerange
2083 <00> <7F>
2084 endcodespacerange
2085 5 beginbfrange
2086 <00> <01> <0393>
2087 <09> <0A> <03A8>
2088 <21> <26> <0021>
2089 <28> <5F> <0028>
2090 <61> <7E> <0061>
2091 endbfrange
2092 32 beginbfchar
2093 <02> <0398>
2094 <03> <039B>
2095 <04> <039E>
2096 <05> <03A0>
2097 <06> <03A3>
2098 <07> <03D2>
2099 <08> <03A6>
2100 <0B> <2191>
2101 <0C> <2193>
2102 <0D> <0027>
2103 <0E> <00A1>
2104 <0F> <00BF>
2105 <10> <0131>
2106 <11> <0237>
2107 <12> <0060>
2108 <13> <00B4>
2109 <14> <02C7>
2110 <15> <02D8>
2111 <16> <00AF>
2112 <17> <02DA>
2113 <18> <00B8>
2114 <19> <00DF>
2115 <1A> <00E6>
2116 <1B> <0153>
2117 <1C> <00F8>
2118 <1D> <00C6>
2119 <1E> <0152>
2120 <1F> <00D8>
2121 <20> <2423>
2122 <27> <2019>
2123 <60> <2018>
2124 <7F> <00A8>
2125 endbfchar
2126 endcmap
2127 CMapName currentdict /CMap defineresource pop
2130 %%EndResource
2131 %%EOF
2132 }\endgroup
2133 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2134 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2136 \fi\fi
2139 % Set the font macro #1 to the font named \fontprefix#2.
2140 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2141 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2142 % Example:
2143 % #1 = \textrm
2144 % #2 = \rmshape
2145 % #3 = 10
2146 % #4 = \mainmagstep
2147 % #5 = OT1
2149 \def\setfont#1#2#3#4#5{%
2150 \font#1=\fontprefix#2#3 scaled #4
2151 \csname cmap#5\endcsname#1%
2153 % This is what gets called when #5 of \setfont is empty.
2154 \let\cmap\gobble
2156 % (end of cmaps)
2158 % Use cm as the default font prefix.
2159 % To specify the font prefix, you must define \fontprefix
2160 % before you read in texinfo.tex.
2161 \ifx\fontprefix\thisisundefined
2162 \def\fontprefix{cm}
2164 % Support font families that don't use the same naming scheme as CM.
2165 \def\rmshape{r}
2166 \def\rmbshape{bx} % where the normal face is bold
2167 \def\bfshape{b}
2168 \def\bxshape{bx}
2169 \def\ttshape{tt}
2170 \def\ttbshape{tt}
2171 \def\ttslshape{sltt}
2172 \def\itshape{ti}
2173 \def\itbshape{bxti}
2174 \def\slshape{sl}
2175 \def\slbshape{bxsl}
2176 \def\sfshape{ss}
2177 \def\sfbshape{ss}
2178 \def\scshape{csc}
2179 \def\scbshape{csc}
2181 % Definitions for a main text size of 11pt. (The default in Texinfo.)
2183 \def\definetextfontsizexi{%
2184 % Text fonts (11.2pt, magstep1).
2185 \def\textnominalsize{11pt}
2186 \edef\mainmagstep{\magstephalf}
2187 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2188 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2189 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2190 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2191 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2192 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2193 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2194 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2195 \font\texti=cmmi10 scaled \mainmagstep
2196 \font\textsy=cmsy10 scaled \mainmagstep
2197 \def\textecsize{1095}
2199 % A few fonts for @defun names and args.
2200 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
2201 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2202 \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
2203 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2204 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2205 \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2207 % Fonts for indices, footnotes, small examples (9pt).
2208 \def\smallnominalsize{9pt}
2209 \setfont\smallrm\rmshape{9}{1000}{OT1}
2210 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2211 \setfont\smallbf\bfshape{10}{900}{OT1}
2212 \setfont\smallit\itshape{9}{1000}{OT1IT}
2213 \setfont\smallsl\slshape{9}{1000}{OT1}
2214 \setfont\smallsf\sfshape{9}{1000}{OT1}
2215 \setfont\smallsc\scshape{10}{900}{OT1}
2216 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2217 \font\smalli=cmmi9
2218 \font\smallsy=cmsy9
2219 \def\smallecsize{0900}
2221 % Fonts for small examples (8pt).
2222 \def\smallernominalsize{8pt}
2223 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2224 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2225 \setfont\smallerbf\bfshape{10}{800}{OT1}
2226 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2227 \setfont\smallersl\slshape{8}{1000}{OT1}
2228 \setfont\smallersf\sfshape{8}{1000}{OT1}
2229 \setfont\smallersc\scshape{10}{800}{OT1}
2230 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2231 \font\smalleri=cmmi8
2232 \font\smallersy=cmsy8
2233 \def\smallerecsize{0800}
2235 % Fonts for title page (20.4pt):
2236 \def\titlenominalsize{20pt}
2237 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2238 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2239 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2240 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2241 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2242 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2243 \let\titlebf=\titlerm
2244 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2245 \font\titlei=cmmi12 scaled \magstep3
2246 \font\titlesy=cmsy10 scaled \magstep4
2247 \def\titleecsize{2074}
2249 % Chapter (and unnumbered) fonts (17.28pt).
2250 \def\chapnominalsize{17pt}
2251 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2252 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2253 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2254 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2255 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2256 \setfont\chapsf\sfbshape{17}{1000}{OT1}
2257 \let\chapbf=\chaprm
2258 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2259 \font\chapi=cmmi12 scaled \magstep2
2260 \font\chapsy=cmsy10 scaled \magstep3
2261 \def\chapecsize{1728}
2263 % Section fonts (14.4pt).
2264 \def\secnominalsize{14pt}
2265 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2266 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2267 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2268 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
2269 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2270 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2271 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2272 \let\secbf\secrm
2273 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
2274 \font\seci=cmmi12 scaled \magstep1
2275 \font\secsy=cmsy10 scaled \magstep2
2276 \def\sececsize{1440}
2278 % Subsection fonts (13.15pt).
2279 \def\ssecnominalsize{13pt}
2280 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2281 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
2282 \setfont\ssecsl\slbshape{10}{1315}{OT1}
2283 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2284 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2285 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2286 \let\ssecbf\ssecrm
2287 \setfont\ssecsc\scbshape{10}{1315}{OT1}
2288 \font\sseci=cmmi12 scaled \magstephalf
2289 \font\ssecsy=cmsy10 scaled 1315
2290 \def\ssececsize{1200}
2292 % Reduced fonts for @acronym in text (10pt).
2293 \def\reducednominalsize{10pt}
2294 \setfont\reducedrm\rmshape{10}{1000}{OT1}
2295 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2296 \setfont\reducedbf\bfshape{10}{1000}{OT1}
2297 \setfont\reducedit\itshape{10}{1000}{OT1IT}
2298 \setfont\reducedsl\slshape{10}{1000}{OT1}
2299 \setfont\reducedsf\sfshape{10}{1000}{OT1}
2300 \setfont\reducedsc\scshape{10}{1000}{OT1}
2301 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2302 \font\reducedi=cmmi10
2303 \font\reducedsy=cmsy10
2304 \def\reducedecsize{1000}
2306 \textleading = 13.2pt % line spacing for 11pt CM
2307 \textfonts % reset the current fonts
2309 } % end of 11pt text font size definitions, \definetextfontsizexi
2312 % Definitions to make the main text be 10pt Computer Modern, with
2313 % section, chapter, etc., sizes following suit. This is for the GNU
2314 % Press printing of the Emacs 22 manual. Maybe other manuals in the
2315 % future. Used with @smallbook, which sets the leading to 12pt.
2317 \def\definetextfontsizex{%
2318 % Text fonts (10pt).
2319 \def\textnominalsize{10pt}
2320 \edef\mainmagstep{1000}
2321 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2322 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2323 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2324 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2325 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2326 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2327 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2328 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2329 \font\texti=cmmi10 scaled \mainmagstep
2330 \font\textsy=cmsy10 scaled \mainmagstep
2331 \def\textecsize{1000}
2333 % A few fonts for @defun names and args.
2334 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2335 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2336 \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
2337 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2338 \def\df{\let\ttfont=\deftt \let\bffont = \defbf
2339 \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2341 % Fonts for indices, footnotes, small examples (9pt).
2342 \def\smallnominalsize{9pt}
2343 \setfont\smallrm\rmshape{9}{1000}{OT1}
2344 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
2345 \setfont\smallbf\bfshape{10}{900}{OT1}
2346 \setfont\smallit\itshape{9}{1000}{OT1IT}
2347 \setfont\smallsl\slshape{9}{1000}{OT1}
2348 \setfont\smallsf\sfshape{9}{1000}{OT1}
2349 \setfont\smallsc\scshape{10}{900}{OT1}
2350 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2351 \font\smalli=cmmi9
2352 \font\smallsy=cmsy9
2353 \def\smallecsize{0900}
2355 % Fonts for small examples (8pt).
2356 \def\smallernominalsize{8pt}
2357 \setfont\smallerrm\rmshape{8}{1000}{OT1}
2358 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2359 \setfont\smallerbf\bfshape{10}{800}{OT1}
2360 \setfont\smallerit\itshape{8}{1000}{OT1IT}
2361 \setfont\smallersl\slshape{8}{1000}{OT1}
2362 \setfont\smallersf\sfshape{8}{1000}{OT1}
2363 \setfont\smallersc\scshape{10}{800}{OT1}
2364 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2365 \font\smalleri=cmmi8
2366 \font\smallersy=cmsy8
2367 \def\smallerecsize{0800}
2369 % Fonts for title page (20.4pt):
2370 \def\titlenominalsize{20pt}
2371 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2372 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2373 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2374 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2375 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2376 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2377 \let\titlebf=\titlerm
2378 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2379 \font\titlei=cmmi12 scaled \magstep3
2380 \font\titlesy=cmsy10 scaled \magstep4
2381 \def\titleecsize{2074}
2383 % Chapter fonts (14.4pt).
2384 \def\chapnominalsize{14pt}
2385 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2386 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2387 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2388 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2389 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2390 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2391 \let\chapbf\chaprm
2392 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2393 \font\chapi=cmmi12 scaled \magstep1
2394 \font\chapsy=cmsy10 scaled \magstep2
2395 \def\chapecsize{1440}
2397 % Section fonts (12pt).
2398 \def\secnominalsize{12pt}
2399 \setfont\secrm\rmbshape{12}{1000}{OT1}
2400 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2401 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2402 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2403 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2404 \setfont\secsf\sfbshape{12}{1000}{OT1}
2405 \let\secbf\secrm
2406 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2407 \font\seci=cmmi12
2408 \font\secsy=cmsy10 scaled \magstep1
2409 \def\sececsize{1200}
2411 % Subsection fonts (10pt).
2412 \def\ssecnominalsize{10pt}
2413 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2414 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2415 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2416 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2417 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2418 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2419 \let\ssecbf\ssecrm
2420 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2421 \font\sseci=cmmi10
2422 \font\ssecsy=cmsy10
2423 \def\ssececsize{1000}
2425 % Reduced fonts for @acronym in text (9pt).
2426 \def\reducednominalsize{9pt}
2427 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2428 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2429 \setfont\reducedbf\bfshape{10}{900}{OT1}
2430 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2431 \setfont\reducedsl\slshape{9}{1000}{OT1}
2432 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2433 \setfont\reducedsc\scshape{10}{900}{OT1}
2434 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2435 \font\reducedi=cmmi9
2436 \font\reducedsy=cmsy9
2437 \def\reducedecsize{0900}
2439 \divide\parskip by 2 % reduce space between paragraphs
2440 \textleading = 12pt % line spacing for 10pt CM
2441 \textfonts % reset the current fonts
2443 } % end of 10pt text font size definitions, \definetextfontsizex
2445 % Fonts for short table of contents.
2446 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2447 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2448 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2449 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2452 % We provide the user-level command
2453 % @fonttextsize 10
2454 % (or 11) to redefine the text font size. pt is assumed.
2456 \def\xiword{11}
2457 \def\xword{10}
2458 \def\xwordpt{10pt}
2460 \parseargdef\fonttextsize{%
2461 \def\textsizearg{#1}%
2462 %\wlog{doing @fonttextsize \textsizearg}%
2464 % Set \globaldefs so that documents can use this inside @tex, since
2465 % makeinfo 4.8 does not support it, but we need it nonetheless.
2467 \begingroup \globaldefs=1
2468 \ifx\textsizearg\xword \definetextfontsizex
2469 \else \ifx\textsizearg\xiword \definetextfontsizexi
2470 \else
2471 \errhelp=\EMsimple
2472 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2473 \fi\fi
2474 \endgroup
2478 % Change the current font style to #1, remembering it in \curfontstyle.
2479 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2480 % italics, not bold italics.
2482 \def\setfontstyle#1{%
2483 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2484 \csname #1font\endcsname % change the current font
2487 \def\rm{\fam=0 \setfontstyle{rm}}
2488 \def\it{\fam=\itfam \setfontstyle{it}}
2489 \def\sl{\fam=\slfam \setfontstyle{sl}}
2490 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2491 \def\tt{\fam=\ttfam \setfontstyle{tt}}
2493 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
2494 % So we set up a \sf.
2495 \newfam\sffam
2496 \def\sf{\fam=\sffam \setfontstyle{sf}}
2498 % We don't need math for this font style.
2499 \def\ttsl{\setfontstyle{ttsl}}
2502 % In order for the font changes to affect most math symbols and letters,
2503 % we have to define the \textfont of the standard families. We don't
2504 % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
2506 \def\resetmathfonts{%
2507 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2508 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2509 \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2514 % The font-changing commands (all called \...fonts) redefine the meanings
2515 % of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
2516 % to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
2517 % commands hardwire \STYLEfont to set the current font.
2519 % Each font-changing command also sets the names \lsize (one size lower)
2520 % and \lllsize (three sizes lower). These relative commands are used
2521 % in, e.g., the LaTeX logo and acronyms.
2523 % This all needs generalizing, badly.
2526 \def\assignfonts#1{%
2527 \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
2528 \expandafter\let\expandafter\itfont\csname #1it\endcsname
2529 \expandafter\let\expandafter\slfont\csname #1sl\endcsname
2530 \expandafter\let\expandafter\bffont\csname #1bf\endcsname
2531 \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
2532 \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
2533 \expandafter\let\expandafter\sffont \csname #1sf\endcsname
2534 \expandafter\let\expandafter\ifont \csname #1i\endcsname
2535 \expandafter\let\expandafter\syfont \csname #1sy\endcsname
2536 \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
2539 \newif\ifrmisbold
2541 % Select smaller font size with the current style. Used to change font size
2542 % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
2543 % normal roman text, also use bold fonts for roman text in the smaller size.
2544 \def\switchtolllsize{%
2545 \expandafter\assignfonts\expandafter{\lllsize}%
2546 \ifrmisbold
2547 \let\rmfont\bffont
2549 \csname\curfontstyle\endcsname
2552 \def\switchtolsize{%
2553 \expandafter\assignfonts\expandafter{\lsize}%
2554 \ifrmisbold
2555 \let\rmfont\bffont
2557 \csname\curfontstyle\endcsname
2560 \def\definefontsetatsize#1#2#3#4#5{%
2561 \expandafter\def\csname #1fonts\endcsname{%
2562 \def\curfontsize{#1}%
2563 \def\lsize{#2}\def\lllsize{#3}%
2564 \csname rmisbold#5\endcsname
2565 \assignfonts{#1}%
2566 \resetmathfonts
2567 \setleading{#4}%
2570 \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
2571 \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
2572 \definefontsetatsize{chap} {sec} {text} {19pt} {true}
2573 \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
2574 \definefontsetatsize{ssec} {text} {small} {15pt} {true}
2575 \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
2576 \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
2577 \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2579 \def\titlefont#1{{\titlefonts\rm #1}}
2580 \let\subsecfonts = \ssecfonts
2581 \let\subsubsecfonts = \ssecfonts
2583 % Define these just so they can be easily changed for other fonts.
2584 \def\angleleft{$\langle$}
2585 \def\angleright{$\rangle$}
2587 % Set the fonts to use with the @small... environments.
2588 \let\smallexamplefonts = \smallfonts
2590 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2591 % can fit this many characters:
2592 % 8.5x11=86 smallbook=72 a4=90 a5=69
2593 % If we use \scriptfonts (8pt), then we can fit this many characters:
2594 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2595 % For me, subjectively, the few extra characters that fit aren't worth
2596 % the additional smallness of 8pt. So I'm making the default 9pt.
2598 % By the way, for comparison, here's what fits with @example (10pt):
2599 % 8.5x11=71 smallbook=60 a4=75 a5=58
2600 % --karl, 24jan03.
2602 % Set up the default fonts, so we can use them for creating boxes.
2604 \definetextfontsizexi
2607 \message{markup,}
2609 % Check if we are currently using a typewriter font. Since all the
2610 % Computer Modern typewriter fonts have zero interword stretch (and
2611 % shrink), and it is reasonable to expect all typewriter fonts to have
2612 % this property, we can check that font parameter.
2614 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2616 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2617 % define and register \INITMACRO to be called on markup style changes.
2618 % \INITMACRO can check \currentmarkupstyle for the innermost
2619 % style.
2621 \let\currentmarkupstyle\empty
2623 \def\setupmarkupstyle#1{%
2624 \def\currentmarkupstyle{#1}%
2625 \markupstylesetup
2628 \let\markupstylesetup\empty
2630 \def\defmarkupstylesetup#1{%
2631 \expandafter\def\expandafter\markupstylesetup
2632 \expandafter{\markupstylesetup #1}%
2633 \def#1%
2636 % Markup style setup for left and right quotes.
2637 \defmarkupstylesetup\markupsetuplq{%
2638 \expandafter\let\expandafter \temp
2639 \csname markupsetuplq\currentmarkupstyle\endcsname
2640 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2643 \defmarkupstylesetup\markupsetuprq{%
2644 \expandafter\let\expandafter \temp
2645 \csname markupsetuprq\currentmarkupstyle\endcsname
2646 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2650 \catcode`\'=\active
2651 \catcode`\`=\active
2653 \gdef\markupsetuplqdefault{\let`\lq}
2654 \gdef\markupsetuprqdefault{\let'\rq}
2656 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2657 \gdef\markupsetcodequoteright{\let'\codequoteright}
2660 \let\markupsetuplqcode \markupsetcodequoteleft
2661 \let\markupsetuprqcode \markupsetcodequoteright
2663 \let\markupsetuplqexample \markupsetcodequoteleft
2664 \let\markupsetuprqexample \markupsetcodequoteright
2666 \let\markupsetuplqkbd \markupsetcodequoteleft
2667 \let\markupsetuprqkbd \markupsetcodequoteright
2669 \let\markupsetuplqsamp \markupsetcodequoteleft
2670 \let\markupsetuprqsamp \markupsetcodequoteright
2672 \let\markupsetuplqverb \markupsetcodequoteleft
2673 \let\markupsetuprqverb \markupsetcodequoteright
2675 \let\markupsetuplqverbatim \markupsetcodequoteleft
2676 \let\markupsetuprqverbatim \markupsetcodequoteright
2678 % Allow an option to not use regular directed right quote/apostrophe
2679 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2680 % The undirected quote is ugly, so don't make it the default, but it
2681 % works for pasting with more pdf viewers (at least evince), the
2682 % lilypond developers report. xpdf does work with the regular 0x27.
2684 \def\codequoteright{%
2685 \ifmonospace
2686 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2687 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2689 \else \char'15 \fi
2690 \else \char'15 \fi
2691 \else
2696 % and a similar option for the left quote char vs. a grave accent.
2697 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2698 % the code environments to do likewise.
2700 \def\codequoteleft{%
2701 \ifmonospace
2702 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2703 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2704 % [Knuth] pp. 380,381,391
2705 % \relax disables Spanish ligatures ?` and !` of \tt font.
2706 \relax`%
2707 \else \char'22 \fi
2708 \else \char'22 \fi
2709 \else
2710 \relax`%
2714 % Commands to set the quote options.
2716 \parseargdef\codequoteundirected{%
2717 \def\temp{#1}%
2718 \ifx\temp\onword
2719 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2720 = t%
2721 \else\ifx\temp\offword
2722 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2723 = \relax
2724 \else
2725 \errhelp = \EMsimple
2726 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2727 \fi\fi
2730 \parseargdef\codequotebacktick{%
2731 \def\temp{#1}%
2732 \ifx\temp\onword
2733 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2734 = t%
2735 \else\ifx\temp\offword
2736 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2737 = \relax
2738 \else
2739 \errhelp = \EMsimple
2740 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2741 \fi\fi
2744 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2745 \def\noligaturesquoteleft{\relax\lq}
2747 % Count depth in font-changes, for error checks
2748 \newcount\fontdepth \fontdepth=0
2750 % Font commands.
2752 % #1 is the font command (\sl or \it), #2 is the text to slant.
2753 % If we are in a monospaced environment, however, 1) always use \ttsl,
2754 % and 2) do not add an italic correction.
2755 \def\dosmartslant#1#2{%
2756 \ifusingtt
2757 {{\ttsl #2}\let\next=\relax}%
2758 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2759 \next
2761 \def\smartslanted{\dosmartslant\sl}
2762 \def\smartitalic{\dosmartslant\it}
2764 % Output an italic correction unless \next (presumed to be the following
2765 % character) is such as not to need one.
2766 \def\smartitaliccorrection{%
2767 \ifx\next,%
2768 \else\ifx\next-%
2769 \else\ifx\next.%
2770 \else\ifx\next\.%
2771 \else\ifx\next\comma%
2772 \else\ptexslash
2773 \fi\fi\fi\fi\fi
2774 \aftersmartic
2777 % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2778 \def\ttslanted#1{{\ttsl #1}}
2780 % @cite is like \smartslanted except unconditionally use \sl. We never want
2781 % ttsl for book titles, do we?
2782 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2784 \def\aftersmartic{}
2785 \def\var#1{%
2786 \let\saveaftersmartic = \aftersmartic
2787 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2788 \smartslanted{#1}%
2791 \let\i=\smartitalic
2792 \let\slanted=\smartslanted
2793 \let\dfn=\smartslanted
2794 \let\emph=\smartitalic
2796 % Explicit font changes: @r, @sc, undocumented @ii.
2797 \def\r#1{{\rm #1}} % roman font
2798 \def\sc#1{{\smallcaps#1}} % smallcaps font
2799 \def\ii#1{{\it #1}} % italic font
2801 % @b, explicit bold. Also @strong.
2802 \def\b#1{{\bf #1}}
2803 \let\strong=\b
2805 % @sansserif, explicit sans.
2806 \def\sansserif#1{{\sf #1}}
2808 % We can't just use \exhyphenpenalty, because that only has effect at
2809 % the end of a paragraph. Restore normal hyphenation at the end of the
2810 % group within which \nohyphenation is presumably called.
2812 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2813 \def\restorehyphenation{\hyphenchar\font = `- }
2815 % Set sfcode to normal for the chars that usually have another value.
2816 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2817 % sometimes \x has an active definition that messes things up.
2819 \catcode`@=11
2820 \def\plainfrenchspacing{%
2821 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2822 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2823 \def\endofsentencespacefactor{1000}% for @. and friends
2825 \def\plainnonfrenchspacing{%
2826 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2827 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2828 \def\endofsentencespacefactor{3000}% for @. and friends
2830 \catcode`@=\other
2831 \def\endofsentencespacefactor{3000}% default
2833 % @t, explicit typewriter.
2834 \def\t#1{%
2835 {\tt \rawbackslash \plainfrenchspacing #1}%
2836 \null
2839 % @samp.
2840 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2842 % @indicateurl is \samp, that is, with quotes.
2843 \let\indicateurl=\samp
2845 % @code (and similar) prints in typewriter, but with spaces the same
2846 % size as normal in the surrounding text, without hyphenation, etc.
2847 % This is a subroutine for that.
2848 \def\tclose#1{%
2850 % Change normal interword space to be same as for the current font.
2851 \spaceskip = \fontdimen2\font
2853 % Switch to typewriter.
2856 % But `\ ' produces the large typewriter interword space.
2857 \def\ {{\spaceskip = 0pt{} }}%
2859 % Turn off hyphenation.
2860 \nohyphenation
2862 \rawbackslash
2863 \plainfrenchspacing
2866 \null % reset spacefactor to 1000
2869 % We *must* turn on hyphenation at `-' and `_' in @code.
2870 % (But see \codedashfinish below.)
2871 % Otherwise, it is too hard to avoid overfull hboxes
2872 % in the Emacs manual, the Library manual, etc.
2874 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2875 % both hyphenation at - and hyphenation within words.
2876 % We must therefore turn them both off (\tclose does that)
2877 % and arrange explicitly to hyphenate at a dash. -- rms.
2879 \catcode`\-=\active \catcode`\_=\active
2880 \catcode`\'=\active \catcode`\`=\active
2881 \global\let'=\rq \global\let`=\lq % default definitions
2883 \global\def\code{\begingroup
2884 \setupmarkupstyle{code}%
2885 % The following should really be moved into \setupmarkupstyle handlers.
2886 \catcode\dashChar=\active \catcode\underChar=\active
2887 \ifallowcodebreaks
2888 \let-\codedash
2889 \let_\codeunder
2890 \else
2891 \let-\normaldash
2892 \let_\realunder
2894 % Given -foo (with a single dash), we do not want to allow a break
2895 % after the hyphen.
2896 \global\let\codedashprev=\codedash
2898 \codex
2901 \gdef\codedash{\futurelet\next\codedashfinish}
2902 \gdef\codedashfinish{%
2903 \normaldash % always output the dash character itself.
2905 % Now, output a discretionary to allow a line break, unless
2906 % (a) the next character is a -, or
2907 % (b) the preceding character is a -.
2908 % E.g., given --posix, we do not want to allow a break after either -.
2909 % Given --foo-bar, we do want to allow a break between the - and the b.
2910 \ifx\next\codedash \else
2911 \ifx\codedashprev\codedash
2912 \else \discretionary{}{}{}\fi
2914 % we need the space after the = for the case when \next itself is a
2915 % space token; it would get swallowed otherwise. As in @code{- a}.
2916 \global\let\codedashprev= \next
2919 \def\normaldash{-}
2921 \def\codex #1{\tclose{#1}\endgroup}
2923 \def\codeunder{%
2924 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2925 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2926 % will therefore expand the active definition of _, which is us
2927 % (inside @code that is), therefore an endless loop.
2928 \ifusingtt{\ifmmode
2929 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2930 \else\normalunderscore \fi
2931 \discretionary{}{}{}}%
2932 {\_}%
2935 % An additional complication: the above will allow breaks after, e.g.,
2936 % each of the four underscores in __typeof__. This is bad.
2937 % @allowcodebreaks provides a document-level way to turn breaking at -
2938 % and _ on and off.
2940 \newif\ifallowcodebreaks \allowcodebreakstrue
2942 \def\keywordtrue{true}
2943 \def\keywordfalse{false}
2945 \parseargdef\allowcodebreaks{%
2946 \def\txiarg{#1}%
2947 \ifx\txiarg\keywordtrue
2948 \allowcodebreakstrue
2949 \else\ifx\txiarg\keywordfalse
2950 \allowcodebreaksfalse
2951 \else
2952 \errhelp = \EMsimple
2953 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2954 \fi\fi
2957 % For @command, @env, @file, @option quotes seem unnecessary,
2958 % so use \code rather than \samp.
2959 \let\command=\code
2960 \let\env=\code
2961 \let\file=\code
2962 \let\option=\code
2964 % @uref (abbreviation for `urlref') aka @url takes an optional
2965 % (comma-separated) second argument specifying the text to display and
2966 % an optional third arg as text to display instead of (rather than in
2967 % addition to) the url itself. First (mandatory) arg is the url.
2969 % TeX-only option to allow changing PDF output to show only the second
2970 % arg (if given), and not the url (which is then just the link target).
2971 \newif\ifurefurlonlylink
2973 % The main macro is \urefbreak, which allows breaking at expected
2974 % places within the url. (There used to be another version, which
2975 % didn't support automatic breaking.)
2976 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2977 \let\uref=\urefbreak
2979 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2980 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2981 \unsepspaces
2982 \pdfurl{#1}%
2983 \setbox0 = \hbox{\ignorespaces #3}%
2984 \ifdim\wd0 > 0pt
2985 \unhbox0 % third arg given, show only that
2986 \else
2987 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
2988 \ifdim\wd0 > 0pt
2989 \ifpdf
2990 % For pdfTeX and LuaTeX
2991 \ifurefurlonlylink
2992 % PDF plus option to not display url, show just arg
2993 \unhbox0
2994 \else
2995 % PDF, normally display both arg and url for consistency,
2996 % visibility, if the pdf is eventually used to print, etc.
2997 \unhbox0\ (\urefcode{#1})%
2999 \else
3000 \ifx\XeTeXrevision\thisisundefined
3001 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3002 \else
3003 % For XeTeX
3004 \ifurefurlonlylink
3005 % PDF plus option to not display url, show just arg
3006 \unhbox0
3007 \else
3008 % PDF, normally display both arg and url for consistency,
3009 % visibility, if the pdf is eventually used to print, etc.
3010 \unhbox0\ (\urefcode{#1})%
3014 \else
3015 \urefcode{#1}% only url given, so show it
3018 \endlink
3019 \endgroup}
3021 % Allow line breaks around only a few characters (only).
3022 \def\urefcatcodes{%
3023 \catcode`\&=\active \catcode`\.=\active
3024 \catcode`\#=\active \catcode`\?=\active
3025 \catcode`\/=\active
3028 \urefcatcodes
3030 \global\def\urefcode{\begingroup
3031 \setupmarkupstyle{code}%
3032 \urefcatcodes
3033 \let&\urefcodeamp
3034 \let.\urefcodedot
3035 \let#\urefcodehash
3036 \let?\urefcodequest
3037 \let/\urefcodeslash
3038 \codex
3041 % By default, they are just regular characters.
3042 \global\def&{\normalamp}
3043 \global\def.{\normaldot}
3044 \global\def#{\normalhash}
3045 \global\def?{\normalquest}
3046 \global\def/{\normalslash}
3049 % we put a little stretch before and after the breakable chars, to help
3050 % line breaking of long url's. The unequal skips make look better in
3051 % cmtt at least, especially for dots.
3052 \def\urefprestretchamount{.13em}
3053 \def\urefpoststretchamount{.1em}
3054 \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
3055 \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
3057 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
3058 \def\urefcodedot{\urefprestretch .\urefpoststretch}
3059 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
3060 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
3061 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3063 \catcode`\/=\active
3064 \global\def\urefcodeslashfinish{%
3065 \urefprestretch \slashChar
3066 % Allow line break only after the final / in a sequence of
3067 % slashes, to avoid line break between the slashes in http://.
3068 \ifx\next/\else \urefpoststretch \fi
3072 % One more complication: by default we'll break after the special
3073 % characters, but some people like to break before the special chars, so
3074 % allow that. Also allow no breaking at all, for manual control.
3076 \parseargdef\urefbreakstyle{%
3077 \def\txiarg{#1}%
3078 \ifx\txiarg\wordnone
3079 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3080 \else\ifx\txiarg\wordbefore
3081 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
3082 \else\ifx\txiarg\wordafter
3083 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
3084 \else
3085 \errhelp = \EMsimple
3086 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3087 \fi\fi\fi
3089 \def\wordafter{after}
3090 \def\wordbefore{before}
3091 \def\wordnone{none}
3093 \urefbreakstyle after
3095 % @url synonym for @uref, since that's how everyone uses it.
3097 \let\url=\uref
3099 % rms does not like angle brackets --karl, 17may97.
3100 % So now @email is just like @uref, unless we are pdf.
3102 %\def\email#1{\angleleft{\tt #1}\angleright}
3103 \ifpdf
3104 \def\email#1{\doemail#1,,\finish}
3105 \def\doemail#1,#2,#3\finish{\begingroup
3106 \unsepspaces
3107 \pdfurl{mailto:#1}%
3108 \setbox0 = \hbox{\ignorespaces #2}%
3109 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3110 \endlink
3111 \endgroup}
3112 \else
3113 \ifx\XeTeXrevision\thisisundefined
3114 \let\email=\uref
3115 \else
3116 \def\email#1{\doemail#1,,\finish}
3117 \def\doemail#1,#2,#3\finish{\begingroup
3118 \unsepspaces
3119 \pdfurl{mailto:#1}%
3120 \setbox0 = \hbox{\ignorespaces #2}%
3121 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3122 \endlink
3123 \endgroup}
3127 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3128 % `example' (@kbd uses ttsl only inside of @example and friends),
3129 % or `code' (@kbd uses normal tty font always).
3130 \parseargdef\kbdinputstyle{%
3131 \def\txiarg{#1}%
3132 \ifx\txiarg\worddistinct
3133 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3134 \else\ifx\txiarg\wordexample
3135 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3136 \else\ifx\txiarg\wordcode
3137 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3138 \else
3139 \errhelp = \EMsimple
3140 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3141 \fi\fi\fi
3143 \def\worddistinct{distinct}
3144 \def\wordexample{example}
3145 \def\wordcode{code}
3147 % Default is `distinct'.
3148 \kbdinputstyle distinct
3150 % @kbd is like @code, except that if the argument is just one @key command,
3151 % then @kbd has no effect.
3152 \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
3154 \def\xkey{\key}
3155 \def\kbdsub#1#2#3\par{%
3156 \def\one{#1}\def\three{#3}\def\threex{??}%
3157 \ifx\one\xkey\ifx\threex\three \key{#2}%
3158 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
3159 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
3162 % definition of @key that produces a lozenge. Doesn't adjust to text size.
3163 %\setfont\keyrm\rmshape{8}{1000}{OT1}
3164 %\font\keysy=cmsy9
3165 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3166 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3167 % \vbox{\hrule\kern-0.4pt
3168 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3169 % \kern-0.4pt\hrule}%
3170 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3172 % definition of @key with no lozenge. If the current font is already
3173 % monospace, don't change it; that way, we respect @kbdinputstyle. But
3174 % if it isn't monospace, then use \tt.
3176 \def\key#1{{\setupmarkupstyle{key}%
3177 \nohyphenation
3178 \ifmonospace\else\tt\fi
3179 #1}\null}
3181 % @clicksequence{File @click{} Open ...}
3182 \def\clicksequence#1{\begingroup #1\endgroup}
3184 % @clickstyle @arrow (by default)
3185 \parseargdef\clickstyle{\def\click{#1}}
3186 \def\click{\arrow}
3188 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3189 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3191 \def\dmn#1{\thinspace #1}
3193 % @acronym for "FBI", "NATO", and the like.
3194 % We print this one point size smaller, since it's intended for
3195 % all-uppercase.
3197 \def\acronym#1{\doacronym #1,,\finish}
3198 \def\doacronym#1,#2,#3\finish{%
3199 {\switchtolsize #1}%
3200 \def\temp{#2}%
3201 \ifx\temp\empty \else
3202 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3204 \null % reset \spacefactor=1000
3207 % @abbr for "Comput. J." and the like.
3208 % No font change, but don't do end-of-sentence spacing.
3210 \def\abbr#1{\doabbr #1,,\finish}
3211 \def\doabbr#1,#2,#3\finish{%
3212 {\plainfrenchspacing #1}%
3213 \def\temp{#2}%
3214 \ifx\temp\empty \else
3215 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3217 \null % reset \spacefactor=1000
3220 % @asis just yields its argument. Used with @table, for example.
3222 \def\asis#1{#1}
3224 % @math outputs its argument in math mode.
3226 % One complication: _ usually means subscripts, but it could also mean
3227 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
3228 % _ active, and distinguish by seeing if the current family is \slfam,
3229 % which is what @var uses.
3231 \catcode`\_ = \active
3232 \gdef\mathunderscore{%
3233 \catcode`\_=\active
3234 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3237 % Another complication: we want \\ (and @\) to output a math (or tt) \.
3238 % FYI, plain.tex uses \\ as a temporary control sequence (for no
3239 % particular reason), but this is not advertised and we don't care.
3241 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3242 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3244 \def\math{%
3245 \ifmmode\else % only go into math if not in math mode already
3246 \tex
3247 \mathunderscore
3248 \let\\ = \mathbackslash
3249 \mathactive
3250 % make the texinfo accent commands work in math mode
3251 \let\"=\ddot
3252 \let\'=\acute
3253 \let\==\bar
3254 \let\^=\hat
3255 \let\`=\grave
3256 \let\u=\breve
3257 \let\v=\check
3258 \let\~=\tilde
3259 \let\dotaccent=\dot
3260 % have to provide another name for sup operator
3261 \let\mathopsup=\sup
3262 $\expandafter\finishmath\fi
3264 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3266 % Some active characters (such as <) are spaced differently in math.
3267 % We have to reset their definitions in case the @math was an argument
3268 % to a command which sets the catcodes (such as @item or @section).
3271 \catcode`^ = \active
3272 \catcode`< = \active
3273 \catcode`> = \active
3274 \catcode`+ = \active
3275 \catcode`' = \active
3276 \gdef\mathactive{%
3277 \let^ = \ptexhat
3278 \let< = \ptexless
3279 \let> = \ptexgtr
3280 \let+ = \ptexplus
3281 \let' = \ptexquoteright
3285 % for @sub and @sup, if in math mode, just do a normal sub/superscript.
3286 % If in text, use math to place as sub/superscript, but switch
3287 % into text mode, with smaller fonts. This is a different font than the
3288 % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3289 % fix it (significant additions to font machinery) until someone notices.
3291 \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3292 \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
3294 \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3295 \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
3297 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3298 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3299 % except specified as a normal braced arg, so no newlines to worry about.
3301 \def\outfmtnametex{tex}
3303 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3304 \long\def\doinlinefmt#1,#2,\finish{%
3305 \def\inlinefmtname{#1}%
3306 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3309 % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3310 % FMTNAME is tex, else ELSE-TEXT.
3311 \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3312 \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3313 \def\inlinefmtname{#1}%
3314 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3317 % For raw, must switch into @tex before parsing the argument, to avoid
3318 % setting catcodes prematurely. Doing it this way means that, for
3319 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
3320 % ignored. But this isn't important because if people want a literal
3321 % *right* brace they would have to use a command anyway, so they may as
3322 % well use a command to get a left brace too. We could re-use the
3323 % delimiter character idea from \verb, but it seems like overkill.
3325 \long\def\inlineraw{\tex \doinlineraw}
3326 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3327 \def\doinlinerawtwo#1,#2,\finish{%
3328 \def\inlinerawname{#1}%
3329 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3330 \endgroup % close group opened by \tex.
3333 % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3335 \long\def\inlineifset#1{\doinlineifset #1,\finish}
3336 \long\def\doinlineifset#1,#2,\finish{%
3337 \def\inlinevarname{#1}%
3338 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3339 \else\ignorespaces#2\fi
3342 % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3344 \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3345 \long\def\doinlineifclear#1,#2,\finish{%
3346 \def\inlinevarname{#1}%
3347 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3351 \message{glyphs,}
3352 % and logos.
3354 % @@ prints an @, as does @atchar{}.
3355 \def\@{\char64 }
3356 \let\atchar=\@
3358 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3359 \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
3360 \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
3361 \let\{=\lbracechar
3362 \let\}=\rbracechar
3364 % @comma{} to avoid , parsing problems.
3365 \let\comma = ,
3367 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3368 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3369 \let\, = \ptexc
3370 \let\dotaccent = \ptexdot
3371 \def\ringaccent#1{{\accent23 #1}}
3372 \let\tieaccent = \ptext
3373 \let\ubaraccent = \ptexb
3374 \let\udotaccent = \d
3376 % Other special characters: @questiondown @exclamdown @ordf @ordm
3377 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3378 \def\questiondown{?`}
3379 \def\exclamdown{!`}
3380 \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
3381 \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
3383 % Dotless i and dotless j, used for accents.
3384 \def\imacro{i}
3385 \def\jmacro{j}
3386 \def\dotless#1{%
3387 \def\temp{#1}%
3388 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3389 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3390 \else \errmessage{@dotless can be used only with i or j}%
3391 \fi\fi
3394 % The \TeX{} logo, as in plain, but resetting the spacing so that a
3395 % period following counts as ending a sentence. (Idea found in latex.)
3397 \edef\TeX{\TeX \spacefactor=1000 }
3399 % @LaTeX{} logo. Not quite the same results as the definition in
3400 % latex.ltx, since we use a different font for the raised A; it's most
3401 % convenient for us to use an explicitly smaller font, rather than using
3402 % the \scriptstyle font (since we don't reset \scriptstyle and
3403 % \scriptscriptstyle).
3405 \def\LaTeX{%
3406 L\kern-.36em
3407 {\setbox0=\hbox{T}%
3408 \vbox to \ht0{\hbox{%
3409 \ifx\textnominalsize\xwordpt
3410 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
3411 % Revert to plain's \scriptsize, which is 7pt.
3412 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3413 \else
3414 % For 11pt, we can use our lllsize.
3415 \switchtolllsize A%
3418 \vss
3420 \kern-.15em
3421 \TeX
3424 % Some math mode symbols. Define \ensuremath to switch into math mode
3425 % unless we are already there. Expansion tricks may not be needed here,
3426 % but safer, and can't hurt.
3427 \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3428 \def\ensuredmath#1{$\relax#1$}
3430 \def\bullet{\ensuremath\ptexbullet}
3431 \def\geq{\ensuremath\ge}
3432 \def\leq{\ensuremath\le}
3433 \def\minus{\ensuremath-}
3435 % @dots{} outputs an ellipsis using the current font.
3436 % We do .5em per period so that it has the same spacing in the cm
3437 % typewriter fonts as three actual period characters; on the other hand,
3438 % in other typewriter fonts three periods are wider than 1.5em. So do
3439 % whichever is larger.
3441 \def\dots{%
3442 \leavevmode
3443 \setbox0=\hbox{...}% get width of three periods
3444 \ifdim\wd0 > 1.5em
3445 \dimen0 = \wd0
3446 \else
3447 \dimen0 = 1.5em
3449 \hbox to \dimen0{%
3450 \hskip 0pt plus.25fil
3451 .\hskip 0pt plus1fil
3452 .\hskip 0pt plus1fil
3453 .\hskip 0pt plus.5fil
3457 % @enddots{} is an end-of-sentence ellipsis.
3459 \def\enddots{%
3460 \dots
3461 \spacefactor=\endofsentencespacefactor
3464 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3466 % Since these characters are used in examples, they should be an even number of
3467 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3469 \def\point{$\star$}
3470 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3471 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3472 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3473 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3474 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3476 % The @error{} command.
3477 % Adapted from the TeXbook's \boxit.
3479 \newbox\errorbox
3481 {\ttfont \global\dimen0 = 3em}% Width of the box.
3482 \dimen2 = .55pt % Thickness of rules
3483 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3484 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3486 \setbox\errorbox=\hbox to \dimen0{\hfil
3487 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3488 \advance\hsize by -2\dimen2 % Rules.
3489 \vbox{%
3490 \hrule height\dimen2
3491 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3492 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3493 \kern3pt\vrule width\dimen2}% Space to right.
3494 \hrule height\dimen2}
3495 \hfil}
3497 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3499 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3501 \def\pounds{{\it\$}}
3503 % @euro{} comes from a separate font, depending on the current style.
3504 % We use the free feym* fonts from the eurosym package by Henrik
3505 % Theiling, which support regular, slanted, bold and bold slanted (and
3506 % "outlined" (blackboard board, sort of) versions, which we don't need).
3507 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3509 % Although only regular is the truly official Euro symbol, we ignore
3510 % that. The Euro is designed to be slightly taller than the regular
3511 % font height.
3513 % feymr - regular
3514 % feymo - slanted
3515 % feybr - bold
3516 % feybo - bold slanted
3518 % There is no good (free) typewriter version, to my knowledge.
3519 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3520 % Hmm.
3522 % Also doesn't work in math. Do we need to do math with euro symbols?
3523 % Hope not.
3526 \def\euro{{\eurofont e}}
3527 \def\eurofont{%
3528 % We set the font at each command, rather than predefining it in
3529 % \textfonts and the other font-switching commands, so that
3530 % installations which never need the symbol don't have to have the
3531 % font installed.
3533 % There is only one designed size (nominal 10pt), so we always scale
3534 % that to the current nominal size.
3536 % By the way, simply using "at 1em" works for cmr10 and the like, but
3537 % does not work for cmbx10 and other extended/shrunken fonts.
3539 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3541 \ifx\curfontstyle\bfstylename
3542 % bold:
3543 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3544 \else
3545 % regular:
3546 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3548 \thiseurofont
3551 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3552 % sometimes we redefine the original macro, and the alias should reflect
3553 % the redefinition.
3555 % Use LaTeX names for the Icelandic letters.
3556 \def\DH{{\ecfont \char"D0}} % Eth
3557 \def\dh{{\ecfont \char"F0}} % eth
3558 \def\TH{{\ecfont \char"DE}} % Thorn
3559 \def\th{{\ecfont \char"FE}} % thorn
3561 \def\guillemetleft{{\ecfont \char"13}}
3562 \def\guillemotleft{\guillemetleft}
3563 \def\guillemetright{{\ecfont \char"14}}
3564 \def\guillemotright{\guillemetright}
3565 \def\guilsinglleft{{\ecfont \char"0E}}
3566 \def\guilsinglright{{\ecfont \char"0F}}
3567 \def\quotedblbase{{\ecfont \char"12}}
3568 \def\quotesinglbase{{\ecfont \char"0D}}
3570 % This positioning is not perfect (see the ogonek LaTeX package), but
3571 % we have the precomposed glyphs for the most common cases. We put the
3572 % tests to use those glyphs in the single \ogonek macro so we have fewer
3573 % dummy definitions to worry about for index entries, etc.
3575 % ogonek is also used with other letters in Lithuanian (IOU), but using
3576 % the precomposed glyphs for those is not so easy since they aren't in
3577 % the same EC font.
3578 \def\ogonek#1{{%
3579 \def\temp{#1}%
3580 \ifx\temp\macrocharA\Aogonek
3581 \else\ifx\temp\macrochara\aogonek
3582 \else\ifx\temp\macrocharE\Eogonek
3583 \else\ifx\temp\macrochare\eogonek
3584 \else
3585 \ecfont \setbox0=\hbox{#1}%
3586 \ifdim\ht0=1ex\accent"0C #1%
3587 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3589 \fi\fi\fi\fi
3592 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3593 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3594 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3595 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3597 % Use the European Computer Modern fonts (cm-super in outline format)
3598 % for non-CM glyphs. That is ec* for regular text and tc* for the text
3599 % companion symbols (LaTeX TS1 encoding). Both are part of the ec
3600 % package and follow the same conventions.
3602 \def\ecfont{\etcfont{e}}
3603 \def\tcfont{\etcfont{t}}
3605 \def\etcfont#1{%
3606 % We can't distinguish serif/sans and italic/slanted, but this
3607 % is used for crude hacks anyway (like adding French and German
3608 % quotes to documents typeset with CM, where we lose kerning), so
3609 % hopefully nobody will notice/care.
3610 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3611 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3612 \ifmonospace
3613 % typewriter:
3614 \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3615 \else
3616 \ifx\curfontstyle\bfstylename
3617 % bold:
3618 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3619 \else
3620 % regular:
3621 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3624 \thisecfont
3627 % @registeredsymbol - R in a circle. The font for the R should really
3628 % be smaller yet, but lllsize is the best we can do for now.
3629 % Adapted from the plain.tex definition of \copyright.
3631 \def\registeredsymbol{%
3632 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
3633 \hfil\crcr\Orb}}%
3637 % @textdegree - the normal degrees sign.
3639 \def\textdegree{$^\circ$}
3641 % Laurent Siebenmann reports \Orb undefined with:
3642 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3643 % so we'll define it if necessary.
3645 \ifx\Orb\thisisundefined
3646 \def\Orb{\mathhexbox20D}
3649 % Quotes.
3650 \chardef\quotedblleft="5C
3651 \chardef\quotedblright=`\"
3652 \chardef\quoteleft=`\`
3653 \chardef\quoteright=`\'
3656 \message{page headings,}
3658 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3659 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3661 % First the title page. Must do @settitle before @titlepage.
3662 \newif\ifseenauthor
3663 \newif\iffinishedtitlepage
3665 % @setcontentsaftertitlepage used to do an implicit @contents or
3666 % @shortcontents after @end titlepage, but it is now obsolete.
3667 \def\setcontentsaftertitlepage{%
3668 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3669 command; move your @contents command if you want the contents
3670 after the title page.}}%
3671 \def\setshortcontentsaftertitlepage{%
3672 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3673 command; move your @shortcontents and @contents commands if you
3674 want the contents after the title page.}}%
3676 \parseargdef\shorttitlepage{%
3677 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3678 \endgroup\page\hbox{}\page}
3680 \envdef\titlepage{%
3681 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3682 \begingroup
3683 \parindent=0pt \textfonts
3684 % Leave some space at the very top of the page.
3685 \vglue\titlepagetopglue
3686 % No rule at page bottom unless we print one at the top with @title.
3687 \finishedtitlepagetrue
3689 % Most title ``pages'' are actually two pages long, with space
3690 % at the top of the second. We don't want the ragged left on the second.
3691 \let\oldpage = \page
3692 \def\page{%
3693 \iffinishedtitlepage\else
3694 \finishtitlepage
3696 \let\page = \oldpage
3697 \page
3698 \null
3702 \def\Etitlepage{%
3703 \iffinishedtitlepage\else
3704 \finishtitlepage
3706 % It is important to do the page break before ending the group,
3707 % because the headline and footline are only empty inside the group.
3708 % If we use the new definition of \page, we always get a blank page
3709 % after the title page, which we certainly don't want.
3710 \oldpage
3711 \endgroup
3713 % Need this before the \...aftertitlepage checks so that if they are
3714 % in effect the toc pages will come out with page numbers.
3715 \HEADINGSon
3718 \def\finishtitlepage{%
3719 \vskip4pt \hrule height 2pt width \hsize
3720 \vskip\titlepagebottomglue
3721 \finishedtitlepagetrue
3724 % Settings used for typesetting titles: no hyphenation, no indentation,
3725 % don't worry much about spacing, ragged right. This should be used
3726 % inside a \vbox, and fonts need to be set appropriately first. \par should
3727 % be specified before the end of the \vbox, since a vbox is a group.
3729 \def\raggedtitlesettings{%
3731 \hyphenpenalty=10000
3732 \parindent=0pt
3733 \tolerance=5000
3734 \ptexraggedright
3737 % Macros to be used within @titlepage:
3739 \let\subtitlerm=\rmfont
3740 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3742 \parseargdef\title{%
3743 \checkenv\titlepage
3744 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3745 % print a rule at the page bottom also.
3746 \finishedtitlepagefalse
3747 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3750 \parseargdef\subtitle{%
3751 \checkenv\titlepage
3752 {\subtitlefont \rightline{#1}}%
3755 % @author should come last, but may come many times.
3756 % It can also be used inside @quotation.
3758 \parseargdef\author{%
3759 \def\temp{\quotation}%
3760 \ifx\thisenv\temp
3761 \def\quotationauthor{#1}% printed in \Equotation.
3762 \else
3763 \checkenv\titlepage
3764 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3765 {\secfonts\rm \leftline{#1}}%
3770 % Set up page headings and footings.
3772 \let\thispage=\folio
3774 \newtoks\evenheadline % headline on even pages
3775 \newtoks\oddheadline % headline on odd pages
3776 \newtoks\evenfootline % footline on even pages
3777 \newtoks\oddfootline % footline on odd pages
3779 % Now make \makeheadline and \makefootline in Plain TeX use those variables
3780 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3781 \else \the\evenheadline \fi}}
3782 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3783 \else \the\evenfootline \fi}\HEADINGShook}
3784 \let\HEADINGShook=\relax
3786 % Commands to set those variables.
3787 % For example, this is what @headings on does
3788 % @evenheading @thistitle|@thispage|@thischapter
3789 % @oddheading @thischapter|@thispage|@thistitle
3790 % @evenfooting @thisfile||
3791 % @oddfooting ||@thisfile
3794 \def\evenheading{\parsearg\evenheadingxxx}
3795 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3796 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3797 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3799 \def\oddheading{\parsearg\oddheadingxxx}
3800 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3801 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3802 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3804 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3806 \def\evenfooting{\parsearg\evenfootingxxx}
3807 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3808 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3809 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3811 \def\oddfooting{\parsearg\oddfootingxxx}
3812 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3813 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3814 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3816 % Leave some space for the footline. Hopefully ok to assume
3817 % @evenfooting will not be used by itself.
3818 \global\advance\txipageheight by -12pt
3819 \global\advance\vsize by -12pt
3822 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3824 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3825 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3827 % The same set of arguments for:
3829 % @oddheadingmarks
3830 % @evenfootingmarks
3831 % @oddfootingmarks
3832 % @everyheadingmarks
3833 % @everyfootingmarks
3835 % These define \getoddheadingmarks, \getevenheadingmarks,
3836 % \getoddfootingmarks, and \getevenfootingmarks, each to one of
3837 % \gettopheadingmarks, \getbottomheadingmarks.
3839 \def\evenheadingmarks{\headingmarks{even}{heading}}
3840 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3841 \def\evenfootingmarks{\headingmarks{even}{footing}}
3842 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3843 \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3844 \headingmarks{odd}{heading}{#1} }
3845 \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3846 \headingmarks{odd}{footing}{#1} }
3847 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3848 \def\headingmarks#1#2#3 {%
3849 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3850 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3853 \everyheadingmarks bottom
3854 \everyfootingmarks bottom
3856 % @headings double turns headings on for double-sided printing.
3857 % @headings single turns headings on for single-sided printing.
3858 % @headings off turns them off.
3859 % @headings on same as @headings double, retained for compatibility.
3860 % @headings after turns on double-sided headings after this page.
3861 % @headings doubleafter turns on double-sided headings after this page.
3862 % @headings singleafter turns on single-sided headings after this page.
3863 % By default, they are off at the start of a document,
3864 % and turned `on' after @end titlepage.
3866 \parseargdef\headings{\csname HEADINGS#1\endcsname}
3868 \def\headingsoff{% non-global headings elimination
3869 \evenheadline={\hfil}\evenfootline={\hfil}%
3870 \oddheadline={\hfil}\oddfootline={\hfil}%
3873 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3874 \HEADINGSoff % it's the default
3876 % When we turn headings on, set the page number to 1.
3877 % For double-sided printing, put current file name in lower left corner,
3878 % chapter name on inside top of right hand pages, document
3879 % title on inside top of left hand pages, and page numbers on outside top
3880 % edge of all pages.
3881 \def\HEADINGSdouble{%
3882 \global\pageno=1
3883 \global\evenfootline={\hfil}
3884 \global\oddfootline={\hfil}
3885 \global\evenheadline={\line{\folio\hfil\thistitle}}
3886 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3887 \global\let\contentsalignmacro = \chapoddpage
3889 \let\contentsalignmacro = \chappager
3891 % For single-sided printing, chapter title goes across top left of page,
3892 % page number on top right.
3893 \def\HEADINGSsingle{%
3894 \global\pageno=1
3895 \global\evenfootline={\hfil}
3896 \global\oddfootline={\hfil}
3897 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3898 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3899 \global\let\contentsalignmacro = \chappager
3901 \def\HEADINGSon{\HEADINGSdouble}
3903 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3904 \let\HEADINGSdoubleafter=\HEADINGSafter
3905 \def\HEADINGSdoublex{%
3906 \global\evenfootline={\hfil}
3907 \global\oddfootline={\hfil}
3908 \global\evenheadline={\line{\folio\hfil\thistitle}}
3909 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3910 \global\let\contentsalignmacro = \chapoddpage
3913 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3914 \def\HEADINGSsinglex{%
3915 \global\evenfootline={\hfil}
3916 \global\oddfootline={\hfil}
3917 \global\evenheadline={\line{\thischapterheading\hfil\folio}}
3918 \global\oddheadline={\line{\thischapterheading\hfil\folio}}
3919 \global\let\contentsalignmacro = \chappager
3922 % Subroutines used in generating headings
3923 % This produces Day Month Year style of output.
3924 % Only define if not already defined, in case a txi-??.tex file has set
3925 % up a different format (e.g., txi-cs.tex does this).
3926 \ifx\today\thisisundefined
3927 \def\today{%
3928 \number\day\space
3929 \ifcase\month
3930 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3931 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3932 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3934 \space\number\year}
3937 % @settitle line... specifies the title of the document, for headings.
3938 % It generates no output of its own.
3939 \def\thistitle{\putwordNoTitle}
3940 \def\settitle{\parsearg{\gdef\thistitle}}
3943 \message{tables,}
3944 % Tables -- @table, @ftable, @vtable, @item(x).
3946 % default indentation of table text
3947 \newdimen\tableindent \tableindent=.8in
3948 % default indentation of @itemize and @enumerate text
3949 \newdimen\itemindent \itemindent=.3in
3950 % margin between end of table item and start of table text.
3951 \newdimen\itemmargin \itemmargin=.1in
3953 % used internally for \itemindent minus \itemmargin
3954 \newdimen\itemmax
3956 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3957 % these defs.
3958 % They also define \itemindex
3959 % to index the item name in whatever manner is desired (perhaps none).
3961 \newif\ifitemxneedsnegativevskip
3963 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3965 \def\internalBitem{\smallbreak \parsearg\itemzzz}
3966 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
3968 \def\itemzzz #1{\begingroup %
3969 \advance\hsize by -\rightskip
3970 \advance\hsize by -\tableindent
3971 \setbox0=\hbox{\itemindicate{#1}}%
3972 \itemindex{#1}%
3973 \nobreak % This prevents a break before @itemx.
3975 % If the item text does not fit in the space we have, put it on a line
3976 % by itself, and do not allow a page break either before or after that
3977 % line. We do not start a paragraph here because then if the next
3978 % command is, e.g., @kindex, the whatsit would get put into the
3979 % horizontal list on a line by itself, resulting in extra blank space.
3980 \ifdim \wd0>\itemmax
3982 % Make this a paragraph so we get the \parskip glue and wrapping,
3983 % but leave it ragged-right.
3984 \begingroup
3985 \advance\leftskip by-\tableindent
3986 \advance\hsize by\tableindent
3987 \advance\rightskip by0pt plus1fil\relax
3988 \leavevmode\unhbox0\par
3989 \endgroup
3991 % We're going to be starting a paragraph, but we don't want the
3992 % \parskip glue -- logically it's part of the @item we just started.
3993 \nobreak \vskip-\parskip
3995 % Stop a page break at the \parskip glue coming up. However, if
3996 % what follows is an environment such as @example, there will be no
3997 % \parskip glue; then the negative vskip we just inserted would
3998 % cause the example and the item to crash together. So we use this
3999 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4000 % \parskip glue after all. Section titles are handled this way also.
4002 \penalty 10001
4003 \endgroup
4004 \itemxneedsnegativevskipfalse
4005 \else
4006 % The item text fits into the space. Start a paragraph, so that the
4007 % following text (if any) will end up on the same line.
4008 \noindent
4009 % Do this with kerns and \unhbox so that if there is a footnote in
4010 % the item text, it can migrate to the main vertical list and
4011 % eventually be printed.
4012 \nobreak\kern-\tableindent
4013 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4014 \unhbox0
4015 \nobreak\kern\dimen0
4016 \endgroup
4017 \itemxneedsnegativevskiptrue
4021 \def\item{\errmessage{@item while not in a list environment}}
4022 \def\itemx{\errmessage{@itemx while not in a list environment}}
4024 % @table, @ftable, @vtable.
4025 \envdef\table{%
4026 \let\itemindex\gobble
4027 \tablecheck{table}%
4029 \envdef\ftable{%
4030 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4031 \tablecheck{ftable}%
4033 \envdef\vtable{%
4034 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4035 \tablecheck{vtable}%
4037 \def\tablecheck#1{%
4038 \ifnum \the\catcode`\^^M=\active
4039 \endgroup
4040 \errmessage{This command won't work in this context; perhaps the problem is
4041 that we are \inenvironment\thisenv}%
4042 \def\next{\doignore{#1}}%
4043 \else
4044 \let\next\tablex
4046 \next
4048 \def\tablex#1{%
4049 \def\itemindicate{#1}%
4050 \parsearg\tabley
4052 \def\tabley#1{%
4054 \makevalueexpandable
4055 \edef\temp{\noexpand\tablez #1\space\space\space}%
4056 \expandafter
4057 }\temp \endtablez
4059 \def\tablez #1 #2 #3 #4\endtablez{%
4060 \aboveenvbreak
4061 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4062 \ifnum 0#2>0 \tableindent=#2\mil \fi
4063 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4064 \itemmax=\tableindent
4065 \advance \itemmax by -\itemmargin
4066 \advance \leftskip by \tableindent
4067 \exdentamount=\tableindent
4068 \parindent = 0pt
4069 \parskip = \smallskipamount
4070 \ifdim \parskip=0pt \parskip=2pt \fi
4071 \let\item = \internalBitem
4072 \let\itemx = \internalBitemx
4074 \def\Etable{\endgraf\afterenvbreak}
4075 \let\Eftable\Etable
4076 \let\Evtable\Etable
4077 \let\Eitemize\Etable
4078 \let\Eenumerate\Etable
4080 % This is the counter used by @enumerate, which is really @itemize
4082 \newcount \itemno
4084 \envdef\itemize{\parsearg\doitemize}
4086 \def\doitemize#1{%
4087 \aboveenvbreak
4088 \itemmax=\itemindent
4089 \advance\itemmax by -\itemmargin
4090 \advance\leftskip by \itemindent
4091 \exdentamount=\itemindent
4092 \parindent=0pt
4093 \parskip=\smallskipamount
4094 \ifdim\parskip=0pt \parskip=2pt \fi
4096 % Try typesetting the item mark so that if the document erroneously says
4097 % something like @itemize @samp (intending @table), there's an error
4098 % right away at the @itemize. It's not the best error message in the
4099 % world, but it's better than leaving it to the @item. This means if
4100 % the user wants an empty mark, they have to say @w{} not just @w.
4101 \def\itemcontents{#1}%
4102 \setbox0 = \hbox{\itemcontents}%
4104 % @itemize with no arg is equivalent to @itemize @bullet.
4105 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4107 \let\item=\itemizeitem
4110 % Definition of @item while inside @itemize and @enumerate.
4112 \def\itemizeitem{%
4113 \advance\itemno by 1 % for enumerations
4114 {\let\par=\endgraf \smallbreak}% reasonable place to break
4116 % If the document has an @itemize directly after a section title, a
4117 % \nobreak will be last on the list, and \sectionheading will have
4118 % done a \vskip-\parskip. In that case, we don't want to zero
4119 % parskip, or the item text will crash with the heading. On the
4120 % other hand, when there is normal text preceding the item (as there
4121 % usually is), we do want to zero parskip, or there would be too much
4122 % space. In that case, we won't have a \nobreak before. At least
4123 % that's the theory.
4124 \ifnum\lastpenalty<10000 \parskip=0in \fi
4125 \noindent
4126 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4128 \ifinner\else
4129 \vadjust{\penalty 1200}% not good to break after first line of item.
4131 % We can be in inner vertical mode in a footnote, although an
4132 % @itemize looks awful there.
4134 \flushcr
4137 % \splitoff TOKENS\endmark defines \first to be the first token in
4138 % TOKENS, and \rest to be the remainder.
4140 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4142 % Allow an optional argument of an uppercase letter, lowercase letter,
4143 % or number, to specify the first label in the enumerated list. No
4144 % argument is the same as `1'.
4146 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4147 \def\enumeratey #1 #2\endenumeratey{%
4148 % If we were given no argument, pretend we were given `1'.
4149 \def\thearg{#1}%
4150 \ifx\thearg\empty \def\thearg{1}\fi
4152 % Detect if the argument is a single token. If so, it might be a
4153 % letter. Otherwise, the only valid thing it can be is a number.
4154 % (We will always have one token, because of the test we just made.
4155 % This is a good thing, since \splitoff doesn't work given nothing at
4156 % all -- the first parameter is undelimited.)
4157 \expandafter\splitoff\thearg\endmark
4158 \ifx\rest\empty
4159 % Only one token in the argument. It could still be anything.
4160 % A ``lowercase letter'' is one whose \lccode is nonzero.
4161 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4162 % not equal to itself.
4163 % Otherwise, we assume it's a number.
4165 % We need the \relax at the end of the \ifnum lines to stop TeX from
4166 % continuing to look for a <number>.
4168 \ifnum\lccode\expandafter`\thearg=0\relax
4169 \numericenumerate % a number (we hope)
4170 \else
4171 % It's a letter.
4172 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4173 \lowercaseenumerate % lowercase letter
4174 \else
4175 \uppercaseenumerate % uppercase letter
4178 \else
4179 % Multiple tokens in the argument. We hope it's a number.
4180 \numericenumerate
4184 % An @enumerate whose labels are integers. The starting integer is
4185 % given in \thearg.
4187 \def\numericenumerate{%
4188 \itemno = \thearg
4189 \startenumeration{\the\itemno}%
4192 % The starting (lowercase) letter is in \thearg.
4193 \def\lowercaseenumerate{%
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 lowercase letters in @enumerate; get a bigger
4199 alphabet}%
4201 \char\lccode\itemno
4205 % The starting (uppercase) letter is in \thearg.
4206 \def\uppercaseenumerate{%
4207 \itemno = \expandafter`\thearg
4208 \startenumeration{%
4209 % Be sure we're not beyond the end of the alphabet.
4210 \ifnum\itemno=0
4211 \errmessage{No more uppercase letters in @enumerate; get a bigger
4212 alphabet}
4214 \char\uccode\itemno
4218 % Call \doitemize, adding a period to the first argument and supplying the
4219 % common last two arguments. Also subtract one from the initial value in
4220 % \itemno, since @item increments \itemno.
4222 \def\startenumeration#1{%
4223 \advance\itemno by -1
4224 \doitemize{#1.}\flushcr
4227 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
4228 % to @enumerate.
4230 \def\alphaenumerate{\enumerate{a}}
4231 \def\capsenumerate{\enumerate{A}}
4232 \def\Ealphaenumerate{\Eenumerate}
4233 \def\Ecapsenumerate{\Eenumerate}
4236 % @multitable macros
4237 % Amy Hendrickson, 8/18/94, 3/6/96
4239 % @multitable ... @end multitable will make as many columns as desired.
4240 % Contents of each column will wrap at width given in preamble. Width
4241 % can be specified either with sample text given in a template line,
4242 % or in percent of \hsize, the current width of text on page.
4244 % Table can continue over pages but will only break between lines.
4246 % To make preamble:
4248 % Either define widths of columns in terms of percent of \hsize:
4249 % @multitable @columnfractions .25 .3 .45
4250 % @item ...
4252 % Numbers following @columnfractions are the percent of the total
4253 % current hsize to be used for each column. You may use as many
4254 % columns as desired.
4257 % Or use a template:
4258 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4259 % @item ...
4260 % using the widest term desired in each column.
4262 % Each new table line starts with @item, each subsequent new column
4263 % starts with @tab. Empty columns may be produced by supplying @tab's
4264 % with nothing between them for as many times as empty columns are needed,
4265 % ie, @tab@tab@tab will produce two empty columns.
4267 % @item, @tab do not need to be on their own lines, but it will not hurt
4268 % if they are.
4270 % Sample multitable:
4272 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
4273 % @item first col stuff @tab second col stuff @tab third col
4274 % @item
4275 % first col stuff
4276 % @tab
4277 % second col stuff
4278 % @tab
4279 % third col
4280 % @item first col stuff @tab second col stuff
4281 % @tab Many paragraphs of text may be used in any column.
4283 % They will wrap at the width determined by the template.
4284 % @item@tab@tab This will be in third column.
4285 % @end multitable
4287 % Default dimensions may be reset by user.
4288 % @multitableparskip is vertical space between paragraphs in table.
4289 % @multitableparindent is paragraph indent in table.
4290 % @multitablecolmargin is horizontal space to be left between columns.
4291 % @multitablelinespace is space to leave between table items, baseline
4292 % to baseline.
4293 % 0pt means it depends on current normal line spacing.
4295 \newskip\multitableparskip
4296 \newskip\multitableparindent
4297 \newdimen\multitablecolspace
4298 \newskip\multitablelinespace
4299 \multitableparskip=0pt
4300 \multitableparindent=6pt
4301 \multitablecolspace=12pt
4302 \multitablelinespace=0pt
4304 % Macros used to set up halign preamble:
4306 \let\endsetuptable\relax
4307 \def\xendsetuptable{\endsetuptable}
4308 \let\columnfractions\relax
4309 \def\xcolumnfractions{\columnfractions}
4310 \newif\ifsetpercent
4312 % #1 is the @columnfraction, usually a decimal number like .5, but might
4313 % be just 1. We just use it, whatever it is.
4315 \def\pickupwholefraction#1 {%
4316 \global\advance\colcount by 1
4317 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4318 \setuptable
4321 \newcount\colcount
4322 \def\setuptable#1{%
4323 \def\firstarg{#1}%
4324 \ifx\firstarg\xendsetuptable
4325 \let\go = \relax
4326 \else
4327 \ifx\firstarg\xcolumnfractions
4328 \global\setpercenttrue
4329 \else
4330 \ifsetpercent
4331 \let\go\pickupwholefraction
4332 \else
4333 \global\advance\colcount by 1
4334 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4335 % separator; typically that is always in the input, anyway.
4336 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4339 \ifx\go\pickupwholefraction
4340 % Put the argument back for the \pickupwholefraction call, so
4341 % we'll always have a period there to be parsed.
4342 \def\go{\pickupwholefraction#1}%
4343 \else
4344 \let\go = \setuptable
4345 \fi%
4350 % multitable-only commands.
4352 % @headitem starts a heading row, which we typeset in bold. Assignments
4353 % have to be global since we are inside the implicit group of an
4354 % alignment entry. \everycr below resets \everytab so we don't have to
4355 % undo it ourselves.
4356 \def\headitemfont{\b}% for people to use in the template row; not changeable
4357 \def\headitem{%
4358 \checkenv\multitable
4359 \crcr
4360 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4361 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4362 \the\everytab % for the first item
4365 % default for tables with no headings.
4366 \let\headitemcrhook=\relax
4368 % A \tab used to include \hskip1sp. But then the space in a template
4369 % line is not enough. That is bad. So let's go back to just `&' until
4370 % we again encounter the problem the 1sp was intended to solve.
4371 % --karl, nathan@acm.org, 20apr99.
4372 \def\tab{\checkenv\multitable &\the\everytab}%
4374 % @multitable ... @end multitable definitions:
4376 \newtoks\everytab % insert after every tab.
4378 \envdef\multitable{%
4379 \vskip\parskip
4380 \startsavinginserts
4382 % @item within a multitable starts a normal row.
4383 % We use \def instead of \let so that if one of the multitable entries
4384 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4385 % \endtemplate) expanding \doitemize.
4386 \def\item{\crcr}%
4388 \tolerance=9500
4389 \hbadness=9500
4390 \setmultitablespacing
4391 \parskip=\multitableparskip
4392 \parindent=\multitableparindent
4393 \overfullrule=0pt
4394 \global\colcount=0
4396 \everycr = {%
4397 \noalign{%
4398 \global\everytab={}% Reset from possible headitem.
4399 \global\colcount=0 % Reset the column counter.
4401 % Check for saved footnotes, etc.:
4402 \checkinserts
4404 % Perhaps a \nobreak, then reset:
4405 \headitemcrhook
4406 \global\let\headitemcrhook=\relax
4410 \parsearg\domultitable
4412 \def\domultitable#1{%
4413 % To parse everything between @multitable and @item:
4414 \setuptable#1 \endsetuptable
4416 % This preamble sets up a generic column definition, which will
4417 % be used as many times as user calls for columns.
4418 % \vtop will set a single line and will also let text wrap and
4419 % continue for many paragraphs if desired.
4420 \halign\bgroup &%
4421 \global\advance\colcount by 1
4422 \multistrut
4423 \vtop{%
4424 % Use the current \colcount to find the correct column width:
4425 \hsize=\expandafter\csname col\the\colcount\endcsname
4427 % In order to keep entries from bumping into each other
4428 % we will add a \leftskip of \multitablecolspace to all columns after
4429 % the first one.
4431 % If a template has been used, we will add \multitablecolspace
4432 % to the width of each template entry.
4434 % If the user has set preamble in terms of percent of \hsize we will
4435 % use that dimension as the width of the column, and the \leftskip
4436 % will keep entries from bumping into each other. Table will start at
4437 % left margin and final column will justify at right margin.
4439 % Make sure we don't inherit \rightskip from the outer environment.
4440 \rightskip=0pt
4441 \ifnum\colcount=1
4442 % The first column will be indented with the surrounding text.
4443 \advance\hsize by\leftskip
4444 \else
4445 \ifsetpercent \else
4446 % If user has not set preamble in terms of percent of \hsize
4447 % we will advance \hsize by \multitablecolspace.
4448 \advance\hsize by \multitablecolspace
4450 % In either case we will make \leftskip=\multitablecolspace:
4451 \leftskip=\multitablecolspace
4453 % Ignoring space at the beginning and end avoids an occasional spurious
4454 % blank line, when TeX decides to break the line at the space before the
4455 % box from the multistrut, so the strut ends up on a line by itself.
4456 % For example:
4457 % @multitable @columnfractions .11 .89
4458 % @item @code{#}
4459 % @tab Legal holiday which is valid in major parts of the whole country.
4460 % Is automatically provided with highlighting sequences respectively
4461 % marking characters.
4462 \noindent\ignorespaces##\unskip\multistrut
4463 }\cr
4465 \def\Emultitable{%
4466 \crcr
4467 \egroup % end the \halign
4468 \global\setpercentfalse
4471 \def\setmultitablespacing{%
4472 \def\multistrut{\strut}% just use the standard line spacing
4474 % Compute \multitablelinespace (if not defined by user) for use in
4475 % \multitableparskip calculation. We used define \multistrut based on
4476 % this, but (ironically) that caused the spacing to be off.
4477 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4478 \ifdim\multitablelinespace=0pt
4479 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4480 \global\advance\multitablelinespace by-\ht0
4482 % Test to see if parskip is larger than space between lines of
4483 % table. If not, do nothing.
4484 % If so, set to same dimension as multitablelinespace.
4485 \ifdim\multitableparskip>\multitablelinespace
4486 \global\multitableparskip=\multitablelinespace
4487 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4488 % than skip between lines in the table.
4489 \fi%
4490 \ifdim\multitableparskip=0pt
4491 \global\multitableparskip=\multitablelinespace
4492 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4493 % than skip between lines in the table.
4494 \fi}
4497 \message{conditionals,}
4499 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4500 % @ifnotxml always succeed. They currently do nothing; we don't
4501 % attempt to check whether the conditionals are properly nested. But we
4502 % have to remember that they are conditionals, so that @end doesn't
4503 % attempt to close an environment group.
4505 \def\makecond#1{%
4506 \expandafter\let\csname #1\endcsname = \relax
4507 \expandafter\let\csname iscond.#1\endcsname = 1
4509 \makecond{iftex}
4510 \makecond{ifnotdocbook}
4511 \makecond{ifnothtml}
4512 \makecond{ifnotinfo}
4513 \makecond{ifnotplaintext}
4514 \makecond{ifnotxml}
4516 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4518 \def\direntry{\doignore{direntry}}
4519 \def\documentdescription{\doignore{documentdescription}}
4520 \def\docbook{\doignore{docbook}}
4521 \def\html{\doignore{html}}
4522 \def\ifdocbook{\doignore{ifdocbook}}
4523 \def\ifhtml{\doignore{ifhtml}}
4524 \def\ifinfo{\doignore{ifinfo}}
4525 \def\ifnottex{\doignore{ifnottex}}
4526 \def\ifplaintext{\doignore{ifplaintext}}
4527 \def\ifxml{\doignore{ifxml}}
4528 \def\ignore{\doignore{ignore}}
4529 \def\menu{\doignore{menu}}
4530 \def\xml{\doignore{xml}}
4532 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4534 % A count to remember the depth of nesting.
4535 \newcount\doignorecount
4537 \def\doignore#1{\begingroup
4538 % Scan in ``verbatim'' mode:
4539 \obeylines
4540 \catcode`\@ = \other
4541 \catcode`\{ = \other
4542 \catcode`\} = \other
4544 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4545 \spaceisspace
4547 % Count number of #1's that we've seen.
4548 \doignorecount = 0
4550 % Swallow text until we reach the matching `@end #1'.
4551 \dodoignore{#1}%
4554 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4555 \obeylines %
4557 \gdef\dodoignore#1{%
4558 % #1 contains the command name as a string, e.g., `ifinfo'.
4560 % Define a command to find the next `@end #1'.
4561 \long\def\doignoretext##1^^M@end #1{%
4562 \doignoretextyyy##1^^M@#1\_STOP_}%
4564 % And this command to find another #1 command, at the beginning of a
4565 % line. (Otherwise, we would consider a line `@c @ifset', for
4566 % example, to count as an @ifset for nesting.)
4567 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4569 % And now expand that command.
4570 \doignoretext ^^M%
4574 \def\doignoreyyy#1{%
4575 \def\temp{#1}%
4576 \ifx\temp\empty % Nothing found.
4577 \let\next\doignoretextzzz
4578 \else % Found a nested condition, ...
4579 \advance\doignorecount by 1
4580 \let\next\doignoretextyyy % ..., look for another.
4581 % If we're here, #1 ends with ^^M\ifinfo (for example).
4583 \next #1% the token \_STOP_ is present just after this macro.
4586 % We have to swallow the remaining "\_STOP_".
4588 \def\doignoretextzzz#1{%
4589 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4590 \let\next\enddoignore
4591 \else % Still inside a nested condition.
4592 \advance\doignorecount by -1
4593 \let\next\doignoretext % Look for the next @end.
4595 \next
4598 % Finish off ignored text.
4599 { \obeylines%
4600 % Ignore anything after the last `@end #1'; this matters in verbatim
4601 % environments, where otherwise the newline after an ignored conditional
4602 % would result in a blank line in the output.
4603 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4607 % @set VAR sets the variable VAR to an empty value.
4608 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4610 % Since we want to separate VAR from REST-OF-LINE (which might be
4611 % empty), we can't just use \parsearg; we have to insert a space of our
4612 % own to delimit the rest of the line, and then take it out again if we
4613 % didn't need it.
4614 % We rely on the fact that \parsearg sets \catcode`\ =10.
4616 \parseargdef\set{\setyyy#1 \endsetyyy}
4617 \def\setyyy#1 #2\endsetyyy{%
4619 \makevalueexpandable
4620 \def\temp{#2}%
4621 \edef\next{\gdef\makecsname{SET#1}}%
4622 \ifx\temp\empty
4623 \next{}%
4624 \else
4625 \setzzz#2\endsetzzz
4629 % Remove the trailing space \setxxx inserted.
4630 \def\setzzz#1 \endsetzzz{\next{#1}}
4632 % @clear VAR clears (i.e., unsets) the variable VAR.
4634 \parseargdef\clear{%
4636 \makevalueexpandable
4637 \global\expandafter\let\csname SET#1\endcsname=\relax
4641 % @value{foo} gets the text saved in variable foo.
4642 \def\value{\begingroup\makevalueexpandable\valuexxx}
4643 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4645 \catcode`\-=\active \catcode`\_=\active
4647 \gdef\makevalueexpandable{%
4648 \let\value = \expandablevalue
4649 % We don't want these characters active, ...
4650 \catcode`\-=\other \catcode`\_=\other
4651 % ..., but we might end up with active ones in the argument if
4652 % we're called from @code, as @code{@value{foo-bar_}}, though.
4653 % So \let them to their normal equivalents.
4654 \let-\normaldash \let_\normalunderscore
4658 % We have this subroutine so that we can handle at least some @value's
4659 % properly in indexes (we call \makevalueexpandable in \indexdummies).
4660 % The command has to be fully expandable (if the variable is set), since
4661 % the result winds up in the index file. This means that if the
4662 % variable's value contains other Texinfo commands, it's almost certain
4663 % it will fail (although perhaps we could fix that with sufficient work
4664 % to do a one-level expansion on the result, instead of complete).
4666 % Unfortunately, this has the consequence that when _ is in the *value*
4667 % of an @set, it does not print properly in the roman fonts (get the cmr
4668 % dot accent at position 126 instead). No fix comes to mind, and it's
4669 % been this way since 2003 or earlier, so just ignore it.
4671 \def\expandablevalue#1{%
4672 \expandafter\ifx\csname SET#1\endcsname\relax
4673 {[No value for ``#1'']}%
4674 \message{Variable `#1', used in @value, is not set.}%
4675 \else
4676 \csname SET#1\endcsname
4680 % Like \expandablevalue, but completely expandable (the \message in the
4681 % definition above operates at the execution level of TeX). Used when
4682 % writing to auxiliary files, due to the expansion that \write does.
4683 % If flag is undefined, pass through an unexpanded @value command: maybe it
4684 % will be set by the time it is read back in.
4686 % NB flag names containing - or _ may not work here.
4687 \def\dummyvalue#1{%
4688 \expandafter\ifx\csname SET#1\endcsname\relax
4689 \noexpand\value{#1}%
4690 \else
4691 \csname SET#1\endcsname
4695 % Used for @value's in index entries to form the sort key: expand the @value
4696 % if possible, otherwise sort late.
4697 \def\indexnofontsvalue#1{%
4698 \expandafter\ifx\csname SET#1\endcsname\relax
4699 ZZZZZZZ
4700 \else
4701 \csname SET#1\endcsname
4705 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4706 % with @set.
4708 % To get the special treatment we need for `@end ifset,' we call
4709 % \makecond and then redefine.
4711 \makecond{ifset}
4712 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4713 \def\doifset#1#2{%
4715 \makevalueexpandable
4716 \let\next=\empty
4717 \expandafter\ifx\csname SET#2\endcsname\relax
4718 #1% If not set, redefine \next.
4720 \expandafter
4721 }\next
4723 \def\ifsetfail{\doignore{ifset}}
4725 % @ifclear VAR ... @end executes the `...' iff VAR has never been
4726 % defined with @set, or has been undefined with @clear.
4728 % The `\else' inside the `\doifset' parameter is a trick to reuse the
4729 % above code: if the variable is not set, do nothing, if it is set,
4730 % then redefine \next to \ifclearfail.
4732 \makecond{ifclear}
4733 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4734 \def\ifclearfail{\doignore{ifclear}}
4736 % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4737 % without the @) is in fact defined. We can only feasibly check at the
4738 % TeX level, so something like `mathcode' is going to considered
4739 % defined even though it is not a Texinfo command.
4741 \makecond{ifcommanddefined}
4742 \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4744 \def\doifcmddefined#1#2{{%
4745 \makevalueexpandable
4746 \let\next=\empty
4747 \expandafter\ifx\csname #2\endcsname\relax
4748 #1% If not defined, \let\next as above.
4750 \expandafter
4751 }\next
4753 \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4755 % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4756 \makecond{ifcommandnotdefined}
4757 \def\ifcommandnotdefined{%
4758 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4759 \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4761 % Set the `txicommandconditionals' variable, so documents have a way to
4762 % test if the @ifcommand...defined conditionals are available.
4763 \set txicommandconditionals
4765 % @dircategory CATEGORY -- specify a category of the dir file
4766 % which this file should belong to. Ignore this in TeX.
4767 \let\dircategory=\comment
4769 % @defininfoenclose.
4770 \let\definfoenclose=\comment
4773 \message{indexing,}
4774 % Index generation facilities
4776 % Define \newwrite to be identical to plain tex's \newwrite
4777 % except not \outer, so it can be used within macros and \if's.
4778 \edef\newwrite{\makecsname{ptexnewwrite}}
4780 % \newindex {foo} defines an index named IX.
4781 % It automatically defines \IXindex such that
4782 % \IXindex ...rest of line... puts an entry in the index IX.
4783 % It also defines \IXindfile to be the number of the output channel for
4784 % the file that accumulates this index. The file's extension is IX.
4785 % The name of an index should be no more than 2 characters long
4786 % for the sake of vms.
4788 \def\newindex#1{%
4789 \expandafter\chardef\csname#1indfile\endcsname=0
4790 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4791 \noexpand\doindex{#1}}
4794 % @defindex foo == \newindex{foo}
4796 \def\defindex{\parsearg\newindex}
4798 % Define @defcodeindex, like @defindex except put all entries in @code.
4800 \def\defcodeindex{\parsearg\newcodeindex}
4802 \def\newcodeindex#1{%
4803 \expandafter\chardef\csname#1indfile\endcsname=0
4804 \expandafter\xdef\csname#1index\endcsname{%
4805 \noexpand\docodeindex{#1}}%
4808 % The default indices:
4809 \newindex{cp}% concepts,
4810 \newcodeindex{fn}% functions,
4811 \newcodeindex{vr}% variables,
4812 \newcodeindex{tp}% types,
4813 \newcodeindex{ky}% keys
4814 \newcodeindex{pg}% and programs.
4817 % @synindex foo bar makes index foo feed into index bar.
4818 % Do this instead of @defindex foo if you don't want it as a separate index.
4820 % @syncodeindex foo bar similar, but put all entries made for index foo
4821 % inside @code.
4823 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4824 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4826 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4827 % #3 the target index (bar).
4828 \def\dosynindex#1#2#3{%
4829 \requireopenindexfile{#3}%
4830 % redefine \fooindfile:
4831 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4832 \expandafter\let\csname#2indfile\endcsname=\temp
4833 % redefine \fooindex:
4834 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4837 % Define \doindex, the driver for all index macros.
4838 % Argument #1 is generated by the calling \fooindex macro,
4839 % and it is the two-letter name of the index.
4841 \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4842 \def\doindexxxx #1{\doind{\indexname}{#1}}
4844 % like the previous two, but they put @code around the argument.
4845 \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4846 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
4849 % Used when writing an index entry out to an index file to prevent
4850 % expansion of Texinfo commands that can appear in an index entry.
4852 \def\indexdummies{%
4853 \escapechar = `\\ % use backslash in output files.
4854 \definedummyletter\@%
4855 \definedummyletter\ %
4857 % For texindex which always views { and } as separators.
4858 \def\{{\lbracechar{}}%
4859 \def\}{\rbracechar{}}%
4861 % Do the redefinitions.
4862 \definedummies
4865 % Used for the aux and toc files, where @ is the escape character.
4867 \def\atdummies{%
4868 \definedummyletter\@%
4869 \definedummyletter\ %
4870 \definedummyletter\{%
4871 \definedummyletter\}%
4873 % Do the redefinitions.
4874 \definedummies
4875 \otherbackslash
4878 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4879 % preventing its expansion. This is used only for control words,
4880 % not control letters, because the \space would be incorrect for
4881 % control characters, but is needed to separate the control word
4882 % from whatever follows.
4884 % These can be used both for control words that take an argument and
4885 % those that do not. If it is followed by {arg} in the input, then
4886 % that will dutifully get written to the index (or wherever).
4888 % For control letters, we have \definedummyletter, which omits the
4889 % space.
4891 \def\definedummyword #1{\def#1{\string#1\space}}%
4892 \def\definedummyletter#1{\def#1{\string#1}}%
4893 \let\definedummyaccent\definedummyletter
4895 % Called from \indexdummies and \atdummies, to effectively prevent
4896 % the expansion of commands.
4898 \def\definedummies{%
4900 \let\commondummyword\definedummyword
4901 \let\commondummyletter\definedummyletter
4902 \let\commondummyaccent\definedummyaccent
4903 \commondummiesnofonts
4905 \definedummyletter\_%
4906 \definedummyletter\-%
4908 % Non-English letters.
4909 \definedummyword\AA
4910 \definedummyword\AE
4911 \definedummyword\DH
4912 \definedummyword\L
4913 \definedummyword\O
4914 \definedummyword\OE
4915 \definedummyword\TH
4916 \definedummyword\aa
4917 \definedummyword\ae
4918 \definedummyword\dh
4919 \definedummyword\exclamdown
4920 \definedummyword\l
4921 \definedummyword\o
4922 \definedummyword\oe
4923 \definedummyword\ordf
4924 \definedummyword\ordm
4925 \definedummyword\questiondown
4926 \definedummyword\ss
4927 \definedummyword\th
4929 % Although these internal commands shouldn't show up, sometimes they do.
4930 \definedummyword\bf
4931 \definedummyword\gtr
4932 \definedummyword\hat
4933 \definedummyword\less
4934 \definedummyword\sf
4935 \definedummyword\sl
4936 \definedummyword\tclose
4937 \definedummyword\tt
4939 \definedummyword\LaTeX
4940 \definedummyword\TeX
4942 % Assorted special characters.
4943 \definedummyword\atchar
4944 \definedummyword\arrow
4945 \definedummyword\bullet
4946 \definedummyword\comma
4947 \definedummyword\copyright
4948 \definedummyword\registeredsymbol
4949 \definedummyword\dots
4950 \definedummyword\enddots
4951 \definedummyword\entrybreak
4952 \definedummyword\equiv
4953 \definedummyword\error
4954 \definedummyword\euro
4955 \definedummyword\expansion
4956 \definedummyword\geq
4957 \definedummyword\guillemetleft
4958 \definedummyword\guillemetright
4959 \definedummyword\guilsinglleft
4960 \definedummyword\guilsinglright
4961 \definedummyword\lbracechar
4962 \definedummyword\leq
4963 \definedummyword\mathopsup
4964 \definedummyword\minus
4965 \definedummyword\ogonek
4966 \definedummyword\pounds
4967 \definedummyword\point
4968 \definedummyword\print
4969 \definedummyword\quotedblbase
4970 \definedummyword\quotedblleft
4971 \definedummyword\quotedblright
4972 \definedummyword\quoteleft
4973 \definedummyword\quoteright
4974 \definedummyword\quotesinglbase
4975 \definedummyword\rbracechar
4976 \definedummyword\result
4977 \definedummyword\sub
4978 \definedummyword\sup
4979 \definedummyword\textdegree
4981 % We want to disable all macros so that they are not expanded by \write.
4982 \macrolist
4983 \let\value\dummyvalue
4985 \normalturnoffactive
4988 % \commondummiesnofonts: common to \definedummies and \indexnofonts.
4989 % Define \commondummyletter, \commondummyaccent and \commondummyword before
4990 % using. Used for accents, font commands, and various control letters.
4992 \def\commondummiesnofonts{%
4993 % Control letters and accents.
4994 \commondummyletter\!%
4995 \commondummyaccent\"%
4996 \commondummyaccent\'%
4997 \commondummyletter\*%
4998 \commondummyaccent\,%
4999 \commondummyletter\.%
5000 \commondummyletter\/%
5001 \commondummyletter\:%
5002 \commondummyaccent\=%
5003 \commondummyletter\?%
5004 \commondummyaccent\^%
5005 \commondummyaccent\`%
5006 \commondummyaccent\~%
5007 \commondummyword\u
5008 \commondummyword\v
5009 \commondummyword\H
5010 \commondummyword\dotaccent
5011 \commondummyword\ogonek
5012 \commondummyword\ringaccent
5013 \commondummyword\tieaccent
5014 \commondummyword\ubaraccent
5015 \commondummyword\udotaccent
5016 \commondummyword\dotless
5018 % Texinfo font commands.
5019 \commondummyword\b
5020 \commondummyword\i
5021 \commondummyword\r
5022 \commondummyword\sansserif
5023 \commondummyword\sc
5024 \commondummyword\slanted
5025 \commondummyword\t
5027 % Commands that take arguments.
5028 \commondummyword\abbr
5029 \commondummyword\acronym
5030 \commondummyword\anchor
5031 \commondummyword\cite
5032 \commondummyword\code
5033 \commondummyword\command
5034 \commondummyword\dfn
5035 \commondummyword\dmn
5036 \commondummyword\email
5037 \commondummyword\emph
5038 \commondummyword\env
5039 \commondummyword\file
5040 \commondummyword\image
5041 \commondummyword\indicateurl
5042 \commondummyword\inforef
5043 \commondummyword\kbd
5044 \commondummyword\key
5045 \commondummyword\math
5046 \commondummyword\option
5047 \commondummyword\pxref
5048 \commondummyword\ref
5049 \commondummyword\samp
5050 \commondummyword\strong
5051 \commondummyword\tie
5052 \commondummyword\U
5053 \commondummyword\uref
5054 \commondummyword\url
5055 \commondummyword\var
5056 \commondummyword\verb
5057 \commondummyword\w
5058 \commondummyword\xref
5061 % For testing: output @{ and @} in index sort strings as \{ and \}.
5062 \newif\ifusebracesinindexes
5064 \let\indexlbrace\relax
5065 \let\indexrbrace\relax
5067 {\catcode`\@=0
5068 \catcode`\\=13
5069 @gdef@backslashdisappear{@def\{}}
5073 \catcode`\<=13
5074 \catcode`\-=13
5075 \catcode`\`=13
5076 \gdef\indexnonalnumdisappear{%
5077 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
5078 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5079 % (Introduced for FSFS 2nd ed.)
5080 \let`=\empty
5083 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
5084 \backslashdisappear
5087 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
5088 \def-{}%
5090 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
5091 \def<{}%
5093 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
5094 \def\@{}%
5098 \gdef\indexnonalnumreappear{%
5099 \useindexbackslash
5100 \let-\normaldash
5101 \let<\normalless
5102 \def\@{@}%
5107 % \indexnofonts is used when outputting the strings to sort the index
5108 % by, and when constructing control sequence names. It eliminates all
5109 % control sequences and just writes whatever the best ASCII sort string
5110 % would be for a given command (usually its argument).
5112 \def\indexnofonts{%
5113 % Accent commands should become @asis.
5114 \def\commondummyaccent##1{\let##1\asis}%
5115 % We can just ignore other control letters.
5116 \def\commondummyletter##1{\let##1\empty}%
5117 % All control words become @asis by default; overrides below.
5118 \let\commondummyword\commondummyaccent
5119 \commondummiesnofonts
5121 % Don't no-op \tt, since it isn't a user-level command
5122 % and is used in the definitions of the active chars like <, >, |, etc.
5123 % Likewise with the other plain tex font commands.
5124 %\let\tt=\asis
5126 \def\ { }%
5127 \def\@{@}%
5128 \def\_{\normalunderscore}%
5129 \def\-{}% @- shouldn't affect sorting
5131 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5132 \uccode`\1=`\} \uppercase{\def\}{1}}%
5133 \let\lbracechar\{%
5134 \let\rbracechar\}%
5136 % Non-English letters.
5137 \def\AA{AA}%
5138 \def\AE{AE}%
5139 \def\DH{DZZ}%
5140 \def\L{L}%
5141 \def\OE{OE}%
5142 \def\O{O}%
5143 \def\TH{TH}%
5144 \def\aa{aa}%
5145 \def\ae{ae}%
5146 \def\dh{dzz}%
5147 \def\exclamdown{!}%
5148 \def\l{l}%
5149 \def\oe{oe}%
5150 \def\ordf{a}%
5151 \def\ordm{o}%
5152 \def\o{o}%
5153 \def\questiondown{?}%
5154 \def\ss{ss}%
5155 \def\th{th}%
5157 \def\LaTeX{LaTeX}%
5158 \def\TeX{TeX}%
5160 % Assorted special characters. \defglyph gives the control sequence a
5161 % definition that removes the {} that follows its use.
5162 \defglyph\atchar{@}%
5163 \defglyph\arrow{->}%
5164 \defglyph\bullet{bullet}%
5165 \defglyph\comma{,}%
5166 \defglyph\copyright{copyright}%
5167 \defglyph\dots{...}%
5168 \defglyph\enddots{...}%
5169 \defglyph\equiv{==}%
5170 \defglyph\error{error}%
5171 \defglyph\euro{euro}%
5172 \defglyph\expansion{==>}%
5173 \defglyph\geq{>=}%
5174 \defglyph\guillemetleft{<<}%
5175 \defglyph\guillemetright{>>}%
5176 \defglyph\guilsinglleft{<}%
5177 \defglyph\guilsinglright{>}%
5178 \defglyph\leq{<=}%
5179 \defglyph\lbracechar{\{}%
5180 \defglyph\minus{-}%
5181 \defglyph\point{.}%
5182 \defglyph\pounds{pounds}%
5183 \defglyph\print{-|}%
5184 \defglyph\quotedblbase{"}%
5185 \defglyph\quotedblleft{"}%
5186 \defglyph\quotedblright{"}%
5187 \defglyph\quoteleft{`}%
5188 \defglyph\quoteright{'}%
5189 \defglyph\quotesinglbase{,}%
5190 \defglyph\rbracechar{\}}%
5191 \defglyph\registeredsymbol{R}%
5192 \defglyph\result{=>}%
5193 \defglyph\textdegree{o}%
5195 % We need to get rid of all macros, leaving only the arguments (if present).
5196 % Of course this is not nearly correct, but it is the best we can do for now.
5197 % makeinfo does not expand macros in the argument to @deffn, which ends up
5198 % writing an index entry, and texindex isn't prepared for an index sort entry
5199 % that starts with \.
5201 % Since macro invocations are followed by braces, we can just redefine them
5202 % to take a single TeX argument. The case of a macro invocation that
5203 % goes to end-of-line is not handled.
5205 \macrolist
5206 \let\value\indexnofontsvalue
5208 \def\defglyph#1#2{\def#1##1{#2}} % see above
5213 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
5215 % Most index entries go through here, but \dosubind is the general case.
5216 % #1 is the index name, #2 is the entry text.
5217 \def\doind#1#2{\dosubind{#1}{#2}{}}
5219 % There is also \dosubind {index}{topic}{subtopic}
5220 % which makes an entry in a two-level index such as the operation index.
5221 % TODO: Two-level index? Operation index?
5223 % Workhorse for all indexes.
5224 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
5225 % empty if called from \doind, as we usually are (the main exception
5226 % is with most defuns, which call us directly).
5228 \def\dosubind#1#2#3{%
5229 \iflinks
5231 \requireopenindexfile{#1}%
5232 % Store the main index entry text (including the third arg).
5233 \toks0 = {#2}%
5234 % If third arg is present, precede it with a space.
5235 \def\thirdarg{#3}%
5236 \ifx\thirdarg\empty \else
5237 \toks0 = \expandafter{\the\toks0 \space #3}%
5240 \edef\writeto{\csname#1indfile\endcsname}%
5242 \safewhatsit\dosubindwrite
5247 % Check if an index file has been opened, and if not, open it.
5248 \def\requireopenindexfile#1{%
5249 \ifnum\csname #1indfile\endcsname=0
5250 \expandafter\newwrite \csname#1indfile\endcsname
5251 \edef\suffix{#1}%
5252 % A .fls suffix would conflict with the file extension for the output
5253 % of -recorder, so use .f1s instead.
5254 \ifx\suffix\indexisfl\def\suffix{f1}\fi
5255 % Open the file
5256 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5257 % Using \immediate above here prevents an object entering into the current
5258 % box, which could confound checks such as those in \safewhatsit for
5259 % preceding skips.
5260 \typeout{Writing index file \jobname.\suffix}%
5261 \fi}
5262 \def\indexisfl{fl}
5264 % Output \ as {\indexbackslash}, because \ is an escape character in
5265 % the index files.
5266 \let\indexbackslash=\relax
5267 {\catcode`\@=0 \catcode`\\=\active
5268 @gdef@useindexbackslash{@def\{{@indexbackslash}}}
5271 % Definition for writing index entry text.
5272 \def\sortas#1{\ignorespaces}%
5274 % Definition for writing index entry sort key. Should occur at the at
5275 % the beginning of the index entry, like
5276 % @cindex @sortas{september} \september
5277 % The \ignorespaces takes care of following space, but there's no way
5278 % to remove space before it.
5280 \catcode`\-=13
5281 \gdef\indexwritesortas{%
5282 \begingroup
5283 \indexnonalnumreappear
5284 \indexwritesortasxxx}
5285 \gdef\indexwritesortasxxx#1{%
5286 \xdef\indexsortkey{#1}\endgroup}
5290 % Write the entry in \toks0 to the index file.
5292 \def\dosubindwrite{%
5293 % Put the index entry in the margin if desired.
5294 \ifx\SETmarginindex\relax\else
5295 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
5298 % Remember, we are within a group.
5299 \indexdummies % Must do this here, since \bf, etc expand at this stage
5300 \useindexbackslash % \indexbackslash isn't defined now so it will be output
5301 % as is; and it will print as backslash.
5302 % The braces around \indexbrace are recognized by texindex.
5304 % Get the string to sort by, by processing the index entry with all
5305 % font commands turned off.
5306 {\indexnofonts
5307 \def\lbracechar{{\indexlbrace}}%
5308 \def\rbracechar{{\indexrbrace}}%
5309 \let\{=\lbracechar
5310 \let\}=\rbracechar
5311 \indexnonalnumdisappear
5312 \xdef\indexsortkey{}%
5313 \let\sortas=\indexwritesortas
5314 \edef\temp{\the\toks0}%
5315 \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
5316 \ifx\indexsortkey\empty
5317 \xdef\indexsortkey{\temp}%
5318 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
5322 % Set up the complete index entry, with both the sort key and
5323 % the original text, including any font commands. We write
5324 % three arguments to \entry to the .?? file (four in the
5325 % subentry case), texindex reduces to two when writing the .??s
5326 % sorted result.
5327 \edef\temp{%
5328 \write\writeto{%
5329 \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
5331 \temp
5333 \newbox\dummybox % used above
5335 % Take care of unwanted page breaks/skips around a whatsit:
5337 % If a skip is the last thing on the list now, preserve it
5338 % by backing up by \lastskip, doing the \write, then inserting
5339 % the skip again. Otherwise, the whatsit generated by the
5340 % \write or \pdfdest will make \lastskip zero. The result is that
5341 % sequences like this:
5342 % @end defun
5343 % @tindex whatever
5344 % @defun ...
5345 % will have extra space inserted, because the \medbreak in the
5346 % start of the @defun won't see the skip inserted by the @end of
5347 % the previous defun.
5349 % But don't do any of this if we're not in vertical mode. We
5350 % don't want to do a \vskip and prematurely end a paragraph.
5352 % Avoid page breaks due to these extra skips, too.
5354 % But wait, there is a catch there:
5355 % We'll have to check whether \lastskip is zero skip. \ifdim is not
5356 % sufficient for this purpose, as it ignores stretch and shrink parts
5357 % of the skip. The only way seems to be to check the textual
5358 % representation of the skip.
5360 % The following is almost like \def\zeroskipmacro{0.0pt} except that
5361 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5363 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5365 \newskip\whatsitskip
5366 \newcount\whatsitpenalty
5368 % ..., ready, GO:
5370 \def\safewhatsit#1{\ifhmode
5372 \else
5373 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5374 \whatsitskip = \lastskip
5375 \edef\lastskipmacro{\the\lastskip}%
5376 \whatsitpenalty = \lastpenalty
5378 % If \lastskip is nonzero, that means the last item was a
5379 % skip. And since a skip is discardable, that means this
5380 % -\whatsitskip glue we're inserting is preceded by a
5381 % non-discardable item, therefore it is not a potential
5382 % breakpoint, therefore no \nobreak needed.
5383 \ifx\lastskipmacro\zeroskipmacro
5384 \else
5385 \vskip-\whatsitskip
5390 \ifx\lastskipmacro\zeroskipmacro
5391 % If \lastskip was zero, perhaps the last item was a penalty, and
5392 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5393 % to re-insert the same penalty (values >10000 are used for various
5394 % signals); since we just inserted a non-discardable item, any
5395 % following glue (such as a \parskip) would be a breakpoint. For example:
5396 % @deffn deffn-whatever
5397 % @vindex index-whatever
5398 % Description.
5399 % would allow a break between the index-whatever whatsit
5400 % and the "Description." paragraph.
5401 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5402 \else
5403 % On the other hand, if we had a nonzero \lastskip,
5404 % this make-up glue would be preceded by a non-discardable item
5405 % (the whatsit from the \write), so we must insert a \nobreak.
5406 \nobreak\vskip\whatsitskip
5408 \fi}
5410 % The index entry written in the file actually looks like
5411 % \entry {sortstring}{page}{topic}
5412 % or
5413 % \entry {sortstring}{page}{topic}{subtopic}
5414 % The texindex program reads in these files and writes files
5415 % containing these kinds of lines:
5416 % \initial {c}
5417 % before the first topic whose initial is c
5418 % \entry {topic}{pagelist}
5419 % for a topic that is used without subtopics
5420 % \primary {topic}
5421 % for the beginning of a topic that is used with subtopics
5422 % \secondary {subtopic}{pagelist}
5423 % for each subtopic.
5425 % Define the user-accessible indexing commands
5426 % @findex, @vindex, @kindex, @cindex.
5428 \def\findex {\fnindex}
5429 \def\kindex {\kyindex}
5430 \def\cindex {\cpindex}
5431 \def\vindex {\vrindex}
5432 \def\tindex {\tpindex}
5433 \def\pindex {\pgindex}
5435 \def\cindexsub {\begingroup\obeylines\cindexsub}
5436 {\obeylines %
5437 \gdef\cindexsub "#1" #2^^M{\endgroup %
5438 \dosubind{cp}{#2}{#1}}}
5440 % Define the macros used in formatting output of the sorted index material.
5442 % @printindex causes a particular index (the ??s file) to get printed.
5443 % It does not print any chapter heading (usually an @unnumbered).
5445 \parseargdef\printindex{\begingroup
5446 \dobreak \chapheadingskip{10000}%
5448 \smallfonts \rm
5449 \tolerance = 9500
5450 \plainfrenchspacing
5451 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5453 % See if the index file exists and is nonempty.
5454 % Change catcode of @ here so that if the index file contains
5455 % \initial {@}
5456 % as its first line, TeX doesn't complain about mismatched braces
5457 % (because it thinks @} is a control sequence).
5458 \catcode`\@ = 12
5459 % See comment in \requireopenindexfile.
5460 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5461 \openin 1 \jobname.\indexname s
5462 \ifeof 1
5463 % \enddoublecolumns gets confused if there is no text in the index,
5464 % and it loses the chapter title and the aux file entries for the
5465 % index. The easiest way to prevent this problem is to make sure
5466 % there is some text.
5467 \putwordIndexNonexistent
5468 \typeout{No file \jobname.\indexname s.}%
5469 \else
5470 \catcode`\\ = 0
5472 % If the index file exists but is empty, then \openin leaves \ifeof
5473 % false. We have to make TeX try to read something from the file, so
5474 % it can discover if there is anything in it.
5475 \read 1 to \thisline
5476 \ifeof 1
5477 \putwordIndexIsEmpty
5478 \else
5479 % Index files are almost Texinfo source, but we use \ as the escape
5480 % character. It would be better to use @, but that's too big a change
5481 % to make right now.
5482 \def\indexbackslash{\ttbackslash}%
5483 \let\indexlbrace\{ % Likewise, set these sequences for braces
5484 \let\indexrbrace\} % used in the sort key.
5485 \begindoublecolumns
5486 \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
5488 % Read input from the index file line by line.
5489 \loopdo
5490 \ifeof1 \else
5491 \read 1 to \nextline
5494 \indexinputprocessing
5495 \thisline
5497 \ifeof1\else
5498 \let\thisline\nextline
5499 \repeat
5501 \enddoublecolumns
5504 \closein 1
5505 \endgroup}
5506 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
5507 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
5509 \def\indexinputprocessing{%
5510 \ifeof1
5511 \let\firsttoken\relax
5512 \else
5513 \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
5514 \act
5517 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
5518 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
5521 % These macros are used by the sorted index file itself.
5522 % Change them to control the appearance of the index.
5524 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5525 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5526 \catcode`\$=3
5527 \gdef\initialglyphs{%
5528 % Some changes for non-alphabetic characters. Using the glyphs from the
5529 % math fonts looks more consistent than the typewriter font used elsewhere
5530 % for these characters.
5531 \def\indexbackslash{\math{\backslash}}%
5532 \let\\=\indexbackslash
5534 % Can't get bold backslash so don't use bold forward slash
5535 \catcode`\/=13
5536 \def/{{\secrmnotbold \normalslash}}%
5537 \def-{{\normaldash\normaldash}}% en dash `--'
5538 \def^{{\chapbf \normalcaret}}%
5539 \def~{{\chapbf \normaltilde}}%
5540 \def\_{%
5541 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5542 \def|{$\vert$}%
5543 \def<{$\less$}%
5544 \def>{$\gtr$}%
5545 \def+{$\normalplus$}%
5548 \def\initial{%
5549 \bgroup
5550 \initialglyphs
5551 \initialx
5554 \def\initialx#1{%
5555 % Remove any glue we may have, we'll be inserting our own.
5556 \removelastskip
5558 % We like breaks before the index initials, so insert a bonus.
5559 % The glue before the bonus allows a little bit of space at the
5560 % bottom of a column to reduce an increase in inter-line spacing.
5561 \nobreak
5562 \vskip 0pt plus 5\baselineskip
5563 \penalty -300
5564 \vskip 0pt plus -5\baselineskip
5566 % Typeset the initial. Making this add up to a whole number of
5567 % baselineskips increases the chance of the dots lining up from column
5568 % to column. It still won't often be perfect, because of the stretch
5569 % we need before each entry, but it's better.
5571 % No shrink because it confuses \balancecolumns.
5572 \vskip 1.67\baselineskip plus 1\baselineskip
5573 \leftline{\secfonts \kern-0.05em \secbf #1}%
5574 % \secfonts is inside the argument of \leftline so that the change of
5575 % \baselineskip will not affect any glue inserted before the vbox that
5576 % \leftline creates.
5577 % Do our best not to break after the initial.
5578 \nobreak
5579 \vskip .33\baselineskip plus .1\baselineskip
5580 \egroup % \initialglyphs
5583 \newdimen\entryrightmargin
5584 \entryrightmargin=0pt
5586 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5587 % then page number (#2) flushed to the right margin. It is used for index
5588 % and table of contents entries. The paragraph is indented by \leftskip.
5590 \def\entry{%
5591 \begingroup
5593 % For pdfTeX and XeTeX.
5594 % The redefinition of \domark stops marks being added in \pdflink to
5595 % preserve coloured links across page boundaries. Otherwise the marks
5596 % would get in the way of \lastbox in \insertentrybox.
5597 \let\domark\relax
5599 % Start a new paragraph if necessary, so our assignments below can't
5600 % affect previous text.
5601 \par
5603 % No extra space above this paragraph.
5604 \parskip = 0in
5606 % When reading the text of entry, convert explicit line breaks
5607 % from @* into spaces. The user might give these in long section
5608 % titles, for instance.
5609 \def\*{\unskip\space\ignorespaces}%
5610 \def\entrybreak{\hfil\break}% An undocumented command
5612 % Swallow the left brace of the text (first parameter):
5613 \afterassignment\doentry
5614 \let\temp =
5616 \def\entrybreak{\unskip\space\ignorespaces}%
5617 \def\doentry{%
5618 % Save the text of the entry
5619 \global\setbox\boxA=\hbox\bgroup
5620 \bgroup % Instead of the swallowed brace.
5621 \noindent
5622 \aftergroup\finishentry
5623 % And now comes the text of the entry.
5624 % Not absorbing as a macro argument reduces the chance of problems
5625 % with catcodes occurring.
5627 {\catcode`\@=11
5628 \gdef\finishentry#1{%
5629 \egroup % end box A
5630 \dimen@ = \wd\boxA % Length of text of entry
5631 \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
5632 % #1 is the page number.
5634 % Get the width of the page numbers, and only use
5635 % leaders if they are present.
5636 \global\setbox\boxB = \hbox{#1}%
5637 \ifdim\wd\boxB = 0pt
5638 \null\nobreak\hfill\ %
5639 \else
5641 \null\nobreak\indexdotfill % Have leaders before the page number.
5643 \ifpdf
5644 \pdfgettoks#1.%
5645 \hskip\skip\thinshrinkable\the\toksA
5646 \else
5647 \ifx\XeTeXrevision\thisisundefined
5648 \hskip\skip\thinshrinkable #1%
5649 \else
5650 \pdfgettoks#1.%
5651 \hskip\skip\thinshrinkable\the\toksA
5655 \egroup % end \boxA
5656 \ifdim\wd\boxB = 0pt
5657 \global\setbox\entrybox=\vbox{\unhbox\boxA}%
5658 \else
5659 \global\setbox\entrybox=\vbox\bgroup
5660 % We want the text of the entries to be aligned to the left, and the
5661 % page numbers to be aligned to the right.
5663 \parindent = 0pt
5664 \advance\leftskip by 0pt plus 1fil
5665 \advance\leftskip by 0pt plus -1fill
5666 \rightskip = 0pt plus -1fil
5667 \advance\rightskip by 0pt plus 1fill
5668 % Cause last line, which could consist of page numbers on their own
5669 % if the list of page numbers is long, to be aligned to the right.
5670 \parfillskip=0pt plus -1fill
5672 \advance\rightskip by \entryrightmargin
5673 % Determine how far we can stretch into the margin.
5674 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5675 % fit on one line in @letterpaper format.
5676 \ifdim\entryrightmargin>2.1em
5677 \dimen@i=2.1em
5678 \else
5679 \dimen@i=0em
5681 \advance \parfillskip by 0pt minus 1\dimen@i
5683 \dimen@ii = \hsize
5684 \advance\dimen@ii by -1\leftskip
5685 \advance\dimen@ii by -1\entryrightmargin
5686 \advance\dimen@ii by 1\dimen@i
5687 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5688 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5689 % Try to split the text roughly evenly. \dimen@ will be the length of
5690 % the first line.
5691 \dimen@ = 0.7\dimen@
5692 \dimen@ii = \hsize
5693 \ifnum\dimen@>\dimen@ii
5694 % If the entry is too long (for example, if it needs more than
5695 % two lines), use all the space in the first line.
5696 \dimen@ = \dimen@ii
5698 \advance\leftskip by 0pt plus 1fill % ragged right
5699 \advance \dimen@ by 1\rightskip
5700 \parshape = 2 0pt \dimen@ 0em \dimen@ii
5701 % Ideally we'd add a finite glue at the end of the first line only,
5702 % instead of using \parshape with explicit line lengths, but TeX
5703 % doesn't seem to provide a way to do such a thing.
5705 % Indent all lines but the first one.
5706 \advance\leftskip by 1em
5707 \advance\parindent by -1em
5708 \fi\fi
5709 \indent % start paragraph
5710 \unhbox\boxA
5712 % Do not prefer a separate line ending with a hyphen to fewer lines.
5713 \finalhyphendemerits = 0
5715 % Word spacing - no stretch
5716 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5718 \linepenalty=1000 % Discourage line breaks.
5719 \hyphenpenalty=5000 % Discourage hyphenation.
5721 \par % format the paragraph
5722 \egroup % The \vbox
5724 \endgroup
5725 \dotheinsertentrybox
5728 \newskip\thinshrinkable
5729 \skip\thinshrinkable=.15em minus .15em
5731 \newbox\entrybox
5732 \def\insertentrybox{%
5733 \ourunvbox\entrybox
5736 % default definition
5737 \let\dotheinsertentrybox\insertentrybox
5739 % Use \lastbox to take apart vbox box by box, and add each sub-box
5740 % to the current vertical list.
5741 \def\ourunvbox#1{%
5742 \bgroup % for local binding of \delayedbox
5743 % Remove the last box from box #1
5744 \global\setbox#1=\vbox{%
5745 \unvbox#1%
5746 \unskip % remove any glue
5747 \unpenalty
5748 \global\setbox\interbox=\lastbox
5750 \setbox\delayedbox=\box\interbox
5751 \ifdim\ht#1=0pt\else
5752 \ourunvbox#1 % Repeat on what's left of the box
5753 \nobreak
5755 \box\delayedbox
5756 \egroup
5758 \newbox\delayedbox
5759 \newbox\interbox
5761 % Used from \printindex. \firsttoken should be the first token
5762 % after the \entry. If it's not another \entry, we are at the last
5763 % line of a group of index entries, so insert a penalty to discourage
5764 % widowed index entries.
5765 \def\dotheinsertentryboxwithpenalty{%
5766 \ifx\firsttoken\isentry
5767 \else
5768 \penalty 9000
5770 \insertentrybox
5772 \def\isentry{\entry}%
5774 % Like plain.tex's \dotfill, except uses up at least 1 em.
5775 % The filll stretch here overpowers both the fil and fill stretch to push
5776 % the page number to the right.
5777 \def\indexdotfill{\cleaders
5778 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5781 \def\primary #1{\line{#1\hfil}}
5783 \newskip\secondaryindent \secondaryindent=0.5cm
5784 \def\secondary#1#2{{%
5785 \parfillskip=0in
5786 \parskip=0in
5787 \hangindent=1in
5788 \hangafter=1
5789 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5790 \ifpdf
5791 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5792 \else
5793 \ifx\XeTeXrevision\thisisundefined
5795 \else
5796 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5799 \par
5802 % Define two-column mode, which we use to typeset indexes.
5803 % Adapted from the TeXbook, page 416, which is to say,
5804 % the manmac.tex format used to print the TeXbook itself.
5805 \catcode`\@=11 % private names
5807 \newbox\partialpage
5808 \newdimen\doublecolumnhsize
5810 % Use inside an output routine to save \topmark and \firstmark
5811 \def\savemarks{%
5812 \global\savedtopmark=\expandafter{\topmark }%
5813 \global\savedfirstmark=\expandafter{\firstmark }%
5815 \newtoks\savedtopmark
5816 \newtoks\savedfirstmark
5818 % Set \topmark and \firstmark for next time \output runs.
5819 % Can't be run from withinside \output (because any material
5820 % added while an output routine is active, including
5821 % penalties, is saved for after it finishes). The page so far
5822 % should be empty, otherwise what's on it will be thrown away.
5823 \def\restoremarks{%
5824 \mark{\the\savedtopmark}%
5825 \bgroup\output = {%
5826 \setbox\dummybox=\box\PAGE
5827 }abc\eject\egroup
5828 % "abc" because output routine doesn't fire for a completely empty page.
5829 \mark{\the\savedfirstmark}%
5832 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5833 % If not much space left on page, start a new page.
5834 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5836 % Grab any single-column material above us.
5837 \output = {%
5839 % Here is a possibility not foreseen in manmac: if we accumulate a
5840 % whole lot of material, we might end up calling this \output
5841 % routine twice in a row (see the doublecol-lose test, which is
5842 % essentially a couple of indexes with @setchapternewpage off). In
5843 % that case we just ship out what is in \partialpage with the normal
5844 % output routine. Generally, \partialpage will be empty when this
5845 % runs and this will be a no-op. See the indexspread.tex test case.
5846 \ifvoid\partialpage \else
5847 \onepageout{\pagecontents\partialpage}%
5850 \global\setbox\partialpage = \vbox{%
5851 % Unvbox the main output page.
5852 \unvbox\PAGE
5853 \kern-\topskip \kern\baselineskip
5855 \savemarks
5857 \eject % run that output routine to set \partialpage
5858 \restoremarks
5860 % We recover the two marks that the last output routine saved in order
5861 % to propagate the information in marks added around a chapter heading,
5862 % which could be otherwise be lost by the time the final page is output.
5865 % Use the double-column output routine for subsequent pages.
5866 \output = {\doublecolumnout}%
5868 % Change the page size parameters. We could do this once outside this
5869 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5870 % format, but then we repeat the same computation. Repeating a couple
5871 % of assignments once per index is clearly meaningless for the
5872 % execution time, so we may as well do it in one place.
5874 % First we halve the line length, less a little for the gutter between
5875 % the columns. We compute the gutter based on the line length, so it
5876 % changes automatically with the paper format. The magic constant
5877 % below is chosen so that the gutter has the same value (well, +-<1pt)
5878 % as it did when we hard-coded it.
5880 % We put the result in a separate register, \doublecolumhsize, so we
5881 % can restore it in \pagesofar, after \hsize itself has (potentially)
5882 % been clobbered.
5884 \doublecolumnhsize = \hsize
5885 \advance\doublecolumnhsize by -.04154\hsize
5886 \divide\doublecolumnhsize by 2
5887 \hsize = \doublecolumnhsize
5889 % Double the \vsize as well.
5890 \advance\vsize by -\ht\partialpage
5891 \vsize = 2\vsize
5893 % For the benefit of balancing columns
5894 \advance\baselineskip by 0pt plus 0.5pt
5897 % The double-column output routine for all double-column pages except
5898 % the last, which is done by \balancecolumns.
5900 \def\doublecolumnout{%
5902 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5903 % Get the available space for the double columns -- the normal
5904 % (undoubled) page height minus any material left over from the
5905 % previous page.
5906 \dimen@ = \vsize
5907 \divide\dimen@ by 2
5909 % box0 will be the left-hand column, box2 the right.
5910 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
5911 \global\advance\vsize by 2\ht\partialpage
5912 \onepageout\pagesofar
5913 \unvbox\PAGE
5914 \penalty\outputpenalty
5917 % Re-output the contents of the output page -- any previous material,
5918 % followed by the two boxes we just split, in box0 and box2.
5919 \def\pagesofar{%
5920 \unvbox\partialpage
5922 \hsize = \doublecolumnhsize
5923 \wd0=\hsize \wd2=\hsize
5924 \hbox to\txipagewidth{\box0\hfil\box2}%
5928 % Finished with with double columns.
5929 \def\enddoublecolumns{%
5930 % The following penalty ensures that the page builder is exercised
5931 % _before_ we change the output routine. This is necessary in the
5932 % following situation:
5934 % The last section of the index consists only of a single entry.
5935 % Before this section, \pagetotal is less than \pagegoal, so no
5936 % break occurs before the last section starts. However, the last
5937 % section, consisting of \initial and the single \entry, does not
5938 % fit on the page and has to be broken off. Without the following
5939 % penalty the page builder will not be exercised until \eject
5940 % below, and by that time we'll already have changed the output
5941 % routine to the \balancecolumns version, so the next-to-last
5942 % double-column page will be processed with \balancecolumns, which
5943 % is wrong: The two columns will go to the main vertical list, with
5944 % the broken-off section in the recent contributions. As soon as
5945 % the output routine finishes, TeX starts reconsidering the page
5946 % break. The two columns and the broken-off section both fit on the
5947 % page, because the two columns now take up only half of the page
5948 % goal. When TeX sees \eject from below which follows the final
5949 % section, it invokes the new output routine that we've set after
5950 % \balancecolumns below; \onepageout will try to fit the two columns
5951 % and the final section into the vbox of \txipageheight (see
5952 % \pagebody), causing an overfull box.
5954 % Note that glue won't work here, because glue does not exercise the
5955 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5956 \penalty0
5958 \output = {%
5959 % Split the last of the double-column material.
5960 \savemarks
5961 \balancecolumns
5963 \eject % call the \output just set
5964 \ifdim\pagetotal=0pt
5965 % Having called \balancecolumns once, we do not
5966 % want to call it again. Therefore, reset \output to its normal
5967 % definition right away.
5968 \global\output = {\onepageout{\pagecontents\PAGE}}%
5970 \endgroup % started in \begindoublecolumns
5971 \restoremarks
5972 % Leave the double-column material on the current page, no automatic
5973 % page break.
5974 \box\balancedcolumns
5976 % \pagegoal was set to the doubled \vsize above, since we restarted
5977 % the current page. We're now back to normal single-column
5978 % typesetting, so reset \pagegoal to the normal \vsize.
5979 \global\vsize = \txipageheight %
5980 \pagegoal = \txipageheight %
5981 \else
5982 % We had some left-over material. This might happen when \doublecolumnout
5983 % is called in \balancecolumns. Try again.
5984 \expandafter\enddoublecolumns
5987 \newbox\balancedcolumns
5988 \setbox\balancedcolumns=\vbox{shouldnt see this}%
5990 % Only called for the last of the double column material. \doublecolumnout
5991 % does the others.
5992 \def\balancecolumns{%
5993 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
5994 \dimen@ = \ht0
5995 \advance\dimen@ by \topskip
5996 \advance\dimen@ by-\baselineskip
5997 \ifdim\dimen@<5\baselineskip
5998 % Don't split a short final column in two.
5999 \setbox2=\vbox{}%
6000 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
6001 \else
6002 \divide\dimen@ by 2 % target to split to
6003 \dimen@ii = \dimen@
6004 \splittopskip = \topskip
6005 % Loop until left column is at least as high as the right column.
6007 \vbadness = 10000
6008 \loop
6009 \global\setbox3 = \copy0
6010 \global\setbox1 = \vsplit3 to \dimen@
6011 \ifdim\ht1<\ht3
6012 \global\advance\dimen@ by 1pt
6013 \repeat
6015 % Now the left column is in box 1, and the right column in box 3.
6017 % Check whether the left column has come out higher than the page itself.
6018 % (Note that we have doubled \vsize for the double columns, so
6019 % the actual height of the page is 0.5\vsize).
6020 \ifdim2\ht1>\vsize
6021 % It appears that we have been called upon to balance too much material.
6022 % Output some of it with \doublecolumnout, leaving the rest on the page.
6023 \setbox\PAGE=\box0
6024 \doublecolumnout
6025 \else
6026 % Compare the heights of the two columns.
6027 \ifdim4\ht1>5\ht3
6028 % Column heights are too different, so don't make their bottoms
6029 % flush with each other.
6030 \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
6031 \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
6032 \else
6033 % Make column bottoms flush with each other.
6034 \setbox2=\vbox to\ht1{\unvbox3\unskip}%
6035 \setbox0=\vbox to\ht1{\unvbox1\unskip}%
6037 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
6042 \catcode`\@ = \other
6045 \message{sectioning,}
6046 % Chapters, sections, etc.
6048 % Let's start with @part.
6049 \outer\parseargdef\part{\partzzz{#1}}
6050 \def\partzzz#1{%
6051 \chapoddpage
6052 \null
6053 \vskip.3\vsize % move it down on the page a bit
6054 \begingroup
6055 \noindent \titlefonts\rm #1\par % the text
6056 \let\lastnode=\empty % no node to associate with
6057 \writetocentry{part}{#1}{}% but put it in the toc
6058 \headingsoff % no headline or footline on the part page
6059 % This outputs a mark at the end of the page that clears \thischapter
6060 % and \thissection, as is done in \startcontents.
6061 \let\pchapsepmacro\relax
6062 \chapmacro{}{Yomitfromtoc}{}%
6063 \chapoddpage
6064 \endgroup
6067 % \unnumberedno is an oxymoron. But we count the unnumbered
6068 % sections so that we can refer to them unambiguously in the pdf
6069 % outlines by their "section number". We avoid collisions with chapter
6070 % numbers by starting them at 10000. (If a document ever has 10000
6071 % chapters, we're in trouble anyway, I'm sure.)
6072 \newcount\unnumberedno \unnumberedno = 10000
6073 \newcount\chapno
6074 \newcount\secno \secno=0
6075 \newcount\subsecno \subsecno=0
6076 \newcount\subsubsecno \subsubsecno=0
6078 % This counter is funny since it counts through charcodes of letters A, B, ...
6079 \newcount\appendixno \appendixno = `\@
6081 % \def\appendixletter{\char\the\appendixno}
6082 % We do the following ugly conditional instead of the above simple
6083 % construct for the sake of pdftex, which needs the actual
6084 % letter in the expansion, not just typeset.
6086 \def\appendixletter{%
6087 \ifnum\appendixno=`A A%
6088 \else\ifnum\appendixno=`B B%
6089 \else\ifnum\appendixno=`C C%
6090 \else\ifnum\appendixno=`D D%
6091 \else\ifnum\appendixno=`E E%
6092 \else\ifnum\appendixno=`F F%
6093 \else\ifnum\appendixno=`G G%
6094 \else\ifnum\appendixno=`H H%
6095 \else\ifnum\appendixno=`I I%
6096 \else\ifnum\appendixno=`J J%
6097 \else\ifnum\appendixno=`K K%
6098 \else\ifnum\appendixno=`L L%
6099 \else\ifnum\appendixno=`M M%
6100 \else\ifnum\appendixno=`N N%
6101 \else\ifnum\appendixno=`O O%
6102 \else\ifnum\appendixno=`P P%
6103 \else\ifnum\appendixno=`Q Q%
6104 \else\ifnum\appendixno=`R R%
6105 \else\ifnum\appendixno=`S S%
6106 \else\ifnum\appendixno=`T T%
6107 \else\ifnum\appendixno=`U U%
6108 \else\ifnum\appendixno=`V V%
6109 \else\ifnum\appendixno=`W W%
6110 \else\ifnum\appendixno=`X X%
6111 \else\ifnum\appendixno=`Y Y%
6112 \else\ifnum\appendixno=`Z Z%
6113 % The \the is necessary, despite appearances, because \appendixletter is
6114 % expanded while writing the .toc file. \char\appendixno is not
6115 % expandable, thus it is written literally, thus all appendixes come out
6116 % with the same letter (or @) in the toc without it.
6117 \else\char\the\appendixno
6118 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6119 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6121 % Each @chapter defines these (using marks) as the number+name, number
6122 % and name of the chapter. Page headings and footings can use
6123 % these. @section does likewise.
6124 \def\thischapter{}
6125 \def\thischapternum{}
6126 \def\thischaptername{}
6127 \def\thissection{}
6128 \def\thissectionnum{}
6129 \def\thissectionname{}
6131 \newcount\absseclevel % used to calculate proper heading level
6132 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6134 % @raisesections: treat @section as chapter, @subsection as section, etc.
6135 \def\raisesections{\global\advance\secbase by -1}
6136 \let\up=\raisesections % original BFox name
6138 % @lowersections: treat @chapter as section, @section as subsection, etc.
6139 \def\lowersections{\global\advance\secbase by 1}
6140 \let\down=\lowersections % original BFox name
6142 % we only have subsub.
6143 \chardef\maxseclevel = 3
6145 % A numbered section within an unnumbered changes to unnumbered too.
6146 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
6147 \chardef\unnlevel = \maxseclevel
6149 % Trace whether the current chapter is an appendix or not:
6150 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6151 \def\chapheadtype{N}
6153 % Choose a heading macro
6154 % #1 is heading type
6155 % #2 is heading level
6156 % #3 is text for heading
6157 \def\genhead#1#2#3{%
6158 % Compute the abs. sec. level:
6159 \absseclevel=#2
6160 \advance\absseclevel by \secbase
6161 % Make sure \absseclevel doesn't fall outside the range:
6162 \ifnum \absseclevel < 0
6163 \absseclevel = 0
6164 \else
6165 \ifnum \absseclevel > 3
6166 \absseclevel = 3
6169 % The heading type:
6170 \def\headtype{#1}%
6171 \if \headtype U%
6172 \ifnum \absseclevel < \unnlevel
6173 \chardef\unnlevel = \absseclevel
6175 \else
6176 % Check for appendix sections:
6177 \ifnum \absseclevel = 0
6178 \edef\chapheadtype{\headtype}%
6179 \else
6180 \if \headtype A\if \chapheadtype N%
6181 \errmessage{@appendix... within a non-appendix chapter}%
6182 \fi\fi
6184 % Check for numbered within unnumbered:
6185 \ifnum \absseclevel > \unnlevel
6186 \def\headtype{U}%
6187 \else
6188 \chardef\unnlevel = 3
6191 % Now print the heading:
6192 \if \headtype U%
6193 \ifcase\absseclevel
6194 \unnumberedzzz{#3}%
6195 \or \unnumberedseczzz{#3}%
6196 \or \unnumberedsubseczzz{#3}%
6197 \or \unnumberedsubsubseczzz{#3}%
6199 \else
6200 \if \headtype A%
6201 \ifcase\absseclevel
6202 \appendixzzz{#3}%
6203 \or \appendixsectionzzz{#3}%
6204 \or \appendixsubseczzz{#3}%
6205 \or \appendixsubsubseczzz{#3}%
6207 \else
6208 \ifcase\absseclevel
6209 \chapterzzz{#3}%
6210 \or \seczzz{#3}%
6211 \or \numberedsubseczzz{#3}%
6212 \or \numberedsubsubseczzz{#3}%
6216 \suppressfirstparagraphindent
6219 % an interface:
6220 \def\numhead{\genhead N}
6221 \def\apphead{\genhead A}
6222 \def\unnmhead{\genhead U}
6224 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6225 % all lower-level sectioning counters to zero.
6227 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
6228 % (e.g., figures), q.v. By default (before any chapter), that is empty.
6229 \let\chaplevelprefix = \empty
6231 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6232 \def\chapterzzz#1{%
6233 % section resetting is \global in case the chapter is in a group, such
6234 % as an @include file.
6235 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6236 \global\advance\chapno by 1
6238 % Used for \float.
6239 \gdef\chaplevelprefix{\the\chapno.}%
6240 \resetallfloatnos
6242 % \putwordChapter can contain complex things in translations.
6243 \toks0=\expandafter{\putwordChapter}%
6244 \message{\the\toks0 \space \the\chapno}%
6246 % Write the actual heading.
6247 \chapmacro{#1}{Ynumbered}{\the\chapno}%
6249 % So @section and the like are numbered underneath this chapter.
6250 \global\let\section = \numberedsec
6251 \global\let\subsection = \numberedsubsec
6252 \global\let\subsubsection = \numberedsubsubsec
6255 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6257 \def\appendixzzz#1{%
6258 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6259 \global\advance\appendixno by 1
6260 \gdef\chaplevelprefix{\appendixletter.}%
6261 \resetallfloatnos
6263 % \putwordAppendix can contain complex things in translations.
6264 \toks0=\expandafter{\putwordAppendix}%
6265 \message{\the\toks0 \space \appendixletter}%
6267 \chapmacro{#1}{Yappendix}{\appendixletter}%
6269 \global\let\section = \appendixsec
6270 \global\let\subsection = \appendixsubsec
6271 \global\let\subsubsection = \appendixsubsubsec
6274 % normally unnmhead0 calls unnumberedzzz:
6275 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
6276 \def\unnumberedzzz#1{%
6277 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6278 \global\advance\unnumberedno by 1
6280 % Since an unnumbered has no number, no prefix for figures.
6281 \global\let\chaplevelprefix = \empty
6282 \resetallfloatnos
6284 % This used to be simply \message{#1}, but TeX fully expands the
6285 % argument to \message. Therefore, if #1 contained @-commands, TeX
6286 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6287 % expanded @cite (which turns out to cause errors because \cite is meant
6288 % to be executed, not expanded).
6290 % Anyway, we don't want the fully-expanded definition of @cite to appear
6291 % as a result of the \message, we just want `@cite' itself. We use
6292 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6293 % simply yielding the contents of <toks register>. (We also do this for
6294 % the toc entries.)
6295 \toks0 = {#1}%
6296 \message{(\the\toks0)}%
6298 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6300 \global\let\section = \unnumberedsec
6301 \global\let\subsection = \unnumberedsubsec
6302 \global\let\subsubsection = \unnumberedsubsubsec
6305 % @centerchap is like @unnumbered, but the heading is centered.
6306 \outer\parseargdef\centerchap{%
6307 \let\centerparametersmaybe = \centerparameters
6308 \unnmhead0{#1}%
6309 \let\centerparametersmaybe = \relax
6312 % @top is like @unnumbered.
6313 \let\top\unnumbered
6315 % Sections.
6317 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6318 \def\seczzz#1{%
6319 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6320 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6323 % normally calls appendixsectionzzz:
6324 \outer\parseargdef\appendixsection{\apphead1{#1}}
6325 \def\appendixsectionzzz#1{%
6326 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6327 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6329 \let\appendixsec\appendixsection
6331 % normally calls unnumberedseczzz:
6332 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6333 \def\unnumberedseczzz#1{%
6334 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6335 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6338 % Subsections.
6340 % normally calls numberedsubseczzz:
6341 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
6342 \def\numberedsubseczzz#1{%
6343 \global\subsubsecno=0 \global\advance\subsecno by 1
6344 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6347 % normally calls appendixsubseczzz:
6348 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
6349 \def\appendixsubseczzz#1{%
6350 \global\subsubsecno=0 \global\advance\subsecno by 1
6351 \sectionheading{#1}{subsec}{Yappendix}%
6352 {\appendixletter.\the\secno.\the\subsecno}%
6355 % normally calls unnumberedsubseczzz:
6356 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6357 \def\unnumberedsubseczzz#1{%
6358 \global\subsubsecno=0 \global\advance\subsecno by 1
6359 \sectionheading{#1}{subsec}{Ynothing}%
6360 {\the\unnumberedno.\the\secno.\the\subsecno}%
6363 % Subsubsections.
6365 % normally numberedsubsubseczzz:
6366 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6367 \def\numberedsubsubseczzz#1{%
6368 \global\advance\subsubsecno by 1
6369 \sectionheading{#1}{subsubsec}{Ynumbered}%
6370 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6373 % normally appendixsubsubseczzz:
6374 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6375 \def\appendixsubsubseczzz#1{%
6376 \global\advance\subsubsecno by 1
6377 \sectionheading{#1}{subsubsec}{Yappendix}%
6378 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6381 % normally unnumberedsubsubseczzz:
6382 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6383 \def\unnumberedsubsubseczzz#1{%
6384 \global\advance\subsubsecno by 1
6385 \sectionheading{#1}{subsubsec}{Ynothing}%
6386 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6389 % These macros control what the section commands do, according
6390 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6391 % Define them by default for a numbered chapter.
6392 \let\section = \numberedsec
6393 \let\subsection = \numberedsubsec
6394 \let\subsubsection = \numberedsubsubsec
6396 % Define @majorheading, @heading and @subheading
6398 \def\majorheading{%
6399 {\advance\chapheadingskip by 10pt \chapbreak }%
6400 \parsearg\chapheadingzzz
6403 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6404 \def\chapheadingzzz#1{%
6405 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6406 \nobreak\bigskip \nobreak
6407 \suppressfirstparagraphindent
6410 % @heading, @subheading, @subsubheading.
6411 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6412 \suppressfirstparagraphindent}
6413 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6414 \suppressfirstparagraphindent}
6415 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6416 \suppressfirstparagraphindent}
6418 % These macros generate a chapter, section, etc. heading only
6419 % (including whitespace, linebreaking, etc. around it),
6420 % given all the information in convenient, parsed form.
6422 % Args are the skip and penalty (usually negative)
6423 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6425 % Parameter controlling skip before chapter headings (if needed)
6426 \newskip\chapheadingskip
6428 % Define plain chapter starts, and page on/off switching for it.
6429 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
6431 % Start a new page
6432 \def\chappager{\par\vfill\supereject}
6434 % \chapoddpage - start on an odd page for a new chapter
6435 % Because \domark is called before \chapoddpage, the filler page will
6436 % get the headings for the next chapter, which is wrong. But we don't
6437 % care -- we just disable all headings on the filler page.
6438 \def\chapoddpage{%
6439 \chappager
6440 \ifodd\pageno \else
6441 \begingroup
6442 \headingsoff
6443 \null
6444 \chappager
6445 \endgroup
6449 \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
6451 \def\CHAPPAGoff{%
6452 \global\let\contentsalignmacro = \chappager
6453 \global\let\pchapsepmacro=\chapbreak
6454 \global\let\pagealignmacro=\chappager}
6456 \def\CHAPPAGon{%
6457 \global\let\contentsalignmacro = \chappager
6458 \global\let\pchapsepmacro=\chappager
6459 \global\let\pagealignmacro=\chappager
6460 \global\def\HEADINGSon{\HEADINGSsingle}}
6462 \def\CHAPPAGodd{%
6463 \global\let\contentsalignmacro = \chapoddpage
6464 \global\let\pchapsepmacro=\chapoddpage
6465 \global\let\pagealignmacro=\chapoddpage
6466 \global\def\HEADINGSon{\HEADINGSdouble}}
6468 \CHAPPAGon
6470 % \chapmacro - Chapter opening.
6472 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6473 % Yappendix, Yomitfromtoc), #3 the chapter number.
6474 % Not used for @heading series.
6476 % To test against our argument.
6477 \def\Ynothingkeyword{Ynothing}
6478 \def\Yappendixkeyword{Yappendix}
6479 \def\Yomitfromtockeyword{Yomitfromtoc}
6481 \def\chapmacro#1#2#3{%
6482 \expandafter\ifx\thisenv\titlepage\else
6483 \checkenv{}% chapters, etc., should not start inside an environment.
6485 % FIXME: \chapmacro is currently called from inside \titlepage when
6486 % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
6487 % this should probably be done by \sectionheading with an option to print
6488 % in chapter size.
6490 % Insert the first mark before the heading break (see notes for \domark).
6491 \let\prevchapterdefs=\lastchapterdefs
6492 \let\prevsectiondefs=\lastsectiondefs
6493 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6494 \gdef\thissection{}}%
6496 \def\temptype{#2}%
6497 \ifx\temptype\Ynothingkeyword
6498 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6499 \gdef\thischapter{\thischaptername}}%
6500 \else\ifx\temptype\Yomitfromtockeyword
6501 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6502 \gdef\thischapter{}}%
6503 \else\ifx\temptype\Yappendixkeyword
6504 \toks0={#1}%
6505 \xdef\lastchapterdefs{%
6506 \gdef\noexpand\thischaptername{\the\toks0}%
6507 \gdef\noexpand\thischapternum{\appendixletter}%
6508 % \noexpand\putwordAppendix avoids expanding indigestible
6509 % commands in some of the translations.
6510 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6511 \noexpand\thischapternum:
6512 \noexpand\thischaptername}%
6514 \else
6515 \toks0={#1}%
6516 \xdef\lastchapterdefs{%
6517 \gdef\noexpand\thischaptername{\the\toks0}%
6518 \gdef\noexpand\thischapternum{\the\chapno}%
6519 % \noexpand\putwordChapter avoids expanding indigestible
6520 % commands in some of the translations.
6521 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6522 \noexpand\thischapternum:
6523 \noexpand\thischaptername}%
6525 \fi\fi\fi
6527 % Output the mark. Pass it through \safewhatsit, to take care of
6528 % the preceding space.
6529 \safewhatsit\domark
6531 % Insert the chapter heading break.
6532 \pchapsepmacro
6534 % Now the second mark, after the heading break. No break points
6535 % between here and the heading.
6536 \let\prevchapterdefs=\lastchapterdefs
6537 \let\prevsectiondefs=\lastsectiondefs
6538 \domark
6541 \chapfonts \rm
6542 \let\footnote=\errfootnoteheading % give better error message
6544 % Have to define \lastsection before calling \donoderef, because the
6545 % xref code eventually uses it. On the other hand, it has to be called
6546 % after \pchapsepmacro, or the headline will change too soon.
6547 \gdef\lastsection{#1}%
6549 % Only insert the separating space if we have a chapter/appendix
6550 % number, and don't print the unnumbered ``number''.
6551 \ifx\temptype\Ynothingkeyword
6552 \setbox0 = \hbox{}%
6553 \def\toctype{unnchap}%
6554 \else\ifx\temptype\Yomitfromtockeyword
6555 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6556 \def\toctype{omit}%
6557 \else\ifx\temptype\Yappendixkeyword
6558 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6559 \def\toctype{app}%
6560 \else
6561 \setbox0 = \hbox{#3\enspace}%
6562 \def\toctype{numchap}%
6563 \fi\fi\fi
6565 % Write the toc entry for this chapter. Must come before the
6566 % \donoderef, because we include the current node name in the toc
6567 % entry, and \donoderef resets it to empty.
6568 \writetocentry{\toctype}{#1}{#3}%
6570 % For pdftex, we have to write out the node definition (aka, make
6571 % the pdfdest) after any page break, but before the actual text has
6572 % been typeset. If the destination for the pdf outline is after the
6573 % text, then jumping from the outline may wind up with the text not
6574 % being visible, for instance under high magnification.
6575 \donoderef{#2}%
6577 % Typeset the actual heading.
6578 \nobreak % Avoid page breaks at the interline glue.
6579 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6580 \unhbox0 #1\par}%
6582 \nobreak\bigskip % no page break after a chapter title
6583 \nobreak
6586 % @centerchap -- centered and unnumbered.
6587 \let\centerparametersmaybe = \relax
6588 \def\centerparameters{%
6589 \advance\rightskip by 3\rightskip
6590 \leftskip = \rightskip
6591 \parfillskip = 0pt
6595 % Section titles. These macros combine the section number parts and
6596 % call the generic \sectionheading to do the printing.
6598 \newskip\secheadingskip
6599 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6601 % Subsection titles.
6602 \newskip\subsecheadingskip
6603 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6605 % Subsubsection titles.
6606 \def\subsubsecheadingskip{\subsecheadingskip}
6607 \def\subsubsecheadingbreak{\subsecheadingbreak}
6610 % Print any size, any type, section title.
6612 % #1 is the text of the title,
6613 % #2 is the section level (sec/subsec/subsubsec),
6614 % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6615 % #4 is the section number.
6617 \def\seckeyword{sec}
6619 \def\sectionheading#1#2#3#4{%
6621 \def\sectionlevel{#2}%
6622 \def\temptype{#3}%
6624 % It is ok for the @heading series commands to appear inside an
6625 % environment (it's been historically allowed, though the logic is
6626 % dubious), but not the others.
6627 \ifx\temptype\Yomitfromtockeyword\else
6628 \checkenv{}% non-@*heading should not be in an environment.
6630 \let\footnote=\errfootnoteheading
6632 % Switch to the right set of fonts.
6633 \csname #2fonts\endcsname \rm
6635 % Insert first mark before the heading break (see notes for \domark).
6636 \let\prevsectiondefs=\lastsectiondefs
6637 \ifx\temptype\Ynothingkeyword
6638 \ifx\sectionlevel\seckeyword
6639 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6640 \gdef\thissection{\thissectionname}}%
6642 \else\ifx\temptype\Yomitfromtockeyword
6643 % Don't redefine \thissection.
6644 \else\ifx\temptype\Yappendixkeyword
6645 \ifx\sectionlevel\seckeyword
6646 \toks0={#1}%
6647 \xdef\lastsectiondefs{%
6648 \gdef\noexpand\thissectionname{\the\toks0}%
6649 \gdef\noexpand\thissectionnum{#4}%
6650 % \noexpand\putwordSection avoids expanding indigestible
6651 % commands in some of the translations.
6652 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6653 \noexpand\thissectionnum:
6654 \noexpand\thissectionname}%
6657 \else
6658 \ifx\sectionlevel\seckeyword
6659 \toks0={#1}%
6660 \xdef\lastsectiondefs{%
6661 \gdef\noexpand\thissectionname{\the\toks0}%
6662 \gdef\noexpand\thissectionnum{#4}%
6663 % \noexpand\putwordSection avoids expanding indigestible
6664 % commands in some of the translations.
6665 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6666 \noexpand\thissectionnum:
6667 \noexpand\thissectionname}%
6670 \fi\fi\fi
6672 % Go into vertical mode. Usually we'll already be there, but we
6673 % don't want the following whatsit to end up in a preceding paragraph
6674 % if the document didn't happen to have a blank line.
6675 \par
6677 % Output the mark. Pass it through \safewhatsit, to take care of
6678 % the preceding space.
6679 \safewhatsit\domark
6681 % Insert space above the heading.
6682 \csname #2headingbreak\endcsname
6684 % Now the second mark, after the heading break. No break points
6685 % between here and the heading.
6686 \global\let\prevsectiondefs=\lastsectiondefs
6687 \domark
6689 % Only insert the space after the number if we have a section number.
6690 \ifx\temptype\Ynothingkeyword
6691 \setbox0 = \hbox{}%
6692 \def\toctype{unn}%
6693 \gdef\lastsection{#1}%
6694 \else\ifx\temptype\Yomitfromtockeyword
6695 % for @headings -- no section number, don't include in toc,
6696 % and don't redefine \lastsection.
6697 \setbox0 = \hbox{}%
6698 \def\toctype{omit}%
6699 \let\sectionlevel=\empty
6700 \else\ifx\temptype\Yappendixkeyword
6701 \setbox0 = \hbox{#4\enspace}%
6702 \def\toctype{app}%
6703 \gdef\lastsection{#1}%
6704 \else
6705 \setbox0 = \hbox{#4\enspace}%
6706 \def\toctype{num}%
6707 \gdef\lastsection{#1}%
6708 \fi\fi\fi
6710 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6711 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6713 % Write the node reference (= pdf destination for pdftex).
6714 % Again, see comments in \chapmacro.
6715 \donoderef{#3}%
6717 % Interline glue will be inserted when the vbox is completed.
6718 % That glue will be a valid breakpoint for the page, since it'll be
6719 % preceded by a whatsit (usually from the \donoderef, or from the
6720 % \writetocentry if there was no node). We don't want to allow that
6721 % break, since then the whatsits could end up on page n while the
6722 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6723 \nobreak
6725 % Output the actual section heading.
6726 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6727 \hangindent=\wd0 % zero if no section number
6728 \unhbox0 #1}%
6730 % Add extra space after the heading -- half of whatever came above it.
6731 % Don't allow stretch, though.
6732 \kern .5 \csname #2headingskip\endcsname
6734 % Do not let the kern be a potential breakpoint, as it would be if it
6735 % was followed by glue.
6736 \nobreak
6738 % We'll almost certainly start a paragraph next, so don't let that
6739 % glue accumulate. (Not a breakpoint because it's preceded by a
6740 % discardable item.) However, when a paragraph is not started next
6741 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6742 % or the negative glue will cause weirdly wrong output, typically
6743 % obscuring the section heading with something else.
6744 \vskip-\parskip
6746 % This is so the last item on the main vertical list is a known
6747 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6748 % and do the needful.
6749 \penalty 10001
6753 \message{toc,}
6754 % Table of contents.
6755 \newwrite\tocfile
6757 % Write an entry to the toc file, opening it if necessary.
6758 % Called from @chapter, etc.
6760 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6761 % We append the current node name (if any) and page number as additional
6762 % arguments for the \{chap,sec,...}entry macros which will eventually
6763 % read this. The node name is used in the pdf outlines as the
6764 % destination to jump to.
6766 % We open the .toc file for writing here instead of at @setfilename (or
6767 % any other fixed time) so that @contents can be anywhere in the document.
6768 % But if #1 is `omit', then we don't do anything. This is used for the
6769 % table of contents chapter openings themselves.
6771 \newif\iftocfileopened
6772 \def\omitkeyword{omit}%
6774 \def\writetocentry#1#2#3{%
6775 \edef\writetoctype{#1}%
6776 \ifx\writetoctype\omitkeyword \else
6777 \iftocfileopened\else
6778 \immediate\openout\tocfile = \jobname.toc
6779 \global\tocfileopenedtrue
6782 \iflinks
6783 {\atdummies
6784 \edef\temp{%
6785 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6786 \temp
6791 % Tell \shipout to create a pdf destination on each page, if we're
6792 % writing pdf. These are used in the table of contents. We can't
6793 % just write one on every page because the title pages are numbered
6794 % 1 and 2 (the page numbers aren't printed), and so are the first
6795 % two pages of the document. Thus, we'd have two destinations named
6796 % `1', and two named `2'.
6797 \ifpdf
6798 \global\pdfmakepagedesttrue
6799 \else
6800 \ifx\XeTeXrevision\thisisundefined
6801 \else
6802 \global\pdfmakepagedesttrue
6808 % These characters do not print properly in the Computer Modern roman
6809 % fonts, so we must take special care. This is more or less redundant
6810 % with the Texinfo input format setup at the end of this file.
6812 \def\activecatcodes{%
6813 \catcode`\"=\active
6814 \catcode`\$=\active
6815 \catcode`\<=\active
6816 \catcode`\>=\active
6817 \catcode`\\=\active
6818 \catcode`\^=\active
6819 \catcode`\_=\active
6820 \catcode`\|=\active
6821 \catcode`\~=\active
6825 % Read the toc file, which is essentially Texinfo input.
6826 \def\readtocfile{%
6827 \setupdatafile
6828 \activecatcodes
6829 \input \tocreadfilename
6832 \newskip\contentsrightmargin \contentsrightmargin=1in
6833 \newcount\savepageno
6834 \newcount\lastnegativepageno \lastnegativepageno = -1
6836 % Prepare to read what we've written to \tocfile.
6838 \def\startcontents#1{%
6839 % If @setchapternewpage on, and @headings double, the contents should
6840 % start on an odd page, unlike chapters. Thus, we maintain
6841 % \contentsalignmacro in parallel with \pagealignmacro.
6842 % From: Torbjorn Granlund <tege@matematik.su.se>
6843 \contentsalignmacro
6844 \immediate\closeout\tocfile
6846 % Don't need to put `Contents' or `Short Contents' in the headline.
6847 % It is abundantly clear what they are.
6848 \chapmacro{#1}{Yomitfromtoc}{}%
6850 \savepageno = \pageno
6851 \begingroup % Set up to handle contents files properly.
6852 \raggedbottom % Worry more about breakpoints than the bottom.
6853 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6855 % Roman numerals for page numbers.
6856 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6859 % redefined for the two-volume lispref. We always output on
6860 % \jobname.toc even if this is redefined.
6862 \def\tocreadfilename{\jobname.toc}
6864 % Normal (long) toc.
6866 \def\contents{%
6867 \startcontents{\putwordTOC}%
6868 \openin 1 \tocreadfilename\space
6869 \ifeof 1 \else
6870 \readtocfile
6872 \vfill \eject
6873 \contentsalignmacro % in case @setchapternewpage odd is in effect
6874 \ifeof 1 \else
6875 \pdfmakeoutlines
6877 \closein 1
6878 \endgroup
6879 \lastnegativepageno = \pageno
6880 \global\pageno = \savepageno
6883 % And just the chapters.
6884 \def\summarycontents{%
6885 \startcontents{\putwordShortTOC}%
6887 \let\partentry = \shortpartentry
6888 \let\numchapentry = \shortchapentry
6889 \let\appentry = \shortchapentry
6890 \let\unnchapentry = \shortunnchapentry
6891 % We want a true roman here for the page numbers.
6892 \secfonts
6893 \let\rm=\shortcontrm \let\bf=\shortcontbf
6894 \let\sl=\shortcontsl \let\tt=\shortconttt
6896 \hyphenpenalty = 10000
6897 \advance\baselineskip by 1pt % Open it up a little.
6898 \def\numsecentry##1##2##3##4{}
6899 \let\appsecentry = \numsecentry
6900 \let\unnsecentry = \numsecentry
6901 \let\numsubsecentry = \numsecentry
6902 \let\appsubsecentry = \numsecentry
6903 \let\unnsubsecentry = \numsecentry
6904 \let\numsubsubsecentry = \numsecentry
6905 \let\appsubsubsecentry = \numsecentry
6906 \let\unnsubsubsecentry = \numsecentry
6907 \openin 1 \tocreadfilename\space
6908 \ifeof 1 \else
6909 \readtocfile
6911 \closein 1
6912 \vfill \eject
6913 \contentsalignmacro % in case @setchapternewpage odd is in effect
6914 \endgroup
6915 \lastnegativepageno = \pageno
6916 \global\pageno = \savepageno
6918 \let\shortcontents = \summarycontents
6920 % Typeset the label for a chapter or appendix for the short contents.
6921 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6923 \def\shortchaplabel#1{%
6924 % This space should be enough, since a single number is .5em, and the
6925 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6926 % But use \hss just in case.
6927 % (This space doesn't include the extra space that gets added after
6928 % the label; that gets put in by \shortchapentry above.)
6930 % We'd like to right-justify chapter numbers, but that looks strange
6931 % with appendix letters. And right-justifying numbers and
6932 % left-justifying letters looks strange when there is less than 10
6933 % chapters. Have to read the whole toc once to know how many chapters
6934 % there are before deciding ...
6935 \hbox to 1em{#1\hss}%
6938 % These macros generate individual entries in the table of contents.
6939 % The first argument is the chapter or section name.
6940 % The last argument is the page number.
6941 % The arguments in between are the chapter number, section number, ...
6943 % Parts, in the main contents. Replace the part number, which doesn't
6944 % exist, with an empty box. Let's hope all the numbers have the same width.
6945 % Also ignore the page number, which is conventionally not printed.
6946 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6947 \def\partentry#1#2#3#4{%
6948 % Add stretch and a bonus for breaking the page before the part heading.
6949 % This reduces the chance of the page being broken immediately after the
6950 % part heading, before a following chapter heading.
6951 \vskip 0pt plus 5\baselineskip
6952 \penalty-300
6953 \vskip 0pt plus -5\baselineskip
6954 \dochapentry{\numeralbox\labelspace#1}{}%
6957 % Parts, in the short toc.
6958 \def\shortpartentry#1#2#3#4{%
6959 \penalty-300
6960 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6961 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6964 % Chapters, in the main contents.
6965 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6967 % Chapters, in the short toc.
6968 % See comments in \dochapentry re vbox and related settings.
6969 \def\shortchapentry#1#2#3#4{%
6970 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6973 % Appendices, in the main contents.
6974 % Need the word Appendix, and a fixed-size box.
6976 \def\appendixbox#1{%
6977 % We use M since it's probably the widest letter.
6978 \setbox0 = \hbox{\putwordAppendix{} M}%
6979 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6981 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6983 % Unnumbered chapters.
6984 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6985 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6987 % Sections.
6988 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6989 \let\appsecentry=\numsecentry
6990 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6992 % Subsections.
6993 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6994 \let\appsubsecentry=\numsubsecentry
6995 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6997 % And subsubsections.
6998 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6999 \let\appsubsubsecentry=\numsubsubsecentry
7000 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
7002 % This parameter controls the indentation of the various levels.
7003 % Same as \defaultparindent.
7004 \newdimen\tocindent \tocindent = 15pt
7006 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
7007 % page number.
7009 % If the toc has to be broken over pages, we want it to be at chapters
7010 % if at all possible; hence the \penalty.
7011 \def\dochapentry#1#2{%
7012 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
7013 \begingroup
7014 % Move the page numbers slightly to the right
7015 \advance\entryrightmargin by -0.05em
7016 \chapentryfonts
7017 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7018 \endgroup
7019 \nobreak\vskip .25\baselineskip plus.1\baselineskip
7022 \def\dosecentry#1#2{\begingroup
7023 \secentryfonts \leftskip=\tocindent
7024 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7025 \endgroup}
7027 \def\dosubsecentry#1#2{\begingroup
7028 \subsecentryfonts \leftskip=2\tocindent
7029 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7030 \endgroup}
7032 \def\dosubsubsecentry#1#2{\begingroup
7033 \subsubsecentryfonts \leftskip=3\tocindent
7034 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
7035 \endgroup}
7037 % We use the same \entry macro as for the index entries.
7038 \let\tocentry = \entry
7040 % Space between chapter (or whatever) number and the title.
7041 \def\labelspace{\hskip1em \relax}
7043 \def\dopageno#1{{\rm #1}}
7044 \def\doshortpageno#1{{\rm #1}}
7046 \def\chapentryfonts{\secfonts \rm}
7047 \def\secentryfonts{\textfonts}
7048 \def\subsecentryfonts{\textfonts}
7049 \def\subsubsecentryfonts{\textfonts}
7052 \message{environments,}
7053 % @foo ... @end foo.
7055 % @tex ... @end tex escapes into raw TeX temporarily.
7056 % One exception: @ is still an escape character, so that @end tex works.
7057 % But \@ or @@ will get a plain @ character.
7059 \envdef\tex{%
7060 \setupmarkupstyle{tex}%
7061 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
7062 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
7063 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
7064 \catcode `\%=14
7065 \catcode `\+=\other
7066 \catcode `\"=\other
7067 \catcode `\|=\other
7068 \catcode `\<=\other
7069 \catcode `\>=\other
7070 \catcode `\`=\other
7071 \catcode `\'=\other
7073 % ' is active in math mode (mathcode"8000). So reset it, and all our
7074 % other math active characters (just in case), to plain's definitions.
7075 \mathactive
7077 % Inverse of the list at the beginning of the file.
7078 \let\b=\ptexb
7079 \let\bullet=\ptexbullet
7080 \let\c=\ptexc
7081 \let\,=\ptexcomma
7082 \let\.=\ptexdot
7083 \let\dots=\ptexdots
7084 \let\equiv=\ptexequiv
7085 \let\!=\ptexexclam
7086 \let\i=\ptexi
7087 \let\indent=\ptexindent
7088 \let\noindent=\ptexnoindent
7089 \let\{=\ptexlbrace
7090 \let\+=\tabalign
7091 \let\}=\ptexrbrace
7092 \let\/=\ptexslash
7093 \let\sp=\ptexsp
7094 \let\*=\ptexstar
7095 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7096 \let\t=\ptext
7097 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7098 \let\frenchspacing=\plainfrenchspacing
7100 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7101 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7102 \def\@{@}%
7104 % There is no need to define \Etex.
7106 % Define @lisp ... @end lisp.
7107 % @lisp environment forms a group so it can rebind things,
7108 % including the definition of @end lisp (which normally is erroneous).
7110 % Amount to narrow the margins by for @lisp.
7111 \newskip\lispnarrowing \lispnarrowing=0.4in
7113 % This is the definition that ^^M gets inside @lisp, @example, and other
7114 % such environments. \null is better than a space, since it doesn't
7115 % have any width.
7116 \def\lisppar{\null\endgraf}
7118 % This space is always present above and below environments.
7119 \newskip\envskipamount \envskipamount = 0pt
7121 % Make spacing and below environment symmetrical. We use \parskip here
7122 % to help in doing that, since in @example-like environments \parskip
7123 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
7124 % start of the next paragraph will insert \parskip.
7126 \def\aboveenvbreak{{%
7127 % =10000 instead of <10000 because of a special case in \itemzzz and
7128 % \sectionheading, q.v.
7129 \ifnum \lastpenalty=10000 \else
7130 \advance\envskipamount by \parskip
7131 \endgraf
7132 \ifdim\lastskip<\envskipamount
7133 \removelastskip
7134 \ifnum\lastpenalty<10000
7135 % Penalize breaking before the environment, because preceding text
7136 % often leads into it.
7137 \penalty100
7139 \vskip\envskipamount
7144 \def\afterenvbreak{{%
7145 % =10000 instead of <10000 because of a special case in \itemzzz and
7146 % \sectionheading, q.v.
7147 \ifnum \lastpenalty=10000 \else
7148 \advance\envskipamount by \parskip
7149 \endgraf
7150 \ifdim\lastskip<\envskipamount
7151 \removelastskip
7152 % it's not a good place to break if the last penalty was \nobreak
7153 % or better ...
7154 \ifnum\lastpenalty<10000 \penalty-50 \fi
7155 \vskip\envskipamount
7160 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7161 % also clear it, so that its embedded environments do the narrowing again.
7162 \let\nonarrowing=\relax
7164 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7165 % environment contents.
7166 \font\circle=lcircle10
7167 \newdimen\circthick
7168 \newdimen\cartouter\newdimen\cartinner
7169 \newskip\normbskip\newskip\normpskip\newskip\normlskip
7170 \circthick=\fontdimen8\circle
7172 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7173 \def\ctr{{\hskip 6pt\circle\char'010}}
7174 \def\cbl{{\circle\char'012\hskip -6pt}}
7175 \def\cbr{{\hskip 6pt\circle\char'011}}
7176 \def\carttop{\hbox to \cartouter{\hskip\lskip
7177 \ctl\leaders\hrule height\circthick\hfil\ctr
7178 \hskip\rskip}}
7179 \def\cartbot{\hbox to \cartouter{\hskip\lskip
7180 \cbl\leaders\hrule height\circthick\hfil\cbr
7181 \hskip\rskip}}
7183 \newskip\lskip\newskip\rskip
7185 \envdef\cartouche{%
7186 \ifhmode\par\fi % can't be in the midst of a paragraph.
7187 \startsavinginserts
7188 \lskip=\leftskip \rskip=\rightskip
7189 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7190 \cartinner=\hsize \advance\cartinner by-\lskip
7191 \advance\cartinner by-\rskip
7192 \cartouter=\hsize
7193 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
7194 % side, and for 6pt waste from
7195 % each corner char, and rule thickness
7196 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7198 % If this cartouche directly follows a sectioning command, we need the
7199 % \parskip glue (backspaced over by default) or the cartouche can
7200 % collide with the section heading.
7201 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7203 \setbox\groupbox=\vbox\bgroup
7204 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7205 \carttop
7206 \hbox\bgroup
7207 \hskip\lskip
7208 \vrule\kern3pt
7209 \vbox\bgroup
7210 \kern3pt
7211 \hsize=\cartinner
7212 \baselineskip=\normbskip
7213 \lineskip=\normlskip
7214 \parskip=\normpskip
7215 \vskip -\parskip
7216 \comment % For explanation, see the end of def\group.
7218 \def\Ecartouche{%
7219 \ifhmode\par\fi
7220 \kern3pt
7221 \egroup
7222 \kern3pt\vrule
7223 \hskip\rskip
7224 \egroup
7225 \cartbot
7226 \egroup
7227 \addgroupbox
7228 \checkinserts
7232 % This macro is called at the beginning of all the @example variants,
7233 % inside a group.
7234 \newdimen\nonfillparindent
7235 \def\nonfillstart{%
7236 \aboveenvbreak
7237 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7238 \sepspaces % Make spaces be word-separators rather than space tokens.
7239 \let\par = \lisppar % don't ignore blank lines
7240 \obeylines % each line of input is a line of output
7241 \parskip = 0pt
7242 % Turn off paragraph indentation but redefine \indent to emulate
7243 % the normal \indent.
7244 \nonfillparindent=\parindent
7245 \parindent = 0pt
7246 \let\indent\nonfillindent
7248 \emergencystretch = 0pt % don't try to avoid overfull boxes
7249 \ifx\nonarrowing\relax
7250 \advance \leftskip by \lispnarrowing
7251 \exdentamount=\lispnarrowing
7252 \else
7253 \let\nonarrowing = \relax
7255 \let\exdent=\nofillexdent
7258 \begingroup
7259 \obeyspaces
7260 % We want to swallow spaces (but not other tokens) after the fake
7261 % @indent in our nonfill-environments, where spaces are normally
7262 % active and set to @tie, resulting in them not being ignored after
7263 % @indent.
7264 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7265 \gdef\nonfillindentcheck{%
7266 \ifx\temp %
7267 \expandafter\nonfillindentgobble%
7268 \else%
7269 \leavevmode\nonfillindentbox%
7270 \fi%
7272 \endgroup
7273 \def\nonfillindentgobble#1{\nonfillindent}
7274 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7276 % If you want all examples etc. small: @set dispenvsize small.
7277 % If you want even small examples the full size: @set dispenvsize nosmall.
7278 % This affects the following displayed environments:
7279 % @example, @display, @format, @lisp
7281 \def\smallword{small}
7282 \def\nosmallword{nosmall}
7283 \let\SETdispenvsize\relax
7284 \def\setnormaldispenv{%
7285 \ifx\SETdispenvsize\smallword
7286 % end paragraph for sake of leading, in case document has no blank
7287 % line. This is redundant with what happens in \aboveenvbreak, but
7288 % we need to do it before changing the fonts, and it's inconvenient
7289 % to change the fonts afterward.
7290 \ifnum \lastpenalty=10000 \else \endgraf \fi
7291 \smallexamplefonts \rm
7294 \def\setsmalldispenv{%
7295 \ifx\SETdispenvsize\nosmallword
7296 \else
7297 \ifnum \lastpenalty=10000 \else \endgraf \fi
7298 \smallexamplefonts \rm
7302 % We often define two environments, @foo and @smallfoo.
7303 % Let's do it in one command. #1 is the env name, #2 the definition.
7304 \def\makedispenvdef#1#2{%
7305 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7306 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7307 \expandafter\let\csname E#1\endcsname \afterenvbreak
7308 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7311 % Define two environment synonyms (#1 and #2) for an environment.
7312 \def\maketwodispenvdef#1#2#3{%
7313 \makedispenvdef{#1}{#3}%
7314 \makedispenvdef{#2}{#3}%
7317 % @lisp: indented, narrowed, typewriter font;
7318 % @example: same as @lisp.
7320 % @smallexample and @smalllisp: use smaller fonts.
7321 % Originally contributed by Pavel@xerox.
7323 \maketwodispenvdef{lisp}{example}{%
7324 \nonfillstart
7325 \tt\setupmarkupstyle{example}%
7326 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7327 \gobble % eat return
7329 % @display/@smalldisplay: same as @lisp except keep current font.
7331 \makedispenvdef{display}{%
7332 \nonfillstart
7333 \gobble
7336 % @format/@smallformat: same as @display except don't narrow margins.
7338 \makedispenvdef{format}{%
7339 \let\nonarrowing = t%
7340 \nonfillstart
7341 \gobble
7344 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7345 \envdef\flushleft{%
7346 \let\nonarrowing = t%
7347 \nonfillstart
7348 \gobble
7350 \let\Eflushleft = \afterenvbreak
7352 % @flushright.
7354 \envdef\flushright{%
7355 \let\nonarrowing = t%
7356 \nonfillstart
7357 \advance\leftskip by 0pt plus 1fill\relax
7358 \gobble
7360 \let\Eflushright = \afterenvbreak
7363 % @raggedright does more-or-less normal line breaking but no right
7364 % justification. From plain.tex. Don't stretch around special
7365 % characters in urls in this environment, since the stretch at the right
7366 % should be enough.
7367 \envdef\raggedright{%
7368 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7369 \def\urefprestretchamount{0pt}%
7370 \def\urefpoststretchamount{0pt}%
7372 \let\Eraggedright\par
7374 \envdef\raggedleft{%
7375 \parindent=0pt \leftskip0pt plus2em
7376 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7377 \hbadness=10000 % Last line will usually be underfull, so turn off
7378 % badness reporting.
7380 \let\Eraggedleft\par
7382 \envdef\raggedcenter{%
7383 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
7384 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7385 \hbadness=10000 % Last line will usually be underfull, so turn off
7386 % badness reporting.
7388 \let\Eraggedcenter\par
7391 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
7392 % and narrows the margins. We keep \parskip nonzero in general, since
7393 % we're doing normal filling. So, when using \aboveenvbreak and
7394 % \afterenvbreak, temporarily make \parskip 0.
7396 \makedispenvdef{quotation}{\quotationstart}
7398 \def\quotationstart{%
7399 \indentedblockstart % same as \indentedblock, but increase right margin too.
7400 \ifx\nonarrowing\relax
7401 \advance\rightskip by \lispnarrowing
7403 \parsearg\quotationlabel
7406 % We have retained a nonzero parskip for the environment, since we're
7407 % doing normal filling.
7409 \def\Equotation{%
7410 \par
7411 \ifx\quotationauthor\thisisundefined\else
7412 % indent a bit.
7413 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7415 {\parskip=0pt \afterenvbreak}%
7417 \def\Esmallquotation{\Equotation}
7419 % If we're given an argument, typeset it in bold with a colon after.
7420 \def\quotationlabel#1{%
7421 \def\temp{#1}%
7422 \ifx\temp\empty \else
7423 {\bf #1: }%
7427 % @indentedblock is like @quotation, but indents only on the left and
7428 % has no optional argument.
7430 \makedispenvdef{indentedblock}{\indentedblockstart}
7432 \def\indentedblockstart{%
7433 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7434 \parindent=0pt
7436 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7437 \ifx\nonarrowing\relax
7438 \advance\leftskip by \lispnarrowing
7439 \exdentamount = \lispnarrowing
7440 \else
7441 \let\nonarrowing = \relax
7445 % Keep a nonzero parskip for the environment, since we're doing normal filling.
7447 \def\Eindentedblock{%
7448 \par
7449 {\parskip=0pt \afterenvbreak}%
7451 \def\Esmallindentedblock{\Eindentedblock}
7454 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7455 % If we want to allow any <char> as delimiter,
7456 % we need the curly braces so that makeinfo sees the @verb command, eg:
7457 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7459 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7461 % [Knuth] p.344; only we need to do the other characters Texinfo sets
7462 % active too. Otherwise, they get lost as the first character on a
7463 % verbatim line.
7464 \def\dospecials{%
7465 \do\ \do\\\do\{\do\}\do\$\do\&%
7466 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7467 \do\<\do\>\do\|\do\@\do+\do\"%
7468 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7469 % @set txicodequotebacktick will not have effect on @verb and
7470 % @verbatim, and ?` and !` ligatures won't get disabled.
7471 %\do\`\do\'%
7474 % [Knuth] p. 380
7475 \def\uncatcodespecials{%
7476 \def\do##1{\catcode`##1=\other}\dospecials}
7478 % Setup for the @verb command.
7480 % Eight spaces for a tab
7481 \begingroup
7482 \catcode`\^^I=\active
7483 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7484 \endgroup
7486 \def\setupverb{%
7487 \tt % easiest (and conventionally used) font for verbatim
7488 \def\par{\leavevmode\endgraf}%
7489 \setupmarkupstyle{verb}%
7490 \tabeightspaces
7491 % Respect line breaks,
7492 % print special symbols as themselves, and
7493 % make each space count
7494 % must do in this order:
7495 \obeylines \uncatcodespecials \sepspaces
7498 % Setup for the @verbatim environment
7500 % Real tab expansion.
7501 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7503 % We typeset each line of the verbatim in an \hbox, so we can handle
7504 % tabs. The \global is in case the verbatim line starts with an accent,
7505 % or some other command that starts with a begin-group. Otherwise, the
7506 % entire \verbbox would disappear at the corresponding end-group, before
7507 % it is typeset. Meanwhile, we can't have nested verbatim commands
7508 % (can we?), so the \global won't be overwriting itself.
7509 \newbox\verbbox
7510 \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
7512 \begingroup
7513 \catcode`\^^I=\active
7514 \gdef\tabexpand{%
7515 \catcode`\^^I=\active
7516 \def^^I{\leavevmode\egroup
7517 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7518 \divide\dimen\verbbox by\tabw
7519 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7520 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7521 \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
7524 \endgroup
7526 % start the verbatim environment.
7527 \def\setupverbatim{%
7528 \let\nonarrowing = t%
7529 \nonfillstart
7530 \tt % easiest (and conventionally used) font for verbatim
7531 % The \leavevmode here is for blank lines. Otherwise, we would
7532 % never \starttabox and the \egroup would end verbatim mode.
7533 \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
7534 \tabexpand
7535 \setupmarkupstyle{verbatim}%
7536 % Respect line breaks,
7537 % print special symbols as themselves, and
7538 % make each space count.
7539 % Must do in this order:
7540 \obeylines \uncatcodespecials \sepspaces
7541 \everypar{\starttabbox}%
7544 % Do the @verb magic: verbatim text is quoted by unique
7545 % delimiter characters. Before first delimiter expect a
7546 % right brace, after last delimiter expect closing brace:
7548 % \def\doverb'{'<char>#1<char>'}'{#1}
7550 % [Knuth] p. 382; only eat outer {}
7551 \begingroup
7552 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7553 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7554 \endgroup
7556 \def\verb{\begingroup\setupverb\doverb}
7559 % Do the @verbatim magic: define the macro \doverbatim so that
7560 % the (first) argument ends when '@end verbatim' is reached, ie:
7562 % \def\doverbatim#1@end verbatim{#1}
7564 % For Texinfo it's a lot easier than for LaTeX,
7565 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7566 % we need not redefine '\', '{' and '}'.
7568 % Inspired by LaTeX's verbatim command set [latex.ltx]
7570 \begingroup
7571 \catcode`\ =\active
7572 \obeylines %
7573 % ignore everything up to the first ^^M, that's the newline at the end
7574 % of the @verbatim input line itself. Otherwise we get an extra blank
7575 % line in the output.
7576 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
7577 % We really want {...\end verbatim} in the body of the macro, but
7578 % without the active space; thus we have to use \xdef and \gobble.
7579 \endgroup
7581 \envdef\verbatim{%
7582 \setupverbatim\doverbatim
7584 \let\Everbatim = \afterenvbreak
7587 % @verbatiminclude FILE - insert text of file in verbatim environment.
7589 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7591 \def\doverbatiminclude#1{%
7593 \makevalueexpandable
7594 \setupverbatim
7595 \indexnofonts % Allow `@@' and other weird things in file names.
7596 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7597 \input #1
7598 \afterenvbreak
7602 % @copying ... @end copying.
7603 % Save the text away for @insertcopying later.
7605 % We save the uninterpreted tokens, rather than creating a box.
7606 % Saving the text in a box would be much easier, but then all the
7607 % typesetting commands (@smallbook, font changes, etc.) have to be done
7608 % beforehand -- and a) we want @copying to be done first in the source
7609 % file; b) letting users define the frontmatter in as flexible order as
7610 % possible is desirable.
7612 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7613 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7615 \def\insertcopying{%
7616 \begingroup
7617 \parindent = 0pt % paragraph indentation looks wrong on title page
7618 \scanexp\copyingtext
7619 \endgroup
7623 \message{defuns,}
7624 % @defun etc.
7626 \newskip\defbodyindent \defbodyindent=.4in
7627 \newskip\defargsindent \defargsindent=50pt
7628 \newskip\deflastargmargin \deflastargmargin=18pt
7629 \newcount\defunpenalty
7631 % Start the processing of @deffn:
7632 \def\startdefun{%
7633 \ifnum\lastpenalty<10000
7634 \medbreak
7635 \defunpenalty=10003 % Will keep this @deffn together with the
7636 % following @def command, see below.
7637 \else
7638 % If there are two @def commands in a row, we'll have a \nobreak,
7639 % which is there to keep the function description together with its
7640 % header. But if there's nothing but headers, we need to allow a
7641 % break somewhere. Check specifically for penalty 10002, inserted
7642 % by \printdefunline, instead of 10000, since the sectioning
7643 % commands also insert a nobreak penalty, and we don't want to allow
7644 % a break between a section heading and a defun.
7646 % As a further refinement, we avoid "club" headers by signalling
7647 % with penalty of 10003 after the very first @deffn in the
7648 % sequence (see above), and penalty of 10002 after any following
7649 % @def command.
7650 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7652 % Similarly, after a section heading, do not allow a break.
7653 % But do insert the glue.
7654 \medskip % preceded by discardable penalty, so not a breakpoint
7657 \parindent=0in
7658 \advance\leftskip by \defbodyindent
7659 \exdentamount=\defbodyindent
7662 \def\dodefunx#1{%
7663 % First, check whether we are in the right environment:
7664 \checkenv#1%
7666 % As above, allow line break if we have multiple x headers in a row.
7667 % It's not a great place, though.
7668 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7670 % And now, it's time to reuse the body of the original defun:
7671 \expandafter\gobbledefun#1%
7673 \def\gobbledefun#1\startdefun{}
7675 % \printdefunline \deffnheader{text}
7677 \def\printdefunline#1#2{%
7678 \begingroup
7679 % call \deffnheader:
7680 #1#2 \endheader
7681 % common ending:
7682 \interlinepenalty = 10000
7683 \advance\rightskip by 0pt plus 1fil\relax
7684 \endgraf
7685 \nobreak\vskip -\parskip
7686 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7687 % Some of the @defun-type tags do not enable magic parentheses,
7688 % rendering the following check redundant. But we don't optimize.
7689 \checkparencounts
7690 \endgroup
7693 \def\Edefun{\endgraf\medbreak}
7695 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7696 % the only thing remaining is to define \deffnheader.
7698 \def\makedefun#1{%
7699 \expandafter\let\csname E#1\endcsname = \Edefun
7700 \edef\temp{\noexpand\domakedefun
7701 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7702 \temp
7705 % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7707 % Define \deffn and \deffnx, without parameters.
7708 % \deffnheader has to be defined explicitly.
7710 \def\domakedefun#1#2#3{%
7711 \envdef#1{%
7712 \startdefun
7713 \doingtypefnfalse % distinguish typed functions from all else
7714 \parseargusing\activeparens{\printdefunline#3}%
7716 \def#2{\dodefunx#1}%
7717 \def#3%
7720 \newif\ifdoingtypefn % doing typed function?
7721 \newif\ifrettypeownline % typeset return type on its own line?
7723 % @deftypefnnewline on|off says whether the return type of typed functions
7724 % are printed on their own line. This affects @deftypefn, @deftypefun,
7725 % @deftypeop, and @deftypemethod.
7727 \parseargdef\deftypefnnewline{%
7728 \def\temp{#1}%
7729 \ifx\temp\onword
7730 \expandafter\let\csname SETtxideftypefnnl\endcsname
7731 = \empty
7732 \else\ifx\temp\offword
7733 \expandafter\let\csname SETtxideftypefnnl\endcsname
7734 = \relax
7735 \else
7736 \errhelp = \EMsimple
7737 \errmessage{Unknown @txideftypefnnl value `\temp',
7738 must be on|off}%
7739 \fi\fi
7742 % Untyped functions:
7744 % @deffn category name args
7745 \makedefun{deffn}{\deffngeneral{}}
7747 % @deffn category class name args
7748 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7750 % \defopon {category on}class name args
7751 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7753 % \deffngeneral {subind}category name args
7755 \def\deffngeneral#1#2 #3 #4\endheader{%
7756 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
7757 \dosubind{fn}{\code{#3}}{#1}%
7758 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7761 % Typed functions:
7763 % @deftypefn category type name args
7764 \makedefun{deftypefn}{\deftypefngeneral{}}
7766 % @deftypeop category class type name args
7767 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7769 % \deftypeopon {category on}class type name args
7770 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7772 % \deftypefngeneral {subind}category type name args
7774 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7775 \dosubind{fn}{\code{#4}}{#1}%
7776 \doingtypefntrue
7777 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7780 % Typed variables:
7782 % @deftypevr category type var args
7783 \makedefun{deftypevr}{\deftypecvgeneral{}}
7785 % @deftypecv category class type var args
7786 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7788 % \deftypecvof {category of}class type var args
7789 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7791 % \deftypecvgeneral {subind}category type var args
7793 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7794 \dosubind{vr}{\code{#4}}{#1}%
7795 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7798 % Untyped variables:
7800 % @defvr category var args
7801 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7803 % @defcv category class var args
7804 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7806 % \defcvof {category of}class var args
7807 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7809 % Types:
7811 % @deftp category name args
7812 \makedefun{deftp}#1 #2 #3\endheader{%
7813 \doind{tp}{\code{#2}}%
7814 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7817 % Remaining @defun-like shortcuts:
7818 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7819 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7820 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7821 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7822 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7823 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7824 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7825 \makedefun{defmethod}{\defopon\putwordMethodon}
7826 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7827 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7828 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7830 % \defname, which formats the name of the @def (not the args).
7831 % #1 is the category, such as "Function".
7832 % #2 is the return type, if any.
7833 % #3 is the function name.
7835 % We are followed by (but not passed) the arguments, if any.
7837 \def\defname#1#2#3{%
7838 \par
7839 % Get the values of \leftskip and \rightskip as they were outside the @def...
7840 \advance\leftskip by -\defbodyindent
7842 % Determine if we are typesetting the return type of a typed function
7843 % on a line by itself.
7844 \rettypeownlinefalse
7845 \ifdoingtypefn % doing a typed function specifically?
7846 % then check user option for putting return type on its own line:
7847 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7848 \rettypeownlinetrue
7852 % How we'll format the category name. Putting it in brackets helps
7853 % distinguish it from the body text that may end up on the next line
7854 % just below it.
7855 \def\temp{#1}%
7856 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7858 % Figure out line sizes for the paragraph shape. We'll always have at
7859 % least two.
7860 \tempnum = 2
7862 % The first line needs space for \box0; but if \rightskip is nonzero,
7863 % we need only space for the part of \box0 which exceeds it:
7864 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7866 % If doing a return type on its own line, we'll have another line.
7867 \ifrettypeownline
7868 \advance\tempnum by 1
7869 \def\maybeshapeline{0in \hsize}%
7870 \else
7871 \def\maybeshapeline{}%
7874 % The continuations:
7875 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7877 % The final paragraph shape:
7878 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7880 % Put the category name at the right margin.
7881 \noindent
7882 \hbox to 0pt{%
7883 \hfil\box0 \kern-\hsize
7884 % \hsize has to be shortened this way:
7885 \kern\leftskip
7886 % Intentionally do not respect \rightskip, since we need the space.
7889 % Allow all lines to be underfull without complaint:
7890 \tolerance=10000 \hbadness=10000
7891 \exdentamount=\defbodyindent
7893 % defun fonts. We use typewriter by default (used to be bold) because:
7894 % . we're printing identifiers, they should be in tt in principle.
7895 % . in languages with many accents, such as Czech or French, it's
7896 % common to leave accents off identifiers. The result looks ok in
7897 % tt, but exceedingly strange in rm.
7898 % . we don't want -- and --- to be treated as ligatures.
7899 % . this still does not fix the ?` and !` ligatures, but so far no
7900 % one has made identifiers using them :).
7901 \df \tt
7902 \def\temp{#2}% text of the return type
7903 \ifx\temp\empty\else
7904 \tclose{\temp}% typeset the return type
7905 \ifrettypeownline
7906 % put return type on its own line; prohibit line break following:
7907 \hfil\vadjust{\nobreak}\break
7908 \else
7909 \space % type on same line, so just followed by a space
7911 \fi % no return type
7912 #3% output function name
7914 {\rm\enskip}% hskip 0.5 em of \rmfont
7916 \boldbrax
7917 % arguments will be output next, if any.
7920 % Print arguments in slanted roman (not ttsl), inconsistently with using
7921 % tt for the name. This is because literal text is sometimes needed in
7922 % the argument list (groff manual), and ttsl and tt are not very
7923 % distinguishable. Prevent hyphenation at `-' chars.
7925 \def\defunargs#1{%
7926 % use sl by default (not ttsl),
7927 % tt for the names.
7928 \df \sl \hyphenchar\font=0
7930 % On the other hand, if an argument has two dashes (for instance), we
7931 % want a way to get ttsl. We used to recommend @var for that, so
7932 % leave the code in, but it's strange for @var to lead to typewriter.
7933 % Nowadays we recommend @code, since the difference between a ttsl hyphen
7934 % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7935 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7937 \sl\hyphenchar\font=45
7940 % We want ()&[] to print specially on the defun line.
7942 \def\activeparens{%
7943 \catcode`\(=\active \catcode`\)=\active
7944 \catcode`\[=\active \catcode`\]=\active
7945 \catcode`\&=\active
7948 % Make control sequences which act like normal parenthesis chars.
7949 \let\lparen = ( \let\rparen = )
7951 % Be sure that we always have a definition for `(', etc. For example,
7952 % if the fn name has parens in it, \boldbrax will not be in effect yet,
7953 % so TeX would otherwise complain about undefined control sequence.
7955 \activeparens
7956 \global\let(=\lparen \global\let)=\rparen
7957 \global\let[=\lbrack \global\let]=\rbrack
7958 \global\let& = \&
7960 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7961 \gdef\magicamp{\let&=\amprm}
7964 \newcount\parencount
7966 % If we encounter &foo, then turn on ()-hacking afterwards
7967 \newif\ifampseen
7968 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
7970 \def\parenfont{%
7971 \ifampseen
7972 % At the first level, print parens in roman,
7973 % otherwise use the default font.
7974 \ifnum \parencount=1 \rm \fi
7975 \else
7976 % The \sf parens (in \boldbrax) actually are a little bolder than
7977 % the contained text. This is especially needed for [ and ] .
7981 \def\infirstlevel#1{%
7982 \ifampseen
7983 \ifnum\parencount=1
7988 \def\bfafterword#1 {#1 \bf}
7990 \def\opnr{%
7991 \global\advance\parencount by 1
7992 {\parenfont(}%
7993 \infirstlevel \bfafterword
7995 \def\clnr{%
7996 {\parenfont)}%
7997 \infirstlevel \sl
7998 \global\advance\parencount by -1
8001 \newcount\brackcount
8002 \def\lbrb{%
8003 \global\advance\brackcount by 1
8004 {\bf[}%
8006 \def\rbrb{%
8007 {\bf]}%
8008 \global\advance\brackcount by -1
8011 \def\checkparencounts{%
8012 \ifnum\parencount=0 \else \badparencount \fi
8013 \ifnum\brackcount=0 \else \badbrackcount \fi
8015 % these should not use \errmessage; the glibc manual, at least, actually
8016 % has such constructs (when documenting function pointers).
8017 \def\badparencount{%
8018 \message{Warning: unbalanced parentheses in @def...}%
8019 \global\parencount=0
8021 \def\badbrackcount{%
8022 \message{Warning: unbalanced square brackets in @def...}%
8023 \global\brackcount=0
8027 \message{macros,}
8028 % @macro.
8030 % To do this right we need a feature of e-TeX, \scantokens,
8031 % which we arrange to emulate with a temporary file in ordinary TeX.
8032 \ifx\eTeXversion\thisisundefined
8033 \newwrite\macscribble
8034 \def\scantokens#1{%
8035 \toks0={#1}%
8036 \immediate\openout\macscribble=\jobname.tmp
8037 \immediate\write\macscribble{\the\toks0}%
8038 \immediate\closeout\macscribble
8039 \input \jobname.tmp
8043 % alias because \c means cedilla in @tex or @math
8044 \let\texinfoc=\c
8046 \newcount\savedcatcodeone
8047 \newcount\savedcatcodetwo
8049 % Used at the time of macro expansion.
8050 % Argument is macro body with arguments substituted
8051 \def\scanmacro#1{%
8052 \newlinechar`\^^M
8053 \def\xeatspaces{\eatspaces}%
8055 % Temporarily undo catcode changes of \printindex. Set catcode of @ to
8056 % 0 so that @-commands in macro expansions aren't printed literally when
8057 % formatting an index file, where \ is used as the escape character.
8058 \savedcatcodeone=\catcode`\@
8059 \savedcatcodetwo=\catcode`\\
8060 \catcode`\@=0
8061 \catcode`\\=\active
8063 % Process the macro body under the current catcode regime.
8064 \scantokens{#1@texinfoc}%
8066 \catcode`\@=\savedcatcodeone
8067 \catcode`\\=\savedcatcodetwo
8069 % The \texinfoc is to remove the \newlinechar added by \scantokens, and
8070 % can be noticed by \parsearg.
8071 % We avoid surrounding the call to \scantokens with \bgroup and \egroup
8072 % to allow macros to open or close groups themselves.
8075 % Used for copying and captions
8076 \def\scanexp#1{%
8077 \expandafter\scanmacro\expandafter{#1}%
8080 \newcount\paramno % Count of parameters
8081 \newtoks\macname % Macro name
8082 \newif\ifrecursive % Is it recursive?
8084 % List of all defined macros in the form
8085 % \commondummyword\macro1\commondummyword\macro2...
8086 % Currently is also contains all @aliases; the list can be split
8087 % if there is a need.
8088 \def\macrolist{}
8090 % Add the macro to \macrolist
8091 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
8092 \def\addtomacrolistxxx#1{%
8093 \toks0 = \expandafter{\macrolist\commondummyword#1}%
8094 \xdef\macrolist{\the\toks0}%
8097 % Utility routines.
8098 % This does \let #1 = #2, with \csnames; that is,
8099 % \let \csname#1\endcsname = \csname#2\endcsname
8100 % (except of course we have to play expansion games).
8102 \def\cslet#1#2{%
8103 \expandafter\let
8104 \csname#1\expandafter\endcsname
8105 \csname#2\endcsname
8108 % Trim leading and trailing spaces off a string.
8109 % Concepts from aro-bend problem 15 (see CTAN).
8110 {\catcode`\@=11
8111 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
8112 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
8113 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
8114 \def\unbrace#1{#1}
8115 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
8118 % Trim a single trailing ^^M off a string.
8119 {\catcode`\^^M=\other \catcode`\Q=3%
8120 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
8121 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8122 \gdef\eatcrb#1Q#2Q{#1}%
8125 % Macro bodies are absorbed as an argument in a context where
8126 % all characters are catcode 10, 11 or 12, except \ which is active
8127 % (as in normal texinfo). It is necessary to change the definition of \
8128 % to recognize macro arguments; this is the job of \mbodybackslash.
8130 % Non-ASCII encodings make 8-bit characters active, so un-activate
8131 % them to avoid their expansion. Must do this non-globally, to
8132 % confine the change to the current group.
8134 % It's necessary to have hard CRs when the macro is executed. This is
8135 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
8136 % body, and then making it the \newlinechar in \scanmacro.
8138 \def\scanctxt{% used as subroutine
8139 \catcode`\"=\other
8140 \catcode`\+=\other
8141 \catcode`\<=\other
8142 \catcode`\>=\other
8143 \catcode`\^=\other
8144 \catcode`\_=\other
8145 \catcode`\|=\other
8146 \catcode`\~=\other
8147 \passthroughcharstrue
8150 \def\scanargctxt{% used for copying and captions, not macros.
8151 \scanctxt
8152 \catcode`\@=\other
8153 \catcode`\\=\other
8154 \catcode`\^^M=\other
8157 \def\macrobodyctxt{% used for @macro definitions
8158 \scanctxt
8159 \catcode`\ =\other
8160 \catcode`\@=\other
8161 \catcode`\{=\other
8162 \catcode`\}=\other
8163 \catcode`\^^M=\other
8164 \usembodybackslash
8167 % Used when scanning braced macro arguments. Note, however, that catcode
8168 % changes here are ineffectual if the macro invocation was nested inside
8169 % an argument to another Texinfo command.
8170 \def\macroargctxt{%
8171 \scanctxt
8172 \catcode`\ =\active
8173 \catcode`\^^M=\other
8174 \catcode`\\=\active
8177 \def\macrolineargctxt{% used for whole-line arguments without braces
8178 \scanctxt
8179 \catcode`\{=\other
8180 \catcode`\}=\other
8183 % \mbodybackslash is the definition of \ in @macro bodies.
8184 % It maps \foo\ => \csname macarg.foo\endcsname => #N
8185 % where N is the macro parameter number.
8186 % We define \csname macarg.\endcsname to be \realbackslash, so
8187 % \\ in macro replacement text gets you a backslash.
8189 {\catcode`@=0 @catcode`@\=@active
8190 @gdef@usembodybackslash{@let\=@mbodybackslash}
8191 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8193 \expandafter\def\csname macarg.\endcsname{\realbackslash}
8195 \def\margbackslash#1{\char`\#1 }
8197 \def\macro{\recursivefalse\parsearg\macroxxx}
8198 \def\rmacro{\recursivetrue\parsearg\macroxxx}
8200 \def\macroxxx#1{%
8201 \getargs{#1}% now \macname is the macname and \argl the arglist
8202 \ifx\argl\empty % no arguments
8203 \paramno=0\relax
8204 \else
8205 \expandafter\parsemargdef \argl;%
8206 \if\paramno>256\relax
8207 \ifx\eTeXversion\thisisundefined
8208 \errhelp = \EMsimple
8209 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8213 \if1\csname ismacro.\the\macname\endcsname
8214 \message{Warning: redefining \the\macname}%
8215 \else
8216 \expandafter\ifx\csname \the\macname\endcsname \relax
8217 \else \errmessage{Macro name \the\macname\space already defined}\fi
8218 \global\cslet{macsave.\the\macname}{\the\macname}%
8219 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8220 \addtomacrolist{\the\macname}%
8222 \begingroup \macrobodyctxt
8223 \ifrecursive \expandafter\parsermacbody
8224 \else \expandafter\parsemacbody
8225 \fi}
8227 \parseargdef\unmacro{%
8228 \if1\csname ismacro.#1\endcsname
8229 \global\cslet{#1}{macsave.#1}%
8230 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8231 % Remove the macro name from \macrolist:
8232 \begingroup
8233 \expandafter\let\csname#1\endcsname \relax
8234 \let\commondummyword\unmacrodo
8235 \xdef\macrolist{\macrolist}%
8236 \endgroup
8237 \else
8238 \errmessage{Macro #1 not defined}%
8242 % Called by \do from \dounmacro on each macro. The idea is to omit any
8243 % macro definitions that have been changed to \relax.
8245 \def\unmacrodo#1{%
8246 \ifx #1\relax
8247 % remove this
8248 \else
8249 \noexpand\commondummyword \noexpand#1%
8253 % \getargs -- Parse the arguments to a @macro line. Set \macname to
8254 % the name of the macro, and \argl to the braced argument list.
8255 \def\getargs#1{\getargsxxx#1{}}
8256 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8257 \def\getmacname#1 #2\relax{\macname={#1}}
8258 \def\getmacargs#1{\def\argl{#1}}
8259 % This made use of the feature that if the last token of a
8260 % <parameter list> is #, then the preceding argument is delimited by
8261 % an opening brace, and that opening brace is not consumed.
8263 % Parse the optional {params} list to @macro or @rmacro.
8264 % Set \paramno to the number of arguments,
8265 % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8266 % three-param macro.) Define \macarg.BLAH for each BLAH in the params
8267 % list to some hook where the argument is to be expanded. If there are
8268 % less than 10 arguments that hook is to be replaced by ##N where N
8269 % is the position in that list, that is to say the macro arguments are to be
8270 % defined `a la TeX in the macro body.
8272 % That gets used by \mbodybackslash (above).
8274 % If there are 10 or more arguments, a different technique is used: see
8275 % \parsemmanyargdef.
8277 \def\parsemargdef#1;{%
8278 \paramno=0\def\paramlist{}%
8279 \let\hash\relax
8280 % \hash is redefined to `#' later to get it into definitions
8281 \let\xeatspaces\relax
8282 \parsemargdefxxx#1,;,%
8283 \ifnum\paramno<10\relax\else
8284 \paramno0\relax
8285 \parsemmanyargdef@@#1,;,% 10 or more arguments
8288 \def\parsemargdefxxx#1,{%
8289 \if#1;\let\next=\relax
8290 \else \let\next=\parsemargdefxxx
8291 \advance\paramno by 1
8292 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8293 {\xeatspaces{\hash\the\paramno}}%
8294 \edef\paramlist{\paramlist\hash\the\paramno,}%
8295 \fi\next}
8297 % \parsemacbody, \parsermacbody
8299 % Read recursive and nonrecursive macro bodies. (They're different since
8300 % rec and nonrec macros end differently.)
8302 % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
8303 % body to be transformed.
8304 % Set \macrobody to the body of the macro, and call \defmacro.
8306 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8307 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8308 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8309 \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8311 % Make @ a letter, so that we can make private-to-Texinfo macro names.
8312 \edef\texiatcatcode{\the\catcode`\@}
8313 \catcode `@=11\relax
8315 %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8317 % If there are 10 or more arguments, a different technique is used, where the
8318 % hook remains in the body, and when macro is to be expanded the body is
8319 % processed again to replace the arguments.
8321 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8322 % argument N value and then \edef the body (nothing else will expand because of
8323 % the catcode regime under which the body was input).
8325 % If you compile with TeX (not eTeX), and you have macros with 10 or more
8326 % arguments, no macro can have more than 256 arguments (else error).
8328 % In case that there are 10 or more arguments we parse again the arguments
8329 % list to set new definitions for the \macarg.BLAH macros corresponding to
8330 % each BLAH argument. It was anyhow needed to parse already once this list
8331 % in order to count the arguments, and as macros with at most 9 arguments
8332 % are by far more frequent than macro with 10 or more arguments, defining
8333 % twice the \macarg.BLAH macros does not cost too much processing power.
8334 \def\parsemmanyargdef@@#1,{%
8335 \if#1;\let\next=\relax
8336 \else
8337 \let\next=\parsemmanyargdef@@
8338 \edef\tempb{\eatspaces{#1}}%
8339 \expandafter\def\expandafter\tempa
8340 \expandafter{\csname macarg.\tempb\endcsname}%
8341 % Note that we need some extra \noexpand\noexpand, this is because we
8342 % don't want \the to be expanded in the \parsermacbody as it uses an
8343 % \xdef .
8344 \expandafter\edef\tempa
8345 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8346 \advance\paramno by 1\relax
8347 \fi\next}
8350 \let\endargs@\relax
8351 \let\nil@\relax
8352 \def\nilm@{\nil@}%
8353 \long\def\nillm@{\nil@}%
8355 % This macro is expanded during the Texinfo macro expansion, not during its
8356 % definition. It gets all the arguments' values and assigns them to macros
8357 % macarg.ARGNAME
8359 % #1 is the macro name
8360 % #2 is the list of argument names
8361 % #3 is the list of argument values
8362 \def\getargvals@#1#2#3{%
8363 \def\macargdeflist@{}%
8364 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8365 \def\paramlist{#2,\nil@}%
8366 \def\macroname{#1}%
8367 \begingroup
8368 \macroargctxt
8369 \def\argvaluelist{#3,\nil@}%
8370 \def\@tempa{#3}%
8371 \ifx\@tempa\empty
8372 \setemptyargvalues@
8373 \else
8374 \getargvals@@
8377 \def\getargvals@@{%
8378 \ifx\paramlist\nilm@
8379 % Some sanity check needed here that \argvaluelist is also empty.
8380 \ifx\argvaluelist\nillm@
8381 \else
8382 \errhelp = \EMsimple
8383 \errmessage{Too many arguments in macro `\macroname'!}%
8385 \let\next\macargexpandinbody@
8386 \else
8387 \ifx\argvaluelist\nillm@
8388 % No more arguments values passed to macro. Set remaining named-arg
8389 % macros to empty.
8390 \let\next\setemptyargvalues@
8391 \else
8392 % pop current arg name into \@tempb
8393 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8394 \expandafter\@tempa\expandafter{\paramlist}%
8395 % pop current argument value into \@tempc
8396 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8397 \expandafter\@tempa\expandafter{\argvaluelist}%
8398 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8399 % First place the new argument macro definition into \@tempd
8400 \expandafter\macname\expandafter{\@tempc}%
8401 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8402 \expandafter\def\expandafter\@tempe\expandafter{%
8403 \csname macarg.\@tempb\endcsname}%
8404 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8405 \push@\@tempd\macargdeflist@
8406 \let\next\getargvals@@
8409 \next
8412 \def\push@#1#2{%
8413 \expandafter\expandafter\expandafter\def
8414 \expandafter\expandafter\expandafter#2%
8415 \expandafter\expandafter\expandafter{%
8416 \expandafter#1#2}%
8419 % Replace arguments by their values in the macro body, and place the result
8420 % in macro \@tempa.
8422 \def\macvalstoargs@{%
8423 % To do this we use the property that token registers that are \the'ed
8424 % within an \edef expand only once. So we are going to place all argument
8425 % values into respective token registers.
8427 % First we save the token context, and initialize argument numbering.
8428 \begingroup
8429 \paramno0\relax
8430 % Then, for each argument number #N, we place the corresponding argument
8431 % value into a new token list register \toks#N
8432 \expandafter\putargsintokens@\saveparamlist@,;,%
8433 % Then, we expand the body so that argument are replaced by their
8434 % values. The trick for values not to be expanded themselves is that they
8435 % are within tokens and that tokens expand only once in an \edef .
8436 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8437 % Now we restore the token stack pointer to free the token list registers
8438 % which we have used, but we make sure that expanded body is saved after
8439 % group.
8440 \expandafter
8441 \endgroup
8442 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8445 % Define the named-macro outside of this group and then close this group.
8447 \def\macargexpandinbody@{%
8448 \expandafter
8449 \endgroup
8450 \macargdeflist@
8451 % First the replace in body the macro arguments by their values, the result
8452 % is in \@tempa .
8453 \macvalstoargs@
8454 % Then we point at the \norecurse or \gobble (for recursive) macro value
8455 % with \@tempb .
8456 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8457 % Depending on whether it is recursive or not, we need some tailing
8458 % \egroup .
8459 \ifx\@tempb\gobble
8460 \let\@tempc\relax
8461 \else
8462 \let\@tempc\egroup
8464 % And now we do the real job:
8465 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8466 \@tempd
8469 \def\putargsintokens@#1,{%
8470 \if#1;\let\next\relax
8471 \else
8472 \let\next\putargsintokens@
8473 % First we allocate the new token list register, and give it a temporary
8474 % alias \@tempb .
8475 \toksdef\@tempb\the\paramno
8476 % Then we place the argument value into that token list register.
8477 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8478 \expandafter\@tempb\expandafter{\@tempa}%
8479 \advance\paramno by 1\relax
8481 \next
8484 % Trailing missing arguments are set to empty.
8486 \def\setemptyargvalues@{%
8487 \ifx\paramlist\nilm@
8488 \let\next\macargexpandinbody@
8489 \else
8490 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8491 \let\next\setemptyargvalues@
8493 \next
8496 \def\setemptyargvaluesparser@#1,#2\endargs@{%
8497 \expandafter\def\expandafter\@tempa\expandafter{%
8498 \expandafter\def\csname macarg.#1\endcsname{}}%
8499 \push@\@tempa\macargdeflist@
8500 \def\paramlist{#2}%
8503 % #1 is the element target macro
8504 % #2 is the list macro
8505 % #3,#4\endargs@ is the list value
8506 \def\pop@#1#2#3,#4\endargs@{%
8507 \def#1{#3}%
8508 \def#2{#4}%
8510 \long\def\longpop@#1#2#3,#4\endargs@{%
8511 \long\def#1{#3}%
8512 \long\def#2{#4}%
8516 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8519 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8520 % \macrobody has the body of the macro in it, with placeholders for
8521 % its parameters, looking like "\xeatspaces{\hash 1}".
8522 % \paramno is the number of parameters
8523 % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8524 % There are four cases: macros of zero, one, up to nine, and many arguments.
8525 % \xdef is used so that macro definitions will survive the file
8526 % they're defined in: @include reads the file inside a group.
8528 \def\defmacro{%
8529 \let\hash=##% convert placeholders to macro parameter chars
8530 \ifnum\paramno=1
8531 \def\xeatspaces##1{##1}%
8532 % This removes the pair of braces around the argument. We don't
8533 % use \eatspaces, because this can cause ends of lines to be lost
8534 % when the argument to \eatspaces is read, leading to line-based
8535 % commands like "@itemize" not being read correctly.
8536 \else
8537 \let\xeatspaces\relax % suppress expansion
8539 \ifcase\paramno
8541 \expandafter\xdef\csname\the\macname\endcsname{%
8542 \bgroup
8543 \noexpand\spaceisspace
8544 \noexpand\endlineisspace
8545 \noexpand\expandafter % skip any whitespace after the macro name.
8546 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8547 \expandafter\xdef\csname\the\macname @@@\endcsname{%
8548 \egroup
8549 \noexpand\scanmacro{\macrobody}}%
8550 \or % 1
8551 \expandafter\xdef\csname\the\macname\endcsname{%
8552 \bgroup
8553 \noexpand\braceorline
8554 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8555 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8556 \egroup
8557 \noexpand\scanmacro{\macrobody}%
8559 \else % at most 9
8560 \ifnum\paramno<10\relax
8561 % @MACNAME sets the context for reading the macro argument
8562 % @MACNAME@@ gets the argument, processes backslashes and appends a
8563 % comma.
8564 % @MACNAME@@@ removes braces surrounding the argument list.
8565 % @MACNAME@@@@ scans the macro body with arguments substituted.
8566 \expandafter\xdef\csname\the\macname\endcsname{%
8567 \bgroup
8568 \noexpand\expandafter % This \expandafter skip any spaces after the
8569 \noexpand\macroargctxt % macro before we change the catcode of space.
8570 \noexpand\expandafter
8571 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8572 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8573 \noexpand\passargtomacro
8574 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8575 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8576 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8577 \expandafter\expandafter
8578 \expandafter\xdef
8579 \expandafter\expandafter
8580 \csname\the\macname @@@@\endcsname\paramlist{%
8581 \egroup\noexpand\scanmacro{\macrobody}}%
8582 \else % 10 or more:
8583 \expandafter\xdef\csname\the\macname\endcsname{%
8584 \noexpand\getargvals@{\the\macname}{\argl}%
8586 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8587 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8589 \fi}
8591 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8593 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8598 {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8599 @catcode`@_=11 % private names
8600 @catcode`@!=11 % used as argument separator
8602 % \passargtomacro#1#2 -
8603 % Call #1 with a list of tokens #2, with any doubled backslashes in #2
8604 % compressed to one.
8606 % This implementation works by expansion, and not execution (so we cannot use
8607 % \def or similar). This reduces the risk of this failing in contexts where
8608 % complete expansion is done with no execution (for example, in writing out to
8609 % an auxiliary file for an index entry).
8611 % State is kept in the input stream: the argument passed to
8612 % @look_ahead, @gobble_and_check_finish and @add_segment is
8614 % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8616 % where:
8617 % THE_MACRO - name of the macro we want to call
8618 % ARG_RESULT - argument list we build to pass to that macro
8619 % PENDING_BS - either a backslash or nothing
8620 % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8622 @gdef@passargtomacro#1#2{%
8623 @add_segment #1!{}@relax#2\@_finish\%
8625 @gdef@_finish{@_finishx} @global@let@_finishx@relax
8627 % #1 - THE_MACRO ARG_RESULT
8628 % #2 - PENDING_BS
8629 % #3 - NEXT_TOKEN
8630 % #4 used to look ahead
8632 % If the next token is not a backslash, process the rest of the argument;
8633 % otherwise, remove the next token.
8634 @gdef@look_ahead#1!#2#3#4{%
8635 @ifx#4\%
8636 @expandafter@gobble_and_check_finish
8637 @else
8638 @expandafter@add_segment
8639 @fi#1!{#2}#4#4%
8642 % #1 - THE_MACRO ARG_RESULT
8643 % #2 - PENDING_BS
8644 % #3 - NEXT_TOKEN
8645 % #4 should be a backslash, which is gobbled.
8646 % #5 looks ahead
8648 % Double backslash found. Add a single backslash, and look ahead.
8649 @gdef@gobble_and_check_finish#1!#2#3#4#5{%
8650 @add_segment#1\!{}#5#5%
8653 @gdef@is_fi{@fi}
8655 % #1 - THE_MACRO ARG_RESULT
8656 % #2 - PENDING_BS
8657 % #3 - NEXT_TOKEN
8658 % #4 is input stream until next backslash
8660 % Input stream is either at the start of the argument, or just after a
8661 % backslash sequence, either a lone backslash, or a doubled backslash.
8662 % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8663 % finish; otherwise, append to ARG_RESULT the segment of the argument up until
8664 % the next backslash. PENDING_BACKSLASH contains a backslash to represent
8665 % a backslash just before the start of the input stream that has not been
8666 % added to ARG_RESULT.
8667 @gdef@add_segment#1!#2#3#4\{%
8668 @ifx#3@_finish
8669 @call_the_macro#1!%
8670 @else
8671 % append the pending backslash to the result, followed by the next segment
8672 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8673 % this @fi is discarded by @look_ahead.
8674 % we can't get rid of it with \expandafter because we don't know how
8675 % long #4 is.
8678 % #1 - THE_MACRO
8679 % #2 - ARG_RESULT
8680 % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8681 % conditional.
8682 @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8687 % \braceorline MAC is used for a one-argument macro MAC. It checks
8688 % whether the next non-whitespace character is a {. It sets the context
8689 % for reading the argument (slightly different in the two cases). Then,
8690 % to read the argument, in the whole-line case, it then calls the regular
8691 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8693 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8694 \def\braceorlinexxx{%
8695 \ifx\nchar\bgroup
8696 \macroargctxt
8697 \expandafter\passargtomacro
8698 \else
8699 \macrolineargctxt\expandafter\parsearg
8700 \fi \macnamexxx}
8703 % @alias.
8704 % We need some trickery to remove the optional spaces around the equal
8705 % sign. Make them active and then expand them all to nothing.
8707 \def\alias{\parseargusing\obeyspaces\aliasxxx}
8708 \def\aliasxxx #1{\aliasyyy#1\relax}
8709 \def\aliasyyy #1=#2\relax{%
8711 \expandafter\let\obeyedspace=\empty
8712 \addtomacrolist{#1}%
8713 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8715 \next
8719 \message{cross references,}
8721 \newwrite\auxfile
8722 \newif\ifhavexrefs % True if xref values are known.
8723 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8725 % @inforef is relatively simple.
8726 \def\inforef #1{\inforefzzz #1,,,,**}
8727 \def\inforefzzz #1,#2,#3,#4**{%
8728 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8729 node \samp{\ignorespaces#1{}}}
8731 % @node's only job in TeX is to define \lastnode, which is used in
8732 % cross-references. The @node line might or might not have commas, and
8733 % might or might not have spaces before the first comma, like:
8734 % @node foo , bar , ...
8735 % We don't want such trailing spaces in the node name.
8737 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8739 % also remove a trailing comma, in case of something like this:
8740 % @node Help-Cross, , , Cross-refs
8741 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8742 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
8744 \let\nwnode=\node
8745 \let\lastnode=\empty
8747 % Write a cross-reference definition for the current node. #1 is the
8748 % type (Ynumbered, Yappendix, Ynothing).
8750 \def\donoderef#1{%
8751 \ifx\lastnode\empty\else
8752 \setref{\lastnode}{#1}%
8753 \global\let\lastnode=\empty
8757 % @anchor{NAME} -- define xref target at arbitrary point.
8759 \newcount\savesfregister
8761 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8762 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8763 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8765 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8766 % anchor), which consists of three parts:
8767 % 1) NAME-title - the current sectioning name taken from \lastsection,
8768 % or the anchor name.
8769 % 2) NAME-snt - section number and type, passed as the SNT arg, or
8770 % empty for anchors.
8771 % 3) NAME-pg - the page number.
8773 % This is called from \donoderef, \anchor, and \dofloat. In the case of
8774 % floats, there is an additional part, which is not written here:
8775 % 4) NAME-lof - the text as it should appear in a @listoffloats.
8777 \def\setref#1#2{%
8778 \pdfmkdest{#1}%
8779 \iflinks
8781 \requireauxfile
8782 \atdummies % preserve commands, but don't expand them
8783 % match definition in \xrdef, \refx, \xrefX.
8784 \def\value##1{##1}%
8785 \edef\writexrdef##1##2{%
8786 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8787 ##1}{##2}}% these are parameters of \writexrdef
8789 \toks0 = \expandafter{\lastsection}%
8790 \immediate \writexrdef{title}{\the\toks0 }%
8791 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8792 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8797 % @xrefautosectiontitle on|off says whether @section(ing) names are used
8798 % automatically in xrefs, if the third arg is not explicitly specified.
8799 % This was provided as a "secret" @set xref-automatic-section-title
8800 % variable, now it's official.
8802 \parseargdef\xrefautomaticsectiontitle{%
8803 \def\temp{#1}%
8804 \ifx\temp\onword
8805 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8806 = \empty
8807 \else\ifx\temp\offword
8808 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8809 = \relax
8810 \else
8811 \errhelp = \EMsimple
8812 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8813 must be on|off}%
8814 \fi\fi
8817 % \f
8818 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8819 % the node name, #2 the name of the Info cross-reference, #3 the printed
8820 % node name, #4 the name of the Info file, #5 the name of the printed
8821 % manual. All but the node name can be omitted.
8823 \def\pxref{\putwordsee{} \xrefXX}
8824 \def\xref{\putwordSee{} \xrefXX}
8825 \def\ref{\xrefXX}
8827 \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8828 \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8830 \newbox\toprefbox
8831 \newbox\printedrefnamebox
8832 \newbox\infofilenamebox
8833 \newbox\printedmanualbox
8835 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8836 \unsepspaces
8838 % Get args without leading/trailing spaces.
8839 \def\printedrefname{\ignorespaces #3}%
8840 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8842 \def\infofilename{\ignorespaces #4}%
8843 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8845 \def\printedmanual{\ignorespaces #5}%
8846 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8848 % If the printed reference name (arg #3) was not explicitly given in
8849 % the @xref, figure out what we want to use.
8850 \ifdim \wd\printedrefnamebox = 0pt
8851 % No printed node name was explicitly given.
8852 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8853 % Not auto section-title: use node name inside the square brackets.
8854 \def\printedrefname{\ignorespaces #1}%
8855 \else
8856 % Auto section-title: use chapter/section title inside
8857 % the square brackets if we have it.
8858 \ifdim \wd\printedmanualbox > 0pt
8859 % It is in another manual, so we don't have it; use node name.
8860 \def\printedrefname{\ignorespaces #1}%
8861 \else
8862 \ifhavexrefs
8863 % We (should) know the real title if we have the xref values.
8864 \def\printedrefname{\refx{#1-title}{}}%
8865 \else
8866 % Otherwise just copy the Info node name.
8867 \def\printedrefname{\ignorespaces #1}%
8868 \fi%
8873 % Make link in pdf output.
8874 \ifpdf
8875 % For pdfTeX and LuaTeX
8876 {\indexnofonts
8877 \makevalueexpandable
8878 \turnoffactive
8879 % This expands tokens, so do it after making catcode changes, so _
8880 % etc. don't get their TeX definitions. This ignores all spaces in
8881 % #4, including (wrongly) those in the middle of the filename.
8882 \getfilename{#4}%
8884 % This (wrongly) does not take account of leading or trailing
8885 % spaces in #1, which should be ignored.
8886 \setpdfdestname{#1}%
8888 \ifx\pdfdestname\empty
8889 \def\pdfdestname{Top}% no empty targets
8892 \leavevmode
8893 \startlink attr{/Border [0 0 0]}%
8894 \ifnum\filenamelength>0
8895 goto file{\the\filename.pdf} name{\pdfdestname}%
8896 \else
8897 goto name{\pdfmkpgn{\pdfdestname}}%
8900 \setcolor{\linkcolor}%
8901 \else
8902 \ifx\XeTeXrevision\thisisundefined
8903 \else
8904 % For XeTeX
8905 {\indexnofonts
8906 \makevalueexpandable
8907 \turnoffactive
8908 % This expands tokens, so do it after making catcode changes, so _
8909 % etc. don't get their TeX definitions. This ignores all spaces in
8910 % #4, including (wrongly) those in the middle of the filename.
8911 \getfilename{#4}%
8913 % This (wrongly) does not take account of leading or trailing
8914 % spaces in #1, which should be ignored.
8915 \setpdfdestname{#1}%
8917 \ifx\pdfdestname\empty
8918 \def\pdfdestname{Top}% no empty targets
8921 \leavevmode
8922 \ifnum\filenamelength>0
8923 % With default settings,
8924 % XeTeX (xdvipdfmx) replaces link destination names with integers.
8925 % In this case, the replaced destination names of
8926 % remote PDFs are no longer known. In order to avoid a replacement,
8927 % you can use xdvipdfmx's command line option `-C 0x0010'.
8928 % If you use XeTeX 0.99996+ (TeX Live 2016+),
8929 % this command line option is no longer necessary
8930 % because we can use the `dvipdfmx:config' special.
8931 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8932 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
8933 \else
8934 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8935 << /S /GoTo /D (\pdfdestname) >> >>}%
8938 \setcolor{\linkcolor}%
8942 % Have to otherify everything special to allow the \csname to
8943 % include an _ in the xref name, etc.
8944 \indexnofonts
8945 \turnoffactive
8946 \def\value##1{##1}%
8947 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8948 \csname XR#1-title\endcsname
8951 % Float references are printed completely differently: "Figure 1.2"
8952 % instead of "[somenode], p.3". \iffloat distinguishes them by
8953 % \Xthisreftitle being set to a magic string.
8954 \iffloat\Xthisreftitle
8955 % If the user specified the print name (third arg) to the ref,
8956 % print it instead of our usual "Figure 1.2".
8957 \ifdim\wd\printedrefnamebox = 0pt
8958 \refx{#1-snt}{}%
8959 \else
8960 \printedrefname
8963 % If the user also gave the printed manual name (fifth arg), append
8964 % "in MANUALNAME".
8965 \ifdim \wd\printedmanualbox > 0pt
8966 \space \putwordin{} \cite{\printedmanual}%
8968 \else
8969 % node/anchor (non-float) references.
8971 % If we use \unhbox to print the node names, TeX does not insert
8972 % empty discretionaries after hyphens, which means that it will not
8973 % find a line break at a hyphen in a node names. Since some manuals
8974 % are best written with fairly long node names, containing hyphens,
8975 % this is a loss. Therefore, we give the text of the node name
8976 % again, so it is as if TeX is seeing it for the first time.
8978 \ifdim \wd\printedmanualbox > 0pt
8979 % Cross-manual reference with a printed manual name.
8981 \crossmanualxref{\cite{\printedmanual\unskip}}%
8983 \else\ifdim \wd\infofilenamebox > 0pt
8984 % Cross-manual reference with only an info filename (arg 4), no
8985 % printed manual name (arg 5). This is essentially the same as
8986 % the case above; we output the filename, since we have nothing else.
8988 \crossmanualxref{\code{\infofilename\unskip}}%
8990 \else
8991 % Reference within this manual.
8993 % _ (for example) has to be the character _ for the purposes of the
8994 % control sequence corresponding to the node, but it has to expand
8995 % into the usual \leavevmode...\vrule stuff for purposes of
8996 % printing. So we \turnoffactive for the \refx-snt, back on for the
8997 % printing, back off for the \refx-pg.
8998 {\turnoffactive
8999 % Only output a following space if the -snt ref is nonempty; for
9000 % @unnumbered and @anchor, it won't be.
9001 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
9002 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
9004 % output the `[mynode]' via the macro below so it can be overridden.
9005 \xrefprintnodename\printedrefname
9007 % But we always want a comma and a space:
9008 ,\space
9010 % output the `page 3'.
9011 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
9012 % Add a , if xref followed by a space
9013 \if\space\noexpand\tokenafterxref ,%
9014 \else\ifx\ \tokenafterxref ,% @TAB
9015 \else\ifx\*\tokenafterxref ,% @*
9016 \else\ifx\ \tokenafterxref ,% @SPACE
9017 \else\ifx\
9018 \tokenafterxref ,% @NL
9019 \else\ifx\tie\tokenafterxref ,% @tie
9020 \fi\fi\fi\fi\fi\fi
9021 \fi\fi
9023 \endlink
9024 \endgroup}
9026 % Output a cross-manual xref to #1. Used just above (twice).
9028 % Only include the text "Section ``foo'' in" if the foo is neither
9029 % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
9030 % "see The Foo Manual", the idea being to refer to the whole manual.
9032 % But, this being TeX, we can't easily compare our node name against the
9033 % string "Top" while ignoring the possible spaces before and after in
9034 % the input. By adding the arbitrary 7sp below, we make it much less
9035 % likely that a real node name would have the same width as "Top" (e.g.,
9036 % in a monospaced font). Hopefully it will never happen in practice.
9038 % For the same basic reason, we retypeset the "Top" at every
9039 % reference, since the current font is indeterminate.
9041 \def\crossmanualxref#1{%
9042 \setbox\toprefbox = \hbox{Top\kern7sp}%
9043 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
9044 \ifdim \wd2 > 7sp % nonempty?
9045 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
9046 \putwordSection{} ``\printedrefname'' \putwordin{}\space
9052 % This macro is called from \xrefX for the `[nodename]' part of xref
9053 % output. It's a separate macro only so it can be changed more easily,
9054 % since square brackets don't work well in some documents. Particularly
9055 % one that Bob is working on :).
9057 \def\xrefprintnodename#1{[#1]}
9059 % Things referred to by \setref.
9061 \def\Ynothing{}
9062 \def\Yomitfromtoc{}
9063 \def\Ynumbered{%
9064 \ifnum\secno=0
9065 \putwordChapter@tie \the\chapno
9066 \else \ifnum\subsecno=0
9067 \putwordSection@tie \the\chapno.\the\secno
9068 \else \ifnum\subsubsecno=0
9069 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9070 \else
9071 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9072 \fi\fi\fi
9074 \def\Yappendix{%
9075 \ifnum\secno=0
9076 \putwordAppendix@tie @char\the\appendixno{}%
9077 \else \ifnum\subsecno=0
9078 \putwordSection@tie @char\the\appendixno.\the\secno
9079 \else \ifnum\subsubsecno=0
9080 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9081 \else
9082 \putwordSection@tie
9083 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9084 \fi\fi\fi
9087 % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
9088 % is output afterwards if non-empty.
9089 \def\refx#1#2{%
9090 \requireauxfile
9092 \indexnofonts
9093 \otherbackslash
9094 \def\value##1{##1}%
9095 \expandafter\global\expandafter\let\expandafter\thisrefX
9096 \csname XR#1\endcsname
9098 \ifx\thisrefX\relax
9099 % If not defined, say something at least.
9100 \angleleft un\-de\-fined\angleright
9101 \iflinks
9102 \ifhavexrefs
9103 {\toks0 = {#1}% avoid expansion of possibly-complex value
9104 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9105 \else
9106 \ifwarnedxrefs\else
9107 \global\warnedxrefstrue
9108 \message{Cross reference values unknown; you must run TeX again.}%
9112 \else
9113 % It's defined, so just use it.
9114 \thisrefX
9116 #2% Output the suffix in any case.
9119 % This is the macro invoked by entries in the aux file. Define a control
9120 % sequence for a cross-reference target (we prepend XR to the control sequence
9121 % name to avoid collisions). The value is the page number. If this is a float
9122 % type, we have more work to do.
9124 \def\xrdef#1#2{%
9125 {% Expand the node or anchor name to remove control sequences.
9126 % \turnoffactive stops 8-bit characters being changed to commands
9127 % like @'e. \refx does the same to retrieve the value in the definition.
9128 \indexnofonts
9129 \turnoffactive
9130 \def\value##1{##1}%
9131 \xdef\safexrefname{#1}%
9134 \bgroup
9135 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
9136 \egroup
9137 % We put the \gdef inside a group to avoid the definitions building up on
9138 % TeX's save stack, which can cause it to run out of space for aux files with
9139 % thousands of lines. \gdef doesn't use the save stack, but \csname does
9140 % when it defines an unknown control sequence as \relax.
9142 % Was that xref control sequence that we just defined for a float?
9143 \expandafter\iffloat\csname XR\safexrefname\endcsname
9144 % it was a float, and we have the (safe) float type in \iffloattype.
9145 \expandafter\let\expandafter\floatlist
9146 \csname floatlist\iffloattype\endcsname
9148 % Is this the first time we've seen this float type?
9149 \expandafter\ifx\floatlist\relax
9150 \toks0 = {\do}% yes, so just \do
9151 \else
9152 % had it before, so preserve previous elements in list.
9153 \toks0 = \expandafter{\floatlist\do}%
9156 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9157 % for later use in \listoffloats.
9158 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9159 {\safexrefname}}%
9163 % If working on a large document in chapters, it is convenient to
9164 % be able to disable indexing, cross-referencing, and contents, for test runs.
9165 % This is done with @novalidate at the beginning of the file.
9167 \newif\iflinks \linkstrue % by default we want the aux files.
9168 \let\novalidate = \linksfalse
9170 % Used when writing to the aux file, or when using data from it.
9171 \def\requireauxfile{%
9172 \iflinks
9173 \tryauxfile
9174 % Open the new aux file. TeX will close it automatically at exit.
9175 \immediate\openout\auxfile=\jobname.aux
9177 \global\let\requireauxfile=\relax % Only do this once.
9180 % Read the last existing aux file, if any. No error if none exists.
9182 \def\tryauxfile{%
9183 \openin 1 \jobname.aux
9184 \ifeof 1 \else
9185 \readdatafile{aux}%
9186 \global\havexrefstrue
9188 \closein 1
9191 \def\setupdatafile{%
9192 \catcode`\^^@=\other
9193 \catcode`\^^A=\other
9194 \catcode`\^^B=\other
9195 \catcode`\^^C=\other
9196 \catcode`\^^D=\other
9197 \catcode`\^^E=\other
9198 \catcode`\^^F=\other
9199 \catcode`\^^G=\other
9200 \catcode`\^^H=\other
9201 \catcode`\^^K=\other
9202 \catcode`\^^L=\other
9203 \catcode`\^^N=\other
9204 \catcode`\^^P=\other
9205 \catcode`\^^Q=\other
9206 \catcode`\^^R=\other
9207 \catcode`\^^S=\other
9208 \catcode`\^^T=\other
9209 \catcode`\^^U=\other
9210 \catcode`\^^V=\other
9211 \catcode`\^^W=\other
9212 \catcode`\^^X=\other
9213 \catcode`\^^Z=\other
9214 \catcode`\^^[=\other
9215 \catcode`\^^\=\other
9216 \catcode`\^^]=\other
9217 \catcode`\^^^=\other
9218 \catcode`\^^_=\other
9219 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
9220 % in xref tags, i.e., node names. But since ^^e4 notation isn't
9221 % supported in the main text, it doesn't seem desirable. Furthermore,
9222 % that is not enough: for node names that actually contain a ^
9223 % character, we would end up writing a line like this: 'xrdef {'hat
9224 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
9225 % argument, and \hat is not an expandable control sequence. It could
9226 % all be worked out, but why? Either we support ^^ or we don't.
9228 % The other change necessary for this was to define \auxhat:
9229 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
9230 % and then to call \auxhat in \setq.
9232 \catcode`\^=\other
9234 % Special characters. Should be turned off anyway, but...
9235 \catcode`\~=\other
9236 \catcode`\[=\other
9237 \catcode`\]=\other
9238 \catcode`\"=\other
9239 \catcode`\_=\other
9240 \catcode`\|=\other
9241 \catcode`\<=\other
9242 \catcode`\>=\other
9243 \catcode`\$=\other
9244 \catcode`\#=\other
9245 \catcode`\&=\other
9246 \catcode`\%=\other
9247 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9249 % This is to support \ in node names and titles, since the \
9250 % characters end up in a \csname. It's easier than
9251 % leaving it active and making its active definition an actual \
9252 % character. What I don't understand is why it works in the *value*
9253 % of the xrdef. Seems like it should be a catcode12 \, and that
9254 % should not typeset properly. But it works, so I'm moving on for
9255 % now. --karl, 15jan04.
9256 \catcode`\\=\other
9258 % @ is our escape character in .aux files, and we need braces.
9259 \catcode`\{=1
9260 \catcode`\}=2
9261 \catcode`\@=0
9264 \def\readdatafile#1{%
9265 \begingroup
9266 \setupdatafile
9267 \input\jobname.#1
9268 \endgroup}
9271 \message{insertions,}
9272 % including footnotes.
9274 \newcount \footnoteno
9276 % The trailing space in the following definition for supereject is
9277 % vital for proper filling; pages come out unaligned when you do a
9278 % pagealignmacro call if that space before the closing brace is
9279 % removed. (Generally, numeric constants should always be followed by a
9280 % space to prevent strange expansion errors.)
9281 \def\supereject{\par\penalty -20000\footnoteno =0 }
9283 % @footnotestyle is meaningful for Info output only.
9284 \let\footnotestyle=\comment
9286 {\catcode `\@=11
9288 % Auto-number footnotes. Otherwise like plain.
9289 \gdef\footnote{%
9290 \global\advance\footnoteno by \@ne
9291 \edef\thisfootno{$^{\the\footnoteno}$}%
9293 % In case the footnote comes at the end of a sentence, preserve the
9294 % extra spacing after we do the footnote number.
9295 \let\@sf\empty
9296 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9298 % Remove inadvertent blank space before typesetting the footnote number.
9299 \unskip
9300 \thisfootno\@sf
9301 \dofootnote
9304 % Don't bother with the trickery in plain.tex to not require the
9305 % footnote text as a parameter. Our footnotes don't need to be so general.
9307 % Oh yes, they do; otherwise, @ifset (and anything else that uses
9308 % \parseargline) fails inside footnotes because the tokens are fixed when
9309 % the footnote is read. --karl, 16nov96.
9311 \gdef\dofootnote{%
9312 \insert\footins\bgroup
9314 % Nested footnotes are not supported in TeX, that would take a lot
9315 % more work. (\startsavinginserts does not suffice.)
9316 \let\footnote=\errfootnotenest
9318 % We want to typeset this text as a normal paragraph, even if the
9319 % footnote reference occurs in (for example) a display environment.
9320 % So reset some parameters.
9321 \hsize=\txipagewidth
9322 \interlinepenalty\interfootnotelinepenalty
9323 \splittopskip\ht\strutbox % top baseline for broken footnotes
9324 \splitmaxdepth\dp\strutbox
9325 \floatingpenalty\@MM
9326 \leftskip\z@skip
9327 \rightskip\z@skip
9328 \spaceskip\z@skip
9329 \xspaceskip\z@skip
9330 \parindent\defaultparindent
9332 \smallfonts \rm
9334 % Because we use hanging indentation in footnotes, a @noindent appears
9335 % to exdent this text, so make it be a no-op. makeinfo does not use
9336 % hanging indentation so @noindent can still be needed within footnote
9337 % text after an @example or the like (not that this is good style).
9338 \let\noindent = \relax
9340 % Hang the footnote text off the number. Use \everypar in case the
9341 % footnote extends for more than one paragraph.
9342 \everypar = {\hang}%
9343 \textindent{\thisfootno}%
9345 % Don't crash into the line above the footnote text. Since this
9346 % expands into a box, it must come within the paragraph, lest it
9347 % provide a place where TeX can split the footnote.
9348 \footstrut
9350 % Invoke rest of plain TeX footnote routine.
9351 \futurelet\next\fo@t
9353 }%end \catcode `\@=11
9355 \def\errfootnotenest{%
9356 \errhelp=\EMsimple
9357 \errmessage{Nested footnotes not supported in texinfo.tex,
9358 even though they work in makeinfo; sorry}
9361 \def\errfootnoteheading{%
9362 \errhelp=\EMsimple
9363 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9366 % In case a @footnote appears in a vbox, save the footnote text and create
9367 % the real \insert just after the vbox finished. Otherwise, the insertion
9368 % would be lost.
9369 % Similarly, if a @footnote appears inside an alignment, save the footnote
9370 % text to a box and make the \insert when a row of the table is finished.
9371 % And the same can be done for other insert classes. --kasal, 16nov03.
9373 % Replace the \insert primitive by a cheating macro.
9374 % Deeper inside, just make sure that the saved insertions are not spilled
9375 % out prematurely.
9377 \def\startsavinginserts{%
9378 \ifx \insert\ptexinsert
9379 \let\insert\saveinsert
9380 \else
9381 \let\checkinserts\relax
9385 % This \insert replacement works for both \insert\footins{foo} and
9386 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9388 \def\saveinsert#1{%
9389 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9390 \afterassignment\next
9391 % swallow the left brace
9392 \let\temp =
9394 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9395 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9397 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9399 \def\placesaveins#1{%
9400 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9401 {\box#1}%
9404 % eat @SAVE -- beware, all of them have catcode \other:
9406 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9407 \gdef\gobblesave @SAVE{}
9410 % initialization:
9411 \def\newsaveins #1{%
9412 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9413 \next
9415 \def\newsaveinsX #1{%
9416 \csname newbox\endcsname #1%
9417 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9418 \checksaveins #1}%
9421 % initialize:
9422 \let\checkinserts\empty
9423 \newsaveins\footins
9424 \newsaveins\margin
9427 % @image. We use the macros from epsf.tex to support this.
9428 % If epsf.tex is not installed and @image is used, we complain.
9430 % Check for and read epsf.tex up front. If we read it only at @image
9431 % time, we might be inside a group, and then its definitions would get
9432 % undone and the next image would fail.
9433 \openin 1 = epsf.tex
9434 \ifeof 1 \else
9435 % Do not bother showing banner with epsf.tex v2.7k (available in
9436 % doc/epsf.tex and on ctan).
9437 \def\epsfannounce{\toks0 = }%
9438 \input epsf.tex
9440 \closein 1
9442 % We will only complain once about lack of epsf.tex.
9443 \newif\ifwarnednoepsf
9444 \newhelp\noepsfhelp{epsf.tex must be installed for images to
9445 work. It is also included in the Texinfo distribution, or you can get
9446 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
9448 \def\image#1{%
9449 \ifx\epsfbox\thisisundefined
9450 \ifwarnednoepsf \else
9451 \errhelp = \noepsfhelp
9452 \errmessage{epsf.tex not found, images will be ignored}%
9453 \global\warnednoepsftrue
9455 \else
9456 \imagexxx #1,,,,,\finish
9460 % Arguments to @image:
9461 % #1 is (mandatory) image filename; we tack on .eps extension.
9462 % #2 is (optional) width, #3 is (optional) height.
9463 % #4 is (ignored optional) html alt text.
9464 % #5 is (ignored optional) extension.
9465 % #6 is just the usual extra ignored arg for parsing stuff.
9466 \newif\ifimagevmode
9467 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9468 \catcode`\^^M = 5 % in case we're inside an example
9469 \normalturnoffactive % allow _ et al. in names
9470 \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
9471 % If the image is by itself, center it.
9472 \ifvmode
9473 \imagevmodetrue
9474 \else \ifx\centersub\centerV
9475 % for @center @image, we need a vbox so we can have our vertical space
9476 \imagevmodetrue
9477 \vbox\bgroup % vbox has better behavior than vtop herev
9478 \fi\fi
9480 \ifimagevmode
9481 \nobreak\medskip
9482 % Usually we'll have text after the image which will insert
9483 % \parskip glue, so insert it here too to equalize the space
9484 % above and below.
9485 \nobreak\vskip\parskip
9486 \nobreak
9489 % Leave vertical mode so that indentation from an enclosing
9490 % environment such as @quotation is respected.
9491 % However, if we're at the top level, we don't want the
9492 % normal paragraph indentation.
9493 % On the other hand, if we are in the case of @center @image, we don't
9494 % want to start a paragraph, which will create a hsize-width box and
9495 % eradicate the centering.
9496 \ifx\centersub\centerV\else \noindent \fi
9498 % Output the image.
9499 \ifpdf
9500 % For pdfTeX and LuaTeX <= 0.80
9501 \dopdfimage{#1}{#2}{#3}%
9502 \else
9503 \ifx\XeTeXrevision\thisisundefined
9504 % For epsf.tex
9505 % \epsfbox itself resets \epsf?size at each figure.
9506 \setbox0 = \hbox{\ignorespaces #2}%
9507 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9508 \setbox0 = \hbox{\ignorespaces #3}%
9509 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9510 \epsfbox{#1.eps}%
9511 \else
9512 % For XeTeX
9513 \doxeteximage{#1}{#2}{#3}%
9517 \ifimagevmode
9518 \medskip % space after a standalone image
9519 \fi
9520 \ifx\centersub\centerV \egroup \fi
9521 \endgroup}
9524 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9525 % etc. We don't actually implement floating yet, we always include the
9526 % float "here". But it seemed the best name for the future.
9528 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9530 % There may be a space before second and/or third parameter; delete it.
9531 \def\eatcommaspace#1, {#1,}
9533 % #1 is the optional FLOATTYPE, the text label for this float, typically
9534 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9535 % this float will not be numbered and cannot be referred to.
9537 % #2 is the optional xref label. Also must be present for the float to
9538 % be referable.
9540 % #3 is the optional positioning argument; for now, it is ignored. It
9541 % will somehow specify the positions allowed to float to (here, top, bottom).
9543 % We keep a separate counter for each FLOATTYPE, which we reset at each
9544 % chapter-level command.
9545 \let\resetallfloatnos=\empty
9547 \def\dofloat#1,#2,#3,#4\finish{%
9548 \let\thiscaption=\empty
9549 \let\thisshortcaption=\empty
9551 % don't lose footnotes inside @float.
9553 % BEWARE: when the floats start float, we have to issue warning whenever an
9554 % insert appears inside a float which could possibly float. --kasal, 26may04
9556 \startsavinginserts
9558 % We can't be used inside a paragraph.
9559 \par
9561 \vtop\bgroup
9562 \def\floattype{#1}%
9563 \def\floatlabel{#2}%
9564 \def\floatloc{#3}% we do nothing with this yet.
9566 \ifx\floattype\empty
9567 \let\safefloattype=\empty
9568 \else
9570 % the floattype might have accents or other special characters,
9571 % but we need to use it in a control sequence name.
9572 \indexnofonts
9573 \turnoffactive
9574 \xdef\safefloattype{\floattype}%
9578 % If label is given but no type, we handle that as the empty type.
9579 \ifx\floatlabel\empty \else
9580 % We want each FLOATTYPE to be numbered separately (Figure 1,
9581 % Table 1, Figure 2, ...). (And if no label, no number.)
9583 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9584 \global\advance\floatno by 1
9587 % This magic value for \lastsection is output by \setref as the
9588 % XREFLABEL-title value. \xrefX uses it to distinguish float
9589 % labels (which have a completely different output format) from
9590 % node and anchor labels. And \xrdef uses it to construct the
9591 % lists of floats.
9593 \edef\lastsection{\floatmagic=\safefloattype}%
9594 \setref{\floatlabel}{Yfloat}%
9598 % start with \parskip glue, I guess.
9599 \vskip\parskip
9601 % Don't suppress indentation if a float happens to start a section.
9602 \restorefirstparagraphindent
9605 % we have these possibilities:
9606 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9607 % @float Foo,lbl & no caption: Foo 1.1
9608 % @float Foo & @caption{Cap}: Foo: Cap
9609 % @float Foo & no caption: Foo
9610 % @float ,lbl & Caption{Cap}: 1.1: Cap
9611 % @float ,lbl & no caption: 1.1
9612 % @float & @caption{Cap}: Cap
9613 % @float & no caption:
9615 \def\Efloat{%
9616 \let\floatident = \empty
9618 % In all cases, if we have a float type, it comes first.
9619 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9621 % If we have an xref label, the number comes next.
9622 \ifx\floatlabel\empty \else
9623 \ifx\floattype\empty \else % if also had float type, need tie first.
9624 \appendtomacro\floatident{\tie}%
9626 % the number.
9627 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9630 % Start the printed caption with what we've constructed in
9631 % \floatident, but keep it separate; we need \floatident again.
9632 \let\captionline = \floatident
9634 \ifx\thiscaption\empty \else
9635 \ifx\floatident\empty \else
9636 \appendtomacro\captionline{: }% had ident, so need a colon between
9639 % caption text.
9640 \appendtomacro\captionline{\scanexp\thiscaption}%
9643 % If we have anything to print, print it, with space before.
9644 % Eventually this needs to become an \insert.
9645 \ifx\captionline\empty \else
9646 \vskip.5\parskip
9647 \captionline
9649 % Space below caption.
9650 \vskip\parskip
9653 % If have an xref label, write the list of floats info. Do this
9654 % after the caption, to avoid chance of it being a breakpoint.
9655 \ifx\floatlabel\empty \else
9656 % Write the text that goes in the lof to the aux file as
9657 % \floatlabel-lof. Besides \floatident, we include the short
9658 % caption if specified, else the full caption if specified, else nothing.
9660 \requireauxfile
9661 \atdummies
9663 \ifx\thisshortcaption\empty
9664 \def\gtemp{\thiscaption}%
9665 \else
9666 \def\gtemp{\thisshortcaption}%
9668 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9669 \ifx\gtemp\empty \else : \gtemp \fi}}%
9672 \egroup % end of \vtop
9674 \checkinserts
9677 % Append the tokens #2 to the definition of macro #1, not expanding either.
9679 \def\appendtomacro#1#2{%
9680 \expandafter\def\expandafter#1\expandafter{#1#2}%
9683 % @caption, @shortcaption
9685 \def\caption{\docaption\thiscaption}
9686 \def\shortcaption{\docaption\thisshortcaption}
9687 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9688 \def\defcaption#1#2{\egroup \def#1{#2}}
9690 % The parameter is the control sequence identifying the counter we are
9691 % going to use. Create it if it doesn't exist and assign it to \floatno.
9692 \def\getfloatno#1{%
9693 \ifx#1\relax
9694 % Haven't seen this figure type before.
9695 \csname newcount\endcsname #1%
9697 % Remember to reset this floatno at the next chap.
9698 \expandafter\gdef\expandafter\resetallfloatnos
9699 \expandafter{\resetallfloatnos #1=0 }%
9701 \let\floatno#1%
9704 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9705 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9706 % first read the @float command.
9708 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9710 % Magic string used for the XREFLABEL-title value, so \xrefX can
9711 % distinguish floats from other xref types.
9712 \def\floatmagic{!!float!!}
9714 % #1 is the control sequence we are passed; we expand into a conditional
9715 % which is true if #1 represents a float ref. That is, the magic
9716 % \lastsection value which we \setref above.
9718 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9720 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9721 % (safe) float type for this float. We set \iffloattype to #2.
9723 \def\doiffloat#1=#2=#3\finish{%
9724 \def\temp{#1}%
9725 \def\iffloattype{#2}%
9726 \ifx\temp\floatmagic
9729 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9731 \parseargdef\listoffloats{%
9732 \def\floattype{#1}% floattype
9734 % the floattype might have accents or other special characters,
9735 % but we need to use it in a control sequence name.
9736 \indexnofonts
9737 \turnoffactive
9738 \xdef\safefloattype{\floattype}%
9741 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9742 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9743 \ifhavexrefs
9744 % if the user said @listoffloats foo but never @float foo.
9745 \message{\linenumber No `\safefloattype' floats to list.}%
9747 \else
9748 \begingroup
9749 \leftskip=\tocindent % indent these entries like a toc
9750 \let\do=\listoffloatsdo
9751 \csname floatlist\safefloattype\endcsname
9752 \endgroup
9756 % This is called on each entry in a list of floats. We're passed the
9757 % xref label, in the form LABEL-title, which is how we save it in the
9758 % aux file. We strip off the -title and look up \XRLABEL-lof, which
9759 % has the text we're supposed to typeset here.
9761 % Figures without xref labels will not be included in the list (since
9762 % they won't appear in the aux file).
9764 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9765 \def\listoffloatsdoentry#1-title\finish{{%
9766 % Can't fully expand XR#1-lof because it can contain anything. Just
9767 % pass the control sequence. On the other hand, XR#1-pg is just the
9768 % page number, and we want to fully expand that so we can get a link
9769 % in pdf output.
9770 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9772 % use the same \entry macro we use to generate the TOC and index.
9773 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9774 \writeentry
9778 \message{localization,}
9780 % For single-language documents, @documentlanguage is usually given very
9781 % early, just after @documentencoding. Single argument is the language
9782 % (de) or locale (de_DE) abbreviation.
9785 \catcode`\_ = \active
9786 \globaldefs=1
9787 \parseargdef\documentlanguage{%
9788 \tex % read txi-??.tex file in plain TeX.
9789 % Read the file by the name they passed if it exists.
9790 \let_ = \normalunderscore % normal _ character for filename test
9791 \openin 1 txi-#1.tex
9792 \ifeof 1
9793 \documentlanguagetrywithoutunderscore #1_\finish
9794 \else
9795 \globaldefs = 1 % everything in the txi-LL files needs to persist
9796 \input txi-#1.tex
9798 \closein 1
9799 \endgroup % end raw TeX
9802 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9803 % try txi-de.tex.
9805 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9806 \openin 1 txi-#1.tex
9807 \ifeof 1
9808 \errhelp = \nolanghelp
9809 \errmessage{Cannot read language file txi-#1.tex}%
9810 \else
9811 \globaldefs = 1 % everything in the txi-LL files needs to persist
9812 \input txi-#1.tex
9814 \closein 1
9816 }% end of special _ catcode
9818 \newhelp\nolanghelp{The given language definition file cannot be found or
9819 is empty. Maybe you need to install it? Putting it in the current
9820 directory should work if nowhere else does.}
9822 % This macro is called from txi-??.tex files; the first argument is the
9823 % \language name to set (without the "\lang@" prefix), the second and
9824 % third args are \{left,right}hyphenmin.
9826 % The language names to pass are determined when the format is built.
9827 % See the etex.log file created at that time, e.g.,
9828 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9830 % With TeX Live 2008, etex now includes hyphenation patterns for all
9831 % available languages. This means we can support hyphenation in
9832 % Texinfo, at least to some extent. (This still doesn't solve the
9833 % accented characters problem.)
9835 \catcode`@=11
9836 \def\txisetlanguage#1#2#3{%
9837 % do not set the language if the name is undefined in the current TeX.
9838 \expandafter\ifx\csname lang@#1\endcsname \relax
9839 \message{no patterns for #1}%
9840 \else
9841 \global\language = \csname lang@#1\endcsname
9843 % but there is no harm in adjusting the hyphenmin values regardless.
9844 \global\lefthyphenmin = #2\relax
9845 \global\righthyphenmin = #3\relax
9848 % XeTeX and LuaTeX can handle Unicode natively.
9849 % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9850 % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9852 \newif\iftxinativeunicodecapable
9853 \newif\iftxiusebytewiseio
9855 \ifx\XeTeXrevision\thisisundefined
9856 \ifx\luatexversion\thisisundefined
9857 \txinativeunicodecapablefalse
9858 \txiusebytewiseiotrue
9859 \else
9860 \txinativeunicodecapabletrue
9861 \txiusebytewiseiofalse
9863 \else
9864 \txinativeunicodecapabletrue
9865 \txiusebytewiseiofalse
9868 % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9869 % for non-UTF-8 (byte-wise) encodings.
9871 \def\setbytewiseio{%
9872 \ifx\XeTeXrevision\thisisundefined
9873 \else
9874 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9875 \XeTeXinputencoding "bytes" % For document root file
9876 % Unfortunately, there seems to be no corresponding XeTeX command for
9877 % output encoding. This is a problem for auxiliary index and TOC files.
9878 % The only solution would be perhaps to write out @U{...} sequences in
9879 % place of non-ASCII characters.
9882 \ifx\luatexversion\thisisundefined
9883 \else
9884 \directlua{
9885 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9886 local function convert_char (char)
9887 return utf8_char(byte(char))
9890 local function convert_line (line)
9891 return gsub(line, ".", convert_char)
9894 callback.register("process_input_buffer", convert_line)
9896 local function convert_line_out (line)
9897 local line_out = ""
9898 for c in string.utfvalues(line) do
9899 line_out = line_out .. string.char(c)
9901 return line_out
9904 callback.register("process_output_buffer", convert_line_out)
9908 \txiusebytewiseiotrue
9912 % Helpers for encodings.
9913 % Set the catcode of characters 128 through 255 to the specified number.
9915 \def\setnonasciicharscatcode#1{%
9916 \count255=128
9917 \loop\ifnum\count255<256
9918 \global\catcode\count255=#1\relax
9919 \advance\count255 by 1
9920 \repeat
9923 \def\setnonasciicharscatcodenonglobal#1{%
9924 \count255=128
9925 \loop\ifnum\count255<256
9926 \catcode\count255=#1\relax
9927 \advance\count255 by 1
9928 \repeat
9931 % @documentencoding sets the definition of non-ASCII characters
9932 % according to the specified encoding.
9934 \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9935 \def\documentencodingzzz#1{%
9937 % Encoding being declared for the document.
9938 \def\declaredencoding{\csname #1.enc\endcsname}%
9940 % Supported encodings: names converted to tokens in order to be able
9941 % to compare them with \ifx.
9942 \def\ascii{\csname US-ASCII.enc\endcsname}%
9943 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9944 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9945 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9946 \def\utfeight{\csname UTF-8.enc\endcsname}%
9948 \ifx \declaredencoding \ascii
9949 \asciichardefs
9951 \else \ifx \declaredencoding \lattwo
9952 \iftxinativeunicodecapable
9953 \setbytewiseio
9955 \setnonasciicharscatcode\active
9956 \lattwochardefs
9958 \else \ifx \declaredencoding \latone
9959 \iftxinativeunicodecapable
9960 \setbytewiseio
9962 \setnonasciicharscatcode\active
9963 \latonechardefs
9965 \else \ifx \declaredencoding \latnine
9966 \iftxinativeunicodecapable
9967 \setbytewiseio
9969 \setnonasciicharscatcode\active
9970 \latninechardefs
9972 \else \ifx \declaredencoding \utfeight
9973 \iftxinativeunicodecapable
9974 % For native Unicode handling (XeTeX and LuaTeX)
9975 \nativeunicodechardefs
9976 \else
9977 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
9978 \setnonasciicharscatcode\active
9979 % since we already invoked \utfeightchardefs at the top level
9980 % (below), do not re-invoke it, otherwise our check for duplicated
9981 % definitions gets triggered. Making non-ascii chars active is
9982 % sufficient.
9985 \else
9986 \message{Ignoring unknown document encoding: #1.}%
9988 \fi % utfeight
9989 \fi % latnine
9990 \fi % latone
9991 \fi % lattwo
9992 \fi % ascii
9994 \ifx\XeTeXrevision\thisisundefined
9995 \else
9996 \ifx \declaredencoding \utfeight
9997 \else
9998 \ifx \declaredencoding \ascii
9999 \else
10000 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
10001 non-ASCII characters in auxiliary files.}%
10007 % emacs-page
10008 % A message to be logged when using a character that isn't available
10009 % the default font encoding (OT1).
10011 \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
10013 % Take account of \c (plain) vs. \, (Texinfo) difference.
10014 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
10016 % First, make active non-ASCII characters in order for them to be
10017 % correctly categorized when TeX reads the replacement text of
10018 % macros containing the character definitions.
10019 \setnonasciicharscatcode\active
10022 \def\gdefchar#1#2{%
10023 \gdef#1{%
10024 \ifpassthroughchars
10025 \string#1%
10026 \else
10031 % Latin1 (ISO-8859-1) character definitions.
10032 \def\latonechardefs{%
10033 \gdefchar^^a0{\tie}
10034 \gdefchar^^a1{\exclamdown}
10035 \gdefchar^^a2{{\tcfont \char162}} % cent
10036 \gdefchar^^a3{\pounds{}}
10037 \gdefchar^^a4{{\tcfont \char164}} % currency
10038 \gdefchar^^a5{{\tcfont \char165}} % yen
10039 \gdefchar^^a6{{\tcfont \char166}} % broken bar
10040 \gdefchar^^a7{\S}
10041 \gdefchar^^a8{\"{}}
10042 \gdefchar^^a9{\copyright{}}
10043 \gdefchar^^aa{\ordf}
10044 \gdefchar^^ab{\guillemetleft{}}
10045 \gdefchar^^ac{\ensuremath\lnot}
10046 \gdefchar^^ad{\-}
10047 \gdefchar^^ae{\registeredsymbol{}}
10048 \gdefchar^^af{\={}}
10050 \gdefchar^^b0{\textdegree}
10051 \gdefchar^^b1{$\pm$}
10052 \gdefchar^^b2{$^2$}
10053 \gdefchar^^b3{$^3$}
10054 \gdefchar^^b4{\'{}}
10055 \gdefchar^^b5{$\mu$}
10056 \gdefchar^^b6{\P}
10057 \gdefchar^^b7{\ensuremath\cdot}
10058 \gdefchar^^b8{\cedilla\ }
10059 \gdefchar^^b9{$^1$}
10060 \gdefchar^^ba{\ordm}
10061 \gdefchar^^bb{\guillemetright{}}
10062 \gdefchar^^bc{$1\over4$}
10063 \gdefchar^^bd{$1\over2$}
10064 \gdefchar^^be{$3\over4$}
10065 \gdefchar^^bf{\questiondown}
10067 \gdefchar^^c0{\`A}
10068 \gdefchar^^c1{\'A}
10069 \gdefchar^^c2{\^A}
10070 \gdefchar^^c3{\~A}
10071 \gdefchar^^c4{\"A}
10072 \gdefchar^^c5{\ringaccent A}
10073 \gdefchar^^c6{\AE}
10074 \gdefchar^^c7{\cedilla C}
10075 \gdefchar^^c8{\`E}
10076 \gdefchar^^c9{\'E}
10077 \gdefchar^^ca{\^E}
10078 \gdefchar^^cb{\"E}
10079 \gdefchar^^cc{\`I}
10080 \gdefchar^^cd{\'I}
10081 \gdefchar^^ce{\^I}
10082 \gdefchar^^cf{\"I}
10084 \gdefchar^^d0{\DH}
10085 \gdefchar^^d1{\~N}
10086 \gdefchar^^d2{\`O}
10087 \gdefchar^^d3{\'O}
10088 \gdefchar^^d4{\^O}
10089 \gdefchar^^d5{\~O}
10090 \gdefchar^^d6{\"O}
10091 \gdefchar^^d7{$\times$}
10092 \gdefchar^^d8{\O}
10093 \gdefchar^^d9{\`U}
10094 \gdefchar^^da{\'U}
10095 \gdefchar^^db{\^U}
10096 \gdefchar^^dc{\"U}
10097 \gdefchar^^dd{\'Y}
10098 \gdefchar^^de{\TH}
10099 \gdefchar^^df{\ss}
10101 \gdefchar^^e0{\`a}
10102 \gdefchar^^e1{\'a}
10103 \gdefchar^^e2{\^a}
10104 \gdefchar^^e3{\~a}
10105 \gdefchar^^e4{\"a}
10106 \gdefchar^^e5{\ringaccent a}
10107 \gdefchar^^e6{\ae}
10108 \gdefchar^^e7{\cedilla c}
10109 \gdefchar^^e8{\`e}
10110 \gdefchar^^e9{\'e}
10111 \gdefchar^^ea{\^e}
10112 \gdefchar^^eb{\"e}
10113 \gdefchar^^ec{\`{\dotless i}}
10114 \gdefchar^^ed{\'{\dotless i}}
10115 \gdefchar^^ee{\^{\dotless i}}
10116 \gdefchar^^ef{\"{\dotless i}}
10118 \gdefchar^^f0{\dh}
10119 \gdefchar^^f1{\~n}
10120 \gdefchar^^f2{\`o}
10121 \gdefchar^^f3{\'o}
10122 \gdefchar^^f4{\^o}
10123 \gdefchar^^f5{\~o}
10124 \gdefchar^^f6{\"o}
10125 \gdefchar^^f7{$\div$}
10126 \gdefchar^^f8{\o}
10127 \gdefchar^^f9{\`u}
10128 \gdefchar^^fa{\'u}
10129 \gdefchar^^fb{\^u}
10130 \gdefchar^^fc{\"u}
10131 \gdefchar^^fd{\'y}
10132 \gdefchar^^fe{\th}
10133 \gdefchar^^ff{\"y}
10136 % Latin9 (ISO-8859-15) encoding character definitions.
10137 \def\latninechardefs{%
10138 % Encoding is almost identical to Latin1.
10139 \latonechardefs
10141 \gdefchar^^a4{\euro{}}
10142 \gdefchar^^a6{\v S}
10143 \gdefchar^^a8{\v s}
10144 \gdefchar^^b4{\v Z}
10145 \gdefchar^^b8{\v z}
10146 \gdefchar^^bc{\OE}
10147 \gdefchar^^bd{\oe}
10148 \gdefchar^^be{\"Y}
10151 % Latin2 (ISO-8859-2) character definitions.
10152 \def\lattwochardefs{%
10153 \gdefchar^^a0{\tie}
10154 \gdefchar^^a1{\ogonek{A}}
10155 \gdefchar^^a2{\u{}}
10156 \gdefchar^^a3{\L}
10157 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10158 \gdefchar^^a5{\v L}
10159 \gdefchar^^a6{\'S}
10160 \gdefchar^^a7{\S}
10161 \gdefchar^^a8{\"{}}
10162 \gdefchar^^a9{\v S}
10163 \gdefchar^^aa{\cedilla S}
10164 \gdefchar^^ab{\v T}
10165 \gdefchar^^ac{\'Z}
10166 \gdefchar^^ad{\-}
10167 \gdefchar^^ae{\v Z}
10168 \gdefchar^^af{\dotaccent Z}
10170 \gdefchar^^b0{\textdegree{}}
10171 \gdefchar^^b1{\ogonek{a}}
10172 \gdefchar^^b2{\ogonek{ }}
10173 \gdefchar^^b3{\l}
10174 \gdefchar^^b4{\'{}}
10175 \gdefchar^^b5{\v l}
10176 \gdefchar^^b6{\'s}
10177 \gdefchar^^b7{\v{}}
10178 \gdefchar^^b8{\cedilla\ }
10179 \gdefchar^^b9{\v s}
10180 \gdefchar^^ba{\cedilla s}
10181 \gdefchar^^bb{\v t}
10182 \gdefchar^^bc{\'z}
10183 \gdefchar^^bd{\H{}}
10184 \gdefchar^^be{\v z}
10185 \gdefchar^^bf{\dotaccent z}
10187 \gdefchar^^c0{\'R}
10188 \gdefchar^^c1{\'A}
10189 \gdefchar^^c2{\^A}
10190 \gdefchar^^c3{\u A}
10191 \gdefchar^^c4{\"A}
10192 \gdefchar^^c5{\'L}
10193 \gdefchar^^c6{\'C}
10194 \gdefchar^^c7{\cedilla C}
10195 \gdefchar^^c8{\v C}
10196 \gdefchar^^c9{\'E}
10197 \gdefchar^^ca{\ogonek{E}}
10198 \gdefchar^^cb{\"E}
10199 \gdefchar^^cc{\v E}
10200 \gdefchar^^cd{\'I}
10201 \gdefchar^^ce{\^I}
10202 \gdefchar^^cf{\v D}
10204 \gdefchar^^d0{\DH}
10205 \gdefchar^^d1{\'N}
10206 \gdefchar^^d2{\v N}
10207 \gdefchar^^d3{\'O}
10208 \gdefchar^^d4{\^O}
10209 \gdefchar^^d5{\H O}
10210 \gdefchar^^d6{\"O}
10211 \gdefchar^^d7{$\times$}
10212 \gdefchar^^d8{\v R}
10213 \gdefchar^^d9{\ringaccent U}
10214 \gdefchar^^da{\'U}
10215 \gdefchar^^db{\H U}
10216 \gdefchar^^dc{\"U}
10217 \gdefchar^^dd{\'Y}
10218 \gdefchar^^de{\cedilla T}
10219 \gdefchar^^df{\ss}
10221 \gdefchar^^e0{\'r}
10222 \gdefchar^^e1{\'a}
10223 \gdefchar^^e2{\^a}
10224 \gdefchar^^e3{\u a}
10225 \gdefchar^^e4{\"a}
10226 \gdefchar^^e5{\'l}
10227 \gdefchar^^e6{\'c}
10228 \gdefchar^^e7{\cedilla c}
10229 \gdefchar^^e8{\v c}
10230 \gdefchar^^e9{\'e}
10231 \gdefchar^^ea{\ogonek{e}}
10232 \gdefchar^^eb{\"e}
10233 \gdefchar^^ec{\v e}
10234 \gdefchar^^ed{\'{\dotless{i}}}
10235 \gdefchar^^ee{\^{\dotless{i}}}
10236 \gdefchar^^ef{\v d}
10238 \gdefchar^^f0{\dh}
10239 \gdefchar^^f1{\'n}
10240 \gdefchar^^f2{\v n}
10241 \gdefchar^^f3{\'o}
10242 \gdefchar^^f4{\^o}
10243 \gdefchar^^f5{\H o}
10244 \gdefchar^^f6{\"o}
10245 \gdefchar^^f7{$\div$}
10246 \gdefchar^^f8{\v r}
10247 \gdefchar^^f9{\ringaccent u}
10248 \gdefchar^^fa{\'u}
10249 \gdefchar^^fb{\H u}
10250 \gdefchar^^fc{\"u}
10251 \gdefchar^^fd{\'y}
10252 \gdefchar^^fe{\cedilla t}
10253 \gdefchar^^ff{\dotaccent{}}
10256 % UTF-8 character definitions.
10258 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
10259 % changes for Texinfo conventions. It is included here under the GPL by
10260 % permission from Frank Mittelbach and the LaTeX team.
10262 \newcount\countUTFx
10263 \newcount\countUTFy
10264 \newcount\countUTFz
10266 \gdef\UTFviiiTwoOctets#1#2{\expandafter
10267 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10269 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10270 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10272 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10273 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10275 \gdef\UTFviiiDefined#1{%
10276 \ifx #1\relax
10277 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10278 \else
10279 \expandafter #1%
10283 % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10284 \begingroup
10285 \catcode`\~13
10286 \catcode`\$12
10287 \catcode`\"12
10289 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10290 % substituting ~ and $ with a character token of that value.
10291 \def\UTFviiiLoop{%
10292 \global\catcode\countUTFx\active
10293 \uccode`\~\countUTFx
10294 \uccode`\$\countUTFx
10295 \uppercase\expandafter{\UTFviiiTmp}%
10296 \advance\countUTFx by 1
10297 \ifnum\countUTFx < \countUTFy
10298 \expandafter\UTFviiiLoop
10299 \fi}
10301 % For bytes other than the first in a UTF-8 sequence. Not expected to
10302 % be expanded except when writing to auxiliary files.
10303 \countUTFx = "80
10304 \countUTFy = "C2
10305 \def\UTFviiiTmp{%
10306 \gdef~{%
10307 \ifpassthroughchars $\fi}}%
10308 \UTFviiiLoop
10310 \countUTFx = "C2
10311 \countUTFy = "E0
10312 \def\UTFviiiTmp{%
10313 \gdef~{%
10314 \ifpassthroughchars $%
10315 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10316 \UTFviiiLoop
10318 \countUTFx = "E0
10319 \countUTFy = "F0
10320 \def\UTFviiiTmp{%
10321 \gdef~{%
10322 \ifpassthroughchars $%
10323 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10324 \UTFviiiLoop
10326 \countUTFx = "F0
10327 \countUTFy = "F4
10328 \def\UTFviiiTmp{%
10329 \gdef~{%
10330 \ifpassthroughchars $%
10331 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10333 \UTFviiiLoop
10334 \endgroup
10336 \def\globallet{\global\let} % save some \expandafter's below
10338 % @U{xxxx} to produce U+xxxx, if we support it.
10339 \def\U#1{%
10340 \expandafter\ifx\csname uni:#1\endcsname \relax
10341 \iftxinativeunicodecapable
10342 % All Unicode characters can be used if native Unicode handling is
10343 % active. However, if the font does not have the glyph,
10344 % letters are missing.
10345 \begingroup
10346 \uccode`\.="#1\relax
10347 \uppercase{.}
10348 \endgroup
10349 \else
10350 \errhelp = \EMsimple
10351 \errmessage{Unicode character U+#1 not supported, sorry}%
10353 \else
10354 \csname uni:#1\endcsname
10358 % These macros are used here to construct the name of a control
10359 % sequence to be defined.
10360 \def\UTFviiiTwoOctetsName#1#2{%
10361 \csname u8:#1\string #2\endcsname}%
10362 \def\UTFviiiThreeOctetsName#1#2#3{%
10363 \csname u8:#1\string #2\string #3\endcsname}%
10364 \def\UTFviiiFourOctetsName#1#2#3#4{%
10365 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10367 % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10368 % provide a definition macro to replace a Unicode character;
10369 % this gets used by the @U command
10371 \begingroup
10372 \catcode`\"=12
10373 \catcode`\<=12
10374 \catcode`\.=12
10375 \catcode`\,=12
10376 \catcode`\;=12
10377 \catcode`\!=12
10378 \catcode`\~=13
10379 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10380 \countUTFz = "#1\relax
10381 \begingroup
10382 \parseXMLCharref
10384 % Give \u8:... its definition. The sequence of seven \expandafter's
10385 % expands after the \gdef three times, e.g.
10387 % 1. \UTFviiTwoOctetsName B1 B2
10388 % 2. \csname u8:B1 \string B2 \endcsname
10389 % 3. \u8: B1 B2 (a single control sequence token)
10391 \expandafter\expandafter
10392 \expandafter\expandafter
10393 \expandafter\expandafter
10394 \expandafter\gdef \UTFviiiTmp{#2}%
10396 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10397 \message{Internal error, already defined: #1}%
10400 % define an additional control sequence for this code point.
10401 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10402 \endgroup}
10404 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10405 % to the corresponding UTF-8 sequence.
10406 \gdef\parseXMLCharref{%
10407 \ifnum\countUTFz < "A0\relax
10408 \errhelp = \EMsimple
10409 \errmessage{Cannot define Unicode char value < 00A0}%
10410 \else\ifnum\countUTFz < "800\relax
10411 \parseUTFviiiA,%
10412 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10413 \else\ifnum\countUTFz < "10000\relax
10414 \parseUTFviiiA;%
10415 \parseUTFviiiA,%
10416 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10417 \else
10418 \parseUTFviiiA;%
10419 \parseUTFviiiA,%
10420 \parseUTFviiiA!%
10421 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10422 \fi\fi\fi
10425 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10426 % It must be a non-initial byte in the sequence.
10427 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10428 % of the bytes.
10429 \gdef\parseUTFviiiA#1{%
10430 \countUTFx = \countUTFz
10431 \divide\countUTFz by 64
10432 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10433 \multiply\countUTFz by 64
10435 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10436 % in order to get the last five bits.
10437 \advance\countUTFx by -\countUTFz
10439 % Convert this to the byte in the UTF-8 sequence.
10440 \advance\countUTFx by 128
10441 \uccode `#1\countUTFx
10442 \countUTFz = \countUTFy}
10444 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10445 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10446 % sequence.
10447 % #2 is one of the \UTFviii*OctetsName macros.
10448 % #3 is always a full stop (.)
10449 % #4 is a template for the other bytes in the sequence. The values for these
10450 % bytes is substituted in here with \uppercase using the \uccode's.
10451 \gdef\parseUTFviiiB#1#2#3#4{%
10452 \advance\countUTFz by "#10\relax
10453 \uccode `#3\countUTFz
10454 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10455 \endgroup
10457 % For native Unicode handling (XeTeX and LuaTeX),
10458 % provide a definition macro that sets a catcode to `other' non-globally
10460 \def\DeclareUnicodeCharacterNativeOther#1#2{%
10461 \catcode"#1=\other
10464 % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10465 % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10466 % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10467 % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10468 % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10470 % Many of our renditions are less than wonderful, and all the missing
10471 % characters are available somewhere. Loading the necessary fonts
10472 % awaits user request. We can't truly support Unicode without
10473 % reimplementing everything that's been done in LaTeX for many years,
10474 % plus probably using luatex or xetex, and who knows what else.
10475 % We won't be doing that here in this simple file. But we can try to at
10476 % least make most of the characters not bomb out.
10478 \def\unicodechardefs{%
10479 \DeclareUnicodeCharacter{00A0}{\tie}%
10480 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10481 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10482 \DeclareUnicodeCharacter{00A3}{\pounds{}}%
10483 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10484 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10485 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10486 \DeclareUnicodeCharacter{00A7}{\S}%
10487 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10488 \DeclareUnicodeCharacter{00A9}{\copyright{}}%
10489 \DeclareUnicodeCharacter{00AA}{\ordf}%
10490 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
10491 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10492 \DeclareUnicodeCharacter{00AD}{\-}%
10493 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
10494 \DeclareUnicodeCharacter{00AF}{\={ }}%
10496 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
10497 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10498 \DeclareUnicodeCharacter{00B2}{$^2$}%
10499 \DeclareUnicodeCharacter{00B3}{$^3$}%
10500 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10501 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10502 \DeclareUnicodeCharacter{00B6}{\P}%
10503 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10504 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10505 \DeclareUnicodeCharacter{00B9}{$^1$}%
10506 \DeclareUnicodeCharacter{00BA}{\ordm}%
10507 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
10508 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10509 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10510 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10511 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10513 \DeclareUnicodeCharacter{00C0}{\`A}%
10514 \DeclareUnicodeCharacter{00C1}{\'A}%
10515 \DeclareUnicodeCharacter{00C2}{\^A}%
10516 \DeclareUnicodeCharacter{00C3}{\~A}%
10517 \DeclareUnicodeCharacter{00C4}{\"A}%
10518 \DeclareUnicodeCharacter{00C5}{\AA}%
10519 \DeclareUnicodeCharacter{00C6}{\AE}%
10520 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10521 \DeclareUnicodeCharacter{00C8}{\`E}%
10522 \DeclareUnicodeCharacter{00C9}{\'E}%
10523 \DeclareUnicodeCharacter{00CA}{\^E}%
10524 \DeclareUnicodeCharacter{00CB}{\"E}%
10525 \DeclareUnicodeCharacter{00CC}{\`I}%
10526 \DeclareUnicodeCharacter{00CD}{\'I}%
10527 \DeclareUnicodeCharacter{00CE}{\^I}%
10528 \DeclareUnicodeCharacter{00CF}{\"I}%
10530 \DeclareUnicodeCharacter{00D0}{\DH}%
10531 \DeclareUnicodeCharacter{00D1}{\~N}%
10532 \DeclareUnicodeCharacter{00D2}{\`O}%
10533 \DeclareUnicodeCharacter{00D3}{\'O}%
10534 \DeclareUnicodeCharacter{00D4}{\^O}%
10535 \DeclareUnicodeCharacter{00D5}{\~O}%
10536 \DeclareUnicodeCharacter{00D6}{\"O}%
10537 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10538 \DeclareUnicodeCharacter{00D8}{\O}%
10539 \DeclareUnicodeCharacter{00D9}{\`U}%
10540 \DeclareUnicodeCharacter{00DA}{\'U}%
10541 \DeclareUnicodeCharacter{00DB}{\^U}%
10542 \DeclareUnicodeCharacter{00DC}{\"U}%
10543 \DeclareUnicodeCharacter{00DD}{\'Y}%
10544 \DeclareUnicodeCharacter{00DE}{\TH}%
10545 \DeclareUnicodeCharacter{00DF}{\ss}%
10547 \DeclareUnicodeCharacter{00E0}{\`a}%
10548 \DeclareUnicodeCharacter{00E1}{\'a}%
10549 \DeclareUnicodeCharacter{00E2}{\^a}%
10550 \DeclareUnicodeCharacter{00E3}{\~a}%
10551 \DeclareUnicodeCharacter{00E4}{\"a}%
10552 \DeclareUnicodeCharacter{00E5}{\aa}%
10553 \DeclareUnicodeCharacter{00E6}{\ae}%
10554 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10555 \DeclareUnicodeCharacter{00E8}{\`e}%
10556 \DeclareUnicodeCharacter{00E9}{\'e}%
10557 \DeclareUnicodeCharacter{00EA}{\^e}%
10558 \DeclareUnicodeCharacter{00EB}{\"e}%
10559 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10560 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10561 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10562 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10564 \DeclareUnicodeCharacter{00F0}{\dh}%
10565 \DeclareUnicodeCharacter{00F1}{\~n}%
10566 \DeclareUnicodeCharacter{00F2}{\`o}%
10567 \DeclareUnicodeCharacter{00F3}{\'o}%
10568 \DeclareUnicodeCharacter{00F4}{\^o}%
10569 \DeclareUnicodeCharacter{00F5}{\~o}%
10570 \DeclareUnicodeCharacter{00F6}{\"o}%
10571 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10572 \DeclareUnicodeCharacter{00F8}{\o}%
10573 \DeclareUnicodeCharacter{00F9}{\`u}%
10574 \DeclareUnicodeCharacter{00FA}{\'u}%
10575 \DeclareUnicodeCharacter{00FB}{\^u}%
10576 \DeclareUnicodeCharacter{00FC}{\"u}%
10577 \DeclareUnicodeCharacter{00FD}{\'y}%
10578 \DeclareUnicodeCharacter{00FE}{\th}%
10579 \DeclareUnicodeCharacter{00FF}{\"y}%
10581 \DeclareUnicodeCharacter{0100}{\=A}%
10582 \DeclareUnicodeCharacter{0101}{\=a}%
10583 \DeclareUnicodeCharacter{0102}{\u{A}}%
10584 \DeclareUnicodeCharacter{0103}{\u{a}}%
10585 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10586 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10587 \DeclareUnicodeCharacter{0106}{\'C}%
10588 \DeclareUnicodeCharacter{0107}{\'c}%
10589 \DeclareUnicodeCharacter{0108}{\^C}%
10590 \DeclareUnicodeCharacter{0109}{\^c}%
10591 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10592 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10593 \DeclareUnicodeCharacter{010C}{\v{C}}%
10594 \DeclareUnicodeCharacter{010D}{\v{c}}%
10595 \DeclareUnicodeCharacter{010E}{\v{D}}%
10596 \DeclareUnicodeCharacter{010F}{d'}%
10598 \DeclareUnicodeCharacter{0110}{\DH}%
10599 \DeclareUnicodeCharacter{0111}{\dh}%
10600 \DeclareUnicodeCharacter{0112}{\=E}%
10601 \DeclareUnicodeCharacter{0113}{\=e}%
10602 \DeclareUnicodeCharacter{0114}{\u{E}}%
10603 \DeclareUnicodeCharacter{0115}{\u{e}}%
10604 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10605 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10606 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10607 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10608 \DeclareUnicodeCharacter{011A}{\v{E}}%
10609 \DeclareUnicodeCharacter{011B}{\v{e}}%
10610 \DeclareUnicodeCharacter{011C}{\^G}%
10611 \DeclareUnicodeCharacter{011D}{\^g}%
10612 \DeclareUnicodeCharacter{011E}{\u{G}}%
10613 \DeclareUnicodeCharacter{011F}{\u{g}}%
10615 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10616 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10617 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10618 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10619 \DeclareUnicodeCharacter{0124}{\^H}%
10620 \DeclareUnicodeCharacter{0125}{\^h}%
10621 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10622 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10623 \DeclareUnicodeCharacter{0128}{\~I}%
10624 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10625 \DeclareUnicodeCharacter{012A}{\=I}%
10626 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10627 \DeclareUnicodeCharacter{012C}{\u{I}}%
10628 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10629 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10630 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10632 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10633 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10634 \DeclareUnicodeCharacter{0132}{IJ}%
10635 \DeclareUnicodeCharacter{0133}{ij}%
10636 \DeclareUnicodeCharacter{0134}{\^J}%
10637 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10638 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10639 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10640 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10641 \DeclareUnicodeCharacter{0139}{\'L}%
10642 \DeclareUnicodeCharacter{013A}{\'l}%
10643 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10644 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10645 \DeclareUnicodeCharacter{013D}{L'}% should kern
10646 \DeclareUnicodeCharacter{013E}{l'}% should kern
10647 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10649 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10650 \DeclareUnicodeCharacter{0141}{\L}%
10651 \DeclareUnicodeCharacter{0142}{\l}%
10652 \DeclareUnicodeCharacter{0143}{\'N}%
10653 \DeclareUnicodeCharacter{0144}{\'n}%
10654 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10655 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10656 \DeclareUnicodeCharacter{0147}{\v{N}}%
10657 \DeclareUnicodeCharacter{0148}{\v{n}}%
10658 \DeclareUnicodeCharacter{0149}{'n}%
10659 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10660 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10661 \DeclareUnicodeCharacter{014C}{\=O}%
10662 \DeclareUnicodeCharacter{014D}{\=o}%
10663 \DeclareUnicodeCharacter{014E}{\u{O}}%
10664 \DeclareUnicodeCharacter{014F}{\u{o}}%
10666 \DeclareUnicodeCharacter{0150}{\H{O}}%
10667 \DeclareUnicodeCharacter{0151}{\H{o}}%
10668 \DeclareUnicodeCharacter{0152}{\OE}%
10669 \DeclareUnicodeCharacter{0153}{\oe}%
10670 \DeclareUnicodeCharacter{0154}{\'R}%
10671 \DeclareUnicodeCharacter{0155}{\'r}%
10672 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10673 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10674 \DeclareUnicodeCharacter{0158}{\v{R}}%
10675 \DeclareUnicodeCharacter{0159}{\v{r}}%
10676 \DeclareUnicodeCharacter{015A}{\'S}%
10677 \DeclareUnicodeCharacter{015B}{\'s}%
10678 \DeclareUnicodeCharacter{015C}{\^S}%
10679 \DeclareUnicodeCharacter{015D}{\^s}%
10680 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10681 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10683 \DeclareUnicodeCharacter{0160}{\v{S}}%
10684 \DeclareUnicodeCharacter{0161}{\v{s}}%
10685 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10686 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10687 \DeclareUnicodeCharacter{0164}{\v{T}}%
10688 \DeclareUnicodeCharacter{0165}{\v{t}}%
10689 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10690 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10691 \DeclareUnicodeCharacter{0168}{\~U}%
10692 \DeclareUnicodeCharacter{0169}{\~u}%
10693 \DeclareUnicodeCharacter{016A}{\=U}%
10694 \DeclareUnicodeCharacter{016B}{\=u}%
10695 \DeclareUnicodeCharacter{016C}{\u{U}}%
10696 \DeclareUnicodeCharacter{016D}{\u{u}}%
10697 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10698 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10700 \DeclareUnicodeCharacter{0170}{\H{U}}%
10701 \DeclareUnicodeCharacter{0171}{\H{u}}%
10702 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10703 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10704 \DeclareUnicodeCharacter{0174}{\^W}%
10705 \DeclareUnicodeCharacter{0175}{\^w}%
10706 \DeclareUnicodeCharacter{0176}{\^Y}%
10707 \DeclareUnicodeCharacter{0177}{\^y}%
10708 \DeclareUnicodeCharacter{0178}{\"Y}%
10709 \DeclareUnicodeCharacter{0179}{\'Z}%
10710 \DeclareUnicodeCharacter{017A}{\'z}%
10711 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10712 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10713 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10714 \DeclareUnicodeCharacter{017E}{\v{z}}%
10715 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10717 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10718 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10719 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10720 \DeclareUnicodeCharacter{01C7}{LJ}%
10721 \DeclareUnicodeCharacter{01C8}{Lj}%
10722 \DeclareUnicodeCharacter{01C9}{lj}%
10723 \DeclareUnicodeCharacter{01CA}{NJ}%
10724 \DeclareUnicodeCharacter{01CB}{Nj}%
10725 \DeclareUnicodeCharacter{01CC}{nj}%
10726 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10727 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10728 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10730 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10731 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10732 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10733 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10734 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10736 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10737 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10738 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10739 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10740 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10741 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10743 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10744 \DeclareUnicodeCharacter{01F1}{DZ}%
10745 \DeclareUnicodeCharacter{01F2}{Dz}%
10746 \DeclareUnicodeCharacter{01F3}{dz}%
10747 \DeclareUnicodeCharacter{01F4}{\'G}%
10748 \DeclareUnicodeCharacter{01F5}{\'g}%
10749 \DeclareUnicodeCharacter{01F8}{\`N}%
10750 \DeclareUnicodeCharacter{01F9}{\`n}%
10751 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10752 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10753 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10754 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10756 \DeclareUnicodeCharacter{021E}{\v{H}}%
10757 \DeclareUnicodeCharacter{021F}{\v{h}}%
10759 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10760 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10761 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10762 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10763 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10764 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10766 \DeclareUnicodeCharacter{0232}{\=Y}%
10767 \DeclareUnicodeCharacter{0233}{\=y}%
10768 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10770 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10772 % Greek letters upper case
10773 \DeclareUnicodeCharacter{0391}{{\it A}}%
10774 \DeclareUnicodeCharacter{0392}{{\it B}}%
10775 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10776 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10777 \DeclareUnicodeCharacter{0395}{{\it E}}%
10778 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10779 \DeclareUnicodeCharacter{0397}{{\it H}}%
10780 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10781 \DeclareUnicodeCharacter{0399}{{\it I}}%
10782 \DeclareUnicodeCharacter{039A}{{\it K}}%
10783 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10784 \DeclareUnicodeCharacter{039C}{{\it M}}%
10785 \DeclareUnicodeCharacter{039D}{{\it N}}%
10786 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10787 \DeclareUnicodeCharacter{039F}{{\it O}}%
10788 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10789 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10790 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10791 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10792 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10793 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10794 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10795 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10796 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10797 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10799 % Vowels with accents
10800 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10801 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10802 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10803 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10804 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10805 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10807 % Standalone accent
10808 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10810 % Greek letters lower case
10811 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10812 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10813 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10814 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10815 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10816 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10817 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10818 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10819 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10820 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10821 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10822 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10823 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10824 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10825 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10826 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10827 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10828 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10829 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10830 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10831 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10832 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10833 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10834 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10835 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10837 % More Greek vowels with accents
10838 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10839 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10840 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10841 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10842 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10844 % Variant Greek letters
10845 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10846 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10847 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10849 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10850 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10851 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10852 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10853 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10854 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10855 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10856 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10857 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10858 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10859 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10860 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10862 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10863 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10865 \DeclareUnicodeCharacter{1E20}{\=G}%
10866 \DeclareUnicodeCharacter{1E21}{\=g}%
10867 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10868 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10869 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10870 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10871 \DeclareUnicodeCharacter{1E26}{\"H}%
10872 \DeclareUnicodeCharacter{1E27}{\"h}%
10874 \DeclareUnicodeCharacter{1E30}{\'K}%
10875 \DeclareUnicodeCharacter{1E31}{\'k}%
10876 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10877 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10878 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10879 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10880 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10881 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10882 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10883 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10884 \DeclareUnicodeCharacter{1E3E}{\'M}%
10885 \DeclareUnicodeCharacter{1E3F}{\'m}%
10887 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10888 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10889 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10890 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10891 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10892 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10893 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10894 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10895 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10896 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10898 \DeclareUnicodeCharacter{1E54}{\'P}%
10899 \DeclareUnicodeCharacter{1E55}{\'p}%
10900 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10901 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10902 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10903 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10904 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10905 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10906 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10907 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10909 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10910 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10911 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10912 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10913 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10914 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10915 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10916 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10917 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10918 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10920 \DeclareUnicodeCharacter{1E7C}{\~V}%
10921 \DeclareUnicodeCharacter{1E7D}{\~v}%
10922 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10923 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10925 \DeclareUnicodeCharacter{1E80}{\`W}%
10926 \DeclareUnicodeCharacter{1E81}{\`w}%
10927 \DeclareUnicodeCharacter{1E82}{\'W}%
10928 \DeclareUnicodeCharacter{1E83}{\'w}%
10929 \DeclareUnicodeCharacter{1E84}{\"W}%
10930 \DeclareUnicodeCharacter{1E85}{\"w}%
10931 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10932 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10933 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10934 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10935 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10936 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10937 \DeclareUnicodeCharacter{1E8C}{\"X}%
10938 \DeclareUnicodeCharacter{1E8D}{\"x}%
10939 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10940 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10942 \DeclareUnicodeCharacter{1E90}{\^Z}%
10943 \DeclareUnicodeCharacter{1E91}{\^z}%
10944 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10945 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10946 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10947 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
10948 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
10949 \DeclareUnicodeCharacter{1E97}{\"t}%
10950 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
10951 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
10953 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
10954 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
10956 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
10957 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
10958 \DeclareUnicodeCharacter{1EBC}{\~E}%
10959 \DeclareUnicodeCharacter{1EBD}{\~e}%
10961 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
10962 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
10963 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
10964 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
10966 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
10967 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
10969 \DeclareUnicodeCharacter{1EF2}{\`Y}%
10970 \DeclareUnicodeCharacter{1EF3}{\`y}%
10971 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
10973 \DeclareUnicodeCharacter{1EF8}{\~Y}%
10974 \DeclareUnicodeCharacter{1EF9}{\~y}%
10976 % Punctuation
10977 \DeclareUnicodeCharacter{2013}{--}%
10978 \DeclareUnicodeCharacter{2014}{---}%
10979 \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
10980 \DeclareUnicodeCharacter{2019}{\quoteright{}}%
10981 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
10982 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
10983 \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
10984 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
10985 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
10986 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
10987 \DeclareUnicodeCharacter{2022}{\bullet{}}%
10988 \DeclareUnicodeCharacter{202F}{\thinspace}%
10989 \DeclareUnicodeCharacter{2026}{\dots{}}%
10990 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
10991 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
10993 \DeclareUnicodeCharacter{20AC}{\euro{}}%
10995 \DeclareUnicodeCharacter{2192}{\expansion{}}%
10996 \DeclareUnicodeCharacter{21D2}{\result{}}%
10998 % Mathematical symbols
10999 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
11000 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
11001 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
11002 \DeclareUnicodeCharacter{2212}{\minus{}}%
11003 \DeclareUnicodeCharacter{2217}{\ast}%
11004 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
11005 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
11006 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
11007 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
11008 \DeclareUnicodeCharacter{2261}{\equiv{}}%
11009 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
11010 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
11011 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
11012 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
11014 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
11015 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
11016 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
11017 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
11018 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
11019 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
11020 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
11021 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
11022 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
11023 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
11024 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
11025 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
11026 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
11027 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
11028 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
11029 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
11030 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
11031 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
11032 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
11033 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
11034 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
11035 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
11036 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
11037 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
11038 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
11039 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
11040 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
11041 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
11042 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
11043 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
11044 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
11045 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
11046 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
11047 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
11048 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
11049 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
11050 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
11051 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
11052 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
11053 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
11054 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
11055 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
11056 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
11057 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
11058 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
11059 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
11060 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
11061 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
11062 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
11063 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
11064 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
11065 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
11066 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
11067 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
11068 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
11069 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
11070 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
11071 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
11072 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11073 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11074 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11075 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11076 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11077 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11078 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11079 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11080 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11081 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11082 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11083 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11084 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11085 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11086 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11087 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11088 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11089 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11090 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11091 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11092 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11093 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11094 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11095 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11096 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11097 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11098 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11099 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11100 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11101 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11102 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11103 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11104 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11106 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11107 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11108 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11109 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11110 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
11111 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11112 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11113 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11114 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11115 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11116 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11117 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11118 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11119 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11120 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11121 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11122 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11123 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11124 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11125 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11126 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11127 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11128 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11129 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11130 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11131 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11132 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11133 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11134 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11136 \global\mathchardef\checkmark="1370% actually the square root sign
11137 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11138 }% end of \unicodechardefs
11140 % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11141 % It makes the setting that replace UTF-8 byte sequence.
11142 \def\utfeightchardefs{%
11143 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11144 \unicodechardefs
11147 % Whether the active definitions of non-ASCII characters expand to
11148 % non-active tokens with the same character code. This is used to
11149 % write characters literally, instead of using active definitions for
11150 % printing the correct glyphs.
11151 \newif\ifpassthroughchars
11152 \passthroughcharsfalse
11154 % For native Unicode handling (XeTeX and LuaTeX),
11155 % provide a definition macro to replace/pass-through a Unicode character
11157 \def\DeclareUnicodeCharacterNative#1#2{%
11158 \catcode"#1=\active
11159 \def\dodeclareunicodecharacternative##1##2##3{%
11160 \begingroup
11161 \uccode`\~="##2\relax
11162 \uppercase{\gdef~}{%
11163 \ifpassthroughchars
11164 ##1%
11165 \else
11166 ##3%
11169 \endgroup
11171 \begingroup
11172 \uccode`\.="#1\relax
11173 \uppercase{\def\UTFNativeTmp{.}}%
11174 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11175 \endgroup
11178 % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11179 % It activates the setting that replaces Unicode characters.
11180 \def\nativeunicodechardefs{%
11181 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11182 \unicodechardefs
11185 % For native Unicode handling (XeTeX and LuaTeX),
11186 % make the character token expand
11187 % to the sequences given in \unicodechardefs for printing.
11188 \def\DeclareUnicodeCharacterNativeAtU#1#2{%
11189 \def\UTFAtUTmp{#2}
11190 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11193 % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11194 \def\nativeunicodechardefsatu{%
11195 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11196 \unicodechardefs
11199 % US-ASCII character definitions.
11200 \def\asciichardefs{% nothing need be done
11201 \relax
11204 % define all Unicode characters we know about, for the sake of @U.
11205 \iftxinativeunicodecapable
11206 \nativeunicodechardefsatu
11207 \else
11208 \utfeightchardefs
11212 % Make non-ASCII characters printable again for compatibility with
11213 % existing Texinfo documents that may use them, even without declaring a
11214 % document encoding.
11216 \setnonasciicharscatcode \other
11219 \message{formatting,}
11221 \newdimen\defaultparindent \defaultparindent = 15pt
11223 \chapheadingskip = 15pt plus 4pt minus 2pt
11224 \secheadingskip = 12pt plus 3pt minus 2pt
11225 \subsecheadingskip = 9pt plus 2pt minus 2pt
11227 % Prevent underfull vbox error messages.
11228 \vbadness = 10000
11230 % Don't be very finicky about underfull hboxes, either.
11231 \hbadness = 6666
11233 % Following George Bush, get rid of widows and orphans.
11234 \widowpenalty=10000
11235 \clubpenalty=10000
11237 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11238 % using an old version of TeX, don't do anything. We want the amount of
11239 % stretch added to depend on the line length, hence the dependence on
11240 % \hsize. We call this whenever the paper size is set.
11242 \def\setemergencystretch{%
11243 \ifx\emergencystretch\thisisundefined
11244 % Allow us to assign to \emergencystretch anyway.
11245 \def\emergencystretch{\dimen0}%
11246 \else
11247 \emergencystretch = .15\hsize
11251 % Parameters in order: 1) textheight; 2) textwidth;
11252 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11253 % 7) physical page height; 8) physical page width.
11255 % We also call \setleading{\textleading}, so the caller should define
11256 % \textleading. The caller should also set \parskip.
11258 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
11259 \voffset = #3\relax
11260 \topskip = #6\relax
11261 \splittopskip = \topskip
11263 \vsize = #1\relax
11264 \advance\vsize by \topskip
11265 \outervsize = \vsize
11266 \advance\outervsize by 2\topandbottommargin
11267 \txipageheight = \vsize
11269 \hsize = #2\relax
11270 \outerhsize = \hsize
11271 \advance\outerhsize by 0.5in
11272 \txipagewidth = \hsize
11274 \normaloffset = #4\relax
11275 \bindingoffset = #5\relax
11277 \ifpdf
11278 \pdfpageheight #7\relax
11279 \pdfpagewidth #8\relax
11280 % if we don't reset these, they will remain at "1 true in" of
11281 % whatever layout pdftex was dumped with.
11282 \pdfhorigin = 1 true in
11283 \pdfvorigin = 1 true in
11284 \else
11285 \ifx\XeTeXrevision\thisisundefined
11286 \special{papersize=#8,#7}%
11287 \else
11288 \pdfpageheight #7\relax
11289 \pdfpagewidth #8\relax
11290 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11294 \setleading{\textleading}
11296 \parindent = \defaultparindent
11297 \setemergencystretch
11300 % @letterpaper (the default).
11301 \def\letterpaper{{\globaldefs = 1
11302 \parskip = 3pt plus 2pt minus 1pt
11303 \textleading = 13.2pt
11305 % If page is nothing but text, make it come out even.
11306 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11307 {\voffset}{.25in}%
11308 {\bindingoffset}{36pt}%
11309 {11in}{8.5in}%
11312 % Use @smallbook to reset parameters for 7x9.25 trim size.
11313 \def\smallbook{{\globaldefs = 1
11314 \parskip = 2pt plus 1pt
11315 \textleading = 12pt
11317 \internalpagesizes{7.5in}{5in}%
11318 {-.2in}{0in}%
11319 {\bindingoffset}{16pt}%
11320 {9.25in}{7in}%
11322 \lispnarrowing = 0.3in
11323 \tolerance = 700
11324 \contentsrightmargin = 0pt
11325 \defbodyindent = .5cm
11328 % Use @smallerbook to reset parameters for 6x9 trim size.
11329 % (Just testing, parameters still in flux.)
11330 \def\smallerbook{{\globaldefs = 1
11331 \parskip = 1.5pt plus 1pt
11332 \textleading = 12pt
11334 \internalpagesizes{7.4in}{4.8in}%
11335 {-.2in}{-.4in}%
11336 {0pt}{14pt}%
11337 {9in}{6in}%
11339 \lispnarrowing = 0.25in
11340 \tolerance = 700
11341 \contentsrightmargin = 0pt
11342 \defbodyindent = .4cm
11345 % Use @afourpaper to print on European A4 paper.
11346 \def\afourpaper{{\globaldefs = 1
11347 \parskip = 3pt plus 2pt minus 1pt
11348 \textleading = 13.2pt
11350 % Double-side printing via postscript on Laserjet 4050
11351 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11352 % To change the settings for a different printer or situation, adjust
11353 % \normaloffset until the front-side and back-side texts align. Then
11354 % do the same for \bindingoffset. You can set these for testing in
11355 % your texinfo source file like this:
11356 % @tex
11357 % \global\normaloffset = -6mm
11358 % \global\bindingoffset = 10mm
11359 % @end tex
11360 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11361 {\voffset}{\hoffset}%
11362 {\bindingoffset}{44pt}%
11363 {297mm}{210mm}%
11365 \tolerance = 700
11366 \contentsrightmargin = 0pt
11367 \defbodyindent = 5mm
11370 % Use @afivepaper to print on European A5 paper.
11371 % From romildo@urano.iceb.ufop.br, 2 July 2000.
11372 % He also recommends making @example and @lisp be small.
11373 \def\afivepaper{{\globaldefs = 1
11374 \parskip = 2pt plus 1pt minus 0.1pt
11375 \textleading = 12.5pt
11377 \internalpagesizes{160mm}{120mm}%
11378 {\voffset}{\hoffset}%
11379 {\bindingoffset}{8pt}%
11380 {210mm}{148mm}%
11382 \lispnarrowing = 0.2in
11383 \tolerance = 800
11384 \contentsrightmargin = 0pt
11385 \defbodyindent = 2mm
11386 \tableindent = 12mm
11389 % A specific text layout, 24x15cm overall, intended for A4 paper.
11390 \def\afourlatex{{\globaldefs = 1
11391 \afourpaper
11392 \internalpagesizes{237mm}{150mm}%
11393 {\voffset}{4.6mm}%
11394 {\bindingoffset}{7mm}%
11395 {297mm}{210mm}%
11397 % Must explicitly reset to 0 because we call \afourpaper.
11398 \globaldefs = 0
11401 % Use @afourwide to print on A4 paper in landscape format.
11402 \def\afourwide{{\globaldefs = 1
11403 \afourpaper
11404 \internalpagesizes{241mm}{165mm}%
11405 {\voffset}{-2.95mm}%
11406 {\bindingoffset}{7mm}%
11407 {297mm}{210mm}%
11408 \globaldefs = 0
11411 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11412 % Perhaps we should allow setting the margins, \topskip, \parskip,
11413 % and/or leading, also. Or perhaps we should compute them somehow.
11415 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11416 \def\pagesizesyyy#1,#2,#3\finish{{%
11417 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11418 \globaldefs = 1
11420 \parskip = 3pt plus 2pt minus 1pt
11421 \setleading{\textleading}%
11423 \dimen0 = #1\relax
11424 \advance\dimen0 by \voffset
11425 \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
11427 \dimen2 = \hsize
11428 \advance\dimen2 by \normaloffset
11429 \advance\dimen2 by 1in % reference point is 1 inch from left edge of page
11431 \internalpagesizes{#1}{\hsize}%
11432 {\voffset}{\normaloffset}%
11433 {\bindingoffset}{44pt}%
11434 {\dimen0}{\dimen2}%
11437 % Set default to letter.
11439 \letterpaper
11441 % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
11442 \hfuzz = 1pt
11445 \message{and turning on texinfo input format.}
11447 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
11449 % DEL is a comment character, in case @c does not suffice.
11450 \catcode`\^^? = 14
11452 % Define macros to output various characters with catcode for normal text.
11453 \catcode`\"=\other \def\normaldoublequote{"}
11454 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11455 \catcode`\+=\other \def\normalplus{+}
11456 \catcode`\<=\other \def\normalless{<}
11457 \catcode`\>=\other \def\normalgreater{>}
11458 \catcode`\^=\other \def\normalcaret{^}
11459 \catcode`\_=\other \def\normalunderscore{_}
11460 \catcode`\|=\other \def\normalverticalbar{|}
11461 \catcode`\~=\other \def\normaltilde{~}
11463 % This macro is used to make a character print one way in \tt
11464 % (where it can probably be output as-is), and another way in other fonts,
11465 % where something hairier probably needs to be done.
11467 % #1 is what to print if we are indeed using \tt; #2 is what to print
11468 % otherwise. Since all the Computer Modern typewriter fonts have zero
11469 % interword stretch (and shrink), and it is reasonable to expect all
11470 % typewriter fonts to have this, we can check that font parameter.
11472 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
11474 % Same as above, but check for italic font. Actually this also catches
11475 % non-italic slanted fonts since it is impossible to distinguish them from
11476 % italic fonts. But since this is only used by $ and it uses \sl anyway
11477 % this is not a problem.
11478 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
11480 % Set catcodes for Texinfo file
11482 % Active characters for printing the wanted glyph.
11483 % Most of these we simply print from the \tt font, but for some, we can
11484 % use math or other variants that look better in normal text.
11486 \catcode`\"=\active
11487 \def\activedoublequote{{\tt\char34}}
11488 \let"=\activedoublequote
11489 \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11490 \chardef\hatchar=`\^
11491 \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11493 \catcode`\_=\active
11494 \def_{\ifusingtt\normalunderscore\_}
11495 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11496 \let\realunder=_
11498 \catcode`\|=\active \def|{{\tt\char124}}
11500 \chardef \less=`\<
11501 \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11502 \chardef \gtr=`\>
11503 \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11504 \catcode`\+=\active \def+{{\tt \char 43}}
11505 \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11506 \catcode`\-=\active \let-=\normaldash
11509 % used for headline/footline in the output routine, in case the page
11510 % breaks in the middle of an @tex block.
11511 \def\texinfochars{%
11512 \let< = \activeless
11513 \let> = \activegtr
11514 \let~ = \activetilde
11515 \let^ = \activehat
11516 \markupsetuplqdefault \markupsetuprqdefault
11517 \let\b = \strong
11518 \let\i = \smartitalic
11519 % in principle, all other definitions in \tex have to be undone too.
11522 % Used sometimes to turn off (effectively) the active characters even after
11523 % parsing them.
11524 \def\turnoffactive{%
11525 \normalturnoffactive
11526 \otherbackslash
11529 \catcode`\@=0
11531 % \backslashcurfont outputs one backslash character in current font,
11532 % as in \char`\\.
11533 \global\chardef\backslashcurfont=`\\
11534 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
11536 % \realbackslash is an actual character `\' with catcode other, and
11537 % \doublebackslash is two of them (for the pdf outlines).
11538 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
11540 % In Texinfo, backslash is an active character; it prints the backslash
11541 % in fixed width font.
11542 \catcode`\\=\active % @ for escape char from now on.
11544 % Print a typewriter backslash. For math mode, we can't simply use
11545 % \backslashcurfont: the story here is that in math mode, the \char
11546 % of \backslashcurfont ends up printing the roman \ from the math symbol
11547 % font (because \char in math mode uses the \mathcode, and plain.tex
11548 % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11549 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11550 % ignored family value; char position "5C). We can't use " for the
11551 % usual hex value because it has already been made active.
11553 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11554 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11556 % \rawbackslash defines an active \ to do \backslashcurfont.
11557 % \otherbackslash defines an active \ to be a literal `\' character with
11558 % catcode other. We switch back and forth between these.
11559 @gdef@rawbackslash{@let\=@backslashcurfont}
11560 @gdef@otherbackslash{@let\=@realbackslash}
11562 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11563 % the literal character `\'.
11565 {@catcode`- = @active
11566 @gdef@normalturnoffactive{%
11567 @passthroughcharstrue
11568 @let-=@normaldash
11569 @let"=@normaldoublequote
11570 @let$=@normaldollar %$ font-lock fix
11571 @let+=@normalplus
11572 @let<=@normalless
11573 @let>=@normalgreater
11574 @let^=@normalcaret
11575 @let_=@normalunderscore
11576 @let|=@normalverticalbar
11577 @let~=@normaltilde
11578 @let\=@ttbackslash
11579 @markupsetuplqdefault
11580 @markupsetuprqdefault
11581 @unsepspaces
11585 % If a .fmt file is being used, characters that might appear in a file
11586 % name cannot be active until we have parsed the command line.
11587 % So turn them off again, and have @fixbackslash turn them back on.
11588 @catcode`+=@other @catcode`@_=@other
11590 % \enablebackslashhack - allow file to begin `\input texinfo'
11592 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11593 % That is what \eatinput is for; after that, the `\' should revert to printing
11594 % a backslash.
11595 % If the file did not have a `\input texinfo', then it is turned off after
11596 % the first line; otherwise the first `\' in the file would cause an error.
11597 % This is used on the very last line of this file, texinfo.tex.
11598 % We also use @c to call @fixbackslash, in case ends of lines are hidden.
11600 @catcode`@^=7
11601 @catcode`@^^M=13@gdef@enablebackslashhack{%
11602 @global@let\ = @eatinput%
11603 @catcode`@^^M=13%
11604 @def@c{@fixbackslash@c}%
11605 % Definition for the newline at the end of this file.
11606 @def ^^M{@let^^M@secondlinenl}%
11607 % Definition for a newline in the main Texinfo file.
11608 @gdef @secondlinenl{@fixbackslash}%
11609 % In case the first line has a whole-line command on it
11610 @let@originalparsearg@parsearg
11611 @def@parsearg{@fixbackslash@originalparsearg}
11614 {@catcode`@^=7 @catcode`@^^M=13%
11615 @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11617 % Emergency active definition of newline, in case an active newline token
11618 % appears by mistake.
11619 {@catcode`@^=7 @catcode13=13%
11620 @gdef@enableemergencynewline{%
11621 @gdef^^M{%
11622 @par%
11623 %<warning: active newline>@par%
11627 @gdef@fixbackslash{%
11628 @ifx\@eatinput @let\ = @ttbackslash @fi
11629 @catcode13=5 % regular end of line
11630 @enableemergencynewline
11631 @let@c=@texinfoc
11632 @let@parsearg@originalparsearg
11633 % Also turn back on active characters that might appear in the input
11634 % file name, in case not using a pre-dumped format.
11635 @catcode`+=@active
11636 @catcode`@_=@active
11638 % If texinfo.cnf is present on the system, read it.
11639 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11640 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11641 % directly in this file, texinfo.tex, makes it possible to make a format
11642 % file for Texinfo.
11644 @openin 1 texinfo.cnf
11645 @ifeof 1 @else @input texinfo.cnf @fi
11646 @closein 1
11650 % Say @foo, not \foo, in error messages.
11651 @escapechar = `@@
11653 % These (along with & and #) are made active for url-breaking, so need
11654 % active definitions as the normal characters.
11655 @def@normaldot{.}
11656 @def@normalquest{?}
11657 @def@normalslash{/}
11659 % These look ok in all fonts, so just make them not special.
11660 % @hashchar{} gets its own user-level command, because of #line.
11661 @catcode`@& = @other @def@normalamp{&}
11662 @catcode`@# = @other @def@normalhash{#}
11663 @catcode`@% = @other @def@normalpercent{%}
11665 @let @hashchar = @normalhash
11667 @c Finally, make ` and ' active, so that txicodequoteundirected and
11668 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11669 @c don't make ` and ' active, @code will not get them as active chars.
11670 @c Do this last of all since we use ` in the previous @catcode assignments.
11671 @catcode`@'=@active
11672 @catcode`@`=@active
11673 @markupsetuplqdefault
11674 @markupsetuprqdefault
11676 @c Local variables:
11677 @c eval: (add-hook 'write-file-hooks 'time-stamp)
11678 @c page-delimiter: "^\\\\message\\|emacs-page"
11679 @c time-stamp-start: "def\\\\texinfoversion{"
11680 @c time-stamp-format: "%:y-%02m-%02d.%02H"
11681 @c time-stamp-end: "}"
11682 @c End:
11684 @c vim:sw=2:
11686 @enablebackslashhack