VirtualBox

source: kBuild/vendor/grep/current/build-aux/texinfo.tex@ 3530

Last change on this file since 3530 was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

File size: 365.5 KB
Line 
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
5%
6\def\texinfoversion{2021-04-25.21}
7%
8% Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc.
9%
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.
14%
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.
19%
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/>.
22%
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").
27%
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.
35%
36% Send bug reports to bug-texinfo@gnu.org. Please include a
37% complete document in each bug report with which we can reproduce the
38% problem. Patches are, of course, greatly appreciated.
39%
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.
51%
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.
55%
56% The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
57
58
59\message{Loading texinfo [version \texinfoversion]:}
60
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}
66
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}%
70
71\chardef\other=12
72
73% We never want plain's \outer definition of \+ in Texinfo.
74% For @tex, we can use \tabalign.
75\let\+ = \relax
76
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
107
108% If this character appears in an error message or help string, it
109% starts a new line in the output.
110\newlinechar = `^^J
111
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.
114%
115\ifx\inputlineno\thisisundefined
116 \let\linenumber = \empty % Pre-3.0.
117\else
118 \def\linenumber{l.\the\inputlineno:\space}
119\fi
120
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
142%
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
155%
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
161
162% Give the space character the catcode for a space.
163\def\spaceisspace{\catcode`\ =10\relax}
164
165% Likewise for ^^M, the end of line character.
166\def\endlineisspace{\catcode13=10\relax}
167
168\chardef\dashChar = `\-
169\chardef\slashChar = `\/
170\chardef\underChar = `\_
171
172% Ignore a token.
173%
174\def\gobble#1{}
175
176% The following is used inside several \edef's.
177\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
178
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
189}
190
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.
196%
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
213 \fi
214 \tracingcommands3 % 3 gives us more in etex
215 \errorcontextlines16
216}%
217
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.
221%
222\def\errormsg{\begingroup \indexnofonts \doerrormsg}
223\def\doerrormsg#1{\errmessage{#1}}
224
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.
227%
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}
234
235%
236 Output routine
237%
238
239% For a final copy, take out the rectangles
240% that mark overfull boxes (in case you have decided
241% that the text looks ok even though it passes the margin).
242%
243\def\finalout{\overfullrule=0pt }
244
245\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
246\newdimen\topandbottommargin \topandbottommargin=.75in
247
248% Output a mark which sets \thischapter, \thissection and \thiscolor.
249% We dump everything together because we only have one kind of mark.
250% This works because we only use \botmark / \topmark, not \firstmark.
251%
252% A mark contains a subexpression of the \ifcase ... \fi construct.
253% \get*marks macros below extract the needed part using \ifcase.
254%
255% Another complication is to let the user choose whether \thischapter
256% (\thissection) refers to the chapter (section) in effect at the top
257% of a page, or that at the bottom of a page.
258
259% \domark is called twice inside \chapmacro, to add one
260% mark before the section break, and one after.
261% In the second call \prevchapterdefs is the same as \currentchapterdefs,
262% and \prevsectiondefs is the same as \currentsectiondefs.
263% Then if the page is not broken at the mark, some of the previous
264% section appears on the page, and we can get the name of this section
265% from \firstmark for @everyheadingmarks top.
266% @everyheadingmarks bottom uses \botmark.
267%
268% See page 260 of The TeXbook.
269\def\domark{%
270 \toks0=\expandafter{\currentchapterdefs}%
271 \toks2=\expandafter{\currentsectiondefs}%
272 \toks4=\expandafter{\prevchapterdefs}%
273 \toks6=\expandafter{\prevsectiondefs}%
274 \toks8=\expandafter{\currentcolordefs}%
275 \mark{%
276 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
277 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
278 \noexpand\else \the\toks8 % 2: color marks
279 }%
280}
281
282% \gettopheadingmarks, \getbottomheadingmarks,
283% \getcolormarks - extract needed part of mark.
284%
285% \topmark doesn't work for the very first chapter (after the title
286% page or the contents), so we use \firstmark there -- this gets us
287% the mark with the chapter defs, unless the user sneaks in, e.g.,
288% @setcolor (or @url, or @link, etc.) between @contents and the very
289% first @chapter.
290\def\gettopheadingmarks{%
291 \ifcase0\the\savedtopmark\fi
292 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
293}
294\def\getbottomheadingmarks{\ifcase1\botmark\fi}
295\def\getcolormarks{\ifcase2\the\savedtopmark\fi}
296
297% Avoid "undefined control sequence" errors.
298\def\currentchapterdefs{}
299\def\currentsectiondefs{}
300\def\currentsection{}
301\def\prevchapterdefs{}
302\def\prevsectiondefs{}
303\def\currentcolordefs{}
304
305% Margin to add to right of even pages, to left of odd pages.
306\newdimen\bindingoffset
307\newdimen\normaloffset
308\newdimen\txipagewidth \newdimen\txipageheight
309
310% Main output routine.
311%
312\chardef\PAGE = 255
313\newtoks\defaultoutput
314\defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
315\output=\expandafter{\the\defaultoutput}
316
317\newbox\headlinebox
318\newbox\footlinebox
319
320% When outputting the double column layout for indices, an output routine
321% is run several times, which hides the original value of \topmark. This
322% can lead to a page heading being output and duplicating the chapter heading
323% of the index. Hence, save the contents of \topmark at the beginning of
324% the output routine. The saved contents are valid until we actually
325% \shipout a page.
326%
327% (We used to run a short output routine to actually set \topmark and
328% \firstmark to the right values, but if this was called with an empty page
329% containing whatsits for writing index entries, the whatsits would be thrown
330% away and the index auxiliary file would remain empty.)
331%
332\newtoks\savedtopmark
333\newif\iftopmarksaved
334\topmarksavedtrue
335\def\savetopmark{%
336 \iftopmarksaved\else
337 \global\savedtopmark=\expandafter{\topmark}%
338 \global\topmarksavedtrue
339 \fi
340}
341
342% \onepageout takes a vbox as an argument.
343% \shipout a vbox for a single page, adding an optional header, footer
344% and footnote. This also causes index entries for this page to be written
345% to the auxiliary files.
346%
347\def\onepageout#1{%
348 \hoffset=\normaloffset
349 %
350 \ifodd\pageno \advance\hoffset by \bindingoffset
351 \else \advance\hoffset by -\bindingoffset\fi
352 %
353 \checkchapterpage
354 %
355 % Retrieve the information for the headings from the marks in the page,
356 % and call Plain TeX's \makeheadline and \makefootline, which use the
357 % values in \headline and \footline.
358 %
359 % Common context changes for both heading and footing.
360 % Do this outside of the \shipout so @code etc. will be expanded in
361 % the headline as they should be, not taken literally (outputting ''code).
362 \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
363 %
364 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
365 \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
366 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
367 \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
368 %
369 {%
370 % Set context for writing to auxiliary files like index files.
371 % Have to do this stuff outside the \shipout because we want it to
372 % take effect in \write's, yet the group defined by the \vbox ends
373 % before the \shipout runs.
374 %
375 \atdummies % don't expand commands in the output.
376 \turnoffactive
377 \shipout\vbox{%
378 % Do this early so pdf references go to the beginning of the page.
379 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
380 %
381 \unvbox\headlinebox
382 \pagebody{#1}%
383 \ifdim\ht\footlinebox > 0pt
384 % Only leave this space if the footline is nonempty.
385 % (We lessened \vsize for it in \oddfootingyyy.)
386 % The \baselineskip=24pt in plain's \makefootline has no effect.
387 \vskip 24pt
388 \unvbox\footlinebox
389 \fi
390 %
391 }%
392 }%
393 \global\topmarksavedfalse
394 \advancepageno
395 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
396}
397
398\newinsert\margin \dimen\margin=\maxdimen
399
400% Main part of page, including any footnotes
401\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
402{\catcode`\@ =11
403\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
404% marginal hacks, juha@viisa.uucp (Juha Takala)
405\ifvoid\margin\else % marginal info is present
406 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
407\dimen@=\dp#1\relax \unvbox#1\relax
408\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
409\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
410}
411
412% Check if we are on the first page of a chapter. Used for printing headings.
413\newif\ifchapterpage
414\def\checkchapterpage{%
415 % Get the chapter that was current at the end of the last page
416 \ifcase1\the\savedtopmark\fi
417 \let\prevchaptername\thischaptername
418 %
419 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
420 \let\curchaptername\thischaptername
421 %
422 \ifx\curchaptername\prevchaptername
423 \chapterpagefalse
424 \else
425 \chapterpagetrue
426 \fi
427}
428
429% Argument parsing
430
431% Parse an argument, then pass it to #1. The argument is the rest of
432% the input line (except we remove a trailing comment). #1 should be a
433% macro which expects an ordinary undelimited TeX argument.
434% For example, \def\foo{\parsearg\fooxxx}.
435%
436\def\parsearg{\parseargusing{}}
437\def\parseargusing#1#2{%
438 \def\argtorun{#2}%
439 \begingroup
440 \obeylines
441 \spaceisspace
442 #1%
443 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
444}
445
446{\obeylines %
447 \gdef\parseargline#1^^M{%
448 \endgroup % End of the group started in \parsearg.
449 \argremovecomment #1\comment\ArgTerm%
450 }%
451}
452
453% First remove any @comment, then any @c comment. Pass the result on to
454% \argcheckspaces.
455\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
456\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
457
458% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
459%
460% \argremovec might leave us with trailing space, e.g.,
461% @end itemize @c foo
462% This space token undergoes the same procedure and is eventually removed
463% by \finishparsearg.
464%
465\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
466\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
467\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
468 \def\temp{#3}%
469 \ifx\temp\empty
470 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
471 \let\temp\finishparsearg
472 \else
473 \let\temp\argcheckspaces
474 \fi
475 % Put the space token in:
476 \temp#1 #3\ArgTerm
477}
478
479% If a _delimited_ argument is enclosed in braces, they get stripped; so
480% to get _exactly_ the rest of the line, we had to prevent such situation.
481% We prepended an \empty token at the very beginning and we expand it now,
482% just before passing the control to \argtorun.
483% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
484% either the null string, or it ends with \^^M---thus there is no danger
485% that a pair of braces would be stripped.
486%
487% But first, we have to remove the trailing space token.
488%
489\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
490
491
492% \parseargdef - define a command taking an argument on the line
493%
494% \parseargdef\foo{...}
495% is roughly equivalent to
496% \def\foo{\parsearg\Xfoo}
497% \def\Xfoo#1{...}
498\def\parseargdef#1{%
499 \expandafter \doparseargdef \csname\string#1\endcsname #1%
500}
501\def\doparseargdef#1#2{%
502 \def#2{\parsearg#1}%
503 \def#1##1%
504}
505
506% Several utility definitions with active space:
507{
508 \obeyspaces
509 \gdef\obeyedspace{ }
510
511 % Make each space character in the input produce a normal interword
512 % space in the output. Don't allow a line break at this space, as this
513 % is used only in environments like @example, where each line of input
514 % should produce a line of output anyway.
515 %
516 \gdef\sepspaces{\obeyspaces\let =\tie}
517
518 % If an index command is used in an @example environment, any spaces
519 % therein should become regular spaces in the raw index file, not the
520 % expansion of \tie (\leavevmode \penalty \@M \ ).
521 \gdef\unsepspaces{\let =\space}
522}
523
524
525\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
526
527% Define the framework for environments in texinfo.tex. It's used like this:
528%
529% \envdef\foo{...}
530% \def\Efoo{...}
531%
532% It's the responsibility of \envdef to insert \begingroup before the
533% actual body; @end closes the group after calling \Efoo. \envdef also
534% defines \thisenv, so the current environment is known; @end checks
535% whether the environment name matches. The \checkenv macro can also be
536% used to check whether the current environment is the one expected.
537%
538% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
539% are not treated as environments; they don't open a group. (The
540% implementation of @end takes care not to call \endgroup in this
541% special case.)
542
543
544% At run-time, environments start with this:
545\def\startenvironment#1{\begingroup\def\thisenv{#1}}
546% initialize
547\let\thisenv\empty
548
549% ... but they get defined via ``\envdef\foo{...}'':
550\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
551\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
552
553% Check whether we're in the right environment:
554\def\checkenv#1{%
555 \def\temp{#1}%
556 \ifx\thisenv\temp
557 \else
558 \badenverr
559 \fi
560}
561
562% Environment mismatch, #1 expected:
563\def\badenverr{%
564 \errhelp = \EMsimple
565 \errmessage{This command can appear only \inenvironment\temp,
566 not \inenvironment\thisenv}%
567}
568\def\inenvironment#1{%
569 \ifx#1\empty
570 outside of any environment%
571 \else
572 in environment \expandafter\string#1%
573 \fi
574}
575
576
577% @end foo calls \checkenv and executes the definition of \Efoo.
578\parseargdef\end{%
579 \if 1\csname iscond.#1\endcsname
580 \else
581 % The general wording of \badenverr may not be ideal.
582 \expandafter\checkenv\csname#1\endcsname
583 \csname E#1\endcsname
584 \endgroup
585 \fi
586}
587
588\newhelp\EMsimple{Press RETURN to continue.}
589
590
591% Be sure we're in horizontal mode when doing a tie, since we make space
592% equivalent to this in @example-like environments. Otherwise, a space
593% at the beginning of a line will start with \penalty -- and
594% since \penalty is valid in vertical mode, we'd end up putting the
595% penalty on the vertical list instead of in the new paragraph.
596{\catcode`@ = 11
597 % Avoid using \@M directly, because that causes trouble
598 % if the definition is written into an index file.
599 \global\let\tiepenalty = \@M
600 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
601}
602
603% @: forces normal size whitespace following.
604\def\:{\spacefactor=1000 }
605
606% @* forces a line break.
607\def\*{\unskip\hfil\break\hbox{}\ignorespaces}
608
609% @/ allows a line break.
610\let\/=\allowbreak
611
612% @. is an end-of-sentence period.
613\def\.{.\spacefactor=\endofsentencespacefactor\space}
614
615% @! is an end-of-sentence bang.
616\def\!{!\spacefactor=\endofsentencespacefactor\space}
617
618% @? is an end-of-sentence query.
619\def\?{?\spacefactor=\endofsentencespacefactor\space}
620
621% @frenchspacing on|off says whether to put extra space after punctuation.
622%
623\def\onword{on}
624\def\offword{off}
625%
626\parseargdef\frenchspacing{%
627 \def\temp{#1}%
628 \ifx\temp\onword \plainfrenchspacing
629 \else\ifx\temp\offword \plainnonfrenchspacing
630 \else
631 \errhelp = \EMsimple
632 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
633 \fi\fi
634}
635
636% @w prevents a word break. Without the \leavevmode, @w at the
637% beginning of a paragraph, when TeX is still in vertical mode, would
638% produce a whole line of output instead of starting the paragraph.
639\def\w#1{\leavevmode\hbox{#1}}
640
641% @group ... @end group forces ... to be all on one page, by enclosing
642% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
643% to keep its height that of a normal line. According to the rules for
644% \topskip (p.114 of the TeXbook), the glue inserted is
645% max (\topskip - \ht (first item), 0). If that height is large,
646% therefore, no glue is inserted, and the space between the headline and
647% the text is small, which looks bad.
648%
649% Another complication is that the group might be very large. This can
650% cause the glue on the previous page to be unduly stretched, because it
651% does not have much material. In this case, it's better to add an
652% explicit \vfill so that the extra space is at the bottom. The
653% threshold for doing this is if the group is more than \vfilllimit
654% percent of a page (\vfilllimit can be changed inside of @tex).
655%
656\newbox\groupbox
657\def\vfilllimit{0.7}
658%
659\envdef\group{%
660 \ifnum\catcode`\^^M=\active \else
661 \errhelp = \groupinvalidhelp
662 \errmessage{@group invalid in context where filling is enabled}%
663 \fi
664 \startsavinginserts
665 %
666 \setbox\groupbox = \vtop\bgroup
667 % Do @comment since we are called inside an environment such as
668 % @example, where each end-of-line in the input causes an
669 % end-of-line in the output. We don't want the end-of-line after
670 % the `@group' to put extra space in the output. Since @group
671 % should appear on a line by itself (according to the Texinfo
672 % manual), we don't worry about eating any user text.
673 \comment
674}
675%
676% The \vtop produces a box with normal height and large depth; thus, TeX puts
677% \baselineskip glue before it, and (when the next line of text is done)
678% \lineskip glue after it. Thus, space below is not quite equal to space
679% above. But it's pretty close.
680\def\Egroup{%
681 % To get correct interline space between the last line of the group
682 % and the first line afterwards, we have to propagate \prevdepth.
683 \endgraf % Not \par, as it may have been set to \lisppar.
684 \global\dimen1 = \prevdepth
685 \egroup % End the \vtop.
686 \addgroupbox
687 \prevdepth = \dimen1
688 \checkinserts
689}
690
691\def\addgroupbox{
692 % \dimen0 is the vertical size of the group's box.
693 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
694 % \dimen2 is how much space is left on the page (more or less).
695 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
696 % if the group doesn't fit on the current page, and it's a big big
697 % group, force a page break.
698 \ifdim \dimen0 > \dimen2
699 \ifdim \pagetotal < \vfilllimit\txipageheight
700 \page
701 \fi
702 \fi
703 \box\groupbox
704}
705
706%
707% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
708% message, so this ends up printing `@group can only ...'.
709%
710\newhelp\groupinvalidhelp{%
711group can only be used in environments such as @example,^^J%
712where each line of input produces a line of output.}
713
714% @need space-in-mils
715% forces a page break if there is not space-in-mils remaining.
716
717\newdimen\mil \mil=0.001in
718
719\parseargdef\need{%
720 % Ensure vertical mode, so we don't make a big box in the middle of a
721 % paragraph.
722 \par
723 %
724 % If the @need value is less than one line space, it's useless.
725 \dimen0 = #1\mil
726 \dimen2 = \ht\strutbox
727 \advance\dimen2 by \dp\strutbox
728 \ifdim\dimen0 > \dimen2
729 %
730 % Do a \strut just to make the height of this box be normal, so the
731 % normal leading is inserted relative to the preceding line.
732 % And a page break here is fine.
733 \vtop to #1\mil{\strut\vfil}%
734 %
735 % TeX does not even consider page breaks if a penalty added to the
736 % main vertical list is 10000 or more. But in order to see if the
737 % empty box we just added fits on the page, we must make it consider
738 % page breaks. On the other hand, we don't want to actually break the
739 % page after the empty box. So we use a penalty of 9999.
740 %
741 % There is an extremely small chance that TeX will actually break the
742 % page at this \penalty, if there are no other feasible breakpoints in
743 % sight. (If the user is using lots of big @group commands, which
744 % almost-but-not-quite fill up a page, TeX will have a hard time doing
745 % good page breaking, for example.) However, I could not construct an
746 % example where a page broke at this \penalty; if it happens in a real
747 % document, then we can reconsider our strategy.
748 \penalty9999
749 %
750 % Back up by the size of the box, whether we did a page break or not.
751 \kern -#1\mil
752 %
753 % Do not allow a page break right after this kern.
754 \nobreak
755 \fi
756}
757
758% @br forces paragraph break (and is undocumented).
759
760\let\br = \par
761
762% @page forces the start of a new page.
763%
764\def\page{\par\vfill\supereject}
765
766% @exdent text....
767% outputs text on separate line in roman font, starting at standard page margin
768
769% This records the amount of indent in the innermost environment.
770% That's how much \exdent should take out.
771\newskip\exdentamount
772
773% This defn is used inside fill environments such as @defun.
774\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
775
776% This defn is used inside nofill environments such as @example.
777\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
778 \leftline{\hskip\leftskip{\rm#1}}}}
779
780% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
781% paragraph. For more general purposes, use the \margin insertion
782% class. WHICH is `l' or `r'. Not documented, written for gawk manual.
783%
784\newskip\inmarginspacing \inmarginspacing=1cm
785\def\strutdepth{\dp\strutbox}
786%
787\def\doinmargin#1#2{\strut\vadjust{%
788 \nobreak
789 \kern-\strutdepth
790 \vtop to \strutdepth{%
791 \baselineskip=\strutdepth
792 \vss
793 % if you have multiple lines of stuff to put here, you'll need to
794 % make the vbox yourself of the appropriate size.
795 \ifx#1l%
796 \llap{\ignorespaces #2\hskip\inmarginspacing}%
797 \else
798 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
799 \fi
800 \null
801 }%
802}}
803\def\inleftmargin{\doinmargin l}
804\def\inrightmargin{\doinmargin r}
805%
806% @inmargin{TEXT [, RIGHT-TEXT]}
807% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
808% else use TEXT for both).
809%
810\def\inmargin#1{\parseinmargin #1,,\finish}
811\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
812 \setbox0 = \hbox{\ignorespaces #2}%
813 \ifdim\wd0 > 0pt
814 \def\lefttext{#1}% have both texts
815 \def\righttext{#2}%
816 \else
817 \def\lefttext{#1}% have only one text
818 \def\righttext{#1}%
819 \fi
820 %
821 \ifodd\pageno
822 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
823 \else
824 \def\temp{\inleftmargin\lefttext}%
825 \fi
826 \temp
827}
828
829% @include FILE -- \input text of FILE.
830%
831\def\include{\parseargusing\filenamecatcodes\includezzz}
832\def\includezzz#1{%
833 \pushthisfilestack
834 \def\thisfile{#1}%
835 {%
836 \makevalueexpandable % we want to expand any @value in FILE.
837 \turnoffactive % and allow special characters in the expansion
838 \indexnofonts % Allow `@@' and other weird things in file names.
839 \wlog{texinfo.tex: doing @include of #1^^J}%
840 \edef\temp{\noexpand\input #1 }%
841 %
842 % This trickery is to read FILE outside of a group, in case it makes
843 % definitions, etc.
844 \expandafter
845 }\temp
846 \popthisfilestack
847}
848\def\filenamecatcodes{%
849 \catcode`\\=\other
850 \catcode`~=\other
851 \catcode`^=\other
852 \catcode`_=\other
853 \catcode`|=\other
854 \catcode`<=\other
855 \catcode`>=\other
856 \catcode`+=\other
857 \catcode`-=\other
858 \catcode`\`=\other
859 \catcode`\'=\other
860}
861
862\def\pushthisfilestack{%
863 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
864}
865\def\pushthisfilestackX{%
866 \expandafter\pushthisfilestackY\thisfile\StackTerm
867}
868\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
869 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
870}
871
872\def\popthisfilestack{\errthisfilestackempty}
873\def\errthisfilestackempty{\errmessage{Internal error:
874 the stack of filenames is empty.}}
875%
876\def\thisfile{}
877
878% @center line
879% outputs that line, centered.
880%
881\parseargdef\center{%
882 \ifhmode
883 \let\centersub\centerH
884 \else
885 \let\centersub\centerV
886 \fi
887 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
888 \let\centersub\relax % don't let the definition persist, just in case
889}
890\def\centerH#1{{%
891 \hfil\break
892 \advance\hsize by -\leftskip
893 \advance\hsize by -\rightskip
894 \line{#1}%
895 \break
896}}
897%
898\newcount\centerpenalty
899\def\centerV#1{%
900 % The idea here is the same as in \startdefun, \cartouche, etc.: if
901 % @center is the first thing after a section heading, we need to wipe
902 % out the negative parskip inserted by \sectionheading, but still
903 % prevent a page break here.
904 \centerpenalty = \lastpenalty
905 \ifnum\centerpenalty>10000 \vskip\parskip \fi
906 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
907 \line{\kern\leftskip #1\kern\rightskip}%
908}
909
910% @sp n outputs n lines of vertical space
911%
912\parseargdef\sp{\vskip #1\baselineskip}
913
914% @comment ...line which is ignored...
915% @c is the same as @comment
916% @ignore ... @end ignore is another way to write a comment
917
918
919\def\c{\begingroup \catcode`\^^M=\active%
920\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
921\cxxx}
922{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
923%
924\let\comment\c
925
926% @paragraphindent NCHARS
927% We'll use ems for NCHARS, close enough.
928% NCHARS can also be the word `asis' or `none'.
929% We cannot feasibly implement @paragraphindent asis, though.
930%
931\def\asisword{asis} % no translation, these are keywords
932\def\noneword{none}
933%
934\parseargdef\paragraphindent{%
935 \def\temp{#1}%
936 \ifx\temp\asisword
937 \else
938 \ifx\temp\noneword
939 \defaultparindent = 0pt
940 \else
941 \defaultparindent = #1em
942 \fi
943 \fi
944 \parindent = \defaultparindent
945}
946
947% @exampleindent NCHARS
948% We'll use ems for NCHARS like @paragraphindent.
949% It seems @exampleindent asis isn't necessary, but
950% I preserve it to make it similar to @paragraphindent.
951\parseargdef\exampleindent{%
952 \def\temp{#1}%
953 \ifx\temp\asisword
954 \else
955 \ifx\temp\noneword
956 \lispnarrowing = 0pt
957 \else
958 \lispnarrowing = #1em
959 \fi
960 \fi
961}
962
963% @firstparagraphindent WORD
964% If WORD is `none', then suppress indentation of the first paragraph
965% after a section heading. If WORD is `insert', then do indent at such
966% paragraphs.
967%
968% The paragraph indentation is suppressed or not by calling
969% \suppressfirstparagraphindent, which the sectioning commands do.
970% We switch the definition of this back and forth according to WORD.
971% By default, we suppress indentation.
972%
973\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
974\def\insertword{insert}
975%
976\parseargdef\firstparagraphindent{%
977 \def\temp{#1}%
978 \ifx\temp\noneword
979 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
980 \else\ifx\temp\insertword
981 \let\suppressfirstparagraphindent = \relax
982 \else
983 \errhelp = \EMsimple
984 \errmessage{Unknown @firstparagraphindent option `\temp'}%
985 \fi\fi
986}
987
988% Here is how we actually suppress indentation. Redefine \everypar to
989% \kern backwards by \parindent, and then reset itself to empty.
990%
991% We also make \indent itself not actually do anything until the next
992% paragraph.
993%
994\gdef\dosuppressfirstparagraphindent{%
995 \gdef\indent {\restorefirstparagraphindent \indent}%
996 \gdef\noindent{\restorefirstparagraphindent \noindent}%
997 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
998}
999%
1000\gdef\restorefirstparagraphindent{%
1001 \global\let\indent = \ptexindent
1002 \global\let\noindent = \ptexnoindent
1003 \global\everypar = {}%
1004}
1005
1006% leave vertical mode without cancelling any first paragraph indent
1007\gdef\imageindent{%
1008 \toks0=\everypar
1009 \everypar={}%
1010 \ptexnoindent
1011 \global\everypar=\toks0
1012}
1013
1014
1015% @refill is a no-op.
1016\let\refill=\relax
1017
1018% @setfilename INFO-FILENAME - ignored
1019\let\setfilename=\comment
1020
1021% @bye.
1022\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
1023
1024
1025\message{pdf,}
1026% adobe `portable' document format
1027\newcount\tempnum
1028\newcount\lnkcount
1029\newtoks\filename
1030\newcount\filenamelength
1031\newcount\pgn
1032\newtoks\toksA
1033\newtoks\toksB
1034\newtoks\toksC
1035\newtoks\toksD
1036\newbox\boxA
1037\newbox\boxB
1038\newcount\countA
1039\newif\ifpdf
1040\newif\ifpdfmakepagedest
1041
1042%
1043% For LuaTeX
1044%
1045
1046\newif\iftxiuseunicodedestname
1047\txiuseunicodedestnamefalse % For pdfTeX etc.
1048
1049\ifx\luatexversion\thisisundefined
1050\else
1051 % Use Unicode destination names
1052 \txiuseunicodedestnametrue
1053 % Escape PDF strings with converting UTF-16 from UTF-8
1054 \begingroup
1055 \catcode`\%=12
1056 \directlua{
1057 function UTF16oct(str)
1058 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1059 for c in string.utfvalues(str) do
1060 if c < 0x10000 then
1061 tex.sprint(
1062 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1063 string.char(0x5c) .. string.char(0x25) .. '03o',
1064 math.floor(c / 256), math.floor(c % 256)))
1065 else
1066 c = c - 0x10000
1067 local c_hi = c / 1024 + 0xd800
1068 local c_lo = c % 1024 + 0xdc00
1069 tex.sprint(
1070 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1071 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1072 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1073 string.char(0x5c) .. string.char(0x25) .. '03o',
1074 math.floor(c_hi / 256), math.floor(c_hi % 256),
1075 math.floor(c_lo / 256), math.floor(c_lo % 256)))
1076 end
1077 end
1078 end
1079 }
1080 \endgroup
1081 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1082 % Escape PDF strings without converting
1083 \begingroup
1084 \directlua{
1085 function PDFescstr(str)
1086 for c in string.bytes(str) do
1087 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
1088 tex.sprint(-2,
1089 string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
1090 c))
1091 else
1092 tex.sprint(-2, string.char(c))
1093 end
1094 end
1095 end
1096 }
1097 % The -2 in the arguments here gives all the input to TeX catcode 12
1098 % (other) or 10 (space), preventing undefined control sequence errors. See
1099 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
1100 %
1101 \endgroup
1102 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
1103 \ifnum\luatexversion>84
1104 % For LuaTeX >= 0.85
1105 \def\pdfdest{\pdfextension dest}
1106 \let\pdfoutput\outputmode
1107 \def\pdfliteral{\pdfextension literal}
1108 \def\pdfcatalog{\pdfextension catalog}
1109 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1110 \let\pdfximage\saveimageresource
1111 \let\pdfrefximage\useimageresource
1112 \let\pdflastximage\lastsavedimageresourceindex
1113 \def\pdfendlink{\pdfextension endlink\relax}
1114 \def\pdfoutline{\pdfextension outline}
1115 \def\pdfstartlink{\pdfextension startlink}
1116 \def\pdffontattr{\pdfextension fontattr}
1117 \def\pdfobj{\pdfextension obj}
1118 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1119 \let\pdfpagewidth\pagewidth
1120 \let\pdfpageheight\pageheight
1121 \edef\pdfhorigin{\pdfvariable horigin}
1122 \edef\pdfvorigin{\pdfvariable vorigin}
1123 \fi
1124\fi
1125
1126% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1127% can be set). So we test for \relax and 0 as well as being undefined.
1128\ifx\pdfoutput\thisisundefined
1129\else
1130 \ifx\pdfoutput\relax
1131 \else
1132 \ifcase\pdfoutput
1133 \else
1134 \pdftrue
1135 \fi
1136 \fi
1137\fi
1138
1139\newif\ifpdforxetex
1140\pdforxetexfalse
1141\ifpdf
1142 \pdforxetextrue
1143\fi
1144\ifx\XeTeXrevision\thisisundefined\else
1145 \pdforxetextrue
1146\fi
1147
1148
1149% Output page labels information.
1150% See PDF reference v.1.7 p.594, section 8.3.1.
1151\ifpdf
1152\def\pagelabels{%
1153 \def\title{0 << /P (T-) /S /D >>}%
1154 \edef\roman{\the\romancount << /S /r >>}%
1155 \edef\arabic{\the\arabiccount << /S /D >>}%
1156 %
1157 % Page label ranges must be increasing. Remove any duplicates.
1158 % (There is a slight chance of this being wrong if e.g. there is
1159 % a @contents but no @titlepage, etc.)
1160 %
1161 \ifnum\romancount=0 \def\roman{}\fi
1162 \ifnum\arabiccount=0 \def\title{}%
1163 \else
1164 \ifnum\romancount=\arabiccount \def\roman{}\fi
1165 \fi
1166 %
1167 \ifnum\romancount<\arabiccount
1168 \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax
1169 \else
1170 \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax
1171 \fi
1172}
1173\else
1174 \let\pagelabels\relax
1175\fi
1176
1177\newcount\pagecount \pagecount=0
1178\newcount\romancount \romancount=0
1179\newcount\arabiccount \arabiccount=0
1180\ifpdf
1181 \let\ptxadvancepageno\advancepageno
1182 \def\advancepageno{%
1183 \ptxadvancepageno\global\advance\pagecount by 1
1184 }
1185\fi
1186
1187
1188% PDF uses PostScript string constants for the names of xref targets,
1189% for display in the outlines, and in other places. Thus, we have to
1190% double any backslashes. Otherwise, a name like "\node" will be
1191% interpreted as a newline (\n), followed by o, d, e. Not good.
1192%
1193% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1194% related messages. The final outcome is that it is up to the TeX user
1195% to double the backslashes and otherwise make the string valid, so
1196% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1197% do this reliably, so we use it.
1198
1199% #1 is a control sequence in which to do the replacements,
1200% which we \xdef.
1201\def\txiescapepdf#1{%
1202 \ifx\pdfescapestring\thisisundefined
1203 % No primitive available; should we give a warning or log?
1204 % Many times it won't matter.
1205 \xdef#1{#1}%
1206 \else
1207 % The expandable \pdfescapestring primitive escapes parentheses,
1208 % backslashes, and other special chars.
1209 \xdef#1{\pdfescapestring{#1}}%
1210 \fi
1211}
1212\def\txiescapepdfutfsixteen#1{%
1213 \ifx\pdfescapestrutfsixteen\thisisundefined
1214 % No UTF-16 converting macro available.
1215 \txiescapepdf{#1}%
1216 \else
1217 \xdef#1{\pdfescapestrutfsixteen{#1}}%
1218 \fi
1219}
1220
1221\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1222with PDF output, and none of those formats could be found. (.eps cannot
1223be supported due to the design of the PDF format; use regular TeX (DVI
1224output) for that.)}
1225
1226\ifpdf
1227 %
1228 % Color manipulation macros using ideas from pdfcolor.tex,
1229 % except using rgb instead of cmyk; the latter is said to render as a
1230 % very dark gray on-screen and a very dark halftone in print, instead
1231 % of actual black. The dark red here is dark enough to print on paper as
1232 % nearly black, but still distinguishable for online viewing. We use
1233 % black by default, though.
1234 \def\rgbDarkRed{0.50 0.09 0.12}
1235 \def\rgbBlack{0 0 0}
1236 %
1237 % rg sets the color for filling (usual text, etc.);
1238 % RG sets the color for stroking (thin rules, e.g., normal _'s).
1239 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1240 %
1241 % Set color, and create a mark which defines \thiscolor accordingly,
1242 % so that \makeheadline knows which color to restore.
1243 \def\setcolor#1{%
1244 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1245 \domark
1246 \pdfsetcolor{#1}%
1247 }
1248 %
1249 \def\maincolor{\rgbBlack}
1250 \pdfsetcolor{\maincolor}
1251 \edef\thiscolor{\maincolor}
1252 \def\currentcolordefs{}
1253 %
1254 \def\makefootline{%
1255 \baselineskip24pt
1256 \line{\pdfsetcolor{\maincolor}\the\footline}%
1257 }
1258 %
1259 \def\makeheadline{%
1260 \vbox to 0pt{%
1261 \vskip-22.5pt
1262 \line{%
1263 \vbox to8.5pt{}%
1264 % Extract \thiscolor definition from the marks.
1265 \getcolormarks
1266 % Typeset the headline with \maincolor, then restore the color.
1267 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1268 }%
1269 \vss
1270 }%
1271 \nointerlineskip
1272 }
1273 %
1274 %
1275 \pdfcatalog{/PageMode /UseOutlines}
1276 %
1277 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1278 \def\dopdfimage#1#2#3{%
1279 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1280 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1281 %
1282 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1283 % others). Let's try in that order, PDF first since if
1284 % someone has a scalable image, presumably better to use that than a
1285 % bitmap.
1286 \let\pdfimgext=\empty
1287 \begingroup
1288 \openin 1 #1.pdf \ifeof 1
1289 \openin 1 #1.PDF \ifeof 1
1290 \openin 1 #1.png \ifeof 1
1291 \openin 1 #1.jpg \ifeof 1
1292 \openin 1 #1.jpeg \ifeof 1
1293 \openin 1 #1.JPG \ifeof 1
1294 \errhelp = \nopdfimagehelp
1295 \errmessage{Could not find image file #1 for pdf}%
1296 \else \gdef\pdfimgext{JPG}%
1297 \fi
1298 \else \gdef\pdfimgext{jpeg}%
1299 \fi
1300 \else \gdef\pdfimgext{jpg}%
1301 \fi
1302 \else \gdef\pdfimgext{png}%
1303 \fi
1304 \else \gdef\pdfimgext{PDF}%
1305 \fi
1306 \else \gdef\pdfimgext{pdf}%
1307 \fi
1308 \closein 1
1309 \endgroup
1310 %
1311 % without \immediate, ancient pdftex seg faults when the same image is
1312 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1313 \ifnum\pdftexversion < 14
1314 \immediate\pdfimage
1315 \else
1316 \immediate\pdfximage
1317 \fi
1318 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1319 \ifdim \wd2 >0pt height \pdfimageheight \fi
1320 \ifnum\pdftexversion<13
1321 #1.\pdfimgext
1322 \else
1323 {#1.\pdfimgext}%
1324 \fi
1325 \ifnum\pdftexversion < 14 \else
1326 \pdfrefximage \pdflastximage
1327 \fi}
1328 %
1329 \def\setpdfdestname#1{{%
1330 % We have to set dummies so commands such as @code, and characters
1331 % such as \, aren't expanded when present in a section title.
1332 \indexnofonts
1333 \makevalueexpandable
1334 \turnoffactive
1335 \iftxiuseunicodedestname
1336 \ifx \declaredencoding \latone
1337 % Pass through Latin-1 characters.
1338 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
1339 \else
1340 \ifx \declaredencoding \utfeight
1341 % Pass through Unicode characters.
1342 \else
1343 % Use ASCII approximations in destination names.
1344 \passthroughcharsfalse
1345 \fi
1346 \fi
1347 \else
1348 % Use ASCII approximations in destination names.
1349 \passthroughcharsfalse
1350 \fi
1351 \def\pdfdestname{#1}%
1352 \txiescapepdf\pdfdestname
1353 }}
1354 %
1355 \def\setpdfoutlinetext#1{{%
1356 \indexnofonts
1357 \makevalueexpandable
1358 \turnoffactive
1359 \ifx \declaredencoding \latone
1360 % The PDF format can use an extended form of Latin-1 in bookmark
1361 % strings. See Appendix D of the PDF Reference, Sixth Edition, for
1362 % the "PDFDocEncoding".
1363 \passthroughcharstrue
1364 % Pass through Latin-1 characters.
1365 % LuaTeX: Convert to Unicode
1366 % pdfTeX: Use Latin-1 as PDFDocEncoding
1367 \def\pdfoutlinetext{#1}%
1368 \else
1369 \ifx \declaredencoding \utfeight
1370 \ifx\luatexversion\thisisundefined
1371 % For pdfTeX with UTF-8.
1372 % TODO: the PDF format can use UTF-16 in bookmark strings,
1373 % but the code for this isn't done yet.
1374 % Use ASCII approximations.
1375 \passthroughcharsfalse
1376 \def\pdfoutlinetext{#1}%
1377 \else
1378 % For LuaTeX with UTF-8.
1379 % Pass through Unicode characters for title texts.
1380 \passthroughcharstrue
1381 \def\pdfoutlinetext{#1}%
1382 \fi
1383 \else
1384 % For non-Latin-1 or non-UTF-8 encodings.
1385 % Use ASCII approximations.
1386 \passthroughcharsfalse
1387 \def\pdfoutlinetext{#1}%
1388 \fi
1389 \fi
1390 % LuaTeX: Convert to UTF-16
1391 % pdfTeX: Use Latin-1 as PDFDocEncoding
1392 \txiescapepdfutfsixteen\pdfoutlinetext
1393 }}
1394 %
1395 \def\pdfmkdest#1{%
1396 \setpdfdestname{#1}%
1397 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1398 }
1399 %
1400 % used to mark target names; must be expandable.
1401 \def\pdfmkpgn#1{#1}
1402 %
1403 % by default, use black for everything.
1404 \def\urlcolor{\rgbBlack}
1405 \def\linkcolor{\rgbBlack}
1406 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1407 %
1408 % Adding outlines to PDF; macros for calculating structure of outlines
1409 % come from Petr Olsak
1410 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1411 \else \csname#1\endcsname \fi}
1412 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1413 \advance\tempnum by 1
1414 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1415 %
1416 % #1 is the section text, which is what will be displayed in the
1417 % outline by the pdf viewer. #2 is the pdf expression for the number
1418 % of subentries (or empty, for subsubsections). #3 is the node text,
1419 % which might be empty if this toc entry had no corresponding node.
1420 % #4 is the page number
1421 %
1422 \def\dopdfoutline#1#2#3#4{%
1423 % Generate a link to the node text if that exists; else, use the
1424 % page number. We could generate a destination for the section
1425 % text in the case where a section has no node, but it doesn't
1426 % seem worth the trouble, since most documents are normally structured.
1427 \setpdfoutlinetext{#1}
1428 \setpdfdestname{#3}
1429 \ifx\pdfdestname\empty
1430 \def\pdfdestname{#4}%
1431 \fi
1432 %
1433 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
1434 }
1435 %
1436 \def\pdfmakeoutlines{%
1437 \begingroup
1438 % Read toc silently, to get counts of subentries for \pdfoutline.
1439 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1440 \def\numchapentry##1##2##3##4{%
1441 \def\thischapnum{##2}%
1442 \def\thissecnum{0}%
1443 \def\thissubsecnum{0}%
1444 }%
1445 \def\numsecentry##1##2##3##4{%
1446 \advancenumber{chap\thischapnum}%
1447 \def\thissecnum{##2}%
1448 \def\thissubsecnum{0}%
1449 }%
1450 \def\numsubsecentry##1##2##3##4{%
1451 \advancenumber{sec\thissecnum}%
1452 \def\thissubsecnum{##2}%
1453 }%
1454 \def\numsubsubsecentry##1##2##3##4{%
1455 \advancenumber{subsec\thissubsecnum}%
1456 }%
1457 \def\thischapnum{0}%
1458 \def\thissecnum{0}%
1459 \def\thissubsecnum{0}%
1460 %
1461 % use \def rather than \let here because we redefine \chapentry et
1462 % al. a second time, below.
1463 \def\appentry{\numchapentry}%
1464 \def\appsecentry{\numsecentry}%
1465 \def\appsubsecentry{\numsubsecentry}%
1466 \def\appsubsubsecentry{\numsubsubsecentry}%
1467 \def\unnchapentry{\numchapentry}%
1468 \def\unnsecentry{\numsecentry}%
1469 \def\unnsubsecentry{\numsubsecentry}%
1470 \def\unnsubsubsecentry{\numsubsubsecentry}%
1471 \readdatafile{toc}%
1472 %
1473 % Read toc second time, this time actually producing the outlines.
1474 % The `-' means take the \expnumber as the absolute number of
1475 % subentries, which we calculated on our first read of the .toc above.
1476 %
1477 % We use the node names as the destinations.
1478 %
1479 % Currently we prefix the section name with the section number
1480 % for chapter and appendix headings only in order to avoid too much
1481 % horizontal space being required in the PDF viewer.
1482 \def\numchapentry##1##2##3##4{%
1483 \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1484 \def\unnchapentry##1##2##3##4{%
1485 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1486 \def\numsecentry##1##2##3##4{%
1487 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1488 \def\numsubsecentry##1##2##3##4{%
1489 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1490 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1491 \dopdfoutline{##1}{}{##3}{##4}}%
1492 %
1493 % PDF outlines are displayed using system fonts, instead of
1494 % document fonts. Therefore we cannot use special characters,
1495 % since the encoding is unknown. For example, the eogonek from
1496 % Latin 2 (0xea) gets translated to a | character. Info from
1497 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1498 %
1499 % TODO this right, we have to translate 8-bit characters to
1500 % their "best" equivalent, based on the @documentencoding. Too
1501 % much work for too little return. Just use the ASCII equivalents
1502 % we use for the index sort strings.
1503 %
1504 \indexnofonts
1505 \setupdatafile
1506 % We can have normal brace characters in the PDF outlines, unlike
1507 % Texinfo index files. So set that up.
1508 \def\{{\lbracecharliteral}%
1509 \def\}{\rbracecharliteral}%
1510 \catcode`\\=\active \otherbackslash
1511 \input \tocreadfilename
1512 \endgroup
1513 }
1514 {\catcode`[=1 \catcode`]=2
1515 \catcode`{=\other \catcode`}=\other
1516 \gdef\lbracecharliteral[{]%
1517 \gdef\rbracecharliteral[}]%
1518 ]
1519 %
1520 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1521 \ifx\PP\D\let\nextsp\relax
1522 \else\let\nextsp\skipspaces
1523 \addtokens{\filename}{\PP}%
1524 \advance\filenamelength by 1
1525 \fi
1526 \nextsp}
1527 \def\getfilename#1{%
1528 \filenamelength=0
1529 % If we don't expand the argument now, \skipspaces will get
1530 % snagged on things like "@value{foo}".
1531 \edef\temp{#1}%
1532 \expandafter\skipspaces\temp|\relax
1533 }
1534 \ifnum\pdftexversion < 14
1535 \let \startlink \pdfannotlink
1536 \else
1537 \let \startlink \pdfstartlink
1538 \fi
1539 % make a live url in pdf output.
1540 \def\pdfurl#1{%
1541 \begingroup
1542 % it seems we really need yet another set of dummies; have not
1543 % tried to figure out what each command should do in the context
1544 % of @url. for now, just make @/ a no-op, that's the only one
1545 % people have actually reported a problem with.
1546 %
1547 \normalturnoffactive
1548 \def\@{@}%
1549 \let\/=\empty
1550 \makevalueexpandable
1551 % do we want to go so far as to use \indexnofonts instead of just
1552 % special-casing \var here?
1553 \def\var##1{##1}%
1554 %
1555 \leavevmode\setcolor{\urlcolor}%
1556 \startlink attr{/Border [0 0 0]}%
1557 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1558 \endgroup}
1559 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
1560 % be a simple number, or a list of numbers in the case of an index
1561 % entry.
1562 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1563 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1564 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1565 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1566 \def\maketoks{%
1567 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1568 \ifx\first0\adn0
1569 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1570 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1571 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1572 \else
1573 \ifnum0=\countA\else\makelink\fi
1574 \ifx\first.\let\next=\done\else
1575 \let\next=\maketoks
1576 \addtokens{\toksB}{\the\toksD}
1577 \ifx\first,\addtokens{\toksB}{\space}\fi
1578 \fi
1579 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1580 \next}
1581 \def\makelink{\addtokens{\toksB}%
1582 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1583 \def\pdflink#1{%
1584 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1585 \setcolor{\linkcolor}#1\endlink}
1586 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1587\else
1588 % non-pdf mode
1589 \let\pdfmkdest = \gobble
1590 \let\pdfurl = \gobble
1591 \let\endlink = \relax
1592 \let\setcolor = \gobble
1593 \let\pdfsetcolor = \gobble
1594 \let\pdfmakeoutlines = \relax
1595\fi % \ifx\pdfoutput
1596
1597%
1598% For XeTeX
1599%
1600\ifx\XeTeXrevision\thisisundefined
1601\else
1602 %
1603 % XeTeX version check
1604 %
1605 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
1606 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
1607 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
1608 % For avoiding PDF destination name replacement, we use this special
1609 % instead of xdvipdfmx's command line option `-C 0x0010'.
1610 \special{dvipdfmx:config C 0x0010}
1611 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
1612 % It can handle Unicode destination names for PDF.
1613 \txiuseunicodedestnametrue
1614 \else
1615 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
1616 % `dvipdfmx:config' special.
1617 % So for avoiding PDF destination name replacement,
1618 % xdvipdfmx's command line option `-C 0x0010' is necessary.
1619 %
1620 % XeTeX < 0.99995 can not handle Unicode destination names for PDF
1621 % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
1622 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1623 \txiuseunicodedestnamefalse
1624 \fi
1625 %
1626 % Color support
1627 %
1628 \def\rgbDarkRed{0.50 0.09 0.12}
1629 \def\rgbBlack{0 0 0}
1630 %
1631 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
1632 %
1633 % Set color, and create a mark which defines \thiscolor accordingly,
1634 % so that \makeheadline knows which color to restore.
1635 \def\setcolor#1{%
1636 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
1637 \domark
1638 \pdfsetcolor{#1}%
1639 }
1640 %
1641 \def\maincolor{\rgbBlack}
1642 \pdfsetcolor{\maincolor}
1643 \edef\thiscolor{\maincolor}
1644 \def\currentcolordefs{}
1645 %
1646 \def\makefootline{%
1647 \baselineskip24pt
1648 \line{\pdfsetcolor{\maincolor}\the\footline}%
1649 }
1650 %
1651 \def\makeheadline{%
1652 \vbox to 0pt{%
1653 \vskip-22.5pt
1654 \line{%
1655 \vbox to8.5pt{}%
1656 % Extract \thiscolor definition from the marks.
1657 \getcolormarks
1658 % Typeset the headline with \maincolor, then restore the color.
1659 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1660 }%
1661 \vss
1662 }%
1663 \nointerlineskip
1664 }
1665 %
1666 % PDF outline support
1667 %
1668 % Emulate pdfTeX primitive
1669 \def\pdfdest name#1 xyz{%
1670 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
1671 }
1672 %
1673 \def\setpdfdestname#1{{%
1674 % We have to set dummies so commands such as @code, and characters
1675 % such as \, aren't expanded when present in a section title.
1676 \indexnofonts
1677 \makevalueexpandable
1678 \turnoffactive
1679 \iftxiuseunicodedestname
1680 % Pass through Unicode characters.
1681 \else
1682 % Use ASCII approximations in destination names.
1683 \passthroughcharsfalse
1684 \fi
1685 \def\pdfdestname{#1}%
1686 \txiescapepdf\pdfdestname
1687 }}
1688 %
1689 \def\setpdfoutlinetext#1{{%
1690 \turnoffactive
1691 % Always use Unicode characters in title texts.
1692 \def\pdfoutlinetext{#1}%
1693 % For XeTeX, xdvipdfmx converts to UTF-16.
1694 % So we do not convert.
1695 \txiescapepdf\pdfoutlinetext
1696 }}
1697 %
1698 \def\pdfmkdest#1{%
1699 \setpdfdestname{#1}%
1700 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1701 }
1702 %
1703 % by default, use black for everything.
1704 \def\urlcolor{\rgbBlack}
1705 \def\linkcolor{\rgbBlack}
1706 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1707 %
1708 \def\dopdfoutline#1#2#3#4{%
1709 \setpdfoutlinetext{#1}
1710 \setpdfdestname{#3}
1711 \ifx\pdfdestname\empty
1712 \def\pdfdestname{#4}%
1713 \fi
1714 %
1715 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
1716 << /S /GoTo /D (\pdfdestname) >> >> }%
1717 }
1718 %
1719 \def\pdfmakeoutlines{%
1720 \begingroup
1721 %
1722 % For XeTeX, counts of subentries are not necessary.
1723 % Therefore, we read toc only once.
1724 %
1725 % We use node names as destinations.
1726 %
1727 % Currently we prefix the section name with the section number
1728 % for chapter and appendix headings only in order to avoid too much
1729 % horizontal space being required in the PDF viewer.
1730 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1731 \def\numchapentry##1##2##3##4{%
1732 \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
1733 \def\numsecentry##1##2##3##4{%
1734 \dopdfoutline{##1}{2}{##3}{##4}}%
1735 \def\numsubsecentry##1##2##3##4{%
1736 \dopdfoutline{##1}{3}{##3}{##4}}%
1737 \def\numsubsubsecentry##1##2##3##4{%
1738 \dopdfoutline{##1}{4}{##3}{##4}}%
1739 %
1740 \let\appentry\numchapentry%
1741 \let\appsecentry\numsecentry%
1742 \let\appsubsecentry\numsubsecentry%
1743 \let\appsubsubsecentry\numsubsubsecentry%
1744 \def\unnchapentry##1##2##3##4{%
1745 \dopdfoutline{##1}{1}{##3}{##4}}%
1746 \let\unnsecentry\numsecentry%
1747 \let\unnsubsecentry\numsubsecentry%
1748 \let\unnsubsubsecentry\numsubsubsecentry%
1749 %
1750 % For XeTeX, xdvipdfmx converts strings to UTF-16.
1751 % Therefore, the encoding and the language may not be considered.
1752 %
1753 \indexnofonts
1754 \setupdatafile
1755 % We can have normal brace characters in the PDF outlines, unlike
1756 % Texinfo index files. So set that up.
1757 \def\{{\lbracecharliteral}%
1758 \def\}{\rbracecharliteral}%
1759 \catcode`\\=\active \otherbackslash
1760 \input \tocreadfilename
1761 \endgroup
1762 }
1763 {\catcode`[=1 \catcode`]=2
1764 \catcode`{=\other \catcode`}=\other
1765 \gdef\lbracecharliteral[{]%
1766 \gdef\rbracecharliteral[}]%
1767 ]
1768
1769 \special{pdf:docview << /PageMode /UseOutlines >> }
1770 % ``\special{pdf:tounicode ...}'' is not necessary
1771 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
1772 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
1773 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
1774 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
1775%
1776 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1777 \ifx\PP\D\let\nextsp\relax
1778 \else\let\nextsp\skipspaces
1779 \addtokens{\filename}{\PP}%
1780 \advance\filenamelength by 1
1781 \fi
1782 \nextsp}
1783 \def\getfilename#1{%
1784 \filenamelength=0
1785 % If we don't expand the argument now, \skipspaces will get
1786 % snagged on things like "@value{foo}".
1787 \edef\temp{#1}%
1788 \expandafter\skipspaces\temp|\relax
1789 }
1790 % make a live url in pdf output.
1791 \def\pdfurl#1{%
1792 \begingroup
1793 % it seems we really need yet another set of dummies; have not
1794 % tried to figure out what each command should do in the context
1795 % of @url. for now, just make @/ a no-op, that's the only one
1796 % people have actually reported a problem with.
1797 %
1798 \normalturnoffactive
1799 \def\@{@}%
1800 \let\/=\empty
1801 \makevalueexpandable
1802 % do we want to go so far as to use \indexnofonts instead of just
1803 % special-casing \var here?
1804 \def\var##1{##1}%
1805 %
1806 \leavevmode\setcolor{\urlcolor}%
1807 \special{pdf:bann << /Border [0 0 0]
1808 /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
1809 \endgroup}
1810 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
1811 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1812 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1813 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1814 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1815 \def\maketoks{%
1816 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1817 \ifx\first0\adn0
1818 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1819 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1820 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1821 \else
1822 \ifnum0=\countA\else\makelink\fi
1823 \ifx\first.\let\next=\done\else
1824 \let\next=\maketoks
1825 \addtokens{\toksB}{\the\toksD}
1826 \ifx\first,\addtokens{\toksB}{\space}\fi
1827 \fi
1828 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1829 \next}
1830 \def\makelink{\addtokens{\toksB}%
1831 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1832 \def\pdflink#1{%
1833 \special{pdf:bann << /Border [0 0 0]
1834 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
1835 \setcolor{\linkcolor}#1\endlink}
1836 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1837%
1838 %
1839 % @image support
1840 %
1841 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1842 \def\doxeteximage#1#2#3{%
1843 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1844 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1845 %
1846 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
1847 % others). Let's try in that order, PDF first since if
1848 % someone has a scalable image, presumably better to use that than a
1849 % bitmap.
1850 \let\xeteximgext=\empty
1851 \begingroup
1852 \openin 1 #1.pdf \ifeof 1
1853 \openin 1 #1.PDF \ifeof 1
1854 \openin 1 #1.png \ifeof 1
1855 \openin 1 #1.jpg \ifeof 1
1856 \openin 1 #1.jpeg \ifeof 1
1857 \openin 1 #1.JPG \ifeof 1
1858 \errmessage{Could not find image file #1 for XeTeX}%
1859 \else \gdef\xeteximgext{JPG}%
1860 \fi
1861 \else \gdef\xeteximgext{jpeg}%
1862 \fi
1863 \else \gdef\xeteximgext{jpg}%
1864 \fi
1865 \else \gdef\xeteximgext{png}%
1866 \fi
1867 \else \gdef\xeteximgext{PDF}%
1868 \fi
1869 \else \gdef\xeteximgext{pdf}%
1870 \fi
1871 \closein 1
1872 \endgroup
1873 %
1874 % Putting an \hbox around the image can prevent an over-long line
1875 % after the image.
1876 \hbox\bgroup
1877 \def\xetexpdfext{pdf}%
1878 \ifx\xeteximgext\xetexpdfext
1879 \XeTeXpdffile "#1".\xeteximgext ""
1880 \else
1881 \def\xetexpdfext{PDF}%
1882 \ifx\xeteximgext\xetexpdfext
1883 \XeTeXpdffile "#1".\xeteximgext ""
1884 \else
1885 \XeTeXpicfile "#1".\xeteximgext ""
1886 \fi
1887 \fi
1888 \ifdim \wd0 >0pt width \xeteximagewidth \fi
1889 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
1890 \egroup
1891 }
1892\fi
1893
1894
1895%
1896\message{fonts,}
1897
1898% Set the baselineskip to #1, and the lineskip and strut size
1899% correspondingly. There is no deep meaning behind these magic numbers
1900% used as factors; they just match (closely enough) what Knuth defined.
1901%
1902\def\lineskipfactor{.08333}
1903\def\strutheightpercent{.70833}
1904\def\strutdepthpercent {.29167}
1905%
1906% can get a sort of poor man's double spacing by redefining this.
1907\def\baselinefactor{1}
1908%
1909\newdimen\textleading
1910\def\setleading#1{%
1911 \dimen0 = #1\relax
1912 \normalbaselineskip = \baselinefactor\dimen0
1913 \normallineskip = \lineskipfactor\normalbaselineskip
1914 \normalbaselines
1915 \setbox\strutbox =\hbox{%
1916 \vrule width0pt height\strutheightpercent\baselineskip
1917 depth \strutdepthpercent \baselineskip
1918 }%
1919}
1920
1921% PDF CMaps. See also LaTeX's t1.cmap.
1922%
1923% do nothing with this by default.
1924\expandafter\let\csname cmapOT1\endcsname\gobble
1925\expandafter\let\csname cmapOT1IT\endcsname\gobble
1926\expandafter\let\csname cmapOT1TT\endcsname\gobble
1927
1928% if we are producing pdf, and we have \pdffontattr, then define cmaps.
1929% (\pdffontattr was introduced many years ago, but people still run
1930% older pdftex's; it's easy to conditionalize, so we do.)
1931\ifpdf \ifx\pdffontattr\thisisundefined \else
1932 \begingroup
1933 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1934 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1935%%DocumentNeededResources: ProcSet (CIDInit)
1936%%IncludeResource: ProcSet (CIDInit)
1937%%BeginResource: CMap (TeX-OT1-0)
1938%%Title: (TeX-OT1-0 TeX OT1 0)
1939%%Version: 1.000
1940%%EndComments
1941/CIDInit /ProcSet findresource begin
194212 dict begin
1943begincmap
1944/CIDSystemInfo
1945<< /Registry (TeX)
1946/Ordering (OT1)
1947/Supplement 0
1948>> def
1949/CMapName /TeX-OT1-0 def
1950/CMapType 2 def
19511 begincodespacerange
1952<00> <7F>
1953endcodespacerange
19548 beginbfrange
1955<00> <01> <0393>
1956<09> <0A> <03A8>
1957<23> <26> <0023>
1958<28> <3B> <0028>
1959<3F> <5B> <003F>
1960<5D> <5E> <005D>
1961<61> <7A> <0061>
1962<7B> <7C> <2013>
1963endbfrange
196440 beginbfchar
1965<02> <0398>
1966<03> <039B>
1967<04> <039E>
1968<05> <03A0>
1969<06> <03A3>
1970<07> <03D2>
1971<08> <03A6>
1972<0B> <00660066>
1973<0C> <00660069>
1974<0D> <0066006C>
1975<0E> <006600660069>
1976<0F> <00660066006C>
1977<10> <0131>
1978<11> <0237>
1979<12> <0060>
1980<13> <00B4>
1981<14> <02C7>
1982<15> <02D8>
1983<16> <00AF>
1984<17> <02DA>
1985<18> <00B8>
1986<19> <00DF>
1987<1A> <00E6>
1988<1B> <0153>
1989<1C> <00F8>
1990<1D> <00C6>
1991<1E> <0152>
1992<1F> <00D8>
1993<21> <0021>
1994<22> <201D>
1995<27> <2019>
1996<3C> <00A1>
1997<3D> <003D>
1998<3E> <00BF>
1999<5C> <201C>
2000<5F> <02D9>
2001<60> <2018>
2002<7D> <02DD>
2003<7E> <007E>
2004<7F> <00A8>
2005endbfchar
2006endcmap
2007CMapName currentdict /CMap defineresource pop
2008end
2009end
2010%%EndResource
2011%%EOF
2012 }\endgroup
2013 \expandafter\edef\csname cmapOT1\endcsname#1{%
2014 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2015 }%
2016%
2017% \cmapOT1IT
2018 \begingroup
2019 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2020 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2021%%DocumentNeededResources: ProcSet (CIDInit)
2022%%IncludeResource: ProcSet (CIDInit)
2023%%BeginResource: CMap (TeX-OT1IT-0)
2024%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
2025%%Version: 1.000
2026%%EndComments
2027/CIDInit /ProcSet findresource begin
202812 dict begin
2029begincmap
2030/CIDSystemInfo
2031<< /Registry (TeX)
2032/Ordering (OT1IT)
2033/Supplement 0
2034>> def
2035/CMapName /TeX-OT1IT-0 def
2036/CMapType 2 def
20371 begincodespacerange
2038<00> <7F>
2039endcodespacerange
20408 beginbfrange
2041<00> <01> <0393>
2042<09> <0A> <03A8>
2043<25> <26> <0025>
2044<28> <3B> <0028>
2045<3F> <5B> <003F>
2046<5D> <5E> <005D>
2047<61> <7A> <0061>
2048<7B> <7C> <2013>
2049endbfrange
205042 beginbfchar
2051<02> <0398>
2052<03> <039B>
2053<04> <039E>
2054<05> <03A0>
2055<06> <03A3>
2056<07> <03D2>
2057<08> <03A6>
2058<0B> <00660066>
2059<0C> <00660069>
2060<0D> <0066006C>
2061<0E> <006600660069>
2062<0F> <00660066006C>
2063<10> <0131>
2064<11> <0237>
2065<12> <0060>
2066<13> <00B4>
2067<14> <02C7>
2068<15> <02D8>
2069<16> <00AF>
2070<17> <02DA>
2071<18> <00B8>
2072<19> <00DF>
2073<1A> <00E6>
2074<1B> <0153>
2075<1C> <00F8>
2076<1D> <00C6>
2077<1E> <0152>
2078<1F> <00D8>
2079<21> <0021>
2080<22> <201D>
2081<23> <0023>
2082<24> <00A3>
2083<27> <2019>
2084<3C> <00A1>
2085<3D> <003D>
2086<3E> <00BF>
2087<5C> <201C>
2088<5F> <02D9>
2089<60> <2018>
2090<7D> <02DD>
2091<7E> <007E>
2092<7F> <00A8>
2093endbfchar
2094endcmap
2095CMapName currentdict /CMap defineresource pop
2096end
2097end
2098%%EndResource
2099%%EOF
2100 }\endgroup
2101 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
2102 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2103 }%
2104%
2105% \cmapOT1TT
2106 \begingroup
2107 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
2108 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
2109%%DocumentNeededResources: ProcSet (CIDInit)
2110%%IncludeResource: ProcSet (CIDInit)
2111%%BeginResource: CMap (TeX-OT1TT-0)
2112%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
2113%%Version: 1.000
2114%%EndComments
2115/CIDInit /ProcSet findresource begin
211612 dict begin
2117begincmap
2118/CIDSystemInfo
2119<< /Registry (TeX)
2120/Ordering (OT1TT)
2121/Supplement 0
2122>> def
2123/CMapName /TeX-OT1TT-0 def
2124/CMapType 2 def
21251 begincodespacerange
2126<00> <7F>
2127endcodespacerange
21285 beginbfrange
2129<00> <01> <0393>
2130<09> <0A> <03A8>
2131<21> <26> <0021>
2132<28> <5F> <0028>
2133<61> <7E> <0061>
2134endbfrange
213532 beginbfchar
2136<02> <0398>
2137<03> <039B>
2138<04> <039E>
2139<05> <03A0>
2140<06> <03A3>
2141<07> <03D2>
2142<08> <03A6>
2143<0B> <2191>
2144<0C> <2193>
2145<0D> <0027>
2146<0E> <00A1>
2147<0F> <00BF>
2148<10> <0131>
2149<11> <0237>
2150<12> <0060>
2151<13> <00B4>
2152<14> <02C7>
2153<15> <02D8>
2154<16> <00AF>
2155<17> <02DA>
2156<18> <00B8>
2157<19> <00DF>
2158<1A> <00E6>
2159<1B> <0153>
2160<1C> <00F8>
2161<1D> <00C6>
2162<1E> <0152>
2163<1F> <00D8>
2164<20> <2423>
2165<27> <2019>
2166<60> <2018>
2167<7F> <00A8>
2168endbfchar
2169endcmap
2170CMapName currentdict /CMap defineresource pop
2171end
2172end
2173%%EndResource
2174%%EOF
2175 }\endgroup
2176 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
2177 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
2178 }%
2179\fi\fi
2180
2181
2182% Set the font macro #1 to the font named \fontprefix#2.
2183% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
2184% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
2185% Example:
2186% #1 = \textrm
2187% #2 = \rmshape
2188% #3 = 10
2189% #4 = \mainmagstep
2190% #5 = OT1
2191%
2192\def\setfont#1#2#3#4#5{%
2193 \font#1=\fontprefix#2#3 scaled #4
2194 \csname cmap#5\endcsname#1%
2195}
2196% This is what gets called when #5 of \setfont is empty.
2197\let\cmap\gobble
2198%
2199% (end of cmaps)
2200
2201% Use cm as the default font prefix.
2202% To specify the font prefix, you must define \fontprefix
2203% before you read in texinfo.tex.
2204\ifx\fontprefix\thisisundefined
2205\def\fontprefix{cm}
2206\fi
2207% Support font families that don't use the same naming scheme as CM.
2208\def\rmshape{r}
2209\def\rmbshape{bx} % where the normal face is bold
2210\def\bfshape{b}
2211\def\bxshape{bx}
2212\def\ttshape{tt}
2213\def\ttbshape{tt}
2214\def\ttslshape{sltt}
2215\def\itshape{ti}
2216\def\itbshape{bxti}
2217\def\slshape{sl}
2218\def\slbshape{bxsl}
2219\def\sfshape{ss}
2220\def\sfbshape{ss}
2221\def\scshape{csc}
2222\def\scbshape{csc}
2223
2224% Definitions for a main text size of 11pt. (The default in Texinfo.)
2225%
2226\def\definetextfontsizexi{%
2227% Text fonts (11.2pt, magstep1).
2228\def\textnominalsize{11pt}
2229\edef\mainmagstep{\magstephalf}
2230\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2231\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2232\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2233\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2234\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2235\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2236\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2237\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2238\font\texti=cmmi10 scaled \mainmagstep
2239\font\textsy=cmsy10 scaled \mainmagstep
2240\def\textecsize{1095}
2241
2242% A few fonts for @defun names and args.
2243\setfont\defbf\bfshape{10}{\magstep1}{OT1}
2244\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
2245\setfont\defsl\slshape{10}{\magstep1}{OT1}
2246\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
2247\def\df{\let\ttfont=\deftt \let\bffont = \defbf
2248\let\ttslfont=\defttsl \let\slfont=\defsl \bf}
2249
2250% Fonts for indices, footnotes, small examples (9pt).
2251\def\smallnominalsize{9pt}
2252\setfont\smallrm\rmshape{9}{1000}{OT1}
2253\setfont\smalltt\ttshape{9}{1000}{OT1TT}
2254\setfont\smallbf\bfshape{10}{900}{OT1}
2255\setfont\smallit\itshape{9}{1000}{OT1IT}
2256\setfont\smallsl\slshape{9}{1000}{OT1}
2257\setfont\smallsf\sfshape{9}{1000}{OT1}
2258\setfont\smallsc\scshape{10}{900}{OT1}
2259\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2260\font\smalli=cmmi9
2261\font\smallsy=cmsy9
2262\def\smallecsize{0900}
2263
2264% Fonts for small examples (8pt).
2265\def\smallernominalsize{8pt}
2266\setfont\smallerrm\rmshape{8}{1000}{OT1}
2267\setfont\smallertt\ttshape{8}{1000}{OT1TT}
2268\setfont\smallerbf\bfshape{10}{800}{OT1}
2269\setfont\smallerit\itshape{8}{1000}{OT1IT}
2270\setfont\smallersl\slshape{8}{1000}{OT1}
2271\setfont\smallersf\sfshape{8}{1000}{OT1}
2272\setfont\smallersc\scshape{10}{800}{OT1}
2273\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2274\font\smalleri=cmmi8
2275\font\smallersy=cmsy8
2276\def\smallerecsize{0800}
2277
2278% Fonts for math mode superscripts (7pt).
2279\def\sevennominalsize{7pt}
2280\setfont\sevenrm\rmshape{7}{1000}{OT1}
2281\setfont\seventt\ttshape{10}{700}{OT1TT}
2282\setfont\sevenbf\bfshape{10}{700}{OT1}
2283\setfont\sevenit\itshape{7}{1000}{OT1IT}
2284\setfont\sevensl\slshape{10}{700}{OT1}
2285\setfont\sevensf\sfshape{10}{700}{OT1}
2286\setfont\sevensc\scshape{10}{700}{OT1}
2287\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2288\font\seveni=cmmi7
2289\font\sevensy=cmsy7
2290\def\sevenecsize{0700}
2291
2292% Fonts for title page (20.4pt):
2293\def\titlenominalsize{20pt}
2294\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2295\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2296\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2297\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2298\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2299\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2300\let\titlebf=\titlerm
2301\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2302\font\titlei=cmmi12 scaled \magstep3
2303\font\titlesy=cmsy10 scaled \magstep4
2304\def\titleecsize{2074}
2305
2306% Chapter (and unnumbered) fonts (17.28pt).
2307\def\chapnominalsize{17pt}
2308\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
2309\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
2310\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
2311\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
2312\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
2313\setfont\chapsf\sfbshape{17}{1000}{OT1}
2314\let\chapbf=\chaprm
2315\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
2316\font\chapi=cmmi12 scaled \magstep2
2317\font\chapsy=cmsy10 scaled \magstep3
2318\def\chapecsize{1728}
2319
2320% Section fonts (14.4pt).
2321\def\secnominalsize{14pt}
2322\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
2323\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
2324\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
2325\setfont\secsl\slbshape{10}{\magstep2}{OT1}
2326\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
2327\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
2328\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
2329\let\secbf\secrm
2330\setfont\secsc\scbshape{10}{\magstep2}{OT1}
2331\font\seci=cmmi12 scaled \magstep1
2332\font\secsy=cmsy10 scaled \magstep2
2333\def\sececsize{1440}
2334
2335% Subsection fonts (13.15pt).
2336\def\ssecnominalsize{13pt}
2337\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
2338\setfont\ssecit\itbshape{10}{1315}{OT1IT}
2339\setfont\ssecsl\slbshape{10}{1315}{OT1}
2340\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
2341\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
2342\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
2343\let\ssecbf\ssecrm
2344\setfont\ssecsc\scbshape{10}{1315}{OT1}
2345\font\sseci=cmmi12 scaled \magstephalf
2346\font\ssecsy=cmsy10 scaled 1315
2347\def\ssececsize{1200}
2348
2349% Reduced fonts for @acronym in text (10pt).
2350\def\reducednominalsize{10pt}
2351\setfont\reducedrm\rmshape{10}{1000}{OT1}
2352\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
2353\setfont\reducedbf\bfshape{10}{1000}{OT1}
2354\setfont\reducedit\itshape{10}{1000}{OT1IT}
2355\setfont\reducedsl\slshape{10}{1000}{OT1}
2356\setfont\reducedsf\sfshape{10}{1000}{OT1}
2357\setfont\reducedsc\scshape{10}{1000}{OT1}
2358\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
2359\font\reducedi=cmmi10
2360\font\reducedsy=cmsy10
2361\def\reducedecsize{1000}
2362
2363\textleading = 13.2pt % line spacing for 11pt CM
2364\textfonts % reset the current fonts
2365\rm
2366} % end of 11pt text font size definitions, \definetextfontsizexi
2367
2368
2369% Definitions to make the main text be 10pt Computer Modern, with
2370% section, chapter, etc., sizes following suit. This is for the GNU
2371% Press printing of the Emacs 22 manual. Maybe other manuals in the
2372% future. Used with @smallbook, which sets the leading to 12pt.
2373%
2374\def\definetextfontsizex{%
2375% Text fonts (10pt).
2376\def\textnominalsize{10pt}
2377\edef\mainmagstep{1000}
2378\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2379\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2380\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2381\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2382\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2383\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2384\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2385\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2386\font\texti=cmmi10 scaled \mainmagstep
2387\font\textsy=cmsy10 scaled \mainmagstep
2388\def\textecsize{1000}
2389
2390% A few fonts for @defun names and args.
2391\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2392\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2393\setfont\defsl\slshape{10}{\magstephalf}{OT1}
2394\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2395\def\df{\let\ttfont=\deftt \let\bffont = \defbf
2396\let\slfont=\defsl \let\ttslfont=\defttsl \bf}
2397
2398% Fonts for indices, footnotes, small examples (9pt).
2399\def\smallnominalsize{9pt}
2400\setfont\smallrm\rmshape{9}{1000}{OT1}
2401\setfont\smalltt\ttshape{9}{1000}{OT1TT}
2402\setfont\smallbf\bfshape{10}{900}{OT1}
2403\setfont\smallit\itshape{9}{1000}{OT1IT}
2404\setfont\smallsl\slshape{9}{1000}{OT1}
2405\setfont\smallsf\sfshape{9}{1000}{OT1}
2406\setfont\smallsc\scshape{10}{900}{OT1}
2407\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2408\font\smalli=cmmi9
2409\font\smallsy=cmsy9
2410\def\smallecsize{0900}
2411
2412% Fonts for small examples (8pt).
2413\def\smallernominalsize{8pt}
2414\setfont\smallerrm\rmshape{8}{1000}{OT1}
2415\setfont\smallertt\ttshape{8}{1000}{OT1TT}
2416\setfont\smallerbf\bfshape{10}{800}{OT1}
2417\setfont\smallerit\itshape{8}{1000}{OT1IT}
2418\setfont\smallersl\slshape{8}{1000}{OT1}
2419\setfont\smallersf\sfshape{8}{1000}{OT1}
2420\setfont\smallersc\scshape{10}{800}{OT1}
2421\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2422\font\smalleri=cmmi8
2423\font\smallersy=cmsy8
2424\def\smallerecsize{0800}
2425
2426% Fonts for math mode superscripts (7pt).
2427\def\sevennominalsize{7pt}
2428\setfont\sevenrm\rmshape{7}{1000}{OT1}
2429\setfont\seventt\ttshape{10}{700}{OT1TT}
2430\setfont\sevenbf\bfshape{10}{700}{OT1}
2431\setfont\sevenit\itshape{7}{1000}{OT1IT}
2432\setfont\sevensl\slshape{10}{700}{OT1}
2433\setfont\sevensf\sfshape{10}{700}{OT1}
2434\setfont\sevensc\scshape{10}{700}{OT1}
2435\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
2436\font\seveni=cmmi7
2437\font\sevensy=cmsy7
2438\def\sevenecsize{0700}
2439
2440% Fonts for title page (20.4pt):
2441\def\titlenominalsize{20pt}
2442\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2443\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2444\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2445\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2446\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2447\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2448\let\titlebf=\titlerm
2449\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2450\font\titlei=cmmi12 scaled \magstep3
2451\font\titlesy=cmsy10 scaled \magstep4
2452\def\titleecsize{2074}
2453
2454% Chapter fonts (14.4pt).
2455\def\chapnominalsize{14pt}
2456\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2457\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2458\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2459\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2460\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2461\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2462\let\chapbf\chaprm
2463\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2464\font\chapi=cmmi12 scaled \magstep1
2465\font\chapsy=cmsy10 scaled \magstep2
2466\def\chapecsize{1440}
2467
2468% Section fonts (12pt).
2469\def\secnominalsize{12pt}
2470\setfont\secrm\rmbshape{12}{1000}{OT1}
2471\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2472\setfont\secsl\slbshape{10}{\magstep1}{OT1}
2473\setfont\sectt\ttbshape{12}{1000}{OT1TT}
2474\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2475\setfont\secsf\sfbshape{12}{1000}{OT1}
2476\let\secbf\secrm
2477\setfont\secsc\scbshape{10}{\magstep1}{OT1}
2478\font\seci=cmmi12
2479\font\secsy=cmsy10 scaled \magstep1
2480\def\sececsize{1200}
2481
2482% Subsection fonts (10pt).
2483\def\ssecnominalsize{10pt}
2484\setfont\ssecrm\rmbshape{10}{1000}{OT1}
2485\setfont\ssecit\itbshape{10}{1000}{OT1IT}
2486\setfont\ssecsl\slbshape{10}{1000}{OT1}
2487\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2488\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2489\setfont\ssecsf\sfbshape{10}{1000}{OT1}
2490\let\ssecbf\ssecrm
2491\setfont\ssecsc\scbshape{10}{1000}{OT1}
2492\font\sseci=cmmi10
2493\font\ssecsy=cmsy10
2494\def\ssececsize{1000}
2495
2496% Reduced fonts for @acronym in text (9pt).
2497\def\reducednominalsize{9pt}
2498\setfont\reducedrm\rmshape{9}{1000}{OT1}
2499\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2500\setfont\reducedbf\bfshape{10}{900}{OT1}
2501\setfont\reducedit\itshape{9}{1000}{OT1IT}
2502\setfont\reducedsl\slshape{9}{1000}{OT1}
2503\setfont\reducedsf\sfshape{9}{1000}{OT1}
2504\setfont\reducedsc\scshape{10}{900}{OT1}
2505\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2506\font\reducedi=cmmi9
2507\font\reducedsy=cmsy9
2508\def\reducedecsize{0900}
2509
2510\divide\parskip by 2 % reduce space between paragraphs
2511\textleading = 12pt % line spacing for 10pt CM
2512\textfonts % reset the current fonts
2513\rm
2514} % end of 10pt text font size definitions, \definetextfontsizex
2515
2516% Fonts for short table of contents.
2517\setfont\shortcontrm\rmshape{12}{1000}{OT1}
2518\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2519\setfont\shortcontsl\slshape{12}{1000}{OT1}
2520\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2521
2522
2523% We provide the user-level command
2524% @fonttextsize 10
2525% (or 11) to redefine the text font size. pt is assumed.
2526%
2527\def\xiword{11}
2528\def\xword{10}
2529\def\xwordpt{10pt}
2530%
2531\parseargdef\fonttextsize{%
2532 \def\textsizearg{#1}%
2533 %\wlog{doing @fonttextsize \textsizearg}%
2534 %
2535 % Set \globaldefs so that documents can use this inside @tex, since
2536 % makeinfo 4.8 does not support it, but we need it nonetheless.
2537 %
2538 \begingroup \globaldefs=1
2539 \ifx\textsizearg\xword \definetextfontsizex
2540 \else \ifx\textsizearg\xiword \definetextfontsizexi
2541 \else
2542 \errhelp=\EMsimple
2543 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2544 \fi\fi
2545 \endgroup
2546}
2547
2548%
2549% Change the current font style to #1, remembering it in \curfontstyle.
2550% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
2551% italics, not bold italics.
2552%
2553\def\setfontstyle#1{%
2554 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
2555 \csname #1font\endcsname % change the current font
2556}
2557
2558\def\rm{\fam=0 \setfontstyle{rm}}
2559\def\it{\fam=\itfam \setfontstyle{it}}
2560\def\sl{\fam=\slfam \setfontstyle{sl}}
2561\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
2562\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt}
2563
2564% Texinfo sort of supports the sans serif font style, which plain TeX does not.
2565% So we set up a \sf.
2566\newfam\sffam
2567\def\sf{\fam=\sffam \setfontstyle{sf}}
2568
2569% We don't need math for this font style.
2570\def\ttsl{\setfontstyle{ttsl}}
2571
2572
2573% In order for the font changes to affect most math symbols and letters,
2574% we have to define the \textfont of the standard families.
2575% We don't bother to reset \scriptscriptfont; awaiting user need.
2576%
2577\def\resetmathfonts{%
2578 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
2579 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
2580 \textfont\ttfam=\ttfont \textfont\sffam=\sffont
2581 %
2582 % Fonts for superscript. Note that the 7pt fonts are used regardless
2583 % of the current font size.
2584 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
2585 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
2586 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
2587 \scriptfont\sffam=\sevensf
2588}
2589
2590%
2591
2592% The font-changing commands (all called \...fonts) redefine the meanings
2593% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
2594% to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
2595% commands hardwire \STYLEfont to set the current font.
2596%
2597% The fonts used for \ifont are for "math italics" (\itfont is for italics
2598% in regular text). \syfont is also used in math mode only.
2599%
2600% Each font-changing command also sets the names \lsize (one size lower)
2601% and \lllsize (three sizes lower). These relative commands are used
2602% in, e.g., the LaTeX logo and acronyms.
2603%
2604% This all needs generalizing, badly.
2605%
2606
2607\def\assignfonts#1{%
2608 \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
2609 \expandafter\let\expandafter\itfont\csname #1it\endcsname
2610 \expandafter\let\expandafter\slfont\csname #1sl\endcsname
2611 \expandafter\let\expandafter\bffont\csname #1bf\endcsname
2612 \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
2613 \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
2614 \expandafter\let\expandafter\sffont \csname #1sf\endcsname
2615 \expandafter\let\expandafter\ifont \csname #1i\endcsname
2616 \expandafter\let\expandafter\syfont \csname #1sy\endcsname
2617 \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
2618}
2619
2620\newif\ifrmisbold
2621
2622% Select smaller font size with the current style. Used to change font size
2623% in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
2624% normal roman text, also use bold fonts for roman text in the smaller size.
2625\def\switchtolllsize{%
2626 \expandafter\assignfonts\expandafter{\lllsize}%
2627 \ifrmisbold
2628 \let\rmfont\bffont
2629 \fi
2630 \csname\curfontstyle\endcsname
2631}%
2632
2633\def\switchtolsize{%
2634 \expandafter\assignfonts\expandafter{\lsize}%
2635 \ifrmisbold
2636 \let\rmfont\bffont
2637 \fi
2638 \csname\curfontstyle\endcsname
2639}%
2640
2641\def\definefontsetatsize#1#2#3#4#5{%
2642\expandafter\def\csname #1fonts\endcsname{%
2643 \def\curfontsize{#1}%
2644 \def\lsize{#2}\def\lllsize{#3}%
2645 \csname rmisbold#5\endcsname
2646 \assignfonts{#1}%
2647 \resetmathfonts
2648 \setleading{#4}%
2649}}
2650
2651\definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
2652\definefontsetatsize{title} {chap} {subsec} {27pt} {true}
2653\definefontsetatsize{chap} {sec} {text} {19pt} {true}
2654\definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
2655\definefontsetatsize{ssec} {text} {small} {15pt} {true}
2656\definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
2657\definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
2658\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
2659
2660\def\titlefont#1{{\titlefonts\rm #1}}
2661\let\subsecfonts = \ssecfonts
2662\let\subsubsecfonts = \ssecfonts
2663
2664% Define these just so they can be easily changed for other fonts.
2665\def\angleleft{$\langle$}
2666\def\angleright{$\rangle$}
2667
2668% Set the fonts to use with the @small... environments.
2669\let\smallexamplefonts = \smallfonts
2670
2671% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2672% can fit this many characters:
2673% 8.5x11=86 smallbook=72 a4=90 a5=69
2674% If we use \scriptfonts (8pt), then we can fit this many characters:
2675% 8.5x11=90+ smallbook=80 a4=90+ a5=77
2676% For me, subjectively, the few extra characters that fit aren't worth
2677% the additional smallness of 8pt. So I'm making the default 9pt.
2678%
2679% By the way, for comparison, here's what fits with @example (10pt):
2680% 8.5x11=71 smallbook=60 a4=75 a5=58
2681% --karl, 24jan03.
2682
2683% Set up the default fonts, so we can use them for creating boxes.
2684%
2685\definetextfontsizexi
2686
2687
2688% Check if we are currently using a typewriter font. Since all the
2689% Computer Modern typewriter fonts have zero interword stretch (and
2690% shrink), and it is reasonable to expect all typewriter fonts to have
2691% this property, we can check that font parameter.
2692%
2693\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2694
2695{
2696\catcode`\'=\active
2697\catcode`\`=\active
2698
2699\gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
2700\gdef\setregularquotes{\let`\lq \let'\rq}
2701}
2702
2703% Allow an option to not use regular directed right quote/apostrophe
2704% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2705% The undirected quote is ugly, so don't make it the default, but it
2706% works for pasting with more pdf viewers (at least evince), the
2707% lilypond developers report. xpdf does work with the regular 0x27.
2708%
2709\def\codequoteright{%
2710 \ifmonospace
2711 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2712 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2713 '%
2714 \else \char'15 \fi
2715 \else \char'15 \fi
2716 \else
2717 '%
2718 \fi
2719}
2720%
2721% and a similar option for the left quote char vs. a grave accent.
2722% Modern fonts display ASCII 0x60 as a grave accent, so some people like
2723% the code environments to do likewise.
2724%
2725\def\codequoteleft{%
2726 \ifmonospace
2727 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2728 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2729 % [Knuth] pp. 380,381,391
2730 % \relax disables Spanish ligatures ?` and !` of \tt font.
2731 \relax`%
2732 \else \char'22 \fi
2733 \else \char'22 \fi
2734 \else
2735 \relax`%
2736 \fi
2737}
2738
2739% Commands to set the quote options.
2740%
2741\parseargdef\codequoteundirected{%
2742 \def\temp{#1}%
2743 \ifx\temp\onword
2744 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2745 = t%
2746 \else\ifx\temp\offword
2747 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2748 = \relax
2749 \else
2750 \errhelp = \EMsimple
2751 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2752 \fi\fi
2753}
2754%
2755\parseargdef\codequotebacktick{%
2756 \def\temp{#1}%
2757 \ifx\temp\onword
2758 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2759 = t%
2760 \else\ifx\temp\offword
2761 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2762 = \relax
2763 \else
2764 \errhelp = \EMsimple
2765 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2766 \fi\fi
2767}
2768
2769% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2770\def\noligaturesquoteleft{\relax\lq}
2771
2772% Count depth in font-changes, for error checks
2773\newcount\fontdepth \fontdepth=0
2774
2775% Font commands.
2776
2777% #1 is the font command (\sl or \it), #2 is the text to slant.
2778% If we are in a monospaced environment, however, 1) always use \ttsl,
2779% and 2) do not add an italic correction.
2780\def\dosmartslant#1#2{%
2781 \ifusingtt
2782 {{\ttsl #2}\let\next=\relax}%
2783 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2784 \next
2785}
2786\def\smartslanted{\dosmartslant\sl}
2787\def\smartitalic{\dosmartslant\it}
2788
2789% Output an italic correction unless \next (presumed to be the following
2790% character) is such as not to need one.
2791\def\smartitaliccorrection{%
2792 \ifx\next,%
2793 \else\ifx\next-%
2794 \else\ifx\next.%
2795 \else\ifx\next\.%
2796 \else\ifx\next\comma%
2797 \else\ptexslash
2798 \fi\fi\fi\fi\fi
2799 \aftersmartic
2800}
2801
2802% Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2803\def\ttslanted#1{{\ttsl #1}}
2804
2805% @cite is like \smartslanted except unconditionally use \sl. We never want
2806% ttsl for book titles, do we?
2807\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2808
2809\def\aftersmartic{}
2810\def\var#1{%
2811 \let\saveaftersmartic = \aftersmartic
2812 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2813 \smartslanted{#1}%
2814}
2815
2816\let\i=\smartitalic
2817\let\slanted=\smartslanted
2818\let\dfn=\smartslanted
2819\let\emph=\smartitalic
2820
2821% Explicit font changes: @r, @sc, undocumented @ii.
2822\def\r#1{{\rm #1}} % roman font
2823\def\sc#1{{\smallcaps#1}} % smallcaps font
2824\def\ii#1{{\it #1}} % italic font
2825
2826% @b, explicit bold. Also @strong.
2827\def\b#1{{\bf #1}}
2828\let\strong=\b
2829
2830% @sansserif, explicit sans.
2831\def\sansserif#1{{\sf #1}}
2832
2833% We can't just use \exhyphenpenalty, because that only has effect at
2834% the end of a paragraph. Restore normal hyphenation at the end of the
2835% group within which \nohyphenation is presumably called.
2836%
2837\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2838\def\restorehyphenation{\hyphenchar\font = `- }
2839
2840% Set sfcode to normal for the chars that usually have another value.
2841% Can't use plain's \frenchspacing because it uses the `\x notation, and
2842% sometimes \x has an active definition that messes things up.
2843%
2844\catcode`@=11
2845 \def\plainfrenchspacing{%
2846 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
2847 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
2848 \def\endofsentencespacefactor{1000}% for @. and friends
2849 }
2850 \def\plainnonfrenchspacing{%
2851 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2852 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2853 \def\endofsentencespacefactor{3000}% for @. and friends
2854 }
2855\catcode`@=\other
2856\def\endofsentencespacefactor{3000}% default
2857
2858% @t, explicit typewriter.
2859\def\t#1{%
2860 {\tt \plainfrenchspacing #1}%
2861 \null
2862}
2863
2864% @samp.
2865\def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
2866
2867% @indicateurl is \samp, that is, with quotes.
2868\let\indicateurl=\samp
2869
2870% @code (and similar) prints in typewriter, but with spaces the same
2871% size as normal in the surrounding text, without hyphenation, etc.
2872% This is a subroutine for that.
2873\def\tclose#1{%
2874 {%
2875 % Change normal interword space to be same as for the current font.
2876 \spaceskip = \fontdimen2\font
2877 %
2878 % Switch to typewriter.
2879 \tt
2880 %
2881 % But `\ ' produces the large typewriter interword space.
2882 \def\ {{\spaceskip = 0pt{} }}%
2883 %
2884 % Turn off hyphenation.
2885 \nohyphenation
2886 %
2887 \plainfrenchspacing
2888 #1%
2889 }%
2890 \null % reset spacefactor to 1000
2891}
2892
2893% We *must* turn on hyphenation at `-' and `_' in @code.
2894% (But see \codedashfinish below.)
2895% Otherwise, it is too hard to avoid overfull hboxes
2896% in the Emacs manual, the Library manual, etc.
2897%
2898% Unfortunately, TeX uses one parameter (\hyphenchar) to control
2899% both hyphenation at - and hyphenation within words.
2900% We must therefore turn them both off (\tclose does that)
2901% and arrange explicitly to hyphenate at a dash. -- rms.
2902{
2903 \catcode`\-=\active \catcode`\_=\active
2904 \catcode`\'=\active \catcode`\`=\active
2905 \global\let'=\rq \global\let`=\lq % default definitions
2906 %
2907 \global\def\code{\begingroup
2908 \setcodequotes
2909 \catcode\dashChar=\active \catcode\underChar=\active
2910 \ifallowcodebreaks
2911 \let-\codedash
2912 \let_\codeunder
2913 \else
2914 \let-\normaldash
2915 \let_\realunder
2916 \fi
2917 % Given -foo (with a single dash), we do not want to allow a break
2918 % after the hyphen.
2919 \global\let\codedashprev=\codedash
2920 %
2921 \codex
2922 }
2923 %
2924 \gdef\codedash{\futurelet\next\codedashfinish}
2925 \gdef\codedashfinish{%
2926 \normaldash % always output the dash character itself.
2927 %
2928 % Now, output a discretionary to allow a line break, unless
2929 % (a) the next character is a -, or
2930 % (b) the preceding character is a -.
2931 % E.g., given --posix, we do not want to allow a break after either -.
2932 % Given --foo-bar, we do want to allow a break between the - and the b.
2933 \ifx\next\codedash \else
2934 \ifx\codedashprev\codedash
2935 \else \discretionary{}{}{}\fi
2936 \fi
2937 % we need the space after the = for the case when \next itself is a
2938 % space token; it would get swallowed otherwise. As in @code{- a}.
2939 \global\let\codedashprev= \next
2940 }
2941}
2942\def\normaldash{-}
2943%
2944\def\codex #1{\tclose{#1}\endgroup}
2945
2946\def\codeunder{%
2947 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2948 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2949 % will therefore expand the active definition of _, which is us
2950 % (inside @code that is), therefore an endless loop.
2951 \ifusingtt{\ifmmode
2952 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2953 \else\normalunderscore \fi
2954 \discretionary{}{}{}}%
2955 {\_}%
2956}
2957
2958% An additional complication: the above will allow breaks after, e.g.,
2959% each of the four underscores in __typeof__. This is bad.
2960% @allowcodebreaks provides a document-level way to turn breaking at -
2961% and _ on and off.
2962%
2963\newif\ifallowcodebreaks \allowcodebreakstrue
2964
2965\def\keywordtrue{true}
2966\def\keywordfalse{false}
2967
2968\parseargdef\allowcodebreaks{%
2969 \def\txiarg{#1}%
2970 \ifx\txiarg\keywordtrue
2971 \allowcodebreakstrue
2972 \else\ifx\txiarg\keywordfalse
2973 \allowcodebreaksfalse
2974 \else
2975 \errhelp = \EMsimple
2976 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2977 \fi\fi
2978}
2979
2980% For @command, @env, @file, @option quotes seem unnecessary,
2981% so use \code rather than \samp.
2982\let\command=\code
2983\let\env=\code
2984\let\file=\code
2985\let\option=\code
2986
2987% @uref (abbreviation for `urlref') aka @url takes an optional
2988% (comma-separated) second argument specifying the text to display and
2989% an optional third arg as text to display instead of (rather than in
2990% addition to) the url itself. First (mandatory) arg is the url.
2991
2992% TeX-only option to allow changing PDF output to show only the second
2993% arg (if given), and not the url (which is then just the link target).
2994\newif\ifurefurlonlylink
2995
2996% The default \pretolerance setting stops the penalty inserted in
2997% \urefallowbreak being a discouragement to line breaking. Set it to
2998% a negative value for this paragraph only. Hopefully this does not
2999% conflict with redefinitions of \par done elsewhere.
3000\def\nopretolerance{%
3001\pretolerance=-1
3002\def\par{\endgraf\pretolerance=100 \let\par\endgraf}%
3003}
3004
3005% The main macro is \urefbreak, which allows breaking at expected
3006% places within the url.
3007\def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak}
3008\let\uref=\urefbreak
3009%
3010\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
3011\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
3012 \unsepspaces
3013 \pdfurl{#1}%
3014 \setbox0 = \hbox{\ignorespaces #3}%
3015 \ifdim\wd0 > 0pt
3016 \unhbox0 % third arg given, show only that
3017 \else
3018 \setbox0 = \hbox{\ignorespaces #2}% look for second arg
3019 \ifdim\wd0 > 0pt
3020 \ifpdf
3021 % For pdfTeX and LuaTeX
3022 \ifurefurlonlylink
3023 % PDF plus option to not display url, show just arg
3024 \unhbox0
3025 \else
3026 % PDF, normally display both arg and url for consistency,
3027 % visibility, if the pdf is eventually used to print, etc.
3028 \unhbox0\ (\urefcode{#1})%
3029 \fi
3030 \else
3031 \ifx\XeTeXrevision\thisisundefined
3032 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
3033 \else
3034 % For XeTeX
3035 \ifurefurlonlylink
3036 % PDF plus option to not display url, show just arg
3037 \unhbox0
3038 \else
3039 % PDF, normally display both arg and url for consistency,
3040 % visibility, if the pdf is eventually used to print, etc.
3041 \unhbox0\ (\urefcode{#1})%
3042 \fi
3043 \fi
3044 \fi
3045 \else
3046 \urefcode{#1}% only url given, so show it
3047 \fi
3048 \fi
3049 \endlink
3050\endgroup}
3051
3052% Allow line breaks around only a few characters (only).
3053\def\urefcatcodes{%
3054 \catcode`\&=\active \catcode`\.=\active
3055 \catcode`\#=\active \catcode`\?=\active
3056 \catcode`\/=\active
3057}
3058{
3059 \urefcatcodes
3060 %
3061 \global\def\urefcode{\begingroup
3062 \setcodequotes
3063 \urefcatcodes
3064 \let&\urefcodeamp
3065 \let.\urefcodedot
3066 \let#\urefcodehash
3067 \let?\urefcodequest
3068 \let/\urefcodeslash
3069 \codex
3070 }
3071 %
3072 % By default, they are just regular characters.
3073 \global\def&{\normalamp}
3074 \global\def.{\normaldot}
3075 \global\def#{\normalhash}
3076 \global\def?{\normalquest}
3077 \global\def/{\normalslash}
3078}
3079
3080\def\urefcodeamp{\urefprebreak \&\urefpostbreak}
3081\def\urefcodedot{\urefprebreak .\urefpostbreak}
3082\def\urefcodehash{\urefprebreak \#\urefpostbreak}
3083\def\urefcodequest{\urefprebreak ?\urefpostbreak}
3084\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
3085{
3086 \catcode`\/=\active
3087 \global\def\urefcodeslashfinish{%
3088 \urefprebreak \slashChar
3089 % Allow line break only after the final / in a sequence of
3090 % slashes, to avoid line break between the slashes in http://.
3091 \ifx\next/\else \urefpostbreak \fi
3092 }
3093}
3094
3095% By default we'll break after the special characters, but some people like to
3096% break before the special chars, so allow that. Also allow no breaking at
3097% all, for manual control.
3098%
3099\parseargdef\urefbreakstyle{%
3100 \def\txiarg{#1}%
3101 \ifx\txiarg\wordnone
3102 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
3103 \else\ifx\txiarg\wordbefore
3104 \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
3105 \else\ifx\txiarg\wordafter
3106 \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
3107 \else
3108 \errhelp = \EMsimple
3109 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
3110 \fi\fi\fi
3111}
3112\def\wordafter{after}
3113\def\wordbefore{before}
3114\def\wordnone{none}
3115
3116% Allow a ragged right output to aid breaking long URL's. There can
3117% be a break at the \allowbreak with no extra glue (if the existing stretch in
3118% the line is sufficient), a break at the \penalty with extra glue added
3119% at the end of the line, or no break at all here.
3120% Changing the value of the penalty and/or the amount of stretch affects how
3121% preferable one choice is over the other.
3122\def\urefallowbreak{%
3123 \penalty0\relax
3124 \hskip 0pt plus 2 em\relax
3125 \penalty1000\relax
3126 \hskip 0pt plus -2 em\relax
3127}
3128
3129\urefbreakstyle after
3130
3131% @url synonym for @uref, since that's how everyone uses it.
3132%
3133\let\url=\uref
3134
3135% rms does not like angle brackets --karl, 17may97.
3136% So now @email is just like @uref, unless we are pdf.
3137%
3138%\def\email#1{\angleleft{\tt #1}\angleright}
3139\ifpdforxetex
3140 \def\email#1{\doemail#1,,\finish}
3141 \def\doemail#1,#2,#3\finish{\begingroup
3142 \unsepspaces
3143 \pdfurl{mailto:#1}%
3144 \setbox0 = \hbox{\ignorespaces #2}%
3145 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3146 \endlink
3147 \endgroup}
3148\else
3149 \let\email=\uref
3150\fi
3151
3152% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3153% `example' (@kbd uses ttsl only inside of @example and friends),
3154% or `code' (@kbd uses normal tty font always).
3155\parseargdef\kbdinputstyle{%
3156 \def\txiarg{#1}%
3157 \ifx\txiarg\worddistinct
3158 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
3159 \else\ifx\txiarg\wordexample
3160 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
3161 \else\ifx\txiarg\wordcode
3162 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
3163 \else
3164 \errhelp = \EMsimple
3165 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
3166 \fi\fi\fi
3167}
3168\def\worddistinct{distinct}
3169\def\wordexample{example}
3170\def\wordcode{code}
3171
3172% Default is `distinct'.
3173\kbdinputstyle distinct
3174
3175% @kbd is like @code, except that if the argument is just one @key command,
3176% then @kbd has no effect.
3177\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
3178
3179\def\xkey{\key}
3180\def\kbdsub#1#2#3\par{%
3181 \def\one{#1}\def\three{#3}\def\threex{??}%
3182 \ifx\one\xkey\ifx\threex\three \key{#2}%
3183 \else{\tclose{\kbdfont\setcodequotes\look}}\fi
3184 \else{\tclose{\kbdfont\setcodequotes\look}}\fi
3185}
3186
3187% definition of @key that produces a lozenge. Doesn't adjust to text size.
3188%\setfont\keyrm\rmshape{8}{1000}{OT1}
3189%\font\keysy=cmsy9
3190%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
3191% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
3192% \vbox{\hrule\kern-0.4pt
3193% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
3194% \kern-0.4pt\hrule}%
3195% \kern-.06em\raise0.4pt\hbox{\angleright}}}}
3196
3197% definition of @key with no lozenge. If the current font is already
3198% monospace, don't change it; that way, we respect @kbdinputstyle. But
3199% if it isn't monospace, then use \tt.
3200%
3201\def\key#1{{\setregularquotes
3202 \nohyphenation
3203 \ifmonospace\else\tt\fi
3204 #1}\null}
3205
3206% @clicksequence{File @click{} Open ...}
3207\def\clicksequence#1{\begingroup #1\endgroup}
3208
3209% @clickstyle @arrow (by default)
3210\parseargdef\clickstyle{\def\click{#1}}
3211\def\click{\arrow}
3212
3213% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
3214% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
3215%
3216\def\dmn#1{\thinspace #1}
3217
3218% @acronym for "FBI", "NATO", and the like.
3219% We print this one point size smaller, since it's intended for
3220% all-uppercase.
3221%
3222\def\acronym#1{\doacronym #1,,\finish}
3223\def\doacronym#1,#2,#3\finish{%
3224 {\switchtolsize #1}%
3225 \def\temp{#2}%
3226 \ifx\temp\empty \else
3227 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3228 \fi
3229 \null % reset \spacefactor=1000
3230}
3231
3232% @abbr for "Comput. J." and the like.
3233% No font change, but don't do end-of-sentence spacing.
3234%
3235\def\abbr#1{\doabbr #1,,\finish}
3236\def\doabbr#1,#2,#3\finish{%
3237 {\plainfrenchspacing #1}%
3238 \def\temp{#2}%
3239 \ifx\temp\empty \else
3240 \space ({\unsepspaces \ignorespaces \temp \unskip})%
3241 \fi
3242 \null % reset \spacefactor=1000
3243}
3244
3245% @asis just yields its argument. Used with @table, for example.
3246%
3247\def\asis#1{#1}
3248
3249% @math outputs its argument in math mode.
3250%
3251% One complication: _ usually means subscripts, but it could also mean
3252% an actual _ character, as in @math{@var{some_variable} + 1}. So make
3253% _ active, and distinguish by seeing if the current family is \slfam,
3254% which is what @var uses.
3255{
3256 \catcode`\_ = \active
3257 \gdef\mathunderscore{%
3258 \catcode`\_=\active
3259 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
3260 }
3261}
3262% Another complication: we want \\ (and @\) to output a math (or tt) \.
3263% FYI, plain.tex uses \\ as a temporary control sequence (for no
3264% particular reason), but this is not advertised and we don't care.
3265%
3266% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
3267\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
3268%
3269\def\math{%
3270 \ifmmode\else % only go into math if not in math mode already
3271 \tex
3272 \mathunderscore
3273 \let\\ = \mathbackslash
3274 \mathactive
3275 % make the texinfo accent commands work in math mode
3276 \let\"=\ddot
3277 \let\'=\acute
3278 \let\==\bar
3279 \let\^=\hat
3280 \let\`=\grave
3281 \let\u=\breve
3282 \let\v=\check
3283 \let\~=\tilde
3284 \let\dotaccent=\dot
3285 % have to provide another name for sup operator
3286 \let\mathopsup=\sup
3287 $\expandafter\finishmath\fi
3288}
3289\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
3290
3291% Some active characters (such as <) are spaced differently in math.
3292% We have to reset their definitions in case the @math was an argument
3293% to a command which sets the catcodes (such as @item or @section).
3294%
3295{
3296 \catcode`^ = \active
3297 \catcode`< = \active
3298 \catcode`> = \active
3299 \catcode`+ = \active
3300 \catcode`' = \active
3301 \gdef\mathactive{%
3302 \let^ = \ptexhat
3303 \let< = \ptexless
3304 \let> = \ptexgtr
3305 \let+ = \ptexplus
3306 \let' = \ptexquoteright
3307 }
3308}
3309
3310% for @sub and @sup, if in math mode, just do a normal sub/superscript.
3311% If in text, use math to place as sub/superscript, but switch
3312% into text mode, with smaller fonts. This is a different font than the
3313% one used for real math sub/superscripts (8pt vs. 7pt), but let's not
3314% fix it (significant additions to font machinery) until someone notices.
3315%
3316\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
3317\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
3318%
3319\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
3320\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
3321
3322% provide this command from LaTeX as it is very common
3323\def\frac#1#2{{{#1}\over{#2}}}
3324
3325% @displaymath.
3326% \globaldefs is needed to recognize the end lines in \tex and
3327% \end tex. Set \thisenv as @end displaymath is seen before @end tex.
3328{\obeylines
3329\globaldefs=1
3330\envdef\displaymath{%
3331\tex%
3332\def\thisenv{\displaymath}%
3333\begingroup\let\end\displaymathend%
3334$$%
3335}
3336
3337\def\displaymathend{$$\endgroup\end}%
3338
3339\def\Edisplaymath{%
3340\def\thisenv{\tex}%
3341\end tex
3342}}
3343
3344
3345% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
3346% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
3347% except specified as a normal braced arg, so no newlines to worry about.
3348%
3349\def\outfmtnametex{tex}
3350%
3351\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
3352\long\def\doinlinefmt#1,#2,\finish{%
3353 \def\inlinefmtname{#1}%
3354 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
3355}
3356%
3357% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
3358% FMTNAME is tex, else ELSE-TEXT.
3359\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
3360\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
3361 \def\inlinefmtname{#1}%
3362 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
3363}
3364%
3365% For raw, must switch into @tex before parsing the argument, to avoid
3366% setting catcodes prematurely. Doing it this way means that, for
3367% example, @inlineraw{html, foo{bar} gets a parse error instead of being
3368% ignored. But this isn't important because if people want a literal
3369% *right* brace they would have to use a command anyway, so they may as
3370% well use a command to get a left brace too. We could re-use the
3371% delimiter character idea from \verb, but it seems like overkill.
3372%
3373\long\def\inlineraw{\tex \doinlineraw}
3374\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
3375\def\doinlinerawtwo#1,#2,\finish{%
3376 \def\inlinerawname{#1}%
3377 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
3378 \endgroup % close group opened by \tex.
3379}
3380
3381% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
3382%
3383\long\def\inlineifset#1{\doinlineifset #1,\finish}
3384\long\def\doinlineifset#1,#2,\finish{%
3385 \def\inlinevarname{#1}%
3386 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
3387 \else\ignorespaces#2\fi
3388}
3389
3390% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
3391%
3392\long\def\inlineifclear#1{\doinlineifclear #1,\finish}
3393\long\def\doinlineifclear#1,#2,\finish{%
3394 \def\inlinevarname{#1}%
3395 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
3396}
3397
3398
3399\message{glyphs,}
3400% and logos.
3401
3402% @@ prints an @, as does @atchar{}.
3403\def\@{\char64 }
3404\let\atchar=\@
3405
3406% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
3407\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
3408\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
3409\let\{=\lbracechar
3410\let\}=\rbracechar
3411
3412% @comma{} to avoid , parsing problems.
3413\let\comma = ,
3414
3415% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
3416% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
3417\let\, = \ptexc
3418\let\dotaccent = \ptexdot
3419\def\ringaccent#1{{\accent23 #1}}
3420\let\tieaccent = \ptext
3421\let\ubaraccent = \ptexb
3422\let\udotaccent = \d
3423
3424% Other special characters: @questiondown @exclamdown @ordf @ordm
3425% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3426\def\questiondown{?`}
3427\def\exclamdown{!`}
3428\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
3429\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
3430
3431% Dotless i and dotless j, used for accents.
3432\def\imacro{i}
3433\def\jmacro{j}
3434\def\dotless#1{%
3435 \def\temp{#1}%
3436 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3437 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3438 \else \errmessage{@dotless can be used only with i or j}%
3439 \fi\fi
3440}
3441
3442% The \TeX{} logo, as in plain, but resetting the spacing so that a
3443% period following counts as ending a sentence. (Idea found in latex.)
3444%
3445\edef\TeX{\TeX \spacefactor=1000 }
3446
3447% @LaTeX{} logo. Not quite the same results as the definition in
3448% latex.ltx, since we use a different font for the raised A; it's most
3449% convenient for us to use an explicitly smaller font, rather than using
3450% the \scriptstyle font (since we don't reset \scriptstyle and
3451% \scriptscriptstyle).
3452%
3453\def\LaTeX{%
3454 L\kern-.36em
3455 {\setbox0=\hbox{T}%
3456 \vbox to \ht0{\hbox{%
3457 \ifx\textnominalsize\xwordpt
3458 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
3459 % Revert to plain's \scriptsize, which is 7pt.
3460 \count255=\the\fam $\fam\count255 \scriptstyle A$%
3461 \else
3462 % For 11pt, we can use our lllsize.
3463 \switchtolllsize A%
3464 \fi
3465 }%
3466 \vss
3467 }}%
3468 \kern-.15em
3469 \TeX
3470}
3471
3472% Some math mode symbols. Define \ensuremath to switch into math mode
3473% unless we are already there. Expansion tricks may not be needed here,
3474% but safer, and can't hurt.
3475\def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
3476\def\ensuredmath#1{$\relax#1$}
3477%
3478\def\bullet{\ensuremath\ptexbullet}
3479\def\geq{\ensuremath\ge}
3480\def\leq{\ensuremath\le}
3481\def\minus{\ensuremath-}
3482
3483% @dots{} outputs an ellipsis using the current font.
3484% We do .5em per period so that it has the same spacing in the cm
3485% typewriter fonts as three actual period characters; on the other hand,
3486% in other typewriter fonts three periods are wider than 1.5em. So do
3487% whichever is larger.
3488%
3489\def\dots{%
3490 \leavevmode
3491 \setbox0=\hbox{...}% get width of three periods
3492 \ifdim\wd0 > 1.5em
3493 \dimen0 = \wd0
3494 \else
3495 \dimen0 = 1.5em
3496 \fi
3497 \hbox to \dimen0{%
3498 \hskip 0pt plus.25fil
3499 .\hskip 0pt plus1fil
3500 .\hskip 0pt plus1fil
3501 .\hskip 0pt plus.5fil
3502 }%
3503}
3504
3505% @enddots{} is an end-of-sentence ellipsis.
3506%
3507\def\enddots{%
3508 \dots
3509 \spacefactor=\endofsentencespacefactor
3510}
3511
3512% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3513%
3514% Since these characters are used in examples, they should be an even number of
3515% \tt widths. Each \tt character is 1en, so two makes it 1em.
3516%
3517\def\point{$\star$}
3518\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3519\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3520\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3521\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3522\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3523
3524% The @error{} command.
3525% Adapted from the TeXbook's \boxit.
3526%
3527\newbox\errorbox
3528%
3529{\ttfont \global\dimen0 = 3em}% Width of the box.
3530\dimen2 = .55pt % Thickness of rules
3531% The text. (`r' is open on the right, `e' somewhat less so on the left.)
3532\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3533%
3534\setbox\errorbox=\hbox to \dimen0{\hfil
3535 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3536 \advance\hsize by -2\dimen2 % Rules.
3537 \vbox{%
3538 \hrule height\dimen2
3539 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3540 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3541 \kern3pt\vrule width\dimen2}% Space to right.
3542 \hrule height\dimen2}
3543 \hfil}
3544%
3545\def\error{\leavevmode\lower.7ex\copy\errorbox}
3546
3547% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3548%
3549\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi}
3550
3551% @euro{} comes from a separate font, depending on the current style.
3552% We use the free feym* fonts from the eurosym package by Henrik
3553% Theiling, which support regular, slanted, bold and bold slanted (and
3554% "outlined" (blackboard board, sort of) versions, which we don't need).
3555% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3556%
3557% Although only regular is the truly official Euro symbol, we ignore
3558% that. The Euro is designed to be slightly taller than the regular
3559% font height.
3560%
3561% feymr - regular
3562% feymo - slanted
3563% feybr - bold
3564% feybo - bold slanted
3565%
3566% There is no good (free) typewriter version, to my knowledge.
3567% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3568% Hmm.
3569%
3570% Also doesn't work in math. Do we need to do math with euro symbols?
3571% Hope not.
3572%
3573%
3574\def\euro{{\eurofont e}}
3575\def\eurofont{%
3576 % We set the font at each command, rather than predefining it in
3577 % \textfonts and the other font-switching commands, so that
3578 % installations which never need the symbol don't have to have the
3579 % font installed.
3580 %
3581 % There is only one designed size (nominal 10pt), so we always scale
3582 % that to the current nominal size.
3583 %
3584 % By the way, simply using "at 1em" works for cmr10 and the like, but
3585 % does not work for cmbx10 and other extended/shrunken fonts.
3586 %
3587 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3588 %
3589 \ifx\curfontstyle\bfstylename
3590 % bold:
3591 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3592 \else
3593 % regular:
3594 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3595 \fi
3596 \thiseurofont
3597}
3598
3599% Glyphs from the EC fonts. We don't use \let for the aliases, because
3600% sometimes we redefine the original macro, and the alias should reflect
3601% the redefinition.
3602%
3603% Use LaTeX names for the Icelandic letters.
3604\def\DH{{\ecfont \char"D0}} % Eth
3605\def\dh{{\ecfont \char"F0}} % eth
3606\def\TH{{\ecfont \char"DE}} % Thorn
3607\def\th{{\ecfont \char"FE}} % thorn
3608%
3609\def\guillemetleft{{\ecfont \char"13}}
3610\def\guillemotleft{\guillemetleft}
3611\def\guillemetright{{\ecfont \char"14}}
3612\def\guillemotright{\guillemetright}
3613\def\guilsinglleft{{\ecfont \char"0E}}
3614\def\guilsinglright{{\ecfont \char"0F}}
3615\def\quotedblbase{{\ecfont \char"12}}
3616\def\quotesinglbase{{\ecfont \char"0D}}
3617%
3618% This positioning is not perfect (see the ogonek LaTeX package), but
3619% we have the precomposed glyphs for the most common cases. We put the
3620% tests to use those glyphs in the single \ogonek macro so we have fewer
3621% dummy definitions to worry about for index entries, etc.
3622%
3623% ogonek is also used with other letters in Lithuanian (IOU), but using
3624% the precomposed glyphs for those is not so easy since they aren't in
3625% the same EC font.
3626\def\ogonek#1{{%
3627 \def\temp{#1}%
3628 \ifx\temp\macrocharA\Aogonek
3629 \else\ifx\temp\macrochara\aogonek
3630 \else\ifx\temp\macrocharE\Eogonek
3631 \else\ifx\temp\macrochare\eogonek
3632 \else
3633 \ecfont \setbox0=\hbox{#1}%
3634 \ifdim\ht0=1ex\accent"0C #1%
3635 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3636 \fi
3637 \fi\fi\fi\fi
3638 }%
3639}
3640\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3641\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3642\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3643\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3644%
3645% Use the European Computer Modern fonts (cm-super in outline format)
3646% for non-CM glyphs. That is ec* for regular text and tc* for the text
3647% companion symbols (LaTeX TS1 encoding). Both are part of the ec
3648% package and follow the same conventions.
3649%
3650\def\ecfont{\etcfont{e}}
3651\def\tcfont{\etcfont{t}}
3652%
3653\def\etcfont#1{%
3654 % We can't distinguish serif/sans and italic/slanted, but this
3655 % is used for crude hacks anyway (like adding French and German
3656 % quotes to documents typeset with CM, where we lose kerning), so
3657 % hopefully nobody will notice/care.
3658 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3659 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3660 \ifmonospace
3661 % typewriter:
3662 \font\thisecfont = #1ctt\ecsize \space at \nominalsize
3663 \else
3664 \ifx\curfontstyle\bfstylename
3665 % bold:
3666 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
3667 \else
3668 % regular:
3669 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3670 \fi
3671 \fi
3672 \thisecfont
3673}
3674
3675% @registeredsymbol - R in a circle. The font for the R should really
3676% be smaller yet, but lllsize is the best we can do for now.
3677% Adapted from the plain.tex definition of \copyright.
3678%
3679\def\registeredsymbol{%
3680 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
3681 \hfil\crcr\Orb}}%
3682 }$%
3683}
3684
3685% @textdegree - the normal degrees sign.
3686%
3687\def\textdegree{$^\circ$}
3688
3689% Laurent Siebenmann reports \Orb undefined with:
3690% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3691% so we'll define it if necessary.
3692%
3693\ifx\Orb\thisisundefined
3694\def\Orb{\mathhexbox20D}
3695\fi
3696
3697% Quotes.
3698\chardef\quoteleft=`\`
3699\chardef\quoteright=`\'
3700
3701% only change font for tt for correct kerning and to avoid using
3702% \ecfont unless necessary.
3703\def\quotedblleft{%
3704 \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi
3705}
3706
3707\def\quotedblright{%
3708 \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi
3709}
3710
3711
3712\message{page headings,}
3713
3714\newskip\titlepagetopglue \titlepagetopglue = 1.5in
3715\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3716
3717% First the title page. Must do @settitle before @titlepage.
3718\newif\ifseenauthor
3719\newif\iffinishedtitlepage
3720
3721% @setcontentsaftertitlepage used to do an implicit @contents or
3722% @shortcontents after @end titlepage, but it is now obsolete.
3723\def\setcontentsaftertitlepage{%
3724 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
3725 command; move your @contents command if you want the contents
3726 after the title page.}}%
3727\def\setshortcontentsaftertitlepage{%
3728 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
3729 command; move your @shortcontents and @contents commands if you
3730 want the contents after the title page.}}%
3731
3732\parseargdef\shorttitlepage{%
3733 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3734 \endgroup\page\hbox{}\page}
3735
3736\envdef\titlepage{%
3737 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3738 \begingroup
3739 \parindent=0pt \textfonts
3740 % Leave some space at the very top of the page.
3741 \vglue\titlepagetopglue
3742 % No rule at page bottom unless we print one at the top with @title.
3743 \finishedtitlepagetrue
3744 %
3745 % Most title ``pages'' are actually two pages long, with space
3746 % at the top of the second. We don't want the ragged left on the second.
3747 \let\oldpage = \page
3748 \def\page{%
3749 \iffinishedtitlepage\else
3750 \finishtitlepage
3751 \fi
3752 \let\page = \oldpage
3753 \page
3754 \null
3755 }%
3756}
3757
3758\def\Etitlepage{%
3759 \iffinishedtitlepage\else
3760 \finishtitlepage
3761 \fi
3762 % It is important to do the page break before ending the group,
3763 % because the headline and footline are only empty inside the group.
3764 % If we use the new definition of \page, we always get a blank page
3765 % after the title page, which we certainly don't want.
3766 \oldpage
3767 \endgroup
3768 %
3769 % Need this before the \...aftertitlepage checks so that if they are
3770 % in effect the toc pages will come out with page numbers.
3771 \HEADINGSon
3772}
3773
3774\def\finishtitlepage{%
3775 \vskip4pt \hrule height 2pt width \hsize
3776 \vskip\titlepagebottomglue
3777 \finishedtitlepagetrue
3778}
3779
3780% Settings used for typesetting titles: no hyphenation, no indentation,
3781% don't worry much about spacing, ragged right. This should be used
3782% inside a \vbox, and fonts need to be set appropriately first. \par should
3783% be specified before the end of the \vbox, since a vbox is a group.
3784%
3785\def\raggedtitlesettings{%
3786 \rm
3787 \hyphenpenalty=10000
3788 \parindent=0pt
3789 \tolerance=5000
3790 \ptexraggedright
3791}
3792
3793% Macros to be used within @titlepage:
3794
3795\let\subtitlerm=\rmfont
3796\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3797
3798\parseargdef\title{%
3799 \checkenv\titlepage
3800 \vbox{\titlefonts \raggedtitlesettings #1\par}%
3801 % print a rule at the page bottom also.
3802 \finishedtitlepagefalse
3803 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3804}
3805
3806\parseargdef\subtitle{%
3807 \checkenv\titlepage
3808 {\subtitlefont \rightline{#1}}%
3809}
3810
3811% @author should come last, but may come many times.
3812% It can also be used inside @quotation.
3813%
3814\parseargdef\author{%
3815 \def\temp{\quotation}%
3816 \ifx\thisenv\temp
3817 \def\quotationauthor{#1}% printed in \Equotation.
3818 \else
3819 \checkenv\titlepage
3820 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3821 {\secfonts\rm \leftline{#1}}%
3822 \fi
3823}
3824
3825
3826% Set up page headings and footings.
3827
3828\let\thispage=\folio
3829
3830\newtoks\evenheadline % headline on even pages
3831\newtoks\oddheadline % headline on odd pages
3832\newtoks\evenchapheadline% headline on even pages with a new chapter
3833\newtoks\oddchapheadline % headline on odd pages with a new chapter
3834\newtoks\evenfootline % footline on even pages
3835\newtoks\oddfootline % footline on odd pages
3836
3837% Now make \makeheadline and \makefootline in Plain TeX use those variables
3838\headline={{\textfonts\rm
3839 \ifchapterpage
3840 \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi
3841 \else
3842 \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi
3843 \fi}}
3844
3845\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3846 \else \the\evenfootline \fi}\HEADINGShook}
3847\let\HEADINGShook=\relax
3848
3849% Commands to set those variables.
3850% For example, this is what @headings on does
3851% @evenheading @thistitle|@thispage|@thischapter
3852% @oddheading @thischapter|@thispage|@thistitle
3853% @evenfooting @thisfile||
3854% @oddfooting ||@thisfile
3855
3856
3857\def\evenheading{\parsearg\evenheadingxxx}
3858\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3859\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3860 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
3861 \global\evenchapheadline=\evenheadline}
3862
3863\def\oddheading{\parsearg\oddheadingxxx}
3864\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3865\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3866 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3867 \global\oddchapheadline=\oddheadline}
3868
3869\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3870
3871\def\evenfooting{\parsearg\evenfootingxxx}
3872\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3873\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3874\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3875
3876\def\oddfooting{\parsearg\oddfootingxxx}
3877\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3878\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3879 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3880 %
3881 % Leave some space for the footline. Hopefully ok to assume
3882 % @evenfooting will not be used by itself.
3883 \global\advance\txipageheight by -12pt
3884 \global\advance\vsize by -12pt
3885}
3886
3887\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3888
3889% @evenheadingmarks top \thischapter <- chapter at the top of a page
3890% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3891%
3892% The same set of arguments for:
3893%
3894% @oddheadingmarks
3895% @evenfootingmarks
3896% @oddfootingmarks
3897% @everyheadingmarks
3898% @everyfootingmarks
3899
3900% These define \getoddheadingmarks, \getevenheadingmarks,
3901% \getoddfootingmarks, and \getevenfootingmarks, each to one of
3902% \gettopheadingmarks, \getbottomheadingmarks.
3903%
3904\def\evenheadingmarks{\headingmarks{even}{heading}}
3905\def\oddheadingmarks{\headingmarks{odd}{heading}}
3906\def\evenfootingmarks{\headingmarks{even}{footing}}
3907\def\oddfootingmarks{\headingmarks{odd}{footing}}
3908\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3909 \headingmarks{odd}{heading}{#1} }
3910\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3911 \headingmarks{odd}{footing}{#1} }
3912% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3913\def\headingmarks#1#2#3 {%
3914 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3915 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3916}
3917
3918\everyheadingmarks bottom
3919\everyfootingmarks bottom
3920
3921% @headings double turns headings on for double-sided printing.
3922% @headings single turns headings on for single-sided printing.
3923% @headings off turns them off.
3924% @headings on same as @headings double, retained for compatibility.
3925% @headings after turns on double-sided headings after this page.
3926% @headings doubleafter turns on double-sided headings after this page.
3927% @headings singleafter turns on single-sided headings after this page.
3928% By default, they are off at the start of a document,
3929% and turned `on' after @end titlepage.
3930
3931\parseargdef\headings{\csname HEADINGS#1\endcsname}
3932
3933\def\headingsoff{% non-global headings elimination
3934 \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}%
3935 \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}%
3936}
3937
3938\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3939\HEADINGSoff % it's the default
3940
3941% When we turn headings on, set the page number to 1.
3942\def\pageone{
3943 \global\pageno=1
3944 \global\arabiccount = \pagecount
3945}
3946
3947% For double-sided printing, put current file name in lower left corner,
3948% chapter name on inside top of right hand pages, document
3949% title on inside top of left hand pages, and page numbers on outside top
3950% edge of all pages.
3951\def\HEADINGSdouble{%
3952\pageone
3953\HEADINGSdoublex
3954}
3955\let\contentsalignmacro = \chappager
3956
3957% For single-sided printing, chapter title goes across top left of page,
3958% page number on top right.
3959\def\HEADINGSsingle{%
3960\pageone
3961\HEADINGSsinglex
3962}
3963\def\HEADINGSon{\HEADINGSdouble}
3964
3965\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3966\let\HEADINGSdoubleafter=\HEADINGSafter
3967\def\HEADINGSdoublex{%
3968\global\evenfootline={\hfil}
3969\global\oddfootline={\hfil}
3970\global\evenheadline={\line{\folio\hfil\thistitle}}
3971\global\oddheadline={\line{\thischapter\hfil\folio}}
3972\global\evenchapheadline={\line{\folio\hfil}}
3973\global\oddchapheadline={\line{\hfil\folio}}
3974\global\let\contentsalignmacro = \chapoddpage
3975}
3976
3977\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3978\def\HEADINGSsinglex{%
3979\global\evenfootline={\hfil}
3980\global\oddfootline={\hfil}
3981\global\evenheadline={\line{\thischapter\hfil\folio}}
3982\global\oddheadline={\line{\thischapter\hfil\folio}}
3983\global\evenchapheadline={\line{\hfil\folio}}
3984\global\oddchapheadline={\line{\hfil\folio}}
3985\global\let\contentsalignmacro = \chappager
3986}
3987
3988% for @setchapternewpage off
3989\def\HEADINGSsinglechapoff{%
3990\pageone
3991\global\evenfootline={\hfil}
3992\global\oddfootline={\hfil}
3993\global\evenheadline={\line{\thischapter\hfil\folio}}
3994\global\oddheadline={\line{\thischapter\hfil\folio}}
3995\global\evenchapheadline=\evenheadline
3996\global\oddchapheadline=\oddheadline
3997\global\let\contentsalignmacro = \chappager
3998}
3999
4000% Subroutines used in generating headings
4001% This produces Day Month Year style of output.
4002% Only define if not already defined, in case a txi-??.tex file has set
4003% up a different format (e.g., txi-cs.tex does this).
4004\ifx\today\thisisundefined
4005\def\today{%
4006 \number\day\space
4007 \ifcase\month
4008 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
4009 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
4010 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
4011 \fi
4012 \space\number\year}
4013\fi
4014
4015% @settitle line... specifies the title of the document, for headings.
4016% It generates no output of its own.
4017\def\thistitle{\putwordNoTitle}
4018\def\settitle{\parsearg{\gdef\thistitle}}
4019
4020
4021\message{tables,}
4022% Tables -- @table, @ftable, @vtable, @item(x).
4023
4024% default indentation of table text
4025\newdimen\tableindent \tableindent=.8in
4026% default indentation of @itemize and @enumerate text
4027\newdimen\itemindent \itemindent=.3in
4028% margin between end of table item and start of table text.
4029\newdimen\itemmargin \itemmargin=.1in
4030
4031% used internally for \itemindent minus \itemmargin
4032\newdimen\itemmax
4033
4034% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
4035% these defs.
4036% They also define \itemindex
4037% to index the item name in whatever manner is desired (perhaps none).
4038
4039\newif\ifitemxneedsnegativevskip
4040
4041\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
4042
4043\def\internalBitem{\smallbreak \parsearg\itemzzz}
4044\def\internalBitemx{\itemxpar \parsearg\itemzzz}
4045
4046\def\itemzzz #1{\begingroup %
4047 \advance\hsize by -\rightskip
4048 \advance\hsize by -\tableindent
4049 \setbox0=\hbox{\itemindicate{#1}}%
4050 \itemindex{#1}%
4051 \nobreak % This prevents a break before @itemx.
4052 %
4053 % If the item text does not fit in the space we have, put it on a line
4054 % by itself, and do not allow a page break either before or after that
4055 % line. We do not start a paragraph here because then if the next
4056 % command is, e.g., @kindex, the whatsit would get put into the
4057 % horizontal list on a line by itself, resulting in extra blank space.
4058 \ifdim \wd0>\itemmax
4059 %
4060 % Make this a paragraph so we get the \parskip glue and wrapping,
4061 % but leave it ragged-right.
4062 \begingroup
4063 \advance\leftskip by-\tableindent
4064 \advance\hsize by\tableindent
4065 \advance\rightskip by0pt plus1fil\relax
4066 \leavevmode\unhbox0\par
4067 \endgroup
4068 %
4069 % We're going to be starting a paragraph, but we don't want the
4070 % \parskip glue -- logically it's part of the @item we just started.
4071 \nobreak \vskip-\parskip
4072 %
4073 % Stop a page break at the \parskip glue coming up. However, if
4074 % what follows is an environment such as @example, there will be no
4075 % \parskip glue; then the negative vskip we just inserted would
4076 % cause the example and the item to crash together. So we use this
4077 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
4078 % \parskip glue after all. Section titles are handled this way also.
4079 %
4080 \penalty 10001
4081 \endgroup
4082 \itemxneedsnegativevskipfalse
4083 \else
4084 % The item text fits into the space. Start a paragraph, so that the
4085 % following text (if any) will end up on the same line.
4086 \noindent
4087 % Do this with kerns and \unhbox so that if there is a footnote in
4088 % the item text, it can migrate to the main vertical list and
4089 % eventually be printed.
4090 \nobreak\kern-\tableindent
4091 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
4092 \unhbox0
4093 \nobreak\kern\dimen0
4094 \endgroup
4095 \itemxneedsnegativevskiptrue
4096 \fi
4097}
4098
4099\def\item{\errmessage{@item while not in a list environment}}
4100\def\itemx{\errmessage{@itemx while not in a list environment}}
4101
4102% @table, @ftable, @vtable.
4103\envdef\table{%
4104 \let\itemindex\gobble
4105 \tablecheck{table}%
4106}
4107\envdef\ftable{%
4108 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
4109 \tablecheck{ftable}%
4110}
4111\envdef\vtable{%
4112 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
4113 \tablecheck{vtable}%
4114}
4115\def\tablecheck#1{%
4116 \ifnum \the\catcode`\^^M=\active
4117 \endgroup
4118 \errmessage{This command won't work in this context; perhaps the problem is
4119 that we are \inenvironment\thisenv}%
4120 \def\next{\doignore{#1}}%
4121 \else
4122 \let\next\tablex
4123 \fi
4124 \next
4125}
4126\def\tablex#1{%
4127 \def\itemindicate{#1}%
4128 \parsearg\tabley
4129}
4130\def\tabley#1{%
4131 {%
4132 \makevalueexpandable
4133 \edef\temp{\noexpand\tablez #1\space\space\space}%
4134 \expandafter
4135 }\temp \endtablez
4136}
4137\def\tablez #1 #2 #3 #4\endtablez{%
4138 \aboveenvbreak
4139 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
4140 \ifnum 0#2>0 \tableindent=#2\mil \fi
4141 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
4142 \itemmax=\tableindent
4143 \advance \itemmax by -\itemmargin
4144 \advance \leftskip by \tableindent
4145 \exdentamount=\tableindent
4146 \parindent = 0pt
4147 \parskip = \smallskipamount
4148 \ifdim \parskip=0pt \parskip=2pt \fi
4149 \let\item = \internalBitem
4150 \let\itemx = \internalBitemx
4151}
4152\def\Etable{\endgraf\afterenvbreak}
4153\let\Eftable\Etable
4154\let\Evtable\Etable
4155\let\Eitemize\Etable
4156\let\Eenumerate\Etable
4157
4158% This is the counter used by @enumerate, which is really @itemize
4159
4160\newcount \itemno
4161
4162\envdef\itemize{\parsearg\doitemize}
4163
4164\def\doitemize#1{%
4165 \aboveenvbreak
4166 \itemmax=\itemindent
4167 \advance\itemmax by -\itemmargin
4168 \advance\leftskip by \itemindent
4169 \exdentamount=\itemindent
4170 \parindent=0pt
4171 \parskip=\smallskipamount
4172 \ifdim\parskip=0pt \parskip=2pt \fi
4173 %
4174 % Try typesetting the item mark so that if the document erroneously says
4175 % something like @itemize @samp (intending @table), there's an error
4176 % right away at the @itemize. It's not the best error message in the
4177 % world, but it's better than leaving it to the @item. This means if
4178 % the user wants an empty mark, they have to say @w{} not just @w.
4179 \def\itemcontents{#1}%
4180 \setbox0 = \hbox{\itemcontents}%
4181 %
4182 % @itemize with no arg is equivalent to @itemize @bullet.
4183 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
4184 %
4185 \let\item=\itemizeitem
4186}
4187
4188% Definition of @item while inside @itemize and @enumerate.
4189%
4190\def\itemizeitem{%
4191 \advance\itemno by 1 % for enumerations
4192 {\let\par=\endgraf \smallbreak}% reasonable place to break
4193 {%
4194 % If the document has an @itemize directly after a section title, a
4195 % \nobreak will be last on the list, and \sectionheading will have
4196 % done a \vskip-\parskip. In that case, we don't want to zero
4197 % parskip, or the item text will crash with the heading. On the
4198 % other hand, when there is normal text preceding the item (as there
4199 % usually is), we do want to zero parskip, or there would be too much
4200 % space. In that case, we won't have a \nobreak before. At least
4201 % that's the theory.
4202 \ifnum\lastpenalty<10000 \parskip=0in \fi
4203 \noindent
4204 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
4205 %
4206 \ifinner\else
4207 \vadjust{\penalty 1200}% not good to break after first line of item.
4208 \fi
4209 % We can be in inner vertical mode in a footnote, although an
4210 % @itemize looks awful there.
4211 }%
4212 \flushcr
4213}
4214
4215% \splitoff TOKENS\endmark defines \first to be the first token in
4216% TOKENS, and \rest to be the remainder.
4217%
4218\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
4219
4220% Allow an optional argument of an uppercase letter, lowercase letter,
4221% or number, to specify the first label in the enumerated list. No
4222% argument is the same as `1'.
4223%
4224\envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
4225\def\enumeratey #1 #2\endenumeratey{%
4226 % If we were given no argument, pretend we were given `1'.
4227 \def\thearg{#1}%
4228 \ifx\thearg\empty \def\thearg{1}\fi
4229 %
4230 % Detect if the argument is a single token. If so, it might be a
4231 % letter. Otherwise, the only valid thing it can be is a number.
4232 % (We will always have one token, because of the test we just made.
4233 % This is a good thing, since \splitoff doesn't work given nothing at
4234 % all -- the first parameter is undelimited.)
4235 \expandafter\splitoff\thearg\endmark
4236 \ifx\rest\empty
4237 % Only one token in the argument. It could still be anything.
4238 % A ``lowercase letter'' is one whose \lccode is nonzero.
4239 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
4240 % not equal to itself.
4241 % Otherwise, we assume it's a number.
4242 %
4243 % We need the \relax at the end of the \ifnum lines to stop TeX from
4244 % continuing to look for a <number>.
4245 %
4246 \ifnum\lccode\expandafter`\thearg=0\relax
4247 \numericenumerate % a number (we hope)
4248 \else
4249 % It's a letter.
4250 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
4251 \lowercaseenumerate % lowercase letter
4252 \else
4253 \uppercaseenumerate % uppercase letter
4254 \fi
4255 \fi
4256 \else
4257 % Multiple tokens in the argument. We hope it's a number.
4258 \numericenumerate
4259 \fi
4260}
4261
4262% An @enumerate whose labels are integers. The starting integer is
4263% given in \thearg.
4264%
4265\def\numericenumerate{%
4266 \itemno = \thearg
4267 \startenumeration{\the\itemno}%
4268}
4269
4270% The starting (lowercase) letter is in \thearg.
4271\def\lowercaseenumerate{%
4272 \itemno = \expandafter`\thearg
4273 \startenumeration{%
4274 % Be sure we're not beyond the end of the alphabet.
4275 \ifnum\itemno=0
4276 \errmessage{No more lowercase letters in @enumerate; get a bigger
4277 alphabet}%
4278 \fi
4279 \char\lccode\itemno
4280 }%
4281}
4282
4283% The starting (uppercase) letter is in \thearg.
4284\def\uppercaseenumerate{%
4285 \itemno = \expandafter`\thearg
4286 \startenumeration{%
4287 % Be sure we're not beyond the end of the alphabet.
4288 \ifnum\itemno=0
4289 \errmessage{No more uppercase letters in @enumerate; get a bigger
4290 alphabet}
4291 \fi
4292 \char\uccode\itemno
4293 }%
4294}
4295
4296% Call \doitemize, adding a period to the first argument and supplying the
4297% common last two arguments. Also subtract one from the initial value in
4298% \itemno, since @item increments \itemno.
4299%
4300\def\startenumeration#1{%
4301 \advance\itemno by -1
4302 \doitemize{#1.}\flushcr
4303}
4304
4305
4306% @multitable macros
4307
4308% Macros used to set up halign preamble:
4309%
4310\let\endsetuptable\relax
4311\def\xendsetuptable{\endsetuptable}
4312\let\columnfractions\relax
4313\def\xcolumnfractions{\columnfractions}
4314\newif\ifsetpercent
4315
4316% #1 is the @columnfraction, usually a decimal number like .5, but might
4317% be just 1. We just use it, whatever it is.
4318%
4319\def\pickupwholefraction#1 {%
4320 \global\advance\colcount by 1
4321 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
4322 \setuptable
4323}
4324
4325\newcount\colcount
4326\def\setuptable#1{%
4327 \def\firstarg{#1}%
4328 \ifx\firstarg\xendsetuptable
4329 \let\go = \relax
4330 \else
4331 \ifx\firstarg\xcolumnfractions
4332 \global\setpercenttrue
4333 \else
4334 \ifsetpercent
4335 \let\go\pickupwholefraction
4336 \else
4337 \global\advance\colcount by 1
4338 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
4339 % separator; typically that is always in the input, anyway.
4340 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
4341 \fi
4342 \fi
4343 \ifx\go\pickupwholefraction
4344 % Put the argument back for the \pickupwholefraction call, so
4345 % we'll always have a period there to be parsed.
4346 \def\go{\pickupwholefraction#1}%
4347 \else
4348 \let\go = \setuptable
4349 \fi%
4350 \fi
4351 \go
4352}
4353
4354% @headitem starts a heading row, which we typeset in bold. Assignments
4355% have to be global since we are inside the implicit group of an
4356% alignment entry. \everycr below resets \everytab so we don't have to
4357% undo it ourselves.
4358\def\headitemfont{\b}% for people to use in the template row; not changeable
4359\def\headitem{%
4360 \checkenv\multitable
4361 \crcr
4362 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
4363 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
4364 \the\everytab % for the first item
4365}%
4366%
4367% default for tables with no headings.
4368\let\headitemcrhook=\relax
4369%
4370\def\tab{\checkenv\multitable &\the\everytab}%
4371
4372\newtoks\everytab % insert after every tab.
4373%
4374\envdef\multitable{%
4375 \vskip\parskip
4376 \startsavinginserts
4377 %
4378 % @item within a multitable starts a normal row.
4379 % We use \def instead of \let so that if one of the multitable entries
4380 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4381 % \endtemplate) expanding \doitemize.
4382 \def\item{\crcr}%
4383 %
4384 \tolerance=9500
4385 \hbadness=9500
4386 \parskip=0pt
4387 \parindent=6pt
4388 \overfullrule=0pt
4389 \global\colcount=0
4390 %
4391 \everycr = {%
4392 \noalign{%
4393 \global\everytab={}% Reset from possible headitem.
4394 \global\colcount=0 % Reset the column counter.
4395 %
4396 % Check for saved footnotes, etc.:
4397 \checkinserts
4398 %
4399 % Perhaps a \nobreak, then reset:
4400 \headitemcrhook
4401 \global\let\headitemcrhook=\relax
4402 }%
4403 }%
4404 %
4405 \parsearg\domultitable
4406}
4407\def\domultitable#1{%
4408 % To parse everything between @multitable and @item:
4409 \setuptable#1 \endsetuptable
4410 %
4411 % This preamble sets up a generic column definition, which will
4412 % be used as many times as user calls for columns.
4413 % \vtop will set a single line and will also let text wrap and
4414 % continue for many paragraphs if desired.
4415 \halign\bgroup &%
4416 \global\advance\colcount by 1
4417 \strut
4418 \vtop{%
4419 \advance\hsize by -1\leftskip
4420 % Find the correct column width
4421 \hsize=\expandafter\csname col\the\colcount\endcsname
4422 %
4423 \rightskip=0pt
4424 \ifnum\colcount=1
4425 \advance\hsize by\leftskip % Add indent of surrounding text
4426 \else
4427 % In order to keep entries from bumping into each other.
4428 \leftskip=12pt
4429 \ifsetpercent \else
4430 % If a template has been used
4431 \advance\hsize by \leftskip
4432 \fi
4433 \fi
4434 \noindent\ignorespaces##\unskip\strut
4435 }\cr
4436}
4437\def\Emultitable{%
4438 \crcr
4439 \egroup % end the \halign
4440 \global\setpercentfalse
4441}
4442
4443
4444\message{conditionals,}
4445
4446% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4447% @ifnotxml always succeed. They currently do nothing; we don't
4448% attempt to check whether the conditionals are properly nested. But we
4449% have to remember that they are conditionals, so that @end doesn't
4450% attempt to close an environment group.
4451%
4452\def\makecond#1{%
4453 \expandafter\let\csname #1\endcsname = \relax
4454 \expandafter\let\csname iscond.#1\endcsname = 1
4455}
4456\makecond{iftex}
4457\makecond{ifnotdocbook}
4458\makecond{ifnothtml}
4459\makecond{ifnotinfo}
4460\makecond{ifnotplaintext}
4461\makecond{ifnotxml}
4462
4463% Ignore @ignore, @ifhtml, @ifinfo, and the like.
4464%
4465\def\direntry{\doignore{direntry}}
4466\def\documentdescription{\doignore{documentdescription}}
4467\def\docbook{\doignore{docbook}}
4468\def\html{\doignore{html}}
4469\def\ifdocbook{\doignore{ifdocbook}}
4470\def\ifhtml{\doignore{ifhtml}}
4471\def\ifinfo{\doignore{ifinfo}}
4472\def\ifnottex{\doignore{ifnottex}}
4473\def\ifplaintext{\doignore{ifplaintext}}
4474\def\ifxml{\doignore{ifxml}}
4475\def\ignore{\doignore{ignore}}
4476\def\menu{\doignore{menu}}
4477\def\xml{\doignore{xml}}
4478
4479% Ignore text until a line `@end #1', keeping track of nested conditionals.
4480%
4481% A count to remember the depth of nesting.
4482\newcount\doignorecount
4483
4484\def\doignore#1{\begingroup
4485 % Scan in ``verbatim'' mode:
4486 \obeylines
4487 \catcode`\@ = \other
4488 \catcode`\{ = \other
4489 \catcode`\} = \other
4490 %
4491 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4492 \spaceisspace
4493 %
4494 % Count number of #1's that we've seen.
4495 \doignorecount = 0
4496 %
4497 % Swallow text until we reach the matching `@end #1'.
4498 \dodoignore{#1}%
4499}
4500
4501{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4502 \obeylines %
4503 %
4504 \gdef\dodoignore#1{%
4505 % #1 contains the command name as a string, e.g., `ifinfo'.
4506 %
4507 % Define a command to find the next `@end #1'.
4508 \long\def\doignoretext##1^^M@end #1{%
4509 \doignoretextyyy##1^^M@#1\_STOP_}%
4510 %
4511 % And this command to find another #1 command, at the beginning of a
4512 % line. (Otherwise, we would consider a line `@c @ifset', for
4513 % example, to count as an @ifset for nesting.)
4514 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4515 %
4516 % And now expand that command.
4517 \doignoretext ^^M%
4518 }%
4519}
4520
4521\def\doignoreyyy#1{%
4522 \def\temp{#1}%
4523 \ifx\temp\empty % Nothing found.
4524 \let\next\doignoretextzzz
4525 \else % Found a nested condition, ...
4526 \advance\doignorecount by 1
4527 \let\next\doignoretextyyy % ..., look for another.
4528 % If we're here, #1 ends with ^^M\ifinfo (for example).
4529 \fi
4530 \next #1% the token \_STOP_ is present just after this macro.
4531}
4532
4533% We have to swallow the remaining "\_STOP_".
4534%
4535\def\doignoretextzzz#1{%
4536 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4537 \let\next\enddoignore
4538 \else % Still inside a nested condition.
4539 \advance\doignorecount by -1
4540 \let\next\doignoretext % Look for the next @end.
4541 \fi
4542 \next
4543}
4544
4545% Finish off ignored text.
4546{ \obeylines%
4547 % Ignore anything after the last `@end #1'; this matters in verbatim
4548 % environments, where otherwise the newline after an ignored conditional
4549 % would result in a blank line in the output.
4550 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4551}
4552
4553
4554% @set VAR sets the variable VAR to an empty value.
4555% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4556%
4557% Since we want to separate VAR from REST-OF-LINE (which might be
4558% empty), we can't just use \parsearg; we have to insert a space of our
4559% own to delimit the rest of the line, and then take it out again if we
4560% didn't need it.
4561% We rely on the fact that \parsearg sets \catcode`\ =10.
4562%
4563\parseargdef\set{\setyyy#1 \endsetyyy}
4564\def\setyyy#1 #2\endsetyyy{%
4565 {%
4566 \makevalueexpandable
4567 \def\temp{#2}%
4568 \edef\next{\gdef\makecsname{SET#1}}%
4569 \ifx\temp\empty
4570 \next{}%
4571 \else
4572 \setzzz#2\endsetzzz
4573 \fi
4574 }%
4575}
4576% Remove the trailing space \setxxx inserted.
4577\def\setzzz#1 \endsetzzz{\next{#1}}
4578
4579% @clear VAR clears (i.e., unsets) the variable VAR.
4580%
4581\parseargdef\clear{%
4582 {%
4583 \makevalueexpandable
4584 \global\expandafter\let\csname SET#1\endcsname=\relax
4585 }%
4586}
4587
4588% @value{foo} gets the text saved in variable foo.
4589\def\value{\begingroup\makevalueexpandable\valuexxx}
4590\def\valuexxx#1{\expandablevalue{#1}\endgroup}
4591{
4592 \catcode`\-=\active \catcode`\_=\active
4593 %
4594 \gdef\makevalueexpandable{%
4595 \let\value = \expandablevalue
4596 % We don't want these characters active, ...
4597 \catcode`\-=\other \catcode`\_=\other
4598 % ..., but we might end up with active ones in the argument if
4599 % we're called from @code, as @code{@value{foo-bar_}}, though.
4600 % So \let them to their normal equivalents.
4601 \let-\normaldash \let_\normalunderscore
4602 }
4603}
4604
4605\def\expandablevalue#1{%
4606 \expandafter\ifx\csname SET#1\endcsname\relax
4607 {[No value for ``#1'']}%
4608 \message{Variable `#1', used in @value, is not set.}%
4609 \else
4610 \csname SET#1\endcsname
4611 \fi
4612}
4613
4614% Like \expandablevalue, but completely expandable (the \message in the
4615% definition above operates at the execution level of TeX). Used when
4616% writing to auxiliary files, due to the expansion that \write does.
4617% If flag is undefined, pass through an unexpanded @value command: maybe it
4618% will be set by the time it is read back in.
4619%
4620% NB flag names containing - or _ may not work here.
4621\def\dummyvalue#1{%
4622 \expandafter\ifx\csname SET#1\endcsname\relax
4623 \string\value{#1}%
4624 \else
4625 \csname SET#1\endcsname
4626 \fi
4627}
4628
4629% Used for @value's in index entries to form the sort key: expand the @value
4630% if possible, otherwise sort late.
4631\def\indexnofontsvalue#1{%
4632 \expandafter\ifx\csname SET#1\endcsname\relax
4633 ZZZZZZZ%
4634 \else
4635 \csname SET#1\endcsname
4636 \fi
4637}
4638
4639% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4640% with @set.
4641%
4642% To get the special treatment we need for `@end ifset,' we call
4643% \makecond and then redefine.
4644%
4645\makecond{ifset}
4646\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4647\def\doifset#1#2{%
4648 {%
4649 \makevalueexpandable
4650 \let\next=\empty
4651 \expandafter\ifx\csname SET#2\endcsname\relax
4652 #1% If not set, redefine \next.
4653 \fi
4654 \expandafter
4655 }\next
4656}
4657\def\ifsetfail{\doignore{ifset}}
4658
4659% @ifclear VAR ... @end executes the `...' iff VAR has never been
4660% defined with @set, or has been undefined with @clear.
4661%
4662% The `\else' inside the `\doifset' parameter is a trick to reuse the
4663% above code: if the variable is not set, do nothing, if it is set,
4664% then redefine \next to \ifclearfail.
4665%
4666\makecond{ifclear}
4667\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4668\def\ifclearfail{\doignore{ifclear}}
4669
4670% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4671% without the @) is in fact defined. We can only feasibly check at the
4672% TeX level, so something like `mathcode' is going to considered
4673% defined even though it is not a Texinfo command.
4674%
4675\makecond{ifcommanddefined}
4676\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4677%
4678\def\doifcmddefined#1#2{{%
4679 \makevalueexpandable
4680 \let\next=\empty
4681 \expandafter\ifx\csname #2\endcsname\relax
4682 #1% If not defined, \let\next as above.
4683 \fi
4684 \expandafter
4685 }\next
4686}
4687\def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4688
4689% @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4690\makecond{ifcommandnotdefined}
4691\def\ifcommandnotdefined{%
4692 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4693\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4694
4695% Set the `txicommandconditionals' variable, so documents have a way to
4696% test if the @ifcommand...defined conditionals are available.
4697\set txicommandconditionals
4698
4699% @dircategory CATEGORY -- specify a category of the dir file
4700% which this file should belong to. Ignore this in TeX.
4701\let\dircategory=\comment
4702
4703% @defininfoenclose.
4704\let\definfoenclose=\comment
4705
4706
4707\message{indexing,}
4708% Index generation facilities
4709
4710% Define \newwrite to be identical to plain tex's \newwrite
4711% except not \outer, so it can be used within macros and \if's.
4712\edef\newwrite{\makecsname{ptexnewwrite}}
4713
4714% \newindex {foo} defines an index named IX.
4715% It automatically defines \IXindex such that
4716% \IXindex ...rest of line... puts an entry in the index IX.
4717% It also defines \IXindfile to be the number of the output channel for
4718% the file that accumulates this index. The file's extension is IX.
4719% The name of an index should be no more than 2 characters long
4720% for the sake of vms.
4721%
4722\def\newindex#1{%
4723 \expandafter\chardef\csname#1indfile\endcsname=0
4724 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4725 \noexpand\doindex{#1}}
4726}
4727
4728% @defindex foo == \newindex{foo}
4729%
4730\def\defindex{\parsearg\newindex}
4731
4732% Define @defcodeindex, like @defindex except put all entries in @code.
4733%
4734\def\defcodeindex{\parsearg\newcodeindex}
4735%
4736\def\newcodeindex#1{%
4737 \expandafter\chardef\csname#1indfile\endcsname=0
4738 \expandafter\xdef\csname#1index\endcsname{%
4739 \noexpand\docodeindex{#1}}%
4740}
4741
4742% The default indices:
4743\newindex{cp}% concepts,
4744\newcodeindex{fn}% functions,
4745\newcodeindex{vr}% variables,
4746\newcodeindex{tp}% types,
4747\newcodeindex{ky}% keys
4748\newcodeindex{pg}% and programs.
4749
4750
4751% @synindex foo bar makes index foo feed into index bar.
4752% Do this instead of @defindex foo if you don't want it as a separate index.
4753%
4754% @syncodeindex foo bar similar, but put all entries made for index foo
4755% inside @code.
4756%
4757\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4758\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4759
4760% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4761% #3 the target index (bar).
4762\def\dosynindex#1#2#3{%
4763 \requireopenindexfile{#3}%
4764 % redefine \fooindfile:
4765 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4766 \expandafter\let\csname#2indfile\endcsname=\temp
4767 % redefine \fooindex:
4768 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4769}
4770
4771% Define \doindex, the driver for all index macros.
4772% Argument #1 is generated by the calling \fooindex macro,
4773% and it is the two-letter name of the index.
4774
4775\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4776\def\doindexxxx #1{\doind{\indexname}{#1}}
4777
4778% like the previous two, but they put @code around the argument.
4779\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4780\def\docodeindexxxx #1{\docind{\indexname}{#1}}
4781
4782
4783% Used for the aux, toc and index files to prevent expansion of Texinfo
4784% commands.
4785%
4786\def\atdummies{%
4787 \definedummyletter\@%
4788 \definedummyletter\ %
4789 \definedummyletter\{%
4790 \definedummyletter\}%
4791 \definedummyletter\&%
4792 %
4793 % Do the redefinitions.
4794 \definedummies
4795 \otherbackslash
4796}
4797
4798% \definedummyword defines \#1 as \string\#1\space, thus effectively
4799% preventing its expansion. This is used only for control words,
4800% not control letters, because the \space would be incorrect for
4801% control characters, but is needed to separate the control word
4802% from whatever follows.
4803%
4804% These can be used both for control words that take an argument and
4805% those that do not. If it is followed by {arg} in the input, then
4806% that will dutifully get written to the index (or wherever).
4807%
4808% For control letters, we have \definedummyletter, which omits the
4809% space.
4810%
4811\def\definedummyword #1{\def#1{\string#1\space}}%
4812\def\definedummyletter#1{\def#1{\string#1}}%
4813\let\definedummyaccent\definedummyletter
4814
4815% Called from \atdummies to prevent the expansion of commands.
4816%
4817\def\definedummies{%
4818 %
4819 \let\commondummyword\definedummyword
4820 \let\commondummyletter\definedummyletter
4821 \let\commondummyaccent\definedummyaccent
4822 \commondummiesnofonts
4823 %
4824 \definedummyletter\_%
4825 \definedummyletter\-%
4826 %
4827 % Non-English letters.
4828 \definedummyword\AA
4829 \definedummyword\AE
4830 \definedummyword\DH
4831 \definedummyword\L
4832 \definedummyword\O
4833 \definedummyword\OE
4834 \definedummyword\TH
4835 \definedummyword\aa
4836 \definedummyword\ae
4837 \definedummyword\dh
4838 \definedummyword\exclamdown
4839 \definedummyword\l
4840 \definedummyword\o
4841 \definedummyword\oe
4842 \definedummyword\ordf
4843 \definedummyword\ordm
4844 \definedummyword\questiondown
4845 \definedummyword\ss
4846 \definedummyword\th
4847 %
4848 % Although these internal commands shouldn't show up, sometimes they do.
4849 \definedummyword\bf
4850 \definedummyword\gtr
4851 \definedummyword\hat
4852 \definedummyword\less
4853 \definedummyword\sf
4854 \definedummyword\sl
4855 \definedummyword\tclose
4856 \definedummyword\tt
4857 %
4858 \definedummyword\LaTeX
4859 \definedummyword\TeX
4860 %
4861 % Assorted special characters.
4862 \definedummyword\ampchar
4863 \definedummyword\atchar
4864 \definedummyword\arrow
4865 \definedummyword\backslashchar
4866 \definedummyword\bullet
4867 \definedummyword\comma
4868 \definedummyword\copyright
4869 \definedummyword\registeredsymbol
4870 \definedummyword\dots
4871 \definedummyword\enddots
4872 \definedummyword\entrybreak
4873 \definedummyword\equiv
4874 \definedummyword\error
4875 \definedummyword\euro
4876 \definedummyword\expansion
4877 \definedummyword\geq
4878 \definedummyword\guillemetleft
4879 \definedummyword\guillemetright
4880 \definedummyword\guilsinglleft
4881 \definedummyword\guilsinglright
4882 \definedummyword\lbracechar
4883 \definedummyword\leq
4884 \definedummyword\mathopsup
4885 \definedummyword\minus
4886 \definedummyword\ogonek
4887 \definedummyword\pounds
4888 \definedummyword\point
4889 \definedummyword\print
4890 \definedummyword\quotedblbase
4891 \definedummyword\quotedblleft
4892 \definedummyword\quotedblright
4893 \definedummyword\quoteleft
4894 \definedummyword\quoteright
4895 \definedummyword\quotesinglbase
4896 \definedummyword\rbracechar
4897 \definedummyword\result
4898 \definedummyword\sub
4899 \definedummyword\sup
4900 \definedummyword\textdegree
4901 %
4902 \definedummyword\subentry
4903 %
4904 % We want to disable all macros so that they are not expanded by \write.
4905 \macrolist
4906 \let\value\dummyvalue
4907 %
4908 \normalturnoffactive
4909}
4910
4911% \commondummiesnofonts: common to \definedummies and \indexnofonts.
4912% Define \commondummyletter, \commondummyaccent and \commondummyword before
4913% using. Used for accents, font commands, and various control letters.
4914%
4915\def\commondummiesnofonts{%
4916 % Control letters and accents.
4917 \commondummyletter\!%
4918 \commondummyaccent\"%
4919 \commondummyaccent\'%
4920 \commondummyletter\*%
4921 \commondummyaccent\,%
4922 \commondummyletter\.%
4923 \commondummyletter\/%
4924 \commondummyletter\:%
4925 \commondummyaccent\=%
4926 \commondummyletter\?%
4927 \commondummyaccent\^%
4928 \commondummyaccent\`%
4929 \commondummyaccent\~%
4930 \commondummyword\u
4931 \commondummyword\v
4932 \commondummyword\H
4933 \commondummyword\dotaccent
4934 \commondummyword\ogonek
4935 \commondummyword\ringaccent
4936 \commondummyword\tieaccent
4937 \commondummyword\ubaraccent
4938 \commondummyword\udotaccent
4939 \commondummyword\dotless
4940 %
4941 % Texinfo font commands.
4942 \commondummyword\b
4943 \commondummyword\i
4944 \commondummyword\r
4945 \commondummyword\sansserif
4946 \commondummyword\sc
4947 \commondummyword\slanted
4948 \commondummyword\t
4949 %
4950 % Commands that take arguments.
4951 \commondummyword\abbr
4952 \commondummyword\acronym
4953 \commondummyword\anchor
4954 \commondummyword\cite
4955 \commondummyword\code
4956 \commondummyword\command
4957 \commondummyword\dfn
4958 \commondummyword\dmn
4959 \commondummyword\email
4960 \commondummyword\emph
4961 \commondummyword\env
4962 \commondummyword\file
4963 \commondummyword\image
4964 \commondummyword\indicateurl
4965 \commondummyword\inforef
4966 \commondummyword\kbd
4967 \commondummyword\key
4968 \commondummyword\math
4969 \commondummyword\option
4970 \commondummyword\pxref
4971 \commondummyword\ref
4972 \commondummyword\samp
4973 \commondummyword\strong
4974 \commondummyword\tie
4975 \commondummyword\U
4976 \commondummyword\uref
4977 \commondummyword\url
4978 \commondummyword\var
4979 \commondummyword\verb
4980 \commondummyword\w
4981 \commondummyword\xref
4982}
4983
4984\let\indexlbrace\relax
4985\let\indexrbrace\relax
4986\let\indexatchar\relax
4987\let\indexbackslash\relax
4988
4989{\catcode`\@=0
4990\catcode`\\=13
4991 @gdef@backslashdisappear{@def\{}}
4992}
4993
4994{
4995\catcode`\<=13
4996\catcode`\-=13
4997\catcode`\`=13
4998 \gdef\indexnonalnumdisappear{%
4999 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
5000 % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
5001 % (Introduced for FSFS 2nd ed.)
5002 \let`=\empty
5003 \fi
5004 %
5005 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
5006 \backslashdisappear
5007 \fi
5008 %
5009 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
5010 \def-{}%
5011 \fi
5012 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
5013 \def<{}%
5014 \fi
5015 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
5016 \def\@{}%
5017 \fi
5018 }
5019
5020 \gdef\indexnonalnumreappear{%
5021 \let-\normaldash
5022 \let<\normalless
5023 }
5024}
5025
5026
5027% \indexnofonts is used when outputting the strings to sort the index
5028% by, and when constructing control sequence names. It eliminates all
5029% control sequences and just writes whatever the best ASCII sort string
5030% would be for a given command (usually its argument).
5031%
5032\def\indexnofonts{%
5033 % Accent commands should become @asis.
5034 \def\commondummyaccent##1{\let##1\asis}%
5035 % We can just ignore other control letters.
5036 \def\commondummyletter##1{\let##1\empty}%
5037 % All control words become @asis by default; overrides below.
5038 \let\commondummyword\commondummyaccent
5039 \commondummiesnofonts
5040 %
5041 % Don't no-op \tt, since it isn't a user-level command
5042 % and is used in the definitions of the active chars like <, >, |, etc.
5043 % Likewise with the other plain tex font commands.
5044 %\let\tt=\asis
5045 %
5046 \def\ { }%
5047 \def\@{@}%
5048 \def\_{\normalunderscore}%
5049 \def\-{}% @- shouldn't affect sorting
5050 %
5051 \uccode`\1=`\{ \uppercase{\def\{{1}}%
5052 \uccode`\1=`\} \uppercase{\def\}{1}}%
5053 \let\lbracechar\{%
5054 \let\rbracechar\}%
5055 %
5056 % Non-English letters.
5057 \def\AA{AA}%
5058 \def\AE{AE}%
5059 \def\DH{DZZ}%
5060 \def\L{L}%
5061 \def\OE{OE}%
5062 \def\O{O}%
5063 \def\TH{TH}%
5064 \def\aa{aa}%
5065 \def\ae{ae}%
5066 \def\dh{dzz}%
5067 \def\exclamdown{!}%
5068 \def\l{l}%
5069 \def\oe{oe}%
5070 \def\ordf{a}%
5071 \def\ordm{o}%
5072 \def\o{o}%
5073 \def\questiondown{?}%
5074 \def\ss{ss}%
5075 \def\th{th}%
5076 %
5077 \let\do\indexnofontsdef
5078 %
5079 \do\LaTeX{LaTeX}%
5080 \do\TeX{TeX}%
5081 %
5082 % Assorted special characters.
5083 \do\atchar{@}%
5084 \do\arrow{->}%
5085 \do\bullet{bullet}%
5086 \do\comma{,}%
5087 \do\copyright{copyright}%
5088 \do\dots{...}%
5089 \do\enddots{...}%
5090 \do\equiv{==}%
5091 \do\error{error}%
5092 \do\euro{euro}%
5093 \do\expansion{==>}%
5094 \do\geq{>=}%
5095 \do\guillemetleft{<<}%
5096 \do\guillemetright{>>}%
5097 \do\guilsinglleft{<}%
5098 \do\guilsinglright{>}%
5099 \do\leq{<=}%
5100 \do\lbracechar{\{}%
5101 \do\minus{-}%
5102 \do\point{.}%
5103 \do\pounds{pounds}%
5104 \do\print{-|}%
5105 \do\quotedblbase{"}%
5106 \do\quotedblleft{"}%
5107 \do\quotedblright{"}%
5108 \do\quoteleft{`}%
5109 \do\quoteright{'}%
5110 \do\quotesinglbase{,}%
5111 \do\rbracechar{\}}%
5112 \do\registeredsymbol{R}%
5113 \do\result{=>}%
5114 \do\textdegree{o}%
5115 %
5116 % We need to get rid of all macros, leaving only the arguments (if present).
5117 % Of course this is not nearly correct, but it is the best we can do for now.
5118 % makeinfo does not expand macros in the argument to @deffn, which ends up
5119 % writing an index entry, and texindex isn't prepared for an index sort entry
5120 % that starts with \.
5121 %
5122 % Since macro invocations are followed by braces, we can just redefine them
5123 % to take a single TeX argument. The case of a macro invocation that
5124 % goes to end-of-line is not handled.
5125 %
5126 \macrolist
5127 \let\value\indexnofontsvalue
5128}
5129
5130% Give the control sequence a definition that removes the {} that follows
5131% its use, e.g. @AA{} -> AA
5132\def\indexnofontsdef#1#2{\def#1##1{#2}}%
5133
5134
5135
5136
5137% #1 is the index name, #2 is the entry text.
5138\def\doind#1#2{%
5139 \iflinks
5140 {%
5141 %
5142 \requireopenindexfile{#1}%
5143 \edef\writeto{\csname#1indfile\endcsname}%
5144 %
5145 \def\indextext{#2}%
5146 \safewhatsit\doindwrite
5147 }%
5148 \fi
5149}
5150
5151% Same as \doind, but for code indices
5152\def\docind#1#2{%
5153 \iflinks
5154 {%
5155 %
5156 \requireopenindexfile{#1}%
5157 \edef\writeto{\csname#1indfile\endcsname}%
5158 %
5159 \def\indextext{#2}%
5160 \safewhatsit\docindwrite
5161 }%
5162 \fi
5163}
5164
5165% Check if an index file has been opened, and if not, open it.
5166\def\requireopenindexfile#1{%
5167\ifnum\csname #1indfile\endcsname=0
5168 \expandafter\newwrite \csname#1indfile\endcsname
5169 \edef\suffix{#1}%
5170 % A .fls suffix would conflict with the file extension for the output
5171 % of -recorder, so use .f1s instead.
5172 \ifx\suffix\indexisfl\def\suffix{f1}\fi
5173 % Open the file
5174 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
5175 % Using \immediate above here prevents an object entering into the current
5176 % box, which could confound checks such as those in \safewhatsit for
5177 % preceding skips.
5178 \typeout{Writing index file \jobname.\suffix}%
5179\fi}
5180\def\indexisfl{fl}
5181
5182% Definition for writing index entry sort key.
5183{
5184\catcode`\-=13
5185\gdef\indexwritesortas{%
5186 \begingroup
5187 \indexnonalnumreappear
5188 \indexwritesortasxxx}
5189\gdef\indexwritesortasxxx#1{%
5190 \xdef\indexsortkey{#1}\endgroup}
5191}
5192
5193\def\indexwriteseealso#1{
5194 \gdef\pagenumbertext{\string\seealso{#1}}%
5195}
5196\def\indexwriteseeentry#1{
5197 \gdef\pagenumbertext{\string\seeentry{#1}}%
5198}
5199
5200% The default definitions
5201\def\sortas#1{}%
5202\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
5203\def\putwordSeeAlso{See also}
5204\def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only
5205
5206
5207% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
5208% * Set \bracedtext to "{aaa}{bbb}"
5209% * Set \fullindexsortkey to "aaa @subentry ZZZ"
5210% * If @seealso occurs, set \pagenumbertext
5211%
5212\def\splitindexentry#1{%
5213 \gdef\fullindexsortkey{}%
5214 \xdef\bracedtext{}%
5215 \def\sep{}%
5216 \def\seealso##1{}%
5217 \def\seeentry##1{}%
5218 \expandafter\doindexsegment#1\subentry\finish\subentry
5219}
5220
5221% append the results from the next segment
5222\def\doindexsegment#1\subentry{%
5223 \def\segment{#1}%
5224 \ifx\segment\isfinish
5225 \else
5226 %
5227 % Fully expand the segment, throwing away any @sortas directives, and
5228 % trim spaces.
5229 \edef\trimmed{\segment}%
5230 \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5231 \ifincodeindex
5232 \edef\trimmed{\noexpand\code{\trimmed}}%
5233 \fi
5234 %
5235 \xdef\bracedtext{\bracedtext{\trimmed}}%
5236 %
5237 % Get the string to sort by. Process the segment with all
5238 % font commands turned off.
5239 \bgroup
5240 \let\sortas\indexwritesortas
5241 \let\seealso\indexwriteseealso
5242 \let\seeentry\indexwriteseeentry
5243 \indexnofonts
5244 % The braces around the commands are recognized by texindex.
5245 \def\lbracechar{{\string\indexlbrace}}%
5246 \def\rbracechar{{\string\indexrbrace}}%
5247 \let\{=\lbracechar
5248 \let\}=\rbracechar
5249 \def\@{{\string\indexatchar}}%
5250 \def\atchar##1{\@}%
5251 \def\backslashchar{{\string\indexbackslash}}%
5252 \uccode`\~=`\\ \uppercase{\let~\backslashchar}%
5253 %
5254 \let\indexsortkey\empty
5255 \global\let\pagenumbertext\empty
5256 % Execute the segment and throw away the typeset output. This executes
5257 % any @sortas or @seealso commands in this segment.
5258 \setbox\dummybox = \hbox{\segment}%
5259 \ifx\indexsortkey\empty{%
5260 \indexnonalnumdisappear
5261 \xdef\trimmed{\segment}%
5262 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5263 \xdef\indexsortkey{\trimmed}%
5264 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
5265 }\fi
5266 %
5267 % Append to \fullindexsortkey.
5268 \edef\tmp{\gdef\noexpand\fullindexsortkey{%
5269 \fullindexsortkey\sep\indexsortkey}}%
5270 \tmp
5271 \egroup
5272 \def\sep{\subentry}%
5273 %
5274 \expandafter\doindexsegment
5275 \fi
5276}
5277\def\isfinish{\finish}%
5278\newbox\dummybox % used above
5279
5280\let\subentry\relax
5281
5282% Use \ instead of @ in index files. To support old texi2dvi and texindex.
5283% This works without changing the escape character used in the toc or aux
5284% files because the index entries are fully expanded here, and \string uses
5285% the current value of \escapechar.
5286\def\escapeisbackslash{\escapechar=`\\}
5287
5288% Use \ in index files by default. texi2dvi didn't support @ as the escape
5289% character (as it checked for "\entry" in the files, and not "@entry"). When
5290% the new version of texi2dvi has had a chance to become more prevalent, then
5291% the escape character can change back to @ again. This should be an easy
5292% change to make now because both @ and \ are only used as escape characters in
5293% index files, never standing for themselves.
5294%
5295\set txiindexescapeisbackslash
5296
5297% Write the entry in \indextext to the index file.
5298%
5299
5300\newif\ifincodeindex
5301\def\doindwrite{\incodeindexfalse\doindwritex}
5302\def\docindwrite{\incodeindextrue\doindwritex}
5303
5304\def\doindwritex{%
5305 \maybemarginindex
5306 %
5307 \atdummies
5308 %
5309 \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else
5310 \escapeisbackslash
5311 \fi
5312 %
5313 % For texindex which always views { and } as separators.
5314 \def\{{\lbracechar{}}%
5315 \def\}{\rbracechar{}}%
5316 \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}%
5317 %
5318 % Split the entry into primary entry and any subentries, and get the index
5319 % sort key.
5320 \splitindexentry\indextext
5321 %
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 %
5328 \edef\temp{%
5329 \write\writeto{%
5330 \string\entry{\fullindexsortkey}%
5331 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
5332 \bracedtext}%
5333 }%
5334 \temp
5335}
5336
5337% Put the index entry in the margin if desired (undocumented).
5338\def\maybemarginindex{%
5339 \ifx\SETmarginindex\relax\else
5340 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
5341 \fi
5342}
5343\let\SETmarginindex=\relax
5344
5345
5346% Take care of unwanted page breaks/skips around a whatsit:
5347%
5348% If a skip is the last thing on the list now, preserve it
5349% by backing up by \lastskip, doing the \write, then inserting
5350% the skip again. Otherwise, the whatsit generated by the
5351% \write or \pdfdest will make \lastskip zero. The result is that
5352% sequences like this:
5353% @end defun
5354% @tindex whatever
5355% @defun ...
5356% will have extra space inserted, because the \medbreak in the
5357% start of the @defun won't see the skip inserted by the @end of
5358% the previous defun.
5359%
5360% But don't do any of this if we're not in vertical mode. We
5361% don't want to do a \vskip and prematurely end a paragraph.
5362%
5363% Avoid page breaks due to these extra skips, too.
5364%
5365% But wait, there is a catch there:
5366% We'll have to check whether \lastskip is zero skip. \ifdim is not
5367% sufficient for this purpose, as it ignores stretch and shrink parts
5368% of the skip. The only way seems to be to check the textual
5369% representation of the skip.
5370%
5371% The following is almost like \def\zeroskipmacro{0.0pt} except that
5372% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
5373%
5374\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
5375%
5376\newskip\whatsitskip
5377\newcount\whatsitpenalty
5378%
5379% ..., ready, GO:
5380%
5381\def\safewhatsit#1{\ifhmode
5382 #1%
5383 \else
5384 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
5385 \whatsitskip = \lastskip
5386 \edef\lastskipmacro{\the\lastskip}%
5387 \whatsitpenalty = \lastpenalty
5388 %
5389 % If \lastskip is nonzero, that means the last item was a
5390 % skip. And since a skip is discardable, that means this
5391 % -\whatsitskip glue we're inserting is preceded by a
5392 % non-discardable item, therefore it is not a potential
5393 % breakpoint, therefore no \nobreak needed.
5394 \ifx\lastskipmacro\zeroskipmacro
5395 \else
5396 \vskip-\whatsitskip
5397 \fi
5398 %
5399 #1%
5400 %
5401 \ifx\lastskipmacro\zeroskipmacro
5402 % If \lastskip was zero, perhaps the last item was a penalty, and
5403 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5404 % to re-insert the same penalty (values >10000 are used for various
5405 % signals); since we just inserted a non-discardable item, any
5406 % following glue (such as a \parskip) would be a breakpoint. For example:
5407 % @deffn deffn-whatever
5408 % @vindex index-whatever
5409 % Description.
5410 % would allow a break between the index-whatever whatsit
5411 % and the "Description." paragraph.
5412 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5413 \else
5414 % On the other hand, if we had a nonzero \lastskip,
5415 % this make-up glue would be preceded by a non-discardable item
5416 % (the whatsit from the \write), so we must insert a \nobreak.
5417 \nobreak\vskip\whatsitskip
5418 \fi
5419\fi}
5420
5421% The index entry written in the file actually looks like
5422% \entry {sortstring}{page}{topic}
5423% or
5424% \entry {sortstring}{page}{topic}{subtopic}
5425% The texindex program reads in these files and writes files
5426% containing these kinds of lines:
5427% \initial {c}
5428% before the first topic whose initial is c
5429% \entry {topic}{pagelist}
5430% for a topic that is used without subtopics
5431% \primary {topic}
5432% \entry {topic}{}
5433% for the beginning of a topic that is used with subtopics
5434% \secondary {subtopic}{pagelist}
5435% for each subtopic.
5436% \secondary {subtopic}{}
5437% for a subtopic with sub-subtopics
5438% \tertiary {subtopic}{subsubtopic}{pagelist}
5439% for each sub-subtopic.
5440
5441% Define the user-accessible indexing commands
5442% @findex, @vindex, @kindex, @cindex.
5443
5444\def\findex {\fnindex}
5445\def\kindex {\kyindex}
5446\def\cindex {\cpindex}
5447\def\vindex {\vrindex}
5448\def\tindex {\tpindex}
5449\def\pindex {\pgindex}
5450
5451% Define the macros used in formatting output of the sorted index material.
5452
5453% @printindex causes a particular index (the ??s file) to get printed.
5454% It does not print any chapter heading (usually an @unnumbered).
5455%
5456\parseargdef\printindex{\begingroup
5457 \dobreak \chapheadingskip{10000}%
5458 %
5459 \smallfonts \rm
5460 \tolerance = 9500
5461 \plainfrenchspacing
5462 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5463 %
5464 % See comment in \requireopenindexfile.
5465 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
5466 %
5467 % See if the index file exists and is nonempty.
5468 \openin 1 \jobname.\indexname s
5469 \ifeof 1
5470 % \enddoublecolumns gets confused if there is no text in the index,
5471 % and it loses the chapter title and the aux file entries for the
5472 % index. The easiest way to prevent this problem is to make sure
5473 % there is some text.
5474 \putwordIndexNonexistent
5475 \typeout{No file \jobname.\indexname s.}%
5476 \else
5477 % If the index file exists but is empty, then \openin leaves \ifeof
5478 % false. We have to make TeX try to read something from the file, so
5479 % it can discover if there is anything in it.
5480 \read 1 to \thisline
5481 \ifeof 1
5482 \putwordIndexIsEmpty
5483 \else
5484 \expandafter\printindexzz\thisline\relax\relax\finish%
5485 \fi
5486 \fi
5487 \closein 1
5488\endgroup}
5489
5490% If the index file starts with a backslash, forgo reading the index
5491% file altogether. If somebody upgrades texinfo.tex they may still have
5492% old index files using \ as the escape character. Reading this would
5493% at best lead to typesetting garbage, at worst a TeX syntax error.
5494\def\printindexzz#1#2\finish{%
5495 \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax
5496 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
5497 \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax
5498\errmessage{%
5499ERROR: A sorted index file in an obsolete format was skipped.
5500To fix this problem, please upgrade your version of 'texi2dvi'
5501or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>.
5502If you are using an old version of 'texindex' (part of the Texinfo
5503distribution), you may also need to upgrade to a newer version (at least 6.0).
5504You may be able to typeset the index if you run
5505'texindex \jobname.\indexname' yourself.
5506You could also try setting the 'txiindexescapeisbackslash' flag by
5507running a command like
5508'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do
5509this, Texinfo will try to use index files in the old format.
5510If you continue to have problems, deleting the index files and starting again
5511might help (with 'rm \jobname.?? \jobname.??s')%
5512}%
5513 \else
5514 (Skipped sorted index file in obsolete format)
5515 \fi
5516 \else
5517 \begindoublecolumns
5518 \input \jobname.\indexname s
5519 \enddoublecolumns
5520 \fi
5521 \else
5522 \begindoublecolumns
5523 \catcode`\\=0\relax
5524 %
5525 % Make @ an escape character to give macros a chance to work. This
5526 % should work because we (hopefully) don't otherwise use @ in index files.
5527 %\catcode`\@=12\relax
5528 \catcode`\@=0\relax
5529 \input \jobname.\indexname s
5530 \enddoublecolumns
5531 \fi
5532}
5533
5534% These macros are used by the sorted index file itself.
5535% Change them to control the appearance of the index.
5536
5537{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
5538\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
5539\catcode`\$=3
5540\gdef\initialglyphs{%
5541 % special control sequences used in the index sort key
5542 \let\indexlbrace\{%
5543 \let\indexrbrace\}%
5544 \let\indexatchar\@%
5545 \def\indexbackslash{\math{\backslash}}%
5546 %
5547 % Some changes for non-alphabetic characters. Using the glyphs from the
5548 % math fonts looks more consistent than the typewriter font used elsewhere
5549 % for these characters.
5550 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
5551 %
5552 % In case @\ is used for backslash
5553 \uppercase{\let\\=~}
5554 % Can't get bold backslash so don't use bold forward slash
5555 \catcode`\/=13
5556 \def/{{\secrmnotbold \normalslash}}%
5557 \def-{{\normaldash\normaldash}}% en dash `--'
5558 \def^{{\chapbf \normalcaret}}%
5559 \def~{{\chapbf \normaltilde}}%
5560 \def\_{%
5561 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
5562 \def|{$\vert$}%
5563 \def<{$\less$}%
5564 \def>{$\gtr$}%
5565 \def+{$\normalplus$}%
5566}}
5567
5568\def\initial{%
5569 \bgroup
5570 \initialglyphs
5571 \initialx
5572}
5573
5574\def\initialx#1{%
5575 % Remove any glue we may have, we'll be inserting our own.
5576 \removelastskip
5577 %
5578 % We like breaks before the index initials, so insert a bonus.
5579 % The glue before the bonus allows a little bit of space at the
5580 % bottom of a column to reduce an increase in inter-line spacing.
5581 \nobreak
5582 \vskip 0pt plus 5\baselineskip
5583 \penalty -300
5584 \vskip 0pt plus -5\baselineskip
5585 %
5586 % Typeset the initial. Making this add up to a whole number of
5587 % baselineskips increases the chance of the dots lining up from column
5588 % to column. It still won't often be perfect, because of the stretch
5589 % we need before each entry, but it's better.
5590 %
5591 % No shrink because it confuses \balancecolumns.
5592 \vskip 1.67\baselineskip plus 1\baselineskip
5593 \leftline{\secfonts \kern-0.05em \secbf #1}%
5594 % \secfonts is inside the argument of \leftline so that the change of
5595 % \baselineskip will not affect any glue inserted before the vbox that
5596 % \leftline creates.
5597 % Do our best not to break after the initial.
5598 \nobreak
5599 \vskip .33\baselineskip plus .1\baselineskip
5600 \egroup % \initialglyphs
5601}
5602
5603\newdimen\entryrightmargin
5604\entryrightmargin=0pt
5605
5606% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5607% then page number (#2) flushed to the right margin. It is used for index
5608% and table of contents entries. The paragraph is indented by \leftskip.
5609%
5610\def\entry{%
5611 \begingroup
5612 %
5613 % Start a new paragraph if necessary, so our assignments below can't
5614 % affect previous text.
5615 \par
5616 %
5617 % No extra space above this paragraph.
5618 \parskip = 0in
5619 %
5620 % When reading the text of entry, convert explicit line breaks
5621 % from @* into spaces. The user might give these in long section
5622 % titles, for instance.
5623 \def\*{\unskip\space\ignorespaces}%
5624 \def\entrybreak{\hfil\break}% An undocumented command
5625 %
5626 % Swallow the left brace of the text (first parameter):
5627 \afterassignment\doentry
5628 \let\temp =
5629}
5630\def\entrybreak{\unskip\space\ignorespaces}%
5631\def\doentry{%
5632 % Save the text of the entry
5633 \global\setbox\boxA=\hbox\bgroup
5634 \bgroup % Instead of the swallowed brace.
5635 \noindent
5636 \aftergroup\finishentry
5637 % And now comes the text of the entry.
5638 % Not absorbing as a macro argument reduces the chance of problems
5639 % with catcodes occurring.
5640}
5641{\catcode`\@=11
5642\gdef\finishentry#1{%
5643 \egroup % end box A
5644 \dimen@ = \wd\boxA % Length of text of entry
5645 \global\setbox\boxA=\hbox\bgroup
5646 \unhbox\boxA
5647 % #1 is the page number.
5648 %
5649 % Get the width of the page numbers, and only use
5650 % leaders if they are present.
5651 \global\setbox\boxB = \hbox{#1}%
5652 \ifdim\wd\boxB = 0pt
5653 \null\nobreak\hfill\ %
5654 \else
5655 %
5656 \null\nobreak\indexdotfill % Have leaders before the page number.
5657 %
5658 \ifpdforxetex
5659 \pdfgettoks#1.%
5660 \hskip\skip\thinshrinkable\the\toksA
5661 \else
5662 \hskip\skip\thinshrinkable #1%
5663 \fi
5664 \fi
5665 \egroup % end \boxA
5666 \ifdim\wd\boxB = 0pt
5667 \noindent\unhbox\boxA\par
5668 \nobreak
5669 \else\bgroup
5670 % We want the text of the entries to be aligned to the left, and the
5671 % page numbers to be aligned to the right.
5672 %
5673 \parindent = 0pt
5674 \advance\leftskip by 0pt plus 1fil
5675 \advance\leftskip by 0pt plus -1fill
5676 \rightskip = 0pt plus -1fil
5677 \advance\rightskip by 0pt plus 1fill
5678 % Cause last line, which could consist of page numbers on their own
5679 % if the list of page numbers is long, to be aligned to the right.
5680 \parfillskip=0pt plus -1fill
5681 %
5682 \advance\rightskip by \entryrightmargin
5683 % Determine how far we can stretch into the margin.
5684 % This allows, e.g., "Appendix H GNU Free Documentation License" to
5685 % fit on one line in @letterpaper format.
5686 \ifdim\entryrightmargin>2.1em
5687 \dimen@i=2.1em
5688 \else
5689 \dimen@i=0em
5690 \fi
5691 \advance \parfillskip by 0pt minus 1\dimen@i
5692 %
5693 \dimen@ii = \hsize
5694 \advance\dimen@ii by -1\leftskip
5695 \advance\dimen@ii by -1\entryrightmargin
5696 \advance\dimen@ii by 1\dimen@i
5697 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
5698 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
5699 % Try to split the text roughly evenly. \dimen@ will be the length of
5700 % the first line.
5701 \dimen@ = 0.7\dimen@
5702 \dimen@ii = \hsize
5703 \ifnum\dimen@>\dimen@ii
5704 % If the entry is too long (for example, if it needs more than
5705 % two lines), use all the space in the first line.
5706 \dimen@ = \dimen@ii
5707 \fi
5708 \advance\leftskip by 0pt plus 1fill % ragged right
5709 \advance \dimen@ by 1\rightskip
5710 \parshape = 2 0pt \dimen@ 0em \dimen@ii
5711 % Ideally we'd add a finite glue at the end of the first line only,
5712 % instead of using \parshape with explicit line lengths, but TeX
5713 % doesn't seem to provide a way to do such a thing.
5714 %
5715 % Indent all lines but the first one.
5716 \advance\leftskip by 1em
5717 \advance\parindent by -1em
5718 \fi\fi
5719 \indent % start paragraph
5720 \unhbox\boxA
5721 %
5722 % Do not prefer a separate line ending with a hyphen to fewer lines.
5723 \finalhyphendemerits = 0
5724 %
5725 % Word spacing - no stretch
5726 \spaceskip=\fontdimen2\font minus \fontdimen4\font
5727 %
5728 \linepenalty=1000 % Discourage line breaks.
5729 \hyphenpenalty=5000 % Discourage hyphenation.
5730 %
5731 \par % format the paragraph
5732 \egroup % The \vbox
5733 \fi
5734 \endgroup
5735}}
5736
5737\newskip\thinshrinkable
5738\skip\thinshrinkable=.15em minus .15em
5739
5740% Like plain.tex's \dotfill, except uses up at least 1 em.
5741% The filll stretch here overpowers both the fil and fill stretch to push
5742% the page number to the right.
5743\def\indexdotfill{\cleaders
5744 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5745
5746
5747\def\primary #1{\line{#1\hfil}}
5748
5749\def\secondary{\indententry{0.5cm}}
5750\def\tertiary{\indententry{1cm}}
5751
5752\def\indententry#1#2#3{%
5753 \bgroup
5754 \leftskip=#1
5755 \entry{#2}{#3}%
5756 \egroup
5757}
5758
5759% Define two-column mode, which we use to typeset indexes.
5760% Adapted from the TeXbook, page 416, which is to say,
5761% the manmac.tex format used to print the TeXbook itself.
5762\catcode`\@=11 % private names
5763
5764\newbox\partialpage
5765\newdimen\doublecolumnhsize
5766
5767\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5768 % If not much space left on page, start a new page.
5769 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
5770 %
5771 % Grab any single-column material above us.
5772 \output = {%
5773 \savetopmark
5774 %
5775 \global\setbox\partialpage = \vbox{%
5776 % Unvbox the main output page.
5777 \unvbox\PAGE
5778 \kern-\topskip \kern\baselineskip
5779 }%
5780 }%
5781 \eject % run that output routine to set \partialpage
5782 %
5783 % Use the double-column output routine for subsequent pages.
5784 \output = {\doublecolumnout}%
5785 %
5786 % Change the page size parameters. We could do this once outside this
5787 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5788 % format, but then we repeat the same computation. Repeating a couple
5789 % of assignments once per index is clearly meaningless for the
5790 % execution time, so we may as well do it in one place.
5791 %
5792 % First we halve the line length, less a little for the gutter between
5793 % the columns. We compute the gutter based on the line length, so it
5794 % changes automatically with the paper format. The magic constant
5795 % below is chosen so that the gutter has the same value (well, +-<1pt)
5796 % as it did when we hard-coded it.
5797 %
5798 % We put the result in a separate register, \doublecolumhsize, so we
5799 % can restore it in \pagesofar, after \hsize itself has (potentially)
5800 % been clobbered.
5801 %
5802 \doublecolumnhsize = \hsize
5803 \advance\doublecolumnhsize by -.04154\hsize
5804 \divide\doublecolumnhsize by 2
5805 \hsize = \doublecolumnhsize
5806 %
5807 % Get the available space for the double columns -- the normal
5808 % (undoubled) page height minus any material left over from the
5809 % previous page.
5810 \advance\vsize by -\ht\partialpage
5811 \vsize = 2\vsize
5812 %
5813 % For the benefit of balancing columns
5814 \advance\baselineskip by 0pt plus 0.5pt
5815}
5816
5817% The double-column output routine for all double-column pages except
5818% the last, which is done by \balancecolumns.
5819%
5820\def\doublecolumnout{%
5821 %
5822 \savetopmark
5823 \splittopskip=\topskip \splitmaxdepth=\maxdepth
5824 \dimen@ = \vsize
5825 \divide\dimen@ by 2
5826 %
5827 % box0 will be the left-hand column, box2 the right.
5828 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
5829 \global\advance\vsize by 2\ht\partialpage
5830 \onepageout\pagesofar % empty except for the first time we are called
5831 \unvbox\PAGE
5832 \penalty\outputpenalty
5833}
5834%
5835% Re-output the contents of the output page -- any previous material,
5836% followed by the two boxes we just split, in box0 and box2.
5837\def\pagesofar{%
5838 \unvbox\partialpage
5839 %
5840 \hsize = \doublecolumnhsize
5841 \wd0=\hsize \wd2=\hsize
5842 \hbox to\txipagewidth{\box0\hfil\box2}%
5843}
5844
5845
5846% Finished with double columns.
5847\def\enddoublecolumns{%
5848 % The following penalty ensures that the page builder is exercised
5849 % _before_ we change the output routine. This is necessary in the
5850 % following situation:
5851 %
5852 % The last section of the index consists only of a single entry.
5853 % Before this section, \pagetotal is less than \pagegoal, so no
5854 % break occurs before the last section starts. However, the last
5855 % section, consisting of \initial and the single \entry, does not
5856 % fit on the page and has to be broken off. Without the following
5857 % penalty the page builder will not be exercised until \eject
5858 % below, and by that time we'll already have changed the output
5859 % routine to the \balancecolumns version, so the next-to-last
5860 % double-column page will be processed with \balancecolumns, which
5861 % is wrong: The two columns will go to the main vertical list, with
5862 % the broken-off section in the recent contributions. As soon as
5863 % the output routine finishes, TeX starts reconsidering the page
5864 % break. The two columns and the broken-off section both fit on the
5865 % page, because the two columns now take up only half of the page
5866 % goal. When TeX sees \eject from below which follows the final
5867 % section, it invokes the new output routine that we've set after
5868 % \balancecolumns below; \onepageout will try to fit the two columns
5869 % and the final section into the vbox of \txipageheight (see
5870 % \pagebody), causing an overfull box.
5871 %
5872 % Note that glue won't work here, because glue does not exercise the
5873 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5874 \penalty0
5875 %
5876 \output = {%
5877 % Split the last of the double-column material.
5878 \savetopmark
5879 \balancecolumns
5880 }%
5881 \eject % call the \output just set
5882 \ifdim\pagetotal=0pt
5883 % Having called \balancecolumns once, we do not
5884 % want to call it again. Therefore, reset \output to its normal
5885 % definition right away.
5886 \global\output=\expandafter{\the\defaultoutput}
5887 %
5888 \endgroup % started in \begindoublecolumns
5889 % Leave the double-column material on the current page, no automatic
5890 % page break.
5891 \box\balancedcolumns
5892 %
5893 % \pagegoal was set to the doubled \vsize above, since we restarted
5894 % the current page. We're now back to normal single-column
5895 % typesetting, so reset \pagegoal to the normal \vsize.
5896 \global\vsize = \txipageheight %
5897 \pagegoal = \txipageheight %
5898 \else
5899 % We had some left-over material. This might happen when \doublecolumnout
5900 % is called in \balancecolumns. Try again.
5901 \expandafter\enddoublecolumns
5902 \fi
5903}
5904\newbox\balancedcolumns
5905\setbox\balancedcolumns=\vbox{shouldnt see this}%
5906%
5907% Only called for the last of the double column material. \doublecolumnout
5908% does the others.
5909\def\balancecolumns{%
5910 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
5911 \dimen@ = \ht0
5912 \ifdim\dimen@<7\baselineskip
5913 % Don't split a short final column in two.
5914 \setbox2=\vbox{}%
5915 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5916 \else
5917 % double the leading vertical space
5918 \advance\dimen@ by \topskip
5919 \advance\dimen@ by-\baselineskip
5920 \divide\dimen@ by 2 % target to split to
5921 \dimen@ii = \dimen@
5922 \splittopskip = \topskip
5923 % Loop until left column is at least as high as the right column.
5924 {%
5925 \vbadness = 10000
5926 \loop
5927 \global\setbox3 = \copy0
5928 \global\setbox1 = \vsplit3 to \dimen@
5929 \ifdim\ht1<\ht3
5930 \global\advance\dimen@ by 1pt
5931 \repeat
5932 }%
5933 % Now the left column is in box 1, and the right column in box 3.
5934 %
5935 % Check whether the left column has come out higher than the page itself.
5936 % (Note that we have doubled \vsize for the double columns, so
5937 % the actual height of the page is 0.5\vsize).
5938 \ifdim2\ht1>\vsize
5939 % It appears that we have been called upon to balance too much material.
5940 % Output some of it with \doublecolumnout, leaving the rest on the page.
5941 \setbox\PAGE=\box0
5942 \doublecolumnout
5943 \else
5944 % Compare the heights of the two columns.
5945 \ifdim4\ht1>5\ht3
5946 % Column heights are too different, so don't make their bottoms
5947 % flush with each other.
5948 \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
5949 \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
5950 \else
5951 % Make column bottoms flush with each other.
5952 \setbox2=\vbox to\ht1{\unvbox3\unskip}%
5953 \setbox0=\vbox to\ht1{\unvbox1\unskip}%
5954 \fi
5955 \global\setbox\balancedcolumns=\vbox{\pagesofar}%
5956 \fi
5957 \fi
5958 %
5959}
5960\catcode`\@ = \other
5961
5962
5963\message{sectioning,}
5964% Chapters, sections, etc.
5965
5966% Let's start with @part.
5967\outer\parseargdef\part{\partzzz{#1}}
5968\def\partzzz#1{%
5969 \chapoddpage
5970 \null
5971 \vskip.3\vsize % move it down on the page a bit
5972 \begingroup
5973 \noindent \titlefonts\rm #1\par % the text
5974 \let\lastnode=\empty % no node to associate with
5975 \writetocentry{part}{#1}{}% but put it in the toc
5976 \headingsoff % no headline or footline on the part page
5977 % This outputs a mark at the end of the page that clears \thischapter
5978 % and \thissection, as is done in \startcontents.
5979 \let\pchapsepmacro\relax
5980 \chapmacro{}{Yomitfromtoc}{}%
5981 \chapoddpage
5982 \endgroup
5983}
5984
5985% \unnumberedno is an oxymoron. But we count the unnumbered
5986% sections so that we can refer to them unambiguously in the pdf
5987% outlines by their "section number". We avoid collisions with chapter
5988% numbers by starting them at 10000. (If a document ever has 10000
5989% chapters, we're in trouble anyway, I'm sure.)
5990\newcount\unnumberedno \unnumberedno = 10000
5991\newcount\chapno
5992\newcount\secno \secno=0
5993\newcount\subsecno \subsecno=0
5994\newcount\subsubsecno \subsubsecno=0
5995
5996% This counter is funny since it counts through charcodes of letters A, B, ...
5997\newcount\appendixno \appendixno = `\@
5998%
5999% \def\appendixletter{\char\the\appendixno}
6000% We do the following ugly conditional instead of the above simple
6001% construct for the sake of pdftex, which needs the actual
6002% letter in the expansion, not just typeset.
6003%
6004\def\appendixletter{%
6005 \ifnum\appendixno=`A A%
6006 \else\ifnum\appendixno=`B B%
6007 \else\ifnum\appendixno=`C C%
6008 \else\ifnum\appendixno=`D D%
6009 \else\ifnum\appendixno=`E E%
6010 \else\ifnum\appendixno=`F F%
6011 \else\ifnum\appendixno=`G G%
6012 \else\ifnum\appendixno=`H H%
6013 \else\ifnum\appendixno=`I I%
6014 \else\ifnum\appendixno=`J J%
6015 \else\ifnum\appendixno=`K K%
6016 \else\ifnum\appendixno=`L L%
6017 \else\ifnum\appendixno=`M M%
6018 \else\ifnum\appendixno=`N N%
6019 \else\ifnum\appendixno=`O O%
6020 \else\ifnum\appendixno=`P P%
6021 \else\ifnum\appendixno=`Q Q%
6022 \else\ifnum\appendixno=`R R%
6023 \else\ifnum\appendixno=`S S%
6024 \else\ifnum\appendixno=`T T%
6025 \else\ifnum\appendixno=`U U%
6026 \else\ifnum\appendixno=`V V%
6027 \else\ifnum\appendixno=`W W%
6028 \else\ifnum\appendixno=`X X%
6029 \else\ifnum\appendixno=`Y Y%
6030 \else\ifnum\appendixno=`Z Z%
6031 % The \the is necessary, despite appearances, because \appendixletter is
6032 % expanded while writing the .toc file. \char\appendixno is not
6033 % expandable, thus it is written literally, thus all appendixes come out
6034 % with the same letter (or @) in the toc without it.
6035 \else\char\the\appendixno
6036 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
6037 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
6038
6039% Each @chapter defines these (using marks) as the number+name, number
6040% and name of the chapter. Page headings and footings can use
6041% these. @section does likewise.
6042\def\thischapter{}
6043\def\thischapternum{}
6044\def\thischaptername{}
6045\def\thissection{}
6046\def\thissectionnum{}
6047\def\thissectionname{}
6048
6049\newcount\absseclevel % used to calculate proper heading level
6050\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
6051
6052% @raisesections: treat @section as chapter, @subsection as section, etc.
6053\def\raisesections{\global\advance\secbase by -1}
6054
6055% @lowersections: treat @chapter as section, @section as subsection, etc.
6056\def\lowersections{\global\advance\secbase by 1}
6057
6058% we only have subsub.
6059\chardef\maxseclevel = 3
6060%
6061% A numbered section within an unnumbered changes to unnumbered too.
6062% To achieve this, remember the "biggest" unnum. sec. we are currently in:
6063\chardef\unnlevel = \maxseclevel
6064%
6065% Trace whether the current chapter is an appendix or not:
6066% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
6067\def\chapheadtype{N}
6068
6069% Choose a heading macro
6070% #1 is heading type
6071% #2 is heading level
6072% #3 is text for heading
6073\def\genhead#1#2#3{%
6074 % Compute the abs. sec. level:
6075 \absseclevel=#2
6076 \advance\absseclevel by \secbase
6077 % Make sure \absseclevel doesn't fall outside the range:
6078 \ifnum \absseclevel < 0
6079 \absseclevel = 0
6080 \else
6081 \ifnum \absseclevel > 3
6082 \absseclevel = 3
6083 \fi
6084 \fi
6085 % The heading type:
6086 \def\headtype{#1}%
6087 \if \headtype U%
6088 \ifnum \absseclevel < \unnlevel
6089 \chardef\unnlevel = \absseclevel
6090 \fi
6091 \else
6092 % Check for appendix sections:
6093 \ifnum \absseclevel = 0
6094 \edef\chapheadtype{\headtype}%
6095 \else
6096 \if \headtype A\if \chapheadtype N%
6097 \errmessage{@appendix... within a non-appendix chapter}%
6098 \fi\fi
6099 \fi
6100 % Check for numbered within unnumbered:
6101 \ifnum \absseclevel > \unnlevel
6102 \def\headtype{U}%
6103 \else
6104 \chardef\unnlevel = 3
6105 \fi
6106 \fi
6107 % Now print the heading:
6108 \if \headtype U%
6109 \ifcase\absseclevel
6110 \unnumberedzzz{#3}%
6111 \or \unnumberedseczzz{#3}%
6112 \or \unnumberedsubseczzz{#3}%
6113 \or \unnumberedsubsubseczzz{#3}%
6114 \fi
6115 \else
6116 \if \headtype A%
6117 \ifcase\absseclevel
6118 \appendixzzz{#3}%
6119 \or \appendixsectionzzz{#3}%
6120 \or \appendixsubseczzz{#3}%
6121 \or \appendixsubsubseczzz{#3}%
6122 \fi
6123 \else
6124 \ifcase\absseclevel
6125 \chapterzzz{#3}%
6126 \or \seczzz{#3}%
6127 \or \numberedsubseczzz{#3}%
6128 \or \numberedsubsubseczzz{#3}%
6129 \fi
6130 \fi
6131 \fi
6132 \suppressfirstparagraphindent
6133}
6134
6135% an interface:
6136\def\numhead{\genhead N}
6137\def\apphead{\genhead A}
6138\def\unnmhead{\genhead U}
6139
6140% @chapter, @appendix, @unnumbered. Increment top-level counter, reset
6141% all lower-level sectioning counters to zero.
6142%
6143% Also set \chaplevelprefix, which we prepend to @float sequence numbers
6144% (e.g., figures), q.v. By default (before any chapter), that is empty.
6145\let\chaplevelprefix = \empty
6146%
6147\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
6148\def\chapterzzz#1{%
6149 % section resetting is \global in case the chapter is in a group, such
6150 % as an @include file.
6151 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6152 \global\advance\chapno by 1
6153 %
6154 % Used for \float.
6155 \gdef\chaplevelprefix{\the\chapno.}%
6156 \resetallfloatnos
6157 %
6158 % \putwordChapter can contain complex things in translations.
6159 \toks0=\expandafter{\putwordChapter}%
6160 \message{\the\toks0 \space \the\chapno}%
6161 %
6162 % Write the actual heading.
6163 \chapmacro{#1}{Ynumbered}{\the\chapno}%
6164 %
6165 % So @section and the like are numbered underneath this chapter.
6166 \global\let\section = \numberedsec
6167 \global\let\subsection = \numberedsubsec
6168 \global\let\subsubsection = \numberedsubsubsec
6169}
6170
6171\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
6172%
6173\def\appendixzzz#1{%
6174 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6175 \global\advance\appendixno by 1
6176 \gdef\chaplevelprefix{\appendixletter.}%
6177 \resetallfloatnos
6178 %
6179 % \putwordAppendix can contain complex things in translations.
6180 \toks0=\expandafter{\putwordAppendix}%
6181 \message{\the\toks0 \space \appendixletter}%
6182 %
6183 \chapmacro{#1}{Yappendix}{\appendixletter}%
6184 %
6185 \global\let\section = \appendixsec
6186 \global\let\subsection = \appendixsubsec
6187 \global\let\subsubsection = \appendixsubsubsec
6188}
6189
6190% normally unnmhead0 calls unnumberedzzz:
6191\outer\parseargdef\unnumbered{\unnmhead0{#1}}
6192\def\unnumberedzzz#1{%
6193 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
6194 \global\advance\unnumberedno by 1
6195 %
6196 % Since an unnumbered has no number, no prefix for figures.
6197 \global\let\chaplevelprefix = \empty
6198 \resetallfloatnos
6199 %
6200 % This used to be simply \message{#1}, but TeX fully expands the
6201 % argument to \message. Therefore, if #1 contained @-commands, TeX
6202 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
6203 % expanded @cite (which turns out to cause errors because \cite is meant
6204 % to be executed, not expanded).
6205 %
6206 % Anyway, we don't want the fully-expanded definition of @cite to appear
6207 % as a result of the \message, we just want `@cite' itself. We use
6208 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
6209 % simply yielding the contents of <toks register>. (We also do this for
6210 % the toc entries.)
6211 \toks0 = {#1}%
6212 \message{(\the\toks0)}%
6213 %
6214 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
6215 %
6216 \global\let\section = \unnumberedsec
6217 \global\let\subsection = \unnumberedsubsec
6218 \global\let\subsubsection = \unnumberedsubsubsec
6219}
6220
6221% @centerchap is like @unnumbered, but the heading is centered.
6222\outer\parseargdef\centerchap{%
6223 \let\centerparametersmaybe = \centerparameters
6224 \unnmhead0{#1}%
6225 \let\centerparametersmaybe = \relax
6226}
6227
6228% @top is like @unnumbered.
6229\let\top\unnumbered
6230
6231% Sections.
6232%
6233\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
6234\def\seczzz#1{%
6235 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6236 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
6237}
6238
6239% normally calls appendixsectionzzz:
6240\outer\parseargdef\appendixsection{\apphead1{#1}}
6241\def\appendixsectionzzz#1{%
6242 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6243 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
6244}
6245\let\appendixsec\appendixsection
6246
6247% normally calls unnumberedseczzz:
6248\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
6249\def\unnumberedseczzz#1{%
6250 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
6251 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
6252}
6253
6254% Subsections.
6255%
6256% normally calls numberedsubseczzz:
6257\outer\parseargdef\numberedsubsec{\numhead2{#1}}
6258\def\numberedsubseczzz#1{%
6259 \global\subsubsecno=0 \global\advance\subsecno by 1
6260 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
6261}
6262
6263% normally calls appendixsubseczzz:
6264\outer\parseargdef\appendixsubsec{\apphead2{#1}}
6265\def\appendixsubseczzz#1{%
6266 \global\subsubsecno=0 \global\advance\subsecno by 1
6267 \sectionheading{#1}{subsec}{Yappendix}%
6268 {\appendixletter.\the\secno.\the\subsecno}%
6269}
6270
6271% normally calls unnumberedsubseczzz:
6272\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
6273\def\unnumberedsubseczzz#1{%
6274 \global\subsubsecno=0 \global\advance\subsecno by 1
6275 \sectionheading{#1}{subsec}{Ynothing}%
6276 {\the\unnumberedno.\the\secno.\the\subsecno}%
6277}
6278
6279% Subsubsections.
6280%
6281% normally numberedsubsubseczzz:
6282\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
6283\def\numberedsubsubseczzz#1{%
6284 \global\advance\subsubsecno by 1
6285 \sectionheading{#1}{subsubsec}{Ynumbered}%
6286 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
6287}
6288
6289% normally appendixsubsubseczzz:
6290\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
6291\def\appendixsubsubseczzz#1{%
6292 \global\advance\subsubsecno by 1
6293 \sectionheading{#1}{subsubsec}{Yappendix}%
6294 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
6295}
6296
6297% normally unnumberedsubsubseczzz:
6298\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
6299\def\unnumberedsubsubseczzz#1{%
6300 \global\advance\subsubsecno by 1
6301 \sectionheading{#1}{subsubsec}{Ynothing}%
6302 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
6303}
6304
6305% These macros control what the section commands do, according
6306% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
6307% Define them by default for a numbered chapter.
6308\let\section = \numberedsec
6309\let\subsection = \numberedsubsec
6310\let\subsubsection = \numberedsubsubsec
6311
6312% Define @majorheading, @heading and @subheading
6313
6314\def\majorheading{%
6315 {\advance\chapheadingskip by 10pt \chapbreak }%
6316 \parsearg\chapheadingzzz
6317}
6318
6319\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
6320\def\chapheadingzzz#1{%
6321 \vbox{\chapfonts \raggedtitlesettings #1\par}%
6322 \nobreak\bigskip \nobreak
6323 \suppressfirstparagraphindent
6324}
6325
6326% @heading, @subheading, @subsubheading.
6327\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
6328 \suppressfirstparagraphindent}
6329\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
6330 \suppressfirstparagraphindent}
6331\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
6332 \suppressfirstparagraphindent}
6333
6334% These macros generate a chapter, section, etc. heading only
6335% (including whitespace, linebreaking, etc. around it),
6336% given all the information in convenient, parsed form.
6337
6338% Args are the skip and penalty (usually negative)
6339\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
6340
6341% Parameter controlling skip before chapter headings (if needed)
6342\newskip\chapheadingskip
6343
6344% Define plain chapter starts, and page on/off switching for it.
6345\def\chapbreak{\dobreak \chapheadingskip {-4000}}
6346
6347% Start a new page
6348\def\chappager{\par\vfill\supereject}
6349
6350% \chapoddpage - start on an odd page for a new chapter
6351% Because \domark is called before \chapoddpage, the filler page will
6352% get the headings for the next chapter, which is wrong. But we don't
6353% care -- we just disable all headings on the filler page.
6354\def\chapoddpage{%
6355 \chappager
6356 \ifodd\pageno \else
6357 \begingroup
6358 \headingsoff
6359 \null
6360 \chappager
6361 \endgroup
6362 \fi
6363}
6364
6365\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
6366
6367\def\CHAPPAGoff{%
6368\global\let\contentsalignmacro = \chappager
6369\global\let\pchapsepmacro=\chapbreak
6370\global\def\HEADINGSon{\HEADINGSsinglechapoff}}
6371
6372\def\CHAPPAGon{%
6373\global\let\contentsalignmacro = \chappager
6374\global\let\pchapsepmacro=\chappager
6375\global\def\HEADINGSon{\HEADINGSsingle}}
6376
6377\def\CHAPPAGodd{%
6378\global\let\contentsalignmacro = \chapoddpage
6379\global\let\pchapsepmacro=\chapoddpage
6380\global\def\HEADINGSon{\HEADINGSdouble}}
6381
6382\CHAPPAGon
6383
6384% \chapmacro - Chapter opening.
6385%
6386% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6387% Yappendix, Yomitfromtoc), #3 the chapter number.
6388% Not used for @heading series.
6389%
6390% To test against our argument.
6391\def\Ynothingkeyword{Ynothing}
6392\def\Yappendixkeyword{Yappendix}
6393\def\Yomitfromtockeyword{Yomitfromtoc}
6394%
6395\def\chapmacro#1#2#3{%
6396 \expandafter\ifx\thisenv\titlepage\else
6397 \checkenv{}% chapters, etc., should not start inside an environment.
6398 \fi
6399 % Insert the first mark before the heading break (see notes for \domark).
6400 \let\prevchapterdefs=\currentchapterdefs
6401 \let\prevsectiondefs=\currentsectiondefs
6402 \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6403 \gdef\thissection{}}%
6404 %
6405 \def\temptype{#2}%
6406 \ifx\temptype\Ynothingkeyword
6407 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6408 \gdef\thischapter{\thischaptername}}%
6409 \else\ifx\temptype\Yomitfromtockeyword
6410 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6411 \gdef\thischapter{}}%
6412 \else\ifx\temptype\Yappendixkeyword
6413 \toks0={#1}%
6414 \xdef\currentchapterdefs{%
6415 \gdef\noexpand\thischaptername{\the\toks0}%
6416 \gdef\noexpand\thischapternum{\appendixletter}%
6417 % \noexpand\putwordAppendix avoids expanding indigestible
6418 % commands in some of the translations.
6419 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6420 \noexpand\thischapternum:
6421 \noexpand\thischaptername}%
6422 }%
6423 \else
6424 \toks0={#1}%
6425 \xdef\currentchapterdefs{%
6426 \gdef\noexpand\thischaptername{\the\toks0}%
6427 \gdef\noexpand\thischapternum{\the\chapno}%
6428 % \noexpand\putwordChapter avoids expanding indigestible
6429 % commands in some of the translations.
6430 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6431 \noexpand\thischapternum:
6432 \noexpand\thischaptername}%
6433 }%
6434 \fi\fi\fi
6435 %
6436 % Output the mark. Pass it through \safewhatsit, to take care of
6437 % the preceding space.
6438 \safewhatsit\domark
6439 %
6440 % Insert the chapter heading break.
6441 \pchapsepmacro
6442 %
6443 % Now the second mark, after the heading break. No break points
6444 % between here and the heading.
6445 \let\prevchapterdefs=\currentchapterdefs
6446 \let\prevsectiondefs=\currentsectiondefs
6447 \domark
6448 %
6449 {%
6450 \chapfonts \rm
6451 \let\footnote=\errfootnoteheading % give better error message
6452 %
6453 % Have to define \currentsection before calling \donoderef, because the
6454 % xref code eventually uses it. On the other hand, it has to be called
6455 % after \pchapsepmacro, or the headline will change too soon.
6456 \gdef\currentsection{#1}%
6457 %
6458 % Only insert the separating space if we have a chapter/appendix
6459 % number, and don't print the unnumbered ``number''.
6460 \ifx\temptype\Ynothingkeyword
6461 \setbox0 = \hbox{}%
6462 \def\toctype{unnchap}%
6463 \else\ifx\temptype\Yomitfromtockeyword
6464 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6465 \def\toctype{omit}%
6466 \else\ifx\temptype\Yappendixkeyword
6467 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6468 \def\toctype{app}%
6469 \else
6470 \setbox0 = \hbox{#3\enspace}%
6471 \def\toctype{numchap}%
6472 \fi\fi\fi
6473 %
6474 % Write the toc entry for this chapter. Must come before the
6475 % \donoderef, because we include the current node name in the toc
6476 % entry, and \donoderef resets it to empty.
6477 \writetocentry{\toctype}{#1}{#3}%
6478 %
6479 % For pdftex, we have to write out the node definition (aka, make
6480 % the pdfdest) after any page break, but before the actual text has
6481 % been typeset. If the destination for the pdf outline is after the
6482 % text, then jumping from the outline may wind up with the text not
6483 % being visible, for instance under high magnification.
6484 \donoderef{#2}%
6485 %
6486 % Typeset the actual heading.
6487 \nobreak % Avoid page breaks at the interline glue.
6488 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6489 \unhbox0 #1\par}%
6490 }%
6491 \nobreak\bigskip % no page break after a chapter title
6492 \nobreak
6493}
6494
6495% @centerchap -- centered and unnumbered.
6496\let\centerparametersmaybe = \relax
6497\def\centerparameters{%
6498 \advance\rightskip by 3\rightskip
6499 \leftskip = \rightskip
6500 \parfillskip = 0pt
6501}
6502
6503
6504% Section titles. These macros combine the section number parts and
6505% call the generic \sectionheading to do the printing.
6506%
6507\newskip\secheadingskip
6508\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6509
6510% Subsection titles.
6511\newskip\subsecheadingskip
6512\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6513
6514% Subsubsection titles.
6515\def\subsubsecheadingskip{\subsecheadingskip}
6516\def\subsubsecheadingbreak{\subsecheadingbreak}
6517
6518
6519% Print any size, any type, section title.
6520%
6521% #1 is the text of the title,
6522% #2 is the section level (sec/subsec/subsubsec),
6523% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
6524% #4 is the section number.
6525%
6526\def\seckeyword{sec}
6527%
6528\def\sectionheading#1#2#3#4{%
6529 {%
6530 \def\sectionlevel{#2}%
6531 \def\temptype{#3}%
6532 %
6533 % It is ok for the @heading series commands to appear inside an
6534 % environment (it's been historically allowed, though the logic is
6535 % dubious), but not the others.
6536 \ifx\temptype\Yomitfromtockeyword\else
6537 \checkenv{}% non-@*heading should not be in an environment.
6538 \fi
6539 \let\footnote=\errfootnoteheading
6540 %
6541 % Switch to the right set of fonts.
6542 \csname #2fonts\endcsname \rm
6543 %
6544 % Insert first mark before the heading break (see notes for \domark).
6545 \let\prevsectiondefs=\currentsectiondefs
6546 \ifx\temptype\Ynothingkeyword
6547 \ifx\sectionlevel\seckeyword
6548 \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6549 \gdef\thissection{\thissectionname}}%
6550 \fi
6551 \else\ifx\temptype\Yomitfromtockeyword
6552 % Don't redefine \thissection.
6553 \else\ifx\temptype\Yappendixkeyword
6554 \ifx\sectionlevel\seckeyword
6555 \toks0={#1}%
6556 \xdef\currentsectiondefs{%
6557 \gdef\noexpand\thissectionname{\the\toks0}%
6558 \gdef\noexpand\thissectionnum{#4}%
6559 % \noexpand\putwordSection avoids expanding indigestible
6560 % commands in some of the translations.
6561 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6562 \noexpand\thissectionnum:
6563 \noexpand\thissectionname}%
6564 }%
6565 \fi
6566 \else
6567 \ifx\sectionlevel\seckeyword
6568 \toks0={#1}%
6569 \xdef\currentsectiondefs{%
6570 \gdef\noexpand\thissectionname{\the\toks0}%
6571 \gdef\noexpand\thissectionnum{#4}%
6572 % \noexpand\putwordSection avoids expanding indigestible
6573 % commands in some of the translations.
6574 \gdef\noexpand\thissection{\noexpand\putwordSection{}
6575 \noexpand\thissectionnum:
6576 \noexpand\thissectionname}%
6577 }%
6578 \fi
6579 \fi\fi\fi
6580 %
6581 % Go into vertical mode. Usually we'll already be there, but we
6582 % don't want the following whatsit to end up in a preceding paragraph
6583 % if the document didn't happen to have a blank line.
6584 \par
6585 %
6586 % Output the mark. Pass it through \safewhatsit, to take care of
6587 % the preceding space.
6588 \safewhatsit\domark
6589 %
6590 % Insert space above the heading.
6591 \csname #2headingbreak\endcsname
6592 %
6593 % Now the second mark, after the heading break. No break points
6594 % between here and the heading.
6595 \global\let\prevsectiondefs=\currentsectiondefs
6596 \domark
6597 %
6598 % Only insert the space after the number if we have a section number.
6599 \ifx\temptype\Ynothingkeyword
6600 \setbox0 = \hbox{}%
6601 \def\toctype{unn}%
6602 \gdef\currentsection{#1}%
6603 \else\ifx\temptype\Yomitfromtockeyword
6604 % for @headings -- no section number, don't include in toc,
6605 % and don't redefine \currentsection.
6606 \setbox0 = \hbox{}%
6607 \def\toctype{omit}%
6608 \let\sectionlevel=\empty
6609 \else\ifx\temptype\Yappendixkeyword
6610 \setbox0 = \hbox{#4\enspace}%
6611 \def\toctype{app}%
6612 \gdef\currentsection{#1}%
6613 \else
6614 \setbox0 = \hbox{#4\enspace}%
6615 \def\toctype{num}%
6616 \gdef\currentsection{#1}%
6617 \fi\fi\fi
6618 %
6619 % Write the toc entry (before \donoderef). See comments in \chapmacro.
6620 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6621 %
6622 % Write the node reference (= pdf destination for pdftex).
6623 % Again, see comments in \chapmacro.
6624 \donoderef{#3}%
6625 %
6626 % Interline glue will be inserted when the vbox is completed.
6627 % That glue will be a valid breakpoint for the page, since it'll be
6628 % preceded by a whatsit (usually from the \donoderef, or from the
6629 % \writetocentry if there was no node). We don't want to allow that
6630 % break, since then the whatsits could end up on page n while the
6631 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6632 \nobreak
6633 %
6634 % Output the actual section heading.
6635 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6636 \hangindent=\wd0 % zero if no section number
6637 \unhbox0 #1}%
6638 }%
6639 % Add extra space after the heading -- half of whatever came above it.
6640 % Don't allow stretch, though.
6641 \kern .5 \csname #2headingskip\endcsname
6642 %
6643 % Do not let the kern be a potential breakpoint, as it would be if it
6644 % was followed by glue.
6645 \nobreak
6646 %
6647 % We'll almost certainly start a paragraph next, so don't let that
6648 % glue accumulate. (Not a breakpoint because it's preceded by a
6649 % discardable item.) However, when a paragraph is not started next
6650 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6651 % or the negative glue will cause weirdly wrong output, typically
6652 % obscuring the section heading with something else.
6653 \vskip-\parskip
6654 %
6655 % This is so the last item on the main vertical list is a known
6656 % \penalty > 10000, so \startdefun, etc., can recognize the situation
6657 % and do the needful.
6658 \penalty 10001
6659}
6660
6661
6662\message{toc,}
6663% Table of contents.
6664\newwrite\tocfile
6665
6666% Write an entry to the toc file, opening it if necessary.
6667% Called from @chapter, etc.
6668%
6669% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6670% We append the current node name (if any) and page number as additional
6671% arguments for the \{chap,sec,...}entry macros which will eventually
6672% read this. The node name is used in the pdf outlines as the
6673% destination to jump to.
6674%
6675% We open the .toc file for writing here instead of at @setfilename (or
6676% any other fixed time) so that @contents can be anywhere in the document.
6677% But if #1 is `omit', then we don't do anything. This is used for the
6678% table of contents chapter openings themselves.
6679%
6680\newif\iftocfileopened
6681\def\omitkeyword{omit}%
6682%
6683\def\writetocentry#1#2#3{%
6684 \edef\writetoctype{#1}%
6685 \ifx\writetoctype\omitkeyword \else
6686 \iftocfileopened\else
6687 \immediate\openout\tocfile = \jobname.toc
6688 \global\tocfileopenedtrue
6689 \fi
6690 %
6691 \iflinks
6692 {\atdummies
6693 \edef\temp{%
6694 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6695 \temp
6696 }%
6697 \fi
6698 \fi
6699 %
6700 % Tell \shipout to create a pdf destination on each page, if we're
6701 % writing pdf. These are used in the table of contents. We can't
6702 % just write one on every page because the title pages are numbered
6703 % 1 and 2 (the page numbers aren't printed), and so are the first
6704 % two pages of the document. Thus, we'd have two destinations named
6705 % `1', and two named `2'.
6706 \ifpdforxetex
6707 \global\pdfmakepagedesttrue
6708 \fi
6709}
6710
6711
6712% These characters do not print properly in the Computer Modern roman
6713% fonts, so we must take special care. This is more or less redundant
6714% with the Texinfo input format setup at the end of this file.
6715%
6716\def\activecatcodes{%
6717 \catcode`\"=\active
6718 \catcode`\$=\active
6719 \catcode`\<=\active
6720 \catcode`\>=\active
6721 \catcode`\\=\active
6722 \catcode`\^=\active
6723 \catcode`\_=\active
6724 \catcode`\|=\active
6725 \catcode`\~=\active
6726}
6727
6728
6729% Read the toc file, which is essentially Texinfo input.
6730\def\readtocfile{%
6731 \setupdatafile
6732 \activecatcodes
6733 \input \tocreadfilename
6734}
6735
6736\newskip\contentsrightmargin \contentsrightmargin=1in
6737\newcount\savepageno
6738\newcount\lastnegativepageno \lastnegativepageno = -1
6739
6740% Prepare to read what we've written to \tocfile.
6741%
6742\def\startcontents#1{%
6743 % If @setchapternewpage on, and @headings double, the contents should
6744 % start on an odd page, unlike chapters.
6745 \contentsalignmacro
6746 \immediate\closeout\tocfile
6747 %
6748 % Don't need to put `Contents' or `Short Contents' in the headline.
6749 % It is abundantly clear what they are.
6750 \chapmacro{#1}{Yomitfromtoc}{}%
6751 %
6752 \savepageno = \pageno
6753 \begingroup % Set up to handle contents files properly.
6754 \raggedbottom % Worry more about breakpoints than the bottom.
6755 \entryrightmargin=\contentsrightmargin % Don't use the full line length.
6756 %
6757 % Roman numerals for page numbers.
6758 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6759 \def\thistitle{}% no title in double-sided headings
6760 % Record where the Roman numerals started.
6761 \ifnum\romancount=0 \global\romancount=\pagecount \fi
6762}
6763
6764% redefined for the two-volume lispref. We always output on
6765% \jobname.toc even if this is redefined.
6766%
6767\def\tocreadfilename{\jobname.toc}
6768
6769% Normal (long) toc.
6770%
6771\def\contents{%
6772 \startcontents{\putwordTOC}%
6773 \openin 1 \tocreadfilename\space
6774 \ifeof 1 \else
6775 \readtocfile
6776 \fi
6777 \vfill \eject
6778 \contentsalignmacro % in case @setchapternewpage odd is in effect
6779 \ifeof 1 \else
6780 \pdfmakeoutlines
6781 \fi
6782 \closein 1
6783 \endgroup
6784 \contentsendroman
6785}
6786
6787% And just the chapters.
6788\def\summarycontents{%
6789 \startcontents{\putwordShortTOC}%
6790 %
6791 \let\partentry = \shortpartentry
6792 \let\numchapentry = \shortchapentry
6793 \let\appentry = \shortchapentry
6794 \let\unnchapentry = \shortunnchapentry
6795 % We want a true roman here for the page numbers.
6796 \secfonts
6797 \let\rm=\shortcontrm \let\bf=\shortcontbf
6798 \let\sl=\shortcontsl \let\tt=\shortconttt
6799 \rm
6800 \hyphenpenalty = 10000
6801 \advance\baselineskip by 1pt % Open it up a little.
6802 \def\numsecentry##1##2##3##4{}
6803 \let\appsecentry = \numsecentry
6804 \let\unnsecentry = \numsecentry
6805 \let\numsubsecentry = \numsecentry
6806 \let\appsubsecentry = \numsecentry
6807 \let\unnsubsecentry = \numsecentry
6808 \let\numsubsubsecentry = \numsecentry
6809 \let\appsubsubsecentry = \numsecentry
6810 \let\unnsubsubsecentry = \numsecentry
6811 \openin 1 \tocreadfilename\space
6812 \ifeof 1 \else
6813 \readtocfile
6814 \fi
6815 \closein 1
6816 \vfill \eject
6817 \contentsalignmacro % in case @setchapternewpage odd is in effect
6818 \endgroup
6819 \contentsendroman
6820}
6821\let\shortcontents = \summarycontents
6822
6823% Get ready to use Arabic numerals again
6824\def\contentsendroman{%
6825 \lastnegativepageno = \pageno
6826 \global\pageno = \savepageno
6827 %
6828 % If \romancount > \arabiccount, the contents are at the end of the
6829 % document. Otherwise, advance where the Arabic numerals start for
6830 % the page numbers.
6831 \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi
6832}
6833
6834% Typeset the label for a chapter or appendix for the short contents.
6835% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6836%
6837\def\shortchaplabel#1{%
6838 % This space should be enough, since a single number is .5em, and the
6839 % widest letter (M) is 1em, at least in the Computer Modern fonts.
6840 % But use \hss just in case.
6841 % (This space doesn't include the extra space that gets added after
6842 % the label; that gets put in by \shortchapentry above.)
6843 %
6844 % We'd like to right-justify chapter numbers, but that looks strange
6845 % with appendix letters. And right-justifying numbers and
6846 % left-justifying letters looks strange when there is less than 10
6847 % chapters. Have to read the whole toc once to know how many chapters
6848 % there are before deciding ...
6849 \hbox to 1em{#1\hss}%
6850}
6851
6852% These macros generate individual entries in the table of contents.
6853% The first argument is the chapter or section name.
6854% The last argument is the page number.
6855% The arguments in between are the chapter number, section number, ...
6856
6857% Parts, in the main contents. Replace the part number, which doesn't
6858% exist, with an empty box. Let's hope all the numbers have the same width.
6859% Also ignore the page number, which is conventionally not printed.
6860\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6861\def\partentry#1#2#3#4{%
6862 % Add stretch and a bonus for breaking the page before the part heading.
6863 % This reduces the chance of the page being broken immediately after the
6864 % part heading, before a following chapter heading.
6865 \vskip 0pt plus 5\baselineskip
6866 \penalty-300
6867 \vskip 0pt plus -5\baselineskip
6868 \dochapentry{\numeralbox\labelspace#1}{}%
6869}
6870%
6871% Parts, in the short toc.
6872\def\shortpartentry#1#2#3#4{%
6873 \penalty-300
6874 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6875 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6876}
6877
6878% Chapters, in the main contents.
6879\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
6880
6881% Chapters, in the short toc.
6882% See comments in \dochapentry re vbox and related settings.
6883\def\shortchapentry#1#2#3#4{%
6884 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6885}
6886
6887% Appendices, in the main contents.
6888% Need the word Appendix, and a fixed-size box.
6889%
6890\def\appendixbox#1{%
6891 % We use M since it's probably the widest letter.
6892 \setbox0 = \hbox{\putwordAppendix{} M}%
6893 \hbox to \wd0{\putwordAppendix{} #1\hss}}
6894%
6895\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
6896
6897% Unnumbered chapters.
6898\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6899\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6900
6901% Sections.
6902\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6903\let\appsecentry=\numsecentry
6904\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6905
6906% Subsections.
6907\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6908\let\appsubsecentry=\numsubsecentry
6909\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6910
6911% And subsubsections.
6912\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6913\let\appsubsubsecentry=\numsubsubsecentry
6914\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6915
6916% This parameter controls the indentation of the various levels.
6917% Same as \defaultparindent.
6918\newdimen\tocindent \tocindent = 15pt
6919
6920% Now for the actual typesetting. In all these, #1 is the text and #2 is the
6921% page number.
6922%
6923% If the toc has to be broken over pages, we want it to be at chapters
6924% if at all possible; hence the \penalty.
6925\def\dochapentry#1#2{%
6926 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6927 \begingroup
6928 % Move the page numbers slightly to the right
6929 \advance\entryrightmargin by -0.05em
6930 \chapentryfonts
6931 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6932 \endgroup
6933 \nobreak\vskip .25\baselineskip plus.1\baselineskip
6934}
6935
6936\def\dosecentry#1#2{\begingroup
6937 \secentryfonts \leftskip=\tocindent
6938 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6939\endgroup}
6940
6941\def\dosubsecentry#1#2{\begingroup
6942 \subsecentryfonts \leftskip=2\tocindent
6943 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6944\endgroup}
6945
6946\def\dosubsubsecentry#1#2{\begingroup
6947 \subsubsecentryfonts \leftskip=3\tocindent
6948 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6949\endgroup}
6950
6951% We use the same \entry macro as for the index entries.
6952\let\tocentry = \entry
6953
6954% Space between chapter (or whatever) number and the title.
6955\def\labelspace{\hskip1em \relax}
6956
6957\def\dopageno#1{{\rm #1}}
6958\def\doshortpageno#1{{\rm #1}}
6959
6960\def\chapentryfonts{\secfonts \rm}
6961\def\secentryfonts{\textfonts}
6962\def\subsecentryfonts{\textfonts}
6963\def\subsubsecentryfonts{\textfonts}
6964
6965
6966\message{environments,}
6967% @foo ... @end foo.
6968
6969% @tex ... @end tex escapes into raw TeX temporarily.
6970% One exception: @ is still an escape character, so that @end tex works.
6971% But \@ or @@ will get a plain @ character.
6972
6973\envdef\tex{%
6974 \setregularquotes
6975 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6976 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6977 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6978 \catcode `\%=14
6979 \catcode `\+=\other
6980 \catcode `\"=\other
6981 \catcode `\|=\other
6982 \catcode `\<=\other
6983 \catcode `\>=\other
6984 \catcode `\`=\other
6985 \catcode `\'=\other
6986 %
6987 % ' is active in math mode (mathcode"8000). So reset it, and all our
6988 % other math active characters (just in case), to plain's definitions.
6989 \mathactive
6990 %
6991 % Inverse of the list at the beginning of the file.
6992 \let\b=\ptexb
6993 \let\bullet=\ptexbullet
6994 \let\c=\ptexc
6995 \let\,=\ptexcomma
6996 \let\.=\ptexdot
6997 \let\dots=\ptexdots
6998 \let\equiv=\ptexequiv
6999 \let\!=\ptexexclam
7000 \let\i=\ptexi
7001 \let\indent=\ptexindent
7002 \let\noindent=\ptexnoindent
7003 \let\{=\ptexlbrace
7004 \let\+=\tabalign
7005 \let\}=\ptexrbrace
7006 \let\/=\ptexslash
7007 \let\sp=\ptexsp
7008 \let\*=\ptexstar
7009 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
7010 \let\t=\ptext
7011 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
7012 \let\frenchspacing=\plainfrenchspacing
7013 %
7014 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
7015 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
7016 \def\@{@}%
7017}
7018% There is no need to define \Etex.
7019
7020% Define @lisp ... @end lisp.
7021% @lisp environment forms a group so it can rebind things,
7022% including the definition of @end lisp (which normally is erroneous).
7023
7024% Amount to narrow the margins by for @lisp.
7025\newskip\lispnarrowing \lispnarrowing=0.4in
7026
7027% This is the definition that ^^M gets inside @lisp, @example, and other
7028% such environments. \null is better than a space, since it doesn't
7029% have any width.
7030\def\lisppar{\null\endgraf}
7031
7032% This space is always present above and below environments.
7033\newskip\envskipamount \envskipamount = 0pt
7034
7035% Make spacing and below environment symmetrical. We use \parskip here
7036% to help in doing that, since in @example-like environments \parskip
7037% is reset to zero; thus the \afterenvbreak inserts no space -- but the
7038% start of the next paragraph will insert \parskip.
7039%
7040\def\aboveenvbreak{{%
7041 % =10000 instead of <10000 because of a special case in \itemzzz and
7042 % \sectionheading, q.v.
7043 \ifnum \lastpenalty=10000 \else
7044 \advance\envskipamount by \parskip
7045 \endgraf
7046 \ifdim\lastskip<\envskipamount
7047 \removelastskip
7048 \ifnum\lastpenalty<10000
7049 % Penalize breaking before the environment, because preceding text
7050 % often leads into it.
7051 \penalty100
7052 \fi
7053 \vskip\envskipamount
7054 \fi
7055 \fi
7056}}
7057
7058\def\afterenvbreak{{%
7059 % =10000 instead of <10000 because of a special case in \itemzzz and
7060 % \sectionheading, q.v.
7061 \ifnum \lastpenalty=10000 \else
7062 \advance\envskipamount by \parskip
7063 \endgraf
7064 \ifdim\lastskip<\envskipamount
7065 \removelastskip
7066 % it's not a good place to break if the last penalty was \nobreak
7067 % or better ...
7068 \ifnum\lastpenalty<10000 \penalty-50 \fi
7069 \vskip\envskipamount
7070 \fi
7071 \fi
7072}}
7073
7074% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
7075% also clear it, so that its embedded environments do the narrowing again.
7076\let\nonarrowing=\relax
7077
7078% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
7079% environment contents.
7080
7081%
7082\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
7083\def\ctr{{\hskip 6pt\circle\char'010}}
7084\def\cbl{{\circle\char'012\hskip -6pt}}
7085\def\cbr{{\hskip 6pt\circle\char'011}}
7086\def\carttop{\hbox to \cartouter{\hskip\lskip
7087 \ctl\leaders\hrule height\circthick\hfil\ctr
7088 \hskip\rskip}}
7089\def\cartbot{\hbox to \cartouter{\hskip\lskip
7090 \cbl\leaders\hrule height\circthick\hfil\cbr
7091 \hskip\rskip}}
7092%
7093\newskip\lskip\newskip\rskip
7094
7095% only require the font if @cartouche is actually used
7096\def\cartouchefontdefs{%
7097 \font\circle=lcircle10\relax
7098 \circthick=\fontdimen8\circle
7099}
7100\newdimen\circthick
7101\newdimen\cartouter\newdimen\cartinner
7102\newskip\normbskip\newskip\normpskip\newskip\normlskip
7103
7104
7105\envdef\cartouche{%
7106 \cartouchefontdefs
7107 \ifhmode\par\fi % can't be in the midst of a paragraph.
7108 \startsavinginserts
7109 \lskip=\leftskip \rskip=\rightskip
7110 \leftskip=0pt\rightskip=0pt % we want these *outside*.
7111 \cartinner=\hsize \advance\cartinner by-\lskip
7112 \advance\cartinner by-\rskip
7113 \cartouter=\hsize
7114 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
7115 % side, and for 6pt waste from
7116 % each corner char, and rule thickness
7117 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
7118 %
7119 % If this cartouche directly follows a sectioning command, we need the
7120 % \parskip glue (backspaced over by default) or the cartouche can
7121 % collide with the section heading.
7122 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
7123 %
7124 \setbox\groupbox=\vbox\bgroup
7125 \baselineskip=0pt\parskip=0pt\lineskip=0pt
7126 \carttop
7127 \hbox\bgroup
7128 \hskip\lskip
7129 \vrule\kern3pt
7130 \vbox\bgroup
7131 \kern3pt
7132 \hsize=\cartinner
7133 \baselineskip=\normbskip
7134 \lineskip=\normlskip
7135 \parskip=\normpskip
7136 \vskip -\parskip
7137 \comment % For explanation, see the end of def\group.
7138}
7139\def\Ecartouche{%
7140 \ifhmode\par\fi
7141 \kern3pt
7142 \egroup
7143 \kern3pt\vrule
7144 \hskip\rskip
7145 \egroup
7146 \cartbot
7147 \egroup
7148 \addgroupbox
7149 \checkinserts
7150}
7151
7152
7153% This macro is called at the beginning of all the @example variants,
7154% inside a group.
7155\newdimen\nonfillparindent
7156\def\nonfillstart{%
7157 \aboveenvbreak
7158 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
7159 \sepspaces % Make spaces be word-separators rather than space tokens.
7160 \let\par = \lisppar % don't ignore blank lines
7161 \obeylines % each line of input is a line of output
7162 \parskip = 0pt
7163 % Turn off paragraph indentation but redefine \indent to emulate
7164 % the normal \indent.
7165 \nonfillparindent=\parindent
7166 \parindent = 0pt
7167 \let\indent\nonfillindent
7168 %
7169 \emergencystretch = 0pt % don't try to avoid overfull boxes
7170 \ifx\nonarrowing\relax
7171 \advance \leftskip by \lispnarrowing
7172 \exdentamount=\lispnarrowing
7173 \else
7174 \let\nonarrowing = \relax
7175 \fi
7176 \let\exdent=\nofillexdent
7177}
7178
7179\begingroup
7180\obeyspaces
7181% We want to swallow spaces (but not other tokens) after the fake
7182% @indent in our nonfill-environments, where spaces are normally
7183% active and set to @tie, resulting in them not being ignored after
7184% @indent.
7185\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
7186\gdef\nonfillindentcheck{%
7187\ifx\temp %
7188\expandafter\nonfillindentgobble%
7189\else%
7190\leavevmode\nonfillindentbox%
7191\fi%
7192}%
7193\endgroup
7194\def\nonfillindentgobble#1{\nonfillindent}
7195\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
7196
7197% If you want all examples etc. small: @set dispenvsize small.
7198% If you want even small examples the full size: @set dispenvsize nosmall.
7199% This affects the following displayed environments:
7200% @example, @display, @format, @lisp, @verbatim
7201%
7202\def\smallword{small}
7203\def\nosmallword{nosmall}
7204\let\SETdispenvsize\relax
7205\def\setnormaldispenv{%
7206 \ifx\SETdispenvsize\smallword
7207 % end paragraph for sake of leading, in case document has no blank
7208 % line. This is redundant with what happens in \aboveenvbreak, but
7209 % we need to do it before changing the fonts, and it's inconvenient
7210 % to change the fonts afterward.
7211 \ifnum \lastpenalty=10000 \else \endgraf \fi
7212 \smallexamplefonts \rm
7213 \fi
7214}
7215\def\setsmalldispenv{%
7216 \ifx\SETdispenvsize\nosmallword
7217 \else
7218 \ifnum \lastpenalty=10000 \else \endgraf \fi
7219 \smallexamplefonts \rm
7220 \fi
7221}
7222
7223% We often define two environments, @foo and @smallfoo.
7224% Let's do it in one command. #1 is the env name, #2 the definition.
7225\def\makedispenvdef#1#2{%
7226 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
7227 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
7228 \expandafter\let\csname E#1\endcsname \afterenvbreak
7229 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
7230}
7231
7232% Define two environment synonyms (#1 and #2) for an environment.
7233\def\maketwodispenvdef#1#2#3{%
7234 \makedispenvdef{#1}{#3}%
7235 \makedispenvdef{#2}{#3}%
7236}
7237%
7238% @lisp: indented, narrowed, typewriter font;
7239% @example: same as @lisp.
7240%
7241% @smallexample and @smalllisp: use smaller fonts.
7242% Originally contributed by Pavel@xerox.
7243%
7244\maketwodispenvdef{lisp}{example}{%
7245 \nonfillstart
7246 \tt\setcodequotes
7247 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
7248 \parsearg\gobble
7249}
7250% @display/@smalldisplay: same as @lisp except keep current font.
7251%
7252\makedispenvdef{display}{%
7253 \nonfillstart
7254 \gobble
7255}
7256
7257% @format/@smallformat: same as @display except don't narrow margins.
7258%
7259\makedispenvdef{format}{%
7260 \let\nonarrowing = t%
7261 \nonfillstart
7262 \gobble
7263}
7264
7265% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
7266\envdef\flushleft{%
7267 \let\nonarrowing = t%
7268 \nonfillstart
7269 \gobble
7270}
7271\let\Eflushleft = \afterenvbreak
7272
7273% @flushright.
7274%
7275\envdef\flushright{%
7276 \let\nonarrowing = t%
7277 \nonfillstart
7278 \advance\leftskip by 0pt plus 1fill\relax
7279 \gobble
7280}
7281\let\Eflushright = \afterenvbreak
7282
7283
7284% @raggedright does more-or-less normal line breaking but no right
7285% justification. From plain.tex.
7286\envdef\raggedright{%
7287 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
7288}
7289\let\Eraggedright\par
7290
7291\envdef\raggedleft{%
7292 \parindent=0pt \leftskip0pt plus2em
7293 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7294 \hbadness=10000 % Last line will usually be underfull, so turn off
7295 % badness reporting.
7296}
7297\let\Eraggedleft\par
7298
7299\envdef\raggedcenter{%
7300 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
7301 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
7302 \hbadness=10000 % Last line will usually be underfull, so turn off
7303 % badness reporting.
7304}
7305\let\Eraggedcenter\par
7306
7307
7308% @quotation does normal linebreaking (hence we can't use \nonfillstart)
7309% and narrows the margins. We keep \parskip nonzero in general, since
7310% we're doing normal filling. So, when using \aboveenvbreak and
7311% \afterenvbreak, temporarily make \parskip 0.
7312%
7313\makedispenvdef{quotation}{\quotationstart}
7314%
7315\def\quotationstart{%
7316 \indentedblockstart % same as \indentedblock, but increase right margin too.
7317 \ifx\nonarrowing\relax
7318 \advance\rightskip by \lispnarrowing
7319 \fi
7320 \parsearg\quotationlabel
7321}
7322
7323% We have retained a nonzero parskip for the environment, since we're
7324% doing normal filling.
7325%
7326\def\Equotation{%
7327 \par
7328 \ifx\quotationauthor\thisisundefined\else
7329 % indent a bit.
7330 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
7331 \fi
7332 {\parskip=0pt \afterenvbreak}%
7333}
7334\def\Esmallquotation{\Equotation}
7335
7336% If we're given an argument, typeset it in bold with a colon after.
7337\def\quotationlabel#1{%
7338 \def\temp{#1}%
7339 \ifx\temp\empty \else
7340 {\bf #1: }%
7341 \fi
7342}
7343
7344% @indentedblock is like @quotation, but indents only on the left and
7345% has no optional argument.
7346%
7347\makedispenvdef{indentedblock}{\indentedblockstart}
7348%
7349\def\indentedblockstart{%
7350 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
7351 \parindent=0pt
7352 %
7353 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
7354 \ifx\nonarrowing\relax
7355 \advance\leftskip by \lispnarrowing
7356 \exdentamount = \lispnarrowing
7357 \else
7358 \let\nonarrowing = \relax
7359 \fi
7360}
7361
7362% Keep a nonzero parskip for the environment, since we're doing normal filling.
7363%
7364\def\Eindentedblock{%
7365 \par
7366 {\parskip=0pt \afterenvbreak}%
7367}
7368\def\Esmallindentedblock{\Eindentedblock}
7369
7370
7371% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7372% If we want to allow any <char> as delimiter,
7373% we need the curly braces so that makeinfo sees the @verb command, eg:
7374% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7375%
7376% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7377%
7378% [Knuth] p.344; only we need to do the other characters Texinfo sets
7379% active too. Otherwise, they get lost as the first character on a
7380% verbatim line.
7381\def\dospecials{%
7382 \do\ \do\\\do\{\do\}\do\$\do\&%
7383 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7384 \do\<\do\>\do\|\do\@\do+\do\"%
7385 % Don't do the quotes -- if we do, @set txicodequoteundirected and
7386 % @set txicodequotebacktick will not have effect on @verb and
7387 % @verbatim, and ?` and !` ligatures won't get disabled.
7388 %\do\`\do\'%
7389}
7390%
7391% [Knuth] p. 380
7392\def\uncatcodespecials{%
7393 \def\do##1{\catcode`##1=\other}\dospecials}
7394%
7395% Setup for the @verb command.
7396%
7397% Eight spaces for a tab
7398\begingroup
7399 \catcode`\^^I=\active
7400 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7401\endgroup
7402%
7403\def\setupverb{%
7404 \tt % easiest (and conventionally used) font for verbatim
7405 \def\par{\leavevmode\endgraf}%
7406 \setcodequotes
7407 \tabeightspaces
7408 % Respect line breaks,
7409 % print special symbols as themselves, and
7410 % make each space count
7411 % must do in this order:
7412 \obeylines \uncatcodespecials \sepspaces
7413}
7414
7415% Setup for the @verbatim environment
7416%
7417% Real tab expansion.
7418\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7419%
7420% We typeset each line of the verbatim in an \hbox, so we can handle
7421% tabs.
7422\newbox\verbbox
7423\def\starttabbox{\setbox\verbbox=\hbox\bgroup}
7424%
7425\begingroup
7426 \catcode`\^^I=\active
7427 \gdef\tabexpand{%
7428 \catcode`\^^I=\active
7429 \def^^I{\leavevmode\egroup
7430 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7431 \divide\dimen\verbbox by\tabw
7432 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7433 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7434 \wd\verbbox=\dimen\verbbox
7435 \leavevmode\box\verbbox \starttabbox
7436 }%
7437 }
7438\endgroup
7439
7440% start the verbatim environment.
7441\def\setupverbatim{%
7442 \let\nonarrowing = t%
7443 \nonfillstart
7444 \tt % easiest (and conventionally used) font for verbatim
7445 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
7446 \tabexpand
7447 \setcodequotes
7448 % Respect line breaks,
7449 % print special symbols as themselves, and
7450 % make each space count.
7451 % Must do in this order:
7452 \obeylines \uncatcodespecials \sepspaces
7453}
7454
7455% Do the @verb magic: verbatim text is quoted by unique
7456% delimiter characters. Before first delimiter expect a
7457% right brace, after last delimiter expect closing brace:
7458%
7459% \def\doverb'{'<char>#1<char>'}'{#1}
7460%
7461% [Knuth] p. 382; only eat outer {}
7462\begingroup
7463 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7464 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7465\endgroup
7466%
7467\def\verb{\begingroup\setupverb\doverb}
7468%
7469%
7470% Do the @verbatim magic: define the macro \doverbatim so that
7471% the (first) argument ends when '@end verbatim' is reached, ie:
7472%
7473% \def\doverbatim#1@end verbatim{#1}
7474%
7475% For Texinfo it's a lot easier than for LaTeX,
7476% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7477% we need not redefine '\', '{' and '}'.
7478%
7479% Inspired by LaTeX's verbatim command set [latex.ltx]
7480%
7481\begingroup
7482 \catcode`\ =\active
7483 \obeylines %
7484 % ignore everything up to the first ^^M, that's the newline at the end
7485 % of the @verbatim input line itself. Otherwise we get an extra blank
7486 % line in the output.
7487 \xdef\doverbatim#1^^M#2@end verbatim{%
7488 \starttabbox#2\egroup\noexpand\end\gobble verbatim}%
7489 % We really want {...\end verbatim} in the body of the macro, but
7490 % without the active space; thus we have to use \xdef and \gobble.
7491 % The \egroup ends the \verbbox started at the end of the last line in
7492 % the block.
7493\endgroup
7494%
7495\envdef\verbatim{%
7496 \setnormaldispenv\setupverbatim\doverbatim
7497}
7498\let\Everbatim = \afterenvbreak
7499
7500
7501% @verbatiminclude FILE - insert text of file in verbatim environment.
7502%
7503\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7504%
7505\def\doverbatiminclude#1{%
7506 {%
7507 \makevalueexpandable
7508 \setupverbatim
7509 {%
7510 \indexnofonts % Allow `@@' and other weird things in file names.
7511 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7512 \edef\tmp{\noexpand\input #1 }
7513 \expandafter
7514 }\expandafter\starttabbox\tmp\egroup
7515 \afterenvbreak
7516 }%
7517}
7518
7519% @copying ... @end copying.
7520% Save the text away for @insertcopying later.
7521%
7522% We save the uninterpreted tokens, rather than creating a box.
7523% Saving the text in a box would be much easier, but then all the
7524% typesetting commands (@smallbook, font changes, etc.) have to be done
7525% beforehand -- and a) we want @copying to be done first in the source
7526% file; b) letting users define the frontmatter in as flexible order as
7527% possible is desirable.
7528%
7529\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7530\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7531%
7532\def\insertcopying{%
7533 \begingroup
7534 \parindent = 0pt % paragraph indentation looks wrong on title page
7535 \scanexp\copyingtext
7536 \endgroup
7537}
7538
7539
7540\message{defuns,}
7541% @defun etc.
7542
7543\newskip\defbodyindent \defbodyindent=.4in
7544\newskip\defargsindent \defargsindent=50pt
7545\newskip\deflastargmargin \deflastargmargin=18pt
7546\newcount\defunpenalty
7547
7548% Start the processing of @deffn:
7549\def\startdefun{%
7550 \ifnum\lastpenalty<10000
7551 \medbreak
7552 \defunpenalty=10003 % Will keep this @deffn together with the
7553 % following @def command, see below.
7554 \else
7555 % If there are two @def commands in a row, we'll have a \nobreak,
7556 % which is there to keep the function description together with its
7557 % header. But if there's nothing but headers, we need to allow a
7558 % break somewhere. Check specifically for penalty 10002, inserted
7559 % by \printdefunline, instead of 10000, since the sectioning
7560 % commands also insert a nobreak penalty, and we don't want to allow
7561 % a break between a section heading and a defun.
7562 %
7563 % As a further refinement, we avoid "club" headers by signalling
7564 % with penalty of 10003 after the very first @deffn in the
7565 % sequence (see above), and penalty of 10002 after any following
7566 % @def command.
7567 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7568 %
7569 % Similarly, after a section heading, do not allow a break.
7570 % But do insert the glue.
7571 \medskip % preceded by discardable penalty, so not a breakpoint
7572 \fi
7573 %
7574 \parindent=0in
7575 \advance\leftskip by \defbodyindent
7576 \exdentamount=\defbodyindent
7577}
7578
7579\def\dodefunx#1{%
7580 % First, check whether we are in the right environment:
7581 \checkenv#1%
7582 %
7583 % As above, allow line break if we have multiple x headers in a row.
7584 % It's not a great place, though.
7585 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7586 %
7587 % And now, it's time to reuse the body of the original defun:
7588 \expandafter\gobbledefun#1%
7589}
7590\def\gobbledefun#1\startdefun{}
7591
7592% \printdefunline \deffnheader{text}
7593%
7594\def\printdefunline#1#2{%
7595 \begingroup
7596 % call \deffnheader:
7597 #1#2 \endheader
7598 % common ending:
7599 \interlinepenalty = 10000
7600 \advance\rightskip by 0pt plus 1fil\relax
7601 \endgraf
7602 \nobreak\vskip -\parskip
7603 \penalty\defunpenalty % signal to \startdefun and \dodefunx
7604 % Some of the @defun-type tags do not enable magic parentheses,
7605 % rendering the following check redundant. But we don't optimize.
7606 \checkparencounts
7607 \endgroup
7608}
7609
7610\def\Edefun{\endgraf\medbreak}
7611
7612% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7613% the only thing remaining is to define \deffnheader.
7614%
7615\def\makedefun#1{%
7616 \expandafter\let\csname E#1\endcsname = \Edefun
7617 \edef\temp{\noexpand\domakedefun
7618 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7619 \temp
7620}
7621
7622% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
7623%
7624% Define \deffn and \deffnx, without parameters.
7625% \deffnheader has to be defined explicitly.
7626%
7627\def\domakedefun#1#2#3{%
7628 \envdef#1{%
7629 \startdefun
7630 \doingtypefnfalse % distinguish typed functions from all else
7631 \parseargusing\activeparens{\printdefunline#3}%
7632 }%
7633 \def#2{\dodefunx#1}%
7634 \def#3%
7635}
7636
7637\newif\ifdoingtypefn % doing typed function?
7638\newif\ifrettypeownline % typeset return type on its own line?
7639
7640% @deftypefnnewline on|off says whether the return type of typed functions
7641% are printed on their own line. This affects @deftypefn, @deftypefun,
7642% @deftypeop, and @deftypemethod.
7643%
7644\parseargdef\deftypefnnewline{%
7645 \def\temp{#1}%
7646 \ifx\temp\onword
7647 \expandafter\let\csname SETtxideftypefnnl\endcsname
7648 = \empty
7649 \else\ifx\temp\offword
7650 \expandafter\let\csname SETtxideftypefnnl\endcsname
7651 = \relax
7652 \else
7653 \errhelp = \EMsimple
7654 \errmessage{Unknown @txideftypefnnl value `\temp',
7655 must be on|off}%
7656 \fi\fi
7657}
7658
7659% \dosubind {index}{topic}{subtopic}
7660%
7661% If SUBTOPIC is present, precede it with a space, and call \doind.
7662% (At some time during the 20th century, this made a two-level entry in an
7663% index such as the operation index. Nobody seemed to notice the change in
7664% behaviour though.)
7665\def\dosubind#1#2#3{%
7666 \def\thirdarg{#3}%
7667 \ifx\thirdarg\empty
7668 \doind{#1}{#2}%
7669 \else
7670 \doind{#1}{#2\space#3}%
7671 \fi
7672}
7673
7674% Untyped functions:
7675
7676% @deffn category name args
7677\makedefun{deffn}{\deffngeneral{}}
7678
7679% @deffn category class name args
7680\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7681
7682% \defopon {category on}class name args
7683\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7684
7685% \deffngeneral {subind}category name args
7686%
7687\def\deffngeneral#1#2 #3 #4\endheader{%
7688 \dosubind{fn}{\code{#3}}{#1}%
7689 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7690}
7691
7692% Typed functions:
7693
7694% @deftypefn category type name args
7695\makedefun{deftypefn}{\deftypefngeneral{}}
7696
7697% @deftypeop category class type name args
7698\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7699
7700% \deftypeopon {category on}class type name args
7701\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7702
7703% \deftypefngeneral {subind}category type name args
7704%
7705\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7706 \dosubind{fn}{\code{#4}}{#1}%
7707 \doingtypefntrue
7708 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7709}
7710
7711% Typed variables:
7712
7713% @deftypevr category type var args
7714\makedefun{deftypevr}{\deftypecvgeneral{}}
7715
7716% @deftypecv category class type var args
7717\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7718
7719% \deftypecvof {category of}class type var args
7720\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7721
7722% \deftypecvgeneral {subind}category type var args
7723%
7724\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7725 \dosubind{vr}{\code{#4}}{#1}%
7726 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7727}
7728
7729% Untyped variables:
7730
7731% @defvr category var args
7732\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7733
7734% @defcv category class var args
7735\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7736
7737% \defcvof {category of}class var args
7738\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7739
7740% Types:
7741
7742% @deftp category name args
7743\makedefun{deftp}#1 #2 #3\endheader{%
7744 \doind{tp}{\code{#2}}%
7745 \defname{#1}{}{#2}\defunargs{#3\unskip}%
7746}
7747
7748% Remaining @defun-like shortcuts:
7749\makedefun{defun}{\deffnheader{\putwordDeffunc} }
7750\makedefun{defmac}{\deffnheader{\putwordDefmac} }
7751\makedefun{defspec}{\deffnheader{\putwordDefspec} }
7752\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7753\makedefun{defvar}{\defvrheader{\putwordDefvar} }
7754\makedefun{defopt}{\defvrheader{\putwordDefopt} }
7755\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7756\makedefun{defmethod}{\defopon\putwordMethodon}
7757\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7758\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7759\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7760
7761% \defname, which formats the name of the @def (not the args).
7762% #1 is the category, such as "Function".
7763% #2 is the return type, if any.
7764% #3 is the function name.
7765%
7766% We are followed by (but not passed) the arguments, if any.
7767%
7768\def\defname#1#2#3{%
7769 \par
7770 % Get the values of \leftskip and \rightskip as they were outside the @def...
7771 \advance\leftskip by -\defbodyindent
7772 %
7773 % Determine if we are typesetting the return type of a typed function
7774 % on a line by itself.
7775 \rettypeownlinefalse
7776 \ifdoingtypefn % doing a typed function specifically?
7777 % then check user option for putting return type on its own line:
7778 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7779 \rettypeownlinetrue
7780 \fi
7781 \fi
7782 %
7783 % How we'll format the category name. Putting it in brackets helps
7784 % distinguish it from the body text that may end up on the next line
7785 % just below it.
7786 \def\temp{#1}%
7787 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7788 %
7789 % Figure out line sizes for the paragraph shape. We'll always have at
7790 % least two.
7791 \tempnum = 2
7792 %
7793 % The first line needs space for \box0; but if \rightskip is nonzero,
7794 % we need only space for the part of \box0 which exceeds it:
7795 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7796 %
7797 % If doing a return type on its own line, we'll have another line.
7798 \ifrettypeownline
7799 \advance\tempnum by 1
7800 \def\maybeshapeline{0in \hsize}%
7801 \else
7802 \def\maybeshapeline{}%
7803 \fi
7804 %
7805 % The continuations:
7806 \dimen2=\hsize \advance\dimen2 by -\defargsindent
7807 %
7808 % The final paragraph shape:
7809 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7810 %
7811 % Put the category name at the right margin.
7812 \noindent
7813 \hbox to 0pt{%
7814 \hfil\box0 \kern-\hsize
7815 % \hsize has to be shortened this way:
7816 \kern\leftskip
7817 % Intentionally do not respect \rightskip, since we need the space.
7818 }%
7819 %
7820 % Allow all lines to be underfull without complaint:
7821 \tolerance=10000 \hbadness=10000
7822 \exdentamount=\defbodyindent
7823 {%
7824 % defun fonts. We use typewriter by default (used to be bold) because:
7825 % . we're printing identifiers, they should be in tt in principle.
7826 % . in languages with many accents, such as Czech or French, it's
7827 % common to leave accents off identifiers. The result looks ok in
7828 % tt, but exceedingly strange in rm.
7829 % . we don't want -- and --- to be treated as ligatures.
7830 % . this still does not fix the ?` and !` ligatures, but so far no
7831 % one has made identifiers using them :).
7832 \df \tt
7833 \def\temp{#2}% text of the return type
7834 \ifx\temp\empty\else
7835 \tclose{\temp}% typeset the return type
7836 \ifrettypeownline
7837 % put return type on its own line; prohibit line break following:
7838 \hfil\vadjust{\nobreak}\break
7839 \else
7840 \space % type on same line, so just followed by a space
7841 \fi
7842 \fi % no return type
7843 #3% output function name
7844 }%
7845 {\rm\enskip}% hskip 0.5 em of \rmfont
7846 %
7847 \boldbrax
7848 % arguments will be output next, if any.
7849}
7850
7851% Print arguments in slanted roman (not ttsl), inconsistently with using
7852% tt for the name. This is because literal text is sometimes needed in
7853% the argument list (groff manual), and ttsl and tt are not very
7854% distinguishable. Prevent hyphenation at `-' chars.
7855%
7856\def\defunargs#1{%
7857 % use sl by default (not ttsl),
7858 % tt for the names.
7859 \df \sl \hyphenchar\font=0
7860 %
7861 % On the other hand, if an argument has two dashes (for instance), we
7862 % want a way to get ttsl. We used to recommend @var for that, so
7863 % leave the code in, but it's strange for @var to lead to typewriter.
7864 % Nowadays we recommend @code, since the difference between a ttsl hyphen
7865 % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7866 \def\var##1{{\setregularquotes\ttslanted{##1}}}%
7867 #1%
7868 \sl\hyphenchar\font=45
7869}
7870
7871% We want ()&[] to print specially on the defun line.
7872%
7873\def\activeparens{%
7874 \catcode`\(=\active \catcode`\)=\active
7875 \catcode`\[=\active \catcode`\]=\active
7876 \catcode`\&=\active
7877}
7878
7879% Make control sequences which act like normal parenthesis chars.
7880\let\lparen = ( \let\rparen = )
7881
7882% Be sure that we always have a definition for `(', etc. For example,
7883% if the fn name has parens in it, \boldbrax will not be in effect yet,
7884% so TeX would otherwise complain about undefined control sequence.
7885{
7886 \activeparens
7887 \global\let(=\lparen \global\let)=\rparen
7888 \global\let[=\lbrack \global\let]=\rbrack
7889 \global\let& = \&
7890
7891 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7892 \gdef\magicamp{\let&=\amprm}
7893}
7894\let\ampchar\&
7895
7896\newcount\parencount
7897
7898% If we encounter &foo, then turn on ()-hacking afterwards
7899\newif\ifampseen
7900\def\amprm#1 {\ampseentrue{\bf\&#1 }}
7901
7902\def\parenfont{%
7903 \ifampseen
7904 % At the first level, print parens in roman,
7905 % otherwise use the default font.
7906 \ifnum \parencount=1 \rm \fi
7907 \else
7908 % The \sf parens (in \boldbrax) actually are a little bolder than
7909 % the contained text. This is especially needed for [ and ] .
7910 \sf
7911 \fi
7912}
7913\def\infirstlevel#1{%
7914 \ifampseen
7915 \ifnum\parencount=1
7916 #1%
7917 \fi
7918 \fi
7919}
7920\def\bfafterword#1 {#1 \bf}
7921
7922\def\opnr{%
7923 \global\advance\parencount by 1
7924 {\parenfont(}%
7925 \infirstlevel \bfafterword
7926}
7927\def\clnr{%
7928 {\parenfont)}%
7929 \infirstlevel \sl
7930 \global\advance\parencount by -1
7931}
7932
7933\newcount\brackcount
7934\def\lbrb{%
7935 \global\advance\brackcount by 1
7936 {\bf[}%
7937}
7938\def\rbrb{%
7939 {\bf]}%
7940 \global\advance\brackcount by -1
7941}
7942
7943\def\checkparencounts{%
7944 \ifnum\parencount=0 \else \badparencount \fi
7945 \ifnum\brackcount=0 \else \badbrackcount \fi
7946}
7947% these should not use \errmessage; the glibc manual, at least, actually
7948% has such constructs (when documenting function pointers).
7949\def\badparencount{%
7950 \message{Warning: unbalanced parentheses in @def...}%
7951 \global\parencount=0
7952}
7953\def\badbrackcount{%
7954 \message{Warning: unbalanced square brackets in @def...}%
7955 \global\brackcount=0
7956}
7957
7958
7959\message{macros,}
7960% @macro.
7961
7962% To do this right we need a feature of e-TeX, \scantokens,
7963% which we arrange to emulate with a temporary file in ordinary TeX.
7964\ifx\eTeXversion\thisisundefined
7965 \newwrite\macscribble
7966 \def\scantokens#1{%
7967 \toks0={#1}%
7968 \immediate\openout\macscribble=\jobname.tmp
7969 \immediate\write\macscribble{\the\toks0}%
7970 \immediate\closeout\macscribble
7971 \input \jobname.tmp
7972 }
7973\fi
7974
7975\let\E=\expandafter
7976
7977% Used at the time of macro expansion.
7978% Argument is macro body with arguments substituted
7979\def\scanmacro#1{%
7980 \newlinechar`\^^M
7981 % expand the expansion of \eatleadingcr twice to maybe remove a leading
7982 % newline (and \else and \fi tokens), then call \eatspaces on the result.
7983 \def\xeatspaces##1{%
7984 \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
7985 }}%
7986 \def\xempty##1{}%
7987 %
7988 % Process the macro body under the current catcode regime.
7989 \scantokens{#1@comment}%
7990 %
7991 % The \comment is to remove the \newlinechar added by \scantokens, and
7992 % can be noticed by \parsearg. Note \c isn't used because this means cedilla
7993 % in math mode.
7994}
7995
7996% Used for copying and captions
7997\def\scanexp#1{%
7998 \expandafter\scanmacro\expandafter{#1}%
7999}
8000
8001\newcount\paramno % Count of parameters
8002\newtoks\macname % Macro name
8003\newif\ifrecursive % Is it recursive?
8004
8005% List of all defined macros in the form
8006% \commondummyword\macro1\commondummyword\macro2...
8007% Currently is also contains all @aliases; the list can be split
8008% if there is a need.
8009\def\macrolist{}
8010
8011% Add the macro to \macrolist
8012\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
8013\def\addtomacrolistxxx#1{%
8014 \toks0 = \expandafter{\macrolist\commondummyword#1}%
8015 \xdef\macrolist{\the\toks0}%
8016}
8017
8018% Utility routines.
8019% This does \let #1 = #2, with \csnames; that is,
8020% \let \csname#1\endcsname = \csname#2\endcsname
8021% (except of course we have to play expansion games).
8022%
8023\def\cslet#1#2{%
8024 \expandafter\let
8025 \csname#1\expandafter\endcsname
8026 \csname#2\endcsname
8027}
8028
8029% Trim leading and trailing spaces off a string.
8030% Concepts from aro-bend problem 15 (see CTAN).
8031{\catcode`\@=11
8032\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
8033\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
8034\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
8035\def\unbrace#1{#1}
8036\unbrace{\gdef\trim@@@ #1 } #2@{#1}
8037}
8038
8039{\catcode`\^^M=\other%
8040\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
8041% Warning: this won't work for a delimited argument
8042% or for an empty argument
8043
8044% Trim a single trailing ^^M off a string.
8045{\catcode`\^^M=\other \catcode`\Q=3%
8046\gdef\eatcr #1{\eatcra #1Q^^MQ}%
8047\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
8048\gdef\eatcrb#1Q#2Q{#1}%
8049}
8050
8051% Macro bodies are absorbed as an argument in a context where
8052% all characters are catcode 10, 11 or 12, except \ which is active
8053% (as in normal texinfo). It is necessary to change the definition of \
8054% to recognize macro arguments; this is the job of \mbodybackslash.
8055%
8056% Non-ASCII encodings make 8-bit characters active, so un-activate
8057% them to avoid their expansion. Must do this non-globally, to
8058% confine the change to the current group.
8059%
8060% It's necessary to have hard CRs when the macro is executed. This is
8061% done by making ^^M (\endlinechar) catcode 12 when reading the macro
8062% body, and then making it the \newlinechar in \scanmacro.
8063%
8064\def\scanctxt{% used as subroutine
8065 \catcode`\"=\other
8066 \catcode`\+=\other
8067 \catcode`\<=\other
8068 \catcode`\>=\other
8069 \catcode`\^=\other
8070 \catcode`\_=\other
8071 \catcode`\|=\other
8072 \catcode`\~=\other
8073 \passthroughcharstrue
8074}
8075
8076\def\scanargctxt{% used for copying and captions, not macros.
8077 \scanctxt
8078 \catcode`\@=\other
8079 \catcode`\\=\other
8080 \catcode`\^^M=\other
8081}
8082
8083\def\macrobodyctxt{% used for @macro definitions
8084 \scanctxt
8085 \catcode`\ =\other
8086 \catcode`\@=\other
8087 \catcode`\{=\other
8088 \catcode`\}=\other
8089 \catcode`\^^M=\other
8090 \usembodybackslash
8091}
8092
8093% Used when scanning braced macro arguments. Note, however, that catcode
8094% changes here are ineffectual if the macro invocation was nested inside
8095% an argument to another Texinfo command.
8096\def\macroargctxt{%
8097 \scanctxt
8098 \catcode`\ =\active
8099 \catcode`\@=\other
8100 \catcode`\^^M=\other
8101 \catcode`\\=\active
8102}
8103
8104\def\macrolineargctxt{% used for whole-line arguments without braces
8105 \scanctxt
8106 \catcode`\@=\other
8107 \catcode`\{=\other
8108 \catcode`\}=\other
8109}
8110
8111% \mbodybackslash is the definition of \ in @macro bodies.
8112% It maps \foo\ => \csname macarg.foo\endcsname => #N
8113% where N is the macro parameter number.
8114% We define \csname macarg.\endcsname to be \realbackslash, so
8115% \\ in macro replacement text gets you a backslash.
8116%
8117{\catcode`@=0 @catcode`@\=@active
8118 @gdef@usembodybackslash{@let\=@mbodybackslash}
8119 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
8120}
8121\expandafter\def\csname macarg.\endcsname{\realbackslash}
8122
8123\def\margbackslash#1{\char`\#1 }
8124
8125\def\macro{\recursivefalse\parsearg\macroxxx}
8126\def\rmacro{\recursivetrue\parsearg\macroxxx}
8127
8128\def\macroxxx#1{%
8129 \getargs{#1}% now \macname is the macname and \argl the arglist
8130 \ifx\argl\empty % no arguments
8131 \paramno=0\relax
8132 \else
8133 \expandafter\parsemargdef \argl;%
8134 \if\paramno>256\relax
8135 \ifx\eTeXversion\thisisundefined
8136 \errhelp = \EMsimple
8137 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
8138 \fi
8139 \fi
8140 \fi
8141 \if1\csname ismacro.\the\macname\endcsname
8142 \message{Warning: redefining \the\macname}%
8143 \else
8144 \expandafter\ifx\csname \the\macname\endcsname \relax
8145 \else \errmessage{Macro name \the\macname\space already defined}\fi
8146 \global\cslet{macsave.\the\macname}{\the\macname}%
8147 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
8148 \addtomacrolist{\the\macname}%
8149 \fi
8150 \begingroup \macrobodyctxt
8151 \ifrecursive \expandafter\parsermacbody
8152 \else \expandafter\parsemacbody
8153 \fi}
8154
8155\parseargdef\unmacro{%
8156 \if1\csname ismacro.#1\endcsname
8157 \global\cslet{#1}{macsave.#1}%
8158 \global\expandafter\let \csname ismacro.#1\endcsname=0%
8159 % Remove the macro name from \macrolist:
8160 \begingroup
8161 \expandafter\let\csname#1\endcsname \relax
8162 \let\commondummyword\unmacrodo
8163 \xdef\macrolist{\macrolist}%
8164 \endgroup
8165 \else
8166 \errmessage{Macro #1 not defined}%
8167 \fi
8168}
8169
8170% Called by \do from \dounmacro on each macro. The idea is to omit any
8171% macro definitions that have been changed to \relax.
8172%
8173\def\unmacrodo#1{%
8174 \ifx #1\relax
8175 % remove this
8176 \else
8177 \noexpand\commondummyword \noexpand#1%
8178 \fi
8179}
8180
8181% \getargs -- Parse the arguments to a @macro line. Set \macname to
8182% the name of the macro, and \argl to the braced argument list.
8183\def\getargs#1{\getargsxxx#1{}}
8184\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
8185\def\getmacname#1 #2\relax{\macname={#1}}
8186\def\getmacargs#1{\def\argl{#1}}
8187% This made use of the feature that if the last token of a
8188% <parameter list> is #, then the preceding argument is delimited by
8189% an opening brace, and that opening brace is not consumed.
8190
8191% Parse the optional {params} list to @macro or @rmacro.
8192% Set \paramno to the number of arguments,
8193% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
8194% three-param macro.) Define \macarg.BLAH for each BLAH in the params
8195% list to some hook where the argument is to be expanded. If there are
8196% less than 10 arguments that hook is to be replaced by ##N where N
8197% is the position in that list, that is to say the macro arguments are to be
8198% defined `a la TeX in the macro body.
8199%
8200% That gets used by \mbodybackslash (above).
8201%
8202% If there are 10 or more arguments, a different technique is used: see
8203% \parsemmanyargdef.
8204%
8205\def\parsemargdef#1;{%
8206 \paramno=0\def\paramlist{}%
8207 \let\hash\relax
8208 % \hash is redefined to `#' later to get it into definitions
8209 \let\xeatspaces\relax
8210 \let\xempty\relax
8211 \parsemargdefxxx#1,;,%
8212 \ifnum\paramno<10\relax\else
8213 \paramno0\relax
8214 \parsemmanyargdef@@#1,;,% 10 or more arguments
8215 \fi
8216}
8217\def\parsemargdefxxx#1,{%
8218 \if#1;\let\next=\relax
8219 \else \let\next=\parsemargdefxxx
8220 \advance\paramno by 1
8221 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
8222 {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
8223 \edef\paramlist{\paramlist\hash\the\paramno,}%
8224 \fi\next}
8225% the \xempty{} is to give \eatleadingcr an argument in the case of an
8226% empty macro argument.
8227
8228% \parsemacbody, \parsermacbody
8229%
8230% Read recursive and nonrecursive macro bodies. (They're different since
8231% rec and nonrec macros end differently.)
8232%
8233% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
8234% body to be transformed.
8235% Set \macrobody to the body of the macro, and call \defmacro.
8236%
8237{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
8238\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8239{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
8240\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
8241
8242% Make @ a letter, so that we can make private-to-Texinfo macro names.
8243\edef\texiatcatcode{\the\catcode`\@}
8244\catcode `@=11\relax
8245
8246%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
8247
8248% If there are 10 or more arguments, a different technique is used, where the
8249% hook remains in the body, and when macro is to be expanded the body is
8250% processed again to replace the arguments.
8251%
8252% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
8253% argument N value and then \edef the body (nothing else will expand because of
8254% the catcode regime under which the body was input).
8255%
8256% If you compile with TeX (not eTeX), and you have macros with 10 or more
8257% arguments, no macro can have more than 256 arguments (else error).
8258%
8259% In case that there are 10 or more arguments we parse again the arguments
8260% list to set new definitions for the \macarg.BLAH macros corresponding to
8261% each BLAH argument. It was anyhow needed to parse already once this list
8262% in order to count the arguments, and as macros with at most 9 arguments
8263% are by far more frequent than macro with 10 or more arguments, defining
8264% twice the \macarg.BLAH macros does not cost too much processing power.
8265\def\parsemmanyargdef@@#1,{%
8266 \if#1;\let\next=\relax
8267 \else
8268 \let\next=\parsemmanyargdef@@
8269 \edef\tempb{\eatspaces{#1}}%
8270 \expandafter\def\expandafter\tempa
8271 \expandafter{\csname macarg.\tempb\endcsname}%
8272 % Note that we need some extra \noexpand\noexpand, this is because we
8273 % don't want \the to be expanded in the \parsermacbody as it uses an
8274 % \xdef .
8275 \expandafter\edef\tempa
8276 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
8277 \advance\paramno by 1\relax
8278 \fi\next}
8279
8280
8281\let\endargs@\relax
8282\let\nil@\relax
8283\def\nilm@{\nil@}%
8284\long\def\nillm@{\nil@}%
8285
8286% This macro is expanded during the Texinfo macro expansion, not during its
8287% definition. It gets all the arguments' values and assigns them to macros
8288% macarg.ARGNAME
8289%
8290% #1 is the macro name
8291% #2 is the list of argument names
8292% #3 is the list of argument values
8293\def\getargvals@#1#2#3{%
8294 \def\macargdeflist@{}%
8295 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
8296 \def\paramlist{#2,\nil@}%
8297 \def\macroname{#1}%
8298 \begingroup
8299 \macroargctxt
8300 \def\argvaluelist{#3,\nil@}%
8301 \def\@tempa{#3}%
8302 \ifx\@tempa\empty
8303 \setemptyargvalues@
8304 \else
8305 \getargvals@@
8306 \fi
8307}
8308\def\getargvals@@{%
8309 \ifx\paramlist\nilm@
8310 % Some sanity check needed here that \argvaluelist is also empty.
8311 \ifx\argvaluelist\nillm@
8312 \else
8313 \errhelp = \EMsimple
8314 \errmessage{Too many arguments in macro `\macroname'!}%
8315 \fi
8316 \let\next\macargexpandinbody@
8317 \else
8318 \ifx\argvaluelist\nillm@
8319 % No more arguments values passed to macro. Set remaining named-arg
8320 % macros to empty.
8321 \let\next\setemptyargvalues@
8322 \else
8323 % pop current arg name into \@tempb
8324 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
8325 \expandafter\@tempa\expandafter{\paramlist}%
8326 % pop current argument value into \@tempc
8327 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
8328 \expandafter\@tempa\expandafter{\argvaluelist}%
8329 % Here \@tempb is the current arg name and \@tempc is the current arg value.
8330 % First place the new argument macro definition into \@tempd
8331 \expandafter\macname\expandafter{\@tempc}%
8332 \expandafter\let\csname macarg.\@tempb\endcsname\relax
8333 \expandafter\def\expandafter\@tempe\expandafter{%
8334 \csname macarg.\@tempb\endcsname}%
8335 \edef\@tempd{\long\def\@tempe{\the\macname}}%
8336 \push@\@tempd\macargdeflist@
8337 \let\next\getargvals@@
8338 \fi
8339 \fi
8340 \next
8341}
8342
8343\def\push@#1#2{%
8344 \expandafter\expandafter\expandafter\def
8345 \expandafter\expandafter\expandafter#2%
8346 \expandafter\expandafter\expandafter{%
8347 \expandafter#1#2}%
8348}
8349
8350% Replace arguments by their values in the macro body, and place the result
8351% in macro \@tempa.
8352%
8353\def\macvalstoargs@{%
8354 % To do this we use the property that token registers that are \the'ed
8355 % within an \edef expand only once. So we are going to place all argument
8356 % values into respective token registers.
8357 %
8358 % First we save the token context, and initialize argument numbering.
8359 \begingroup
8360 \paramno0\relax
8361 % Then, for each argument number #N, we place the corresponding argument
8362 % value into a new token list register \toks#N
8363 \expandafter\putargsintokens@\saveparamlist@,;,%
8364 % Then, we expand the body so that argument are replaced by their
8365 % values. The trick for values not to be expanded themselves is that they
8366 % are within tokens and that tokens expand only once in an \edef .
8367 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
8368 % Now we restore the token stack pointer to free the token list registers
8369 % which we have used, but we make sure that expanded body is saved after
8370 % group.
8371 \expandafter
8372 \endgroup
8373 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
8374 }
8375
8376% Define the named-macro outside of this group and then close this group.
8377%
8378\def\macargexpandinbody@{%
8379 \expandafter
8380 \endgroup
8381 \macargdeflist@
8382 % First the replace in body the macro arguments by their values, the result
8383 % is in \@tempa .
8384 \macvalstoargs@
8385 % Then we point at the \norecurse or \gobble (for recursive) macro value
8386 % with \@tempb .
8387 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8388 % Depending on whether it is recursive or not, we need some tailing
8389 % \egroup .
8390 \ifx\@tempb\gobble
8391 \let\@tempc\relax
8392 \else
8393 \let\@tempc\egroup
8394 \fi
8395 % And now we do the real job:
8396 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8397 \@tempd
8398}
8399
8400\def\putargsintokens@#1,{%
8401 \if#1;\let\next\relax
8402 \else
8403 \let\next\putargsintokens@
8404 % First we allocate the new token list register, and give it a temporary
8405 % alias \@tempb .
8406 \toksdef\@tempb\the\paramno
8407 % Then we place the argument value into that token list register.
8408 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8409 \expandafter\@tempb\expandafter{\@tempa}%
8410 \advance\paramno by 1\relax
8411 \fi
8412 \next
8413}
8414
8415% Trailing missing arguments are set to empty.
8416%
8417\def\setemptyargvalues@{%
8418 \ifx\paramlist\nilm@
8419 \let\next\macargexpandinbody@
8420 \else
8421 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8422 \let\next\setemptyargvalues@
8423 \fi
8424 \next
8425}
8426
8427\def\setemptyargvaluesparser@#1,#2\endargs@{%
8428 \expandafter\def\expandafter\@tempa\expandafter{%
8429 \expandafter\def\csname macarg.#1\endcsname{}}%
8430 \push@\@tempa\macargdeflist@
8431 \def\paramlist{#2}%
8432}
8433
8434% #1 is the element target macro
8435% #2 is the list macro
8436% #3,#4\endargs@ is the list value
8437\def\pop@#1#2#3,#4\endargs@{%
8438 \def#1{#3}%
8439 \def#2{#4}%
8440}
8441\long\def\longpop@#1#2#3,#4\endargs@{%
8442 \long\def#1{#3}%
8443 \long\def#2{#4}%
8444}
8445
8446
8447%%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
8448
8449
8450% This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
8451% \macrobody has the body of the macro in it, with placeholders for
8452% its parameters, looking like "\xeatspaces{\hash 1}".
8453% \paramno is the number of parameters
8454% \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
8455% There are four cases: macros of zero, one, up to nine, and many arguments.
8456% \xdef is used so that macro definitions will survive the file
8457% they're defined in: @include reads the file inside a group.
8458%
8459\def\defmacro{%
8460 \let\hash=##% convert placeholders to macro parameter chars
8461 \ifnum\paramno=1
8462 \def\xeatspaces##1{##1}%
8463 % This removes the pair of braces around the argument. We don't
8464 % use \eatspaces, because this can cause ends of lines to be lost
8465 % when the argument to \eatspaces is read, leading to line-based
8466 % commands like "@itemize" not being read correctly.
8467 \else
8468 \let\xeatspaces\relax % suppress expansion
8469 \fi
8470 \ifcase\paramno
8471 % 0
8472 \expandafter\xdef\csname\the\macname\endcsname{%
8473 \bgroup
8474 \noexpand\spaceisspace
8475 \noexpand\endlineisspace
8476 \noexpand\expandafter % skip any whitespace after the macro name.
8477 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8478 \expandafter\xdef\csname\the\macname @@@\endcsname{%
8479 \egroup
8480 \noexpand\scanmacro{\macrobody}}%
8481 \or % 1
8482 \expandafter\xdef\csname\the\macname\endcsname{%
8483 \bgroup
8484 \noexpand\braceorline
8485 \expandafter\noexpand\csname\the\macname @@@\endcsname}%
8486 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8487 \egroup
8488 \noexpand\scanmacro{\macrobody}%
8489 }%
8490 \else % at most 9
8491 \ifnum\paramno<10\relax
8492 % @MACNAME sets the context for reading the macro argument
8493 % @MACNAME@@ gets the argument, processes backslashes and appends a
8494 % comma.
8495 % @MACNAME@@@ removes braces surrounding the argument list.
8496 % @MACNAME@@@@ scans the macro body with arguments substituted.
8497 \expandafter\xdef\csname\the\macname\endcsname{%
8498 \bgroup
8499 \noexpand\expandafter % This \expandafter skip any spaces after the
8500 \noexpand\macroargctxt % macro before we change the catcode of space.
8501 \noexpand\expandafter
8502 \expandafter\noexpand\csname\the\macname @@\endcsname}%
8503 \expandafter\xdef\csname\the\macname @@\endcsname##1{%
8504 \noexpand\passargtomacro
8505 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
8506 \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
8507 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
8508 \expandafter\expandafter
8509 \expandafter\xdef
8510 \expandafter\expandafter
8511 \csname\the\macname @@@@\endcsname\paramlist{%
8512 \egroup\noexpand\scanmacro{\macrobody}}%
8513 \else % 10 or more:
8514 \expandafter\xdef\csname\the\macname\endcsname{%
8515 \noexpand\getargvals@{\the\macname}{\argl}%
8516 }%
8517 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
8518 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8519 \fi
8520 \fi}
8521
8522\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
8523
8524\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8525
8526
8527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8528%
8529{\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
8530@catcode`@_=11 % private names
8531@catcode`@!=11 % used as argument separator
8532
8533% \passargtomacro#1#2 -
8534% Call #1 with a list of tokens #2, with any doubled backslashes in #2
8535% compressed to one.
8536%
8537% This implementation works by expansion, and not execution (so we cannot use
8538% \def or similar). This reduces the risk of this failing in contexts where
8539% complete expansion is done with no execution (for example, in writing out to
8540% an auxiliary file for an index entry).
8541%
8542% State is kept in the input stream: the argument passed to
8543% @look_ahead, @gobble_and_check_finish and @add_segment is
8544%
8545% THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
8546%
8547% where:
8548% THE_MACRO - name of the macro we want to call
8549% ARG_RESULT - argument list we build to pass to that macro
8550% PENDING_BS - either a backslash or nothing
8551% NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
8552
8553@gdef@passargtomacro#1#2{%
8554 @add_segment #1!{}@relax#2\@_finish\%
8555}
8556@gdef@_finish{@_finishx} @global@let@_finishx@relax
8557
8558% #1 - THE_MACRO ARG_RESULT
8559% #2 - PENDING_BS
8560% #3 - NEXT_TOKEN
8561% #4 used to look ahead
8562%
8563% If the next token is not a backslash, process the rest of the argument;
8564% otherwise, remove the next token.
8565@gdef@look_ahead#1!#2#3#4{%
8566 @ifx#4\%
8567 @expandafter@gobble_and_check_finish
8568 @else
8569 @expandafter@add_segment
8570 @fi#1!{#2}#4#4%
8571}
8572
8573% #1 - THE_MACRO ARG_RESULT
8574% #2 - PENDING_BS
8575% #3 - NEXT_TOKEN
8576% #4 should be a backslash, which is gobbled.
8577% #5 looks ahead
8578%
8579% Double backslash found. Add a single backslash, and look ahead.
8580@gdef@gobble_and_check_finish#1!#2#3#4#5{%
8581 @add_segment#1\!{}#5#5%
8582}
8583
8584@gdef@is_fi{@fi}
8585
8586% #1 - THE_MACRO ARG_RESULT
8587% #2 - PENDING_BS
8588% #3 - NEXT_TOKEN
8589% #4 is input stream until next backslash
8590%
8591% Input stream is either at the start of the argument, or just after a
8592% backslash sequence, either a lone backslash, or a doubled backslash.
8593% NEXT_TOKEN contains the first token in the input stream: if it is \finish,
8594% finish; otherwise, append to ARG_RESULT the segment of the argument up until
8595% the next backslash. PENDING_BACKSLASH contains a backslash to represent
8596% a backslash just before the start of the input stream that has not been
8597% added to ARG_RESULT.
8598@gdef@add_segment#1!#2#3#4\{%
8599@ifx#3@_finish
8600 @call_the_macro#1!%
8601@else
8602 % append the pending backslash to the result, followed by the next segment
8603 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
8604 % this @fi is discarded by @look_ahead.
8605 % we can't get rid of it with \expandafter because we don't know how
8606 % long #4 is.
8607}
8608
8609% #1 - THE_MACRO
8610% #2 - ARG_RESULT
8611% #3 discards the res of the conditional in @add_segment, and @is_fi ends the
8612% conditional.
8613@gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
8614
8615}
8616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8617
8618% \braceorline MAC is used for a one-argument macro MAC. It checks
8619% whether the next non-whitespace character is a {. It sets the context
8620% for reading the argument (slightly different in the two cases). Then,
8621% to read the argument, in the whole-line case, it then calls the regular
8622% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
8623%
8624\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8625\def\braceorlinexxx{%
8626 \ifx\nchar\bgroup
8627 \macroargctxt
8628 \expandafter\passargtomacro
8629 \else
8630 \macrolineargctxt\expandafter\parsearg
8631 \fi \macnamexxx}
8632
8633
8634% @alias.
8635% We need some trickery to remove the optional spaces around the equal
8636% sign. Make them active and then expand them all to nothing.
8637%
8638\def\alias{\parseargusing\obeyspaces\aliasxxx}
8639\def\aliasxxx #1{\aliasyyy#1\relax}
8640\def\aliasyyy #1=#2\relax{%
8641 {%
8642 \expandafter\let\obeyedspace=\empty
8643 \addtomacrolist{#1}%
8644 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8645 }%
8646 \next
8647}
8648
8649
8650\message{cross references,}
8651
8652\newwrite\auxfile
8653\newif\ifhavexrefs % True if xref values are known.
8654\newif\ifwarnedxrefs % True if we warned once that they aren't known.
8655
8656% @inforef is relatively simple.
8657\def\inforef #1{\inforefzzz #1,,,,**}
8658\def\inforefzzz #1,#2,#3,#4**{%
8659 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8660 node \samp{\ignorespaces#1{}}}
8661
8662% @node's only job in TeX is to define \lastnode, which is used in
8663% cross-references. The @node line might or might not have commas, and
8664% might or might not have spaces before the first comma, like:
8665% @node foo , bar , ...
8666% We don't want such trailing spaces in the node name.
8667%
8668\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8669%
8670% also remove a trailing comma, in case of something like this:
8671% @node Help-Cross, , , Cross-refs
8672\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8673\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
8674
8675% Used so that the @top node doesn't have to be wrapped in an @ifnottex
8676% conditional.
8677% \doignore goes to more effort to skip nested conditionals but we don't need
8678% that here.
8679\def\omittopnode{%
8680 \ifx\lastnode\wordTop
8681 \expandafter\ignorenode\fi
8682}
8683\def\wordTop{Top}
8684
8685% Until the next @node or @bye command, divert output to a box that is not
8686% output.
8687\def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}%
8688\ignorenodebye
8689}
8690
8691{\let\bye\relax
8692\gdef\ignorenodebye{\let\bye\ignorenodebyedef}
8693\gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}}
8694% The redefinition of \bye here is because it is declared \outer
8695
8696\let\lastnode=\empty
8697
8698% Write a cross-reference definition for the current node. #1 is the
8699% type (Ynumbered, Yappendix, Ynothing).
8700%
8701\def\donoderef#1{%
8702 \ifx\lastnode\empty\else
8703 \setref{\lastnode}{#1}%
8704 \global\let\lastnode=\empty
8705 \fi
8706}
8707
8708% @anchor{NAME} -- define xref target at arbitrary point.
8709%
8710\newcount\savesfregister
8711%
8712\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8713\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8714\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8715
8716% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8717% anchor), which consists of three parts:
8718% 1) NAME-title - the current sectioning name taken from \currentsection,
8719% or the anchor name.
8720% 2) NAME-snt - section number and type, passed as the SNT arg, or
8721% empty for anchors.
8722% 3) NAME-pg - the page number.
8723%
8724% This is called from \donoderef, \anchor, and \dofloat. In the case of
8725% floats, there is an additional part, which is not written here:
8726% 4) NAME-lof - the text as it should appear in a @listoffloats.
8727%
8728\def\setref#1#2{%
8729 \pdfmkdest{#1}%
8730 \iflinks
8731 {%
8732 \requireauxfile
8733 \atdummies % preserve commands, but don't expand them
8734 % match definition in \xrdef, \refx, \xrefX.
8735 \def\value##1{##1}%
8736 \edef\writexrdef##1##2{%
8737 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8738 ##1}{##2}}% these are parameters of \writexrdef
8739 }%
8740 \toks0 = \expandafter{\currentsection}%
8741 \immediate \writexrdef{title}{\the\toks0 }%
8742 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8743 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8744 }%
8745 \fi
8746}
8747
8748% @xrefautosectiontitle on|off says whether @section(ing) names are used
8749% automatically in xrefs, if the third arg is not explicitly specified.
8750% This was provided as a "secret" @set xref-automatic-section-title
8751% variable, now it's official.
8752%
8753\parseargdef\xrefautomaticsectiontitle{%
8754 \def\temp{#1}%
8755 \ifx\temp\onword
8756 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8757 = \empty
8758 \else\ifx\temp\offword
8759 \expandafter\let\csname SETxref-automatic-section-title\endcsname
8760 = \relax
8761 \else
8762 \errhelp = \EMsimple
8763 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8764 must be on|off}%
8765 \fi\fi
8766}
8767
8768%
8769% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8770% the node name, #2 the name of the Info cross-reference, #3 the printed
8771% node name, #4 the name of the Info file, #5 the name of the printed
8772% manual. All but the node name can be omitted.
8773%
8774\def\pxref{\putwordsee{} \xrefXX}
8775\def\xref{\putwordSee{} \xrefXX}
8776\def\ref{\xrefXX}
8777
8778\def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
8779\def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
8780%
8781\newbox\toprefbox
8782\newbox\printedrefnamebox
8783\newbox\infofilenamebox
8784\newbox\printedmanualbox
8785%
8786\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8787 \unsepspaces
8788 %
8789 % Get args without leading/trailing spaces.
8790 \def\printedrefname{\ignorespaces #3}%
8791 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8792 %
8793 \def\infofilename{\ignorespaces #4}%
8794 \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8795 %
8796 \def\printedmanual{\ignorespaces #5}%
8797 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8798 %
8799 % If the printed reference name (arg #3) was not explicitly given in
8800 % the @xref, figure out what we want to use.
8801 \ifdim \wd\printedrefnamebox = 0pt
8802 % No printed node name was explicitly given.
8803 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8804 % Not auto section-title: use node name inside the square brackets.
8805 \def\printedrefname{\ignorespaces #1}%
8806 \else
8807 % Auto section-title: use chapter/section title inside
8808 % the square brackets if we have it.
8809 \ifdim \wd\printedmanualbox > 0pt
8810 % It is in another manual, so we don't have it; use node name.
8811 \def\printedrefname{\ignorespaces #1}%
8812 \else
8813 \ifhavexrefs
8814 % We (should) know the real title if we have the xref values.
8815 \def\printedrefname{\refx{#1-title}}%
8816 \else
8817 % Otherwise just copy the Info node name.
8818 \def\printedrefname{\ignorespaces #1}%
8819 \fi%
8820 \fi
8821 \fi
8822 \fi
8823 %
8824 % Make link in pdf output.
8825 \ifpdf
8826 % For pdfTeX and LuaTeX
8827 {\indexnofonts
8828 \makevalueexpandable
8829 \turnoffactive
8830 % This expands tokens, so do it after making catcode changes, so _
8831 % etc. don't get their TeX definitions. This ignores all spaces in
8832 % #4, including (wrongly) those in the middle of the filename.
8833 \getfilename{#4}%
8834 %
8835 % This (wrongly) does not take account of leading or trailing
8836 % spaces in #1, which should be ignored.
8837 \setpdfdestname{#1}%
8838 %
8839 \ifx\pdfdestname\empty
8840 \def\pdfdestname{Top}% no empty targets
8841 \fi
8842 %
8843 \leavevmode
8844 \startlink attr{/Border [0 0 0]}%
8845 \ifnum\filenamelength>0
8846 goto file{\the\filename.pdf} name{\pdfdestname}%
8847 \else
8848 goto name{\pdfmkpgn{\pdfdestname}}%
8849 \fi
8850 }%
8851 \setcolor{\linkcolor}%
8852 \else
8853 \ifx\XeTeXrevision\thisisundefined
8854 \else
8855 % For XeTeX
8856 {\indexnofonts
8857 \makevalueexpandable
8858 \turnoffactive
8859 % This expands tokens, so do it after making catcode changes, so _
8860 % etc. don't get their TeX definitions. This ignores all spaces in
8861 % #4, including (wrongly) those in the middle of the filename.
8862 \getfilename{#4}%
8863 %
8864 % This (wrongly) does not take account of leading or trailing
8865 % spaces in #1, which should be ignored.
8866 \setpdfdestname{#1}%
8867 %
8868 \ifx\pdfdestname\empty
8869 \def\pdfdestname{Top}% no empty targets
8870 \fi
8871 %
8872 \leavevmode
8873 \ifnum\filenamelength>0
8874 % With default settings,
8875 % XeTeX (xdvipdfmx) replaces link destination names with integers.
8876 % In this case, the replaced destination names of
8877 % remote PDFs are no longer known. In order to avoid a replacement,
8878 % you can use xdvipdfmx's command line option `-C 0x0010'.
8879 % If you use XeTeX 0.99996+ (TeX Live 2016+),
8880 % this command line option is no longer necessary
8881 % because we can use the `dvipdfmx:config' special.
8882 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8883 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
8884 \else
8885 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
8886 << /S /GoTo /D (\pdfdestname) >> >>}%
8887 \fi
8888 }%
8889 \setcolor{\linkcolor}%
8890 \fi
8891 \fi
8892 {%
8893 % Have to otherify everything special to allow the \csname to
8894 % include an _ in the xref name, etc.
8895 \indexnofonts
8896 \turnoffactive
8897 \def\value##1{##1}%
8898 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8899 \csname XR#1-title\endcsname
8900 }%
8901 %
8902 % Float references are printed completely differently: "Figure 1.2"
8903 % instead of "[somenode], p.3". \iffloat distinguishes them by
8904 % \Xthisreftitle being set to a magic string.
8905 \iffloat\Xthisreftitle
8906 % If the user specified the print name (third arg) to the ref,
8907 % print it instead of our usual "Figure 1.2".
8908 \ifdim\wd\printedrefnamebox = 0pt
8909 \refx{#1-snt}%
8910 \else
8911 \printedrefname
8912 \fi
8913 %
8914 % If the user also gave the printed manual name (fifth arg), append
8915 % "in MANUALNAME".
8916 \ifdim \wd\printedmanualbox > 0pt
8917 \space \putwordin{} \cite{\printedmanual}%
8918 \fi
8919 \else
8920 % node/anchor (non-float) references.
8921 %
8922 % If we use \unhbox to print the node names, TeX does not insert
8923 % empty discretionaries after hyphens, which means that it will not
8924 % find a line break at a hyphen in a node names. Since some manuals
8925 % are best written with fairly long node names, containing hyphens,
8926 % this is a loss. Therefore, we give the text of the node name
8927 % again, so it is as if TeX is seeing it for the first time.
8928 %
8929 \ifdim \wd\printedmanualbox > 0pt
8930 % Cross-manual reference with a printed manual name.
8931 %
8932 \crossmanualxref{\cite{\printedmanual\unskip}}%
8933 %
8934 \else\ifdim \wd\infofilenamebox > 0pt
8935 % Cross-manual reference with only an info filename (arg 4), no
8936 % printed manual name (arg 5). This is essentially the same as
8937 % the case above; we output the filename, since we have nothing else.
8938 %
8939 \crossmanualxref{\code{\infofilename\unskip}}%
8940 %
8941 \else
8942 % Reference within this manual.
8943 %
8944 % Only output a following space if the -snt ref is nonempty, as the ref
8945 % will be empty for @unnumbered and @anchor.
8946 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
8947 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8948 %
8949 % output the `[mynode]' via the macro below so it can be overridden.
8950 \xrefprintnodename\printedrefname
8951 %
8952 \expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax
8953 % But we always want a comma and a space:
8954 ,\space
8955 %
8956 % output the `page 3'.
8957 \turnoffactive \putwordpage\tie\refx{#1-pg}%
8958 % Add a , if xref followed by a space
8959 \if\space\noexpand\tokenafterxref ,%
8960 \else\ifx\ \tokenafterxref ,% @TAB
8961 \else\ifx\*\tokenafterxref ,% @*
8962 \else\ifx\ \tokenafterxref ,% @SPACE
8963 \else\ifx\
8964 \tokenafterxref ,% @NL
8965 \else\ifx\tie\tokenafterxref ,% @tie
8966 \fi\fi\fi\fi\fi\fi
8967 \fi
8968 \fi\fi
8969 \fi
8970 \endlink
8971\endgroup}
8972
8973% Output a cross-manual xref to #1. Used just above (twice).
8974%
8975% Only include the text "Section ``foo'' in" if the foo is neither
8976% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
8977% "see The Foo Manual", the idea being to refer to the whole manual.
8978%
8979% But, this being TeX, we can't easily compare our node name against the
8980% string "Top" while ignoring the possible spaces before and after in
8981% the input. By adding the arbitrary 7sp below, we make it much less
8982% likely that a real node name would have the same width as "Top" (e.g.,
8983% in a monospaced font). Hopefully it will never happen in practice.
8984%
8985% For the same basic reason, we retypeset the "Top" at every
8986% reference, since the current font is indeterminate.
8987%
8988\def\crossmanualxref#1{%
8989 \setbox\toprefbox = \hbox{Top\kern7sp}%
8990 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
8991 \ifdim \wd2 > 7sp % nonempty?
8992 \ifdim \wd2 = \wd\toprefbox \else % same as Top?
8993 \putwordSection{} ``\printedrefname'' \putwordin{}\space
8994 \fi
8995 \fi
8996 #1%
8997}
8998
8999% This macro is called from \xrefX for the `[nodename]' part of xref
9000% output. It's a separate macro only so it can be changed more easily,
9001% since square brackets don't work well in some documents. Particularly
9002% one that Bob is working on :).
9003%
9004\def\xrefprintnodename#1{[#1]}
9005
9006% Things referred to by \setref.
9007%
9008\def\Ynothing{}
9009\def\Yomitfromtoc{}
9010\def\Ynumbered{%
9011 \ifnum\secno=0
9012 \putwordChapter@tie \the\chapno
9013 \else \ifnum\subsecno=0
9014 \putwordSection@tie \the\chapno.\the\secno
9015 \else \ifnum\subsubsecno=0
9016 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
9017 \else
9018 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
9019 \fi\fi\fi
9020}
9021\def\Yappendix{%
9022 \ifnum\secno=0
9023 \putwordAppendix@tie @char\the\appendixno{}%
9024 \else \ifnum\subsecno=0
9025 \putwordSection@tie @char\the\appendixno.\the\secno
9026 \else \ifnum\subsubsecno=0
9027 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
9028 \else
9029 \putwordSection@tie
9030 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
9031 \fi\fi\fi
9032}
9033
9034% \refx{NAME} - reference a cross-reference string named NAME.
9035\def\refx#1{%
9036 \requireauxfile
9037 {%
9038 \indexnofonts
9039 \turnoffactive
9040 \def\value##1{##1}%
9041 \expandafter\global\expandafter\let\expandafter\thisrefX
9042 \csname XR#1\endcsname
9043 }%
9044 \ifx\thisrefX\relax
9045 % If not defined, say something at least.
9046 \angleleft un\-de\-fined\angleright
9047 \iflinks
9048 \ifhavexrefs
9049 {\toks0 = {#1}% avoid expansion of possibly-complex value
9050 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
9051 \else
9052 \ifwarnedxrefs\else
9053 \global\warnedxrefstrue
9054 \message{Cross reference values unknown; you must run TeX again.}%
9055 \fi
9056 \fi
9057 \fi
9058 \else
9059 % It's defined, so just use it.
9060 \thisrefX
9061 \fi
9062}
9063
9064% This is the macro invoked by entries in the aux file. Define a control
9065% sequence for a cross-reference target (we prepend XR to the control sequence
9066% name to avoid collisions). The value is the page number. If this is a float
9067% type, we have more work to do.
9068%
9069\def\xrdef#1#2{%
9070 {% Expand the node or anchor name to remove control sequences.
9071 % \turnoffactive stops 8-bit characters being changed to commands
9072 % like @'e. \refx does the same to retrieve the value in the definition.
9073 \indexnofonts
9074 \turnoffactive
9075 \def\value##1{##1}%
9076 \xdef\safexrefname{#1}%
9077 }%
9078 %
9079 \bgroup
9080 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
9081 \egroup
9082 % We put the \gdef inside a group to avoid the definitions building up on
9083 % TeX's save stack, which can cause it to run out of space for aux files with
9084 % thousands of lines. \gdef doesn't use the save stack, but \csname does
9085 % when it defines an unknown control sequence as \relax.
9086 %
9087 % Was that xref control sequence that we just defined for a float?
9088 \expandafter\iffloat\csname XR\safexrefname\endcsname
9089 % it was a float, and we have the (safe) float type in \iffloattype.
9090 \expandafter\let\expandafter\floatlist
9091 \csname floatlist\iffloattype\endcsname
9092 %
9093 % Is this the first time we've seen this float type?
9094 \expandafter\ifx\floatlist\relax
9095 \toks0 = {\do}% yes, so just \do
9096 \else
9097 % had it before, so preserve previous elements in list.
9098 \toks0 = \expandafter{\floatlist\do}%
9099 \fi
9100 %
9101 % Remember this xref in the control sequence \floatlistFLOATTYPE,
9102 % for later use in \listoffloats.
9103 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
9104 {\safexrefname}}%
9105 \fi
9106}
9107
9108% If working on a large document in chapters, it is convenient to
9109% be able to disable indexing, cross-referencing, and contents, for test runs.
9110% This is done with @novalidate at the beginning of the file.
9111%
9112\newif\iflinks \linkstrue % by default we want the aux files.
9113\let\novalidate = \linksfalse
9114
9115% Used when writing to the aux file, or when using data from it.
9116\def\requireauxfile{%
9117 \iflinks
9118 \tryauxfile
9119 % Open the new aux file. TeX will close it automatically at exit.
9120 \immediate\openout\auxfile=\jobname.aux
9121 \fi
9122 \global\let\requireauxfile=\relax % Only do this once.
9123}
9124
9125% Read the last existing aux file, if any. No error if none exists.
9126%
9127\def\tryauxfile{%
9128 \openin 1 \jobname.aux
9129 \ifeof 1 \else
9130 \readdatafile{aux}%
9131 \global\havexrefstrue
9132 \fi
9133 \closein 1
9134}
9135
9136\def\setupdatafile{%
9137 \catcode`\^^@=\other
9138 \catcode`\^^A=\other
9139 \catcode`\^^B=\other
9140 \catcode`\^^C=\other
9141 \catcode`\^^D=\other
9142 \catcode`\^^E=\other
9143 \catcode`\^^F=\other
9144 \catcode`\^^G=\other
9145 \catcode`\^^H=\other
9146 \catcode`\^^K=\other
9147 \catcode`\^^L=\other
9148 \catcode`\^^N=\other
9149 \catcode`\^^P=\other
9150 \catcode`\^^Q=\other
9151 \catcode`\^^R=\other
9152 \catcode`\^^S=\other
9153 \catcode`\^^T=\other
9154 \catcode`\^^U=\other
9155 \catcode`\^^V=\other
9156 \catcode`\^^W=\other
9157 \catcode`\^^X=\other
9158 \catcode`\^^Z=\other
9159 \catcode`\^^[=\other
9160 \catcode`\^^\=\other
9161 \catcode`\^^]=\other
9162 \catcode`\^^^=\other
9163 \catcode`\^^_=\other
9164 \catcode`\^=\other
9165 %
9166 % Special characters. Should be turned off anyway, but...
9167 \catcode`\~=\other
9168 \catcode`\[=\other
9169 \catcode`\]=\other
9170 \catcode`\"=\other
9171 \catcode`\_=\active
9172 \catcode`\|=\active
9173 \catcode`\<=\active
9174 \catcode`\>=\active
9175 \catcode`\$=\other
9176 \catcode`\#=\other
9177 \catcode`\&=\other
9178 \catcode`\%=\other
9179 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
9180 %
9181 \catcode`\\=\active
9182 %
9183 % @ is our escape character in .aux files, and we need braces.
9184 \catcode`\{=1
9185 \catcode`\}=2
9186 \catcode`\@=0
9187}
9188
9189\def\readdatafile#1{%
9190\begingroup
9191 \setupdatafile
9192 \input\jobname.#1
9193\endgroup}
9194
9195
9196\message{insertions,}
9197% including footnotes.
9198
9199\newcount \footnoteno
9200
9201% The trailing space in the following definition for supereject is
9202% vital for proper filling; pages come out unaligned when you do a
9203% pagealignmacro call if that space before the closing brace is
9204% removed. (Generally, numeric constants should always be followed by a
9205% space to prevent strange expansion errors.)
9206\def\supereject{\par\penalty -20000\footnoteno =0 }
9207
9208% @footnotestyle is meaningful for Info output only.
9209\let\footnotestyle=\comment
9210
9211{\catcode `\@=11
9212%
9213% Auto-number footnotes. Otherwise like plain.
9214\gdef\footnote{%
9215 \global\advance\footnoteno by \@ne
9216 \edef\thisfootno{$^{\the\footnoteno}$}%
9217 %
9218 % In case the footnote comes at the end of a sentence, preserve the
9219 % extra spacing after we do the footnote number.
9220 \let\@sf\empty
9221 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
9222 %
9223 % Remove inadvertent blank space before typesetting the footnote number.
9224 \unskip
9225 \thisfootno\@sf
9226 \dofootnote
9227}%
9228
9229% Don't bother with the trickery in plain.tex to not require the
9230% footnote text as a parameter. Our footnotes don't need to be so general.
9231%
9232% Oh yes, they do; otherwise, @ifset (and anything else that uses
9233% \parseargline) fails inside footnotes because the tokens are fixed when
9234% the footnote is read. --karl, 16nov96.
9235%
9236\gdef\dofootnote{%
9237 \insert\footins\bgroup
9238 %
9239 % Nested footnotes are not supported in TeX, that would take a lot
9240 % more work. (\startsavinginserts does not suffice.)
9241 \let\footnote=\errfootnotenest
9242 %
9243 % We want to typeset this text as a normal paragraph, even if the
9244 % footnote reference occurs in (for example) a display environment.
9245 % So reset some parameters.
9246 \hsize=\txipagewidth
9247 \interlinepenalty\interfootnotelinepenalty
9248 \splittopskip\ht\strutbox % top baseline for broken footnotes
9249 \splitmaxdepth\dp\strutbox
9250 \floatingpenalty\@MM
9251 \leftskip\z@skip
9252 \rightskip\z@skip
9253 \spaceskip\z@skip
9254 \xspaceskip\z@skip
9255 \parindent\defaultparindent
9256 %
9257 \smallfonts \rm
9258 %
9259 % Because we use hanging indentation in footnotes, a @noindent appears
9260 % to exdent this text, so make it be a no-op. makeinfo does not use
9261 % hanging indentation so @noindent can still be needed within footnote
9262 % text after an @example or the like (not that this is good style).
9263 \let\noindent = \relax
9264 %
9265 % Hang the footnote text off the number. Use \everypar in case the
9266 % footnote extends for more than one paragraph.
9267 \everypar = {\hang}%
9268 \textindent{\thisfootno}%
9269 %
9270 % Don't crash into the line above the footnote text. Since this
9271 % expands into a box, it must come within the paragraph, lest it
9272 % provide a place where TeX can split the footnote.
9273 \footstrut
9274 %
9275 % Invoke rest of plain TeX footnote routine.
9276 \futurelet\next\fo@t
9277}
9278}%end \catcode `\@=11
9279
9280\def\errfootnotenest{%
9281 \errhelp=\EMsimple
9282 \errmessage{Nested footnotes not supported in texinfo.tex,
9283 even though they work in makeinfo; sorry}
9284}
9285
9286\def\errfootnoteheading{%
9287 \errhelp=\EMsimple
9288 \errmessage{Footnotes in chapters, sections, etc., are not supported}
9289}
9290
9291% In case a @footnote appears in a vbox, save the footnote text and create
9292% the real \insert just after the vbox finished. Otherwise, the insertion
9293% would be lost.
9294% Similarly, if a @footnote appears inside an alignment, save the footnote
9295% text to a box and make the \insert when a row of the table is finished.
9296% And the same can be done for other insert classes. --kasal, 16nov03.
9297%
9298% Replace the \insert primitive by a cheating macro.
9299% Deeper inside, just make sure that the saved insertions are not spilled
9300% out prematurely.
9301%
9302\def\startsavinginserts{%
9303 \ifx \insert\ptexinsert
9304 \let\insert\saveinsert
9305 \else
9306 \let\checkinserts\relax
9307 \fi
9308}
9309
9310% This \insert replacement works for both \insert\footins{foo} and
9311% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
9312%
9313\def\saveinsert#1{%
9314 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
9315 \afterassignment\next
9316 % swallow the left brace
9317 \let\temp =
9318}
9319\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
9320\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
9321
9322\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
9323
9324\def\placesaveins#1{%
9325 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
9326 {\box#1}%
9327}
9328
9329% eat @SAVE -- beware, all of them have catcode \other:
9330{
9331 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
9332 \gdef\gobblesave @SAVE{}
9333}
9334
9335% initialization:
9336\def\newsaveins #1{%
9337 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
9338 \next
9339}
9340\def\newsaveinsX #1{%
9341 \csname newbox\endcsname #1%
9342 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
9343 \checksaveins #1}%
9344}
9345
9346% initialize:
9347\let\checkinserts\empty
9348\newsaveins\footins
9349\newsaveins\margin
9350
9351
9352% @image. We use the macros from epsf.tex to support this.
9353% If epsf.tex is not installed and @image is used, we complain.
9354%
9355% Check for and read epsf.tex up front. If we read it only at @image
9356% time, we might be inside a group, and then its definitions would get
9357% undone and the next image would fail.
9358\openin 1 = epsf.tex
9359\ifeof 1 \else
9360 % Do not bother showing banner with epsf.tex v2.7k (available in
9361 % doc/epsf.tex and on ctan).
9362 \def\epsfannounce{\toks0 = }%
9363 \input epsf.tex
9364\fi
9365\closein 1
9366%
9367% We will only complain once about lack of epsf.tex.
9368\newif\ifwarnednoepsf
9369\newhelp\noepsfhelp{epsf.tex must be installed for images to
9370 work. It is also included in the Texinfo distribution, or you can get
9371 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
9372%
9373\def\image#1{%
9374 \ifx\epsfbox\thisisundefined
9375 \ifwarnednoepsf \else
9376 \errhelp = \noepsfhelp
9377 \errmessage{epsf.tex not found, images will be ignored}%
9378 \global\warnednoepsftrue
9379 \fi
9380 \else
9381 \imagexxx #1,,,,,\finish
9382 \fi
9383}
9384%
9385% Arguments to @image:
9386% #1 is (mandatory) image filename; we tack on .eps extension.
9387% #2 is (optional) width, #3 is (optional) height.
9388% #4 is (ignored optional) html alt text.
9389% #5 is (ignored optional) extension.
9390% #6 is just the usual extra ignored arg for parsing stuff.
9391\newif\ifimagevmode
9392\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9393 \catcode`\^^M = 5 % in case we're inside an example
9394 \normalturnoffactive % allow _ et al. in names
9395 \makevalueexpandable
9396 % If the image is by itself, center it.
9397 \ifvmode
9398 \imagevmodetrue
9399 \else \ifx\centersub\centerV
9400 % for @center @image, we need a vbox so we can have our vertical space
9401 \imagevmodetrue
9402 \vbox\bgroup % vbox has better behavior than vtop herev
9403 \fi\fi
9404 %
9405 \ifimagevmode
9406 \nobreak\medskip
9407 % Usually we'll have text after the image which will insert
9408 % \parskip glue, so insert it here too to equalize the space
9409 % above and below.
9410 \nobreak\vskip\parskip
9411 \nobreak
9412 \fi
9413 %
9414 % Leave vertical mode so that indentation from an enclosing
9415 % environment such as @quotation is respected.
9416 % However, if we're at the top level, we don't want the
9417 % normal paragraph indentation.
9418 % On the other hand, if we are in the case of @center @image, we don't
9419 % want to start a paragraph, which will create a hsize-width box and
9420 % eradicate the centering.
9421 \ifx\centersub\centerV \else \imageindent \fi
9422 %
9423 % Output the image.
9424 \ifpdf
9425 % For pdfTeX and LuaTeX <= 0.80
9426 \dopdfimage{#1}{#2}{#3}%
9427 \else
9428 \ifx\XeTeXrevision\thisisundefined
9429 % For epsf.tex
9430 % \epsfbox itself resets \epsf?size at each figure.
9431 \setbox0 = \hbox{\ignorespaces #2}%
9432 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9433 \setbox0 = \hbox{\ignorespaces #3}%
9434 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9435 \epsfbox{#1.eps}%
9436 \else
9437 % For XeTeX
9438 \doxeteximage{#1}{#2}{#3}%
9439 \fi
9440 \fi
9441 %
9442 \ifimagevmode
9443 \medskip % space after a standalone image
9444 \fi
9445 \ifx\centersub\centerV \egroup \fi
9446\endgroup}
9447
9448
9449% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9450% etc. We don't actually implement floating yet, we always include the
9451% float "here". But it seemed the best name for the future.
9452%
9453\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9454
9455% There may be a space before second and/or third parameter; delete it.
9456\def\eatcommaspace#1, {#1,}
9457
9458% #1 is the optional FLOATTYPE, the text label for this float, typically
9459% "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9460% this float will not be numbered and cannot be referred to.
9461%
9462% #2 is the optional xref label. Also must be present for the float to
9463% be referable.
9464%
9465% #3 is the optional positioning argument; for now, it is ignored. It
9466% will somehow specify the positions allowed to float to (here, top, bottom).
9467%
9468% We keep a separate counter for each FLOATTYPE, which we reset at each
9469% chapter-level command.
9470\let\resetallfloatnos=\empty
9471%
9472\def\dofloat#1,#2,#3,#4\finish{%
9473 \let\thiscaption=\empty
9474 \let\thisshortcaption=\empty
9475 %
9476 % don't lose footnotes inside @float.
9477 %
9478 % BEWARE: when the floats start float, we have to issue warning whenever an
9479 % insert appears inside a float which could possibly float. --kasal, 26may04
9480 %
9481 \startsavinginserts
9482 %
9483 % We can't be used inside a paragraph.
9484 \par
9485 %
9486 \vtop\bgroup
9487 \def\floattype{#1}%
9488 \def\floatlabel{#2}%
9489 \def\floatloc{#3}% we do nothing with this yet.
9490 %
9491 \ifx\floattype\empty
9492 \let\safefloattype=\empty
9493 \else
9494 {%
9495 % the floattype might have accents or other special characters,
9496 % but we need to use it in a control sequence name.
9497 \indexnofonts
9498 \turnoffactive
9499 \xdef\safefloattype{\floattype}%
9500 }%
9501 \fi
9502 %
9503 % If label is given but no type, we handle that as the empty type.
9504 \ifx\floatlabel\empty \else
9505 % We want each FLOATTYPE to be numbered separately (Figure 1,
9506 % Table 1, Figure 2, ...). (And if no label, no number.)
9507 %
9508 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9509 \global\advance\floatno by 1
9510 %
9511 {%
9512 % This magic value for \currentsection is output by \setref as the
9513 % XREFLABEL-title value. \xrefX uses it to distinguish float
9514 % labels (which have a completely different output format) from
9515 % node and anchor labels. And \xrdef uses it to construct the
9516 % lists of floats.
9517 %
9518 \edef\currentsection{\floatmagic=\safefloattype}%
9519 \setref{\floatlabel}{Yfloat}%
9520 }%
9521 \fi
9522 %
9523 % start with \parskip glue, I guess.
9524 \vskip\parskip
9525 %
9526 % Don't suppress indentation if a float happens to start a section.
9527 \restorefirstparagraphindent
9528}
9529
9530% we have these possibilities:
9531% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9532% @float Foo,lbl & no caption: Foo 1.1
9533% @float Foo & @caption{Cap}: Foo: Cap
9534% @float Foo & no caption: Foo
9535% @float ,lbl & Caption{Cap}: 1.1: Cap
9536% @float ,lbl & no caption: 1.1
9537% @float & @caption{Cap}: Cap
9538% @float & no caption:
9539%
9540\def\Efloat{%
9541 \let\floatident = \empty
9542 %
9543 % In all cases, if we have a float type, it comes first.
9544 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9545 %
9546 % If we have an xref label, the number comes next.
9547 \ifx\floatlabel\empty \else
9548 \ifx\floattype\empty \else % if also had float type, need tie first.
9549 \appendtomacro\floatident{\tie}%
9550 \fi
9551 % the number.
9552 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9553 \fi
9554 %
9555 % Start the printed caption with what we've constructed in
9556 % \floatident, but keep it separate; we need \floatident again.
9557 \let\captionline = \floatident
9558 %
9559 \ifx\thiscaption\empty \else
9560 \ifx\floatident\empty \else
9561 \appendtomacro\captionline{: }% had ident, so need a colon between
9562 \fi
9563 %
9564 % caption text.
9565 \appendtomacro\captionline{\scanexp\thiscaption}%
9566 \fi
9567 %
9568 % If we have anything to print, print it, with space before.
9569 % Eventually this needs to become an \insert.
9570 \ifx\captionline\empty \else
9571 \vskip.5\parskip
9572 \captionline
9573 %
9574 % Space below caption.
9575 \vskip\parskip
9576 \fi
9577 %
9578 % If have an xref label, write the list of floats info. Do this
9579 % after the caption, to avoid chance of it being a breakpoint.
9580 \ifx\floatlabel\empty \else
9581 % Write the text that goes in the lof to the aux file as
9582 % \floatlabel-lof. Besides \floatident, we include the short
9583 % caption if specified, else the full caption if specified, else nothing.
9584 {%
9585 \requireauxfile
9586 \atdummies
9587 %
9588 \ifx\thisshortcaption\empty
9589 \def\gtemp{\thiscaption}%
9590 \else
9591 \def\gtemp{\thisshortcaption}%
9592 \fi
9593 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9594 \ifx\gtemp\empty \else : \gtemp \fi}}%
9595 }%
9596 \fi
9597 \egroup % end of \vtop
9598 %
9599 \checkinserts
9600}
9601
9602% Append the tokens #2 to the definition of macro #1, not expanding either.
9603%
9604\def\appendtomacro#1#2{%
9605 \expandafter\def\expandafter#1\expandafter{#1#2}%
9606}
9607
9608% @caption, @shortcaption
9609%
9610\def\caption{\docaption\thiscaption}
9611\def\shortcaption{\docaption\thisshortcaption}
9612\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9613\def\defcaption#1#2{\egroup \def#1{#2}}
9614
9615% The parameter is the control sequence identifying the counter we are
9616% going to use. Create it if it doesn't exist and assign it to \floatno.
9617\def\getfloatno#1{%
9618 \ifx#1\relax
9619 % Haven't seen this figure type before.
9620 \csname newcount\endcsname #1%
9621 %
9622 % Remember to reset this floatno at the next chap.
9623 \expandafter\gdef\expandafter\resetallfloatnos
9624 \expandafter{\resetallfloatnos #1=0 }%
9625 \fi
9626 \let\floatno#1%
9627}
9628
9629% \setref calls this to get the XREFLABEL-snt value. We want an @xref
9630% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9631% first read the @float command.
9632%
9633\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9634
9635% Magic string used for the XREFLABEL-title value, so \xrefX can
9636% distinguish floats from other xref types.
9637\def\floatmagic{!!float!!}
9638
9639% #1 is the control sequence we are passed; we expand into a conditional
9640% which is true if #1 represents a float ref. That is, the magic
9641% \currentsection value which we \setref above.
9642%
9643\def\iffloat#1{\expandafter\doiffloat#1==\finish}
9644%
9645% #1 is (maybe) the \floatmagic string. If so, #2 will be the
9646% (safe) float type for this float. We set \iffloattype to #2.
9647%
9648\def\doiffloat#1=#2=#3\finish{%
9649 \def\temp{#1}%
9650 \def\iffloattype{#2}%
9651 \ifx\temp\floatmagic
9652}
9653
9654% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9655%
9656\parseargdef\listoffloats{%
9657 \def\floattype{#1}% floattype
9658 {%
9659 % the floattype might have accents or other special characters,
9660 % but we need to use it in a control sequence name.
9661 \indexnofonts
9662 \turnoffactive
9663 \xdef\safefloattype{\floattype}%
9664 }%
9665 %
9666 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9667 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9668 \ifhavexrefs
9669 % if the user said @listoffloats foo but never @float foo.
9670 \message{\linenumber No `\safefloattype' floats to list.}%
9671 \fi
9672 \else
9673 \begingroup
9674 \leftskip=\tocindent % indent these entries like a toc
9675 \let\do=\listoffloatsdo
9676 \csname floatlist\safefloattype\endcsname
9677 \endgroup
9678 \fi
9679}
9680
9681% This is called on each entry in a list of floats. We're passed the
9682% xref label, in the form LABEL-title, which is how we save it in the
9683% aux file. We strip off the -title and look up \XRLABEL-lof, which
9684% has the text we're supposed to typeset here.
9685%
9686% Figures without xref labels will not be included in the list (since
9687% they won't appear in the aux file).
9688%
9689\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9690\def\listoffloatsdoentry#1-title\finish{{%
9691 % Can't fully expand XR#1-lof because it can contain anything. Just
9692 % pass the control sequence. On the other hand, XR#1-pg is just the
9693 % page number, and we want to fully expand that so we can get a link
9694 % in pdf output.
9695 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9696 %
9697 % use the same \entry macro we use to generate the TOC and index.
9698 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9699 \writeentry
9700}}
9701
9702
9703\message{localization,}
9704
9705% For single-language documents, @documentlanguage is usually given very
9706% early, just after @documentencoding. Single argument is the language
9707% (de) or locale (de_DE) abbreviation.
9708%
9709{
9710 \catcode`\_ = \active
9711 \globaldefs=1
9712\parseargdef\documentlanguage{%
9713 \tex % read txi-??.tex file in plain TeX.
9714 % Read the file by the name they passed if it exists.
9715 \let_ = \normalunderscore % normal _ character for filename test
9716 \openin 1 txi-#1.tex
9717 \ifeof 1
9718 \documentlanguagetrywithoutunderscore #1_\finish
9719 \else
9720 \globaldefs = 1 % everything in the txi-LL files needs to persist
9721 \input txi-#1.tex
9722 \fi
9723 \closein 1
9724 \endgroup % end raw TeX
9725}
9726%
9727% If they passed de_DE, and txi-de_DE.tex doesn't exist,
9728% try txi-de.tex.
9729%
9730\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9731 \openin 1 txi-#1.tex
9732 \ifeof 1
9733 \errhelp = \nolanghelp
9734 \errmessage{Cannot read language file txi-#1.tex}%
9735 \else
9736 \globaldefs = 1 % everything in the txi-LL files needs to persist
9737 \input txi-#1.tex
9738 \fi
9739 \closein 1
9740}
9741}% end of special _ catcode
9742%
9743\newhelp\nolanghelp{The given language definition file cannot be found or
9744is empty. Maybe you need to install it? Putting it in the current
9745directory should work if nowhere else does.}
9746
9747% This macro is called from txi-??.tex files; the first argument is the
9748% \language name to set (without the "\lang@" prefix), the second and
9749% third args are \{left,right}hyphenmin.
9750%
9751% The language names to pass are determined when the format is built.
9752% See the etex.log file created at that time, e.g.,
9753% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9754%
9755% With TeX Live 2008, etex now includes hyphenation patterns for all
9756% available languages. This means we can support hyphenation in
9757% Texinfo, at least to some extent. (This still doesn't solve the
9758% accented characters problem.)
9759%
9760\catcode`@=11
9761\def\txisetlanguage#1#2#3{%
9762 % do not set the language if the name is undefined in the current TeX.
9763 \expandafter\ifx\csname lang@#1\endcsname \relax
9764 \message{no patterns for #1}%
9765 \else
9766 \global\language = \csname lang@#1\endcsname
9767 \fi
9768 % but there is no harm in adjusting the hyphenmin values regardless.
9769 \global\lefthyphenmin = #2\relax
9770 \global\righthyphenmin = #3\relax
9771}
9772
9773% XeTeX and LuaTeX can handle Unicode natively.
9774% Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
9775% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
9776%
9777\newif\iftxinativeunicodecapable
9778\newif\iftxiusebytewiseio
9779
9780\ifx\XeTeXrevision\thisisundefined
9781 \ifx\luatexversion\thisisundefined
9782 \txinativeunicodecapablefalse
9783 \txiusebytewiseiotrue
9784 \else
9785 \txinativeunicodecapabletrue
9786 \txiusebytewiseiofalse
9787 \fi
9788\else
9789 \txinativeunicodecapabletrue
9790 \txiusebytewiseiofalse
9791\fi
9792
9793% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
9794% for non-UTF-8 (byte-wise) encodings.
9795%
9796\def\setbytewiseio{%
9797 \ifx\XeTeXrevision\thisisundefined
9798 \else
9799 \XeTeXdefaultencoding "bytes" % For subsequent files to be read
9800 \XeTeXinputencoding "bytes" % For document root file
9801 % Unfortunately, there seems to be no corresponding XeTeX command for
9802 % output encoding. This is a problem for auxiliary index and TOC files.
9803 % The only solution would be perhaps to write out @U{...} sequences in
9804 % place of non-ASCII characters.
9805 \fi
9806
9807 \ifx\luatexversion\thisisundefined
9808 \else
9809 \directlua{
9810 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
9811 local function convert_char (char)
9812 return utf8_char(byte(char))
9813 end
9814
9815 local function convert_line (line)
9816 return gsub(line, ".", convert_char)
9817 end
9818
9819 callback.register("process_input_buffer", convert_line)
9820
9821 local function convert_line_out (line)
9822 local line_out = ""
9823 for c in string.utfvalues(line) do
9824 line_out = line_out .. string.char(c)
9825 end
9826 return line_out
9827 end
9828
9829 callback.register("process_output_buffer", convert_line_out)
9830 }
9831 \fi
9832
9833 \txiusebytewiseiotrue
9834}
9835
9836
9837% Helpers for encodings.
9838% Set the catcode of characters 128 through 255 to the specified number.
9839%
9840\def\setnonasciicharscatcode#1{%
9841 \count255=128
9842 \loop\ifnum\count255<256
9843 \global\catcode\count255=#1\relax
9844 \advance\count255 by 1
9845 \repeat
9846}
9847
9848\def\setnonasciicharscatcodenonglobal#1{%
9849 \count255=128
9850 \loop\ifnum\count255<256
9851 \catcode\count255=#1\relax
9852 \advance\count255 by 1
9853 \repeat
9854}
9855
9856% @documentencoding sets the definition of non-ASCII characters
9857% according to the specified encoding.
9858%
9859\def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
9860\def\documentencodingzzz#1{%
9861 %
9862 % Encoding being declared for the document.
9863 \def\declaredencoding{\csname #1.enc\endcsname}%
9864 %
9865 % Supported encodings: names converted to tokens in order to be able
9866 % to compare them with \ifx.
9867 \def\ascii{\csname US-ASCII.enc\endcsname}%
9868 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9869 \def\latone{\csname ISO-8859-1.enc\endcsname}%
9870 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9871 \def\utfeight{\csname UTF-8.enc\endcsname}%
9872 %
9873 \ifx \declaredencoding \ascii
9874 \asciichardefs
9875 %
9876 \else \ifx \declaredencoding \lattwo
9877 \iftxinativeunicodecapable
9878 \setbytewiseio
9879 \fi
9880 \setnonasciicharscatcode\active
9881 \lattwochardefs
9882 %
9883 \else \ifx \declaredencoding \latone
9884 \iftxinativeunicodecapable
9885 \setbytewiseio
9886 \fi
9887 \setnonasciicharscatcode\active
9888 \latonechardefs
9889 %
9890 \else \ifx \declaredencoding \latnine
9891 \iftxinativeunicodecapable
9892 \setbytewiseio
9893 \fi
9894 \setnonasciicharscatcode\active
9895 \latninechardefs
9896 %
9897 \else \ifx \declaredencoding \utfeight
9898 \iftxinativeunicodecapable
9899 % For native Unicode handling (XeTeX and LuaTeX)
9900 \nativeunicodechardefs
9901 \else
9902 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
9903 \setnonasciicharscatcode\active
9904 % since we already invoked \utfeightchardefs at the top level
9905 % (below), do not re-invoke it, otherwise our check for duplicated
9906 % definitions gets triggered. Making non-ascii chars active is
9907 % sufficient.
9908 \fi
9909 %
9910 \else
9911 \message{Ignoring unknown document encoding: #1.}%
9912 %
9913 \fi % utfeight
9914 \fi % latnine
9915 \fi % latone
9916 \fi % lattwo
9917 \fi % ascii
9918 %
9919 \ifx\XeTeXrevision\thisisundefined
9920 \else
9921 \ifx \declaredencoding \utfeight
9922 \else
9923 \ifx \declaredencoding \ascii
9924 \else
9925 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
9926 non-ASCII characters in auxiliary files.}%
9927 \fi
9928 \fi
9929 \fi
9930}
9931
9932% emacs-page
9933% A message to be logged when using a character that isn't available
9934% the default font encoding (OT1).
9935%
9936\def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
9937
9938% Take account of \c (plain) vs. \, (Texinfo) difference.
9939\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9940
9941% First, make active non-ASCII characters in order for them to be
9942% correctly categorized when TeX reads the replacement text of
9943% macros containing the character definitions.
9944\setnonasciicharscatcode\active
9945%
9946
9947\def\gdefchar#1#2{%
9948\gdef#1{%
9949 \ifpassthroughchars
9950 \string#1%
9951 \else
9952 #2%
9953 \fi
9954}}
9955
9956% Latin1 (ISO-8859-1) character definitions.
9957\def\latonechardefs{%
9958 \gdefchar^^a0{\tie}
9959 \gdefchar^^a1{\exclamdown}
9960 \gdefchar^^a2{{\tcfont \char162}} % cent
9961 \gdefchar^^a3{\pounds{}}
9962 \gdefchar^^a4{{\tcfont \char164}} % currency
9963 \gdefchar^^a5{{\tcfont \char165}} % yen
9964 \gdefchar^^a6{{\tcfont \char166}} % broken bar
9965 \gdefchar^^a7{\S}
9966 \gdefchar^^a8{\"{}}
9967 \gdefchar^^a9{\copyright{}}
9968 \gdefchar^^aa{\ordf}
9969 \gdefchar^^ab{\guillemetleft{}}
9970 \gdefchar^^ac{\ensuremath\lnot}
9971 \gdefchar^^ad{\-}
9972 \gdefchar^^ae{\registeredsymbol{}}
9973 \gdefchar^^af{\={}}
9974 %
9975 \gdefchar^^b0{\textdegree}
9976 \gdefchar^^b1{$\pm$}
9977 \gdefchar^^b2{$^2$}
9978 \gdefchar^^b3{$^3$}
9979 \gdefchar^^b4{\'{}}
9980 \gdefchar^^b5{$\mu$}
9981 \gdefchar^^b6{\P}
9982 \gdefchar^^b7{\ensuremath\cdot}
9983 \gdefchar^^b8{\cedilla\ }
9984 \gdefchar^^b9{$^1$}
9985 \gdefchar^^ba{\ordm}
9986 \gdefchar^^bb{\guillemetright{}}
9987 \gdefchar^^bc{$1\over4$}
9988 \gdefchar^^bd{$1\over2$}
9989 \gdefchar^^be{$3\over4$}
9990 \gdefchar^^bf{\questiondown}
9991 %
9992 \gdefchar^^c0{\`A}
9993 \gdefchar^^c1{\'A}
9994 \gdefchar^^c2{\^A}
9995 \gdefchar^^c3{\~A}
9996 \gdefchar^^c4{\"A}
9997 \gdefchar^^c5{\ringaccent A}
9998 \gdefchar^^c6{\AE}
9999 \gdefchar^^c7{\cedilla C}
10000 \gdefchar^^c8{\`E}
10001 \gdefchar^^c9{\'E}
10002 \gdefchar^^ca{\^E}
10003 \gdefchar^^cb{\"E}
10004 \gdefchar^^cc{\`I}
10005 \gdefchar^^cd{\'I}
10006 \gdefchar^^ce{\^I}
10007 \gdefchar^^cf{\"I}
10008 %
10009 \gdefchar^^d0{\DH}
10010 \gdefchar^^d1{\~N}
10011 \gdefchar^^d2{\`O}
10012 \gdefchar^^d3{\'O}
10013 \gdefchar^^d4{\^O}
10014 \gdefchar^^d5{\~O}
10015 \gdefchar^^d6{\"O}
10016 \gdefchar^^d7{$\times$}
10017 \gdefchar^^d8{\O}
10018 \gdefchar^^d9{\`U}
10019 \gdefchar^^da{\'U}
10020 \gdefchar^^db{\^U}
10021 \gdefchar^^dc{\"U}
10022 \gdefchar^^dd{\'Y}
10023 \gdefchar^^de{\TH}
10024 \gdefchar^^df{\ss}
10025 %
10026 \gdefchar^^e0{\`a}
10027 \gdefchar^^e1{\'a}
10028 \gdefchar^^e2{\^a}
10029 \gdefchar^^e3{\~a}
10030 \gdefchar^^e4{\"a}
10031 \gdefchar^^e5{\ringaccent a}
10032 \gdefchar^^e6{\ae}
10033 \gdefchar^^e7{\cedilla c}
10034 \gdefchar^^e8{\`e}
10035 \gdefchar^^e9{\'e}
10036 \gdefchar^^ea{\^e}
10037 \gdefchar^^eb{\"e}
10038 \gdefchar^^ec{\`{\dotless i}}
10039 \gdefchar^^ed{\'{\dotless i}}
10040 \gdefchar^^ee{\^{\dotless i}}
10041 \gdefchar^^ef{\"{\dotless i}}
10042 %
10043 \gdefchar^^f0{\dh}
10044 \gdefchar^^f1{\~n}
10045 \gdefchar^^f2{\`o}
10046 \gdefchar^^f3{\'o}
10047 \gdefchar^^f4{\^o}
10048 \gdefchar^^f5{\~o}
10049 \gdefchar^^f6{\"o}
10050 \gdefchar^^f7{$\div$}
10051 \gdefchar^^f8{\o}
10052 \gdefchar^^f9{\`u}
10053 \gdefchar^^fa{\'u}
10054 \gdefchar^^fb{\^u}
10055 \gdefchar^^fc{\"u}
10056 \gdefchar^^fd{\'y}
10057 \gdefchar^^fe{\th}
10058 \gdefchar^^ff{\"y}
10059}
10060
10061% Latin9 (ISO-8859-15) encoding character definitions.
10062\def\latninechardefs{%
10063 % Encoding is almost identical to Latin1.
10064 \latonechardefs
10065 %
10066 \gdefchar^^a4{\euro{}}
10067 \gdefchar^^a6{\v S}
10068 \gdefchar^^a8{\v s}
10069 \gdefchar^^b4{\v Z}
10070 \gdefchar^^b8{\v z}
10071 \gdefchar^^bc{\OE}
10072 \gdefchar^^bd{\oe}
10073 \gdefchar^^be{\"Y}
10074}
10075
10076% Latin2 (ISO-8859-2) character definitions.
10077\def\lattwochardefs{%
10078 \gdefchar^^a0{\tie}
10079 \gdefchar^^a1{\ogonek{A}}
10080 \gdefchar^^a2{\u{}}
10081 \gdefchar^^a3{\L}
10082 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
10083 \gdefchar^^a5{\v L}
10084 \gdefchar^^a6{\'S}
10085 \gdefchar^^a7{\S}
10086 \gdefchar^^a8{\"{}}
10087 \gdefchar^^a9{\v S}
10088 \gdefchar^^aa{\cedilla S}
10089 \gdefchar^^ab{\v T}
10090 \gdefchar^^ac{\'Z}
10091 \gdefchar^^ad{\-}
10092 \gdefchar^^ae{\v Z}
10093 \gdefchar^^af{\dotaccent Z}
10094 %
10095 \gdefchar^^b0{\textdegree{}}
10096 \gdefchar^^b1{\ogonek{a}}
10097 \gdefchar^^b2{\ogonek{ }}
10098 \gdefchar^^b3{\l}
10099 \gdefchar^^b4{\'{}}
10100 \gdefchar^^b5{\v l}
10101 \gdefchar^^b6{\'s}
10102 \gdefchar^^b7{\v{}}
10103 \gdefchar^^b8{\cedilla\ }
10104 \gdefchar^^b9{\v s}
10105 \gdefchar^^ba{\cedilla s}
10106 \gdefchar^^bb{\v t}
10107 \gdefchar^^bc{\'z}
10108 \gdefchar^^bd{\H{}}
10109 \gdefchar^^be{\v z}
10110 \gdefchar^^bf{\dotaccent z}
10111 %
10112 \gdefchar^^c0{\'R}
10113 \gdefchar^^c1{\'A}
10114 \gdefchar^^c2{\^A}
10115 \gdefchar^^c3{\u A}
10116 \gdefchar^^c4{\"A}
10117 \gdefchar^^c5{\'L}
10118 \gdefchar^^c6{\'C}
10119 \gdefchar^^c7{\cedilla C}
10120 \gdefchar^^c8{\v C}
10121 \gdefchar^^c9{\'E}
10122 \gdefchar^^ca{\ogonek{E}}
10123 \gdefchar^^cb{\"E}
10124 \gdefchar^^cc{\v E}
10125 \gdefchar^^cd{\'I}
10126 \gdefchar^^ce{\^I}
10127 \gdefchar^^cf{\v D}
10128 %
10129 \gdefchar^^d0{\DH}
10130 \gdefchar^^d1{\'N}
10131 \gdefchar^^d2{\v N}
10132 \gdefchar^^d3{\'O}
10133 \gdefchar^^d4{\^O}
10134 \gdefchar^^d5{\H O}
10135 \gdefchar^^d6{\"O}
10136 \gdefchar^^d7{$\times$}
10137 \gdefchar^^d8{\v R}
10138 \gdefchar^^d9{\ringaccent U}
10139 \gdefchar^^da{\'U}
10140 \gdefchar^^db{\H U}
10141 \gdefchar^^dc{\"U}
10142 \gdefchar^^dd{\'Y}
10143 \gdefchar^^de{\cedilla T}
10144 \gdefchar^^df{\ss}
10145 %
10146 \gdefchar^^e0{\'r}
10147 \gdefchar^^e1{\'a}
10148 \gdefchar^^e2{\^a}
10149 \gdefchar^^e3{\u a}
10150 \gdefchar^^e4{\"a}
10151 \gdefchar^^e5{\'l}
10152 \gdefchar^^e6{\'c}
10153 \gdefchar^^e7{\cedilla c}
10154 \gdefchar^^e8{\v c}
10155 \gdefchar^^e9{\'e}
10156 \gdefchar^^ea{\ogonek{e}}
10157 \gdefchar^^eb{\"e}
10158 \gdefchar^^ec{\v e}
10159 \gdefchar^^ed{\'{\dotless{i}}}
10160 \gdefchar^^ee{\^{\dotless{i}}}
10161 \gdefchar^^ef{\v d}
10162 %
10163 \gdefchar^^f0{\dh}
10164 \gdefchar^^f1{\'n}
10165 \gdefchar^^f2{\v n}
10166 \gdefchar^^f3{\'o}
10167 \gdefchar^^f4{\^o}
10168 \gdefchar^^f5{\H o}
10169 \gdefchar^^f6{\"o}
10170 \gdefchar^^f7{$\div$}
10171 \gdefchar^^f8{\v r}
10172 \gdefchar^^f9{\ringaccent u}
10173 \gdefchar^^fa{\'u}
10174 \gdefchar^^fb{\H u}
10175 \gdefchar^^fc{\"u}
10176 \gdefchar^^fd{\'y}
10177 \gdefchar^^fe{\cedilla t}
10178 \gdefchar^^ff{\dotaccent{}}
10179}
10180
10181% UTF-8 character definitions.
10182%
10183% This code to support UTF-8 is based on LaTeX's utf8.def, with some
10184% changes for Texinfo conventions. It is included here under the GPL by
10185% permission from Frank Mittelbach and the LaTeX team.
10186%
10187\newcount\countUTFx
10188\newcount\countUTFy
10189\newcount\countUTFz
10190
10191\gdef\UTFviiiTwoOctets#1#2{\expandafter
10192 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
10193%
10194\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
10195 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
10196%
10197\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
10198 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
10199
10200\gdef\UTFviiiDefined#1{%
10201 \ifx #1\relax
10202 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
10203 \else
10204 \expandafter #1%
10205 \fi
10206}
10207
10208% Give non-ASCII bytes the active definitions for processing UTF-8 sequences
10209\begingroup
10210 \catcode`\~13
10211 \catcode`\$12
10212 \catcode`\"12
10213
10214 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
10215 % substituting ~ and $ with a character token of that value.
10216 \def\UTFviiiLoop{%
10217 \global\catcode\countUTFx\active
10218 \uccode`\~\countUTFx
10219 \uccode`\$\countUTFx
10220 \uppercase\expandafter{\UTFviiiTmp}%
10221 \advance\countUTFx by 1
10222 \ifnum\countUTFx < \countUTFy
10223 \expandafter\UTFviiiLoop
10224 \fi}
10225
10226 % For bytes other than the first in a UTF-8 sequence. Not expected to
10227 % be expanded except when writing to auxiliary files.
10228 \countUTFx = "80
10229 \countUTFy = "C2
10230 \def\UTFviiiTmp{%
10231 \gdef~{%
10232 \ifpassthroughchars $\fi}}%
10233 \UTFviiiLoop
10234
10235 \countUTFx = "C2
10236 \countUTFy = "E0
10237 \def\UTFviiiTmp{%
10238 \gdef~{%
10239 \ifpassthroughchars $%
10240 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
10241 \UTFviiiLoop
10242
10243 \countUTFx = "E0
10244 \countUTFy = "F0
10245 \def\UTFviiiTmp{%
10246 \gdef~{%
10247 \ifpassthroughchars $%
10248 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
10249 \UTFviiiLoop
10250
10251 \countUTFx = "F0
10252 \countUTFy = "F4
10253 \def\UTFviiiTmp{%
10254 \gdef~{%
10255 \ifpassthroughchars $%
10256 \else\expandafter\UTFviiiFourOctets\expandafter$\fi
10257 }}%
10258 \UTFviiiLoop
10259\endgroup
10260
10261\def\globallet{\global\let} % save some \expandafter's below
10262
10263% @U{xxxx} to produce U+xxxx, if we support it.
10264\def\U#1{%
10265 \expandafter\ifx\csname uni:#1\endcsname \relax
10266 \iftxinativeunicodecapable
10267 % All Unicode characters can be used if native Unicode handling is
10268 % active. However, if the font does not have the glyph,
10269 % letters are missing.
10270 \begingroup
10271 \uccode`\.="#1\relax
10272 \uppercase{.}
10273 \endgroup
10274 \else
10275 \errhelp = \EMsimple
10276 \errmessage{Unicode character U+#1 not supported, sorry}%
10277 \fi
10278 \else
10279 \csname uni:#1\endcsname
10280 \fi
10281}
10282
10283% These macros are used here to construct the name of a control
10284% sequence to be defined.
10285\def\UTFviiiTwoOctetsName#1#2{%
10286 \csname u8:#1\string #2\endcsname}%
10287\def\UTFviiiThreeOctetsName#1#2#3{%
10288 \csname u8:#1\string #2\string #3\endcsname}%
10289\def\UTFviiiFourOctetsName#1#2#3#4{%
10290 \csname u8:#1\string #2\string #3\string #4\endcsname}%
10291
10292% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
10293% provide a definition macro to replace a Unicode character;
10294% this gets used by the @U command
10295%
10296\begingroup
10297 \catcode`\"=12
10298 \catcode`\<=12
10299 \catcode`\.=12
10300 \catcode`\,=12
10301 \catcode`\;=12
10302 \catcode`\!=12
10303 \catcode`\~=13
10304 \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
10305 \countUTFz = "#1\relax
10306 \begingroup
10307 \parseXMLCharref
10308
10309 % Give \u8:... its definition. The sequence of seven \expandafter's
10310 % expands after the \gdef three times, e.g.
10311 %
10312 % 1. \UTFviiTwoOctetsName B1 B2
10313 % 2. \csname u8:B1 \string B2 \endcsname
10314 % 3. \u8: B1 B2 (a single control sequence token)
10315 %
10316 \expandafter\expandafter
10317 \expandafter\expandafter
10318 \expandafter\expandafter
10319 \expandafter\gdef \UTFviiiTmp{#2}%
10320 %
10321 \expandafter\ifx\csname uni:#1\endcsname \relax \else
10322 \message{Internal error, already defined: #1}%
10323 \fi
10324 %
10325 % define an additional control sequence for this code point.
10326 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
10327 \endgroup}
10328 %
10329 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
10330 % to the corresponding UTF-8 sequence.
10331 \gdef\parseXMLCharref{%
10332 \ifnum\countUTFz < "A0\relax
10333 \errhelp = \EMsimple
10334 \errmessage{Cannot define Unicode char value < 00A0}%
10335 \else\ifnum\countUTFz < "800\relax
10336 \parseUTFviiiA,%
10337 \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
10338 \else\ifnum\countUTFz < "10000\relax
10339 \parseUTFviiiA;%
10340 \parseUTFviiiA,%
10341 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
10342 \else
10343 \parseUTFviiiA;%
10344 \parseUTFviiiA,%
10345 \parseUTFviiiA!%
10346 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
10347 \fi\fi\fi
10348 }
10349
10350 % Extract a byte from the end of the UTF-8 representation of \countUTFx.
10351 % It must be a non-initial byte in the sequence.
10352 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
10353 % of the bytes.
10354 \gdef\parseUTFviiiA#1{%
10355 \countUTFx = \countUTFz
10356 \divide\countUTFz by 64
10357 \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
10358 \multiply\countUTFz by 64
10359
10360 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
10361 % in order to get the last five bits.
10362 \advance\countUTFx by -\countUTFz
10363
10364 % Convert this to the byte in the UTF-8 sequence.
10365 \advance\countUTFx by 128
10366 \uccode `#1\countUTFx
10367 \countUTFz = \countUTFy}
10368
10369 % Used to put a UTF-8 byte sequence into \UTFviiiTmp
10370 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
10371 % sequence.
10372 % #2 is one of the \UTFviii*OctetsName macros.
10373 % #3 is always a full stop (.)
10374 % #4 is a template for the other bytes in the sequence. The values for these
10375 % bytes is substituted in here with \uppercase using the \uccode's.
10376 \gdef\parseUTFviiiB#1#2#3#4{%
10377 \advance\countUTFz by "#10\relax
10378 \uccode `#3\countUTFz
10379 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
10380\endgroup
10381
10382% For native Unicode handling (XeTeX and LuaTeX),
10383% provide a definition macro that sets a catcode to `other' non-globally
10384%
10385\def\DeclareUnicodeCharacterNativeOther#1#2{%
10386 \catcode"#1=\other
10387}
10388
10389% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
10390% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
10391% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
10392% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
10393% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
10394%
10395% Many of our renditions are less than wonderful, and all the missing
10396% characters are available somewhere. Loading the necessary fonts
10397% awaits user request. We can't truly support Unicode without
10398% reimplementing everything that's been done in LaTeX for many years,
10399% plus probably using luatex or xetex, and who knows what else.
10400% We won't be doing that here in this simple file. But we can try to at
10401% least make most of the characters not bomb out.
10402%
10403\def\unicodechardefs{%
10404 \DeclareUnicodeCharacter{00A0}{\tie}%
10405 \DeclareUnicodeCharacter{00A1}{\exclamdown}%
10406 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
10407 \DeclareUnicodeCharacter{00A3}{\pounds{}}%
10408 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
10409 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
10410 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
10411 \DeclareUnicodeCharacter{00A7}{\S}%
10412 \DeclareUnicodeCharacter{00A8}{\"{ }}%
10413 \DeclareUnicodeCharacter{00A9}{\copyright{}}%
10414 \DeclareUnicodeCharacter{00AA}{\ordf}%
10415 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
10416 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
10417 \DeclareUnicodeCharacter{00AD}{\-}%
10418 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
10419 \DeclareUnicodeCharacter{00AF}{\={ }}%
10420 %
10421 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
10422 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
10423 \DeclareUnicodeCharacter{00B2}{$^2$}%
10424 \DeclareUnicodeCharacter{00B3}{$^3$}%
10425 \DeclareUnicodeCharacter{00B4}{\'{ }}%
10426 \DeclareUnicodeCharacter{00B5}{$\mu$}%
10427 \DeclareUnicodeCharacter{00B6}{\P}%
10428 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
10429 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
10430 \DeclareUnicodeCharacter{00B9}{$^1$}%
10431 \DeclareUnicodeCharacter{00BA}{\ordm}%
10432 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
10433 \DeclareUnicodeCharacter{00BC}{$1\over4$}%
10434 \DeclareUnicodeCharacter{00BD}{$1\over2$}%
10435 \DeclareUnicodeCharacter{00BE}{$3\over4$}%
10436 \DeclareUnicodeCharacter{00BF}{\questiondown}%
10437 %
10438 \DeclareUnicodeCharacter{00C0}{\`A}%
10439 \DeclareUnicodeCharacter{00C1}{\'A}%
10440 \DeclareUnicodeCharacter{00C2}{\^A}%
10441 \DeclareUnicodeCharacter{00C3}{\~A}%
10442 \DeclareUnicodeCharacter{00C4}{\"A}%
10443 \DeclareUnicodeCharacter{00C5}{\AA}%
10444 \DeclareUnicodeCharacter{00C6}{\AE}%
10445 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
10446 \DeclareUnicodeCharacter{00C8}{\`E}%
10447 \DeclareUnicodeCharacter{00C9}{\'E}%
10448 \DeclareUnicodeCharacter{00CA}{\^E}%
10449 \DeclareUnicodeCharacter{00CB}{\"E}%
10450 \DeclareUnicodeCharacter{00CC}{\`I}%
10451 \DeclareUnicodeCharacter{00CD}{\'I}%
10452 \DeclareUnicodeCharacter{00CE}{\^I}%
10453 \DeclareUnicodeCharacter{00CF}{\"I}%
10454 %
10455 \DeclareUnicodeCharacter{00D0}{\DH}%
10456 \DeclareUnicodeCharacter{00D1}{\~N}%
10457 \DeclareUnicodeCharacter{00D2}{\`O}%
10458 \DeclareUnicodeCharacter{00D3}{\'O}%
10459 \DeclareUnicodeCharacter{00D4}{\^O}%
10460 \DeclareUnicodeCharacter{00D5}{\~O}%
10461 \DeclareUnicodeCharacter{00D6}{\"O}%
10462 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
10463 \DeclareUnicodeCharacter{00D8}{\O}%
10464 \DeclareUnicodeCharacter{00D9}{\`U}%
10465 \DeclareUnicodeCharacter{00DA}{\'U}%
10466 \DeclareUnicodeCharacter{00DB}{\^U}%
10467 \DeclareUnicodeCharacter{00DC}{\"U}%
10468 \DeclareUnicodeCharacter{00DD}{\'Y}%
10469 \DeclareUnicodeCharacter{00DE}{\TH}%
10470 \DeclareUnicodeCharacter{00DF}{\ss}%
10471 %
10472 \DeclareUnicodeCharacter{00E0}{\`a}%
10473 \DeclareUnicodeCharacter{00E1}{\'a}%
10474 \DeclareUnicodeCharacter{00E2}{\^a}%
10475 \DeclareUnicodeCharacter{00E3}{\~a}%
10476 \DeclareUnicodeCharacter{00E4}{\"a}%
10477 \DeclareUnicodeCharacter{00E5}{\aa}%
10478 \DeclareUnicodeCharacter{00E6}{\ae}%
10479 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
10480 \DeclareUnicodeCharacter{00E8}{\`e}%
10481 \DeclareUnicodeCharacter{00E9}{\'e}%
10482 \DeclareUnicodeCharacter{00EA}{\^e}%
10483 \DeclareUnicodeCharacter{00EB}{\"e}%
10484 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
10485 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
10486 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
10487 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
10488 %
10489 \DeclareUnicodeCharacter{00F0}{\dh}%
10490 \DeclareUnicodeCharacter{00F1}{\~n}%
10491 \DeclareUnicodeCharacter{00F2}{\`o}%
10492 \DeclareUnicodeCharacter{00F3}{\'o}%
10493 \DeclareUnicodeCharacter{00F4}{\^o}%
10494 \DeclareUnicodeCharacter{00F5}{\~o}%
10495 \DeclareUnicodeCharacter{00F6}{\"o}%
10496 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
10497 \DeclareUnicodeCharacter{00F8}{\o}%
10498 \DeclareUnicodeCharacter{00F9}{\`u}%
10499 \DeclareUnicodeCharacter{00FA}{\'u}%
10500 \DeclareUnicodeCharacter{00FB}{\^u}%
10501 \DeclareUnicodeCharacter{00FC}{\"u}%
10502 \DeclareUnicodeCharacter{00FD}{\'y}%
10503 \DeclareUnicodeCharacter{00FE}{\th}%
10504 \DeclareUnicodeCharacter{00FF}{\"y}%
10505 %
10506 \DeclareUnicodeCharacter{0100}{\=A}%
10507 \DeclareUnicodeCharacter{0101}{\=a}%
10508 \DeclareUnicodeCharacter{0102}{\u{A}}%
10509 \DeclareUnicodeCharacter{0103}{\u{a}}%
10510 \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
10511 \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
10512 \DeclareUnicodeCharacter{0106}{\'C}%
10513 \DeclareUnicodeCharacter{0107}{\'c}%
10514 \DeclareUnicodeCharacter{0108}{\^C}%
10515 \DeclareUnicodeCharacter{0109}{\^c}%
10516 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
10517 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
10518 \DeclareUnicodeCharacter{010C}{\v{C}}%
10519 \DeclareUnicodeCharacter{010D}{\v{c}}%
10520 \DeclareUnicodeCharacter{010E}{\v{D}}%
10521 \DeclareUnicodeCharacter{010F}{d'}%
10522 %
10523 \DeclareUnicodeCharacter{0110}{\DH}%
10524 \DeclareUnicodeCharacter{0111}{\dh}%
10525 \DeclareUnicodeCharacter{0112}{\=E}%
10526 \DeclareUnicodeCharacter{0113}{\=e}%
10527 \DeclareUnicodeCharacter{0114}{\u{E}}%
10528 \DeclareUnicodeCharacter{0115}{\u{e}}%
10529 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
10530 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
10531 \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
10532 \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
10533 \DeclareUnicodeCharacter{011A}{\v{E}}%
10534 \DeclareUnicodeCharacter{011B}{\v{e}}%
10535 \DeclareUnicodeCharacter{011C}{\^G}%
10536 \DeclareUnicodeCharacter{011D}{\^g}%
10537 \DeclareUnicodeCharacter{011E}{\u{G}}%
10538 \DeclareUnicodeCharacter{011F}{\u{g}}%
10539 %
10540 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
10541 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
10542 \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
10543 \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
10544 \DeclareUnicodeCharacter{0124}{\^H}%
10545 \DeclareUnicodeCharacter{0125}{\^h}%
10546 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
10547 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
10548 \DeclareUnicodeCharacter{0128}{\~I}%
10549 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
10550 \DeclareUnicodeCharacter{012A}{\=I}%
10551 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
10552 \DeclareUnicodeCharacter{012C}{\u{I}}%
10553 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
10554 \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
10555 \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
10556 %
10557 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
10558 \DeclareUnicodeCharacter{0131}{\dotless{i}}%
10559 \DeclareUnicodeCharacter{0132}{IJ}%
10560 \DeclareUnicodeCharacter{0133}{ij}%
10561 \DeclareUnicodeCharacter{0134}{\^J}%
10562 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
10563 \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
10564 \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
10565 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
10566 \DeclareUnicodeCharacter{0139}{\'L}%
10567 \DeclareUnicodeCharacter{013A}{\'l}%
10568 \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
10569 \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
10570 \DeclareUnicodeCharacter{013D}{L'}% should kern
10571 \DeclareUnicodeCharacter{013E}{l'}% should kern
10572 \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
10573 %
10574 \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
10575 \DeclareUnicodeCharacter{0141}{\L}%
10576 \DeclareUnicodeCharacter{0142}{\l}%
10577 \DeclareUnicodeCharacter{0143}{\'N}%
10578 \DeclareUnicodeCharacter{0144}{\'n}%
10579 \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
10580 \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
10581 \DeclareUnicodeCharacter{0147}{\v{N}}%
10582 \DeclareUnicodeCharacter{0148}{\v{n}}%
10583 \DeclareUnicodeCharacter{0149}{'n}%
10584 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
10585 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
10586 \DeclareUnicodeCharacter{014C}{\=O}%
10587 \DeclareUnicodeCharacter{014D}{\=o}%
10588 \DeclareUnicodeCharacter{014E}{\u{O}}%
10589 \DeclareUnicodeCharacter{014F}{\u{o}}%
10590 %
10591 \DeclareUnicodeCharacter{0150}{\H{O}}%
10592 \DeclareUnicodeCharacter{0151}{\H{o}}%
10593 \DeclareUnicodeCharacter{0152}{\OE}%
10594 \DeclareUnicodeCharacter{0153}{\oe}%
10595 \DeclareUnicodeCharacter{0154}{\'R}%
10596 \DeclareUnicodeCharacter{0155}{\'r}%
10597 \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
10598 \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
10599 \DeclareUnicodeCharacter{0158}{\v{R}}%
10600 \DeclareUnicodeCharacter{0159}{\v{r}}%
10601 \DeclareUnicodeCharacter{015A}{\'S}%
10602 \DeclareUnicodeCharacter{015B}{\'s}%
10603 \DeclareUnicodeCharacter{015C}{\^S}%
10604 \DeclareUnicodeCharacter{015D}{\^s}%
10605 \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
10606 \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
10607 %
10608 \DeclareUnicodeCharacter{0160}{\v{S}}%
10609 \DeclareUnicodeCharacter{0161}{\v{s}}%
10610 \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
10611 \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
10612 \DeclareUnicodeCharacter{0164}{\v{T}}%
10613 \DeclareUnicodeCharacter{0165}{\v{t}}%
10614 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
10615 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
10616 \DeclareUnicodeCharacter{0168}{\~U}%
10617 \DeclareUnicodeCharacter{0169}{\~u}%
10618 \DeclareUnicodeCharacter{016A}{\=U}%
10619 \DeclareUnicodeCharacter{016B}{\=u}%
10620 \DeclareUnicodeCharacter{016C}{\u{U}}%
10621 \DeclareUnicodeCharacter{016D}{\u{u}}%
10622 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
10623 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
10624 %
10625 \DeclareUnicodeCharacter{0170}{\H{U}}%
10626 \DeclareUnicodeCharacter{0171}{\H{u}}%
10627 \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
10628 \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
10629 \DeclareUnicodeCharacter{0174}{\^W}%
10630 \DeclareUnicodeCharacter{0175}{\^w}%
10631 \DeclareUnicodeCharacter{0176}{\^Y}%
10632 \DeclareUnicodeCharacter{0177}{\^y}%
10633 \DeclareUnicodeCharacter{0178}{\"Y}%
10634 \DeclareUnicodeCharacter{0179}{\'Z}%
10635 \DeclareUnicodeCharacter{017A}{\'z}%
10636 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
10637 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
10638 \DeclareUnicodeCharacter{017D}{\v{Z}}%
10639 \DeclareUnicodeCharacter{017E}{\v{z}}%
10640 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
10641 %
10642 \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
10643 \DeclareUnicodeCharacter{01C5}{D\v{z}}%
10644 \DeclareUnicodeCharacter{01C6}{d\v{z}}%
10645 \DeclareUnicodeCharacter{01C7}{LJ}%
10646 \DeclareUnicodeCharacter{01C8}{Lj}%
10647 \DeclareUnicodeCharacter{01C9}{lj}%
10648 \DeclareUnicodeCharacter{01CA}{NJ}%
10649 \DeclareUnicodeCharacter{01CB}{Nj}%
10650 \DeclareUnicodeCharacter{01CC}{nj}%
10651 \DeclareUnicodeCharacter{01CD}{\v{A}}%
10652 \DeclareUnicodeCharacter{01CE}{\v{a}}%
10653 \DeclareUnicodeCharacter{01CF}{\v{I}}%
10654 %
10655 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
10656 \DeclareUnicodeCharacter{01D1}{\v{O}}%
10657 \DeclareUnicodeCharacter{01D2}{\v{o}}%
10658 \DeclareUnicodeCharacter{01D3}{\v{U}}%
10659 \DeclareUnicodeCharacter{01D4}{\v{u}}%
10660 %
10661 \DeclareUnicodeCharacter{01E2}{\={\AE}}%
10662 \DeclareUnicodeCharacter{01E3}{\={\ae}}%
10663 \DeclareUnicodeCharacter{01E6}{\v{G}}%
10664 \DeclareUnicodeCharacter{01E7}{\v{g}}%
10665 \DeclareUnicodeCharacter{01E8}{\v{K}}%
10666 \DeclareUnicodeCharacter{01E9}{\v{k}}%
10667 %
10668 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
10669 \DeclareUnicodeCharacter{01F1}{DZ}%
10670 \DeclareUnicodeCharacter{01F2}{Dz}%
10671 \DeclareUnicodeCharacter{01F3}{dz}%
10672 \DeclareUnicodeCharacter{01F4}{\'G}%
10673 \DeclareUnicodeCharacter{01F5}{\'g}%
10674 \DeclareUnicodeCharacter{01F8}{\`N}%
10675 \DeclareUnicodeCharacter{01F9}{\`n}%
10676 \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
10677 \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
10678 \DeclareUnicodeCharacter{01FE}{\'{\O}}%
10679 \DeclareUnicodeCharacter{01FF}{\'{\o}}%
10680 %
10681 \DeclareUnicodeCharacter{021E}{\v{H}}%
10682 \DeclareUnicodeCharacter{021F}{\v{h}}%
10683 %
10684 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
10685 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
10686 \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
10687 \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
10688 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
10689 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
10690 %
10691 \DeclareUnicodeCharacter{0232}{\=Y}%
10692 \DeclareUnicodeCharacter{0233}{\=y}%
10693 \DeclareUnicodeCharacter{0237}{\dotless{j}}%
10694 %
10695 \DeclareUnicodeCharacter{02BC}{'}%
10696 %
10697 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
10698 %
10699 % Greek letters upper case
10700 \DeclareUnicodeCharacter{0391}{{\it A}}%
10701 \DeclareUnicodeCharacter{0392}{{\it B}}%
10702 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
10703 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
10704 \DeclareUnicodeCharacter{0395}{{\it E}}%
10705 \DeclareUnicodeCharacter{0396}{{\it Z}}%
10706 \DeclareUnicodeCharacter{0397}{{\it H}}%
10707 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
10708 \DeclareUnicodeCharacter{0399}{{\it I}}%
10709 \DeclareUnicodeCharacter{039A}{{\it K}}%
10710 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
10711 \DeclareUnicodeCharacter{039C}{{\it M}}%
10712 \DeclareUnicodeCharacter{039D}{{\it N}}%
10713 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
10714 \DeclareUnicodeCharacter{039F}{{\it O}}%
10715 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
10716 \DeclareUnicodeCharacter{03A1}{{\it P}}%
10717 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
10718 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
10719 \DeclareUnicodeCharacter{03A4}{{\it T}}%
10720 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
10721 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
10722 \DeclareUnicodeCharacter{03A7}{{\it X}}%
10723 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
10724 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
10725 %
10726 % Vowels with accents
10727 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
10728 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
10729 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
10730 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
10731 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
10732 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
10733 %
10734 % Standalone accent
10735 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
10736 %
10737 % Greek letters lower case
10738 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
10739 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
10740 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
10741 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
10742 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
10743 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
10744 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
10745 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
10746 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
10747 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
10748 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
10749 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
10750 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
10751 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
10752 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
10753 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
10754 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
10755 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
10756 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
10757 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
10758 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
10759 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
10760 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
10761 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
10762 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
10763 %
10764 % More Greek vowels with accents
10765 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
10766 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
10767 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
10768 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
10769 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
10770 %
10771 % Variant Greek letters
10772 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
10773 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
10774 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
10775 %
10776 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
10777 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
10778 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
10779 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
10780 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
10781 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
10782 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
10783 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
10784 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
10785 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
10786 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
10787 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
10788 %
10789 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
10790 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
10791 %
10792 \DeclareUnicodeCharacter{1E20}{\=G}%
10793 \DeclareUnicodeCharacter{1E21}{\=g}%
10794 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
10795 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
10796 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
10797 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
10798 \DeclareUnicodeCharacter{1E26}{\"H}%
10799 \DeclareUnicodeCharacter{1E27}{\"h}%
10800 %
10801 \DeclareUnicodeCharacter{1E30}{\'K}%
10802 \DeclareUnicodeCharacter{1E31}{\'k}%
10803 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
10804 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
10805 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
10806 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
10807 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
10808 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
10809 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
10810 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
10811 \DeclareUnicodeCharacter{1E3E}{\'M}%
10812 \DeclareUnicodeCharacter{1E3F}{\'m}%
10813 %
10814 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
10815 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
10816 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
10817 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
10818 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
10819 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
10820 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
10821 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
10822 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
10823 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
10824 %
10825 \DeclareUnicodeCharacter{1E54}{\'P}%
10826 \DeclareUnicodeCharacter{1E55}{\'p}%
10827 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
10828 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
10829 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
10830 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
10831 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
10832 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
10833 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
10834 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
10835 %
10836 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
10837 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
10838 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
10839 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
10840 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
10841 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
10842 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
10843 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
10844 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
10845 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
10846 %
10847 \DeclareUnicodeCharacter{1E7C}{\~V}%
10848 \DeclareUnicodeCharacter{1E7D}{\~v}%
10849 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
10850 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
10851 %
10852 \DeclareUnicodeCharacter{1E80}{\`W}%
10853 \DeclareUnicodeCharacter{1E81}{\`w}%
10854 \DeclareUnicodeCharacter{1E82}{\'W}%
10855 \DeclareUnicodeCharacter{1E83}{\'w}%
10856 \DeclareUnicodeCharacter{1E84}{\"W}%
10857 \DeclareUnicodeCharacter{1E85}{\"w}%
10858 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
10859 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
10860 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
10861 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
10862 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
10863 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
10864 \DeclareUnicodeCharacter{1E8C}{\"X}%
10865 \DeclareUnicodeCharacter{1E8D}{\"x}%
10866 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
10867 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
10868 %
10869 \DeclareUnicodeCharacter{1E90}{\^Z}%
10870 \DeclareUnicodeCharacter{1E91}{\^z}%
10871 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
10872 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
10873 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
10874 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
10875 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
10876 \DeclareUnicodeCharacter{1E97}{\"t}%
10877 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
10878 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
10879 %
10880 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
10881 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
10882 %
10883 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
10884 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
10885 \DeclareUnicodeCharacter{1EBC}{\~E}%
10886 \DeclareUnicodeCharacter{1EBD}{\~e}%
10887 %
10888 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
10889 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
10890 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
10891 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
10892 %
10893 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
10894 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
10895 %
10896 \DeclareUnicodeCharacter{1EF2}{\`Y}%
10897 \DeclareUnicodeCharacter{1EF3}{\`y}%
10898 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
10899 %
10900 \DeclareUnicodeCharacter{1EF8}{\~Y}%
10901 \DeclareUnicodeCharacter{1EF9}{\~y}%
10902 %
10903 % Punctuation
10904 \DeclareUnicodeCharacter{2013}{--}%
10905 \DeclareUnicodeCharacter{2014}{---}%
10906 \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
10907 \DeclareUnicodeCharacter{2019}{\quoteright{}}%
10908 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
10909 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
10910 \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
10911 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
10912 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
10913 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
10914 \DeclareUnicodeCharacter{2022}{\bullet{}}%
10915 \DeclareUnicodeCharacter{202F}{\thinspace}%
10916 \DeclareUnicodeCharacter{2026}{\dots{}}%
10917 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
10918 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
10919 %
10920 \DeclareUnicodeCharacter{20AC}{\euro{}}%
10921 %
10922 \DeclareUnicodeCharacter{2192}{\expansion{}}%
10923 \DeclareUnicodeCharacter{21D2}{\result{}}%
10924 %
10925 % Mathematical symbols
10926 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
10927 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
10928 \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
10929 \DeclareUnicodeCharacter{2212}{\minus{}}%
10930 \DeclareUnicodeCharacter{2217}{\ast}%
10931 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
10932 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
10933 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
10934 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
10935 \DeclareUnicodeCharacter{2261}{\equiv{}}%
10936 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
10937 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
10938 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
10939 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
10940 %
10941 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
10942 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
10943 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
10944 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
10945 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
10946 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
10947 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
10948 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
10949 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
10950 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
10951 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
10952 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
10953 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
10954 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
10955 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
10956 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
10957 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
10958 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
10959 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
10960 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
10961 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
10962 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
10963 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
10964 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
10965 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
10966 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
10967 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
10968 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
10969 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
10970 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
10971 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
10972 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
10973 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
10974 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
10975 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
10976 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
10977 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
10978 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
10979 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
10980 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
10981 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
10982 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
10983 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
10984 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
10985 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
10986 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
10987 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
10988 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
10989 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
10990 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
10991 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
10992 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
10993 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
10994 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
10995 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
10996 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
10997 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
10998 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
10999 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
11000 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
11001 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
11002 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
11003 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
11004 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
11005 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
11006 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
11007 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
11008 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
11009 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
11010 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
11011 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
11012 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
11013 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
11014 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
11015 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
11016 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
11017 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
11018 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
11019 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
11020 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
11021 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
11022 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
11023 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
11024 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
11025 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
11026 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
11027 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
11028 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
11029 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
11030 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
11031 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
11032 %
11033 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
11034 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
11035 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
11036 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
11037 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
11038 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
11039 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
11040 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
11041 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
11042 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
11043 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
11044 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
11045 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
11046 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
11047 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
11048 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
11049 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
11050 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
11051 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
11052 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
11053 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
11054 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
11055 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
11056 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
11057 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
11058 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
11059 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
11060 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
11061 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
11062 %
11063 \global\mathchardef\checkmark="1370% actually the square root sign
11064 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
11065}% end of \unicodechardefs
11066
11067% UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
11068% It makes the setting that replace UTF-8 byte sequence.
11069\def\utfeightchardefs{%
11070 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
11071 \unicodechardefs
11072}
11073
11074% Whether the active definitions of non-ASCII characters expand to
11075% non-active tokens with the same character code. This is used to
11076% write characters literally, instead of using active definitions for
11077% printing the correct glyphs.
11078\newif\ifpassthroughchars
11079\passthroughcharsfalse
11080
11081% For native Unicode handling (XeTeX and LuaTeX),
11082% provide a definition macro to replace/pass-through a Unicode character
11083%
11084\def\DeclareUnicodeCharacterNative#1#2{%
11085 \catcode"#1=\active
11086 \def\dodeclareunicodecharacternative##1##2##3{%
11087 \begingroup
11088 \uccode`\~="##2\relax
11089 \uppercase{\gdef~}{%
11090 \ifpassthroughchars
11091 ##1%
11092 \else
11093 ##3%
11094 \fi
11095 }
11096 \endgroup
11097 }
11098 \begingroup
11099 \uccode`\.="#1\relax
11100 \uppercase{\def\UTFNativeTmp{.}}%
11101 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
11102 \endgroup
11103}
11104
11105% Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
11106% It activates the setting that replaces Unicode characters.
11107\def\nativeunicodechardefs{%
11108 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
11109 \unicodechardefs
11110}
11111
11112% For native Unicode handling (XeTeX and LuaTeX),
11113% make the character token expand
11114% to the sequences given in \unicodechardefs for printing.
11115\def\DeclareUnicodeCharacterNativeAtU#1#2{%
11116 \def\UTFAtUTmp{#2}
11117 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
11118}
11119
11120% @U command definitions for native Unicode handling (XeTeX and LuaTeX).
11121\def\nativeunicodechardefsatu{%
11122 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
11123 \unicodechardefs
11124}
11125
11126% US-ASCII character definitions.
11127\def\asciichardefs{% nothing need be done
11128 \relax
11129}
11130
11131% Define all Unicode characters we know about. This makes UTF-8 the default
11132% input encoding and allows @U to work.
11133\iftxinativeunicodecapable
11134 \nativeunicodechardefsatu
11135\else
11136 \utfeightchardefs
11137\fi
11138
11139\message{formatting,}
11140
11141\newdimen\defaultparindent \defaultparindent = 15pt
11142
11143\chapheadingskip = 15pt plus 4pt minus 2pt
11144\secheadingskip = 12pt plus 3pt minus 2pt
11145\subsecheadingskip = 9pt plus 2pt minus 2pt
11146
11147% Prevent underfull vbox error messages.
11148\vbadness = 10000
11149
11150% Don't be very finicky about underfull hboxes, either.
11151\hbadness = 6666
11152
11153% Following George Bush, get rid of widows and orphans.
11154\widowpenalty=10000
11155\clubpenalty=10000
11156
11157% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
11158% using an old version of TeX, don't do anything. We want the amount of
11159% stretch added to depend on the line length, hence the dependence on
11160% \hsize. We call this whenever the paper size is set.
11161%
11162\def\setemergencystretch{%
11163 \ifx\emergencystretch\thisisundefined
11164 % Allow us to assign to \emergencystretch anyway.
11165 \def\emergencystretch{\dimen0}%
11166 \else
11167 \emergencystretch = .15\hsize
11168 \fi
11169}
11170
11171% Parameters in order: 1) textheight; 2) textwidth;
11172% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
11173% 7) physical page height; 8) physical page width.
11174%
11175% We also call \setleading{\textleading}, so the caller should define
11176% \textleading. The caller should also set \parskip.
11177%
11178\def\internalpagesizes#1#2#3#4#5#6#7#8{%
11179 \voffset = #3\relax
11180 \topskip = #6\relax
11181 \splittopskip = \topskip
11182 %
11183 \vsize = #1\relax
11184 \advance\vsize by \topskip
11185 \outervsize = \vsize
11186 \advance\outervsize by 2\topandbottommargin
11187 \txipageheight = \vsize
11188 %
11189 \hsize = #2\relax
11190 \outerhsize = \hsize
11191 \advance\outerhsize by 0.5in
11192 \txipagewidth = \hsize
11193 %
11194 \normaloffset = #4\relax
11195 \bindingoffset = #5\relax
11196 %
11197 \ifpdf
11198 \pdfpageheight #7\relax
11199 \pdfpagewidth #8\relax
11200 % if we don't reset these, they will remain at "1 true in" of
11201 % whatever layout pdftex was dumped with.
11202 \pdfhorigin = 1 true in
11203 \pdfvorigin = 1 true in
11204 \else
11205 \ifx\XeTeXrevision\thisisundefined
11206 \special{papersize=#8,#7}%
11207 \else
11208 \pdfpageheight #7\relax
11209 \pdfpagewidth #8\relax
11210 % XeTeX does not have \pdfhorigin and \pdfvorigin.
11211 \fi
11212 \fi
11213 %
11214 \setleading{\textleading}
11215 %
11216 \parindent = \defaultparindent
11217 \setemergencystretch
11218}
11219
11220% @letterpaper (the default).
11221\def\letterpaper{{\globaldefs = 1
11222 \parskip = 3pt plus 2pt minus 1pt
11223 \textleading = 13.2pt
11224 %
11225 % If page is nothing but text, make it come out even.
11226 \internalpagesizes{607.2pt}{6in}% that's 46 lines
11227 {\voffset}{.25in}%
11228 {\bindingoffset}{36pt}%
11229 {11in}{8.5in}%
11230}}
11231
11232% Use @smallbook to reset parameters for 7x9.25 trim size.
11233\def\smallbook{{\globaldefs = 1
11234 \parskip = 2pt plus 1pt
11235 \textleading = 12pt
11236 %
11237 \internalpagesizes{7.5in}{5in}%
11238 {-.2in}{0in}%
11239 {\bindingoffset}{16pt}%
11240 {9.25in}{7in}%
11241 %
11242 \lispnarrowing = 0.3in
11243 \tolerance = 700
11244 \contentsrightmargin = 0pt
11245 \defbodyindent = .5cm
11246}}
11247
11248% Use @smallerbook to reset parameters for 6x9 trim size.
11249% (Just testing, parameters still in flux.)
11250\def\smallerbook{{\globaldefs = 1
11251 \parskip = 1.5pt plus 1pt
11252 \textleading = 12pt
11253 %
11254 \internalpagesizes{7.4in}{4.8in}%
11255 {-.2in}{-.4in}%
11256 {0pt}{14pt}%
11257 {9in}{6in}%
11258 %
11259 \lispnarrowing = 0.25in
11260 \tolerance = 700
11261 \contentsrightmargin = 0pt
11262 \defbodyindent = .4cm
11263}}
11264
11265% Use @afourpaper to print on European A4 paper.
11266\def\afourpaper{{\globaldefs = 1
11267 \parskip = 3pt plus 2pt minus 1pt
11268 \textleading = 13.2pt
11269 %
11270 % Double-side printing via postscript on Laserjet 4050
11271 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
11272 % To change the settings for a different printer or situation, adjust
11273 % \normaloffset until the front-side and back-side texts align. Then
11274 % do the same for \bindingoffset. You can set these for testing in
11275 % your texinfo source file like this:
11276 % @tex
11277 % \global\normaloffset = -6mm
11278 % \global\bindingoffset = 10mm
11279 % @end tex
11280 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
11281 {\voffset}{\hoffset}%
11282 {\bindingoffset}{44pt}%
11283 {297mm}{210mm}%
11284 %
11285 \tolerance = 700
11286 \contentsrightmargin = 0pt
11287 \defbodyindent = 5mm
11288}}
11289
11290% Use @afivepaper to print on European A5 paper.
11291% From romildo@urano.iceb.ufop.br, 2 July 2000.
11292% He also recommends making @example and @lisp be small.
11293\def\afivepaper{{\globaldefs = 1
11294 \parskip = 2pt plus 1pt minus 0.1pt
11295 \textleading = 12.5pt
11296 %
11297 \internalpagesizes{160mm}{120mm}%
11298 {\voffset}{\hoffset}%
11299 {\bindingoffset}{8pt}%
11300 {210mm}{148mm}%
11301 %
11302 \lispnarrowing = 0.2in
11303 \tolerance = 800
11304 \contentsrightmargin = 0pt
11305 \defbodyindent = 2mm
11306 \tableindent = 12mm
11307}}
11308
11309% A specific text layout, 24x15cm overall, intended for A4 paper.
11310\def\afourlatex{{\globaldefs = 1
11311 \afourpaper
11312 \internalpagesizes{237mm}{150mm}%
11313 {\voffset}{4.6mm}%
11314 {\bindingoffset}{7mm}%
11315 {297mm}{210mm}%
11316 %
11317 % Must explicitly reset to 0 because we call \afourpaper.
11318 \globaldefs = 0
11319}}
11320
11321% Use @afourwide to print on A4 paper in landscape format.
11322\def\afourwide{{\globaldefs = 1
11323 \afourpaper
11324 \internalpagesizes{241mm}{165mm}%
11325 {\voffset}{-2.95mm}%
11326 {\bindingoffset}{7mm}%
11327 {297mm}{210mm}%
11328 \globaldefs = 0
11329}}
11330
11331\def\bsixpaper{{\globaldefs = 1
11332 \afourpaper
11333 \internalpagesizes{140mm}{100mm}%
11334 {-6.35mm}{-12.7mm}%
11335 {\bindingoffset}{14pt}%
11336 {176mm}{125mm}%
11337 \let\SETdispenvsize=\smallword
11338 \lispnarrowing = 0.2in
11339 \globaldefs = 0
11340}}
11341
11342
11343% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
11344% Perhaps we should allow setting the margins, \topskip, \parskip,
11345% and/or leading, also. Or perhaps we should compute them somehow.
11346%
11347\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
11348\def\pagesizesyyy#1,#2,#3\finish{{%
11349 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
11350 \globaldefs = 1
11351 %
11352 \parskip = 3pt plus 2pt minus 1pt
11353 \setleading{\textleading}%
11354 %
11355 \dimen0 = #1\relax
11356 \advance\dimen0 by 2.5in % default 1in margin above heading line
11357 % and 1.5in to include heading, footing and
11358 % bottom margin
11359 %
11360 \dimen2 = \hsize
11361 \advance\dimen2 by 2in % default to 1 inch margin on each side
11362 %
11363 \internalpagesizes{#1}{\hsize}%
11364 {\voffset}{\normaloffset}%
11365 {\bindingoffset}{44pt}%
11366 {\dimen0}{\dimen2}%
11367}}
11368
11369% Set default to letter.
11370%
11371\letterpaper
11372
11373% Default value of \hfuzz, for suppressing warnings about overfull hboxes.
11374\hfuzz = 1pt
11375
11376
11377\message{and turning on texinfo input format.}
11378
11379\def^^L{\par} % remove \outer, so ^L can appear in an @comment
11380
11381% DEL is a comment character, in case @c does not suffice.
11382\catcode`\^^? = 14
11383
11384% Define macros to output various characters with catcode for normal text.
11385\catcode`\"=\other \def\normaldoublequote{"}
11386\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
11387\catcode`\+=\other \def\normalplus{+}
11388\catcode`\<=\other \def\normalless{<}
11389\catcode`\>=\other \def\normalgreater{>}
11390\catcode`\^=\other \def\normalcaret{^}
11391\catcode`\_=\other \def\normalunderscore{_}
11392\catcode`\|=\other \def\normalverticalbar{|}
11393\catcode`\~=\other \def\normaltilde{~}
11394
11395% This macro is used to make a character print one way in \tt
11396% (where it can probably be output as-is), and another way in other fonts,
11397% where something hairier probably needs to be done.
11398%
11399% #1 is what to print if we are indeed using \tt; #2 is what to print
11400% otherwise. Since all the Computer Modern typewriter fonts have zero
11401% interword stretch (and shrink), and it is reasonable to expect all
11402% typewriter fonts to have this, we can check that font parameter.
11403%
11404\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
11405
11406% Same as above, but check for italic font. Actually this also catches
11407% non-italic slanted fonts since it is impossible to distinguish them from
11408% italic fonts. But since this is only used by $ and it uses \sl anyway
11409% this is not a problem.
11410\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
11411
11412% Set catcodes for Texinfo file
11413
11414% Active characters for printing the wanted glyph.
11415% Most of these we simply print from the \tt font, but for some, we can
11416% use math or other variants that look better in normal text.
11417%
11418\catcode`\"=\active
11419\def\activedoublequote{{\tt\char34}}
11420\let"=\activedoublequote
11421\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
11422\chardef\hatchar=`\^
11423\catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
11424
11425\catcode`\_=\active
11426\def_{\ifusingtt\normalunderscore\_}
11427\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
11428\let\realunder=_
11429
11430\catcode`\|=\active \def|{{\tt\char124}}
11431
11432\chardef \less=`\<
11433\catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
11434\chardef \gtr=`\>
11435\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
11436\catcode`\+=\active \def+{{\tt \char 43}}
11437\catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
11438\catcode`\-=\active \let-=\normaldash
11439
11440
11441% used for headline/footline in the output routine, in case the page
11442% breaks in the middle of an @tex block.
11443\def\texinfochars{%
11444 \let< = \activeless
11445 \let> = \activegtr
11446 \let~ = \activetilde
11447 \let^ = \activehat
11448 \setregularquotes
11449 \let\b = \strong
11450 \let\i = \smartitalic
11451 % in principle, all other definitions in \tex have to be undone too.
11452}
11453
11454% Used sometimes to turn off (effectively) the active characters even after
11455% parsing them.
11456\def\turnoffactive{%
11457 \normalturnoffactive
11458 \otherbackslash
11459}
11460
11461\catcode`\@=0
11462
11463% \backslashcurfont outputs one backslash character in current font,
11464% as in \char`\\.
11465\global\chardef\backslashcurfont=`\\
11466
11467% \realbackslash is an actual character `\' with catcode other.
11468{\catcode`\\=\other @gdef@realbackslash{\}}
11469
11470% In Texinfo, backslash is an active character; it prints the backslash
11471% in fixed width font.
11472\catcode`\\=\active % @ for escape char from now on.
11473
11474% Print a typewriter backslash. For math mode, we can't simply use
11475% \backslashcurfont: the story here is that in math mode, the \char
11476% of \backslashcurfont ends up printing the roman \ from the math symbol
11477% font (because \char in math mode uses the \mathcode, and plain.tex
11478% sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
11479% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
11480% ignored family value; char position "5C). We can't use " for the
11481% usual hex value because it has already been made active.
11482
11483@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
11484@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
11485
11486% \otherbackslash defines an active \ to be a literal `\' character with
11487% catcode other.
11488@gdef@otherbackslash{@let\=@realbackslash}
11489
11490% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
11491% the literal character `\'.
11492%
11493{@catcode`- = @active
11494 @gdef@normalturnoffactive{%
11495 @passthroughcharstrue
11496 @let-=@normaldash
11497 @let"=@normaldoublequote
11498 @let$=@normaldollar %$ font-lock fix
11499 @let+=@normalplus
11500 @let<=@normalless
11501 @let>=@normalgreater
11502 @let^=@normalcaret
11503 @let_=@normalunderscore
11504 @let|=@normalverticalbar
11505 @let~=@normaltilde
11506 @let\=@ttbackslash
11507 @setregularquotes
11508 @unsepspaces
11509 }
11510}
11511
11512% If a .fmt file is being used, characters that might appear in a file
11513% name cannot be active until we have parsed the command line.
11514% So turn them off again, and have @fixbackslash turn them back on.
11515@catcode`+=@other @catcode`@_=@other
11516
11517% \enablebackslashhack - allow file to begin `\input texinfo'
11518%
11519% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
11520% That is what \eatinput is for; after that, the `\' should revert to printing
11521% a backslash.
11522% If the file did not have a `\input texinfo', then it is turned off after
11523% the first line; otherwise the first `\' in the file would cause an error.
11524% This is used on the very last line of this file, texinfo.tex.
11525% We also use @c to call @fixbackslash, in case ends of lines are hidden.
11526{
11527@catcode`@^=7
11528@catcode`@^^M=13@gdef@enablebackslashhack{%
11529 @global@let\ = @eatinput%
11530 @catcode`@^^M=13%
11531 @def@c{@fixbackslash@c}%
11532 % Definition for the newline at the end of this file.
11533 @def ^^M{@let^^M@secondlinenl}%
11534 % Definition for a newline in the main Texinfo file.
11535 @gdef @secondlinenl{@fixbackslash}%
11536 % In case the first line has a whole-line command on it
11537 @let@originalparsearg@parsearg
11538 @def@parsearg{@fixbackslash@originalparsearg}
11539}}
11540
11541{@catcode`@^=7 @catcode`@^^M=13%
11542@gdef@eatinput input texinfo#1^^M{@fixbackslash}}
11543
11544% Emergency active definition of newline, in case an active newline token
11545% appears by mistake.
11546{@catcode`@^=7 @catcode13=13%
11547@gdef@enableemergencynewline{%
11548 @gdef^^M{%
11549 @par%
11550 %<warning: active newline>@par%
11551}}}
11552
11553
11554@gdef@fixbackslash{%
11555 @ifx\@eatinput @let\ = @ttbackslash @fi
11556 @catcode13=5 % regular end of line
11557 @enableemergencynewline
11558 @let@c=@comment
11559 @let@parsearg@originalparsearg
11560 % Also turn back on active characters that might appear in the input
11561 % file name, in case not using a pre-dumped format.
11562 @catcode`+=@active
11563 @catcode`@_=@active
11564 %
11565 % If texinfo.cnf is present on the system, read it.
11566 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
11567 % called at the beginning of every Texinfo file. Not opening texinfo.cnf
11568 % directly in this file, texinfo.tex, makes it possible to make a format
11569 % file for Texinfo.
11570 %
11571 @openin 1 texinfo.cnf
11572 @ifeof 1 @else @input texinfo.cnf @fi
11573 @closein 1
11574}
11575
11576
11577% Say @foo, not \foo, in error messages.
11578@escapechar = `@@
11579
11580% These (along with & and #) are made active for url-breaking, so need
11581% active definitions as the normal characters.
11582@def@normaldot{.}
11583@def@normalquest{?}
11584@def@normalslash{/}
11585
11586% These look ok in all fonts, so just make them not special.
11587% @hashchar{} gets its own user-level command, because of #line.
11588@catcode`@& = @other @def@normalamp{&}
11589@catcode`@# = @other @def@normalhash{#}
11590@catcode`@% = @other @def@normalpercent{%}
11591
11592@let @hashchar = @normalhash
11593
11594@c Finally, make ` and ' active, so that txicodequoteundirected and
11595@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11596@c don't make ` and ' active, @code will not get them as active chars.
11597@c Do this last of all since we use ` in the previous @catcode assignments.
11598@catcode`@'=@active
11599@catcode`@`=@active
11600@setregularquotes
11601
11602@c Local variables:
11603@c eval: (add-hook 'before-save-hook 'time-stamp)
11604@c page-delimiter: "^\\\\message\\|emacs-page"
11605@c time-stamp-start: "def\\\\texinfoversion{"
11606@c time-stamp-format: "%:y-%02m-%02d.%02H"
11607@c time-stamp-end: "}"
11608@c End:
11609
11610@c vim:sw=2:
11611
11612@enablebackslashhack
11613
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette