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{1999-09-25.10} 7% 8% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 9% Free Software Foundation, Inc. 10% 11% This texinfo.tex file is free software; you can redistribute it and/or 12% modify it under the terms of the GNU General Public License as 13% published by the Free Software Foundation; either version 2, or (at 14% your option) any later version. 15% 16% This texinfo.tex file is distributed in the hope that it will be 17% useful, but WITHOUT ANY WARRANTY; without even the implied warranty 18% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19% General Public License for more details. 20% 21% You should have received a copy of the GNU General Public License 22% along with this texinfo.tex file; see the file COPYING. If not, write 23% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 24% Boston, MA 02111-1307, USA. 25% 26% In other words, you are welcome to use, share and improve this program. 27% You are forbidden to forbid anyone else to use, share and improve 28% what you give them. Help stamp out software-hoarding! 29% 30% Please try the latest version of texinfo.tex before submitting bug 31% reports; you can get the latest version from: 32% ftp://ftp.gnu.org/gnu/texinfo.tex 33% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) 34% ftp://texinfo.org/tex/texinfo.tex 35% ftp://us.ctan.org/macros/texinfo/texinfo.tex 36% (and all CTAN mirrors, finger ctan@us.ctan.org for a list). 37% /home/gd/gnu/doc/texinfo.tex on the GNU machines. 38% The texinfo.tex in any given Texinfo distribution could well be out 39% of date, so if that's what you're using, please check. 40% Texinfo has a small home page at http://texinfo.org/. 41% 42% Send bug reports to bug-texinfo@gnu.org. Please include including a 43% complete document in each bug report with which we can reproduce the 44% problem. Patches are, of course, greatly appreciated. 45% 46% To process a Texinfo manual with TeX, it's most reliable to use the 47% texi2dvi shell script that comes with the distribution. For a simple 48% manual foo.texi, however, you can get away with this: 49% tex foo.texi 50% texindex foo.?? 51% tex foo.texi 52% tex foo.texi 53% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps. 54% The extra runs of TeX get the cross-reference information correct. 55% Sometimes one run after texindex suffices, and sometimes you need more 56% than two; texi2dvi does it as many times as necessary. 57% 58% It is possible to adapt texinfo.tex for other languages. You can get 59% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/. 60 61\message{Loading texinfo [version \texinfoversion]:} 62 63% If in a .fmt file, print the version number 64% and turn on active characters that we couldn't do earlier because 65% they might have appeared in the input file name. 66\everyjob{\message{[Texinfo version \texinfoversion]}% 67 \catcode`+=\active \catcode`\_=\active} 68 69% Save some parts of plain tex whose names we will redefine. 70\let\ptexb=\b 71\let\ptexbullet=\bullet 72\let\ptexc=\c 73\let\ptexcomma=\, 74\let\ptexdot=\. 75\let\ptexdots=\dots 76\let\ptexend=\end 77\let\ptexequiv=\equiv 78\let\ptexexclam=\! 79\let\ptexi=\i 80\let\ptexlbrace=\{ 81\let\ptexrbrace=\} 82\let\ptexstar=\* 83\let\ptext=\t 84 85% We never want plain's outer \+ definition in Texinfo. 86% For @tex, we can use \tabalign. 87\let\+ = \relax 88 89\message{Basics,} 90\chardef\other=12 91 92% If this character appears in an error message or help string, it 93% starts a new line in the output. 94\newlinechar = `^^J 95 96% Set up fixed words for English if not already set. 97\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi 98\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi 99\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi 100\ifx\putwordin\undefined \gdef\putwordin{in}\fi 101\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi 102\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi 103\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi 104\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi 105\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi 106\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi 107\ifx\putwordof\undefined \gdef\putwordof{of}\fi 108\ifx\putwordon\undefined \gdef\putwordon{on}\fi 109\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi 110\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi 111\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi 112\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi 113\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi 114\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi 115\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi 116% 117\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi 118\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi 119\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi 120\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi 121\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi 122\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi 123\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi 124\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi 125\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi 126\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi 127\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi 128\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi 129% 130\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi 131\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi 132\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi 133\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi 134\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi 135\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi 136\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi 137 138% Ignore a token. 139% 140\def\gobble#1{} 141 142\hyphenation{ap-pen-dix} 143\hyphenation{mini-buf-fer mini-buf-fers} 144\hyphenation{eshell} 145\hyphenation{white-space} 146 147% Margin to add to right of even pages, to left of odd pages. 148\newdimen \bindingoffset 149\newdimen \normaloffset 150\newdimen\pagewidth \newdimen\pageheight 151 152% Sometimes it is convenient to have everything in the transcript file 153% and nothing on the terminal. We don't just call \tracingall here, 154% since that produces some useless output on the terminal. 155% 156\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% 157\ifx\eTeXversion\undefined 158\def\loggingall{\tracingcommands2 \tracingstats2 159 \tracingpages1 \tracingoutput1 \tracinglostchars1 160 \tracingmacros2 \tracingparagraphs1 \tracingrestores1 161 \showboxbreadth\maxdimen\showboxdepth\maxdimen 162}% 163\else 164\def\loggingall{\tracingcommands3 \tracingstats2 165 \tracingpages1 \tracingoutput1 \tracinglostchars1 166 \tracingmacros2 \tracingparagraphs1 \tracingrestores1 167 \tracingscantokens1 \tracingassigns1 \tracingifs1 168 \tracinggroups1 \tracingnesting2 169 \showboxbreadth\maxdimen\showboxdepth\maxdimen 170}% 171\fi 172 173% For @cropmarks command. 174% Do @cropmarks to get crop marks. 175% 176\newif\ifcropmarks 177\let\cropmarks = \cropmarkstrue 178% 179% Dimensions to add cropmarks at corners. 180% Added by P. A. MacKay, 12 Nov. 1986 181% 182\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines 183\newdimen\cornerlong \cornerlong=1pc 184\newdimen\cornerthick \cornerthick=.3pt 185\newdimen\topandbottommargin \topandbottommargin=.75in 186 187% Main output routine. 188\chardef\PAGE = 255 189\output = {\onepageout{\pagecontents\PAGE}} 190 191\newbox\headlinebox 192\newbox\footlinebox 193 194% \onepageout takes a vbox as an argument. Note that \pagecontents 195% does insertions, but you have to call it yourself. 196\def\onepageout#1{% 197 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi 198 % 199 \ifodd\pageno \advance\hoffset by \bindingoffset 200 \else \advance\hoffset by -\bindingoffset\fi 201 % 202 % Do this outside of the \shipout so @code etc. will be expanded in 203 % the headline as they should be, not taken literally (outputting ''code). 204 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% 205 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% 206 % 207 {% 208 % Have to do this stuff outside the \shipout because we want it to 209 % take effect in \write's, yet the group defined by the \vbox ends 210 % before the \shipout runs. 211 % 212 \escapechar = `\\ % use backslash in output files. 213 \indexdummies % don't expand commands in the output. 214 \normalturnoffactive % \ in index entries must not stay \, e.g., if 215 % the page break happens to be in the middle of an example. 216 \shipout\vbox{% 217 \ifcropmarks \vbox to \outervsize\bgroup 218 \hsize = \outerhsize 219 \vskip-\topandbottommargin 220 \vtop to0pt{% 221 \line{\ewtop\hfil\ewtop}% 222 \nointerlineskip 223 \line{% 224 \vbox{\moveleft\cornerthick\nstop}% 225 \hfill 226 \vbox{\moveright\cornerthick\nstop}% 227 }% 228 \vss}% 229 \vskip\topandbottommargin 230 \line\bgroup 231 \hfil % center the page within the outer (page) hsize. 232 \ifodd\pageno\hskip\bindingoffset\fi 233 \vbox\bgroup 234 \fi 235 % 236 \unvbox\headlinebox 237 \pagebody{#1}% 238 \ifdim\ht\footlinebox > 0pt 239 % Only leave this space if the footline is nonempty. 240 % (We lessened \vsize for it in \oddfootingxxx.) 241 % The \baselineskip=24pt in plain's \makefootline has no effect. 242 \vskip 2\baselineskip 243 \unvbox\footlinebox 244 \fi 245 % 246 \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi 247 % 248 \ifcropmarks 249 \egroup % end of \vbox\bgroup 250 \hfil\egroup % end of (centering) \line\bgroup 251 \vskip\topandbottommargin plus1fill minus1fill 252 \boxmaxdepth = \cornerthick 253 \vbox to0pt{\vss 254 \line{% 255 \vbox{\moveleft\cornerthick\nsbot}% 256 \hfill 257 \vbox{\moveright\cornerthick\nsbot}% 258 }% 259 \nointerlineskip 260 \line{\ewbot\hfil\ewbot}% 261 }% 262 \egroup % \vbox from first cropmarks clause 263 \fi 264 }% end of \shipout\vbox 265 }% end of group with \turnoffactive 266 \advancepageno 267 \ifnum\outputpenalty>-20000 \else\dosupereject\fi 268} 269 270\newinsert\margin \dimen\margin=\maxdimen 271 272\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} 273{\catcode`\@ =11 274\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi 275% marginal hacks, juha@viisa.uucp (Juha Takala) 276\ifvoid\margin\else % marginal info is present 277 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi 278\dimen@=\dp#1 \unvbox#1 279\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi 280\ifr@ggedbottom \kern-\dimen@ \vfil \fi} 281} 282 283% Here are the rules for the cropmarks. Note that they are 284% offset so that the space between them is truly \outerhsize or \outervsize 285% (P. A. MacKay, 12 November, 1986) 286% 287\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} 288\def\nstop{\vbox 289 {\hrule height\cornerthick depth\cornerlong width\cornerthick}} 290\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} 291\def\nsbot{\vbox 292 {\hrule height\cornerlong depth\cornerthick width\cornerthick}} 293 294% Parse an argument, then pass it to #1. The argument is the rest of 295% the input line (except we remove a trailing comment). #1 should be a 296% macro which expects an ordinary undelimited TeX argument. 297% 298\def\parsearg#1{% 299 \let\next = #1% 300 \begingroup 301 \obeylines 302 \futurelet\temp\parseargx 303} 304 305% If the next token is an obeyed space (from an @example environment or 306% the like), remove it and recurse. Otherwise, we're done. 307\def\parseargx{% 308 % \obeyedspace is defined far below, after the definition of \sepspaces. 309 \ifx\obeyedspace\temp 310 \expandafter\parseargdiscardspace 311 \else 312 \expandafter\parseargline 313 \fi 314} 315 316% Remove a single space (as the delimiter token to the macro call). 317{\obeyspaces % 318 \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} 319 320{\obeylines % 321 \gdef\parseargline#1^^M{% 322 \endgroup % End of the group started in \parsearg. 323 % 324 % First remove any @c comment, then any @comment. 325 % Result of each macro is put in \toks0. 326 \argremovec #1\c\relax % 327 \expandafter\argremovecomment \the\toks0 \comment\relax % 328 % 329 % Call the caller's macro, saved as \next in \parsearg. 330 \expandafter\next\expandafter{\the\toks0}% 331 }% 332} 333 334% Since all \c{,omment} does is throw away the argument, we can let TeX 335% do that for us. The \relax here is matched by the \relax in the call 336% in \parseargline; it could be more or less anything, its purpose is 337% just to delimit the argument to the \c. 338\def\argremovec#1\c#2\relax{\toks0 = {#1}} 339\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} 340 341% \argremovec{,omment} might leave us with trailing spaces, though; e.g., 342% @end itemize @c foo 343% will have two active spaces as part of the argument with the 344% `itemize'. Here we remove all active spaces from #1, and assign the 345% result to \toks0. 346% 347% This loses if there are any *other* active characters besides spaces 348% in the argument -- _ ^ +, for example -- since they get expanded. 349% Fortunately, Texinfo does not define any such commands. (If it ever 350% does, the catcode of the characters in questionwill have to be changed 351% here.) But this means we cannot call \removeactivespaces as part of 352% \argremovec{,omment}, since @c uses \parsearg, and thus the argument 353% that \parsearg gets might well have any character at all in it. 354% 355\def\removeactivespaces#1{% 356 \begingroup 357 \ignoreactivespaces 358 \edef\temp{#1}% 359 \global\toks0 = \expandafter{\temp}% 360 \endgroup 361} 362 363% Change the active space to expand to nothing. 364% 365\begingroup 366 \obeyspaces 367 \gdef\ignoreactivespaces{\obeyspaces\let =\empty} 368\endgroup 369 370 371\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} 372 373%% These are used to keep @begin/@end levels from running away 374%% Call \inENV within environments (after a \begingroup) 375\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} 376\def\ENVcheck{% 377\ifENV\errmessage{Still within an environment; press RETURN to continue} 378\endgroup\fi} % This is not perfect, but it should reduce lossage 379 380% @begin foo is the same as @foo, for now. 381\newhelp\EMsimple{Press RETURN to continue.} 382 383\outer\def\begin{\parsearg\beginxxx} 384 385\def\beginxxx #1{% 386\expandafter\ifx\csname #1\endcsname\relax 387{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else 388\csname #1\endcsname\fi} 389 390% @end foo executes the definition of \Efoo. 391% 392\def\end{\parsearg\endxxx} 393\def\endxxx #1{% 394 \removeactivespaces{#1}% 395 \edef\endthing{\the\toks0}% 396 % 397 \expandafter\ifx\csname E\endthing\endcsname\relax 398 \expandafter\ifx\csname \endthing\endcsname\relax 399 % There's no \foo, i.e., no ``environment'' foo. 400 \errhelp = \EMsimple 401 \errmessage{Undefined command `@end \endthing'}% 402 \else 403 \unmatchedenderror\endthing 404 \fi 405 \else 406 % Everything's ok; the right environment has been started. 407 \csname E\endthing\endcsname 408 \fi 409} 410 411% There is an environment #1, but it hasn't been started. Give an error. 412% 413\def\unmatchedenderror#1{% 414 \errhelp = \EMsimple 415 \errmessage{This `@end #1' doesn't have a matching `@#1'}% 416} 417 418% Define the control sequence \E#1 to give an unmatched @end error. 419% 420\def\defineunmatchedend#1{% 421 \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% 422} 423 424 425% Single-spacing is done by various environments (specifically, in 426% \nonfillstart and \quotations). 427\newskip\singlespaceskip \singlespaceskip = 12.5pt 428\def\singlespace{% 429 % Why was this kern here? It messes up equalizing space above and below 430 % environments. --karl, 6may93 431 %{\advance \baselineskip by -\singlespaceskip 432 %\kern \baselineskip}% 433 \setleading \singlespaceskip 434} 435 436%% Simple single-character @ commands 437 438% @@ prints an @ 439% Kludge this until the fonts are right (grr). 440\def\@{{\tt\char64}} 441 442% This is turned off because it was never documented 443% and you can use @w{...} around a quote to suppress ligatures. 444%% Define @` and @' to be the same as ` and ' 445%% but suppressing ligatures. 446%\def\`{{`}} 447%\def\'{{'}} 448 449% Used to generate quoted braces. 450\def\mylbrace {{\tt\char123}} 451\def\myrbrace {{\tt\char125}} 452\let\{=\mylbrace 453\let\}=\myrbrace 454\begingroup 455 % Definitions to produce actual \{ & \} command in an index. 456 \catcode`\{ = 12 \catcode`\} = 12 457 \catcode`\[ = 1 \catcode`\] = 2 458 \catcode`\@ = 0 \catcode`\\ = 12 459 @gdef@lbracecmd[\{]% 460 @gdef@rbracecmd[\}]% 461@endgroup 462 463% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent 464% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. 465\let\, = \c 466\let\dotaccent = \. 467\def\ringaccent#1{{\accent23 #1}} 468\let\tieaccent = \t 469\let\ubaraccent = \b 470\let\udotaccent = \d 471 472% Other special characters: @questiondown @exclamdown 473% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. 474\def\questiondown{?`} 475\def\exclamdown{!`} 476 477% Dotless i and dotless j, used for accents. 478\def\imacro{i} 479\def\jmacro{j} 480\def\dotless#1{% 481 \def\temp{#1}% 482 \ifx\temp\imacro \ptexi 483 \else\ifx\temp\jmacro \j 484 \else \errmessage{@dotless can be used only with i or j}% 485 \fi\fi 486} 487 488% Be sure we're in horizontal mode when doing a tie, since we make space 489% equivalent to this in @example-like environments. Otherwise, a space 490% at the beginning of a line will start with \penalty -- and 491% since \penalty is valid in vertical mode, we'd end up putting the 492% penalty on the vertical list instead of in the new paragraph. 493{\catcode`@ = 11 494 % Avoid using \@M directly, because that causes trouble 495 % if the definition is written into an index file. 496 \global\let\tiepenalty = \@M 497 \gdef\tie{\leavevmode\penalty\tiepenalty\ } 498} 499 500% @: forces normal size whitespace following. 501\def\:{\spacefactor=1000 } 502 503% @* forces a line break. 504\def\*{\hfil\break\hbox{}\ignorespaces} 505 506% @. is an end-of-sentence period. 507\def\.{.\spacefactor=3000 } 508 509% @! is an end-of-sentence bang. 510\def\!{!\spacefactor=3000 } 511 512% @? is an end-of-sentence query. 513\def\?{?\spacefactor=3000 } 514 515% @w prevents a word break. Without the \leavevmode, @w at the 516% beginning of a paragraph, when TeX is still in vertical mode, would 517% produce a whole line of output instead of starting the paragraph. 518\def\w#1{\leavevmode\hbox{#1}} 519 520% @group ... @end group forces ... to be all on one page, by enclosing 521% it in a TeX vbox. We use \vtop instead of \vbox to construct the box 522% to keep its height that of a normal line. According to the rules for 523% \topskip (p.114 of the TeXbook), the glue inserted is 524% max (\topskip - \ht (first item), 0). If that height is large, 525% therefore, no glue is inserted, and the space between the headline and 526% the text is small, which looks bad. 527% 528\def\group{\begingroup 529 \ifnum\catcode13=\active \else 530 \errhelp = \groupinvalidhelp 531 \errmessage{@group invalid in context where filling is enabled}% 532 \fi 533 % 534 % The \vtop we start below produces a box with normal height and large 535 % depth; thus, TeX puts \baselineskip glue before it, and (when the 536 % next line of text is done) \lineskip glue after it. (See p.82 of 537 % the TeXbook.) Thus, space below is not quite equal to space 538 % above. But it's pretty close. 539 \def\Egroup{% 540 \egroup % End the \vtop. 541 \endgroup % End the \group. 542 }% 543 % 544 \vtop\bgroup 545 % We have to put a strut on the last line in case the @group is in 546 % the midst of an example, rather than completely enclosing it. 547 % Otherwise, the interline space between the last line of the group 548 % and the first line afterwards is too small. But we can't put the 549 % strut in \Egroup, since there it would be on a line by itself. 550 % Hence this just inserts a strut at the beginning of each line. 551 \everypar = {\strut}% 552 % 553 % Since we have a strut on every line, we don't need any of TeX's 554 % normal interline spacing. 555 \offinterlineskip 556 % 557 % OK, but now we have to do something about blank 558 % lines in the input in @example-like environments, which normally 559 % just turn into \lisppar, which will insert no space now that we've 560 % turned off the interline space. Simplest is to make them be an 561 % empty paragraph. 562 \ifx\par\lisppar 563 \edef\par{\leavevmode \par}% 564 % 565 % Reset ^^M's definition to new definition of \par. 566 \obeylines 567 \fi 568 % 569 % Do @comment since we are called inside an environment such as 570 % @example, where each end-of-line in the input causes an 571 % end-of-line in the output. We don't want the end-of-line after 572 % the `@group' to put extra space in the output. Since @group 573 % should appear on a line by itself (according to the Texinfo 574 % manual), we don't worry about eating any user text. 575 \comment 576} 577% 578% TeX puts in an \escapechar (i.e., `@') at the beginning of the help 579% message, so this ends up printing `@group can only ...'. 580% 581\newhelp\groupinvalidhelp{% 582group can only be used in environments such as @example,^^J% 583where each line of input produces a line of output.} 584 585% @need space-in-mils 586% forces a page break if there is not space-in-mils remaining. 587 588\newdimen\mil \mil=0.001in 589 590\def\need{\parsearg\needx} 591 592% Old definition--didn't work. 593%\def\needx #1{\par % 594%% This method tries to make TeX break the page naturally 595%% if the depth of the box does not fit. 596%{\baselineskip=0pt% 597%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak 598%\prevdepth=-1000pt 599%}} 600 601\def\needx#1{% 602 % Ensure vertical mode, so we don't make a big box in the middle of a 603 % paragraph. 604 \par 605 % 606 % If the @need value is less than one line space, it's useless. 607 \dimen0 = #1\mil 608 \dimen2 = \ht\strutbox 609 \advance\dimen2 by \dp\strutbox 610 \ifdim\dimen0 > \dimen2 611 % 612 % Do a \strut just to make the height of this box be normal, so the 613 % normal leading is inserted relative to the preceding line. 614 % And a page break here is fine. 615 \vtop to #1\mil{\strut\vfil}% 616 % 617 % TeX does not even consider page breaks if a penalty added to the 618 % main vertical list is 10000 or more. But in order to see if the 619 % empty box we just added fits on the page, we must make it consider 620 % page breaks. On the other hand, we don't want to actually break the 621 % page after the empty box. So we use a penalty of 9999. 622 % 623 % There is an extremely small chance that TeX will actually break the 624 % page at this \penalty, if there are no other feasible breakpoints in 625 % sight. (If the user is using lots of big @group commands, which 626 % almost-but-not-quite fill up a page, TeX will have a hard time doing 627 % good page breaking, for example.) However, I could not construct an 628 % example where a page broke at this \penalty; if it happens in a real 629 % document, then we can reconsider our strategy. 630 \penalty9999 631 % 632 % Back up by the size of the box, whether we did a page break or not. 633 \kern -#1\mil 634 % 635 % Do not allow a page break right after this kern. 636 \nobreak 637 \fi 638} 639 640% @br forces paragraph break 641 642\let\br = \par 643 644% @dots{} output an ellipsis using the current font. 645% We do .5em per period so that it has the same spacing in a typewriter 646% font as three actual period characters. 647% 648\def\dots{% 649 \leavevmode 650 \hbox to 1.5em{% 651 \hskip 0pt plus 0.25fil minus 0.25fil 652 .\hss.\hss.% 653 \hskip 0pt plus 0.5fil minus 0.5fil 654 }% 655} 656 657% @enddots{} is an end-of-sentence ellipsis. 658% 659\def\enddots{% 660 \leavevmode 661 \hbox to 2em{% 662 \hskip 0pt plus 0.25fil minus 0.25fil 663 .\hss.\hss.\hss.% 664 \hskip 0pt plus 0.5fil minus 0.5fil 665 }% 666 \spacefactor=3000 667} 668 669 670% @page forces the start of a new page 671% 672\def\page{\par\vfill\supereject} 673 674% @exdent text.... 675% outputs text on separate line in roman font, starting at standard page margin 676 677% This records the amount of indent in the innermost environment. 678% That's how much \exdent should take out. 679\newskip\exdentamount 680 681% This defn is used inside fill environments such as @defun. 682\def\exdent{\parsearg\exdentyyy} 683\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} 684 685% This defn is used inside nofill environments such as @example. 686\def\nofillexdent{\parsearg\nofillexdentyyy} 687\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount 688\leftline{\hskip\leftskip{\rm#1}}}} 689 690% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. 691 692\def\inmargin#1{% 693\strut\vadjust{\nobreak\kern-\strutdepth 694 \vtop to \strutdepth{\baselineskip\strutdepth\vss 695 \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} 696\newskip\inmarginspacing \inmarginspacing=1cm 697\def\strutdepth{\dp\strutbox} 698 699%\hbox{{\rm#1}}\hfil\break}} 700 701% @include file insert text of that file as input. 702% Allow normal characters that we make active in the argument (a file name). 703\def\include{\begingroup 704 \catcode`\\=12 705 \catcode`~=12 706 \catcode`^=12 707 \catcode`_=12 708 \catcode`|=12 709 \catcode`<=12 710 \catcode`>=12 711 \catcode`+=12 712 \parsearg\includezzz} 713% Restore active chars for included file. 714\def\includezzz#1{\endgroup\begingroup 715 % Read the included file in a group so nested @include's work. 716 \def\thisfile{#1}% 717 \input\thisfile 718\endgroup} 719 720\def\thisfile{} 721 722% @center line outputs that line, centered 723 724\def\center{\parsearg\centerzzz} 725\def\centerzzz #1{{\advance\hsize by -\leftskip 726\advance\hsize by -\rightskip 727\centerline{#1}}} 728 729% @sp n outputs n lines of vertical space 730 731\def\sp{\parsearg\spxxx} 732\def\spxxx #1{\vskip #1\baselineskip} 733 734% @comment ...line which is ignored... 735% @c is the same as @comment 736% @ignore ... @end ignore is another way to write a comment 737 738\def\comment{\begingroup \catcode`\^^M=\other% 739\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% 740\commentxxx} 741{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} 742 743\let\c=\comment 744 745% @paragraphindent NCHARS 746% We'll use ems for NCHARS, close enough. 747% We cannot implement @paragraphindent asis, though. 748% 749\def\asisword{asis} % no translation, these are keywords 750\def\noneword{none} 751% 752\def\paragraphindent{\parsearg\doparagraphindent} 753\def\doparagraphindent#1{% 754 \def\temp{#1}% 755 \ifx\temp\asisword 756 \else 757 \ifx\temp\noneword 758 \defaultparindent = 0pt 759 \else 760 \defaultparindent = #1em 761 \fi 762 \fi 763 \parindent = \defaultparindent 764} 765 766% @exampleindent NCHARS 767% We'll use ems for NCHARS like @paragraphindent. 768% It seems @exampleindent asis isn't necessary, but 769% I preserve it to make it similar to @paragraphindent. 770\def\exampleindent{\parsearg\doexampleindent} 771\def\doexampleindent#1{% 772 \def\temp{#1}% 773 \ifx\temp\asisword 774 \else 775 \ifx\temp\noneword 776 \lispnarrowing = 0pt 777 \else 778 \lispnarrowing = #1em 779 \fi 780 \fi 781} 782 783% @asis just yields its argument. Used with @table, for example. 784% 785\def\asis#1{#1} 786 787% @math means output in math mode. 788% We don't use $'s directly in the definition of \math because control 789% sequences like \math are expanded when the toc file is written. Then, 790% we read the toc file back, the $'s will be normal characters (as they 791% should be, according to the definition of Texinfo). So we must use a 792% control sequence to switch into and out of math mode. 793% 794% This isn't quite enough for @math to work properly in indices, but it 795% seems unlikely it will ever be needed there. 796% 797\let\implicitmath = $ 798\def\math#1{\implicitmath #1\implicitmath} 799 800% @bullet and @minus need the same treatment as @math, just above. 801\def\bullet{\implicitmath\ptexbullet\implicitmath} 802\def\minus{\implicitmath-\implicitmath} 803 804% @refill is a no-op. 805\let\refill=\relax 806 807% If working on a large document in chapters, it is convenient to 808% be able to disable indexing, cross-referencing, and contents, for test runs. 809% This is done with @novalidate (before @setfilename). 810% 811\newif\iflinks \linkstrue % by default we want the aux files. 812\let\novalidate = \linksfalse 813 814% @setfilename is done at the beginning of every texinfo file. 815% So open here the files we need to have open while reading the input. 816% This makes it possible to make a .fmt file for texinfo. 817\def\setfilename{% 818 \iflinks 819 \readauxfile 820 \fi % \openindices needs to do some work in any case. 821 \openindices 822 \fixbackslash % Turn off hack to swallow `\input texinfo'. 823 \global\let\setfilename=\comment % Ignore extra @setfilename cmds. 824 % 825 % If texinfo.cnf is present on the system, read it. 826 % Useful for site-wide @afourpaper, etc. 827 % Just to be on the safe side, close the input stream before the \input. 828 \openin 1 texinfo.cnf 829 \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi 830 \closein1 831 \temp 832 % 833 \comment % Ignore the actual filename. 834} 835 836% Called from \setfilename. 837% 838\def\openindices{% 839 \newindex{cp}% 840 \newcodeindex{fn}% 841 \newcodeindex{vr}% 842 \newcodeindex{tp}% 843 \newcodeindex{ky}% 844 \newcodeindex{pg}% 845} 846 847% @bye. 848\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} 849 850 851\message{pdf,} 852% adobe `portable' document format 853\newcount\tempnum 854\newcount\lnkcount 855\newtoks\filename 856\newcount\filenamelength 857\newcount\pgn 858\newtoks\toksA 859\newtoks\toksB 860\newtoks\toksC 861\newtoks\toksD 862\newbox\boxA 863\newcount\countA 864\newif\ifpdf 865\newif\ifpdfmakepagedest 866 867\ifx\pdfoutput\undefined 868 \pdffalse 869 \let\pdfmkdest = \gobble 870 \let\pdfurl = \gobble 871 \let\endlink = \relax 872 \let\linkcolor = \relax 873 \let\pdfmakeoutlines = \relax 874\else 875 \pdftrue 876 \pdfoutput = 1 877 \input pdfcolor 878 \def\dopdfimage#1#2#3{% 879 \def\imagewidth{#2}% 880 \def\imageheight{#3}% 881 \ifnum\pdftexversion < 14 882 \pdfimage 883 \else 884 \pdfximage 885 \fi 886 \ifx\empty\imagewidth\else width \imagewidth \fi 887 \ifx\empty\imageheight\else height \imageheight \fi 888 {#1.pdf}% 889 \ifnum\pdftexversion < 14 \else 890 \pdfrefximage \pdflastximage 891 \fi} 892 \def\pdfmkdest#1{\pdfdest name{#1@} xyz} 893 \def\pdfmkpgn#1{#1@} 894 \let\linkcolor = \Cyan 895 \def\endlink{\Black\pdfendlink} 896 % Adding outlines to PDF; macros for calculating structure of outlines 897 % come from Petr Olsak 898 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% 899 \else \csname#1\endcsname \fi} 900 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax 901 \advance\tempnum by1 902 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} 903 \def\pdfmakeoutlines{{% 904 \openin 1 \jobname.toc 905 \ifeof 1\else\bgroup 906 \closein 1 907 \indexnofonts 908 \def\tt{} 909 % thanh's hack / proper braces in bookmarks 910 \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace 911 \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace 912 % 913 \def\chapentry ##1##2##3{} 914 \def\unnumbchapentry ##1##2{} 915 \def\secentry ##1##2##3##4{\advancenumber{chap##2}} 916 \def\unnumbsecentry ##1##2{} 917 \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} 918 \def\unnumbsubsecentry ##1##2{} 919 \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} 920 \def\unnumbsubsubsecentry ##1##2{} 921 \input \jobname.toc 922 \def\chapentry ##1##2##3{% 923 \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} 924 \def\unnumbchapentry ##1##2{% 925 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} 926 \def\secentry ##1##2##3##4{% 927 \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} 928 \def\unnumbsecentry ##1##2{% 929 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} 930 \def\subsecentry ##1##2##3##4##5{% 931 \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} 932 \def\unnumbsubsecentry ##1##2{% 933 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} 934 \def\subsubsecentry ##1##2##3##4##5##6{% 935 \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} 936 \def\unnumbsubsubsecentry ##1##2{% 937 \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} 938 \input \jobname.toc 939 \egroup\fi 940 }} 941 \def\makelinks #1,{% 942 \def\params{#1}\def\E{END}% 943 \ifx\params\E 944 \let\nextmakelinks=\relax 945 \else 946 \let\nextmakelinks=\makelinks 947 \ifnum\lnkcount>0,\fi 948 \picknum{#1}% 949 \startlink attr{/Border [0 0 0]} 950 goto name{\pdfmkpgn{\the\pgn}}% 951 \linkcolor #1% 952 \advance\lnkcount by 1% 953 \endlink 954 \fi 955 \nextmakelinks 956 } 957 \def\picknum#1{\expandafter\pn#1} 958 \def\pn#1{% 959 \def\p{#1}% 960 \ifx\p\lbrace 961 \let\nextpn=\ppn 962 \else 963 \let\nextpn=\ppnn 964 \def\first{#1} 965 \fi 966 \nextpn 967 } 968 \def\ppn#1{\pgn=#1\gobble} 969 \def\ppnn{\pgn=\first} 970 \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} 971 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 972 \def\skipspaces#1{\def\PP{#1}\def\D{|}% 973 \ifx\PP\D\let\nextsp\relax 974 \else\let\nextsp\skipspaces 975 \ifx\p\space\else\addtokens{\filename}{\PP}% 976 \advance\filenamelength by 1 977 \fi 978 \fi 979 \nextsp} 980 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} 981 \ifnum\pdftexversion < 14 982 \let \startlink \pdfannotlink 983 \else 984 \let \startlink \pdfstartlink 985 \fi 986 \def\pdfurl#1{% 987 \begingroup 988 \normalturnoffactive\def\@{@}% 989 \leavevmode\Red 990 \startlink attr{/Border [0 0 0]}% 991 user{/Subtype /Link /A << /S /URI /URI (#1) >>}% 992 % #1 993 \endgroup} 994 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} 995 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 996 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} 997 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} 998 \def\maketoks{% 999 \expandafter\poptoks\the\toksA|ENDTOKS| 1000 \ifx\first0\adn0 1001 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 1002 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 1003 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 1004 \else 1005 \ifnum0=\countA\else\makelink\fi 1006 \ifx\first.\let\next=\done\else 1007 \let\next=\maketoks 1008 \addtokens{\toksB}{\the\toksD} 1009 \ifx\first,\addtokens{\toksB}{\space}\fi 1010 \fi 1011 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 1012 \next} 1013 \def\makelink{\addtokens{\toksB}% 1014 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} 1015 \def\pdflink#1{% 1016 \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}} 1017 \linkcolor #1\endlink} 1018 \def\mkpgn#1{#1@} 1019 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} 1020\fi % \ifx\pdfoutput 1021 1022 1023\message{fonts,} 1024% Font-change commands. 1025 1026% Texinfo sort of supports the sans serif font style, which plain TeX does not. 1027% So we set up a \sf analogous to plain's \rm, etc. 1028\newfam\sffam 1029\def\sf{\fam=\sffam \tensf} 1030\let\li = \sf % Sometimes we call it \li, not \sf. 1031 1032% We don't need math for this one. 1033\def\ttsl{\tenttsl} 1034 1035% Use Computer Modern fonts at \magstephalf (11pt). 1036\newcount\mainmagstep 1037\mainmagstep=\magstephalf 1038 1039% Set the font macro #1 to the font named #2, adding on the 1040% specified font prefix (normally `cm'). 1041% #3 is the font's design size, #4 is a scale factor 1042\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} 1043 1044% Use cm as the default font prefix. 1045% To specify the font prefix, you must define \fontprefix 1046% before you read in texinfo.tex. 1047\ifx\fontprefix\undefined 1048\def\fontprefix{cm} 1049\fi 1050% Support font families that don't use the same naming scheme as CM. 1051\def\rmshape{r} 1052\def\rmbshape{bx} %where the normal face is bold 1053\def\bfshape{b} 1054\def\bxshape{bx} 1055\def\ttshape{tt} 1056\def\ttbshape{tt} 1057\def\ttslshape{sltt} 1058\def\itshape{ti} 1059\def\itbshape{bxti} 1060\def\slshape{sl} 1061\def\slbshape{bxsl} 1062\def\sfshape{ss} 1063\def\sfbshape{ss} 1064\def\scshape{csc} 1065\def\scbshape{csc} 1066 1067\ifx\bigger\relax 1068\let\mainmagstep=\magstep1 1069\setfont\textrm\rmshape{12}{1000} 1070\setfont\texttt\ttshape{12}{1000} 1071\else 1072\setfont\textrm\rmshape{10}{\mainmagstep} 1073\setfont\texttt\ttshape{10}{\mainmagstep} 1074\fi 1075% Instead of cmb10, you many want to use cmbx10. 1076% cmbx10 is a prettier font on its own, but cmb10 1077% looks better when embedded in a line with cmr10. 1078\setfont\textbf\bfshape{10}{\mainmagstep} 1079\setfont\textit\itshape{10}{\mainmagstep} 1080\setfont\textsl\slshape{10}{\mainmagstep} 1081\setfont\textsf\sfshape{10}{\mainmagstep} 1082\setfont\textsc\scshape{10}{\mainmagstep} 1083\setfont\textttsl\ttslshape{10}{\mainmagstep} 1084\font\texti=cmmi10 scaled \mainmagstep 1085\font\textsy=cmsy10 scaled \mainmagstep 1086 1087% A few fonts for @defun, etc. 1088\setfont\defbf\bxshape{10}{\magstep1} %was 1314 1089\setfont\deftt\ttshape{10}{\magstep1} 1090\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} 1091 1092% Fonts for indices, footnotes, small examples (9pt). 1093\setfont\smallrm\rmshape{9}{1000} 1094\setfont\smalltt\ttshape{9}{1000} 1095\setfont\smallbf\bfshape{10}{900} 1096\setfont\smallit\itshape{9}{1000} 1097\setfont\smallsl\slshape{9}{1000} 1098\setfont\smallsf\sfshape{9}{1000} 1099\setfont\smallsc\scshape{10}{900} 1100\setfont\smallttsl\ttslshape{10}{900} 1101\font\smalli=cmmi9 1102\font\smallsy=cmsy9 1103 1104% Fonts for title page: 1105\setfont\titlerm\rmbshape{12}{\magstep3} 1106\setfont\titleit\itbshape{10}{\magstep4} 1107\setfont\titlesl\slbshape{10}{\magstep4} 1108\setfont\titlett\ttbshape{12}{\magstep3} 1109\setfont\titlettsl\ttslshape{10}{\magstep4} 1110\setfont\titlesf\sfbshape{17}{\magstep1} 1111\let\titlebf=\titlerm 1112\setfont\titlesc\scbshape{10}{\magstep4} 1113\font\titlei=cmmi12 scaled \magstep3 1114\font\titlesy=cmsy10 scaled \magstep4 1115\def\authorrm{\secrm} 1116 1117% Chapter (and unnumbered) fonts (17.28pt). 1118\setfont\chaprm\rmbshape{12}{\magstep2} 1119\setfont\chapit\itbshape{10}{\magstep3} 1120\setfont\chapsl\slbshape{10}{\magstep3} 1121\setfont\chaptt\ttbshape{12}{\magstep2} 1122\setfont\chapttsl\ttslshape{10}{\magstep3} 1123\setfont\chapsf\sfbshape{17}{1000} 1124\let\chapbf=\chaprm 1125\setfont\chapsc\scbshape{10}{\magstep3} 1126\font\chapi=cmmi12 scaled \magstep2 1127\font\chapsy=cmsy10 scaled \magstep3 1128 1129% Section fonts (14.4pt). 1130\setfont\secrm\rmbshape{12}{\magstep1} 1131\setfont\secit\itbshape{10}{\magstep2} 1132\setfont\secsl\slbshape{10}{\magstep2} 1133\setfont\sectt\ttbshape{12}{\magstep1} 1134\setfont\secttsl\ttslshape{10}{\magstep2} 1135\setfont\secsf\sfbshape{12}{\magstep1} 1136\let\secbf\secrm 1137\setfont\secsc\scbshape{10}{\magstep2} 1138\font\seci=cmmi12 scaled \magstep1 1139\font\secsy=cmsy10 scaled \magstep2 1140 1141% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. 1142% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. 1143% \setfont\ssecsl\slshape{10}{\magstep1} 1144% \setfont\ssectt\ttshape{10}{\magstep1} 1145% \setfont\ssecsf\sfshape{10}{\magstep1} 1146 1147%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. 1148%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than 1149%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. 1150%\setfont\ssectt\ttshape{10}{1315} 1151%\setfont\ssecsf\sfshape{10}{1315} 1152 1153%\let\ssecbf=\ssecrm 1154 1155% Subsection fonts (13.15pt). 1156\setfont\ssecrm\rmbshape{12}{\magstephalf} 1157\setfont\ssecit\itbshape{10}{1315} 1158\setfont\ssecsl\slbshape{10}{1315} 1159\setfont\ssectt\ttbshape{12}{\magstephalf} 1160\setfont\ssecttsl\ttslshape{10}{1315} 1161\setfont\ssecsf\sfbshape{12}{\magstephalf} 1162\let\ssecbf\ssecrm 1163\setfont\ssecsc\scbshape{10}{\magstep1} 1164\font\sseci=cmmi12 scaled \magstephalf 1165\font\ssecsy=cmsy10 scaled 1315 1166% The smallcaps and symbol fonts should actually be scaled \magstep1.5, 1167% but that is not a standard magnification. 1168 1169% In order for the font changes to affect most math symbols and letters, 1170% we have to define the \textfont of the standard families. Since 1171% texinfo doesn't allow for producing subscripts and superscripts, we 1172% don't bother to reset \scriptfont and \scriptscriptfont (which would 1173% also require loading a lot more fonts). 1174% 1175\def\resetmathfonts{% 1176 \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy 1177 \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf 1178 \textfont\ttfam = \tentt \textfont\sffam = \tensf 1179} 1180 1181 1182% The font-changing commands redefine the meanings of \tenSTYLE, instead 1183% of just \STYLE. We do this so that font changes will continue to work 1184% in math mode, where it is the current \fam that is relevant in most 1185% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam 1186% \tenbf}, for example. By redefining \tenbf, we obviate the need to 1187% redefine \bf itself. 1188\def\textfonts{% 1189 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl 1190 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc 1191 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl 1192 \resetmathfonts} 1193\def\titlefonts{% 1194 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl 1195 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc 1196 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy 1197 \let\tenttsl=\titlettsl 1198 \resetmathfonts \setleading{25pt}} 1199\def\titlefont#1{{\titlefonts\rm #1}} 1200\def\chapfonts{% 1201 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 1202 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc 1203 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl 1204 \resetmathfonts \setleading{19pt}} 1205\def\secfonts{% 1206 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl 1207 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc 1208 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl 1209 \resetmathfonts \setleading{16pt}} 1210\def\subsecfonts{% 1211 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl 1212 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc 1213 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl 1214 \resetmathfonts \setleading{15pt}} 1215\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? 1216\def\smallfonts{% 1217 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl 1218 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc 1219 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy 1220 \let\tenttsl=\smallttsl 1221 \resetmathfonts \setleading{11pt}} 1222 1223% Set up the default fonts, so we can use them for creating boxes. 1224% 1225\textfonts 1226 1227% Define these so they can be easily changed for other fonts. 1228\def\angleleft{$\langle$} 1229\def\angleright{$\rangle$} 1230 1231% Count depth in font-changes, for error checks 1232\newcount\fontdepth \fontdepth=0 1233 1234% Fonts for short table of contents. 1235\setfont\shortcontrm\rmshape{12}{1000} 1236\setfont\shortcontbf\bxshape{12}{1000} 1237\setfont\shortcontsl\slshape{12}{1000} 1238 1239%% Add scribe-like font environments, plus @l for inline lisp (usually sans 1240%% serif) and @ii for TeX italic 1241 1242% \smartitalic{ARG} outputs arg in italics, followed by an italic correction 1243% unless the following character is such as not to need one. 1244\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} 1245\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} 1246\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} 1247 1248\let\i=\smartitalic 1249\let\var=\smartslanted 1250\let\dfn=\smartslanted 1251\let\emph=\smartitalic 1252\let\cite=\smartslanted 1253 1254\def\b#1{{\bf #1}} 1255\let\strong=\b 1256 1257% We can't just use \exhyphenpenalty, because that only has effect at 1258% the end of a paragraph. Restore normal hyphenation at the end of the 1259% group within which \nohyphenation is presumably called. 1260% 1261\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} 1262\def\restorehyphenation{\hyphenchar\font = `- } 1263 1264\def\t#1{% 1265 {\tt \rawbackslash \frenchspacing #1}% 1266 \null 1267} 1268\let\ttfont=\t 1269\def\samp#1{`\tclose{#1}'\null} 1270\setfont\keyrm\rmshape{8}{1000} 1271\font\keysy=cmsy9 1272\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% 1273 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% 1274 \vbox{\hrule\kern-0.4pt 1275 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% 1276 \kern-0.4pt\hrule}% 1277 \kern-.06em\raise0.4pt\hbox{\angleright}}}} 1278% The old definition, with no lozenge: 1279%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} 1280\def\ctrl #1{{\tt \rawbackslash \hat}#1} 1281 1282% @file, @option are the same as @samp. 1283\let\file=\samp 1284\let\option=\samp 1285 1286% @code is a modification of @t, 1287% which makes spaces the same size as normal in the surrounding text. 1288\def\tclose#1{% 1289 {% 1290 % Change normal interword space to be same as for the current font. 1291 \spaceskip = \fontdimen2\font 1292 % 1293 % Switch to typewriter. 1294 \tt 1295 % 1296 % But `\ ' produces the large typewriter interword space. 1297 \def\ {{\spaceskip = 0pt{} }}% 1298 % 1299 % Turn off hyphenation. 1300 \nohyphenation 1301 % 1302 \rawbackslash 1303 \frenchspacing 1304 #1% 1305 }% 1306 \null 1307} 1308 1309% We *must* turn on hyphenation at `-' and `_' in \code. 1310% Otherwise, it is too hard to avoid overfull hboxes 1311% in the Emacs manual, the Library manual, etc. 1312 1313% Unfortunately, TeX uses one parameter (\hyphenchar) to control 1314% both hyphenation at - and hyphenation within words. 1315% We must therefore turn them both off (\tclose does that) 1316% and arrange explicitly to hyphenate at a dash. 1317% -- rms. 1318{ 1319 \catcode`\-=\active 1320 \catcode`\_=\active 1321 % 1322 \global\def\code{\begingroup 1323 \catcode`\-=\active \let-\codedash 1324 \catcode`\_=\active \let_\codeunder 1325 \codex 1326 } 1327 % 1328 % If we end up with any active - characters when handling the index, 1329 % just treat them as a normal -. 1330 \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} 1331} 1332 1333\def\realdash{-} 1334\def\codedash{-\discretionary{}{}{}} 1335\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} 1336\def\codex #1{\tclose{#1}\endgroup} 1337 1338%\let\exp=\tclose %Was temporary 1339 1340% @kbd is like @code, except that if the argument is just one @key command, 1341% then @kbd has no effect. 1342 1343% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), 1344% `example' (@kbd uses ttsl only inside of @example and friends), 1345% or `code' (@kbd uses normal tty font always). 1346\def\kbdinputstyle{\parsearg\kbdinputstylexxx} 1347\def\kbdinputstylexxx#1{% 1348 \def\arg{#1}% 1349 \ifx\arg\worddistinct 1350 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% 1351 \else\ifx\arg\wordexample 1352 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% 1353 \else\ifx\arg\wordcode 1354 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% 1355 \fi\fi\fi 1356} 1357\def\worddistinct{distinct} 1358\def\wordexample{example} 1359\def\wordcode{code} 1360 1361% Default is kbdinputdistinct. (Too much of a hassle to call the macro, 1362% the catcodes are wrong for parsearg to work.) 1363\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} 1364 1365\def\xkey{\key} 1366\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% 1367\ifx\one\xkey\ifx\threex\three \key{#2}% 1368\else{\tclose{\kbdfont\look}}\fi 1369\else{\tclose{\kbdfont\look}}\fi} 1370 1371% For @url, @env, @command quotes seem unnecessary, so use \code. 1372\let\url=\code 1373\let\env=\code 1374\let\command=\code 1375 1376% @uref (abbreviation for `urlref') takes an optional (comma-separated) 1377% second argument specifying the text to display and an optional third 1378% arg as text to display instead of (rather than in addition to) the url 1379% itself. First (mandatory) arg is the url. Perhaps eventually put in 1380% a hypertex \special here. 1381% 1382\def\uref#1{\douref #1,,,\finish} 1383\def\douref#1,#2,#3,#4\finish{\begingroup 1384 \unsepspaces 1385 \pdfurl{#1}% 1386 \setbox0 = \hbox{\ignorespaces #3}% 1387 \ifdim\wd0 > 0pt 1388 \unhbox0 % third arg given, show only that 1389 \else 1390 \setbox0 = \hbox{\ignorespaces #2}% 1391 \ifdim\wd0 > 0pt 1392 \ifpdf 1393 \unhbox0 % PDF: 2nd arg given, show only it 1394 \else 1395 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url 1396 \fi 1397 \else 1398 \code{#1}% only url given, so show it 1399 \fi 1400 \fi 1401 \endlink 1402\endgroup} 1403 1404% rms does not like angle brackets --karl, 17may97. 1405% So now @email is just like @uref, unless we are pdf. 1406% 1407%\def\email#1{\angleleft{\tt #1}\angleright} 1408\ifpdf 1409 \def\email#1{\doemail#1,,\finish} 1410 \def\doemail#1,#2,#3\finish{\begingroup 1411 \unsepspaces 1412 \pdfurl{mailto:#1}% 1413 \setbox0 = \hbox{\ignorespaces #2}% 1414 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi 1415 \endlink 1416 \endgroup} 1417\else 1418 \let\email=\uref 1419\fi 1420 1421% Check if we are currently using a typewriter font. Since all the 1422% Computer Modern typewriter fonts have zero interword stretch (and 1423% shrink), and it is reasonable to expect all typewriter fonts to have 1424% this property, we can check that font parameter. 1425% 1426\def\ifmonospace{\ifdim\fontdimen3\font=0pt } 1427 1428% Typeset a dimension, e.g., `in' or `pt'. The only reason for the 1429% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. 1430% 1431\def\dmn#1{\thinspace #1} 1432 1433\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} 1434 1435% @l was never documented to mean ``switch to the Lisp font'', 1436% and it is not used as such in any manual I can find. We need it for 1437% Polish suppressed-l. --karl, 22sep96. 1438%\def\l#1{{\li #1}\null} 1439 1440% Explicit font changes: @r, @sc, undocumented @ii. 1441\def\r#1{{\rm #1}} % roman font 1442\def\sc#1{{\smallcaps#1}} % smallcaps font 1443\def\ii#1{{\it #1}} % italic font 1444 1445% @acronym downcases the argument and prints in smallcaps. 1446\def\acronym#1{{\smallcaps \lowercase{#1}}} 1447 1448% @pounds{} is a sterling sign. 1449\def\pounds{{\it\$}} 1450 1451 1452\message{page headings,} 1453 1454\newskip\titlepagetopglue \titlepagetopglue = 1.5in 1455\newskip\titlepagebottomglue \titlepagebottomglue = 2pc 1456 1457% First the title page. Must do @settitle before @titlepage. 1458\newif\ifseenauthor 1459\newif\iffinishedtitlepage 1460 1461% Do an implicit @contents or @shortcontents after @end titlepage if the 1462% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. 1463% 1464\newif\ifsetcontentsaftertitlepage 1465 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue 1466\newif\ifsetshortcontentsaftertitlepage 1467 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue 1468 1469\def\shorttitlepage{\parsearg\shorttitlepagezzz} 1470\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% 1471 \endgroup\page\hbox{}\page} 1472 1473\def\titlepage{\begingroup \parindent=0pt \textfonts 1474 \let\subtitlerm=\tenrm 1475 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% 1476 % 1477 \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% 1478 % 1479 % Leave some space at the very top of the page. 1480 \vglue\titlepagetopglue 1481 % 1482 % Now you can print the title using @title. 1483 \def\title{\parsearg\titlezzz}% 1484 \def\titlezzz##1{\leftline{\titlefonts\rm ##1} 1485 % print a rule at the page bottom also. 1486 \finishedtitlepagefalse 1487 \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% 1488 % No rule at page bottom unless we print one at the top with @title. 1489 \finishedtitlepagetrue 1490 % 1491 % Now you can put text using @subtitle. 1492 \def\subtitle{\parsearg\subtitlezzz}% 1493 \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% 1494 % 1495 % @author should come last, but may come many times. 1496 \def\author{\parsearg\authorzzz}% 1497 \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi 1498 {\authorfont \leftline{##1}}}% 1499 % 1500 % Most title ``pages'' are actually two pages long, with space 1501 % at the top of the second. We don't want the ragged left on the second. 1502 \let\oldpage = \page 1503 \def\page{% 1504 \iffinishedtitlepage\else 1505 \finishtitlepage 1506 \fi 1507 \oldpage 1508 \let\page = \oldpage 1509 \hbox{}}% 1510% \def\page{\oldpage \hbox{}} 1511} 1512 1513\def\Etitlepage{% 1514 \iffinishedtitlepage\else 1515 \finishtitlepage 1516 \fi 1517 % It is important to do the page break before ending the group, 1518 % because the headline and footline are only empty inside the group. 1519 % If we use the new definition of \page, we always get a blank page 1520 % after the title page, which we certainly don't want. 1521 \oldpage 1522 \endgroup 1523 % 1524 % If they want short, they certainly want long too. 1525 \ifsetshortcontentsaftertitlepage 1526 \shortcontents 1527 \contents 1528 \global\let\shortcontents = \relax 1529 \global\let\contents = \relax 1530 \fi 1531 % 1532 \ifsetcontentsaftertitlepage 1533 \contents 1534 \global\let\contents = \relax 1535 \global\let\shortcontents = \relax 1536 \fi 1537 % 1538 \ifpdf \pdfmakepagedesttrue \fi 1539 % 1540 \HEADINGSon 1541} 1542 1543\def\finishtitlepage{% 1544 \vskip4pt \hrule height 2pt width \hsize 1545 \vskip\titlepagebottomglue 1546 \finishedtitlepagetrue 1547} 1548 1549%%% Set up page headings and footings. 1550 1551\let\thispage=\folio 1552 1553\newtoks\evenheadline % headline on even pages 1554\newtoks\oddheadline % headline on odd pages 1555\newtoks\evenfootline % footline on even pages 1556\newtoks\oddfootline % footline on odd pages 1557 1558% Now make Tex use those variables 1559\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline 1560 \else \the\evenheadline \fi}} 1561\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline 1562 \else \the\evenfootline \fi}\HEADINGShook} 1563\let\HEADINGShook=\relax 1564 1565% Commands to set those variables. 1566% For example, this is what @headings on does 1567% @evenheading @thistitle|@thispage|@thischapter 1568% @oddheading @thischapter|@thispage|@thistitle 1569% @evenfooting @thisfile|| 1570% @oddfooting ||@thisfile 1571 1572\def\evenheading{\parsearg\evenheadingxxx} 1573\def\oddheading{\parsearg\oddheadingxxx} 1574\def\everyheading{\parsearg\everyheadingxxx} 1575 1576\def\evenfooting{\parsearg\evenfootingxxx} 1577\def\oddfooting{\parsearg\oddfootingxxx} 1578\def\everyfooting{\parsearg\everyfootingxxx} 1579 1580{\catcode`\@=0 % 1581 1582\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} 1583\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% 1584\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 1585 1586\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} 1587\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% 1588\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 1589 1590\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% 1591 1592\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} 1593\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% 1594\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 1595 1596\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} 1597\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% 1598 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% 1599 % 1600 % Leave some space for the footline. Hopefully ok to assume 1601 % @evenfooting will not be used by itself. 1602 \global\advance\pageheight by -\baselineskip 1603 \global\advance\vsize by -\baselineskip 1604} 1605 1606\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} 1607% 1608}% unbind the catcode of @. 1609 1610% @headings double turns headings on for double-sided printing. 1611% @headings single turns headings on for single-sided printing. 1612% @headings off turns them off. 1613% @headings on same as @headings double, retained for compatibility. 1614% @headings after turns on double-sided headings after this page. 1615% @headings doubleafter turns on double-sided headings after this page. 1616% @headings singleafter turns on single-sided headings after this page. 1617% By default, they are off at the start of a document, 1618% and turned `on' after @end titlepage. 1619 1620\def\headings #1 {\csname HEADINGS#1\endcsname} 1621 1622\def\HEADINGSoff{ 1623\global\evenheadline={\hfil} \global\evenfootline={\hfil} 1624\global\oddheadline={\hfil} \global\oddfootline={\hfil}} 1625\HEADINGSoff 1626% When we turn headings on, set the page number to 1. 1627% For double-sided printing, put current file name in lower left corner, 1628% chapter name on inside top of right hand pages, document 1629% title on inside top of left hand pages, and page numbers on outside top 1630% edge of all pages. 1631\def\HEADINGSdouble{ 1632\global\pageno=1 1633\global\evenfootline={\hfil} 1634\global\oddfootline={\hfil} 1635\global\evenheadline={\line{\folio\hfil\thistitle}} 1636\global\oddheadline={\line{\thischapter\hfil\folio}} 1637\global\let\contentsalignmacro = \chapoddpage 1638} 1639\let\contentsalignmacro = \chappager 1640 1641% For single-sided printing, chapter title goes across top left of page, 1642% page number on top right. 1643\def\HEADINGSsingle{ 1644\global\pageno=1 1645\global\evenfootline={\hfil} 1646\global\oddfootline={\hfil} 1647\global\evenheadline={\line{\thischapter\hfil\folio}} 1648\global\oddheadline={\line{\thischapter\hfil\folio}} 1649\global\let\contentsalignmacro = \chappager 1650} 1651\def\HEADINGSon{\HEADINGSdouble} 1652 1653\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} 1654\let\HEADINGSdoubleafter=\HEADINGSafter 1655\def\HEADINGSdoublex{% 1656\global\evenfootline={\hfil} 1657\global\oddfootline={\hfil} 1658\global\evenheadline={\line{\folio\hfil\thistitle}} 1659\global\oddheadline={\line{\thischapter\hfil\folio}} 1660\global\let\contentsalignmacro = \chapoddpage 1661} 1662 1663\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} 1664\def\HEADINGSsinglex{% 1665\global\evenfootline={\hfil} 1666\global\oddfootline={\hfil} 1667\global\evenheadline={\line{\thischapter\hfil\folio}} 1668\global\oddheadline={\line{\thischapter\hfil\folio}} 1669\global\let\contentsalignmacro = \chappager 1670} 1671 1672% Subroutines used in generating headings 1673% Produces Day Month Year style of output. 1674\def\today{% 1675 \number\day\space 1676 \ifcase\month 1677 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr 1678 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug 1679 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec 1680 \fi 1681 \space\number\year} 1682 1683% @settitle line... specifies the title of the document, for headings. 1684% It generates no output of its own. 1685\def\thistitle{\putwordNoTitle} 1686\def\settitle{\parsearg\settitlezzz} 1687\def\settitlezzz #1{\gdef\thistitle{#1}} 1688 1689 1690\message{tables,} 1691% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). 1692 1693% default indentation of table text 1694\newdimen\tableindent \tableindent=.8in 1695% default indentation of @itemize and @enumerate text 1696\newdimen\itemindent \itemindent=.3in 1697% margin between end of table item and start of table text. 1698\newdimen\itemmargin \itemmargin=.1in 1699 1700% used internally for \itemindent minus \itemmargin 1701\newdimen\itemmax 1702 1703% Note @table, @vtable, and @vtable define @item, @itemx, etc., with 1704% these defs. 1705% They also define \itemindex 1706% to index the item name in whatever manner is desired (perhaps none). 1707 1708\newif\ifitemxneedsnegativevskip 1709 1710\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} 1711 1712\def\internalBitem{\smallbreak \parsearg\itemzzz} 1713\def\internalBitemx{\itemxpar \parsearg\itemzzz} 1714 1715\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} 1716\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} 1717 1718\def\internalBkitem{\smallbreak \parsearg\kitemzzz} 1719\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} 1720 1721\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% 1722 \itemzzz {#1}} 1723 1724\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% 1725 \itemzzz {#1}} 1726 1727\def\itemzzz #1{\begingroup % 1728 \advance\hsize by -\rightskip 1729 \advance\hsize by -\tableindent 1730 \setbox0=\hbox{\itemfont{#1}}% 1731 \itemindex{#1}% 1732 \nobreak % This prevents a break before @itemx. 1733 % 1734 % If the item text does not fit in the space we have, put it on a line 1735 % by itself, and do not allow a page break either before or after that 1736 % line. We do not start a paragraph here because then if the next 1737 % command is, e.g., @kindex, the whatsit would get put into the 1738 % horizontal list on a line by itself, resulting in extra blank space. 1739 \ifdim \wd0>\itemmax 1740 % 1741 % Make this a paragraph so we get the \parskip glue and wrapping, 1742 % but leave it ragged-right. 1743 \begingroup 1744 \advance\leftskip by-\tableindent 1745 \advance\hsize by\tableindent 1746 \advance\rightskip by0pt plus1fil 1747 \leavevmode\unhbox0\par 1748 \endgroup 1749 % 1750 % We're going to be starting a paragraph, but we don't want the 1751 % \parskip glue -- logically it's part of the @item we just started. 1752 \nobreak \vskip-\parskip 1753 % 1754 % Stop a page break at the \parskip glue coming up. Unfortunately 1755 % we can't prevent a possible page break at the following 1756 % \baselineskip glue. 1757 \nobreak 1758 \endgroup 1759 \itemxneedsnegativevskipfalse 1760 \else 1761 % The item text fits into the space. Start a paragraph, so that the 1762 % following text (if any) will end up on the same line. 1763 \noindent 1764 % Do this with kerns and \unhbox so that if there is a footnote in 1765 % the item text, it can migrate to the main vertical list and 1766 % eventually be printed. 1767 \nobreak\kern-\tableindent 1768 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 1769 \unhbox0 1770 \nobreak\kern\dimen0 1771 \endgroup 1772 \itemxneedsnegativevskiptrue 1773 \fi 1774} 1775 1776\def\item{\errmessage{@item while not in a table}} 1777\def\itemx{\errmessage{@itemx while not in a table}} 1778\def\kitem{\errmessage{@kitem while not in a table}} 1779\def\kitemx{\errmessage{@kitemx while not in a table}} 1780\def\xitem{\errmessage{@xitem while not in a table}} 1781\def\xitemx{\errmessage{@xitemx while not in a table}} 1782 1783% Contains a kludge to get @end[description] to work. 1784\def\description{\tablez{\dontindex}{1}{}{}{}{}} 1785 1786% @table, @ftable, @vtable. 1787\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} 1788{\obeylines\obeyspaces% 1789\gdef\tablex #1^^M{% 1790\tabley\dontindex#1 \endtabley}} 1791 1792\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} 1793{\obeylines\obeyspaces% 1794\gdef\ftablex #1^^M{% 1795\tabley\fnitemindex#1 \endtabley 1796\def\Eftable{\endgraf\afterenvbreak\endgroup}% 1797\let\Etable=\relax}} 1798 1799\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} 1800{\obeylines\obeyspaces% 1801\gdef\vtablex #1^^M{% 1802\tabley\vritemindex#1 \endtabley 1803\def\Evtable{\endgraf\afterenvbreak\endgroup}% 1804\let\Etable=\relax}} 1805 1806\def\dontindex #1{} 1807\def\fnitemindex #1{\doind {fn}{\code{#1}}}% 1808\def\vritemindex #1{\doind {vr}{\code{#1}}}% 1809 1810{\obeyspaces % 1811\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% 1812\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} 1813 1814\def\tablez #1#2#3#4#5#6{% 1815\aboveenvbreak % 1816\begingroup % 1817\def\Edescription{\Etable}% Necessary kludge. 1818\let\itemindex=#1% 1819\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % 1820\ifnum 0#4>0 \tableindent=#4\mil \fi % 1821\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % 1822\def\itemfont{#2}% 1823\itemmax=\tableindent % 1824\advance \itemmax by -\itemmargin % 1825\advance \leftskip by \tableindent % 1826\exdentamount=\tableindent 1827\parindent = 0pt 1828\parskip = \smallskipamount 1829\ifdim \parskip=0pt \parskip=2pt \fi% 1830\def\Etable{\endgraf\afterenvbreak\endgroup}% 1831\let\item = \internalBitem % 1832\let\itemx = \internalBitemx % 1833\let\kitem = \internalBkitem % 1834\let\kitemx = \internalBkitemx % 1835\let\xitem = \internalBxitem % 1836\let\xitemx = \internalBxitemx % 1837} 1838 1839% This is the counter used by @enumerate, which is really @itemize 1840 1841\newcount \itemno 1842 1843\def\itemize{\parsearg\itemizezzz} 1844 1845\def\itemizezzz #1{% 1846 \begingroup % ended by the @end itemize 1847 \itemizey {#1}{\Eitemize} 1848} 1849 1850\def\itemizey #1#2{% 1851\aboveenvbreak % 1852\itemmax=\itemindent % 1853\advance \itemmax by -\itemmargin % 1854\advance \leftskip by \itemindent % 1855\exdentamount=\itemindent 1856\parindent = 0pt % 1857\parskip = \smallskipamount % 1858\ifdim \parskip=0pt \parskip=2pt \fi% 1859\def#2{\endgraf\afterenvbreak\endgroup}% 1860\def\itemcontents{#1}% 1861\let\item=\itemizeitem} 1862 1863% Set sfcode to normal for the chars that usually have another value. 1864% These are `.?!:;,' 1865\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 1866 \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } 1867 1868% \splitoff TOKENS\endmark defines \first to be the first token in 1869% TOKENS, and \rest to be the remainder. 1870% 1871\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% 1872 1873% Allow an optional argument of an uppercase letter, lowercase letter, 1874% or number, to specify the first label in the enumerated list. No 1875% argument is the same as `1'. 1876% 1877\def\enumerate{\parsearg\enumeratezzz} 1878\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} 1879\def\enumeratey #1 #2\endenumeratey{% 1880 \begingroup % ended by the @end enumerate 1881 % 1882 % If we were given no argument, pretend we were given `1'. 1883 \def\thearg{#1}% 1884 \ifx\thearg\empty \def\thearg{1}\fi 1885 % 1886 % Detect if the argument is a single token. If so, it might be a 1887 % letter. Otherwise, the only valid thing it can be is a number. 1888 % (We will always have one token, because of the test we just made. 1889 % This is a good thing, since \splitoff doesn't work given nothing at 1890 % all -- the first parameter is undelimited.) 1891 \expandafter\splitoff\thearg\endmark 1892 \ifx\rest\empty 1893 % Only one token in the argument. It could still be anything. 1894 % A ``lowercase letter'' is one whose \lccode is nonzero. 1895 % An ``uppercase letter'' is one whose \lccode is both nonzero, and 1896 % not equal to itself. 1897 % Otherwise, we assume it's a number. 1898 % 1899 % We need the \relax at the end of the \ifnum lines to stop TeX from 1900 % continuing to look for a <number>. 1901 % 1902 \ifnum\lccode\expandafter`\thearg=0\relax 1903 \numericenumerate % a number (we hope) 1904 \else 1905 % It's a letter. 1906 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax 1907 \lowercaseenumerate % lowercase letter 1908 \else 1909 \uppercaseenumerate % uppercase letter 1910 \fi 1911 \fi 1912 \else 1913 % Multiple tokens in the argument. We hope it's a number. 1914 \numericenumerate 1915 \fi 1916} 1917 1918% An @enumerate whose labels are integers. The starting integer is 1919% given in \thearg. 1920% 1921\def\numericenumerate{% 1922 \itemno = \thearg 1923 \startenumeration{\the\itemno}% 1924} 1925 1926% The starting (lowercase) letter is in \thearg. 1927\def\lowercaseenumerate{% 1928 \itemno = \expandafter`\thearg 1929 \startenumeration{% 1930 % Be sure we're not beyond the end of the alphabet. 1931 \ifnum\itemno=0 1932 \errmessage{No more lowercase letters in @enumerate; get a bigger 1933 alphabet}% 1934 \fi 1935 \char\lccode\itemno 1936 }% 1937} 1938 1939% The starting (uppercase) letter is in \thearg. 1940\def\uppercaseenumerate{% 1941 \itemno = \expandafter`\thearg 1942 \startenumeration{% 1943 % Be sure we're not beyond the end of the alphabet. 1944 \ifnum\itemno=0 1945 \errmessage{No more uppercase letters in @enumerate; get a bigger 1946 alphabet} 1947 \fi 1948 \char\uccode\itemno 1949 }% 1950} 1951 1952% Call itemizey, adding a period to the first argument and supplying the 1953% common last two arguments. Also subtract one from the initial value in 1954% \itemno, since @item increments \itemno. 1955% 1956\def\startenumeration#1{% 1957 \advance\itemno by -1 1958 \itemizey{#1.}\Eenumerate\flushcr 1959} 1960 1961% @alphaenumerate and @capsenumerate are abbreviations for giving an arg 1962% to @enumerate. 1963% 1964\def\alphaenumerate{\enumerate{a}} 1965\def\capsenumerate{\enumerate{A}} 1966\def\Ealphaenumerate{\Eenumerate} 1967\def\Ecapsenumerate{\Eenumerate} 1968 1969% Definition of @item while inside @itemize. 1970 1971\def\itemizeitem{% 1972\advance\itemno by 1 1973{\let\par=\endgraf \smallbreak}% 1974\ifhmode \errmessage{In hmode at itemizeitem}\fi 1975{\parskip=0in \hskip 0pt 1976\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% 1977\vadjust{\penalty 1200}}% 1978\flushcr} 1979 1980% @multitable macros 1981% Amy Hendrickson, 8/18/94, 3/6/96 1982% 1983% @multitable ... @end multitable will make as many columns as desired. 1984% Contents of each column will wrap at width given in preamble. Width 1985% can be specified either with sample text given in a template line, 1986% or in percent of \hsize, the current width of text on page. 1987 1988% Table can continue over pages but will only break between lines. 1989 1990% To make preamble: 1991% 1992% Either define widths of columns in terms of percent of \hsize: 1993% @multitable @columnfractions .25 .3 .45 1994% @item ... 1995% 1996% Numbers following @columnfractions are the percent of the total 1997% current hsize to be used for each column. You may use as many 1998% columns as desired. 1999 2000 2001% Or use a template: 2002% @multitable {Column 1 template} {Column 2 template} {Column 3 template} 2003% @item ... 2004% using the widest term desired in each column. 2005% 2006% For those who want to use more than one line's worth of words in 2007% the preamble, break the line within one argument and it 2008% will parse correctly, i.e., 2009% 2010% @multitable {Column 1 template} {Column 2 template} {Column 3 2011% template} 2012% Not: 2013% @multitable {Column 1 template} {Column 2 template} 2014% {Column 3 template} 2015 2016% Each new table line starts with @item, each subsequent new column 2017% starts with @tab. Empty columns may be produced by supplying @tab's 2018% with nothing between them for as many times as empty columns are needed, 2019% ie, @tab@tab@tab will produce two empty columns. 2020 2021% @item, @tab, @multitable or @end multitable do not need to be on their 2022% own lines, but it will not hurt if they are. 2023 2024% Sample multitable: 2025 2026% @multitable {Column 1 template} {Column 2 template} {Column 3 template} 2027% @item first col stuff @tab second col stuff @tab third col 2028% @item 2029% first col stuff 2030% @tab 2031% second col stuff 2032% @tab 2033% third col 2034% @item first col stuff @tab second col stuff 2035% @tab Many paragraphs of text may be used in any column. 2036% 2037% They will wrap at the width determined by the template. 2038% @item@tab@tab This will be in third column. 2039% @end multitable 2040 2041% Default dimensions may be reset by user. 2042% @multitableparskip is vertical space between paragraphs in table. 2043% @multitableparindent is paragraph indent in table. 2044% @multitablecolmargin is horizontal space to be left between columns. 2045% @multitablelinespace is space to leave between table items, baseline 2046% to baseline. 2047% 0pt means it depends on current normal line spacing. 2048% 2049\newskip\multitableparskip 2050\newskip\multitableparindent 2051\newdimen\multitablecolspace 2052\newskip\multitablelinespace 2053\multitableparskip=0pt 2054\multitableparindent=6pt 2055\multitablecolspace=12pt 2056\multitablelinespace=0pt 2057 2058% Macros used to set up halign preamble: 2059% 2060\let\endsetuptable\relax 2061\def\xendsetuptable{\endsetuptable} 2062\let\columnfractions\relax 2063\def\xcolumnfractions{\columnfractions} 2064\newif\ifsetpercent 2065 2066% #1 is the part of the @columnfraction before the decimal point, which 2067% is presumably either 0 or the empty string (but we don't check, we 2068% just throw it away). #2 is the decimal part, which we use as the 2069% percent of \hsize for this column. 2070\def\pickupwholefraction#1.#2 {% 2071 \global\advance\colcount by 1 2072 \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% 2073 \setuptable 2074} 2075 2076\newcount\colcount 2077\def\setuptable#1{% 2078 \def\firstarg{#1}% 2079 \ifx\firstarg\xendsetuptable 2080 \let\go = \relax 2081 \else 2082 \ifx\firstarg\xcolumnfractions 2083 \global\setpercenttrue 2084 \else 2085 \ifsetpercent 2086 \let\go\pickupwholefraction 2087 \else 2088 \global\advance\colcount by 1 2089 \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; 2090 % typically that is always in the input, anyway. 2091 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% 2092 \fi 2093 \fi 2094 \ifx\go\pickupwholefraction 2095 % Put the argument back for the \pickupwholefraction call, so 2096 % we'll always have a period there to be parsed. 2097 \def\go{\pickupwholefraction#1}% 2098 \else 2099 \let\go = \setuptable 2100 \fi% 2101 \fi 2102 \go 2103} 2104 2105% This used to have \hskip1sp. But then the space in a template line is 2106% not enough. That is bad. So let's go back to just & until we 2107% encounter the problem it was intended to solve again. 2108% --karl, nathan@acm.org, 20apr99. 2109\def\tab{&} 2110 2111% @multitable ... @end multitable definitions: 2112% 2113\def\multitable{\parsearg\dotable} 2114\def\dotable#1{\bgroup 2115 \vskip\parskip 2116 \let\item\crcr 2117 \tolerance=9500 2118 \hbadness=9500 2119 \setmultitablespacing 2120 \parskip=\multitableparskip 2121 \parindent=\multitableparindent 2122 \overfullrule=0pt 2123 \global\colcount=0 2124 \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% 2125 % 2126 % To parse everything between @multitable and @item: 2127 \setuptable#1 \endsetuptable 2128 % 2129 % \everycr will reset column counter, \colcount, at the end of 2130 % each line. Every column entry will cause \colcount to advance by one. 2131 % The table preamble 2132 % looks at the current \colcount to find the correct column width. 2133 \everycr{\noalign{% 2134 % 2135 % \filbreak%% keeps underfull box messages off when table breaks over pages. 2136 % Maybe so, but it also creates really weird page breaks when the table 2137 % breaks over pages. Wouldn't \vfil be better? Wait until the problem 2138 % manifests itself, so it can be fixed for real --karl. 2139 \global\colcount=0\relax}}% 2140 % 2141 % This preamble sets up a generic column definition, which will 2142 % be used as many times as user calls for columns. 2143 % \vtop will set a single line and will also let text wrap and 2144 % continue for many paragraphs if desired. 2145 \halign\bgroup&\global\advance\colcount by 1\relax 2146 \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname 2147 % 2148 % In order to keep entries from bumping into each other 2149 % we will add a \leftskip of \multitablecolspace to all columns after 2150 % the first one. 2151 % 2152 % If a template has been used, we will add \multitablecolspace 2153 % to the width of each template entry. 2154 % 2155 % If the user has set preamble in terms of percent of \hsize we will 2156 % use that dimension as the width of the column, and the \leftskip 2157 % will keep entries from bumping into each other. Table will start at 2158 % left margin and final column will justify at right margin. 2159 % 2160 % Make sure we don't inherit \rightskip from the outer environment. 2161 \rightskip=0pt 2162 \ifnum\colcount=1 2163 % The first column will be indented with the surrounding text. 2164 \advance\hsize by\leftskip 2165 \else 2166 \ifsetpercent \else 2167 % If user has not set preamble in terms of percent of \hsize 2168 % we will advance \hsize by \multitablecolspace. 2169 \advance\hsize by \multitablecolspace 2170 \fi 2171 % In either case we will make \leftskip=\multitablecolspace: 2172 \leftskip=\multitablecolspace 2173 \fi 2174 % Ignoring space at the beginning and end avoids an occasional spurious 2175 % blank line, when TeX decides to break the line at the space before the 2176 % box from the multistrut, so the strut ends up on a line by itself. 2177 % For example: 2178 % @multitable @columnfractions .11 .89 2179 % @item @code{#} 2180 % @tab Legal holiday which is valid in major parts of the whole country. 2181 % Is automatically provided with highlighting sequences respectively marking 2182 % characters. 2183 \noindent\ignorespaces##\unskip\multistrut}\cr 2184} 2185 2186\def\setmultitablespacing{% test to see if user has set \multitablelinespace. 2187% If so, do nothing. If not, give it an appropriate dimension based on 2188% current baselineskip. 2189\ifdim\multitablelinespace=0pt 2190\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip 2191\global\advance\multitablelinespace by-\ht0 2192%% strut to put in table in case some entry doesn't have descenders, 2193%% to keep lines equally spaced 2194\let\multistrut = \strut 2195\else 2196%% FIXME: what is \box0 supposed to be? 2197\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 2198width0pt\relax} \fi 2199%% Test to see if parskip is larger than space between lines of 2200%% table. If not, do nothing. 2201%% If so, set to same dimension as multitablelinespace. 2202\ifdim\multitableparskip>\multitablelinespace 2203\global\multitableparskip=\multitablelinespace 2204\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 2205 %% than skip between lines in the table. 2206\fi% 2207\ifdim\multitableparskip=0pt 2208\global\multitableparskip=\multitablelinespace 2209\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 2210 %% than skip between lines in the table. 2211\fi} 2212 2213 2214\message{conditionals,} 2215% Prevent errors for section commands. 2216% Used in @ignore and in failing conditionals. 2217\def\ignoresections{% 2218 \let\chapter=\relax 2219 \let\unnumbered=\relax 2220 \let\top=\relax 2221 \let\unnumberedsec=\relax 2222 \let\unnumberedsection=\relax 2223 \let\unnumberedsubsec=\relax 2224 \let\unnumberedsubsection=\relax 2225 \let\unnumberedsubsubsec=\relax 2226 \let\unnumberedsubsubsection=\relax 2227 \let\section=\relax 2228 \let\subsec=\relax 2229 \let\subsubsec=\relax 2230 \let\subsection=\relax 2231 \let\subsubsection=\relax 2232 \let\appendix=\relax 2233 \let\appendixsec=\relax 2234 \let\appendixsection=\relax 2235 \let\appendixsubsec=\relax 2236 \let\appendixsubsection=\relax 2237 \let\appendixsubsubsec=\relax 2238 \let\appendixsubsubsection=\relax 2239 \let\contents=\relax 2240 \let\smallbook=\relax 2241 \let\titlepage=\relax 2242} 2243 2244% Used in nested conditionals, where we have to parse the Texinfo source 2245% and so want to turn off most commands, in case they are used 2246% incorrectly. 2247% 2248\def\ignoremorecommands{% 2249 \let\defcodeindex = \relax 2250 \let\defcv = \relax 2251 \let\deffn = \relax 2252 \let\deffnx = \relax 2253 \let\defindex = \relax 2254 \let\defivar = \relax 2255 \let\defmac = \relax 2256 \let\defmethod = \relax 2257 \let\defop = \relax 2258 \let\defopt = \relax 2259 \let\defspec = \relax 2260 \let\deftp = \relax 2261 \let\deftypefn = \relax 2262 \let\deftypefun = \relax 2263 \let\deftypeivar = \relax 2264 \let\deftypeop = \relax 2265 \let\deftypevar = \relax 2266 \let\deftypevr = \relax 2267 \let\defun = \relax 2268 \let\defvar = \relax 2269 \let\defvr = \relax 2270 \let\ref = \relax 2271 \let\xref = \relax 2272 \let\printindex = \relax 2273 \let\pxref = \relax 2274 \let\settitle = \relax 2275 \let\setchapternewpage = \relax 2276 \let\setchapterstyle = \relax 2277 \let\everyheading = \relax 2278 \let\evenheading = \relax 2279 \let\oddheading = \relax 2280 \let\everyfooting = \relax 2281 \let\evenfooting = \relax 2282 \let\oddfooting = \relax 2283 \let\headings = \relax 2284 \let\include = \relax 2285 \let\lowersections = \relax 2286 \let\down = \relax 2287 \let\raisesections = \relax 2288 \let\up = \relax 2289 \let\set = \relax 2290 \let\clear = \relax 2291 \let\item = \relax 2292} 2293 2294% Ignore @ignore ... @end ignore. 2295% 2296\def\ignore{\doignore{ignore}} 2297 2298% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. 2299% 2300\def\ifinfo{\doignore{ifinfo}} 2301\def\ifhtml{\doignore{ifhtml}} 2302\def\ifnottex{\doignore{ifnottex}} 2303\def\html{\doignore{html}} 2304\def\menu{\doignore{menu}} 2305\def\direntry{\doignore{direntry}} 2306 2307% @dircategory CATEGORY -- specify a category of the dir file 2308% which this file should belong to. Ignore this in TeX. 2309\let\dircategory = \comment 2310 2311% Ignore text until a line `@end #1'. 2312% 2313\def\doignore#1{\begingroup 2314 % Don't complain about control sequences we have declared \outer. 2315 \ignoresections 2316 % 2317 % Define a command to swallow text until we reach `@end #1'. 2318 % This @ is a catcode 12 token (that is the normal catcode of @ in 2319 % this texinfo.tex file). We change the catcode of @ below to match. 2320 \long\def\doignoretext##1@end #1{\enddoignore}% 2321 % 2322 % Make sure that spaces turn into tokens that match what \doignoretext wants. 2323 \catcode32 = 10 2324 % 2325 % Ignore braces, too, so mismatched braces don't cause trouble. 2326 \catcode`\{ = 9 2327 \catcode`\} = 9 2328 % 2329 % We must not have @c interpreted as a control sequence. 2330 \catcode`\@ = 12 2331 % 2332 % Make the letter c a comment character so that the rest of the line 2333 % will be ignored. This way, the document can have (for example) 2334 % @c @end ifinfo 2335 % and the @end ifinfo will be properly ignored. 2336 % (We've just changed @ to catcode 12.) 2337 \catcode`\c = 14 2338 % 2339 % And now expand that command. 2340 \doignoretext 2341} 2342 2343% What we do to finish off ignored text. 2344% 2345\def\enddoignore{\endgroup\ignorespaces}% 2346 2347\newif\ifwarnedobs\warnedobsfalse 2348\def\obstexwarn{% 2349 \ifwarnedobs\relax\else 2350 % We need to warn folks that they may have trouble with TeX 3.0. 2351 % This uses \immediate\write16 rather than \message to get newlines. 2352 \immediate\write16{} 2353 \immediate\write16{WARNING: for users of Unix TeX 3.0!} 2354 \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} 2355 \immediate\write16{If you are running another version of TeX, relax.} 2356 \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} 2357 \immediate\write16{ Then upgrade your TeX installation if you can.} 2358 \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} 2359 \immediate\write16{If you are stuck with version 3.0, run the} 2360 \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} 2361 \immediate\write16{ to use a workaround.} 2362 \immediate\write16{} 2363 \global\warnedobstrue 2364 \fi 2365} 2366 2367% **In TeX 3.0, setting text in \nullfont hangs tex. For a 2368% workaround (which requires the file ``dummy.tfm'' to be installed), 2369% uncomment the following line: 2370%%%%%\font\nullfont=dummy\let\obstexwarn=\relax 2371 2372% Ignore text, except that we keep track of conditional commands for 2373% purposes of nesting, up to an `@end #1' command. 2374% 2375\def\nestedignore#1{% 2376 \obstexwarn 2377 % We must actually expand the ignored text to look for the @end 2378 % command, so that nested ignore constructs work. Thus, we put the 2379 % text into a \vbox and then do nothing with the result. To minimize 2380 % the change of memory overflow, we follow the approach outlined on 2381 % page 401 of the TeXbook: make the current font be a dummy font. 2382 % 2383 \setbox0 = \vbox\bgroup 2384 % Don't complain about control sequences we have declared \outer. 2385 \ignoresections 2386 % 2387 % Define `@end #1' to end the box, which will in turn undefine the 2388 % @end command again. 2389 \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% 2390 % 2391 % We are going to be parsing Texinfo commands. Most cause no 2392 % trouble when they are used incorrectly, but some commands do 2393 % complicated argument parsing or otherwise get confused, so we 2394 % undefine them. 2395 % 2396 % We can't do anything about stray @-signs, unfortunately; 2397 % they'll produce `undefined control sequence' errors. 2398 \ignoremorecommands 2399 % 2400 % Set the current font to be \nullfont, a TeX primitive, and define 2401 % all the font commands to also use \nullfont. We don't use 2402 % dummy.tfm, as suggested in the TeXbook, because not all sites 2403 % might have that installed. Therefore, math mode will still 2404 % produce output, but that should be an extremely small amount of 2405 % stuff compared to the main input. 2406 % 2407 \nullfont 2408 \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont 2409 \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont 2410 \let\tensf=\nullfont 2411 % Similarly for index fonts (mostly for their use in smallexample). 2412 \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont 2413 \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont 2414 \let\smallsf=\nullfont 2415 % 2416 % Don't complain when characters are missing from the fonts. 2417 \tracinglostchars = 0 2418 % 2419 % Don't bother to do space factor calculations. 2420 \frenchspacing 2421 % 2422 % Don't report underfull hboxes. 2423 \hbadness = 10000 2424 % 2425 % Do minimal line-breaking. 2426 \pretolerance = 10000 2427 % 2428 % Do not execute instructions in @tex 2429 \def\tex{\doignore{tex}}% 2430 % Do not execute macro definitions. 2431 % `c' is a comment character, so the word `macro' will get cut off. 2432 \def\macro{\doignore{ma}}% 2433} 2434 2435% @set VAR sets the variable VAR to an empty value. 2436% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. 2437% 2438% Since we want to separate VAR from REST-OF-LINE (which might be 2439% empty), we can't just use \parsearg; we have to insert a space of our 2440% own to delimit the rest of the line, and then take it out again if we 2441% didn't need it. Make sure the catcode of space is correct to avoid 2442% losing inside @example, for instance. 2443% 2444\def\set{\begingroup\catcode` =10 2445 \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. 2446 \parsearg\setxxx} 2447\def\setxxx#1{\setyyy#1 \endsetyyy} 2448\def\setyyy#1 #2\endsetyyy{% 2449 \def\temp{#2}% 2450 \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty 2451 \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. 2452 \fi 2453 \endgroup 2454} 2455% Can't use \xdef to pre-expand #2 and save some time, since \temp or 2456% \next or other control sequences that we've defined might get us into 2457% an infinite loop. Consider `@set foo @cite{bar}'. 2458\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} 2459 2460% @clear VAR clears (i.e., unsets) the variable VAR. 2461% 2462\def\clear{\parsearg\clearxxx} 2463\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} 2464 2465% @value{foo} gets the text saved in variable foo. 2466{ 2467 \catcode`\_ = \active 2468 % 2469 % We might end up with active _ or - characters in the argument if 2470 % we're called from @code, as @code{@value{foo-bar_}}. So \let any 2471 % such active characters to their normal equivalents. 2472 \gdef\value{\begingroup 2473 \catcode`\-=12 \catcode`\_=12 2474 \indexbreaks \let_\normalunderscore 2475 \valuexxx} 2476} 2477\def\valuexxx#1{\expandablevalue{#1}\endgroup} 2478 2479% We have this subroutine so that we can handle at least some @value's 2480% properly in indexes (we \let\value to this in \indexdummies). Ones 2481% whose names contain - or _ still won't work, but we can't do anything 2482% about that. The command has to be fully expandable, since the result 2483% winds up in the index file. This means that if the variable's value 2484% contains other Texinfo commands, it's almost certain it will fail 2485% (although perhaps we could fix that with sufficient work to do a 2486% one-level expansion on the result, instead of complete). 2487% 2488\def\expandablevalue#1{% 2489 \expandafter\ifx\csname SET#1\endcsname\relax 2490 {[No value for ``#1'']}% 2491 \else 2492 \csname SET#1\endcsname 2493 \fi 2494} 2495 2496% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined 2497% with @set. 2498% 2499\def\ifset{\parsearg\ifsetxxx} 2500\def\ifsetxxx #1{% 2501 \expandafter\ifx\csname SET#1\endcsname\relax 2502 \expandafter\ifsetfail 2503 \else 2504 \expandafter\ifsetsucceed 2505 \fi 2506} 2507\def\ifsetsucceed{\conditionalsucceed{ifset}} 2508\def\ifsetfail{\nestedignore{ifset}} 2509\defineunmatchedend{ifset} 2510 2511% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been 2512% defined with @set, or has been undefined with @clear. 2513% 2514\def\ifclear{\parsearg\ifclearxxx} 2515\def\ifclearxxx #1{% 2516 \expandafter\ifx\csname SET#1\endcsname\relax 2517 \expandafter\ifclearsucceed 2518 \else 2519 \expandafter\ifclearfail 2520 \fi 2521} 2522\def\ifclearsucceed{\conditionalsucceed{ifclear}} 2523\def\ifclearfail{\nestedignore{ifclear}} 2524\defineunmatchedend{ifclear} 2525 2526% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text 2527% following, through the first @end iftex (etc.). Make `@end iftex' 2528% (etc.) valid only after an @iftex. 2529% 2530\def\iftex{\conditionalsucceed{iftex}} 2531\def\ifnothtml{\conditionalsucceed{ifnothtml}} 2532\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} 2533\defineunmatchedend{iftex} 2534\defineunmatchedend{ifnothtml} 2535\defineunmatchedend{ifnotinfo} 2536 2537% We can't just want to start a group at @iftex (for example) and end it 2538% at @end iftex, since then @set commands inside the conditional have no 2539% effect (they'd get reverted at the end of the group). So we must 2540% define \Eiftex to redefine itself to be its previous value. (We can't 2541% just define it to fail again with an ``unmatched end'' error, since 2542% the @ifset might be nested.) 2543% 2544\def\conditionalsucceed#1{% 2545 \edef\temp{% 2546 % Remember the current value of \E#1. 2547 \let\nece{prevE#1} = \nece{E#1}% 2548 % 2549 % At the `@end #1', redefine \E#1 to be its previous value. 2550 \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% 2551 }% 2552 \temp 2553} 2554 2555% We need to expand lots of \csname's, but we don't want to expand the 2556% control sequences after we've constructed them. 2557% 2558\def\nece#1{\expandafter\noexpand\csname#1\endcsname} 2559 2560% @defininfoenclose. 2561\let\definfoenclose=\comment 2562 2563 2564\message{indexing,} 2565% Index generation facilities 2566 2567% Define \newwrite to be identical to plain tex's \newwrite 2568% except not \outer, so it can be used within \newindex. 2569{\catcode`\@=11 2570\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} 2571 2572% \newindex {foo} defines an index named foo. 2573% It automatically defines \fooindex such that 2574% \fooindex ...rest of line... puts an entry in the index foo. 2575% It also defines \fooindfile to be the number of the output channel for 2576% the file that accumulates this index. The file's extension is foo. 2577% The name of an index should be no more than 2 characters long 2578% for the sake of vms. 2579% 2580\def\newindex#1{% 2581 \iflinks 2582 \expandafter\newwrite \csname#1indfile\endcsname 2583 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file 2584 \fi 2585 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index 2586 \noexpand\doindex{#1}} 2587} 2588 2589% @defindex foo == \newindex{foo} 2590 2591\def\defindex{\parsearg\newindex} 2592 2593% Define @defcodeindex, like @defindex except put all entries in @code. 2594 2595\def\newcodeindex#1{% 2596 \iflinks 2597 \expandafter\newwrite \csname#1indfile\endcsname 2598 \openout \csname#1indfile\endcsname \jobname.#1 2599 \fi 2600 \expandafter\xdef\csname#1index\endcsname{% 2601 \noexpand\docodeindex{#1}} 2602} 2603 2604\def\defcodeindex{\parsearg\newcodeindex} 2605 2606% @synindex foo bar makes index foo feed into index bar. 2607% Do this instead of @defindex foo if you don't want it as a separate index. 2608% The \closeout helps reduce unnecessary open files; the limit on the 2609% Acorn RISC OS is a mere 16 files. 2610\def\synindex#1 #2 {% 2611 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname 2612 \expandafter\closeout\csname#1indfile\endcsname 2613 \expandafter\let\csname#1indfile\endcsname=\synindexfoo 2614 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex 2615 \noexpand\doindex{#2}}% 2616} 2617 2618% @syncodeindex foo bar similar, but put all entries made for index foo 2619% inside @code. 2620\def\syncodeindex#1 #2 {% 2621 \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname 2622 \expandafter\closeout\csname#1indfile\endcsname 2623 \expandafter\let\csname#1indfile\endcsname=\synindexfoo 2624 \expandafter\xdef\csname#1index\endcsname{% define \xxxindex 2625 \noexpand\docodeindex{#2}}% 2626} 2627 2628% Define \doindex, the driver for all \fooindex macros. 2629% Argument #1 is generated by the calling \fooindex macro, 2630% and it is "foo", the name of the index. 2631 2632% \doindex just uses \parsearg; it calls \doind for the actual work. 2633% This is because \doind is more useful to call from other macros. 2634 2635% There is also \dosubind {index}{topic}{subtopic} 2636% which makes an entry in a two-level index such as the operation index. 2637 2638\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} 2639\def\singleindexer #1{\doind{\indexname}{#1}} 2640 2641% like the previous two, but they put @code around the argument. 2642\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} 2643\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} 2644 2645\def\indexdummies{% 2646\def\ { }% 2647% Take care of the plain tex accent commands. 2648\def\"{\realbackslash "}% 2649\def\`{\realbackslash `}% 2650\def\'{\realbackslash '}% 2651\def\^{\realbackslash ^}% 2652\def\~{\realbackslash ~}% 2653\def\={\realbackslash =}% 2654\def\b{\realbackslash b}% 2655\def\c{\realbackslash c}% 2656\def\d{\realbackslash d}% 2657\def\u{\realbackslash u}% 2658\def\v{\realbackslash v}% 2659\def\H{\realbackslash H}% 2660% Take care of the plain tex special European modified letters. 2661\def\oe{\realbackslash oe}% 2662\def\ae{\realbackslash ae}% 2663\def\aa{\realbackslash aa}% 2664\def\OE{\realbackslash OE}% 2665\def\AE{\realbackslash AE}% 2666\def\AA{\realbackslash AA}% 2667\def\o{\realbackslash o}% 2668\def\O{\realbackslash O}% 2669\def\l{\realbackslash l}% 2670\def\L{\realbackslash L}% 2671\def\ss{\realbackslash ss}% 2672% Take care of texinfo commands likely to appear in an index entry. 2673% (Must be a way to avoid doing expansion at all, and thus not have to 2674% laboriously list every single command here.) 2675\def\@{@}% will be @@ when we switch to @ as escape char. 2676% Need these in case \tex is in effect and \{ is a \delimiter again. 2677% But can't use \lbracecmd and \rbracecmd because texindex assumes 2678% braces and backslashes are used only as delimiters. 2679\let\{ = \mylbrace 2680\let\} = \myrbrace 2681\def\_{{\realbackslash _}}% 2682\def\w{\realbackslash w }% 2683\def\bf{\realbackslash bf }% 2684%\def\rm{\realbackslash rm }% 2685\def\sl{\realbackslash sl }% 2686\def\sf{\realbackslash sf}% 2687\def\tt{\realbackslash tt}% 2688\def\gtr{\realbackslash gtr}% 2689\def\less{\realbackslash less}% 2690\def\hat{\realbackslash hat}% 2691\def\TeX{\realbackslash TeX}% 2692\def\dots{\realbackslash dots }% 2693\def\result{\realbackslash result}% 2694\def\equiv{\realbackslash equiv}% 2695\def\expansion{\realbackslash expansion}% 2696\def\print{\realbackslash print}% 2697\def\error{\realbackslash error}% 2698\def\point{\realbackslash point}% 2699\def\copyright{\realbackslash copyright}% 2700\def\tclose##1{\realbackslash tclose {##1}}% 2701\def\code##1{\realbackslash code {##1}}% 2702\def\uref##1{\realbackslash uref {##1}}% 2703\def\url##1{\realbackslash url {##1}}% 2704\def\env##1{\realbackslash env {##1}}% 2705\def\command##1{\realbackslash command {##1}}% 2706\def\option##1{\realbackslash option {##1}}% 2707\def\dotless##1{\realbackslash dotless {##1}}% 2708\def\samp##1{\realbackslash samp {##1}}% 2709\def\,##1{\realbackslash ,{##1}}% 2710\def\t##1{\realbackslash t {##1}}% 2711\def\r##1{\realbackslash r {##1}}% 2712\def\i##1{\realbackslash i {##1}}% 2713\def\b##1{\realbackslash b {##1}}% 2714\def\sc##1{\realbackslash sc {##1}}% 2715\def\cite##1{\realbackslash cite {##1}}% 2716\def\key##1{\realbackslash key {##1}}% 2717\def\file##1{\realbackslash file {##1}}% 2718\def\var##1{\realbackslash var {##1}}% 2719\def\kbd##1{\realbackslash kbd {##1}}% 2720\def\dfn##1{\realbackslash dfn {##1}}% 2721\def\emph##1{\realbackslash emph {##1}}% 2722\def\acronym##1{\realbackslash acronym {##1}}% 2723% 2724% Handle some cases of @value -- where the variable name does not 2725% contain - or _, and the value does not contain any 2726% (non-fully-expandable) commands. 2727\let\value = \expandablevalue 2728% 2729\unsepspaces 2730% Turn off macro expansion 2731\turnoffmacros 2732} 2733 2734% If an index command is used in an @example environment, any spaces 2735% therein should become regular spaces in the raw index file, not the 2736% expansion of \tie (\\leavevmode \penalty \@M \ ). 2737{\obeyspaces 2738 \gdef\unsepspaces{\obeyspaces\let =\space}} 2739 2740% \indexnofonts no-ops all font-change commands. 2741% This is used when outputting the strings to sort the index by. 2742\def\indexdummyfont#1{#1} 2743\def\indexdummytex{TeX} 2744\def\indexdummydots{...} 2745 2746\def\indexnofonts{% 2747% Just ignore accents. 2748\let\,=\indexdummyfont 2749\let\"=\indexdummyfont 2750\let\`=\indexdummyfont 2751\let\'=\indexdummyfont 2752\let\^=\indexdummyfont 2753\let\~=\indexdummyfont 2754\let\==\indexdummyfont 2755\let\b=\indexdummyfont 2756\let\c=\indexdummyfont 2757\let\d=\indexdummyfont 2758\let\u=\indexdummyfont 2759\let\v=\indexdummyfont 2760\let\H=\indexdummyfont 2761\let\dotless=\indexdummyfont 2762% Take care of the plain tex special European modified letters. 2763\def\oe{oe}% 2764\def\ae{ae}% 2765\def\aa{aa}% 2766\def\OE{OE}% 2767\def\AE{AE}% 2768\def\AA{AA}% 2769\def\o{o}% 2770\def\O{O}% 2771\def\l{l}% 2772\def\L{L}% 2773\def\ss{ss}% 2774\let\w=\indexdummyfont 2775\let\t=\indexdummyfont 2776\let\r=\indexdummyfont 2777\let\i=\indexdummyfont 2778\let\b=\indexdummyfont 2779\let\emph=\indexdummyfont 2780\let\strong=\indexdummyfont 2781\let\cite=\indexdummyfont 2782\let\sc=\indexdummyfont 2783%Don't no-op \tt, since it isn't a user-level command 2784% and is used in the definitions of the active chars like <, >, |... 2785%\let\tt=\indexdummyfont 2786\let\tclose=\indexdummyfont 2787\let\code=\indexdummyfont 2788\let\url=\indexdummyfont 2789\let\uref=\indexdummyfont 2790\let\env=\indexdummyfont 2791\let\acronym=\indexdummyfont 2792\let\command=\indexdummyfont 2793\let\option=\indexdummyfont 2794\let\file=\indexdummyfont 2795\let\samp=\indexdummyfont 2796\let\kbd=\indexdummyfont 2797\let\key=\indexdummyfont 2798\let\var=\indexdummyfont 2799\let\TeX=\indexdummytex 2800\let\dots=\indexdummydots 2801\def\@{@}% 2802} 2803 2804% To define \realbackslash, we must make \ not be an escape. 2805% We must first make another character (@) an escape 2806% so we do not become unable to do a definition. 2807 2808{\catcode`\@=0 \catcode`\\=\other 2809 @gdef@realbackslash{\}} 2810 2811\let\indexbackslash=0 %overridden during \printindex. 2812\let\SETmarginindex=\relax % put index entries in margin (undocumented)? 2813 2814% For \ifx comparisons. 2815\def\emptymacro{\empty} 2816 2817% Most index entries go through here, but \dosubind is the general case. 2818% 2819\def\doind#1#2{\dosubind{#1}{#2}\empty} 2820 2821% Workhorse for all \fooindexes. 2822% #1 is name of index, #2 is stuff to put there, #3 is subentry -- 2823% \empty if called from \doind, as we usually are. The main exception 2824% is with defuns, which call us directly. 2825% 2826\def\dosubind#1#2#3{% 2827 % Put the index entry in the margin if desired. 2828 \ifx\SETmarginindex\relax\else 2829 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% 2830 \fi 2831 {% 2832 \count255=\lastpenalty 2833 {% 2834 \indexdummies % Must do this here, since \bf, etc expand at this stage 2835 \escapechar=`\\ 2836 {% 2837 \let\folio = 0% We will expand all macros now EXCEPT \folio. 2838 \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now 2839 % so it will be output as is; and it will print as backslash. 2840 % 2841 \def\thirdarg{#3}% 2842 % 2843 % If third arg is present, precede it with space in sort key. 2844 \ifx\thirdarg\emptymacro 2845 \let\subentry = \empty 2846 \else 2847 \def\subentry{ #3}% 2848 \fi 2849 % 2850 % First process the index entry with all font commands turned 2851 % off to get the string to sort by. 2852 {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% 2853 % 2854 % Now the real index entry with the fonts. 2855 \toks0 = {#2}% 2856 % 2857 % If third (subentry) arg is present, add it to the index 2858 % string. And include a space. 2859 \ifx\thirdarg\emptymacro \else 2860 \toks0 = \expandafter{\the\toks0 \space #3}% 2861 \fi 2862 % 2863 % Set up the complete index entry, with both the sort key 2864 % and the original text, including any font commands. We write 2865 % three arguments to \entry to the .?? file, texindex reduces to 2866 % two when writing the .??s sorted result. 2867 \edef\temp{% 2868 \write\csname#1indfile\endcsname{% 2869 \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% 2870 }% 2871 % 2872 % If a skip is the last thing on the list now, preserve it 2873 % by backing up by \lastskip, doing the \write, then inserting 2874 % the skip again. Otherwise, the whatsit generated by the 2875 % \write will make \lastskip zero. The result is that sequences 2876 % like this: 2877 % @end defun 2878 % @tindex whatever 2879 % @defun ... 2880 % will have extra space inserted, because the \medbreak in the 2881 % start of the @defun won't see the skip inserted by the @end of 2882 % the previous defun. 2883 % 2884 % But don't do any of this if we're not in vertical mode. We 2885 % don't want to do a \vskip and prematurely end a paragraph. 2886 % 2887 % Avoid page breaks due to these extra skips, too. 2888 % 2889 \iflinks 2890 \ifvmode 2891 \skip0 = \lastskip 2892 \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi 2893 \fi 2894 % 2895 \temp % do the write 2896 % 2897 % 2898 \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi 2899 \fi 2900 }% 2901 }% 2902 \penalty\count255 2903 }% 2904} 2905 2906% The index entry written in the file actually looks like 2907% \entry {sortstring}{page}{topic} 2908% or 2909% \entry {sortstring}{page}{topic}{subtopic} 2910% The texindex program reads in these files and writes files 2911% containing these kinds of lines: 2912% \initial {c} 2913% before the first topic whose initial is c 2914% \entry {topic}{pagelist} 2915% for a topic that is used without subtopics 2916% \primary {topic} 2917% for the beginning of a topic that is used with subtopics 2918% \secondary {subtopic}{pagelist} 2919% for each subtopic. 2920 2921% Define the user-accessible indexing commands 2922% @findex, @vindex, @kindex, @cindex. 2923 2924\def\findex {\fnindex} 2925\def\kindex {\kyindex} 2926\def\cindex {\cpindex} 2927\def\vindex {\vrindex} 2928\def\tindex {\tpindex} 2929\def\pindex {\pgindex} 2930 2931\def\cindexsub {\begingroup\obeylines\cindexsub} 2932{\obeylines % 2933\gdef\cindexsub "#1" #2^^M{\endgroup % 2934\dosubind{cp}{#2}{#1}}} 2935 2936% Define the macros used in formatting output of the sorted index material. 2937 2938% @printindex causes a particular index (the ??s file) to get printed. 2939% It does not print any chapter heading (usually an @unnumbered). 2940% 2941\def\printindex{\parsearg\doprintindex} 2942\def\doprintindex#1{\begingroup 2943 \dobreak \chapheadingskip{10000}% 2944 % 2945 \smallfonts \rm 2946 \tolerance = 9500 2947 \indexbreaks 2948 % 2949 % See if the index file exists and is nonempty. 2950 % Change catcode of @ here so that if the index file contains 2951 % \initial {@} 2952 % as its first line, TeX doesn't complain about mismatched braces 2953 % (because it thinks @} is a control sequence). 2954 \catcode`\@ = 11 2955 \openin 1 \jobname.#1s 2956 \ifeof 1 2957 % \enddoublecolumns gets confused if there is no text in the index, 2958 % and it loses the chapter title and the aux file entries for the 2959 % index. The easiest way to prevent this problem is to make sure 2960 % there is some text. 2961 \putwordIndexNonexistent 2962 \else 2963 % 2964 % If the index file exists but is empty, then \openin leaves \ifeof 2965 % false. We have to make TeX try to read something from the file, so 2966 % it can discover if there is anything in it. 2967 \read 1 to \temp 2968 \ifeof 1 2969 \putwordIndexIsEmpty 2970 \else 2971 % Index files are almost Texinfo source, but we use \ as the escape 2972 % character. It would be better to use @, but that's too big a change 2973 % to make right now. 2974 \def\indexbackslash{\rawbackslashxx}% 2975 \catcode`\\ = 0 2976 \escapechar = `\\ 2977 \begindoublecolumns 2978 \input \jobname.#1s 2979 \enddoublecolumns 2980 \fi 2981 \fi 2982 \closein 1 2983\endgroup} 2984 2985% These macros are used by the sorted index file itself. 2986% Change them to control the appearance of the index. 2987 2988\def\initial#1{{% 2989 % Some minor font changes for the special characters. 2990 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt 2991 % 2992 % Remove any glue we may have, we'll be inserting our own. 2993 \removelastskip 2994 % 2995 % We like breaks before the index initials, so insert a bonus. 2996 \penalty -300 2997 % 2998 % Typeset the initial. Making this add up to a whole number of 2999 % baselineskips increases the chance of the dots lining up from column 3000 % to column. It still won't often be perfect, because of the stretch 3001 % we need before each entry, but it's better. 3002 % 3003 % No shrink because it confuses \balancecolumns. 3004 \vskip 1.67\baselineskip plus .5\baselineskip 3005 \leftline{\secbf #1}% 3006 \vskip .33\baselineskip plus .1\baselineskip 3007 % 3008 % Do our best not to break after the initial. 3009 \nobreak 3010}} 3011 3012% This typesets a paragraph consisting of #1, dot leaders, and then #2 3013% flush to the right margin. It is used for index and table of contents 3014% entries. The paragraph is indented by \leftskip. 3015% 3016\def\entry#1#2{\begingroup 3017 % 3018 % Start a new paragraph if necessary, so our assignments below can't 3019 % affect previous text. 3020 \par 3021 % 3022 % Do not fill out the last line with white space. 3023 \parfillskip = 0in 3024 % 3025 % No extra space above this paragraph. 3026 \parskip = 0in 3027 % 3028 % Do not prefer a separate line ending with a hyphen to fewer lines. 3029 \finalhyphendemerits = 0 3030 % 3031 % \hangindent is only relevant when the entry text and page number 3032 % don't both fit on one line. In that case, bob suggests starting the 3033 % dots pretty far over on the line. Unfortunately, a large 3034 % indentation looks wrong when the entry text itself is broken across 3035 % lines. So we use a small indentation and put up with long leaders. 3036 % 3037 % \hangafter is reset to 1 (which is the value we want) at the start 3038 % of each paragraph, so we need not do anything with that. 3039 \hangindent = 2em 3040 % 3041 % When the entry text needs to be broken, just fill out the first line 3042 % with blank space. 3043 \rightskip = 0pt plus1fil 3044 % 3045 % A bit of stretch before each entry for the benefit of balancing columns. 3046 \vskip 0pt plus1pt 3047 % 3048 % Start a ``paragraph'' for the index entry so the line breaking 3049 % parameters we've set above will have an effect. 3050 \noindent 3051 % 3052 % Insert the text of the index entry. TeX will do line-breaking on it. 3053 #1% 3054 % The following is kludged to not output a line of dots in the index if 3055 % there are no page numbers. The next person who breaks this will be 3056 % cursed by a Unix daemon. 3057 \def\tempa{{\rm }}% 3058 \def\tempb{#2}% 3059 \edef\tempc{\tempa}% 3060 \edef\tempd{\tempb}% 3061 \ifx\tempc\tempd\ \else% 3062 % 3063 % If we must, put the page number on a line of its own, and fill out 3064 % this line with blank space. (The \hfil is overwhelmed with the 3065 % fill leaders glue in \indexdotfill if the page number does fit.) 3066 \hfil\penalty50 3067 \null\nobreak\indexdotfill % Have leaders before the page number. 3068 % 3069 % The `\ ' here is removed by the implicit \unskip that TeX does as 3070 % part of (the primitive) \par. Without it, a spurious underfull 3071 % \hbox ensues. 3072 \ifpdf 3073 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. 3074 \else 3075 \ #2% The page number ends the paragraph. 3076 \fi 3077 \fi% 3078 \par 3079\endgroup} 3080 3081% Like \dotfill except takes at least 1 em. 3082\def\indexdotfill{\cleaders 3083 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} 3084 3085\def\primary #1{\line{#1\hfil}} 3086 3087\newskip\secondaryindent \secondaryindent=0.5cm 3088 3089\def\secondary #1#2{ 3090{\parfillskip=0in \parskip=0in 3091\hangindent =1in \hangafter=1 3092\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par 3093}} 3094 3095% Define two-column mode, which we use to typeset indexes. 3096% Adapted from the TeXbook, page 416, which is to say, 3097% the manmac.tex format used to print the TeXbook itself. 3098\catcode`\@=11 3099 3100\newbox\partialpage 3101\newdimen\doublecolumnhsize 3102 3103\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns 3104 % Grab any single-column material above us. 3105 \output = {% 3106 % 3107 % Here is a possibility not foreseen in manmac: if we accumulate a 3108 % whole lot of material, we might end up calling this \output 3109 % routine twice in a row (see the doublecol-lose test, which is 3110 % essentially a couple of indexes with @setchapternewpage off). In 3111 % that case we just ship out what is in \partialpage with the normal 3112 % output routine. Generally, \partialpage will be empty when this 3113 % runs and this will be a no-op. See the indexspread.tex test case. 3114 \ifvoid\partialpage \else 3115 \onepageout{\pagecontents\partialpage}% 3116 \fi 3117 % 3118 \global\setbox\partialpage = \vbox{% 3119 % Unvbox the main output page. 3120 \unvbox\PAGE 3121 \kern-\topskip \kern\baselineskip 3122 }% 3123 }% 3124 \eject % run that output routine to set \partialpage 3125 % 3126 % Use the double-column output routine for subsequent pages. 3127 \output = {\doublecolumnout}% 3128 % 3129 % Change the page size parameters. We could do this once outside this 3130 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 3131 % format, but then we repeat the same computation. Repeating a couple 3132 % of assignments once per index is clearly meaningless for the 3133 % execution time, so we may as well do it in one place. 3134 % 3135 % First we halve the line length, less a little for the gutter between 3136 % the columns. We compute the gutter based on the line length, so it 3137 % changes automatically with the paper format. The magic constant 3138 % below is chosen so that the gutter has the same value (well, +-<1pt) 3139 % as it did when we hard-coded it. 3140 % 3141 % We put the result in a separate register, \doublecolumhsize, so we 3142 % can restore it in \pagesofar, after \hsize itself has (potentially) 3143 % been clobbered. 3144 % 3145 \doublecolumnhsize = \hsize 3146 \advance\doublecolumnhsize by -.04154\hsize 3147 \divide\doublecolumnhsize by 2 3148 \hsize = \doublecolumnhsize 3149 % 3150 % Double the \vsize as well. (We don't need a separate register here, 3151 % since nobody clobbers \vsize.) 3152 \advance\vsize by -\ht\partialpage 3153 \vsize = 2\vsize 3154} 3155 3156% The double-column output routine for all double-column pages except 3157% the last. 3158% 3159\def\doublecolumnout{% 3160 \splittopskip=\topskip \splitmaxdepth=\maxdepth 3161 % Get the available space for the double columns -- the normal 3162 % (undoubled) page height minus any material left over from the 3163 % previous page. 3164 \dimen@ = \vsize 3165 \divide\dimen@ by 2 3166 % 3167 % box0 will be the left-hand column, box2 the right. 3168 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ 3169 \onepageout\pagesofar 3170 \unvbox255 3171 \penalty\outputpenalty 3172} 3173\def\pagesofar{% 3174 % Re-output the contents of the output page -- any previous material, 3175 % followed by the two boxes we just split, in box0 and box2. 3176 \unvbox\partialpage 3177 % 3178 \hsize = \doublecolumnhsize 3179 \wd0=\hsize \wd2=\hsize 3180 \hbox to\pagewidth{\box0\hfil\box2}% 3181} 3182\def\enddoublecolumns{% 3183 \output = {% 3184 % Split the last of the double-column material. Leave it on the 3185 % current page, no automatic page break. 3186 \balancecolumns 3187 % 3188 % If we end up splitting too much material for the current page, 3189 % though, there will be another page break right after this \output 3190 % invocation ends. Having called \balancecolumns once, we do not 3191 % want to call it again. Therefore, reset \output to its normal 3192 % definition right away. (We hope \balancecolumns will never be 3193 % called on to balance too much material, but if it is, this makes 3194 % the output somewhat more palatable.) 3195 \global\output = {\onepageout{\pagecontents\PAGE}}% 3196 }% 3197 \eject 3198 \endgroup % started in \begindoublecolumns 3199 % 3200 % \pagegoal was set to the doubled \vsize above, since we restarted 3201 % the current page. We're now back to normal single-column 3202 % typesetting, so reset \pagegoal to the normal \vsize (after the 3203 % \endgroup where \vsize got restored). 3204 \pagegoal = \vsize 3205} 3206\def\balancecolumns{% 3207 % Called at the end of the double column material. 3208 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. 3209 \dimen@ = \ht0 3210 \advance\dimen@ by \topskip 3211 \advance\dimen@ by-\baselineskip 3212 \divide\dimen@ by 2 % target to split to 3213 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% 3214 \splittopskip = \topskip 3215 % Loop until we get a decent breakpoint. 3216 {% 3217 \vbadness = 10000 3218 \loop 3219 \global\setbox3 = \copy0 3220 \global\setbox1 = \vsplit3 to \dimen@ 3221 \ifdim\ht3>\dimen@ 3222 \global\advance\dimen@ by 1pt 3223 \repeat 3224 }% 3225 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% 3226 \setbox0=\vbox to\dimen@{\unvbox1}% 3227 \setbox2=\vbox to\dimen@{\unvbox3}% 3228 % 3229 \pagesofar 3230} 3231\catcode`\@ = \other 3232 3233 3234\message{sectioning,} 3235% Chapters, sections, etc. 3236 3237\newcount\chapno 3238\newcount\secno \secno=0 3239\newcount\subsecno \subsecno=0 3240\newcount\subsubsecno \subsubsecno=0 3241 3242% This counter is funny since it counts through charcodes of letters A, B, ... 3243\newcount\appendixno \appendixno = `\@ 3244% \def\appendixletter{\char\the\appendixno} 3245% We do the following for the sake of pdftex, which needs the actual 3246% letter in the expansion, not just typeset. 3247\def\appendixletter{% 3248 \ifnum\appendixno=`A A% 3249 \else\ifnum\appendixno=`B B% 3250 \else\ifnum\appendixno=`C C% 3251 \else\ifnum\appendixno=`D D% 3252 \else\ifnum\appendixno=`E E% 3253 \else\ifnum\appendixno=`F F% 3254 \else\ifnum\appendixno=`G G% 3255 \else\ifnum\appendixno=`H H% 3256 \else\ifnum\appendixno=`I I% 3257 \else\ifnum\appendixno=`J J% 3258 \else\ifnum\appendixno=`K K% 3259 \else\ifnum\appendixno=`L L% 3260 \else\ifnum\appendixno=`M M% 3261 \else\ifnum\appendixno=`N N% 3262 \else\ifnum\appendixno=`O O% 3263 \else\ifnum\appendixno=`P P% 3264 \else\ifnum\appendixno=`Q Q% 3265 \else\ifnum\appendixno=`R R% 3266 \else\ifnum\appendixno=`S S% 3267 \else\ifnum\appendixno=`T T% 3268 \else\ifnum\appendixno=`U U% 3269 \else\ifnum\appendixno=`V V% 3270 \else\ifnum\appendixno=`W W% 3271 \else\ifnum\appendixno=`X X% 3272 \else\ifnum\appendixno=`Y Y% 3273 \else\ifnum\appendixno=`Z Z% 3274 % The \the is necessary, despite appearances, because \appendixletter is 3275 % expanded while writing the .toc file. \char\appendixno is not 3276 % expandable, thus it is written literally, thus all appendixes come out 3277 % with the same letter (or @) in the toc without it. 3278 \else\char\the\appendixno 3279 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 3280 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} 3281 3282% Each @chapter defines this as the name of the chapter. 3283% page headings and footings can use it. @section does likewise. 3284\def\thischapter{} 3285\def\thissection{} 3286 3287\newcount\absseclevel % used to calculate proper heading level 3288\newcount\secbase\secbase=0 % @raise/lowersections modify this count 3289 3290% @raisesections: treat @section as chapter, @subsection as section, etc. 3291\def\raisesections{\global\advance\secbase by -1} 3292\let\up=\raisesections % original BFox name 3293 3294% @lowersections: treat @chapter as section, @section as subsection, etc. 3295\def\lowersections{\global\advance\secbase by 1} 3296\let\down=\lowersections % original BFox name 3297 3298% Choose a numbered-heading macro 3299% #1 is heading level if unmodified by @raisesections or @lowersections 3300% #2 is text for heading 3301\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 3302\ifcase\absseclevel 3303 \chapterzzz{#2} 3304\or 3305 \seczzz{#2} 3306\or 3307 \numberedsubseczzz{#2} 3308\or 3309 \numberedsubsubseczzz{#2} 3310\else 3311 \ifnum \absseclevel<0 3312 \chapterzzz{#2} 3313 \else 3314 \numberedsubsubseczzz{#2} 3315 \fi 3316\fi 3317} 3318 3319% like \numhead, but chooses appendix heading levels 3320\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 3321\ifcase\absseclevel 3322 \appendixzzz{#2} 3323\or 3324 \appendixsectionzzz{#2} 3325\or 3326 \appendixsubseczzz{#2} 3327\or 3328 \appendixsubsubseczzz{#2} 3329\else 3330 \ifnum \absseclevel<0 3331 \appendixzzz{#2} 3332 \else 3333 \appendixsubsubseczzz{#2} 3334 \fi 3335\fi 3336} 3337 3338% like \numhead, but chooses numberless heading levels 3339\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 3340\ifcase\absseclevel 3341 \unnumberedzzz{#2} 3342\or 3343 \unnumberedseczzz{#2} 3344\or 3345 \unnumberedsubseczzz{#2} 3346\or 3347 \unnumberedsubsubseczzz{#2} 3348\else 3349 \ifnum \absseclevel<0 3350 \unnumberedzzz{#2} 3351 \else 3352 \unnumberedsubsubseczzz{#2} 3353 \fi 3354\fi 3355} 3356 3357% @chapter, @appendix, @unnumbered. 3358\def\thischaptername{No Chapter Title} 3359\outer\def\chapter{\parsearg\chapteryyy} 3360\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz 3361\def\chapterzzz #1{% 3362\secno=0 \subsecno=0 \subsubsecno=0 3363\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% 3364\chapmacro {#1}{\the\chapno}% 3365\gdef\thissection{#1}% 3366\gdef\thischaptername{#1}% 3367% We don't substitute the actual chapter name into \thischapter 3368% because we don't want its macros evaluated now. 3369\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% 3370\toks0 = {#1}% 3371\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% 3372 {\the\chapno}}}% 3373\temp 3374\donoderef 3375\global\let\section = \numberedsec 3376\global\let\subsection = \numberedsubsec 3377\global\let\subsubsection = \numberedsubsubsec 3378} 3379 3380\outer\def\appendix{\parsearg\appendixyyy} 3381\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz 3382\def\appendixzzz #1{% 3383\secno=0 \subsecno=0 \subsubsecno=0 3384\global\advance \appendixno by 1 3385\message{\putwordAppendix\space \appendixletter}% 3386\chapmacro {#1}{\putwordAppendix{} \appendixletter}% 3387\gdef\thissection{#1}% 3388\gdef\thischaptername{#1}% 3389\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% 3390\toks0 = {#1}% 3391\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% 3392 {\putwordAppendix{} \appendixletter}}}% 3393\temp 3394\appendixnoderef 3395\global\let\section = \appendixsec 3396\global\let\subsection = \appendixsubsec 3397\global\let\subsubsection = \appendixsubsubsec 3398} 3399 3400% @centerchap is like @unnumbered, but the heading is centered. 3401\outer\def\centerchap{\parsearg\centerchapyyy} 3402\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} 3403 3404% @top is like @unnumbered. 3405\outer\def\top{\parsearg\unnumberedyyy} 3406 3407\outer\def\unnumbered{\parsearg\unnumberedyyy} 3408\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz 3409\def\unnumberedzzz #1{% 3410\secno=0 \subsecno=0 \subsubsecno=0 3411% 3412% This used to be simply \message{#1}, but TeX fully expands the 3413% argument to \message. Therefore, if #1 contained @-commands, TeX 3414% expanded them. For example, in `@unnumbered The @cite{Book}', TeX 3415% expanded @cite (which turns out to cause errors because \cite is meant 3416% to be executed, not expanded). 3417% 3418% Anyway, we don't want the fully-expanded definition of @cite to appear 3419% as a result of the \message, we just want `@cite' itself. We use 3420% \the<toks register> to achieve this: TeX expands \the<toks> only once, 3421% simply yielding the contents of <toks register>. (We also do this for 3422% the toc entries.) 3423\toks0 = {#1}\message{(\the\toks0)}% 3424% 3425\unnumbchapmacro {#1}% 3426\gdef\thischapter{#1}\gdef\thissection{#1}% 3427\toks0 = {#1}% 3428\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% 3429\temp 3430\unnumbnoderef 3431\global\let\section = \unnumberedsec 3432\global\let\subsection = \unnumberedsubsec 3433\global\let\subsubsection = \unnumberedsubsubsec 3434} 3435 3436% Sections. 3437\outer\def\numberedsec{\parsearg\secyyy} 3438\def\secyyy #1{\numhead1{#1}} % normally calls seczzz 3439\def\seczzz #1{% 3440\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % 3441\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% 3442\toks0 = {#1}% 3443\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% 3444 {\the\chapno}{\the\secno}}}% 3445\temp 3446\donoderef 3447\nobreak 3448} 3449 3450\outer\def\appendixsection{\parsearg\appendixsecyyy} 3451\outer\def\appendixsec{\parsearg\appendixsecyyy} 3452\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz 3453\def\appendixsectionzzz #1{% 3454\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % 3455\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% 3456\toks0 = {#1}% 3457\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% 3458 {\appendixletter}{\the\secno}}}% 3459\temp 3460\appendixnoderef 3461\nobreak 3462} 3463 3464\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} 3465\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz 3466\def\unnumberedseczzz #1{% 3467\plainsecheading {#1}\gdef\thissection{#1}% 3468\toks0 = {#1}% 3469\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% 3470\temp 3471\unnumbnoderef 3472\nobreak 3473} 3474 3475% Subsections. 3476\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} 3477\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz 3478\def\numberedsubseczzz #1{% 3479\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % 3480\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% 3481\toks0 = {#1}% 3482\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% 3483 {\the\chapno}{\the\secno}{\the\subsecno}}}% 3484\temp 3485\donoderef 3486\nobreak 3487} 3488 3489\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} 3490\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz 3491\def\appendixsubseczzz #1{% 3492\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % 3493\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% 3494\toks0 = {#1}% 3495\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% 3496 {\appendixletter}{\the\secno}{\the\subsecno}}}% 3497\temp 3498\appendixnoderef 3499\nobreak 3500} 3501 3502\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} 3503\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz 3504\def\unnumberedsubseczzz #1{% 3505\plainsubsecheading {#1}\gdef\thissection{#1}% 3506\toks0 = {#1}% 3507\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% 3508 {\the\toks0}}}% 3509\temp 3510\unnumbnoderef 3511\nobreak 3512} 3513 3514% Subsubsections. 3515\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} 3516\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz 3517\def\numberedsubsubseczzz #1{% 3518\gdef\thissection{#1}\global\advance \subsubsecno by 1 % 3519\subsubsecheading {#1} 3520 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% 3521\toks0 = {#1}% 3522\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% 3523 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% 3524\temp 3525\donoderef 3526\nobreak 3527} 3528 3529\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} 3530\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz 3531\def\appendixsubsubseczzz #1{% 3532\gdef\thissection{#1}\global\advance \subsubsecno by 1 % 3533\subsubsecheading {#1} 3534 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% 3535\toks0 = {#1}% 3536\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% 3537 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% 3538\temp 3539\appendixnoderef 3540\nobreak 3541} 3542 3543\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} 3544\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz 3545\def\unnumberedsubsubseczzz #1{% 3546\plainsubsubsecheading {#1}\gdef\thissection{#1}% 3547\toks0 = {#1}% 3548\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% 3549 {\the\toks0}}}% 3550\temp 3551\unnumbnoderef 3552\nobreak 3553} 3554 3555% These are variants which are not "outer", so they can appear in @ifinfo. 3556% Actually, they should now be obsolete; ordinary section commands should work. 3557\def\infotop{\parsearg\unnumberedzzz} 3558\def\infounnumbered{\parsearg\unnumberedzzz} 3559\def\infounnumberedsec{\parsearg\unnumberedseczzz} 3560\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} 3561\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} 3562 3563\def\infoappendix{\parsearg\appendixzzz} 3564\def\infoappendixsec{\parsearg\appendixseczzz} 3565\def\infoappendixsubsec{\parsearg\appendixsubseczzz} 3566\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} 3567 3568\def\infochapter{\parsearg\chapterzzz} 3569\def\infosection{\parsearg\sectionzzz} 3570\def\infosubsection{\parsearg\subsectionzzz} 3571\def\infosubsubsection{\parsearg\subsubsectionzzz} 3572 3573% These macros control what the section commands do, according 3574% to what kind of chapter we are in (ordinary, appendix, or unnumbered). 3575% Define them by default for a numbered chapter. 3576\global\let\section = \numberedsec 3577\global\let\subsection = \numberedsubsec 3578\global\let\subsubsection = \numberedsubsubsec 3579 3580% Define @majorheading, @heading and @subheading 3581 3582% NOTE on use of \vbox for chapter headings, section headings, and such: 3583% 1) We use \vbox rather than the earlier \line to permit 3584% overlong headings to fold. 3585% 2) \hyphenpenalty is set to 10000 because hyphenation in a 3586% heading is obnoxious; this forbids it. 3587% 3) Likewise, headings look best if no \parindent is used, and 3588% if justification is not attempted. Hence \raggedright. 3589 3590 3591\def\majorheading{\parsearg\majorheadingzzz} 3592\def\majorheadingzzz #1{% 3593{\advance\chapheadingskip by 10pt \chapbreak }% 3594{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3595 \parindent=0pt\raggedright 3596 \rm #1\hfill}}\bigskip \par\penalty 200} 3597 3598\def\chapheading{\parsearg\chapheadingzzz} 3599\def\chapheadingzzz #1{\chapbreak % 3600{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3601 \parindent=0pt\raggedright 3602 \rm #1\hfill}}\bigskip \par\penalty 200} 3603 3604% @heading, @subheading, @subsubheading. 3605\def\heading{\parsearg\plainsecheading} 3606\def\subheading{\parsearg\plainsubsecheading} 3607\def\subsubheading{\parsearg\plainsubsubsecheading} 3608 3609% These macros generate a chapter, section, etc. heading only 3610% (including whitespace, linebreaking, etc. around it), 3611% given all the information in convenient, parsed form. 3612 3613%%% Args are the skip and penalty (usually negative) 3614\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} 3615 3616\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} 3617 3618%%% Define plain chapter starts, and page on/off switching for it 3619% Parameter controlling skip before chapter headings (if needed) 3620 3621\newskip\chapheadingskip 3622 3623\def\chapbreak{\dobreak \chapheadingskip {-4000}} 3624\def\chappager{\par\vfill\supereject} 3625\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} 3626 3627\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} 3628 3629\def\CHAPPAGoff{% 3630\global\let\contentsalignmacro = \chappager 3631\global\let\pchapsepmacro=\chapbreak 3632\global\let\pagealignmacro=\chappager} 3633 3634\def\CHAPPAGon{% 3635\global\let\contentsalignmacro = \chappager 3636\global\let\pchapsepmacro=\chappager 3637\global\let\pagealignmacro=\chappager 3638\global\def\HEADINGSon{\HEADINGSsingle}} 3639 3640\def\CHAPPAGodd{ 3641\global\let\contentsalignmacro = \chapoddpage 3642\global\let\pchapsepmacro=\chapoddpage 3643\global\let\pagealignmacro=\chapoddpage 3644\global\def\HEADINGSon{\HEADINGSdouble}} 3645 3646\CHAPPAGon 3647 3648\def\CHAPFplain{ 3649\global\let\chapmacro=\chfplain 3650\global\let\unnumbchapmacro=\unnchfplain 3651\global\let\centerchapmacro=\centerchfplain} 3652 3653% Plain chapter opening. 3654% #1 is the text, #2 the chapter number or empty if unnumbered. 3655\def\chfplain#1#2{% 3656 \pchapsepmacro 3657 {% 3658 \chapfonts \rm 3659 \def\chapnum{#2}% 3660 \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% 3661 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright 3662 \hangindent = \wd0 \centerparametersmaybe 3663 \unhbox0 #1\par}% 3664 }% 3665 \nobreak\bigskip % no page break after a chapter title 3666 \nobreak 3667} 3668 3669% Plain opening for unnumbered. 3670\def\unnchfplain#1{\chfplain{#1}{}} 3671 3672% @centerchap -- centered and unnumbered. 3673\let\centerparametersmaybe = \relax 3674\def\centerchfplain#1{{% 3675 \def\centerparametersmaybe{% 3676 \advance\rightskip by 3\rightskip 3677 \leftskip = \rightskip 3678 \parfillskip = 0pt 3679 }% 3680 \chfplain{#1}{}% 3681}} 3682 3683\CHAPFplain % The default 3684 3685\def\unnchfopen #1{% 3686\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3687 \parindent=0pt\raggedright 3688 \rm #1\hfill}}\bigskip \par\nobreak 3689} 3690 3691\def\chfopen #1#2{\chapoddpage {\chapfonts 3692\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% 3693\par\penalty 5000 % 3694} 3695 3696\def\centerchfopen #1{% 3697\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3698 \parindent=0pt 3699 \hfill {\rm #1}\hfill}}\bigskip \par\nobreak 3700} 3701 3702\def\CHAPFopen{ 3703\global\let\chapmacro=\chfopen 3704\global\let\unnumbchapmacro=\unnchfopen 3705\global\let\centerchapmacro=\centerchfopen} 3706 3707 3708% Section titles. 3709\newskip\secheadingskip 3710\def\secheadingbreak{\dobreak \secheadingskip {-1000}} 3711\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} 3712\def\plainsecheading#1{\sectionheading{sec}{}{#1}} 3713 3714% Subsection titles. 3715\newskip \subsecheadingskip 3716\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} 3717\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} 3718\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} 3719 3720% Subsubsection titles. 3721\let\subsubsecheadingskip = \subsecheadingskip 3722\let\subsubsecheadingbreak = \subsecheadingbreak 3723\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} 3724\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} 3725 3726 3727% Print any size section title. 3728% 3729% #1 is the section type (sec/subsec/subsubsec), #2 is the section 3730% number (maybe empty), #3 the text. 3731\def\sectionheading#1#2#3{% 3732 {% 3733 \expandafter\advance\csname #1headingskip\endcsname by \parskip 3734 \csname #1headingbreak\endcsname 3735 }% 3736 {% 3737 % Switch to the right set of fonts. 3738 \csname #1fonts\endcsname \rm 3739 % 3740 % Only insert the separating space if we have a section number. 3741 \def\secnum{#2}% 3742 \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% 3743 % 3744 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright 3745 \hangindent = \wd0 % zero if no section number 3746 \unhbox0 #3}% 3747 }% 3748 \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak 3749} 3750 3751 3752\message{toc,} 3753% Table of contents. 3754\newwrite\tocfile 3755 3756% Write an entry to the toc file, opening it if necessary. 3757% Called from @chapter, etc. We supply {\folio} at the end of the 3758% argument, which will end up as the last argument to the \...entry macro. 3759% 3760% We open the .toc file here instead of at @setfilename or any other 3761% given time so that @contents can be put in the document anywhere. 3762% 3763\newif\iftocfileopened 3764\def\writetocentry#1{% 3765 \iftocfileopened\else 3766 \immediate\openout\tocfile = \jobname.toc 3767 \global\tocfileopenedtrue 3768 \fi 3769 \iflinks \write\tocfile{#1{\folio}}\fi 3770} 3771 3772\newskip\contentsrightmargin \contentsrightmargin=1in 3773\newcount\savepageno 3774\newcount\lastnegativepageno \lastnegativepageno = -1 3775 3776% Finish up the main text and prepare to read what we've written 3777% to \tocfile. 3778% 3779\def\startcontents#1{% 3780 % If @setchapternewpage on, and @headings double, the contents should 3781 % start on an odd page, unlike chapters. Thus, we maintain 3782 % \contentsalignmacro in parallel with \pagealignmacro. 3783 % From: Torbjorn Granlund <tege@matematik.su.se> 3784 \contentsalignmacro 3785 \immediate\closeout\tocfile 3786 % 3787 % Don't need to put `Contents' or `Short Contents' in the headline. 3788 % It is abundantly clear what they are. 3789 \unnumbchapmacro{#1}\def\thischapter{}% 3790 \savepageno = \pageno 3791 \begingroup % Set up to handle contents files properly. 3792 \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 3793 % We can't do this, because then an actual ^ in a section 3794 % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. 3795 %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi 3796 \raggedbottom % Worry more about breakpoints than the bottom. 3797 \advance\hsize by -\contentsrightmargin % Don't use the full line length. 3798 % 3799 % Roman numerals for page numbers. 3800 \ifnum \pageno>0 \pageno = \lastnegativepageno \fi 3801} 3802 3803 3804% Normal (long) toc. 3805\def\contents{% 3806 \startcontents{\putwordTOC}% 3807 \openin 1 \jobname.toc 3808 \ifeof 1 \else 3809 \closein 1 3810 \input \jobname.toc 3811 \fi 3812 \vfill \eject 3813 \contentsalignmacro % in case @setchapternewpage odd is in effect 3814 \pdfmakeoutlines 3815 \endgroup 3816 \lastnegativepageno = \pageno 3817 \pageno = \savepageno 3818} 3819 3820% And just the chapters. 3821\def\summarycontents{% 3822 \startcontents{\putwordShortTOC}% 3823 % 3824 \let\chapentry = \shortchapentry 3825 \let\unnumbchapentry = \shortunnumberedentry 3826 % We want a true roman here for the page numbers. 3827 \secfonts 3828 \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl 3829 \rm 3830 \hyphenpenalty = 10000 3831 \advance\baselineskip by 1pt % Open it up a little. 3832 \def\secentry ##1##2##3##4{} 3833 \def\unnumbsecentry ##1##2{} 3834 \def\subsecentry ##1##2##3##4##5{} 3835 \def\unnumbsubsecentry ##1##2{} 3836 \def\subsubsecentry ##1##2##3##4##5##6{} 3837 \def\unnumbsubsubsecentry ##1##2{} 3838 \openin 1 \jobname.toc 3839 \ifeof 1 \else 3840 \closein 1 3841 \input \jobname.toc 3842 \fi 3843 \vfill \eject 3844 \contentsalignmacro % in case @setchapternewpage odd is in effect 3845 \endgroup 3846 \lastnegativepageno = \pageno 3847 \pageno = \savepageno 3848} 3849\let\shortcontents = \summarycontents 3850 3851\ifpdf 3852 \pdfcatalog{/PageMode /UseOutlines}% 3853\fi 3854 3855% These macros generate individual entries in the table of contents. 3856% The first argument is the chapter or section name. 3857% The last argument is the page number. 3858% The arguments in between are the chapter number, section number, ... 3859 3860% Chapter-level things, for both the long and short contents. 3861\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} 3862 3863% See comments in \dochapentry re vbox and related settings 3864\def\shortchapentry#1#2#3{% 3865 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% 3866} 3867 3868% Typeset the label for a chapter or appendix for the short contents. 3869% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. 3870% We could simplify the code here by writing out an \appendixentry 3871% command in the toc file for appendices, instead of using \chapentry 3872% for both, but it doesn't seem worth it. 3873% 3874\newdimen\shortappendixwidth 3875% 3876\def\shortchaplabel#1{% 3877 % Compute width of word "Appendix", may change with language. 3878 \setbox0 = \hbox{\shortcontrm \putwordAppendix}% 3879 \shortappendixwidth = \wd0 3880 % 3881 % We typeset #1 in a box of constant width, regardless of the text of 3882 % #1, so the chapter titles will come out aligned. 3883 \setbox0 = \hbox{#1}% 3884 \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi 3885 % 3886 % This space should be plenty, since a single number is .5em, and the 3887 % widest letter (M) is 1em, at least in the Computer Modern fonts. 3888 % (This space doesn't include the extra space that gets added after 3889 % the label; that gets put in by \shortchapentry above.) 3890 \advance\dimen0 by 1.1em 3891 \hbox to \dimen0{#1\hfil}% 3892} 3893 3894\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} 3895\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}} 3896 3897% Sections. 3898\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} 3899\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} 3900 3901% Subsections. 3902\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} 3903\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} 3904 3905% And subsubsections. 3906\def\subsubsecentry#1#2#3#4#5#6{% 3907 \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} 3908\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} 3909 3910% This parameter controls the indentation of the various levels. 3911\newdimen\tocindent \tocindent = 3pc 3912 3913% Now for the actual typesetting. In all these, #1 is the text and #2 is the 3914% page number. 3915% 3916% If the toc has to be broken over pages, we want it to be at chapters 3917% if at all possible; hence the \penalty. 3918\def\dochapentry#1#2{% 3919 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip 3920 \begingroup 3921 \chapentryfonts 3922 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 3923 \endgroup 3924 \nobreak\vskip .25\baselineskip plus.1\baselineskip 3925} 3926 3927\def\dosecentry#1#2{\begingroup 3928 \secentryfonts \leftskip=\tocindent 3929 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 3930\endgroup} 3931 3932\def\dosubsecentry#1#2{\begingroup 3933 \subsecentryfonts \leftskip=2\tocindent 3934 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 3935\endgroup} 3936 3937\def\dosubsubsecentry#1#2{\begingroup 3938 \subsubsecentryfonts \leftskip=3\tocindent 3939 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 3940\endgroup} 3941 3942% Final typesetting of a toc entry; we use the same \entry macro as for 3943% the index entries, but we want to suppress hyphenation here. (We 3944% can't do that in the \entry macro, since index entries might consist 3945% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) 3946\def\tocentry#1#2{\begingroup 3947 \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks 3948 % Do not use \turnoffactive in these arguments. Since the toc is 3949 % typeset in cmr, so characters such as _ would come out wrong; we 3950 % have to do the usual translation tricks. 3951 \entry{#1}{#2}% 3952\endgroup} 3953 3954% Space between chapter (or whatever) number and the title. 3955\def\labelspace{\hskip1em \relax} 3956 3957\def\dopageno#1{{\rm #1}} 3958\def\doshortpageno#1{{\rm #1}} 3959 3960\def\chapentryfonts{\secfonts \rm} 3961\def\secentryfonts{\textfonts} 3962\let\subsecentryfonts = \textfonts 3963\let\subsubsecentryfonts = \textfonts 3964 3965 3966\message{environments,} 3967% @foo ... @end foo. 3968 3969% Since these characters are used in examples, it should be an even number of 3970% \tt widths. Each \tt character is 1en, so two makes it 1em. 3971% Furthermore, these definitions must come after we define our fonts. 3972\newbox\dblarrowbox \newbox\longdblarrowbox 3973\newbox\pushcharbox \newbox\bullbox 3974\newbox\equivbox \newbox\errorbox 3975 3976%{\tentt 3977%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} 3978%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} 3979%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} 3980%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} 3981% Adapted from the manmac format (p.420 of TeXbook) 3982%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex 3983% depth .1ex\hfil} 3984%} 3985 3986% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. 3987\def\point{$\star$} 3988\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} 3989\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} 3990\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} 3991\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} 3992 3993% Adapted from the TeXbook's \boxit. 3994{\tentt \global\dimen0 = 3em}% Width of the box. 3995\dimen2 = .55pt % Thickness of rules 3996% The text. (`r' is open on the right, `e' somewhat less so on the left.) 3997\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} 3998 3999\global\setbox\errorbox=\hbox to \dimen0{\hfil 4000 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. 4001 \advance\hsize by -2\dimen2 % Rules. 4002 \vbox{ 4003 \hrule height\dimen2 4004 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. 4005 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. 4006 \kern3pt\vrule width\dimen2}% Space to right. 4007 \hrule height\dimen2} 4008 \hfil} 4009 4010% The @error{} command. 4011\def\error{\leavevmode\lower.7ex\copy\errorbox} 4012 4013% @tex ... @end tex escapes into raw Tex temporarily. 4014% One exception: @ is still an escape character, so that @end tex works. 4015% But \@ or @@ will get a plain tex @ character. 4016 4017\def\tex{\begingroup 4018 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 4019 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 4020 \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie 4021 \catcode `\%=14 4022 \catcode 43=12 % plus 4023 \catcode`\"=12 4024 \catcode`\==12 4025 \catcode`\|=12 4026 \catcode`\<=12 4027 \catcode`\>=12 4028 \escapechar=`\\ 4029 % 4030 \let\b=\ptexb 4031 \let\bullet=\ptexbullet 4032 \let\c=\ptexc 4033 \let\,=\ptexcomma 4034 \let\.=\ptexdot 4035 \let\dots=\ptexdots 4036 \let\equiv=\ptexequiv 4037 \let\!=\ptexexclam 4038 \let\i=\ptexi 4039 \let\{=\ptexlbrace 4040 \let\+=\tabalign 4041 \let\}=\ptexrbrace 4042 \let\*=\ptexstar 4043 \let\t=\ptext 4044 % 4045 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% 4046 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% 4047 \def\@{@}% 4048\let\Etex=\endgroup} 4049 4050% Define @lisp ... @endlisp. 4051% @lisp does a \begingroup so it can rebind things, 4052% including the definition of @endlisp (which normally is erroneous). 4053 4054% Amount to narrow the margins by for @lisp. 4055\newskip\lispnarrowing \lispnarrowing=0.4in 4056 4057% This is the definition that ^^M gets inside @lisp, @example, and other 4058% such environments. \null is better than a space, since it doesn't 4059% have any width. 4060\def\lisppar{\null\endgraf} 4061 4062% Make each space character in the input produce a normal interword 4063% space in the output. Don't allow a line break at this space, as this 4064% is used only in environments like @example, where each line of input 4065% should produce a line of output anyway. 4066% 4067{\obeyspaces % 4068\gdef\sepspaces{\obeyspaces\let =\tie}} 4069 4070% Define \obeyedspace to be our active space, whatever it is. This is 4071% for use in \parsearg. 4072{\sepspaces% 4073\global\let\obeyedspace= } 4074 4075% This space is always present above and below environments. 4076\newskip\envskipamount \envskipamount = 0pt 4077 4078% Make spacing and below environment symmetrical. We use \parskip here 4079% to help in doing that, since in @example-like environments \parskip 4080% is reset to zero; thus the \afterenvbreak inserts no space -- but the 4081% start of the next paragraph will insert \parskip 4082% 4083\def\aboveenvbreak{{\advance\envskipamount by \parskip 4084\endgraf \ifdim\lastskip<\envskipamount 4085\removelastskip \penalty-50 \vskip\envskipamount \fi}} 4086 4087\let\afterenvbreak = \aboveenvbreak 4088 4089% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. 4090\let\nonarrowing=\relax 4091 4092% @cartouche ... @end cartouche: draw rectangle w/rounded corners around 4093% environment contents. 4094\font\circle=lcircle10 4095\newdimen\circthick 4096\newdimen\cartouter\newdimen\cartinner 4097\newskip\normbskip\newskip\normpskip\newskip\normlskip 4098\circthick=\fontdimen8\circle 4099% 4100\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth 4101\def\ctr{{\hskip 6pt\circle\char'010}} 4102\def\cbl{{\circle\char'012\hskip -6pt}} 4103\def\cbr{{\hskip 6pt\circle\char'011}} 4104\def\carttop{\hbox to \cartouter{\hskip\lskip 4105 \ctl\leaders\hrule height\circthick\hfil\ctr 4106 \hskip\rskip}} 4107\def\cartbot{\hbox to \cartouter{\hskip\lskip 4108 \cbl\leaders\hrule height\circthick\hfil\cbr 4109 \hskip\rskip}} 4110% 4111\newskip\lskip\newskip\rskip 4112 4113\long\def\cartouche{% 4114\begingroup 4115 \lskip=\leftskip \rskip=\rightskip 4116 \leftskip=0pt\rightskip=0pt %we want these *outside*. 4117 \cartinner=\hsize \advance\cartinner by-\lskip 4118 \advance\cartinner by-\rskip 4119 \cartouter=\hsize 4120 \advance\cartouter by 18.4pt % allow for 3pt kerns on either 4121% side, and for 6pt waste from 4122% each corner char, and rule thickness 4123 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip 4124 % Flag to tell @lisp, etc., not to narrow margin. 4125 \let\nonarrowing=\comment 4126 \vbox\bgroup 4127 \baselineskip=0pt\parskip=0pt\lineskip=0pt 4128 \carttop 4129 \hbox\bgroup 4130 \hskip\lskip 4131 \vrule\kern3pt 4132 \vbox\bgroup 4133 \hsize=\cartinner 4134 \kern3pt 4135 \begingroup 4136 \baselineskip=\normbskip 4137 \lineskip=\normlskip 4138 \parskip=\normpskip 4139 \vskip -\parskip 4140\def\Ecartouche{% 4141 \endgroup 4142 \kern3pt 4143 \egroup 4144 \kern3pt\vrule 4145 \hskip\rskip 4146 \egroup 4147 \cartbot 4148 \egroup 4149\endgroup 4150}} 4151 4152 4153% This macro is called at the beginning of all the @example variants, 4154% inside a group. 4155\def\nonfillstart{% 4156 \aboveenvbreak 4157 \inENV % This group ends at the end of the body 4158 \hfuzz = 12pt % Don't be fussy 4159 \sepspaces % Make spaces be word-separators rather than space tokens. 4160 \singlespace 4161 \let\par = \lisppar % don't ignore blank lines 4162 \obeylines % each line of input is a line of output 4163 \parskip = 0pt 4164 \parindent = 0pt 4165 \emergencystretch = 0pt % don't try to avoid overfull boxes 4166 % @cartouche defines \nonarrowing to inhibit narrowing 4167 % at next level down. 4168 \ifx\nonarrowing\relax 4169 \advance \leftskip by \lispnarrowing 4170 \exdentamount=\lispnarrowing 4171 \let\exdent=\nofillexdent 4172 \let\nonarrowing=\relax 4173 \fi 4174} 4175 4176% Define the \E... control sequence only if we are inside the particular 4177% environment, so the error checking in \end will work. 4178% 4179% To end an @example-like environment, we first end the paragraph (via 4180% \afterenvbreak's vertical glue), and then the group. That way we keep 4181% the zero \parskip that the environments set -- \parskip glue will be 4182% inserted at the beginning of the next paragraph in the document, after 4183% the environment. 4184% 4185\def\nonfillfinish{\afterenvbreak\endgroup} 4186 4187% @lisp: indented, narrowed, typewriter font. 4188\def\lisp{\begingroup 4189 \nonfillstart 4190 \let\Elisp = \nonfillfinish 4191 \tt 4192 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. 4193 \gobble % eat return 4194} 4195 4196% @example: Same as @lisp. 4197\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} 4198 4199% @small... is usually equivalent to the non-small (@smallbook 4200% redefines). We must call \example (or whatever) last in the 4201% definition, since it reads the return following the @example (or 4202% whatever) command. 4203% 4204% This actually allows (for example) @end display inside an 4205% @smalldisplay. Too bad, but makeinfo will catch the error anyway. 4206% 4207\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} 4208\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} 4209\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} 4210\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} 4211 4212% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. 4213% Originally contributed by Pavel@xerox. 4214\def\smalllispx{\begingroup 4215 \def\Esmalllisp{\nonfillfinish\endgroup}% 4216 \def\Esmallexample{\nonfillfinish\endgroup}% 4217 \smallfonts 4218 \lisp 4219} 4220 4221% @display: same as @lisp except keep current font. 4222% 4223\def\display{\begingroup 4224 \nonfillstart 4225 \let\Edisplay = \nonfillfinish 4226 \gobble 4227} 4228 4229% @smalldisplay (when @smallbook): @display plus smaller fonts. 4230% 4231\def\smalldisplayx{\begingroup 4232 \def\Esmalldisplay{\nonfillfinish\endgroup}% 4233 \smallfonts \rm 4234 \display 4235} 4236 4237% @format: same as @display except don't narrow margins. 4238% 4239\def\format{\begingroup 4240 \let\nonarrowing = t 4241 \nonfillstart 4242 \let\Eformat = \nonfillfinish 4243 \gobble 4244} 4245 4246% @smallformat (when @smallbook): @format plus smaller fonts. 4247% 4248\def\smallformatx{\begingroup 4249 \def\Esmallformat{\nonfillfinish\endgroup}% 4250 \smallfonts \rm 4251 \format 4252} 4253 4254% @flushleft (same as @format). 4255% 4256\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} 4257 4258% @flushright. 4259% 4260\def\flushright{\begingroup 4261 \let\nonarrowing = t 4262 \nonfillstart 4263 \let\Eflushright = \nonfillfinish 4264 \advance\leftskip by 0pt plus 1fill 4265 \gobble 4266} 4267 4268% @quotation does normal linebreaking (hence we can't use \nonfillstart) 4269% and narrows the margins. 4270% 4271\def\quotation{% 4272 \begingroup\inENV %This group ends at the end of the @quotation body 4273 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip 4274 \singlespace 4275 \parindent=0pt 4276 % We have retained a nonzero parskip for the environment, since we're 4277 % doing normal filling. So to avoid extra space below the environment... 4278 \def\Equotation{\parskip = 0pt \nonfillfinish}% 4279 % 4280 % @cartouche defines \nonarrowing to inhibit narrowing at next level down. 4281 \ifx\nonarrowing\relax 4282 \advance\leftskip by \lispnarrowing 4283 \advance\rightskip by \lispnarrowing 4284 \exdentamount = \lispnarrowing 4285 \let\nonarrowing = \relax 4286 \fi 4287} 4288 4289 4290\message{defuns,} 4291% @defun etc. 4292 4293% Allow user to change definition object font (\df) internally 4294\def\setdeffont #1 {\csname DEF#1\endcsname} 4295 4296\newskip\defbodyindent \defbodyindent=.4in 4297\newskip\defargsindent \defargsindent=50pt 4298\newskip\deftypemargin \deftypemargin=12pt 4299\newskip\deflastargmargin \deflastargmargin=18pt 4300 4301\newcount\parencount 4302% define \functionparens, which makes ( and ) and & do special things. 4303% \functionparens affects the group it is contained in. 4304\def\activeparens{% 4305\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active 4306\catcode`\[=\active \catcode`\]=\active} 4307 4308% Make control sequences which act like normal parenthesis chars. 4309\let\lparen = ( \let\rparen = ) 4310 4311{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) 4312 4313% Be sure that we always have a definition for `(', etc. For example, 4314% if the fn name has parens in it, \boldbrax will not be in effect yet, 4315% so TeX would otherwise complain about undefined control sequence. 4316\global\let(=\lparen \global\let)=\rparen 4317\global\let[=\lbrack \global\let]=\rbrack 4318 4319\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } 4320\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} 4321% This is used to turn on special parens 4322% but make & act ordinary (given that it's active). 4323\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} 4324 4325% Definitions of (, ) and & used in args for functions. 4326% This is the definition of ( outside of all parentheses. 4327\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested 4328 \global\advance\parencount by 1 4329} 4330% 4331% This is the definition of ( when already inside a level of parens. 4332\gdef\opnested{\char`\(\global\advance\parencount by 1 } 4333% 4334\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. 4335 % also in that case restore the outer-level definition of (. 4336 \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi 4337 \global\advance \parencount by -1 } 4338% If we encounter &foo, then turn on ()-hacking afterwards 4339\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } 4340% 4341\gdef\normalparens{\boldbrax\let&=\ampnr} 4342} % End of definition inside \activeparens 4343%% These parens (in \boldbrax) actually are a little bolder than the 4344%% contained text. This is especially needed for [ and ] 4345\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } 4346\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } 4347\let\ampnr = \& 4348\def\lbrb{{\bf\char`\[}} 4349\def\rbrb{{\bf\char`\]}} 4350 4351% Active &'s sneak into the index arguments, so make sure it's defined. 4352{ 4353 \catcode`& = 13 4354 \global\let& = \ampnr 4355} 4356 4357% First, defname, which formats the header line itself. 4358% #1 should be the function name. 4359% #2 should be the type of definition, such as "Function". 4360 4361\def\defname #1#2{% 4362% Get the values of \leftskip and \rightskip as they were 4363% outside the @def... 4364\dimen2=\leftskip 4365\advance\dimen2 by -\defbodyindent 4366\noindent 4367\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% 4368\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line 4369\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations 4370\parshape 2 0in \dimen0 \defargsindent \dimen1 4371% Now output arg 2 ("Function" or some such) 4372% ending at \deftypemargin from the right margin, 4373% but stuck inside a box of width 0 so it does not interfere with linebreaking 4374{% Adjust \hsize to exclude the ambient margins, 4375% so that \rightline will obey them. 4376\advance \hsize by -\dimen2 4377\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% 4378% Make all lines underfull and no complaints: 4379\tolerance=10000 \hbadness=10000 4380\advance\leftskip by -\defbodyindent 4381\exdentamount=\defbodyindent 4382{\df #1}\enskip % Generate function name 4383} 4384 4385% Actually process the body of a definition 4386% #1 should be the terminating control sequence, such as \Edefun. 4387% #2 should be the "another name" control sequence, such as \defunx. 4388% #3 should be the control sequence that actually processes the header, 4389% such as \defunheader. 4390 4391\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody 4392\medbreak % 4393% Define the end token that this defining construct specifies 4394% so that it will exit this group. 4395\def#1{\endgraf\endgroup\medbreak}% 4396\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% 4397\parindent=0in 4398\advance\leftskip by \defbodyindent 4399\exdentamount=\defbodyindent 4400\begingroup % 4401\catcode 61=\active % 61 is `=' 4402\obeylines\activeparens\spacesplit#3} 4403 4404% #1 is the \E... control sequence to end the definition (which we define). 4405% #2 is the \...x control sequence for consecutive fns (which we define). 4406% #3 is the control sequence to call to resume processing. 4407% #4, delimited by the space, is the class name. 4408% 4409\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % 4410\medbreak % 4411% Define the end token that this defining construct specifies 4412% so that it will exit this group. 4413\def#1{\endgraf\endgroup\medbreak}% 4414\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% 4415\parindent=0in 4416\advance\leftskip by \defbodyindent 4417\exdentamount=\defbodyindent 4418\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} 4419 4420% Used for @deftypemethod and @deftypeivar. 4421% #1 is the \E... control sequence to end the definition (which we define). 4422% #2 is the \...x control sequence for consecutive fns (which we define). 4423% #3 is the control sequence to call to resume processing. 4424% #4, delimited by a space, is the class name. 4425% #5 is the method's return type. 4426% 4427\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV 4428 \medbreak 4429 \def#1{\endgraf\endgroup\medbreak}% 4430 \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% 4431 \parindent=0in 4432 \advance\leftskip by \defbodyindent 4433 \exdentamount=\defbodyindent 4434 \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} 4435 4436% Used for @deftypeop. The change from \deftypemethparsebody is an 4437% extra argument at the beginning which is the `category', instead of it 4438% being the hardwired string `Method' or `Instance Variable'. We have 4439% to account for this both in the \...x definition and in parsing the 4440% input at hand. Thus also need a control sequence (passed as #5) for 4441% the \E... definition to assign the category name to. 4442% 4443\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV 4444 \medbreak 4445 \def#1{\endgraf\endgroup\medbreak}% 4446 \def#2##1 ##2 ##3 {% 4447 \def#4{##1}% 4448 \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}% 4449 \parindent=0in 4450 \advance\leftskip by \defbodyindent 4451 \exdentamount=\defbodyindent 4452 \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}} 4453 4454\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % 4455\medbreak % 4456% Define the end token that this defining construct specifies 4457% so that it will exit this group. 4458\def#1{\endgraf\endgroup\medbreak}% 4459\def#2##1 ##2 {\def#4{##1}% 4460\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% 4461\parindent=0in 4462\advance\leftskip by \defbodyindent 4463\exdentamount=\defbodyindent 4464\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} 4465 4466% These parsing functions are similar to the preceding ones 4467% except that they do not make parens into active characters. 4468% These are used for "variables" since they have no arguments. 4469 4470\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody 4471\medbreak % 4472% Define the end token that this defining construct specifies 4473% so that it will exit this group. 4474\def#1{\endgraf\endgroup\medbreak}% 4475\def#2{\begingroup\obeylines\spacesplit#3}% 4476\parindent=0in 4477\advance\leftskip by \defbodyindent 4478\exdentamount=\defbodyindent 4479\begingroup % 4480\catcode 61=\active % 4481\obeylines\spacesplit#3} 4482 4483% This is used for \def{tp,vr}parsebody. It could probably be used for 4484% some of the others, too, with some judicious conditionals. 4485% 4486\def\parsebodycommon#1#2#3{% 4487 \begingroup\inENV % 4488 \medbreak % 4489 % Define the end token that this defining construct specifies 4490 % so that it will exit this group. 4491 \def#1{\endgraf\endgroup\medbreak}% 4492 \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% 4493 \parindent=0in 4494 \advance\leftskip by \defbodyindent 4495 \exdentamount=\defbodyindent 4496 \begingroup\obeylines 4497} 4498 4499\def\defvrparsebody#1#2#3#4 {% 4500 \parsebodycommon{#1}{#2}{#3}% 4501 \spacesplit{#3{#4}}% 4502} 4503 4504% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the 4505% type is just `struct', because we lose the braces in `{struct 4506% termios}' when \spacesplit reads its undelimited argument. Sigh. 4507% \let\deftpparsebody=\defvrparsebody 4508% 4509% So, to get around this, we put \empty in with the type name. That 4510% way, TeX won't find exactly `{...}' as an undelimited argument, and 4511% won't strip off the braces. 4512% 4513\def\deftpparsebody #1#2#3#4 {% 4514 \parsebodycommon{#1}{#2}{#3}% 4515 \spacesplit{\parsetpheaderline{#3{#4}}}\empty 4516} 4517 4518% Fine, but then we have to eventually remove the \empty *and* the 4519% braces (if any). That's what this does. 4520% 4521\def\removeemptybraces\empty#1\relax{#1} 4522 4523% After \spacesplit has done its work, this is called -- #1 is the final 4524% thing to call, #2 the type name (which starts with \empty), and #3 4525% (which might be empty) the arguments. 4526% 4527\def\parsetpheaderline#1#2#3{% 4528 #1{\removeemptybraces#2\relax}{#3}% 4529}% 4530 4531\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % 4532\medbreak % 4533% Define the end token that this defining construct specifies 4534% so that it will exit this group. 4535\def#1{\endgraf\endgroup\medbreak}% 4536\def#2##1 ##2 {\def#4{##1}% 4537\begingroup\obeylines\spacesplit{#3{##2}}}% 4538\parindent=0in 4539\advance\leftskip by \defbodyindent 4540\exdentamount=\defbodyindent 4541\begingroup\obeylines\spacesplit{#3{#5}}} 4542 4543% Split up #2 at the first space token. 4544% call #1 with two arguments: 4545% the first is all of #2 before the space token, 4546% the second is all of #2 after that space token. 4547% If #2 contains no space token, all of it is passed as the first arg 4548% and the second is passed as empty. 4549 4550{\obeylines 4551\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% 4552\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% 4553\ifx\relax #3% 4554#1{#2}{}\else #1{#2}{#3#4}\fi}} 4555 4556% So much for the things common to all kinds of definitions. 4557 4558% Define @defun. 4559 4560% First, define the processing that is wanted for arguments of \defun 4561% Use this to expand the args and terminate the paragraph they make up 4562 4563\def\defunargs#1{\functionparens \sl 4564% Expand, preventing hyphenation at `-' chars. 4565% Note that groups don't affect changes in \hyphenchar. 4566% Set the font temporarily and use \font in case \setfont made \tensl a macro. 4567{\tensl\hyphenchar\font=0}% 4568#1% 4569{\tensl\hyphenchar\font=45}% 4570\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% 4571\interlinepenalty=10000 4572\advance\rightskip by 0pt plus 1fil 4573\endgraf\nobreak\vskip -\parskip\nobreak 4574} 4575 4576\def\deftypefunargs #1{% 4577% Expand, preventing hyphenation at `-' chars. 4578% Note that groups don't affect changes in \hyphenchar. 4579% Use \boldbraxnoamp, not \functionparens, so that & is not special. 4580\boldbraxnoamp 4581\tclose{#1}% avoid \code because of side effects on active chars 4582\interlinepenalty=10000 4583\advance\rightskip by 0pt plus 1fil 4584\endgraf\nobreak\vskip -\parskip\nobreak 4585} 4586 4587% Do complete processing of one @defun or @defunx line already parsed. 4588 4589% @deffn Command forward-char nchars 4590 4591\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} 4592 4593\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% 4594\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % 4595\catcode 61=\other % Turn off change made in \defparsebody 4596} 4597 4598% @defun == @deffn Function 4599 4600\def\defun{\defparsebody\Edefun\defunx\defunheader} 4601 4602\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4603\begingroup\defname {#1}{\putwordDeffunc}% 4604\defunargs {#2}\endgroup % 4605\catcode 61=\other % Turn off change made in \defparsebody 4606} 4607 4608% @deftypefun int foobar (int @var{foo}, float @var{bar}) 4609 4610\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} 4611 4612% #1 is the data type. #2 is the name and args. 4613\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} 4614% #1 is the data type, #2 the name, #3 the args. 4615\def\deftypefunheaderx #1#2 #3\relax{% 4616\doind {fn}{\code{#2}}% Make entry in function index 4617\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% 4618\deftypefunargs {#3}\endgroup % 4619\catcode 61=\other % Turn off change made in \defparsebody 4620} 4621 4622% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) 4623 4624\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} 4625 4626% \defheaderxcond#1\relax$$$ 4627% puts #1 in @code, followed by a space, but does nothing if #1 is null. 4628\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} 4629 4630% #1 is the classification. #2 is the data type. #3 is the name and args. 4631\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} 4632% #1 is the classification, #2 the data type, #3 the name, #4 the args. 4633\def\deftypefnheaderx #1#2#3 #4\relax{% 4634\doind {fn}{\code{#3}}% Make entry in function index 4635\begingroup 4636\normalparens % notably, turn off `&' magic, which prevents 4637% at least some C++ text from working 4638\defname {\defheaderxcond#2\relax$$$#3}{#1}% 4639\deftypefunargs {#4}\endgroup % 4640\catcode 61=\other % Turn off change made in \defparsebody 4641} 4642 4643% @defmac == @deffn Macro 4644 4645\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} 4646 4647\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4648\begingroup\defname {#1}{\putwordDefmac}% 4649\defunargs {#2}\endgroup % 4650\catcode 61=\other % Turn off change made in \defparsebody 4651} 4652 4653% @defspec == @deffn Special Form 4654 4655\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} 4656 4657\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4658\begingroup\defname {#1}{\putwordDefspec}% 4659\defunargs {#2}\endgroup % 4660\catcode 61=\other % Turn off change made in \defparsebody 4661} 4662 4663% @defop CATEGORY CLASS OPERATION ARG... 4664% 4665\def\defop #1 {\def\defoptype{#1}% 4666\defopparsebody\Edefop\defopx\defopheader\defoptype} 4667% 4668\def\defopheader#1#2#3{% 4669\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index 4670\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% 4671\defunargs {#3}\endgroup % 4672} 4673 4674% @deftypeop CATEGORY CLASS TYPE OPERATION ARG... 4675% 4676\def\deftypeop #1 {\def\deftypeopcategory{#1}% 4677 \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader 4678 \deftypeopcategory} 4679% 4680% #1 is the class name, #2 the data type, #3 the operation name, #4 the args. 4681\def\deftypeopheader#1#2#3#4{% 4682 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index 4683 \begingroup 4684 \defname{\defheaderxcond#2\relax$$$#3} 4685 {\deftypeopcategory\ \putwordon\ \code{#1}}% 4686 \deftypefunargs{#4}% 4687 \endgroup 4688} 4689 4690% @deftypemethod CLASS TYPE METHOD ARG... 4691% 4692\def\deftypemethod{% 4693 \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} 4694% 4695% #1 is the class name, #2 the data type, #3 the method name, #4 the args. 4696\def\deftypemethodheader#1#2#3#4{% 4697 \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index 4698 \begingroup 4699 \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% 4700 \deftypefunargs{#4}% 4701 \endgroup 4702} 4703 4704% @deftypeivar CLASS TYPE VARNAME 4705% 4706\def\deftypeivar{% 4707 \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} 4708% 4709% #1 is the class name, #2 the data type, #3 the variable name. 4710\def\deftypeivarheader#1#2#3{% 4711 \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index 4712 \begingroup 4713 \defname{#3}{\putwordInstanceVariableof\ \code{#1}}% 4714 \defvarargs{#3}% 4715 \endgroup 4716} 4717 4718% @defmethod == @defop Method 4719% 4720\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} 4721% 4722% #1 is the class name, #2 the method name, #3 the args. 4723\def\defmethodheader#1#2#3{% 4724 \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index 4725 \begingroup 4726 \defname{#2}{\putwordMethodon\ \code{#1}}% 4727 \defunargs{#3}% 4728 \endgroup 4729} 4730 4731% @defcv {Class Option} foo-class foo-flag 4732 4733\def\defcv #1 {\def\defcvtype{#1}% 4734\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} 4735 4736\def\defcvarheader #1#2#3{% 4737\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index 4738\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% 4739\defvarargs {#3}\endgroup % 4740} 4741 4742% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME 4743% 4744\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} 4745% 4746\def\defivarheader#1#2#3{% 4747 \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index 4748 \begingroup 4749 \defname{#2}{\putwordInstanceVariableof\ #1}% 4750 \defvarargs{#3}% 4751 \endgroup 4752} 4753 4754% @defvar 4755% First, define the processing that is wanted for arguments of @defvar. 4756% This is actually simple: just print them in roman. 4757% This must expand the args and terminate the paragraph they make up 4758\def\defvarargs #1{\normalparens #1% 4759\interlinepenalty=10000 4760\endgraf\nobreak\vskip -\parskip\nobreak} 4761 4762% @defvr Counter foo-count 4763 4764\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} 4765 4766\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% 4767\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} 4768 4769% @defvar == @defvr Variable 4770 4771\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} 4772 4773\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index 4774\begingroup\defname {#1}{\putwordDefvar}% 4775\defvarargs {#2}\endgroup % 4776} 4777 4778% @defopt == @defvr {User Option} 4779 4780\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} 4781 4782\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index 4783\begingroup\defname {#1}{\putwordDefopt}% 4784\defvarargs {#2}\endgroup % 4785} 4786 4787% @deftypevar int foobar 4788 4789\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} 4790 4791% #1 is the data type. #2 is the name, perhaps followed by text that 4792% is actually part of the data type, which should not be put into the index. 4793\def\deftypevarheader #1#2{% 4794\dovarind#2 \relax% Make entry in variables index 4795\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% 4796\interlinepenalty=10000 4797\endgraf\nobreak\vskip -\parskip\nobreak 4798\endgroup} 4799\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} 4800 4801% @deftypevr {Global Flag} int enable 4802 4803\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} 4804 4805\def\deftypevrheader #1#2#3{\dovarind#3 \relax% 4806\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} 4807\interlinepenalty=10000 4808\endgraf\nobreak\vskip -\parskip\nobreak 4809\endgroup} 4810 4811% Now define @deftp 4812% Args are printed in bold, a slight difference from @defvar. 4813 4814\def\deftpargs #1{\bf \defvarargs{#1}} 4815 4816% @deftp Class window height width ... 4817 4818\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} 4819 4820\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% 4821\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} 4822 4823% These definitions are used if you use @defunx (etc.) 4824% anywhere other than immediately after a @defun or @defunx. 4825% 4826\def\defcvx#1 {\errmessage{@defcvx in invalid context}} 4827\def\deffnx#1 {\errmessage{@deffnx in invalid context}} 4828\def\defivarx#1 {\errmessage{@defivarx in invalid context}} 4829\def\defmacx#1 {\errmessage{@defmacx in invalid context}} 4830\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} 4831\def\defoptx #1 {\errmessage{@defoptx in invalid context}} 4832\def\defopx#1 {\errmessage{@defopx in invalid context}} 4833\def\defspecx#1 {\errmessage{@defspecx in invalid context}} 4834\def\deftpx#1 {\errmessage{@deftpx in invalid context}} 4835\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} 4836\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} 4837\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} 4838\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} 4839\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} 4840\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} 4841\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} 4842\def\defunx#1 {\errmessage{@defunx in invalid context}} 4843\def\defvarx#1 {\errmessage{@defvarx in invalid context}} 4844\def\defvrx#1 {\errmessage{@defvrx in invalid context}} 4845 4846 4847\message{macros,} 4848% @macro. 4849 4850% To do this right we need a feature of e-TeX, \scantokens, 4851% which we arrange to emulate with a temporary file in ordinary TeX. 4852\ifx\eTeXversion\undefined 4853 \newwrite\macscribble 4854 \def\scanmacro#1{% 4855 \begingroup \newlinechar`\^^M 4856 % Undo catcode changes of \startcontents and \doprintindex 4857 \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ 4858 % Append \endinput to make sure that TeX does not see the ending newline. 4859 \toks0={#1\endinput}% 4860 \immediate\openout\macscribble=\jobname.tmp 4861 \immediate\write\macscribble{\the\toks0}% 4862 \immediate\closeout\macscribble 4863 \let\xeatspaces\eatspaces 4864 \input \jobname.tmp 4865 \endgroup 4866} 4867\else 4868\def\scanmacro#1{% 4869\begingroup \newlinechar`\^^M 4870% Undo catcode changes of \startcontents and \doprintindex 4871\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ 4872\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} 4873\fi 4874 4875\newcount\paramno % Count of parameters 4876\newtoks\macname % Macro name 4877\newif\ifrecursive % Is it recursive? 4878\def\macrolist{} % List of all defined macros in the form 4879 % \do\macro1\do\macro2... 4880 4881% Utility routines. 4882% Thisdoes \let #1 = #2, except with \csnames. 4883\def\cslet#1#2{% 4884\expandafter\expandafter 4885\expandafter\let 4886\expandafter\expandafter 4887\csname#1\endcsname 4888\csname#2\endcsname} 4889 4890% Trim leading and trailing spaces off a string. 4891% Concepts from aro-bend problem 15 (see CTAN). 4892{\catcode`\@=11 4893\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} 4894\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} 4895\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} 4896\def\unbrace#1{#1} 4897\unbrace{\gdef\trim@@@ #1 } #2@{#1} 4898} 4899 4900% Trim a single trailing ^^M off a string. 4901{\catcode`\^^M=12\catcode`\Q=3% 4902\gdef\eatcr #1{\eatcra #1Q^^MQ}% 4903\gdef\eatcra#1^^MQ{\eatcrb#1Q}% 4904\gdef\eatcrb#1Q#2Q{#1}% 4905} 4906 4907% Macro bodies are absorbed as an argument in a context where 4908% all characters are catcode 10, 11 or 12, except \ which is active 4909% (as in normal texinfo). It is necessary to change the definition of \. 4910 4911% It's necessary to have hard CRs when the macro is executed. This is 4912% done by making ^^M (\endlinechar) catcode 12 when reading the macro 4913% body, and then making it the \newlinechar in \scanmacro. 4914 4915\def\macrobodyctxt{% 4916 \catcode`\~=12 4917 \catcode`\^=12 4918 \catcode`\_=12 4919 \catcode`\|=12 4920 \catcode`\<=12 4921 \catcode`\>=12 4922 \catcode`\+=12 4923 \catcode`\{=12 4924 \catcode`\}=12 4925 \catcode`\@=12 4926 \catcode`\^^M=12 4927 \usembodybackslash} 4928 4929\def\macroargctxt{% 4930 \catcode`\~=12 4931 \catcode`\^=12 4932 \catcode`\_=12 4933 \catcode`\|=12 4934 \catcode`\<=12 4935 \catcode`\>=12 4936 \catcode`\+=12 4937 \catcode`\@=12 4938 \catcode`\\=12} 4939 4940% \mbodybackslash is the definition of \ in @macro bodies. 4941% It maps \foo\ => \csname macarg.foo\endcsname => #N 4942% where N is the macro parameter number. 4943% We define \csname macarg.\endcsname to be \realbackslash, so 4944% \\ in macro replacement text gets you a backslash. 4945 4946{\catcode`@=0 @catcode`@\=@active 4947 @gdef@usembodybackslash{@let\=@mbodybackslash} 4948 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} 4949} 4950\expandafter\def\csname macarg.\endcsname{\realbackslash} 4951 4952\def\macro{\recursivefalse\parsearg\macroxxx} 4953\def\rmacro{\recursivetrue\parsearg\macroxxx} 4954 4955\def\macroxxx#1{% 4956 \getargs{#1}% now \macname is the macname and \argl the arglist 4957 \ifx\argl\empty % no arguments 4958 \paramno=0% 4959 \else 4960 \expandafter\parsemargdef \argl;% 4961 \fi 4962 \if1\csname ismacro.\the\macname\endcsname 4963 \message{Warning: redefining \the\macname}% 4964 \else 4965 \expandafter\ifx\csname \the\macname\endcsname \relax 4966 \else \errmessage{The name \the\macname\space is reserved}\fi 4967 \global\cslet{macsave.\the\macname}{\the\macname}% 4968 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% 4969 % Add the macroname to \macrolist 4970 \toks0 = \expandafter{\macrolist\do}% 4971 \xdef\macrolist{\the\toks0 4972 \expandafter\noexpand\csname\the\macname\endcsname}% 4973 \fi 4974 \begingroup \macrobodyctxt 4975 \ifrecursive \expandafter\parsermacbody 4976 \else \expandafter\parsemacbody 4977 \fi} 4978 4979\def\unmacro{\parsearg\unmacroxxx} 4980\def\unmacroxxx#1{% 4981 \if1\csname ismacro.#1\endcsname 4982 \global\cslet{#1}{macsave.#1}% 4983 \global\expandafter\let \csname ismacro.#1\endcsname=0% 4984 % Remove the macro name from \macrolist 4985 \begingroup 4986 \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% 4987 \def\do##1{% 4988 \def\tempb{##1}% 4989 \ifx\tempa\tempb 4990 % remove this 4991 \else 4992 \toks0 = \expandafter{\newmacrolist\do}% 4993 \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% 4994 \fi}% 4995 \def\newmacrolist{}% 4996 % Execute macro list to define \newmacrolist 4997 \macrolist 4998 \global\let\macrolist\newmacrolist 4999 \endgroup 5000 \else 5001 \errmessage{Macro #1 not defined}% 5002 \fi 5003} 5004 5005% This makes use of the obscure feature that if the last token of a 5006% <parameter list> is #, then the preceding argument is delimited by 5007% an opening brace, and that opening brace is not consumed. 5008\def\getargs#1{\getargsxxx#1{}} 5009\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} 5010\def\getmacname #1 #2\relax{\macname={#1}} 5011\def\getmacargs#1{\def\argl{#1}} 5012 5013% Parse the optional {params} list. Set up \paramno and \paramlist 5014% so \defmacro knows what to do. Define \macarg.blah for each blah 5015% in the params list, to be ##N where N is the position in that list. 5016% That gets used by \mbodybackslash (above). 5017 5018% We need to get `macro parameter char #' into several definitions. 5019% The technique used is stolen from LaTeX: let \hash be something 5020% unexpandable, insert that wherever you need a #, and then redefine 5021% it to # just before using the token list produced. 5022% 5023% The same technique is used to protect \eatspaces till just before 5024% the macro is used. 5025 5026\def\parsemargdef#1;{\paramno=0\def\paramlist{}% 5027 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} 5028\def\parsemargdefxxx#1,{% 5029 \if#1;\let\next=\relax 5030 \else \let\next=\parsemargdefxxx 5031 \advance\paramno by 1% 5032 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname 5033 {\xeatspaces{\hash\the\paramno}}% 5034 \edef\paramlist{\paramlist\hash\the\paramno,}% 5035 \fi\next} 5036 5037% These two commands read recursive and nonrecursive macro bodies. 5038% (They're different since rec and nonrec macros end differently.) 5039 5040\long\def\parsemacbody#1@end macro% 5041{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% 5042\long\def\parsermacbody#1@end rmacro% 5043{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% 5044 5045% This defines the macro itself. There are six cases: recursive and 5046% nonrecursive macros of zero, one, and many arguments. 5047% Much magic with \expandafter here. 5048% \xdef is used so that macro definitions will survive the file 5049% they're defined in; @include reads the file inside a group. 5050\def\defmacro{% 5051 \let\hash=##% convert placeholders to macro parameter chars 5052 \ifrecursive 5053 \ifcase\paramno 5054 % 0 5055 \expandafter\xdef\csname\the\macname\endcsname{% 5056 \noexpand\scanmacro{\temp}}% 5057 \or % 1 5058 \expandafter\xdef\csname\the\macname\endcsname{% 5059 \bgroup\noexpand\macroargctxt 5060 \noexpand\braceorline 5061 \expandafter\noexpand\csname\the\macname xxx\endcsname}% 5062 \expandafter\xdef\csname\the\macname xxx\endcsname##1{% 5063 \egroup\noexpand\scanmacro{\temp}}% 5064 \else % many 5065 \expandafter\xdef\csname\the\macname\endcsname{% 5066 \bgroup\noexpand\macroargctxt 5067 \noexpand\csname\the\macname xx\endcsname}% 5068 \expandafter\xdef\csname\the\macname xx\endcsname##1{% 5069 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% 5070 \expandafter\expandafter 5071 \expandafter\xdef 5072 \expandafter\expandafter 5073 \csname\the\macname xxx\endcsname 5074 \paramlist{\egroup\noexpand\scanmacro{\temp}}% 5075 \fi 5076 \else 5077 \ifcase\paramno 5078 % 0 5079 \expandafter\xdef\csname\the\macname\endcsname{% 5080 \noexpand\norecurse{\the\macname}% 5081 \noexpand\scanmacro{\temp}\egroup}% 5082 \or % 1 5083 \expandafter\xdef\csname\the\macname\endcsname{% 5084 \bgroup\noexpand\macroargctxt 5085 \noexpand\braceorline 5086 \expandafter\noexpand\csname\the\macname xxx\endcsname}% 5087 \expandafter\xdef\csname\the\macname xxx\endcsname##1{% 5088 \egroup 5089 \noexpand\norecurse{\the\macname}% 5090 \noexpand\scanmacro{\temp}\egroup}% 5091 \else % many 5092 \expandafter\xdef\csname\the\macname\endcsname{% 5093 \bgroup\noexpand\macroargctxt 5094 \expandafter\noexpand\csname\the\macname xx\endcsname}% 5095 \expandafter\xdef\csname\the\macname xx\endcsname##1{% 5096 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% 5097 \expandafter\expandafter 5098 \expandafter\xdef 5099 \expandafter\expandafter 5100 \csname\the\macname xxx\endcsname 5101 \paramlist{% 5102 \egroup 5103 \noexpand\norecurse{\the\macname}% 5104 \noexpand\scanmacro{\temp}\egroup}% 5105 \fi 5106 \fi} 5107 5108\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} 5109 5110% \braceorline decides whether the next nonwhitespace character is a 5111% {. If so it reads up to the closing }, if not, it reads the whole 5112% line. Whatever was read is then fed to the next control sequence 5113% as an argument (by \parsebrace or \parsearg) 5114\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} 5115\def\braceorlinexxx{% 5116 \ifx\nchar\bgroup\else 5117 \expandafter\parsearg 5118 \fi \next} 5119 5120% We mant to disable all macros during \shipout so that they are not 5121% expanded by \write. 5122\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% 5123 \edef\next{\macrolist}\expandafter\endgroup\next} 5124 5125 5126% @alias. 5127% We need some trickery to remove the optional spaces around the equal 5128% sign. Just make them active and then expand them all to nothing. 5129\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx} 5130\def\aliasxxx #1{\aliasyyy#1\relax} 5131\def\aliasyyy #1=#2\relax{\ignoreactivespaces 5132\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=% 5133 \expandafter\noexpand\csname#2\endcsname}% 5134\expandafter\endgroup\next} 5135 5136 5137\message{cross references,} 5138% @xref etc. 5139 5140\newwrite\auxfile 5141 5142\newif\ifhavexrefs % True if xref values are known. 5143\newif\ifwarnedxrefs % True if we warned once that they aren't known. 5144 5145% @inforef is relatively simple. 5146\def\inforef #1{\inforefzzz #1,,,,**} 5147\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, 5148 node \samp{\ignorespaces#1{}}} 5149 5150% @node's job is to define \lastnode. 5151\def\node{\ENVcheck\parsearg\nodezzz} 5152\def\nodezzz#1{\nodexxx [#1,]} 5153\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} 5154\let\nwnode=\node 5155\let\lastnode=\relax 5156 5157% The sectioning commands (@chapter, etc.) call these. 5158\def\donoderef{% 5159 \ifx\lastnode\relax\else 5160 \expandafter\expandafter\expandafter\setref{\lastnode}% 5161 {Ysectionnumberandtype}% 5162 \global\let\lastnode=\relax 5163 \fi 5164} 5165\def\unnumbnoderef{% 5166 \ifx\lastnode\relax\else 5167 \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% 5168 \global\let\lastnode=\relax 5169 \fi 5170} 5171\def\appendixnoderef{% 5172 \ifx\lastnode\relax\else 5173 \expandafter\expandafter\expandafter\setref{\lastnode}% 5174 {Yappendixletterandtype}% 5175 \global\let\lastnode=\relax 5176 \fi 5177} 5178 5179 5180% @anchor{NAME} -- define xref target at arbitrary point. 5181% 5182\newcount\savesfregister 5183\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} 5184\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} 5185\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} 5186 5187% \setref{NAME}{SNT} defines a cross-reference point NAME, namely 5188% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have 5189% to set \indexdummies so commands such as @code in a section title 5190% aren't expanded. It would be nicer not to expand the titles in the 5191% first place, but there's so many layers that that is hard to do. 5192% 5193\def\setref#1#2{{% 5194 \indexdummies 5195 \pdfmkdest{#1}% 5196 \dosetq{#1-title}{Ytitle}% 5197 \dosetq{#1-pg}{Ypagenumber}% 5198 \dosetq{#1-snt}{#2}% 5199}} 5200 5201% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is 5202% the node name, #2 the name of the Info cross-reference, #3 the printed 5203% node name, #4 the name of the Info file, #5 the name of the printed 5204% manual. All but the node name can be omitted. 5205% 5206\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} 5207\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} 5208\def\ref#1{\xrefX[#1,,,,,,,]} 5209\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup 5210 \unsepspaces 5211 \def\printedmanual{\ignorespaces #5}% 5212 \def\printednodename{\ignorespaces #3}% 5213 \setbox1=\hbox{\printedmanual}% 5214 \setbox0=\hbox{\printednodename}% 5215 \ifdim \wd0 = 0pt 5216 % No printed node name was explicitly given. 5217 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax 5218 % Use the node name inside the square brackets. 5219 \def\printednodename{\ignorespaces #1}% 5220 \else 5221 % Use the actual chapter/section title appear inside 5222 % the square brackets. Use the real section title if we have it. 5223 \ifdim \wd1 > 0pt 5224 % It is in another manual, so we don't have it. 5225 \def\printednodename{\ignorespaces #1}% 5226 \else 5227 \ifhavexrefs 5228 % We know the real title if we have the xref values. 5229 \def\printednodename{\refx{#1-title}{}}% 5230 \else 5231 % Otherwise just copy the Info node name. 5232 \def\printednodename{\ignorespaces #1}% 5233 \fi% 5234 \fi 5235 \fi 5236 \fi 5237 % 5238 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not 5239 % insert empty discretionaries after hyphens, which means that it will 5240 % not find a line break at a hyphen in a node names. Since some manuals 5241 % are best written with fairly long node names, containing hyphens, this 5242 % is a loss. Therefore, we give the text of the node name again, so it 5243 % is as if TeX is seeing it for the first time. 5244 \ifpdf 5245 \leavevmode 5246 \getfilename{#4}% 5247 \ifnum\filenamelength>0 5248 \startlink attr{/Border [0 0 0]}% 5249 goto file{\the\filename.pdf} name{#1@}% 5250 \else 5251 \startlink attr{/Border [0 0 0]}% 5252 goto name{#1@}% 5253 \fi 5254 \linkcolor 5255 \fi 5256 % 5257 \ifdim \wd1 > 0pt 5258 \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% 5259 \else 5260 % _ (for example) has to be the character _ for the purposes of the 5261 % control sequence corresponding to the node, but it has to expand 5262 % into the usual \leavevmode...\vrule stuff for purposes of 5263 % printing. So we \turnoffactive for the \refx-snt, back on for the 5264 % printing, back off for the \refx-pg. 5265 {\normalturnoffactive 5266 % Only output a following space if the -snt ref is nonempty; for 5267 % @unnumbered and @anchor, it won't be. 5268 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% 5269 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi 5270 }% 5271 % [mynode], 5272 [\printednodename],\space 5273 % page 3 5274 \turnoffactive \putwordpage\tie\refx{#1-pg}{}% 5275 \fi 5276 \endlink 5277\endgroup} 5278 5279% \dosetq is the interface for calls from other macros 5280 5281% Use \normalturnoffactive so that punctuation chars such as underscore 5282% and backslash work in node names. (\turnoffactive doesn't do \.) 5283\def\dosetq#1#2{% 5284 {\let\folio=0% 5285 \normalturnoffactive 5286 \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% 5287 \iflinks 5288 \next 5289 \fi 5290 }% 5291} 5292 5293% \internalsetq {foo}{page} expands into 5294% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} 5295% When the aux file is read, ' is the escape character 5296 5297\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} 5298 5299% Things to be expanded by \internalsetq 5300 5301\def\Ypagenumber{\folio} 5302 5303\def\Ytitle{\thissection} 5304 5305\def\Ynothing{} 5306 5307\def\Ysectionnumberandtype{% 5308\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % 5309\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % 5310\else \ifnum \subsubsecno=0 % 5311\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % 5312\else % 5313\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % 5314\fi \fi \fi } 5315 5316\def\Yappendixletterandtype{% 5317\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% 5318\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % 5319\else \ifnum \subsubsecno=0 % 5320\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % 5321\else % 5322\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % 5323\fi \fi \fi } 5324 5325\gdef\xreftie{'tie} 5326 5327% Use TeX 3.0's \inputlineno to get the line number, for better error 5328% messages, but if we're using an old version of TeX, don't do anything. 5329% 5330\ifx\inputlineno\thisisundefined 5331 \let\linenumber = \empty % Non-3.0. 5332\else 5333 \def\linenumber{\the\inputlineno:\space} 5334\fi 5335 5336% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. 5337% If its value is nonempty, SUFFIX is output afterward. 5338 5339\def\refx#1#2{% 5340 \expandafter\ifx\csname X#1\endcsname\relax 5341 % If not defined, say something at least. 5342 \angleleft un\-de\-fined\angleright 5343 \iflinks 5344 \ifhavexrefs 5345 \message{\linenumber Undefined cross reference `#1'.}% 5346 \else 5347 \ifwarnedxrefs\else 5348 \global\warnedxrefstrue 5349 \message{Cross reference values unknown; you must run TeX again.}% 5350 \fi 5351 \fi 5352 \fi 5353 \else 5354 % It's defined, so just use it. 5355 \csname X#1\endcsname 5356 \fi 5357 #2% Output the suffix in any case. 5358} 5359 5360% This is the macro invoked by entries in the aux file. 5361% 5362\def\xrdef#1{\begingroup 5363 % Reenable \ as an escape while reading the second argument. 5364 \catcode`\\ = 0 5365 \afterassignment\endgroup 5366 \expandafter\gdef\csname X#1\endcsname 5367} 5368 5369% Read the last existing aux file, if any. No error if none exists. 5370\def\readauxfile{\begingroup 5371 \catcode`\^^@=\other 5372 \catcode`\^^A=\other 5373 \catcode`\^^B=\other 5374 \catcode`\^^C=\other 5375 \catcode`\^^D=\other 5376 \catcode`\^^E=\other 5377 \catcode`\^^F=\other 5378 \catcode`\^^G=\other 5379 \catcode`\^^H=\other 5380 \catcode`\^^K=\other 5381 \catcode`\^^L=\other 5382 \catcode`\^^N=\other 5383 \catcode`\^^P=\other 5384 \catcode`\^^Q=\other 5385 \catcode`\^^R=\other 5386 \catcode`\^^S=\other 5387 \catcode`\^^T=\other 5388 \catcode`\^^U=\other 5389 \catcode`\^^V=\other 5390 \catcode`\^^W=\other 5391 \catcode`\^^X=\other 5392 \catcode`\^^Z=\other 5393 \catcode`\^^[=\other 5394 \catcode`\^^\=\other 5395 \catcode`\^^]=\other 5396 \catcode`\^^^=\other 5397 \catcode`\^^_=\other 5398 \catcode`\@=\other 5399 \catcode`\^=\other 5400 % It was suggested to define this as 7, which would allow ^^e4 etc. 5401 % in xref tags, i.e., node names. But since ^^e4 notation isn't 5402 % supported in the main text, it doesn't seem desirable. Furthermore, 5403 % that is not enough: for node names that actually contain a ^ 5404 % character, we would end up writing a line like this: 'xrdef {'hat 5405 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first 5406 % argument, and \hat is not an expandable control sequence. It could 5407 % all be worked out, but why? Either we support ^^ or we don't. 5408 % 5409 % The other change necessary for this was to define \auxhat: 5410 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter 5411 % and then to call \auxhat in \setq. 5412 % 5413 \catcode`\~=\other 5414 \catcode`\[=\other 5415 \catcode`\]=\other 5416 \catcode`\"=\other 5417 \catcode`\_=\other 5418 \catcode`\|=\other 5419 \catcode`\<=\other 5420 \catcode`\>=\other 5421 \catcode`\$=\other 5422 \catcode`\#=\other 5423 \catcode`\&=\other 5424 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off 5425 % Make the characters 128-255 be printing characters 5426 {% 5427 \count 1=128 5428 \def\loop{% 5429 \catcode\count 1=\other 5430 \advance\count 1 by 1 5431 \ifnum \count 1<256 \loop \fi 5432 }% 5433 }% 5434 % The aux file uses ' as the escape (for now). 5435 % Turn off \ as an escape so we do not lose on 5436 % entries which were dumped with control sequences in their names. 5437 % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ 5438 % Reference to such entries still does not work the way one would wish, 5439 % but at least they do not bomb out when the aux file is read in. 5440 \catcode`\{=1 5441 \catcode`\}=2 5442 \catcode`\%=\other 5443 \catcode`\'=0 5444 \catcode`\\=\other 5445 % 5446 \openin 1 \jobname.aux 5447 \ifeof 1 \else 5448 \closein 1 5449 \input \jobname.aux 5450 \global\havexrefstrue 5451 \global\warnedobstrue 5452 \fi 5453 % Open the new aux file. TeX will close it automatically at exit. 5454 \openout\auxfile=\jobname.aux 5455\endgroup} 5456 5457 5458% Footnotes. 5459 5460\newcount \footnoteno 5461 5462% The trailing space in the following definition for supereject is 5463% vital for proper filling; pages come out unaligned when you do a 5464% pagealignmacro call if that space before the closing brace is 5465% removed. (Generally, numeric constants should always be followed by a 5466% space to prevent strange expansion errors.) 5467\def\supereject{\par\penalty -20000\footnoteno =0 } 5468 5469% @footnotestyle is meaningful for info output only. 5470\let\footnotestyle=\comment 5471 5472\let\ptexfootnote=\footnote 5473 5474{\catcode `\@=11 5475% 5476% Auto-number footnotes. Otherwise like plain. 5477\gdef\footnote{% 5478 \global\advance\footnoteno by \@ne 5479 \edef\thisfootno{$^{\the\footnoteno}$}% 5480 % 5481 % In case the footnote comes at the end of a sentence, preserve the 5482 % extra spacing after we do the footnote number. 5483 \let\@sf\empty 5484 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi 5485 % 5486 % Remove inadvertent blank space before typesetting the footnote number. 5487 \unskip 5488 \thisfootno\@sf 5489 \footnotezzz 5490}% 5491 5492% Don't bother with the trickery in plain.tex to not require the 5493% footnote text as a parameter. Our footnotes don't need to be so general. 5494% 5495% Oh yes, they do; otherwise, @ifset and anything else that uses 5496% \parseargline fail inside footnotes because the tokens are fixed when 5497% the footnote is read. --karl, 16nov96. 5498% 5499\long\gdef\footnotezzz{\insert\footins\bgroup 5500 % We want to typeset this text as a normal paragraph, even if the 5501 % footnote reference occurs in (for example) a display environment. 5502 % So reset some parameters. 5503 \interlinepenalty\interfootnotelinepenalty 5504 \splittopskip\ht\strutbox % top baseline for broken footnotes 5505 \splitmaxdepth\dp\strutbox 5506 \floatingpenalty\@MM 5507 \leftskip\z@skip 5508 \rightskip\z@skip 5509 \spaceskip\z@skip 5510 \xspaceskip\z@skip 5511 \parindent\defaultparindent 5512 % 5513 \smallfonts \rm 5514 % 5515 % Hang the footnote text off the number. 5516 \hang 5517 \textindent{\thisfootno}% 5518 % 5519 % Don't crash into the line above the footnote text. Since this 5520 % expands into a box, it must come within the paragraph, lest it 5521 % provide a place where TeX can split the footnote. 5522 \footstrut 5523 \futurelet\next\fo@t 5524} 5525\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t 5526 \else\let\next\f@t\fi \next} 5527\def\f@@t{\bgroup\aftergroup\@foot\let\next} 5528\def\f@t#1{#1\@foot} 5529\def\@foot{\strut\par\egroup} 5530 5531}%end \catcode `\@=11 5532 5533% Set the baselineskip to #1, and the lineskip and strut size 5534% correspondingly. There is no deep meaning behind these magic numbers 5535% used as factors; they just match (closely enough) what Knuth defined. 5536% 5537\def\lineskipfactor{.08333} 5538\def\strutheightpercent{.70833} 5539\def\strutdepthpercent {.29167} 5540% 5541\def\setleading#1{% 5542 \normalbaselineskip = #1\relax 5543 \normallineskip = \lineskipfactor\normalbaselineskip 5544 \normalbaselines 5545 \setbox\strutbox =\hbox{% 5546 \vrule width0pt height\strutheightpercent\baselineskip 5547 depth \strutdepthpercent \baselineskip 5548 }% 5549} 5550 5551% @| inserts a changebar to the left of the current line. It should 5552% surround any changed text. This approach does *not* work if the 5553% change spans more than two lines of output. To handle that, we would 5554% have adopt a much more difficult approach (putting marks into the main 5555% vertical list for the beginning and end of each change). 5556% 5557\def\|{% 5558 % \vadjust can only be used in horizontal mode. 5559 \leavevmode 5560 % 5561 % Append this vertical mode material after the current line in the output. 5562 \vadjust{% 5563 % We want to insert a rule with the height and depth of the current 5564 % leading; that is exactly what \strutbox is supposed to record. 5565 \vskip-\baselineskip 5566 % 5567 % \vadjust-items are inserted at the left edge of the type. So 5568 % the \llap here moves out into the left-hand margin. 5569 \llap{% 5570 % 5571 % For a thicker or thinner bar, change the `1pt'. 5572 \vrule height\baselineskip width1pt 5573 % 5574 % This is the space between the bar and the text. 5575 \hskip 12pt 5576 }% 5577 }% 5578} 5579 5580% For a final copy, take out the rectangles 5581% that mark overfull boxes (in case you have decided 5582% that the text looks ok even though it passes the margin). 5583% 5584\def\finalout{\overfullrule=0pt} 5585 5586% @image. We use the macros from epsf.tex to support this. 5587% If epsf.tex is not installed and @image is used, we complain. 5588% 5589% Check for and read epsf.tex up front. If we read it only at @image 5590% time, we might be inside a group, and then its definitions would get 5591% undone and the next image would fail. 5592\openin 1 = epsf.tex 5593\ifeof 1 \else 5594 \closein 1 5595 % Do not bother showing banner with post-v2.7 epsf.tex (available in 5596 % doc/epsf.tex until it shows up on ctan). 5597 \def\epsfannounce{\toks0 = }% 5598 \input epsf.tex 5599\fi 5600% 5601% We will only complain once about lack of epsf.tex. 5602\newif\ifwarnednoepsf 5603\newhelp\noepsfhelp{epsf.tex must be installed for images to 5604 work. It is also included in the Texinfo distribution, or you can get 5605 it from ftp://tug.org/tex/epsf.tex.} 5606% 5607\def\image#1{% 5608 \ifx\epsfbox\undefined 5609 \ifwarnednoepsf \else 5610 \errhelp = \noepsfhelp 5611 \errmessage{epsf.tex not found, images will be ignored}% 5612 \global\warnednoepsftrue 5613 \fi 5614 \else 5615 \imagexxx #1,,,\finish 5616 \fi 5617} 5618% 5619% Arguments to @image: 5620% #1 is (mandatory) image filename; we tack on .eps extension. 5621% #2 is (optional) width, #3 is (optional) height. 5622% #4 is just the usual extra ignored arg for parsing this stuff. 5623\def\imagexxx#1,#2,#3,#4\finish{% 5624 \ifpdf 5625 \centerline{\dopdfimage{#1}{#2}{#3}}% 5626 \else 5627 % \epsfbox itself resets \epsf?size at each figure. 5628 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi 5629 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi 5630 \begingroup 5631 \catcode`\^^M = 5 % in case we're inside an example 5632 % If the image is by itself, center it. 5633 \ifvmode 5634 \nobreak\bigskip 5635 % Usually we'll have text after the image which will insert 5636 % \parskip glue, so insert it here too to equalize the space 5637 % above and below. 5638 \nobreak\vskip\parskip 5639 \nobreak 5640 \centerline{\epsfbox{#1.eps}}% 5641 \bigbreak 5642 \else 5643 % In the middle of a paragraph, no extra space. 5644 \epsfbox{#1.eps}% 5645 \fi 5646 \endgroup 5647 \fi 5648} 5649 5650 5651\message{localization,} 5652% and i18n. 5653 5654% @documentlanguage is usually given very early, just after 5655% @setfilename. If done too late, it may not override everything 5656% properly. Single argument is the language abbreviation. 5657% It would be nice if we could set up a hyphenation file here. 5658% 5659\def\documentlanguage{\parsearg\dodocumentlanguage} 5660\def\dodocumentlanguage#1{% 5661 \tex % read txi-??.tex file in plain TeX. 5662 % Read the file if it exists. 5663 \openin 1 txi-#1.tex 5664 \ifeof1 5665 \errhelp = \nolanghelp 5666 \errmessage{Cannot read language file txi-#1.tex}% 5667 \let\temp = \relax 5668 \else 5669 \def\temp{\input txi-#1.tex }% 5670 \fi 5671 \temp 5672 \endgroup 5673} 5674\newhelp\nolanghelp{The given language definition file cannot be found or 5675is empty. Maybe you need to install it? In the current directory 5676should work if nowhere else does.} 5677 5678 5679% @documentencoding should change something in TeX eventually, most 5680% likely, but for now just recognize it. 5681\let\documentencoding = \comment 5682 5683 5684% Page size parameters. 5685% 5686\newdimen\defaultparindent \defaultparindent = 15pt 5687 5688\chapheadingskip = 15pt plus 4pt minus 2pt 5689\secheadingskip = 12pt plus 3pt minus 2pt 5690\subsecheadingskip = 9pt plus 2pt minus 2pt 5691 5692% Prevent underfull vbox error messages. 5693\vbadness = 10000 5694 5695% Don't be so finicky about underfull hboxes, either. 5696\hbadness = 2000 5697 5698% Following George Bush, just get rid of widows and orphans. 5699\widowpenalty=10000 5700\clubpenalty=10000 5701 5702% Use TeX 3.0's \emergencystretch to help line breaking, but if we're 5703% using an old version of TeX, don't do anything. We want the amount of 5704% stretch added to depend on the line length, hence the dependence on 5705% \hsize. We call this whenever the paper size is set. 5706% 5707\def\setemergencystretch{% 5708 \ifx\emergencystretch\thisisundefined 5709 % Allow us to assign to \emergencystretch anyway. 5710 \def\emergencystretch{\dimen0}% 5711 \else 5712 \emergencystretch = .15\hsize 5713 \fi 5714} 5715 5716% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; 5717% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can 5718% set \parskip and call \setleading for \baselineskip. 5719% 5720\def\internalpagesizes#1#2#3#4#5#6{% 5721 \voffset = #3\relax 5722 \topskip = #6\relax 5723 \splittopskip = \topskip 5724 % 5725 \vsize = #1\relax 5726 \advance\vsize by \topskip 5727 \outervsize = \vsize 5728 \advance\outervsize by 2\topandbottommargin 5729 \pageheight = \vsize 5730 % 5731 \hsize = #2\relax 5732 \outerhsize = \hsize 5733 \advance\outerhsize by 0.5in 5734 \pagewidth = \hsize 5735 % 5736 \normaloffset = #4\relax 5737 \bindingoffset = #5\relax 5738 % 5739 \parindent = \defaultparindent 5740 \setemergencystretch 5741} 5742 5743% @letterpaper (the default). 5744\def\letterpaper{{\globaldefs = 1 5745 \parskip = 3pt plus 2pt minus 1pt 5746 \setleading{13.2pt}% 5747 % 5748 % If page is nothing but text, make it come out even. 5749 \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% 5750}} 5751 5752% Use @smallbook to reset parameters for 7x9.5 (or so) format. 5753\def\smallbook{{\globaldefs = 1 5754 \parskip = 2pt plus 1pt 5755 \setleading{12pt}% 5756 % 5757 \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% 5758 % 5759 \lispnarrowing = 0.3in 5760 \tolerance = 700 5761 \hfuzz = 1pt 5762 \contentsrightmargin = 0pt 5763 \deftypemargin = 0pt 5764 \defbodyindent = .5cm 5765 % 5766 \let\smalldisplay = \smalldisplayx 5767 \let\smallexample = \smalllispx 5768 \let\smallformat = \smallformatx 5769 \let\smalllisp = \smalllispx 5770}} 5771 5772% Use @afourpaper to print on European A4 paper. 5773\def\afourpaper{{\globaldefs = 1 5774 \setleading{12pt}% 5775 \parskip = 3pt plus 2pt minus 1pt 5776 % 5777 \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% 5778 % 5779 \tolerance = 700 5780 \hfuzz = 1pt 5781}} 5782 5783% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin 5784% 29mm, hence bottom margin 28mm, nominal side margin 3cm. 5785\def\afourlatex{{\globaldefs = 1 5786 \setleading{13.6pt}% 5787 % 5788 \afourpaper 5789 \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% 5790 % 5791 \globaldefs = 0 5792}} 5793 5794% Use @afourwide to print on European A4 paper in wide format. 5795\def\afourwide{% 5796 \afourpaper 5797 \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% 5798 % 5799 \globaldefs = 0 5800} 5801 5802% @pagesizes TEXTHEIGHT[,TEXTWIDTH] 5803% Perhaps we should allow setting the margins, \topskip, \parskip, 5804% and/or leading, also. Or perhaps we should compute them somehow. 5805% 5806\def\pagesizes{\parsearg\pagesizesxxx} 5807\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} 5808\def\pagesizesyyy#1,#2,#3\finish{{% 5809 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi 5810 \globaldefs = 1 5811 % 5812 \parskip = 3pt plus 2pt minus 1pt 5813 \setleading{13.2pt}% 5814 % 5815 \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% 5816}} 5817 5818% Set default to letter. 5819% 5820\letterpaper 5821 5822 5823\message{and turning on texinfo input format.} 5824 5825% Define macros to output various characters with catcode for normal text. 5826\catcode`\"=\other 5827\catcode`\~=\other 5828\catcode`\^=\other 5829\catcode`\_=\other 5830\catcode`\|=\other 5831\catcode`\<=\other 5832\catcode`\>=\other 5833\catcode`\+=\other 5834\catcode`\$=\other 5835\def\normaldoublequote{"} 5836\def\normaltilde{~} 5837\def\normalcaret{^} 5838\def\normalunderscore{_} 5839\def\normalverticalbar{|} 5840\def\normalless{<} 5841\def\normalgreater{>} 5842\def\normalplus{+} 5843\def\normaldollar{$} 5844 5845% This macro is used to make a character print one way in ttfont 5846% where it can probably just be output, and another way in other fonts, 5847% where something hairier probably needs to be done. 5848% 5849% #1 is what to print if we are indeed using \tt; #2 is what to print 5850% otherwise. Since all the Computer Modern typewriter fonts have zero 5851% interword stretch (and shrink), and it is reasonable to expect all 5852% typewriter fonts to have this, we can check that font parameter. 5853% 5854\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} 5855 5856% Same as above, but check for italic font. Actually this also catches 5857% non-italic slanted fonts since it is impossible to distinguish them from 5858% italic fonts. But since this is only used by $ and it uses \sl anyway 5859% this is not a problem. 5860\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} 5861 5862% Turn off all special characters except @ 5863% (and those which the user can use as if they were ordinary). 5864% Most of these we simply print from the \tt font, but for some, we can 5865% use math or other variants that look better in normal text. 5866 5867\catcode`\"=\active 5868\def\activedoublequote{{\tt\char34}} 5869\let"=\activedoublequote 5870\catcode`\~=\active 5871\def~{{\tt\char126}} 5872\chardef\hat=`\^ 5873\catcode`\^=\active 5874\def^{{\tt \hat}} 5875 5876\catcode`\_=\active 5877\def_{\ifusingtt\normalunderscore\_} 5878% Subroutine for the previous macro. 5879\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} 5880 5881\catcode`\|=\active 5882\def|{{\tt\char124}} 5883\chardef \less=`\< 5884\catcode`\<=\active 5885\def<{{\tt \less}} 5886\chardef \gtr=`\> 5887\catcode`\>=\active 5888\def>{{\tt \gtr}} 5889\catcode`\+=\active 5890\def+{{\tt \char 43}} 5891\catcode`\$=\active 5892\def${\ifusingit{{\sl\$}}\normaldollar} 5893%\catcode 27=\active 5894%\def^^[{$\diamondsuit$} 5895 5896% Set up an active definition for =, but don't enable it most of the time. 5897{\catcode`\==\active 5898\global\def={{\tt \char 61}}} 5899 5900\catcode`+=\active 5901\catcode`\_=\active 5902 5903% If a .fmt file is being used, characters that might appear in a file 5904% name cannot be active until we have parsed the command line. 5905% So turn them off again, and have \everyjob (or @setfilename) turn them on. 5906% \otherifyactive is called near the end of this file. 5907\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} 5908 5909\catcode`\@=0 5910 5911% \rawbackslashxx output one backslash character in current font 5912\global\chardef\rawbackslashxx=`\\ 5913%{\catcode`\\=\other 5914%@gdef@rawbackslashxx{\}} 5915 5916% \rawbackslash redefines \ as input to do \rawbackslashxx. 5917{\catcode`\\=\active 5918@gdef@rawbackslash{@let\=@rawbackslashxx }} 5919 5920% \normalbackslash outputs one backslash in fixed width font. 5921\def\normalbackslash{{\tt\rawbackslashxx}} 5922 5923% \catcode 17=0 % Define control-q 5924\catcode`\\=\active 5925 5926% Used sometimes to turn off (effectively) the active characters 5927% even after parsing them. 5928@def@turnoffactive{@let"=@normaldoublequote 5929@let\=@realbackslash 5930@let~=@normaltilde 5931@let^=@normalcaret 5932@let_=@normalunderscore 5933@let|=@normalverticalbar 5934@let<=@normalless 5935@let>=@normalgreater 5936@let+=@normalplus 5937@let$=@normaldollar} 5938 5939@def@normalturnoffactive{@let"=@normaldoublequote 5940@let\=@normalbackslash 5941@let~=@normaltilde 5942@let^=@normalcaret 5943@let_=@normalunderscore 5944@let|=@normalverticalbar 5945@let<=@normalless 5946@let>=@normalgreater 5947@let+=@normalplus 5948@let$=@normaldollar} 5949 5950% Make _ and + \other characters, temporarily. 5951% This is canceled by @fixbackslash. 5952@otherifyactive 5953 5954% If a .fmt file is being used, we don't want the `\input texinfo' to show up. 5955% That is what \eatinput is for; after that, the `\' should revert to printing 5956% a backslash. 5957% 5958@gdef@eatinput input texinfo{@fixbackslash} 5959@global@let\ = @eatinput 5960 5961% On the other hand, perhaps the file did not have a `\input texinfo'. Then 5962% the first `\{ in the file would cause an error. This macro tries to fix 5963% that, assuming it is called before the first `\' could plausibly occur. 5964% Also back turn on active characters that might appear in the input 5965% file name, in case not using a pre-dumped format. 5966% 5967@gdef@fixbackslash{% 5968 @ifx\@eatinput @let\ = @normalbackslash @fi 5969 @catcode`+=@active 5970 @catcode`@_=@active 5971} 5972 5973% Say @foo, not \foo, in error messages. 5974@escapechar = `@@ 5975 5976% These look ok in all fonts, so just make them not special. 5977@catcode`@& = @other 5978@catcode`@# = @other 5979@catcode`@% = @other 5980 5981@c Set initial fonts. 5982@textfonts 5983@rm 5984 5985 5986@c Local variables: 5987@c eval: (add-hook 'write-file-hooks 'time-stamp) 5988@c page-delimiter: "^\\\\message" 5989@c time-stamp-start: "def\\\\texinfoversion{" 5990@c time-stamp-format: "%:y-%02m-%02d.%02H" 5991@c time-stamp-end: "}" 5992@c End: 5993