
1: % texinfo.tex -- TeX macros to handle Texinfo files. 2: % 3: % Load plain if necessary, i.e., if running under initex. 4: \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 5: % 6: \def\texinfoversion{2007-03-14.11} 7: % 8: % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 9: % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 10: % 2007 Free Software Foundation, Inc. 11: % 12: % This texinfo.tex file is free software; you can redistribute it and/or 13: % modify it under the terms of the GNU General Public License as 14: % published by the Free Software Foundation; either version 2, or (at 15: % your option) any later version. 16: % 17: % This texinfo.tex file is distributed in the hope that it will be 18: % useful, but WITHOUT ANY WARRANTY; without even the implied warranty 19: % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20: % General Public License for more details. 21: % 22: % You should have received a copy of the GNU General Public License 23: % along with this texinfo.tex file; see the file COPYING. If not, write 24: % to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25: % Boston, MA 02110-1301, USA. 26: % 27: % As a special exception, when this file is read by TeX when processing 28: % a Texinfo source document, you may use the result without 29: % restriction. (This has been our intent since Texinfo was invented.) 30: % 31: % Please try the latest version of texinfo.tex before submitting bug 32: % reports; you can get the latest version from: 33: % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or 34: % ftp://tug.org/tex/texinfo.tex 35: % (and all CTAN mirrors, see http://www.ctan.org). 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: 71: \chardef\other=12 72: 73: % We never want plain's \outer definition of \+ in Texinfo. 74: % For @tex, we can use \tabalign. 75: \let\+ = \relax 76: 77: % Save some plain tex macros whose names we will redefine. 78: \let\ptexb=\b 79: \let\ptexbullet=\bullet 80: \let\ptexc=\c 81: \let\ptexcomma=\, 82: \let\ptexdot=\. 83: \let\ptexdots=\dots 84: \let\ptexend=\end 85: \let\ptexequiv=\equiv 86: \let\ptexexclam=\! 87: \let\ptexfootnote=\footnote 88: \let\ptexgtr=> 89: \let\ptexhat=^ 90: \let\ptexi=\i 91: \let\ptexindent=\indent 92: \let\ptexinsert=\insert 93: \let\ptexlbrace=\{ 94: \let\ptexless=< 95: \let\ptexnewwrite\newwrite 96: \let\ptexnoindent=\noindent 97: \let\ptexplus=+ 98: \let\ptexrbrace=\} 99: \let\ptexslash=\/ 100: \let\ptexstar=\* 101: \let\ptext=\t 102: 103: % If this character appears in an error message or help string, it 104: % starts a new line in the output. 105: \newlinechar = `^^J 106: 107: % Use TeX 3.0's \inputlineno to get the line number, for better error 108: % messages, but if we're using an old version of TeX, don't do anything. 109: % 110: \ifx\inputlineno\thisisundefined 111: \let\linenumber = \empty % Pre-3.0. 112: \else 113: \def\linenumber{l.\the\inputlineno:\space} 114: \fi 115: 116: % Set up fixed words for English if not already set. 117: \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi 118: \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi 119: \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi 120: \ifx\putwordin\undefined \gdef\putwordin{in}\fi 121: \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi 122: \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi 123: \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi 124: \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi 125: \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi 126: \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi 127: \ifx\putwordof\undefined \gdef\putwordof{of}\fi 128: \ifx\putwordon\undefined \gdef\putwordon{on}\fi 129: \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi 130: \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi 131: \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi 132: \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi 133: \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi 134: \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi 135: \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi 136: % 137: \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi 138: \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi 139: \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi 140: \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi 141: \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi 142: \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi 143: \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi 144: \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi 145: \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi 146: \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi 147: \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi 148: \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi 149: % 150: \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi 151: \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi 152: \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi 153: \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi 154: \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi 155: 156: % Since the category of space is not known, we have to be careful. 157: \chardef\spacecat = 10 158: \def\spaceisspace{\catcode`\ =\spacecat} 159: 160: % sometimes characters are active, so we need control sequences. 161: \chardef\colonChar = `\: 162: \chardef\commaChar = `\, 163: \chardef\dashChar = `\- 164: \chardef\dotChar = `\. 165: \chardef\exclamChar= `\! 166: \chardef\lquoteChar= `\` 167: \chardef\questChar = `\? 168: \chardef\rquoteChar= `\' 169: \chardef\semiChar = `\; 170: \chardef\underChar = `\_ 171: 172: % Ignore a token. 173: % 174: \def\gobble#1{} 175: 176: % The following is used inside several \edef's. 177: \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} 178: 179: % Hyphenation fixes. 180: \hyphenation{ 181: Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script 182: ap-pen-dix bit-map bit-maps 183: data-base data-bases eshell fall-ing half-way long-est man-u-script 184: man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm 185: par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces 186: spell-ing spell-ings 187: stand-alone strong-est time-stamp time-stamps which-ever white-space 188: wide-spread wrap-around 189: } 190: 191: % Margin to add to right of even pages, to left of odd pages. 192: \newdimen\bindingoffset 193: \newdimen\normaloffset 194: \newdimen\pagewidth \newdimen\pageheight 195: 196: % For a final copy, take out the rectangles 197: % that mark overfull boxes (in case you have decided 198: % that the text looks ok even though it passes the margin). 199: % 200: \def\finalout{\overfullrule=0pt} 201: 202: % @| inserts a changebar to the left of the current line. It should 203: % surround any changed text. This approach does *not* work if the 204: % change spans more than two lines of output. To handle that, we would 205: % have adopt a much more difficult approach (putting marks into the main 206: % vertical list for the beginning and end of each change). 207: % 208: \def\|{% 209: % \vadjust can only be used in horizontal mode. 210: \leavevmode 211: % 212: % Append this vertical mode material after the current line in the output. 213: \vadjust{% 214: % We want to insert a rule with the height and depth of the current 215: % leading; that is exactly what \strutbox is supposed to record. 216: \vskip-\baselineskip 217: % 218: % \vadjust-items are inserted at the left edge of the type. So 219: % the \llap here moves out into the left-hand margin. 220: \llap{% 221: % 222: % For a thicker or thinner bar, change the `1pt'. 223: \vrule height\baselineskip width1pt 224: % 225: % This is the space between the bar and the text. 226: \hskip 12pt 227: }% 228: }% 229: } 230: 231: % Sometimes it is convenient to have everything in the transcript file 232: % and nothing on the terminal. We don't just call \tracingall here, 233: % since that produces some useless output on the terminal. We also make 234: % some effort to order the tracing commands to reduce output in the log 235: % file; cf. trace.sty in LaTeX. 236: % 237: \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% 238: \def\loggingall{% 239: \tracingstats2 240: \tracingpages1 241: \tracinglostchars2 % 2 gives us more in etex 242: \tracingparagraphs1 243: \tracingoutput1 244: \tracingmacros2 245: \tracingrestores1 246: \showboxbreadth\maxdimen \showboxdepth\maxdimen 247: \ifx\eTeXversion\undefined\else % etex gives us more logging 248: \tracingscantokens1 249: \tracingifs1 250: \tracinggroups1 251: \tracingnesting2 252: \tracingassigns1 253: \fi 254: \tracingcommands3 % 3 gives us more in etex 255: \errorcontextlines16 256: }% 257: 258: % add check for \lastpenalty to plain's definitions. If the last thing 259: % we did was a \nobreak, we don't want to insert more space. 260: % 261: \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount 262: \removelastskip\penalty-50\smallskip\fi\fi} 263: \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount 264: \removelastskip\penalty-100\medskip\fi\fi} 265: \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount 266: \removelastskip\penalty-200\bigskip\fi\fi} 267: 268: % For @cropmarks command. 269: % Do @cropmarks to get crop marks. 270: % 271: \newif\ifcropmarks 272: \let\cropmarks = \cropmarkstrue 273: % 274: % Dimensions to add cropmarks at corners. 275: % Added by P. A. MacKay, 12 Nov. 1986 276: % 277: \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines 278: \newdimen\cornerlong \cornerlong=1pc 279: \newdimen\cornerthick \cornerthick=.3pt 280: \newdimen\topandbottommargin \topandbottommargin=.75in 281: 282: % Main output routine. 283: \chardef\PAGE = 255 284: \output = {\onepageout{\pagecontents\PAGE}} 285: 286: \newbox\headlinebox 287: \newbox\footlinebox 288: 289: % \onepageout takes a vbox as an argument. Note that \pagecontents 290: % does insertions, but you have to call it yourself. 291: \def\onepageout#1{% 292: \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi 293: % 294: \ifodd\pageno \advance\hoffset by \bindingoffset 295: \else \advance\hoffset by -\bindingoffset\fi 296: % 297: % Do this outside of the \shipout so @code etc. will be expanded in 298: % the headline as they should be, not taken literally (outputting ''code). 299: \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% 300: \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% 301: % 302: {% 303: % Have to do this stuff outside the \shipout because we want it to 304: % take effect in \write's, yet the group defined by the \vbox ends 305: % before the \shipout runs. 306: % 307: \indexdummies % don't expand commands in the output. 308: \normalturnoffactive % \ in index entries must not stay \, e.g., if 309: % the page break happens to be in the middle of an example. 310: % We don't want .vr (or whatever) entries like this: 311: % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} 312: % "\acronym" won't work when it's read back in; 313: % it needs to be 314: % {\code {{\tt \backslashcurfont }acronym} 315: \shipout\vbox{% 316: % Do this early so pdf references go to the beginning of the page. 317: \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi 318: % 319: \ifcropmarks \vbox to \outervsize\bgroup 320: \hsize = \outerhsize 321: \vskip-\topandbottommargin 322: \vtop to0pt{% 323: \line{\ewtop\hfil\ewtop}% 324: \nointerlineskip 325: \line{% 326: \vbox{\moveleft\cornerthick\nstop}% 327: \hfill 328: \vbox{\moveright\cornerthick\nstop}% 329: }% 330: \vss}% 331: \vskip\topandbottommargin 332: \line\bgroup 333: \hfil % center the page within the outer (page) hsize. 334: \ifodd\pageno\hskip\bindingoffset\fi 335: \vbox\bgroup 336: \fi 337: % 338: \unvbox\headlinebox 339: \pagebody{#1}% 340: \ifdim\ht\footlinebox > 0pt 341: % Only leave this space if the footline is nonempty. 342: % (We lessened \vsize for it in \oddfootingyyy.) 343: % The \baselineskip=24pt in plain's \makefootline has no effect. 344: \vskip 24pt 345: \unvbox\footlinebox 346: \fi 347: % 348: \ifcropmarks 349: \egroup % end of \vbox\bgroup 350: \hfil\egroup % end of (centering) \line\bgroup 351: \vskip\topandbottommargin plus1fill minus1fill 352: \boxmaxdepth = \cornerthick 353: \vbox to0pt{\vss 354: \line{% 355: \vbox{\moveleft\cornerthick\nsbot}% 356: \hfill 357: \vbox{\moveright\cornerthick\nsbot}% 358: }% 359: \nointerlineskip 360: \line{\ewbot\hfil\ewbot}% 361: }% 362: \egroup % \vbox from first cropmarks clause 363: \fi 364: }% end of \shipout\vbox 365: }% end of group with \indexdummies 366: \advancepageno 367: \ifnum\outputpenalty>-20000 \else\dosupereject\fi 368: } 369: 370: \newinsert\margin \dimen\margin=\maxdimen 371: 372: \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} 373: {\catcode`\@ =11 374: \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi 375: % marginal hacks, juha@viisa.uucp (Juha Takala) 376: \ifvoid\margin\else % marginal info is present 377: \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi 378: \dimen@=\dp#1 \unvbox#1 379: \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi 380: \ifr@ggedbottom \kern-\dimen@ \vfil \fi} 381: } 382: 383: % Here are the rules for the cropmarks. Note that they are 384: % offset so that the space between them is truly \outerhsize or \outervsize 385: % (P. A. MacKay, 12 November, 1986) 386: % 387: \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} 388: \def\nstop{\vbox 389: {\hrule height\cornerthick depth\cornerlong width\cornerthick}} 390: \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} 391: \def\nsbot{\vbox 392: {\hrule height\cornerlong depth\cornerthick width\cornerthick}} 393: 394: % Parse an argument, then pass it to #1. The argument is the rest of 395: % the input line (except we remove a trailing comment). #1 should be a 396: % macro which expects an ordinary undelimited TeX argument. 397: % 398: \def\parsearg{\parseargusing{}} 399: \def\parseargusing#1#2{% 400: \def\argtorun{#2}% 401: \begingroup 402: \obeylines 403: \spaceisspace 404: #1% 405: \parseargline\empty% Insert the \empty token, see \finishparsearg below. 406: } 407: 408: {\obeylines % 409: \gdef\parseargline#1^^M{% 410: \endgroup % End of the group started in \parsearg. 411: \argremovecomment #1\comment\ArgTerm% 412: }% 413: } 414: 415: % First remove any @comment, then any @c comment. 416: \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} 417: \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} 418: 419: % Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space. 420: % 421: % \argremovec might leave us with trailing space, e.g., 422: % @end itemize @c foo 423: % This space token undergoes the same procedure and is eventually removed 424: % by \finishparsearg. 425: % 426: \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} 427: \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} 428: \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% 429: \def\temp{#3}% 430: \ifx\temp\empty 431: % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: 432: \let\temp\finishparsearg 433: \else 434: \let\temp\argcheckspaces 435: \fi 436: % Put the space token in: 437: \temp#1 #3\ArgTerm 438: } 439: 440: % If a _delimited_ argument is enclosed in braces, they get stripped; so 441: % to get _exactly_ the rest of the line, we had to prevent such situation. 442: % We prepended an \empty token at the very beginning and we expand it now, 443: % just before passing the control to \argtorun. 444: % (Similarily, we have to think about #3 of \argcheckspacesY above: it is 445: % either the null string, or it ends with \^^M---thus there is no danger 446: % that a pair of braces would be stripped. 447: % 448: % But first, we have to remove the trailing space token. 449: % 450: \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} 451: 452: % \parseargdef\foo{...} 453: % is roughly equivalent to 454: % \def\foo{\parsearg\Xfoo} 455: % \def\Xfoo#1{...} 456: % 457: % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my 458: % favourite TeX trick. --kasal, 16nov03 459: 460: \def\parseargdef#1{% 461: \expandafter \doparseargdef \csname\string#1\endcsname #1% 462: } 463: \def\doparseargdef#1#2{% 464: \def#2{\parsearg#1}% 465: \def#1##1% 466: } 467: 468: % Several utility definitions with active space: 469: { 470: \obeyspaces 471: \gdef\obeyedspace{ } 472: 473: % Make each space character in the input produce a normal interword 474: % space in the output. Don't allow a line break at this space, as this 475: % is used only in environments like @example, where each line of input 476: % should produce a line of output anyway. 477: % 478: \gdef\sepspaces{\obeyspaces\let =\tie} 479: 480: % If an index command is used in an @example environment, any spaces 481: % therein should become regular spaces in the raw index file, not the 482: % expansion of \tie (\leavevmode \penalty \@M \ ). 483: \gdef\unsepspaces{\let =\space} 484: } 485: 486: 487: \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} 488: 489: % Define the framework for environments in texinfo.tex. It's used like this: 490: % 491: % \envdef\foo{...} 492: % \def\Efoo{...} 493: % 494: % It's the responsibility of \envdef to insert \begingroup before the 495: % actual body; @end closes the group after calling \Efoo. \envdef also 496: % defines \thisenv, so the current environment is known; @end checks 497: % whether the environment name matches. The \checkenv macro can also be 498: % used to check whether the current environment is the one expected. 499: % 500: % Non-false conditionals (@iftex, @ifset) don't fit into this, so they 501: % are not treated as enviroments; they don't open a group. (The 502: % implementation of @end takes care not to call \endgroup in this 503: % special case.) 504: 505: 506: % At runtime, environments start with this: 507: \def\startenvironment#1{\begingroup\def\thisenv{#1}} 508: % initialize 509: \let\thisenv\empty 510: 511: % ... but they get defined via ``\envdef\foo{...}'': 512: \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} 513: \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} 514: 515: % Check whether we're in the right environment: 516: \def\checkenv#1{% 517: \def\temp{#1}% 518: \ifx\thisenv\temp 519: \else 520: \badenverr 521: \fi 522: } 523: 524: % Evironment mismatch, #1 expected: 525: \def\badenverr{% 526: \errhelp = \EMsimple 527: \errmessage{This command can appear only \inenvironment\temp, 528: not \inenvironment\thisenv}% 529: } 530: \def\inenvironment#1{% 531: \ifx#1\empty 532: out of any environment% 533: \else 534: in environment \expandafter\string#1% 535: \fi 536: } 537: 538: % @end foo executes the definition of \Efoo. 539: % But first, it executes a specialized version of \checkenv 540: % 541: \parseargdef\end{% 542: \if 1\csname iscond.#1\endcsname 543: \else 544: % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 545: \expandafter\checkenv\csname#1\endcsname 546: \csname E#1\endcsname 547: \endgroup 548: \fi 549: } 550: 551: \newhelp\EMsimple{Press RETURN to continue.} 552: 553: 554: %% Simple single-character @ commands 555: 556: % @@ prints an @ 557: % Kludge this until the fonts are right (grr). 558: \def\@{{\tt\char64}} 559: 560: % This is turned off because it was never documented 561: % and you can use @w{...} around a quote to suppress ligatures. 562: %% Define @` and @' to be the same as ` and ' 563: %% but suppressing ligatures. 564: %\def\`{{`}} 565: %\def\'{{'}} 566: 567: % Used to generate quoted braces. 568: \def\mylbrace {{\tt\char123}} 569: \def\myrbrace {{\tt\char125}} 570: \let\{=\mylbrace 571: \let\}=\myrbrace 572: \begingroup 573: % Definitions to produce \{ and \} commands for indices, 574: % and @{ and @} for the aux/toc files. 575: \catcode`\{ = \other \catcode`\} = \other 576: \catcode`\[ = 1 \catcode`\] = 2 577: \catcode`\! = 0 \catcode`\\ = \other 578: !gdef!lbracecmd[\{]% 579: !gdef!rbracecmd[\}]% 580: !gdef!lbraceatcmd[@{]% 581: !gdef!rbraceatcmd[@}]% 582: !endgroup 583: 584: % @comma{} to avoid , parsing problems. 585: \let\comma = , 586: 587: % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent 588: % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. 589: \let\, = \c 590: \let\dotaccent = \. 591: \def\ringaccent#1{{\accent23 #1}} 592: \let\tieaccent = \t 593: \let\ubaraccent = \b 594: \let\udotaccent = \d 595: 596: % Other special characters: @questiondown @exclamdown @ordf @ordm 597: % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. 598: \def\questiondown{?`} 599: \def\exclamdown{!`} 600: \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} 601: \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} 602: 603: % Dotless i and dotless j, used for accents. 604: \def\imacro{i} 605: \def\jmacro{j} 606: \def\dotless#1{% 607: \def\temp{#1}% 608: \ifx\temp\imacro \ptexi 609: \else\ifx\temp\jmacro \j 610: \else \errmessage{@dotless can be used only with i or j}% 611: \fi\fi 612: } 613: 614: % The \TeX{} logo, as in plain, but resetting the spacing so that a 615: % period following counts as ending a sentence. (Idea found in latex.) 616: % 617: \edef\TeX{\TeX \spacefactor=1000 } 618: 619: % @LaTeX{} logo. Not quite the same results as the definition in 620: % latex.ltx, since we use a different font for the raised A; it's most 621: % convenient for us to use an explicitly smaller font, rather than using 622: % the \scriptstyle font (since we don't reset \scriptstyle and 623: % \scriptscriptstyle). 624: % 625: \def\LaTeX{% 626: L\kern-.36em 627: {\setbox0=\hbox{T}% 628: \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% 629: \kern-.15em 630: \TeX 631: } 632: 633: % Be sure we're in horizontal mode when doing a tie, since we make space 634: % equivalent to this in @example-like environments. Otherwise, a space 635: % at the beginning of a line will start with \penalty -- and 636: % since \penalty is valid in vertical mode, we'd end up putting the 637: % penalty on the vertical list instead of in the new paragraph. 638: {\catcode`@ = 11 639: % Avoid using \@M directly, because that causes trouble 640: % if the definition is written into an index file. 641: \global\let\tiepenalty = \@M 642: \gdef\tie{\leavevmode\penalty\tiepenalty\ } 643: } 644: 645: % @: forces normal size whitespace following. 646: \def\:{\spacefactor=1000 } 647: 648: % @* forces a line break. 649: \def\*{\hfil\break\hbox{}\ignorespaces} 650: 651: % @/ allows a line break. 652: \let\/=\allowbreak 653: 654: % @. is an end-of-sentence period. 655: \def\.{.\spacefactor=\endofsentencespacefactor\space} 656: 657: % @! is an end-of-sentence bang. 658: \def\!{!\spacefactor=\endofsentencespacefactor\space} 659: 660: % @? is an end-of-sentence query. 661: \def\?{?\spacefactor=\endofsentencespacefactor\space} 662: 663: % @frenchspacing on|off says whether to put extra space after punctuation. 664: % 665: \def\onword{on} 666: \def\offword{off} 667: % 668: \parseargdef\frenchspacing{% 669: \def\temp{#1}% 670: \ifx\temp\onword \plainfrenchspacing 671: \else\ifx\temp\offword \plainnonfrenchspacing 672: \else 673: \errhelp = \EMsimple 674: \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% 675: \fi\fi 676: } 677: 678: % @w prevents a word break. Without the \leavevmode, @w at the 679: % beginning of a paragraph, when TeX is still in vertical mode, would 680: % produce a whole line of output instead of starting the paragraph. 681: \def\w#1{\leavevmode\hbox{#1}} 682: 683: % @group ... @end group forces ... to be all on one page, by enclosing 684: % it in a TeX vbox. We use \vtop instead of \vbox to construct the box 685: % to keep its height that of a normal line. According to the rules for 686: % \topskip (p.114 of the TeXbook), the glue inserted is 687: % max (\topskip - \ht (first item), 0). If that height is large, 688: % therefore, no glue is inserted, and the space between the headline and 689: % the text is small, which looks bad. 690: % 691: % Another complication is that the group might be very large. This can 692: % cause the glue on the previous page to be unduly stretched, because it 693: % does not have much material. In this case, it's better to add an 694: % explicit \vfill so that the extra space is at the bottom. The 695: % threshold for doing this is if the group is more than \vfilllimit 696: % percent of a page (\vfilllimit can be changed inside of @tex). 697: % 698: \newbox\groupbox 699: \def\vfilllimit{0.7} 700: % 701: \envdef\group{% 702: \ifnum\catcode`\^^M=\active \else 703: \errhelp = \groupinvalidhelp 704: \errmessage{@group invalid in context where filling is enabled}% 705: \fi 706: \startsavinginserts 707: % 708: \setbox\groupbox = \vtop\bgroup 709: % Do @comment since we are called inside an environment such as 710: % @example, where each end-of-line in the input causes an 711: % end-of-line in the output. We don't want the end-of-line after 712: % the `@group' to put extra space in the output. Since @group 713: % should appear on a line by itself (according to the Texinfo 714: % manual), we don't worry about eating any user text. 715: \comment 716: } 717: % 718: % The \vtop produces a box with normal height and large depth; thus, TeX puts 719: % \baselineskip glue before it, and (when the next line of text is done) 720: % \lineskip glue after it. Thus, space below is not quite equal to space 721: % above. But it's pretty close. 722: \def\Egroup{% 723: % To get correct interline space between the last line of the group 724: % and the first line afterwards, we have to propagate \prevdepth. 725: \endgraf % Not \par, as it may have been set to \lisppar. 726: \global\dimen1 = \prevdepth 727: \egroup % End the \vtop. 728: % \dimen0 is the vertical size of the group's box. 729: \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox 730: % \dimen2 is how much space is left on the page (more or less). 731: \dimen2 = \pageheight \advance\dimen2 by -\pagetotal 732: % if the group doesn't fit on the current page, and it's a big big 733: % group, force a page break. 734: \ifdim \dimen0 > \dimen2 735: \ifdim \pagetotal < \vfilllimit\pageheight 736: \page 737: \fi 738: \fi 739: \box\groupbox 740: \prevdepth = \dimen1 741: \checkinserts