Fixes for AIX xlc compiler.
[libffi.git] / texinfo.tex
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{2012-06-05.14}
7 %
8 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10 % 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
11 %
12 % This texinfo.tex file is free software: you can redistribute it and/or
13 % modify it under the terms of the GNU General Public License as
14 % published by the Free Software Foundation, either version 3 of the
15 % License, or (at your option) any later version.
16 %
17 % This texinfo.tex file is distributed in the hope that it will be
18 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 % General Public License for more details.
21 %
22 % You should have received a copy of the GNU General Public License
23 % along with this program. If not, see <http://www.gnu.org/licenses/>.
24 %
25 % As a special exception, when this file is read by TeX when processing
26 % a Texinfo source document, you may use the result without
27 % restriction. (This has been our intent since Texinfo was invented.)
28 %
29 % Please try the latest version of texinfo.tex before submitting bug
30 % reports; you can get the latest version from:
31 % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
32 % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
33 % http://www.gnu.org/software/texinfo/ (the Texinfo home page)
34 % The texinfo.tex in any given distribution could well be out
35 % of date, so if that's what you're using, please check.
36 %
37 % Send bug reports to bug-texinfo@gnu.org. Please include including a
38 % complete document in each bug report with which we can reproduce the
39 % problem. Patches are, of course, greatly appreciated.
40 %
41 % To process a Texinfo manual with TeX, it's most reliable to use the
42 % texi2dvi shell script that comes with the distribution. For a simple
43 % manual foo.texi, however, you can get away with this:
44 % tex foo.texi
45 % texindex foo.??
46 % tex foo.texi
47 % tex foo.texi
48 % dvips foo.dvi -o # or whatever; this makes foo.ps.
49 % The extra TeX runs get the cross-reference information correct.
50 % Sometimes one run after texindex suffices, and sometimes you need more
51 % than two; texi2dvi does it as many times as necessary.
52 %
53 % It is possible to adapt texinfo.tex for other languages, to some
54 % extent. You can get the existing language-specific files from the
55 % full Texinfo distribution.
56 %
57 % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
58
59
60 \message{Loading texinfo [version \texinfoversion]:}
61
62 % If in a .fmt file, print the version number
63 % and turn on active characters that we couldn't do earlier because
64 % they might have appeared in the input file name.
65 \everyjob{\message{[Texinfo version \texinfoversion]}%
66 \catcode`+=\active \catcode`\_=\active}
67
68 \chardef\other=12
69
70 % We never want plain's \outer definition of \+ in Texinfo.
71 % For @tex, we can use \tabalign.
72 \let\+ = \relax
73
74 % Save some plain tex macros whose names we will redefine.
75 \let\ptexb=\b
76 \let\ptexbullet=\bullet
77 \let\ptexc=\c
78 \let\ptexcomma=\,
79 \let\ptexdot=\.
80 \let\ptexdots=\dots
81 \let\ptexend=\end
82 \let\ptexequiv=\equiv
83 \let\ptexexclam=\!
84 \let\ptexfootnote=\footnote
85 \let\ptexgtr=>
86 \let\ptexhat=^
87 \let\ptexi=\i
88 \let\ptexindent=\indent
89 \let\ptexinsert=\insert
90 \let\ptexlbrace=\{
91 \let\ptexless=<
92 \let\ptexnewwrite\newwrite
93 \let\ptexnoindent=\noindent
94 \let\ptexplus=+
95 \let\ptexraggedright=\raggedright
96 \let\ptexrbrace=\}
97 \let\ptexslash=\/
98 \let\ptexstar=\*
99 \let\ptext=\t
100 \let\ptextop=\top
101 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
102
103 % If this character appears in an error message or help string, it
104 % starts a new line in the output.
105 \newlinechar = `^^J
106
107 % Use TeX 3.0's \inputlineno to get the line number, for better error
108 % messages, but if we're using an old version of TeX, don't do anything.
109 %
110 \ifx\inputlineno\thisisundefined
111 \let\linenumber = \empty % Pre-3.0.
112 \else
113 \def\linenumber{l.\the\inputlineno:\space}
114 \fi
115
116 % Set up fixed words for English if not already set.
117 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
118 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
119 \ifx\putworderror\undefined \gdef\putworderror{error}\fi
120 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
121 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
122 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
123 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
124 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
125 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
126 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
127 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
128 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
129 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
130 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
131 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
132 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
133 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
134 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
135 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
136 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
137 %
138 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
139 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
140 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
141 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
142 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
143 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
144 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
145 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
146 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
147 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
148 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
149 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
150 %
151 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
152 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
153 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
154 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
155 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
156
157 % Since the category of space is not known, we have to be careful.
158 \chardef\spacecat = 10
159 \def\spaceisspace{\catcode`\ =\spacecat}
160
161 % sometimes characters are active, so we need control sequences.
162 \chardef\ampChar = `\&
163 \chardef\colonChar = `\:
164 \chardef\commaChar = `\,
165 \chardef\dashChar = `\-
166 \chardef\dotChar = `\.
167 \chardef\exclamChar= `\!
168 \chardef\hashChar = `\#
169 \chardef\lquoteChar= `\`
170 \chardef\questChar = `\?
171 \chardef\rquoteChar= `\'
172 \chardef\semiChar = `\;
173 \chardef\slashChar = `\/
174 \chardef\underChar = `\_
175
176 % Ignore a token.
177 %
178 \def\gobble#1{}
179
180 % The following is used inside several \edef's.
181 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
182
183 % Hyphenation fixes.
184 \hyphenation{
185 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
186 ap-pen-dix bit-map bit-maps
187 data-base data-bases eshell fall-ing half-way long-est man-u-script
188 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
189 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
190 spell-ing spell-ings
191 stand-alone strong-est time-stamp time-stamps which-ever white-space
192 wide-spread wrap-around
193 }
194
195 % Margin to add to right of even pages, to left of odd pages.
196 \newdimen\bindingoffset
197 \newdimen\normaloffset
198 \newdimen\pagewidth \newdimen\pageheight
199
200 % For a final copy, take out the rectangles
201 % that mark overfull boxes (in case you have decided
202 % that the text looks ok even though it passes the margin).
203 %
204 \def\finalout{\overfullrule=0pt }
205
206 % Sometimes it is convenient to have everything in the transcript file
207 % and nothing on the terminal. We don't just call \tracingall here,
208 % since that produces some useless output on the terminal. We also make
209 % some effort to order the tracing commands to reduce output in the log
210 % file; cf. trace.sty in LaTeX.
211 %
212 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
213 \def\loggingall{%
214 \tracingstats2
215 \tracingpages1
216 \tracinglostchars2 % 2 gives us more in etex
217 \tracingparagraphs1
218 \tracingoutput1
219 \tracingmacros2
220 \tracingrestores1
221 \showboxbreadth\maxdimen \showboxdepth\maxdimen
222 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
223 \tracingscantokens1
224 \tracingifs1
225 \tracinggroups1
226 \tracingnesting2
227 \tracingassigns1
228 \fi
229 \tracingcommands3 % 3 gives us more in etex
230 \errorcontextlines16
231 }%
232
233 % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
234 % aren't perfect, it's not the end of the world, being an error message,
235 % after all.
236 %
237 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
238 \def\doerrormsg#1{\errmessage{#1}}
239
240 % add check for \lastpenalty to plain's definitions. If the last thing
241 % we did was a \nobreak, we don't want to insert more space.
242 %
243 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
244 \removelastskip\penalty-50\smallskip\fi\fi}
245 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
246 \removelastskip\penalty-100\medskip\fi\fi}
247 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
248 \removelastskip\penalty-200\bigskip\fi\fi}
249
250 % Do @cropmarks to get crop marks.
251 %
252 \newif\ifcropmarks
253 \let\cropmarks = \cropmarkstrue
254 %
255 % Dimensions to add cropmarks at corners.
256 % Added by P. A. MacKay, 12 Nov. 1986
257 %
258 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
259 \newdimen\cornerlong \cornerlong=1pc
260 \newdimen\cornerthick \cornerthick=.3pt
261 \newdimen\topandbottommargin \topandbottommargin=.75in
262
263 % Output a mark which sets \thischapter, \thissection and \thiscolor.
264 % We dump everything together because we only have one kind of mark.
265 % This works because we only use \botmark / \topmark, not \firstmark.
266 %
267 % A mark contains a subexpression of the \ifcase ... \fi construct.
268 % \get*marks macros below extract the needed part using \ifcase.
269 %
270 % Another complication is to let the user choose whether \thischapter
271 % (\thissection) refers to the chapter (section) in effect at the top
272 % of a page, or that at the bottom of a page. The solution is
273 % described on page 260 of The TeXbook. It involves outputting two
274 % marks for the sectioning macros, one before the section break, and
275 % one after. I won't pretend I can describe this better than DEK...
276 \def\domark{%
277 \toks0=\expandafter{\lastchapterdefs}%
278 \toks2=\expandafter{\lastsectiondefs}%
279 \toks4=\expandafter{\prevchapterdefs}%
280 \toks6=\expandafter{\prevsectiondefs}%
281 \toks8=\expandafter{\lastcolordefs}%
282 \mark{%
283 \the\toks0 \the\toks2
284 \noexpand\or \the\toks4 \the\toks6
285 \noexpand\else \the\toks8
286 }%
287 }
288 % \topmark doesn't work for the very first chapter (after the title
289 % page or the contents), so we use \firstmark there -- this gets us
290 % the mark with the chapter defs, unless the user sneaks in, e.g.,
291 % @setcolor (or @url, or @link, etc.) between @contents and the very
292 % first @chapter.
293 \def\gettopheadingmarks{%
294 \ifcase0\topmark\fi
295 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
296 }
297 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
298 \def\getcolormarks{\ifcase2\topmark\fi}
299
300 % Avoid "undefined control sequence" errors.
301 \def\lastchapterdefs{}
302 \def\lastsectiondefs{}
303 \def\prevchapterdefs{}
304 \def\prevsectiondefs{}
305 \def\lastcolordefs{}
306
307 % Main output routine.
308 \chardef\PAGE = 255
309 \output = {\onepageout{\pagecontents\PAGE}}
310
311 \newbox\headlinebox
312 \newbox\footlinebox
313
314 % \onepageout takes a vbox as an argument. Note that \pagecontents
315 % does insertions, but you have to call it yourself.
316 \def\onepageout#1{%
317 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
318 %
319 \ifodd\pageno \advance\hoffset by \bindingoffset
320 \else \advance\hoffset by -\bindingoffset\fi
321 %
322 % Do this outside of the \shipout so @code etc. will be expanded in
323 % the headline as they should be, not taken literally (outputting ''code).
324 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
325 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
326 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
327 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
328 %
329 {%
330 % Have to do this stuff outside the \shipout because we want it to
331 % take effect in \write's, yet the group defined by the \vbox ends
332 % before the \shipout runs.
333 %
334 \indexdummies % don't expand commands in the output.
335 \normalturnoffactive % \ in index entries must not stay \, e.g., if
336 % the page break happens to be in the middle of an example.
337 % We don't want .vr (or whatever) entries like this:
338 % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
339 % "\acronym" won't work when it's read back in;
340 % it needs to be
341 % {\code {{\tt \backslashcurfont }acronym}
342 \shipout\vbox{%
343 % Do this early so pdf references go to the beginning of the page.
344 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
345 %
346 \ifcropmarks \vbox to \outervsize\bgroup
347 \hsize = \outerhsize
348 \vskip-\topandbottommargin
349 \vtop to0pt{%
350 \line{\ewtop\hfil\ewtop}%
351 \nointerlineskip
352 \line{%
353 \vbox{\moveleft\cornerthick\nstop}%
354 \hfill
355 \vbox{\moveright\cornerthick\nstop}%
356 }%
357 \vss}%
358 \vskip\topandbottommargin
359 \line\bgroup
360 \hfil % center the page within the outer (page) hsize.
361 \ifodd\pageno\hskip\bindingoffset\fi
362 \vbox\bgroup
363 \fi
364 %
365 \unvbox\headlinebox
366 \pagebody{#1}%
367 \ifdim\ht\footlinebox > 0pt
368 % Only leave this space if the footline is nonempty.
369 % (We lessened \vsize for it in \oddfootingyyy.)
370 % The \baselineskip=24pt in plain's \makefootline has no effect.
371 \vskip 24pt
372 \unvbox\footlinebox
373 \fi
374 %
375 \ifcropmarks
376 \egroup % end of \vbox\bgroup
377 \hfil\egroup % end of (centering) \line\bgroup
378 \vskip\topandbottommargin plus1fill minus1fill
379 \boxmaxdepth = \cornerthick
380 \vbox to0pt{\vss
381 \line{%
382 \vbox{\moveleft\cornerthick\nsbot}%
383 \hfill
384 \vbox{\moveright\cornerthick\nsbot}%
385 }%
386 \nointerlineskip
387 \line{\ewbot\hfil\ewbot}%
388 }%
389 \egroup % \vbox from first cropmarks clause
390 \fi
391 }% end of \shipout\vbox
392 }% end of group with \indexdummies
393 \advancepageno
394 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
395 }
396
397 \newinsert\margin \dimen\margin=\maxdimen
398
399 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
400 {\catcode`\@ =11
401 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
402 % marginal hacks, juha@viisa.uucp (Juha Takala)
403 \ifvoid\margin\else % marginal info is present
404 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
405 \dimen@=\dp#1\relax \unvbox#1\relax
406 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
407 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
408 }
409
410 % Here are the rules for the cropmarks. Note that they are
411 % offset so that the space between them is truly \outerhsize or \outervsize
412 % (P. A. MacKay, 12 November, 1986)
413 %
414 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
415 \def\nstop{\vbox
416 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
417 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
418 \def\nsbot{\vbox
419 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
420
421 % Parse an argument, then pass it to #1. The argument is the rest of
422 % the input line (except we remove a trailing comment). #1 should be a
423 % macro which expects an ordinary undelimited TeX argument.
424 %
425 \def\parsearg{\parseargusing{}}
426 \def\parseargusing#1#2{%
427 \def\argtorun{#2}%
428 \begingroup
429 \obeylines
430 \spaceisspace
431 #1%
432 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
433 }
434
435 {\obeylines %
436 \gdef\parseargline#1^^M{%
437 \endgroup % End of the group started in \parsearg.
438 \argremovecomment #1\comment\ArgTerm%
439 }%
440 }
441
442 % First remove any @comment, then any @c comment.
443 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
444 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
445
446 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
447 %
448 % \argremovec might leave us with trailing space, e.g.,
449 % @end itemize @c foo
450 % This space token undergoes the same procedure and is eventually removed
451 % by \finishparsearg.
452 %
453 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
454 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
455 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
456 \def\temp{#3}%
457 \ifx\temp\empty
458 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
459 \let\temp\finishparsearg
460 \else
461 \let\temp\argcheckspaces
462 \fi
463 % Put the space token in:
464 \temp#1 #3\ArgTerm
465 }
466
467 % If a _delimited_ argument is enclosed in braces, they get stripped; so
468 % to get _exactly_ the rest of the line, we had to prevent such situation.
469 % We prepended an \empty token at the very beginning and we expand it now,
470 % just before passing the control to \argtorun.
471 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
472 % either the null string, or it ends with \^^M---thus there is no danger
473 % that a pair of braces would be stripped.
474 %
475 % But first, we have to remove the trailing space token.
476 %
477 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
478
479 % \parseargdef\foo{...}
480 % is roughly equivalent to
481 % \def\foo{\parsearg\Xfoo}
482 % \def\Xfoo#1{...}
483 %
484 % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
485 % favourite TeX trick. --kasal, 16nov03
486
487 \def\parseargdef#1{%
488 \expandafter \doparseargdef \csname\string#1\endcsname #1%
489 }
490 \def\doparseargdef#1#2{%
491 \def#2{\parsearg#1}%
492 \def#1##1%
493 }
494
495 % Several utility definitions with active space:
496 {
497 \obeyspaces
498 \gdef\obeyedspace{ }
499
500 % Make each space character in the input produce a normal interword
501 % space in the output. Don't allow a line break at this space, as this
502 % is used only in environments like @example, where each line of input
503 % should produce a line of output anyway.
504 %
505 \gdef\sepspaces{\obeyspaces\let =\tie}
506
507 % If an index command is used in an @example environment, any spaces
508 % therein should become regular spaces in the raw index file, not the
509 % expansion of \tie (\leavevmode \penalty \@M \ ).
510 \gdef\unsepspaces{\let =\space}
511 }
512
513
514 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
515
516 % Define the framework for environments in texinfo.tex. It's used like this:
517 %
518 % \envdef\foo{...}
519 % \def\Efoo{...}
520 %
521 % It's the responsibility of \envdef to insert \begingroup before the
522 % actual body; @end closes the group after calling \Efoo. \envdef also
523 % defines \thisenv, so the current environment is known; @end checks
524 % whether the environment name matches. The \checkenv macro can also be
525 % used to check whether the current environment is the one expected.
526 %
527 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
528 % are not treated as environments; they don't open a group. (The
529 % implementation of @end takes care not to call \endgroup in this
530 % special case.)
531
532
533 % At run-time, environments start with this:
534 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
535 % initialize
536 \let\thisenv\empty
537
538 % ... but they get defined via ``\envdef\foo{...}'':
539 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
540 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
541
542 % Check whether we're in the right environment:
543 \def\checkenv#1{%
544 \def\temp{#1}%
545 \ifx\thisenv\temp
546 \else
547 \badenverr
548 \fi
549 }
550
551 % Environment mismatch, #1 expected:
552 \def\badenverr{%
553 \errhelp = \EMsimple
554 \errmessage{This command can appear only \inenvironment\temp,
555 not \inenvironment\thisenv}%
556 }
557 \def\inenvironment#1{%
558 \ifx#1\empty
559 outside of any environment%
560 \else
561 in environment \expandafter\string#1%
562 \fi
563 }
564
565 % @end foo executes the definition of \Efoo.
566 % But first, it executes a specialized version of \checkenv
567 %
568 \parseargdef\end{%
569 \if 1\csname iscond.#1\endcsname
570 \else
571 % The general wording of \badenverr may not be ideal.
572 \expandafter\checkenv\csname#1\endcsname
573 \csname E#1\endcsname
574 \endgroup
575 \fi
576 }
577
578 \newhelp\EMsimple{Press RETURN to continue.}
579
580
581 % Be sure we're in horizontal mode when doing a tie, since we make space
582 % equivalent to this in @example-like environments. Otherwise, a space
583 % at the beginning of a line will start with \penalty -- and
584 % since \penalty is valid in vertical mode, we'd end up putting the
585 % penalty on the vertical list instead of in the new paragraph.
586 {\catcode`@ = 11
587 % Avoid using \@M directly, because that causes trouble
588 % if the definition is written into an index file.
589 \global\let\tiepenalty = \@M
590 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
591 }
592
593 % @: forces normal size whitespace following.
594 \def\:{\spacefactor=1000 }
595
596 % @* forces a line break.
597 \def\*{\hfil\break\hbox{}\ignorespaces}
598
599 % @/ allows a line break.
600 \let\/=\allowbreak
601
602 % @. is an end-of-sentence period.
603 \def\.{.\spacefactor=\endofsentencespacefactor\space}
604
605 % @! is an end-of-sentence bang.
606 \def\!{!\spacefactor=\endofsentencespacefactor\space}
607
608 % @? is an end-of-sentence query.
609 \def\?{?\spacefactor=\endofsentencespacefactor\space}
610
611 % @frenchspacing on|off says whether to put extra space after punctuation.
612 %
613 \def\onword{on}
614 \def\offword{off}
615 %
616 \parseargdef\frenchspacing{%
617 \def\temp{#1}%
618 \ifx\temp\onword \plainfrenchspacing
619 \else\ifx\temp\offword \plainnonfrenchspacing
620 \else
621 \errhelp = \EMsimple
622 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
623 \fi\fi
624 }
625
626 % @w prevents a word break. Without the \leavevmode, @w at the
627 % beginning of a paragraph, when TeX is still in vertical mode, would
628 % produce a whole line of output instead of starting the paragraph.
629 \def\w#1{\leavevmode\hbox{#1}}
630
631 % @group ... @end group forces ... to be all on one page, by enclosing
632 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
633 % to keep its height that of a normal line. According to the rules for
634 % \topskip (p.114 of the TeXbook), the glue inserted is
635 % max (\topskip - \ht (first item), 0). If that height is large,
636 % therefore, no glue is inserted, and the space between the headline and
637 % the text is small, which looks bad.
638 %
639 % Another complication is that the group might be very large. This can
640 % cause the glue on the previous page to be unduly stretched, because it
641 % does not have much material. In this case, it's better to add an
642 % explicit \vfill so that the extra space is at the bottom. The
643 % threshold for doing this is if the group is more than \vfilllimit
644 % percent of a page (\vfilllimit can be changed inside of @tex).
645 %
646 \newbox\groupbox
647 \def\vfilllimit{0.7}
648 %
649 \envdef\group{%
650 \ifnum\catcode`\^^M=\active \else
651 \errhelp = \groupinvalidhelp
652 \errmessage{@group invalid in context where filling is enabled}%
653 \fi
654 \startsavinginserts
655 %
656 \setbox\groupbox = \vtop\bgroup
657 % Do @comment since we are called inside an environment such as
658 % @example, where each end-of-line in the input causes an
659 % end-of-line in the output. We don't want the end-of-line after
660 % the `@group' to put extra space in the output. Since @group
661 % should appear on a line by itself (according to the Texinfo
662 % manual), we don't worry about eating any user text.
663 \comment
664 }
665 %
666 % The \vtop produces a box with normal height and large depth; thus, TeX puts
667 % \baselineskip glue before it, and (when the next line of text is done)
668 % \lineskip glue after it. Thus, space below is not quite equal to space
669 % above. But it's pretty close.
670 \def\Egroup{%
671 % To get correct interline space between the last line of the group
672 % and the first line afterwards, we have to propagate \prevdepth.
673 \endgraf % Not \par, as it may have been set to \lisppar.
674 \global\dimen1 = \prevdepth
675 \egroup % End the \vtop.
676 % \dimen0 is the vertical size of the group's box.
677 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
678 % \dimen2 is how much space is left on the page (more or less).
679 \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
680 % if the group doesn't fit on the current page, and it's a big big
681 % group, force a page break.
682 \ifdim \dimen0 > \dimen2
683 \ifdim \pagetotal < \vfilllimit\pageheight
684 \page
685 \fi
686 \fi
687 \box\groupbox
688 \prevdepth = \dimen1
689 \checkinserts
690 }
691 %
692 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
693 % message, so this ends up printing `@group can only ...'.
694 %
695 \newhelp\groupinvalidhelp{%
696 group can only be used in environments such as @example,^^J%
697 where each line of input produces a line of output.}
698
699 % @need space-in-mils
700 % forces a page break if there is not space-in-mils remaining.
701
702 \newdimen\mil \mil=0.001in
703
704 \parseargdef\need{%
705 % Ensure vertical mode, so we don't make a big box in the middle of a
706 % paragraph.
707 \par
708 %
709 % If the @need value is less than one line space, it's useless.
710 \dimen0 = #1\mil
711 \dimen2 = \ht\strutbox
712 \advance\dimen2 by \dp\strutbox
713 \ifdim\dimen0 > \dimen2
714 %
715 % Do a \strut just to make the height of this box be normal, so the
716 % normal leading is inserted relative to the preceding line.
717 % And a page break here is fine.
718 \vtop to #1\mil{\strut\vfil}%
719 %
720 % TeX does not even consider page breaks if a penalty added to the
721 % main vertical list is 10000 or more. But in order to see if the
722 % empty box we just added fits on the page, we must make it consider
723 % page breaks. On the other hand, we don't want to actually break the
724 % page after the empty box. So we use a penalty of 9999.
725 %
726 % There is an extremely small chance that TeX will actually break the
727 % page at this \penalty, if there are no other feasible breakpoints in
728 % sight. (If the user is using lots of big @group commands, which
729 % almost-but-not-quite fill up a page, TeX will have a hard time doing
730 % good page breaking, for example.) However, I could not construct an
731 % example where a page broke at this \penalty; if it happens in a real
732 % document, then we can reconsider our strategy.
733 \penalty9999
734 %
735 % Back up by the size of the box, whether we did a page break or not.
736 \kern -#1\mil
737 %
738 % Do not allow a page break right after this kern.
739 \nobreak
740 \fi
741 }
742
743 % @br forces paragraph break (and is undocumented).
744
745 \let\br = \par
746
747 % @page forces the start of a new page.
748 %
749 \def\page{\par\vfill\supereject}
750
751 % @exdent text....
752 % outputs text on separate line in roman font, starting at standard page margin
753
754 % This records the amount of indent in the innermost environment.
755 % That's how much \exdent should take out.
756 \newskip\exdentamount
757
758 % This defn is used inside fill environments such as @defun.
759 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
760
761 % This defn is used inside nofill environments such as @example.
762 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
763 \leftline{\hskip\leftskip{\rm#1}}}}
764
765 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
766 % paragraph. For more general purposes, use the \margin insertion
767 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
768 %
769 \newskip\inmarginspacing \inmarginspacing=1cm
770 \def\strutdepth{\dp\strutbox}
771 %
772 \def\doinmargin#1#2{\strut\vadjust{%
773 \nobreak
774 \kern-\strutdepth
775 \vtop to \strutdepth{%
776 \baselineskip=\strutdepth
777 \vss
778 % if you have multiple lines of stuff to put here, you'll need to
779 % make the vbox yourself of the appropriate size.
780 \ifx#1l%
781 \llap{\ignorespaces #2\hskip\inmarginspacing}%
782 \else
783 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
784 \fi
785 \null
786 }%
787 }}
788 \def\inleftmargin{\doinmargin l}
789 \def\inrightmargin{\doinmargin r}
790 %
791 % @inmargin{TEXT [, RIGHT-TEXT]}
792 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
793 % else use TEXT for both).
794 %
795 \def\inmargin#1{\parseinmargin #1,,\finish}
796 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
797 \setbox0 = \hbox{\ignorespaces #2}%
798 \ifdim\wd0 > 0pt
799 \def\lefttext{#1}% have both texts
800 \def\righttext{#2}%
801 \else
802 \def\lefttext{#1}% have only one text
803 \def\righttext{#1}%
804 \fi
805 %
806 \ifodd\pageno
807 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
808 \else
809 \def\temp{\inleftmargin\lefttext}%
810 \fi
811 \temp
812 }
813
814 % @| inserts a changebar to the left of the current line. It should
815 % surround any changed text. This approach does *not* work if the
816 % change spans more than two lines of output. To handle that, we would
817 % have adopt a much more difficult approach (putting marks into the main
818 % vertical list for the beginning and end of each change). This command
819 % is not documented, not supported, and doesn't work.
820 %
821 \def\|{%
822 % \vadjust can only be used in horizontal mode.
823 \leavevmode
824 %
825 % Append this vertical mode material after the current line in the output.
826 \vadjust{%
827 % We want to insert a rule with the height and depth of the current
828 % leading; that is exactly what \strutbox is supposed to record.
829 \vskip-\baselineskip
830 %
831 % \vadjust-items are inserted at the left edge of the type. So
832 % the \llap here moves out into the left-hand margin.
833 \llap{%
834 %
835 % For a thicker or thinner bar, change the `1pt'.
836 \vrule height\baselineskip width1pt
837 %
838 % This is the space between the bar and the text.
839 \hskip 12pt
840 }%
841 }%
842 }
843
844 % @include FILE -- \input text of FILE.
845 %
846 \def\include{\parseargusing\filenamecatcodes\includezzz}
847 \def\includezzz#1{%
848 \pushthisfilestack
849 \def\thisfile{#1}%
850 {%
851 \makevalueexpandable % we want to expand any @value in FILE.
852 \turnoffactive % and allow special characters in the expansion
853 \indexnofonts % Allow `@@' and other weird things in file names.
854 \wlog{texinfo.tex: doing @include of #1^^J}%
855 \edef\temp{\noexpand\input #1 }%
856 %
857 % This trickery is to read FILE outside of a group, in case it makes
858 % definitions, etc.
859 \expandafter
860 }\temp
861 \popthisfilestack
862 }
863 \def\filenamecatcodes{%
864 \catcode`\\=\other
865 \catcode`~=\other
866 \catcode`^=\other
867 \catcode`_=\other
868 \catcode`|=\other
869 \catcode`<=\other
870 \catcode`>=\other
871 \catcode`+=\other
872 \catcode`-=\other
873 \catcode`\`=\other
874 \catcode`\'=\other
875 }
876
877 \def\pushthisfilestack{%
878 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
879 }
880 \def\pushthisfilestackX{%
881 \expandafter\pushthisfilestackY\thisfile\StackTerm
882 }
883 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
884 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
885 }
886
887 \def\popthisfilestack{\errthisfilestackempty}
888 \def\errthisfilestackempty{\errmessage{Internal error:
889 the stack of filenames is empty.}}
890 %
891 \def\thisfile{}
892
893 % @center line
894 % outputs that line, centered.
895 %
896 \parseargdef\center{%
897 \ifhmode
898 \let\centersub\centerH
899 \else
900 \let\centersub\centerV
901 \fi
902 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
903 \let\centersub\relax % don't let the definition persist, just in case
904 }
905 \def\centerH#1{{%
906 \hfil\break
907 \advance\hsize by -\leftskip
908 \advance\hsize by -\rightskip
909 \line{#1}%
910 \break
911 }}
912 %
913 \newcount\centerpenalty
914 \def\centerV#1{%
915 % The idea here is the same as in \startdefun, \cartouche, etc.: if
916 % @center is the first thing after a section heading, we need to wipe
917 % out the negative parskip inserted by \sectionheading, but still
918 % prevent a page break here.
919 \centerpenalty = \lastpenalty
920 \ifnum\centerpenalty>10000 \vskip\parskip \fi
921 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
922 \line{\kern\leftskip #1\kern\rightskip}%
923 }
924
925 % @sp n outputs n lines of vertical space
926 %
927 \parseargdef\sp{\vskip #1\baselineskip}
928
929 % @comment ...line which is ignored...
930 % @c is the same as @comment
931 % @ignore ... @end ignore is another way to write a comment
932 %
933 \def\comment{\begingroup \catcode`\^^M=\other%
934 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
935 \commentxxx}
936 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
937 %
938 \let\c=\comment
939
940 % @paragraphindent NCHARS
941 % We'll use ems for NCHARS, close enough.
942 % NCHARS can also be the word `asis' or `none'.
943 % We cannot feasibly implement @paragraphindent asis, though.
944 %
945 \def\asisword{asis} % no translation, these are keywords
946 \def\noneword{none}
947 %
948 \parseargdef\paragraphindent{%
949 \def\temp{#1}%
950 \ifx\temp\asisword
951 \else
952 \ifx\temp\noneword
953 \defaultparindent = 0pt
954 \else
955 \defaultparindent = #1em
956 \fi
957 \fi
958 \parindent = \defaultparindent
959 }
960
961 % @exampleindent NCHARS
962 % We'll use ems for NCHARS like @paragraphindent.
963 % It seems @exampleindent asis isn't necessary, but
964 % I preserve it to make it similar to @paragraphindent.
965 \parseargdef\exampleindent{%
966 \def\temp{#1}%
967 \ifx\temp\asisword
968 \else
969 \ifx\temp\noneword
970 \lispnarrowing = 0pt
971 \else
972 \lispnarrowing = #1em
973 \fi
974 \fi
975 }
976
977 % @firstparagraphindent WORD
978 % If WORD is `none', then suppress indentation of the first paragraph
979 % after a section heading. If WORD is `insert', then do indent at such
980 % paragraphs.
981 %
982 % The paragraph indentation is suppressed or not by calling
983 % \suppressfirstparagraphindent, which the sectioning commands do.
984 % We switch the definition of this back and forth according to WORD.
985 % By default, we suppress indentation.
986 %
987 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
988 \def\insertword{insert}
989 %
990 \parseargdef\firstparagraphindent{%
991 \def\temp{#1}%
992 \ifx\temp\noneword
993 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
994 \else\ifx\temp\insertword
995 \let\suppressfirstparagraphindent = \relax
996 \else
997 \errhelp = \EMsimple
998 \errmessage{Unknown @firstparagraphindent option `\temp'}%
999 \fi\fi
1000 }
1001
1002 % Here is how we actually suppress indentation. Redefine \everypar to
1003 % \kern backwards by \parindent, and then reset itself to empty.
1004 %
1005 % We also make \indent itself not actually do anything until the next
1006 % paragraph.
1007 %
1008 \gdef\dosuppressfirstparagraphindent{%
1009 \gdef\indent{%
1010 \restorefirstparagraphindent
1011 \indent
1012 }%
1013 \gdef\noindent{%
1014 \restorefirstparagraphindent
1015 \noindent
1016 }%
1017 \global\everypar = {%
1018 \kern -\parindent
1019 \restorefirstparagraphindent
1020 }%
1021 }
1022
1023 \gdef\restorefirstparagraphindent{%
1024 \global \let \indent = \ptexindent
1025 \global \let \noindent = \ptexnoindent
1026 \global \everypar = {}%
1027 }
1028
1029
1030 % @refill is a no-op.
1031 \let\refill=\relax
1032
1033 % If working on a large document in chapters, it is convenient to
1034 % be able to disable indexing, cross-referencing, and contents, for test runs.
1035 % This is done with @novalidate (before @setfilename).
1036 %
1037 \newif\iflinks \linkstrue % by default we want the aux files.
1038 \let\novalidate = \linksfalse
1039
1040 % @setfilename is done at the beginning of every texinfo file.
1041 % So open here the files we need to have open while reading the input.
1042 % This makes it possible to make a .fmt file for texinfo.
1043 \def\setfilename{%
1044 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1045 \iflinks
1046 \tryauxfile
1047 % Open the new aux file. TeX will close it automatically at exit.
1048 \immediate\openout\auxfile=\jobname.aux
1049 \fi % \openindices needs to do some work in any case.
1050 \openindices
1051 \let\setfilename=\comment % Ignore extra @setfilename cmds.
1052 %
1053 % If texinfo.cnf is present on the system, read it.
1054 % Useful for site-wide @afourpaper, etc.
1055 \openin 1 texinfo.cnf
1056 \ifeof 1 \else \input texinfo.cnf \fi
1057 \closein 1
1058 %
1059 \comment % Ignore the actual filename.
1060 }
1061
1062 % Called from \setfilename.
1063 %
1064 \def\openindices{%
1065 \newindex{cp}%
1066 \newcodeindex{fn}%
1067 \newcodeindex{vr}%
1068 \newcodeindex{tp}%
1069 \newcodeindex{ky}%
1070 \newcodeindex{pg}%
1071 }
1072
1073 % @bye.
1074 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1075
1076
1077 \message{pdf,}
1078 % adobe `portable' document format
1079 \newcount\tempnum
1080 \newcount\lnkcount
1081 \newtoks\filename
1082 \newcount\filenamelength
1083 \newcount\pgn
1084 \newtoks\toksA
1085 \newtoks\toksB
1086 \newtoks\toksC
1087 \newtoks\toksD
1088 \newbox\boxA
1089 \newcount\countA
1090 \newif\ifpdf
1091 \newif\ifpdfmakepagedest
1092
1093 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1094 % can be set). So we test for \relax and 0 as well as being undefined.
1095 \ifx\pdfoutput\thisisundefined
1096 \else
1097 \ifx\pdfoutput\relax
1098 \else
1099 \ifcase\pdfoutput
1100 \else
1101 \pdftrue
1102 \fi
1103 \fi
1104 \fi
1105
1106 % PDF uses PostScript string constants for the names of xref targets,
1107 % for display in the outlines, and in other places. Thus, we have to
1108 % double any backslashes. Otherwise, a name like "\node" will be
1109 % interpreted as a newline (\n), followed by o, d, e. Not good.
1110 %
1111 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1112 % related messages. The final outcome is that it is up to the TeX user
1113 % to double the backslashes and otherwise make the string valid, so
1114 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1115 % do this reliably, so we use it.
1116
1117 % #1 is a control sequence in which to do the replacements,
1118 % which we \xdef.
1119 \def\txiescapepdf#1{%
1120 \ifx\pdfescapestring\thisisundefined
1121 % No primitive available; should we give a warning or log?
1122 % Many times it won't matter.
1123 \else
1124 % The expandable \pdfescapestring primitive escapes parentheses,
1125 % backslashes, and other special chars.
1126 \xdef#1{\pdfescapestring{#1}}%
1127 \fi
1128 }
1129
1130 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1131 with PDF output, and none of those formats could be found. (.eps cannot
1132 be supported due to the design of the PDF format; use regular TeX (DVI
1133 output) for that.)}
1134
1135 \ifpdf
1136 %
1137 % Color manipulation macros based on pdfcolor.tex,
1138 % except using rgb instead of cmyk; the latter is said to render as a
1139 % very dark gray on-screen and a very dark halftone in print, instead
1140 % of actual black.
1141 \def\rgbDarkRed{0.50 0.09 0.12}
1142 \def\rgbBlack{0 0 0}
1143 %
1144 % k sets the color for filling (usual text, etc.);
1145 % K sets the color for stroking (thin rules, e.g., normal _'s).
1146 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1147 %
1148 % Set color, and create a mark which defines \thiscolor accordingly,
1149 % so that \makeheadline knows which color to restore.
1150 \def\setcolor#1{%
1151 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1152 \domark
1153 \pdfsetcolor{#1}%
1154 }
1155 %
1156 \def\maincolor{\rgbBlack}
1157 \pdfsetcolor{\maincolor}
1158 \edef\thiscolor{\maincolor}
1159 \def\lastcolordefs{}
1160 %
1161 \def\makefootline{%
1162 \baselineskip24pt
1163 \line{\pdfsetcolor{\maincolor}\the\footline}%
1164 }
1165 %
1166 \def\makeheadline{%
1167 \vbox to 0pt{%
1168 \vskip-22.5pt
1169 \line{%
1170 \vbox to8.5pt{}%
1171 % Extract \thiscolor definition from the marks.
1172 \getcolormarks
1173 % Typeset the headline with \maincolor, then restore the color.
1174 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1175 }%
1176 \vss
1177 }%
1178 \nointerlineskip
1179 }
1180 %
1181 %
1182 \pdfcatalog{/PageMode /UseOutlines}
1183 %
1184 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1185 \def\dopdfimage#1#2#3{%
1186 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1187 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1188 %
1189 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1190 % others). Let's try in that order, PDF first since if
1191 % someone has a scalable image, presumably better to use that than a
1192 % bitmap.
1193 \let\pdfimgext=\empty
1194 \begingroup
1195 \openin 1 #1.pdf \ifeof 1
1196 \openin 1 #1.PDF \ifeof 1
1197 \openin 1 #1.png \ifeof 1
1198 \openin 1 #1.jpg \ifeof 1
1199 \openin 1 #1.jpeg \ifeof 1
1200 \openin 1 #1.JPG \ifeof 1
1201 \errhelp = \nopdfimagehelp
1202 \errmessage{Could not find image file #1 for pdf}%
1203 \else \gdef\pdfimgext{JPG}%
1204 \fi
1205 \else \gdef\pdfimgext{jpeg}%
1206 \fi
1207 \else \gdef\pdfimgext{jpg}%
1208 \fi
1209 \else \gdef\pdfimgext{png}%
1210 \fi
1211 \else \gdef\pdfimgext{PDF}%
1212 \fi
1213 \else \gdef\pdfimgext{pdf}%
1214 \fi
1215 \closein 1
1216 \endgroup
1217 %
1218 % without \immediate, ancient pdftex seg faults when the same image is
1219 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1220 \ifnum\pdftexversion < 14
1221 \immediate\pdfimage
1222 \else
1223 \immediate\pdfximage
1224 \fi
1225 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1226 \ifdim \wd2 >0pt height \pdfimageheight \fi
1227 \ifnum\pdftexversion<13
1228 #1.\pdfimgext
1229 \else
1230 {#1.\pdfimgext}%
1231 \fi
1232 \ifnum\pdftexversion < 14 \else
1233 \pdfrefximage \pdflastximage
1234 \fi}
1235 %
1236 \def\pdfmkdest#1{{%
1237 % We have to set dummies so commands such as @code, and characters
1238 % such as \, aren't expanded when present in a section title.
1239 \indexnofonts
1240 \turnoffactive
1241 \makevalueexpandable
1242 \def\pdfdestname{#1}%
1243 \txiescapepdf\pdfdestname
1244 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1245 }}
1246 %
1247 % used to mark target names; must be expandable.
1248 \def\pdfmkpgn#1{#1}
1249 %
1250 % by default, use a color that is dark enough to print on paper as
1251 % nearly black, but still distinguishable for online viewing.
1252 \def\urlcolor{\rgbDarkRed}
1253 \def\linkcolor{\rgbDarkRed}
1254 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1255 %
1256 % Adding outlines to PDF; macros for calculating structure of outlines
1257 % come from Petr Olsak
1258 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1259 \else \csname#1\endcsname \fi}
1260 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1261 \advance\tempnum by 1
1262 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1263 %
1264 % #1 is the section text, which is what will be displayed in the
1265 % outline by the pdf viewer. #2 is the pdf expression for the number
1266 % of subentries (or empty, for subsubsections). #3 is the node text,
1267 % which might be empty if this toc entry had no corresponding node.
1268 % #4 is the page number
1269 %
1270 \def\dopdfoutline#1#2#3#4{%
1271 % Generate a link to the node text if that exists; else, use the
1272 % page number. We could generate a destination for the section
1273 % text in the case where a section has no node, but it doesn't
1274 % seem worth the trouble, since most documents are normally structured.
1275 \edef\pdfoutlinedest{#3}%
1276 \ifx\pdfoutlinedest\empty
1277 \def\pdfoutlinedest{#4}%
1278 \else
1279 \txiescapepdf\pdfoutlinedest
1280 \fi
1281 %
1282 % Also escape PDF chars in the display string.
1283 \edef\pdfoutlinetext{#1}%
1284 \txiescapepdf\pdfoutlinetext
1285 %
1286 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1287 }
1288 %
1289 \def\pdfmakeoutlines{%
1290 \begingroup
1291 % Read toc silently, to get counts of subentries for \pdfoutline.
1292 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1293 \def\numchapentry##1##2##3##4{%
1294 \def\thischapnum{##2}%
1295 \def\thissecnum{0}%
1296 \def\thissubsecnum{0}%
1297 }%
1298 \def\numsecentry##1##2##3##4{%
1299 \advancenumber{chap\thischapnum}%
1300 \def\thissecnum{##2}%
1301 \def\thissubsecnum{0}%
1302 }%
1303 \def\numsubsecentry##1##2##3##4{%
1304 \advancenumber{sec\thissecnum}%
1305 \def\thissubsecnum{##2}%
1306 }%
1307 \def\numsubsubsecentry##1##2##3##4{%
1308 \advancenumber{subsec\thissubsecnum}%
1309 }%
1310 \def\thischapnum{0}%
1311 \def\thissecnum{0}%
1312 \def\thissubsecnum{0}%
1313 %
1314 % use \def rather than \let here because we redefine \chapentry et
1315 % al. a second time, below.
1316 \def\appentry{\numchapentry}%
1317 \def\appsecentry{\numsecentry}%
1318 \def\appsubsecentry{\numsubsecentry}%
1319 \def\appsubsubsecentry{\numsubsubsecentry}%
1320 \def\unnchapentry{\numchapentry}%
1321 \def\unnsecentry{\numsecentry}%
1322 \def\unnsubsecentry{\numsubsecentry}%
1323 \def\unnsubsubsecentry{\numsubsubsecentry}%
1324 \readdatafile{toc}%
1325 %
1326 % Read toc second time, this time actually producing the outlines.
1327 % The `-' means take the \expnumber as the absolute number of
1328 % subentries, which we calculated on our first read of the .toc above.
1329 %
1330 % We use the node names as the destinations.
1331 \def\numchapentry##1##2##3##4{%
1332 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1333 \def\numsecentry##1##2##3##4{%
1334 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1335 \def\numsubsecentry##1##2##3##4{%
1336 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1337 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1338 \dopdfoutline{##1}{}{##3}{##4}}%
1339 %
1340 % PDF outlines are displayed using system fonts, instead of
1341 % document fonts. Therefore we cannot use special characters,
1342 % since the encoding is unknown. For example, the eogonek from
1343 % Latin 2 (0xea) gets translated to a | character. Info from
1344 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1345 %
1346 % TODO this right, we have to translate 8-bit characters to
1347 % their "best" equivalent, based on the @documentencoding. Too
1348 % much work for too little return. Just use the ASCII equivalents
1349 % we use for the index sort strings.
1350 %
1351 \indexnofonts
1352 \setupdatafile
1353 % We can have normal brace characters in the PDF outlines, unlike
1354 % Texinfo index files. So set that up.
1355 \def\{{\lbracecharliteral}%
1356 \def\}{\rbracecharliteral}%
1357 \catcode`\\=\active \otherbackslash
1358 \input \tocreadfilename
1359 \endgroup
1360 }
1361 {\catcode`[=1 \catcode`]=2
1362 \catcode`{=\other \catcode`}=\other
1363 \gdef\lbracecharliteral[{]%
1364 \gdef\rbracecharliteral[}]%
1365 ]
1366 %
1367 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1368 \ifx\PP\D\let\nextsp\relax
1369 \else\let\nextsp\skipspaces
1370 \addtokens{\filename}{\PP}%
1371 \advance\filenamelength by 1
1372 \fi
1373 \nextsp}
1374 \def\getfilename#1{%
1375 \filenamelength=0
1376 % If we don't expand the argument now, \skipspaces will get
1377 % snagged on things like "@value{foo}".
1378 \edef\temp{#1}%
1379 \expandafter\skipspaces\temp|\relax
1380 }
1381 \ifnum\pdftexversion < 14
1382 \let \startlink \pdfannotlink
1383 \else
1384 \let \startlink \pdfstartlink
1385 \fi
1386 % make a live url in pdf output.
1387 \def\pdfurl#1{%
1388 \begingroup
1389 % it seems we really need yet another set of dummies; have not
1390 % tried to figure out what each command should do in the context
1391 % of @url. for now, just make @/ a no-op, that's the only one
1392 % people have actually reported a problem with.
1393 %
1394 \normalturnoffactive
1395 \def\@{@}%
1396 \let\/=\empty
1397 \makevalueexpandable
1398 % do we want to go so far as to use \indexnofonts instead of just
1399 % special-casing \var here?
1400 \def\var##1{##1}%
1401 %
1402 \leavevmode\setcolor{\urlcolor}%
1403 \startlink attr{/Border [0 0 0]}%
1404 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1405 \endgroup}
1406 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1407 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1408 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1409 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1410 \def\maketoks{%
1411 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1412 \ifx\first0\adn0
1413 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1414 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1415 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1416 \else
1417 \ifnum0=\countA\else\makelink\fi
1418 \ifx\first.\let\next=\done\else
1419 \let\next=\maketoks
1420 \addtokens{\toksB}{\the\toksD}
1421 \ifx\first,\addtokens{\toksB}{\space}\fi
1422 \fi
1423 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1424 \next}
1425 \def\makelink{\addtokens{\toksB}%
1426 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1427 \def\pdflink#1{%
1428 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1429 \setcolor{\linkcolor}#1\endlink}
1430 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1431 \else
1432 % non-pdf mode
1433 \let\pdfmkdest = \gobble
1434 \let\pdfurl = \gobble
1435 \let\endlink = \relax
1436 \let\setcolor = \gobble
1437 \let\pdfsetcolor = \gobble
1438 \let\pdfmakeoutlines = \relax
1439 \fi % \ifx\pdfoutput
1440
1441
1442 \message{fonts,}
1443
1444 % Change the current font style to #1, remembering it in \curfontstyle.
1445 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1446 % italics, not bold italics.
1447 %
1448 \def\setfontstyle#1{%
1449 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1450 \csname ten#1\endcsname % change the current font
1451 }
1452
1453 % Select #1 fonts with the current style.
1454 %
1455 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1456
1457 \def\rm{\fam=0 \setfontstyle{rm}}
1458 \def\it{\fam=\itfam \setfontstyle{it}}
1459 \def\sl{\fam=\slfam \setfontstyle{sl}}
1460 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1461 \def\tt{\fam=\ttfam \setfontstyle{tt}}
1462
1463 % Unfortunately, we have to override this for titles and the like, since
1464 % in those cases "rm" is bold. Sigh.
1465 \def\rmisbold{\rm\def\curfontstyle{bf}}
1466
1467 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1468 % So we set up a \sf.
1469 \newfam\sffam
1470 \def\sf{\fam=\sffam \setfontstyle{sf}}
1471 \let\li = \sf % Sometimes we call it \li, not \sf.
1472
1473 % We don't need math for this font style.
1474 \def\ttsl{\setfontstyle{ttsl}}
1475
1476
1477 % Set the baselineskip to #1, and the lineskip and strut size
1478 % correspondingly. There is no deep meaning behind these magic numbers
1479 % used as factors; they just match (closely enough) what Knuth defined.
1480 %
1481 \def\lineskipfactor{.08333}
1482 \def\strutheightpercent{.70833}
1483 \def\strutdepthpercent {.29167}
1484 %
1485 % can get a sort of poor man's double spacing by redefining this.
1486 \def\baselinefactor{1}
1487 %
1488 \newdimen\textleading
1489 \def\setleading#1{%
1490 \dimen0 = #1\relax
1491 \normalbaselineskip = \baselinefactor\dimen0
1492 \normallineskip = \lineskipfactor\normalbaselineskip
1493 \normalbaselines
1494 \setbox\strutbox =\hbox{%
1495 \vrule width0pt height\strutheightpercent\baselineskip
1496 depth \strutdepthpercent \baselineskip
1497 }%
1498 }
1499
1500 % PDF CMaps. See also LaTeX's t1.cmap.
1501 %
1502 % do nothing with this by default.
1503 \expandafter\let\csname cmapOT1\endcsname\gobble
1504 \expandafter\let\csname cmapOT1IT\endcsname\gobble
1505 \expandafter\let\csname cmapOT1TT\endcsname\gobble
1506
1507 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1508 % (\pdffontattr was introduced many years ago, but people still run
1509 % older pdftex's; it's easy to conditionalize, so we do.)
1510 \ifpdf \ifx\pdffontattr\thisisundefined \else
1511 \begingroup
1512 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1513 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1514 %%DocumentNeededResources: ProcSet (CIDInit)
1515 %%IncludeResource: ProcSet (CIDInit)
1516 %%BeginResource: CMap (TeX-OT1-0)
1517 %%Title: (TeX-OT1-0 TeX OT1 0)
1518 %%Version: 1.000
1519 %%EndComments
1520 /CIDInit /ProcSet findresource begin
1521 12 dict begin
1522 begincmap
1523 /CIDSystemInfo
1524 << /Registry (TeX)
1525 /Ordering (OT1)
1526 /Supplement 0
1527 >> def
1528 /CMapName /TeX-OT1-0 def
1529 /CMapType 2 def
1530 1 begincodespacerange
1531 <00> <7F>
1532 endcodespacerange
1533 8 beginbfrange
1534 <00> <01> <0393>
1535 <09> <0A> <03A8>
1536 <23> <26> <0023>
1537 <28> <3B> <0028>
1538 <3F> <5B> <003F>
1539 <5D> <5E> <005D>
1540 <61> <7A> <0061>
1541 <7B> <7C> <2013>
1542 endbfrange
1543 40 beginbfchar
1544 <02> <0398>
1545 <03> <039B>
1546 <04> <039E>
1547 <05> <03A0>
1548 <06> <03A3>
1549 <07> <03D2>
1550 <08> <03A6>
1551 <0B> <00660066>
1552 <0C> <00660069>
1553 <0D> <0066006C>
1554 <0E> <006600660069>
1555 <0F> <00660066006C>
1556 <10> <0131>
1557 <11> <0237>
1558 <12> <0060>
1559 <13> <00B4>
1560 <14> <02C7>
1561 <15> <02D8>
1562 <16> <00AF>
1563 <17> <02DA>
1564 <18> <00B8>
1565 <19> <00DF>
1566 <1A> <00E6>
1567 <1B> <0153>
1568 <1C> <00F8>
1569 <1D> <00C6>
1570 <1E> <0152>
1571 <1F> <00D8>
1572 <21> <0021>
1573 <22> <201D>
1574 <27> <2019>
1575 <3C> <00A1>
1576 <3D> <003D>
1577 <3E> <00BF>
1578 <5C> <201C>
1579 <5F> <02D9>
1580 <60> <2018>
1581 <7D> <02DD>
1582 <7E> <007E>
1583 <7F> <00A8>
1584 endbfchar
1585 endcmap
1586 CMapName currentdict /CMap defineresource pop
1587 end
1588 end
1589 %%EndResource
1590 %%EOF
1591 }\endgroup
1592 \expandafter\edef\csname cmapOT1\endcsname#1{%
1593 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1594 }%
1595 %
1596 % \cmapOT1IT
1597 \begingroup
1598 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1599 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1600 %%DocumentNeededResources: ProcSet (CIDInit)
1601 %%IncludeResource: ProcSet (CIDInit)
1602 %%BeginResource: CMap (TeX-OT1IT-0)
1603 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1604 %%Version: 1.000
1605 %%EndComments
1606 /CIDInit /ProcSet findresource begin
1607 12 dict begin
1608 begincmap
1609 /CIDSystemInfo
1610 << /Registry (TeX)
1611 /Ordering (OT1IT)
1612 /Supplement 0
1613 >> def
1614 /CMapName /TeX-OT1IT-0 def
1615 /CMapType 2 def
1616 1 begincodespacerange
1617 <00> <7F>
1618 endcodespacerange
1619 8 beginbfrange
1620 <00> <01> <0393>
1621 <09> <0A> <03A8>
1622 <25> <26> <0025>
1623 <28> <3B> <0028>
1624 <3F> <5B> <003F>
1625 <5D> <5E> <005D>
1626 <61> <7A> <0061>
1627 <7B> <7C> <2013>
1628 endbfrange
1629 42 beginbfchar
1630 <02> <0398>
1631 <03> <039B>
1632 <04> <039E>
1633 <05> <03A0>
1634 <06> <03A3>
1635 <07> <03D2>
1636 <08> <03A6>
1637 <0B> <00660066>
1638 <0C> <00660069>
1639 <0D> <0066006C>
1640 <0E> <006600660069>
1641 <0F> <00660066006C>
1642 <10> <0131>
1643 <11> <0237>
1644 <12> <0060>
1645 <13> <00B4>
1646 <14> <02C7>
1647 <15> <02D8>
1648 <16> <00AF>
1649 <17> <02DA>
1650 <18> <00B8>
1651 <19> <00DF>
1652 <1A> <00E6>
1653 <1B> <0153>
1654 <1C> <00F8>
1655 <1D> <00C6>
1656 <1E> <0152>
1657 <1F> <00D8>
1658 <21> <0021>
1659 <22> <201D>
1660 <23> <0023>
1661 <24> <00A3>
1662 <27> <2019>
1663 <3C> <00A1>
1664 <3D> <003D>
1665 <3E> <00BF>
1666 <5C> <201C>
1667 <5F> <02D9>
1668 <60> <2018>
1669 <7D> <02DD>
1670 <7E> <007E>
1671 <7F> <00A8>
1672 endbfchar
1673 endcmap
1674 CMapName currentdict /CMap defineresource pop
1675 end
1676 end
1677 %%EndResource
1678 %%EOF
1679 }\endgroup
1680 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1681 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1682 }%
1683 %
1684 % \cmapOT1TT
1685 \begingroup
1686 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1687 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1688 %%DocumentNeededResources: ProcSet (CIDInit)
1689 %%IncludeResource: ProcSet (CIDInit)
1690 %%BeginResource: CMap (TeX-OT1TT-0)
1691 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1692 %%Version: 1.000
1693 %%EndComments
1694 /CIDInit /ProcSet findresource begin
1695 12 dict begin
1696 begincmap
1697 /CIDSystemInfo
1698 << /Registry (TeX)
1699 /Ordering (OT1TT)
1700 /Supplement 0
1701 >> def
1702 /CMapName /TeX-OT1TT-0 def
1703 /CMapType 2 def
1704 1 begincodespacerange
1705 <00> <7F>
1706 endcodespacerange
1707 5 beginbfrange
1708 <00> <01> <0393>
1709 <09> <0A> <03A8>
1710 <21> <26> <0021>
1711 <28> <5F> <0028>
1712 <61> <7E> <0061>
1713 endbfrange
1714 32 beginbfchar
1715 <02> <0398>
1716 <03> <039B>
1717 <04> <039E>
1718 <05> <03A0>
1719 <06> <03A3>
1720 <07> <03D2>
1721 <08> <03A6>
1722 <0B> <2191>
1723 <0C> <2193>
1724 <0D> <0027>
1725 <0E> <00A1>
1726 <0F> <00BF>
1727 <10> <0131>
1728 <11> <0237>
1729 <12> <0060>
1730 <13> <00B4>
1731 <14> <02C7>
1732 <15> <02D8>
1733 <16> <00AF>
1734 <17> <02DA>
1735 <18> <00B8>
1736 <19> <00DF>
1737 <1A> <00E6>
1738 <1B> <0153>
1739 <1C> <00F8>
1740 <1D> <00C6>
1741 <1E> <0152>
1742 <1F> <00D8>
1743 <20> <2423>
1744 <27> <2019>
1745 <60> <2018>
1746 <7F> <00A8>
1747 endbfchar
1748 endcmap
1749 CMapName currentdict /CMap defineresource pop
1750 end
1751 end
1752 %%EndResource
1753 %%EOF
1754 }\endgroup
1755 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1756 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1757 }%
1758 \fi\fi
1759
1760
1761 % Set the font macro #1 to the font named \fontprefix#2.
1762 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1763 % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
1764 % Example:
1765 % #1 = \textrm
1766 % #2 = \rmshape
1767 % #3 = 10
1768 % #4 = \mainmagstep
1769 % #5 = OT1
1770 %
1771 \def\setfont#1#2#3#4#5{%
1772 \font#1=\fontprefix#2#3 scaled #4
1773 \csname cmap#5\endcsname#1%
1774 }
1775 % This is what gets called when #5 of \setfont is empty.
1776 \let\cmap\gobble
1777 %
1778 % (end of cmaps)
1779
1780 % Use cm as the default font prefix.
1781 % To specify the font prefix, you must define \fontprefix
1782 % before you read in texinfo.tex.
1783 \ifx\fontprefix\thisisundefined
1784 \def\fontprefix{cm}
1785 \fi
1786 % Support font families that don't use the same naming scheme as CM.
1787 \def\rmshape{r}
1788 \def\rmbshape{bx} % where the normal face is bold
1789 \def\bfshape{b}
1790 \def\bxshape{bx}
1791 \def\ttshape{tt}
1792 \def\ttbshape{tt}
1793 \def\ttslshape{sltt}
1794 \def\itshape{ti}
1795 \def\itbshape{bxti}
1796 \def\slshape{sl}
1797 \def\slbshape{bxsl}
1798 \def\sfshape{ss}
1799 \def\sfbshape{ss}
1800 \def\scshape{csc}
1801 \def\scbshape{csc}
1802
1803 % Definitions for a main text size of 11pt. (The default in Texinfo.)
1804 %
1805 \def\definetextfontsizexi{%
1806 % Text fonts (11.2pt, magstep1).
1807 \def\textnominalsize{11pt}
1808 \edef\mainmagstep{\magstephalf}
1809 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1810 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1811 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1812 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1813 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1814 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1815 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1816 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1817 \font\texti=cmmi10 scaled \mainmagstep
1818 \font\textsy=cmsy10 scaled \mainmagstep
1819 \def\textecsize{1095}
1820
1821 % A few fonts for @defun names and args.
1822 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
1823 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1824 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1825 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1826
1827 % Fonts for indices, footnotes, small examples (9pt).
1828 \def\smallnominalsize{9pt}
1829 \setfont\smallrm\rmshape{9}{1000}{OT1}
1830 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1831 \setfont\smallbf\bfshape{10}{900}{OT1}
1832 \setfont\smallit\itshape{9}{1000}{OT1IT}
1833 \setfont\smallsl\slshape{9}{1000}{OT1}
1834 \setfont\smallsf\sfshape{9}{1000}{OT1}
1835 \setfont\smallsc\scshape{10}{900}{OT1}
1836 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1837 \font\smalli=cmmi9
1838 \font\smallsy=cmsy9
1839 \def\smallecsize{0900}
1840
1841 % Fonts for small examples (8pt).
1842 \def\smallernominalsize{8pt}
1843 \setfont\smallerrm\rmshape{8}{1000}{OT1}
1844 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
1845 \setfont\smallerbf\bfshape{10}{800}{OT1}
1846 \setfont\smallerit\itshape{8}{1000}{OT1IT}
1847 \setfont\smallersl\slshape{8}{1000}{OT1}
1848 \setfont\smallersf\sfshape{8}{1000}{OT1}
1849 \setfont\smallersc\scshape{10}{800}{OT1}
1850 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1851 \font\smalleri=cmmi8
1852 \font\smallersy=cmsy8
1853 \def\smallerecsize{0800}
1854
1855 % Fonts for title page (20.4pt):
1856 \def\titlenominalsize{20pt}
1857 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1858 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1859 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1860 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1861 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1862 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1863 \let\titlebf=\titlerm
1864 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1865 \font\titlei=cmmi12 scaled \magstep3
1866 \font\titlesy=cmsy10 scaled \magstep4
1867 \def\titleecsize{2074}
1868
1869 % Chapter (and unnumbered) fonts (17.28pt).
1870 \def\chapnominalsize{17pt}
1871 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
1872 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
1873 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
1874 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
1875 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
1876 \setfont\chapsf\sfbshape{17}{1000}{OT1}
1877 \let\chapbf=\chaprm
1878 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
1879 \font\chapi=cmmi12 scaled \magstep2
1880 \font\chapsy=cmsy10 scaled \magstep3
1881 \def\chapecsize{1728}
1882
1883 % Section fonts (14.4pt).
1884 \def\secnominalsize{14pt}
1885 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
1886 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
1887 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
1888 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
1889 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
1890 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
1891 \let\secbf\secrm
1892 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
1893 \font\seci=cmmi12 scaled \magstep1
1894 \font\secsy=cmsy10 scaled \magstep2
1895 \def\sececsize{1440}
1896
1897 % Subsection fonts (13.15pt).
1898 \def\ssecnominalsize{13pt}
1899 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
1900 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
1901 \setfont\ssecsl\slbshape{10}{1315}{OT1}
1902 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
1903 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
1904 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
1905 \let\ssecbf\ssecrm
1906 \setfont\ssecsc\scbshape{10}{1315}{OT1}
1907 \font\sseci=cmmi12 scaled \magstephalf
1908 \font\ssecsy=cmsy10 scaled 1315
1909 \def\ssececsize{1200}
1910
1911 % Reduced fonts for @acro in text (10pt).
1912 \def\reducednominalsize{10pt}
1913 \setfont\reducedrm\rmshape{10}{1000}{OT1}
1914 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
1915 \setfont\reducedbf\bfshape{10}{1000}{OT1}
1916 \setfont\reducedit\itshape{10}{1000}{OT1IT}
1917 \setfont\reducedsl\slshape{10}{1000}{OT1}
1918 \setfont\reducedsf\sfshape{10}{1000}{OT1}
1919 \setfont\reducedsc\scshape{10}{1000}{OT1}
1920 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
1921 \font\reducedi=cmmi10
1922 \font\reducedsy=cmsy10
1923 \def\reducedecsize{1000}
1924
1925 \textleading = 13.2pt % line spacing for 11pt CM
1926 \textfonts % reset the current fonts
1927 \rm
1928 } % end of 11pt text font size definitions, \definetextfontsizexi
1929
1930
1931 % Definitions to make the main text be 10pt Computer Modern, with
1932 % section, chapter, etc., sizes following suit. This is for the GNU
1933 % Press printing of the Emacs 22 manual. Maybe other manuals in the
1934 % future. Used with @smallbook, which sets the leading to 12pt.
1935 %
1936 \def\definetextfontsizex{%
1937 % Text fonts (10pt).
1938 \def\textnominalsize{10pt}
1939 \edef\mainmagstep{1000}
1940 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1941 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1942 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1943 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1944 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1945 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1946 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1947 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1948 \font\texti=cmmi10 scaled \mainmagstep
1949 \font\textsy=cmsy10 scaled \mainmagstep
1950 \def\textecsize{1000}
1951
1952 % A few fonts for @defun names and args.
1953 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
1954 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
1955 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
1956 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1957
1958 % Fonts for indices, footnotes, small examples (9pt).
1959 \def\smallnominalsize{9pt}
1960 \setfont\smallrm\rmshape{9}{1000}{OT1}
1961 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1962 \setfont\smallbf\bfshape{10}{900}{OT1}
1963 \setfont\smallit\itshape{9}{1000}{OT1IT}
1964 \setfont\smallsl\slshape{9}{1000}{OT1}
1965 \setfont\smallsf\sfshape{9}{1000}{OT1}
1966 \setfont\smallsc\scshape{10}{900}{OT1}
1967 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1968 \font\smalli=cmmi9
1969 \font\smallsy=cmsy9
1970 \def\smallecsize{0900}
1971
1972 % Fonts for small examples (8pt).
1973 \def\smallernominalsize{8pt}
1974 \setfont\smallerrm\rmshape{8}{1000}{OT1}
1975 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
1976 \setfont\smallerbf\bfshape{10}{800}{OT1}
1977 \setfont\smallerit\itshape{8}{1000}{OT1IT}
1978 \setfont\smallersl\slshape{8}{1000}{OT1}
1979 \setfont\smallersf\sfshape{8}{1000}{OT1}
1980 \setfont\smallersc\scshape{10}{800}{OT1}
1981 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1982 \font\smalleri=cmmi8
1983 \font\smallersy=cmsy8
1984 \def\smallerecsize{0800}
1985
1986 % Fonts for title page (20.4pt):
1987 \def\titlenominalsize{20pt}
1988 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1989 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1990 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1991 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1992 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1993 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1994 \let\titlebf=\titlerm
1995 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1996 \font\titlei=cmmi12 scaled \magstep3
1997 \font\titlesy=cmsy10 scaled \magstep4
1998 \def\titleecsize{2074}
1999
2000 % Chapter fonts (14.4pt).
2001 \def\chapnominalsize{14pt}
2002 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2003 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2004 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2005 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2006 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2007 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2008 \let\chapbf\chaprm
2009 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2010 \font\chapi=cmmi12 scaled \magstep1
2011 \font\chapsy=cmsy10 scaled \magstep2
2012 \def\chapecsize{1440}
2013
2014 % Section fonts (12pt).
2015 \def\secnominalsize{12pt}
2016 \setfont\secrm\rmbshape{12}{1000}{OT1}
2017 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2018 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2019 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2020 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2021 \setfont\secsf\sfbshape{12}{1000}{OT1}
2022 \let\secbf\secrm
2023 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2024 \font\seci=cmmi12
2025 \font\secsy=cmsy10 scaled \magstep1
2026 \def\sececsize{1200}
2027
2028 % Subsection fonts (10pt).
2029 \def\ssecnominalsize{10pt}
2030 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2031 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2032 \setfont\ssecsl\slbshape{10}{1000}{OT1}
2033 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2034 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2035 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2036 \let\ssecbf\ssecrm
2037 \setfont\ssecsc\scbshape{10}{1000}{OT1}
2038 \font\sseci=cmmi10
2039 \font\ssecsy=cmsy10
2040 \def\ssececsize{1000}
2041
2042 % Reduced fonts for @acro in text (9pt).
2043 \def\reducednominalsize{9pt}
2044 \setfont\reducedrm\rmshape{9}{1000}{OT1}
2045 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2046 \setfont\reducedbf\bfshape{10}{900}{OT1}
2047 \setfont\reducedit\itshape{9}{1000}{OT1IT}
2048 \setfont\reducedsl\slshape{9}{1000}{OT1}
2049 \setfont\reducedsf\sfshape{9}{1000}{OT1}
2050 \setfont\reducedsc\scshape{10}{900}{OT1}
2051 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2052 \font\reducedi=cmmi9
2053 \font\reducedsy=cmsy9
2054 \def\reducedecsize{0900}
2055
2056 \divide\parskip by 2 % reduce space between paragraphs
2057 \textleading = 12pt % line spacing for 10pt CM
2058 \textfonts % reset the current fonts
2059 \rm
2060 } % end of 10pt text font size definitions, \definetextfontsizex
2061
2062
2063 % We provide the user-level command
2064 % @fonttextsize 10
2065 % (or 11) to redefine the text font size. pt is assumed.
2066 %
2067 \def\xiword{11}
2068 \def\xword{10}
2069 \def\xwordpt{10pt}
2070 %
2071 \parseargdef\fonttextsize{%
2072 \def\textsizearg{#1}%
2073 %\wlog{doing @fonttextsize \textsizearg}%
2074 %
2075 % Set \globaldefs so that documents can use this inside @tex, since
2076 % makeinfo 4.8 does not support it, but we need it nonetheless.
2077 %
2078 \begingroup \globaldefs=1
2079 \ifx\textsizearg\xword \definetextfontsizex
2080 \else \ifx\textsizearg\xiword \definetextfontsizexi
2081 \else
2082 \errhelp=\EMsimple
2083 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2084 \fi\fi
2085 \endgroup
2086 }
2087
2088
2089 % In order for the font changes to affect most math symbols and letters,
2090 % we have to define the \textfont of the standard families. Since
2091 % texinfo doesn't allow for producing subscripts and superscripts except
2092 % in the main text, we don't bother to reset \scriptfont and
2093 % \scriptscriptfont (which would also require loading a lot more fonts).
2094 %
2095 \def\resetmathfonts{%
2096 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2097 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2098 \textfont\ttfam=\tentt \textfont\sffam=\tensf
2099 }
2100
2101 % The font-changing commands redefine the meanings of \tenSTYLE, instead
2102 % of just \STYLE. We do this because \STYLE needs to also set the
2103 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2104 % \tenSTYLE to set the current font.
2105 %
2106 % Each font-changing command also sets the names \lsize (one size lower)
2107 % and \lllsize (three sizes lower). These relative commands are used in
2108 % the LaTeX logo and acronyms.
2109 %
2110 % This all needs generalizing, badly.
2111 %
2112 \def\textfonts{%
2113 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2114 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2115 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2116 \let\tenttsl=\textttsl
2117 \def\curfontsize{text}%
2118 \def\lsize{reduced}\def\lllsize{smaller}%
2119 \resetmathfonts \setleading{\textleading}}
2120 \def\titlefonts{%
2121 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2122 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2123 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2124 \let\tenttsl=\titlettsl
2125 \def\curfontsize{title}%
2126 \def\lsize{chap}\def\lllsize{subsec}%
2127 \resetmathfonts \setleading{27pt}}
2128 \def\titlefont#1{{\titlefonts\rmisbold #1}}
2129 \def\chapfonts{%
2130 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2131 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2132 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2133 \let\tenttsl=\chapttsl
2134 \def\curfontsize{chap}%
2135 \def\lsize{sec}\def\lllsize{text}%
2136 \resetmathfonts \setleading{19pt}}
2137 \def\secfonts{%
2138 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2139 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2140 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2141 \let\tenttsl=\secttsl
2142 \def\curfontsize{sec}%
2143 \def\lsize{subsec}\def\lllsize{reduced}%
2144 \resetmathfonts \setleading{16pt}}
2145 \def\subsecfonts{%
2146 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2147 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2148 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2149 \let\tenttsl=\ssecttsl
2150 \def\curfontsize{ssec}%
2151 \def\lsize{text}\def\lllsize{small}%
2152 \resetmathfonts \setleading{15pt}}
2153 \let\subsubsecfonts = \subsecfonts
2154 \def\reducedfonts{%
2155 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2156 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2157 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2158 \let\tenttsl=\reducedttsl
2159 \def\curfontsize{reduced}%
2160 \def\lsize{small}\def\lllsize{smaller}%
2161 \resetmathfonts \setleading{10.5pt}}
2162 \def\smallfonts{%
2163 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2164 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2165 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2166 \let\tenttsl=\smallttsl
2167 \def\curfontsize{small}%
2168 \def\lsize{smaller}\def\lllsize{smaller}%
2169 \resetmathfonts \setleading{10.5pt}}
2170 \def\smallerfonts{%
2171 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2172 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2173 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2174 \let\tenttsl=\smallerttsl
2175 \def\curfontsize{smaller}%
2176 \def\lsize{smaller}\def\lllsize{smaller}%
2177 \resetmathfonts \setleading{9.5pt}}
2178
2179 % Fonts for short table of contents.
2180 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2181 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2182 \setfont\shortcontsl\slshape{12}{1000}{OT1}
2183 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2184
2185 % Define these just so they can be easily changed for other fonts.
2186 \def\angleleft{$\langle$}
2187 \def\angleright{$\rangle$}
2188
2189 % Set the fonts to use with the @small... environments.
2190 \let\smallexamplefonts = \smallfonts
2191
2192 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2193 % can fit this many characters:
2194 % 8.5x11=86 smallbook=72 a4=90 a5=69
2195 % If we use \scriptfonts (8pt), then we can fit this many characters:
2196 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2197 % For me, subjectively, the few extra characters that fit aren't worth
2198 % the additional smallness of 8pt. So I'm making the default 9pt.
2199 %
2200 % By the way, for comparison, here's what fits with @example (10pt):
2201 % 8.5x11=71 smallbook=60 a4=75 a5=58
2202 % --karl, 24jan03.
2203
2204 % Set up the default fonts, so we can use them for creating boxes.
2205 %
2206 \definetextfontsizexi
2207
2208
2209 \message{markup,}
2210
2211 % Check if we are currently using a typewriter font. Since all the
2212 % Computer Modern typewriter fonts have zero interword stretch (and
2213 % shrink), and it is reasonable to expect all typewriter fonts to have
2214 % this property, we can check that font parameter.
2215 %
2216 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2217
2218 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2219 % define and register \INITMACRO to be called on markup style changes.
2220 % \INITMACRO can check \currentmarkupstyle for the innermost
2221 % style and the set of \ifmarkupSTYLE switches for all styles
2222 % currently in effect.
2223 \newif\ifmarkupvar
2224 \newif\ifmarkupsamp
2225 \newif\ifmarkupkey
2226 %\newif\ifmarkupfile % @file == @samp.
2227 %\newif\ifmarkupoption % @option == @samp.
2228 \newif\ifmarkupcode
2229 \newif\ifmarkupkbd
2230 %\newif\ifmarkupenv % @env == @code.
2231 %\newif\ifmarkupcommand % @command == @code.
2232 \newif\ifmarkuptex % @tex (and part of @math, for now).
2233 \newif\ifmarkupexample
2234 \newif\ifmarkupverb
2235 \newif\ifmarkupverbatim
2236
2237 \let\currentmarkupstyle\empty
2238
2239 \def\setupmarkupstyle#1{%
2240 \csname markup#1true\endcsname
2241 \def\currentmarkupstyle{#1}%
2242 \markupstylesetup
2243 }
2244
2245 \let\markupstylesetup\empty
2246
2247 \def\defmarkupstylesetup#1{%
2248 \expandafter\def\expandafter\markupstylesetup
2249 \expandafter{\markupstylesetup #1}%
2250 \def#1%
2251 }
2252
2253 % Markup style setup for left and right quotes.
2254 \defmarkupstylesetup\markupsetuplq{%
2255 \expandafter\let\expandafter \temp
2256 \csname markupsetuplq\currentmarkupstyle\endcsname
2257 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2258 }
2259
2260 \defmarkupstylesetup\markupsetuprq{%
2261 \expandafter\let\expandafter \temp
2262 \csname markupsetuprq\currentmarkupstyle\endcsname
2263 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2264 }
2265
2266 {
2267 \catcode`\'=\active
2268 \catcode`\`=\active
2269
2270 \gdef\markupsetuplqdefault{\let`\lq}
2271 \gdef\markupsetuprqdefault{\let'\rq}
2272
2273 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2274 \gdef\markupsetcodequoteright{\let'\codequoteright}
2275
2276 \gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
2277 }
2278
2279 \let\markupsetuplqcode \markupsetcodequoteleft
2280 \let\markupsetuprqcode \markupsetcodequoteright
2281 %
2282 \let\markupsetuplqexample \markupsetcodequoteleft
2283 \let\markupsetuprqexample \markupsetcodequoteright
2284 %
2285 \let\markupsetuplqsamp \markupsetcodequoteleft
2286 \let\markupsetuprqsamp \markupsetcodequoteright
2287 %
2288 \let\markupsetuplqverb \markupsetcodequoteleft
2289 \let\markupsetuprqverb \markupsetcodequoteright
2290 %
2291 \let\markupsetuplqverbatim \markupsetcodequoteleft
2292 \let\markupsetuprqverbatim \markupsetcodequoteright
2293
2294 \let\markupsetuplqkbd \markupsetnoligaturesquoteleft
2295
2296 % Allow an option to not use regular directed right quote/apostrophe
2297 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2298 % The undirected quote is ugly, so don't make it the default, but it
2299 % works for pasting with more pdf viewers (at least evince), the
2300 % lilypond developers report. xpdf does work with the regular 0x27.
2301 %
2302 \def\codequoteright{%
2303 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2304 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2305 '%
2306 \else \char'15 \fi
2307 \else \char'15 \fi
2308 }
2309 %
2310 % and a similar option for the left quote char vs. a grave accent.
2311 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2312 % the code environments to do likewise.
2313 %
2314 \def\codequoteleft{%
2315 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2316 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2317 % [Knuth] pp. 380,381,391
2318 % \relax disables Spanish ligatures ?` and !` of \tt font.
2319 \relax`%
2320 \else \char'22 \fi
2321 \else \char'22 \fi
2322 }
2323
2324 % Commands to set the quote options.
2325 %
2326 \parseargdef\codequoteundirected{%
2327 \def\temp{#1}%
2328 \ifx\temp\onword
2329 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2330 = t%
2331 \else\ifx\temp\offword
2332 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2333 = \relax
2334 \else
2335 \errhelp = \EMsimple
2336 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2337 \fi\fi
2338 }
2339 %
2340 \parseargdef\codequotebacktick{%
2341 \def\temp{#1}%
2342 \ifx\temp\onword
2343 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2344 = t%
2345 \else\ifx\temp\offword
2346 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2347 = \relax
2348 \else
2349 \errhelp = \EMsimple
2350 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2351 \fi\fi
2352 }
2353
2354 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2355 \def\noligaturesquoteleft{\relax\lq}
2356
2357 % Count depth in font-changes, for error checks
2358 \newcount\fontdepth \fontdepth=0
2359
2360 % Font commands.
2361
2362 % #1 is the font command (\sl or \it), #2 is the text to slant.
2363 % If we are in a monospaced environment, however, 1) always use \ttsl,
2364 % and 2) do not add an italic correction.
2365 \def\dosmartslant#1#2{%
2366 \ifusingtt
2367 {{\ttsl #2}\let\next=\relax}%
2368 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2369 \next
2370 }
2371 \def\smartslanted{\dosmartslant\sl}
2372 \def\smartitalic{\dosmartslant\it}
2373
2374 % Output an italic correction unless \next (presumed to be the following
2375 % character) is such as not to need one.
2376 \def\smartitaliccorrection{%
2377 \ifx\next,%
2378 \else\ifx\next-%
2379 \else\ifx\next.%
2380 \else\ptexslash
2381 \fi\fi\fi
2382 \aftersmartic
2383 }
2384
2385 % like \smartslanted except unconditionally uses \ttsl, and no ic.
2386 % @var is set to this for defun arguments.
2387 \def\ttslanted#1{{\ttsl #1}}
2388
2389 % @cite is like \smartslanted except unconditionally use \sl. We never want
2390 % ttsl for book titles, do we?
2391 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2392
2393 \def\aftersmartic{}
2394 \def\var#1{%
2395 \let\saveaftersmartic = \aftersmartic
2396 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2397 \smartslanted{#1}%
2398 }
2399
2400 \let\i=\smartitalic
2401 \let\slanted=\smartslanted
2402 \let\dfn=\smartslanted
2403 \let\emph=\smartitalic
2404
2405 % Explicit font changes: @r, @sc, undocumented @ii.
2406 \def\r#1{{\rm #1}} % roman font
2407 \def\sc#1{{\smallcaps#1}} % smallcaps font
2408 \def\ii#1{{\it #1}} % italic font
2409
2410 % @b, explicit bold. Also @strong.
2411 \def\b#1{{\bf #1}}
2412 \let\strong=\b
2413
2414 % @sansserif, explicit sans.
2415 \def\sansserif#1{{\sf #1}}
2416
2417 % We can't just use \exhyphenpenalty, because that only has effect at
2418 % the end of a paragraph. Restore normal hyphenation at the end of the
2419 % group within which \nohyphenation is presumably called.
2420 %
2421 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2422 \def\restorehyphenation{\hyphenchar\font = `- }
2423
2424 % Set sfcode to normal for the chars that usually have another value.
2425 % Can't use plain's \frenchspacing because it uses the `\x notation, and
2426 % sometimes \x has an active definition that messes things up.
2427 %
2428 \catcode`@=11
2429 \def\plainfrenchspacing{%
2430 \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
2431 \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
2432 \def\endofsentencespacefactor{1000}% for @. and friends
2433 }
2434 \def\plainnonfrenchspacing{%
2435 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2436 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2437 \def\endofsentencespacefactor{3000}% for @. and friends
2438 }
2439 \catcode`@=\other
2440 \def\endofsentencespacefactor{3000}% default
2441
2442 % @t, explicit typewriter.
2443 \def\t#1{%
2444 {\tt \rawbackslash \plainfrenchspacing #1}%
2445 \null
2446 }
2447
2448 % @samp.
2449 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2450
2451 % definition of @key that produces a lozenge. Doesn't adjust to text size.
2452 %\setfont\keyrm\rmshape{8}{1000}{OT1}
2453 %\font\keysy=cmsy9
2454 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2455 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2456 % \vbox{\hrule\kern-0.4pt
2457 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2458 % \kern-0.4pt\hrule}%
2459 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2460
2461 % definition of @key with no lozenge. If the current font is already
2462 % monospace, don't change it; that way, we respect @kbdinputstyle. But
2463 % if it isn't monospace, then use \tt.
2464 %
2465 \def\key#1{{\setupmarkupstyle{key}%
2466 \nohyphenation
2467 \ifmonospace\else\tt\fi
2468 #1}\null}
2469
2470 % ctrl is no longer a Texinfo command.
2471 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
2472
2473 % @file, @option are the same as @samp.
2474 \let\file=\samp
2475 \let\option=\samp
2476
2477 % @code is a modification of @t,
2478 % which makes spaces the same size as normal in the surrounding text.
2479 \def\tclose#1{%
2480 {%
2481 % Change normal interword space to be same as for the current font.
2482 \spaceskip = \fontdimen2\font
2483 %
2484 % Switch to typewriter.
2485 \tt
2486 %
2487 % But `\ ' produces the large typewriter interword space.
2488 \def\ {{\spaceskip = 0pt{} }}%
2489 %
2490 % Turn off hyphenation.
2491 \nohyphenation
2492 %
2493 \rawbackslash
2494 \plainfrenchspacing
2495 #1%
2496 }%
2497 \null % reset spacefactor to 1000
2498 }
2499
2500 % We *must* turn on hyphenation at `-' and `_' in @code.
2501 % Otherwise, it is too hard to avoid overfull hboxes
2502 % in the Emacs manual, the Library manual, etc.
2503
2504 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2505 % both hyphenation at - and hyphenation within words.
2506 % We must therefore turn them both off (\tclose does that)
2507 % and arrange explicitly to hyphenate at a dash.
2508 % -- rms.
2509 {
2510 \catcode`\-=\active \catcode`\_=\active
2511 \catcode`\'=\active \catcode`\`=\active
2512 \global\let'=\rq \global\let`=\lq % default definitions
2513 %
2514 \global\def\code{\begingroup
2515 \setupmarkupstyle{code}%
2516 % The following should really be moved into \setupmarkupstyle handlers.
2517 \catcode\dashChar=\active \catcode\underChar=\active
2518 \ifallowcodebreaks
2519 \let-\codedash
2520 \let_\codeunder
2521 \else
2522 \let-\realdash
2523 \let_\realunder
2524 \fi
2525 \codex
2526 }
2527 }
2528
2529 \def\codex #1{\tclose{#1}\endgroup}
2530
2531 \def\realdash{-}
2532 \def\codedash{-\discretionary{}{}{}}
2533 \def\codeunder{%
2534 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2535 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2536 % will therefore expand the active definition of _, which is us
2537 % (inside @code that is), therefore an endless loop.
2538 \ifusingtt{\ifmmode
2539 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2540 \else\normalunderscore \fi
2541 \discretionary{}{}{}}%
2542 {\_}%
2543 }
2544
2545 % An additional complication: the above will allow breaks after, e.g.,
2546 % each of the four underscores in __typeof__. This is undesirable in
2547 % some manuals, especially if they don't have long identifiers in
2548 % general. @allowcodebreaks provides a way to control this.
2549 %
2550 \newif\ifallowcodebreaks \allowcodebreakstrue
2551
2552 \def\keywordtrue{true}
2553 \def\keywordfalse{false}
2554
2555 \parseargdef\allowcodebreaks{%
2556 \def\txiarg{#1}%
2557 \ifx\txiarg\keywordtrue
2558 \allowcodebreakstrue
2559 \else\ifx\txiarg\keywordfalse
2560 \allowcodebreaksfalse
2561 \else
2562 \errhelp = \EMsimple
2563 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2564 \fi\fi
2565 }
2566
2567 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
2568 % second argument specifying the text to display and an optional third
2569 % arg as text to display instead of (rather than in addition to) the url
2570 % itself. First (mandatory) arg is the url.
2571 % (This \urefnobreak definition isn't used now, leaving it for a while
2572 % for comparison.)
2573 \def\urefnobreak#1{\dourefnobreak #1,,,\finish}
2574 \def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
2575 \unsepspaces
2576 \pdfurl{#1}%
2577 \setbox0 = \hbox{\ignorespaces #3}%
2578 \ifdim\wd0 > 0pt
2579 \unhbox0 % third arg given, show only that
2580 \else
2581 \setbox0 = \hbox{\ignorespaces #2}%
2582 \ifdim\wd0 > 0pt
2583 \ifpdf
2584 \unhbox0 % PDF: 2nd arg given, show only it
2585 \else
2586 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
2587 \fi
2588 \else
2589 \code{#1}% only url given, so show it
2590 \fi
2591 \fi
2592 \endlink
2593 \endgroup}
2594
2595 % This \urefbreak definition is the active one.
2596 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2597 \let\uref=\urefbreak
2598 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2599 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2600 \unsepspaces
2601 \pdfurl{#1}%
2602 \setbox0 = \hbox{\ignorespaces #3}%
2603 \ifdim\wd0 > 0pt
2604 \unhbox0 % third arg given, show only that
2605 \else
2606 \setbox0 = \hbox{\ignorespaces #2}%
2607 \ifdim\wd0 > 0pt
2608 \ifpdf
2609 \unhbox0 % PDF: 2nd arg given, show only it
2610 \else
2611 \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
2612 \fi
2613 \else
2614 \urefcode{#1}% only url given, so show it
2615 \fi
2616 \fi
2617 \endlink
2618 \endgroup}
2619
2620 % Allow line breaks around only a few characters (only).
2621 \def\urefcatcodes{%
2622 \catcode\ampChar=\active \catcode\dotChar=\active
2623 \catcode\hashChar=\active \catcode\questChar=\active
2624 \catcode\slashChar=\active
2625 }
2626 {
2627 \urefcatcodes
2628 %
2629 \global\def\urefcode{\begingroup
2630 \setupmarkupstyle{code}%
2631 \urefcatcodes
2632 \let&\urefcodeamp
2633 \let.\urefcodedot
2634 \let#\urefcodehash
2635 \let?\urefcodequest
2636 \let/\urefcodeslash
2637 \codex
2638 }
2639 %
2640 % By default, they are just regular characters.
2641 \global\def&{\normalamp}
2642 \global\def.{\normaldot}
2643 \global\def#{\normalhash}
2644 \global\def?{\normalquest}
2645 \global\def/{\normalslash}
2646 }
2647
2648 % we put a little stretch before and after the breakable chars, to help
2649 % line breaking of long url's. The unequal skips make look better in
2650 % cmtt at least, especially for dots.
2651 \def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
2652 \def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
2653 %
2654 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2655 \def\urefcodedot{\urefprestretch .\urefpoststretch}
2656 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
2657 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
2658 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2659 {
2660 \catcode`\/=\active
2661 \global\def\urefcodeslashfinish{%
2662 \urefprestretch \slashChar
2663 % Allow line break only after the final / in a sequence of
2664 % slashes, to avoid line break between the slashes in http://.
2665 \ifx\next/\else \urefpoststretch \fi
2666 }
2667 }
2668
2669 % One more complication: by default we'll break after the special
2670 % characters, but some people like to break before the special chars, so
2671 % allow that. Also allow no breaking at all, for manual control.
2672 %
2673 \parseargdef\urefbreakstyle{%
2674 \def\txiarg{#1}%
2675 \ifx\txiarg\wordnone
2676 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2677 \else\ifx\txiarg\wordbefore
2678 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2679 \else\ifx\txiarg\wordafter
2680 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2681 \else
2682 \errhelp = \EMsimple
2683 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2684 \fi\fi\fi
2685 }
2686 \def\wordafter{after}
2687 \def\wordbefore{before}
2688 \def\wordnone{none}
2689
2690 \urefbreakstyle after
2691
2692 % @url synonym for @uref, since that's how everyone uses it.
2693 %
2694 \let\url=\uref
2695
2696 % rms does not like angle brackets --karl, 17may97.
2697 % So now @email is just like @uref, unless we are pdf.
2698 %
2699 %\def\email#1{\angleleft{\tt #1}\angleright}
2700 \ifpdf
2701 \def\email#1{\doemail#1,,\finish}
2702 \def\doemail#1,#2,#3\finish{\begingroup
2703 \unsepspaces
2704 \pdfurl{mailto:#1}%
2705 \setbox0 = \hbox{\ignorespaces #2}%
2706 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2707 \endlink
2708 \endgroup}
2709 \else
2710 \let\email=\uref
2711 \fi
2712
2713 % @kbd is like @code, except that if the argument is just one @key command,
2714 % then @kbd has no effect.
2715 \def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
2716
2717 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2718 % `example' (@kbd uses ttsl only inside of @example and friends),
2719 % or `code' (@kbd uses normal tty font always).
2720 \parseargdef\kbdinputstyle{%
2721 \def\txiarg{#1}%
2722 \ifx\txiarg\worddistinct
2723 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2724 \else\ifx\txiarg\wordexample
2725 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2726 \else\ifx\txiarg\wordcode
2727 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2728 \else
2729 \errhelp = \EMsimple
2730 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2731 \fi\fi\fi
2732 }
2733 \def\worddistinct{distinct}
2734 \def\wordexample{example}
2735 \def\wordcode{code}
2736
2737 % Default is `distinct'.
2738 \kbdinputstyle distinct
2739
2740 \def\xkey{\key}
2741 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2742 \ifx\one\xkey\ifx\threex\three \key{#2}%
2743 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2744 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
2745
2746 % For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2747 \let\indicateurl=\code
2748 \let\env=\code
2749 \let\command=\code
2750
2751 % @clicksequence{File @click{} Open ...}
2752 \def\clicksequence#1{\begingroup #1\endgroup}
2753
2754 % @clickstyle @arrow (by default)
2755 \parseargdef\clickstyle{\def\click{#1}}
2756 \def\click{\arrow}
2757
2758 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2759 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2760 %
2761 \def\dmn#1{\thinspace #1}
2762
2763 % @l was never documented to mean ``switch to the Lisp font'',
2764 % and it is not used as such in any manual I can find. We need it for
2765 % Polish suppressed-l. --karl, 22sep96.
2766 %\def\l#1{{\li #1}\null}
2767
2768 % @acronym for "FBI", "NATO", and the like.
2769 % We print this one point size smaller, since it's intended for
2770 % all-uppercase.
2771 %
2772 \def\acronym#1{\doacronym #1,,\finish}
2773 \def\doacronym#1,#2,#3\finish{%
2774 {\selectfonts\lsize #1}%
2775 \def\temp{#2}%
2776 \ifx\temp\empty \else
2777 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2778 \fi
2779 \null % reset \spacefactor=1000
2780 }
2781
2782 % @abbr for "Comput. J." and the like.
2783 % No font change, but don't do end-of-sentence spacing.
2784 %
2785 \def\abbr#1{\doabbr #1,,\finish}
2786 \def\doabbr#1,#2,#3\finish{%
2787 {\plainfrenchspacing #1}%
2788 \def\temp{#2}%
2789 \ifx\temp\empty \else
2790 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2791 \fi
2792 \null % reset \spacefactor=1000
2793 }
2794
2795 % @asis just yields its argument. Used with @table, for example.
2796 %
2797 \def\asis#1{#1}
2798
2799 % @math outputs its argument in math mode.
2800 %
2801 % One complication: _ usually means subscripts, but it could also mean
2802 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
2803 % _ active, and distinguish by seeing if the current family is \slfam,
2804 % which is what @var uses.
2805 {
2806 \catcode`\_ = \active
2807 \gdef\mathunderscore{%
2808 \catcode`\_=\active
2809 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2810 }
2811 }
2812 % Another complication: we want \\ (and @\) to output a math (or tt) \.
2813 % FYI, plain.tex uses \\ as a temporary control sequence (for no
2814 % particular reason), but this is not advertised and we don't care.
2815 %
2816 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2817 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2818 %
2819 \def\math{%
2820 \tex
2821 \mathunderscore
2822 \let\\ = \mathbackslash
2823 \mathactive
2824 % make the texinfo accent commands work in math mode
2825 \let\"=\ddot
2826 \let\'=\acute
2827 \let\==\bar
2828 \let\^=\hat
2829 \let\`=\grave
2830 \let\u=\breve
2831 \let\v=\check
2832 \let\~=\tilde
2833 \let\dotaccent=\dot
2834 $\finishmath
2835 }
2836 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
2837
2838 % Some active characters (such as <) are spaced differently in math.
2839 % We have to reset their definitions in case the @math was an argument
2840 % to a command which sets the catcodes (such as @item or @section).
2841 %
2842 {
2843 \catcode`^ = \active
2844 \catcode`< = \active
2845 \catcode`> = \active
2846 \catcode`+ = \active
2847 \catcode`' = \active
2848 \gdef\mathactive{%
2849 \let^ = \ptexhat
2850 \let< = \ptexless
2851 \let> = \ptexgtr
2852 \let+ = \ptexplus
2853 \let' = \ptexquoteright
2854 }
2855 }
2856
2857 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
2858 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
2859 % except specified as a normal braced arg, so no newlines to worry about.
2860 %
2861 \def\outfmtnametex{tex}
2862 %
2863 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
2864 \long\def\doinlinefmt#1,#2,\finish{%
2865 \def\inlinefmtname{#1}%
2866 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
2867 }
2868 % For raw, must switch into @tex before parsing the argument, to avoid
2869 % setting catcodes prematurely. Doing it this way means that, for
2870 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
2871 % ignored. But this isn't important because if people want a literal
2872 % *right* brace they would have to use a command anyway, so they may as
2873 % well use a command to get a left brace too. We could re-use the
2874 % delimiter character idea from \verb, but it seems like overkill.
2875 %
2876 \long\def\inlineraw{\tex \doinlineraw}
2877 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
2878 \def\doinlinerawtwo#1,#2,\finish{%
2879 \def\inlinerawname{#1}%
2880 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
2881 \endgroup % close group opened by \tex.
2882 }
2883
2884
2885 \message{glyphs,}
2886 % and logos.
2887
2888 % @@ prints an @, as does @atchar{}.
2889 \def\@{\char64 }
2890 \let\atchar=\@
2891
2892 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
2893 % Unless we're in typewriter, use \ecfont because the CM text fonts do
2894 % not have braces, and we don't want to switch into math.
2895 \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
2896 \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
2897 \let\{=\mylbrace \let\lbracechar=\{
2898 \let\}=\myrbrace \let\rbracechar=\}
2899 \begingroup
2900 % Definitions to produce \{ and \} commands for indices,
2901 % and @{ and @} for the aux/toc files.
2902 \catcode`\{ = \other \catcode`\} = \other
2903 \catcode`\[ = 1 \catcode`\] = 2
2904 \catcode`\! = 0 \catcode`\\ = \other
2905 !gdef!lbracecmd[\{]%
2906 !gdef!rbracecmd[\}]%
2907 !gdef!lbraceatcmd[@{]%
2908 !gdef!rbraceatcmd[@}]%
2909 !endgroup
2910
2911 % @comma{} to avoid , parsing problems.
2912 \let\comma = ,
2913
2914 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
2915 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
2916 \let\, = \ptexc
2917 \let\dotaccent = \ptexdot
2918 \def\ringaccent#1{{\accent23 #1}}
2919 \let\tieaccent = \ptext
2920 \let\ubaraccent = \ptexb
2921 \let\udotaccent = \d
2922
2923 % Other special characters: @questiondown @exclamdown @ordf @ordm
2924 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
2925 \def\questiondown{?`}
2926 \def\exclamdown{!`}
2927 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
2928 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
2929
2930 % Dotless i and dotless j, used for accents.
2931 \def\imacro{i}
2932 \def\jmacro{j}
2933 \def\dotless#1{%
2934 \def\temp{#1}%
2935 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
2936 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
2937 \else \errmessage{@dotless can be used only with i or j}%
2938 \fi\fi
2939 }
2940
2941 % The \TeX{} logo, as in plain, but resetting the spacing so that a
2942 % period following counts as ending a sentence. (Idea found in latex.)
2943 %
2944 \edef\TeX{\TeX \spacefactor=1000 }
2945
2946 % @LaTeX{} logo. Not quite the same results as the definition in
2947 % latex.ltx, since we use a different font for the raised A; it's most
2948 % convenient for us to use an explicitly smaller font, rather than using
2949 % the \scriptstyle font (since we don't reset \scriptstyle and
2950 % \scriptscriptstyle).
2951 %
2952 \def\LaTeX{%
2953 L\kern-.36em
2954 {\setbox0=\hbox{T}%
2955 \vbox to \ht0{\hbox{%
2956 \ifx\textnominalsize\xwordpt
2957 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
2958 % Revert to plain's \scriptsize, which is 7pt.
2959 \count255=\the\fam $\fam\count255 \scriptstyle A$%
2960 \else
2961 % For 11pt, we can use our lllsize.
2962 \selectfonts\lllsize A%
2963 \fi
2964 }%
2965 \vss
2966 }}%
2967 \kern-.15em
2968 \TeX
2969 }
2970
2971 % Some math mode symbols.
2972 \def\bullet{$\ptexbullet$}
2973 \def\geq{\ifmmode \ge\else $\ge$\fi}
2974 \def\leq{\ifmmode \le\else $\le$\fi}
2975 \def\minus{\ifmmode -\else $-$\fi}
2976
2977 % @dots{} outputs an ellipsis using the current font.
2978 % We do .5em per period so that it has the same spacing in the cm
2979 % typewriter fonts as three actual period characters; on the other hand,
2980 % in other typewriter fonts three periods are wider than 1.5em. So do
2981 % whichever is larger.
2982 %
2983 \def\dots{%
2984 \leavevmode
2985 \setbox0=\hbox{...}% get width of three periods
2986 \ifdim\wd0 > 1.5em
2987 \dimen0 = \wd0
2988 \else
2989 \dimen0 = 1.5em
2990 \fi
2991 \hbox to \dimen0{%
2992 \hskip 0pt plus.25fil
2993 .\hskip 0pt plus1fil
2994 .\hskip 0pt plus1fil
2995 .\hskip 0pt plus.5fil
2996 }%
2997 }
2998
2999 % @enddots{} is an end-of-sentence ellipsis.
3000 %
3001 \def\enddots{%
3002 \dots
3003 \spacefactor=\endofsentencespacefactor
3004 }
3005
3006 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3007 %
3008 % Since these characters are used in examples, they should be an even number of
3009 % \tt widths. Each \tt character is 1en, so two makes it 1em.
3010 %
3011 \def\point{$\star$}
3012 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3013 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3014 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3015 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3016 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3017
3018 % The @error{} command.
3019 % Adapted from the TeXbook's \boxit.
3020 %
3021 \newbox\errorbox
3022 %
3023 {\tentt \global\dimen0 = 3em}% Width of the box.
3024 \dimen2 = .55pt % Thickness of rules
3025 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3026 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3027 %
3028 \setbox\errorbox=\hbox to \dimen0{\hfil
3029 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3030 \advance\hsize by -2\dimen2 % Rules.
3031 \vbox{%
3032 \hrule height\dimen2
3033 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3034 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3035 \kern3pt\vrule width\dimen2}% Space to right.
3036 \hrule height\dimen2}
3037 \hfil}
3038 %
3039 \def\error{\leavevmode\lower.7ex\copy\errorbox}
3040
3041 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3042 %
3043 \def\pounds{{\it\$}}
3044
3045 % @euro{} comes from a separate font, depending on the current style.
3046 % We use the free feym* fonts from the eurosym package by Henrik
3047 % Theiling, which support regular, slanted, bold and bold slanted (and
3048 % "outlined" (blackboard board, sort of) versions, which we don't need).
3049 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3050 %
3051 % Although only regular is the truly official Euro symbol, we ignore
3052 % that. The Euro is designed to be slightly taller than the regular
3053 % font height.
3054 %
3055 % feymr - regular
3056 % feymo - slanted
3057 % feybr - bold
3058 % feybo - bold slanted
3059 %
3060 % There is no good (free) typewriter version, to my knowledge.
3061 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3062 % Hmm.
3063 %
3064 % Also doesn't work in math. Do we need to do math with euro symbols?
3065 % Hope not.
3066 %
3067 %
3068 \def\euro{{\eurofont e}}
3069 \def\eurofont{%
3070 % We set the font at each command, rather than predefining it in
3071 % \textfonts and the other font-switching commands, so that
3072 % installations which never need the symbol don't have to have the
3073 % font installed.
3074 %
3075 % There is only one designed size (nominal 10pt), so we always scale
3076 % that to the current nominal size.
3077 %
3078 % By the way, simply using "at 1em" works for cmr10 and the like, but
3079 % does not work for cmbx10 and other extended/shrunken fonts.
3080 %
3081 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3082 %
3083 \ifx\curfontstyle\bfstylename
3084 % bold:
3085 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3086 \else
3087 % regular:
3088 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3089 \fi
3090 \thiseurofont
3091 }
3092
3093 % Glyphs from the EC fonts. We don't use \let for the aliases, because
3094 % sometimes we redefine the original macro, and the alias should reflect
3095 % the redefinition.
3096 %
3097 % Use LaTeX names for the Icelandic letters.
3098 \def\DH{{\ecfont \char"D0}} % Eth
3099 \def\dh{{\ecfont \char"F0}} % eth
3100 \def\TH{{\ecfont \char"DE}} % Thorn
3101 \def\th{{\ecfont \char"FE}} % thorn
3102 %
3103 \def\guillemetleft{{\ecfont \char"13}}
3104 \def\guillemotleft{\guillemetleft}
3105 \def\guillemetright{{\ecfont \char"14}}
3106 \def\guillemotright{\guillemetright}
3107 \def\guilsinglleft{{\ecfont \char"0E}}
3108 \def\guilsinglright{{\ecfont \char"0F}}
3109 \def\quotedblbase{{\ecfont \char"12}}
3110 \def\quotesinglbase{{\ecfont \char"0D}}
3111 %
3112 % This positioning is not perfect (see the ogonek LaTeX package), but
3113 % we have the precomposed glyphs for the most common cases. We put the
3114 % tests to use those glyphs in the single \ogonek macro so we have fewer
3115 % dummy definitions to worry about for index entries, etc.
3116 %
3117 % ogonek is also used with other letters in Lithuanian (IOU), but using
3118 % the precomposed glyphs for those is not so easy since they aren't in
3119 % the same EC font.
3120 \def\ogonek#1{{%
3121 \def\temp{#1}%
3122 \ifx\temp\macrocharA\Aogonek
3123 \else\ifx\temp\macrochara\aogonek
3124 \else\ifx\temp\macrocharE\Eogonek
3125 \else\ifx\temp\macrochare\eogonek
3126 \else
3127 \ecfont \setbox0=\hbox{#1}%
3128 \ifdim\ht0=1ex\accent"0C #1%
3129 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3130 \fi
3131 \fi\fi\fi\fi
3132 }%
3133 }
3134 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3135 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3136 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3137 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3138 %
3139 % Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
3140 \def\ecfont{%
3141 % We can't distinguish serif/sans and italic/slanted, but this
3142 % is used for crude hacks anyway (like adding French and German
3143 % quotes to documents typeset with CM, where we lose kerning), so
3144 % hopefully nobody will notice/care.
3145 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3146 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3147 \ifx\curfontstyle\bfstylename
3148 % bold:
3149 \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
3150 \else
3151 % regular:
3152 \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3153 \fi
3154 \thisecfont
3155 }
3156
3157 % @registeredsymbol - R in a circle. The font for the R should really
3158 % be smaller yet, but lllsize is the best we can do for now.
3159 % Adapted from the plain.tex definition of \copyright.
3160 %
3161 \def\registeredsymbol{%
3162 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3163 \hfil\crcr\Orb}}%
3164 }$%
3165 }
3166
3167 % @textdegree - the normal degrees sign.
3168 %
3169 \def\textdegree{$^\circ$}
3170
3171 % Laurent Siebenmann reports \Orb undefined with:
3172 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3173 % so we'll define it if necessary.
3174 %
3175 \ifx\Orb\thisisundefined
3176 \def\Orb{\mathhexbox20D}
3177 \fi
3178
3179 % Quotes.
3180 \chardef\quotedblleft="5C
3181 \chardef\quotedblright=`\"
3182 \chardef\quoteleft=`\`
3183 \chardef\quoteright=`\'
3184
3185
3186 \message{page headings,}
3187
3188 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3189 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3190
3191 % First the title page. Must do @settitle before @titlepage.
3192 \newif\ifseenauthor
3193 \newif\iffinishedtitlepage
3194
3195 % Do an implicit @contents or @shortcontents after @end titlepage if the
3196 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
3197 %
3198 \newif\ifsetcontentsaftertitlepage
3199 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3200 \newif\ifsetshortcontentsaftertitlepage
3201 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3202
3203 \parseargdef\shorttitlepage{%
3204 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3205 \endgroup\page\hbox{}\page}
3206
3207 \envdef\titlepage{%
3208 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3209 \begingroup
3210 \parindent=0pt \textfonts
3211 % Leave some space at the very top of the page.
3212 \vglue\titlepagetopglue
3213 % No rule at page bottom unless we print one at the top with @title.
3214 \finishedtitlepagetrue
3215 %
3216 % Most title ``pages'' are actually two pages long, with space
3217 % at the top of the second. We don't want the ragged left on the second.
3218 \let\oldpage = \page
3219 \def\page{%
3220 \iffinishedtitlepage\else
3221 \finishtitlepage
3222 \fi
3223 \let\page = \oldpage
3224 \page
3225 \null
3226 }%
3227 }
3228
3229 \def\Etitlepage{%
3230 \iffinishedtitlepage\else
3231 \finishtitlepage
3232 \fi
3233 % It is important to do the page break before ending the group,
3234 % because the headline and footline are only empty inside the group.
3235 % If we use the new definition of \page, we always get a blank page
3236 % after the title page, which we certainly don't want.
3237 \oldpage
3238 \endgroup
3239 %
3240 % Need this before the \...aftertitlepage checks so that if they are
3241 % in effect the toc pages will come out with page numbers.
3242 \HEADINGSon
3243 %
3244 % If they want short, they certainly want long too.
3245 \ifsetshortcontentsaftertitlepage
3246 \shortcontents
3247 \contents
3248 \global\let\shortcontents = \relax
3249 \global\let\contents = \relax
3250 \fi
3251 %
3252 \ifsetcontentsaftertitlepage
3253 \contents
3254 \global\let\contents = \relax
3255 \global\let\shortcontents = \relax
3256 \fi
3257 }
3258
3259 \def\finishtitlepage{%
3260 \vskip4pt \hrule height 2pt width \hsize
3261 \vskip\titlepagebottomglue
3262 \finishedtitlepagetrue
3263 }
3264
3265 % Macros to be used within @titlepage:
3266
3267 \let\subtitlerm=\tenrm
3268 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3269
3270 \parseargdef\title{%
3271 \checkenv\titlepage
3272 \leftline{\titlefonts\rmisbold #1}
3273 % print a rule at the page bottom also.
3274 \finishedtitlepagefalse
3275 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3276 }
3277
3278 \parseargdef\subtitle{%
3279 \checkenv\titlepage
3280 {\subtitlefont \rightline{#1}}%
3281 }
3282
3283 % @author should come last, but may come many times.
3284 % It can also be used inside @quotation.
3285 %
3286 \parseargdef\author{%
3287 \def\temp{\quotation}%
3288 \ifx\thisenv\temp
3289 \def\quotationauthor{#1}% printed in \Equotation.
3290 \else
3291 \checkenv\titlepage
3292 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3293 {\secfonts\rmisbold \leftline{#1}}%
3294 \fi
3295 }
3296
3297
3298 % Set up page headings and footings.
3299
3300 \let\thispage=\folio
3301
3302 \newtoks\evenheadline % headline on even pages
3303 \newtoks\oddheadline % headline on odd pages
3304 \newtoks\evenfootline % footline on even pages
3305 \newtoks\oddfootline % footline on odd pages
3306
3307 % Now make TeX use those variables
3308 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3309 \else \the\evenheadline \fi}}
3310 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3311 \else \the\evenfootline \fi}\HEADINGShook}
3312 \let\HEADINGShook=\relax
3313
3314 % Commands to set those variables.
3315 % For example, this is what @headings on does
3316 % @evenheading @thistitle|@thispage|@thischapter
3317 % @oddheading @thischapter|@thispage|@thistitle
3318 % @evenfooting @thisfile||
3319 % @oddfooting ||@thisfile
3320
3321
3322 \def\evenheading{\parsearg\evenheadingxxx}
3323 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3324 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3325 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3326
3327 \def\oddheading{\parsearg\oddheadingxxx}
3328 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3329 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3330 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3331
3332 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3333
3334 \def\evenfooting{\parsearg\evenfootingxxx}
3335 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3336 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3337 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3338
3339 \def\oddfooting{\parsearg\oddfootingxxx}
3340 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3341 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3342 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3343 %
3344 % Leave some space for the footline. Hopefully ok to assume
3345 % @evenfooting will not be used by itself.
3346 \global\advance\pageheight by -12pt
3347 \global\advance\vsize by -12pt
3348 }
3349
3350 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3351
3352 % @evenheadingmarks top \thischapter <- chapter at the top of a page
3353 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3354 %
3355 % The same set of arguments for:
3356 %
3357 % @oddheadingmarks
3358 % @evenfootingmarks
3359 % @oddfootingmarks
3360 % @everyheadingmarks
3361 % @everyfootingmarks
3362
3363 \def\evenheadingmarks{\headingmarks{even}{heading}}
3364 \def\oddheadingmarks{\headingmarks{odd}{heading}}
3365 \def\evenfootingmarks{\headingmarks{even}{footing}}
3366 \def\oddfootingmarks{\headingmarks{odd}{footing}}
3367 \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3368 \headingmarks{odd}{heading}{#1} }
3369 \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3370 \headingmarks{odd}{footing}{#1} }
3371 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3372 \def\headingmarks#1#2#3 {%
3373 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3374 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3375 }
3376
3377 \everyheadingmarks bottom
3378 \everyfootingmarks bottom
3379
3380 % @headings double turns headings on for double-sided printing.
3381 % @headings single turns headings on for single-sided printing.
3382 % @headings off turns them off.
3383 % @headings on same as @headings double, retained for compatibility.
3384 % @headings after turns on double-sided headings after this page.
3385 % @headings doubleafter turns on double-sided headings after this page.
3386 % @headings singleafter turns on single-sided headings after this page.
3387 % By default, they are off at the start of a document,
3388 % and turned `on' after @end titlepage.
3389
3390 \def\headings #1 {\csname HEADINGS#1\endcsname}
3391
3392 \def\headingsoff{% non-global headings elimination
3393 \evenheadline={\hfil}\evenfootline={\hfil}%
3394 \oddheadline={\hfil}\oddfootline={\hfil}%
3395 }
3396
3397 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3398 \HEADINGSoff % it's the default
3399
3400 % When we turn headings on, set the page number to 1.
3401 % For double-sided printing, put current file name in lower left corner,
3402 % chapter name on inside top of right hand pages, document
3403 % title on inside top of left hand pages, and page numbers on outside top
3404 % edge of all pages.
3405 \def\HEADINGSdouble{%
3406 \global\pageno=1
3407 \global\evenfootline={\hfil}
3408 \global\oddfootline={\hfil}
3409 \global\evenheadline={\line{\folio\hfil\thistitle}}
3410 \global\oddheadline={\line{\thischapter\hfil\folio}}
3411 \global\let\contentsalignmacro = \chapoddpage
3412 }
3413 \let\contentsalignmacro = \chappager
3414
3415 % For single-sided printing, chapter title goes across top left of page,
3416 % page number on top right.
3417 \def\HEADINGSsingle{%
3418 \global\pageno=1
3419 \global\evenfootline={\hfil}
3420 \global\oddfootline={\hfil}
3421 \global\evenheadline={\line{\thischapter\hfil\folio}}
3422 \global\oddheadline={\line{\thischapter\hfil\folio}}
3423 \global\let\contentsalignmacro = \chappager
3424 }
3425 \def\HEADINGSon{\HEADINGSdouble}
3426
3427 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3428 \let\HEADINGSdoubleafter=\HEADINGSafter
3429 \def\HEADINGSdoublex{%
3430 \global\evenfootline={\hfil}
3431 \global\oddfootline={\hfil}
3432 \global\evenheadline={\line{\folio\hfil\thistitle}}
3433 \global\oddheadline={\line{\thischapter\hfil\folio}}
3434 \global\let\contentsalignmacro = \chapoddpage
3435 }
3436
3437 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3438 \def\HEADINGSsinglex{%
3439 \global\evenfootline={\hfil}
3440 \global\oddfootline={\hfil}
3441 \global\evenheadline={\line{\thischapter\hfil\folio}}
3442 \global\oddheadline={\line{\thischapter\hfil\folio}}
3443 \global\let\contentsalignmacro = \chappager
3444 }
3445
3446 % Subroutines used in generating headings
3447 % This produces Day Month Year style of output.
3448 % Only define if not already defined, in case a txi-??.tex file has set
3449 % up a different format (e.g., txi-cs.tex does this).
3450 \ifx\today\thisisundefined
3451 \def\today{%
3452 \number\day\space
3453 \ifcase\month
3454 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3455 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3456 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3457 \fi
3458 \space\number\year}
3459 \fi
3460
3461 % @settitle line... specifies the title of the document, for headings.
3462 % It generates no output of its own.
3463 \def\thistitle{\putwordNoTitle}
3464 \def\settitle{\parsearg{\gdef\thistitle}}
3465
3466
3467 \message{tables,}
3468 % Tables -- @table, @ftable, @vtable, @item(x).
3469
3470 % default indentation of table text
3471 \newdimen\tableindent \tableindent=.8in
3472 % default indentation of @itemize and @enumerate text
3473 \newdimen\itemindent \itemindent=.3in
3474 % margin between end of table item and start of table text.
3475 \newdimen\itemmargin \itemmargin=.1in
3476
3477 % used internally for \itemindent minus \itemmargin
3478 \newdimen\itemmax
3479
3480 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3481 % these defs.
3482 % They also define \itemindex
3483 % to index the item name in whatever manner is desired (perhaps none).
3484
3485 \newif\ifitemxneedsnegativevskip
3486
3487 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3488
3489 \def\internalBitem{\smallbreak \parsearg\itemzzz}
3490 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
3491
3492 \def\itemzzz #1{\begingroup %
3493 \advance\hsize by -\rightskip
3494 \advance\hsize by -\tableindent
3495 \setbox0=\hbox{\itemindicate{#1}}%
3496 \itemindex{#1}%
3497 \nobreak % This prevents a break before @itemx.
3498 %
3499 % If the item text does not fit in the space we have, put it on a line
3500 % by itself, and do not allow a page break either before or after that
3501 % line. We do not start a paragraph here because then if the next
3502 % command is, e.g., @kindex, the whatsit would get put into the
3503 % horizontal list on a line by itself, resulting in extra blank space.
3504 \ifdim \wd0>\itemmax
3505 %
3506 % Make this a paragraph so we get the \parskip glue and wrapping,
3507 % but leave it ragged-right.
3508 \begingroup
3509 \advance\leftskip by-\tableindent
3510 \advance\hsize by\tableindent
3511 \advance\rightskip by0pt plus1fil\relax
3512 \leavevmode\unhbox0\par
3513 \endgroup
3514 %
3515 % We're going to be starting a paragraph, but we don't want the
3516 % \parskip glue -- logically it's part of the @item we just started.
3517 \nobreak \vskip-\parskip
3518 %
3519 % Stop a page break at the \parskip glue coming up. However, if
3520 % what follows is an environment such as @example, there will be no
3521 % \parskip glue; then the negative vskip we just inserted would
3522 % cause the example and the item to crash together. So we use this
3523 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3524 % \parskip glue after all. Section titles are handled this way also.
3525 %
3526 \penalty 10001
3527 \endgroup
3528 \itemxneedsnegativevskipfalse
3529 \else
3530 % The item text fits into the space. Start a paragraph, so that the
3531 % following text (if any) will end up on the same line.
3532 \noindent
3533 % Do this with kerns and \unhbox so that if there is a footnote in
3534 % the item text, it can migrate to the main vertical list and
3535 % eventually be printed.
3536 \nobreak\kern-\tableindent
3537 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3538 \unhbox0
3539 \nobreak\kern\dimen0
3540 \endgroup
3541 \itemxneedsnegativevskiptrue
3542 \fi
3543 }
3544
3545 \def\item{\errmessage{@item while not in a list environment}}
3546 \def\itemx{\errmessage{@itemx while not in a list environment}}
3547
3548 % @table, @ftable, @vtable.
3549 \envdef\table{%
3550 \let\itemindex\gobble
3551 \tablecheck{table}%
3552 }
3553 \envdef\ftable{%
3554 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3555 \tablecheck{ftable}%
3556 }
3557 \envdef\vtable{%
3558 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3559 \tablecheck{vtable}%
3560 }
3561 \def\tablecheck#1{%
3562 \ifnum \the\catcode`\^^M=\active
3563 \endgroup
3564 \errmessage{This command won't work in this context; perhaps the problem is
3565 that we are \inenvironment\thisenv}%
3566 \def\next{\doignore{#1}}%
3567 \else
3568 \let\next\tablex
3569 \fi
3570 \next
3571 }
3572 \def\tablex#1{%
3573 \def\itemindicate{#1}%
3574 \parsearg\tabley
3575 }
3576 \def\tabley#1{%
3577 {%
3578 \makevalueexpandable
3579 \edef\temp{\noexpand\tablez #1\space\space\space}%
3580 \expandafter
3581 }\temp \endtablez
3582 }
3583 \def\tablez #1 #2 #3 #4\endtablez{%
3584 \aboveenvbreak
3585 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3586 \ifnum 0#2>0 \tableindent=#2\mil \fi
3587 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3588 \itemmax=\tableindent
3589 \advance \itemmax by -\itemmargin
3590 \advance \leftskip by \tableindent
3591 \exdentamount=\tableindent
3592 \parindent = 0pt
3593 \parskip = \smallskipamount
3594 \ifdim \parskip=0pt \parskip=2pt \fi
3595 \let\item = \internalBitem
3596 \let\itemx = \internalBitemx
3597 }
3598 \def\Etable{\endgraf\afterenvbreak}
3599 \let\Eftable\Etable
3600 \let\Evtable\Etable
3601 \let\Eitemize\Etable
3602 \let\Eenumerate\Etable
3603
3604 % This is the counter used by @enumerate, which is really @itemize
3605
3606 \newcount \itemno
3607
3608 \envdef\itemize{\parsearg\doitemize}
3609
3610 \def\doitemize#1{%
3611 \aboveenvbreak
3612 \itemmax=\itemindent
3613 \advance\itemmax by -\itemmargin
3614 \advance\leftskip by \itemindent
3615 \exdentamount=\itemindent
3616 \parindent=0pt
3617 \parskip=\smallskipamount
3618 \ifdim\parskip=0pt \parskip=2pt \fi
3619 %
3620 % Try typesetting the item mark that if the document erroneously says
3621 % something like @itemize @samp (intending @table), there's an error
3622 % right away at the @itemize. It's not the best error message in the
3623 % world, but it's better than leaving it to the @item. This means if
3624 % the user wants an empty mark, they have to say @w{} not just @w.
3625 \def\itemcontents{#1}%
3626 \setbox0 = \hbox{\itemcontents}%
3627 %
3628 % @itemize with no arg is equivalent to @itemize @bullet.
3629 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3630 %
3631 \let\item=\itemizeitem
3632 }
3633
3634 % Definition of @item while inside @itemize and @enumerate.
3635 %
3636 \def\itemizeitem{%
3637 \advance\itemno by 1 % for enumerations
3638 {\let\par=\endgraf \smallbreak}% reasonable place to break
3639 {%
3640 % If the document has an @itemize directly after a section title, a
3641 % \nobreak will be last on the list, and \sectionheading will have
3642 % done a \vskip-\parskip. In that case, we don't want to zero
3643 % parskip, or the item text will crash with the heading. On the
3644 % other hand, when there is normal text preceding the item (as there
3645 % usually is), we do want to zero parskip, or there would be too much
3646 % space. In that case, we won't have a \nobreak before. At least
3647 % that's the theory.
3648 \ifnum\lastpenalty<10000 \parskip=0in \fi
3649 \noindent
3650 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3651 %
3652 \vadjust{\penalty 1200}}% not good to break after first line of item.
3653 \flushcr
3654 }
3655
3656 % \splitoff TOKENS\endmark defines \first to be the first token in
3657 % TOKENS, and \rest to be the remainder.
3658 %
3659 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3660
3661 % Allow an optional argument of an uppercase letter, lowercase letter,
3662 % or number, to specify the first label in the enumerated list. No
3663 % argument is the same as `1'.
3664 %
3665 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
3666 \def\enumeratey #1 #2\endenumeratey{%
3667 % If we were given no argument, pretend we were given `1'.
3668 \def\thearg{#1}%
3669 \ifx\thearg\empty \def\thearg{1}\fi
3670 %
3671 % Detect if the argument is a single token. If so, it might be a
3672 % letter. Otherwise, the only valid thing it can be is a number.
3673 % (We will always have one token, because of the test we just made.
3674 % This is a good thing, since \splitoff doesn't work given nothing at
3675 % all -- the first parameter is undelimited.)
3676 \expandafter\splitoff\thearg\endmark
3677 \ifx\rest\empty
3678 % Only one token in the argument. It could still be anything.
3679 % A ``lowercase letter'' is one whose \lccode is nonzero.
3680 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3681 % not equal to itself.
3682 % Otherwise, we assume it's a number.
3683 %
3684 % We need the \relax at the end of the \ifnum lines to stop TeX from
3685 % continuing to look for a <number>.
3686 %
3687 \ifnum\lccode\expandafter`\thearg=0\relax
3688 \numericenumerate % a number (we hope)
3689 \else
3690 % It's a letter.
3691 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3692 \lowercaseenumerate % lowercase letter
3693 \else
3694 \uppercaseenumerate % uppercase letter
3695 \fi
3696 \fi
3697 \else
3698 % Multiple tokens in the argument. We hope it's a number.
3699 \numericenumerate
3700 \fi
3701 }
3702
3703 % An @enumerate whose labels are integers. The starting integer is
3704 % given in \thearg.
3705 %
3706 \def\numericenumerate{%
3707 \itemno = \thearg
3708 \startenumeration{\the\itemno}%
3709 }
3710
3711 % The starting (lowercase) letter is in \thearg.
3712 \def\lowercaseenumerate{%
3713 \itemno = \expandafter`\thearg
3714 \startenumeration{%
3715 % Be sure we're not beyond the end of the alphabet.
3716 \ifnum\itemno=0
3717 \errmessage{No more lowercase letters in @enumerate; get a bigger
3718 alphabet}%
3719 \fi
3720 \char\lccode\itemno
3721 }%
3722 }
3723
3724 % The starting (uppercase) letter is in \thearg.
3725 \def\uppercaseenumerate{%
3726 \itemno = \expandafter`\thearg
3727 \startenumeration{%
3728 % Be sure we're not beyond the end of the alphabet.
3729 \ifnum\itemno=0
3730 \errmessage{No more uppercase letters in @enumerate; get a bigger
3731 alphabet}
3732 \fi
3733 \char\uccode\itemno
3734 }%
3735 }
3736
3737 % Call \doitemize, adding a period to the first argument and supplying the
3738 % common last two arguments. Also subtract one from the initial value in
3739 % \itemno, since @item increments \itemno.
3740 %
3741 \def\startenumeration#1{%
3742 \advance\itemno by -1
3743 \doitemize{#1.}\flushcr
3744 }
3745
3746 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3747 % to @enumerate.
3748 %
3749 \def\alphaenumerate{\enumerate{a}}
3750 \def\capsenumerate{\enumerate{A}}
3751 \def\Ealphaenumerate{\Eenumerate}
3752 \def\Ecapsenumerate{\Eenumerate}
3753
3754
3755 % @multitable macros
3756 % Amy Hendrickson, 8/18/94, 3/6/96
3757 %
3758 % @multitable ... @end multitable will make as many columns as desired.
3759 % Contents of each column will wrap at width given in preamble. Width
3760 % can be specified either with sample text given in a template line,
3761 % or in percent of \hsize, the current width of text on page.
3762
3763 % Table can continue over pages but will only break between lines.
3764
3765 % To make preamble:
3766 %
3767 % Either define widths of columns in terms of percent of \hsize:
3768 % @multitable @columnfractions .25 .3 .45
3769 % @item ...
3770 %
3771 % Numbers following @columnfractions are the percent of the total
3772 % current hsize to be used for each column. You may use as many
3773 % columns as desired.
3774
3775
3776 % Or use a template:
3777 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3778 % @item ...
3779 % using the widest term desired in each column.
3780
3781 % Each new table line starts with @item, each subsequent new column
3782 % starts with @tab. Empty columns may be produced by supplying @tab's
3783 % with nothing between them for as many times as empty columns are needed,
3784 % ie, @tab@tab@tab will produce two empty columns.
3785
3786 % @item, @tab do not need to be on their own lines, but it will not hurt
3787 % if they are.
3788
3789 % Sample multitable:
3790
3791 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3792 % @item first col stuff @tab second col stuff @tab third col
3793 % @item
3794 % first col stuff
3795 % @tab
3796 % second col stuff
3797 % @tab
3798 % third col
3799 % @item first col stuff @tab second col stuff
3800 % @tab Many paragraphs of text may be used in any column.
3801 %
3802 % They will wrap at the width determined by the template.
3803 % @item@tab@tab This will be in third column.
3804 % @end multitable
3805
3806 % Default dimensions may be reset by user.
3807 % @multitableparskip is vertical space between paragraphs in table.
3808 % @multitableparindent is paragraph indent in table.
3809 % @multitablecolmargin is horizontal space to be left between columns.
3810 % @multitablelinespace is space to leave between table items, baseline
3811 % to baseline.
3812 % 0pt means it depends on current normal line spacing.
3813 %
3814 \newskip\multitableparskip
3815 \newskip\multitableparindent
3816 \newdimen\multitablecolspace
3817 \newskip\multitablelinespace
3818 \multitableparskip=0pt
3819 \multitableparindent=6pt
3820 \multitablecolspace=12pt
3821 \multitablelinespace=0pt
3822
3823 % Macros used to set up halign preamble:
3824 %
3825 \let\endsetuptable\relax
3826 \def\xendsetuptable{\endsetuptable}
3827 \let\columnfractions\relax
3828 \def\xcolumnfractions{\columnfractions}
3829 \newif\ifsetpercent
3830
3831 % #1 is the @columnfraction, usually a decimal number like .5, but might
3832 % be just 1. We just use it, whatever it is.
3833 %
3834 \def\pickupwholefraction#1 {%
3835 \global\advance\colcount by 1
3836 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3837 \setuptable
3838 }
3839
3840 \newcount\colcount
3841 \def\setuptable#1{%
3842 \def\firstarg{#1}%
3843 \ifx\firstarg\xendsetuptable
3844 \let\go = \relax
3845 \else
3846 \ifx\firstarg\xcolumnfractions
3847 \global\setpercenttrue
3848 \else
3849 \ifsetpercent
3850 \let\go\pickupwholefraction
3851 \else
3852 \global\advance\colcount by 1
3853 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3854 % separator; typically that is always in the input, anyway.
3855 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3856 \fi
3857 \fi
3858 \ifx\go\pickupwholefraction
3859 % Put the argument back for the \pickupwholefraction call, so
3860 % we'll always have a period there to be parsed.
3861 \def\go{\pickupwholefraction#1}%
3862 \else
3863 \let\go = \setuptable
3864 \fi%
3865 \fi
3866 \go
3867 }
3868
3869 % multitable-only commands.
3870 %
3871 % @headitem starts a heading row, which we typeset in bold.
3872 % Assignments have to be global since we are inside the implicit group
3873 % of an alignment entry. \everycr resets \everytab so we don't have to
3874 % undo it ourselves.
3875 \def\headitemfont{\b}% for people to use in the template row; not changeable
3876 \def\headitem{%
3877 \checkenv\multitable
3878 \crcr
3879 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
3880 \the\everytab % for the first item
3881 }%
3882 %
3883 % A \tab used to include \hskip1sp. But then the space in a template
3884 % line is not enough. That is bad. So let's go back to just `&' until
3885 % we again encounter the problem the 1sp was intended to solve.
3886 % --karl, nathan@acm.org, 20apr99.
3887 \def\tab{\checkenv\multitable &\the\everytab}%
3888
3889 % @multitable ... @end multitable definitions:
3890 %
3891 \newtoks\everytab % insert after every tab.
3892 %
3893 \envdef\multitable{%
3894 \vskip\parskip
3895 \startsavinginserts
3896 %
3897 % @item within a multitable starts a normal row.
3898 % We use \def instead of \let so that if one of the multitable entries
3899 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
3900 % \endtemplate) expanding \doitemize.
3901 \def\item{\crcr}%
3902 %
3903 \tolerance=9500
3904 \hbadness=9500
3905 \setmultitablespacing
3906 \parskip=\multitableparskip
3907 \parindent=\multitableparindent
3908 \overfullrule=0pt
3909 \global\colcount=0
3910 %
3911 \everycr = {%
3912 \noalign{%
3913 \global\everytab={}%
3914 \global\colcount=0 % Reset the column counter.
3915 % Check for saved footnotes, etc.
3916 \checkinserts
3917 % Keeps underfull box messages off when table breaks over pages.
3918 %\filbreak
3919 % Maybe so, but it also creates really weird page breaks when the
3920 % table breaks over pages. Wouldn't \vfil be better? Wait until the
3921 % problem manifests itself, so it can be fixed for real --karl.
3922 }%
3923 }%
3924 %
3925 \parsearg\domultitable
3926 }
3927 \def\domultitable#1{%
3928 % To parse everything between @multitable and @item:
3929 \setuptable#1 \endsetuptable
3930 %
3931 % This preamble sets up a generic column definition, which will
3932 % be used as many times as user calls for columns.
3933 % \vtop will set a single line and will also let text wrap and
3934 % continue for many paragraphs if desired.
3935 \halign\bgroup &%
3936 \global\advance\colcount by 1
3937 \multistrut
3938 \vtop{%
3939 % Use the current \colcount to find the correct column width:
3940 \hsize=\expandafter\csname col\the\colcount\endcsname
3941 %
3942 % In order to keep entries from bumping into each other
3943 % we will add a \leftskip of \multitablecolspace to all columns after
3944 % the first one.
3945 %
3946 % If a template has been used, we will add \multitablecolspace
3947 % to the width of each template entry.
3948 %
3949 % If the user has set preamble in terms of percent of \hsize we will
3950 % use that dimension as the width of the column, and the \leftskip
3951 % will keep entries from bumping into each other. Table will start at
3952 % left margin and final column will justify at right margin.
3953 %
3954 % Make sure we don't inherit \rightskip from the outer environment.
3955 \rightskip=0pt
3956 \ifnum\colcount=1
3957 % The first column will be indented with the surrounding text.
3958 \advance\hsize by\leftskip
3959 \else
3960 \ifsetpercent \else
3961 % If user has not set preamble in terms of percent of \hsize
3962 % we will advance \hsize by \multitablecolspace.
3963 \advance\hsize by \multitablecolspace
3964 \fi
3965 % In either case we will make \leftskip=\multitablecolspace:
3966 \leftskip=\multitablecolspace
3967 \fi
3968 % Ignoring space at the beginning and end avoids an occasional spurious
3969 % blank line, when TeX decides to break the line at the space before the
3970 % box from the multistrut, so the strut ends up on a line by itself.
3971 % For example:
3972 % @multitable @columnfractions .11 .89
3973 % @item @code{#}
3974 % @tab Legal holiday which is valid in major parts of the whole country.
3975 % Is automatically provided with highlighting sequences respectively
3976 % marking characters.
3977 \noindent\ignorespaces##\unskip\multistrut
3978 }\cr
3979 }
3980 \def\Emultitable{%
3981 \crcr
3982 \egroup % end the \halign
3983 \global\setpercentfalse
3984 }
3985
3986 \def\setmultitablespacing{%
3987 \def\multistrut{\strut}% just use the standard line spacing
3988 %
3989 % Compute \multitablelinespace (if not defined by user) for use in
3990 % \multitableparskip calculation. We used define \multistrut based on
3991 % this, but (ironically) that caused the spacing to be off.
3992 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
3993 \ifdim\multitablelinespace=0pt
3994 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
3995 \global\advance\multitablelinespace by-\ht0
3996 \fi
3997 % Test to see if parskip is larger than space between lines of
3998 % table. If not, do nothing.
3999 % If so, set to same dimension as multitablelinespace.
4000 \ifdim\multitableparskip>\multitablelinespace
4001 \global\multitableparskip=\multitablelinespace
4002 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4003 % than skip between lines in the table.
4004 \fi%
4005 \ifdim\multitableparskip=0pt
4006 \global\multitableparskip=\multitablelinespace
4007 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4008 % than skip between lines in the table.
4009 \fi}
4010
4011
4012 \message{conditionals,}
4013
4014 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4015 % @ifnotxml always succeed. They currently do nothing; we don't
4016 % attempt to check whether the conditionals are properly nested. But we
4017 % have to remember that they are conditionals, so that @end doesn't
4018 % attempt to close an environment group.
4019 %
4020 \def\makecond#1{%
4021 \expandafter\let\csname #1\endcsname = \relax
4022 \expandafter\let\csname iscond.#1\endcsname = 1
4023 }
4024 \makecond{iftex}
4025 \makecond{ifnotdocbook}
4026 \makecond{ifnothtml}
4027 \makecond{ifnotinfo}
4028 \makecond{ifnotplaintext}
4029 \makecond{ifnotxml}
4030
4031 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4032 %
4033 \def\direntry{\doignore{direntry}}
4034 \def\documentdescription{\doignore{documentdescription}}
4035 \def\docbook{\doignore{docbook}}
4036 \def\html{\doignore{html}}
4037 \def\ifdocbook{\doignore{ifdocbook}}
4038 \def\ifhtml{\doignore{ifhtml}}
4039 \def\ifinfo{\doignore{ifinfo}}
4040 \def\ifnottex{\doignore{ifnottex}}
4041 \def\ifplaintext{\doignore{ifplaintext}}
4042 \def\ifxml{\doignore{ifxml}}
4043 \def\ignore{\doignore{ignore}}
4044 \def\menu{\doignore{menu}}
4045 \def\xml{\doignore{xml}}
4046
4047 % Ignore text until a line `@end #1', keeping track of nested conditionals.
4048 %
4049 % A count to remember the depth of nesting.
4050 \newcount\doignorecount
4051
4052 \def\doignore#1{\begingroup
4053 % Scan in ``verbatim'' mode:
4054 \obeylines
4055 \catcode`\@ = \other
4056 \catcode`\{ = \other
4057 \catcode`\} = \other
4058 %
4059 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4060 \spaceisspace
4061 %
4062 % Count number of #1's that we've seen.
4063 \doignorecount = 0
4064 %
4065 % Swallow text until we reach the matching `@end #1'.
4066 \dodoignore{#1}%
4067 }
4068
4069 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4070 \obeylines %
4071 %
4072 \gdef\dodoignore#1{%
4073 % #1 contains the command name as a string, e.g., `ifinfo'.
4074 %
4075 % Define a command to find the next `@end #1'.
4076 \long\def\doignoretext##1^^M@end #1{%