Annotation of embedaddon/readline/doc/texinfo.tex, revision 1.1.1.2
1.1 misho 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: %
1.1.1.2 ! misho 6: \def\texinfoversion{2015-11-22.14}
1.1 misho 7: %
8: % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9: % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
1.1.1.2 ! misho 10: % 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
! 11: % Free Software Foundation, Inc.
1.1 misho 12: %
13: % This texinfo.tex file is free software: you can redistribute it and/or
14: % modify it under the terms of the GNU General Public License as
15: % published by the Free Software Foundation, either version 3 of the
16: % License, or (at your option) any later version.
17: %
18: % This texinfo.tex file is distributed in the hope that it will be
19: % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20: % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21: % General Public License for more details.
22: %
23: % You should have received a copy of the GNU General Public License
24: % along with this program. If not, see <http://www.gnu.org/licenses/>.
25: %
26: % As a special exception, when this file is read by TeX when processing
27: % a Texinfo source document, you may use the result without
28: % restriction. This Exception is an additional permission under section 7
29: % of the GNU General Public License, version 3 ("GPLv3").
30: %
31: % Please try the latest version of texinfo.tex before submitting bug
32: % reports; you can get the latest version from:
33: % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
34: % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
35: % http://www.gnu.org/software/texinfo/ (the Texinfo home page)
36: % The texinfo.tex in any given distribution could well be out
37: % of date, so if that's what you're using, please check.
38: %
39: % Send bug reports to bug-texinfo@gnu.org. Please include including a
40: % complete document in each bug report with which we can reproduce the
41: % problem. Patches are, of course, greatly appreciated.
42: %
43: % To process a Texinfo manual with TeX, it's most reliable to use the
44: % texi2dvi shell script that comes with the distribution. For a simple
45: % manual foo.texi, however, you can get away with this:
46: % tex foo.texi
47: % texindex foo.??
48: % tex foo.texi
49: % tex foo.texi
50: % dvips foo.dvi -o # or whatever; this makes foo.ps.
51: % The extra TeX runs get the cross-reference information correct.
52: % Sometimes one run after texindex suffices, and sometimes you need more
53: % than two; texi2dvi does it as many times as necessary.
54: %
55: % It is possible to adapt texinfo.tex for other languages, to some
56: % extent. You can get the existing language-specific files from the
57: % full Texinfo distribution.
58: %
59: % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
60:
61:
62: \message{Loading texinfo [version \texinfoversion]:}
63:
64: % If in a .fmt file, print the version number
65: % and turn on active characters that we couldn't do earlier because
66: % they might have appeared in the input file name.
67: \everyjob{\message{[Texinfo version \texinfoversion]}%
68: \catcode`+=\active \catcode`\_=\active}
69:
70: \chardef\other=12
71:
72: % We never want plain's \outer definition of \+ in Texinfo.
73: % For @tex, we can use \tabalign.
74: \let\+ = \relax
75:
76: % Save some plain tex macros whose names we will redefine.
77: \let\ptexb=\b
78: \let\ptexbullet=\bullet
79: \let\ptexc=\c
80: \let\ptexcomma=\,
81: \let\ptexdot=\.
82: \let\ptexdots=\dots
83: \let\ptexend=\end
84: \let\ptexequiv=\equiv
85: \let\ptexexclam=\!
86: \let\ptexfootnote=\footnote
87: \let\ptexgtr=>
88: \let\ptexhat=^
89: \let\ptexi=\i
90: \let\ptexindent=\indent
91: \let\ptexinsert=\insert
92: \let\ptexlbrace=\{
93: \let\ptexless=<
94: \let\ptexnewwrite\newwrite
95: \let\ptexnoindent=\noindent
96: \let\ptexplus=+
97: \let\ptexraggedright=\raggedright
98: \let\ptexrbrace=\}
99: \let\ptexslash=\/
1.1.1.2 ! misho 100: \let\ptexsp=\sp
1.1 misho 101: \let\ptexstar=\*
1.1.1.2 ! misho 102: \let\ptexsup=\sup
1.1 misho 103: \let\ptext=\t
104: \let\ptextop=\top
105: {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
106:
107: % If this character appears in an error message or help string, it
108: % starts a new line in the output.
109: \newlinechar = `^^J
110:
111: % Use TeX 3.0's \inputlineno to get the line number, for better error
112: % messages, but if we're using an old version of TeX, don't do anything.
113: %
114: \ifx\inputlineno\thisisundefined
115: \let\linenumber = \empty % Pre-3.0.
116: \else
117: \def\linenumber{l.\the\inputlineno:\space}
118: \fi
119:
120: % Set up fixed words for English if not already set.
121: \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
122: \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
123: \ifx\putworderror\undefined \gdef\putworderror{error}\fi
124: \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
125: \ifx\putwordin\undefined \gdef\putwordin{in}\fi
126: \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
127: \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
128: \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
129: \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
130: \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
131: \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
132: \ifx\putwordof\undefined \gdef\putwordof{of}\fi
133: \ifx\putwordon\undefined \gdef\putwordon{on}\fi
134: \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
135: \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
136: \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
137: \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
138: \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
139: \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
140: \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
141: %
142: \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
143: \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
144: \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
145: \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
146: \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
147: \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
148: \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
149: \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
150: \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
151: \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
152: \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
153: \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
154: %
155: \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
156: \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
157: \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
158: \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
159: \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
160:
161: % Since the category of space is not known, we have to be careful.
162: \chardef\spacecat = 10
163: \def\spaceisspace{\catcode`\ =\spacecat}
164:
165: % sometimes characters are active, so we need control sequences.
166: \chardef\ampChar = `\&
167: \chardef\colonChar = `\:
168: \chardef\commaChar = `\,
169: \chardef\dashChar = `\-
170: \chardef\dotChar = `\.
171: \chardef\exclamChar= `\!
172: \chardef\hashChar = `\#
173: \chardef\lquoteChar= `\`
174: \chardef\questChar = `\?
175: \chardef\rquoteChar= `\'
176: \chardef\semiChar = `\;
177: \chardef\slashChar = `\/
178: \chardef\underChar = `\_
179:
180: % Ignore a token.
181: %
182: \def\gobble#1{}
183:
184: % The following is used inside several \edef's.
185: \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
186:
187: % Hyphenation fixes.
188: \hyphenation{
189: Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
190: ap-pen-dix bit-map bit-maps
191: data-base data-bases eshell fall-ing half-way long-est man-u-script
192: man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
193: par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
194: spell-ing spell-ings
195: stand-alone strong-est time-stamp time-stamps which-ever white-space
196: wide-spread wrap-around
197: }
198:
199: % Sometimes it is convenient to have everything in the transcript file
200: % and nothing on the terminal. We don't just call \tracingall here,
201: % since that produces some useless output on the terminal. We also make
202: % some effort to order the tracing commands to reduce output in the log
203: % file; cf. trace.sty in LaTeX.
204: %
205: \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
206: \def\loggingall{%
207: \tracingstats2
208: \tracingpages1
209: \tracinglostchars2 % 2 gives us more in etex
210: \tracingparagraphs1
211: \tracingoutput1
212: \tracingmacros2
213: \tracingrestores1
214: \showboxbreadth\maxdimen \showboxdepth\maxdimen
215: \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
216: \tracingscantokens1
217: \tracingifs1
218: \tracinggroups1
219: \tracingnesting2
220: \tracingassigns1
221: \fi
222: \tracingcommands3 % 3 gives us more in etex
223: \errorcontextlines16
224: }%
225:
226: % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
227: % aren't perfect, it's not the end of the world, being an error message,
228: % after all.
229: %
230: \def\errormsg{\begingroup \indexnofonts \doerrormsg}
231: \def\doerrormsg#1{\errmessage{#1}}
232:
233: % add check for \lastpenalty to plain's definitions. If the last thing
234: % we did was a \nobreak, we don't want to insert more space.
235: %
236: \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
237: \removelastskip\penalty-50\smallskip\fi\fi}
238: \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
239: \removelastskip\penalty-100\medskip\fi\fi}
240: \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
241: \removelastskip\penalty-200\bigskip\fi\fi}
242:
1.1.1.2 ! misho 243: % Output routine
! 244: %
! 245:
! 246: % For a final copy, take out the rectangles
! 247: % that mark overfull boxes (in case you have decided
! 248: % that the text looks ok even though it passes the margin).
! 249: %
! 250: \def\finalout{\overfullrule=0pt }
! 251:
1.1 misho 252: % Do @cropmarks to get crop marks.
253: %
254: \newif\ifcropmarks
255: \let\cropmarks = \cropmarkstrue
256: %
257: % Dimensions to add cropmarks at corners.
258: % Added by P. A. MacKay, 12 Nov. 1986
259: %
260: \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
261: \newdimen\cornerlong \cornerlong=1pc
262: \newdimen\cornerthick \cornerthick=.3pt
263: \newdimen\topandbottommargin \topandbottommargin=.75in
264:
265: % Output a mark which sets \thischapter, \thissection and \thiscolor.
266: % We dump everything together because we only have one kind of mark.
267: % This works because we only use \botmark / \topmark, not \firstmark.
268: %
269: % A mark contains a subexpression of the \ifcase ... \fi construct.
270: % \get*marks macros below extract the needed part using \ifcase.
271: %
272: % Another complication is to let the user choose whether \thischapter
273: % (\thissection) refers to the chapter (section) in effect at the top
274: % of a page, or that at the bottom of a page. The solution is
275: % described on page 260 of The TeXbook. It involves outputting two
276: % marks for the sectioning macros, one before the section break, and
277: % one after. I won't pretend I can describe this better than DEK...
1.1.1.2 ! misho 278: %
1.1 misho 279: \def\domark{%
280: \toks0=\expandafter{\lastchapterdefs}%
281: \toks2=\expandafter{\lastsectiondefs}%
282: \toks4=\expandafter{\prevchapterdefs}%
283: \toks6=\expandafter{\prevsectiondefs}%
284: \toks8=\expandafter{\lastcolordefs}%
285: \mark{%
286: \the\toks0 \the\toks2 % 0: top marks (\last...)
287: \noexpand\or \the\toks4 \the\toks6 % 1: bottom marks (default, \prev...)
288: \noexpand\else \the\toks8 % 2: color marks
289: }%
290: }
1.1.1.2 ! misho 291:
! 292: % \gettopheadingmarks, \getbottomheadingmarks - extract needed part of mark.
! 293: %
1.1 misho 294: % \topmark doesn't work for the very first chapter (after the title
295: % page or the contents), so we use \firstmark there -- this gets us
296: % the mark with the chapter defs, unless the user sneaks in, e.g.,
297: % @setcolor (or @url, or @link, etc.) between @contents and the very
298: % first @chapter.
299: \def\gettopheadingmarks{%
300: \ifcase0\topmark\fi
301: \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
302: }
303: \def\getbottomheadingmarks{\ifcase1\botmark\fi}
304: \def\getcolormarks{\ifcase2\topmark\fi}
305:
306: % Avoid "undefined control sequence" errors.
307: \def\lastchapterdefs{}
308: \def\lastsectiondefs{}
1.1.1.2 ! misho 309: \def\lastsection{}
1.1 misho 310: \def\prevchapterdefs{}
311: \def\prevsectiondefs{}
312: \def\lastcolordefs{}
313:
1.1.1.2 ! misho 314: % Margin to add to right of even pages, to left of odd pages.
! 315: \newdimen\bindingoffset
! 316: \newdimen\normaloffset
! 317: \newdimen\pagewidth \newdimen\pageheight
! 318:
1.1 misho 319: % Main output routine.
1.1.1.2 ! misho 320: %
1.1 misho 321: \chardef\PAGE = 255
322: \output = {\onepageout{\pagecontents\PAGE}}
323:
324: \newbox\headlinebox
325: \newbox\footlinebox
326:
1.1.1.2 ! misho 327: % \onepageout takes a vbox as an argument.
! 328: % \shipout a vbox for a single page, adding an optional header, footer,
! 329: % cropmarks, and footnote. This also causes index entries for this page
! 330: % to be written to the auxiliary files.
! 331: %
1.1 misho 332: \def\onepageout#1{%
333: \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
334: %
335: \ifodd\pageno \advance\hoffset by \bindingoffset
336: \else \advance\hoffset by -\bindingoffset\fi
337: %
1.1.1.2 ! misho 338: % Common context changes for both heading and footing.
1.1 misho 339: % Do this outside of the \shipout so @code etc. will be expanded in
340: % the headline as they should be, not taken literally (outputting ''code).
341: \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars}
342: %
1.1.1.2 ! misho 343: % Retrieve the information for the headings from the marks in the page,
! 344: % and call Plain TeX's \makeheadline and \makefootline, which use the
! 345: % values in \headline and \footline.
1.1 misho 346: %
1.1.1.2 ! misho 347: % This is used to check if we are on the first page of a chapter.
! 348: \ifcase0\topmark\fi
! 349: \ifx\thischapter\empty
! 350: % See comment for \gettopheadingmarks
! 351: \ifcase0\firstmark\fi
! 352: \let\curchaptername\thischaptername
! 353: \ifcase1\firstmark\fi
! 354: \let\prevchaptername\thischaptername
! 355: \else
! 356: \let\curchaptername\thischaptername
! 357: \ifcase1\topmark\fi
! 358: \let\prevchaptername\thischaptername
! 359: \fi
! 360: %
! 361: \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
1.1 misho 362: \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
1.1.1.2 ! misho 363: %
! 364: \ifx\curchaptername\prevchaptername
! 365: \let\thischapterheading\thischapter
! 366: \else
! 367: % \thischapterheading is the same as \thischapter except it is blank
! 368: % for the first page of a chapter. This is to prevent the chapter name
! 369: % being shown twice.
! 370: \def\thischapterheading{}%
! 371: \fi
! 372: %
! 373: \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
1.1 misho 374: \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
375: %
376: {%
1.1.1.2 ! misho 377: % Set context for writing to auxiliary files like index files.
1.1 misho 378: % Have to do this stuff outside the \shipout because we want it to
379: % take effect in \write's, yet the group defined by the \vbox ends
380: % before the \shipout runs.
381: %
382: \indexdummies % don't expand commands in the output.
383: \normalturnoffactive % \ in index entries must not stay \, e.g., if
384: % the page break happens to be in the middle of an example.
385: % We don't want .vr (or whatever) entries like this:
1.1.1.2 ! misho 386: % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
1.1 misho 387: % "\acronym" won't work when it's read back in;
388: % it needs to be
1.1.1.2 ! misho 389: % {\code {{\backslashcurfont }acronym}
1.1 misho 390: \shipout\vbox{%
391: % Do this early so pdf references go to the beginning of the page.
392: \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
393: %
394: \ifcropmarks \vbox to \outervsize\bgroup
395: \hsize = \outerhsize
396: \vskip-\topandbottommargin
397: \vtop to0pt{%
398: \line{\ewtop\hfil\ewtop}%
399: \nointerlineskip
400: \line{%
401: \vbox{\moveleft\cornerthick\nstop}%
402: \hfill
403: \vbox{\moveright\cornerthick\nstop}%
404: }%
405: \vss}%
406: \vskip\topandbottommargin
407: \line\bgroup
408: \hfil % center the page within the outer (page) hsize.
409: \ifodd\pageno\hskip\bindingoffset\fi
410: \vbox\bgroup
411: \fi
412: %
413: \unvbox\headlinebox
414: \pagebody{#1}%
415: \ifdim\ht\footlinebox > 0pt
416: % Only leave this space if the footline is nonempty.
417: % (We lessened \vsize for it in \oddfootingyyy.)
418: % The \baselineskip=24pt in plain's \makefootline has no effect.
419: \vskip 24pt
420: \unvbox\footlinebox
421: \fi
422: %
423: \ifcropmarks
424: \egroup % end of \vbox\bgroup
425: \hfil\egroup % end of (centering) \line\bgroup
426: \vskip\topandbottommargin plus1fill minus1fill
427: \boxmaxdepth = \cornerthick
428: \vbox to0pt{\vss
429: \line{%
430: \vbox{\moveleft\cornerthick\nsbot}%
431: \hfill
432: \vbox{\moveright\cornerthick\nsbot}%
433: }%
434: \nointerlineskip
435: \line{\ewbot\hfil\ewbot}%
436: }%
437: \egroup % \vbox from first cropmarks clause
438: \fi
439: }% end of \shipout\vbox
440: }% end of group with \indexdummies
441: \advancepageno
442: \ifnum\outputpenalty>-20000 \else\dosupereject\fi
443: }
444:
445: \newinsert\margin \dimen\margin=\maxdimen
446:
1.1.1.2 ! misho 447: % Main part of page, including any footnotes
1.1 misho 448: \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
449: {\catcode`\@ =11
450: \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
451: % marginal hacks, juha@viisa.uucp (Juha Takala)
452: \ifvoid\margin\else % marginal info is present
453: \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
454: \dimen@=\dp#1\relax \unvbox#1\relax
455: \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
456: \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
457: }
458:
459: % Here are the rules for the cropmarks. Note that they are
460: % offset so that the space between them is truly \outerhsize or \outervsize
461: % (P. A. MacKay, 12 November, 1986)
462: %
463: \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
464: \def\nstop{\vbox
465: {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
466: \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
467: \def\nsbot{\vbox
468: {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
469:
1.1.1.2 ! misho 470:
! 471: % Argument parsing
! 472:
1.1 misho 473: % Parse an argument, then pass it to #1. The argument is the rest of
474: % the input line (except we remove a trailing comment). #1 should be a
475: % macro which expects an ordinary undelimited TeX argument.
1.1.1.2 ! misho 476: % For example, \def\foo{\parsearg\fooxxx}.
1.1 misho 477: %
478: \def\parsearg{\parseargusing{}}
479: \def\parseargusing#1#2{%
480: \def\argtorun{#2}%
481: \begingroup
482: \obeylines
483: \spaceisspace
484: #1%
485: \parseargline\empty% Insert the \empty token, see \finishparsearg below.
486: }
487:
488: {\obeylines %
489: \gdef\parseargline#1^^M{%
490: \endgroup % End of the group started in \parsearg.
491: \argremovecomment #1\comment\ArgTerm%
492: }%
493: }
494:
1.1.1.2 ! misho 495: % First remove any @comment, then any @c comment. Also remove a @texinfoc
! 496: % comment (see \scanmacro for details). Pass the result on to \argcheckspaces.
1.1 misho 497: \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
1.1.1.2 ! misho 498: \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
! 499: \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
1.1 misho 500:
501: % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
502: %
503: % \argremovec might leave us with trailing space, e.g.,
504: % @end itemize @c foo
505: % This space token undergoes the same procedure and is eventually removed
506: % by \finishparsearg.
507: %
508: \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
509: \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
510: \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
511: \def\temp{#3}%
512: \ifx\temp\empty
513: % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
514: \let\temp\finishparsearg
515: \else
516: \let\temp\argcheckspaces
517: \fi
518: % Put the space token in:
519: \temp#1 #3\ArgTerm
520: }
521:
522: % If a _delimited_ argument is enclosed in braces, they get stripped; so
523: % to get _exactly_ the rest of the line, we had to prevent such situation.
524: % We prepended an \empty token at the very beginning and we expand it now,
525: % just before passing the control to \argtorun.
526: % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
527: % either the null string, or it ends with \^^M---thus there is no danger
528: % that a pair of braces would be stripped.
529: %
530: % But first, we have to remove the trailing space token.
531: %
532: \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
533:
1.1.1.2 ! misho 534:
! 535: % \parseargdef - define a command taking an argument on the line
! 536: %
1.1 misho 537: % \parseargdef\foo{...}
538: % is roughly equivalent to
539: % \def\foo{\parsearg\Xfoo}
540: % \def\Xfoo#1{...}
541: \def\parseargdef#1{%
542: \expandafter \doparseargdef \csname\string#1\endcsname #1%
543: }
544: \def\doparseargdef#1#2{%
545: \def#2{\parsearg#1}%
546: \def#1##1%
547: }
548:
549: % Several utility definitions with active space:
550: {
551: \obeyspaces
552: \gdef\obeyedspace{ }
553:
554: % Make each space character in the input produce a normal interword
555: % space in the output. Don't allow a line break at this space, as this
556: % is used only in environments like @example, where each line of input
557: % should produce a line of output anyway.
558: %
559: \gdef\sepspaces{\obeyspaces\let =\tie}
560:
561: % If an index command is used in an @example environment, any spaces
562: % therein should become regular spaces in the raw index file, not the
563: % expansion of \tie (\leavevmode \penalty \@M \ ).
564: \gdef\unsepspaces{\let =\space}
565: }
566:
567:
568: \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
569:
570: % Define the framework for environments in texinfo.tex. It's used like this:
571: %
572: % \envdef\foo{...}
573: % \def\Efoo{...}
574: %
575: % It's the responsibility of \envdef to insert \begingroup before the
576: % actual body; @end closes the group after calling \Efoo. \envdef also
577: % defines \thisenv, so the current environment is known; @end checks
578: % whether the environment name matches. The \checkenv macro can also be
579: % used to check whether the current environment is the one expected.
580: %
581: % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
582: % are not treated as environments; they don't open a group. (The
583: % implementation of @end takes care not to call \endgroup in this
584: % special case.)
585:
586:
587: % At run-time, environments start with this:
588: \def\startenvironment#1{\begingroup\def\thisenv{#1}}
589: % initialize
590: \let\thisenv\empty
591:
592: % ... but they get defined via ``\envdef\foo{...}'':
593: \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
594: \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
595:
596: % Check whether we're in the right environment:
597: \def\checkenv#1{%
598: \def\temp{#1}%
599: \ifx\thisenv\temp
600: \else
601: \badenverr
602: \fi
603: }
604:
605: % Environment mismatch, #1 expected:
606: \def\badenverr{%
607: \errhelp = \EMsimple
608: \errmessage{This command can appear only \inenvironment\temp,
609: not \inenvironment\thisenv}%
610: }
611: \def\inenvironment#1{%
612: \ifx#1\empty
613: outside of any environment%
614: \else
615: in environment \expandafter\string#1%
616: \fi
617: }
618:
619: % @end foo executes the definition of \Efoo.
620: % But first, it executes a specialized version of \checkenv
621: %
622: \parseargdef\end{%
623: \if 1\csname iscond.#1\endcsname
624: \else
625: % The general wording of \badenverr may not be ideal.
626: \expandafter\checkenv\csname#1\endcsname
627: \csname E#1\endcsname
628: \endgroup
629: \fi
630: }
631:
632: \newhelp\EMsimple{Press RETURN to continue.}
633:
634:
635: % Be sure we're in horizontal mode when doing a tie, since we make space
636: % equivalent to this in @example-like environments. Otherwise, a space
637: % at the beginning of a line will start with \penalty -- and
638: % since \penalty is valid in vertical mode, we'd end up putting the
639: % penalty on the vertical list instead of in the new paragraph.
640: {\catcode`@ = 11
641: % Avoid using \@M directly, because that causes trouble
642: % if the definition is written into an index file.
643: \global\let\tiepenalty = \@M
644: \gdef\tie{\leavevmode\penalty\tiepenalty\ }
645: }
646:
647: % @: forces normal size whitespace following.
648: \def\:{\spacefactor=1000 }
649:
650: % @* forces a line break.
651: \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
652:
653: % @/ allows a line break.
654: \let\/=\allowbreak
655:
656: % @. is an end-of-sentence period.
657: \def\.{.\spacefactor=\endofsentencespacefactor\space}
658:
659: % @! is an end-of-sentence bang.
660: \def\!{!\spacefactor=\endofsentencespacefactor\space}
661:
662: % @? is an end-of-sentence query.
663: \def\?{?\spacefactor=\endofsentencespacefactor\space}
664:
665: % @frenchspacing on|off says whether to put extra space after punctuation.
666: %
667: \def\onword{on}
668: \def\offword{off}
669: %
670: \parseargdef\frenchspacing{%
671: \def\temp{#1}%
672: \ifx\temp\onword \plainfrenchspacing
673: \else\ifx\temp\offword \plainnonfrenchspacing
674: \else
675: \errhelp = \EMsimple
676: \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
677: \fi\fi
678: }
679:
680: % @w prevents a word break. Without the \leavevmode, @w at the
681: % beginning of a paragraph, when TeX is still in vertical mode, would
682: % produce a whole line of output instead of starting the paragraph.
683: \def\w#1{\leavevmode\hbox{#1}}
684:
685: % @group ... @end group forces ... to be all on one page, by enclosing
686: % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
687: % to keep its height that of a normal line. According to the rules for
688: % \topskip (p.114 of the TeXbook), the glue inserted is
689: % max (\topskip - \ht (first item), 0). If that height is large,
690: % therefore, no glue is inserted, and the space between the headline and
691: % the text is small, which looks bad.
692: %
693: % Another complication is that the group might be very large. This can
694: % cause the glue on the previous page to be unduly stretched, because it
695: % does not have much material. In this case, it's better to add an
696: % explicit \vfill so that the extra space is at the bottom. The
697: % threshold for doing this is if the group is more than \vfilllimit
698: % percent of a page (\vfilllimit can be changed inside of @tex).
699: %
700: \newbox\groupbox
701: \def\vfilllimit{0.7}
702: %
703: \envdef\group{%
704: \ifnum\catcode`\^^M=\active \else
705: \errhelp = \groupinvalidhelp
706: \errmessage{@group invalid in context where filling is enabled}%
707: \fi
708: \startsavinginserts
709: %
710: \setbox\groupbox = \vtop\bgroup
711: % Do @comment since we are called inside an environment such as
712: % @example, where each end-of-line in the input causes an
713: % end-of-line in the output. We don't want the end-of-line after
714: % the `@group' to put extra space in the output. Since @group
715: % should appear on a line by itself (according to the Texinfo
716: % manual), we don't worry about eating any user text.
717: \comment
718: }
719: %
720: % The \vtop produces a box with normal height and large depth; thus, TeX puts
721: % \baselineskip glue before it, and (when the next line of text is done)
722: % \lineskip glue after it. Thus, space below is not quite equal to space
723: % above. But it's pretty close.
724: \def\Egroup{%
725: % To get correct interline space between the last line of the group
726: % and the first line afterwards, we have to propagate \prevdepth.
727: \endgraf % Not \par, as it may have been set to \lisppar.
728: \global\dimen1 = \prevdepth
729: \egroup % End the \vtop.
1.1.1.2 ! misho 730: \addgroupbox
! 731: \prevdepth = \dimen1
! 732: \checkinserts
! 733: }
! 734:
! 735: \def\addgroupbox{
1.1 misho 736: % \dimen0 is the vertical size of the group's box.
737: \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
738: % \dimen2 is how much space is left on the page (more or less).
739: \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
740: % if the group doesn't fit on the current page, and it's a big big
741: % group, force a page break.
742: \ifdim \dimen0 > \dimen2
743: \ifdim \pagetotal < \vfilllimit\pageheight
744: \page
745: \fi
746: \fi
747: \box\groupbox
748: }
1.1.1.2 ! misho 749:
1.1 misho 750: %
751: % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
752: % message, so this ends up printing `@group can only ...'.
753: %
754: \newhelp\groupinvalidhelp{%
755: group can only be used in environments such as @example,^^J%
756: where each line of input produces a line of output.}
757:
758: % @need space-in-mils
759: % forces a page break if there is not space-in-mils remaining.
760:
761: \newdimen\mil \mil=0.001in
762:
763: \parseargdef\need{%
764: % Ensure vertical mode, so we don't make a big box in the middle of a
765: % paragraph.
766: \par
767: %
768: % If the @need value is less than one line space, it's useless.
769: \dimen0 = #1\mil
770: \dimen2 = \ht\strutbox
771: \advance\dimen2 by \dp\strutbox
772: \ifdim\dimen0 > \dimen2
773: %
774: % Do a \strut just to make the height of this box be normal, so the
775: % normal leading is inserted relative to the preceding line.
776: % And a page break here is fine.
777: \vtop to #1\mil{\strut\vfil}%
778: %
779: % TeX does not even consider page breaks if a penalty added to the
780: % main vertical list is 10000 or more. But in order to see if the
781: % empty box we just added fits on the page, we must make it consider
782: % page breaks. On the other hand, we don't want to actually break the
783: % page after the empty box. So we use a penalty of 9999.
784: %
785: % There is an extremely small chance that TeX will actually break the
786: % page at this \penalty, if there are no other feasible breakpoints in
787: % sight. (If the user is using lots of big @group commands, which
788: % almost-but-not-quite fill up a page, TeX will have a hard time doing
789: % good page breaking, for example.) However, I could not construct an
790: % example where a page broke at this \penalty; if it happens in a real
791: % document, then we can reconsider our strategy.
792: \penalty9999
793: %
794: % Back up by the size of the box, whether we did a page break or not.
795: \kern -#1\mil
796: %
797: % Do not allow a page break right after this kern.
798: \nobreak
799: \fi
800: }
801:
802: % @br forces paragraph break (and is undocumented).
803:
804: \let\br = \par
805:
806: % @page forces the start of a new page.
807: %
808: \def\page{\par\vfill\supereject}
809:
810: % @exdent text....
811: % outputs text on separate line in roman font, starting at standard page margin
812:
813: % This records the amount of indent in the innermost environment.
814: % That's how much \exdent should take out.
815: \newskip\exdentamount
816:
817: % This defn is used inside fill environments such as @defun.
818: \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
819:
820: % This defn is used inside nofill environments such as @example.
821: \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
822: \leftline{\hskip\leftskip{\rm#1}}}}
823:
824: % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
825: % paragraph. For more general purposes, use the \margin insertion
826: % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
827: %
828: \newskip\inmarginspacing \inmarginspacing=1cm
829: \def\strutdepth{\dp\strutbox}
830: %
831: \def\doinmargin#1#2{\strut\vadjust{%
832: \nobreak
833: \kern-\strutdepth
834: \vtop to \strutdepth{%
835: \baselineskip=\strutdepth
836: \vss
837: % if you have multiple lines of stuff to put here, you'll need to
838: % make the vbox yourself of the appropriate size.
839: \ifx#1l%
840: \llap{\ignorespaces #2\hskip\inmarginspacing}%
841: \else
842: \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
843: \fi
844: \null
845: }%
846: }}
847: \def\inleftmargin{\doinmargin l}
848: \def\inrightmargin{\doinmargin r}
849: %
850: % @inmargin{TEXT [, RIGHT-TEXT]}
851: % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
852: % else use TEXT for both).
853: %
854: \def\inmargin#1{\parseinmargin #1,,\finish}
855: \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
856: \setbox0 = \hbox{\ignorespaces #2}%
857: \ifdim\wd0 > 0pt
858: \def\lefttext{#1}% have both texts
859: \def\righttext{#2}%
860: \else
861: \def\lefttext{#1}% have only one text
862: \def\righttext{#1}%
863: \fi
864: %
865: \ifodd\pageno
866: \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
867: \else
868: \def\temp{\inleftmargin\lefttext}%
869: \fi
870: \temp
871: }
872:
873: % @| inserts a changebar to the left of the current line. It should
874: % surround any changed text. This approach does *not* work if the
875: % change spans more than two lines of output. To handle that, we would
876: % have adopt a much more difficult approach (putting marks into the main
877: % vertical list for the beginning and end of each change). This command
878: % is not documented, not supported, and doesn't work.
879: %
880: \def\|{%
881: % \vadjust can only be used in horizontal mode.
882: \leavevmode
883: %
884: % Append this vertical mode material after the current line in the output.
885: \vadjust{%
886: % We want to insert a rule with the height and depth of the current
887: % leading; that is exactly what \strutbox is supposed to record.
888: \vskip-\baselineskip
889: %
890: % \vadjust-items are inserted at the left edge of the type. So
891: % the \llap here moves out into the left-hand margin.
892: \llap{%
893: %
894: % For a thicker or thinner bar, change the `1pt'.
895: \vrule height\baselineskip width1pt
896: %
897: % This is the space between the bar and the text.
898: \hskip 12pt
899: }%
900: }%
901: }
902:
903: % @include FILE -- \input text of FILE.
904: %
905: \def\include{\parseargusing\filenamecatcodes\includezzz}
906: \def\includezzz#1{%
907: \pushthisfilestack
908: \def\thisfile{#1}%
909: {%
910: \makevalueexpandable % we want to expand any @value in FILE.
911: \turnoffactive % and allow special characters in the expansion
912: \indexnofonts % Allow `@@' and other weird things in file names.
913: \wlog{texinfo.tex: doing @include of #1^^J}%
914: \edef\temp{\noexpand\input #1 }%
915: %
916: % This trickery is to read FILE outside of a group, in case it makes
917: % definitions, etc.
918: \expandafter
919: }\temp
920: \popthisfilestack
921: }
922: \def\filenamecatcodes{%
923: \catcode`\\=\other
924: \catcode`~=\other
925: \catcode`^=\other
926: \catcode`_=\other
927: \catcode`|=\other
928: \catcode`<=\other
929: \catcode`>=\other
930: \catcode`+=\other
931: \catcode`-=\other
932: \catcode`\`=\other
933: \catcode`\'=\other
934: }
935:
936: \def\pushthisfilestack{%
937: \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
938: }
939: \def\pushthisfilestackX{%
940: \expandafter\pushthisfilestackY\thisfile\StackTerm
941: }
942: \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
943: \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
944: }
945:
946: \def\popthisfilestack{\errthisfilestackempty}
947: \def\errthisfilestackempty{\errmessage{Internal error:
948: the stack of filenames is empty.}}
949: %
950: \def\thisfile{}
951:
952: % @center line
953: % outputs that line, centered.
954: %
955: \parseargdef\center{%
956: \ifhmode
957: \let\centersub\centerH
958: \else
959: \let\centersub\centerV
960: \fi
961: \centersub{\hfil \ignorespaces#1\unskip \hfil}%
962: \let\centersub\relax % don't let the definition persist, just in case
963: }
964: \def\centerH#1{{%
965: \hfil\break
966: \advance\hsize by -\leftskip
967: \advance\hsize by -\rightskip
968: \line{#1}%
969: \break
970: }}
971: %
972: \newcount\centerpenalty
973: \def\centerV#1{%
974: % The idea here is the same as in \startdefun, \cartouche, etc.: if
975: % @center is the first thing after a section heading, we need to wipe
976: % out the negative parskip inserted by \sectionheading, but still
977: % prevent a page break here.
978: \centerpenalty = \lastpenalty
979: \ifnum\centerpenalty>10000 \vskip\parskip \fi
980: \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
981: \line{\kern\leftskip #1\kern\rightskip}%
982: }
983:
984: % @sp n outputs n lines of vertical space
985: %
986: \parseargdef\sp{\vskip #1\baselineskip}
987:
988: % @comment ...line which is ignored...
989: % @c is the same as @comment
990: % @ignore ... @end ignore is another way to write a comment
991: %
1.1.1.2 ! misho 992: \def\comment{\begingroup \catcode`\^^M=\active%
! 993: \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other\commentxxx}%
! 994:
! 995: {\catcode`\^^M=\active%
! 996: \gdef\commentxxx#1^^M{\endgroup%
! 997: \futurelet\nexttoken\commentxxxx}%
! 998: \gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}%
! 999: }
! 1000:
! 1001: \def\c{\begingroup \catcode`\^^M=\active%
1.1 misho 1002: \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
1.1.1.2 ! misho 1003: \cxxx}
! 1004: {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
! 1005: % See comment in \scanmacro about why the definitions of @c and @comment differ
1.1 misho 1006:
1007: % @paragraphindent NCHARS
1008: % We'll use ems for NCHARS, close enough.
1009: % NCHARS can also be the word `asis' or `none'.
1010: % We cannot feasibly implement @paragraphindent asis, though.
1011: %
1012: \def\asisword{asis} % no translation, these are keywords
1013: \def\noneword{none}
1014: %
1015: \parseargdef\paragraphindent{%
1016: \def\temp{#1}%
1017: \ifx\temp\asisword
1018: \else
1019: \ifx\temp\noneword
1020: \defaultparindent = 0pt
1021: \else
1022: \defaultparindent = #1em
1023: \fi
1024: \fi
1025: \parindent = \defaultparindent
1026: }
1027:
1028: % @exampleindent NCHARS
1029: % We'll use ems for NCHARS like @paragraphindent.
1030: % It seems @exampleindent asis isn't necessary, but
1031: % I preserve it to make it similar to @paragraphindent.
1032: \parseargdef\exampleindent{%
1033: \def\temp{#1}%
1034: \ifx\temp\asisword
1035: \else
1036: \ifx\temp\noneword
1037: \lispnarrowing = 0pt
1038: \else
1039: \lispnarrowing = #1em
1040: \fi
1041: \fi
1042: }
1043:
1044: % @firstparagraphindent WORD
1045: % If WORD is `none', then suppress indentation of the first paragraph
1046: % after a section heading. If WORD is `insert', then do indent at such
1047: % paragraphs.
1048: %
1049: % The paragraph indentation is suppressed or not by calling
1050: % \suppressfirstparagraphindent, which the sectioning commands do.
1051: % We switch the definition of this back and forth according to WORD.
1052: % By default, we suppress indentation.
1053: %
1054: \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
1055: \def\insertword{insert}
1056: %
1057: \parseargdef\firstparagraphindent{%
1058: \def\temp{#1}%
1059: \ifx\temp\noneword
1060: \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
1061: \else\ifx\temp\insertword
1062: \let\suppressfirstparagraphindent = \relax
1063: \else
1064: \errhelp = \EMsimple
1065: \errmessage{Unknown @firstparagraphindent option `\temp'}%
1066: \fi\fi
1067: }
1068:
1069: % Here is how we actually suppress indentation. Redefine \everypar to
1070: % \kern backwards by \parindent, and then reset itself to empty.
1071: %
1072: % We also make \indent itself not actually do anything until the next
1073: % paragraph.
1074: %
1075: \gdef\dosuppressfirstparagraphindent{%
1.1.1.2 ! misho 1076: \gdef\indent {\restorefirstparagraphindent \indent}%
! 1077: \gdef\noindent{\restorefirstparagraphindent \noindent}%
! 1078: \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
1.1 misho 1079: }
1.1.1.2 ! misho 1080: %
1.1 misho 1081: \gdef\restorefirstparagraphindent{%
1.1.1.2 ! misho 1082: \global\let\indent = \ptexindent
! 1083: \global\let\noindent = \ptexnoindent
! 1084: \global\everypar = {}%
1.1 misho 1085: }
1086:
1087:
1088: % @refill is a no-op.
1089: \let\refill=\relax
1090:
1.1.1.2 ! misho 1091: % @setfilename INFO-FILENAME - ignored
! 1092: \let\setfilename=\comment
1.1 misho 1093:
1094: % @bye.
1095: \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
1096:
1097:
1098: \message{pdf,}
1099: % adobe `portable' document format
1100: \newcount\tempnum
1101: \newcount\lnkcount
1102: \newtoks\filename
1103: \newcount\filenamelength
1104: \newcount\pgn
1105: \newtoks\toksA
1106: \newtoks\toksB
1107: \newtoks\toksC
1108: \newtoks\toksD
1109: \newbox\boxA
1.1.1.2 ! misho 1110: \newbox\boxB
1.1 misho 1111: \newcount\countA
1112: \newif\ifpdf
1113: \newif\ifpdfmakepagedest
1114:
1115: % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1116: % can be set). So we test for \relax and 0 as well as being undefined.
1117: \ifx\pdfoutput\thisisundefined
1118: \else
1119: \ifx\pdfoutput\relax
1120: \else
1121: \ifcase\pdfoutput
1122: \else
1123: \pdftrue
1124: \fi
1125: \fi
1126: \fi
1127:
1128: % PDF uses PostScript string constants for the names of xref targets,
1129: % for display in the outlines, and in other places. Thus, we have to
1130: % double any backslashes. Otherwise, a name like "\node" will be
1131: % interpreted as a newline (\n), followed by o, d, e. Not good.
1132: %
1133: % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1134: % related messages. The final outcome is that it is up to the TeX user
1135: % to double the backslashes and otherwise make the string valid, so
1136: % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1137: % do this reliably, so we use it.
1138:
1139: % #1 is a control sequence in which to do the replacements,
1140: % which we \xdef.
1141: \def\txiescapepdf#1{%
1142: \ifx\pdfescapestring\thisisundefined
1143: % No primitive available; should we give a warning or log?
1144: % Many times it won't matter.
1145: \else
1146: % The expandable \pdfescapestring primitive escapes parentheses,
1147: % backslashes, and other special chars.
1148: \xdef#1{\pdfescapestring{#1}}%
1149: \fi
1150: }
1151:
1152: \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1153: with PDF output, and none of those formats could be found. (.eps cannot
1154: be supported due to the design of the PDF format; use regular TeX (DVI
1155: output) for that.)}
1156:
1157: \ifpdf
1158: %
1.1.1.2 ! misho 1159: % Color manipulation macros using ideas from pdfcolor.tex,
1.1 misho 1160: % except using rgb instead of cmyk; the latter is said to render as a
1161: % very dark gray on-screen and a very dark halftone in print, instead
1.1.1.2 ! misho 1162: % of actual black. The dark red here is dark enough to print on paper as
! 1163: % nearly black, but still distinguishable for online viewing. We use
! 1164: % black by default, though.
1.1 misho 1165: \def\rgbDarkRed{0.50 0.09 0.12}
1166: \def\rgbBlack{0 0 0}
1167: %
1168: % k sets the color for filling (usual text, etc.);
1169: % K sets the color for stroking (thin rules, e.g., normal _'s).
1170: \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
1171: %
1172: % Set color, and create a mark which defines \thiscolor accordingly,
1173: % so that \makeheadline knows which color to restore.
1174: \def\setcolor#1{%
1175: \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1176: \domark
1177: \pdfsetcolor{#1}%
1178: }
1179: %
1180: \def\maincolor{\rgbBlack}
1181: \pdfsetcolor{\maincolor}
1182: \edef\thiscolor{\maincolor}
1183: \def\lastcolordefs{}
1184: %
1185: \def\makefootline{%
1186: \baselineskip24pt
1187: \line{\pdfsetcolor{\maincolor}\the\footline}%
1188: }
1189: %
1190: \def\makeheadline{%
1191: \vbox to 0pt{%
1192: \vskip-22.5pt
1193: \line{%
1194: \vbox to8.5pt{}%
1195: % Extract \thiscolor definition from the marks.
1196: \getcolormarks
1197: % Typeset the headline with \maincolor, then restore the color.
1198: \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1199: }%
1200: \vss
1201: }%
1202: \nointerlineskip
1203: }
1204: %
1205: %
1206: \pdfcatalog{/PageMode /UseOutlines}
1207: %
1208: % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1209: \def\dopdfimage#1#2#3{%
1210: \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1211: \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1212: %
1213: % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1214: % others). Let's try in that order, PDF first since if
1215: % someone has a scalable image, presumably better to use that than a
1216: % bitmap.
1217: \let\pdfimgext=\empty
1218: \begingroup
1219: \openin 1 #1.pdf \ifeof 1
1220: \openin 1 #1.PDF \ifeof 1
1221: \openin 1 #1.png \ifeof 1
1222: \openin 1 #1.jpg \ifeof 1
1223: \openin 1 #1.jpeg \ifeof 1
1224: \openin 1 #1.JPG \ifeof 1
1225: \errhelp = \nopdfimagehelp
1226: \errmessage{Could not find image file #1 for pdf}%
1227: \else \gdef\pdfimgext{JPG}%
1228: \fi
1229: \else \gdef\pdfimgext{jpeg}%
1230: \fi
1231: \else \gdef\pdfimgext{jpg}%
1232: \fi
1233: \else \gdef\pdfimgext{png}%
1234: \fi
1235: \else \gdef\pdfimgext{PDF}%
1236: \fi
1237: \else \gdef\pdfimgext{pdf}%
1238: \fi
1239: \closein 1
1240: \endgroup
1241: %
1242: % without \immediate, ancient pdftex seg faults when the same image is
1243: % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1244: \ifnum\pdftexversion < 14
1245: \immediate\pdfimage
1246: \else
1247: \immediate\pdfximage
1248: \fi
1249: \ifdim \wd0 >0pt width \pdfimagewidth \fi
1250: \ifdim \wd2 >0pt height \pdfimageheight \fi
1251: \ifnum\pdftexversion<13
1252: #1.\pdfimgext
1253: \else
1254: {#1.\pdfimgext}%
1255: \fi
1256: \ifnum\pdftexversion < 14 \else
1257: \pdfrefximage \pdflastximage
1258: \fi}
1259: %
1260: \def\pdfmkdest#1{{%
1261: % We have to set dummies so commands such as @code, and characters
1262: % such as \, aren't expanded when present in a section title.
1263: \indexnofonts
1264: \turnoffactive
1265: \makevalueexpandable
1266: \def\pdfdestname{#1}%
1267: \txiescapepdf\pdfdestname
1268: \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1269: }}
1270: %
1271: % used to mark target names; must be expandable.
1272: \def\pdfmkpgn#1{#1}
1273: %
1.1.1.2 ! misho 1274: % by default, use black for everything.
! 1275: \def\urlcolor{\rgbBlack}
! 1276: \def\linkcolor{\rgbBlack}
1.1 misho 1277: \def\endlink{\setcolor{\maincolor}\pdfendlink}
1278: %
1279: % Adding outlines to PDF; macros for calculating structure of outlines
1280: % come from Petr Olsak
1281: \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
1282: \else \csname#1\endcsname \fi}
1283: \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
1284: \advance\tempnum by 1
1285: \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
1286: %
1287: % #1 is the section text, which is what will be displayed in the
1288: % outline by the pdf viewer. #2 is the pdf expression for the number
1289: % of subentries (or empty, for subsubsections). #3 is the node text,
1290: % which might be empty if this toc entry had no corresponding node.
1291: % #4 is the page number
1292: %
1293: \def\dopdfoutline#1#2#3#4{%
1294: % Generate a link to the node text if that exists; else, use the
1295: % page number. We could generate a destination for the section
1296: % text in the case where a section has no node, but it doesn't
1297: % seem worth the trouble, since most documents are normally structured.
1298: \edef\pdfoutlinedest{#3}%
1299: \ifx\pdfoutlinedest\empty
1300: \def\pdfoutlinedest{#4}%
1301: \else
1302: \txiescapepdf\pdfoutlinedest
1303: \fi
1304: %
1305: % Also escape PDF chars in the display string.
1306: \edef\pdfoutlinetext{#1}%
1307: \txiescapepdf\pdfoutlinetext
1308: %
1309: \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1310: }
1311: %
1312: \def\pdfmakeoutlines{%
1313: \begingroup
1314: % Read toc silently, to get counts of subentries for \pdfoutline.
1315: \def\partentry##1##2##3##4{}% ignore parts in the outlines
1316: \def\numchapentry##1##2##3##4{%
1317: \def\thischapnum{##2}%
1318: \def\thissecnum{0}%
1319: \def\thissubsecnum{0}%
1320: }%
1321: \def\numsecentry##1##2##3##4{%
1322: \advancenumber{chap\thischapnum}%
1323: \def\thissecnum{##2}%
1324: \def\thissubsecnum{0}%
1325: }%
1326: \def\numsubsecentry##1##2##3##4{%
1327: \advancenumber{sec\thissecnum}%
1328: \def\thissubsecnum{##2}%
1329: }%
1330: \def\numsubsubsecentry##1##2##3##4{%
1331: \advancenumber{subsec\thissubsecnum}%
1332: }%
1333: \def\thischapnum{0}%
1334: \def\thissecnum{0}%
1335: \def\thissubsecnum{0}%
1336: %
1337: % use \def rather than \let here because we redefine \chapentry et
1338: % al. a second time, below.
1339: \def\appentry{\numchapentry}%
1340: \def\appsecentry{\numsecentry}%
1341: \def\appsubsecentry{\numsubsecentry}%
1342: \def\appsubsubsecentry{\numsubsubsecentry}%
1343: \def\unnchapentry{\numchapentry}%
1344: \def\unnsecentry{\numsecentry}%
1345: \def\unnsubsecentry{\numsubsecentry}%
1346: \def\unnsubsubsecentry{\numsubsubsecentry}%
1347: \readdatafile{toc}%
1348: %
1349: % Read toc second time, this time actually producing the outlines.
1350: % The `-' means take the \expnumber as the absolute number of
1351: % subentries, which we calculated on our first read of the .toc above.
1352: %
1353: % We use the node names as the destinations.
1354: \def\numchapentry##1##2##3##4{%
1355: \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
1356: \def\numsecentry##1##2##3##4{%
1357: \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
1358: \def\numsubsecentry##1##2##3##4{%
1359: \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
1360: \def\numsubsubsecentry##1##2##3##4{% count is always zero
1361: \dopdfoutline{##1}{}{##3}{##4}}%
1362: %
1363: % PDF outlines are displayed using system fonts, instead of
1364: % document fonts. Therefore we cannot use special characters,
1365: % since the encoding is unknown. For example, the eogonek from
1366: % Latin 2 (0xea) gets translated to a | character. Info from
1367: % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1368: %
1369: % TODO this right, we have to translate 8-bit characters to
1370: % their "best" equivalent, based on the @documentencoding. Too
1371: % much work for too little return. Just use the ASCII equivalents
1372: % we use for the index sort strings.
1373: %
1374: \indexnofonts
1375: \setupdatafile
1376: % We can have normal brace characters in the PDF outlines, unlike
1377: % Texinfo index files. So set that up.
1378: \def\{{\lbracecharliteral}%
1379: \def\}{\rbracecharliteral}%
1380: \catcode`\\=\active \otherbackslash
1381: \input \tocreadfilename
1382: \endgroup
1383: }
1384: {\catcode`[=1 \catcode`]=2
1385: \catcode`{=\other \catcode`}=\other
1386: \gdef\lbracecharliteral[{]%
1387: \gdef\rbracecharliteral[}]%
1388: ]
1389: %
1390: \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1391: \ifx\PP\D\let\nextsp\relax
1392: \else\let\nextsp\skipspaces
1393: \addtokens{\filename}{\PP}%
1394: \advance\filenamelength by 1
1395: \fi
1396: \nextsp}
1397: \def\getfilename#1{%
1398: \filenamelength=0
1399: % If we don't expand the argument now, \skipspaces will get
1400: % snagged on things like "@value{foo}".
1401: \edef\temp{#1}%
1402: \expandafter\skipspaces\temp|\relax
1403: }
1404: \ifnum\pdftexversion < 14
1405: \let \startlink \pdfannotlink
1406: \else
1407: \let \startlink \pdfstartlink
1408: \fi
1409: % make a live url in pdf output.
1410: \def\pdfurl#1{%
1411: \begingroup
1412: % it seems we really need yet another set of dummies; have not
1413: % tried to figure out what each command should do in the context
1414: % of @url. for now, just make @/ a no-op, that's the only one
1415: % people have actually reported a problem with.
1416: %
1417: \normalturnoffactive
1418: \def\@{@}%
1419: \let\/=\empty
1420: \makevalueexpandable
1421: % do we want to go so far as to use \indexnofonts instead of just
1422: % special-casing \var here?
1423: \def\var##1{##1}%
1424: %
1425: \leavevmode\setcolor{\urlcolor}%
1426: \startlink attr{/Border [0 0 0]}%
1427: user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1428: \endgroup}
1429: \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1430: \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1431: \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1432: \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1433: \def\maketoks{%
1434: \expandafter\poptoks\the\toksA|ENDTOKS|\relax
1435: \ifx\first0\adn0
1436: \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1437: \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1438: \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1439: \else
1440: \ifnum0=\countA\else\makelink\fi
1441: \ifx\first.\let\next=\done\else
1442: \let\next=\maketoks
1443: \addtokens{\toksB}{\the\toksD}
1444: \ifx\first,\addtokens{\toksB}{\space}\fi
1445: \fi
1446: \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1447: \next}
1448: \def\makelink{\addtokens{\toksB}%
1449: {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1450: \def\pdflink#1{%
1451: \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1452: \setcolor{\linkcolor}#1\endlink}
1453: \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1454: \else
1455: % non-pdf mode
1456: \let\pdfmkdest = \gobble
1457: \let\pdfurl = \gobble
1458: \let\endlink = \relax
1459: \let\setcolor = \gobble
1460: \let\pdfsetcolor = \gobble
1461: \let\pdfmakeoutlines = \relax
1462: \fi % \ifx\pdfoutput
1463:
1464:
1465: \message{fonts,}
1466:
1467: % Change the current font style to #1, remembering it in \curfontstyle.
1468: % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
1469: % italics, not bold italics.
1470: %
1471: \def\setfontstyle#1{%
1472: \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
1473: \csname ten#1\endcsname % change the current font
1474: }
1475:
1476: % Select #1 fonts with the current style.
1477: %
1478: \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
1479:
1480: \def\rm{\fam=0 \setfontstyle{rm}}
1481: \def\it{\fam=\itfam \setfontstyle{it}}
1482: \def\sl{\fam=\slfam \setfontstyle{sl}}
1483: \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
1484: \def\tt{\fam=\ttfam \setfontstyle{tt}}
1485:
1486: % Unfortunately, we have to override this for titles and the like, since
1487: % in those cases "rm" is bold. Sigh.
1488: \def\rmisbold{\rm\def\curfontstyle{bf}}
1489:
1490: % Texinfo sort of supports the sans serif font style, which plain TeX does not.
1491: % So we set up a \sf.
1492: \newfam\sffam
1493: \def\sf{\fam=\sffam \setfontstyle{sf}}
1494: \let\li = \sf % Sometimes we call it \li, not \sf.
1495:
1496: % We don't need math for this font style.
1497: \def\ttsl{\setfontstyle{ttsl}}
1498:
1499:
1500: % Set the baselineskip to #1, and the lineskip and strut size
1501: % correspondingly. There is no deep meaning behind these magic numbers
1502: % used as factors; they just match (closely enough) what Knuth defined.
1503: %
1504: \def\lineskipfactor{.08333}
1505: \def\strutheightpercent{.70833}
1506: \def\strutdepthpercent {.29167}
1507: %
1508: % can get a sort of poor man's double spacing by redefining this.
1509: \def\baselinefactor{1}
1510: %
1511: \newdimen\textleading
1512: \def\setleading#1{%
1513: \dimen0 = #1\relax
1514: \normalbaselineskip = \baselinefactor\dimen0
1515: \normallineskip = \lineskipfactor\normalbaselineskip
1516: \normalbaselines
1517: \setbox\strutbox =\hbox{%
1518: \vrule width0pt height\strutheightpercent\baselineskip
1519: depth \strutdepthpercent \baselineskip
1520: }%
1521: }
1522:
1523: % PDF CMaps. See also LaTeX's t1.cmap.
1524: %
1525: % do nothing with this by default.
1526: \expandafter\let\csname cmapOT1\endcsname\gobble
1527: \expandafter\let\csname cmapOT1IT\endcsname\gobble
1528: \expandafter\let\csname cmapOT1TT\endcsname\gobble
1529:
1530: % if we are producing pdf, and we have \pdffontattr, then define cmaps.
1531: % (\pdffontattr was introduced many years ago, but people still run
1532: % older pdftex's; it's easy to conditionalize, so we do.)
1533: \ifpdf \ifx\pdffontattr\thisisundefined \else
1534: \begingroup
1535: \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1536: \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1537: %%DocumentNeededResources: ProcSet (CIDInit)
1538: %%IncludeResource: ProcSet (CIDInit)
1539: %%BeginResource: CMap (TeX-OT1-0)
1540: %%Title: (TeX-OT1-0 TeX OT1 0)
1541: %%Version: 1.000
1542: %%EndComments
1543: /CIDInit /ProcSet findresource begin
1544: 12 dict begin
1545: begincmap
1546: /CIDSystemInfo
1547: << /Registry (TeX)
1548: /Ordering (OT1)
1549: /Supplement 0
1550: >> def
1551: /CMapName /TeX-OT1-0 def
1552: /CMapType 2 def
1553: 1 begincodespacerange
1554: <00> <7F>
1555: endcodespacerange
1556: 8 beginbfrange
1557: <00> <01> <0393>
1558: <09> <0A> <03A8>
1559: <23> <26> <0023>
1560: <28> <3B> <0028>
1561: <3F> <5B> <003F>
1562: <5D> <5E> <005D>
1563: <61> <7A> <0061>
1564: <7B> <7C> <2013>
1565: endbfrange
1566: 40 beginbfchar
1567: <02> <0398>
1568: <03> <039B>
1569: <04> <039E>
1570: <05> <03A0>
1571: <06> <03A3>
1572: <07> <03D2>
1573: <08> <03A6>
1574: <0B> <00660066>
1575: <0C> <00660069>
1576: <0D> <0066006C>
1577: <0E> <006600660069>
1578: <0F> <00660066006C>
1579: <10> <0131>
1580: <11> <0237>
1581: <12> <0060>
1582: <13> <00B4>
1583: <14> <02C7>
1584: <15> <02D8>
1585: <16> <00AF>
1586: <17> <02DA>
1587: <18> <00B8>
1588: <19> <00DF>
1589: <1A> <00E6>
1590: <1B> <0153>
1591: <1C> <00F8>
1592: <1D> <00C6>
1593: <1E> <0152>
1594: <1F> <00D8>
1595: <21> <0021>
1596: <22> <201D>
1597: <27> <2019>
1598: <3C> <00A1>
1599: <3D> <003D>
1600: <3E> <00BF>
1601: <5C> <201C>
1602: <5F> <02D9>
1603: <60> <2018>
1604: <7D> <02DD>
1605: <7E> <007E>
1606: <7F> <00A8>
1607: endbfchar
1608: endcmap
1609: CMapName currentdict /CMap defineresource pop
1610: end
1611: end
1612: %%EndResource
1613: %%EOF
1614: }\endgroup
1615: \expandafter\edef\csname cmapOT1\endcsname#1{%
1616: \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1617: }%
1618: %
1619: % \cmapOT1IT
1620: \begingroup
1621: \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1622: \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1623: %%DocumentNeededResources: ProcSet (CIDInit)
1624: %%IncludeResource: ProcSet (CIDInit)
1625: %%BeginResource: CMap (TeX-OT1IT-0)
1626: %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1627: %%Version: 1.000
1628: %%EndComments
1629: /CIDInit /ProcSet findresource begin
1630: 12 dict begin
1631: begincmap
1632: /CIDSystemInfo
1633: << /Registry (TeX)
1634: /Ordering (OT1IT)
1635: /Supplement 0
1636: >> def
1637: /CMapName /TeX-OT1IT-0 def
1638: /CMapType 2 def
1639: 1 begincodespacerange
1640: <00> <7F>
1641: endcodespacerange
1642: 8 beginbfrange
1643: <00> <01> <0393>
1644: <09> <0A> <03A8>
1645: <25> <26> <0025>
1646: <28> <3B> <0028>
1647: <3F> <5B> <003F>
1648: <5D> <5E> <005D>
1649: <61> <7A> <0061>
1650: <7B> <7C> <2013>
1651: endbfrange
1652: 42 beginbfchar
1653: <02> <0398>
1654: <03> <039B>
1655: <04> <039E>
1656: <05> <03A0>
1657: <06> <03A3>
1658: <07> <03D2>
1659: <08> <03A6>
1660: <0B> <00660066>
1661: <0C> <00660069>
1662: <0D> <0066006C>
1663: <0E> <006600660069>
1664: <0F> <00660066006C>
1665: <10> <0131>
1666: <11> <0237>
1667: <12> <0060>
1668: <13> <00B4>
1669: <14> <02C7>
1670: <15> <02D8>
1671: <16> <00AF>
1672: <17> <02DA>
1673: <18> <00B8>
1674: <19> <00DF>
1675: <1A> <00E6>
1676: <1B> <0153>
1677: <1C> <00F8>
1678: <1D> <00C6>
1679: <1E> <0152>
1680: <1F> <00D8>
1681: <21> <0021>
1682: <22> <201D>
1683: <23> <0023>
1684: <24> <00A3>
1685: <27> <2019>
1686: <3C> <00A1>
1687: <3D> <003D>
1688: <3E> <00BF>
1689: <5C> <201C>
1690: <5F> <02D9>
1691: <60> <2018>
1692: <7D> <02DD>
1693: <7E> <007E>
1694: <7F> <00A8>
1695: endbfchar
1696: endcmap
1697: CMapName currentdict /CMap defineresource pop
1698: end
1699: end
1700: %%EndResource
1701: %%EOF
1702: }\endgroup
1703: \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1704: \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1705: }%
1706: %
1707: % \cmapOT1TT
1708: \begingroup
1709: \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1710: \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1711: %%DocumentNeededResources: ProcSet (CIDInit)
1712: %%IncludeResource: ProcSet (CIDInit)
1713: %%BeginResource: CMap (TeX-OT1TT-0)
1714: %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1715: %%Version: 1.000
1716: %%EndComments
1717: /CIDInit /ProcSet findresource begin
1718: 12 dict begin
1719: begincmap
1720: /CIDSystemInfo
1721: << /Registry (TeX)
1722: /Ordering (OT1TT)
1723: /Supplement 0
1724: >> def
1725: /CMapName /TeX-OT1TT-0 def
1726: /CMapType 2 def
1727: 1 begincodespacerange
1728: <00> <7F>
1729: endcodespacerange
1730: 5 beginbfrange
1731: <00> <01> <0393>
1732: <09> <0A> <03A8>
1733: <21> <26> <0021>
1734: <28> <5F> <0028>
1735: <61> <7E> <0061>
1736: endbfrange
1737: 32 beginbfchar
1738: <02> <0398>
1739: <03> <039B>
1740: <04> <039E>
1741: <05> <03A0>
1742: <06> <03A3>
1743: <07> <03D2>
1744: <08> <03A6>
1745: <0B> <2191>
1746: <0C> <2193>
1747: <0D> <0027>
1748: <0E> <00A1>
1749: <0F> <00BF>
1750: <10> <0131>
1751: <11> <0237>
1752: <12> <0060>
1753: <13> <00B4>
1754: <14> <02C7>
1755: <15> <02D8>
1756: <16> <00AF>
1757: <17> <02DA>
1758: <18> <00B8>
1759: <19> <00DF>
1760: <1A> <00E6>
1761: <1B> <0153>
1762: <1C> <00F8>
1763: <1D> <00C6>
1764: <1E> <0152>
1765: <1F> <00D8>
1766: <20> <2423>
1767: <27> <2019>
1768: <60> <2018>
1769: <7F> <00A8>
1770: endbfchar
1771: endcmap
1772: CMapName currentdict /CMap defineresource pop
1773: end
1774: end
1775: %%EndResource
1776: %%EOF
1777: }\endgroup
1778: \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1779: \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1780: }%
1781: \fi\fi
1782:
1783:
1784: % Set the font macro #1 to the font named \fontprefix#2.
1785: % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1786: % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
1787: % Example:
1788: % #1 = \textrm
1789: % #2 = \rmshape
1790: % #3 = 10
1791: % #4 = \mainmagstep
1792: % #5 = OT1
1793: %
1794: \def\setfont#1#2#3#4#5{%
1795: \font#1=\fontprefix#2#3 scaled #4
1796: \csname cmap#5\endcsname#1%
1797: }
1798: % This is what gets called when #5 of \setfont is empty.
1799: \let\cmap\gobble
1800: %
1801: % (end of cmaps)
1802:
1803: % Use cm as the default font prefix.
1804: % To specify the font prefix, you must define \fontprefix
1805: % before you read in texinfo.tex.
1806: \ifx\fontprefix\thisisundefined
1807: \def\fontprefix{cm}
1808: \fi
1809: % Support font families that don't use the same naming scheme as CM.
1810: \def\rmshape{r}
1811: \def\rmbshape{bx} % where the normal face is bold
1812: \def\bfshape{b}
1813: \def\bxshape{bx}
1814: \def\ttshape{tt}
1815: \def\ttbshape{tt}
1816: \def\ttslshape{sltt}
1817: \def\itshape{ti}
1818: \def\itbshape{bxti}
1819: \def\slshape{sl}
1820: \def\slbshape{bxsl}
1821: \def\sfshape{ss}
1822: \def\sfbshape{ss}
1823: \def\scshape{csc}
1824: \def\scbshape{csc}
1825:
1826: % Definitions for a main text size of 11pt. (The default in Texinfo.)
1827: %
1828: \def\definetextfontsizexi{%
1829: % Text fonts (11.2pt, magstep1).
1830: \def\textnominalsize{11pt}
1831: \edef\mainmagstep{\magstephalf}
1832: \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1833: \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1834: \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1835: \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1836: \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1837: \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1838: \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1839: \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1840: \font\texti=cmmi10 scaled \mainmagstep
1841: \font\textsy=cmsy10 scaled \mainmagstep
1842: \def\textecsize{1095}
1843:
1844: % A few fonts for @defun names and args.
1845: \setfont\defbf\bfshape{10}{\magstep1}{OT1}
1846: \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1.1.1.2 ! misho 1847: \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
1.1 misho 1848: \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1.1.1.2 ! misho 1849: \def\df{\let\tentt=\deftt \let\tenbf = \defbf
! 1850: \let\tenttsl=\defttsl \let\tensl=\defsl \bf}
1.1 misho 1851:
1852: % Fonts for indices, footnotes, small examples (9pt).
1853: \def\smallnominalsize{9pt}
1854: \setfont\smallrm\rmshape{9}{1000}{OT1}
1855: \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1856: \setfont\smallbf\bfshape{10}{900}{OT1}
1857: \setfont\smallit\itshape{9}{1000}{OT1IT}
1858: \setfont\smallsl\slshape{9}{1000}{OT1}
1859: \setfont\smallsf\sfshape{9}{1000}{OT1}
1860: \setfont\smallsc\scshape{10}{900}{OT1}
1861: \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1862: \font\smalli=cmmi9
1863: \font\smallsy=cmsy9
1864: \def\smallecsize{0900}
1865:
1866: % Fonts for small examples (8pt).
1867: \def\smallernominalsize{8pt}
1868: \setfont\smallerrm\rmshape{8}{1000}{OT1}
1869: \setfont\smallertt\ttshape{8}{1000}{OT1TT}
1870: \setfont\smallerbf\bfshape{10}{800}{OT1}
1871: \setfont\smallerit\itshape{8}{1000}{OT1IT}
1872: \setfont\smallersl\slshape{8}{1000}{OT1}
1873: \setfont\smallersf\sfshape{8}{1000}{OT1}
1874: \setfont\smallersc\scshape{10}{800}{OT1}
1875: \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1876: \font\smalleri=cmmi8
1877: \font\smallersy=cmsy8
1878: \def\smallerecsize{0800}
1879:
1880: % Fonts for title page (20.4pt):
1881: \def\titlenominalsize{20pt}
1882: \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1883: \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1884: \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1885: \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1886: \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1887: \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1888: \let\titlebf=\titlerm
1889: \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1890: \font\titlei=cmmi12 scaled \magstep3
1891: \font\titlesy=cmsy10 scaled \magstep4
1892: \def\titleecsize{2074}
1893:
1894: % Chapter (and unnumbered) fonts (17.28pt).
1895: \def\chapnominalsize{17pt}
1896: \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
1897: \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
1898: \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
1899: \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
1900: \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
1901: \setfont\chapsf\sfbshape{17}{1000}{OT1}
1902: \let\chapbf=\chaprm
1903: \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
1904: \font\chapi=cmmi12 scaled \magstep2
1905: \font\chapsy=cmsy10 scaled \magstep3
1906: \def\chapecsize{1728}
1907:
1908: % Section fonts (14.4pt).
1909: \def\secnominalsize{14pt}
1910: \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
1.1.1.2 ! misho 1911: \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
1.1 misho 1912: \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
1913: \setfont\secsl\slbshape{10}{\magstep2}{OT1}
1914: \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
1915: \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
1916: \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
1917: \let\secbf\secrm
1918: \setfont\secsc\scbshape{10}{\magstep2}{OT1}
1919: \font\seci=cmmi12 scaled \magstep1
1920: \font\secsy=cmsy10 scaled \magstep2
1921: \def\sececsize{1440}
1922:
1923: % Subsection fonts (13.15pt).
1924: \def\ssecnominalsize{13pt}
1925: \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
1926: \setfont\ssecit\itbshape{10}{1315}{OT1IT}
1927: \setfont\ssecsl\slbshape{10}{1315}{OT1}
1928: \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
1929: \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
1930: \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
1931: \let\ssecbf\ssecrm
1932: \setfont\ssecsc\scbshape{10}{1315}{OT1}
1933: \font\sseci=cmmi12 scaled \magstephalf
1934: \font\ssecsy=cmsy10 scaled 1315
1935: \def\ssececsize{1200}
1936:
1937: % Reduced fonts for @acro in text (10pt).
1938: \def\reducednominalsize{10pt}
1939: \setfont\reducedrm\rmshape{10}{1000}{OT1}
1940: \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
1941: \setfont\reducedbf\bfshape{10}{1000}{OT1}
1942: \setfont\reducedit\itshape{10}{1000}{OT1IT}
1943: \setfont\reducedsl\slshape{10}{1000}{OT1}
1944: \setfont\reducedsf\sfshape{10}{1000}{OT1}
1945: \setfont\reducedsc\scshape{10}{1000}{OT1}
1946: \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
1947: \font\reducedi=cmmi10
1948: \font\reducedsy=cmsy10
1949: \def\reducedecsize{1000}
1950:
1951: \textleading = 13.2pt % line spacing for 11pt CM
1952: \textfonts % reset the current fonts
1953: \rm
1954: } % end of 11pt text font size definitions, \definetextfontsizexi
1955:
1956:
1957: % Definitions to make the main text be 10pt Computer Modern, with
1958: % section, chapter, etc., sizes following suit. This is for the GNU
1959: % Press printing of the Emacs 22 manual. Maybe other manuals in the
1960: % future. Used with @smallbook, which sets the leading to 12pt.
1961: %
1962: \def\definetextfontsizex{%
1963: % Text fonts (10pt).
1964: \def\textnominalsize{10pt}
1965: \edef\mainmagstep{1000}
1966: \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1967: \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1968: \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1969: \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1970: \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1971: \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1972: \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1973: \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1974: \font\texti=cmmi10 scaled \mainmagstep
1975: \font\textsy=cmsy10 scaled \mainmagstep
1976: \def\textecsize{1000}
1977:
1978: % A few fonts for @defun names and args.
1979: \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
1980: \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
1.1.1.2 ! misho 1981: \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
1.1 misho 1982: \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
1.1.1.2 ! misho 1983: \def\df{\let\tentt=\deftt \let\tenbf = \defbf
! 1984: \let\tensl=\defsl \let\tenttsl=\defttsl \bf}
1.1 misho 1985:
1986: % Fonts for indices, footnotes, small examples (9pt).
1987: \def\smallnominalsize{9pt}
1988: \setfont\smallrm\rmshape{9}{1000}{OT1}
1989: \setfont\smalltt\ttshape{9}{1000}{OT1TT}
1990: \setfont\smallbf\bfshape{10}{900}{OT1}
1991: \setfont\smallit\itshape{9}{1000}{OT1IT}
1992: \setfont\smallsl\slshape{9}{1000}{OT1}
1993: \setfont\smallsf\sfshape{9}{1000}{OT1}
1994: \setfont\smallsc\scshape{10}{900}{OT1}
1995: \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1996: \font\smalli=cmmi9
1997: \font\smallsy=cmsy9
1998: \def\smallecsize{0900}
1999:
2000: % Fonts for small examples (8pt).
2001: \def\smallernominalsize{8pt}
2002: \setfont\smallerrm\rmshape{8}{1000}{OT1}
2003: \setfont\smallertt\ttshape{8}{1000}{OT1TT}
2004: \setfont\smallerbf\bfshape{10}{800}{OT1}
2005: \setfont\smallerit\itshape{8}{1000}{OT1IT}
2006: \setfont\smallersl\slshape{8}{1000}{OT1}
2007: \setfont\smallersf\sfshape{8}{1000}{OT1}
2008: \setfont\smallersc\scshape{10}{800}{OT1}
2009: \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2010: \font\smalleri=cmmi8
2011: \font\smallersy=cmsy8
2012: \def\smallerecsize{0800}
2013:
2014: % Fonts for title page (20.4pt):
2015: \def\titlenominalsize{20pt}
2016: \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2017: \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2018: \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2019: \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2020: \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2021: \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2022: \let\titlebf=\titlerm
2023: \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2024: \font\titlei=cmmi12 scaled \magstep3
2025: \font\titlesy=cmsy10 scaled \magstep4
2026: \def\titleecsize{2074}
2027:
2028: % Chapter fonts (14.4pt).
2029: \def\chapnominalsize{14pt}
2030: \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2031: \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2032: \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2033: \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2034: \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2035: \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2036: \let\chapbf\chaprm
2037: \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2038: \font\chapi=cmmi12 scaled \magstep1
2039: \font\chapsy=cmsy10 scaled \magstep2
2040: \def\chapecsize{1440}
2041:
2042: % Section fonts (12pt).
2043: \def\secnominalsize{12pt}
2044: \setfont\secrm\rmbshape{12}{1000}{OT1}
2045: \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2046: \setfont\secsl\slbshape{10}{\magstep1}{OT1}
2047: \setfont\sectt\ttbshape{12}{1000}{OT1TT}
2048: \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2049: \setfont\secsf\sfbshape{12}{1000}{OT1}
2050: \let\secbf\secrm
2051: \setfont\secsc\scbshape{10}{\magstep1}{OT1}
2052: \font\seci=cmmi12
2053: \font\secsy=cmsy10 scaled \magstep1
2054: \def\sececsize{1200}
2055:
2056: % Subsection fonts (10pt).
2057: \def\ssecnominalsize{10pt}
2058: \setfont\ssecrm\rmbshape{10}{1000}{OT1}
2059: \setfont\ssecit\itbshape{10}{1000}{OT1IT}
2060: \setfont\ssecsl\slbshape{10}{1000}{OT1}
2061: \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2062: \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2063: \setfont\ssecsf\sfbshape{10}{1000}{OT1}
2064: \let\ssecbf\ssecrm
2065: \setfont\ssecsc\scbshape{10}{1000}{OT1}
2066: \font\sseci=cmmi10
2067: \font\ssecsy=cmsy10
2068: \def\ssececsize{1000}
2069:
2070: % Reduced fonts for @acro in text (9pt).
2071: \def\reducednominalsize{9pt}
2072: \setfont\reducedrm\rmshape{9}{1000}{OT1}
2073: \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2074: \setfont\reducedbf\bfshape{10}{900}{OT1}
2075: \setfont\reducedit\itshape{9}{1000}{OT1IT}
2076: \setfont\reducedsl\slshape{9}{1000}{OT1}
2077: \setfont\reducedsf\sfshape{9}{1000}{OT1}
2078: \setfont\reducedsc\scshape{10}{900}{OT1}
2079: \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2080: \font\reducedi=cmmi9
2081: \font\reducedsy=cmsy9
2082: \def\reducedecsize{0900}
2083:
2084: \divide\parskip by 2 % reduce space between paragraphs
2085: \textleading = 12pt % line spacing for 10pt CM
2086: \textfonts % reset the current fonts
2087: \rm
2088: } % end of 10pt text font size definitions, \definetextfontsizex
2089:
2090:
2091: % We provide the user-level command
2092: % @fonttextsize 10
2093: % (or 11) to redefine the text font size. pt is assumed.
2094: %
2095: \def\xiword{11}
2096: \def\xword{10}
2097: \def\xwordpt{10pt}
2098: %
2099: \parseargdef\fonttextsize{%
2100: \def\textsizearg{#1}%
2101: %\wlog{doing @fonttextsize \textsizearg}%
2102: %
2103: % Set \globaldefs so that documents can use this inside @tex, since
2104: % makeinfo 4.8 does not support it, but we need it nonetheless.
2105: %
2106: \begingroup \globaldefs=1
2107: \ifx\textsizearg\xword \definetextfontsizex
2108: \else \ifx\textsizearg\xiword \definetextfontsizexi
2109: \else
2110: \errhelp=\EMsimple
2111: \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2112: \fi\fi
2113: \endgroup
2114: }
2115:
2116: % In order for the font changes to affect most math symbols and letters,
1.1.1.2 ! misho 2117: % we have to define the \textfont of the standard families. We don't
! 2118: % bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
1.1 misho 2119: %
2120: \def\resetmathfonts{%
2121: \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
2122: \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
2123: \textfont\ttfam=\tentt \textfont\sffam=\tensf
2124: }
2125:
2126: % The font-changing commands redefine the meanings of \tenSTYLE, instead
2127: % of just \STYLE. We do this because \STYLE needs to also set the
2128: % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
2129: % \tenSTYLE to set the current font.
2130: %
2131: % Each font-changing command also sets the names \lsize (one size lower)
1.1.1.2 ! misho 2132: % and \lllsize (three sizes lower). These relative commands are used
! 2133: % in, e.g., the LaTeX logo and acronyms.
1.1 misho 2134: %
2135: % This all needs generalizing, badly.
2136: %
2137: \def\textfonts{%
2138: \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
2139: \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
2140: \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
2141: \let\tenttsl=\textttsl
2142: \def\curfontsize{text}%
2143: \def\lsize{reduced}\def\lllsize{smaller}%
2144: \resetmathfonts \setleading{\textleading}}
2145: \def\titlefonts{%
2146: \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
2147: \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
2148: \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
2149: \let\tenttsl=\titlettsl
2150: \def\curfontsize{title}%
2151: \def\lsize{chap}\def\lllsize{subsec}%
2152: \resetmathfonts \setleading{27pt}}
2153: \def\titlefont#1{{\titlefonts\rmisbold #1}}
2154: \def\chapfonts{%
2155: \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
2156: \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
2157: \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
2158: \let\tenttsl=\chapttsl
2159: \def\curfontsize{chap}%
2160: \def\lsize{sec}\def\lllsize{text}%
2161: \resetmathfonts \setleading{19pt}}
2162: \def\secfonts{%
2163: \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
2164: \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
2165: \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
2166: \let\tenttsl=\secttsl
2167: \def\curfontsize{sec}%
2168: \def\lsize{subsec}\def\lllsize{reduced}%
1.1.1.2 ! misho 2169: \resetmathfonts \setleading{17pt}}
1.1 misho 2170: \def\subsecfonts{%
2171: \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
2172: \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
2173: \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
2174: \let\tenttsl=\ssecttsl
2175: \def\curfontsize{ssec}%
2176: \def\lsize{text}\def\lllsize{small}%
2177: \resetmathfonts \setleading{15pt}}
2178: \let\subsubsecfonts = \subsecfonts
2179: \def\reducedfonts{%
2180: \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
2181: \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
2182: \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
2183: \let\tenttsl=\reducedttsl
2184: \def\curfontsize{reduced}%
2185: \def\lsize{small}\def\lllsize{smaller}%
2186: \resetmathfonts \setleading{10.5pt}}
2187: \def\smallfonts{%
2188: \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
2189: \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
2190: \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
2191: \let\tenttsl=\smallttsl
2192: \def\curfontsize{small}%
2193: \def\lsize{smaller}\def\lllsize{smaller}%
2194: \resetmathfonts \setleading{10.5pt}}
2195: \def\smallerfonts{%
2196: \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
2197: \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
2198: \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
2199: \let\tenttsl=\smallerttsl
2200: \def\curfontsize{smaller}%
2201: \def\lsize{smaller}\def\lllsize{smaller}%
2202: \resetmathfonts \setleading{9.5pt}}
2203:
2204: % Fonts for short table of contents.
2205: \setfont\shortcontrm\rmshape{12}{1000}{OT1}
2206: \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
2207: \setfont\shortcontsl\slshape{12}{1000}{OT1}
2208: \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
2209:
2210: % Define these just so they can be easily changed for other fonts.
2211: \def\angleleft{$\langle$}
2212: \def\angleright{$\rangle$}
2213:
2214: % Set the fonts to use with the @small... environments.
2215: \let\smallexamplefonts = \smallfonts
2216:
2217: % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
2218: % can fit this many characters:
2219: % 8.5x11=86 smallbook=72 a4=90 a5=69
2220: % If we use \scriptfonts (8pt), then we can fit this many characters:
2221: % 8.5x11=90+ smallbook=80 a4=90+ a5=77
2222: % For me, subjectively, the few extra characters that fit aren't worth
2223: % the additional smallness of 8pt. So I'm making the default 9pt.
2224: %
2225: % By the way, for comparison, here's what fits with @example (10pt):
2226: % 8.5x11=71 smallbook=60 a4=75 a5=58
2227: % --karl, 24jan03.
2228:
2229: % Set up the default fonts, so we can use them for creating boxes.
2230: %
2231: \definetextfontsizexi
2232:
2233:
2234: \message{markup,}
2235:
2236: % Check if we are currently using a typewriter font. Since all the
2237: % Computer Modern typewriter fonts have zero interword stretch (and
2238: % shrink), and it is reasonable to expect all typewriter fonts to have
2239: % this property, we can check that font parameter.
2240: %
2241: \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
2242:
2243: % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
2244: % define and register \INITMACRO to be called on markup style changes.
2245: % \INITMACRO can check \currentmarkupstyle for the innermost
2246: % style and the set of \ifmarkupSTYLE switches for all styles
2247: % currently in effect.
2248: \newif\ifmarkupvar
2249: \newif\ifmarkupsamp
2250: \newif\ifmarkupkey
2251: %\newif\ifmarkupfile % @file == @samp.
2252: %\newif\ifmarkupoption % @option == @samp.
2253: \newif\ifmarkupcode
2254: \newif\ifmarkupkbd
2255: %\newif\ifmarkupenv % @env == @code.
2256: %\newif\ifmarkupcommand % @command == @code.
2257: \newif\ifmarkuptex % @tex (and part of @math, for now).
2258: \newif\ifmarkupexample
2259: \newif\ifmarkupverb
2260: \newif\ifmarkupverbatim
2261:
2262: \let\currentmarkupstyle\empty
2263:
2264: \def\setupmarkupstyle#1{%
2265: \csname markup#1true\endcsname
2266: \def\currentmarkupstyle{#1}%
2267: \markupstylesetup
2268: }
2269:
2270: \let\markupstylesetup\empty
2271:
2272: \def\defmarkupstylesetup#1{%
2273: \expandafter\def\expandafter\markupstylesetup
2274: \expandafter{\markupstylesetup #1}%
2275: \def#1%
2276: }
2277:
2278: % Markup style setup for left and right quotes.
2279: \defmarkupstylesetup\markupsetuplq{%
2280: \expandafter\let\expandafter \temp
2281: \csname markupsetuplq\currentmarkupstyle\endcsname
2282: \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2283: }
2284:
2285: \defmarkupstylesetup\markupsetuprq{%
2286: \expandafter\let\expandafter \temp
2287: \csname markupsetuprq\currentmarkupstyle\endcsname
2288: \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2289: }
2290:
2291: {
2292: \catcode`\'=\active
2293: \catcode`\`=\active
2294:
2295: \gdef\markupsetuplqdefault{\let`\lq}
2296: \gdef\markupsetuprqdefault{\let'\rq}
2297:
2298: \gdef\markupsetcodequoteleft{\let`\codequoteleft}
2299: \gdef\markupsetcodequoteright{\let'\codequoteright}
2300: }
2301:
2302: \let\markupsetuplqcode \markupsetcodequoteleft
2303: \let\markupsetuprqcode \markupsetcodequoteright
2304: %
2305: \let\markupsetuplqexample \markupsetcodequoteleft
2306: \let\markupsetuprqexample \markupsetcodequoteright
2307: %
2308: \let\markupsetuplqkbd \markupsetcodequoteleft
2309: \let\markupsetuprqkbd \markupsetcodequoteright
2310: %
2311: \let\markupsetuplqsamp \markupsetcodequoteleft
2312: \let\markupsetuprqsamp \markupsetcodequoteright
2313: %
2314: \let\markupsetuplqverb \markupsetcodequoteleft
2315: \let\markupsetuprqverb \markupsetcodequoteright
2316: %
2317: \let\markupsetuplqverbatim \markupsetcodequoteleft
2318: \let\markupsetuprqverbatim \markupsetcodequoteright
2319:
2320: % Allow an option to not use regular directed right quote/apostrophe
2321: % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2322: % The undirected quote is ugly, so don't make it the default, but it
2323: % works for pasting with more pdf viewers (at least evince), the
2324: % lilypond developers report. xpdf does work with the regular 0x27.
2325: %
2326: \def\codequoteright{%
2327: \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
2328: \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
2329: '%
2330: \else \char'15 \fi
2331: \else \char'15 \fi
2332: }
2333: %
2334: % and a similar option for the left quote char vs. a grave accent.
2335: % Modern fonts display ASCII 0x60 as a grave accent, so some people like
2336: % the code environments to do likewise.
2337: %
2338: \def\codequoteleft{%
2339: \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
2340: \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
2341: % [Knuth] pp. 380,381,391
2342: % \relax disables Spanish ligatures ?` and !` of \tt font.
2343: \relax`%
2344: \else \char'22 \fi
2345: \else \char'22 \fi
2346: }
2347:
2348: % Commands to set the quote options.
2349: %
2350: \parseargdef\codequoteundirected{%
2351: \def\temp{#1}%
2352: \ifx\temp\onword
2353: \expandafter\let\csname SETtxicodequoteundirected\endcsname
2354: = t%
2355: \else\ifx\temp\offword
2356: \expandafter\let\csname SETtxicodequoteundirected\endcsname
2357: = \relax
2358: \else
2359: \errhelp = \EMsimple
2360: \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2361: \fi\fi
2362: }
2363: %
2364: \parseargdef\codequotebacktick{%
2365: \def\temp{#1}%
2366: \ifx\temp\onword
2367: \expandafter\let\csname SETtxicodequotebacktick\endcsname
2368: = t%
2369: \else\ifx\temp\offword
2370: \expandafter\let\csname SETtxicodequotebacktick\endcsname
2371: = \relax
2372: \else
2373: \errhelp = \EMsimple
2374: \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2375: \fi\fi
2376: }
2377:
2378: % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2379: \def\noligaturesquoteleft{\relax\lq}
2380:
2381: % Count depth in font-changes, for error checks
2382: \newcount\fontdepth \fontdepth=0
2383:
2384: % Font commands.
2385:
2386: % #1 is the font command (\sl or \it), #2 is the text to slant.
2387: % If we are in a monospaced environment, however, 1) always use \ttsl,
2388: % and 2) do not add an italic correction.
2389: \def\dosmartslant#1#2{%
2390: \ifusingtt
2391: {{\ttsl #2}\let\next=\relax}%
2392: {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2393: \next
2394: }
2395: \def\smartslanted{\dosmartslant\sl}
2396: \def\smartitalic{\dosmartslant\it}
2397:
2398: % Output an italic correction unless \next (presumed to be the following
2399: % character) is such as not to need one.
2400: \def\smartitaliccorrection{%
2401: \ifx\next,%
2402: \else\ifx\next-%
2403: \else\ifx\next.%
2404: \else\ifx\next\.%
2405: \else\ifx\next\comma%
2406: \else\ptexslash
2407: \fi\fi\fi\fi\fi
2408: \aftersmartic
2409: }
2410:
2411: % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
2412: \def\ttslanted#1{{\ttsl #1}}
2413:
2414: % @cite is like \smartslanted except unconditionally use \sl. We never want
2415: % ttsl for book titles, do we?
2416: \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2417:
2418: \def\aftersmartic{}
2419: \def\var#1{%
2420: \let\saveaftersmartic = \aftersmartic
2421: \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2422: \smartslanted{#1}%
2423: }
2424:
2425: \let\i=\smartitalic
2426: \let\slanted=\smartslanted
2427: \let\dfn=\smartslanted
2428: \let\emph=\smartitalic
2429:
2430: % Explicit font changes: @r, @sc, undocumented @ii.
2431: \def\r#1{{\rm #1}} % roman font
2432: \def\sc#1{{\smallcaps#1}} % smallcaps font
2433: \def\ii#1{{\it #1}} % italic font
2434:
2435: % @b, explicit bold. Also @strong.
2436: \def\b#1{{\bf #1}}
2437: \let\strong=\b
2438:
2439: % @sansserif, explicit sans.
2440: \def\sansserif#1{{\sf #1}}
2441:
2442: % We can't just use \exhyphenpenalty, because that only has effect at
2443: % the end of a paragraph. Restore normal hyphenation at the end of the
2444: % group within which \nohyphenation is presumably called.
2445: %
2446: \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
2447: \def\restorehyphenation{\hyphenchar\font = `- }
2448:
2449: % Set sfcode to normal for the chars that usually have another value.
2450: % Can't use plain's \frenchspacing because it uses the `\x notation, and
2451: % sometimes \x has an active definition that messes things up.
2452: %
2453: \catcode`@=11
2454: \def\plainfrenchspacing{%
2455: \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
2456: \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
2457: \def\endofsentencespacefactor{1000}% for @. and friends
2458: }
2459: \def\plainnonfrenchspacing{%
2460: \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
2461: \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
2462: \def\endofsentencespacefactor{3000}% for @. and friends
2463: }
2464: \catcode`@=\other
2465: \def\endofsentencespacefactor{3000}% default
2466:
2467: % @t, explicit typewriter.
2468: \def\t#1{%
2469: {\tt \rawbackslash \plainfrenchspacing #1}%
2470: \null
2471: }
2472:
2473: % @samp.
2474: \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
2475:
2476: % @indicateurl is \samp, that is, with quotes.
2477: \let\indicateurl=\samp
2478:
2479: % @code (and similar) prints in typewriter, but with spaces the same
2480: % size as normal in the surrounding text, without hyphenation, etc.
2481: % This is a subroutine for that.
2482: \def\tclose#1{%
2483: {%
2484: % Change normal interword space to be same as for the current font.
2485: \spaceskip = \fontdimen2\font
2486: %
2487: % Switch to typewriter.
2488: \tt
2489: %
2490: % But `\ ' produces the large typewriter interword space.
2491: \def\ {{\spaceskip = 0pt{} }}%
2492: %
2493: % Turn off hyphenation.
2494: \nohyphenation
2495: %
2496: \rawbackslash
2497: \plainfrenchspacing
2498: #1%
2499: }%
2500: \null % reset spacefactor to 1000
2501: }
2502:
2503: % We *must* turn on hyphenation at `-' and `_' in @code.
2504: % (But see \codedashfinish below.)
2505: % Otherwise, it is too hard to avoid overfull hboxes
2506: % in the Emacs manual, the Library manual, etc.
2507: %
2508: % Unfortunately, TeX uses one parameter (\hyphenchar) to control
2509: % both hyphenation at - and hyphenation within words.
2510: % We must therefore turn them both off (\tclose does that)
2511: % and arrange explicitly to hyphenate at a dash. -- rms.
2512: {
2513: \catcode`\-=\active \catcode`\_=\active
2514: \catcode`\'=\active \catcode`\`=\active
2515: \global\let'=\rq \global\let`=\lq % default definitions
2516: %
2517: \global\def\code{\begingroup
2518: \setupmarkupstyle{code}%
2519: % The following should really be moved into \setupmarkupstyle handlers.
2520: \catcode\dashChar=\active \catcode\underChar=\active
2521: \ifallowcodebreaks
2522: \let-\codedash
2523: \let_\codeunder
2524: \else
2525: \let-\normaldash
2526: \let_\realunder
2527: \fi
2528: % Given -foo (with a single dash), we do not want to allow a break
2529: % after the hyphen.
2530: \global\let\codedashprev=\codedash
2531: %
2532: \codex
2533: }
2534: %
2535: \gdef\codedash{\futurelet\next\codedashfinish}
2536: \gdef\codedashfinish{%
2537: \normaldash % always output the dash character itself.
2538: %
2539: % Now, output a discretionary to allow a line break, unless
2540: % (a) the next character is a -, or
2541: % (b) the preceding character is a -.
2542: % E.g., given --posix, we do not want to allow a break after either -.
2543: % Given --foo-bar, we do want to allow a break between the - and the b.
2544: \ifx\next\codedash \else
2545: \ifx\codedashprev\codedash
2546: \else \discretionary{}{}{}\fi
2547: \fi
2548: % we need the space after the = for the case when \next itself is a
2549: % space token; it would get swallowed otherwise. As in @code{- a}.
2550: \global\let\codedashprev= \next
2551: }
2552: }
2553: \def\normaldash{-}
2554: %
2555: \def\codex #1{\tclose{#1}\endgroup}
2556:
2557: \def\codeunder{%
2558: % this is all so @math{@code{var_name}+1} can work. In math mode, _
2559: % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
2560: % will therefore expand the active definition of _, which is us
2561: % (inside @code that is), therefore an endless loop.
2562: \ifusingtt{\ifmmode
2563: \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
2564: \else\normalunderscore \fi
2565: \discretionary{}{}{}}%
2566: {\_}%
2567: }
2568:
2569: % An additional complication: the above will allow breaks after, e.g.,
2570: % each of the four underscores in __typeof__. This is bad.
2571: % @allowcodebreaks provides a document-level way to turn breaking at -
2572: % and _ on and off.
2573: %
2574: \newif\ifallowcodebreaks \allowcodebreakstrue
2575:
2576: \def\keywordtrue{true}
2577: \def\keywordfalse{false}
2578:
2579: \parseargdef\allowcodebreaks{%
2580: \def\txiarg{#1}%
2581: \ifx\txiarg\keywordtrue
2582: \allowcodebreakstrue
2583: \else\ifx\txiarg\keywordfalse
2584: \allowcodebreaksfalse
2585: \else
2586: \errhelp = \EMsimple
2587: \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2588: \fi\fi
2589: }
2590:
2591: % For @command, @env, @file, @option quotes seem unnecessary,
2592: % so use \code rather than \samp.
2593: \let\command=\code
2594: \let\env=\code
2595: \let\file=\code
2596: \let\option=\code
2597:
1.1.1.2 ! misho 2598: % @uref (abbreviation for `urlref') aka @url takes an optional
! 2599: % (comma-separated) second argument specifying the text to display and
! 2600: % an optional third arg as text to display instead of (rather than in
! 2601: % addition to) the url itself. First (mandatory) arg is the url.
! 2602:
! 2603: % TeX-only option to allow changing PDF output to show only the second
! 2604: % arg (if given), and not the url (which is then just the link target).
! 2605: \newif\ifurefurlonlylink
! 2606:
! 2607: % The main macro is \urefbreak, which allows breaking at expected
! 2608: % places within the url. (There used to be another version, which
! 2609: % didn't support automatic breaking.)
1.1 misho 2610: \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2611: \let\uref=\urefbreak
1.1.1.2 ! misho 2612: %
1.1 misho 2613: \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2614: \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2615: \unsepspaces
2616: \pdfurl{#1}%
2617: \setbox0 = \hbox{\ignorespaces #3}%
2618: \ifdim\wd0 > 0pt
2619: \unhbox0 % third arg given, show only that
2620: \else
1.1.1.2 ! misho 2621: \setbox0 = \hbox{\ignorespaces #2}% look for second arg
1.1 misho 2622: \ifdim\wd0 > 0pt
2623: \ifpdf
1.1.1.2 ! misho 2624: \ifurefurlonlylink
! 2625: % PDF plus option to not display url, show just arg
! 2626: \unhbox0
! 2627: \else
! 2628: % PDF, normally display both arg and url for consistency,
! 2629: % visibility, if the pdf is eventually used to print, etc.
! 2630: \unhbox0\ (\urefcode{#1})%
! 2631: \fi
1.1 misho 2632: \else
1.1.1.2 ! misho 2633: \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
1.1 misho 2634: \fi
2635: \else
2636: \urefcode{#1}% only url given, so show it
2637: \fi
2638: \fi
2639: \endlink
2640: \endgroup}
2641:
2642: % Allow line breaks around only a few characters (only).
2643: \def\urefcatcodes{%
2644: \catcode\ampChar=\active \catcode\dotChar=\active
2645: \catcode\hashChar=\active \catcode\questChar=\active
2646: \catcode\slashChar=\active
2647: }
2648: {
2649: \urefcatcodes
2650: %
2651: \global\def\urefcode{\begingroup
2652: \setupmarkupstyle{code}%
2653: \urefcatcodes
2654: \let&\urefcodeamp
2655: \let.\urefcodedot
2656: \let#\urefcodehash
2657: \let?\urefcodequest
2658: \let/\urefcodeslash
2659: \codex
2660: }
2661: %
2662: % By default, they are just regular characters.
2663: \global\def&{\normalamp}
2664: \global\def.{\normaldot}
2665: \global\def#{\normalhash}
2666: \global\def?{\normalquest}
2667: \global\def/{\normalslash}
2668: }
2669:
2670: % we put a little stretch before and after the breakable chars, to help
2671: % line breaking of long url's. The unequal skips make look better in
2672: % cmtt at least, especially for dots.
1.1.1.2 ! misho 2673: \def\urefprestretchamount{.13em}
! 2674: \def\urefpoststretchamount{.1em}
! 2675: \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
! 2676: \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
1.1 misho 2677: %
2678: \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2679: \def\urefcodedot{\urefprestretch .\urefpoststretch}
2680: \def\urefcodehash{\urefprestretch \#\urefpoststretch}
2681: \def\urefcodequest{\urefprestretch ?\urefpoststretch}
2682: \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2683: {
2684: \catcode`\/=\active
2685: \global\def\urefcodeslashfinish{%
2686: \urefprestretch \slashChar
2687: % Allow line break only after the final / in a sequence of
2688: % slashes, to avoid line break between the slashes in http://.
2689: \ifx\next/\else \urefpoststretch \fi
2690: }
2691: }
2692:
2693: % One more complication: by default we'll break after the special
2694: % characters, but some people like to break before the special chars, so
2695: % allow that. Also allow no breaking at all, for manual control.
2696: %
2697: \parseargdef\urefbreakstyle{%
2698: \def\txiarg{#1}%
2699: \ifx\txiarg\wordnone
2700: \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2701: \else\ifx\txiarg\wordbefore
2702: \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2703: \else\ifx\txiarg\wordafter
2704: \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2705: \else
2706: \errhelp = \EMsimple
2707: \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2708: \fi\fi\fi
2709: }
2710: \def\wordafter{after}
2711: \def\wordbefore{before}
2712: \def\wordnone{none}
2713:
2714: \urefbreakstyle after
2715:
2716: % @url synonym for @uref, since that's how everyone uses it.
2717: %
2718: \let\url=\uref
2719:
2720: % rms does not like angle brackets --karl, 17may97.
2721: % So now @email is just like @uref, unless we are pdf.
2722: %
2723: %\def\email#1{\angleleft{\tt #1}\angleright}
2724: \ifpdf
2725: \def\email#1{\doemail#1,,\finish}
2726: \def\doemail#1,#2,#3\finish{\begingroup
2727: \unsepspaces
2728: \pdfurl{mailto:#1}%
2729: \setbox0 = \hbox{\ignorespaces #2}%
2730: \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
2731: \endlink
2732: \endgroup}
2733: \else
2734: \let\email=\uref
2735: \fi
2736:
2737: % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2738: % `example' (@kbd uses ttsl only inside of @example and friends),
2739: % or `code' (@kbd uses normal tty font always).
2740: \parseargdef\kbdinputstyle{%
2741: \def\txiarg{#1}%
2742: \ifx\txiarg\worddistinct
2743: \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2744: \else\ifx\txiarg\wordexample
2745: \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2746: \else\ifx\txiarg\wordcode
2747: \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2748: \else
2749: \errhelp = \EMsimple
2750: \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2751: \fi\fi\fi
2752: }
2753: \def\worddistinct{distinct}
2754: \def\wordexample{example}
2755: \def\wordcode{code}
2756:
2757: % Default is `distinct'.
2758: \kbdinputstyle distinct
2759:
2760: % @kbd is like @code, except that if the argument is just one @key command,
2761: % then @kbd has no effect.
2762: \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
2763:
2764: \def\xkey{\key}
2765: \def\kbdsub#1#2#3\par{%
2766: \def\one{#1}\def\three{#3}\def\threex{??}%
2767: \ifx\one\xkey\ifx\threex\three \key{#2}%
2768: \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2769: \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2770: }
2771:
2772: % definition of @key that produces a lozenge. Doesn't adjust to text size.
2773: %\setfont\keyrm\rmshape{8}{1000}{OT1}
2774: %\font\keysy=cmsy9
2775: %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
2776: % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
2777: % \vbox{\hrule\kern-0.4pt
2778: % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
2779: % \kern-0.4pt\hrule}%
2780: % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2781:
2782: % definition of @key with no lozenge. If the current font is already
2783: % monospace, don't change it; that way, we respect @kbdinputstyle. But
2784: % if it isn't monospace, then use \tt.
2785: %
2786: \def\key#1{{\setupmarkupstyle{key}%
2787: \nohyphenation
2788: \ifmonospace\else\tt\fi
2789: #1}\null}
2790:
2791: % @clicksequence{File @click{} Open ...}
2792: \def\clicksequence#1{\begingroup #1\endgroup}
2793:
2794: % @clickstyle @arrow (by default)
2795: \parseargdef\clickstyle{\def\click{#1}}
2796: \def\click{\arrow}
2797:
2798: % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2799: % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2800: %
2801: \def\dmn#1{\thinspace #1}
2802:
2803: % @acronym for "FBI", "NATO", and the like.
2804: % We print this one point size smaller, since it's intended for
2805: % all-uppercase.
2806: %
2807: \def\acronym#1{\doacronym #1,,\finish}
2808: \def\doacronym#1,#2,#3\finish{%
2809: {\selectfonts\lsize #1}%
2810: \def\temp{#2}%
2811: \ifx\temp\empty \else
2812: \space ({\unsepspaces \ignorespaces \temp \unskip})%
2813: \fi
2814: \null % reset \spacefactor=1000
2815: }
2816:
2817: % @abbr for "Comput. J." and the like.
2818: % No font change, but don't do end-of-sentence spacing.
2819: %
2820: \def\abbr#1{\doabbr #1,,\finish}
2821: \def\doabbr#1,#2,#3\finish{%
2822: {\plainfrenchspacing #1}%
2823: \def\temp{#2}%
2824: \ifx\temp\empty \else
2825: \space ({\unsepspaces \ignorespaces \temp \unskip})%
2826: \fi
2827: \null % reset \spacefactor=1000
2828: }
2829:
2830: % @asis just yields its argument. Used with @table, for example.
2831: %
2832: \def\asis#1{#1}
2833:
2834: % @math outputs its argument in math mode.
2835: %
2836: % One complication: _ usually means subscripts, but it could also mean
2837: % an actual _ character, as in @math{@var{some_variable} + 1}. So make
2838: % _ active, and distinguish by seeing if the current family is \slfam,
2839: % which is what @var uses.
2840: {
2841: \catcode`\_ = \active
2842: \gdef\mathunderscore{%
2843: \catcode`\_=\active
2844: \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2845: }
2846: }
2847: % Another complication: we want \\ (and @\) to output a math (or tt) \.
2848: % FYI, plain.tex uses \\ as a temporary control sequence (for no
2849: % particular reason), but this is not advertised and we don't care.
2850: %
2851: % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2852: \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2853: %
2854: \def\math{%
2855: \tex
2856: \mathunderscore
2857: \let\\ = \mathbackslash
2858: \mathactive
2859: % make the texinfo accent commands work in math mode
2860: \let\"=\ddot
2861: \let\'=\acute
2862: \let\==\bar
2863: \let\^=\hat
2864: \let\`=\grave
2865: \let\u=\breve
2866: \let\v=\check
2867: \let\~=\tilde
2868: \let\dotaccent=\dot
1.1.1.2 ! misho 2869: % have to provide another name for sup operator
! 2870: \let\mathopsup=\sup
1.1 misho 2871: $\finishmath
2872: }
2873: \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
2874:
2875: % Some active characters (such as <) are spaced differently in math.
2876: % We have to reset their definitions in case the @math was an argument
2877: % to a command which sets the catcodes (such as @item or @section).
2878: %
2879: {
2880: \catcode`^ = \active
2881: \catcode`< = \active
2882: \catcode`> = \active
2883: \catcode`+ = \active
2884: \catcode`' = \active
2885: \gdef\mathactive{%
2886: \let^ = \ptexhat
2887: \let< = \ptexless
2888: \let> = \ptexgtr
2889: \let+ = \ptexplus
2890: \let' = \ptexquoteright
2891: }
2892: }
2893:
1.1.1.2 ! misho 2894: % for @sub and @sup, if in math mode, just do a normal sub/superscript.
! 2895: % If in text, use math to place as sub/superscript, but switch
! 2896: % into text mode, with smaller fonts. This is a different font than the
! 2897: % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
! 2898: % fix it (significant additions to font machinery) until someone notices.
! 2899: %
! 2900: \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
! 2901: \def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
! 2902: %
! 2903: \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
! 2904: \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
1.1 misho 2905:
2906: % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
2907: % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
2908: % except specified as a normal braced arg, so no newlines to worry about.
2909: %
2910: \def\outfmtnametex{tex}
2911: %
2912: \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
2913: \long\def\doinlinefmt#1,#2,\finish{%
2914: \def\inlinefmtname{#1}%
2915: \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
2916: }
2917: %
2918: % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
2919: % FMTNAME is tex, else ELSE-TEXT.
2920: \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
2921: \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
2922: \def\inlinefmtname{#1}%
2923: \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
2924: }
2925: %
2926: % For raw, must switch into @tex before parsing the argument, to avoid
2927: % setting catcodes prematurely. Doing it this way means that, for
2928: % example, @inlineraw{html, foo{bar} gets a parse error instead of being
2929: % ignored. But this isn't important because if people want a literal
2930: % *right* brace they would have to use a command anyway, so they may as
2931: % well use a command to get a left brace too. We could re-use the
2932: % delimiter character idea from \verb, but it seems like overkill.
2933: %
2934: \long\def\inlineraw{\tex \doinlineraw}
2935: \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
2936: \def\doinlinerawtwo#1,#2,\finish{%
2937: \def\inlinerawname{#1}%
2938: \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
2939: \endgroup % close group opened by \tex.
2940: }
2941:
2942: % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
2943: %
2944: \long\def\inlineifset#1{\doinlineifset #1,\finish}
2945: \long\def\doinlineifset#1,#2,\finish{%
2946: \def\inlinevarname{#1}%
2947: \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
2948: \else\ignorespaces#2\fi
2949: }
2950:
2951: % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
2952: %
2953: \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
2954: \long\def\doinlineifclear#1,#2,\finish{%
2955: \def\inlinevarname{#1}%
2956: \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
2957: }
2958:
2959:
2960: \message{glyphs,}
2961: % and logos.
2962:
2963: % @@ prints an @, as does @atchar{}.
2964: \def\@{\char64 }
2965: \let\atchar=\@
2966:
2967: % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
2968: % Unless we're in typewriter, use \ecfont because the CM text fonts do
2969: % not have braces, and we don't want to switch into math.
2970: \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
2971: \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
2972: \let\{=\mylbrace \let\lbracechar=\{
2973: \let\}=\myrbrace \let\rbracechar=\}
2974: \begingroup
2975: % Definitions to produce \{ and \} commands for indices,
2976: % and @{ and @} for the aux/toc files.
2977: \catcode`\{ = \other \catcode`\} = \other
2978: \catcode`\[ = 1 \catcode`\] = 2
2979: \catcode`\! = 0 \catcode`\\ = \other
2980: !gdef!lbracecmd[\{]%
2981: !gdef!rbracecmd[\}]%
2982: !gdef!lbraceatcmd[@{]%
2983: !gdef!rbraceatcmd[@}]%
2984: !endgroup
2985:
2986: % @comma{} to avoid , parsing problems.
2987: \let\comma = ,
2988:
2989: % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
2990: % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
2991: \let\, = \ptexc
2992: \let\dotaccent = \ptexdot
2993: \def\ringaccent#1{{\accent23 #1}}
2994: \let\tieaccent = \ptext
2995: \let\ubaraccent = \ptexb
2996: \let\udotaccent = \d
2997:
2998: % Other special characters: @questiondown @exclamdown @ordf @ordm
2999: % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
3000: \def\questiondown{?`}
3001: \def\exclamdown{!`}
3002: \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
3003: \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
3004:
3005: % Dotless i and dotless j, used for accents.
3006: \def\imacro{i}
3007: \def\jmacro{j}
3008: \def\dotless#1{%
3009: \def\temp{#1}%
3010: \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
3011: \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
3012: \else \errmessage{@dotless can be used only with i or j}%
3013: \fi\fi
3014: }
3015:
3016: % The \TeX{} logo, as in plain, but resetting the spacing so that a
3017: % period following counts as ending a sentence. (Idea found in latex.)
3018: %
3019: \edef\TeX{\TeX \spacefactor=1000 }
3020:
3021: % @LaTeX{} logo. Not quite the same results as the definition in
3022: % latex.ltx, since we use a different font for the raised A; it's most
3023: % convenient for us to use an explicitly smaller font, rather than using
3024: % the \scriptstyle font (since we don't reset \scriptstyle and
3025: % \scriptscriptstyle).
3026: %
3027: \def\LaTeX{%
3028: L\kern-.36em
3029: {\setbox0=\hbox{T}%
3030: \vbox to \ht0{\hbox{%
3031: \ifx\textnominalsize\xwordpt
3032: % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
3033: % Revert to plain's \scriptsize, which is 7pt.
3034: \count255=\the\fam $\fam\count255 \scriptstyle A$%
3035: \else
3036: % For 11pt, we can use our lllsize.
3037: \selectfonts\lllsize A%
3038: \fi
3039: }%
3040: \vss
3041: }}%
3042: \kern-.15em
3043: \TeX
3044: }
3045:
1.1.1.2 ! misho 3046: % Some math mode symbols. Define \ensuremath to switch into math mode
! 3047: % unless we are already there. Expansion tricks may not be needed here,
! 3048: % but safer, and can't hurt.
! 3049: \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
! 3050: \def\ensuredmath#1{$\relax#1$}
! 3051: %
! 3052: \def\bullet{\ensuremath\ptexbullet}
! 3053: \def\geq{\ensuremath\ge}
! 3054: \def\leq{\ensuremath\le}
! 3055: \def\minus{\ensuremath-}
1.1 misho 3056:
3057: % @dots{} outputs an ellipsis using the current font.
3058: % We do .5em per period so that it has the same spacing in the cm
3059: % typewriter fonts as three actual period characters; on the other hand,
3060: % in other typewriter fonts three periods are wider than 1.5em. So do
3061: % whichever is larger.
3062: %
3063: \def\dots{%
3064: \leavevmode
3065: \setbox0=\hbox{...}% get width of three periods
3066: \ifdim\wd0 > 1.5em
3067: \dimen0 = \wd0
3068: \else
3069: \dimen0 = 1.5em
3070: \fi
3071: \hbox to \dimen0{%
3072: \hskip 0pt plus.25fil
3073: .\hskip 0pt plus1fil
3074: .\hskip 0pt plus1fil
3075: .\hskip 0pt plus.5fil
3076: }%
3077: }
3078:
3079: % @enddots{} is an end-of-sentence ellipsis.
3080: %
3081: \def\enddots{%
3082: \dots
3083: \spacefactor=\endofsentencespacefactor
3084: }
3085:
3086: % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
3087: %
3088: % Since these characters are used in examples, they should be an even number of
3089: % \tt widths. Each \tt character is 1en, so two makes it 1em.
3090: %
3091: \def\point{$\star$}
3092: \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
3093: \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
3094: \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
3095: \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
3096: \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
3097:
3098: % The @error{} command.
3099: % Adapted from the TeXbook's \boxit.
3100: %
3101: \newbox\errorbox
3102: %
3103: {\tentt \global\dimen0 = 3em}% Width of the box.
3104: \dimen2 = .55pt % Thickness of rules
3105: % The text. (`r' is open on the right, `e' somewhat less so on the left.)
3106: \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
3107: %
3108: \setbox\errorbox=\hbox to \dimen0{\hfil
3109: \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
3110: \advance\hsize by -2\dimen2 % Rules.
3111: \vbox{%
3112: \hrule height\dimen2
3113: \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
3114: \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
3115: \kern3pt\vrule width\dimen2}% Space to right.
3116: \hrule height\dimen2}
3117: \hfil}
3118: %
3119: \def\error{\leavevmode\lower.7ex\copy\errorbox}
3120:
3121: % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
3122: %
3123: \def\pounds{{\it\$}}
3124:
3125: % @euro{} comes from a separate font, depending on the current style.
3126: % We use the free feym* fonts from the eurosym package by Henrik
3127: % Theiling, which support regular, slanted, bold and bold slanted (and
3128: % "outlined" (blackboard board, sort of) versions, which we don't need).
3129: % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
3130: %
3131: % Although only regular is the truly official Euro symbol, we ignore
3132: % that. The Euro is designed to be slightly taller than the regular
3133: % font height.
3134: %
3135: % feymr - regular
3136: % feymo - slanted
3137: % feybr - bold
3138: % feybo - bold slanted
3139: %
3140: % There is no good (free) typewriter version, to my knowledge.
3141: % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
3142: % Hmm.
3143: %
3144: % Also doesn't work in math. Do we need to do math with euro symbols?
3145: % Hope not.
3146: %
3147: %
3148: \def\euro{{\eurofont e}}
3149: \def\eurofont{%
3150: % We set the font at each command, rather than predefining it in
3151: % \textfonts and the other font-switching commands, so that
3152: % installations which never need the symbol don't have to have the
3153: % font installed.
3154: %
3155: % There is only one designed size (nominal 10pt), so we always scale
3156: % that to the current nominal size.
3157: %
3158: % By the way, simply using "at 1em" works for cmr10 and the like, but
3159: % does not work for cmbx10 and other extended/shrunken fonts.
3160: %
3161: \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
3162: %
3163: \ifx\curfontstyle\bfstylename
3164: % bold:
3165: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
3166: \else
3167: % regular:
3168: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
3169: \fi
3170: \thiseurofont
3171: }
3172:
3173: % Glyphs from the EC fonts. We don't use \let for the aliases, because
3174: % sometimes we redefine the original macro, and the alias should reflect
3175: % the redefinition.
3176: %
3177: % Use LaTeX names for the Icelandic letters.
3178: \def\DH{{\ecfont \char"D0}} % Eth
3179: \def\dh{{\ecfont \char"F0}} % eth
3180: \def\TH{{\ecfont \char"DE}} % Thorn
3181: \def\th{{\ecfont \char"FE}} % thorn
3182: %
3183: \def\guillemetleft{{\ecfont \char"13}}
3184: \def\guillemotleft{\guillemetleft}
3185: \def\guillemetright{{\ecfont \char"14}}
3186: \def\guillemotright{\guillemetright}
3187: \def\guilsinglleft{{\ecfont \char"0E}}
3188: \def\guilsinglright{{\ecfont \char"0F}}
3189: \def\quotedblbase{{\ecfont \char"12}}
3190: \def\quotesinglbase{{\ecfont \char"0D}}
3191: %
3192: % This positioning is not perfect (see the ogonek LaTeX package), but
3193: % we have the precomposed glyphs for the most common cases. We put the
3194: % tests to use those glyphs in the single \ogonek macro so we have fewer
3195: % dummy definitions to worry about for index entries, etc.
3196: %
3197: % ogonek is also used with other letters in Lithuanian (IOU), but using
3198: % the precomposed glyphs for those is not so easy since they aren't in
3199: % the same EC font.
3200: \def\ogonek#1{{%
3201: \def\temp{#1}%
3202: \ifx\temp\macrocharA\Aogonek
3203: \else\ifx\temp\macrochara\aogonek
3204: \else\ifx\temp\macrocharE\Eogonek
3205: \else\ifx\temp\macrochare\eogonek
3206: \else
3207: \ecfont \setbox0=\hbox{#1}%
3208: \ifdim\ht0=1ex\accent"0C #1%
3209: \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
3210: \fi
3211: \fi\fi\fi\fi
3212: }%
3213: }
3214: \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
3215: \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
3216: \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
3217: \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
3218: %
1.1.1.2 ! misho 3219: % Use the European Computer Modern fonts (cm-super in outline format)
! 3220: % for non-CM glyphs. That is ec* for regular text and tc* for the text
! 3221: % companion symbols (LaTeX TS1 encoding). Both are part of the ec
! 3222: % package and follow the same conventions.
! 3223: %
! 3224: \def\ecfont{\etcfont{e}}
! 3225: \def\tcfont{\etcfont{t}}
! 3226: %
! 3227: \def\etcfont#1{%
1.1 misho 3228: % We can't distinguish serif/sans and italic/slanted, but this
3229: % is used for crude hacks anyway (like adding French and German
3230: % quotes to documents typeset with CM, where we lose kerning), so
3231: % hopefully nobody will notice/care.
3232: \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
3233: \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
3234: \ifmonospace
3235: % typewriter:
1.1.1.2 ! misho 3236: \font\thisecfont = #1ctt\ecsize \space at \nominalsize
1.1 misho 3237: \else
3238: \ifx\curfontstyle\bfstylename
3239: % bold:
1.1.1.2 ! misho 3240: \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
1.1 misho 3241: \else
3242: % regular:
1.1.1.2 ! misho 3243: \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
1.1 misho 3244: \fi
3245: \fi
3246: \thisecfont
3247: }
3248:
3249: % @registeredsymbol - R in a circle. The font for the R should really
3250: % be smaller yet, but lllsize is the best we can do for now.
3251: % Adapted from the plain.tex definition of \copyright.
3252: %
3253: \def\registeredsymbol{%
3254: $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
3255: \hfil\crcr\Orb}}%
3256: }$%
3257: }
3258:
3259: % @textdegree - the normal degrees sign.
3260: %
3261: \def\textdegree{$^\circ$}
3262:
3263: % Laurent Siebenmann reports \Orb undefined with:
3264: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
3265: % so we'll define it if necessary.
3266: %
3267: \ifx\Orb\thisisundefined
3268: \def\Orb{\mathhexbox20D}
3269: \fi
3270:
3271: % Quotes.
3272: \chardef\quotedblleft="5C
3273: \chardef\quotedblright=`\"
3274: \chardef\quoteleft=`\`
3275: \chardef\quoteright=`\'
3276:
3277:
3278: \message{page headings,}
3279:
3280: \newskip\titlepagetopglue \titlepagetopglue = 1.5in
3281: \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
3282:
3283: % First the title page. Must do @settitle before @titlepage.
3284: \newif\ifseenauthor
3285: \newif\iffinishedtitlepage
3286:
3287: % Do an implicit @contents or @shortcontents after @end titlepage if the
3288: % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
3289: %
3290: \newif\ifsetcontentsaftertitlepage
3291: \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
3292: \newif\ifsetshortcontentsaftertitlepage
3293: \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3294:
3295: \parseargdef\shorttitlepage{%
3296: \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3297: \endgroup\page\hbox{}\page}
3298:
3299: \envdef\titlepage{%
3300: % Open one extra group, as we want to close it in the middle of \Etitlepage.
3301: \begingroup
3302: \parindent=0pt \textfonts
3303: % Leave some space at the very top of the page.
3304: \vglue\titlepagetopglue
3305: % No rule at page bottom unless we print one at the top with @title.
3306: \finishedtitlepagetrue
3307: %
3308: % Most title ``pages'' are actually two pages long, with space
3309: % at the top of the second. We don't want the ragged left on the second.
3310: \let\oldpage = \page
3311: \def\page{%
3312: \iffinishedtitlepage\else
3313: \finishtitlepage
3314: \fi
3315: \let\page = \oldpage
3316: \page
3317: \null
3318: }%
3319: }
3320:
3321: \def\Etitlepage{%
3322: \iffinishedtitlepage\else
3323: \finishtitlepage
3324: \fi
3325: % It is important to do the page break before ending the group,
3326: % because the headline and footline are only empty inside the group.
3327: % If we use the new definition of \page, we always get a blank page
3328: % after the title page, which we certainly don't want.
3329: \oldpage
3330: \endgroup
3331: %
3332: % Need this before the \...aftertitlepage checks so that if they are
3333: % in effect the toc pages will come out with page numbers.
3334: \HEADINGSon
3335: %
3336: % If they want short, they certainly want long too.
3337: \ifsetshortcontentsaftertitlepage
3338: \shortcontents
3339: \contents
3340: \global\let\shortcontents = \relax
3341: \global\let\contents = \relax
3342: \fi
3343: %
3344: \ifsetcontentsaftertitlepage
3345: \contents
3346: \global\let\contents = \relax
3347: \global\let\shortcontents = \relax
3348: \fi
3349: }
3350:
3351: \def\finishtitlepage{%
3352: \vskip4pt \hrule height 2pt width \hsize
3353: \vskip\titlepagebottomglue
3354: \finishedtitlepagetrue
3355: }
3356:
3357: % Settings used for typesetting titles: no hyphenation, no indentation,
3358: % don't worry much about spacing, ragged right. This should be used
3359: % inside a \vbox, and fonts need to be set appropriately first. Because
3360: % it is always used for titles, nothing else, we call \rmisbold. \par
3361: % should be specified before the end of the \vbox, since a vbox is a group.
3362: %
3363: \def\raggedtitlesettings{%
3364: \rmisbold
3365: \hyphenpenalty=10000
3366: \parindent=0pt
3367: \tolerance=5000
3368: \ptexraggedright
3369: }
3370:
3371: % Macros to be used within @titlepage:
3372:
3373: \let\subtitlerm=\tenrm
3374: \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
3375:
3376: \parseargdef\title{%
3377: \checkenv\titlepage
3378: \vbox{\titlefonts \raggedtitlesettings #1\par}%
3379: % print a rule at the page bottom also.
3380: \finishedtitlepagefalse
3381: \vskip4pt \hrule height 4pt width \hsize \vskip4pt
3382: }
3383:
3384: \parseargdef\subtitle{%
3385: \checkenv\titlepage
3386: {\subtitlefont \rightline{#1}}%
3387: }
3388:
3389: % @author should come last, but may come many times.
3390: % It can also be used inside @quotation.
3391: %
3392: \parseargdef\author{%
3393: \def\temp{\quotation}%
3394: \ifx\thisenv\temp
3395: \def\quotationauthor{#1}% printed in \Equotation.
3396: \else
3397: \checkenv\titlepage
3398: \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
3399: {\secfonts\rmisbold \leftline{#1}}%
3400: \fi
3401: }
3402:
3403:
3404: % Set up page headings and footings.
3405:
3406: \let\thispage=\folio
3407:
3408: \newtoks\evenheadline % headline on even pages
3409: \newtoks\oddheadline % headline on odd pages
3410: \newtoks\evenfootline % footline on even pages
3411: \newtoks\oddfootline % footline on odd pages
3412:
1.1.1.2 ! misho 3413: % Now make \makeheadline and \makefootline in Plain TeX use those variables
1.1 misho 3414: \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
3415: \else \the\evenheadline \fi}}
3416: \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
3417: \else \the\evenfootline \fi}\HEADINGShook}
3418: \let\HEADINGShook=\relax
3419:
3420: % Commands to set those variables.
3421: % For example, this is what @headings on does
3422: % @evenheading @thistitle|@thispage|@thischapter
3423: % @oddheading @thischapter|@thispage|@thistitle
3424: % @evenfooting @thisfile||
3425: % @oddfooting ||@thisfile
3426:
3427:
3428: \def\evenheading{\parsearg\evenheadingxxx}
3429: \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
3430: \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
3431: \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3432:
3433: \def\oddheading{\parsearg\oddheadingxxx}
3434: \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
3435: \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
3436: \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3437:
3438: \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
3439:
3440: \def\evenfooting{\parsearg\evenfootingxxx}
3441: \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
3442: \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
3443: \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
3444:
3445: \def\oddfooting{\parsearg\oddfootingxxx}
3446: \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
3447: \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
3448: \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
3449: %
3450: % Leave some space for the footline. Hopefully ok to assume
3451: % @evenfooting will not be used by itself.
3452: \global\advance\pageheight by -12pt
3453: \global\advance\vsize by -12pt
3454: }
3455:
3456: \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
3457:
3458: % @evenheadingmarks top \thischapter <- chapter at the top of a page
3459: % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
3460: %
3461: % The same set of arguments for:
3462: %
3463: % @oddheadingmarks
3464: % @evenfootingmarks
3465: % @oddfootingmarks
3466: % @everyheadingmarks
3467: % @everyfootingmarks
3468:
1.1.1.2 ! misho 3469: % These define \getoddheadingmarks, \getevenheadingmarks,
! 3470: % \getoddfootingmarks, and \getevenfootingmarks, each to one of
! 3471: % \gettopheadingmarks, \getbottomheadingmarks.
! 3472: %
1.1 misho 3473: \def\evenheadingmarks{\headingmarks{even}{heading}}
3474: \def\oddheadingmarks{\headingmarks{odd}{heading}}
3475: \def\evenfootingmarks{\headingmarks{even}{footing}}
3476: \def\oddfootingmarks{\headingmarks{odd}{footing}}
3477: \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
3478: \headingmarks{odd}{heading}{#1} }
3479: \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
3480: \headingmarks{odd}{footing}{#1} }
3481: % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3482: \def\headingmarks#1#2#3 {%
3483: \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
3484: \global\expandafter\let\csname get#1#2marks\endcsname \temp
3485: }
3486:
3487: \everyheadingmarks bottom
3488: \everyfootingmarks bottom
3489:
3490: % @headings double turns headings on for double-sided printing.
3491: % @headings single turns headings on for single-sided printing.
3492: % @headings off turns them off.
3493: % @headings on same as @headings double, retained for compatibility.
3494: % @headings after turns on double-sided headings after this page.
3495: % @headings doubleafter turns on double-sided headings after this page.
3496: % @headings singleafter turns on single-sided headings after this page.
3497: % By default, they are off at the start of a document,
3498: % and turned `on' after @end titlepage.
3499:
3500: \def\headings #1 {\csname HEADINGS#1\endcsname}
3501:
3502: \def\headingsoff{% non-global headings elimination
3503: \evenheadline={\hfil}\evenfootline={\hfil}%
3504: \oddheadline={\hfil}\oddfootline={\hfil}%
3505: }
3506:
3507: \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3508: \HEADINGSoff % it's the default
3509:
3510: % When we turn headings on, set the page number to 1.
3511: % For double-sided printing, put current file name in lower left corner,
3512: % chapter name on inside top of right hand pages, document
3513: % title on inside top of left hand pages, and page numbers on outside top
3514: % edge of all pages.
3515: \def\HEADINGSdouble{%
3516: \global\pageno=1
3517: \global\evenfootline={\hfil}
3518: \global\oddfootline={\hfil}
3519: \global\evenheadline={\line{\folio\hfil\thistitle}}
1.1.1.2 ! misho 3520: \global\oddheadline={\line{\thischapterheading\hfil\folio}}
1.1 misho 3521: \global\let\contentsalignmacro = \chapoddpage
3522: }
3523: \let\contentsalignmacro = \chappager
3524:
3525: % For single-sided printing, chapter title goes across top left of page,
3526: % page number on top right.
3527: \def\HEADINGSsingle{%
3528: \global\pageno=1
3529: \global\evenfootline={\hfil}
3530: \global\oddfootline={\hfil}
1.1.1.2 ! misho 3531: \global\evenheadline={\line{\thischapterheading\hfil\folio}}
! 3532: \global\oddheadline={\line{\thischapterheading\hfil\folio}}
1.1 misho 3533: \global\let\contentsalignmacro = \chappager
3534: }
3535: \def\HEADINGSon{\HEADINGSdouble}
3536:
3537: \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
3538: \let\HEADINGSdoubleafter=\HEADINGSafter
3539: \def\HEADINGSdoublex{%
3540: \global\evenfootline={\hfil}
3541: \global\oddfootline={\hfil}
3542: \global\evenheadline={\line{\folio\hfil\thistitle}}
1.1.1.2 ! misho 3543: \global\oddheadline={\line{\thischapterheading\hfil\folio}}
1.1 misho 3544: \global\let\contentsalignmacro = \chapoddpage
3545: }
3546:
3547: \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
3548: \def\HEADINGSsinglex{%
3549: \global\evenfootline={\hfil}
3550: \global\oddfootline={\hfil}
1.1.1.2 ! misho 3551: \global\evenheadline={\line{\thischapterheading\hfil\folio}}
! 3552: \global\oddheadline={\line{\thischapterheading\hfil\folio}}
1.1 misho 3553: \global\let\contentsalignmacro = \chappager
3554: }
3555:
3556: % Subroutines used in generating headings
3557: % This produces Day Month Year style of output.
3558: % Only define if not already defined, in case a txi-??.tex file has set
3559: % up a different format (e.g., txi-cs.tex does this).
3560: \ifx\today\thisisundefined
3561: \def\today{%
3562: \number\day\space
3563: \ifcase\month
3564: \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
3565: \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
3566: \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
3567: \fi
3568: \space\number\year}
3569: \fi
3570:
3571: % @settitle line... specifies the title of the document, for headings.
3572: % It generates no output of its own.
3573: \def\thistitle{\putwordNoTitle}
3574: \def\settitle{\parsearg{\gdef\thistitle}}
3575:
3576:
3577: \message{tables,}
3578: % Tables -- @table, @ftable, @vtable, @item(x).
3579:
3580: % default indentation of table text
3581: \newdimen\tableindent \tableindent=.8in
3582: % default indentation of @itemize and @enumerate text
3583: \newdimen\itemindent \itemindent=.3in
3584: % margin between end of table item and start of table text.
3585: \newdimen\itemmargin \itemmargin=.1in
3586:
3587: % used internally for \itemindent minus \itemmargin
3588: \newdimen\itemmax
3589:
3590: % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
3591: % these defs.
3592: % They also define \itemindex
3593: % to index the item name in whatever manner is desired (perhaps none).
3594:
3595: \newif\ifitemxneedsnegativevskip
3596:
3597: \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
3598:
3599: \def\internalBitem{\smallbreak \parsearg\itemzzz}
3600: \def\internalBitemx{\itemxpar \parsearg\itemzzz}
3601:
3602: \def\itemzzz #1{\begingroup %
3603: \advance\hsize by -\rightskip
3604: \advance\hsize by -\tableindent
3605: \setbox0=\hbox{\itemindicate{#1}}%
3606: \itemindex{#1}%
3607: \nobreak % This prevents a break before @itemx.
3608: %
3609: % If the item text does not fit in the space we have, put it on a line
3610: % by itself, and do not allow a page break either before or after that
3611: % line. We do not start a paragraph here because then if the next
3612: % command is, e.g., @kindex, the whatsit would get put into the
3613: % horizontal list on a line by itself, resulting in extra blank space.
3614: \ifdim \wd0>\itemmax
3615: %
3616: % Make this a paragraph so we get the \parskip glue and wrapping,
3617: % but leave it ragged-right.
3618: \begingroup
3619: \advance\leftskip by-\tableindent
3620: \advance\hsize by\tableindent
3621: \advance\rightskip by0pt plus1fil\relax
3622: \leavevmode\unhbox0\par
3623: \endgroup
3624: %
3625: % We're going to be starting a paragraph, but we don't want the
3626: % \parskip glue -- logically it's part of the @item we just started.
3627: \nobreak \vskip-\parskip
3628: %
3629: % Stop a page break at the \parskip glue coming up. However, if
3630: % what follows is an environment such as @example, there will be no
3631: % \parskip glue; then the negative vskip we just inserted would
3632: % cause the example and the item to crash together. So we use this
3633: % bizarre value of 10001 as a signal to \aboveenvbreak to insert
3634: % \parskip glue after all. Section titles are handled this way also.
3635: %
3636: \penalty 10001
3637: \endgroup
3638: \itemxneedsnegativevskipfalse
3639: \else
3640: % The item text fits into the space. Start a paragraph, so that the
3641: % following text (if any) will end up on the same line.
3642: \noindent
3643: % Do this with kerns and \unhbox so that if there is a footnote in
3644: % the item text, it can migrate to the main vertical list and
3645: % eventually be printed.
3646: \nobreak\kern-\tableindent
3647: \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
3648: \unhbox0
3649: \nobreak\kern\dimen0
3650: \endgroup
3651: \itemxneedsnegativevskiptrue
3652: \fi
3653: }
3654:
3655: \def\item{\errmessage{@item while not in a list environment}}
3656: \def\itemx{\errmessage{@itemx while not in a list environment}}
3657:
3658: % @table, @ftable, @vtable.
3659: \envdef\table{%
3660: \let\itemindex\gobble
3661: \tablecheck{table}%
3662: }
3663: \envdef\ftable{%
3664: \def\itemindex ##1{\doind {fn}{\code{##1}}}%
3665: \tablecheck{ftable}%
3666: }
3667: \envdef\vtable{%
3668: \def\itemindex ##1{\doind {vr}{\code{##1}}}%
3669: \tablecheck{vtable}%
3670: }
3671: \def\tablecheck#1{%
3672: \ifnum \the\catcode`\^^M=\active
3673: \endgroup
3674: \errmessage{This command won't work in this context; perhaps the problem is
3675: that we are \inenvironment\thisenv}%
3676: \def\next{\doignore{#1}}%
3677: \else
3678: \let\next\tablex
3679: \fi
3680: \next
3681: }
3682: \def\tablex#1{%
3683: \def\itemindicate{#1}%
3684: \parsearg\tabley
3685: }
3686: \def\tabley#1{%
3687: {%
3688: \makevalueexpandable
3689: \edef\temp{\noexpand\tablez #1\space\space\space}%
3690: \expandafter
3691: }\temp \endtablez
3692: }
3693: \def\tablez #1 #2 #3 #4\endtablez{%
3694: \aboveenvbreak
3695: \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
3696: \ifnum 0#2>0 \tableindent=#2\mil \fi
3697: \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
3698: \itemmax=\tableindent
3699: \advance \itemmax by -\itemmargin
3700: \advance \leftskip by \tableindent
3701: \exdentamount=\tableindent
3702: \parindent = 0pt
3703: \parskip = \smallskipamount
3704: \ifdim \parskip=0pt \parskip=2pt \fi
3705: \let\item = \internalBitem
3706: \let\itemx = \internalBitemx
3707: }
3708: \def\Etable{\endgraf\afterenvbreak}
3709: \let\Eftable\Etable
3710: \let\Evtable\Etable
3711: \let\Eitemize\Etable
3712: \let\Eenumerate\Etable
3713:
3714: % This is the counter used by @enumerate, which is really @itemize
3715:
3716: \newcount \itemno
3717:
3718: \envdef\itemize{\parsearg\doitemize}
3719:
3720: \def\doitemize#1{%
3721: \aboveenvbreak
3722: \itemmax=\itemindent
3723: \advance\itemmax by -\itemmargin
3724: \advance\leftskip by \itemindent
3725: \exdentamount=\itemindent
3726: \parindent=0pt
3727: \parskip=\smallskipamount
3728: \ifdim\parskip=0pt \parskip=2pt \fi
3729: %
1.1.1.2 ! misho 3730: % Try typesetting the item mark so that if the document erroneously says
1.1 misho 3731: % something like @itemize @samp (intending @table), there's an error
3732: % right away at the @itemize. It's not the best error message in the
3733: % world, but it's better than leaving it to the @item. This means if
3734: % the user wants an empty mark, they have to say @w{} not just @w.
3735: \def\itemcontents{#1}%
3736: \setbox0 = \hbox{\itemcontents}%
3737: %
3738: % @itemize with no arg is equivalent to @itemize @bullet.
3739: \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
3740: %
3741: \let\item=\itemizeitem
3742: }
3743:
3744: % Definition of @item while inside @itemize and @enumerate.
3745: %
3746: \def\itemizeitem{%
3747: \advance\itemno by 1 % for enumerations
3748: {\let\par=\endgraf \smallbreak}% reasonable place to break
3749: {%
3750: % If the document has an @itemize directly after a section title, a
3751: % \nobreak will be last on the list, and \sectionheading will have
3752: % done a \vskip-\parskip. In that case, we don't want to zero
3753: % parskip, or the item text will crash with the heading. On the
3754: % other hand, when there is normal text preceding the item (as there
3755: % usually is), we do want to zero parskip, or there would be too much
3756: % space. In that case, we won't have a \nobreak before. At least
3757: % that's the theory.
3758: \ifnum\lastpenalty<10000 \parskip=0in \fi
3759: \noindent
3760: \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
3761: %
1.1.1.2 ! misho 3762: \ifinner\else
! 3763: \vadjust{\penalty 1200}% not good to break after first line of item.
! 3764: \fi
! 3765: % We can be in inner vertical mode in a footnote, although an
! 3766: % @itemize looks awful there.
! 3767: }%
1.1 misho 3768: \flushcr
3769: }
3770:
3771: % \splitoff TOKENS\endmark defines \first to be the first token in
3772: % TOKENS, and \rest to be the remainder.
3773: %
3774: \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
3775:
3776: % Allow an optional argument of an uppercase letter, lowercase letter,
3777: % or number, to specify the first label in the enumerated list. No
3778: % argument is the same as `1'.
3779: %
3780: \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
3781: \def\enumeratey #1 #2\endenumeratey{%
3782: % If we were given no argument, pretend we were given `1'.
3783: \def\thearg{#1}%
3784: \ifx\thearg\empty \def\thearg{1}\fi
3785: %
3786: % Detect if the argument is a single token. If so, it might be a
3787: % letter. Otherwise, the only valid thing it can be is a number.
3788: % (We will always have one token, because of the test we just made.
3789: % This is a good thing, since \splitoff doesn't work given nothing at
3790: % all -- the first parameter is undelimited.)
3791: \expandafter\splitoff\thearg\endmark
3792: \ifx\rest\empty
3793: % Only one token in the argument. It could still be anything.
3794: % A ``lowercase letter'' is one whose \lccode is nonzero.
3795: % An ``uppercase letter'' is one whose \lccode is both nonzero, and
3796: % not equal to itself.
3797: % Otherwise, we assume it's a number.
3798: %
3799: % We need the \relax at the end of the \ifnum lines to stop TeX from
3800: % continuing to look for a <number>.
3801: %
3802: \ifnum\lccode\expandafter`\thearg=0\relax
3803: \numericenumerate % a number (we hope)
3804: \else
3805: % It's a letter.
3806: \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
3807: \lowercaseenumerate % lowercase letter
3808: \else
3809: \uppercaseenumerate % uppercase letter
3810: \fi
3811: \fi
3812: \else
3813: % Multiple tokens in the argument. We hope it's a number.
3814: \numericenumerate
3815: \fi
3816: }
3817:
3818: % An @enumerate whose labels are integers. The starting integer is
3819: % given in \thearg.
3820: %
3821: \def\numericenumerate{%
3822: \itemno = \thearg
3823: \startenumeration{\the\itemno}%
3824: }
3825:
3826: % The starting (lowercase) letter is in \thearg.
3827: \def\lowercaseenumerate{%
3828: \itemno = \expandafter`\thearg
3829: \startenumeration{%
3830: % Be sure we're not beyond the end of the alphabet.
3831: \ifnum\itemno=0
3832: \errmessage{No more lowercase letters in @enumerate; get a bigger
3833: alphabet}%
3834: \fi
3835: \char\lccode\itemno
3836: }%
3837: }
3838:
3839: % The starting (uppercase) letter is in \thearg.
3840: \def\uppercaseenumerate{%
3841: \itemno = \expandafter`\thearg
3842: \startenumeration{%
3843: % Be sure we're not beyond the end of the alphabet.
3844: \ifnum\itemno=0
3845: \errmessage{No more uppercase letters in @enumerate; get a bigger
3846: alphabet}
3847: \fi
3848: \char\uccode\itemno
3849: }%
3850: }
3851:
3852: % Call \doitemize, adding a period to the first argument and supplying the
3853: % common last two arguments. Also subtract one from the initial value in
3854: % \itemno, since @item increments \itemno.
3855: %
3856: \def\startenumeration#1{%
3857: \advance\itemno by -1
3858: \doitemize{#1.}\flushcr
3859: }
3860:
3861: % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
3862: % to @enumerate.
3863: %
3864: \def\alphaenumerate{\enumerate{a}}
3865: \def\capsenumerate{\enumerate{A}}
3866: \def\Ealphaenumerate{\Eenumerate}
3867: \def\Ecapsenumerate{\Eenumerate}
3868:
3869:
3870: % @multitable macros
3871: % Amy Hendrickson, 8/18/94, 3/6/96
3872: %
3873: % @multitable ... @end multitable will make as many columns as desired.
3874: % Contents of each column will wrap at width given in preamble. Width
3875: % can be specified either with sample text given in a template line,
3876: % or in percent of \hsize, the current width of text on page.
3877:
3878: % Table can continue over pages but will only break between lines.
3879:
3880: % To make preamble:
3881: %
3882: % Either define widths of columns in terms of percent of \hsize:
3883: % @multitable @columnfractions .25 .3 .45
3884: % @item ...
3885: %
3886: % Numbers following @columnfractions are the percent of the total
3887: % current hsize to be used for each column. You may use as many
3888: % columns as desired.
3889:
3890:
3891: % Or use a template:
3892: % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3893: % @item ...
3894: % using the widest term desired in each column.
3895:
3896: % Each new table line starts with @item, each subsequent new column
3897: % starts with @tab. Empty columns may be produced by supplying @tab's
3898: % with nothing between them for as many times as empty columns are needed,
3899: % ie, @tab@tab@tab will produce two empty columns.
3900:
3901: % @item, @tab do not need to be on their own lines, but it will not hurt
3902: % if they are.
3903:
3904: % Sample multitable:
3905:
3906: % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
3907: % @item first col stuff @tab second col stuff @tab third col
3908: % @item
3909: % first col stuff
3910: % @tab
3911: % second col stuff
3912: % @tab
3913: % third col
3914: % @item first col stuff @tab second col stuff
3915: % @tab Many paragraphs of text may be used in any column.
3916: %
3917: % They will wrap at the width determined by the template.
3918: % @item@tab@tab This will be in third column.
3919: % @end multitable
3920:
3921: % Default dimensions may be reset by user.
3922: % @multitableparskip is vertical space between paragraphs in table.
3923: % @multitableparindent is paragraph indent in table.
3924: % @multitablecolmargin is horizontal space to be left between columns.
3925: % @multitablelinespace is space to leave between table items, baseline
3926: % to baseline.
3927: % 0pt means it depends on current normal line spacing.
3928: %
3929: \newskip\multitableparskip
3930: \newskip\multitableparindent
3931: \newdimen\multitablecolspace
3932: \newskip\multitablelinespace
3933: \multitableparskip=0pt
3934: \multitableparindent=6pt
3935: \multitablecolspace=12pt
3936: \multitablelinespace=0pt
3937:
3938: % Macros used to set up halign preamble:
3939: %
3940: \let\endsetuptable\relax
3941: \def\xendsetuptable{\endsetuptable}
3942: \let\columnfractions\relax
3943: \def\xcolumnfractions{\columnfractions}
3944: \newif\ifsetpercent
3945:
3946: % #1 is the @columnfraction, usually a decimal number like .5, but might
3947: % be just 1. We just use it, whatever it is.
3948: %
3949: \def\pickupwholefraction#1 {%
3950: \global\advance\colcount by 1
3951: \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
3952: \setuptable
3953: }
3954:
3955: \newcount\colcount
3956: \def\setuptable#1{%
3957: \def\firstarg{#1}%
3958: \ifx\firstarg\xendsetuptable
3959: \let\go = \relax
3960: \else
3961: \ifx\firstarg\xcolumnfractions
3962: \global\setpercenttrue
3963: \else
3964: \ifsetpercent
3965: \let\go\pickupwholefraction
3966: \else
3967: \global\advance\colcount by 1
3968: \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
3969: % separator; typically that is always in the input, anyway.
3970: \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
3971: \fi
3972: \fi
3973: \ifx\go\pickupwholefraction
3974: % Put the argument back for the \pickupwholefraction call, so
3975: % we'll always have a period there to be parsed.
3976: \def\go{\pickupwholefraction#1}%
3977: \else
3978: \let\go = \setuptable
3979: \fi%
3980: \fi
3981: \go
3982: }
3983:
3984: % multitable-only commands.
1.1.1.2 ! misho 3985: %
! 3986: % @headitem starts a heading row, which we typeset in bold. Assignments
! 3987: % have to be global since we are inside the implicit group of an
! 3988: % alignment entry. \everycr below resets \everytab so we don't have to
1.1 misho 3989: % undo it ourselves.
3990: \def\headitemfont{\b}% for people to use in the template row; not changeable
3991: \def\headitem{%
3992: \checkenv\multitable
3993: \crcr
1.1.1.2 ! misho 3994: \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
1.1 misho 3995: \global\everytab={\bf}% can't use \headitemfont since the parsing differs
3996: \the\everytab % for the first item
3997: }%
3998: %
1.1.1.2 ! misho 3999: % default for tables with no headings.
! 4000: \let\headitemcrhook=\relax
! 4001: %
1.1 misho 4002: % A \tab used to include \hskip1sp. But then the space in a template
4003: % line is not enough. That is bad. So let's go back to just `&' until
4004: % we again encounter the problem the 1sp was intended to solve.
4005: % --karl, nathan@acm.org, 20apr99.
4006: \def\tab{\checkenv\multitable &\the\everytab}%
4007:
4008: % @multitable ... @end multitable definitions:
4009: %
4010: \newtoks\everytab % insert after every tab.
4011: %
4012: \envdef\multitable{%
4013: \vskip\parskip
4014: \startsavinginserts
4015: %
4016: % @item within a multitable starts a normal row.
4017: % We use \def instead of \let so that if one of the multitable entries
4018: % contains an @itemize, we don't choke on the \item (seen as \crcr aka
4019: % \endtemplate) expanding \doitemize.
4020: \def\item{\crcr}%
4021: %
4022: \tolerance=9500
4023: \hbadness=9500
4024: \setmultitablespacing
4025: \parskip=\multitableparskip
4026: \parindent=\multitableparindent
4027: \overfullrule=0pt
4028: \global\colcount=0
4029: %
4030: \everycr = {%
4031: \noalign{%
1.1.1.2 ! misho 4032: \global\everytab={}% Reset from possible headitem.
1.1 misho 4033: \global\colcount=0 % Reset the column counter.
1.1.1.2 ! misho 4034: %
! 4035: % Check for saved footnotes, etc.:
1.1 misho 4036: \checkinserts
1.1.1.2 ! misho 4037: %
! 4038: % Perhaps a \nobreak, then reset:
! 4039: \headitemcrhook
! 4040: \global\let\headitemcrhook=\relax
1.1 misho 4041: }%
4042: }%
4043: %
4044: \parsearg\domultitable
4045: }
4046: \def\domultitable#1{%
4047: % To parse everything between @multitable and @item:
4048: \setuptable#1 \endsetuptable
4049: %
4050: % This preamble sets up a generic column definition, which will
4051: % be used as many times as user calls for columns.
4052: % \vtop will set a single line and will also let text wrap and
4053: % continue for many paragraphs if desired.
4054: \halign\bgroup &%
4055: \global\advance\colcount by 1
4056: \multistrut
4057: \vtop{%
4058: % Use the current \colcount to find the correct column width:
4059: \hsize=\expandafter\csname col\the\colcount\endcsname
4060: %
4061: % In order to keep entries from bumping into each other
4062: % we will add a \leftskip of \multitablecolspace to all columns after
4063: % the first one.
4064: %
4065: % If a template has been used, we will add \multitablecolspace
4066: % to the width of each template entry.
4067: %
4068: % If the user has set preamble in terms of percent of \hsize we will
4069: % use that dimension as the width of the column, and the \leftskip
4070: % will keep entries from bumping into each other. Table will start at
4071: % left margin and final column will justify at right margin.
4072: %
4073: % Make sure we don't inherit \rightskip from the outer environment.
4074: \rightskip=0pt
4075: \ifnum\colcount=1
4076: % The first column will be indented with the surrounding text.
4077: \advance\hsize by\leftskip
4078: \else
4079: \ifsetpercent \else
4080: % If user has not set preamble in terms of percent of \hsize
4081: % we will advance \hsize by \multitablecolspace.
4082: \advance\hsize by \multitablecolspace
4083: \fi
4084: % In either case we will make \leftskip=\multitablecolspace:
4085: \leftskip=\multitablecolspace
4086: \fi
4087: % Ignoring space at the beginning and end avoids an occasional spurious
4088: % blank line, when TeX decides to break the line at the space before the
4089: % box from the multistrut, so the strut ends up on a line by itself.
4090: % For example:
4091: % @multitable @columnfractions .11 .89
4092: % @item @code{#}
4093: % @tab Legal holiday which is valid in major parts of the whole country.
4094: % Is automatically provided with highlighting sequences respectively
4095: % marking characters.
4096: \noindent\ignorespaces##\unskip\multistrut
4097: }\cr
4098: }
4099: \def\Emultitable{%
4100: \crcr
4101: \egroup % end the \halign
4102: \global\setpercentfalse
4103: }
4104:
4105: \def\setmultitablespacing{%
4106: \def\multistrut{\strut}% just use the standard line spacing
4107: %
4108: % Compute \multitablelinespace (if not defined by user) for use in
4109: % \multitableparskip calculation. We used define \multistrut based on
4110: % this, but (ironically) that caused the spacing to be off.
4111: % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
4112: \ifdim\multitablelinespace=0pt
4113: \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
4114: \global\advance\multitablelinespace by-\ht0
4115: \fi
4116: % Test to see if parskip is larger than space between lines of
4117: % table. If not, do nothing.
4118: % If so, set to same dimension as multitablelinespace.
4119: \ifdim\multitableparskip>\multitablelinespace
4120: \global\multitableparskip=\multitablelinespace
4121: \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4122: % than skip between lines in the table.
4123: \fi%
4124: \ifdim\multitableparskip=0pt
4125: \global\multitableparskip=\multitablelinespace
4126: \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
4127: % than skip between lines in the table.
4128: \fi}
4129:
4130:
4131: \message{conditionals,}
4132:
4133: % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
4134: % @ifnotxml always succeed. They currently do nothing; we don't
4135: % attempt to check whether the conditionals are properly nested. But we
4136: % have to remember that they are conditionals, so that @end doesn't
4137: % attempt to close an environment group.
4138: %
4139: \def\makecond#1{%
4140: \expandafter\let\csname #1\endcsname = \relax
4141: \expandafter\let\csname iscond.#1\endcsname = 1
4142: }
4143: \makecond{iftex}
4144: \makecond{ifnotdocbook}
4145: \makecond{ifnothtml}
4146: \makecond{ifnotinfo}
4147: \makecond{ifnotplaintext}
4148: \makecond{ifnotxml}
4149:
4150: % Ignore @ignore, @ifhtml, @ifinfo, and the like.
4151: %
4152: \def\direntry{\doignore{direntry}}
4153: \def\documentdescription{\doignore{documentdescription}}
4154: \def\docbook{\doignore{docbook}}
4155: \def\html{\doignore{html}}
4156: \def\ifdocbook{\doignore{ifdocbook}}
4157: \def\ifhtml{\doignore{ifhtml}}
4158: \def\ifinfo{\doignore{ifinfo}}
4159: \def\ifnottex{\doignore{ifnottex}}
4160: \def\ifplaintext{\doignore{ifplaintext}}
4161: \def\ifxml{\doignore{ifxml}}
4162: \def\ignore{\doignore{ignore}}
4163: \def\menu{\doignore{menu}}
4164: \def\xml{\doignore{xml}}
4165:
4166: % Ignore text until a line `@end #1', keeping track of nested conditionals.
4167: %
4168: % A count to remember the depth of nesting.
4169: \newcount\doignorecount
4170:
4171: \def\doignore#1{\begingroup
4172: % Scan in ``verbatim'' mode:
4173: \obeylines
4174: \catcode`\@ = \other
4175: \catcode`\{ = \other
4176: \catcode`\} = \other
4177: %
4178: % Make sure that spaces turn into tokens that match what \doignoretext wants.
4179: \spaceisspace
4180: %
4181: % Count number of #1's that we've seen.
4182: \doignorecount = 0
4183: %
4184: % Swallow text until we reach the matching `@end #1'.
4185: \dodoignore{#1}%
4186: }
4187:
4188: { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
4189: \obeylines %
4190: %
4191: \gdef\dodoignore#1{%
4192: % #1 contains the command name as a string, e.g., `ifinfo'.
4193: %
4194: % Define a command to find the next `@end #1'.
4195: \long\def\doignoretext##1^^M@end #1{%
4196: \doignoretextyyy##1^^M@#1\_STOP_}%
4197: %
4198: % And this command to find another #1 command, at the beginning of a
4199: % line. (Otherwise, we would consider a line `@c @ifset', for
4200: % example, to count as an @ifset for nesting.)
4201: \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
4202: %
4203: % And now expand that command.
4204: \doignoretext ^^M%
4205: }%
4206: }
4207:
4208: \def\doignoreyyy#1{%
4209: \def\temp{#1}%
4210: \ifx\temp\empty % Nothing found.
4211: \let\next\doignoretextzzz
4212: \else % Found a nested condition, ...
4213: \advance\doignorecount by 1
4214: \let\next\doignoretextyyy % ..., look for another.
4215: % If we're here, #1 ends with ^^M\ifinfo (for example).
4216: \fi
4217: \next #1% the token \_STOP_ is present just after this macro.
4218: }
4219:
4220: % We have to swallow the remaining "\_STOP_".
4221: %
4222: \def\doignoretextzzz#1{%
4223: \ifnum\doignorecount = 0 % We have just found the outermost @end.
4224: \let\next\enddoignore
4225: \else % Still inside a nested condition.
4226: \advance\doignorecount by -1
4227: \let\next\doignoretext % Look for the next @end.
4228: \fi
4229: \next
4230: }
4231:
4232: % Finish off ignored text.
4233: { \obeylines%
4234: % Ignore anything after the last `@end #1'; this matters in verbatim
4235: % environments, where otherwise the newline after an ignored conditional
4236: % would result in a blank line in the output.
4237: \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
4238: }
4239:
4240:
4241: % @set VAR sets the variable VAR to an empty value.
4242: % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
4243: %
4244: % Since we want to separate VAR from REST-OF-LINE (which might be
4245: % empty), we can't just use \parsearg; we have to insert a space of our
4246: % own to delimit the rest of the line, and then take it out again if we
4247: % didn't need it.
4248: % We rely on the fact that \parsearg sets \catcode`\ =10.
4249: %
4250: \parseargdef\set{\setyyy#1 \endsetyyy}
4251: \def\setyyy#1 #2\endsetyyy{%
4252: {%
4253: \makevalueexpandable
4254: \def\temp{#2}%
4255: \edef\next{\gdef\makecsname{SET#1}}%
4256: \ifx\temp\empty
4257: \next{}%
4258: \else
4259: \setzzz#2\endsetzzz
4260: \fi
4261: }%
4262: }
4263: % Remove the trailing space \setxxx inserted.
4264: \def\setzzz#1 \endsetzzz{\next{#1}}
4265:
4266: % @clear VAR clears (i.e., unsets) the variable VAR.
4267: %
4268: \parseargdef\clear{%
4269: {%
4270: \makevalueexpandable
4271: \global\expandafter\let\csname SET#1\endcsname=\relax
4272: }%
4273: }
4274:
4275: % @value{foo} gets the text saved in variable foo.
4276: \def\value{\begingroup\makevalueexpandable\valuexxx}
4277: \def\valuexxx#1{\expandablevalue{#1}\endgroup}
4278: {
4279: \catcode`\-=\active \catcode`\_=\active
4280: %
4281: \gdef\makevalueexpandable{%
4282: \let\value = \expandablevalue
4283: % We don't want these characters active, ...
4284: \catcode`\-=\other \catcode`\_=\other
4285: % ..., but we might end up with active ones in the argument if
4286: % we're called from @code, as @code{@value{foo-bar_}}, though.
4287: % So \let them to their normal equivalents.
4288: \let-\normaldash \let_\normalunderscore
4289: }
4290: }
4291:
4292: % We have this subroutine so that we can handle at least some @value's
4293: % properly in indexes (we call \makevalueexpandable in \indexdummies).
4294: % The command has to be fully expandable (if the variable is set), since
4295: % the result winds up in the index file. This means that if the
4296: % variable's value contains other Texinfo commands, it's almost certain
4297: % it will fail (although perhaps we could fix that with sufficient work
4298: % to do a one-level expansion on the result, instead of complete).
4299: %
4300: % Unfortunately, this has the consequence that when _ is in the *value*
4301: % of an @set, it does not print properly in the roman fonts (get the cmr
4302: % dot accent at position 126 instead). No fix comes to mind, and it's
4303: % been this way since 2003 or earlier, so just ignore it.
4304: %
4305: \def\expandablevalue#1{%
4306: \expandafter\ifx\csname SET#1\endcsname\relax
4307: {[No value for ``#1'']}%
4308: \message{Variable `#1', used in @value, is not set.}%
4309: \else
4310: \csname SET#1\endcsname
4311: \fi
4312: }
4313:
4314: % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
4315: % with @set.
4316: %
4317: % To get the special treatment we need for `@end ifset,' we call
4318: % \makecond and then redefine.
4319: %
4320: \makecond{ifset}
4321: \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
4322: \def\doifset#1#2{%
4323: {%
4324: \makevalueexpandable
4325: \let\next=\empty
4326: \expandafter\ifx\csname SET#2\endcsname\relax
4327: #1% If not set, redefine \next.
4328: \fi
4329: \expandafter
4330: }\next
4331: }
4332: \def\ifsetfail{\doignore{ifset}}
4333:
4334: % @ifclear VAR ... @end executes the `...' iff VAR has never been
4335: % defined with @set, or has been undefined with @clear.
4336: %
4337: % The `\else' inside the `\doifset' parameter is a trick to reuse the
4338: % above code: if the variable is not set, do nothing, if it is set,
4339: % then redefine \next to \ifclearfail.
4340: %
4341: \makecond{ifclear}
4342: \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
4343: \def\ifclearfail{\doignore{ifclear}}
4344:
4345: % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
4346: % without the @) is in fact defined. We can only feasibly check at the
4347: % TeX level, so something like `mathcode' is going to considered
4348: % defined even though it is not a Texinfo command.
4349: %
4350: \makecond{ifcommanddefined}
4351: \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
4352: %
4353: \def\doifcmddefined#1#2{{%
4354: \makevalueexpandable
4355: \let\next=\empty
4356: \expandafter\ifx\csname #2\endcsname\relax
4357: #1% If not defined, \let\next as above.
4358: \fi
4359: \expandafter
4360: }\next
4361: }
4362: \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
4363:
4364: % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
4365: \makecond{ifcommandnotdefined}
4366: \def\ifcommandnotdefined{%
4367: \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
4368: \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
4369:
4370: % Set the `txicommandconditionals' variable, so documents have a way to
4371: % test if the @ifcommand...defined conditionals are available.
4372: \set txicommandconditionals
4373:
4374: % @dircategory CATEGORY -- specify a category of the dir file
4375: % which this file should belong to. Ignore this in TeX.
4376: \let\dircategory=\comment
4377:
4378: % @defininfoenclose.
4379: \let\definfoenclose=\comment
4380:
4381:
4382: \message{indexing,}
4383: % Index generation facilities
4384:
4385: % Define \newwrite to be identical to plain tex's \newwrite
4386: % except not \outer, so it can be used within macros and \if's.
4387: \edef\newwrite{\makecsname{ptexnewwrite}}
4388:
1.1.1.2 ! misho 4389: % \newindex {foo} defines an index named IX.
! 4390: % It automatically defines \IXindex such that
! 4391: % \IXindex ...rest of line... puts an entry in the index IX.
! 4392: % It also defines \IXindfile to be the number of the output channel for
! 4393: % the file that accumulates this index. The file's extension is IX.
1.1 misho 4394: % The name of an index should be no more than 2 characters long
4395: % for the sake of vms.
4396: %
4397: \def\newindex#1{%
1.1.1.2 ! misho 4398: \expandafter\chardef\csname#1indfile\endcsname=0
1.1 misho 4399: \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
4400: \noexpand\doindex{#1}}
4401: }
4402:
4403: % @defindex foo == \newindex{foo}
4404: %
4405: \def\defindex{\parsearg\newindex}
4406:
4407: % Define @defcodeindex, like @defindex except put all entries in @code.
4408: %
4409: \def\defcodeindex{\parsearg\newcodeindex}
4410: %
4411: \def\newcodeindex#1{%
1.1.1.2 ! misho 4412: \expandafter\chardef\csname#1indfile\endcsname=0
1.1 misho 4413: \expandafter\xdef\csname#1index\endcsname{%
4414: \noexpand\docodeindex{#1}}%
4415: }
4416:
1.1.1.2 ! misho 4417: % The default indices:
! 4418: \newindex{cp}% concepts,
! 4419: \newcodeindex{fn}% functions,
! 4420: \newcodeindex{vr}% variables,
! 4421: \newcodeindex{tp}% types,
! 4422: \newcodeindex{ky}% keys
! 4423: \newcodeindex{pg}% and programs.
! 4424:
1.1 misho 4425:
4426: % @synindex foo bar makes index foo feed into index bar.
4427: % Do this instead of @defindex foo if you don't want it as a separate index.
4428: %
4429: % @syncodeindex foo bar similar, but put all entries made for index foo
4430: % inside @code.
4431: %
4432: \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
4433: \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
4434:
4435: % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
4436: % #3 the target index (bar).
4437: \def\dosynindex#1#2#3{%
4438: % Only do \closeout if we haven't already done it, else we'll end up
4439: % closing the target index.
4440: \expandafter \ifx\csname donesynindex#2\endcsname \relax
4441: % The \closeout helps reduce unnecessary open files; the limit on the
4442: % Acorn RISC OS is a mere 16 files.
4443: \expandafter\closeout\csname#2indfile\endcsname
4444: \expandafter\let\csname donesynindex#2\endcsname = 1
4445: \fi
4446: % redefine \fooindfile:
4447: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
4448: \expandafter\let\csname#2indfile\endcsname=\temp
4449: % redefine \fooindex:
4450: \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
4451: }
4452:
1.1.1.2 ! misho 4453: % Define \doindex, the driver for all index macros.
1.1 misho 4454: % Argument #1 is generated by the calling \fooindex macro,
1.1.1.2 ! misho 4455: % and it the two-letter name of the index.
1.1 misho 4456:
1.1.1.2 ! misho 4457: \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
! 4458: \def\doindexxxx #1{\doind{\indexname}{#1}}
1.1 misho 4459:
4460: % like the previous two, but they put @code around the argument.
1.1.1.2 ! misho 4461: \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
! 4462: \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
1.1 misho 4463:
1.1.1.2 ! misho 4464: % Used when writing an index entry out to an index file, to prevent
! 4465: % expansion of Texinfo commands that can appear in an index entry.
1.1 misho 4466: %
4467: \def\indexdummies{%
4468: \escapechar = `\\ % use backslash in output files.
4469: \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4470: \def\ {\realbackslash\space }%
4471: %
4472: % Need these unexpandable (because we define \tt as a dummy)
4473: % definitions when @{ or @} appear in index entry text. Also, more
4474: % complicated, when \tex is in effect and \{ is a \delimiter again.
4475: % We can't use \lbracecmd and \rbracecmd because texindex assumes
4476: % braces and backslashes are used only as delimiters. Perhaps we
1.1.1.2 ! misho 4477: % should use @lbracechar and @rbracechar?
1.1 misho 4478: \def\{{{\tt\char123}}%
4479: \def\}{{\tt\char125}}%
4480: %
4481: % Do the redefinitions.
4482: \commondummies
4483: }
4484:
4485: % For the aux and toc files, @ is the escape character. So we want to
4486: % redefine everything using @ as the escape character (instead of
4487: % \realbackslash, still used for index files). When everything uses @,
4488: % this will be simpler.
4489: %
4490: \def\atdummies{%
4491: \def\@{@@}%
4492: \def\ {@ }%
4493: \let\{ = \lbraceatcmd
4494: \let\} = \rbraceatcmd
4495: %
4496: % Do the redefinitions.
4497: \commondummies
4498: \otherbackslash
4499: }
4500:
4501: % Called from \indexdummies and \atdummies.
4502: %
4503: \def\commondummies{%
4504: % \definedummyword defines \#1 as \string\#1\space, thus effectively
4505: % preventing its expansion. This is used only for control words,
4506: % not control letters, because the \space would be incorrect for
4507: % control characters, but is needed to separate the control word
4508: % from whatever follows.
4509: %
4510: % For control letters, we have \definedummyletter, which omits the
4511: % space.
4512: %
4513: % These can be used both for control words that take an argument and
4514: % those that do not. If it is followed by {arg} in the input, then
4515: % that will dutifully get written to the index (or wherever).
4516: %
4517: \def\definedummyword ##1{\def##1{\string##1\space}}%
4518: \def\definedummyletter##1{\def##1{\string##1}}%
4519: \let\definedummyaccent\definedummyletter
4520: %
4521: \commondummiesnofonts
4522: %
4523: \definedummyletter\_%
4524: \definedummyletter\-%
4525: %
4526: % Non-English letters.
4527: \definedummyword\AA
4528: \definedummyword\AE
4529: \definedummyword\DH
4530: \definedummyword\L
4531: \definedummyword\O
4532: \definedummyword\OE
4533: \definedummyword\TH
4534: \definedummyword\aa
4535: \definedummyword\ae
4536: \definedummyword\dh
4537: \definedummyword\exclamdown
4538: \definedummyword\l
4539: \definedummyword\o
4540: \definedummyword\oe
4541: \definedummyword\ordf
4542: \definedummyword\ordm
4543: \definedummyword\questiondown
4544: \definedummyword\ss
4545: \definedummyword\th
4546: %
4547: % Although these internal commands shouldn't show up, sometimes they do.
4548: \definedummyword\bf
4549: \definedummyword\gtr
4550: \definedummyword\hat
4551: \definedummyword\less
4552: \definedummyword\sf
4553: \definedummyword\sl
4554: \definedummyword\tclose
4555: \definedummyword\tt
4556: %
4557: \definedummyword\LaTeX
4558: \definedummyword\TeX
4559: %
4560: % Assorted special characters.
4561: \definedummyword\arrow
4562: \definedummyword\bullet
4563: \definedummyword\comma
4564: \definedummyword\copyright
4565: \definedummyword\registeredsymbol
4566: \definedummyword\dots
4567: \definedummyword\enddots
4568: \definedummyword\entrybreak
4569: \definedummyword\equiv
4570: \definedummyword\error
4571: \definedummyword\euro
4572: \definedummyword\expansion
4573: \definedummyword\geq
4574: \definedummyword\guillemetleft
4575: \definedummyword\guillemetright
4576: \definedummyword\guilsinglleft
4577: \definedummyword\guilsinglright
4578: \definedummyword\lbracechar
4579: \definedummyword\leq
1.1.1.2 ! misho 4580: \definedummyword\mathopsup
1.1 misho 4581: \definedummyword\minus
4582: \definedummyword\ogonek
4583: \definedummyword\pounds
4584: \definedummyword\point
4585: \definedummyword\print
4586: \definedummyword\quotedblbase
4587: \definedummyword\quotedblleft
4588: \definedummyword\quotedblright
4589: \definedummyword\quoteleft
4590: \definedummyword\quoteright
4591: \definedummyword\quotesinglbase
4592: \definedummyword\rbracechar
4593: \definedummyword\result
1.1.1.2 ! misho 4594: \definedummyword\sub
! 4595: \definedummyword\sup
1.1 misho 4596: \definedummyword\textdegree
4597: %
4598: % We want to disable all macros so that they are not expanded by \write.
4599: \macrolist
4600: %
4601: \normalturnoffactive
4602: %
4603: % Handle some cases of @value -- where it does not contain any
4604: % (non-fully-expandable) commands.
4605: \makevalueexpandable
4606: }
4607:
4608: % \commondummiesnofonts: common to \commondummies and \indexnofonts.
1.1.1.2 ! misho 4609: % Define \definedumyletter, \definedummyaccent and \definedummyword before
! 4610: % using.
1.1 misho 4611: %
4612: \def\commondummiesnofonts{%
4613: % Control letters and accents.
4614: \definedummyletter\!%
4615: \definedummyaccent\"%
4616: \definedummyaccent\'%
4617: \definedummyletter\*%
4618: \definedummyaccent\,%
4619: \definedummyletter\.%
4620: \definedummyletter\/%
4621: \definedummyletter\:%
4622: \definedummyaccent\=%
4623: \definedummyletter\?%
4624: \definedummyaccent\^%
4625: \definedummyaccent\`%
4626: \definedummyaccent\~%
4627: \definedummyword\u
4628: \definedummyword\v
4629: \definedummyword\H
4630: \definedummyword\dotaccent
4631: \definedummyword\ogonek
4632: \definedummyword\ringaccent
4633: \definedummyword\tieaccent
4634: \definedummyword\ubaraccent
4635: \definedummyword\udotaccent
4636: \definedummyword\dotless
4637: %
4638: % Texinfo font commands.
4639: \definedummyword\b
4640: \definedummyword\i
4641: \definedummyword\r
4642: \definedummyword\sansserif
4643: \definedummyword\sc
4644: \definedummyword\slanted
4645: \definedummyword\t
4646: %
4647: % Commands that take arguments.
4648: \definedummyword\abbr
4649: \definedummyword\acronym
4650: \definedummyword\anchor
4651: \definedummyword\cite
4652: \definedummyword\code
4653: \definedummyword\command
4654: \definedummyword\dfn
4655: \definedummyword\dmn
4656: \definedummyword\email
4657: \definedummyword\emph
4658: \definedummyword\env
4659: \definedummyword\file
4660: \definedummyword\image
4661: \definedummyword\indicateurl
4662: \definedummyword\inforef
4663: \definedummyword\kbd
4664: \definedummyword\key
4665: \definedummyword\math
4666: \definedummyword\option
4667: \definedummyword\pxref
4668: \definedummyword\ref
4669: \definedummyword\samp
4670: \definedummyword\strong
4671: \definedummyword\tie
1.1.1.2 ! misho 4672: \definedummyword\U
1.1 misho 4673: \definedummyword\uref
4674: \definedummyword\url
4675: \definedummyword\var
4676: \definedummyword\verb
4677: \definedummyword\w
4678: \definedummyword\xref
4679: }
4680:
1.1.1.2 ! misho 4681: % For testing: output @{ and @} in index sort strings as \{ and \}.
! 4682: \newif\ifusebracesinindexes
! 4683:
! 4684: \let\indexlbrace\relax
! 4685: \let\indexrbrace\relax
! 4686:
! 4687: {\catcode`\@=0
! 4688: \catcode`\\=13
! 4689: @gdef@backslashdisappear{@def\{}}
! 4690: }
! 4691:
! 4692: {
! 4693: \catcode`\<=13
! 4694: \catcode`\-=13
! 4695: \catcode`\`=13
! 4696: \gdef\indexnonalnumdisappear{%
! 4697: \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
! 4698: % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
! 4699: % (Introduced for FSFS 2nd ed.)
! 4700: \let`=\empty
! 4701: \fi
! 4702: %
! 4703: \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
! 4704: \backslashdisappear
! 4705: \fi
! 4706: %
! 4707: \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
! 4708: \def-{}%
! 4709: \fi
! 4710: \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
! 4711: \def<{}%
! 4712: \fi
! 4713: \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
! 4714: \def\@{}%
! 4715: \fi
! 4716: }
! 4717:
! 4718: \gdef\indexnonalnumreappear{%
! 4719: \useindexbackslash
! 4720: \let-\normaldash
! 4721: \let<\normalless
! 4722: \def\@{@}%
! 4723: }
! 4724: }
! 4725:
! 4726:
1.1 misho 4727: % \indexnofonts is used when outputting the strings to sort the index
4728: % by, and when constructing control sequence names. It eliminates all
4729: % control sequences and just writes whatever the best ASCII sort string
4730: % would be for a given command (usually its argument).
4731: %
4732: \def\indexnofonts{%
4733: % Accent commands should become @asis.
4734: \def\definedummyaccent##1{\let##1\asis}%
4735: % We can just ignore other control letters.
4736: \def\definedummyletter##1{\let##1\empty}%
4737: % All control words become @asis by default; overrides below.
4738: \let\definedummyword\definedummyaccent
4739: \commondummiesnofonts
4740: %
4741: % Don't no-op \tt, since it isn't a user-level command
4742: % and is used in the definitions of the active chars like <, >, |, etc.
4743: % Likewise with the other plain tex font commands.
4744: %\let\tt=\asis
4745: %
4746: \def\ { }%
4747: \def\@{@}%
4748: \def\_{\normalunderscore}%
4749: \def\-{}% @- shouldn't affect sorting
4750: %
1.1.1.2 ! misho 4751: \def\lbracechar{{\indexlbrace}}%
! 4752: \def\rbracechar{{\indexrbrace}}%
! 4753: \let\{=\lbracechar
! 4754: \let\}=\rbracechar
1.1 misho 4755: %
4756: %
4757: % Non-English letters.
4758: \def\AA{AA}%
4759: \def\AE{AE}%
4760: \def\DH{DZZ}%
4761: \def\L{L}%
4762: \def\OE{OE}%
4763: \def\O{O}%
1.1.1.2 ! misho 4764: \def\TH{TH}%
1.1 misho 4765: \def\aa{aa}%
4766: \def\ae{ae}%
4767: \def\dh{dzz}%
4768: \def\exclamdown{!}%
4769: \def\l{l}%
4770: \def\oe{oe}%
4771: \def\ordf{a}%
4772: \def\ordm{o}%
4773: \def\o{o}%
4774: \def\questiondown{?}%
4775: \def\ss{ss}%
1.1.1.2 ! misho 4776: \def\th{th}%
1.1 misho 4777: %
4778: \def\LaTeX{LaTeX}%
4779: \def\TeX{TeX}%
4780: %
4781: % Assorted special characters.
4782: % (The following {} will end up in the sort string, but that's ok.)
4783: \def\arrow{->}%
4784: \def\bullet{bullet}%
4785: \def\comma{,}%
4786: \def\copyright{copyright}%
4787: \def\dots{...}%
4788: \def\enddots{...}%
4789: \def\equiv{==}%
4790: \def\error{error}%
4791: \def\euro{euro}%
4792: \def\expansion{==>}%
4793: \def\geq{>=}%
4794: \def\guillemetleft{<<}%
4795: \def\guillemetright{>>}%
4796: \def\guilsinglleft{<}%
4797: \def\guilsinglright{>}%
4798: \def\leq{<=}%
4799: \def\minus{-}%
4800: \def\point{.}%
4801: \def\pounds{pounds}%
4802: \def\print{-|}%
4803: \def\quotedblbase{"}%
4804: \def\quotedblleft{"}%
4805: \def\quotedblright{"}%
4806: \def\quoteleft{`}%
4807: \def\quoteright{'}%
4808: \def\quotesinglbase{,}%
4809: \def\registeredsymbol{R}%
4810: \def\result{=>}%
4811: \def\textdegree{o}%
4812: %
4813: % We need to get rid of all macros, leaving only the arguments (if present).
4814: % Of course this is not nearly correct, but it is the best we can do for now.
4815: % makeinfo does not expand macros in the argument to @deffn, which ends up
4816: % writing an index entry, and texindex isn't prepared for an index sort entry
4817: % that starts with \.
4818: %
4819: % Since macro invocations are followed by braces, we can just redefine them
4820: % to take a single TeX argument. The case of a macro invocation that
4821: % goes to end-of-line is not handled.
4822: %
4823: \macrolist
4824: }
4825:
4826:
4827: \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4828:
4829: % Most index entries go through here, but \dosubind is the general case.
4830: % #1 is the index name, #2 is the entry text.
4831: \def\doind#1#2{\dosubind{#1}{#2}{}}
4832:
1.1.1.2 ! misho 4833: % There is also \dosubind {index}{topic}{subtopic}
! 4834: % which makes an entry in a two-level index such as the operation index.
! 4835: % TODO: Two-level index? Operation index?
! 4836:
! 4837: % Workhorse for all indexes.
1.1 misho 4838: % #1 is name of index, #2 is stuff to put there, #3 is subentry --
4839: % empty if called from \doind, as we usually are (the main exception
4840: % is with most defuns, which call us directly).
4841: %
4842: \def\dosubind#1#2#3{%
4843: \iflinks
4844: {%
1.1.1.2 ! misho 4845: \requireopenindexfile{#1}%
1.1 misho 4846: % Store the main index entry text (including the third arg).
4847: \toks0 = {#2}%
4848: % If third arg is present, precede it with a space.
4849: \def\thirdarg{#3}%
4850: \ifx\thirdarg\empty \else
4851: \toks0 = \expandafter{\the\toks0 \space #3}%
4852: \fi
4853: %
4854: \edef\writeto{\csname#1indfile\endcsname}%
4855: %
4856: \safewhatsit\dosubindwrite
4857: }%
4858: \fi
4859: }
4860:
1.1.1.2 ! misho 4861: % Check if an index file has been opened, and if not, open it.
! 4862: \def\requireopenindexfile#1{%
! 4863: \ifnum\csname #1indfile\endcsname=0
! 4864: \expandafter\newwrite \csname#1indfile\endcsname
! 4865: \edef\suffix{#1}%
! 4866: % A .fls suffix would conflict with the file extension for the output
! 4867: % of -recorder, so use .f1s instead.
! 4868: \ifx\suffix\indexisfl\def\suffix{f1}\fi
! 4869: % Open the file
! 4870: \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
! 4871: % Using \immediate here prevents an object entering into the current box,
! 4872: % which could confound checks such as those in \safewhatsit for preceding
! 4873: % skips.
! 4874: \fi}
! 4875: \def\indexisfl{fl}
! 4876:
! 4877: % Output \ as {\indexbackslash}, because \ is an escape character in
! 4878: % the index files.
! 4879: \let\indexbackslash=\relax
! 4880: {\catcode`\@=0 \catcode`\\=\active
! 4881: @gdef@useindexbackslash{@def\{{@indexbackslash}}}
! 4882: }
! 4883:
! 4884: % Definition for writing index entry text.
! 4885: \def\sortas#1{\ignorespaces}%
! 4886:
! 4887: % Definition for writing index entry sort key. Should occur at the at
! 4888: % the beginning of the index entry, like
! 4889: % @cindex @sortas{september} \september
! 4890: % The \ignorespaces takes care of following space, but there's no way
! 4891: % to remove space before it.
! 4892: {
! 4893: \catcode`\-=13
! 4894: \gdef\indexwritesortas{%
! 4895: \begingroup
! 4896: \indexnonalnumreappear
! 4897: \indexwritesortasxxx}
! 4898: \gdef\indexwritesortasxxx#1{%
! 4899: \xdef\indexsortkey{#1}\endgroup}
! 4900: }
! 4901:
! 4902:
! 4903: % Write the entry in \toks0 to the index file.
1.1 misho 4904: %
4905: \def\dosubindwrite{%
4906: % Put the index entry in the margin if desired.
4907: \ifx\SETmarginindex\relax\else
4908: \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
4909: \fi
4910: %
4911: % Remember, we are within a group.
4912: \indexdummies % Must do this here, since \bf, etc expand at this stage
1.1.1.2 ! misho 4913: \useindexbackslash % \indexbackslash isn't defined now so it will be output
! 4914: % as is; and it will print as backslash.
! 4915: % Get the string to sort by, by processing the index entry with all
! 4916: % font commands turned off.
1.1 misho 4917: {\indexnofonts
1.1.1.2 ! misho 4918: \indexnonalnumdisappear
! 4919: \xdef\indexsortkey{}%
! 4920: \let\sortas=\indexwritesortas
! 4921: \edef\temp{\the\toks0}%
! 4922: \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
! 4923: \ifx\indexsortkey\empty
! 4924: \xdef\indexsortkey{\temp}%
! 4925: \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
! 4926: \fi
1.1 misho 4927: }%
4928: %
4929: % Set up the complete index entry, with both the sort key and
4930: % the original text, including any font commands. We write
4931: % three arguments to \entry to the .?? file (four in the
4932: % subentry case), texindex reduces to two when writing the .??s
4933: % sorted result.
4934: \edef\temp{%
4935: \write\writeto{%
1.1.1.2 ! misho 4936: \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
1.1 misho 4937: }%
4938: \temp
4939: }
1.1.1.2 ! misho 4940: \newbox\dummybox % used above
1.1 misho 4941:
4942: % Take care of unwanted page breaks/skips around a whatsit:
4943: %
4944: % If a skip is the last thing on the list now, preserve it
4945: % by backing up by \lastskip, doing the \write, then inserting
4946: % the skip again. Otherwise, the whatsit generated by the
4947: % \write or \pdfdest will make \lastskip zero. The result is that
4948: % sequences like this:
4949: % @end defun
4950: % @tindex whatever
4951: % @defun ...
4952: % will have extra space inserted, because the \medbreak in the
4953: % start of the @defun won't see the skip inserted by the @end of
4954: % the previous defun.
4955: %
4956: % But don't do any of this if we're not in vertical mode. We
4957: % don't want to do a \vskip and prematurely end a paragraph.
4958: %
4959: % Avoid page breaks due to these extra skips, too.
4960: %
4961: % But wait, there is a catch there:
4962: % We'll have to check whether \lastskip is zero skip. \ifdim is not
4963: % sufficient for this purpose, as it ignores stretch and shrink parts
4964: % of the skip. The only way seems to be to check the textual
4965: % representation of the skip.
4966: %
4967: % The following is almost like \def\zeroskipmacro{0.0pt} except that
4968: % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
4969: %
4970: \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
4971: %
4972: \newskip\whatsitskip
4973: \newcount\whatsitpenalty
4974: %
4975: % ..., ready, GO:
4976: %
4977: \def\safewhatsit#1{\ifhmode
4978: #1%
4979: \else
4980: % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
4981: \whatsitskip = \lastskip
4982: \edef\lastskipmacro{\the\lastskip}%
4983: \whatsitpenalty = \lastpenalty
4984: %
4985: % If \lastskip is nonzero, that means the last item was a
4986: % skip. And since a skip is discardable, that means this
4987: % -\whatsitskip glue we're inserting is preceded by a
4988: % non-discardable item, therefore it is not a potential
4989: % breakpoint, therefore no \nobreak needed.
4990: \ifx\lastskipmacro\zeroskipmacro
4991: \else
4992: \vskip-\whatsitskip
4993: \fi
4994: %
4995: #1%
4996: %
4997: \ifx\lastskipmacro\zeroskipmacro
4998: % If \lastskip was zero, perhaps the last item was a penalty, and
4999: % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
5000: % to re-insert the same penalty (values >10000 are used for various
5001: % signals); since we just inserted a non-discardable item, any
5002: % following glue (such as a \parskip) would be a breakpoint. For example:
5003: % @deffn deffn-whatever
5004: % @vindex index-whatever
5005: % Description.
5006: % would allow a break between the index-whatever whatsit
5007: % and the "Description." paragraph.
5008: \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
5009: \else
5010: % On the other hand, if we had a nonzero \lastskip,
5011: % this make-up glue would be preceded by a non-discardable item
5012: % (the whatsit from the \write), so we must insert a \nobreak.
5013: \nobreak\vskip\whatsitskip
5014: \fi
5015: \fi}
5016:
5017: % The index entry written in the file actually looks like
5018: % \entry {sortstring}{page}{topic}
5019: % or
5020: % \entry {sortstring}{page}{topic}{subtopic}
5021: % The texindex program reads in these files and writes files
5022: % containing these kinds of lines:
5023: % \initial {c}
5024: % before the first topic whose initial is c
5025: % \entry {topic}{pagelist}
5026: % for a topic that is used without subtopics
5027: % \primary {topic}
5028: % for the beginning of a topic that is used with subtopics
5029: % \secondary {subtopic}{pagelist}
5030: % for each subtopic.
5031:
5032: % Define the user-accessible indexing commands
5033: % @findex, @vindex, @kindex, @cindex.
5034:
5035: \def\findex {\fnindex}
5036: \def\kindex {\kyindex}
5037: \def\cindex {\cpindex}
5038: \def\vindex {\vrindex}
5039: \def\tindex {\tpindex}
5040: \def\pindex {\pgindex}
5041:
5042: \def\cindexsub {\begingroup\obeylines\cindexsub}
5043: {\obeylines %
5044: \gdef\cindexsub "#1" #2^^M{\endgroup %
5045: \dosubind{cp}{#2}{#1}}}
5046:
5047: % Define the macros used in formatting output of the sorted index material.
5048:
5049: % @printindex causes a particular index (the ??s file) to get printed.
5050: % It does not print any chapter heading (usually an @unnumbered).
5051: %
5052: \parseargdef\printindex{\begingroup
5053: \dobreak \chapheadingskip{10000}%
5054: %
5055: \smallfonts \rm
5056: \tolerance = 9500
5057: \plainfrenchspacing
5058: \everypar = {}% don't want the \kern\-parindent from indentation suppression.
5059: %
5060: % See if the index file exists and is nonempty.
5061: % Change catcode of @ here so that if the index file contains
5062: % \initial {@}
5063: % as its first line, TeX doesn't complain about mismatched braces
5064: % (because it thinks @} is a control sequence).
5065: \catcode`\@ = 11
1.1.1.2 ! misho 5066: % See comment in \requireopenindexfile.
! 5067: \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
! 5068: \openin 1 \jobname.\indexname s
1.1 misho 5069: \ifeof 1
5070: % \enddoublecolumns gets confused if there is no text in the index,
5071: % and it loses the chapter title and the aux file entries for the
5072: % index. The easiest way to prevent this problem is to make sure
5073: % there is some text.
5074: \putwordIndexNonexistent
5075: \else
1.1.1.2 ! misho 5076: \catcode`\\ = 0
! 5077: \escapechar = `\\
1.1 misho 5078: %
5079: % If the index file exists but is empty, then \openin leaves \ifeof
5080: % false. We have to make TeX try to read something from the file, so
5081: % it can discover if there is anything in it.
1.1.1.2 ! misho 5082: \read 1 to \thisline
1.1 misho 5083: \ifeof 1
5084: \putwordIndexIsEmpty
5085: \else
5086: % Index files are almost Texinfo source, but we use \ as the escape
5087: % character. It would be better to use @, but that's too big a change
5088: % to make right now.
1.1.1.2 ! misho 5089: \def\indexbackslash{\ttbackslash}%
! 5090: \let\indexlbrace\{ % Likewise, set these sequences for braces
! 5091: \let\indexrbrace\} % used in the sort key.
1.1 misho 5092: \begindoublecolumns
1.1.1.2 ! misho 5093: \let\entryorphanpenalty=\indexorphanpenalty
! 5094: %
! 5095: % Read input from the index file line by line.
! 5096: \loopdo
! 5097: \ifeof1
! 5098: \let\firsttoken\relax
! 5099: \else
! 5100: \read 1 to \nextline
! 5101: \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
! 5102: \act
! 5103: \fi
! 5104: \thisline
! 5105: %
! 5106: \ifeof1\else
! 5107: \let\thisline\nextline
! 5108: \repeat
! 5109: %%
1.1 misho 5110: \enddoublecolumns
5111: \fi
5112: \fi
5113: \closein 1
5114: \endgroup}
5115:
1.1.1.2 ! misho 5116: \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
! 5117: \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
! 5118:
! 5119: \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
! 5120: \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
! 5121:
1.1 misho 5122: % These macros are used by the sorted index file itself.
5123: % Change them to control the appearance of the index.
5124:
1.1.1.2 ! misho 5125: {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
! 5126: \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
! 5127: \catcode`\$=3
! 5128: \gdef\initialglyphs{%
! 5129: % Some changes for non-alphabetic characters. Using the glyphs from the
! 5130: % math fonts looks more consistent than the typewriter font used elsewhere
! 5131: % for these characters.
! 5132: \def\indexbackslash{\math{\backslash}}%
! 5133: \let\\=\indexbackslash
! 5134: %
! 5135: % Can't get bold backslash so don't use bold forward slash
! 5136: \catcode`\/=13
! 5137: \def/{{\secrmnotbold \normalslash}}%
! 5138: \def-{{\normaldash\normaldash}}% en dash `--'
! 5139: \def^{{\chapbf \normalcaret}}%
! 5140: \def~{{\chapbf \normaltilde}}%
! 5141: \def\_{%
! 5142: \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
! 5143: \def|{$\vert$}%
! 5144: \def<{$\less$}%
! 5145: \def>{$\gtr$}%
! 5146: \def+{$\normalplus$}%
! 5147: }}
! 5148:
! 5149: \def\initial{%
! 5150: \bgroup
! 5151: \initialglyphs
! 5152: \initialx
! 5153: }
! 5154:
! 5155: \def\initialx#1{%
1.1 misho 5156: % Remove any glue we may have, we'll be inserting our own.
5157: \removelastskip
5158: %
5159: % We like breaks before the index initials, so insert a bonus.
1.1.1.2 ! misho 5160: % The glue before the bonus allows a little bit of space at the
! 5161: % bottom of a column to reduce an increase in inter-line spacing.
1.1 misho 5162: \nobreak
1.1.1.2 ! misho 5163: \vskip 0pt plus 5\baselineskip
! 5164: \penalty -300
! 5165: \vskip 0pt plus -5\baselineskip
1.1 misho 5166: %
5167: % Typeset the initial. Making this add up to a whole number of
5168: % baselineskips increases the chance of the dots lining up from column
5169: % to column. It still won't often be perfect, because of the stretch
5170: % we need before each entry, but it's better.
5171: %
5172: % No shrink because it confuses \balancecolumns.
1.1.1.2 ! misho 5173: \vskip 1.67\baselineskip plus 1\baselineskip
! 5174: \leftline{\secfonts \kern-0.05em \secbf #1}%
! 5175: % \secfonts is inside the argument of \leftline so that the change of
! 5176: % \baselineskip will not affect any glue inserted before the vbox that
! 5177: % \leftline creates.
1.1 misho 5178: % Do our best not to break after the initial.
5179: \nobreak
5180: \vskip .33\baselineskip plus .1\baselineskip
1.1.1.2 ! misho 5181: \egroup % \initialglyphs
! 5182: }
! 5183:
! 5184: \newdimen\entryrightmargin
! 5185: \entryrightmargin=0pt
1.1 misho 5186:
5187: % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
5188: % then page number (#2) flushed to the right margin. It is used for index
5189: % and table of contents entries. The paragraph is indented by \leftskip.
5190: %
5191: \def\entry{%
5192: \begingroup
5193: %
5194: % Start a new paragraph if necessary, so our assignments below can't
5195: % affect previous text.
5196: \par
5197: %
5198: % No extra space above this paragraph.
5199: \parskip = 0in
5200: %
5201: % When reading the text of entry, convert explicit line breaks
5202: % from @* into spaces. The user might give these in long section
5203: % titles, for instance.
5204: \def\*{\unskip\space\ignorespaces}%
1.1.1.2 ! misho 5205: \def\entrybreak{\hfil\break}% An undocumented command
! 5206: %
! 5207: % A bit of stretch before each entry for the benefit of balancing
! 5208: % columns.
! 5209: \vskip 0pt plus0.5pt
1.1 misho 5210: %
5211: % Swallow the left brace of the text (first parameter):
5212: \afterassignment\doentry
5213: \let\temp =
5214: }
5215: \def\entrybreak{\unskip\space\ignorespaces}%
5216: \def\doentry{%
1.1.1.2 ! misho 5217: % Save the text of the entry
! 5218: \global\setbox\boxA=\hbox\bgroup
1.1 misho 5219: \bgroup % Instead of the swallowed brace.
5220: \noindent
5221: \aftergroup\finishentry
5222: % And now comes the text of the entry.
1.1.1.2 ! misho 5223: % Not absorbing as a macro argument reduces the chance of problems
! 5224: % with catcodes occurring.
1.1 misho 5225: }
1.1.1.2 ! misho 5226: {\catcode`\@=11
! 5227: \gdef\finishentry#1{%
! 5228: \egroup % end box A
! 5229: \dimen@ = \wd\boxA % Length of text of entry
! 5230: \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
1.1 misho 5231: % #1 is the page number.
5232: %
1.1.1.2 ! misho 5233: % Get the width of the page numbers, and only use
! 5234: % leaders if they are present.
! 5235: \global\setbox\boxB = \hbox{#1}%
! 5236: \ifdim\wd\boxB = 0pt
! 5237: \null\nobreak\hfill\ %
1.1 misho 5238: \else
5239: %
5240: \null\nobreak\indexdotfill % Have leaders before the page number.
5241: %
5242: \ifpdf
1.1.1.2 ! misho 5243: \pdfgettoks#1.%
! 5244: \hskip\skip\thinshrinkable\the\toksA
1.1 misho 5245: \else
1.1.1.2 ! misho 5246: \hskip\skip\thinshrinkable #1%
1.1 misho 5247: \fi
5248: \fi
1.1.1.2 ! misho 5249: \egroup % end \boxA
! 5250: \ifdim\wd\boxB = 0pt
! 5251: \global\setbox\entryindexbox=\box\boxA
! 5252: \else
! 5253: \global\setbox\entryindexbox=\vbox\bgroup\noindent
! 5254: % We want the text of the entries to be aligned to the left, and the
! 5255: % page numbers to be aligned to the right.
! 5256: %
! 5257: \advance\leftskip by 0pt plus 1fil
! 5258: \advance\leftskip by 0pt plus -1fill
! 5259: \rightskip = 0pt plus -1fil
! 5260: \advance\rightskip by 0pt plus 1fill
! 5261: % Cause last line, which could consist of page numbers on their own
! 5262: % if the list of page numbers is long, to be aligned to the right.
! 5263: \parfillskip=0pt plus -1fill
! 5264: %
! 5265: \hangindent=1em
! 5266: %
! 5267: \advance\rightskip by \entryrightmargin
! 5268: % Determine how far we can stretch into the margin.
! 5269: % This allows, e.g., "Appendix H GNU Free Documentation License" to
! 5270: % fit on one line in @letterpaper format.
! 5271: \ifdim\entryrightmargin>2.1em
! 5272: \dimen@i=2.1em
! 5273: \else
! 5274: \dimen@i=0em
! 5275: \fi
! 5276: \advance \parfillskip by 0pt minus 1\dimen@i
! 5277: %
! 5278: \dimen@ii = \hsize
! 5279: \advance\dimen@ii by -1\leftskip
! 5280: \advance\dimen@ii by -1\entryrightmargin
! 5281: \advance\dimen@ii by 1\dimen@i
! 5282: \let\maybestrut=\relax
! 5283: \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
! 5284: \let\maybestrut=\strut
! 5285: \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
! 5286: \dimen@ = 0.7\dimen@ % Try to split the text roughly evenly
! 5287: \dimen@ii = \hsize
! 5288: \advance \dimen@ii by -1em
! 5289: \ifnum\dimen@>\dimen@ii
! 5290: % If the entry is too long, use the whole line
! 5291: \dimen@ = \dimen@ii
! 5292: \fi
! 5293: \advance\leftskip by 0pt plus 1fill % ragged right
! 5294: \advance \dimen@ by 1\rightskip
! 5295: \parshape = 2 0pt \dimen@ 1em \dimen@ii
! 5296: % Ideally we'd add a finite glue at the end of the first line only, but
! 5297: % TeX doesn't seem to provide a way to do such a thing.
! 5298: \fi\fi
! 5299: \maybestrut % Add a strut on the first and last lines
! 5300: \unhbox\boxA
! 5301: \maybestrut
! 5302: %
! 5303: % Do not prefer a separate line ending with a hyphen to fewer lines.
! 5304: \finalhyphendemerits = 0
! 5305: %
! 5306: % Word spacing - no stretch
! 5307: \spaceskip=\fontdimen2\font minus \fontdimen4\font
! 5308: %
! 5309: \linepenalty=1000 % Discourage line breaks.
! 5310: \hyphenpenalty=5000 % Discourage hyphenation.
! 5311: %
! 5312: \par % format the paragraph
! 5313: \egroup % The \vbox
! 5314: \fi
1.1 misho 5315: \endgroup
1.1.1.2 ! misho 5316: % delay text of entry until after penalty
! 5317: \bgroup\aftergroup\insertindexentrybox
! 5318: \entryorphanpenalty
! 5319: }}
! 5320:
! 5321: \newskip\thinshrinkable
! 5322: \skip\thinshrinkable=.15em minus .15em
! 5323:
! 5324: \newbox\entryindexbox
! 5325: \def\insertindexentrybox{%
! 5326: \lineskip=0pt % This comes into effect when the \vbox has a large
! 5327: % height due to the paragraph in it having several
! 5328: % lines.
! 5329: \box\entryindexbox}
! 5330:
! 5331: % Default is no penalty
! 5332: \let\entryorphanpenalty\egroup
! 5333:
! 5334: % Used from \printindex. \firsttoken should be the first token
! 5335: % after the \entry. If it's not another \entry, we are at the last
! 5336: % line of a group of index entries, so insert a penalty to discourage
! 5337: % orphaned index entries.
! 5338: \long\def\indexorphanpenalty{%
! 5339: \def\isentry{\entry}%
! 5340: \ifx\firsttoken\isentry
! 5341: \else
! 5342: \unskip\penalty 9000
! 5343: % The \unskip here stops breaking before the glue. It relies on the
! 5344: % \vskip above being there, otherwise there is an error
! 5345: % "You can't use `\unskip' in vertical mode". There has to be glue
! 5346: % in the current vertical list that hasn't been added to the
! 5347: % "current page". See Chapter 24 of the TeXbook. This contradicts
! 5348: % Section 8.3.7 in "TeX by Topic," though.
! 5349: \fi
! 5350: \egroup % now comes the box added with \aftergroup
1.1 misho 5351: }
5352:
5353: % Like plain.tex's \dotfill, except uses up at least 1 em.
1.1.1.2 ! misho 5354: % The filll stretch here overpowers both the fil and fill stretch to push
! 5355: % the page number to the right.
1.1 misho 5356: \def\indexdotfill{\cleaders
1.1.1.2 ! misho 5357: \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
! 5358:
1.1 misho 5359:
5360: \def\primary #1{\line{#1\hfil}}
5361:
5362: \newskip\secondaryindent \secondaryindent=0.5cm
5363: \def\secondary#1#2{{%
5364: \parfillskip=0in
5365: \parskip=0in
5366: \hangindent=1in
5367: \hangafter=1
5368: \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
5369: \ifpdf
5370: \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5371: \else
5372: #2
5373: \fi
5374: \par
5375: }}
5376:
5377: % Define two-column mode, which we use to typeset indexes.
5378: % Adapted from the TeXbook, page 416, which is to say,
5379: % the manmac.tex format used to print the TeXbook itself.
5380: \catcode`\@=11
5381:
5382: \newbox\partialpage
5383: \newdimen\doublecolumnhsize
1.1.1.2 ! misho 5384: \newdimen\doublecolumntopgap
! 5385: \doublecolumntopgap = 0pt
! 5386:
! 5387: \newtoks\savedtopmark % Used in \begindoublecolumns
! 5388: \newtoks\savedfirstmark
1.1 misho 5389:
5390: \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
5391: % Grab any single-column material above us.
5392: \output = {%
5393: %
5394: % Here is a possibility not foreseen in manmac: if we accumulate a
5395: % whole lot of material, we might end up calling this \output
5396: % routine twice in a row (see the doublecol-lose test, which is
5397: % essentially a couple of indexes with @setchapternewpage off). In
5398: % that case we just ship out what is in \partialpage with the normal
5399: % output routine. Generally, \partialpage will be empty when this
5400: % runs and this will be a no-op. See the indexspread.tex test case.
5401: \ifvoid\partialpage \else
5402: \onepageout{\pagecontents\partialpage}%
5403: \fi
5404: %
5405: \global\setbox\partialpage = \vbox{%
5406: % Unvbox the main output page.
5407: \unvbox\PAGE
5408: \kern-\topskip \kern\baselineskip
5409: }%
1.1.1.2 ! misho 5410: % Save \topmark and \firstmark
! 5411: \global\savedtopmark=\expandafter{\topmark}%
! 5412: \global\savedfirstmark=\expandafter{\firstmark}%
1.1 misho 5413: }%
5414: \eject % run that output routine to set \partialpage
5415: %
1.1.1.2 ! misho 5416: % We recover the two marks that the last output routine saved in order
! 5417: % to propagate the information in marks added around a chapter heading,
! 5418: % which could be otherwise be lost by the time the final page is output.
! 5419: %
! 5420: \mark{\the\savedtopmark}% Only mark in page passed to following \output.
! 5421: \output = {%
! 5422: \setbox0=\box\PAGE % clear box 255
! 5423: }abc\eject
! 5424: %
! 5425: \mark{\the\savedfirstmark}%
! 5426: %
1.1 misho 5427: % Use the double-column output routine for subsequent pages.
5428: \output = {\doublecolumnout}%
5429: %
5430: % Change the page size parameters. We could do this once outside this
5431: % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
5432: % format, but then we repeat the same computation. Repeating a couple
5433: % of assignments once per index is clearly meaningless for the
5434: % execution time, so we may as well do it in one place.
5435: %
5436: % First we halve the line length, less a little for the gutter between
5437: % the columns. We compute the gutter based on the line length, so it
5438: % changes automatically with the paper format. The magic constant
5439: % below is chosen so that the gutter has the same value (well, +-<1pt)
5440: % as it did when we hard-coded it.
5441: %
5442: % We put the result in a separate register, \doublecolumhsize, so we
5443: % can restore it in \pagesofar, after \hsize itself has (potentially)
5444: % been clobbered.
5445: %
5446: \doublecolumnhsize = \hsize
5447: \advance\doublecolumnhsize by -.04154\hsize
5448: \divide\doublecolumnhsize by 2
5449: \hsize = \doublecolumnhsize
5450: %
5451: % Double the \vsize as well. (We don't need a separate register here,
5452: % since nobody clobbers \vsize.)
1.1.1.2 ! misho 5453: \global\doublecolumntopgap = \topskip
! 5454: \global\advance\doublecolumntopgap by -1\baselineskip
! 5455: \global\advance\vsize by -1\doublecolumntopgap
1.1 misho 5456: \vsize = 2\vsize
1.1.1.2 ! misho 5457: \topskip=0pt
1.1 misho 5458: }
5459:
5460: % The double-column output routine for all double-column pages except
1.1.1.2 ! misho 5461: % the last, which is done by \balancecolumns.
1.1 misho 5462: %
5463: \def\doublecolumnout{%
5464: \splittopskip=\topskip \splitmaxdepth=\maxdepth
5465: % Get the available space for the double columns -- the normal
5466: % (undoubled) page height minus any material left over from the
5467: % previous page.
5468: \dimen@ = \vsize
5469: \divide\dimen@ by 2
5470: \advance\dimen@ by -\ht\partialpage
5471: %
5472: % box0 will be the left-hand column, box2 the right.
5473: \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
5474: \onepageout\pagesofar
5475: \unvbox255
5476: \penalty\outputpenalty
5477: }
5478: %
5479: % Re-output the contents of the output page -- any previous material,
5480: % followed by the two boxes we just split, in box0 and box2.
5481: \def\pagesofar{%
5482: \unvbox\partialpage
5483: %
5484: \hsize = \doublecolumnhsize
5485: \wd0=\hsize \wd2=\hsize
1.1.1.2 ! misho 5486: \vbox{%
! 5487: \vskip\doublecolumntopgap
! 5488: \hbox to\pagewidth{\box0\hfil\box2}}%
1.1 misho 5489: }
1.1.1.2 ! misho 5490:
! 5491:
! 5492: % Finished with with double columns.
1.1 misho 5493: \def\enddoublecolumns{%
5494: % The following penalty ensures that the page builder is exercised
5495: % _before_ we change the output routine. This is necessary in the
5496: % following situation:
5497: %
5498: % The last section of the index consists only of a single entry.
5499: % Before this section, \pagetotal is less than \pagegoal, so no
5500: % break occurs before the last section starts. However, the last
5501: % section, consisting of \initial and the single \entry, does not
5502: % fit on the page and has to be broken off. Without the following
5503: % penalty the page builder will not be exercised until \eject
5504: % below, and by that time we'll already have changed the output
5505: % routine to the \balancecolumns version, so the next-to-last
5506: % double-column page will be processed with \balancecolumns, which
5507: % is wrong: The two columns will go to the main vertical list, with
5508: % the broken-off section in the recent contributions. As soon as
5509: % the output routine finishes, TeX starts reconsidering the page
5510: % break. The two columns and the broken-off section both fit on the
5511: % page, because the two columns now take up only half of the page
5512: % goal. When TeX sees \eject from below which follows the final
5513: % section, it invokes the new output routine that we've set after
5514: % \balancecolumns below; \onepageout will try to fit the two columns
5515: % and the final section into the vbox of \pageheight (see
5516: % \pagebody), causing an overfull box.
5517: %
5518: % Note that glue won't work here, because glue does not exercise the
5519: % page builder, unlike penalties (see The TeXbook, pp. 280-281).
5520: \penalty0
5521: %
5522: \output = {%
5523: % Split the last of the double-column material. Leave it on the
5524: % current page, no automatic page break.
5525: \balancecolumns
5526: %
5527: % If we end up splitting too much material for the current page,
5528: % though, there will be another page break right after this \output
5529: % invocation ends. Having called \balancecolumns once, we do not
5530: % want to call it again. Therefore, reset \output to its normal
5531: % definition right away. (We hope \balancecolumns will never be
5532: % called on to balance too much material, but if it is, this makes
5533: % the output somewhat more palatable.)
5534: \global\output = {\onepageout{\pagecontents\PAGE}}%
5535: }%
5536: \eject
5537: \endgroup % started in \begindoublecolumns
5538: %
5539: % \pagegoal was set to the doubled \vsize above, since we restarted
5540: % the current page. We're now back to normal single-column
5541: % typesetting, so reset \pagegoal to the normal \vsize (after the
5542: % \endgroup where \vsize got restored).
5543: \pagegoal = \vsize
5544: }
5545: %
1.1.1.2 ! misho 5546: % Only called for the last of the double column material. \doublecolumnout
! 5547: % does the others.
1.1 misho 5548: \def\balancecolumns{%
5549: \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
5550: \dimen@ = \ht0
5551: \advance\dimen@ by \topskip
5552: \advance\dimen@ by-\baselineskip
1.1.1.2 ! misho 5553: \ifdim\dimen@<14\baselineskip
! 5554: % Don't split a short final column in two.
! 5555: \setbox2=\vbox{}%
! 5556: \else
! 5557: \divide\dimen@ by 2 % target to split to
! 5558: \dimen@ii = \dimen@
! 5559: \splittopskip = \topskip
! 5560: % Loop until the second column is no higher than the first
! 5561: {%
! 5562: \vbadness = 10000
! 5563: \loop
! 5564: \global\setbox3 = \copy0
! 5565: \global\setbox1 = \vsplit3 to \dimen@
! 5566: % Remove glue from bottom of first column to
! 5567: % make sure it is higher than the second.
! 5568: \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}%
! 5569: \ifdim\ht3>\ht1
! 5570: \global\advance\dimen@ by 1pt
! 5571: \repeat
! 5572: }%
! 5573: \multiply\dimen@ii by 4
! 5574: \divide\dimen@ii by 5
! 5575: \ifdim\ht3<\dimen@ii
! 5576: % Column heights are too different, so don't make their bottoms
! 5577: % flush with each other. The glue at the end of the second column
! 5578: % allows a second column to stretch, reducing the difference in
! 5579: % height between the two.
! 5580: \setbox0=\vbox to\dimen@{\unvbox1\vfill}%
! 5581: \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}%
! 5582: \else
! 5583: \setbox0=\vbox to\dimen@{\unvbox1}%
! 5584: \setbox2=\vbox to\dimen@{\unvbox3}%
! 5585: \fi
! 5586: \fi
1.1 misho 5587: %
5588: \pagesofar
5589: }
5590: \catcode`\@ = \other
5591:
5592:
5593: \message{sectioning,}
5594: % Chapters, sections, etc.
5595:
5596: % Let's start with @part.
5597: \outer\parseargdef\part{\partzzz{#1}}
5598: \def\partzzz#1{%
5599: \chapoddpage
5600: \null
5601: \vskip.3\vsize % move it down on the page a bit
5602: \begingroup
5603: \noindent \titlefonts\rmisbold #1\par % the text
5604: \let\lastnode=\empty % no node to associate with
5605: \writetocentry{part}{#1}{}% but put it in the toc
5606: \headingsoff % no headline or footline on the part page
1.1.1.2 ! misho 5607: % This outputs a mark at the end of the page that clears \thischapter
! 5608: % and \thissection, as is done in \startcontents.
! 5609: \let\pchapsepmacro\relax
! 5610: \chapmacro{}{Yomitfromtoc}{}%
1.1 misho 5611: \chapoddpage
5612: \endgroup
5613: }
5614:
5615: % \unnumberedno is an oxymoron. But we count the unnumbered
5616: % sections so that we can refer to them unambiguously in the pdf
5617: % outlines by their "section number". We avoid collisions with chapter
5618: % numbers by starting them at 10000. (If a document ever has 10000
5619: % chapters, we're in trouble anyway, I'm sure.)
5620: \newcount\unnumberedno \unnumberedno = 10000
5621: \newcount\chapno
5622: \newcount\secno \secno=0
5623: \newcount\subsecno \subsecno=0
5624: \newcount\subsubsecno \subsubsecno=0
5625:
5626: % This counter is funny since it counts through charcodes of letters A, B, ...
5627: \newcount\appendixno \appendixno = `\@
5628: %
5629: % \def\appendixletter{\char\the\appendixno}
5630: % We do the following ugly conditional instead of the above simple
5631: % construct for the sake of pdftex, which needs the actual
5632: % letter in the expansion, not just typeset.
5633: %
5634: \def\appendixletter{%
5635: \ifnum\appendixno=`A A%
5636: \else\ifnum\appendixno=`B B%
5637: \else\ifnum\appendixno=`C C%
5638: \else\ifnum\appendixno=`D D%
5639: \else\ifnum\appendixno=`E E%
5640: \else\ifnum\appendixno=`F F%
5641: \else\ifnum\appendixno=`G G%
5642: \else\ifnum\appendixno=`H H%
5643: \else\ifnum\appendixno=`I I%
5644: \else\ifnum\appendixno=`J J%
5645: \else\ifnum\appendixno=`K K%
5646: \else\ifnum\appendixno=`L L%
5647: \else\ifnum\appendixno=`M M%
5648: \else\ifnum\appendixno=`N N%
5649: \else\ifnum\appendixno=`O O%
5650: \else\ifnum\appendixno=`P P%
5651: \else\ifnum\appendixno=`Q Q%
5652: \else\ifnum\appendixno=`R R%
5653: \else\ifnum\appendixno=`S S%
5654: \else\ifnum\appendixno=`T T%
5655: \else\ifnum\appendixno=`U U%
5656: \else\ifnum\appendixno=`V V%
5657: \else\ifnum\appendixno=`W W%
5658: \else\ifnum\appendixno=`X X%
5659: \else\ifnum\appendixno=`Y Y%
5660: \else\ifnum\appendixno=`Z Z%
5661: % The \the is necessary, despite appearances, because \appendixletter is
5662: % expanded while writing the .toc file. \char\appendixno is not
5663: % expandable, thus it is written literally, thus all appendixes come out
5664: % with the same letter (or @) in the toc without it.
5665: \else\char\the\appendixno
5666: \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
5667: \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
5668:
5669: % Each @chapter defines these (using marks) as the number+name, number
5670: % and name of the chapter. Page headings and footings can use
5671: % these. @section does likewise.
5672: \def\thischapter{}
5673: \def\thischapternum{}
5674: \def\thischaptername{}
5675: \def\thissection{}
5676: \def\thissectionnum{}
5677: \def\thissectionname{}
5678:
5679: \newcount\absseclevel % used to calculate proper heading level
5680: \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
5681:
5682: % @raisesections: treat @section as chapter, @subsection as section, etc.
5683: \def\raisesections{\global\advance\secbase by -1}
5684: \let\up=\raisesections % original BFox name
5685:
5686: % @lowersections: treat @chapter as section, @section as subsection, etc.
5687: \def\lowersections{\global\advance\secbase by 1}
5688: \let\down=\lowersections % original BFox name
5689:
5690: % we only have subsub.
5691: \chardef\maxseclevel = 3
5692: %
5693: % A numbered section within an unnumbered changes to unnumbered too.
5694: % To achieve this, remember the "biggest" unnum. sec. we are currently in:
5695: \chardef\unnlevel = \maxseclevel
5696: %
5697: % Trace whether the current chapter is an appendix or not:
5698: % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
5699: \def\chapheadtype{N}
5700:
5701: % Choose a heading macro
5702: % #1 is heading type
5703: % #2 is heading level
5704: % #3 is text for heading
5705: \def\genhead#1#2#3{%
5706: % Compute the abs. sec. level:
5707: \absseclevel=#2
5708: \advance\absseclevel by \secbase
5709: % Make sure \absseclevel doesn't fall outside the range:
5710: \ifnum \absseclevel < 0
5711: \absseclevel = 0
5712: \else
5713: \ifnum \absseclevel > 3
5714: \absseclevel = 3
5715: \fi
5716: \fi
5717: % The heading type:
5718: \def\headtype{#1}%
5719: \if \headtype U%
5720: \ifnum \absseclevel < \unnlevel
5721: \chardef\unnlevel = \absseclevel
5722: \fi
5723: \else
5724: % Check for appendix sections:
5725: \ifnum \absseclevel = 0
5726: \edef\chapheadtype{\headtype}%
5727: \else
5728: \if \headtype A\if \chapheadtype N%
5729: \errmessage{@appendix... within a non-appendix chapter}%
5730: \fi\fi
5731: \fi
5732: % Check for numbered within unnumbered:
5733: \ifnum \absseclevel > \unnlevel
5734: \def\headtype{U}%
5735: \else
5736: \chardef\unnlevel = 3
5737: \fi
5738: \fi
5739: % Now print the heading:
5740: \if \headtype U%
5741: \ifcase\absseclevel
5742: \unnumberedzzz{#3}%
5743: \or \unnumberedseczzz{#3}%
5744: \or \unnumberedsubseczzz{#3}%
5745: \or \unnumberedsubsubseczzz{#3}%
5746: \fi
5747: \else
5748: \if \headtype A%
5749: \ifcase\absseclevel
5750: \appendixzzz{#3}%
5751: \or \appendixsectionzzz{#3}%
5752: \or \appendixsubseczzz{#3}%
5753: \or \appendixsubsubseczzz{#3}%
5754: \fi
5755: \else
5756: \ifcase\absseclevel
5757: \chapterzzz{#3}%
5758: \or \seczzz{#3}%
5759: \or \numberedsubseczzz{#3}%
5760: \or \numberedsubsubseczzz{#3}%
5761: \fi
5762: \fi
5763: \fi
5764: \suppressfirstparagraphindent
5765: }
5766:
5767: % an interface:
5768: \def\numhead{\genhead N}
5769: \def\apphead{\genhead A}
5770: \def\unnmhead{\genhead U}
5771:
5772: % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
5773: % all lower-level sectioning counters to zero.
5774: %
5775: % Also set \chaplevelprefix, which we prepend to @float sequence numbers
5776: % (e.g., figures), q.v. By default (before any chapter), that is empty.
5777: \let\chaplevelprefix = \empty
5778: %
5779: \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
5780: \def\chapterzzz#1{%
5781: % section resetting is \global in case the chapter is in a group, such
5782: % as an @include file.
5783: \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5784: \global\advance\chapno by 1
5785: %
5786: % Used for \float.
5787: \gdef\chaplevelprefix{\the\chapno.}%
5788: \resetallfloatnos
5789: %
5790: % \putwordChapter can contain complex things in translations.
5791: \toks0=\expandafter{\putwordChapter}%
5792: \message{\the\toks0 \space \the\chapno}%
5793: %
5794: % Write the actual heading.
5795: \chapmacro{#1}{Ynumbered}{\the\chapno}%
5796: %
5797: % So @section and the like are numbered underneath this chapter.
5798: \global\let\section = \numberedsec
5799: \global\let\subsection = \numberedsubsec
5800: \global\let\subsubsection = \numberedsubsubsec
5801: }
5802:
5803: \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
5804: %
5805: \def\appendixzzz#1{%
5806: \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5807: \global\advance\appendixno by 1
5808: \gdef\chaplevelprefix{\appendixletter.}%
5809: \resetallfloatnos
5810: %
5811: % \putwordAppendix can contain complex things in translations.
5812: \toks0=\expandafter{\putwordAppendix}%
5813: \message{\the\toks0 \space \appendixletter}%
5814: %
5815: \chapmacro{#1}{Yappendix}{\appendixletter}%
5816: %
5817: \global\let\section = \appendixsec
5818: \global\let\subsection = \appendixsubsec
5819: \global\let\subsubsection = \appendixsubsubsec
5820: }
5821:
5822: % normally unnmhead0 calls unnumberedzzz:
5823: \outer\parseargdef\unnumbered{\unnmhead0{#1}}
5824: \def\unnumberedzzz#1{%
5825: \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5826: \global\advance\unnumberedno by 1
5827: %
5828: % Since an unnumbered has no number, no prefix for figures.
5829: \global\let\chaplevelprefix = \empty
5830: \resetallfloatnos
5831: %
5832: % This used to be simply \message{#1}, but TeX fully expands the
5833: % argument to \message. Therefore, if #1 contained @-commands, TeX
5834: % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
5835: % expanded @cite (which turns out to cause errors because \cite is meant
5836: % to be executed, not expanded).
5837: %
5838: % Anyway, we don't want the fully-expanded definition of @cite to appear
5839: % as a result of the \message, we just want `@cite' itself. We use
5840: % \the<toks register> to achieve this: TeX expands \the<toks> only once,
5841: % simply yielding the contents of <toks register>. (We also do this for
5842: % the toc entries.)
5843: \toks0 = {#1}%
5844: \message{(\the\toks0)}%
5845: %
5846: \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
5847: %
5848: \global\let\section = \unnumberedsec
5849: \global\let\subsection = \unnumberedsubsec
5850: \global\let\subsubsection = \unnumberedsubsubsec
5851: }
5852:
5853: % @centerchap is like @unnumbered, but the heading is centered.
5854: \outer\parseargdef\centerchap{%
5855: \let\centerparametersmaybe = \centerparameters
5856: \unnmhead0{#1}%
5857: \let\centerparametersmaybe = \relax
5858: }
5859:
5860: % @top is like @unnumbered.
5861: \let\top\unnumbered
5862:
5863: % Sections.
5864: %
5865: \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
5866: \def\seczzz#1{%
5867: \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5868: \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
5869: }
5870:
5871: % normally calls appendixsectionzzz:
5872: \outer\parseargdef\appendixsection{\apphead1{#1}}
5873: \def\appendixsectionzzz#1{%
5874: \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5875: \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
5876: }
5877: \let\appendixsec\appendixsection
5878:
5879: % normally calls unnumberedseczzz:
5880: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
5881: \def\unnumberedseczzz#1{%
5882: \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5883: \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
5884: }
5885:
5886: % Subsections.
5887: %
5888: % normally calls numberedsubseczzz:
5889: \outer\parseargdef\numberedsubsec{\numhead2{#1}}
5890: \def\numberedsubseczzz#1{%
5891: \global\subsubsecno=0 \global\advance\subsecno by 1
5892: \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
5893: }
5894:
5895: % normally calls appendixsubseczzz:
5896: \outer\parseargdef\appendixsubsec{\apphead2{#1}}
5897: \def\appendixsubseczzz#1{%
5898: \global\subsubsecno=0 \global\advance\subsecno by 1
5899: \sectionheading{#1}{subsec}{Yappendix}%
5900: {\appendixletter.\the\secno.\the\subsecno}%
5901: }
5902:
5903: % normally calls unnumberedsubseczzz:
5904: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
5905: \def\unnumberedsubseczzz#1{%
5906: \global\subsubsecno=0 \global\advance\subsecno by 1
5907: \sectionheading{#1}{subsec}{Ynothing}%
5908: {\the\unnumberedno.\the\secno.\the\subsecno}%
5909: }
5910:
5911: % Subsubsections.
5912: %
5913: % normally numberedsubsubseczzz:
5914: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
5915: \def\numberedsubsubseczzz#1{%
5916: \global\advance\subsubsecno by 1
5917: \sectionheading{#1}{subsubsec}{Ynumbered}%
5918: {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
5919: }
5920:
5921: % normally appendixsubsubseczzz:
5922: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
5923: \def\appendixsubsubseczzz#1{%
5924: \global\advance\subsubsecno by 1
5925: \sectionheading{#1}{subsubsec}{Yappendix}%
5926: {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
5927: }
5928:
5929: % normally unnumberedsubsubseczzz:
5930: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
5931: \def\unnumberedsubsubseczzz#1{%
5932: \global\advance\subsubsecno by 1
5933: \sectionheading{#1}{subsubsec}{Ynothing}%
5934: {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
5935: }
5936:
5937: % These macros control what the section commands do, according
5938: % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
5939: % Define them by default for a numbered chapter.
5940: \let\section = \numberedsec
5941: \let\subsection = \numberedsubsec
5942: \let\subsubsection = \numberedsubsubsec
5943:
5944: % Define @majorheading, @heading and @subheading
5945:
5946: \def\majorheading{%
5947: {\advance\chapheadingskip by 10pt \chapbreak }%
5948: \parsearg\chapheadingzzz
5949: }
5950:
5951: \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
5952: \def\chapheadingzzz#1{%
5953: \vbox{\chapfonts \raggedtitlesettings #1\par}%
5954: \nobreak\bigskip \nobreak
5955: \suppressfirstparagraphindent
5956: }
5957:
5958: % @heading, @subheading, @subsubheading.
5959: \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
5960: \suppressfirstparagraphindent}
5961: \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
5962: \suppressfirstparagraphindent}
5963: \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
5964: \suppressfirstparagraphindent}
5965:
5966: % These macros generate a chapter, section, etc. heading only
5967: % (including whitespace, linebreaking, etc. around it),
5968: % given all the information in convenient, parsed form.
5969:
5970: % Args are the skip and penalty (usually negative)
5971: \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
5972:
5973: % Parameter controlling skip before chapter headings (if needed)
5974: \newskip\chapheadingskip
5975:
5976: % Define plain chapter starts, and page on/off switching for it.
5977: \def\chapbreak{\dobreak \chapheadingskip {-4000}}
1.1.1.2 ! misho 5978:
! 5979: % Start a new page
1.1 misho 5980: \def\chappager{\par\vfill\supereject}
1.1.1.2 ! misho 5981:
! 5982: % \chapoddpage - start on an odd page for a new chapter
1.1 misho 5983: % Because \domark is called before \chapoddpage, the filler page will
5984: % get the headings for the next chapter, which is wrong. But we don't
5985: % care -- we just disable all headings on the filler page.
5986: \def\chapoddpage{%
5987: \chappager
5988: \ifodd\pageno \else
5989: \begingroup
5990: \headingsoff
5991: \null
5992: \chappager
5993: \endgroup
5994: \fi
5995: }
5996:
5997: \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
5998:
5999: \def\CHAPPAGoff{%
6000: \global\let\contentsalignmacro = \chappager
6001: \global\let\pchapsepmacro=\chapbreak
6002: \global\let\pagealignmacro=\chappager}
6003:
6004: \def\CHAPPAGon{%
6005: \global\let\contentsalignmacro = \chappager
6006: \global\let\pchapsepmacro=\chappager
6007: \global\let\pagealignmacro=\chappager
6008: \global\def\HEADINGSon{\HEADINGSsingle}}
6009:
6010: \def\CHAPPAGodd{%
6011: \global\let\contentsalignmacro = \chapoddpage
6012: \global\let\pchapsepmacro=\chapoddpage
6013: \global\let\pagealignmacro=\chapoddpage
6014: \global\def\HEADINGSon{\HEADINGSdouble}}
6015:
6016: \CHAPPAGon
6017:
1.1.1.2 ! misho 6018: % \chapmacro - Chapter opening.
1.1 misho 6019: %
6020: % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
6021: % Yappendix, Yomitfromtoc), #3 the chapter number.
1.1.1.2 ! misho 6022: % Not used for @heading series.
1.1 misho 6023: %
6024: % To test against our argument.
6025: \def\Ynothingkeyword{Ynothing}
6026: \def\Yappendixkeyword{Yappendix}
1.1.1.2 ! misho 6027: \def\Yomitfromtockeyword{Yomitfromtoc}
1.1 misho 6028: %
6029: \def\chapmacro#1#2#3{%
1.1.1.2 ! misho 6030: \checkenv{}% chapters, etc., should not start inside an environment.
! 6031: %
1.1 misho 6032: % Insert the first mark before the heading break (see notes for \domark).
6033: \let\prevchapterdefs=\lastchapterdefs
6034: \let\prevsectiondefs=\lastsectiondefs
6035: \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
6036: \gdef\thissection{}}%
6037: %
6038: \def\temptype{#2}%
6039: \ifx\temptype\Ynothingkeyword
6040: \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6041: \gdef\thischapter{\thischaptername}}%
6042: \else\ifx\temptype\Yomitfromtockeyword
6043: \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
6044: \gdef\thischapter{}}%
6045: \else\ifx\temptype\Yappendixkeyword
6046: \toks0={#1}%
6047: \xdef\lastchapterdefs{%
6048: \gdef\noexpand\thischaptername{\the\toks0}%
6049: \gdef\noexpand\thischapternum{\appendixletter}%
6050: % \noexpand\putwordAppendix avoids expanding indigestible
6051: % commands in some of the translations.
6052: \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
6053: \noexpand\thischapternum:
6054: \noexpand\thischaptername}%
6055: }%
6056: \else
6057: \toks0={#1}%
6058: \xdef\lastchapterdefs{%
6059: \gdef\noexpand\thischaptername{\the\toks0}%
6060: \gdef\noexpand\thischapternum{\the\chapno}%
6061: % \noexpand\putwordChapter avoids expanding indigestible
6062: % commands in some of the translations.
6063: \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
6064: \noexpand\thischapternum:
6065: \noexpand\thischaptername}%
6066: }%
6067: \fi\fi\fi
6068: %
6069: % Output the mark. Pass it through \safewhatsit, to take care of
6070: % the preceding space.
6071: \safewhatsit\domark
6072: %
6073: % Insert the chapter heading break.
6074: \pchapsepmacro
6075: %
6076: % Now the second mark, after the heading break. No break points
6077: % between here and the heading.
6078: \let\prevchapterdefs=\lastchapterdefs
6079: \let\prevsectiondefs=\lastsectiondefs
6080: \domark
6081: %
6082: {%
6083: \chapfonts \rmisbold
1.1.1.2 ! misho 6084: \let\footnote=\errfootnoteheading % give better error message
1.1 misho 6085: %
6086: % Have to define \lastsection before calling \donoderef, because the
6087: % xref code eventually uses it. On the other hand, it has to be called
6088: % after \pchapsepmacro, or the headline will change too soon.
6089: \gdef\lastsection{#1}%
6090: %
6091: % Only insert the separating space if we have a chapter/appendix
6092: % number, and don't print the unnumbered ``number''.
6093: \ifx\temptype\Ynothingkeyword
6094: \setbox0 = \hbox{}%
6095: \def\toctype{unnchap}%
6096: \else\ifx\temptype\Yomitfromtockeyword
6097: \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
6098: \def\toctype{omit}%
6099: \else\ifx\temptype\Yappendixkeyword
6100: \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
6101: \def\toctype{app}%
6102: \else
6103: \setbox0 = \hbox{#3\enspace}%
6104: \def\toctype{numchap}%
6105: \fi\fi\fi
6106: %
6107: % Write the toc entry for this chapter. Must come before the
6108: % \donoderef, because we include the current node name in the toc
6109: % entry, and \donoderef resets it to empty.
6110: \writetocentry{\toctype}{#1}{#3}%
6111: %
6112: % For pdftex, we have to write out the node definition (aka, make
6113: % the pdfdest) after any page break, but before the actual text has
6114: % been typeset. If the destination for the pdf outline is after the
6115: % text, then jumping from the outline may wind up with the text not
6116: % being visible, for instance under high magnification.
6117: \donoderef{#2}%
6118: %
6119: % Typeset the actual heading.
6120: \nobreak % Avoid page breaks at the interline glue.
6121: \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
6122: \unhbox0 #1\par}%
6123: }%
6124: \nobreak\bigskip % no page break after a chapter title
6125: \nobreak
6126: }
6127:
6128: % @centerchap -- centered and unnumbered.
6129: \let\centerparametersmaybe = \relax
6130: \def\centerparameters{%
6131: \advance\rightskip by 3\rightskip
6132: \leftskip = \rightskip
6133: \parfillskip = 0pt
6134: }
6135:
6136:
6137: % I don't think this chapter style is supported any more, so I'm not
6138: % updating it with the new noderef stuff. We'll see. --karl, 11aug03.
6139: %
6140: \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
6141: %
6142: \def\unnchfopen #1{%
6143: \chapoddpage
6144: \vbox{\chapfonts \raggedtitlesettings #1\par}%
6145: \nobreak\bigskip\nobreak
6146: }
6147: \def\chfopen #1#2{\chapoddpage {\chapfonts
6148: \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
6149: \par\penalty 5000 %
6150: }
6151: \def\centerchfopen #1{%
6152: \chapoddpage
6153: \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
6154: \nobreak\bigskip \nobreak
6155: }
6156: \def\CHAPFopen{%
6157: \global\let\chapmacro=\chfopen
6158: \global\let\centerchapmacro=\centerchfopen}
6159:
6160:
6161: % Section titles. These macros combine the section number parts and
6162: % call the generic \sectionheading to do the printing.
6163: %
6164: \newskip\secheadingskip
6165: \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
6166:
6167: % Subsection titles.
6168: \newskip\subsecheadingskip
6169: \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
6170:
6171: % Subsubsection titles.
6172: \def\subsubsecheadingskip{\subsecheadingskip}
6173: \def\subsubsecheadingbreak{\subsecheadingbreak}
6174:
6175:
6176: % Print any size, any type, section title.
6177: %
1.1.1.2 ! misho 6178: % #1 is the text of the title,
! 6179: % #2 is the section level (sec/subsec/subsubsec),
! 6180: % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
! 6181: % #4 is the section number.
1.1 misho 6182: %
6183: \def\seckeyword{sec}
6184: %
6185: \def\sectionheading#1#2#3#4{%
6186: {%
1.1.1.2 ! misho 6187: \def\sectionlevel{#2}%
! 6188: \def\temptype{#3}%
! 6189: %
! 6190: % It is ok for the @heading series commands to appear inside an
! 6191: % environment (it's been historically allowed, though the logic is
! 6192: % dubious), but not the others.
! 6193: \ifx\temptype\Yomitfromtockeyword\else
! 6194: \checkenv{}% non-@*heading should not be in an environment.
! 6195: \fi
! 6196: \let\footnote=\errfootnoteheading
1.1 misho 6197: %
6198: % Switch to the right set of fonts.
6199: \csname #2fonts\endcsname \rmisbold
6200: %
6201: % Insert first mark before the heading break (see notes for \domark).
6202: \let\prevsectiondefs=\lastsectiondefs
6203: \ifx\temptype\Ynothingkeyword
6204: \ifx\sectionlevel\seckeyword
6205: \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
6206: \gdef\thissection{\thissectionname}}%
6207: \fi
6208: \else\ifx\temptype\Yomitfromtockeyword
6209: % Don't redefine \thissection.
6210: \else\ifx\temptype\Yappendixkeyword
6211: \ifx\sectionlevel\seckeyword
6212: \toks0={#1}%
6213: \xdef\lastsectiondefs{%
6214: \gdef\noexpand\thissectionname{\the\toks0}%
6215: \gdef\noexpand\thissectionnum{#4}%
6216: % \noexpand\putwordSection avoids expanding indigestible
6217: % commands in some of the translations.
6218: \gdef\noexpand\thissection{\noexpand\putwordSection{}
6219: \noexpand\thissectionnum:
6220: \noexpand\thissectionname}%
6221: }%
6222: \fi
6223: \else
6224: \ifx\sectionlevel\seckeyword
6225: \toks0={#1}%
6226: \xdef\lastsectiondefs{%
6227: \gdef\noexpand\thissectionname{\the\toks0}%
6228: \gdef\noexpand\thissectionnum{#4}%
6229: % \noexpand\putwordSection avoids expanding indigestible
6230: % commands in some of the translations.
6231: \gdef\noexpand\thissection{\noexpand\putwordSection{}
6232: \noexpand\thissectionnum:
6233: \noexpand\thissectionname}%
6234: }%
6235: \fi
6236: \fi\fi\fi
6237: %
6238: % Go into vertical mode. Usually we'll already be there, but we
6239: % don't want the following whatsit to end up in a preceding paragraph
6240: % if the document didn't happen to have a blank line.
6241: \par
6242: %
6243: % Output the mark. Pass it through \safewhatsit, to take care of
6244: % the preceding space.
6245: \safewhatsit\domark
6246: %
6247: % Insert space above the heading.
6248: \csname #2headingbreak\endcsname
6249: %
6250: % Now the second mark, after the heading break. No break points
6251: % between here and the heading.
6252: \global\let\prevsectiondefs=\lastsectiondefs
6253: \domark
6254: %
6255: % Only insert the space after the number if we have a section number.
6256: \ifx\temptype\Ynothingkeyword
6257: \setbox0 = \hbox{}%
6258: \def\toctype{unn}%
6259: \gdef\lastsection{#1}%
6260: \else\ifx\temptype\Yomitfromtockeyword
6261: % for @headings -- no section number, don't include in toc,
6262: % and don't redefine \lastsection.
6263: \setbox0 = \hbox{}%
6264: \def\toctype{omit}%
6265: \let\sectionlevel=\empty
6266: \else\ifx\temptype\Yappendixkeyword
6267: \setbox0 = \hbox{#4\enspace}%
6268: \def\toctype{app}%
6269: \gdef\lastsection{#1}%
6270: \else
6271: \setbox0 = \hbox{#4\enspace}%
6272: \def\toctype{num}%
6273: \gdef\lastsection{#1}%
6274: \fi\fi\fi
6275: %
6276: % Write the toc entry (before \donoderef). See comments in \chapmacro.
6277: \writetocentry{\toctype\sectionlevel}{#1}{#4}%
6278: %
6279: % Write the node reference (= pdf destination for pdftex).
6280: % Again, see comments in \chapmacro.
6281: \donoderef{#3}%
6282: %
6283: % Interline glue will be inserted when the vbox is completed.
6284: % That glue will be a valid breakpoint for the page, since it'll be
6285: % preceded by a whatsit (usually from the \donoderef, or from the
6286: % \writetocentry if there was no node). We don't want to allow that
6287: % break, since then the whatsits could end up on page n while the
6288: % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
6289: \nobreak
6290: %
6291: % Output the actual section heading.
6292: \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
6293: \hangindent=\wd0 % zero if no section number
6294: \unhbox0 #1}%
6295: }%
6296: % Add extra space after the heading -- half of whatever came above it.
6297: % Don't allow stretch, though.
6298: \kern .5 \csname #2headingskip\endcsname
6299: %
6300: % Do not let the kern be a potential breakpoint, as it would be if it
6301: % was followed by glue.
6302: \nobreak
6303: %
6304: % We'll almost certainly start a paragraph next, so don't let that
6305: % glue accumulate. (Not a breakpoint because it's preceded by a
6306: % discardable item.) However, when a paragraph is not started next
6307: % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
6308: % or the negative glue will cause weirdly wrong output, typically
6309: % obscuring the section heading with something else.
6310: \vskip-\parskip
6311: %
6312: % This is so the last item on the main vertical list is a known
6313: % \penalty > 10000, so \startdefun, etc., can recognize the situation
6314: % and do the needful.
6315: \penalty 10001
6316: }
6317:
6318:
6319: \message{toc,}
6320: % Table of contents.
6321: \newwrite\tocfile
6322:
6323: % Write an entry to the toc file, opening it if necessary.
6324: % Called from @chapter, etc.
6325: %
6326: % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
6327: % We append the current node name (if any) and page number as additional
6328: % arguments for the \{chap,sec,...}entry macros which will eventually
6329: % read this. The node name is used in the pdf outlines as the
6330: % destination to jump to.
6331: %
6332: % We open the .toc file for writing here instead of at @setfilename (or
6333: % any other fixed time) so that @contents can be anywhere in the document.
6334: % But if #1 is `omit', then we don't do anything. This is used for the
6335: % table of contents chapter openings themselves.
6336: %
6337: \newif\iftocfileopened
6338: \def\omitkeyword{omit}%
6339: %
6340: \def\writetocentry#1#2#3{%
6341: \edef\writetoctype{#1}%
6342: \ifx\writetoctype\omitkeyword \else
6343: \iftocfileopened\else
6344: \immediate\openout\tocfile = \jobname.toc
6345: \global\tocfileopenedtrue
6346: \fi
6347: %
6348: \iflinks
6349: {\atdummies
6350: \edef\temp{%
6351: \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
6352: \temp
6353: }%
6354: \fi
6355: \fi
6356: %
6357: % Tell \shipout to create a pdf destination on each page, if we're
6358: % writing pdf. These are used in the table of contents. We can't
6359: % just write one on every page because the title pages are numbered
6360: % 1 and 2 (the page numbers aren't printed), and so are the first
6361: % two pages of the document. Thus, we'd have two destinations named
6362: % `1', and two named `2'.
6363: \ifpdf \global\pdfmakepagedesttrue \fi
6364: }
6365:
6366:
6367: % These characters do not print properly in the Computer Modern roman
6368: % fonts, so we must take special care. This is more or less redundant
6369: % with the Texinfo input format setup at the end of this file.
6370: %
6371: \def\activecatcodes{%
6372: \catcode`\"=\active
6373: \catcode`\$=\active
6374: \catcode`\<=\active
6375: \catcode`\>=\active
6376: \catcode`\\=\active
6377: \catcode`\^=\active
6378: \catcode`\_=\active
6379: \catcode`\|=\active
6380: \catcode`\~=\active
6381: }
6382:
6383:
6384: % Read the toc file, which is essentially Texinfo input.
6385: \def\readtocfile{%
6386: \setupdatafile
6387: \activecatcodes
6388: \input \tocreadfilename
6389: }
6390:
6391: \newskip\contentsrightmargin \contentsrightmargin=1in
6392: \newcount\savepageno
6393: \newcount\lastnegativepageno \lastnegativepageno = -1
6394:
6395: % Prepare to read what we've written to \tocfile.
6396: %
6397: \def\startcontents#1{%
6398: % If @setchapternewpage on, and @headings double, the contents should
6399: % start on an odd page, unlike chapters. Thus, we maintain
6400: % \contentsalignmacro in parallel with \pagealignmacro.
6401: % From: Torbjorn Granlund <tege@matematik.su.se>
6402: \contentsalignmacro
6403: \immediate\closeout\tocfile
6404: %
6405: % Don't need to put `Contents' or `Short Contents' in the headline.
6406: % It is abundantly clear what they are.
6407: \chapmacro{#1}{Yomitfromtoc}{}%
6408: %
6409: \savepageno = \pageno
6410: \begingroup % Set up to handle contents files properly.
6411: \raggedbottom % Worry more about breakpoints than the bottom.
1.1.1.2 ! misho 6412: \entryrightmargin=\contentsrightmargin % Don't use the full line length.
1.1 misho 6413: %
6414: % Roman numerals for page numbers.
6415: \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
6416: }
6417:
6418: % redefined for the two-volume lispref. We always output on
6419: % \jobname.toc even if this is redefined.
6420: %
6421: \def\tocreadfilename{\jobname.toc}
6422:
6423: % Normal (long) toc.
6424: %
6425: \def\contents{%
6426: \startcontents{\putwordTOC}%
6427: \openin 1 \tocreadfilename\space
6428: \ifeof 1 \else
6429: \readtocfile
6430: \fi
6431: \vfill \eject
6432: \contentsalignmacro % in case @setchapternewpage odd is in effect
6433: \ifeof 1 \else
6434: \pdfmakeoutlines
6435: \fi
6436: \closein 1
6437: \endgroup
6438: \lastnegativepageno = \pageno
6439: \global\pageno = \savepageno
6440: }
6441:
6442: % And just the chapters.
6443: \def\summarycontents{%
6444: \startcontents{\putwordShortTOC}%
6445: %
6446: \let\partentry = \shortpartentry
6447: \let\numchapentry = \shortchapentry
6448: \let\appentry = \shortchapentry
6449: \let\unnchapentry = \shortunnchapentry
6450: % We want a true roman here for the page numbers.
6451: \secfonts
6452: \let\rm=\shortcontrm \let\bf=\shortcontbf
6453: \let\sl=\shortcontsl \let\tt=\shortconttt
6454: \rm
6455: \hyphenpenalty = 10000
6456: \advance\baselineskip by 1pt % Open it up a little.
6457: \def\numsecentry##1##2##3##4{}
6458: \let\appsecentry = \numsecentry
6459: \let\unnsecentry = \numsecentry
6460: \let\numsubsecentry = \numsecentry
6461: \let\appsubsecentry = \numsecentry
6462: \let\unnsubsecentry = \numsecentry
6463: \let\numsubsubsecentry = \numsecentry
6464: \let\appsubsubsecentry = \numsecentry
6465: \let\unnsubsubsecentry = \numsecentry
6466: \openin 1 \tocreadfilename\space
6467: \ifeof 1 \else
6468: \readtocfile
6469: \fi
6470: \closein 1
6471: \vfill \eject
6472: \contentsalignmacro % in case @setchapternewpage odd is in effect
6473: \endgroup
6474: \lastnegativepageno = \pageno
6475: \global\pageno = \savepageno
6476: }
6477: \let\shortcontents = \summarycontents
6478:
6479: % Typeset the label for a chapter or appendix for the short contents.
6480: % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
6481: %
6482: \def\shortchaplabel#1{%
6483: % This space should be enough, since a single number is .5em, and the
6484: % widest letter (M) is 1em, at least in the Computer Modern fonts.
6485: % But use \hss just in case.
6486: % (This space doesn't include the extra space that gets added after
6487: % the label; that gets put in by \shortchapentry above.)
6488: %
6489: % We'd like to right-justify chapter numbers, but that looks strange
6490: % with appendix letters. And right-justifying numbers and
6491: % left-justifying letters looks strange when there is less than 10
6492: % chapters. Have to read the whole toc once to know how many chapters
6493: % there are before deciding ...
6494: \hbox to 1em{#1\hss}%
6495: }
6496:
6497: % These macros generate individual entries in the table of contents.
6498: % The first argument is the chapter or section name.
6499: % The last argument is the page number.
6500: % The arguments in between are the chapter number, section number, ...
6501:
6502: % Parts, in the main contents. Replace the part number, which doesn't
6503: % exist, with an empty box. Let's hope all the numbers have the same width.
6504: % Also ignore the page number, which is conventionally not printed.
6505: \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6506: \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6507: %
6508: % Parts, in the short toc.
6509: \def\shortpartentry#1#2#3#4{%
6510: \penalty-300
6511: \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6512: \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6513: }
6514:
6515: % Chapters, in the main contents.
6516: \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
1.1.1.2 ! misho 6517:
1.1 misho 6518: % Chapters, in the short toc.
6519: % See comments in \dochapentry re vbox and related settings.
6520: \def\shortchapentry#1#2#3#4{%
6521: \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
6522: }
6523:
6524: % Appendices, in the main contents.
6525: % Need the word Appendix, and a fixed-size box.
6526: %
6527: \def\appendixbox#1{%
6528: % We use M since it's probably the widest letter.
6529: \setbox0 = \hbox{\putwordAppendix{} M}%
6530: \hbox to \wd0{\putwordAppendix{} #1\hss}}
6531: %
1.1.1.2 ! misho 6532: \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
1.1 misho 6533:
6534: % Unnumbered chapters.
6535: \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
6536: \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
6537:
6538: % Sections.
6539: \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
6540: \let\appsecentry=\numsecentry
6541: \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
6542:
6543: % Subsections.
6544: \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
6545: \let\appsubsecentry=\numsubsecentry
6546: \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
6547:
6548: % And subsubsections.
6549: \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
6550: \let\appsubsubsecentry=\numsubsubsecentry
6551: \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
6552:
6553: % This parameter controls the indentation of the various levels.
6554: % Same as \defaultparindent.
6555: \newdimen\tocindent \tocindent = 15pt
6556:
6557: % Now for the actual typesetting. In all these, #1 is the text and #2 is the
6558: % page number.
6559: %
6560: % If the toc has to be broken over pages, we want it to be at chapters
6561: % if at all possible; hence the \penalty.
6562: \def\dochapentry#1#2{%
6563: \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
6564: \begingroup
1.1.1.2 ! misho 6565: % Move the page numbers slightly to the right
! 6566: \advance\entryrightmargin by -0.05em
1.1 misho 6567: \chapentryfonts
6568: \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6569: \endgroup
6570: \nobreak\vskip .25\baselineskip plus.1\baselineskip
6571: }
6572:
6573: \def\dosecentry#1#2{\begingroup
6574: \secentryfonts \leftskip=\tocindent
6575: \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6576: \endgroup}
6577:
6578: \def\dosubsecentry#1#2{\begingroup
6579: \subsecentryfonts \leftskip=2\tocindent
6580: \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6581: \endgroup}
6582:
6583: \def\dosubsubsecentry#1#2{\begingroup
6584: \subsubsecentryfonts \leftskip=3\tocindent
6585: \tocentry{#1}{\dopageno\bgroup#2\egroup}%
6586: \endgroup}
6587:
6588: % We use the same \entry macro as for the index entries.
6589: \let\tocentry = \entry
6590:
6591: % Space between chapter (or whatever) number and the title.
6592: \def\labelspace{\hskip1em \relax}
6593:
6594: \def\dopageno#1{{\rm #1}}
6595: \def\doshortpageno#1{{\rm #1}}
6596:
6597: \def\chapentryfonts{\secfonts \rm}
6598: \def\secentryfonts{\textfonts}
6599: \def\subsecentryfonts{\textfonts}
6600: \def\subsubsecentryfonts{\textfonts}
6601:
6602:
6603: \message{environments,}
6604: % @foo ... @end foo.
6605:
6606: % @tex ... @end tex escapes into raw TeX temporarily.
6607: % One exception: @ is still an escape character, so that @end tex works.
6608: % But \@ or @@ will get a plain @ character.
6609:
6610: \envdef\tex{%
6611: \setupmarkupstyle{tex}%
6612: \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
6613: \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
6614: \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
6615: \catcode `\%=14
6616: \catcode `\+=\other
6617: \catcode `\"=\other
6618: \catcode `\|=\other
6619: \catcode `\<=\other
6620: \catcode `\>=\other
6621: \catcode `\`=\other
6622: \catcode `\'=\other
6623: \escapechar=`\\
6624: %
6625: % ' is active in math mode (mathcode"8000). So reset it, and all our
6626: % other math active characters (just in case), to plain's definitions.
6627: \mathactive
6628: %
1.1.1.2 ! misho 6629: % Inverse of the list at the beginning of the file.
1.1 misho 6630: \let\b=\ptexb
6631: \let\bullet=\ptexbullet
6632: \let\c=\ptexc
6633: \let\,=\ptexcomma
6634: \let\.=\ptexdot
6635: \let\dots=\ptexdots
6636: \let\equiv=\ptexequiv
6637: \let\!=\ptexexclam
6638: \let\i=\ptexi
6639: \let\indent=\ptexindent
6640: \let\noindent=\ptexnoindent
6641: \let\{=\ptexlbrace
6642: \let\+=\tabalign
6643: \let\}=\ptexrbrace
6644: \let\/=\ptexslash
1.1.1.2 ! misho 6645: \let\sp=\ptexsp
1.1 misho 6646: \let\*=\ptexstar
1.1.1.2 ! misho 6647: %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
1.1 misho 6648: \let\t=\ptext
6649: \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
6650: \let\frenchspacing=\plainfrenchspacing
6651: %
6652: \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
6653: \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
6654: \def\@{@}%
6655: }
6656: % There is no need to define \Etex.
6657:
6658: % Define @lisp ... @end lisp.
6659: % @lisp environment forms a group so it can rebind things,
6660: % including the definition of @end lisp (which normally is erroneous).
6661:
6662: % Amount to narrow the margins by for @lisp.
6663: \newskip\lispnarrowing \lispnarrowing=0.4in
6664:
6665: % This is the definition that ^^M gets inside @lisp, @example, and other
6666: % such environments. \null is better than a space, since it doesn't
6667: % have any width.
6668: \def\lisppar{\null\endgraf}
6669:
6670: % This space is always present above and below environments.
6671: \newskip\envskipamount \envskipamount = 0pt
6672:
6673: % Make spacing and below environment symmetrical. We use \parskip here
6674: % to help in doing that, since in @example-like environments \parskip
6675: % is reset to zero; thus the \afterenvbreak inserts no space -- but the
6676: % start of the next paragraph will insert \parskip.
6677: %
6678: \def\aboveenvbreak{{%
6679: % =10000 instead of <10000 because of a special case in \itemzzz and
6680: % \sectionheading, q.v.
6681: \ifnum \lastpenalty=10000 \else
6682: \advance\envskipamount by \parskip
6683: \endgraf
6684: \ifdim\lastskip<\envskipamount
6685: \removelastskip
1.1.1.2 ! misho 6686: \ifnum\lastpenalty<10000
! 6687: % Penalize breaking before the environment, because preceding text
! 6688: % often leads into it.
! 6689: \penalty100
! 6690: \fi
! 6691: \vskip\envskipamount
! 6692: \fi
! 6693: \fi
! 6694: }}
! 6695:
! 6696: \def\afterenvbreak{{%
! 6697: % =10000 instead of <10000 because of a special case in \itemzzz and
! 6698: % \sectionheading, q.v.
! 6699: \ifnum \lastpenalty=10000 \else
! 6700: \advance\envskipamount by \parskip
! 6701: \endgraf
! 6702: \ifdim\lastskip<\envskipamount
! 6703: \removelastskip
1.1 misho 6704: % it's not a good place to break if the last penalty was \nobreak
6705: % or better ...
6706: \ifnum\lastpenalty<10000 \penalty-50 \fi
6707: \vskip\envskipamount
6708: \fi
6709: \fi
6710: }}
6711:
6712: % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
6713: % also clear it, so that its embedded environments do the narrowing again.
6714: \let\nonarrowing=\relax
6715:
6716: % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
6717: % environment contents.
6718: \font\circle=lcircle10
6719: \newdimen\circthick
6720: \newdimen\cartouter\newdimen\cartinner
6721: \newskip\normbskip\newskip\normpskip\newskip\normlskip
6722: \circthick=\fontdimen8\circle
6723: %
6724: \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
6725: \def\ctr{{\hskip 6pt\circle\char'010}}
6726: \def\cbl{{\circle\char'012\hskip -6pt}}
6727: \def\cbr{{\hskip 6pt\circle\char'011}}
6728: \def\carttop{\hbox to \cartouter{\hskip\lskip
6729: \ctl\leaders\hrule height\circthick\hfil\ctr
6730: \hskip\rskip}}
6731: \def\cartbot{\hbox to \cartouter{\hskip\lskip
6732: \cbl\leaders\hrule height\circthick\hfil\cbr
6733: \hskip\rskip}}
6734: %
6735: \newskip\lskip\newskip\rskip
6736:
6737: \envdef\cartouche{%
6738: \ifhmode\par\fi % can't be in the midst of a paragraph.
6739: \startsavinginserts
6740: \lskip=\leftskip \rskip=\rightskip
6741: \leftskip=0pt\rightskip=0pt % we want these *outside*.
6742: \cartinner=\hsize \advance\cartinner by-\lskip
6743: \advance\cartinner by-\rskip
6744: \cartouter=\hsize
6745: \advance\cartouter by 18.4pt % allow for 3pt kerns on either
6746: % side, and for 6pt waste from
6747: % each corner char, and rule thickness
6748: \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
6749: %
6750: % If this cartouche directly follows a sectioning command, we need the
6751: % \parskip glue (backspaced over by default) or the cartouche can
6752: % collide with the section heading.
6753: \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
6754: %
1.1.1.2 ! misho 6755: \setbox\groupbox=\vbox\bgroup
1.1 misho 6756: \baselineskip=0pt\parskip=0pt\lineskip=0pt
6757: \carttop
6758: \hbox\bgroup
6759: \hskip\lskip
6760: \vrule\kern3pt
6761: \vbox\bgroup
6762: \kern3pt
6763: \hsize=\cartinner
6764: \baselineskip=\normbskip
6765: \lineskip=\normlskip
6766: \parskip=\normpskip
6767: \vskip -\parskip
6768: \comment % For explanation, see the end of def\group.
6769: }
6770: \def\Ecartouche{%
6771: \ifhmode\par\fi
6772: \kern3pt
6773: \egroup
6774: \kern3pt\vrule
6775: \hskip\rskip
6776: \egroup
6777: \cartbot
6778: \egroup
1.1.1.2 ! misho 6779: \addgroupbox
1.1 misho 6780: \checkinserts
6781: }
6782:
6783:
6784: % This macro is called at the beginning of all the @example variants,
6785: % inside a group.
6786: \newdimen\nonfillparindent
6787: \def\nonfillstart{%
6788: \aboveenvbreak
6789: \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
6790: \sepspaces % Make spaces be word-separators rather than space tokens.
6791: \let\par = \lisppar % don't ignore blank lines
6792: \obeylines % each line of input is a line of output
6793: \parskip = 0pt
6794: % Turn off paragraph indentation but redefine \indent to emulate
6795: % the normal \indent.
6796: \nonfillparindent=\parindent
6797: \parindent = 0pt
6798: \let\indent\nonfillindent
6799: %
6800: \emergencystretch = 0pt % don't try to avoid overfull boxes
6801: \ifx\nonarrowing\relax
6802: \advance \leftskip by \lispnarrowing
6803: \exdentamount=\lispnarrowing
6804: \else
6805: \let\nonarrowing = \relax
6806: \fi
6807: \let\exdent=\nofillexdent
6808: }
6809:
6810: \begingroup
6811: \obeyspaces
6812: % We want to swallow spaces (but not other tokens) after the fake
6813: % @indent in our nonfill-environments, where spaces are normally
6814: % active and set to @tie, resulting in them not being ignored after
6815: % @indent.
6816: \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
6817: \gdef\nonfillindentcheck{%
6818: \ifx\temp %
6819: \expandafter\nonfillindentgobble%
6820: \else%
6821: \leavevmode\nonfillindentbox%
6822: \fi%
6823: }%
6824: \endgroup
6825: \def\nonfillindentgobble#1{\nonfillindent}
6826: \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
6827:
6828: % If you want all examples etc. small: @set dispenvsize small.
6829: % If you want even small examples the full size: @set dispenvsize nosmall.
6830: % This affects the following displayed environments:
6831: % @example, @display, @format, @lisp
6832: %
6833: \def\smallword{small}
6834: \def\nosmallword{nosmall}
6835: \let\SETdispenvsize\relax
6836: \def\setnormaldispenv{%
6837: \ifx\SETdispenvsize\smallword
6838: % end paragraph for sake of leading, in case document has no blank
6839: % line. This is redundant with what happens in \aboveenvbreak, but
6840: % we need to do it before changing the fonts, and it's inconvenient
6841: % to change the fonts afterward.
6842: \ifnum \lastpenalty=10000 \else \endgraf \fi
6843: \smallexamplefonts \rm
6844: \fi
6845: }
6846: \def\setsmalldispenv{%
6847: \ifx\SETdispenvsize\nosmallword
6848: \else
6849: \ifnum \lastpenalty=10000 \else \endgraf \fi
6850: \smallexamplefonts \rm
6851: \fi
6852: }
6853:
6854: % We often define two environments, @foo and @smallfoo.
6855: % Let's do it in one command. #1 is the env name, #2 the definition.
6856: \def\makedispenvdef#1#2{%
6857: \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
6858: \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
6859: \expandafter\let\csname E#1\endcsname \afterenvbreak
6860: \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
6861: }
6862:
6863: % Define two environment synonyms (#1 and #2) for an environment.
6864: \def\maketwodispenvdef#1#2#3{%
6865: \makedispenvdef{#1}{#3}%
6866: \makedispenvdef{#2}{#3}%
6867: }
6868: %
6869: % @lisp: indented, narrowed, typewriter font;
6870: % @example: same as @lisp.
6871: %
6872: % @smallexample and @smalllisp: use smaller fonts.
6873: % Originally contributed by Pavel@xerox.
6874: %
6875: \maketwodispenvdef{lisp}{example}{%
6876: \nonfillstart
6877: \tt\setupmarkupstyle{example}%
6878: \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
6879: \gobble % eat return
6880: }
6881: % @display/@smalldisplay: same as @lisp except keep current font.
6882: %
6883: \makedispenvdef{display}{%
6884: \nonfillstart
6885: \gobble
6886: }
6887:
6888: % @format/@smallformat: same as @display except don't narrow margins.
6889: %
6890: \makedispenvdef{format}{%
6891: \let\nonarrowing = t%
6892: \nonfillstart
6893: \gobble
6894: }
6895:
6896: % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
6897: \envdef\flushleft{%
6898: \let\nonarrowing = t%
6899: \nonfillstart
6900: \gobble
6901: }
6902: \let\Eflushleft = \afterenvbreak
6903:
6904: % @flushright.
6905: %
6906: \envdef\flushright{%
6907: \let\nonarrowing = t%
6908: \nonfillstart
6909: \advance\leftskip by 0pt plus 1fill\relax
6910: \gobble
6911: }
6912: \let\Eflushright = \afterenvbreak
6913:
6914:
6915: % @raggedright does more-or-less normal line breaking but no right
1.1.1.2 ! misho 6916: % justification. From plain.tex. Don't stretch around special
! 6917: % characters in urls in this environment, since the stretch at the right
! 6918: % should be enough.
1.1 misho 6919: \envdef\raggedright{%
1.1.1.2 ! misho 6920: \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
! 6921: \def\urefprestretchamount{0pt}%
! 6922: \def\urefpoststretchamount{0pt}%
1.1 misho 6923: }
6924: \let\Eraggedright\par
6925:
6926: \envdef\raggedleft{%
6927: \parindent=0pt \leftskip0pt plus2em
6928: \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6929: \hbadness=10000 % Last line will usually be underfull, so turn off
6930: % badness reporting.
6931: }
6932: \let\Eraggedleft\par
6933:
6934: \envdef\raggedcenter{%
6935: \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
6936: \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
6937: \hbadness=10000 % Last line will usually be underfull, so turn off
6938: % badness reporting.
6939: }
6940: \let\Eraggedcenter\par
6941:
6942:
6943: % @quotation does normal linebreaking (hence we can't use \nonfillstart)
6944: % and narrows the margins. We keep \parskip nonzero in general, since
6945: % we're doing normal filling. So, when using \aboveenvbreak and
6946: % \afterenvbreak, temporarily make \parskip 0.
6947: %
6948: \makedispenvdef{quotation}{\quotationstart}
6949: %
6950: \def\quotationstart{%
6951: \indentedblockstart % same as \indentedblock, but increase right margin too.
6952: \ifx\nonarrowing\relax
6953: \advance\rightskip by \lispnarrowing
6954: \fi
6955: \parsearg\quotationlabel
6956: }
6957:
6958: % We have retained a nonzero parskip for the environment, since we're
6959: % doing normal filling.
6960: %
6961: \def\Equotation{%
6962: \par
6963: \ifx\quotationauthor\thisisundefined\else
6964: % indent a bit.
6965: \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
6966: \fi
6967: {\parskip=0pt \afterenvbreak}%
6968: }
6969: \def\Esmallquotation{\Equotation}
6970:
6971: % If we're given an argument, typeset it in bold with a colon after.
6972: \def\quotationlabel#1{%
6973: \def\temp{#1}%
6974: \ifx\temp\empty \else
6975: {\bf #1: }%
6976: \fi
6977: }
6978:
6979: % @indentedblock is like @quotation, but indents only on the left and
6980: % has no optional argument.
6981: %
6982: \makedispenvdef{indentedblock}{\indentedblockstart}
6983: %
6984: \def\indentedblockstart{%
6985: {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
6986: \parindent=0pt
6987: %
6988: % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
6989: \ifx\nonarrowing\relax
6990: \advance\leftskip by \lispnarrowing
6991: \exdentamount = \lispnarrowing
6992: \else
6993: \let\nonarrowing = \relax
6994: \fi
6995: }
6996:
6997: % Keep a nonzero parskip for the environment, since we're doing normal filling.
6998: %
6999: \def\Eindentedblock{%
7000: \par
7001: {\parskip=0pt \afterenvbreak}%
7002: }
7003: \def\Esmallindentedblock{\Eindentedblock}
7004:
7005:
7006: % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
7007: % If we want to allow any <char> as delimiter,
7008: % we need the curly braces so that makeinfo sees the @verb command, eg:
7009: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
7010: %
7011: % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
7012: %
7013: % [Knuth] p.344; only we need to do the other characters Texinfo sets
7014: % active too. Otherwise, they get lost as the first character on a
7015: % verbatim line.
7016: \def\dospecials{%
7017: \do\ \do\\\do\{\do\}\do\$\do\&%
7018: \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
7019: \do\<\do\>\do\|\do\@\do+\do\"%
7020: % Don't do the quotes -- if we do, @set txicodequoteundirected and
7021: % @set txicodequotebacktick will not have effect on @verb and
7022: % @verbatim, and ?` and !` ligatures won't get disabled.
7023: %\do\`\do\'%
7024: }
7025: %
7026: % [Knuth] p. 380
7027: \def\uncatcodespecials{%
7028: \def\do##1{\catcode`##1=\other}\dospecials}
7029: %
7030: % Setup for the @verb command.
7031: %
7032: % Eight spaces for a tab
7033: \begingroup
7034: \catcode`\^^I=\active
7035: \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
7036: \endgroup
7037: %
7038: \def\setupverb{%
7039: \tt % easiest (and conventionally used) font for verbatim
7040: \def\par{\leavevmode\endgraf}%
7041: \setupmarkupstyle{verb}%
7042: \tabeightspaces
7043: % Respect line breaks,
7044: % print special symbols as themselves, and
7045: % make each space count
7046: % must do in this order:
7047: \obeylines \uncatcodespecials \sepspaces
7048: }
7049:
7050: % Setup for the @verbatim environment
7051: %
7052: % Real tab expansion.
7053: \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
7054: %
7055: % We typeset each line of the verbatim in an \hbox, so we can handle
7056: % tabs. The \global is in case the verbatim line starts with an accent,
7057: % or some other command that starts with a begin-group. Otherwise, the
7058: % entire \verbbox would disappear at the corresponding end-group, before
7059: % it is typeset. Meanwhile, we can't have nested verbatim commands
7060: % (can we?), so the \global won't be overwriting itself.
7061: \newbox\verbbox
7062: \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
7063: %
7064: \begingroup
7065: \catcode`\^^I=\active
7066: \gdef\tabexpand{%
7067: \catcode`\^^I=\active
7068: \def^^I{\leavevmode\egroup
7069: \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
7070: \divide\dimen\verbbox by\tabw
7071: \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
7072: \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
7073: \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
7074: }%
7075: }
7076: \endgroup
7077:
7078: % start the verbatim environment.
7079: \def\setupverbatim{%
7080: \let\nonarrowing = t%
7081: \nonfillstart
7082: \tt % easiest (and conventionally used) font for verbatim
7083: % The \leavevmode here is for blank lines. Otherwise, we would
7084: % never \starttabox and the \egroup would end verbatim mode.
7085: \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
7086: \tabexpand
7087: \setupmarkupstyle{verbatim}%
7088: % Respect line breaks,
7089: % print special symbols as themselves, and
7090: % make each space count.
7091: % Must do in this order:
7092: \obeylines \uncatcodespecials \sepspaces
7093: \everypar{\starttabbox}%
7094: }
7095:
7096: % Do the @verb magic: verbatim text is quoted by unique
7097: % delimiter characters. Before first delimiter expect a
7098: % right brace, after last delimiter expect closing brace:
7099: %
7100: % \def\doverb'{'<char>#1<char>'}'{#1}
7101: %
7102: % [Knuth] p. 382; only eat outer {}
7103: \begingroup
7104: \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
7105: \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
7106: \endgroup
7107: %
7108: \def\verb{\begingroup\setupverb\doverb}
7109: %
7110: %
7111: % Do the @verbatim magic: define the macro \doverbatim so that
7112: % the (first) argument ends when '@end verbatim' is reached, ie:
7113: %
7114: % \def\doverbatim#1@end verbatim{#1}
7115: %
7116: % For Texinfo it's a lot easier than for LaTeX,
7117: % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
7118: % we need not redefine '\', '{' and '}'.
7119: %
7120: % Inspired by LaTeX's verbatim command set [latex.ltx]
7121: %
7122: \begingroup
7123: \catcode`\ =\active
7124: \obeylines %
7125: % ignore everything up to the first ^^M, that's the newline at the end
7126: % of the @verbatim input line itself. Otherwise we get an extra blank
7127: % line in the output.
7128: \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
7129: % We really want {...\end verbatim} in the body of the macro, but
7130: % without the active space; thus we have to use \xdef and \gobble.
7131: \endgroup
7132: %
7133: \envdef\verbatim{%
7134: \setupverbatim\doverbatim
7135: }
7136: \let\Everbatim = \afterenvbreak
7137:
7138:
7139: % @verbatiminclude FILE - insert text of file in verbatim environment.
7140: %
7141: \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
7142: %
7143: \def\doverbatiminclude#1{%
7144: {%
7145: \makevalueexpandable
7146: \setupverbatim
7147: \indexnofonts % Allow `@@' and other weird things in file names.
7148: \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
7149: \input #1
7150: \afterenvbreak
7151: }%
7152: }
7153:
7154: % @copying ... @end copying.
7155: % Save the text away for @insertcopying later.
7156: %
7157: % We save the uninterpreted tokens, rather than creating a box.
7158: % Saving the text in a box would be much easier, but then all the
7159: % typesetting commands (@smallbook, font changes, etc.) have to be done
7160: % beforehand -- and a) we want @copying to be done first in the source
7161: % file; b) letting users define the frontmatter in as flexible order as
1.1.1.2 ! misho 7162: % possible is desirable.
1.1 misho 7163: %
7164: \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
7165: \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
7166: %
7167: \def\insertcopying{%
7168: \begingroup
7169: \parindent = 0pt % paragraph indentation looks wrong on title page
7170: \scanexp\copyingtext
7171: \endgroup
7172: }
7173:
7174:
7175: \message{defuns,}
7176: % @defun etc.
7177:
7178: \newskip\defbodyindent \defbodyindent=.4in
7179: \newskip\defargsindent \defargsindent=50pt
7180: \newskip\deflastargmargin \deflastargmargin=18pt
7181: \newcount\defunpenalty
7182:
7183: % Start the processing of @deffn:
7184: \def\startdefun{%
7185: \ifnum\lastpenalty<10000
7186: \medbreak
7187: \defunpenalty=10003 % Will keep this @deffn together with the
7188: % following @def command, see below.
7189: \else
7190: % If there are two @def commands in a row, we'll have a \nobreak,
7191: % which is there to keep the function description together with its
7192: % header. But if there's nothing but headers, we need to allow a
7193: % break somewhere. Check specifically for penalty 10002, inserted
7194: % by \printdefunline, instead of 10000, since the sectioning
7195: % commands also insert a nobreak penalty, and we don't want to allow
7196: % a break between a section heading and a defun.
7197: %
7198: % As a further refinement, we avoid "club" headers by signalling
7199: % with penalty of 10003 after the very first @deffn in the
7200: % sequence (see above), and penalty of 10002 after any following
7201: % @def command.
7202: \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
7203: %
7204: % Similarly, after a section heading, do not allow a break.
7205: % But do insert the glue.
7206: \medskip % preceded by discardable penalty, so not a breakpoint
7207: \fi
7208: %
7209: \parindent=0in
7210: \advance\leftskip by \defbodyindent
7211: \exdentamount=\defbodyindent
7212: }
7213:
7214: \def\dodefunx#1{%
7215: % First, check whether we are in the right environment:
7216: \checkenv#1%
7217: %
7218: % As above, allow line break if we have multiple x headers in a row.
7219: % It's not a great place, though.
7220: \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
7221: %
7222: % And now, it's time to reuse the body of the original defun:
7223: \expandafter\gobbledefun#1%
7224: }
7225: \def\gobbledefun#1\startdefun{}
7226:
7227: % \printdefunline \deffnheader{text}
7228: %
7229: \def\printdefunline#1#2{%
7230: \begingroup
7231: % call \deffnheader:
7232: #1#2 \endheader
7233: % common ending:
7234: \interlinepenalty = 10000
7235: \advance\rightskip by 0pt plus 1fil\relax
7236: \endgraf
7237: \nobreak\vskip -\parskip
7238: \penalty\defunpenalty % signal to \startdefun and \dodefunx
7239: % Some of the @defun-type tags do not enable magic parentheses,
7240: % rendering the following check redundant. But we don't optimize.
7241: \checkparencounts
7242: \endgroup
7243: }
7244:
7245: \def\Edefun{\endgraf\medbreak}
7246:
7247: % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
7248: % the only thing remaining is to define \deffnheader.
7249: %
7250: \def\makedefun#1{%
7251: \expandafter\let\csname E#1\endcsname = \Edefun
7252: \edef\temp{\noexpand\domakedefun
7253: \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
7254: \temp
7255: }
7256:
1.1.1.2 ! misho 7257: % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
1.1 misho 7258: %
7259: % Define \deffn and \deffnx, without parameters.
7260: % \deffnheader has to be defined explicitly.
7261: %
7262: \def\domakedefun#1#2#3{%
7263: \envdef#1{%
7264: \startdefun
7265: \doingtypefnfalse % distinguish typed functions from all else
7266: \parseargusing\activeparens{\printdefunline#3}%
7267: }%
7268: \def#2{\dodefunx#1}%
7269: \def#3%
7270: }
7271:
7272: \newif\ifdoingtypefn % doing typed function?
7273: \newif\ifrettypeownline % typeset return type on its own line?
7274:
7275: % @deftypefnnewline on|off says whether the return type of typed functions
7276: % are printed on their own line. This affects @deftypefn, @deftypefun,
7277: % @deftypeop, and @deftypemethod.
7278: %
7279: \parseargdef\deftypefnnewline{%
7280: \def\temp{#1}%
7281: \ifx\temp\onword
7282: \expandafter\let\csname SETtxideftypefnnl\endcsname
7283: = \empty
7284: \else\ifx\temp\offword
7285: \expandafter\let\csname SETtxideftypefnnl\endcsname
7286: = \relax
7287: \else
7288: \errhelp = \EMsimple
7289: \errmessage{Unknown @txideftypefnnl value `\temp',
7290: must be on|off}%
7291: \fi\fi
7292: }
7293:
7294: % Untyped functions:
7295:
7296: % @deffn category name args
7297: \makedefun{deffn}{\deffngeneral{}}
7298:
7299: % @deffn category class name args
7300: \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
7301:
7302: % \defopon {category on}class name args
7303: \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7304:
7305: % \deffngeneral {subind}category name args
7306: %
7307: \def\deffngeneral#1#2 #3 #4\endheader{%
7308: % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
7309: \dosubind{fn}{\code{#3}}{#1}%
7310: \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
7311: }
7312:
7313: % Typed functions:
7314:
7315: % @deftypefn category type name args
7316: \makedefun{deftypefn}{\deftypefngeneral{}}
7317:
7318: % @deftypeop category class type name args
7319: \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
7320:
7321: % \deftypeopon {category on}class type name args
7322: \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
7323:
7324: % \deftypefngeneral {subind}category type name args
7325: %
7326: \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
7327: \dosubind{fn}{\code{#4}}{#1}%
7328: \doingtypefntrue
7329: \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7330: }
7331:
7332: % Typed variables:
7333:
7334: % @deftypevr category type var args
7335: \makedefun{deftypevr}{\deftypecvgeneral{}}
7336:
7337: % @deftypecv category class type var args
7338: \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
7339:
7340: % \deftypecvof {category of}class type var args
7341: \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
7342:
7343: % \deftypecvgeneral {subind}category type var args
7344: %
7345: \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
7346: \dosubind{vr}{\code{#4}}{#1}%
7347: \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
7348: }
7349:
7350: % Untyped variables:
7351:
7352: % @defvr category var args
7353: \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
7354:
7355: % @defcv category class var args
7356: \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
7357:
7358: % \defcvof {category of}class var args
7359: \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
7360:
7361: % Types:
7362:
7363: % @deftp category name args
7364: \makedefun{deftp}#1 #2 #3\endheader{%
7365: \doind{tp}{\code{#2}}%
7366: \defname{#1}{}{#2}\defunargs{#3\unskip}%
7367: }
7368:
7369: % Remaining @defun-like shortcuts:
7370: \makedefun{defun}{\deffnheader{\putwordDeffunc} }
7371: \makedefun{defmac}{\deffnheader{\putwordDefmac} }
7372: \makedefun{defspec}{\deffnheader{\putwordDefspec} }
7373: \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
7374: \makedefun{defvar}{\defvrheader{\putwordDefvar} }
7375: \makedefun{defopt}{\defvrheader{\putwordDefopt} }
7376: \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
7377: \makedefun{defmethod}{\defopon\putwordMethodon}
7378: \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
7379: \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
7380: \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
7381:
7382: % \defname, which formats the name of the @def (not the args).
7383: % #1 is the category, such as "Function".
7384: % #2 is the return type, if any.
7385: % #3 is the function name.
7386: %
7387: % We are followed by (but not passed) the arguments, if any.
7388: %
7389: \def\defname#1#2#3{%
7390: \par
7391: % Get the values of \leftskip and \rightskip as they were outside the @def...
7392: \advance\leftskip by -\defbodyindent
7393: %
7394: % Determine if we are typesetting the return type of a typed function
7395: % on a line by itself.
7396: \rettypeownlinefalse
7397: \ifdoingtypefn % doing a typed function specifically?
7398: % then check user option for putting return type on its own line:
7399: \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
7400: \rettypeownlinetrue
7401: \fi
7402: \fi
7403: %
7404: % How we'll format the category name. Putting it in brackets helps
7405: % distinguish it from the body text that may end up on the next line
7406: % just below it.
7407: \def\temp{#1}%
7408: \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
7409: %
7410: % Figure out line sizes for the paragraph shape. We'll always have at
7411: % least two.
7412: \tempnum = 2
7413: %
7414: % The first line needs space for \box0; but if \rightskip is nonzero,
7415: % we need only space for the part of \box0 which exceeds it:
7416: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
7417: %
7418: % If doing a return type on its own line, we'll have another line.
7419: \ifrettypeownline
7420: \advance\tempnum by 1
7421: \def\maybeshapeline{0in \hsize}%
7422: \else
7423: \def\maybeshapeline{}%
7424: \fi
7425: %
7426: % The continuations:
7427: \dimen2=\hsize \advance\dimen2 by -\defargsindent
7428: %
7429: % The final paragraph shape:
7430: \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
7431: %
7432: % Put the category name at the right margin.
7433: \noindent
7434: \hbox to 0pt{%
7435: \hfil\box0 \kern-\hsize
7436: % \hsize has to be shortened this way:
7437: \kern\leftskip
7438: % Intentionally do not respect \rightskip, since we need the space.
7439: }%
7440: %
7441: % Allow all lines to be underfull without complaint:
7442: \tolerance=10000 \hbadness=10000
7443: \exdentamount=\defbodyindent
7444: {%
7445: % defun fonts. We use typewriter by default (used to be bold) because:
7446: % . we're printing identifiers, they should be in tt in principle.
7447: % . in languages with many accents, such as Czech or French, it's
7448: % common to leave accents off identifiers. The result looks ok in
7449: % tt, but exceedingly strange in rm.
7450: % . we don't want -- and --- to be treated as ligatures.
7451: % . this still does not fix the ?` and !` ligatures, but so far no
7452: % one has made identifiers using them :).
7453: \df \tt
7454: \def\temp{#2}% text of the return type
7455: \ifx\temp\empty\else
7456: \tclose{\temp}% typeset the return type
7457: \ifrettypeownline
7458: % put return type on its own line; prohibit line break following:
7459: \hfil\vadjust{\nobreak}\break
7460: \else
7461: \space % type on same line, so just followed by a space
7462: \fi
7463: \fi % no return type
7464: #3% output function name
7465: }%
7466: {\rm\enskip}% hskip 0.5 em of \tenrm
7467: %
7468: \boldbrax
7469: % arguments will be output next, if any.
7470: }
7471:
7472: % Print arguments in slanted roman (not ttsl), inconsistently with using
7473: % tt for the name. This is because literal text is sometimes needed in
7474: % the argument list (groff manual), and ttsl and tt are not very
7475: % distinguishable. Prevent hyphenation at `-' chars.
7476: %
7477: \def\defunargs#1{%
7478: % use sl by default (not ttsl),
7479: % tt for the names.
7480: \df \sl \hyphenchar\font=0
7481: %
7482: % On the other hand, if an argument has two dashes (for instance), we
7483: % want a way to get ttsl. We used to recommend @var for that, so
7484: % leave the code in, but it's strange for @var to lead to typewriter.
7485: % Nowadays we recommend @code, since the difference between a ttsl hyphen
7486: % and a tt hyphen is pretty tiny. @code also disables ?` !`.
7487: \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
7488: #1%
7489: \sl\hyphenchar\font=45
7490: }
7491:
7492: % We want ()&[] to print specially on the defun line.
7493: %
7494: \def\activeparens{%
7495: \catcode`\(=\active \catcode`\)=\active
7496: \catcode`\[=\active \catcode`\]=\active
7497: \catcode`\&=\active
7498: }
7499:
7500: % Make control sequences which act like normal parenthesis chars.
7501: \let\lparen = ( \let\rparen = )
7502:
7503: % Be sure that we always have a definition for `(', etc. For example,
7504: % if the fn name has parens in it, \boldbrax will not be in effect yet,
7505: % so TeX would otherwise complain about undefined control sequence.
7506: {
7507: \activeparens
7508: \global\let(=\lparen \global\let)=\rparen
7509: \global\let[=\lbrack \global\let]=\rbrack
7510: \global\let& = \&
7511:
7512: \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
7513: \gdef\magicamp{\let&=\amprm}
7514: }
7515:
7516: \newcount\parencount
7517:
7518: % If we encounter &foo, then turn on ()-hacking afterwards
7519: \newif\ifampseen
7520: \def\amprm#1 {\ampseentrue{\bf\ }}
7521:
7522: \def\parenfont{%
7523: \ifampseen
7524: % At the first level, print parens in roman,
7525: % otherwise use the default font.
7526: \ifnum \parencount=1 \rm \fi
7527: \else
7528: % The \sf parens (in \boldbrax) actually are a little bolder than
7529: % the contained text. This is especially needed for [ and ] .
7530: \sf
7531: \fi
7532: }
7533: \def\infirstlevel#1{%
7534: \ifampseen
7535: \ifnum\parencount=1
7536: #1%
7537: \fi
7538: \fi
7539: }
7540: \def\bfafterword#1 {#1 \bf}
7541:
7542: \def\opnr{%
7543: \global\advance\parencount by 1
7544: {\parenfont(}%
7545: \infirstlevel \bfafterword
7546: }
7547: \def\clnr{%
7548: {\parenfont)}%
7549: \infirstlevel \sl
7550: \global\advance\parencount by -1
7551: }
7552:
7553: \newcount\brackcount
7554: \def\lbrb{%
7555: \global\advance\brackcount by 1
7556: {\bf[}%
7557: }
7558: \def\rbrb{%
7559: {\bf]}%
7560: \global\advance\brackcount by -1
7561: }
7562:
7563: \def\checkparencounts{%
7564: \ifnum\parencount=0 \else \badparencount \fi
7565: \ifnum\brackcount=0 \else \badbrackcount \fi
7566: }
7567: % these should not use \errmessage; the glibc manual, at least, actually
7568: % has such constructs (when documenting function pointers).
7569: \def\badparencount{%
7570: \message{Warning: unbalanced parentheses in @def...}%
7571: \global\parencount=0
7572: }
7573: \def\badbrackcount{%
7574: \message{Warning: unbalanced square brackets in @def...}%
7575: \global\brackcount=0
7576: }
7577:
7578:
7579: \message{macros,}
7580: % @macro.
7581:
7582: % To do this right we need a feature of e-TeX, \scantokens,
7583: % which we arrange to emulate with a temporary file in ordinary TeX.
7584: \ifx\eTeXversion\thisisundefined
7585: \newwrite\macscribble
7586: \def\scantokens#1{%
7587: \toks0={#1}%
7588: \immediate\openout\macscribble=\jobname.tmp
7589: \immediate\write\macscribble{\the\toks0}%
7590: \immediate\closeout\macscribble
7591: \input \jobname.tmp
7592: }
7593: \fi
7594:
1.1.1.2 ! misho 7595: \let\aftermacroxxx\relax
! 7596: \def\aftermacro{\aftermacroxxx}
! 7597:
! 7598: % alias because \c means cedilla in @tex or @math
! 7599: \let\texinfoc=\c
! 7600:
! 7601: % Used at the time of macro expansion.
! 7602: % Argument is macro body with arguments substituted
! 7603: \def\scanmacro#1{%
1.1 misho 7604: \newlinechar`\^^M
1.1.1.2 ! misho 7605: \def\xprocessmacroarg{\eatspaces}%
1.1 misho 7606: %
1.1.1.2 ! misho 7607: % Process the macro body under the current catcode regime.
! 7608: \scantokens{#1\texinfoc}\aftermacro%
1.1 misho 7609: %
1.1.1.2 ! misho 7610: % The \c is to remove the \newlinechar added by \scantokens, and
! 7611: % can be noticed by \parsearg.
! 7612: % The \aftermacro allows a \comment at the end of the macro definition
! 7613: % to duplicate itself past the final \newlinechar added by \scantokens:
! 7614: % this is used in the definition of \group to comment out a newline. We
! 7615: % don't do the same for \c to support Texinfo files with macros that ended
! 7616: % with a @c, which should no longer be necessary.
! 7617: % We avoid surrounding the call to \scantokens with \bgroup and \egroup
! 7618: % to allow macros to open or close groups themselves.
! 7619: }
1.1 misho 7620:
7621: \def\scanexp#1{%
1.1.1.2 ! misho 7622: \bgroup
! 7623: % Undo catcode changes of \startcontents and \printindex
! 7624: % When called from @insertcopying or (short)caption, we need active
! 7625: % backslash to get it printed correctly.
! 7626: % FIXME: This may not be needed.
! 7627: %\catcode`\@=0 \catcode`\\=\active \escapechar=`\@
1.1 misho 7628: \edef\temp{\noexpand\scanmacro{#1}}%
7629: \temp
1.1.1.2 ! misho 7630: \egroup
1.1 misho 7631: }
7632:
7633: \newcount\paramno % Count of parameters
7634: \newtoks\macname % Macro name
7635: \newif\ifrecursive % Is it recursive?
7636:
7637: % List of all defined macros in the form
7638: % \definedummyword\macro1\definedummyword\macro2...
7639: % Currently is also contains all @aliases; the list can be split
7640: % if there is a need.
7641: \def\macrolist{}
7642:
7643: % Add the macro to \macrolist
7644: \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
7645: \def\addtomacrolistxxx#1{%
7646: \toks0 = \expandafter{\macrolist\definedummyword#1}%
7647: \xdef\macrolist{\the\toks0}%
7648: }
7649:
7650: % Utility routines.
7651: % This does \let #1 = #2, with \csnames; that is,
7652: % \let \csname#1\endcsname = \csname#2\endcsname
7653: % (except of course we have to play expansion games).
7654: %
7655: \def\cslet#1#2{%
7656: \expandafter\let
7657: \csname#1\expandafter\endcsname
7658: \csname#2\endcsname
7659: }
7660:
7661: % Trim leading and trailing spaces off a string.
7662: % Concepts from aro-bend problem 15 (see CTAN).
7663: {\catcode`\@=11
7664: \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
7665: \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
7666: \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
7667: \def\unbrace#1{#1}
7668: \unbrace{\gdef\trim@@@ #1 } #2@{#1}
7669: }
7670:
7671: % Trim a single trailing ^^M off a string.
7672: {\catcode`\^^M=\other \catcode`\Q=3%
7673: \gdef\eatcr #1{\eatcra #1Q^^MQ}%
7674: \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
7675: \gdef\eatcrb#1Q#2Q{#1}%
7676: }
7677:
7678: % Macro bodies are absorbed as an argument in a context where
7679: % all characters are catcode 10, 11 or 12, except \ which is active
7680: % (as in normal texinfo). It is necessary to change the definition of \
7681: % to recognize macro arguments; this is the job of \mbodybackslash.
7682: %
7683: % Non-ASCII encodings make 8-bit characters active, so un-activate
7684: % them to avoid their expansion. Must do this non-globally, to
7685: % confine the change to the current group.
7686: %
7687: % It's necessary to have hard CRs when the macro is executed. This is
7688: % done by making ^^M (\endlinechar) catcode 12 when reading the macro
7689: % body, and then making it the \newlinechar in \scanmacro.
7690: %
7691: \def\scanctxt{% used as subroutine
7692: \catcode`\"=\other
7693: \catcode`\+=\other
7694: \catcode`\<=\other
7695: \catcode`\>=\other
7696: \catcode`\^=\other
7697: \catcode`\_=\other
7698: \catcode`\|=\other
7699: \catcode`\~=\other
7700: \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
7701: }
7702:
7703: \def\scanargctxt{% used for copying and captions, not macros.
7704: \scanctxt
1.1.1.2 ! misho 7705: \catcode`\@=\other
1.1 misho 7706: \catcode`\\=\other
7707: \catcode`\^^M=\other
7708: }
7709:
7710: \def\macrobodyctxt{% used for @macro definitions
7711: \scanctxt
1.1.1.2 ! misho 7712: \catcode`\ =\other
! 7713: \catcode`\@=\other
1.1 misho 7714: \catcode`\{=\other
7715: \catcode`\}=\other
7716: \catcode`\^^M=\other
7717: \usembodybackslash
7718: }
7719:
1.1.1.2 ! misho 7720: % Used when scanning braced macro arguments. Note, however, that catcode
! 7721: % changes here are ineffectual if the macro invocation was nested inside
! 7722: % an argument to another Texinfo command.
! 7723: \def\macroargctxt{%
1.1 misho 7724: \scanctxt
1.1.1.2 ! misho 7725: \catcode`\ =\active
! 7726: \catcode`\^^M=\other
! 7727: \catcode`\\=\active
1.1 misho 7728: }
7729:
1.1.1.2 ! misho 7730: \def\macrolineargctxt{% used for whole-line arguments without braces
! 7731: \scanctxt
! 7732: \catcode`\{=\other
! 7733: \catcode`\}=\other
! 7734: }
1.1 misho 7735:
7736: % \mbodybackslash is the definition of \ in @macro bodies.
7737: % It maps \foo\ => \csname macarg.foo\endcsname => #N
7738: % where N is the macro parameter number.
7739: % We define \csname macarg.\endcsname to be \realbackslash, so
7740: % \\ in macro replacement text gets you a backslash.
7741: %
7742: {\catcode`@=0 @catcode`@\=@active
7743: @gdef@usembodybackslash{@let\=@mbodybackslash}
7744: @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
7745: }
7746: \expandafter\def\csname macarg.\endcsname{\realbackslash}
7747:
7748: \def\margbackslash#1{\char`\#1 }
7749:
7750: \def\macro{\recursivefalse\parsearg\macroxxx}
7751: \def\rmacro{\recursivetrue\parsearg\macroxxx}
7752:
7753: \def\macroxxx#1{%
7754: \getargs{#1}% now \macname is the macname and \argl the arglist
7755: \ifx\argl\empty % no arguments
7756: \paramno=0\relax
7757: \else
7758: \expandafter\parsemargdef \argl;%
7759: \if\paramno>256\relax
7760: \ifx\eTeXversion\thisisundefined
7761: \errhelp = \EMsimple
7762: \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
7763: \fi
7764: \fi
7765: \fi
7766: \if1\csname ismacro.\the\macname\endcsname
7767: \message{Warning: redefining \the\macname}%
7768: \else
7769: \expandafter\ifx\csname \the\macname\endcsname \relax
7770: \else \errmessage{Macro name \the\macname\space already defined}\fi
7771: \global\cslet{macsave.\the\macname}{\the\macname}%
7772: \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
7773: \addtomacrolist{\the\macname}%
7774: \fi
7775: \begingroup \macrobodyctxt
7776: \ifrecursive \expandafter\parsermacbody
7777: \else \expandafter\parsemacbody
7778: \fi}
7779:
7780: \parseargdef\unmacro{%
7781: \if1\csname ismacro.#1\endcsname
7782: \global\cslet{#1}{macsave.#1}%
7783: \global\expandafter\let \csname ismacro.#1\endcsname=0%
7784: % Remove the macro name from \macrolist:
7785: \begingroup
7786: \expandafter\let\csname#1\endcsname \relax
7787: \let\definedummyword\unmacrodo
7788: \xdef\macrolist{\macrolist}%
7789: \endgroup
7790: \else
7791: \errmessage{Macro #1 not defined}%
7792: \fi
7793: }
7794:
7795: % Called by \do from \dounmacro on each macro. The idea is to omit any
7796: % macro definitions that have been changed to \relax.
7797: %
7798: \def\unmacrodo#1{%
7799: \ifx #1\relax
7800: % remove this
7801: \else
7802: \noexpand\definedummyword \noexpand#1%
7803: \fi
7804: }
7805:
1.1.1.2 ! misho 7806: % \getargs -- Parse the arguments to a @macro line. Set \macname to
! 7807: % the name of the macro, and \argl to the braced argument list.
1.1 misho 7808: \def\getargs#1{\getargsxxx#1{}}
7809: \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
7810: \def\getmacname#1 #2\relax{\macname={#1}}
7811: \def\getmacargs#1{\def\argl{#1}}
1.1.1.2 ! misho 7812: % This made use of the feature that if the last token of a
! 7813: % <parameter list> is #, then the preceding argument is delimited by
! 7814: % an opening brace, and that opening brace is not consumed.
1.1 misho 7815:
1.1.1.2 ! misho 7816: % Parse the optional {params} list to @macro or @rmacro.
! 7817: % Set \paramno to the number of arguments,
! 7818: % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
! 7819: % three-param macro.) Define \macarg.BLAH for each BLAH in the params
! 7820: % list to some hook where the argument is to be expanded. If there are
! 7821: % less than 10 arguments that hook is to be replaced by ##N where N
1.1 misho 7822: % is the position in that list, that is to say the macro arguments are to be
7823: % defined `a la TeX in the macro body.
7824: %
7825: % That gets used by \mbodybackslash (above).
7826: %
1.1.1.2 ! misho 7827: % If there are 10 or more arguments, a different technique is used: see
! 7828: % \parsemmanyargdef.
1.1 misho 7829: %
7830: \def\parsemargdef#1;{%
7831: \paramno=0\def\paramlist{}%
7832: \let\hash\relax
1.1.1.2 ! misho 7833: % \hash is redefined to `#' later to get it into definitions
! 7834: \let\processmacroarg\relax
1.1 misho 7835: \parsemargdefxxx#1,;,%
7836: \ifnum\paramno<10\relax\else
7837: \paramno0\relax
7838: \parsemmanyargdef@@#1,;,% 10 or more arguments
7839: \fi
7840: }
7841: \def\parsemargdefxxx#1,{%
7842: \if#1;\let\next=\relax
7843: \else \let\next=\parsemargdefxxx
7844: \advance\paramno by 1
7845: \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
1.1.1.2 ! misho 7846: {\processmacroarg{\hash\the\paramno}}%
1.1 misho 7847: \edef\paramlist{\paramlist\hash\the\paramno,}%
7848: \fi\next}
7849:
1.1.1.2 ! misho 7850: % \parsemacbody, \parsermacbody
! 7851: %
! 7852: % Read recursive and nonrecursive macro bodies. (They're different since
! 7853: % rec and nonrec macros end differently.)
! 7854: %
! 7855: % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
! 7856: % body to be transformed.
! 7857: % Set \macrobody to the body of the macro, and call \defmacro.
! 7858: %
! 7859: {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
! 7860: \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
! 7861: {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
! 7862: \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
! 7863:
! 7864: % Make @ a letter, so that we can make private-to-Texinfo macro names.
! 7865: \edef\texiatcatcode{\the\catcode`\@}
! 7866: \catcode `@=11\relax
! 7867:
! 7868: %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
! 7869:
! 7870: % If there are 10 or more arguments, a different technique is used, where the
! 7871: % hook remains in the body, and when macro is to be expanded the body is
! 7872: % processed again to replace the arguments.
! 7873: %
! 7874: % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
! 7875: % argument N value and then \edef the body (nothing else will expand because of
! 7876: % the catcode regime under which the body was input).
! 7877: %
! 7878: % If you compile with TeX (not eTeX), and you have macros with 10 or more
! 7879: % arguments, no macro can have more than 256 arguments (else error).
! 7880: %
! 7881: % In case that there are 10 or more arguments we parse again the arguments
! 7882: % list to set new definitions for the \macarg.BLAH macros corresponding to
! 7883: % each BLAH argument. It was anyhow needed to parse already once this list
! 7884: % in order to count the arguments, and as macros with at most 9 arguments
! 7885: % are by far more frequent than macro with 10 or more arguments, defining
! 7886: % twice the \macarg.BLAH macros does not cost too much processing power.
1.1 misho 7887: \def\parsemmanyargdef@@#1,{%
7888: \if#1;\let\next=\relax
7889: \else
7890: \let\next=\parsemmanyargdef@@
7891: \edef\tempb{\eatspaces{#1}}%
7892: \expandafter\def\expandafter\tempa
7893: \expandafter{\csname macarg.\tempb\endcsname}%
7894: % Note that we need some extra \noexpand\noexpand, this is because we
7895: % don't want \the to be expanded in the \parsermacbody as it uses an
7896: % \xdef .
7897: \expandafter\edef\tempa
7898: {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
7899: \advance\paramno by 1\relax
7900: \fi\next}
7901:
7902:
7903: \let\endargs@\relax
7904: \let\nil@\relax
7905: \def\nilm@{\nil@}%
7906: \long\def\nillm@{\nil@}%
7907:
7908: % This macro is expanded during the Texinfo macro expansion, not during its
1.1.1.2 ! misho 7909: % definition. It gets all the arguments' values and assigns them to macros
1.1 misho 7910: % macarg.ARGNAME
7911: %
7912: % #1 is the macro name
7913: % #2 is the list of argument names
7914: % #3 is the list of argument values
7915: \def\getargvals@#1#2#3{%
7916: \def\macargdeflist@{}%
7917: \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
7918: \def\paramlist{#2,\nil@}%
7919: \def\macroname{#1}%
7920: \begingroup
7921: \macroargctxt
7922: \def\argvaluelist{#3,\nil@}%
7923: \def\@tempa{#3}%
7924: \ifx\@tempa\empty
7925: \setemptyargvalues@
7926: \else
7927: \getargvals@@
7928: \fi
7929: }
7930: \def\getargvals@@{%
7931: \ifx\paramlist\nilm@
7932: % Some sanity check needed here that \argvaluelist is also empty.
7933: \ifx\argvaluelist\nillm@
7934: \else
7935: \errhelp = \EMsimple
7936: \errmessage{Too many arguments in macro `\macroname'!}%
7937: \fi
7938: \let\next\macargexpandinbody@
7939: \else
7940: \ifx\argvaluelist\nillm@
7941: % No more arguments values passed to macro. Set remaining named-arg
7942: % macros to empty.
7943: \let\next\setemptyargvalues@
7944: \else
7945: % pop current arg name into \@tempb
7946: \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
7947: \expandafter\@tempa\expandafter{\paramlist}%
7948: % pop current argument value into \@tempc
7949: \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
7950: \expandafter\@tempa\expandafter{\argvaluelist}%
7951: % Here \@tempb is the current arg name and \@tempc is the current arg value.
7952: % First place the new argument macro definition into \@tempd
7953: \expandafter\macname\expandafter{\@tempc}%
7954: \expandafter\let\csname macarg.\@tempb\endcsname\relax
7955: \expandafter\def\expandafter\@tempe\expandafter{%
7956: \csname macarg.\@tempb\endcsname}%
7957: \edef\@tempd{\long\def\@tempe{\the\macname}}%
7958: \push@\@tempd\macargdeflist@
7959: \let\next\getargvals@@
7960: \fi
7961: \fi
7962: \next
7963: }
7964:
7965: \def\push@#1#2{%
7966: \expandafter\expandafter\expandafter\def
7967: \expandafter\expandafter\expandafter#2%
7968: \expandafter\expandafter\expandafter{%
7969: \expandafter#1#2}%
7970: }
7971:
7972: % Replace arguments by their values in the macro body, and place the result
1.1.1.2 ! misho 7973: % in macro \@tempa.
! 7974: %
1.1 misho 7975: \def\macvalstoargs@{%
7976: % To do this we use the property that token registers that are \the'ed
7977: % within an \edef expand only once. So we are going to place all argument
7978: % values into respective token registers.
7979: %
7980: % First we save the token context, and initialize argument numbering.
7981: \begingroup
7982: \paramno0\relax
7983: % Then, for each argument number #N, we place the corresponding argument
7984: % value into a new token list register \toks#N
7985: \expandafter\putargsintokens@\saveparamlist@,;,%
7986: % Then, we expand the body so that argument are replaced by their
7987: % values. The trick for values not to be expanded themselves is that they
7988: % are within tokens and that tokens expand only once in an \edef .
7989: \edef\@tempc{\csname mac.\macroname .body\endcsname}%
7990: % Now we restore the token stack pointer to free the token list registers
7991: % which we have used, but we make sure that expanded body is saved after
7992: % group.
7993: \expandafter
7994: \endgroup
7995: \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
7996: }
7997:
1.1.1.2 ! misho 7998: % Define the named-macro outside of this group and then close this group.
! 7999: %
1.1 misho 8000: \def\macargexpandinbody@{%
8001: \expandafter
8002: \endgroup
8003: \macargdeflist@
8004: % First the replace in body the macro arguments by their values, the result
8005: % is in \@tempa .
8006: \macvalstoargs@
8007: % Then we point at the \norecurse or \gobble (for recursive) macro value
8008: % with \@tempb .
8009: \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
8010: % Depending on whether it is recursive or not, we need some tailing
8011: % \egroup .
8012: \ifx\@tempb\gobble
8013: \let\@tempc\relax
8014: \else
8015: \let\@tempc\egroup
8016: \fi
8017: % And now we do the real job:
8018: \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
8019: \@tempd
8020: }
8021:
8022: \def\putargsintokens@#1,{%
8023: \if#1;\let\next\relax
8024: \else
8025: \let\next\putargsintokens@
8026: % First we allocate the new token list register, and give it a temporary
8027: % alias \@tempb .
8028: \toksdef\@tempb\the\paramno
8029: % Then we place the argument value into that token list register.
8030: \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
8031: \expandafter\@tempb\expandafter{\@tempa}%
8032: \advance\paramno by 1\relax
8033: \fi
8034: \next
8035: }
8036:
1.1.1.2 ! misho 8037: % Trailing missing arguments are set to empty.
! 8038: %
1.1 misho 8039: \def\setemptyargvalues@{%
8040: \ifx\paramlist\nilm@
8041: \let\next\macargexpandinbody@
8042: \else
8043: \expandafter\setemptyargvaluesparser@\paramlist\endargs@
8044: \let\next\setemptyargvalues@
8045: \fi
8046: \next
8047: }
8048:
8049: \def\setemptyargvaluesparser@#1,#2\endargs@{%
8050: \expandafter\def\expandafter\@tempa\expandafter{%
8051: \expandafter\def\csname macarg.#1\endcsname{}}%
8052: \push@\@tempa\macargdeflist@
8053: \def\paramlist{#2}%
8054: }
8055:
8056: % #1 is the element target macro
8057: % #2 is the list macro
8058: % #3,#4\endargs@ is the list value
8059: \def\pop@#1#2#3,#4\endargs@{%
8060: \def#1{#3}%
8061: \def#2{#4}%
8062: }
8063: \long\def\longpop@#1#2#3,#4\endargs@{%
8064: \long\def#1{#3}%
8065: \long\def#2{#4}%
8066: }
8067:
1.1.1.2 ! misho 8068:
! 8069: %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
! 8070:
! 8071:
! 8072:
! 8073: % Remove following spaces at the expansion stage.
! 8074: % This works because spaces are discarded before each argument when TeX is
! 8075: % getting the arguments for a macro.
! 8076: % This must not be immediately followed by a }.
! 8077: \long\def\gobblespaces#1{#1}
! 8078:
! 8079: % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
! 8080: % \macrobody has the body of the macro in it, with placeholders for
! 8081: % its parameters, looking like "\processmacroarg{\hash 1}".
! 8082: % \paramno is the number of parameters
! 8083: % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
! 8084: % There are eight cases: recursive and nonrecursive macros of zero, one,
! 8085: % up to nine, and many arguments.
1.1 misho 8086: % \xdef is used so that macro definitions will survive the file
1.1.1.2 ! misho 8087: % they're defined in: @include reads the file inside a group.
1.1 misho 8088: %
8089: \def\defmacro{%
8090: \let\hash=##% convert placeholders to macro parameter chars
1.1.1.2 ! misho 8091: \ifnum\paramno=1
! 8092: \def\processmacroarg{\gobblespaces}%
! 8093: % This removes the pair of braces around the argument. We don't
! 8094: % use \eatspaces, because this can cause ends of lines to be lost
! 8095: % when the argument to \eatspaces is read, leading to line-based
! 8096: % commands like "@itemize" not being read correctly.
! 8097: \else
! 8098: \def\processmacroarg{\xprocessmacroarg}%
! 8099: \let\xprocessmacroarg\relax
! 8100: \fi
! 8101: \ifrecursive %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1.1 misho 8102: \ifcase\paramno
8103: % 0
8104: \expandafter\xdef\csname\the\macname\endcsname{%
1.1.1.2 ! misho 8105: \noexpand\scanmacro{\macrobody}}%
1.1 misho 8106: \or % 1
8107: \expandafter\xdef\csname\the\macname\endcsname{%
1.1.1.2 ! misho 8108: \bgroup
1.1 misho 8109: \noexpand\braceorline
1.1.1.2 ! misho 8110: \expandafter\noexpand\csname\the\macname @@@\endcsname}%
! 8111: \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
! 8112: \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
! 8113: \noexpand\gobblespaces##1\empty}%
! 8114: % The \empty is for \gobblespaces in case #1 is empty
! 8115: }%
! 8116: \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
! 8117: \egroup\noexpand\scanmacro{\macrobody}}%
1.1 misho 8118: \else
8119: \ifnum\paramno<10\relax % at most 9
1.1.1.2 ! misho 8120: % See non-recursive section below for comments
1.1 misho 8121: \expandafter\xdef\csname\the\macname\endcsname{%
1.1.1.2 ! misho 8122: \bgroup
! 8123: \noexpand\expandafter
! 8124: \noexpand\macroargctxt
! 8125: \noexpand\expandafter
! 8126: \expandafter\noexpand\csname\the\macname @@\endcsname}%
! 8127: \expandafter\xdef\csname\the\macname @@\endcsname##1{%
! 8128: \noexpand\passargtomacro
! 8129: \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
! 8130: \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
! 8131: \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
1.1 misho 8132: \expandafter\expandafter
8133: \expandafter\xdef
8134: \expandafter\expandafter
1.1.1.2 ! misho 8135: \csname\the\macname @@@@\endcsname\paramlist{%
! 8136: \egroup\noexpand\scanmacro{\macrobody}}%
1.1 misho 8137: \else % 10 or more
8138: \expandafter\xdef\csname\the\macname\endcsname{%
8139: \noexpand\getargvals@{\the\macname}{\argl}%
8140: }%
1.1.1.2 ! misho 8141: \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
1.1 misho 8142: \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
8143: \fi
8144: \fi
1.1.1.2 ! misho 8145: \else %%%%%%%%%%%%%%%%%%%%%% Non-recursive %%%%%%%%%%%%%%%%%%%%%%%%%%
1.1 misho 8146: \ifcase\paramno
8147: % 0
8148: \expandafter\xdef\csname\the\macname\endcsname{%
1.1.1.2 ! misho 8149: \noexpand\scanmacro{\macrobody}}%
1.1 misho 8150: \or % 1
8151: \expandafter\xdef\csname\the\macname\endcsname{%
1.1.1.2 ! misho 8152: \bgroup
1.1 misho 8153: \noexpand\braceorline
1.1.1.2 ! misho 8154: \expandafter\noexpand\csname\the\macname @@@\endcsname}%
! 8155: \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
! 8156: \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
! 8157: \noexpand\gobblespaces##1\empty}%
! 8158: % The \empty is for \gobblespaces in case #1 is empty
! 8159: }%
! 8160: \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
1.1 misho 8161: \egroup
1.1.1.2 ! misho 8162: \noexpand\scanmacro{\macrobody}%
! 8163: }%
1.1 misho 8164: \else % at most 9
8165: \ifnum\paramno<10\relax
1.1.1.2 ! misho 8166: % @MACNAME sets the context for reading the macro argument
! 8167: % @MACNAME@@ gets the argument, processes backslashes and appends a
! 8168: % comma.
! 8169: % @MACNAME@@@ removes braces surrounding the argument list.
! 8170: % @MACNAME@@@@ scans the macro body with arguments substituted.
1.1 misho 8171: \expandafter\xdef\csname\the\macname\endcsname{%
1.1.1.2 ! misho 8172: \bgroup
! 8173: \noexpand\expandafter % This \expandafter skip any spaces after the
! 8174: \noexpand\macroargctxt % macro before we change the catcode of space.
! 8175: \noexpand\expandafter
! 8176: \expandafter\noexpand\csname\the\macname @@\endcsname}%
! 8177: \expandafter\xdef\csname\the\macname @@\endcsname##1{%
! 8178: \noexpand\passargtomacro
! 8179: \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
! 8180: \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
! 8181: \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
1.1 misho 8182: \expandafter\expandafter
8183: \expandafter\xdef
8184: \expandafter\expandafter
1.1.1.2 ! misho 8185: \csname\the\macname @@@@\endcsname\paramlist{%
! 8186: \egroup\noexpand\scanmacro{\macrobody}}%
1.1 misho 8187: \else % 10 or more:
8188: \expandafter\xdef\csname\the\macname\endcsname{%
8189: \noexpand\getargvals@{\the\macname}{\argl}%
8190: }%
1.1.1.2 ! misho 8191: \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
1.1 misho 8192: \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
8193: \fi
8194: \fi
8195: \fi}
8196:
1.1.1.2 ! misho 8197: \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
1.1 misho 8198:
8199: \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
8200:
1.1.1.2 ! misho 8201:
! 8202: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! 8203: %
! 8204: {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
! 8205: @catcode`@_=11 % private names
! 8206: @catcode`@!=11 % used as argument separator
! 8207:
! 8208: % \passargtomacro#1#2 -
! 8209: % Call #1 with a list of tokens #2, with any doubled backslashes in #2
! 8210: % compressed to one.
! 8211: %
! 8212: % This implementation works by expansion, and not execution (so we cannot use
! 8213: % \def or similar). This reduces the risk of this failing in contexts where
! 8214: % complete expansion is done with no execution (for example, in writing out to
! 8215: % an auxiliary file for an index entry).
! 8216: %
! 8217: % State is kept in the input stream: the argument passed to
! 8218: % @look_ahead, @gobble_and_check_finish and @add_segment is
! 8219: %
! 8220: % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
! 8221: %
! 8222: % where:
! 8223: % THE_MACRO - name of the macro we want to call
! 8224: % ARG_RESULT - argument list we build to pass to that macro
! 8225: % PENDING_BS - either a backslash or nothing
! 8226: % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
! 8227:
! 8228: @gdef@passargtomacro#1#2{%
! 8229: @add_segment #1!{}@relax#2\@_finish\%
! 8230: }
! 8231: @gdef@_finish{@_finishx} @global@let@_finishx@relax
! 8232:
! 8233: % #1 - THE_MACRO ARG_RESULT
! 8234: % #2 - PENDING_BS
! 8235: % #3 - NEXT_TOKEN
! 8236: % #4 used to look ahead
! 8237: %
! 8238: % If the next token is not a backslash, process the rest of the argument;
! 8239: % otherwise, remove the next token.
! 8240: @gdef@look_ahead#1!#2#3#4{%
! 8241: @ifx#4\%
! 8242: @expandafter@gobble_and_check_finish
! 8243: @else
! 8244: @expandafter@add_segment
! 8245: @fi#1!{#2}#4#4%
! 8246: }
! 8247:
! 8248: % #1 - THE_MACRO ARG_RESULT
! 8249: % #2 - PENDING_BS
! 8250: % #3 - NEXT_TOKEN
! 8251: % #4 should be a backslash, which is gobbled.
! 8252: % #5 looks ahead
! 8253: %
! 8254: % Double backslash found. Add a single backslash, and look ahead.
! 8255: @gdef@gobble_and_check_finish#1!#2#3#4#5{%
! 8256: @add_segment#1\!{}#5#5%
! 8257: }
! 8258:
! 8259: @gdef@is_fi{@fi}
! 8260:
! 8261: % #1 - THE_MACRO ARG_RESULT
! 8262: % #2 - PENDING_BS
! 8263: % #3 - NEXT_TOKEN
! 8264: % #4 is input stream until next backslash
! 8265: %
! 8266: % Input stream is either at the start of the argument, or just after a
! 8267: % backslash sequence, either a lone backslash, or a doubled backslash.
! 8268: % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
! 8269: % finish; otherwise, append to ARG_RESULT the segment of the argument up until
! 8270: % the next backslash. PENDING_BACKSLASH contains a backslash to represent
! 8271: % a backslash just before the start of the input stream that has not been
! 8272: % added to ARG_RESULT.
! 8273: @gdef@add_segment#1!#2#3#4\{%
! 8274: @ifx#3@_finish
! 8275: @call_the_macro#1!%
! 8276: @else
! 8277: % append the pending backslash to the result, followed by the next segment
! 8278: @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
! 8279: % this @fi is discarded by @look_ahead.
! 8280: % we can't get rid of it with \expandafter because we don't know how
! 8281: % long #4 is.
! 8282: }
! 8283:
! 8284: % #1 - THE_MACRO
! 8285: % #2 - ARG_RESULT
! 8286: % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
! 8287: % conditional.
! 8288: @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
! 8289:
! 8290: }
! 8291: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! 8292:
! 8293: % \braceorline MAC is used for a one-argument macro MAC. It checks
! 8294: % whether the next non-whitespace character is a {. It sets the context
! 8295: % for reading the argument (slightly different in the two cases). Then,
! 8296: % to read the argument, in the whole-line case, it then calls the regular
! 8297: % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
1.1 misho 8298: %
8299: \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
8300: \def\braceorlinexxx{%
1.1.1.2 ! misho 8301: \ifx\nchar\bgroup
! 8302: \macroargctxt
! 8303: \expandafter\passargtomacro
! 8304: \else
! 8305: \macrolineargctxt\expandafter\parsearg
1.1 misho 8306: \fi \macnamexxx}
8307:
8308:
8309: % @alias.
8310: % We need some trickery to remove the optional spaces around the equal
8311: % sign. Make them active and then expand them all to nothing.
8312: %
8313: \def\alias{\parseargusing\obeyspaces\aliasxxx}
8314: \def\aliasxxx #1{\aliasyyy#1\relax}
8315: \def\aliasyyy #1=#2\relax{%
8316: {%
8317: \expandafter\let\obeyedspace=\empty
8318: \addtomacrolist{#1}%
8319: \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
8320: }%
8321: \next
8322: }
8323:
8324:
8325: \message{cross references,}
8326:
8327: \newwrite\auxfile
8328: \newif\ifhavexrefs % True if xref values are known.
8329: \newif\ifwarnedxrefs % True if we warned once that they aren't known.
8330:
8331: % @inforef is relatively simple.
8332: \def\inforef #1{\inforefzzz #1,,,,**}
8333: \def\inforefzzz #1,#2,#3,#4**{%
8334: \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
8335: node \samp{\ignorespaces#1{}}}
8336:
8337: % @node's only job in TeX is to define \lastnode, which is used in
8338: % cross-references. The @node line might or might not have commas, and
8339: % might or might not have spaces before the first comma, like:
8340: % @node foo , bar , ...
8341: % We don't want such trailing spaces in the node name.
8342: %
8343: \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
8344: %
8345: % also remove a trailing comma, in case of something like this:
8346: % @node Help-Cross, , , Cross-refs
8347: \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
8348: \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
8349:
8350: \let\nwnode=\node
8351: \let\lastnode=\empty
8352:
8353: % Write a cross-reference definition for the current node. #1 is the
8354: % type (Ynumbered, Yappendix, Ynothing).
8355: %
8356: \def\donoderef#1{%
8357: \ifx\lastnode\empty\else
8358: \setref{\lastnode}{#1}%
8359: \global\let\lastnode=\empty
8360: \fi
8361: }
8362:
8363: % @anchor{NAME} -- define xref target at arbitrary point.
8364: %
8365: \newcount\savesfregister
8366: %
8367: \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
8368: \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
8369: \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
8370:
8371: % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
8372: % anchor), which consists of three parts:
8373: % 1) NAME-title - the current sectioning name taken from \lastsection,
8374: % or the anchor name.
8375: % 2) NAME-snt - section number and type, passed as the SNT arg, or
8376: % empty for anchors.
8377: % 3) NAME-pg - the page number.
8378: %
8379: % This is called from \donoderef, \anchor, and \dofloat. In the case of
8380: % floats, there is an additional part, which is not written here:
8381: % 4) NAME-lof - the text as it should appear in a @listoffloats.
8382: %
8383: \def\setref#1#2{%
8384: \pdfmkdest{#1}%
8385: \iflinks
8386: {%
1.1.1.2 ! misho 8387: \requireauxfile
1.1 misho 8388: \atdummies % preserve commands, but don't expand them
8389: \edef\writexrdef##1##2{%
8390: \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
8391: ##1}{##2}}% these are parameters of \writexrdef
8392: }%
8393: \toks0 = \expandafter{\lastsection}%
8394: \immediate \writexrdef{title}{\the\toks0 }%
8395: \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
8396: \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
8397: }%
8398: \fi
8399: }
8400:
8401: % @xrefautosectiontitle on|off says whether @section(ing) names are used
8402: % automatically in xrefs, if the third arg is not explicitly specified.
8403: % This was provided as a "secret" @set xref-automatic-section-title
8404: % variable, now it's official.
8405: %
8406: \parseargdef\xrefautomaticsectiontitle{%
8407: \def\temp{#1}%
8408: \ifx\temp\onword
8409: \expandafter\let\csname SETxref-automatic-section-title\endcsname
8410: = \empty
8411: \else\ifx\temp\offword
8412: \expandafter\let\csname SETxref-automatic-section-title\endcsname
8413: = \relax
8414: \else
8415: \errhelp = \EMsimple
8416: \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
8417: must be on|off}%
8418: \fi\fi
8419: }
8420:
8421: %
8422: % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
8423: % the node name, #2 the name of the Info cross-reference, #3 the printed
8424: % node name, #4 the name of the Info file, #5 the name of the printed
8425: % manual. All but the node name can be omitted.
8426: %
1.1.1.2 ! misho 8427: \def\pxref{\putwordsee{} \xrefXX}
! 8428: \def\xref{\putwordSee{} \xrefXX}
! 8429: \def\ref{\xrefXX}
! 8430:
! 8431: \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
! 8432: \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
1.1 misho 8433: %
8434: \newbox\toprefbox
8435: \newbox\printedrefnamebox
8436: \newbox\infofilenamebox
8437: \newbox\printedmanualbox
8438: %
8439: \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
8440: \unsepspaces
8441: %
8442: % Get args without leading/trailing spaces.
8443: \def\printedrefname{\ignorespaces #3}%
8444: \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
8445: %
8446: \def\infofilename{\ignorespaces #4}%
8447: \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
8448: %
8449: \def\printedmanual{\ignorespaces #5}%
8450: \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
8451: %
8452: % If the printed reference name (arg #3) was not explicitly given in
8453: % the @xref, figure out what we want to use.
8454: \ifdim \wd\printedrefnamebox = 0pt
8455: % No printed node name was explicitly given.
8456: \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
8457: % Not auto section-title: use node name inside the square brackets.
8458: \def\printedrefname{\ignorespaces #1}%
8459: \else
8460: % Auto section-title: use chapter/section title inside
8461: % the square brackets if we have it.
8462: \ifdim \wd\printedmanualbox > 0pt
8463: % It is in another manual, so we don't have it; use node name.
8464: \def\printedrefname{\ignorespaces #1}%
8465: \else
8466: \ifhavexrefs
8467: % We (should) know the real title if we have the xref values.
8468: \def\printedrefname{\refx{#1-title}{}}%
8469: \else
8470: % Otherwise just copy the Info node name.
8471: \def\printedrefname{\ignorespaces #1}%
8472: \fi%
8473: \fi
8474: \fi
8475: \fi
8476: %
8477: % Make link in pdf output.
8478: \ifpdf
8479: {\indexnofonts
8480: \turnoffactive
8481: \makevalueexpandable
8482: % This expands tokens, so do it after making catcode changes, so _
8483: % etc. don't get their TeX definitions. This ignores all spaces in
8484: % #4, including (wrongly) those in the middle of the filename.
8485: \getfilename{#4}%
8486: %
8487: % This (wrongly) does not take account of leading or trailing
8488: % spaces in #1, which should be ignored.
8489: \edef\pdfxrefdest{#1}%
8490: \ifx\pdfxrefdest\empty
8491: \def\pdfxrefdest{Top}% no empty targets
8492: \else
8493: \txiescapepdf\pdfxrefdest % escape PDF special chars
8494: \fi
8495: %
8496: \leavevmode
8497: \startlink attr{/Border [0 0 0]}%
8498: \ifnum\filenamelength>0
8499: goto file{\the\filename.pdf} name{\pdfxrefdest}%
8500: \else
8501: goto name{\pdfmkpgn{\pdfxrefdest}}%
8502: \fi
8503: }%
8504: \setcolor{\linkcolor}%
8505: \fi
8506: %
8507: % Float references are printed completely differently: "Figure 1.2"
8508: % instead of "[somenode], p.3". We distinguish them by the
8509: % LABEL-title being set to a magic string.
8510: {%
8511: % Have to otherify everything special to allow the \csname to
8512: % include an _ in the xref name, etc.
8513: \indexnofonts
8514: \turnoffactive
8515: \expandafter\global\expandafter\let\expandafter\Xthisreftitle
8516: \csname XR#1-title\endcsname
8517: }%
8518: \iffloat\Xthisreftitle
8519: % If the user specified the print name (third arg) to the ref,
8520: % print it instead of our usual "Figure 1.2".
8521: \ifdim\wd\printedrefnamebox = 0pt
8522: \refx{#1-snt}{}%
8523: \else
8524: \printedrefname
8525: \fi
8526: %
8527: % If the user also gave the printed manual name (fifth arg), append
8528: % "in MANUALNAME".
8529: \ifdim \wd\printedmanualbox > 0pt
8530: \space \putwordin{} \cite{\printedmanual}%
8531: \fi
8532: \else
8533: % node/anchor (non-float) references.
8534: %
8535: % If we use \unhbox to print the node names, TeX does not insert
8536: % empty discretionaries after hyphens, which means that it will not
8537: % find a line break at a hyphen in a node names. Since some manuals
8538: % are best written with fairly long node names, containing hyphens,
8539: % this is a loss. Therefore, we give the text of the node name
8540: % again, so it is as if TeX is seeing it for the first time.
8541: %
8542: \ifdim \wd\printedmanualbox > 0pt
8543: % Cross-manual reference with a printed manual name.
8544: %
8545: \crossmanualxref{\cite{\printedmanual\unskip}}%
8546: %
8547: \else\ifdim \wd\infofilenamebox > 0pt
8548: % Cross-manual reference with only an info filename (arg 4), no
8549: % printed manual name (arg 5). This is essentially the same as
8550: % the case above; we output the filename, since we have nothing else.
8551: %
8552: \crossmanualxref{\code{\infofilename\unskip}}%
8553: %
8554: \else
8555: % Reference within this manual.
8556: %
8557: % _ (for example) has to be the character _ for the purposes of the
8558: % control sequence corresponding to the node, but it has to expand
8559: % into the usual \leavevmode...\vrule stuff for purposes of
8560: % printing. So we \turnoffactive for the \refx-snt, back on for the
8561: % printing, back off for the \refx-pg.
8562: {\turnoffactive
8563: % Only output a following space if the -snt ref is nonempty; for
8564: % @unnumbered and @anchor, it won't be.
8565: \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
8566: \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
8567: }%
8568: % output the `[mynode]' via the macro below so it can be overridden.
8569: \xrefprintnodename\printedrefname
8570: %
8571: % But we always want a comma and a space:
8572: ,\space
8573: %
8574: % output the `page 3'.
8575: \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
1.1.1.2 ! misho 8576: \ifx,\tokenafterxref
! 8577: \else\ifx.\tokenafterxref
! 8578: \else\ifx;\tokenafterxref
! 8579: \else\ifx)\tokenafterxref
! 8580: \else,% add a , if xref not followed by punctuation
! 8581: \fi\fi\fi\fi
1.1 misho 8582: \fi\fi
8583: \fi
8584: \endlink
8585: \endgroup}
8586:
8587: % Output a cross-manual xref to #1. Used just above (twice).
8588: %
8589: % Only include the text "Section ``foo'' in" if the foo is neither
8590: % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
8591: % "see The Foo Manual", the idea being to refer to the whole manual.
8592: %
8593: % But, this being TeX, we can't easily compare our node name against the
8594: % string "Top" while ignoring the possible spaces before and after in
8595: % the input. By adding the arbitrary 7sp below, we make it much less
8596: % likely that a real node name would have the same width as "Top" (e.g.,
8597: % in a monospaced font). Hopefully it will never happen in practice.
8598: %
8599: % For the same basic reason, we retypeset the "Top" at every
8600: % reference, since the current font is indeterminate.
8601: %
8602: \def\crossmanualxref#1{%
8603: \setbox\toprefbox = \hbox{Top\kern7sp}%
8604: \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
8605: \ifdim \wd2 > 7sp % nonempty?
8606: \ifdim \wd2 = \wd\toprefbox \else % same as Top?
8607: \putwordSection{} ``\printedrefname'' \putwordin{}\space
8608: \fi
8609: \fi
8610: #1%
8611: }
8612:
8613: % This macro is called from \xrefX for the `[nodename]' part of xref
8614: % output. It's a separate macro only so it can be changed more easily,
8615: % since square brackets don't work well in some documents. Particularly
8616: % one that Bob is working on :).
8617: %
8618: \def\xrefprintnodename#1{[#1]}
8619:
8620: % Things referred to by \setref.
8621: %
8622: \def\Ynothing{}
8623: \def\Yomitfromtoc{}
8624: \def\Ynumbered{%
8625: \ifnum\secno=0
8626: \putwordChapter@tie \the\chapno
8627: \else \ifnum\subsecno=0
8628: \putwordSection@tie \the\chapno.\the\secno
8629: \else \ifnum\subsubsecno=0
8630: \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
8631: \else
8632: \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
8633: \fi\fi\fi
8634: }
8635: \def\Yappendix{%
8636: \ifnum\secno=0
8637: \putwordAppendix@tie @char\the\appendixno{}%
8638: \else \ifnum\subsecno=0
8639: \putwordSection@tie @char\the\appendixno.\the\secno
8640: \else \ifnum\subsubsecno=0
8641: \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
8642: \else
8643: \putwordSection@tie
8644: @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
8645: \fi\fi\fi
8646: }
8647:
8648: % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
8649: % If its value is nonempty, SUFFIX is output afterward.
8650: %
8651: \def\refx#1#2{%
1.1.1.2 ! misho 8652: \requireauxfile
1.1 misho 8653: {%
8654: \indexnofonts
8655: \otherbackslash
8656: \expandafter\global\expandafter\let\expandafter\thisrefX
8657: \csname XR#1\endcsname
8658: }%
8659: \ifx\thisrefX\relax
8660: % If not defined, say something at least.
8661: \angleleft un\-de\-fined\angleright
8662: \iflinks
8663: \ifhavexrefs
8664: {\toks0 = {#1}% avoid expansion of possibly-complex value
8665: \message{\linenumber Undefined cross reference `\the\toks0'.}}%
8666: \else
8667: \ifwarnedxrefs\else
8668: \global\warnedxrefstrue
8669: \message{Cross reference values unknown; you must run TeX again.}%
8670: \fi
8671: \fi
8672: \fi
8673: \else
8674: % It's defined, so just use it.
8675: \thisrefX
8676: \fi
8677: #2% Output the suffix in any case.
8678: }
8679:
8680: % This is the macro invoked by entries in the aux file. Usually it's
8681: % just a \def (we prepend XR to the control sequence name to avoid
8682: % collisions). But if this is a float type, we have more work to do.
8683: %
8684: \def\xrdef#1#2{%
8685: {% The node name might contain 8-bit characters, which in our current
8686: % implementation are changed to commands like @'e. Don't let these
8687: % mess up the control sequence name.
8688: \indexnofonts
8689: \turnoffactive
8690: \xdef\safexrefname{#1}%
8691: }%
8692: %
8693: \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
8694: %
8695: % Was that xref control sequence that we just defined for a float?
8696: \expandafter\iffloat\csname XR\safexrefname\endcsname
8697: % it was a float, and we have the (safe) float type in \iffloattype.
8698: \expandafter\let\expandafter\floatlist
8699: \csname floatlist\iffloattype\endcsname
8700: %
8701: % Is this the first time we've seen this float type?
8702: \expandafter\ifx\floatlist\relax
8703: \toks0 = {\do}% yes, so just \do
8704: \else
8705: % had it before, so preserve previous elements in list.
8706: \toks0 = \expandafter{\floatlist\do}%
8707: \fi
8708: %
8709: % Remember this xref in the control sequence \floatlistFLOATTYPE,
8710: % for later use in \listoffloats.
8711: \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
8712: {\safexrefname}}%
8713: \fi
8714: }
8715:
1.1.1.2 ! misho 8716: % If working on a large document in chapters, it is convenient to
! 8717: % be able to disable indexing, cross-referencing, and contents, for test runs.
! 8718: % This is done with @novalidate at the beginning of the file.
! 8719: %
! 8720: \newif\iflinks \linkstrue % by default we want the aux files.
! 8721: \let\novalidate = \linksfalse
! 8722:
! 8723: % Used when writing to the aux file, or when using data from it.
! 8724: \def\requireauxfile{%
! 8725: \iflinks
! 8726: \tryauxfile
! 8727: % Open the new aux file. TeX will close it automatically at exit.
! 8728: \immediate\openout\auxfile=\jobname.aux
! 8729: \fi
! 8730: \global\let\requireauxfile=\relax % Only do this once.
! 8731: }
! 8732:
1.1 misho 8733: % Read the last existing aux file, if any. No error if none exists.
8734: %
8735: \def\tryauxfile{%
8736: \openin 1 \jobname.aux
8737: \ifeof 1 \else
8738: \readdatafile{aux}%
8739: \global\havexrefstrue
8740: \fi
8741: \closein 1
8742: }
8743:
8744: \def\setupdatafile{%
8745: \catcode`\^^@=\other
8746: \catcode`\^^A=\other
8747: \catcode`\^^B=\other
8748: \catcode`\^^C=\other
8749: \catcode`\^^D=\other
8750: \catcode`\^^E=\other
8751: \catcode`\^^F=\other
8752: \catcode`\^^G=\other
8753: \catcode`\^^H=\other
8754: \catcode`\^^K=\other
8755: \catcode`\^^L=\other
8756: \catcode`\^^N=\other
8757: \catcode`\^^P=\other
8758: \catcode`\^^Q=\other
8759: \catcode`\^^R=\other
8760: \catcode`\^^S=\other
8761: \catcode`\^^T=\other
8762: \catcode`\^^U=\other
8763: \catcode`\^^V=\other
8764: \catcode`\^^W=\other
8765: \catcode`\^^X=\other
8766: \catcode`\^^Z=\other
8767: \catcode`\^^[=\other
8768: \catcode`\^^\=\other
8769: \catcode`\^^]=\other
8770: \catcode`\^^^=\other
8771: \catcode`\^^_=\other
8772: % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
8773: % in xref tags, i.e., node names. But since ^^e4 notation isn't
8774: % supported in the main text, it doesn't seem desirable. Furthermore,
8775: % that is not enough: for node names that actually contain a ^
8776: % character, we would end up writing a line like this: 'xrdef {'hat
8777: % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
8778: % argument, and \hat is not an expandable control sequence. It could
8779: % all be worked out, but why? Either we support ^^ or we don't.
8780: %
8781: % The other change necessary for this was to define \auxhat:
8782: % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
8783: % and then to call \auxhat in \setq.
8784: %
8785: \catcode`\^=\other
8786: %
8787: % Special characters. Should be turned off anyway, but...
8788: \catcode`\~=\other
8789: \catcode`\[=\other
8790: \catcode`\]=\other
8791: \catcode`\"=\other
8792: \catcode`\_=\other
8793: \catcode`\|=\other
8794: \catcode`\<=\other
8795: \catcode`\>=\other
8796: \catcode`\$=\other
8797: \catcode`\#=\other
8798: \catcode`\&=\other
8799: \catcode`\%=\other
8800: \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
8801: %
8802: % This is to support \ in node names and titles, since the \
8803: % characters end up in a \csname. It's easier than
8804: % leaving it active and making its active definition an actual \
8805: % character. What I don't understand is why it works in the *value*
8806: % of the xrdef. Seems like it should be a catcode12 \, and that
8807: % should not typeset properly. But it works, so I'm moving on for
8808: % now. --karl, 15jan04.
8809: \catcode`\\=\other
8810: %
8811: % Make the characters 128-255 be printing characters.
1.1.1.2 ! misho 8812: {\setnonasciicharscatcodenonglobal\other}%
1.1 misho 8813: %
8814: % @ is our escape character in .aux files, and we need braces.
8815: \catcode`\{=1
8816: \catcode`\}=2
8817: \catcode`\@=0
8818: }
8819:
8820: \def\readdatafile#1{%
8821: \begingroup
8822: \setupdatafile
8823: \input\jobname.#1
8824: \endgroup}
8825:
8826:
8827: \message{insertions,}
8828: % including footnotes.
8829:
8830: \newcount \footnoteno
8831:
8832: % The trailing space in the following definition for supereject is
8833: % vital for proper filling; pages come out unaligned when you do a
8834: % pagealignmacro call if that space before the closing brace is
8835: % removed. (Generally, numeric constants should always be followed by a
8836: % space to prevent strange expansion errors.)
8837: \def\supereject{\par\penalty -20000\footnoteno =0 }
8838:
8839: % @footnotestyle is meaningful for Info output only.
8840: \let\footnotestyle=\comment
8841:
8842: {\catcode `\@=11
8843: %
8844: % Auto-number footnotes. Otherwise like plain.
8845: \gdef\footnote{%
8846: \global\advance\footnoteno by \@ne
8847: \edef\thisfootno{$^{\the\footnoteno}$}%
8848: %
8849: % In case the footnote comes at the end of a sentence, preserve the
8850: % extra spacing after we do the footnote number.
8851: \let\@sf\empty
8852: \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
8853: %
8854: % Remove inadvertent blank space before typesetting the footnote number.
8855: \unskip
8856: \thisfootno\@sf
8857: \dofootnote
8858: }%
8859:
8860: % Don't bother with the trickery in plain.tex to not require the
8861: % footnote text as a parameter. Our footnotes don't need to be so general.
8862: %
8863: % Oh yes, they do; otherwise, @ifset (and anything else that uses
8864: % \parseargline) fails inside footnotes because the tokens are fixed when
8865: % the footnote is read. --karl, 16nov96.
8866: %
8867: \gdef\dofootnote{%
8868: \insert\footins\bgroup
1.1.1.2 ! misho 8869: %
! 8870: % Nested footnotes are not supported in TeX, that would take a lot
! 8871: % more work. (\startsavinginserts does not suffice.)
! 8872: \let\footnote=\errfootnotenest
! 8873: %
1.1 misho 8874: % We want to typeset this text as a normal paragraph, even if the
8875: % footnote reference occurs in (for example) a display environment.
8876: % So reset some parameters.
8877: \hsize=\pagewidth
8878: \interlinepenalty\interfootnotelinepenalty
8879: \splittopskip\ht\strutbox % top baseline for broken footnotes
8880: \splitmaxdepth\dp\strutbox
8881: \floatingpenalty\@MM
8882: \leftskip\z@skip
8883: \rightskip\z@skip
8884: \spaceskip\z@skip
8885: \xspaceskip\z@skip
8886: \parindent\defaultparindent
8887: %
8888: \smallfonts \rm
8889: %
8890: % Because we use hanging indentation in footnotes, a @noindent appears
8891: % to exdent this text, so make it be a no-op. makeinfo does not use
8892: % hanging indentation so @noindent can still be needed within footnote
8893: % text after an @example or the like (not that this is good style).
8894: \let\noindent = \relax
8895: %
8896: % Hang the footnote text off the number. Use \everypar in case the
8897: % footnote extends for more than one paragraph.
8898: \everypar = {\hang}%
8899: \textindent{\thisfootno}%
8900: %
8901: % Don't crash into the line above the footnote text. Since this
8902: % expands into a box, it must come within the paragraph, lest it
8903: % provide a place where TeX can split the footnote.
8904: \footstrut
8905: %
8906: % Invoke rest of plain TeX footnote routine.
8907: \futurelet\next\fo@t
8908: }
8909: }%end \catcode `\@=11
8910:
1.1.1.2 ! misho 8911: \def\errfootnotenest{%
! 8912: \errhelp=\EMsimple
! 8913: \errmessage{Nested footnotes not supported in texinfo.tex,
! 8914: even though they work in makeinfo; sorry}
! 8915: }
! 8916:
! 8917: \def\errfootnoteheading{%
! 8918: \errhelp=\EMsimple
! 8919: \errmessage{Footnotes in chapters, sections, etc., are not supported}
! 8920: }
! 8921:
1.1 misho 8922: % In case a @footnote appears in a vbox, save the footnote text and create
8923: % the real \insert just after the vbox finished. Otherwise, the insertion
8924: % would be lost.
8925: % Similarly, if a @footnote appears inside an alignment, save the footnote
8926: % text to a box and make the \insert when a row of the table is finished.
8927: % And the same can be done for other insert classes. --kasal, 16nov03.
1.1.1.2 ! misho 8928: %
1.1 misho 8929: % Replace the \insert primitive by a cheating macro.
8930: % Deeper inside, just make sure that the saved insertions are not spilled
8931: % out prematurely.
8932: %
8933: \def\startsavinginserts{%
8934: \ifx \insert\ptexinsert
8935: \let\insert\saveinsert
8936: \else
8937: \let\checkinserts\relax
8938: \fi
8939: }
8940:
8941: % This \insert replacement works for both \insert\footins{foo} and
8942: % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
8943: %
8944: \def\saveinsert#1{%
8945: \edef\next{\noexpand\savetobox \makeSAVEname#1}%
8946: \afterassignment\next
8947: % swallow the left brace
8948: \let\temp =
8949: }
8950: \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
8951: \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
8952:
8953: \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
8954:
8955: \def\placesaveins#1{%
8956: \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
8957: {\box#1}%
8958: }
8959:
8960: % eat @SAVE -- beware, all of them have catcode \other:
8961: {
8962: \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
8963: \gdef\gobblesave @SAVE{}
8964: }
8965:
8966: % initialization:
8967: \def\newsaveins #1{%
8968: \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
8969: \next
8970: }
8971: \def\newsaveinsX #1{%
8972: \csname newbox\endcsname #1%
8973: \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
8974: \checksaveins #1}%
8975: }
8976:
8977: % initialize:
8978: \let\checkinserts\empty
8979: \newsaveins\footins
8980: \newsaveins\margin
8981:
8982:
8983: % @image. We use the macros from epsf.tex to support this.
8984: % If epsf.tex is not installed and @image is used, we complain.
8985: %
8986: % Check for and read epsf.tex up front. If we read it only at @image
8987: % time, we might be inside a group, and then its definitions would get
8988: % undone and the next image would fail.
8989: \openin 1 = epsf.tex
8990: \ifeof 1 \else
8991: % Do not bother showing banner with epsf.tex v2.7k (available in
8992: % doc/epsf.tex and on ctan).
8993: \def\epsfannounce{\toks0 = }%
8994: \input epsf.tex
8995: \fi
8996: \closein 1
8997: %
8998: % We will only complain once about lack of epsf.tex.
8999: \newif\ifwarnednoepsf
9000: \newhelp\noepsfhelp{epsf.tex must be installed for images to
9001: work. It is also included in the Texinfo distribution, or you can get
9002: it from ftp://tug.org/tex/epsf.tex.}
9003: %
9004: \def\image#1{%
9005: \ifx\epsfbox\thisisundefined
9006: \ifwarnednoepsf \else
9007: \errhelp = \noepsfhelp
9008: \errmessage{epsf.tex not found, images will be ignored}%
9009: \global\warnednoepsftrue
9010: \fi
9011: \else
9012: \imagexxx #1,,,,,\finish
9013: \fi
9014: }
9015: %
9016: % Arguments to @image:
9017: % #1 is (mandatory) image filename; we tack on .eps extension.
9018: % #2 is (optional) width, #3 is (optional) height.
9019: % #4 is (ignored optional) html alt text.
9020: % #5 is (ignored optional) extension.
9021: % #6 is just the usual extra ignored arg for parsing stuff.
9022: \newif\ifimagevmode
9023: \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
9024: \catcode`\^^M = 5 % in case we're inside an example
9025: \normalturnoffactive % allow _ et al. in names
1.1.1.2 ! misho 9026: \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
1.1 misho 9027: % If the image is by itself, center it.
9028: \ifvmode
9029: \imagevmodetrue
9030: \else \ifx\centersub\centerV
9031: % for @center @image, we need a vbox so we can have our vertical space
9032: \imagevmodetrue
9033: \vbox\bgroup % vbox has better behavior than vtop herev
9034: \fi\fi
9035: %
9036: \ifimagevmode
9037: \nobreak\medskip
9038: % Usually we'll have text after the image which will insert
9039: % \parskip glue, so insert it here too to equalize the space
9040: % above and below.
9041: \nobreak\vskip\parskip
9042: \nobreak
9043: \fi
9044: %
9045: % Leave vertical mode so that indentation from an enclosing
9046: % environment such as @quotation is respected.
9047: % However, if we're at the top level, we don't want the
9048: % normal paragraph indentation.
9049: % On the other hand, if we are in the case of @center @image, we don't
9050: % want to start a paragraph, which will create a hsize-width box and
9051: % eradicate the centering.
9052: \ifx\centersub\centerV\else \noindent \fi
9053: %
9054: % Output the image.
9055: \ifpdf
9056: \dopdfimage{#1}{#2}{#3}%
9057: \else
9058: % \epsfbox itself resets \epsf?size at each figure.
9059: \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
9060: \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
9061: \epsfbox{#1.eps}%
9062: \fi
9063: %
9064: \ifimagevmode
9065: \medskip % space after a standalone image
9066: \fi
9067: \ifx\centersub\centerV \egroup \fi
9068: \endgroup}
9069:
9070:
9071: % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
9072: % etc. We don't actually implement floating yet, we always include the
9073: % float "here". But it seemed the best name for the future.
9074: %
9075: \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
9076:
9077: % There may be a space before second and/or third parameter; delete it.
9078: \def\eatcommaspace#1, {#1,}
9079:
9080: % #1 is the optional FLOATTYPE, the text label for this float, typically
9081: % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
9082: % this float will not be numbered and cannot be referred to.
9083: %
9084: % #2 is the optional xref label. Also must be present for the float to
9085: % be referable.
9086: %
9087: % #3 is the optional positioning argument; for now, it is ignored. It
9088: % will somehow specify the positions allowed to float to (here, top, bottom).
9089: %
9090: % We keep a separate counter for each FLOATTYPE, which we reset at each
9091: % chapter-level command.
9092: \let\resetallfloatnos=\empty
9093: %
9094: \def\dofloat#1,#2,#3,#4\finish{%
9095: \let\thiscaption=\empty
9096: \let\thisshortcaption=\empty
9097: %
9098: % don't lose footnotes inside @float.
9099: %
9100: % BEWARE: when the floats start float, we have to issue warning whenever an
9101: % insert appears inside a float which could possibly float. --kasal, 26may04
9102: %
9103: \startsavinginserts
9104: %
9105: % We can't be used inside a paragraph.
9106: \par
9107: %
9108: \vtop\bgroup
9109: \def\floattype{#1}%
9110: \def\floatlabel{#2}%
9111: \def\floatloc{#3}% we do nothing with this yet.
9112: %
9113: \ifx\floattype\empty
9114: \let\safefloattype=\empty
9115: \else
9116: {%
9117: % the floattype might have accents or other special characters,
9118: % but we need to use it in a control sequence name.
9119: \indexnofonts
9120: \turnoffactive
9121: \xdef\safefloattype{\floattype}%
9122: }%
9123: \fi
9124: %
9125: % If label is given but no type, we handle that as the empty type.
9126: \ifx\floatlabel\empty \else
9127: % We want each FLOATTYPE to be numbered separately (Figure 1,
9128: % Table 1, Figure 2, ...). (And if no label, no number.)
9129: %
9130: \expandafter\getfloatno\csname\safefloattype floatno\endcsname
9131: \global\advance\floatno by 1
9132: %
9133: {%
9134: % This magic value for \lastsection is output by \setref as the
9135: % XREFLABEL-title value. \xrefX uses it to distinguish float
9136: % labels (which have a completely different output format) from
9137: % node and anchor labels. And \xrdef uses it to construct the
9138: % lists of floats.
9139: %
9140: \edef\lastsection{\floatmagic=\safefloattype}%
9141: \setref{\floatlabel}{Yfloat}%
9142: }%
9143: \fi
9144: %
9145: % start with \parskip glue, I guess.
9146: \vskip\parskip
9147: %
9148: % Don't suppress indentation if a float happens to start a section.
9149: \restorefirstparagraphindent
9150: }
9151:
9152: % we have these possibilities:
9153: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
9154: % @float Foo,lbl & no caption: Foo 1.1
9155: % @float Foo & @caption{Cap}: Foo: Cap
9156: % @float Foo & no caption: Foo
9157: % @float ,lbl & Caption{Cap}: 1.1: Cap
9158: % @float ,lbl & no caption: 1.1
9159: % @float & @caption{Cap}: Cap
9160: % @float & no caption:
9161: %
9162: \def\Efloat{%
9163: \let\floatident = \empty
9164: %
9165: % In all cases, if we have a float type, it comes first.
9166: \ifx\floattype\empty \else \def\floatident{\floattype}\fi
9167: %
9168: % If we have an xref label, the number comes next.
9169: \ifx\floatlabel\empty \else
9170: \ifx\floattype\empty \else % if also had float type, need tie first.
9171: \appendtomacro\floatident{\tie}%
9172: \fi
9173: % the number.
9174: \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
9175: \fi
9176: %
9177: % Start the printed caption with what we've constructed in
9178: % \floatident, but keep it separate; we need \floatident again.
9179: \let\captionline = \floatident
9180: %
9181: \ifx\thiscaption\empty \else
9182: \ifx\floatident\empty \else
9183: \appendtomacro\captionline{: }% had ident, so need a colon between
9184: \fi
9185: %
9186: % caption text.
9187: \appendtomacro\captionline{\scanexp\thiscaption}%
9188: \fi
9189: %
9190: % If we have anything to print, print it, with space before.
9191: % Eventually this needs to become an \insert.
9192: \ifx\captionline\empty \else
9193: \vskip.5\parskip
9194: \captionline
9195: %
9196: % Space below caption.
9197: \vskip\parskip
9198: \fi
9199: %
9200: % If have an xref label, write the list of floats info. Do this
9201: % after the caption, to avoid chance of it being a breakpoint.
9202: \ifx\floatlabel\empty \else
9203: % Write the text that goes in the lof to the aux file as
9204: % \floatlabel-lof. Besides \floatident, we include the short
9205: % caption if specified, else the full caption if specified, else nothing.
9206: {%
1.1.1.2 ! misho 9207: \requireauxfile
1.1 misho 9208: \atdummies
9209: %
9210: % since we read the caption text in the macro world, where ^^M
9211: % is turned into a normal character, we have to scan it back, so
9212: % we don't write the literal three characters "^^M" into the aux file.
9213: \scanexp{%
9214: \xdef\noexpand\gtemp{%
9215: \ifx\thisshortcaption\empty
9216: \thiscaption
9217: \else
9218: \thisshortcaption
9219: \fi
9220: }%
9221: }%
9222: \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
9223: \ifx\gtemp\empty \else : \gtemp \fi}}%
9224: }%
9225: \fi
9226: \egroup % end of \vtop
9227: %
9228: % place the captured inserts
9229: %
9230: % BEWARE: when the floats start floating, we have to issue warning
9231: % whenever an insert appears inside a float which could possibly
9232: % float. --kasal, 26may04
9233: %
9234: \checkinserts
9235: }
9236:
9237: % Append the tokens #2 to the definition of macro #1, not expanding either.
9238: %
9239: \def\appendtomacro#1#2{%
9240: \expandafter\def\expandafter#1\expandafter{#1#2}%
9241: }
9242:
9243: % @caption, @shortcaption
9244: %
9245: \def\caption{\docaption\thiscaption}
9246: \def\shortcaption{\docaption\thisshortcaption}
9247: \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
9248: \def\defcaption#1#2{\egroup \def#1{#2}}
9249:
9250: % The parameter is the control sequence identifying the counter we are
9251: % going to use. Create it if it doesn't exist and assign it to \floatno.
9252: \def\getfloatno#1{%
9253: \ifx#1\relax
9254: % Haven't seen this figure type before.
9255: \csname newcount\endcsname #1%
9256: %
9257: % Remember to reset this floatno at the next chap.
9258: \expandafter\gdef\expandafter\resetallfloatnos
9259: \expandafter{\resetallfloatnos #1=0 }%
9260: \fi
9261: \let\floatno#1%
9262: }
9263:
9264: % \setref calls this to get the XREFLABEL-snt value. We want an @xref
9265: % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
9266: % first read the @float command.
9267: %
9268: \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
9269:
9270: % Magic string used for the XREFLABEL-title value, so \xrefX can
9271: % distinguish floats from other xref types.
9272: \def\floatmagic{!!float!!}
9273:
9274: % #1 is the control sequence we are passed; we expand into a conditional
9275: % which is true if #1 represents a float ref. That is, the magic
9276: % \lastsection value which we \setref above.
9277: %
9278: \def\iffloat#1{\expandafter\doiffloat#1==\finish}
9279: %
9280: % #1 is (maybe) the \floatmagic string. If so, #2 will be the
9281: % (safe) float type for this float. We set \iffloattype to #2.
9282: %
9283: \def\doiffloat#1=#2=#3\finish{%
9284: \def\temp{#1}%
9285: \def\iffloattype{#2}%
9286: \ifx\temp\floatmagic
9287: }
9288:
9289: % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
9290: %
9291: \parseargdef\listoffloats{%
9292: \def\floattype{#1}% floattype
9293: {%
9294: % the floattype might have accents or other special characters,
9295: % but we need to use it in a control sequence name.
9296: \indexnofonts
9297: \turnoffactive
9298: \xdef\safefloattype{\floattype}%
9299: }%
9300: %
9301: % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
9302: \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
9303: \ifhavexrefs
9304: % if the user said @listoffloats foo but never @float foo.
9305: \message{\linenumber No `\safefloattype' floats to list.}%
9306: \fi
9307: \else
9308: \begingroup
9309: \leftskip=\tocindent % indent these entries like a toc
9310: \let\do=\listoffloatsdo
9311: \csname floatlist\safefloattype\endcsname
9312: \endgroup
9313: \fi
9314: }
9315:
9316: % This is called on each entry in a list of floats. We're passed the
9317: % xref label, in the form LABEL-title, which is how we save it in the
9318: % aux file. We strip off the -title and look up \XRLABEL-lof, which
9319: % has the text we're supposed to typeset here.
9320: %
9321: % Figures without xref labels will not be included in the list (since
9322: % they won't appear in the aux file).
9323: %
9324: \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
9325: \def\listoffloatsdoentry#1-title\finish{{%
9326: % Can't fully expand XR#1-lof because it can contain anything. Just
9327: % pass the control sequence. On the other hand, XR#1-pg is just the
9328: % page number, and we want to fully expand that so we can get a link
9329: % in pdf output.
9330: \toksA = \expandafter{\csname XR#1-lof\endcsname}%
9331: %
9332: % use the same \entry macro we use to generate the TOC and index.
9333: \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
9334: \writeentry
9335: }}
9336:
9337:
9338: \message{localization,}
9339:
9340: % For single-language documents, @documentlanguage is usually given very
9341: % early, just after @documentencoding. Single argument is the language
9342: % (de) or locale (de_DE) abbreviation.
9343: %
9344: {
9345: \catcode`\_ = \active
9346: \globaldefs=1
1.1.1.2 ! misho 9347: \parseargdef\documentlanguage{%
1.1 misho 9348: \tex % read txi-??.tex file in plain TeX.
9349: % Read the file by the name they passed if it exists.
1.1.1.2 ! misho 9350: \let_ = \normalunderscore % normal _ character for filename test
1.1 misho 9351: \openin 1 txi-#1.tex
9352: \ifeof 1
1.1.1.2 ! misho 9353: \documentlanguagetrywithoutunderscore #1_\finish
1.1 misho 9354: \else
9355: \globaldefs = 1 % everything in the txi-LL files needs to persist
9356: \input txi-#1.tex
9357: \fi
9358: \closein 1
9359: \endgroup % end raw TeX
1.1.1.2 ! misho 9360: }
1.1 misho 9361: %
9362: % If they passed de_DE, and txi-de_DE.tex doesn't exist,
9363: % try txi-de.tex.
9364: %
9365: \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
9366: \openin 1 txi-#1.tex
9367: \ifeof 1
9368: \errhelp = \nolanghelp
9369: \errmessage{Cannot read language file txi-#1.tex}%
9370: \else
9371: \globaldefs = 1 % everything in the txi-LL files needs to persist
9372: \input txi-#1.tex
9373: \fi
9374: \closein 1
9375: }
9376: }% end of special _ catcode
9377: %
9378: \newhelp\nolanghelp{The given language definition file cannot be found or
9379: is empty. Maybe you need to install it? Putting it in the current
9380: directory should work if nowhere else does.}
9381:
9382: % This macro is called from txi-??.tex files; the first argument is the
9383: % \language name to set (without the "\lang@" prefix), the second and
9384: % third args are \{left,right}hyphenmin.
9385: %
9386: % The language names to pass are determined when the format is built.
9387: % See the etex.log file created at that time, e.g.,
9388: % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
9389: %
9390: % With TeX Live 2008, etex now includes hyphenation patterns for all
9391: % available languages. This means we can support hyphenation in
9392: % Texinfo, at least to some extent. (This still doesn't solve the
9393: % accented characters problem.)
9394: %
9395: \catcode`@=11
9396: \def\txisetlanguage#1#2#3{%
9397: % do not set the language if the name is undefined in the current TeX.
9398: \expandafter\ifx\csname lang@#1\endcsname \relax
9399: \message{no patterns for #1}%
9400: \else
9401: \global\language = \csname lang@#1\endcsname
9402: \fi
9403: % but there is no harm in adjusting the hyphenmin values regardless.
9404: \global\lefthyphenmin = #2\relax
9405: \global\righthyphenmin = #3\relax
9406: }
9407:
9408: % Helpers for encodings.
9409: % Set the catcode of characters 128 through 255 to the specified number.
9410: %
9411: \def\setnonasciicharscatcode#1{%
9412: \count255=128
9413: \loop\ifnum\count255<256
9414: \global\catcode\count255=#1\relax
9415: \advance\count255 by 1
9416: \repeat
9417: }
9418:
9419: \def\setnonasciicharscatcodenonglobal#1{%
9420: \count255=128
9421: \loop\ifnum\count255<256
9422: \catcode\count255=#1\relax
9423: \advance\count255 by 1
9424: \repeat
9425: }
9426:
9427: % @documentencoding sets the definition of non-ASCII characters
9428: % according to the specified encoding.
9429: %
1.1.1.2 ! misho 9430: \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
! 9431: \def\documentencodingzzz#1{%
1.1 misho 9432: % Encoding being declared for the document.
9433: \def\declaredencoding{\csname #1.enc\endcsname}%
9434: %
9435: % Supported encodings: names converted to tokens in order to be able
9436: % to compare them with \ifx.
9437: \def\ascii{\csname US-ASCII.enc\endcsname}%
9438: \def\latnine{\csname ISO-8859-15.enc\endcsname}%
9439: \def\latone{\csname ISO-8859-1.enc\endcsname}%
9440: \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
9441: \def\utfeight{\csname UTF-8.enc\endcsname}%
9442: %
9443: \ifx \declaredencoding \ascii
9444: \asciichardefs
9445: %
9446: \else \ifx \declaredencoding \lattwo
9447: \setnonasciicharscatcode\active
9448: \lattwochardefs
9449: %
9450: \else \ifx \declaredencoding \latone
9451: \setnonasciicharscatcode\active
9452: \latonechardefs
9453: %
9454: \else \ifx \declaredencoding \latnine
9455: \setnonasciicharscatcode\active
9456: \latninechardefs
9457: %
9458: \else \ifx \declaredencoding \utfeight
9459: \setnonasciicharscatcode\active
1.1.1.2 ! misho 9460: % since we already invoked \utfeightchardefs at the top level
! 9461: % (below), do not re-invoke it, then our check for duplicated
! 9462: % definitions triggers. Making non-ascii chars active is enough.
1.1 misho 9463: %
9464: \else
1.1.1.2 ! misho 9465: \message{Ignoring unknown document encoding: #1.}%
1.1 misho 9466: %
9467: \fi % utfeight
9468: \fi % latnine
9469: \fi % latone
9470: \fi % lattwo
9471: \fi % ascii
9472: }
9473:
1.1.1.2 ! misho 9474: % emacs-page
1.1 misho 9475: % A message to be logged when using a character that isn't available
9476: % the default font encoding (OT1).
9477: %
1.1.1.2 ! misho 9478: \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
1.1 misho 9479:
9480: % Take account of \c (plain) vs. \, (Texinfo) difference.
9481: \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
9482:
9483: % First, make active non-ASCII characters in order for them to be
9484: % correctly categorized when TeX reads the replacement text of
9485: % macros containing the character definitions.
9486: \setnonasciicharscatcode\active
9487: %
9488: % Latin1 (ISO-8859-1) character definitions.
9489: \def\latonechardefs{%
9490: \gdef^^a0{\tie}
9491: \gdef^^a1{\exclamdown}
1.1.1.2 ! misho 9492: \gdef^^a2{{\tcfont \char162}} % cent
! 9493: \gdef^^a3{\pounds}
! 9494: \gdef^^a4{{\tcfont \char164}} % currency
! 9495: \gdef^^a5{{\tcfont \char165}} % yen
! 9496: \gdef^^a6{{\tcfont \char166}} % broken bar
1.1 misho 9497: \gdef^^a7{\S}
9498: \gdef^^a8{\"{}}
9499: \gdef^^a9{\copyright}
9500: \gdef^^aa{\ordf}
9501: \gdef^^ab{\guillemetleft}
1.1.1.2 ! misho 9502: \gdef^^ac{\ensuremath\lnot}
1.1 misho 9503: \gdef^^ad{\-}
9504: \gdef^^ae{\registeredsymbol}
9505: \gdef^^af{\={}}
9506: %
9507: \gdef^^b0{\textdegree}
9508: \gdef^^b1{$\pm$}
9509: \gdef^^b2{$^2$}
9510: \gdef^^b3{$^3$}
9511: \gdef^^b4{\'{}}
9512: \gdef^^b5{$\mu$}
9513: \gdef^^b6{\P}
1.1.1.2 ! misho 9514: \gdef^^b7{\ensuremath\cdot}
1.1 misho 9515: \gdef^^b8{\cedilla\ }
9516: \gdef^^b9{$^1$}
9517: \gdef^^ba{\ordm}
9518: \gdef^^bb{\guillemetright}
9519: \gdef^^bc{$1\over4$}
9520: \gdef^^bd{$1\over2$}
9521: \gdef^^be{$3\over4$}
9522: \gdef^^bf{\questiondown}
9523: %
9524: \gdef^^c0{\`A}
9525: \gdef^^c1{\'A}
9526: \gdef^^c2{\^A}
9527: \gdef^^c3{\~A}
9528: \gdef^^c4{\"A}
9529: \gdef^^c5{\ringaccent A}
9530: \gdef^^c6{\AE}
9531: \gdef^^c7{\cedilla C}
9532: \gdef^^c8{\`E}
9533: \gdef^^c9{\'E}
9534: \gdef^^ca{\^E}
9535: \gdef^^cb{\"E}
9536: \gdef^^cc{\`I}
9537: \gdef^^cd{\'I}
9538: \gdef^^ce{\^I}
9539: \gdef^^cf{\"I}
9540: %
9541: \gdef^^d0{\DH}
9542: \gdef^^d1{\~N}
9543: \gdef^^d2{\`O}
9544: \gdef^^d3{\'O}
9545: \gdef^^d4{\^O}
9546: \gdef^^d5{\~O}
9547: \gdef^^d6{\"O}
9548: \gdef^^d7{$\times$}
9549: \gdef^^d8{\O}
9550: \gdef^^d9{\`U}
9551: \gdef^^da{\'U}
9552: \gdef^^db{\^U}
9553: \gdef^^dc{\"U}
9554: \gdef^^dd{\'Y}
9555: \gdef^^de{\TH}
9556: \gdef^^df{\ss}
9557: %
9558: \gdef^^e0{\`a}
9559: \gdef^^e1{\'a}
9560: \gdef^^e2{\^a}
9561: \gdef^^e3{\~a}
9562: \gdef^^e4{\"a}
9563: \gdef^^e5{\ringaccent a}
9564: \gdef^^e6{\ae}
9565: \gdef^^e7{\cedilla c}
9566: \gdef^^e8{\`e}
9567: \gdef^^e9{\'e}
9568: \gdef^^ea{\^e}
9569: \gdef^^eb{\"e}
9570: \gdef^^ec{\`{\dotless i}}
9571: \gdef^^ed{\'{\dotless i}}
9572: \gdef^^ee{\^{\dotless i}}
9573: \gdef^^ef{\"{\dotless i}}
9574: %
9575: \gdef^^f0{\dh}
9576: \gdef^^f1{\~n}
9577: \gdef^^f2{\`o}
9578: \gdef^^f3{\'o}
9579: \gdef^^f4{\^o}
9580: \gdef^^f5{\~o}
9581: \gdef^^f6{\"o}
9582: \gdef^^f7{$\div$}
9583: \gdef^^f8{\o}
9584: \gdef^^f9{\`u}
9585: \gdef^^fa{\'u}
9586: \gdef^^fb{\^u}
9587: \gdef^^fc{\"u}
9588: \gdef^^fd{\'y}
9589: \gdef^^fe{\th}
9590: \gdef^^ff{\"y}
9591: }
9592:
9593: % Latin9 (ISO-8859-15) encoding character definitions.
9594: \def\latninechardefs{%
9595: % Encoding is almost identical to Latin1.
9596: \latonechardefs
9597: %
9598: \gdef^^a4{\euro}
9599: \gdef^^a6{\v S}
9600: \gdef^^a8{\v s}
9601: \gdef^^b4{\v Z}
9602: \gdef^^b8{\v z}
9603: \gdef^^bc{\OE}
9604: \gdef^^bd{\oe}
9605: \gdef^^be{\"Y}
9606: }
9607:
9608: % Latin2 (ISO-8859-2) character definitions.
9609: \def\lattwochardefs{%
9610: \gdef^^a0{\tie}
9611: \gdef^^a1{\ogonek{A}}
9612: \gdef^^a2{\u{}}
9613: \gdef^^a3{\L}
9614: \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
9615: \gdef^^a5{\v L}
9616: \gdef^^a6{\'S}
9617: \gdef^^a7{\S}
9618: \gdef^^a8{\"{}}
9619: \gdef^^a9{\v S}
9620: \gdef^^aa{\cedilla S}
9621: \gdef^^ab{\v T}
9622: \gdef^^ac{\'Z}
9623: \gdef^^ad{\-}
9624: \gdef^^ae{\v Z}
9625: \gdef^^af{\dotaccent Z}
9626: %
9627: \gdef^^b0{\textdegree}
9628: \gdef^^b1{\ogonek{a}}
9629: \gdef^^b2{\ogonek{ }}
9630: \gdef^^b3{\l}
9631: \gdef^^b4{\'{}}
9632: \gdef^^b5{\v l}
9633: \gdef^^b6{\'s}
9634: \gdef^^b7{\v{}}
9635: \gdef^^b8{\cedilla\ }
9636: \gdef^^b9{\v s}
9637: \gdef^^ba{\cedilla s}
9638: \gdef^^bb{\v t}
9639: \gdef^^bc{\'z}
9640: \gdef^^bd{\H{}}
9641: \gdef^^be{\v z}
9642: \gdef^^bf{\dotaccent z}
9643: %
9644: \gdef^^c0{\'R}
9645: \gdef^^c1{\'A}
9646: \gdef^^c2{\^A}
9647: \gdef^^c3{\u A}
9648: \gdef^^c4{\"A}
9649: \gdef^^c5{\'L}
9650: \gdef^^c6{\'C}
9651: \gdef^^c7{\cedilla C}
9652: \gdef^^c8{\v C}
9653: \gdef^^c9{\'E}
9654: \gdef^^ca{\ogonek{E}}
9655: \gdef^^cb{\"E}
9656: \gdef^^cc{\v E}
9657: \gdef^^cd{\'I}
9658: \gdef^^ce{\^I}
9659: \gdef^^cf{\v D}
9660: %
9661: \gdef^^d0{\DH}
9662: \gdef^^d1{\'N}
9663: \gdef^^d2{\v N}
9664: \gdef^^d3{\'O}
9665: \gdef^^d4{\^O}
9666: \gdef^^d5{\H O}
9667: \gdef^^d6{\"O}
9668: \gdef^^d7{$\times$}
9669: \gdef^^d8{\v R}
9670: \gdef^^d9{\ringaccent U}
9671: \gdef^^da{\'U}
9672: \gdef^^db{\H U}
9673: \gdef^^dc{\"U}
9674: \gdef^^dd{\'Y}
9675: \gdef^^de{\cedilla T}
9676: \gdef^^df{\ss}
9677: %
9678: \gdef^^e0{\'r}
9679: \gdef^^e1{\'a}
9680: \gdef^^e2{\^a}
9681: \gdef^^e3{\u a}
9682: \gdef^^e4{\"a}
9683: \gdef^^e5{\'l}
9684: \gdef^^e6{\'c}
9685: \gdef^^e7{\cedilla c}
9686: \gdef^^e8{\v c}
9687: \gdef^^e9{\'e}
9688: \gdef^^ea{\ogonek{e}}
9689: \gdef^^eb{\"e}
9690: \gdef^^ec{\v e}
9691: \gdef^^ed{\'{\dotless{i}}}
9692: \gdef^^ee{\^{\dotless{i}}}
9693: \gdef^^ef{\v d}
9694: %
9695: \gdef^^f0{\dh}
9696: \gdef^^f1{\'n}
9697: \gdef^^f2{\v n}
9698: \gdef^^f3{\'o}
9699: \gdef^^f4{\^o}
9700: \gdef^^f5{\H o}
9701: \gdef^^f6{\"o}
9702: \gdef^^f7{$\div$}
9703: \gdef^^f8{\v r}
9704: \gdef^^f9{\ringaccent u}
9705: \gdef^^fa{\'u}
9706: \gdef^^fb{\H u}
9707: \gdef^^fc{\"u}
9708: \gdef^^fd{\'y}
9709: \gdef^^fe{\cedilla t}
9710: \gdef^^ff{\dotaccent{}}
9711: }
9712:
9713: % UTF-8 character definitions.
9714: %
9715: % This code to support UTF-8 is based on LaTeX's utf8.def, with some
9716: % changes for Texinfo conventions. It is included here under the GPL by
9717: % permission from Frank Mittelbach and the LaTeX team.
9718: %
9719: \newcount\countUTFx
9720: \newcount\countUTFy
9721: \newcount\countUTFz
9722:
9723: \gdef\UTFviiiTwoOctets#1#2{\expandafter
9724: \UTFviiiDefined\csname u8:#1\string #2\endcsname}
9725: %
9726: \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
9727: \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
9728: %
9729: \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
9730: \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
9731:
9732: \gdef\UTFviiiDefined#1{%
9733: \ifx #1\relax
9734: \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
9735: \else
9736: \expandafter #1%
9737: \fi
9738: }
9739:
9740: \begingroup
9741: \catcode`\~13
9742: \catcode`\"12
9743:
9744: \def\UTFviiiLoop{%
9745: \global\catcode\countUTFx\active
9746: \uccode`\~\countUTFx
9747: \uppercase\expandafter{\UTFviiiTmp}%
9748: \advance\countUTFx by 1
9749: \ifnum\countUTFx < \countUTFy
9750: \expandafter\UTFviiiLoop
9751: \fi}
9752:
9753: \countUTFx = "C2
9754: \countUTFy = "E0
9755: \def\UTFviiiTmp{%
9756: \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
9757: \UTFviiiLoop
9758:
9759: \countUTFx = "E0
9760: \countUTFy = "F0
9761: \def\UTFviiiTmp{%
9762: \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
9763: \UTFviiiLoop
9764:
9765: \countUTFx = "F0
9766: \countUTFy = "F4
9767: \def\UTFviiiTmp{%
9768: \xdef~{\noexpand\UTFviiiFourOctets\string~}}
9769: \UTFviiiLoop
9770: \endgroup
9771:
1.1.1.2 ! misho 9772: \def\globallet{\global\let} % save some \expandafter's below
! 9773:
! 9774: % @U{xxxx} to produce U+xxxx, if we support it.
! 9775: \def\U#1{%
! 9776: \expandafter\ifx\csname uni:#1\endcsname \relax
! 9777: \errhelp = \EMsimple
! 9778: \errmessage{Unicode character U+#1 not supported, sorry}%
! 9779: \else
! 9780: \csname uni:#1\endcsname
! 9781: \fi
! 9782: }
! 9783:
1.1 misho 9784: \begingroup
9785: \catcode`\"=12
9786: \catcode`\<=12
9787: \catcode`\.=12
9788: \catcode`\,=12
9789: \catcode`\;=12
9790: \catcode`\!=12
9791: \catcode`\~=13
9792: \gdef\DeclareUnicodeCharacter#1#2{%
9793: \countUTFz = "#1\relax
9794: %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
9795: \begingroup
9796: \parseXMLCharref
9797: \def\UTFviiiTwoOctets##1##2{%
9798: \csname u8:##1\string ##2\endcsname}%
9799: \def\UTFviiiThreeOctets##1##2##3{%
9800: \csname u8:##1\string ##2\string ##3\endcsname}%
9801: \def\UTFviiiFourOctets##1##2##3##4{%
9802: \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
9803: \expandafter\expandafter\expandafter\expandafter
9804: \expandafter\expandafter\expandafter
9805: \gdef\UTFviiiTmp{#2}%
1.1.1.2 ! misho 9806: %
! 9807: \expandafter\ifx\csname uni:#1\endcsname \relax \else
! 9808: \message{Internal error, already defined: #1}%
! 9809: \fi
! 9810: %
! 9811: % define an additional control sequence for this code point.
! 9812: \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
1.1 misho 9813: \endgroup}
9814:
9815: \gdef\parseXMLCharref{%
9816: \ifnum\countUTFz < "A0\relax
9817: \errhelp = \EMsimple
9818: \errmessage{Cannot define Unicode char value < 00A0}%
9819: \else\ifnum\countUTFz < "800\relax
9820: \parseUTFviiiA,%
9821: \parseUTFviiiB C\UTFviiiTwoOctets.,%
9822: \else\ifnum\countUTFz < "10000\relax
9823: \parseUTFviiiA;%
9824: \parseUTFviiiA,%
9825: \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
9826: \else
9827: \parseUTFviiiA;%
9828: \parseUTFviiiA,%
9829: \parseUTFviiiA!%
9830: \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
9831: \fi\fi\fi
9832: }
9833:
9834: \gdef\parseUTFviiiA#1{%
9835: \countUTFx = \countUTFz
9836: \divide\countUTFz by 64
9837: \countUTFy = \countUTFz
9838: \multiply\countUTFz by 64
9839: \advance\countUTFx by -\countUTFz
9840: \advance\countUTFx by 128
9841: \uccode `#1\countUTFx
9842: \countUTFz = \countUTFy}
9843:
9844: \gdef\parseUTFviiiB#1#2#3#4{%
9845: \advance\countUTFz by "#10\relax
9846: \uccode `#3\countUTFz
9847: \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
9848: \endgroup
9849:
1.1.1.2 ! misho 9850: % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
! 9851: % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
! 9852: % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
! 9853: % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
! 9854: % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
! 9855: %
! 9856: % Many of our renditions are less than wonderful, and all the missing
! 9857: % characters are available somewhere. Loading the necessary fonts
! 9858: % awaits user request. We can't truly support Unicode without
! 9859: % reimplementing everything that's been done in LaTeX for many years,
! 9860: % plus probably using luatex or xetex, and who knows what else.
! 9861: % We won't be doing that here in this simple file. But we can try to at
! 9862: % least make most of the characters not bomb out.
! 9863: %
1.1 misho 9864: \def\utfeightchardefs{%
9865: \DeclareUnicodeCharacter{00A0}{\tie}
9866: \DeclareUnicodeCharacter{00A1}{\exclamdown}
1.1.1.2 ! misho 9867: \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
1.1 misho 9868: \DeclareUnicodeCharacter{00A3}{\pounds}
1.1.1.2 ! misho 9869: \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
! 9870: \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
! 9871: \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
! 9872: \DeclareUnicodeCharacter{00A7}{\S}
1.1 misho 9873: \DeclareUnicodeCharacter{00A8}{\"{ }}
9874: \DeclareUnicodeCharacter{00A9}{\copyright}
9875: \DeclareUnicodeCharacter{00AA}{\ordf}
9876: \DeclareUnicodeCharacter{00AB}{\guillemetleft}
1.1.1.2 ! misho 9877: \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}
1.1 misho 9878: \DeclareUnicodeCharacter{00AD}{\-}
9879: \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
9880: \DeclareUnicodeCharacter{00AF}{\={ }}
9881:
9882: \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
1.1.1.2 ! misho 9883: \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}
! 9884: \DeclareUnicodeCharacter{00B2}{$^2$}
! 9885: \DeclareUnicodeCharacter{00B3}{$^3$}
1.1 misho 9886: \DeclareUnicodeCharacter{00B4}{\'{ }}
1.1.1.2 ! misho 9887: \DeclareUnicodeCharacter{00B5}{$\mu$}
! 9888: \DeclareUnicodeCharacter{00B6}{\P}
! 9889: \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}
1.1 misho 9890: \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
1.1.1.2 ! misho 9891: \DeclareUnicodeCharacter{00B9}{$^1$}
1.1 misho 9892: \DeclareUnicodeCharacter{00BA}{\ordm}
9893: \DeclareUnicodeCharacter{00BB}{\guillemetright}
1.1.1.2 ! misho 9894: \DeclareUnicodeCharacter{00BC}{$1\over4$}
! 9895: \DeclareUnicodeCharacter{00BD}{$1\over2$}
! 9896: \DeclareUnicodeCharacter{00BE}{$3\over4$}
1.1 misho 9897: \DeclareUnicodeCharacter{00BF}{\questiondown}
9898:
9899: \DeclareUnicodeCharacter{00C0}{\`A}
9900: \DeclareUnicodeCharacter{00C1}{\'A}
9901: \DeclareUnicodeCharacter{00C2}{\^A}
9902: \DeclareUnicodeCharacter{00C3}{\~A}
9903: \DeclareUnicodeCharacter{00C4}{\"A}
9904: \DeclareUnicodeCharacter{00C5}{\AA}
9905: \DeclareUnicodeCharacter{00C6}{\AE}
9906: \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
9907: \DeclareUnicodeCharacter{00C8}{\`E}
9908: \DeclareUnicodeCharacter{00C9}{\'E}
9909: \DeclareUnicodeCharacter{00CA}{\^E}
9910: \DeclareUnicodeCharacter{00CB}{\"E}
9911: \DeclareUnicodeCharacter{00CC}{\`I}
9912: \DeclareUnicodeCharacter{00CD}{\'I}
9913: \DeclareUnicodeCharacter{00CE}{\^I}
9914: \DeclareUnicodeCharacter{00CF}{\"I}
9915:
9916: \DeclareUnicodeCharacter{00D0}{\DH}
9917: \DeclareUnicodeCharacter{00D1}{\~N}
9918: \DeclareUnicodeCharacter{00D2}{\`O}
9919: \DeclareUnicodeCharacter{00D3}{\'O}
9920: \DeclareUnicodeCharacter{00D4}{\^O}
9921: \DeclareUnicodeCharacter{00D5}{\~O}
9922: \DeclareUnicodeCharacter{00D6}{\"O}
1.1.1.2 ! misho 9923: \DeclareUnicodeCharacter{00D7}{\ensuremath\times}
1.1 misho 9924: \DeclareUnicodeCharacter{00D8}{\O}
9925: \DeclareUnicodeCharacter{00D9}{\`U}
9926: \DeclareUnicodeCharacter{00DA}{\'U}
9927: \DeclareUnicodeCharacter{00DB}{\^U}
9928: \DeclareUnicodeCharacter{00DC}{\"U}
9929: \DeclareUnicodeCharacter{00DD}{\'Y}
9930: \DeclareUnicodeCharacter{00DE}{\TH}
9931: \DeclareUnicodeCharacter{00DF}{\ss}
9932:
9933: \DeclareUnicodeCharacter{00E0}{\`a}
9934: \DeclareUnicodeCharacter{00E1}{\'a}
9935: \DeclareUnicodeCharacter{00E2}{\^a}
9936: \DeclareUnicodeCharacter{00E3}{\~a}
9937: \DeclareUnicodeCharacter{00E4}{\"a}
9938: \DeclareUnicodeCharacter{00E5}{\aa}
9939: \DeclareUnicodeCharacter{00E6}{\ae}
9940: \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
9941: \DeclareUnicodeCharacter{00E8}{\`e}
9942: \DeclareUnicodeCharacter{00E9}{\'e}
9943: \DeclareUnicodeCharacter{00EA}{\^e}
9944: \DeclareUnicodeCharacter{00EB}{\"e}
9945: \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
9946: \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
9947: \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
9948: \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
9949:
9950: \DeclareUnicodeCharacter{00F0}{\dh}
9951: \DeclareUnicodeCharacter{00F1}{\~n}
9952: \DeclareUnicodeCharacter{00F2}{\`o}
9953: \DeclareUnicodeCharacter{00F3}{\'o}
9954: \DeclareUnicodeCharacter{00F4}{\^o}
9955: \DeclareUnicodeCharacter{00F5}{\~o}
9956: \DeclareUnicodeCharacter{00F6}{\"o}
1.1.1.2 ! misho 9957: \DeclareUnicodeCharacter{00F7}{\ensuremath\div}
1.1 misho 9958: \DeclareUnicodeCharacter{00F8}{\o}
9959: \DeclareUnicodeCharacter{00F9}{\`u}
9960: \DeclareUnicodeCharacter{00FA}{\'u}
9961: \DeclareUnicodeCharacter{00FB}{\^u}
9962: \DeclareUnicodeCharacter{00FC}{\"u}
9963: \DeclareUnicodeCharacter{00FD}{\'y}
9964: \DeclareUnicodeCharacter{00FE}{\th}
9965: \DeclareUnicodeCharacter{00FF}{\"y}
9966:
9967: \DeclareUnicodeCharacter{0100}{\=A}
9968: \DeclareUnicodeCharacter{0101}{\=a}
9969: \DeclareUnicodeCharacter{0102}{\u{A}}
9970: \DeclareUnicodeCharacter{0103}{\u{a}}
9971: \DeclareUnicodeCharacter{0104}{\ogonek{A}}
9972: \DeclareUnicodeCharacter{0105}{\ogonek{a}}
9973: \DeclareUnicodeCharacter{0106}{\'C}
9974: \DeclareUnicodeCharacter{0107}{\'c}
9975: \DeclareUnicodeCharacter{0108}{\^C}
9976: \DeclareUnicodeCharacter{0109}{\^c}
9977: \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
9978: \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
9979: \DeclareUnicodeCharacter{010C}{\v{C}}
9980: \DeclareUnicodeCharacter{010D}{\v{c}}
9981: \DeclareUnicodeCharacter{010E}{\v{D}}
1.1.1.2 ! misho 9982: \DeclareUnicodeCharacter{010F}{d'}
1.1 misho 9983:
1.1.1.2 ! misho 9984: \DeclareUnicodeCharacter{0110}{\DH}
! 9985: \DeclareUnicodeCharacter{0111}{\dh}
1.1 misho 9986: \DeclareUnicodeCharacter{0112}{\=E}
9987: \DeclareUnicodeCharacter{0113}{\=e}
9988: \DeclareUnicodeCharacter{0114}{\u{E}}
9989: \DeclareUnicodeCharacter{0115}{\u{e}}
9990: \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
9991: \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
1.1.1.2 ! misho 9992: \DeclareUnicodeCharacter{0118}{\ogonek{E}}
! 9993: \DeclareUnicodeCharacter{0119}{\ogonek{e}}
1.1 misho 9994: \DeclareUnicodeCharacter{011A}{\v{E}}
9995: \DeclareUnicodeCharacter{011B}{\v{e}}
9996: \DeclareUnicodeCharacter{011C}{\^G}
9997: \DeclareUnicodeCharacter{011D}{\^g}
9998: \DeclareUnicodeCharacter{011E}{\u{G}}
9999: \DeclareUnicodeCharacter{011F}{\u{g}}
10000:
10001: \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
10002: \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
1.1.1.2 ! misho 10003: \DeclareUnicodeCharacter{0122}{\cedilla{G}}
! 10004: \DeclareUnicodeCharacter{0123}{\cedilla{g}}
1.1 misho 10005: \DeclareUnicodeCharacter{0124}{\^H}
10006: \DeclareUnicodeCharacter{0125}{\^h}
1.1.1.2 ! misho 10007: \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}
! 10008: \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}
1.1 misho 10009: \DeclareUnicodeCharacter{0128}{\~I}
10010: \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
10011: \DeclareUnicodeCharacter{012A}{\=I}
10012: \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
10013: \DeclareUnicodeCharacter{012C}{\u{I}}
10014: \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
1.1.1.2 ! misho 10015: \DeclareUnicodeCharacter{012E}{\ogonek{I}}
! 10016: \DeclareUnicodeCharacter{012F}{\ogonek{i}}
1.1 misho 10017:
10018: \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
10019: \DeclareUnicodeCharacter{0131}{\dotless{i}}
10020: \DeclareUnicodeCharacter{0132}{IJ}
10021: \DeclareUnicodeCharacter{0133}{ij}
10022: \DeclareUnicodeCharacter{0134}{\^J}
10023: \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
1.1.1.2 ! misho 10024: \DeclareUnicodeCharacter{0136}{\cedilla{K}}
! 10025: \DeclareUnicodeCharacter{0137}{\cedilla{k}}
! 10026: \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}
1.1 misho 10027: \DeclareUnicodeCharacter{0139}{\'L}
10028: \DeclareUnicodeCharacter{013A}{\'l}
1.1.1.2 ! misho 10029: \DeclareUnicodeCharacter{013B}{\cedilla{L}}
! 10030: \DeclareUnicodeCharacter{013C}{\cedilla{l}}
! 10031: \DeclareUnicodeCharacter{013D}{L'}% should kern
! 10032: \DeclareUnicodeCharacter{013E}{l'}% should kern
! 10033: \DeclareUnicodeCharacter{013F}{L\U{00B7}}
1.1 misho 10034:
1.1.1.2 ! misho 10035: \DeclareUnicodeCharacter{0140}{l\U{00B7}}
1.1 misho 10036: \DeclareUnicodeCharacter{0141}{\L}
10037: \DeclareUnicodeCharacter{0142}{\l}
10038: \DeclareUnicodeCharacter{0143}{\'N}
10039: \DeclareUnicodeCharacter{0144}{\'n}
1.1.1.2 ! misho 10040: \DeclareUnicodeCharacter{0145}{\cedilla{N}}
! 10041: \DeclareUnicodeCharacter{0146}{\cedilla{n}}
1.1 misho 10042: \DeclareUnicodeCharacter{0147}{\v{N}}
10043: \DeclareUnicodeCharacter{0148}{\v{n}}
1.1.1.2 ! misho 10044: \DeclareUnicodeCharacter{0149}{'n}
! 10045: \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}
! 10046: \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}
1.1 misho 10047: \DeclareUnicodeCharacter{014C}{\=O}
10048: \DeclareUnicodeCharacter{014D}{\=o}
10049: \DeclareUnicodeCharacter{014E}{\u{O}}
10050: \DeclareUnicodeCharacter{014F}{\u{o}}
10051:
10052: \DeclareUnicodeCharacter{0150}{\H{O}}
10053: \DeclareUnicodeCharacter{0151}{\H{o}}
10054: \DeclareUnicodeCharacter{0152}{\OE}
10055: \DeclareUnicodeCharacter{0153}{\oe}
10056: \DeclareUnicodeCharacter{0154}{\'R}
10057: \DeclareUnicodeCharacter{0155}{\'r}
1.1.1.2 ! misho 10058: \DeclareUnicodeCharacter{0156}{\cedilla{R}}
! 10059: \DeclareUnicodeCharacter{0157}{\cedilla{r}}
1.1 misho 10060: \DeclareUnicodeCharacter{0158}{\v{R}}
10061: \DeclareUnicodeCharacter{0159}{\v{r}}
10062: \DeclareUnicodeCharacter{015A}{\'S}
10063: \DeclareUnicodeCharacter{015B}{\'s}
10064: \DeclareUnicodeCharacter{015C}{\^S}
10065: \DeclareUnicodeCharacter{015D}{\^s}
10066: \DeclareUnicodeCharacter{015E}{\cedilla{S}}
10067: \DeclareUnicodeCharacter{015F}{\cedilla{s}}
10068:
10069: \DeclareUnicodeCharacter{0160}{\v{S}}
10070: \DeclareUnicodeCharacter{0161}{\v{s}}
1.1.1.2 ! misho 10071: \DeclareUnicodeCharacter{0162}{\cedilla{T}}
! 10072: \DeclareUnicodeCharacter{0163}{\cedilla{t}}
1.1 misho 10073: \DeclareUnicodeCharacter{0164}{\v{T}}
1.1.1.2 ! misho 10074: \DeclareUnicodeCharacter{0165}{\v{t}}
! 10075: \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}
! 10076: \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}
1.1 misho 10077: \DeclareUnicodeCharacter{0168}{\~U}
10078: \DeclareUnicodeCharacter{0169}{\~u}
10079: \DeclareUnicodeCharacter{016A}{\=U}
10080: \DeclareUnicodeCharacter{016B}{\=u}
10081: \DeclareUnicodeCharacter{016C}{\u{U}}
10082: \DeclareUnicodeCharacter{016D}{\u{u}}
10083: \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
10084: \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
10085:
10086: \DeclareUnicodeCharacter{0170}{\H{U}}
10087: \DeclareUnicodeCharacter{0171}{\H{u}}
1.1.1.2 ! misho 10088: \DeclareUnicodeCharacter{0172}{\ogonek{U}}
! 10089: \DeclareUnicodeCharacter{0173}{\ogonek{u}}
1.1 misho 10090: \DeclareUnicodeCharacter{0174}{\^W}
10091: \DeclareUnicodeCharacter{0175}{\^w}
10092: \DeclareUnicodeCharacter{0176}{\^Y}
10093: \DeclareUnicodeCharacter{0177}{\^y}
10094: \DeclareUnicodeCharacter{0178}{\"Y}
10095: \DeclareUnicodeCharacter{0179}{\'Z}
10096: \DeclareUnicodeCharacter{017A}{\'z}
10097: \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
10098: \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
10099: \DeclareUnicodeCharacter{017D}{\v{Z}}
10100: \DeclareUnicodeCharacter{017E}{\v{z}}
1.1.1.2 ! misho 10101: \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}
1.1 misho 10102:
10103: \DeclareUnicodeCharacter{01C4}{D\v{Z}}
10104: \DeclareUnicodeCharacter{01C5}{D\v{z}}
10105: \DeclareUnicodeCharacter{01C6}{d\v{z}}
10106: \DeclareUnicodeCharacter{01C7}{LJ}
10107: \DeclareUnicodeCharacter{01C8}{Lj}
10108: \DeclareUnicodeCharacter{01C9}{lj}
10109: \DeclareUnicodeCharacter{01CA}{NJ}
10110: \DeclareUnicodeCharacter{01CB}{Nj}
10111: \DeclareUnicodeCharacter{01CC}{nj}
10112: \DeclareUnicodeCharacter{01CD}{\v{A}}
10113: \DeclareUnicodeCharacter{01CE}{\v{a}}
10114: \DeclareUnicodeCharacter{01CF}{\v{I}}
10115:
10116: \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
10117: \DeclareUnicodeCharacter{01D1}{\v{O}}
10118: \DeclareUnicodeCharacter{01D2}{\v{o}}
10119: \DeclareUnicodeCharacter{01D3}{\v{U}}
10120: \DeclareUnicodeCharacter{01D4}{\v{u}}
10121:
10122: \DeclareUnicodeCharacter{01E2}{\={\AE}}
10123: \DeclareUnicodeCharacter{01E3}{\={\ae}}
10124: \DeclareUnicodeCharacter{01E6}{\v{G}}
10125: \DeclareUnicodeCharacter{01E7}{\v{g}}
10126: \DeclareUnicodeCharacter{01E8}{\v{K}}
10127: \DeclareUnicodeCharacter{01E9}{\v{k}}
10128:
10129: \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
10130: \DeclareUnicodeCharacter{01F1}{DZ}
10131: \DeclareUnicodeCharacter{01F2}{Dz}
10132: \DeclareUnicodeCharacter{01F3}{dz}
10133: \DeclareUnicodeCharacter{01F4}{\'G}
10134: \DeclareUnicodeCharacter{01F5}{\'g}
10135: \DeclareUnicodeCharacter{01F8}{\`N}
10136: \DeclareUnicodeCharacter{01F9}{\`n}
10137: \DeclareUnicodeCharacter{01FC}{\'{\AE}}
10138: \DeclareUnicodeCharacter{01FD}{\'{\ae}}
10139: \DeclareUnicodeCharacter{01FE}{\'{\O}}
10140: \DeclareUnicodeCharacter{01FF}{\'{\o}}
10141:
10142: \DeclareUnicodeCharacter{021E}{\v{H}}
10143: \DeclareUnicodeCharacter{021F}{\v{h}}
10144:
10145: \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
10146: \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
10147: \DeclareUnicodeCharacter{0228}{\cedilla{E}}
10148: \DeclareUnicodeCharacter{0229}{\cedilla{e}}
10149: \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
10150: \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
10151:
10152: \DeclareUnicodeCharacter{0232}{\=Y}
10153: \DeclareUnicodeCharacter{0233}{\=y}
10154: \DeclareUnicodeCharacter{0237}{\dotless{j}}
10155:
10156: \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
10157:
1.1.1.2 ! misho 10158: % Greek letters upper case
! 10159: \DeclareUnicodeCharacter{0391}{{\it A}}
! 10160: \DeclareUnicodeCharacter{0392}{{\it B}}
! 10161: \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}
! 10162: \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}
! 10163: \DeclareUnicodeCharacter{0395}{{\it E}}
! 10164: \DeclareUnicodeCharacter{0396}{{\it Z}}
! 10165: \DeclareUnicodeCharacter{0397}{{\it H}}
! 10166: \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}
! 10167: \DeclareUnicodeCharacter{0399}{{\it I}}
! 10168: \DeclareUnicodeCharacter{039A}{{\it K}}
! 10169: \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}
! 10170: \DeclareUnicodeCharacter{039C}{{\it M}}
! 10171: \DeclareUnicodeCharacter{039D}{{\it N}}
! 10172: \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}
! 10173: \DeclareUnicodeCharacter{039F}{{\it O}}
! 10174: \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}
! 10175: \DeclareUnicodeCharacter{03A1}{{\it P}}
! 10176: %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
! 10177: \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}
! 10178: \DeclareUnicodeCharacter{03A4}{{\it T}}
! 10179: \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}
! 10180: \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}
! 10181: \DeclareUnicodeCharacter{03A7}{{\it X}}
! 10182: \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}
! 10183: \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}
! 10184:
! 10185: % Vowels with accents
! 10186: \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}
! 10187: \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}
! 10188: \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}
! 10189: \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}
! 10190: \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}
! 10191: \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}
! 10192:
! 10193: % Standalone accent
! 10194: \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}
! 10195:
! 10196: % Greek letters lower case
! 10197: \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}
! 10198: \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}
! 10199: \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}
! 10200: \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}
! 10201: \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}
! 10202: \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}
! 10203: \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}
! 10204: \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}
! 10205: \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}
! 10206: \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}
! 10207: \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}
! 10208: \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}
! 10209: \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}
! 10210: \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}
! 10211: \DeclareUnicodeCharacter{03BF}{{\it o}} % omicron
! 10212: \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}
! 10213: \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}
! 10214: \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}
! 10215: \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}
! 10216: \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}
! 10217: \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}
! 10218: \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}
! 10219: \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}
! 10220: \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}
! 10221: \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}
! 10222:
! 10223: % More Greek vowels with accents
! 10224: \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}
! 10225: \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}
! 10226: \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}
! 10227: \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}
! 10228: \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}
! 10229:
! 10230: % Variant Greek letters
! 10231: \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}
! 10232: \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}
! 10233: \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}
! 10234:
1.1 misho 10235: \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
10236: \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
10237: \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
10238: \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
10239: \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
10240: \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
10241: \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
10242: \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
10243: \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
10244: \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
10245: \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
10246: \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
10247:
10248: \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
10249: \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
10250:
10251: \DeclareUnicodeCharacter{1E20}{\=G}
10252: \DeclareUnicodeCharacter{1E21}{\=g}
10253: \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
10254: \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
10255: \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
10256: \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
10257: \DeclareUnicodeCharacter{1E26}{\"H}
10258: \DeclareUnicodeCharacter{1E27}{\"h}
10259:
10260: \DeclareUnicodeCharacter{1E30}{\'K}
10261: \DeclareUnicodeCharacter{1E31}{\'k}
10262: \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
10263: \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
10264: \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
10265: \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
10266: \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
10267: \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
10268: \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
10269: \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
10270: \DeclareUnicodeCharacter{1E3E}{\'M}
10271: \DeclareUnicodeCharacter{1E3F}{\'m}
10272:
10273: \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
10274: \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
10275: \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
10276: \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
10277: \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
10278: \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
10279: \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
10280: \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
10281: \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
10282: \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
10283:
10284: \DeclareUnicodeCharacter{1E54}{\'P}
10285: \DeclareUnicodeCharacter{1E55}{\'p}
10286: \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
10287: \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
10288: \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
10289: \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
10290: \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
10291: \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
10292: \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
10293: \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
10294:
10295: \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
10296: \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
10297: \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
10298: \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
10299: \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
10300: \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
10301: \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
10302: \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
10303: \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
10304: \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
10305:
10306: \DeclareUnicodeCharacter{1E7C}{\~V}
10307: \DeclareUnicodeCharacter{1E7D}{\~v}
10308: \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
10309: \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
10310:
10311: \DeclareUnicodeCharacter{1E80}{\`W}
10312: \DeclareUnicodeCharacter{1E81}{\`w}
10313: \DeclareUnicodeCharacter{1E82}{\'W}
10314: \DeclareUnicodeCharacter{1E83}{\'w}
10315: \DeclareUnicodeCharacter{1E84}{\"W}
10316: \DeclareUnicodeCharacter{1E85}{\"w}
10317: \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
10318: \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
10319: \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
10320: \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
10321: \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
10322: \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
10323: \DeclareUnicodeCharacter{1E8C}{\"X}
10324: \DeclareUnicodeCharacter{1E8D}{\"x}
10325: \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
10326: \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
10327:
10328: \DeclareUnicodeCharacter{1E90}{\^Z}
10329: \DeclareUnicodeCharacter{1E91}{\^z}
10330: \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
10331: \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
10332: \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
10333: \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
10334: \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
10335: \DeclareUnicodeCharacter{1E97}{\"t}
10336: \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
10337: \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
10338:
10339: \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
10340: \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
10341:
10342: \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
10343: \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
10344: \DeclareUnicodeCharacter{1EBC}{\~E}
10345: \DeclareUnicodeCharacter{1EBD}{\~e}
10346:
10347: \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
10348: \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
10349: \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
10350: \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
10351:
10352: \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
10353: \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
10354:
10355: \DeclareUnicodeCharacter{1EF2}{\`Y}
10356: \DeclareUnicodeCharacter{1EF3}{\`y}
10357: \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
10358:
10359: \DeclareUnicodeCharacter{1EF8}{\~Y}
10360: \DeclareUnicodeCharacter{1EF9}{\~y}
10361:
1.1.1.2 ! misho 10362: % Punctuation
1.1 misho 10363: \DeclareUnicodeCharacter{2013}{--}
10364: \DeclareUnicodeCharacter{2014}{---}
10365: \DeclareUnicodeCharacter{2018}{\quoteleft}
10366: \DeclareUnicodeCharacter{2019}{\quoteright}
10367: \DeclareUnicodeCharacter{201A}{\quotesinglbase}
10368: \DeclareUnicodeCharacter{201C}{\quotedblleft}
10369: \DeclareUnicodeCharacter{201D}{\quotedblright}
10370: \DeclareUnicodeCharacter{201E}{\quotedblbase}
1.1.1.2 ! misho 10371: \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}
! 10372: \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}
1.1 misho 10373: \DeclareUnicodeCharacter{2022}{\bullet}
1.1.1.2 ! misho 10374: \DeclareUnicodeCharacter{202F}{\thinspace}
1.1 misho 10375: \DeclareUnicodeCharacter{2026}{\dots}
10376: \DeclareUnicodeCharacter{2039}{\guilsinglleft}
10377: \DeclareUnicodeCharacter{203A}{\guilsinglright}
1.1.1.2 ! misho 10378:
1.1 misho 10379: \DeclareUnicodeCharacter{20AC}{\euro}
10380:
10381: \DeclareUnicodeCharacter{2192}{\expansion}
10382: \DeclareUnicodeCharacter{21D2}{\result}
10383:
1.1.1.2 ! misho 10384: % Mathematical symbols
! 10385: \DeclareUnicodeCharacter{2200}{\ensuremath\forall}
! 10386: \DeclareUnicodeCharacter{2203}{\ensuremath\exists}
! 10387: \DeclareUnicodeCharacter{2208}{\ensuremath\in}
1.1 misho 10388: \DeclareUnicodeCharacter{2212}{\minus}
1.1.1.2 ! misho 10389: \DeclareUnicodeCharacter{2217}{\ast}
! 10390: \DeclareUnicodeCharacter{221E}{\ensuremath\infty}
! 10391: \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}
! 10392: \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}
! 10393: \DeclareUnicodeCharacter{2229}{\ensuremath\cap}
1.1 misho 10394: \DeclareUnicodeCharacter{2261}{\equiv}
1.1.1.2 ! misho 10395: \DeclareUnicodeCharacter{2264}{\ensuremath\leq}
! 10396: \DeclareUnicodeCharacter{2265}{\ensuremath\geq}
! 10397: \DeclareUnicodeCharacter{2282}{\ensuremath\subset}
! 10398: \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}
! 10399:
! 10400: \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}
! 10401: \DeclareUnicodeCharacter{2032}{\ensuremath\prime}
! 10402: \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}
! 10403: \DeclareUnicodeCharacter{2111}{\ensuremath\Im}
! 10404: \DeclareUnicodeCharacter{2113}{\ensuremath\ell}
! 10405: \DeclareUnicodeCharacter{2118}{\ensuremath\wp}
! 10406: \DeclareUnicodeCharacter{211C}{\ensuremath\Re}
! 10407: \DeclareUnicodeCharacter{2127}{\ensuremath\mho}
! 10408: \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}
! 10409: \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}
! 10410: \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}
! 10411: \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}
! 10412: \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}
! 10413: \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}
! 10414: \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}
! 10415: \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}
! 10416: \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}
! 10417: \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}
! 10418: \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}
! 10419: \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}
! 10420: \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}
! 10421: \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}
! 10422: \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}
! 10423: \DeclareUnicodeCharacter{21BE}{\ensuremath\upharpoonright}
! 10424: \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}
! 10425: \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}
! 10426: \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}
! 10427: \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}
! 10428: \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}
! 10429: \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}
! 10430: \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}
! 10431: \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}
! 10432: \DeclareUnicodeCharacter{21DD}{\ensuremath\leadsto}
! 10433: \DeclareUnicodeCharacter{2201}{\ensuremath\complement}
! 10434: \DeclareUnicodeCharacter{2202}{\ensuremath\partial}
! 10435: \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}
! 10436: \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}
! 10437: \DeclareUnicodeCharacter{2209}{\ensuremath\notin}
! 10438: \DeclareUnicodeCharacter{220B}{\ensuremath\owns}
! 10439: \DeclareUnicodeCharacter{220F}{\ensuremath\prod}
! 10440: \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}
! 10441: \DeclareUnicodeCharacter{2211}{\ensuremath\sum}
! 10442: \DeclareUnicodeCharacter{2213}{\ensuremath\mp}
! 10443: \DeclareUnicodeCharacter{2218}{\ensuremath\circ}
! 10444: \DeclareUnicodeCharacter{221A}{\ensuremath\surd}
! 10445: \DeclareUnicodeCharacter{221D}{\ensuremath\propto}
! 10446: \DeclareUnicodeCharacter{2220}{\ensuremath\angle}
! 10447: \DeclareUnicodeCharacter{2223}{\ensuremath\mid}
! 10448: \DeclareUnicodeCharacter{2228}{\ensuremath\vee}
! 10449: \DeclareUnicodeCharacter{222A}{\ensuremath\cup}
! 10450: \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}
! 10451: \DeclareUnicodeCharacter{222E}{\ensuremath\oint}
! 10452: \DeclareUnicodeCharacter{223C}{\ensuremath\sim}
! 10453: \DeclareUnicodeCharacter{2240}{\ensuremath\wr}
! 10454: \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}
! 10455: \DeclareUnicodeCharacter{2245}{\ensuremath\cong}
! 10456: \DeclareUnicodeCharacter{2248}{\ensuremath\approx}
! 10457: \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}
! 10458: \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}
! 10459: \DeclareUnicodeCharacter{2260}{\ensuremath\neq}
! 10460: \DeclareUnicodeCharacter{226A}{\ensuremath\ll}
! 10461: \DeclareUnicodeCharacter{226B}{\ensuremath\gg}
! 10462: \DeclareUnicodeCharacter{227A}{\ensuremath\prec}
! 10463: \DeclareUnicodeCharacter{227B}{\ensuremath\succ}
! 10464: \DeclareUnicodeCharacter{2283}{\ensuremath\supset}
! 10465: \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}
! 10466: \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}
! 10467: \DeclareUnicodeCharacter{228F}{\ensuremath\sqsubset}
! 10468: \DeclareUnicodeCharacter{2290}{\ensuremath\sqsupset}
! 10469: \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}
! 10470: \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}
! 10471: \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}
! 10472: \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}
! 10473: \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}
! 10474: \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}
! 10475: \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}
! 10476: \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}
! 10477: \DeclareUnicodeCharacter{2299}{\ensuremath\odot}
! 10478: \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}
! 10479: \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}
! 10480: \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}
! 10481: \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}
! 10482: \DeclareUnicodeCharacter{22A8}{\ensuremath\models}
! 10483: \DeclareUnicodeCharacter{22B4}{\ensuremath\unlhd}
! 10484: \DeclareUnicodeCharacter{22B5}{\ensuremath\unrhd}
! 10485: \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}
! 10486: \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}
! 10487: \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}
! 10488: \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}
! 10489: \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}
! 10490: \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}
! 10491: \DeclareUnicodeCharacter{22C6}{\ensuremath\star}
! 10492: \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}
! 10493: \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}
! 10494: \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}
! 10495: \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}
! 10496: \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}
! 10497: \DeclareUnicodeCharacter{2322}{\ensuremath\frown}
! 10498: \DeclareUnicodeCharacter{2323}{\ensuremath\smile}
! 10499:
! 10500: \DeclareUnicodeCharacter{25A1}{\ensuremath\Box}
! 10501: \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}
! 10502: \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}
! 10503: \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}
! 10504: \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}
! 10505: \DeclareUnicodeCharacter{25C7}{\ensuremath\Diamond}
! 10506: \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}
! 10507: \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}
! 10508: \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}
! 10509: \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}
! 10510: \DeclareUnicodeCharacter{266D}{\ensuremath\flat}
! 10511: \DeclareUnicodeCharacter{266E}{\ensuremath\natural}
! 10512: \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}
! 10513: \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}
! 10514: \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}
! 10515: \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}
! 10516: \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}
! 10517: \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}
! 10518: \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}
! 10519: \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}
! 10520: \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}
! 10521: \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}
! 10522: \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}
! 10523: \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}
! 10524: \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}
! 10525: \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}
! 10526: \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}
! 10527: \DeclareUnicodeCharacter{2A1D}{\ensuremath\Join}
! 10528: \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}
! 10529: \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}
! 10530: \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}
1.1 misho 10531:
1.1.1.2 ! misho 10532: \global\mathchardef\checkmark="1370 % actually the square root sign
! 10533: \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}
! 10534: }% end of \utfeightchardefs
1.1 misho 10535:
10536: % US-ASCII character definitions.
10537: \def\asciichardefs{% nothing need be done
10538: \relax
10539: }
10540:
1.1.1.2 ! misho 10541: % Latin1 (ISO-8859-1) character definitions.
! 10542: \def\nonasciistringdefs{%
! 10543: \setnonasciicharscatcode\active
! 10544: \def\defstringchar##1{\def##1{\string##1}}%
! 10545: %
! 10546: \defstringchar^^80\defstringchar^^81\defstringchar^^82\defstringchar^^83%
! 10547: \defstringchar^^84\defstringchar^^85\defstringchar^^86\defstringchar^^87%
! 10548: \defstringchar^^88\defstringchar^^89\defstringchar^^8a\defstringchar^^8b%
! 10549: \defstringchar^^8c\defstringchar^^8d\defstringchar^^8e\defstringchar^^8f%
! 10550: %
! 10551: \defstringchar^^90\defstringchar^^91\defstringchar^^92\defstringchar^^93%
! 10552: \defstringchar^^94\defstringchar^^95\defstringchar^^96\defstringchar^^97%
! 10553: \defstringchar^^98\defstringchar^^99\defstringchar^^9a\defstringchar^^9b%
! 10554: \defstringchar^^9c\defstringchar^^9d\defstringchar^^9e\defstringchar^^9f%
! 10555: %
! 10556: \defstringchar^^a0\defstringchar^^a1\defstringchar^^a2\defstringchar^^a3%
! 10557: \defstringchar^^a4\defstringchar^^a5\defstringchar^^a6\defstringchar^^a7%
! 10558: \defstringchar^^a8\defstringchar^^a9\defstringchar^^aa\defstringchar^^ab%
! 10559: \defstringchar^^ac\defstringchar^^ad\defstringchar^^ae\defstringchar^^af%
! 10560: %
! 10561: \defstringchar^^b0\defstringchar^^b1\defstringchar^^b2\defstringchar^^b3%
! 10562: \defstringchar^^b4\defstringchar^^b5\defstringchar^^b6\defstringchar^^b7%
! 10563: \defstringchar^^b8\defstringchar^^b9\defstringchar^^ba\defstringchar^^bb%
! 10564: \defstringchar^^bc\defstringchar^^bd\defstringchar^^be\defstringchar^^bf%
! 10565: %
! 10566: \defstringchar^^c0\defstringchar^^c1\defstringchar^^c2\defstringchar^^c3%
! 10567: \defstringchar^^c4\defstringchar^^c5\defstringchar^^c6\defstringchar^^c7%
! 10568: \defstringchar^^c8\defstringchar^^c9\defstringchar^^ca\defstringchar^^cb%
! 10569: \defstringchar^^cc\defstringchar^^cd\defstringchar^^ce\defstringchar^^cf%
! 10570: %
! 10571: \defstringchar^^d0\defstringchar^^d1\defstringchar^^d2\defstringchar^^d3%
! 10572: \defstringchar^^d4\defstringchar^^d5\defstringchar^^d6\defstringchar^^d7%
! 10573: \defstringchar^^d8\defstringchar^^d9\defstringchar^^da\defstringchar^^db%
! 10574: \defstringchar^^dc\defstringchar^^dd\defstringchar^^de\defstringchar^^df%
! 10575: %
! 10576: \defstringchar^^e0\defstringchar^^e1\defstringchar^^e2\defstringchar^^e3%
! 10577: \defstringchar^^e4\defstringchar^^e5\defstringchar^^e6\defstringchar^^e7%
! 10578: \defstringchar^^e8\defstringchar^^e9\defstringchar^^ea\defstringchar^^eb%
! 10579: \defstringchar^^ec\defstringchar^^ed\defstringchar^^ee\defstringchar^^ef%
! 10580: %
! 10581: \defstringchar^^f0\defstringchar^^f1\defstringchar^^f2\defstringchar^^f3%
! 10582: \defstringchar^^f4\defstringchar^^f5\defstringchar^^f6\defstringchar^^f7%
! 10583: \defstringchar^^f8\defstringchar^^f9\defstringchar^^fa\defstringchar^^fb%
! 10584: \defstringchar^^fc\defstringchar^^fd\defstringchar^^fe\defstringchar^^ff%
! 10585: }
! 10586:
! 10587:
! 10588: % define all the unicode characters we know about, for the sake of @U.
! 10589: \utfeightchardefs
! 10590:
! 10591:
1.1 misho 10592: % Make non-ASCII characters printable again for compatibility with
10593: % existing Texinfo documents that may use them, even without declaring a
10594: % document encoding.
10595: %
10596: \setnonasciicharscatcode \other
10597:
10598:
10599: \message{formatting,}
10600:
10601: \newdimen\defaultparindent \defaultparindent = 15pt
10602:
10603: \chapheadingskip = 15pt plus 4pt minus 2pt
10604: \secheadingskip = 12pt plus 3pt minus 2pt
10605: \subsecheadingskip = 9pt plus 2pt minus 2pt
10606:
10607: % Prevent underfull vbox error messages.
10608: \vbadness = 10000
10609:
10610: % Don't be very finicky about underfull hboxes, either.
10611: \hbadness = 6666
10612:
10613: % Following George Bush, get rid of widows and orphans.
10614: \widowpenalty=10000
10615: \clubpenalty=10000
10616:
10617: % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
10618: % using an old version of TeX, don't do anything. We want the amount of
10619: % stretch added to depend on the line length, hence the dependence on
10620: % \hsize. We call this whenever the paper size is set.
10621: %
10622: \def\setemergencystretch{%
10623: \ifx\emergencystretch\thisisundefined
10624: % Allow us to assign to \emergencystretch anyway.
10625: \def\emergencystretch{\dimen0}%
10626: \else
10627: \emergencystretch = .15\hsize
10628: \fi
10629: }
10630:
10631: % Parameters in order: 1) textheight; 2) textwidth;
10632: % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
10633: % 7) physical page height; 8) physical page width.
10634: %
10635: % We also call \setleading{\textleading}, so the caller should define
10636: % \textleading. The caller should also set \parskip.
10637: %
10638: \def\internalpagesizes#1#2#3#4#5#6#7#8{%
10639: \voffset = #3\relax
10640: \topskip = #6\relax
10641: \splittopskip = \topskip
10642: %
10643: \vsize = #1\relax
10644: \advance\vsize by \topskip
10645: \outervsize = \vsize
10646: \advance\outervsize by 2\topandbottommargin
10647: \pageheight = \vsize
10648: %
10649: \hsize = #2\relax
10650: \outerhsize = \hsize
10651: \advance\outerhsize by 0.5in
10652: \pagewidth = \hsize
10653: %
10654: \normaloffset = #4\relax
10655: \bindingoffset = #5\relax
10656: %
10657: \ifpdf
10658: \pdfpageheight #7\relax
10659: \pdfpagewidth #8\relax
10660: % if we don't reset these, they will remain at "1 true in" of
10661: % whatever layout pdftex was dumped with.
10662: \pdfhorigin = 1 true in
10663: \pdfvorigin = 1 true in
10664: \fi
10665: %
10666: \setleading{\textleading}
10667: %
10668: \parindent = \defaultparindent
10669: \setemergencystretch
10670: }
10671:
10672: % @letterpaper (the default).
10673: \def\letterpaper{{\globaldefs = 1
10674: \parskip = 3pt plus 2pt minus 1pt
10675: \textleading = 13.2pt
10676: %
10677: % If page is nothing but text, make it come out even.
10678: \internalpagesizes{607.2pt}{6in}% that's 46 lines
10679: {\voffset}{.25in}%
10680: {\bindingoffset}{36pt}%
10681: {11in}{8.5in}%
10682: }}
10683:
10684: % Use @smallbook to reset parameters for 7x9.25 trim size.
10685: \def\smallbook{{\globaldefs = 1
10686: \parskip = 2pt plus 1pt
10687: \textleading = 12pt
10688: %
10689: \internalpagesizes{7.5in}{5in}%
10690: {-.2in}{0in}%
10691: {\bindingoffset}{16pt}%
10692: {9.25in}{7in}%
10693: %
10694: \lispnarrowing = 0.3in
10695: \tolerance = 700
10696: \hfuzz = 1pt
10697: \contentsrightmargin = 0pt
10698: \defbodyindent = .5cm
10699: }}
10700:
10701: % Use @smallerbook to reset parameters for 6x9 trim size.
10702: % (Just testing, parameters still in flux.)
10703: \def\smallerbook{{\globaldefs = 1
10704: \parskip = 1.5pt plus 1pt
10705: \textleading = 12pt
10706: %
10707: \internalpagesizes{7.4in}{4.8in}%
10708: {-.2in}{-.4in}%
10709: {0pt}{14pt}%
10710: {9in}{6in}%
10711: %
10712: \lispnarrowing = 0.25in
10713: \tolerance = 700
10714: \hfuzz = 1pt
10715: \contentsrightmargin = 0pt
10716: \defbodyindent = .4cm
10717: }}
10718:
10719: % Use @afourpaper to print on European A4 paper.
10720: \def\afourpaper{{\globaldefs = 1
10721: \parskip = 3pt plus 2pt minus 1pt
10722: \textleading = 13.2pt
10723: %
10724: % Double-side printing via postscript on Laserjet 4050
10725: % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
10726: % To change the settings for a different printer or situation, adjust
10727: % \normaloffset until the front-side and back-side texts align. Then
10728: % do the same for \bindingoffset. You can set these for testing in
10729: % your texinfo source file like this:
10730: % @tex
10731: % \global\normaloffset = -6mm
10732: % \global\bindingoffset = 10mm
10733: % @end tex
10734: \internalpagesizes{673.2pt}{160mm}% that's 51 lines
10735: {\voffset}{\hoffset}%
10736: {\bindingoffset}{44pt}%
10737: {297mm}{210mm}%
10738: %
10739: \tolerance = 700
10740: \hfuzz = 1pt
10741: \contentsrightmargin = 0pt
10742: \defbodyindent = 5mm
10743: }}
10744:
10745: % Use @afivepaper to print on European A5 paper.
10746: % From romildo@urano.iceb.ufop.br, 2 July 2000.
10747: % He also recommends making @example and @lisp be small.
10748: \def\afivepaper{{\globaldefs = 1
10749: \parskip = 2pt plus 1pt minus 0.1pt
10750: \textleading = 12.5pt
10751: %
10752: \internalpagesizes{160mm}{120mm}%
10753: {\voffset}{\hoffset}%
10754: {\bindingoffset}{8pt}%
10755: {210mm}{148mm}%
10756: %
10757: \lispnarrowing = 0.2in
10758: \tolerance = 800
10759: \hfuzz = 1.2pt
10760: \contentsrightmargin = 0pt
10761: \defbodyindent = 2mm
10762: \tableindent = 12mm
10763: }}
10764:
10765: % A specific text layout, 24x15cm overall, intended for A4 paper.
10766: \def\afourlatex{{\globaldefs = 1
10767: \afourpaper
10768: \internalpagesizes{237mm}{150mm}%
10769: {\voffset}{4.6mm}%
10770: {\bindingoffset}{7mm}%
10771: {297mm}{210mm}%
10772: %
10773: % Must explicitly reset to 0 because we call \afourpaper.
10774: \globaldefs = 0
10775: }}
10776:
10777: % Use @afourwide to print on A4 paper in landscape format.
10778: \def\afourwide{{\globaldefs = 1
10779: \afourpaper
10780: \internalpagesizes{241mm}{165mm}%
10781: {\voffset}{-2.95mm}%
10782: {\bindingoffset}{7mm}%
10783: {297mm}{210mm}%
10784: \globaldefs = 0
10785: }}
10786:
10787: % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
10788: % Perhaps we should allow setting the margins, \topskip, \parskip,
10789: % and/or leading, also. Or perhaps we should compute them somehow.
10790: %
10791: \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
10792: \def\pagesizesyyy#1,#2,#3\finish{{%
10793: \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
10794: \globaldefs = 1
10795: %
10796: \parskip = 3pt plus 2pt minus 1pt
10797: \setleading{\textleading}%
10798: %
10799: \dimen0 = #1\relax
10800: \advance\dimen0 by \voffset
10801: %
10802: \dimen2 = \hsize
10803: \advance\dimen2 by \normaloffset
10804: %
10805: \internalpagesizes{#1}{\hsize}%
10806: {\voffset}{\normaloffset}%
10807: {\bindingoffset}{44pt}%
10808: {\dimen0}{\dimen2}%
10809: }}
10810:
10811: % Set default to letter.
10812: %
10813: \letterpaper
10814:
10815:
10816: \message{and turning on texinfo input format.}
10817:
10818: \def^^L{\par} % remove \outer, so ^L can appear in an @comment
10819:
10820: % DEL is a comment character, in case @c does not suffice.
10821: \catcode`\^^? = 14
10822:
10823: % Define macros to output various characters with catcode for normal text.
10824: \catcode`\"=\other \def\normaldoublequote{"}
10825: \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
10826: \catcode`\+=\other \def\normalplus{+}
10827: \catcode`\<=\other \def\normalless{<}
10828: \catcode`\>=\other \def\normalgreater{>}
10829: \catcode`\^=\other \def\normalcaret{^}
10830: \catcode`\_=\other \def\normalunderscore{_}
10831: \catcode`\|=\other \def\normalverticalbar{|}
10832: \catcode`\~=\other \def\normaltilde{~}
10833:
10834: % This macro is used to make a character print one way in \tt
10835: % (where it can probably be output as-is), and another way in other fonts,
10836: % where something hairier probably needs to be done.
10837: %
10838: % #1 is what to print if we are indeed using \tt; #2 is what to print
10839: % otherwise. Since all the Computer Modern typewriter fonts have zero
10840: % interword stretch (and shrink), and it is reasonable to expect all
10841: % typewriter fonts to have this, we can check that font parameter.
10842: %
10843: \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
10844:
10845: % Same as above, but check for italic font. Actually this also catches
10846: % non-italic slanted fonts since it is impossible to distinguish them from
10847: % italic fonts. But since this is only used by $ and it uses \sl anyway
10848: % this is not a problem.
10849: \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
10850:
10851: % Turn off all special characters except @
10852: % (and those which the user can use as if they were ordinary).
10853: % Most of these we simply print from the \tt font, but for some, we can
10854: % use math or other variants that look better in normal text.
10855:
10856: \catcode`\"=\active
10857: \def\activedoublequote{{\tt\char34}}
10858: \let"=\activedoublequote
10859: \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
1.1.1.2 ! misho 10860: \chardef\hatchar=`\^
! 10861: \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
1.1 misho 10862:
10863: \catcode`\_=\active
10864: \def_{\ifusingtt\normalunderscore\_}
10865: \let\realunder=_
10866: % Subroutine for the previous macro.
10867: \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
10868:
10869: \catcode`\|=\active
10870: \def|{{\tt\char124}}
10871:
10872: \chardef \less=`\<
10873: \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
10874: \chardef \gtr=`\>
10875: \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
10876: \catcode`\+=\active \def+{{\tt \char 43}}
10877: \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
1.1.1.2 ! misho 10878: \catcode`\-=\active \let-=\normaldash
! 10879:
1.1 misho 10880:
10881: % used for headline/footline in the output routine, in case the page
10882: % breaks in the middle of an @tex block.
10883: \def\texinfochars{%
10884: \let< = \activeless
10885: \let> = \activegtr
10886: \let~ = \activetilde
10887: \let^ = \activehat
10888: \markupsetuplqdefault \markupsetuprqdefault
10889: \let\b = \strong
10890: \let\i = \smartitalic
10891: % in principle, all other definitions in \tex have to be undone too.
10892: }
10893:
10894: % Used sometimes to turn off (effectively) the active characters even after
10895: % parsing them.
10896: \def\turnoffactive{%
10897: \normalturnoffactive
10898: \otherbackslash
10899: }
10900:
10901: \catcode`\@=0
10902:
10903: % \backslashcurfont outputs one backslash character in current font,
10904: % as in \char`\\.
10905: \global\chardef\backslashcurfont=`\\
10906: \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
10907:
10908: % \realbackslash is an actual character `\' with catcode other, and
10909: % \doublebackslash is two of them (for the pdf outlines).
10910: {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
10911:
1.1.1.2 ! misho 10912: % In Texinfo, backslash is an active character; it prints the backslash
1.1 misho 10913: % in fixed width font.
10914: \catcode`\\=\active % @ for escape char from now on.
10915:
1.1.1.2 ! misho 10916: % Print a typewriter backslash. For math mode, we can't simply use
! 10917: % \backslashcurfont: the story here is that in math mode, the \char
! 10918: % of \backslashcurfont ends up printing the roman \ from the math symbol
! 10919: % font (because \char in math mode uses the \mathcode, and plain.tex
! 10920: % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
1.1 misho 10921: % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
10922: % ignored family value; char position "5C). We can't use " for the
10923: % usual hex value because it has already been made active.
10924:
1.1.1.2 ! misho 10925: @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
! 10926: @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
! 10927:
1.1 misho 10928: % \rawbackslash defines an active \ to do \backslashcurfont.
10929: % \otherbackslash defines an active \ to be a literal `\' character with
10930: % catcode other. We switch back and forth between these.
10931: @gdef@rawbackslash{@let\=@backslashcurfont}
10932: @gdef@otherbackslash{@let\=@realbackslash}
10933:
10934: % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
1.1.1.2 ! misho 10935: % the literal character `\'.
1.1 misho 10936: %
10937: {@catcode`- = @active
10938: @gdef@normalturnoffactive{%
1.1.1.2 ! misho 10939: @nonasciistringdefs
1.1 misho 10940: @let-=@normaldash
10941: @let"=@normaldoublequote
10942: @let$=@normaldollar %$ font-lock fix
10943: @let+=@normalplus
10944: @let<=@normalless
10945: @let>=@normalgreater
10946: @let^=@normalcaret
10947: @let_=@normalunderscore
10948: @let|=@normalverticalbar
10949: @let~=@normaltilde
1.1.1.2 ! misho 10950: @let\=@ttbackslash
1.1 misho 10951: @markupsetuplqdefault
10952: @markupsetuprqdefault
10953: @unsepspaces
10954: }
10955: }
10956:
1.1.1.2 ! misho 10957: % If a .fmt file is being used, characters that might appear in a file
! 10958: % name cannot be active until we have parsed the command line.
! 10959: % So turn them off again, and have @fixbackslash turn them back on.
! 10960: @catcode`+=@other @catcode`@_=@other
1.1 misho 10961:
1.1.1.2 ! misho 10962: % \enablebackslashhack - allow file to begin `\input texinfo'
! 10963: %
1.1 misho 10964: % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
10965: % That is what \eatinput is for; after that, the `\' should revert to printing
10966: % a backslash.
1.1.1.2 ! misho 10967: % If the file did not have a `\input texinfo', then it is turned off after
! 10968: % the first line; otherwise the first `\' in the file would cause an error.
! 10969: % This is used on the very last line of this file, texinfo.tex.
! 10970: % We also use @c to call @fixbackslash, in case ends of lines are hidden.
! 10971: {
! 10972: @catcode`@^=7
! 10973: @catcode`@^^M=13@gdef@enablebackslashhack{%
! 10974: @global@let\ = @eatinput%
! 10975: @catcode`@^^M=13%
! 10976: @def@c{@fixbackslash@c}%
! 10977: @def ^^M{@let^^M@secondlinenl}%
! 10978: @gdef @secondlinenl{@let^^M@thirdlinenl}%
! 10979: @gdef @thirdlinenl{@fixbackslash}%
! 10980: }}
! 10981:
! 10982: {@catcode`@^=7 @catcode`@^^M=13%
! 10983: @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
1.1 misho 10984:
10985: @gdef@fixbackslash{%
1.1.1.2 ! misho 10986: @ifx\@eatinput @let\ = @ttbackslash @fi
! 10987: @catcode13=5 % regular end of line
! 10988: @let@c=@texinfoc
! 10989: % Also turn back on active characters that might appear in the input
! 10990: % file name, in case not using a pre-dumped format.
1.1 misho 10991: @catcode`+=@active
10992: @catcode`@_=@active
1.1.1.2 ! misho 10993: %
! 10994: % If texinfo.cnf is present on the system, read it.
! 10995: % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
! 10996: % called at the beginning of every Texinfo file. Not opening texinfo.cnf
! 10997: % directly in this file, texinfo.tex, makes it possible to make a format
! 10998: % file for Texinfo.
! 10999: %
! 11000: @openin 1 texinfo.cnf
! 11001: @ifeof 1 @else @input texinfo.cnf @fi
! 11002: @closein 1
1.1 misho 11003: }
11004:
1.1.1.2 ! misho 11005:
1.1 misho 11006: % Say @foo, not \foo, in error messages.
11007: @escapechar = `@@
11008:
11009: % These (along with & and #) are made active for url-breaking, so need
11010: % active definitions as the normal characters.
11011: @def@normaldot{.}
11012: @def@normalquest{?}
11013: @def@normalslash{/}
11014:
11015: % These look ok in all fonts, so just make them not special.
11016: % @hashchar{} gets its own user-level command, because of #line.
11017: @catcode`@& = @other @def@normalamp{&}
11018: @catcode`@# = @other @def@normalhash{#}
11019: @catcode`@% = @other @def@normalpercent{%}
11020:
11021: @let @hashchar = @normalhash
11022:
11023: @c Finally, make ` and ' active, so that txicodequoteundirected and
11024: @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
11025: @c don't make ` and ' active, @code will not get them as active chars.
11026: @c Do this last of all since we use ` in the previous @catcode assignments.
11027: @catcode`@'=@active
11028: @catcode`@`=@active
11029: @markupsetuplqdefault
11030: @markupsetuprqdefault
11031:
11032: @c Local variables:
11033: @c eval: (add-hook 'write-file-hooks 'time-stamp)
1.1.1.2 ! misho 11034: @c page-delimiter: "^\\\\message\\|emacs-page"
1.1 misho 11035: @c time-stamp-start: "def\\\\texinfoversion{"
11036: @c time-stamp-format: "%:y-%02m-%02d.%02H"
11037: @c time-stamp-end: "}"
11038: @c End:
11039:
11040: @c vim:sw=2:
11041:
11042: @ignore
11043: arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
11044: @end ignore
1.1.1.2 ! misho 11045: @enablebackslashhack
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>