aboutsummaryrefslogtreecommitdiff
path: root/doc/texinfo.tex
diff options
context:
space:
mode:
Diffstat (limited to 'doc/texinfo.tex')
-rw-r--r--doc/texinfo.tex9913
1 files changed, 0 insertions, 9913 deletions
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
deleted file mode 100644
index 2abda0f3..00000000
--- a/doc/texinfo.tex
+++ /dev/null
@@ -1,9913 +0,0 @@
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-01-03.09}
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 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://www.gnu.org/software/texinfo/ (the Texinfo home page), or
32% ftp://tug.org/tex/texinfo.tex
33% (and all CTAN mirrors, see http://www.ctan.org).
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{%
696group can only be used in environments such as @example,^^J%
697where 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\next\centerH
899 \else
900 \let\next\centerV
901 \fi
902 \next{\hfil \ignorespaces#1\unskip \hfil}%
903}
904\def\centerH#1{%
905 {%
906 \hfil\break
907 \advance\hsize by -\leftskip
908 \advance\hsize by -\rightskip
909 \line{#1}%
910 \break
911 }%
912}
913\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
914
915% @sp n outputs n lines of vertical space
916
917\parseargdef\sp{\vskip #1\baselineskip}
918
919% @comment ...line which is ignored...
920% @c is the same as @comment
921% @ignore ... @end ignore is another way to write a comment
922
923\def\comment{\begingroup \catcode`\^^M=\other%
924\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
925\commentxxx}
926{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
927
928\let\c=\comment
929
930% @paragraphindent NCHARS
931% We'll use ems for NCHARS, close enough.
932% NCHARS can also be the word `asis' or `none'.
933% We cannot feasibly implement @paragraphindent asis, though.
934%
935\def\asisword{asis} % no translation, these are keywords
936\def\noneword{none}
937%
938\parseargdef\paragraphindent{%
939 \def\temp{#1}%
940 \ifx\temp\asisword
941 \else
942 \ifx\temp\noneword
943 \defaultparindent = 0pt
944 \else
945 \defaultparindent = #1em
946 \fi
947 \fi
948 \parindent = \defaultparindent
949}
950
951% @exampleindent NCHARS
952% We'll use ems for NCHARS like @paragraphindent.
953% It seems @exampleindent asis isn't necessary, but
954% I preserve it to make it similar to @paragraphindent.
955\parseargdef\exampleindent{%
956 \def\temp{#1}%
957 \ifx\temp\asisword
958 \else
959 \ifx\temp\noneword
960 \lispnarrowing = 0pt
961 \else
962 \lispnarrowing = #1em
963 \fi
964 \fi
965}
966
967% @firstparagraphindent WORD
968% If WORD is `none', then suppress indentation of the first paragraph
969% after a section heading. If WORD is `insert', then do indent at such
970% paragraphs.
971%
972% The paragraph indentation is suppressed or not by calling
973% \suppressfirstparagraphindent, which the sectioning commands do.
974% We switch the definition of this back and forth according to WORD.
975% By default, we suppress indentation.
976%
977\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
978\def\insertword{insert}
979%
980\parseargdef\firstparagraphindent{%
981 \def\temp{#1}%
982 \ifx\temp\noneword
983 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
984 \else\ifx\temp\insertword
985 \let\suppressfirstparagraphindent = \relax
986 \else
987 \errhelp = \EMsimple
988 \errmessage{Unknown @firstparagraphindent option `\temp'}%
989 \fi\fi
990}
991
992% Here is how we actually suppress indentation. Redefine \everypar to
993% \kern backwards by \parindent, and then reset itself to empty.
994%
995% We also make \indent itself not actually do anything until the next
996% paragraph.
997%
998\gdef\dosuppressfirstparagraphindent{%
999 \gdef\indent{%
1000 \restorefirstparagraphindent
1001 \indent
1002 }%
1003 \gdef\noindent{%
1004 \restorefirstparagraphindent
1005 \noindent
1006 }%
1007 \global\everypar = {%
1008 \kern -\parindent
1009 \restorefirstparagraphindent
1010 }%
1011}
1012
1013\gdef\restorefirstparagraphindent{%
1014 \global \let \indent = \ptexindent
1015 \global \let \noindent = \ptexnoindent
1016 \global \everypar = {}%
1017}
1018
1019
1020% @refill is a no-op.
1021\let\refill=\relax
1022
1023% If working on a large document in chapters, it is convenient to
1024% be able to disable indexing, cross-referencing, and contents, for test runs.
1025% This is done with @novalidate (before @setfilename).
1026%
1027\newif\iflinks \linkstrue % by default we want the aux files.
1028\let\novalidate = \linksfalse
1029
1030% @setfilename is done at the beginning of every texinfo file.
1031% So open here the files we need to have open while reading the input.
1032% This makes it possible to make a .fmt file for texinfo.
1033\def\setfilename{%
1034 \fixbackslash % Turn off hack to swallow `\input texinfo'.
1035 \iflinks
1036 \tryauxfile
1037 % Open the new aux file. TeX will close it automatically at exit.
1038 \immediate\openout\auxfile=\jobname.aux
1039 \fi % \openindices needs to do some work in any case.
1040 \openindices
1041 \let\setfilename=\comment % Ignore extra @setfilename cmds.
1042 %
1043 % If texinfo.cnf is present on the system, read it.
1044 % Useful for site-wide @afourpaper, etc.
1045 \openin 1 texinfo.cnf
1046 \ifeof 1 \else \input texinfo.cnf \fi
1047 \closein 1
1048 %
1049 \comment % Ignore the actual filename.
1050}
1051
1052% Called from \setfilename.
1053%
1054\def\openindices{%
1055 \newindex{cp}%
1056 \newcodeindex{fn}%
1057 \newcodeindex{vr}%
1058 \newcodeindex{tp}%
1059 \newcodeindex{ky}%
1060 \newcodeindex{pg}%
1061}
1062
1063% @bye.
1064\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1065
1066
1067\message{pdf,}
1068% adobe `portable' document format
1069\newcount\tempnum
1070\newcount\lnkcount
1071\newtoks\filename
1072\newcount\filenamelength
1073\newcount\pgn
1074\newtoks\toksA
1075\newtoks\toksB
1076\newtoks\toksC
1077\newtoks\toksD
1078\newbox\boxA
1079\newcount\countA
1080\newif\ifpdf
1081\newif\ifpdfmakepagedest
1082
1083% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1084% can be set). So we test for \relax and 0 as well as being undefined.
1085\ifx\pdfoutput\thisisundefined
1086\else
1087 \ifx\pdfoutput\relax
1088 \else
1089 \ifcase\pdfoutput
1090 \else
1091 \pdftrue
1092 \fi
1093 \fi
1094\fi
1095
1096% PDF uses PostScript string constants for the names of xref targets,
1097% for display in the outlines, and in other places. Thus, we have to
1098% double any backslashes. Otherwise, a name like "\node" will be
1099% interpreted as a newline (\n), followed by o, d, e. Not good.
1100%
1101% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1102% related messages. The final outcome is that it is up to the TeX user
1103% to double the backslashes and otherwise make the string valid, so
1104% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1105% do this reliably, so we use it.
1106
1107% #1 is a control sequence in which to do the replacements,
1108% which we \xdef.
1109\def\txiescapepdf#1{%
1110 \ifx\pdfescapestring\relax
1111 % No primitive available; should we give a warning or log?
1112 % Many times it won't matter.
1113 \else
1114 % The expandable \pdfescapestring primitive escapes parentheses,
1115 % backslashes, and other special chars.
1116 \xdef#1{\pdfescapestring{#1}}%
1117 \fi
1118}
1119
1120\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1121with PDF output, and none of those formats could be found. (.eps cannot
1122be supported due to the design of the PDF format; use regular TeX (DVI
1123output) for that.)}
1124
1125\ifpdf
1126 %
1127 % Color manipulation macros based on pdfcolor.tex,
1128 % except using rgb instead of cmyk; the latter is said to render as a
1129 % very dark gray on-screen and a very dark halftone in print, instead
1130 % of actual black.
1131 \def\rgbDarkRed{0.50 0.09 0.12}
1132 \def\rgbBlack{0 0 0}
1133 %
1134 % k sets the color for filling (usual text, etc.);
1135 % K sets the color for stroking (thin rules, e.g., normal _'s).
1136 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1137 %
1138 % Set color, and create a mark which defines \thiscolor accordingly,
1139 % so that \makeheadline knows which color to restore.
1140 \def\setcolor#1{%
1141 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1142 \domark
1143 \pdfsetcolor{#1}%
1144 }
1145 %
1146 \def\maincolor{\rgbBlack}
1147 \pdfsetcolor{\maincolor}
1148 \edef\thiscolor{\maincolor}
1149 \def\lastcolordefs{}
1150 %
1151 \def\makefootline{%
1152 \baselineskip24pt
1153 \line{\pdfsetcolor{\maincolor}\the\footline}%
1154 }
1155 %
1156 \def\makeheadline{%
1157 \vbox to 0pt{%
1158 \vskip-22.5pt
1159 \line{%
1160 \vbox to8.5pt{}%
1161 % Extract \thiscolor definition from the marks.
1162 \getcolormarks
1163 % Typeset the headline with \maincolor, then restore the color.
1164 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1165 }%
1166 \vss
1167 }%
1168 \nointerlineskip
1169 }
1170 %
1171 %
1172 \pdfcatalog{/PageMode /UseOutlines}
1173 %
1174 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1175 \def\dopdfimage#1#2#3{%
1176 \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1177 \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1178 %
1179 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1180 % others). Let's try in that order, PDF first since if
1181 % someone has a scalable image, presumably better to use that than a
1182 % bitmap.
1183 \let\pdfimgext=\empty
1184 \begingroup
1185 \openin 1 #1.pdf \ifeof 1
1186 \openin 1 #1.PDF \ifeof 1
1187 \openin 1 #1.png \ifeof 1
1188 \openin 1 #1.jpg \ifeof 1
1189 \openin 1 #1.jpeg \ifeof 1
1190 \openin 1 #1.JPG \ifeof 1
1191 \errhelp = \nopdfimagehelp
1192 \errmessage{Could not find image file #1 for pdf}%
1193 \else \gdef\pdfimgext{JPG}%
1194 \fi
1195 \else \gdef\pdfimgext{jpeg}%
1196 \fi
1197 \else \gdef\pdfimgext{jpg}%
1198 \fi
1199 \else \gdef\pdfimgext{png}%
1200 \fi
1201 \else \gdef\pdfimgext{PDF}%
1202 \fi
1203 \else \gdef\pdfimgext{pdf}%
1204 \fi
1205 \closein 1
1206 \endgroup
1207 %
1208 % without \immediate, ancient pdftex seg faults when the same image is
1209 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1210 \ifnum\pdftexversion < 14
1211 \immediate\pdfimage
1212 \else
1213 \immediate\pdfximage
1214 \fi
1215 \ifdim \wd0 >0pt width \imagewidth \fi
1216 \ifdim \wd2 >0pt height \imageheight \fi
1217 \ifnum\pdftexversion<13
1218 #1.\pdfimgext
1219 \else
1220 {#1.\pdfimgext}%
1221 \fi
1222 \ifnum\pdftexversion < 14 \else
1223 \pdfrefximage \pdflastximage
1224 \fi}
1225 %
1226 \def\pdfmkdest#1{{%
1227 % We have to set dummies so commands such as @code, and characters
1228 % such as \, aren't expanded when present in a section title.
1229 \indexnofonts
1230 \turnoffactive
1231 \makevalueexpandable
1232 \def\pdfdestname{#1}%
1233 \txiescapepdf\pdfdestname
1234 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1235 }}
1236 %
1237 % used to mark target names; must be expandable.
1238 \def\pdfmkpgn#1{#1}
1239 %
1240 % by default, use a color that is dark enough to print on paper as
1241 % nearly black, but still distinguishable for online viewing.
1242 \def\urlcolor{\rgbDarkRed}
1243 \def\linkcolor{\rgbDarkRed}
1244 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1245 %
1246 % Adding outlines to PDF; macros for calculating structure of outlines
1247 % come from Petr Olsak
1248 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1249 \else \csname#1\endcsname \fi}
1250 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1251 \advance\tempnum by 1
1252 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1253 %
1254 % #1 is the section text, which is what will be displayed in the
1255 % outline by the pdf viewer. #2 is the pdf expression for the number
1256 % of subentries (or empty, for subsubsections). #3 is the node text,
1257 % which might be empty if this toc entry had no corresponding node.
1258 % #4 is the page number
1259 %
1260 \def\dopdfoutline#1#2#3#4{%
1261 % Generate a link to the node text if that exists; else, use the
1262 % page number. We could generate a destination for the section
1263 % text in the case where a section has no node, but it doesn't
1264 % seem worth the trouble, since most documents are normally structured.
1265 \edef\pdfoutlinedest{#3}%
1266 \ifx\pdfoutlinedest\empty
1267 \def\pdfoutlinedest{#4}%
1268 \else
1269 \txiescapepdf\pdfoutlinedest
1270 \fi
1271 %
1272 % Also escape PDF chars in the display string.
1273 \edef\pdfoutlinetext{#1}%
1274 \txiescapepdf\pdfoutlinetext
1275 %
1276 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1277 }
1278 %
1279 \def\pdfmakeoutlines{%
1280 \begingroup
1281 % Read toc silently, to get counts of subentries for \pdfoutline.
1282 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1283 \def\numchapentry##1##2##3##4{%
1284 \def\thischapnum{##2}%
1285 \def\thissecnum{0}%
1286 \def\thissubsecnum{0}%
1287 }%
1288 \def\numsecentry##1##2##3##4{%
1289 \advancenumber{chap\thischapnum}%
1290 \def\thissecnum{##2}%
1291 \def\thissubsecnum{0}%
1292 }%
1293 \def\numsubsecentry##1##2##3##4{%
1294 \advancenumber{sec\thissecnum}%
1295 \def\thissubsecnum{##2}%
1296 }%
1297 \def\numsubsubsecentry##1##2##3##4{%
1298 \advancenumber{subsec\thissubsecnum}%
1299 }%
1300 \def\thischapnum{0}%
1301 \def\thissecnum{0}%
1302 \def\thissubsecnum{0}%
1303 %
1304 % use \def rather than \let here because we redefine \chapentry et
1305 % al. a second time, below.
1306 \def\appentry{\numchapentry}%
1307 \def\appsecentry{\numsecentry}%
1308 \def\appsubsecentry{\numsubsecentry}%
1309 \def\appsubsubsecentry{\numsubsubsecentry}%
1310 \def\unnchapentry{\numchapentry}%
1311 \def\unnsecentry{\numsecentry}%
1312 \def\unnsubsecentry{\numsubsecentry}%
1313 \def\unnsubsubsecentry{\numsubsubsecentry}%
1314 \readdatafile{toc}%
1315 %
1316 % Read toc second time, this time actually producing the outlines.
1317 % The `-' means take the \expnumber as the absolute number of
1318 % subentries, which we calculated on our first read of the .toc above.
1319 %
1320 % We use the node names as the destinations.
1321 \def\numchapentry##1##2##3##4{%
1322 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1323 \def\numsecentry##1##2##3##4{%
1324 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1325 \def\numsubsecentry##1##2##3##4{%
1326 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1327 \def\numsubsubsecentry##1##2##3##4{% count is always zero
1328 \dopdfoutline{##1}{}{##3}{##4}}%
1329 %
1330 % PDF outlines are displayed using system fonts, instead of
1331 % document fonts. Therefore we cannot use special characters,
1332 % since the encoding is unknown. For example, the eogonek from
1333 % Latin 2 (0xea) gets translated to a | character. Info from
1334 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1335 %
1336 % TODO this right, we have to translate 8-bit characters to
1337 % their "best" equivalent, based on the @documentencoding. Too
1338 % much work for too little return. Just use the ASCII equivalents
1339 % we use for the index sort strings.
1340 %
1341 \indexnofonts
1342 \setupdatafile
1343 % We can have normal brace characters in the PDF outlines, unlike
1344 % Texinfo index files. So set that up.
1345 \def\{{\lbracecharliteral}%
1346 \def\}{\rbracecharliteral}%
1347 \catcode`\\=\active \otherbackslash
1348 \input \tocreadfilename
1349 \endgroup
1350 }
1351 {\catcode`[=1 \catcode`]=2
1352 \catcode`{=\other \catcode`}=\other
1353 \gdef\lbracecharliteral[{]%
1354 \gdef\rbracecharliteral[}]%
1355 ]
1356 %
1357 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1358 \ifx\PP\D\let\nextsp\relax
1359 \else\let\nextsp\skipspaces
1360 \ifx\p\space\else\addtokens{\filename}{\PP}%
1361 \advance\filenamelength by 1
1362 \fi
1363 \fi
1364 \nextsp}
1365 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1366 \ifnum\pdftexversion < 14
1367 \let \startlink \pdfannotlink
1368 \else
1369 \let \startlink \pdfstartlink
1370 \fi
1371 % make a live url in pdf output.
1372 \def\pdfurl#1{%
1373 \begingroup
1374 % it seems we really need yet another set of dummies; have not
1375 % tried to figure out what each command should do in the context
1376 % of @url. for now, just make @/ a no-op, that's the only one
1377 % people have actually reported a problem with.
1378 %
1379 \normalturnoffactive
1380 \def\@{@}%
1381 \let\/=\empty
1382 \makevalueexpandable
1383 % do we want to go so far as to use \indexnofonts instead of just
1384 % special-casing \var here?
1385 \def\var##1{##1}%
1386 %
1387 \leavevmode\setcolor{\urlcolor}%
1388 \startlink attr{/Border [0 0 0]}%
1389 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1390 \endgroup}
1391 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1392 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1393 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1394 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1395 \def\maketoks{%
1396 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1397 \ifx\first0\adn0
1398 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1399 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1400 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1401 \else
1402 \ifnum0=\countA\else\makelink\fi
1403 \ifx\first.\let\next=\done\else
1404 \let\next=\maketoks
1405 \addtokens{\toksB}{\the\toksD}
1406 \ifx\first,\addtokens{\toksB}{\space}\fi
1407 \fi
1408 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1409 \next}
1410 \def\makelink{\addtokens{\toksB}%
1411 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1412 \def\pdflink#1{%
1413 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1414 \setcolor{\linkcolor}#1\endlink}
1415 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1416\else
1417 % non-pdf mode
1418 \let\pdfmkdest = \gobble
1419 \let\pdfurl = \gobble
1420 \let\endlink = \relax
1421 \let\setcolor = \gobble
1422 \let\pdfsetcolor = \gobble
1423 \let\pdfmakeoutlines = \relax
1424\fi % \ifx\pdfoutput
1425
1426
1427\message{fonts,}
1428
1429% Change the current font style to #1, remembering it in \curfontstyle.
1430% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1431% italics, not bold italics.
1432%
1433\def\setfontstyle#1{%
1434 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1435 \csname ten#1\endcsname % change the current font
1436}
1437
1438% Select #1 fonts with the current style.
1439%
1440\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1441
1442\def\rm{\fam=0 \setfontstyle{rm}}
1443\def\it{\fam=\itfam \setfontstyle{it}}
1444\def\sl{\fam=\slfam \setfontstyle{sl}}
1445\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1446\def\tt{\fam=\ttfam \setfontstyle{tt}}
1447
1448% Unfortunately, we have to override this for titles and the like, since
1449% in those cases "rm" is bold. Sigh.
1450\def\rmisbold{\rm\def\curfontstyle{bf}}
1451
1452% Texinfo sort of supports the sans serif font style, which plain TeX does not.
1453% So we set up a \sf.
1454\newfam\sffam
1455\def\sf{\fam=\sffam \setfontstyle{sf}}
1456\let\li = \sf % Sometimes we call it \li, not \sf.
1457
1458% We don't need math for this font style.
1459\def\ttsl{\setfontstyle{ttsl}}
1460
1461
1462% Default leading.
1463\newdimen\textleading \textleading = 13.2pt
1464
1465% Set the baselineskip to #1, and the lineskip and strut size
1466% correspondingly. There is no deep meaning behind these magic numbers
1467% used as factors; they just match (closely enough) what Knuth defined.
1468%
1469\def\lineskipfactor{.08333}
1470\def\strutheightpercent{.70833}
1471\def\strutdepthpercent {.29167}
1472%
1473% can get a sort of poor man's double spacing by redefining this.
1474\def\baselinefactor{1}
1475%
1476\def\setleading#1{%
1477 \dimen0 = #1\relax
1478 \normalbaselineskip = \baselinefactor\dimen0
1479 \normallineskip = \lineskipfactor\normalbaselineskip
1480 \normalbaselines
1481 \setbox\strutbox =\hbox{%
1482 \vrule width0pt height\strutheightpercent\baselineskip
1483 depth \strutdepthpercent \baselineskip
1484 }%
1485}
1486
1487% PDF CMaps. See also LaTeX's t1.cmap.
1488%
1489% do nothing with this by default.
1490\expandafter\let\csname cmapOT1\endcsname\gobble
1491\expandafter\let\csname cmapOT1IT\endcsname\gobble
1492\expandafter\let\csname cmapOT1TT\endcsname\gobble
1493
1494% if we are producing pdf, and we have \pdffontattr, then define cmaps.
1495% (\pdffontattr was introduced many years ago, but people still run
1496% older pdftex's; it's easy to conditionalize, so we do.)
1497\ifpdf \ifx\pdffontattr\thisisundefined \else
1498 \begingroup
1499 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1500 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1501%%DocumentNeededResources: ProcSet (CIDInit)
1502%%IncludeResource: ProcSet (CIDInit)
1503%%BeginResource: CMap (TeX-OT1-0)
1504%%Title: (TeX-OT1-0 TeX OT1 0)
1505%%Version: 1.000
1506%%EndComments
1507/CIDInit /ProcSet findresource begin
150812 dict begin
1509begincmap
1510/CIDSystemInfo
1511<< /Registry (TeX)
1512/Ordering (OT1)
1513/Supplement 0
1514>> def
1515/CMapName /TeX-OT1-0 def
1516/CMapType 2 def
15171 begincodespacerange
1518<00> <7F>
1519endcodespacerange
15208 beginbfrange
1521<00> <01> <0393>
1522<09> <0A> <03A8>
1523<23> <26> <0023>
1524<28> <3B> <0028>
1525<3F> <5B> <003F>
1526<5D> <5E> <005D>
1527<61> <7A> <0061>
1528<7B> <7C> <2013>
1529endbfrange
153040 beginbfchar
1531<02> <0398>
1532<03> <039B>
1533<04> <039E>
1534<05> <03A0>
1535<06> <03A3>
1536<07> <03D2>
1537<08> <03A6>
1538<0B> <00660066>
1539<0C> <00660069>
1540<0D> <0066006C>
1541<0E> <006600660069>
1542<0F> <00660066006C>
1543<10> <0131>
1544<11> <0237>
1545<12> <0060>
1546<13> <00B4>
1547<14> <02C7>
1548<15> <02D8>
1549<16> <00AF>
1550<17> <02DA>
1551<18> <00B8>
1552<19> <00DF>
1553<1A> <00E6>
1554<1B> <0153>
1555<1C> <00F8>
1556<1D> <00C6>
1557<1E> <0152>
1558<1F> <00D8>
1559<21> <0021>
1560<22> <201D>
1561<27> <2019>
1562<3C> <00A1>
1563<3D> <003D>
1564<3E> <00BF>
1565<5C> <201C>
1566<5F> <02D9>
1567<60> <2018>
1568<7D> <02DD>
1569<7E> <007E>
1570<7F> <00A8>
1571endbfchar
1572endcmap
1573CMapName currentdict /CMap defineresource pop
1574end
1575end
1576%%EndResource
1577%%EOF
1578 }\endgroup
1579 \expandafter\edef\csname cmapOT1\endcsname#1{%
1580 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1581 }%
1582%
1583% \cmapOT1IT
1584 \begingroup
1585 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1586 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1587%%DocumentNeededResources: ProcSet (CIDInit)
1588%%IncludeResource: ProcSet (CIDInit)
1589%%BeginResource: CMap (TeX-OT1IT-0)
1590%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1591%%Version: 1.000
1592%%EndComments
1593/CIDInit /ProcSet findresource begin
159412 dict begin
1595begincmap
1596/CIDSystemInfo
1597<< /Registry (TeX)
1598/Ordering (OT1IT)
1599/Supplement 0
1600>> def
1601/CMapName /TeX-OT1IT-0 def
1602/CMapType 2 def
16031 begincodespacerange
1604<00> <7F>
1605endcodespacerange
16068 beginbfrange
1607<00> <01> <0393>
1608<09> <0A> <03A8>
1609<25> <26> <0025>
1610<28> <3B> <0028>
1611<3F> <5B> <003F>
1612<5D> <5E> <005D>
1613<61> <7A> <0061>
1614<7B> <7C> <2013>
1615endbfrange
161642 beginbfchar
1617<02> <0398>
1618<03> <039B>
1619<04> <039E>
1620<05> <03A0>
1621<06> <03A3>
1622<07> <03D2>
1623<08> <03A6>
1624<0B> <00660066>
1625<0C> <00660069>
1626<0D> <0066006C>
1627<0E> <006600660069>
1628<0F> <00660066006C>
1629<10> <0131>
1630<11> <0237>
1631<12> <0060>
1632<13> <00B4>
1633<14> <02C7>
1634<15> <02D8>
1635<16> <00AF>
1636<17> <02DA>
1637<18> <00B8>
1638<19> <00DF>
1639<1A> <00E6>
1640<1B> <0153>
1641<1C> <00F8>
1642<1D> <00C6>
1643<1E> <0152>
1644<1F> <00D8>
1645<21> <0021>
1646<22> <201D>
1647<23> <0023>
1648<24> <00A3>
1649<27> <2019>
1650<3C> <00A1>
1651<3D> <003D>
1652<3E> <00BF>
1653<5C> <201C>
1654<5F> <02D9>
1655<60> <2018>
1656<7D> <02DD>
1657<7E> <007E>
1658<7F> <00A8>
1659endbfchar
1660endcmap
1661CMapName currentdict /CMap defineresource pop
1662end
1663end
1664%%EndResource
1665%%EOF
1666 }\endgroup
1667 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1668 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1669 }%
1670%
1671% \cmapOT1TT
1672 \begingroup
1673 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1674 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1675%%DocumentNeededResources: ProcSet (CIDInit)
1676%%IncludeResource: ProcSet (CIDInit)
1677%%BeginResource: CMap (TeX-OT1TT-0)
1678%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1679%%Version: 1.000
1680%%EndComments
1681/CIDInit /ProcSet findresource begin
168212 dict begin
1683begincmap
1684/CIDSystemInfo
1685<< /Registry (TeX)
1686/Ordering (OT1TT)
1687/Supplement 0
1688>> def
1689/CMapName /TeX-OT1TT-0 def
1690/CMapType 2 def
16911 begincodespacerange
1692<00> <7F>
1693endcodespacerange
16945 beginbfrange
1695<00> <01> <0393>
1696<09> <0A> <03A8>
1697<21> <26> <0021>
1698<28> <5F> <0028>
1699<61> <7E> <0061>
1700endbfrange
170132 beginbfchar
1702<02> <0398>
1703<03> <039B>
1704<04> <039E>
1705<05> <03A0>
1706<06> <03A3>
1707<07> <03D2>
1708<08> <03A6>
1709<0B> <2191>
1710<0C> <2193>
1711<0D> <0027>
1712<0E> <00A1>
1713<0F> <00BF>
1714<10> <0131>
1715<11> <0237>
1716<12> <0060>
1717<13> <00B4>
1718<14> <02C7>
1719<15> <02D8>
1720<16> <00AF>
1721<17> <02DA>
1722<18> <00B8>
1723<19> <00DF>
1724<1A> <00E6>
1725<1B> <0153>
1726<1C> <00F8>
1727<1D> <00C6>
1728<1E> <0152>
1729<1F> <00D8>
1730<20> <2423>
1731<27> <2019>
1732<60> <2018>
1733<7F> <00A8>
1734endbfchar
1735endcmap
1736CMapName currentdict /CMap defineresource pop
1737end
1738end
1739%%EndResource
1740%%EOF
1741 }\endgroup
1742 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1743 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1744 }%
1745\fi\fi
1746
1747
1748% Set the font macro #1 to the font named #2, adding on the
1749% specified font prefix (normally `cm').
1750% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1751% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
1752% empty to omit).
1753\def\setfont#1#2#3#4#5{%
1754 \font#1=\fontprefix#2#3 scaled #4
1755 \csname cmap#5\endcsname#1%
1756}
1757% This is what gets called when #5 of \setfont is empty.
1758\let\cmap\gobble
1759% emacs-page end of cmaps
1760
1761% Use cm as the default font prefix.
1762% To specify the font prefix, you must define \fontprefix
1763% before you read in texinfo.tex.
1764\ifx\fontprefix\thisisundefined
1765\def\fontprefix{cm}
1766\fi
1767% Support font families that don't use the same naming scheme as CM.
1768\def\rmshape{r}
1769\def\rmbshape{bx} %where the normal face is bold
1770\def\bfshape{b}
1771\def\bxshape{bx}
1772\def\ttshape{tt}
1773\def\ttbshape{tt}
1774\def\ttslshape{sltt}
1775\def\itshape{ti}
1776\def\itbshape{bxti}
1777\def\slshape{sl}
1778\def\slbshape{bxsl}
1779\def\sfshape{ss}
1780\def\sfbshape{ss}
1781\def\scshape{csc}
1782\def\scbshape{csc}
1783
1784% Definitions for a main text size of 11pt. This is the default in
1785% Texinfo.
1786%
1787\def\definetextfontsizexi{%
1788% Text fonts (11.2pt, magstep1).
1789\def\textnominalsize{11pt}
1790\edef\mainmagstep{\magstephalf}
1791\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1792\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1793\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1794\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1795\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1796\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1797\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1798\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1799\font\texti=cmmi10 scaled \mainmagstep
1800\font\textsy=cmsy10 scaled \mainmagstep
1801\def\textecsize{1095}
1802
1803% A few fonts for @defun names and args.
1804\setfont\defbf\bfshape{10}{\magstep1}{OT1}
1805\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1806\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1807\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1808
1809% Fonts for indices, footnotes, small examples (9pt).
1810\def\smallnominalsize{9pt}
1811\setfont\smallrm\rmshape{9}{1000}{OT1}
1812\setfont\smalltt\ttshape{9}{1000}{OT1TT}
1813\setfont\smallbf\bfshape{10}{900}{OT1}
1814\setfont\smallit\itshape{9}{1000}{OT1IT}
1815\setfont\smallsl\slshape{9}{1000}{OT1}
1816\setfont\smallsf\sfshape{9}{1000}{OT1}
1817\setfont\smallsc\scshape{10}{900}{OT1}
1818\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1819\font\smalli=cmmi9
1820\font\smallsy=cmsy9
1821\def\smallecsize{0900}
1822
1823% Fonts for small examples (8pt).
1824\def\smallernominalsize{8pt}
1825\setfont\smallerrm\rmshape{8}{1000}{OT1}
1826\setfont\smallertt\ttshape{8}{1000}{OT1TT}
1827\setfont\smallerbf\bfshape{10}{800}{OT1}
1828\setfont\smallerit\itshape{8}{1000}{OT1IT}
1829\setfont\smallersl\slshape{8}{1000}{OT1}
1830\setfont\smallersf\sfshape{8}{1000}{OT1}
1831\setfont\smallersc\scshape{10}{800}{OT1}
1832\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1833\font\smalleri=cmmi8
1834\font\smallersy=cmsy8
1835\def\smallerecsize{0800}
1836
1837% Fonts for title page (20.4pt):
1838\def\titlenominalsize{20pt}
1839\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1840\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1841\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1842\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1843\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1844\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1845\let\titlebf=\titlerm
1846\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1847\font\titlei=cmmi12 scaled \magstep3
1848\font\titlesy=cmsy10 scaled \magstep4
1849\def\titleecsize{2074}
1850
1851% Chapter (and unnumbered) fonts (17.28pt).
1852\def\chapnominalsize{17pt}
1853\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
1854\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
1855\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
1856\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
1857\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
1858\setfont\chapsf\sfbshape{17}{1000}{OT1}
1859\let\chapbf=\chaprm
1860\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
1861\font\chapi=cmmi12 scaled \magstep2
1862\font\chapsy=cmsy10 scaled \magstep3
1863\def\chapecsize{1728}
1864
1865% Section fonts (14.4pt).
1866\def\secnominalsize{14pt}
1867\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
1868\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
1869\setfont\secsl\slbshape{10}{\magstep2}{OT1}
1870\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
1871\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
1872\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
1873\let\secbf\secrm
1874\setfont\secsc\scbshape{10}{\magstep2}{OT1}
1875\font\seci=cmmi12 scaled \magstep1
1876\font\secsy=cmsy10 scaled \magstep2
1877\def\sececsize{1440}
1878
1879% Subsection fonts (13.15pt).
1880\def\ssecnominalsize{13pt}
1881\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
1882\setfont\ssecit\itbshape{10}{1315}{OT1IT}
1883\setfont\ssecsl\slbshape{10}{1315}{OT1}
1884\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
1885\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
1886\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
1887\let\ssecbf\ssecrm
1888\setfont\ssecsc\scbshape{10}{1315}{OT1}
1889\font\sseci=cmmi12 scaled \magstephalf
1890\font\ssecsy=cmsy10 scaled 1315
1891\def\ssececsize{1200}
1892
1893% Reduced fonts for @acro in text (10pt).
1894\def\reducednominalsize{10pt}
1895\setfont\reducedrm\rmshape{10}{1000}{OT1}
1896\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
1897\setfont\reducedbf\bfshape{10}{1000}{OT1}
1898\setfont\reducedit\itshape{10}{1000}{OT1IT}
1899\setfont\reducedsl\slshape{10}{1000}{OT1}
1900\setfont\reducedsf\sfshape{10}{1000}{OT1}
1901\setfont\reducedsc\scshape{10}{1000}{OT1}
1902\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
1903\font\reducedi=cmmi10
1904\font\reducedsy=cmsy10
1905\def\reducedecsize{1000}
1906
1907\textleading = 13.2pt % line spacing for 11pt CM
1908\textfonts % reset the current fonts
1909\rm
1910} % end of 11pt text font size definitions
1911
1912
1913% Definitions to make the main text be 10pt Computer Modern, with
1914% section, chapter, etc., sizes following suit. This is for the GNU
1915% Press printing of the Emacs 22 manual. Maybe other manuals in the
1916% future. Used with @smallbook, which sets the leading to 12pt.
1917%
1918\def\definetextfontsizex{%
1919% Text fonts (10pt).
1920\def\textnominalsize{10pt}
1921\edef\mainmagstep{1000}
1922\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1923\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1924\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1925\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1926\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1927\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1928\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1929\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1930\font\texti=cmmi10 scaled \mainmagstep
1931\font\textsy=cmsy10 scaled \mainmagstep
1932\def\textecsize{1000}
1933
1934% A few fonts for @defun names and args.
1935\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
1936\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
1937\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
1938\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1939
1940% Fonts for indices, footnotes, small examples (9pt).
1941\def\smallnominalsize{9pt}
1942\setfont\smallrm\rmshape{9}{1000}{OT1}
1943\setfont\smalltt\ttshape{9}{1000}{OT1TT}
1944\setfont\smallbf\bfshape{10}{900}{OT1}
1945\setfont\smallit\itshape{9}{1000}{OT1IT}
1946\setfont\smallsl\slshape{9}{1000}{OT1}
1947\setfont\smallsf\sfshape{9}{1000}{OT1}
1948\setfont\smallsc\scshape{10}{900}{OT1}
1949\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1950\font\smalli=cmmi9
1951\font\smallsy=cmsy9
1952\def\smallecsize{0900}
1953
1954% Fonts for small examples (8pt).
1955\def\smallernominalsize{8pt}
1956\setfont\smallerrm\rmshape{8}{1000}{OT1}
1957\setfont\smallertt\ttshape{8}{1000}{OT1TT}
1958\setfont\smallerbf\bfshape{10}{800}{OT1}
1959\setfont\smallerit\itshape{8}{1000}{OT1IT}
1960\setfont\smallersl\slshape{8}{1000}{OT1}
1961\setfont\smallersf\sfshape{8}{1000}{OT1}
1962\setfont\smallersc\scshape{10}{800}{OT1}
1963\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1964\font\smalleri=cmmi8
1965\font\smallersy=cmsy8
1966\def\smallerecsize{0800}
1967
1968% Fonts for title page (20.4pt):
1969\def\titlenominalsize{20pt}
1970\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1971\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1972\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1973\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1974\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1975\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1976\let\titlebf=\titlerm
1977\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1978\font\titlei=cmmi12 scaled \magstep3
1979\font\titlesy=cmsy10 scaled \magstep4
1980\def\titleecsize{2074}
1981
1982% Chapter fonts (14.4pt).
1983\def\chapnominalsize{14pt}
1984\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
1985\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
1986\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
1987\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
1988\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
1989\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
1990\let\chapbf\chaprm
1991\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
1992\font\chapi=cmmi12 scaled \magstep1
1993\font\chapsy=cmsy10 scaled \magstep2
1994\def\chapecsize{1440}
1995
1996% Section fonts (12pt).
1997\def\secnominalsize{12pt}
1998\setfont\secrm\rmbshape{12}{1000}{OT1}
1999\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2000\setfont\secsl\slbshape{10}{\magstep1}{OT1}
2001\setfont\sectt\ttbshape{12}{1000}{OT1TT}
2002\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2003\setfont\secsf\sfbshape{12}{1000}{OT1}
2004\let\secbf\secrm
2005\setfont\secsc\scbshape{10}{\magstep1}{OT1}
2006\font\seci=cmmi12
2007\font\secsy=cmsy10 scaled \magstep1
2008\def\sececsize{1200}
2009
2010% Subsection fonts (10pt).
2011\def\ssecnominalsize{10pt}
2012\setfont\ssecrm\rmbshape{10}{1000}{OT1}
2013\setfont\ssecit\itbshape{10}{1000}{OT1IT}
2014\setfont\ssecsl\slbshape{10}{1000}{OT1}
2015\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2016\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2017\setfont\ssecsf\sfbshape{10}{1000}{OT1}
2018\let\ssecbf\ssecrm
2019\setfont\ssecsc\scbshape{10}{1000}{OT1}
2020\font\sseci=cmmi10
2021\font\ssecsy=cmsy10
2022\def\ssececsize{1000}
2023
2024% Reduced fonts for @acro in text (9pt).
2025\def\reducednominalsize{9pt}
2026\setfont\reducedrm\rmshape{9}{1000}{OT1}
2027\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2028\setfont\reducedbf\bfshape{10}{900}{OT1}
2029\setfont\reducedit\itshape{9}{1000}{OT1IT}
2030\setfont\reducedsl\slshape{9}{1000}{OT1}
2031\setfont\reducedsf\sfshape{9}{1000}{OT1}
2032\setfont\reducedsc\scshape{10}{900}{OT1}
2033\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2034\font\reducedi=cmmi9
2035\font\reducedsy=cmsy9
2036\def\reducedecsize{0900}
2037
2038\divide\parskip by 2 % reduce space between paragraphs
2039\textleading = 12pt % line spacing for 10pt CM
2040\textfonts % reset the current fonts
2041\rm
2042} % end of 10pt text font size definitions
2043
2044
2045% We provide the user-level command
2046% @fonttextsize 10
2047% (or 11) to redefine the text font size. pt is assumed.
2048%
2049\def\xiword{11}
2050\def\xword{10}
2051\def\xwordpt{10pt}
2052%
2053\parseargdef\fonttextsize{%
2054 \def\textsizearg{#1}%
2055 %\wlog{doing @fonttextsize \textsizearg}%
2056 %
2057 % Set \globaldefs so that documents can use this inside @tex, since
2058 % makeinfo 4.8 does not support it, but we need it nonetheless.
2059 %
2060 \begingroup \globaldefs=1
2061 \ifx\textsizearg\xword \definetextfontsizex
2062 \else \ifx\textsizearg\xiword \definetextfontsizexi
2063 \else
2064 \errhelp=\EMsimple
2065 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2066 \fi\fi
2067 \endgroup
2068}
2069
2070
2071% In order for the font changes to affect most math symbols and letters,
2072% we have to define the \textfont of the standard families. Since
2073% texinfo doesn't allow for producing subscripts and superscripts except
2074% in the main text, we don't bother to reset \scriptfont and
2075% \scriptscriptfont (which would also require loading a lot more fonts).
2076%
2077\def\resetmathfonts{%
2078 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2079 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2080 \textfont\ttfam=\tentt \textfont\sffam=\tensf
2081}
2082
2083% The font-changing commands redefine the meanings of \tenSTYLE, instead
2084% of just \STYLE. We do this because \STYLE needs to also set the
2085% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2086% \tenSTYLE to set the current font.
2087%
2088% Each font-changing command also sets the names \lsize (one size lower)
2089% and \lllsize (three sizes lower). These relative commands are used in
2090% the LaTeX logo and acronyms.
2091%
2092% This all needs generalizing, badly.
2093%
2094\def\textfonts{%
2095 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2096 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2097 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2098 \let\tenttsl=\textttsl
2099 \def\curfontsize{text}%
2100 \def\lsize{reduced}\def\lllsize{smaller}%
2101 \resetmathfonts \setleading{\textleading}}
2102\def\titlefonts{%
2103 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2104 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2105 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2106 \let\tenttsl=\titlettsl
2107 \def\curfontsize{title}%
2108 \def\lsize{chap}\def\lllsize{subsec}%
2109 \resetmathfonts \setleading{27pt}}
2110\def\titlefont#1{{\titlefonts\rmisbold #1}}
2111\def\chapfonts{%
2112 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2113 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2114 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2115 \let\tenttsl=\chapttsl
2116 \def\curfontsize{chap}%
2117 \def\lsize{sec}\def\lllsize{text}%
2118 \resetmathfonts \setleading{19pt}}
2119\def\secfonts{%
2120 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2121 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2122 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2123 \let\tenttsl=\secttsl
2124 \def\curfontsize{sec}%
2125 \def\lsize{subsec}\def\lllsize{reduced}%
2126 \resetmathfonts \setleading{16pt}}
2127\def\subsecfonts{%
2128 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2129 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2130 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2131 \let\tenttsl=\ssecttsl
2132 \def\curfontsize{ssec}%
2133 \def\lsize{text}\def\lllsize{small}%
2134 \resetmathfonts \setleading{15pt}}
2135\let\subsubsecfonts = \subsecfonts
2136\def\reducedfonts{%
2137 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2138 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2139 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2140 \let\tenttsl=\reducedttsl
2141 \def\curfontsize{reduced}%
2142 \def\lsize{small}\def\lllsize{smaller}%
2143 \resetmathfonts \setleading{10.5pt}}
2144\def\smallfonts{%
2145 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2146 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2147 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2148 \let\tenttsl=\smallttsl
2149 \def\curfontsize{small}%
2150 \def\lsize{smaller}\def\lllsize{smaller}%
2151 \resetmathfonts \setleading{10.5pt}}
2152\def\smallerfonts{%
2153 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2154 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2155 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2156 \let\tenttsl=\smallerttsl
2157 \def\curfontsize{smaller}%
2158 \def\lsize{smaller}\def\lllsize{smaller}%
2159 \resetmathfonts \setleading{9.5pt}}
2160
2161% Fonts for short table of contents.
2162\setfont\shortcontrm\rmshape{12}{1000}{OT1}
2163\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2164\setfont\shortcontsl\slshape{12}{1000}{OT1}
2165\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2166
2167% Define these just so they can be easily changed for other fonts.
2168\def\angleleft{$\langle$}
2169\def\angleright{$\rangle$}
2170
2171% Set the fonts to use with the @small... environments.
2172\let\smallexamplefonts = \smallfonts
2173
2174% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2175% can fit this many characters:
2176% 8.5x11=86 smallbook=72 a4=90 a5=69
2177% If we use \scriptfonts (8pt), then we can fit this many characters:
2178% 8.5x11=90+ smallbook=80 a4=90+ a5=77
2179% For me, subjectively, the few extra characters that fit aren't worth
2180% the additional smallness of 8pt. So I'm making the default 9pt.
2181%
2182% By the way, for comparison, here's what fits with @example (10pt):
2183% 8.5x11=71 smallbook=60 a4=75 a5=58
2184% --karl, 24jan03.
2185
2186% Set up the default fonts, so we can use them for creating boxes.
2187%
2188\definetextfontsizexi
2189
2190
2191\message{markup,}
2192
2193% Check if we are currently using a typewriter font. Since all the
2194% Computer Modern typewriter fonts have zero interword stretch (and
2195% shrink), and it is reasonable to expect all typewriter fonts to have
2196% this property, we can check that font parameter.
2197%
2198\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2199
2200% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2201% define and register \INITMACRO to be called on markup style changes.
2202% \INITMACRO can check \currentmarkupstyle for the innermost
2203% style and the set of \ifmarkupSTYLE switches for all styles
2204% currently in effect.
2205\newif\ifmarkupvar
2206\newif\ifmarkupsamp
2207\newif\ifmarkupkey
2208%\newif\ifmarkupfile % @file == @samp.
2209%\newif\ifmarkupoption % @option == @samp.
2210\newif\ifmarkupcode
2211\newif\ifmarkupkbd
2212%\newif\ifmarkupenv % @env == @code.
2213%\newif\ifmarkupcommand % @command == @code.
2214\newif\ifmarkuptex % @tex (and part of @math, for now).
2215\newif\ifmarkupexample
2216\newif\ifmarkupverb
2217\newif\ifmarkupverbatim
2218
2219\let\currentmarkupstyle\empty
2220
2221\def\setupmarkupstyle#1{%
2222 \csname markup#1true\endcsname
2223 \def\currentmarkupstyle{#1}%
2224 \markupstylesetup
2225}
2226
2227\let\markupstylesetup\empty
2228
2229\def\defmarkupstylesetup#1{%
2230 \expandafter\def\expandafter\markupstylesetup
2231 \expandafter{\markupstylesetup #1}%
2232 \def#1%
2233}
2234
2235% Markup style setup for left and right quotes.
2236\defmarkupstylesetup\markupsetuplq{%
2237 \expandafter\let\expandafter \temp
2238 \csname markupsetuplq\currentmarkupstyle\endcsname
2239 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2240}
2241
2242\defmarkupstylesetup\markupsetuprq{%
2243 \expandafter\let\expandafter \temp
2244 \csname markupsetuprq\currentmarkupstyle\endcsname
2245 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2246}
2247
2248{
2249\catcode`\'=\active
2250\catcode`\`=\active
2251
2252\gdef\markupsetuplqdefault{\let`\lq}
2253\gdef\markupsetuprqdefault{\let'\rq}
2254
2255\gdef\markupsetcodequoteleft{\let`\codequoteleft}
2256\gdef\markupsetcodequoteright{\let'\codequoteright}
2257
2258\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
2259}
2260
2261\let\markupsetuplqcode \markupsetcodequoteleft
2262\let\markupsetuprqcode \markupsetcodequoteright
2263%
2264\let\markupsetuplqexample \markupsetcodequoteleft
2265\let\markupsetuprqexample \markupsetcodequoteright
2266%
2267\let\markupsetuplqsamp \markupsetcodequoteleft
2268\let\markupsetuprqsamp \markupsetcodequoteright
2269%
2270\let\markupsetuplqverb \markupsetcodequoteleft
2271\let\markupsetuprqverb \markupsetcodequoteright
2272%
2273\let\markupsetuplqverbatim \markupsetcodequoteleft
2274\let\markupsetuprqverbatim \markupsetcodequoteright
2275
2276\let\markupsetuplqkbd \markupsetnoligaturesquoteleft
2277
2278% Allow an option to not use regular directed right quote/apostrophe
2279% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2280% The undirected quote is ugly, so don't make it the default, but it
2281% works for pasting with more pdf viewers (at least evince), the
2282% lilypond developers report. xpdf does work with the regular 0x27.
2283%
2284\def\codequoteright{%
2285 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2286 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2287 '%
2288 \else \char'15 \fi
2289 \else \char'15 \fi
2290}
2291%
2292% and a similar option for the left quote char vs. a grave accent.
2293% Modern fonts display ASCII 0x60 as a grave accent, so some people like
2294% the code environments to do likewise.
2295%
2296\def\codequoteleft{%
2297 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2298 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2299 % [Knuth] pp. 380,381,391
2300 % \relax disables Spanish ligatures ?` and !` of \tt font.
2301 \relax`%
2302 \else \char'22 \fi
2303 \else \char'22 \fi
2304}
2305
2306% Commands to set the quote options.
2307%
2308\parseargdef\codequoteundirected{%
2309 \def\temp{#1}%
2310 \ifx\temp\onword
2311 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2312 = t%
2313 \else\ifx\temp\offword
2314 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2315 = \relax
2316 \else
2317 \errhelp = \EMsimple
2318 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2319 \fi\fi
2320}
2321%
2322\parseargdef\codequotebacktick{%
2323 \def\temp{#1}%
2324 \ifx\temp\onword
2325 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2326 = t%
2327 \else\ifx\temp\offword
2328 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2329 = \relax
2330 \else
2331 \errhelp = \EMsimple
2332 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2333 \fi\fi
2334}
2335
2336% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2337\def\noligaturesquoteleft{\relax\lq}
2338
2339% Count depth in font-changes, for error checks
2340\newcount\fontdepth \fontdepth=0
2341
2342% Font commands.
2343
2344% #1 is the font command (\sl or \it), #2 is the text to slant.
2345% If we are in a monospaced environment, however, 1) always use \ttsl,
2346% and 2) do not add an italic correction.
2347\def\dosmartslant#1#2{%
2348 \ifusingtt
2349 {{\ttsl #2}\let\next=\relax}%
2350 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2351 \next
2352}
2353\def\smartslanted{\dosmartslant\sl}
2354\def\smartitalic{\dosmartslant\it}
2355
2356% Output an italic correction unless \next (presumed to be the following
2357% character) is such as not to need one.
2358\def\smartitaliccorrection{%
2359 \ifx\next,%
2360 \else\ifx\next-%
2361 \else\ifx\next.%
2362 \else\ptexslash
2363 \fi\fi\fi
2364 \aftersmartic
2365}
2366
2367% like \smartslanted except unconditionally uses \ttsl, and no ic.
2368% @var is set to this for defun arguments.
2369\def\ttslanted#1{{\ttsl #1}}
2370
2371% @cite is like \smartslanted except unconditionally use \sl. We never want
2372% ttsl for book titles, do we?
2373\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2374
2375\def\aftersmartic{}
2376\def\var#1{%
2377 \let\saveaftersmartic = \aftersmartic
2378 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2379 \smartslanted{#1}%
2380}
2381
2382\let\i=\smartitalic
2383\let\slanted=\smartslanted
2384\let\dfn=\smartslanted
2385\let\emph=\smartitalic
2386
2387% Explicit font changes: @r, @sc, undocumented @ii.
2388\def\r#1{{\rm #1}} % roman font
2389\def\sc#1{{\smallcaps#1}} % smallcaps font
2390\def\ii#1{{\it #1}} % italic font
2391
2392% @b, explicit bold. Also @strong.
2393\def\b#1{{\bf #1}}
2394\let\strong=\b
2395
2396% @sansserif, explicit sans.
2397\def\sansserif#1{{\sf #1}}
2398
2399% We can't just use \exhyphenpenalty, because that only has effect at
2400% the end of a paragraph. Restore normal hyphenation at the end of the
2401% group within which \nohyphenation is presumably called.
2402%
2403\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2404\def\restorehyphenation{\hyphenchar\font = `- }
2405
2406% Set sfcode to normal for the chars that usually have another value.
2407% Can't use plain's \frenchspacing because it uses the `\x notation, and
2408% sometimes \x has an active definition that messes things up.
2409%
2410\catcode`@=11
2411 \def\plainfrenchspacing{%
2412 \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
2413 \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
2414 \def\endofsentencespacefactor{1000}% for @. and friends
2415 }
2416 \def\plainnonfrenchspacing{%
2417 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2418 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2419 \def\endofsentencespacefactor{3000}% for @. and friends
2420 }
2421\catcode`@=\other
2422\def\endofsentencespacefactor{3000}% default
2423
2424% @t, explicit typewriter.
2425\def\t#1{%
2426 {\tt \rawbackslash \plainfrenchspacing #1}%
2427 \null
2428}
2429
2430% @samp.
2431\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2432
2433% definition of @key that produces a lozenge. Doesn't adjust to text size.
2434%\setfont\keyrm\rmshape{8}{1000}{OT1}
2435%\font\keysy=cmsy9
2436%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2437% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2438% \vbox{\hrule\kern-0.4pt
2439% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2440% \kern-0.4pt\hrule}%
2441% \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2442
2443% definition of @key with no lozenge. If the current font is already
2444% monospace, don't change it; that way, we respect @kbdinputstyle. But
2445% if it isn't monospace, then use \tt.
2446%
2447\def\key#1{{\setupmarkupstyle{key}%
2448 \nohyphenation
2449 \ifmonospace\else\tt\fi
2450 #1}\null}
2451
2452% ctrl is no longer a Texinfo command.
2453\def\ctrl #1{{\tt \rawbackslash \hat}#1}
2454
2455% @file, @option are the same as @samp.
2456\let\file=\samp
2457\let\option=\samp
2458
2459% @code is a modification of @t,
2460% which makes spaces the same size as normal in the surrounding text.
2461\def\tclose#1{%
2462 {%
2463 % Change normal interword space to be same as for the current font.
2464 \spaceskip = \fontdimen2\font
2465 %
2466 % Switch to typewriter.
2467 \tt
2468 %
2469 % But `\ ' produces the large typewriter interword space.
2470 \def\ {{\spaceskip = 0pt{} }}%
2471 %
2472 % Turn off hyphenation.
2473 \nohyphenation
2474 %
2475 \rawbackslash
2476 \plainfrenchspacing
2477 #1%
2478 }%
2479 \null % reset spacefactor to 1000
2480}
2481
2482% We *must* turn on hyphenation at `-' and `_' in @code.
2483% Otherwise, it is too hard to avoid overfull hboxes
2484% in the Emacs manual, the Library manual, etc.
2485
2486% Unfortunately, TeX uses one parameter (\hyphenchar) to control
2487% both hyphenation at - and hyphenation within words.
2488% We must therefore turn them both off (\tclose does that)
2489% and arrange explicitly to hyphenate at a dash.
2490% -- rms.
2491{
2492 \catcode`\-=\active \catcode`\_=\active
2493 \catcode`\'=\active \catcode`\`=\active
2494 \global\let'=\rq \global\let`=\lq % default definitions
2495 %
2496 \global\def\code{\begingroup
2497 \setupmarkupstyle{code}%
2498 % The following should really be moved into \setupmarkupstyle handlers.
2499 \catcode\dashChar=\active \catcode\underChar=\active
2500 \ifallowcodebreaks
2501 \let-\codedash
2502 \let_\codeunder
2503 \else
2504 \let-\realdash
2505 \let_\realunder
2506 \fi
2507 \codex
2508 }
2509}
2510
2511\def\codex #1{\tclose{#1}\endgroup}
2512
2513\def\realdash{-}
2514\def\codedash{-\discretionary{}{}{}}
2515\def\codeunder{%
2516 % this is all so @math{@code{var_name}+1} can work. In math mode, _
2517 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2518 % will therefore expand the active definition of _, which is us
2519 % (inside @code that is), therefore an endless loop.
2520 \ifusingtt{\ifmmode
2521 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2522 \else\normalunderscore \fi
2523 \discretionary{}{}{}}%
2524 {\_}%
2525}
2526
2527% An additional complication: the above will allow breaks after, e.g.,
2528% each of the four underscores in __typeof__. This is undesirable in
2529% some manuals, especially if they don't have long identifiers in
2530% general. @allowcodebreaks provides a way to control this.
2531%
2532\newif\ifallowcodebreaks \allowcodebreakstrue
2533
2534\def\keywordtrue{true}
2535\def\keywordfalse{false}
2536
2537\parseargdef\allowcodebreaks{%
2538 \def\txiarg{#1}%
2539 \ifx\txiarg\keywordtrue
2540 \allowcodebreakstrue
2541 \else\ifx\txiarg\keywordfalse
2542 \allowcodebreaksfalse
2543 \else
2544 \errhelp = \EMsimple
2545 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2546 \fi\fi
2547}
2548
2549% @uref (abbreviation for `urlref') takes an optional (comma-separated)
2550% second argument specifying the text to display and an optional third
2551% arg as text to display instead of (rather than in addition to) the url
2552% itself. First (mandatory) arg is the url.
2553% (This \urefnobreak definition isn't used now, leaving it for a while
2554% for comparison.)
2555\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
2556\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
2557 \unsepspaces
2558 \pdfurl{#1}%
2559 \setbox0 = \hbox{\ignorespaces #3}%
2560 \ifdim\wd0 > 0pt
2561 \unhbox0 % third arg given, show only that
2562 \else
2563 \setbox0 = \hbox{\ignorespaces #2}%
2564 \ifdim\wd0 > 0pt
2565 \ifpdf
2566 \unhbox0 % PDF: 2nd arg given, show only it
2567 \else
2568 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
2569 \fi
2570 \else
2571 \code{#1}% only url given, so show it
2572 \fi
2573 \fi
2574 \endlink
2575\endgroup}
2576
2577% This \urefbreak definition is the active one.
2578\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2579\let\uref=\urefbreak
2580\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2581\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2582 \unsepspaces
2583 \pdfurl{#1}%
2584 \setbox0 = \hbox{\ignorespaces #3}%
2585 \ifdim\wd0 > 0pt
2586 \unhbox0 % third arg given, show only that
2587 \else
2588 \setbox0 = \hbox{\ignorespaces #2}%
2589 \ifdim\wd0 > 0pt
2590 \ifpdf
2591 \unhbox0 % PDF: 2nd arg given, show only it
2592 \else
2593 \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
2594 \fi
2595 \else
2596 \urefcode{#1}% only url given, so show it
2597 \fi
2598 \fi
2599 \endlink
2600\endgroup}
2601
2602% Allow line breaks around only a few characters (only).
2603\def\urefcatcodes{%
2604 \catcode\ampChar=\active \catcode\dotChar=\active
2605 \catcode\hashChar=\active \catcode\questChar=\active
2606 \catcode\slashChar=\active
2607}
2608{
2609 \urefcatcodes
2610 %
2611 \global\def\urefcode{\begingroup
2612 \setupmarkupstyle{code}%
2613 \urefcatcodes
2614 \let&\urefcodeamp
2615 \let.\urefcodedot
2616 \let#\urefcodehash
2617 \let?\urefcodequest
2618 \let/\urefcodeslash
2619 \codex
2620 }
2621 %
2622 % By default, they are just regular characters.
2623 \global\def&{\normalamp}
2624 \global\def.{\normaldot}
2625 \global\def#{\normalhash}
2626 \global\def?{\normalquest}
2627 \global\def/{\normalslash}
2628}
2629
2630% we put a little stretch before and after the breakable chars, to help
2631% line breaking of long url's. The unequal skips make look better in
2632% cmtt at least, especially for dots.
2633\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
2634\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
2635%
2636\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2637\def\urefcodedot{\urefprestretch .\urefpoststretch}
2638\def\urefcodehash{\urefprestretch \#\urefpoststretch}
2639\def\urefcodequest{\urefprestretch ?\urefpoststretch}
2640\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2641{
2642 \catcode`\/=\active
2643 \global\def\urefcodeslashfinish{%
2644 \urefprestretch \slashChar
2645 % Allow line break only after the final / in a sequence of
2646 % slashes, to avoid line break between the slashes in http://.
2647 \ifx\next/\else \urefpoststretch \fi
2648 }
2649}
2650
2651% One more complication: by default we'll break after the special
2652% characters, but some people like to break before the special chars, so
2653% allow that. Also allow no breaking at all, for manual control.
2654%
2655\parseargdef\urefbreakstyle{%
2656 \def\txiarg{#1}%
2657 \ifx\txiarg\wordnone
2658 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2659 \else\ifx\txiarg\wordbefore
2660 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2661 \else\ifx\txiarg\wordafter
2662 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2663 \else
2664 \errhelp = \EMsimple
2665 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2666 \fi\fi\fi
2667}
2668\def\wordafter{after}
2669\def\wordbefore{before}
2670\def\wordnone{none}
2671
2672\urefbreakstyle after
2673
2674% @url synonym for @uref, since that's how everyone uses it.
2675%
2676\let\url=\uref
2677
2678% rms does not like angle brackets --karl, 17may97.
2679% So now @email is just like @uref, unless we are pdf.
2680%
2681%\def\email#1{\angleleft{\tt #1}\angleright}
2682\ifpdf
2683 \def\email#1{\doemail#1,,\finish}
2684 \def\doemail#1,#2,#3\finish{\begingroup
2685 \unsepspaces
2686 \pdfurl{mailto:#1}%
2687 \setbox0 = \hbox{\ignorespaces #2}%
2688 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2689 \endlink
2690 \endgroup}
2691\else
2692 \let\email=\uref
2693\fi
2694
2695% @kbd is like @code, except that if the argument is just one @key command,
2696% then @kbd has no effect.
2697\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
2698
2699% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2700% `example' (@kbd uses ttsl only inside of @example and friends),
2701% or `code' (@kbd uses normal tty font always).
2702\parseargdef\kbdinputstyle{%
2703 \def\txiarg{#1}%
2704 \ifx\txiarg\worddistinct
2705 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2706 \else\ifx\txiarg\wordexample
2707 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2708 \else\ifx\txiarg\wordcode
2709 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2710 \else
2711 \errhelp = \EMsimple
2712 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2713 \fi\fi\fi
2714}
2715\def\worddistinct{distinct}
2716\def\wordexample{example}
2717\def\wordcode{code}
2718
2719% Default is `distinct'.
2720\kbdinputstyle distinct
2721
2722\def\xkey{\key}
2723\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2724\ifx\one\xkey\ifx\threex\three \key{#2}%
2725\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2726\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
2727
2728% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2729\let\indicateurl=\code
2730\let\env=\code
2731\let\command=\code
2732
2733% @clicksequence{File @click{} Open ...}
2734\def\clicksequence#1{\begingroup #1\endgroup}
2735
2736% @clickstyle @arrow (by default)
2737\parseargdef\clickstyle{\def\click{#1}}
2738\def\click{\arrow}
2739
2740% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2741% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2742%
2743\def\dmn#1{\thinspace #1}
2744
2745% @l was never documented to mean ``switch to the Lisp font'',
2746% and it is not used as such in any manual I can find. We need it for
2747% Polish suppressed-l. --karl, 22sep96.
2748%\def\l#1{{\li #1}\null}
2749
2750% @acronym for "FBI", "NATO", and the like.
2751% We print this one point size smaller, since it's intended for
2752% all-uppercase.
2753%
2754\def\acronym#1{\doacronym #1,,\finish}
2755\def\doacronym#1,#2,#3\finish{%
2756 {\selectfonts\lsize #1}%
2757 \def\temp{#2}%
2758 \ifx\temp\empty \else
2759 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2760 \fi
2761 \null % reset \spacefactor=1000
2762}
2763
2764% @abbr for "Comput. J." and the like.
2765% No font change, but don't do end-of-sentence spacing.
2766%
2767\def\abbr#1{\doabbr #1,,\finish}
2768\def\doabbr#1,#2,#3\finish{%
2769 {\plainfrenchspacing #1}%
2770 \def\temp{#2}%
2771 \ifx\temp\empty \else
2772 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2773 \fi
2774 \null % reset \spacefactor=1000
2775}
2776
2777% @asis just yields its argument. Used with @table, for example.
2778%
2779\def\asis#1{#1}
2780
2781% @math outputs its argument in math mode.
2782%
2783% One complication: _ usually means subscripts, but it could also mean
2784% an actual _ character, as in @math{@var{some_variable} + 1}. So make
2785% _ active, and distinguish by seeing if the current family is \slfam,
2786% which is what @var uses.
2787{
2788 \catcode`\_ = \active
2789 \gdef\mathunderscore{%
2790 \catcode`\_=\active
2791 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2792 }
2793}
2794% Another complication: we want \\ (and @\) to output a math (or tt) \.
2795% FYI, plain.tex uses \\ as a temporary control sequence (for no
2796% particular reason), but this is not advertised and we don't care.
2797%
2798% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2799\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2800%
2801\def\math{%
2802 \tex
2803 \mathunderscore
2804 \let\\ = \mathbackslash
2805 \mathactive
2806 % make the texinfo accent commands work in math mode
2807 \let\"=\ddot
2808 \let\'=\acute
2809 \let\==\bar
2810 \let\^=\hat
2811 \let\`=\grave
2812 \let\u=\breve
2813 \let\v=\check
2814 \let\~=\tilde
2815 \let\dotaccent=\dot
2816 $\finishmath
2817}
2818\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
2819
2820% Some active characters (such as <) are spaced differently in math.
2821% We have to reset their definitions in case the @math was an argument
2822% to a command which sets the catcodes (such as @item or @section).
2823%
2824{
2825 \catcode`^ = \active
2826 \catcode`< = \active
2827 \catcode`> = \active
2828 \catcode`+ = \active
2829 \catcode`' = \active
2830 \gdef\mathactive{%
2831 \let^ = \ptexhat
2832 \let< = \ptexless
2833 \let> = \ptexgtr
2834 \let+ = \ptexplus
2835 \let' = \ptexquoteright
2836 }
2837}
2838
2839% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
2840% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
2841% except specified as a normal braced arg, so no newlines to worry about.
2842%
2843\def\outfmtnametex{tex}
2844%
2845\def\inlinefmt#1{\doinlinefmt #1,\finish}
2846\def\doinlinefmt#1,#2,\finish{%
2847 \def\inlinefmtname{#1}%
2848 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
2849}
2850% For raw, must switch into @tex before parsing the argument, to avoid
2851% setting catcodes prematurely. Doing it this way means that, for
2852% example, @inlineraw{html, foo{bar} gets a parse error instead of being
2853% ignored. But this isn't important because if people want a literal
2854% *right* brace they would have to use a command anyway, so they may as
2855% well use a command to get a left brace too. We could re-use the
2856% delimiter character idea from \verb, but it seems like overkill.
2857%
2858\def\inlineraw{\tex \doinlineraw}
2859\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
2860\def\doinlinerawtwo#1,#2,\finish{%
2861 \def\inlinerawname{#1}%
2862 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
2863 \endgroup % close group opened by \tex.
2864}
2865
2866
2867\message{glyphs,}
2868% and logos.
2869
2870% @@ prints an @, as does @atchar{}.
2871\def\@{\char64 }
2872\let\atchar=\@
2873
2874% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
2875% Unless we're in typewriter, use \ecfont because the CM text fonts do
2876% not have braces, and we don't want to switch into math.
2877\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
2878\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
2879\let\{=\mylbrace \let\lbracechar=\{
2880\let\}=\myrbrace \let\rbracechar=\}
2881\begingroup
2882 % Definitions to produce \{ and \} commands for indices,
2883 % and @{ and @} for the aux/toc files.
2884 \catcode`\{ = \other \catcode`\} = \other
2885 \catcode`\[ = 1 \catcode`\] = 2
2886 \catcode`\! = 0 \catcode`\\ = \other
2887 !gdef!lbracecmd[\{]%
2888 !gdef!rbracecmd[\}]%
2889 !gdef!lbraceatcmd[@{]%
2890 !gdef!rbraceatcmd[@}]%
2891!endgroup
2892
2893% @comma{} to avoid , parsing problems.
2894\let\comma = ,
2895
2896% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
2897% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
2898\let\, = \ptexc
2899\let\dotaccent = \ptexdot
2900\def\ringaccent#1{{\accent23 #1}}
2901\let\tieaccent = \ptext
2902\let\ubaraccent = \ptexb
2903\let\udotaccent = \d
2904
2905% Other special characters: @questiondown @exclamdown @ordf @ordm
2906% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
2907\def\questiondown{?`}
2908\def\exclamdown{!`}
2909\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
2910\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
2911
2912% Dotless i and dotless j, used for accents.
2913\def\imacro{i}
2914\def\jmacro{j}
2915\def\dotless#1{%
2916 \def\temp{#1}%
2917 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
2918 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
2919 \else \errmessage{@dotless can be used only with i or j}%
2920 \fi\fi
2921}
2922
2923% The \TeX{} logo, as in plain, but resetting the spacing so that a
2924% period following counts as ending a sentence. (Idea found in latex.)
2925%
2926\edef\TeX{\TeX \spacefactor=1000 }
2927
2928% @LaTeX{} logo. Not quite the same results as the definition in
2929% latex.ltx, since we use a different font for the raised A; it's most
2930% convenient for us to use an explicitly smaller font, rather than using
2931% the \scriptstyle font (since we don't reset \scriptstyle and
2932% \scriptscriptstyle).
2933%
2934\def\LaTeX{%
2935 L\kern-.36em
2936 {\setbox0=\hbox{T}%
2937 \vbox to \ht0{\hbox{%
2938 \ifx\textnominalsize\xwordpt
2939 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
2940 % Revert to plain's \scriptsize, which is 7pt.
2941 \count255=\the\fam $\fam\count255 \scriptstyle A$%
2942 \else
2943 % For 11pt, we can use our lllsize.
2944 \selectfonts\lllsize A%
2945 \fi
2946 }%
2947 \vss
2948 }}%
2949 \kern-.15em
2950 \TeX
2951}
2952
2953% Some math mode symbols.
2954\def\bullet{$\ptexbullet$}
2955\def\geq{\ifmmode \ge\else $\ge$\fi}
2956\def\leq{\ifmmode \le\else $\le$\fi}
2957\def\minus{\ifmmode -\else $-$\fi}
2958
2959% @dots{} outputs an ellipsis using the current font.
2960% We do .5em per period so that it has the same spacing in the cm
2961% typewriter fonts as three actual period characters; on the other hand,
2962% in other typewriter fonts three periods are wider than 1.5em. So do
2963% whichever is larger.
2964%
2965\def\dots{%
2966 \leavevmode
2967 \setbox0=\hbox{...}% get width of three periods
2968 \ifdim\wd0 > 1.5em
2969 \dimen0 = \wd0
2970 \else
2971 \dimen0 = 1.5em
2972 \fi
2973 \hbox to \dimen0{%
2974 \hskip 0pt plus.25fil
2975 .\hskip 0pt plus1fil
2976 .\hskip 0pt plus1fil
2977 .\hskip 0pt plus.5fil
2978 }%
2979}
2980
2981% @enddots{} is an end-of-sentence ellipsis.
2982%
2983\def\enddots{%
2984 \dots
2985 \spacefactor=\endofsentencespacefactor
2986}
2987
2988% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
2989%
2990% Since these characters are used in examples, they should be an even number of
2991% \tt widths. Each \tt character is 1en, so two makes it 1em.
2992%
2993\def\point{$\star$}
2994\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
2995\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
2996\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
2997\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
2998\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
2999
3000% The @error{} command.
3001% Adapted from the TeXbook's \boxit.
3002%
3003\newbox\errorbox
3004%
3005{\tentt \global\dimen0 = 3em}% Width of the box.
3006\dimen2 = .55pt % Thickness of rules
3007% The text. (`r' is open on the right, `e' somewhat less so on the left.)
3008\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3009%
3010\setbox\errorbox=\hbox to \dimen0{\hfil
3011 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3012 \advance\hsize by -2\dimen2 % Rules.
3013 \vbox{%
3014 \hrule height\dimen2
3015 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3016 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3017 \kern3pt\vrule width\dimen2}% Space to right.
3018 \hrule height\dimen2}
3019 \hfil}
3020%
3021\def\error{\leavevmode\lower.7ex\copy\errorbox}
3022
3023% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3024%
3025\def\pounds{{\it\$}}
3026
3027% @euro{} comes from a separate font, depending on the current style.
3028% We use the free feym* fonts from the eurosym package by Henrik
3029% Theiling, which support regular, slanted, bold and bold slanted (and
3030% "outlined" (blackboard board, sort of) versions, which we don't need).
3031% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3032%
3033% Although only regular is the truly official Euro symbol, we ignore
3034% that. The Euro is designed to be slightly taller than the regular
3035% font height.
3036%
3037% feymr - regular
3038% feymo - slanted
3039% feybr - bold
3040% feybo - bold slanted
3041%
3042% There is no good (free) typewriter version, to my knowledge.
3043% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3044% Hmm.
3045%
3046% Also doesn't work in math. Do we need to do math with euro symbols?
3047% Hope not.
3048%
3049%
3050\def\euro{{\eurofont e}}
3051\def\eurofont{%
3052 % We set the font at each command, rather than predefining it in
3053 % \textfonts and the other font-switching commands, so that
3054 % installations which never need the symbol don't have to have the
3055 % font installed.
3056 %
3057 % There is only one designed size (nominal 10pt), so we always scale
3058 % that to the current nominal size.
3059 %
3060 % By the way, simply using "at 1em" works for cmr10 and the like, but
3061 % does not work for cmbx10 and other extended/shrunken fonts.
3062 %
3063 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3064 %
3065 \ifx\curfontstyle\bfstylename
3066 % bold:
3067 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3068 \else
3069 % regular:
3070 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3071 \fi
3072 \thiseurofont
3073}
3074
3075% Glyphs from the EC fonts. We don't use \let for the aliases, because
3076% sometimes we redefine the original macro, and the alias should reflect
3077% the redefinition.
3078%
3079% Use LaTeX names for the Icelandic letters.
3080\def\DH{{\ecfont \char"D0}} % Eth
3081\def\dh{{\ecfont \char"F0}} % eth
3082\def\TH{{\ecfont \char"DE}} % Thorn
3083\def\th{{\ecfont \char"FE}} % thorn
3084%
3085\def\guillemetleft{{\ecfont \char"13}}
3086\def\guillemotleft{\guillemetleft}
3087\def\guillemetright{{\ecfont \char"14}}
3088\def\guillemotright{\guillemetright}
3089\def\guilsinglleft{{\ecfont \char"0E}}
3090\def\guilsinglright{{\ecfont \char"0F}}
3091\def\quotedblbase{{\ecfont \char"12}}
3092\def\quotesinglbase{{\ecfont \char"0D}}
3093%
3094% This positioning is not perfect (see the ogonek LaTeX package), but
3095% we have the precomposed glyphs for the most common cases. We put the
3096% tests to use those glyphs in the single \ogonek macro so we have fewer
3097% dummy definitions to worry about for index entries, etc.
3098%
3099% ogonek is also used with other letters in Lithuanian (IOU), but using
3100% the precomposed glyphs for those is not so easy since they aren't in
3101% the same EC font.
3102\def\ogonek#1{{%
3103 \def\temp{#1}%
3104 \ifx\temp\macrocharA\Aogonek
3105 \else\ifx\temp\macrochara\aogonek
3106 \else\ifx\temp\macrocharE\Eogonek
3107 \else\ifx\temp\macrochare\eogonek
3108 \else
3109 \ecfont \setbox0=\hbox{#1}%
3110 \ifdim\ht0=1ex\accent"0C #1%
3111 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3112 \fi
3113 \fi\fi\fi\fi
3114 }%
3115}
3116\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3117\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3118\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3119\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3120%
3121% Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
3122\def\ecfont{%
3123 % We can't distinguish serif/sans and italic/slanted, but this
3124 % is used for crude hacks anyway (like adding French and German
3125 % quotes to documents typeset with CM, where we lose kerning), so
3126 % hopefully nobody will notice/care.
3127 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3128 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3129 \ifx\curfontstyle\bfstylename
3130 % bold:
3131 \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
3132 \else
3133 % regular:
3134 \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
3135 \fi
3136 \thisecfont
3137}
3138
3139% @registeredsymbol - R in a circle. The font for the R should really
3140% be smaller yet, but lllsize is the best we can do for now.
3141% Adapted from the plain.tex definition of \copyright.
3142%
3143\def\registeredsymbol{%
3144 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3145 \hfil\crcr\Orb}}%
3146 }$%
3147}
3148
3149% @textdegree - the normal degrees sign.
3150%
3151\def\textdegree{$^\circ$}
3152
3153% Laurent Siebenmann reports \Orb undefined with:
3154% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3155% so we'll define it if necessary.
3156%
3157\ifx\Orb\thisisundefined
3158\def\Orb{\mathhexbox20D}
3159\fi
3160
3161% Quotes.
3162\chardef\quotedblleft="5C
3163\chardef\quotedblright=`\"
3164\chardef\quoteleft=`\`
3165\chardef\quoteright=`\'
3166
3167
3168\message{page headings,}
3169
3170\newskip\titlepagetopglue \titlepagetopglue = 1.5in
3171\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3172
3173% First the title page. Must do @settitle before @titlepage.
3174\newif\ifseenauthor
3175\newif\iffinishedtitlepage
3176
3177% Do an implicit @contents or @shortcontents after @end titlepage if the
3178% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
3179%
3180\newif\ifsetcontentsaftertitlepage
3181 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3182\newif\ifsetshortcontentsaftertitlepage
3183 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3184
3185\parseargdef\shorttitlepage{%
3186 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3187 \endgroup\page\hbox{}\page}
3188
3189\envdef\titlepage{%
3190 % Open one extra group, as we want to close it in the middle of \Etitlepage.
3191 \begingroup
3192 \parindent=0pt \textfonts
3193 % Leave some space at the very top of the page.
3194 \vglue\titlepagetopglue
3195 % No rule at page bottom unless we print one at the top with @title.
3196 \finishedtitlepagetrue
3197 %
3198 % Most title ``pages'' are actually two pages long, with space
3199 % at the top of the second. We don't want the ragged left on the second.
3200 \let\oldpage = \page
3201 \def\page{%
3202 \iffinishedtitlepage\else
3203 \finishtitlepage
3204 \fi
3205 \let\page = \oldpage
3206 \page
3207 \null
3208 }%
3209}
3210
3211\def\Etitlepage{%
3212 \iffinishedtitlepage\else
3213 \finishtitlepage
3214 \fi
3215 % It is important to do the page break before ending the group,
3216 % because the headline and footline are only empty inside the group.
3217 % If we use the new definition of \page, we always get a blank page
3218 % after the title page, which we certainly don't want.
3219 \oldpage
3220 \endgroup
3221 %
3222 % Need this before the \...aftertitlepage checks so that if they are
3223 % in effect the toc pages will come out with page numbers.
3224 \HEADINGSon
3225 %
3226 % If they want short, they certainly want long too.
3227 \ifsetshortcontentsaftertitlepage
3228 \shortcontents
3229 \contents
3230 \global\let\shortcontents = \relax
3231 \global\let\contents = \relax
3232 \fi
3233 %
3234 \ifsetcontentsaftertitlepage
3235 \contents
3236 \global\let\contents = \relax
3237 \global\let\shortcontents = \relax
3238 \fi
3239}
3240
3241\def\finishtitlepage{%
3242 \vskip4pt \hrule height 2pt width \hsize
3243 \vskip\titlepagebottomglue
3244 \finishedtitlepagetrue
3245}
3246
3247% Macros to be used within @titlepage:
3248
3249\let\subtitlerm=\tenrm
3250\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3251
3252\parseargdef\title{%
3253 \checkenv\titlepage
3254 \leftline{\titlefonts\rmisbold #1}
3255 % print a rule at the page bottom also.
3256 \finishedtitlepagefalse
3257 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3258}
3259
3260\parseargdef\subtitle{%
3261 \checkenv\titlepage
3262 {\subtitlefont \rightline{#1}}%
3263}
3264
3265% @author should come last, but may come many times.
3266% It can also be used inside @quotation.
3267%
3268\parseargdef\author{%
3269 \def\temp{\quotation}%
3270 \ifx\thisenv\temp
3271 \def\quotationauthor{#1}% printed in \Equotation.
3272 \else
3273 \checkenv\titlepage
3274 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3275 {\secfonts\rmisbold \leftline{#1}}%
3276 \fi
3277}
3278
3279
3280% Set up page headings and footings.
3281
3282\let\thispage=\folio
3283
3284\newtoks\evenheadline % headline on even pages
3285\newtoks\oddheadline % headline on odd pages
3286\newtoks\evenfootline % footline on even pages
3287\newtoks\oddfootline % footline on odd pages
3288
3289% Now make TeX use those variables
3290\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3291 \else \the\evenheadline \fi}}
3292\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3293 \else \the\evenfootline \fi}\HEADINGShook}
3294\let\HEADINGShook=\relax
3295
3296% Commands to set those variables.
3297% For example, this is what @headings on does
3298% @evenheading @thistitle|@thispage|@thischapter
3299% @oddheading @thischapter|@thispage|@thistitle
3300% @evenfooting @thisfile||
3301% @oddfooting ||@thisfile
3302
3303
3304\def\evenheading{\parsearg\evenheadingxxx}
3305\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3306\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3307\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3308
3309\def\oddheading{\parsearg\oddheadingxxx}
3310\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3311\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3312\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3313
3314\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3315
3316\def\evenfooting{\parsearg\evenfootingxxx}
3317\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3318\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3319\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3320
3321\def\oddfooting{\parsearg\oddfootingxxx}
3322\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3323\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3324 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3325 %
3326 % Leave some space for the footline. Hopefully ok to assume
3327 % @evenfooting will not be used by itself.
3328 \global\advance\pageheight by -12pt
3329 \global\advance\vsize by -12pt
3330}
3331
3332\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3333
3334% @evenheadingmarks top \thischapter <- chapter at the top of a page
3335% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3336%
3337% The same set of arguments for:
3338%
3339% @oddheadingmarks
3340% @evenfootingmarks
3341% @oddfootingmarks
3342% @everyheadingmarks
3343% @everyfootingmarks
3344
3345\def\evenheadingmarks{\headingmarks{even}{heading}}
3346\def\oddheadingmarks{\headingmarks{odd}{heading}}
3347\def\evenfootingmarks{\headingmarks{even}{footing}}
3348\def\oddfootingmarks{\headingmarks{odd}{footing}}
3349\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3350 \headingmarks{odd}{heading}{#1} }
3351\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3352 \headingmarks{odd}{footing}{#1} }
3353% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3354\def\headingmarks#1#2#3 {%
3355 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3356 \global\expandafter\let\csname get#1#2marks\endcsname \temp
3357}
3358
3359\everyheadingmarks bottom
3360\everyfootingmarks bottom
3361
3362% @headings double turns headings on for double-sided printing.
3363% @headings single turns headings on for single-sided printing.
3364% @headings off turns them off.
3365% @headings on same as @headings double, retained for compatibility.
3366% @headings after turns on double-sided headings after this page.
3367% @headings doubleafter turns on double-sided headings after this page.
3368% @headings singleafter turns on single-sided headings after this page.
3369% By default, they are off at the start of a document,
3370% and turned `on' after @end titlepage.
3371
3372\def\headings #1 {\csname HEADINGS#1\endcsname}
3373
3374\def\headingsoff{% non-global headings elimination
3375 \evenheadline={\hfil}\evenfootline={\hfil}%
3376 \oddheadline={\hfil}\oddfootline={\hfil}%
3377}
3378
3379\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3380\HEADINGSoff % it's the default
3381
3382% When we turn headings on, set the page number to 1.
3383% For double-sided printing, put current file name in lower left corner,
3384% chapter name on inside top of right hand pages, document
3385% title on inside top of left hand pages, and page numbers on outside top
3386% edge of all pages.
3387\def\HEADINGSdouble{%
3388\global\pageno=1
3389\global\evenfootline={\hfil}
3390\global\oddfootline={\hfil}
3391\global\evenheadline={\line{\folio\hfil\thistitle}}
3392\global\oddheadline={\line{\thischapter\hfil\folio}}
3393\global\let\contentsalignmacro = \chapoddpage
3394}
3395\let\contentsalignmacro = \chappager
3396
3397% For single-sided printing, chapter title goes across top left of page,
3398% page number on top right.
3399\def\HEADINGSsingle{%
3400\global\pageno=1
3401\global\evenfootline={\hfil}
3402\global\oddfootline={\hfil}
3403\global\evenheadline={\line{\thischapter\hfil\folio}}
3404\global\oddheadline={\line{\thischapter\hfil\folio}}
3405\global\let\contentsalignmacro = \chappager
3406}
3407\def\HEADINGSon{\HEADINGSdouble}
3408
3409\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3410\let\HEADINGSdoubleafter=\HEADINGSafter
3411\def\HEADINGSdoublex{%
3412\global\evenfootline={\hfil}
3413\global\oddfootline={\hfil}
3414\global\evenheadline={\line{\folio\hfil\thistitle}}
3415\global\oddheadline={\line{\thischapter\hfil\folio}}
3416\global\let\contentsalignmacro = \chapoddpage
3417}
3418
3419\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3420\def\HEADINGSsinglex{%
3421\global\evenfootline={\hfil}
3422\global\oddfootline={\hfil}
3423\global\evenheadline={\line{\thischapter\hfil\folio}}
3424\global\oddheadline={\line{\thischapter\hfil\folio}}
3425\global\let\contentsalignmacro = \chappager
3426}
3427
3428% Subroutines used in generating headings
3429% This produces Day Month Year style of output.
3430% Only define if not already defined, in case a txi-??.tex file has set
3431% up a different format (e.g., txi-cs.tex does this).
3432\ifx\today\thisisundefined
3433\def\today{%
3434 \number\day\space
3435 \ifcase\month
3436 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3437 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3438 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3439 \fi
3440 \space\number\year}
3441\fi
3442
3443% @settitle line... specifies the title of the document, for headings.
3444% It generates no output of its own.
3445\def\thistitle{\putwordNoTitle}
3446\def\settitle{\parsearg{\gdef\thistitle}}
3447
3448
3449\message{tables,}
3450% Tables -- @table, @ftable, @vtable, @item(x).
3451
3452% default indentation of table text
3453\newdimen\tableindent \tableindent=.8in
3454% default indentation of @itemize and @enumerate text
3455\newdimen\itemindent \itemindent=.3in
3456% margin between end of table item and start of table text.
3457\newdimen\itemmargin \itemmargin=.1in
3458
3459% used internally for \itemindent minus \itemmargin
3460\newdimen\itemmax
3461
3462% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3463% these defs.
3464% They also define \itemindex
3465% to index the item name in whatever manner is desired (perhaps none).
3466
3467\newif\ifitemxneedsnegativevskip
3468
3469\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3470
3471\def\internalBitem{\smallbreak \parsearg\itemzzz}
3472\def\internalBitemx{\itemxpar \parsearg\itemzzz}
3473
3474\def\itemzzz #1{\begingroup %
3475 \advance\hsize by -\rightskip
3476 \advance\hsize by -\tableindent
3477 \setbox0=\hbox{\itemindicate{#1}}%
3478 \itemindex{#1}%
3479 \nobreak % This prevents a break before @itemx.
3480 %
3481 % If the item text does not fit in the space we have, put it on a line
3482 % by itself, and do not allow a page break either before or after that
3483 % line. We do not start a paragraph here because then if the next
3484 % command is, e.g., @kindex, the whatsit would get put into the
3485 % horizontal list on a line by itself, resulting in extra blank space.
3486 \ifdim \wd0>\itemmax
3487 %
3488 % Make this a paragraph so we get the \parskip glue and wrapping,
3489 % but leave it ragged-right.
3490 \begingroup
3491 \advance\leftskip by-\tableindent
3492 \advance\hsize by\tableindent
3493 \advance\rightskip by0pt plus1fil\relax
3494 \leavevmode\unhbox0\par
3495 \endgroup
3496 %
3497 % We're going to be starting a paragraph, but we don't want the
3498 % \parskip glue -- logically it's part of the @item we just started.
3499 \nobreak \vskip-\parskip
3500 %
3501 % Stop a page break at the \parskip glue coming up. However, if
3502 % what follows is an environment such as @example, there will be no
3503 % \parskip glue; then the negative vskip we just inserted would
3504 % cause the example and the item to crash together. So we use this
3505 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3506 % \parskip glue after all. Section titles are handled this way also.
3507 %
3508 \penalty 10001
3509 \endgroup
3510 \itemxneedsnegativevskipfalse
3511 \else
3512 % The item text fits into the space. Start a paragraph, so that the
3513 % following text (if any) will end up on the same line.
3514 \noindent
3515 % Do this with kerns and \unhbox so that if there is a footnote in
3516 % the item text, it can migrate to the main vertical list and
3517 % eventually be printed.
3518 \nobreak\kern-\tableindent
3519 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3520 \unhbox0
3521 \nobreak\kern\dimen0
3522 \endgroup
3523 \itemxneedsnegativevskiptrue
3524 \fi
3525}
3526
3527\def\item{\errmessage{@item while not in a list environment}}
3528\def\itemx{\errmessage{@itemx while not in a list environment}}
3529
3530% @table, @ftable, @vtable.
3531\envdef\table{%
3532 \let\itemindex\gobble
3533 \tablecheck{table}%
3534}
3535\envdef\ftable{%
3536 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3537 \tablecheck{ftable}%
3538}
3539\envdef\vtable{%
3540 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3541 \tablecheck{vtable}%
3542}
3543\def\tablecheck#1{%
3544 \ifnum \the\catcode`\^^M=\active
3545 \endgroup
3546 \errmessage{This command won't work in this context; perhaps the problem is
3547 that we are \inenvironment\thisenv}%
3548 \def\next{\doignore{#1}}%
3549 \else
3550 \let\next\tablex
3551 \fi
3552 \next
3553}
3554\def\tablex#1{%
3555 \def\itemindicate{#1}%
3556 \parsearg\tabley
3557}
3558\def\tabley#1{%
3559 {%
3560 \makevalueexpandable
3561 \edef\temp{\noexpand\tablez #1\space\space\space}%
3562 \expandafter
3563 }\temp \endtablez
3564}
3565\def\tablez #1 #2 #3 #4\endtablez{%
3566 \aboveenvbreak
3567 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3568 \ifnum 0#2>0 \tableindent=#2\mil \fi
3569 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3570 \itemmax=\tableindent
3571 \advance \itemmax by -\itemmargin
3572 \advance \leftskip by \tableindent
3573 \exdentamount=\tableindent
3574 \parindent = 0pt
3575 \parskip = \smallskipamount
3576 \ifdim \parskip=0pt \parskip=2pt \fi
3577 \let\item = \internalBitem
3578 \let\itemx = \internalBitemx
3579}
3580\def\Etable{\endgraf\afterenvbreak}
3581\let\Eftable\Etable
3582\let\Evtable\Etable
3583\let\Eitemize\Etable
3584\let\Eenumerate\Etable
3585
3586% This is the counter used by @enumerate, which is really @itemize
3587
3588\newcount \itemno
3589
3590\envdef\itemize{\parsearg\doitemize}
3591
3592\def\doitemize#1{%
3593 \aboveenvbreak
3594 \itemmax=\itemindent
3595 \advance\itemmax by -\itemmargin
3596 \advance\leftskip by \itemindent
3597 \exdentamount=\itemindent
3598 \parindent=0pt
3599 \parskip=\smallskipamount
3600 \ifdim\parskip=0pt \parskip=2pt \fi
3601 %
3602 % Try typesetting the item mark that if the document erroneously says
3603 % something like @itemize @samp (intending @table), there's an error
3604 % right away at the @itemize. It's not the best error message in the
3605 % world, but it's better than leaving it to the @item. This means if
3606 % the user wants an empty mark, they have to say @w{} not just @w.
3607 \def\itemcontents{#1}%
3608 \setbox0 = \hbox{\itemcontents}%
3609 %
3610 % @itemize with no arg is equivalent to @itemize @bullet.
3611 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3612 %
3613 \let\item=\itemizeitem
3614}
3615
3616% Definition of @item while inside @itemize and @enumerate.
3617%
3618\def\itemizeitem{%
3619 \advance\itemno by 1 % for enumerations
3620 {\let\par=\endgraf \smallbreak}% reasonable place to break
3621 {%
3622 % If the document has an @itemize directly after a section title, a
3623 % \nobreak will be last on the list, and \sectionheading will have
3624 % done a \vskip-\parskip. In that case, we don't want to zero
3625 % parskip, or the item text will crash with the heading. On the
3626 % other hand, when there is normal text preceding the item (as there
3627 % usually is), we do want to zero parskip, or there would be too much
3628 % space. In that case, we won't have a \nobreak before. At least
3629 % that's the theory.
3630 \ifnum\lastpenalty<10000 \parskip=0in \fi
3631 \noindent
3632 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3633 %
3634 \vadjust{\penalty 1200}}% not good to break after first line of item.
3635 \flushcr
3636}
3637
3638% \splitoff TOKENS\endmark defines \first to be the first token in
3639% TOKENS, and \rest to be the remainder.
3640%
3641\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3642
3643% Allow an optional argument of an uppercase letter, lowercase letter,
3644% or number, to specify the first label in the enumerated list. No
3645% argument is the same as `1'.
3646%
3647\envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
3648\def\enumeratey #1 #2\endenumeratey{%
3649 % If we were given no argument, pretend we were given `1'.
3650 \def\thearg{#1}%
3651 \ifx\thearg\empty \def\thearg{1}\fi
3652 %
3653 % Detect if the argument is a single token. If so, it might be a
3654 % letter. Otherwise, the only valid thing it can be is a number.
3655 % (We will always have one token, because of the test we just made.
3656 % This is a good thing, since \splitoff doesn't work given nothing at
3657 % all -- the first parameter is undelimited.)
3658 \expandafter\splitoff\thearg\endmark
3659 \ifx\rest\empty
3660 % Only one token in the argument. It could still be anything.
3661 % A ``lowercase letter'' is one whose \lccode is nonzero.
3662 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3663 % not equal to itself.
3664 % Otherwise, we assume it's a number.
3665 %
3666 % We need the \relax at the end of the \ifnum lines to stop TeX from
3667 % continuing to look for a <number>.
3668 %
3669 \ifnum\lccode\expandafter`\thearg=0\relax
3670 \numericenumerate % a number (we hope)
3671 \else
3672 % It's a letter.
3673 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3674 \lowercaseenumerate % lowercase letter
3675 \else
3676 \uppercaseenumerate % uppercase letter
3677 \fi
3678 \fi
3679 \else
3680 % Multiple tokens in the argument. We hope it's a number.
3681 \numericenumerate
3682 \fi
3683}
3684
3685% An @enumerate whose labels are integers. The starting integer is
3686% given in \thearg.
3687%
3688\def\numericenumerate{%
3689 \itemno = \thearg
3690 \startenumeration{\the\itemno}%
3691}
3692
3693% The starting (lowercase) letter is in \thearg.
3694\def\lowercaseenumerate{%
3695 \itemno = \expandafter`\thearg
3696 \startenumeration{%
3697 % Be sure we're not beyond the end of the alphabet.
3698 \ifnum\itemno=0
3699 \errmessage{No more lowercase letters in @enumerate; get a bigger
3700 alphabet}%
3701 \fi
3702 \char\lccode\itemno
3703 }%
3704}
3705
3706% The starting (uppercase) letter is in \thearg.
3707\def\uppercaseenumerate{%
3708 \itemno = \expandafter`\thearg
3709 \startenumeration{%
3710 % Be sure we're not beyond the end of the alphabet.
3711 \ifnum\itemno=0
3712 \errmessage{No more uppercase letters in @enumerate; get a bigger
3713 alphabet}
3714 \fi
3715 \char\uccode\itemno
3716 }%
3717}
3718
3719% Call \doitemize, adding a period to the first argument and supplying the
3720% common last two arguments. Also subtract one from the initial value in
3721% \itemno, since @item increments \itemno.
3722%
3723\def\startenumeration#1{%
3724 \advance\itemno by -1
3725 \doitemize{#1.}\flushcr
3726}
3727
3728% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3729% to @enumerate.
3730%
3731\def\alphaenumerate{\enumerate{a}}
3732\def\capsenumerate{\enumerate{A}}
3733\def\Ealphaenumerate{\Eenumerate}
3734\def\Ecapsenumerate{\Eenumerate}
3735
3736
3737% @multitable macros
3738% Amy Hendrickson, 8/18/94, 3/6/96
3739%
3740% @multitable ... @end multitable will make as many columns as desired.
3741% Contents of each column will wrap at width given in preamble. Width
3742% can be specified either with sample text given in a template line,
3743% or in percent of \hsize, the current width of text on page.
3744
3745% Table can continue over pages but will only break between lines.
3746
3747% To make preamble:
3748%
3749% Either define widths of columns in terms of percent of \hsize:
3750% @multitable @columnfractions .25 .3 .45
3751% @item ...
3752%
3753% Numbers following @columnfractions are the percent of the total
3754% current hsize to be used for each column. You may use as many
3755% columns as desired.
3756
3757
3758% Or use a template:
3759% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3760% @item ...
3761% using the widest term desired in each column.
3762
3763% Each new table line starts with @item, each subsequent new column
3764% starts with @tab. Empty columns may be produced by supplying @tab's
3765% with nothing between them for as many times as empty columns are needed,
3766% ie, @tab@tab@tab will produce two empty columns.
3767
3768% @item, @tab do not need to be on their own lines, but it will not hurt
3769% if they are.
3770
3771% Sample multitable:
3772
3773% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3774% @item first col stuff @tab second col stuff @tab third col
3775% @item
3776% first col stuff
3777% @tab
3778% second col stuff
3779% @tab
3780% third col
3781% @item first col stuff @tab second col stuff
3782% @tab Many paragraphs of text may be used in any column.
3783%
3784% They will wrap at the width determined by the template.
3785% @item@tab@tab This will be in third column.
3786% @end multitable
3787
3788% Default dimensions may be reset by user.
3789% @multitableparskip is vertical space between paragraphs in table.
3790% @multitableparindent is paragraph indent in table.
3791% @multitablecolmargin is horizontal space to be left between columns.
3792% @multitablelinespace is space to leave between table items, baseline
3793% to baseline.
3794% 0pt means it depends on current normal line spacing.
3795%
3796\newskip\multitableparskip
3797\newskip\multitableparindent
3798\newdimen\multitablecolspace
3799\newskip\multitablelinespace
3800\multitableparskip=0pt
3801\multitableparindent=6pt
3802\multitablecolspace=12pt
3803\multitablelinespace=0pt
3804
3805% Macros used to set up halign preamble:
3806%
3807\let\endsetuptable\relax
3808\def\xendsetuptable{\endsetuptable}
3809\let\columnfractions\relax
3810\def\xcolumnfractions{\columnfractions}
3811\newif\ifsetpercent
3812
3813% #1 is the @columnfraction, usually a decimal number like .5, but might
3814% be just 1. We just use it, whatever it is.
3815%
3816\def\pickupwholefraction#1 {%
3817 \global\advance\colcount by 1
3818 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3819 \setuptable
3820}
3821
3822\newcount\colcount
3823\def\setuptable#1{%
3824 \def\firstarg{#1}%
3825 \ifx\firstarg\xendsetuptable
3826 \let\go = \relax
3827 \else
3828 \ifx\firstarg\xcolumnfractions
3829 \global\setpercenttrue
3830 \else
3831 \ifsetpercent
3832 \let\go\pickupwholefraction
3833 \else
3834 \global\advance\colcount by 1
3835 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3836 % separator; typically that is always in the input, anyway.
3837 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3838 \fi
3839 \fi
3840 \ifx\go\pickupwholefraction
3841 % Put the argument back for the \pickupwholefraction call, so
3842 % we'll always have a period there to be parsed.
3843 \def\go{\pickupwholefraction#1}%
3844 \else
3845 \let\go = \setuptable
3846 \fi%
3847 \fi
3848 \go
3849}
3850
3851% multitable-only commands.
3852%
3853% @headitem starts a heading row, which we typeset in bold.
3854% Assignments have to be global since we are inside the implicit group
3855% of an alignment entry. \everycr resets \everytab so we don't have to
3856% undo it ourselves.
3857\def\headitemfont{\b}% for people to use in the template row; not changeable
3858\def\headitem{%
3859 \checkenv\multitable
3860 \crcr
3861 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
3862 \the\everytab % for the first item
3863}%
3864%
3865% A \tab used to include \hskip1sp. But then the space in a template
3866% line is not enough. That is bad. So let's go back to just `&' until
3867% we again encounter the problem the 1sp was intended to solve.
3868% --karl, nathan@acm.org, 20apr99.
3869\def\tab{\checkenv\multitable &\the\everytab}%
3870
3871% @multitable ... @end multitable definitions:
3872%
3873\newtoks\everytab % insert after every tab.
3874%
3875\envdef\multitable{%
3876 \vskip\parskip
3877 \startsavinginserts
3878 %
3879 % @item within a multitable starts a normal row.
3880 % We use \def instead of \let so that if one of the multitable entries
3881 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
3882 % \endtemplate) expanding \doitemize.
3883 \def\item{\crcr}%
3884 %
3885 \tolerance=9500
3886 \hbadness=9500
3887 \setmultitablespacing
3888 \parskip=\multitableparskip
3889 \parindent=\multitableparindent
3890 \overfullrule=0pt
3891 \global\colcount=0
3892 %
3893 \everycr = {%
3894 \noalign{%
3895 \global\everytab={}%
3896 \global\colcount=0 % Reset the column counter.
3897 % Check for saved footnotes, etc.
3898 \checkinserts
3899 % Keeps underfull box messages off when table breaks over pages.
3900 %\filbreak
3901 % Maybe so, but it also creates really weird page breaks when the
3902 % table breaks over pages. Wouldn't \vfil be better? Wait until the
3903 % problem manifests itself, so it can be fixed for real --karl.
3904 }%
3905 }%
3906 %
3907 \parsearg\domultitable
3908}
3909\def\domultitable#1{%
3910 % To parse everything between @multitable and @item:
3911 \setuptable#1 \endsetuptable
3912 %
3913 % This preamble sets up a generic column definition, which will
3914 % be used as many times as user calls for columns.
3915 % \vtop will set a single line and will also let text wrap and
3916 % continue for many paragraphs if desired.
3917 \halign\bgroup &%
3918 \global\advance\colcount by 1
3919 \multistrut
3920 \vtop{%
3921 % Use the current \colcount to find the correct column width:
3922 \hsize=\expandafter\csname col\the\colcount\endcsname
3923 %
3924 % In order to keep entries from bumping into each other
3925 % we will add a \leftskip of \multitablecolspace to all columns after
3926 % the first one.
3927 %
3928 % If a template has been used, we will add \multitablecolspace
3929 % to the width of each template entry.
3930 %
3931 % If the user has set preamble in terms of percent of \hsize we will
3932 % use that dimension as the width of the column, and the \leftskip
3933 % will keep entries from bumping into each other. Table will start at
3934 % left margin and final column will justify at right margin.
3935 %
3936 % Make sure we don't inherit \rightskip from the outer environment.
3937 \rightskip=0pt
3938 \ifnum\colcount=1
3939 % The first column will be indented with the surrounding text.
3940 \advance\hsize by\leftskip
3941 \else
3942 \ifsetpercent \else
3943 % If user has not set preamble in terms of percent of \hsize
3944 % we will advance \hsize by \multitablecolspace.
3945 \advance\hsize by \multitablecolspace
3946 \fi
3947 % In either case we will make \leftskip=\multitablecolspace:
3948 \leftskip=\multitablecolspace
3949 \fi
3950 % Ignoring space at the beginning and end avoids an occasional spurious
3951 % blank line, when TeX decides to break the line at the space before the
3952 % box from the multistrut, so the strut ends up on a line by itself.
3953 % For example:
3954 % @multitable @columnfractions .11 .89
3955 % @item @code{#}
3956 % @tab Legal holiday which is valid in major parts of the whole country.
3957 % Is automatically provided with highlighting sequences respectively
3958 % marking characters.
3959 \noindent\ignorespaces##\unskip\multistrut
3960 }\cr
3961}
3962\def\Emultitable{%
3963 \crcr
3964 \egroup % end the \halign
3965 \global\setpercentfalse
3966}
3967
3968\def\setmultitablespacing{%
3969 \def\multistrut{\strut}% just use the standard line spacing
3970 %
3971 % Compute \multitablelinespace (if not defined by user) for use in
3972 % \multitableparskip calculation. We used define \multistrut based on
3973 % this, but (ironically) that caused the spacing to be off.
3974 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
3975\ifdim\multitablelinespace=0pt
3976\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
3977\global\advance\multitablelinespace by-\ht0
3978\fi
3979% Test to see if parskip is larger than space between lines of
3980% table. If not, do nothing.
3981% If so, set to same dimension as multitablelinespace.
3982\ifdim\multitableparskip>\multitablelinespace
3983\global\multitableparskip=\multitablelinespace
3984\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
3985 % than skip between lines in the table.
3986\fi%
3987\ifdim\multitableparskip=0pt
3988\global\multitableparskip=\multitablelinespace
3989\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
3990 % than skip between lines in the table.
3991\fi}
3992
3993
3994\message{conditionals,}
3995
3996% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
3997% @ifnotxml always succeed. They currently do nothing; we don't
3998% attempt to check whether the conditionals are properly nested. But we
3999% have to remember that they are conditionals, so that @end doesn't
4000% attempt to close an environment group.
4001%
4002\def\makecond#1{%
4003 \expandafter\let\csname #1\endcsname = \relax
4004 \expandafter\let\csname iscond.#1\endcsname = 1
4005}
4006\makecond{iftex}
4007\makecond{ifnotdocbook}
4008\makecond{ifnothtml}
4009\makecond{ifnotinfo}
4010\makecond{ifnotplaintext}
4011\makecond{ifnotxml}
4012
4013% Ignore @ignore, @ifhtml, @ifinfo, and the like.
4014%
4015\def\direntry{\doignore{direntry}}
4016\def\documentdescription{\doignore{documentdescription}}
4017\def\docbook{\doignore{docbook}}
4018\def\html{\doignore{html}}
4019\def\ifdocbook{\doignore{ifdocbook}}
4020\def\ifhtml{\doignore{ifhtml}}
4021\def\ifinfo{\doignore{ifinfo}}
4022\def\ifnottex{\doignore{ifnottex}}
4023\def\ifplaintext{\doignore{ifplaintext}}
4024\def\ifxml{\doignore{ifxml}}
4025\def\ignore{\doignore{ignore}}
4026\def\menu{\doignore{menu}}
4027\def\xml{\doignore{xml}}
4028
4029% Ignore text until a line `@end #1', keeping track of nested conditionals.
4030%
4031% A count to remember the depth of nesting.
4032\newcount\doignorecount
4033
4034\def\doignore#1{\begingroup
4035 % Scan in ``verbatim'' mode:
4036 \obeylines
4037 \catcode`\@ = \other
4038 \catcode`\{ = \other
4039 \catcode`\} = \other
4040 %
4041 % Make sure that spaces turn into tokens that match what \doignoretext wants.
4042 \spaceisspace
4043 %
4044 % Count number of #1's that we've seen.
4045 \doignorecount = 0
4046 %
4047 % Swallow text until we reach the matching `@end #1'.
4048 \dodoignore{#1}%
4049}
4050
4051{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4052 \obeylines %
4053 %
4054 \gdef\dodoignore#1{%
4055 % #1 contains the command name as a string, e.g., `ifinfo'.
4056 %
4057 % Define a command to find the next `@end #1'.
4058 \long\def\doignoretext##1^^M@end #1{%
4059 \doignoretextyyy##1^^M@#1\_STOP_}%
4060 %
4061 % And this command to find another #1 command, at the beginning of a
4062 % line. (Otherwise, we would consider a line `@c @ifset', for
4063 % example, to count as an @ifset for nesting.)
4064 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4065 %
4066 % And now expand that command.
4067 \doignoretext ^^M%
4068 }%
4069}
4070
4071\def\doignoreyyy#1{%
4072 \def\temp{#1}%
4073 \ifx\temp\empty % Nothing found.
4074 \let\next\doignoretextzzz
4075 \else % Found a nested condition, ...
4076 \advance\doignorecount by 1
4077 \let\next\doignoretextyyy % ..., look for another.
4078 % If we're here, #1 ends with ^^M\ifinfo (for example).
4079 \fi
4080 \next #1% the token \_STOP_ is present just after this macro.
4081}
4082
4083% We have to swallow the remaining "\_STOP_".
4084%
4085\def\doignoretextzzz#1{%
4086 \ifnum\doignorecount = 0 % We have just found the outermost @end.
4087 \let\next\enddoignore
4088 \else % Still inside a nested condition.
4089 \advance\doignorecount by -1
4090 \let\next\doignoretext % Look for the next @end.
4091 \fi
4092 \next
4093}
4094
4095% Finish off ignored text.
4096{ \obeylines%
4097 % Ignore anything after the last `@end #1'; this matters in verbatim
4098 % environments, where otherwise the newline after an ignored conditional
4099 % would result in a blank line in the output.
4100 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4101}
4102
4103
4104% @set VAR sets the variable VAR to an empty value.
4105% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4106%
4107% Since we want to separate VAR from REST-OF-LINE (which might be
4108% empty), we can't just use \parsearg; we have to insert a space of our
4109% own to delimit the rest of the line, and then take it out again if we
4110% didn't need it.
4111% We rely on the fact that \parsearg sets \catcode`\ =10.
4112%
4113\parseargdef\set{\setyyy#1 \endsetyyy}
4114\def\setyyy#1 #2\endsetyyy{%
4115 {%
4116 \makevalueexpandable
4117 \def\temp{#2}%
4118 \edef\next{\gdef\makecsname{SET#1}}%
4119 \ifx\temp\empty
4120 \next{}%
4121 \else
4122 \setzzz#2\endsetzzz
4123 \fi
4124 }%
4125}
4126% Remove the trailing space \setxxx inserted.
4127\def\setzzz#1 \endsetzzz{\next{#1}}
4128
4129% @clear VAR clears (i.e., unsets) the variable VAR.
4130%
4131\parseargdef\clear{%
4132 {%
4133 \makevalueexpandable
4134 \global\expandafter\let\csname SET#1\endcsname=\relax
4135 }%
4136}
4137
4138% @value{foo} gets the text saved in variable foo.
4139\def\value{\begingroup\makevalueexpandable\valuexxx}
4140\def\valuexxx#1{\expandablevalue{#1}\endgroup}
4141{
4142 \catcode`\- = \active \catcode`\_ = \active
4143 %
4144 \gdef\makevalueexpandable{%
4145 \let\value = \expandablevalue
4146 % We don't want these characters active, ...
4147 \catcode`\-=\other \catcode`\_=\other
4148 % ..., but we might end up with active ones in the argument if
4149 % we're called from @code, as @code{@value{foo-bar_}}, though.
4150 % So \let them to their normal equivalents.
4151 \let-\realdash \let_\normalunderscore
4152 }
4153}
4154
4155% We have this subroutine so that we can handle at least some @value's
4156% properly in indexes (we call \makevalueexpandable in \indexdummies).
4157% The command has to be fully expandable (if the variable is set), since
4158% the result winds up in the index file. This means that if the
4159% variable's value contains other Texinfo commands, it's almost certain
4160% it will fail (although perhaps we could fix that with sufficient work
4161% to do a one-level expansion on the result, instead of complete).
4162%
4163\def\expandablevalue#1{%
4164 \expandafter\ifx\csname SET#1\endcsname\relax
4165 {[No value for ``#1'']}%
4166 \message{Variable `#1', used in @value, is not set.}%
4167 \else
4168 \csname SET#1\endcsname
4169 \fi
4170}
4171
4172% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4173% with @set.
4174%
4175% To get special treatment of `@end ifset,' call \makeond and the redefine.
4176%
4177\makecond{ifset}
4178\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4179\def\doifset#1#2{%
4180 {%
4181 \makevalueexpandable
4182 \let\next=\empty
4183 \expandafter\ifx\csname SET#2\endcsname\relax
4184 #1% If not set, redefine \next.
4185 \fi
4186 \expandafter
4187 }\next
4188}
4189\def\ifsetfail{\doignore{ifset}}
4190
4191% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
4192% defined with @set, or has been undefined with @clear.
4193%
4194% The `\else' inside the `\doifset' parameter is a trick to reuse the
4195% above code: if the variable is not set, do nothing, if it is set,
4196% then redefine \next to \ifclearfail.
4197%
4198\makecond{ifclear}
4199\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4200\def\ifclearfail{\doignore{ifclear}}
4201
4202% @dircategory CATEGORY -- specify a category of the dir file
4203% which this file should belong to. Ignore this in TeX.
4204\let\dircategory=\comment
4205
4206% @defininfoenclose.
4207\let\definfoenclose=\comment
4208
4209
4210\message{indexing,}
4211% Index generation facilities
4212
4213% Define \newwrite to be identical to plain tex's \newwrite
4214% except not \outer, so it can be used within macros and \if's.
4215\edef\newwrite{\makecsname{ptexnewwrite}}
4216
4217% \newindex {foo} defines an index named foo.
4218% It automatically defines \fooindex such that
4219% \fooindex ...rest of line... puts an entry in the index foo.
4220% It also defines \fooindfile to be the number of the output channel for
4221% the file that accumulates this index. The file's extension is foo.
4222% The name of an index should be no more than 2 characters long
4223% for the sake of vms.
4224%
4225\def\newindex#1{%
4226 \iflinks
4227 \expandafter\newwrite \csname#1indfile\endcsname
4228 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
4229 \fi
4230 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4231 \noexpand\doindex{#1}}
4232}
4233
4234% @defindex foo == \newindex{foo}
4235%
4236\def\defindex{\parsearg\newindex}
4237
4238% Define @defcodeindex, like @defindex except put all entries in @code.
4239%
4240\def\defcodeindex{\parsearg\newcodeindex}
4241%
4242\def\newcodeindex#1{%
4243 \iflinks
4244 \expandafter\newwrite \csname#1indfile\endcsname
4245 \openout \csname#1indfile\endcsname \jobname.#1
4246 \fi
4247 \expandafter\xdef\csname#1index\endcsname{%
4248 \noexpand\docodeindex{#1}}%
4249}
4250
4251
4252% @synindex foo bar makes index foo feed into index bar.
4253% Do this instead of @defindex foo if you don't want it as a separate index.
4254%
4255% @syncodeindex foo bar similar, but put all entries made for index foo
4