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{2020-11-25.18} 7% 8% Copyright 1985, 1986, 1988, 1990-2020 Free Software Foundation, Inc. 9% 10% This texinfo.tex file is free software: you can redistribute it and/or 11% modify it under the terms of the GNU General Public License as 12% published by the Free Software Foundation, either version 3 of the 13% License, or (at your option) any later version. 14% 15% This texinfo.tex file is distributed in the hope that it will be 16% useful, but WITHOUT ANY WARRANTY; without even the implied warranty 17% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18% General Public License for more details. 19% 20% You should have received a copy of the GNU General Public License 21% along with this program. If not, see <https://www.gnu.org/licenses/>. 22% 23% As a special exception, when this file is read by TeX when processing 24% a Texinfo source document, you may use the result without 25% restriction. This Exception is an additional permission under section 7 26% of the GNU General Public License, version 3 ("GPLv3"). 27% 28% Please try the latest version of texinfo.tex before submitting bug 29% reports; you can get the latest version from: 30% https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or 31% https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or 32% https://www.gnu.org/software/texinfo/ (the Texinfo home page) 33% The texinfo.tex in any given distribution could well be out 34% of date, so if that's what you're using, please check. 35% 36% Send bug reports to bug-texinfo@gnu.org. Please include a 37% complete document in each bug report with which we can reproduce the 38% problem. Patches are, of course, greatly appreciated. 39% 40% To process a Texinfo manual with TeX, it's most reliable to use the 41% texi2dvi shell script that comes with the distribution. For a simple 42% manual foo.texi, however, you can get away with this: 43% tex foo.texi 44% texindex foo.?? 45% tex foo.texi 46% tex foo.texi 47% dvips foo.dvi -o # or whatever; this makes foo.ps. 48% The extra TeX runs get the cross-reference information correct. 49% Sometimes one run after texindex suffices, and sometimes you need more 50% than two; texi2dvi does it as many times as necessary. 51% 52% It is possible to adapt texinfo.tex for other languages, to some 53% extent. You can get the existing language-specific files from the 54% full Texinfo distribution. 55% 56% The GNU Texinfo home page is https://www.gnu.org/software/texinfo. 57 58 59\message{Loading texinfo [version \texinfoversion]:} 60 61% If in a .fmt file, print the version number 62% and turn on active characters that we couldn't do earlier because 63% they might have appeared in the input file name. 64\everyjob{\message{[Texinfo version \texinfoversion]}% 65 \catcode`+=\active \catcode`\_=\active} 66 67% LaTeX's \typeout. This ensures that the messages it is used for 68% are identical in format to the corresponding ones from latex/pdflatex. 69\def\typeout{\immediate\write17}% 70 71\chardef\other=12 72 73% We never want plain's \outer definition of \+ in Texinfo. 74% For @tex, we can use \tabalign. 75\let\+ = \relax 76 77% Save some plain tex macros whose names we will redefine. 78\let\ptexb=\b 79\let\ptexbullet=\bullet 80\let\ptexc=\c 81\let\ptexcomma=\, 82\let\ptexdot=\. 83\let\ptexdots=\dots 84\let\ptexend=\end 85\let\ptexequiv=\equiv 86\let\ptexexclam=\! 87\let\ptexfootnote=\footnote 88\let\ptexgtr=> 89\let\ptexhat=^ 90\let\ptexi=\i 91\let\ptexindent=\indent 92\let\ptexinsert=\insert 93\let\ptexlbrace=\{ 94\let\ptexless=< 95\let\ptexnewwrite\newwrite 96\let\ptexnoindent=\noindent 97\let\ptexplus=+ 98\let\ptexraggedright=\raggedright 99\let\ptexrbrace=\} 100\let\ptexslash=\/ 101\let\ptexsp=\sp 102\let\ptexstar=\* 103\let\ptexsup=\sup 104\let\ptext=\t 105\let\ptextop=\top 106{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode 107 108% If this character appears in an error message or help string, it 109% starts a new line in the output. 110\newlinechar = `^^J 111 112% Use TeX 3.0's \inputlineno to get the line number, for better error 113% messages, but if we're using an old version of TeX, don't do anything. 114% 115\ifx\inputlineno\thisisundefined 116 \let\linenumber = \empty % Pre-3.0. 117\else 118 \def\linenumber{l.\the\inputlineno:\space} 119\fi 120 121% Set up fixed words for English if not already set. 122\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi 123\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi 124\ifx\putworderror\undefined \gdef\putworderror{error}\fi 125\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi 126\ifx\putwordin\undefined \gdef\putwordin{in}\fi 127\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi 128\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi 129\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi 130\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi 131\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi 132\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi 133\ifx\putwordof\undefined \gdef\putwordof{of}\fi 134\ifx\putwordon\undefined \gdef\putwordon{on}\fi 135\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi 136\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi 137\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi 138\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi 139\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi 140\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi 141\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi 142% 143\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi 144\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi 145\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi 146\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi 147\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi 148\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi 149\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi 150\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi 151\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi 152\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi 153\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi 154\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi 155% 156\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi 157\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi 158\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi 159\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi 160\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi 161 162% Give the space character the catcode for a space. 163\def\spaceisspace{\catcode`\ =10\relax} 164 165% Likewise for ^^M, the end of line character. 166\def\endlineisspace{\catcode13=10\relax} 167 168\chardef\dashChar = `\- 169\chardef\slashChar = `\/ 170\chardef\underChar = `\_ 171 172% Ignore a token. 173% 174\def\gobble#1{} 175 176% The following is used inside several \edef's. 177\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} 178 179% Hyphenation fixes. 180\hyphenation{ 181 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script 182 ap-pen-dix bit-map bit-maps 183 data-base data-bases eshell fall-ing half-way long-est man-u-script 184 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm 185 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces 186 spell-ing spell-ings 187 stand-alone strong-est time-stamp time-stamps which-ever white-space 188 wide-spread wrap-around 189} 190 191% Sometimes it is convenient to have everything in the transcript file 192% and nothing on the terminal. We don't just call \tracingall here, 193% since that produces some useless output on the terminal. We also make 194% some effort to order the tracing commands to reduce output in the log 195% file; cf. trace.sty in LaTeX. 196% 197\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% 198\def\loggingall{% 199 \tracingstats2 200 \tracingpages1 201 \tracinglostchars2 % 2 gives us more in etex 202 \tracingparagraphs1 203 \tracingoutput1 204 \tracingmacros2 205 \tracingrestores1 206 \showboxbreadth\maxdimen \showboxdepth\maxdimen 207 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging 208 \tracingscantokens1 209 \tracingifs1 210 \tracinggroups1 211 \tracingnesting2 212 \tracingassigns1 213 \fi 214 \tracingcommands3 % 3 gives us more in etex 215 \errorcontextlines16 216}% 217 218% @errormsg{MSG}. Do the index-like expansions on MSG, but if things 219% aren't perfect, it's not the end of the world, being an error message, 220% after all. 221% 222\def\errormsg{\begingroup \indexnofonts \doerrormsg} 223\def\doerrormsg#1{\errmessage{#1}} 224 225% add check for \lastpenalty to plain's definitions. If the last thing 226% we did was a \nobreak, we don't want to insert more space. 227% 228\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount 229 \removelastskip\penalty-50\smallskip\fi\fi} 230\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount 231 \removelastskip\penalty-100\medskip\fi\fi} 232\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount 233 \removelastskip\penalty-200\bigskip\fi\fi} 234 235% Output routine 236% 237 238% For a final copy, take out the rectangles 239% that mark overfull boxes (in case you have decided 240% that the text looks ok even though it passes the margin). 241% 242\def\finalout{\overfullrule=0pt } 243 244\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines 245\newdimen\topandbottommargin \topandbottommargin=.75in 246 247% Output a mark which sets \thischapter, \thissection and \thiscolor. 248% We dump everything together because we only have one kind of mark. 249% This works because we only use \botmark / \topmark, not \firstmark. 250% 251% A mark contains a subexpression of the \ifcase ... \fi construct. 252% \get*marks macros below extract the needed part using \ifcase. 253% 254% Another complication is to let the user choose whether \thischapter 255% (\thissection) refers to the chapter (section) in effect at the top 256% of a page, or that at the bottom of a page. 257 258% \domark is called twice inside \chapmacro, to add one 259% mark before the section break, and one after. 260% In the second call \prevchapterdefs is the same as \currentchapterdefs, 261% and \prevsectiondefs is the same as \currentsectiondefs. 262% Then if the page is not broken at the mark, some of the previous 263% section appears on the page, and we can get the name of this section 264% from \firstmark for @everyheadingmarks top. 265% @everyheadingmarks bottom uses \botmark. 266% 267% See page 260 of The TeXbook. 268\def\domark{% 269 \toks0=\expandafter{\currentchapterdefs}% 270 \toks2=\expandafter{\currentsectiondefs}% 271 \toks4=\expandafter{\prevchapterdefs}% 272 \toks6=\expandafter{\prevsectiondefs}% 273 \toks8=\expandafter{\currentcolordefs}% 274 \mark{% 275 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top 276 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom 277 \noexpand\else \the\toks8 % 2: color marks 278 }% 279} 280 281% \gettopheadingmarks, \getbottomheadingmarks, 282% \getcolormarks - extract needed part of mark. 283% 284% \topmark doesn't work for the very first chapter (after the title 285% page or the contents), so we use \firstmark there -- this gets us 286% the mark with the chapter defs, unless the user sneaks in, e.g., 287% @setcolor (or @url, or @link, etc.) between @contents and the very 288% first @chapter. 289\def\gettopheadingmarks{% 290 \ifcase0\the\savedtopmark\fi 291 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi 292} 293\def\getbottomheadingmarks{\ifcase1\botmark\fi} 294\def\getcolormarks{\ifcase2\the\savedtopmark\fi} 295 296% Avoid "undefined control sequence" errors. 297\def\currentchapterdefs{} 298\def\currentsectiondefs{} 299\def\currentsection{} 300\def\prevchapterdefs{} 301\def\prevsectiondefs{} 302\def\currentcolordefs{} 303 304% Margin to add to right of even pages, to left of odd pages. 305\newdimen\bindingoffset 306\newdimen\normaloffset 307\newdimen\txipagewidth \newdimen\txipageheight 308 309% Main output routine. 310% 311\chardef\PAGE = 255 312\newtoks\defaultoutput 313\defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}} 314\output=\expandafter{\the\defaultoutput} 315 316\newbox\headlinebox 317\newbox\footlinebox 318 319% When outputting the double column layout for indices, an output routine 320% is run several times, which hides the original value of \topmark. This 321% can lead to a page heading being output and duplicating the chapter heading 322% of the index. Hence, save the contents of \topmark at the beginning of 323% the output routine. The saved contents are valid until we actually 324% \shipout a page. 325% 326% (We used to run a short output routine to actually set \topmark and 327% \firstmark to the right values, but if this was called with an empty page 328% containing whatsits for writing index entries, the whatsits would be thrown 329% away and the index auxiliary file would remain empty.) 330% 331\newtoks\savedtopmark 332\newif\iftopmarksaved 333\topmarksavedtrue 334\def\savetopmark{% 335 \iftopmarksaved\else 336 \global\savedtopmark=\expandafter{\topmark}% 337 \global\topmarksavedtrue 338 \fi 339} 340 341% \onepageout takes a vbox as an argument. 342% \shipout a vbox for a single page, adding an optional header, footer 343% and footnote. This also causes index entries for this page to be written 344% to the auxiliary files. 345% 346\def\onepageout#1{% 347 \hoffset=\normaloffset 348 % 349 \ifodd\pageno \advance\hoffset by \bindingoffset 350 \else \advance\hoffset by -\bindingoffset\fi 351 % 352 \checkchapterpage 353 % 354 % Retrieve the information for the headings from the marks in the page, 355 % and call Plain TeX's \makeheadline and \makefootline, which use the 356 % values in \headline and \footline. 357 % 358 % Common context changes for both heading and footing. 359 % Do this outside of the \shipout so @code etc. will be expanded in 360 % the headline as they should be, not taken literally (outputting ''code). 361 \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars} 362 % 363 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi 364 \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}% 365 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi 366 \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}% 367 % 368 {% 369 % Set context for writing to auxiliary files like index files. 370 % Have to do this stuff outside the \shipout because we want it to 371 % take effect in \write's, yet the group defined by the \vbox ends 372 % before the \shipout runs. 373 % 374 \atdummies % don't expand commands in the output. 375 \turnoffactive 376 \shipout\vbox{% 377 % Do this early so pdf references go to the beginning of the page. 378 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi 379 % 380 \unvbox\headlinebox 381 \pagebody{#1}% 382 \ifdim\ht\footlinebox > 0pt 383 % Only leave this space if the footline is nonempty. 384 % (We lessened \vsize for it in \oddfootingyyy.) 385 % The \baselineskip=24pt in plain's \makefootline has no effect. 386 \vskip 24pt 387 \unvbox\footlinebox 388 \fi 389 % 390 }% 391 }% 392 \global\topmarksavedfalse 393 \advancepageno 394 \ifnum\outputpenalty>-20000 \else\dosupereject\fi 395} 396 397\newinsert\margin \dimen\margin=\maxdimen 398 399% Main part of page, including any footnotes 400\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}} 401{\catcode`\@ =11 402\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi 403% marginal hacks, juha@viisa.uucp (Juha Takala) 404\ifvoid\margin\else % marginal info is present 405 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi 406\dimen@=\dp#1\relax \unvbox#1\relax 407\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi 408\ifr@ggedbottom \kern-\dimen@ \vfil \fi} 409} 410 411% Check if we are on the first page of a chapter. Used for printing headings. 412\newif\ifchapterpage 413\def\checkchapterpage{% 414 % Get the chapter that was current at the end of the last page 415 \ifcase1\the\savedtopmark\fi 416 \let\prevchaptername\thischaptername 417 % 418 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi 419 \let\curchaptername\thischaptername 420 % 421 \ifx\curchaptername\prevchaptername 422 \chapterpagefalse 423 \else 424 \chapterpagetrue 425 \fi 426} 427 428% Argument parsing 429 430% Parse an argument, then pass it to #1. The argument is the rest of 431% the input line (except we remove a trailing comment). #1 should be a 432% macro which expects an ordinary undelimited TeX argument. 433% For example, \def\foo{\parsearg\fooxxx}. 434% 435\def\parsearg{\parseargusing{}} 436\def\parseargusing#1#2{% 437 \def\argtorun{#2}% 438 \begingroup 439 \obeylines 440 \spaceisspace 441 #1% 442 \parseargline\empty% Insert the \empty token, see \finishparsearg below. 443} 444 445{\obeylines % 446 \gdef\parseargline#1^^M{% 447 \endgroup % End of the group started in \parsearg. 448 \argremovecomment #1\comment\ArgTerm% 449 }% 450} 451 452% First remove any @comment, then any @c comment. Pass the result on to 453% \argcheckspaces. 454\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} 455\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} 456 457% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space. 458% 459% \argremovec might leave us with trailing space, e.g., 460% @end itemize @c foo 461% This space token undergoes the same procedure and is eventually removed 462% by \finishparsearg. 463% 464\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} 465\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} 466\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% 467 \def\temp{#3}% 468 \ifx\temp\empty 469 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: 470 \let\temp\finishparsearg 471 \else 472 \let\temp\argcheckspaces 473 \fi 474 % Put the space token in: 475 \temp#1 #3\ArgTerm 476} 477 478% If a _delimited_ argument is enclosed in braces, they get stripped; so 479% to get _exactly_ the rest of the line, we had to prevent such situation. 480% We prepended an \empty token at the very beginning and we expand it now, 481% just before passing the control to \argtorun. 482% (Similarly, we have to think about #3 of \argcheckspacesY above: it is 483% either the null string, or it ends with \^^M---thus there is no danger 484% that a pair of braces would be stripped. 485% 486% But first, we have to remove the trailing space token. 487% 488\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} 489 490 491% \parseargdef - define a command taking an argument on the line 492% 493% \parseargdef\foo{...} 494% is roughly equivalent to 495% \def\foo{\parsearg\Xfoo} 496% \def\Xfoo#1{...} 497\def\parseargdef#1{% 498 \expandafter \doparseargdef \csname\string#1\endcsname #1% 499} 500\def\doparseargdef#1#2{% 501 \def#2{\parsearg#1}% 502 \def#1##1% 503} 504 505% Several utility definitions with active space: 506{ 507 \obeyspaces 508 \gdef\obeyedspace{ } 509 510 % Make each space character in the input produce a normal interword 511 % space in the output. Don't allow a line break at this space, as this 512 % is used only in environments like @example, where each line of input 513 % should produce a line of output anyway. 514 % 515 \gdef\sepspaces{\obeyspaces\let =\tie} 516 517 % If an index command is used in an @example environment, any spaces 518 % therein should become regular spaces in the raw index file, not the 519 % expansion of \tie (\leavevmode \penalty \@M \ ). 520 \gdef\unsepspaces{\let =\space} 521} 522 523 524\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} 525 526% Define the framework for environments in texinfo.tex. It's used like this: 527% 528% \envdef\foo{...} 529% \def\Efoo{...} 530% 531% It's the responsibility of \envdef to insert \begingroup before the 532% actual body; @end closes the group after calling \Efoo. \envdef also 533% defines \thisenv, so the current environment is known; @end checks 534% whether the environment name matches. The \checkenv macro can also be 535% used to check whether the current environment is the one expected. 536% 537% Non-false conditionals (@iftex, @ifset) don't fit into this, so they 538% are not treated as environments; they don't open a group. (The 539% implementation of @end takes care not to call \endgroup in this 540% special case.) 541 542 543% At run-time, environments start with this: 544\def\startenvironment#1{\begingroup\def\thisenv{#1}} 545% initialize 546\let\thisenv\empty 547 548% ... but they get defined via ``\envdef\foo{...}'': 549\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} 550\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} 551 552% Check whether we're in the right environment: 553\def\checkenv#1{% 554 \def\temp{#1}% 555 \ifx\thisenv\temp 556 \else 557 \badenverr 558 \fi 559} 560 561% Environment mismatch, #1 expected: 562\def\badenverr{% 563 \errhelp = \EMsimple 564 \errmessage{This command can appear only \inenvironment\temp, 565 not \inenvironment\thisenv}% 566} 567\def\inenvironment#1{% 568 \ifx#1\empty 569 outside of any environment% 570 \else 571 in environment \expandafter\string#1% 572 \fi 573} 574 575 576% @end foo calls \checkenv and executes the definition of \Efoo. 577\parseargdef\end{ 578 \if 1\csname iscond.#1\endcsname 579 \else 580 % The general wording of \badenverr may not be ideal. 581 \expandafter\checkenv\csname#1\endcsname 582 \csname E#1\endcsname 583 \endgroup 584 \fi 585} 586 587\newhelp\EMsimple{Press RETURN to continue.} 588 589 590% Be sure we're in horizontal mode when doing a tie, since we make space 591% equivalent to this in @example-like environments. Otherwise, a space 592% at the beginning of a line will start with \penalty -- and 593% since \penalty is valid in vertical mode, we'd end up putting the 594% penalty on the vertical list instead of in the new paragraph. 595{\catcode`@ = 11 596 % Avoid using \@M directly, because that causes trouble 597 % if the definition is written into an index file. 598 \global\let\tiepenalty = \@M 599 \gdef\tie{\leavevmode\penalty\tiepenalty\ } 600} 601 602% @: forces normal size whitespace following. 603\def\:{\spacefactor=1000 } 604 605% @* forces a line break. 606\def\*{\unskip\hfil\break\hbox{}\ignorespaces} 607 608% @/ allows a line break. 609\let\/=\allowbreak 610 611% @. is an end-of-sentence period. 612\def\.{.\spacefactor=\endofsentencespacefactor\space} 613 614% @! is an end-of-sentence bang. 615\def\!{!\spacefactor=\endofsentencespacefactor\space} 616 617% @? is an end-of-sentence query. 618\def\?{?\spacefactor=\endofsentencespacefactor\space} 619 620% @frenchspacing on|off says whether to put extra space after punctuation. 621% 622\def\onword{on} 623\def\offword{off} 624% 625\parseargdef\frenchspacing{% 626 \def\temp{#1}% 627 \ifx\temp\onword \plainfrenchspacing 628 \else\ifx\temp\offword \plainnonfrenchspacing 629 \else 630 \errhelp = \EMsimple 631 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% 632 \fi\fi 633} 634 635% @w prevents a word break. Without the \leavevmode, @w at the 636% beginning of a paragraph, when TeX is still in vertical mode, would 637% produce a whole line of output instead of starting the paragraph. 638\def\w#1{\leavevmode\hbox{#1}} 639 640% @group ... @end group forces ... to be all on one page, by enclosing 641% it in a TeX vbox. We use \vtop instead of \vbox to construct the box 642% to keep its height that of a normal line. According to the rules for 643% \topskip (p.114 of the TeXbook), the glue inserted is 644% max (\topskip - \ht (first item), 0). If that height is large, 645% therefore, no glue is inserted, and the space between the headline and 646% the text is small, which looks bad. 647% 648% Another complication is that the group might be very large. This can 649% cause the glue on the previous page to be unduly stretched, because it 650% does not have much material. In this case, it's better to add an 651% explicit \vfill so that the extra space is at the bottom. The 652% threshold for doing this is if the group is more than \vfilllimit 653% percent of a page (\vfilllimit can be changed inside of @tex). 654% 655\newbox\groupbox 656\def\vfilllimit{0.7} 657% 658\envdef\group{% 659 \ifnum\catcode`\^^M=\active \else 660 \errhelp = \groupinvalidhelp 661 \errmessage{@group invalid in context where filling is enabled}% 662 \fi 663 \startsavinginserts 664 % 665 \setbox\groupbox = \vtop\bgroup 666 % Do @comment since we are called inside an environment such as 667 % @example, where each end-of-line in the input causes an 668 % end-of-line in the output. We don't want the end-of-line after 669 % the `@group' to put extra space in the output. Since @group 670 % should appear on a line by itself (according to the Texinfo 671 % manual), we don't worry about eating any user text. 672 \comment 673} 674% 675% The \vtop produces a box with normal height and large depth; thus, TeX puts 676% \baselineskip glue before it, and (when the next line of text is done) 677% \lineskip glue after it. Thus, space below is not quite equal to space 678% above. But it's pretty close. 679\def\Egroup{% 680 % To get correct interline space between the last line of the group 681 % and the first line afterwards, we have to propagate \prevdepth. 682 \endgraf % Not \par, as it may have been set to \lisppar. 683 \global\dimen1 = \prevdepth 684 \egroup % End the \vtop. 685 \addgroupbox 686 \prevdepth = \dimen1 687 \checkinserts 688} 689 690\def\addgroupbox{ 691 % \dimen0 is the vertical size of the group's box. 692 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox 693 % \dimen2 is how much space is left on the page (more or less). 694 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal 695 % if the group doesn't fit on the current page, and it's a big big 696 % group, force a page break. 697 \ifdim \dimen0 > \dimen2 698 \ifdim \pagetotal < \vfilllimit\txipageheight 699 \page 700 \fi 701 \fi 702 \box\groupbox 703} 704 705% 706% TeX puts in an \escapechar (i.e., `@') at the beginning of the help 707% message, so this ends up printing `@group can only ...'. 708% 709\newhelp\groupinvalidhelp{% 710group can only be used in environments such as @example,^^J% 711where each line of input produces a line of output.} 712 713% @need space-in-mils 714% forces a page break if there is not space-in-mils remaining. 715 716\newdimen\mil \mil=0.001in 717 718\parseargdef\need{% 719 % Ensure vertical mode, so we don't make a big box in the middle of a 720 % paragraph. 721 \par 722 % 723 % If the @need value is less than one line space, it's useless. 724 \dimen0 = #1\mil 725 \dimen2 = \ht\strutbox 726 \advance\dimen2 by \dp\strutbox 727 \ifdim\dimen0 > \dimen2 728 % 729 % Do a \strut just to make the height of this box be normal, so the 730 % normal leading is inserted relative to the preceding line. 731 % And a page break here is fine. 732 \vtop to #1\mil{\strut\vfil}% 733 % 734 % TeX does not even consider page breaks if a penalty added to the 735 % main vertical list is 10000 or more. But in order to see if the 736 % empty box we just added fits on the page, we must make it consider 737 % page breaks. On the other hand, we don't want to actually break the 738 % page after the empty box. So we use a penalty of 9999. 739 % 740 % There is an extremely small chance that TeX will actually break the 741 % page at this \penalty, if there are no other feasible breakpoints in 742 % sight. (If the user is using lots of big @group commands, which 743 % almost-but-not-quite fill up a page, TeX will have a hard time doing 744 % good page breaking, for example.) However, I could not construct an 745 % example where a page broke at this \penalty; if it happens in a real 746 % document, then we can reconsider our strategy. 747 \penalty9999 748 % 749 % Back up by the size of the box, whether we did a page break or not. 750 \kern -#1\mil 751 % 752 % Do not allow a page break right after this kern. 753 \nobreak 754 \fi 755} 756 757% @br forces paragraph break (and is undocumented). 758 759\let\br = \par 760 761% @page forces the start of a new page. 762% 763\def\page{\par\vfill\supereject} 764 765% @exdent text.... 766% outputs text on separate line in roman font, starting at standard page margin 767 768% This records the amount of indent in the innermost environment. 769% That's how much \exdent should take out. 770\newskip\exdentamount 771 772% This defn is used inside fill environments such as @defun. 773\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} 774 775% This defn is used inside nofill environments such as @example. 776\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount 777 \leftline{\hskip\leftskip{\rm#1}}}} 778 779% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current 780% paragraph. For more general purposes, use the \margin insertion 781% class. WHICH is `l' or `r'. Not documented, written for gawk manual. 782% 783\newskip\inmarginspacing \inmarginspacing=1cm 784\def\strutdepth{\dp\strutbox} 785% 786\def\doinmargin#1#2{\strut\vadjust{% 787 \nobreak 788 \kern-\strutdepth 789 \vtop to \strutdepth{% 790 \baselineskip=\strutdepth 791 \vss 792 % if you have multiple lines of stuff to put here, you'll need to 793 % make the vbox yourself of the appropriate size. 794 \ifx#1l% 795 \llap{\ignorespaces #2\hskip\inmarginspacing}% 796 \else 797 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% 798 \fi 799 \null 800 }% 801}} 802\def\inleftmargin{\doinmargin l} 803\def\inrightmargin{\doinmargin r} 804% 805% @inmargin{TEXT [, RIGHT-TEXT]} 806% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; 807% else use TEXT for both). 808% 809\def\inmargin#1{\parseinmargin #1,,\finish} 810\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. 811 \setbox0 = \hbox{\ignorespaces #2}% 812 \ifdim\wd0 > 0pt 813 \def\lefttext{#1}% have both texts 814 \def\righttext{#2}% 815 \else 816 \def\lefttext{#1}% have only one text 817 \def\righttext{#1}% 818 \fi 819 % 820 \ifodd\pageno 821 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin 822 \else 823 \def\temp{\inleftmargin\lefttext}% 824 \fi 825 \temp 826} 827 828% @include FILE -- \input text of FILE. 829% 830\def\include{\parseargusing\filenamecatcodes\includezzz} 831\def\includezzz#1{% 832 \pushthisfilestack 833 \def\thisfile{#1}% 834 {% 835 \makevalueexpandable % we want to expand any @value in FILE. 836 \turnoffactive % and allow special characters in the expansion 837 \indexnofonts % Allow `@@' and other weird things in file names. 838 \wlog{texinfo.tex: doing @include of #1^^J}% 839 \edef\temp{\noexpand\input #1 }% 840 % 841 % This trickery is to read FILE outside of a group, in case it makes 842 % definitions, etc. 843 \expandafter 844 }\temp 845 \popthisfilestack 846} 847\def\filenamecatcodes{% 848 \catcode`\\=\other 849 \catcode`~=\other 850 \catcode`^=\other 851 \catcode`_=\other 852 \catcode`|=\other 853 \catcode`<=\other 854 \catcode`>=\other 855 \catcode`+=\other 856 \catcode`-=\other 857 \catcode`\`=\other 858 \catcode`\'=\other 859} 860 861\def\pushthisfilestack{% 862 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm 863} 864\def\pushthisfilestackX{% 865 \expandafter\pushthisfilestackY\thisfile\StackTerm 866} 867\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% 868 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% 869} 870 871\def\popthisfilestack{\errthisfilestackempty} 872\def\errthisfilestackempty{\errmessage{Internal error: 873 the stack of filenames is empty.}} 874% 875\def\thisfile{} 876 877% @center line 878% outputs that line, centered. 879% 880\parseargdef\center{% 881 \ifhmode 882 \let\centersub\centerH 883 \else 884 \let\centersub\centerV 885 \fi 886 \centersub{\hfil \ignorespaces#1\unskip \hfil}% 887 \let\centersub\relax % don't let the definition persist, just in case 888} 889\def\centerH#1{{% 890 \hfil\break 891 \advance\hsize by -\leftskip 892 \advance\hsize by -\rightskip 893 \line{#1}% 894 \break 895}} 896% 897\newcount\centerpenalty 898\def\centerV#1{% 899 % The idea here is the same as in \startdefun, \cartouche, etc.: if 900 % @center is the first thing after a section heading, we need to wipe 901 % out the negative parskip inserted by \sectionheading, but still 902 % prevent a page break here. 903 \centerpenalty = \lastpenalty 904 \ifnum\centerpenalty>10000 \vskip\parskip \fi 905 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi 906 \line{\kern\leftskip #1\kern\rightskip}% 907} 908 909% @sp n outputs n lines of vertical space 910% 911\parseargdef\sp{\vskip #1\baselineskip} 912 913% @comment ...line which is ignored... 914% @c is the same as @comment 915% @ignore ... @end ignore is another way to write a comment 916 917 918\def\c{\begingroup \catcode`\^^M=\active% 919\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% 920\cxxx} 921{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}} 922% 923\let\comment\c 924 925% @paragraphindent NCHARS 926% We'll use ems for NCHARS, close enough. 927% NCHARS can also be the word `asis' or `none'. 928% We cannot feasibly implement @paragraphindent asis, though. 929% 930\def\asisword{asis} % no translation, these are keywords 931\def\noneword{none} 932% 933\parseargdef\paragraphindent{% 934 \def\temp{#1}% 935 \ifx\temp\asisword 936 \else 937 \ifx\temp\noneword 938 \defaultparindent = 0pt 939 \else 940 \defaultparindent = #1em 941 \fi 942 \fi 943 \parindent = \defaultparindent 944} 945 946% @exampleindent NCHARS 947% We'll use ems for NCHARS like @paragraphindent. 948% It seems @exampleindent asis isn't necessary, but 949% I preserve it to make it similar to @paragraphindent. 950\parseargdef\exampleindent{% 951 \def\temp{#1}% 952 \ifx\temp\asisword 953 \else 954 \ifx\temp\noneword 955 \lispnarrowing = 0pt 956 \else 957 \lispnarrowing = #1em 958 \fi 959 \fi 960} 961 962% @firstparagraphindent WORD 963% If WORD is `none', then suppress indentation of the first paragraph 964% after a section heading. If WORD is `insert', then do indent at such 965% paragraphs. 966% 967% The paragraph indentation is suppressed or not by calling 968% \suppressfirstparagraphindent, which the sectioning commands do. 969% We switch the definition of this back and forth according to WORD. 970% By default, we suppress indentation. 971% 972\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} 973\def\insertword{insert} 974% 975\parseargdef\firstparagraphindent{% 976 \def\temp{#1}% 977 \ifx\temp\noneword 978 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent 979 \else\ifx\temp\insertword 980 \let\suppressfirstparagraphindent = \relax 981 \else 982 \errhelp = \EMsimple 983 \errmessage{Unknown @firstparagraphindent option `\temp'}% 984 \fi\fi 985} 986 987% Here is how we actually suppress indentation. Redefine \everypar to 988% \kern backwards by \parindent, and then reset itself to empty. 989% 990% We also make \indent itself not actually do anything until the next 991% paragraph. 992% 993\gdef\dosuppressfirstparagraphindent{% 994 \gdef\indent {\restorefirstparagraphindent \indent}% 995 \gdef\noindent{\restorefirstparagraphindent \noindent}% 996 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}% 997} 998% 999\gdef\restorefirstparagraphindent{% 1000 \global\let\indent = \ptexindent 1001 \global\let\noindent = \ptexnoindent 1002 \global\everypar = {}% 1003} 1004 1005 1006% @refill is a no-op. 1007\let\refill=\relax 1008 1009% @setfilename INFO-FILENAME - ignored 1010\let\setfilename=\comment 1011 1012% @bye. 1013\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend} 1014 1015 1016\message{pdf,} 1017% adobe `portable' document format 1018\newcount\tempnum 1019\newcount\lnkcount 1020\newtoks\filename 1021\newcount\filenamelength 1022\newcount\pgn 1023\newtoks\toksA 1024\newtoks\toksB 1025\newtoks\toksC 1026\newtoks\toksD 1027\newbox\boxA 1028\newbox\boxB 1029\newcount\countA 1030\newif\ifpdf 1031\newif\ifpdfmakepagedest 1032 1033% 1034% For LuaTeX 1035% 1036 1037\newif\iftxiuseunicodedestname 1038\txiuseunicodedestnamefalse % For pdfTeX etc. 1039 1040\ifx\luatexversion\thisisundefined 1041\else 1042 % Use Unicode destination names 1043 \txiuseunicodedestnametrue 1044 % Escape PDF strings with converting UTF-16 from UTF-8 1045 \begingroup 1046 \catcode`\%=12 1047 \directlua{ 1048 function UTF16oct(str) 1049 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377') 1050 for c in string.utfvalues(str) do 1051 if c < 0x10000 then 1052 tex.sprint( 1053 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. 1054 string.char(0x5c) .. string.char(0x25) .. '03o', 1055 math.floor(c / 256), math.floor(c % 256))) 1056 else 1057 c = c - 0x10000 1058 local c_hi = c / 1024 + 0xd800 1059 local c_lo = c % 1024 + 0xdc00 1060 tex.sprint( 1061 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. 1062 string.char(0x5c) .. string.char(0x25) .. '03o' .. 1063 string.char(0x5c) .. string.char(0x25) .. '03o' .. 1064 string.char(0x5c) .. string.char(0x25) .. '03o', 1065 math.floor(c_hi / 256), math.floor(c_hi % 256), 1066 math.floor(c_lo / 256), math.floor(c_lo % 256))) 1067 end 1068 end 1069 end 1070 } 1071 \endgroup 1072 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}} 1073 % Escape PDF strings without converting 1074 \begingroup 1075 \directlua{ 1076 function PDFescstr(str) 1077 for c in string.bytes(str) do 1078 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then 1079 tex.sprint(-2, 1080 string.format(string.char(0x5c) .. string.char(0x25) .. '03o', 1081 c)) 1082 else 1083 tex.sprint(-2, string.char(c)) 1084 end 1085 end 1086 end 1087 } 1088 % The -2 in the arguments here gives all the input to TeX catcode 12 1089 % (other) or 10 (space), preventing undefined control sequence errors. See 1090 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html 1091 % 1092 \endgroup 1093 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} 1094 \ifnum\luatexversion>84 1095 % For LuaTeX >= 0.85 1096 \def\pdfdest{\pdfextension dest} 1097 \let\pdfoutput\outputmode 1098 \def\pdfliteral{\pdfextension literal} 1099 \def\pdfcatalog{\pdfextension catalog} 1100 \def\pdftexversion{\numexpr\pdffeedback version\relax} 1101 \let\pdfximage\saveimageresource 1102 \let\pdfrefximage\useimageresource 1103 \let\pdflastximage\lastsavedimageresourceindex 1104 \def\pdfendlink{\pdfextension endlink\relax} 1105 \def\pdfoutline{\pdfextension outline} 1106 \def\pdfstartlink{\pdfextension startlink} 1107 \def\pdffontattr{\pdfextension fontattr} 1108 \def\pdfobj{\pdfextension obj} 1109 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax} 1110 \let\pdfpagewidth\pagewidth 1111 \let\pdfpageheight\pageheight 1112 \edef\pdfhorigin{\pdfvariable horigin} 1113 \edef\pdfvorigin{\pdfvariable vorigin} 1114 \fi 1115\fi 1116 1117% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 1118% can be set). So we test for \relax and 0 as well as being undefined. 1119\ifx\pdfoutput\thisisundefined 1120\else 1121 \ifx\pdfoutput\relax 1122 \else 1123 \ifcase\pdfoutput 1124 \else 1125 \pdftrue 1126 \fi 1127 \fi 1128\fi 1129 1130\newif\ifpdforxetex 1131\pdforxetexfalse 1132\ifpdf 1133 \pdforxetextrue 1134\fi 1135\ifx\XeTeXrevision\thisisundefined\else 1136 \pdforxetextrue 1137\fi 1138 1139 1140% Output page labels information. 1141% See PDF reference v.1.7 p.594, section 8.3.1. 1142\ifpdf 1143\def\pagelabels{% 1144 \def\title{0 << /P (T-) /S /D >>}% 1145 \edef\roman{\the\romancount << /S /r >>}% 1146 \edef\arabic{\the\arabiccount << /S /D >>}% 1147 % 1148 % Page label ranges must be increasing. Remove any duplicates. 1149 % (There is a slight chance of this being wrong if e.g. there is 1150 % a @contents but no @titlepage, etc.) 1151 % 1152 \ifnum\romancount=0 \def\roman{}\fi 1153 \ifnum\arabiccount=0 \def\title{}% 1154 \else 1155 \ifnum\romancount=\arabiccount \def\roman{}\fi 1156 \fi 1157 % 1158 \ifnum\romancount<\arabiccount 1159 \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax 1160 \else 1161 \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax 1162 \fi 1163} 1164\else 1165 \let\pagelabels\relax 1166\fi 1167 1168\newcount\pagecount \pagecount=0 1169\newcount\romancount \romancount=0 1170\newcount\arabiccount \arabiccount=0 1171\ifpdf 1172 \let\ptxadvancepageno\advancepageno 1173 \def\advancepageno{% 1174 \ptxadvancepageno\global\advance\pagecount by 1 1175 } 1176\fi 1177 1178 1179% PDF uses PostScript string constants for the names of xref targets, 1180% for display in the outlines, and in other places. Thus, we have to 1181% double any backslashes. Otherwise, a name like "\node" will be 1182% interpreted as a newline (\n), followed by o, d, e. Not good. 1183% 1184% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and 1185% related messages. The final outcome is that it is up to the TeX user 1186% to double the backslashes and otherwise make the string valid, so 1187% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to 1188% do this reliably, so we use it. 1189 1190% #1 is a control sequence in which to do the replacements, 1191% which we \xdef. 1192\def\txiescapepdf#1{% 1193 \ifx\pdfescapestring\thisisundefined 1194 % No primitive available; should we give a warning or log? 1195 % Many times it won't matter. 1196 \xdef#1{#1}% 1197 \else 1198 % The expandable \pdfescapestring primitive escapes parentheses, 1199 % backslashes, and other special chars. 1200 \xdef#1{\pdfescapestring{#1}}% 1201 \fi 1202} 1203\def\txiescapepdfutfsixteen#1{% 1204 \ifx\pdfescapestrutfsixteen\thisisundefined 1205 % No UTF-16 converting macro available. 1206 \txiescapepdf{#1}% 1207 \else 1208 \xdef#1{\pdfescapestrutfsixteen{#1}}% 1209 \fi 1210} 1211 1212\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images 1213with PDF output, and none of those formats could be found. (.eps cannot 1214be supported due to the design of the PDF format; use regular TeX (DVI 1215output) for that.)} 1216 1217\ifpdf 1218 % 1219 % Color manipulation macros using ideas from pdfcolor.tex, 1220 % except using rgb instead of cmyk; the latter is said to render as a 1221 % very dark gray on-screen and a very dark halftone in print, instead 1222 % of actual black. The dark red here is dark enough to print on paper as 1223 % nearly black, but still distinguishable for online viewing. We use 1224 % black by default, though. 1225 \def\rgbDarkRed{0.50 0.09 0.12} 1226 \def\rgbBlack{0 0 0} 1227 % 1228 % rg sets the color for filling (usual text, etc.); 1229 % RG sets the color for stroking (thin rules, e.g., normal _'s). 1230 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} 1231 % 1232 % Set color, and create a mark which defines \thiscolor accordingly, 1233 % so that \makeheadline knows which color to restore. 1234 \def\setcolor#1{% 1235 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% 1236 \domark 1237 \pdfsetcolor{#1}% 1238 } 1239 % 1240 \def\maincolor{\rgbBlack} 1241 \pdfsetcolor{\maincolor} 1242 \edef\thiscolor{\maincolor} 1243 \def\currentcolordefs{} 1244 % 1245 \def\makefootline{% 1246 \baselineskip24pt 1247 \line{\pdfsetcolor{\maincolor}\the\footline}% 1248 } 1249 % 1250 \def\makeheadline{% 1251 \vbox to 0pt{% 1252 \vskip-22.5pt 1253 \line{% 1254 \vbox to8.5pt{}% 1255 % Extract \thiscolor definition from the marks. 1256 \getcolormarks 1257 % Typeset the headline with \maincolor, then restore the color. 1258 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% 1259 }% 1260 \vss 1261 }% 1262 \nointerlineskip 1263 } 1264 % 1265 % 1266 \pdfcatalog{/PageMode /UseOutlines} 1267 % 1268 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). 1269 \def\dopdfimage#1#2#3{% 1270 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% 1271 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% 1272 % 1273 % pdftex (and the PDF format) support .pdf, .png, .jpg (among 1274 % others). Let's try in that order, PDF first since if 1275 % someone has a scalable image, presumably better to use that than a 1276 % bitmap. 1277 \let\pdfimgext=\empty 1278 \begingroup 1279 \openin 1 #1.pdf \ifeof 1 1280 \openin 1 #1.PDF \ifeof 1 1281 \openin 1 #1.png \ifeof 1 1282 \openin 1 #1.jpg \ifeof 1 1283 \openin 1 #1.jpeg \ifeof 1 1284 \openin 1 #1.JPG \ifeof 1 1285 \errhelp = \nopdfimagehelp 1286 \errmessage{Could not find image file #1 for pdf}% 1287 \else \gdef\pdfimgext{JPG}% 1288 \fi 1289 \else \gdef\pdfimgext{jpeg}% 1290 \fi 1291 \else \gdef\pdfimgext{jpg}% 1292 \fi 1293 \else \gdef\pdfimgext{png}% 1294 \fi 1295 \else \gdef\pdfimgext{PDF}% 1296 \fi 1297 \else \gdef\pdfimgext{pdf}% 1298 \fi 1299 \closein 1 1300 \endgroup 1301 % 1302 % without \immediate, ancient pdftex seg faults when the same image is 1303 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) 1304 \ifnum\pdftexversion < 14 1305 \immediate\pdfimage 1306 \else 1307 \immediate\pdfximage 1308 \fi 1309 \ifdim \wd0 >0pt width \pdfimagewidth \fi 1310 \ifdim \wd2 >0pt height \pdfimageheight \fi 1311 \ifnum\pdftexversion<13 1312 #1.\pdfimgext 1313 \else 1314 {#1.\pdfimgext}% 1315 \fi 1316 \ifnum\pdftexversion < 14 \else 1317 \pdfrefximage \pdflastximage 1318 \fi} 1319 % 1320 \def\setpdfdestname#1{{% 1321 % We have to set dummies so commands such as @code, and characters 1322 % such as \, aren't expanded when present in a section title. 1323 \indexnofonts 1324 \makevalueexpandable 1325 \turnoffactive 1326 \iftxiuseunicodedestname 1327 \ifx \declaredencoding \latone 1328 % Pass through Latin-1 characters. 1329 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode. 1330 \else 1331 \ifx \declaredencoding \utfeight 1332 % Pass through Unicode characters. 1333 \else 1334 % Use ASCII approximations in destination names. 1335 \passthroughcharsfalse 1336 \fi 1337 \fi 1338 \else 1339 % Use ASCII approximations in destination names. 1340 \passthroughcharsfalse 1341 \fi 1342 \def\pdfdestname{#1}% 1343 \txiescapepdf\pdfdestname 1344 }} 1345 % 1346 \def\setpdfoutlinetext#1{{% 1347 \indexnofonts 1348 \makevalueexpandable 1349 \turnoffactive 1350 \ifx \declaredencoding \latone 1351 % The PDF format can use an extended form of Latin-1 in bookmark 1352 % strings. See Appendix D of the PDF Reference, Sixth Edition, for 1353 % the "PDFDocEncoding". 1354 \passthroughcharstrue 1355 % Pass through Latin-1 characters. 1356 % LuaTeX: Convert to Unicode 1357 % pdfTeX: Use Latin-1 as PDFDocEncoding 1358 \def\pdfoutlinetext{#1}% 1359 \else 1360 \ifx \declaredencoding \utfeight 1361 \ifx\luatexversion\thisisundefined 1362 % For pdfTeX with UTF-8. 1363 % TODO: the PDF format can use UTF-16 in bookmark strings, 1364 % but the code for this isn't done yet. 1365 % Use ASCII approximations. 1366 \passthroughcharsfalse 1367 \def\pdfoutlinetext{#1}% 1368 \else 1369 % For LuaTeX with UTF-8. 1370 % Pass through Unicode characters for title texts. 1371 \passthroughcharstrue 1372 \def\pdfoutlinetext{#1}% 1373 \fi 1374 \else 1375 % For non-Latin-1 or non-UTF-8 encodings. 1376 % Use ASCII approximations. 1377 \passthroughcharsfalse 1378 \def\pdfoutlinetext{#1}% 1379 \fi 1380 \fi 1381 % LuaTeX: Convert to UTF-16 1382 % pdfTeX: Use Latin-1 as PDFDocEncoding 1383 \txiescapepdfutfsixteen\pdfoutlinetext 1384 }} 1385 % 1386 \def\pdfmkdest#1{% 1387 \setpdfdestname{#1}% 1388 \safewhatsit{\pdfdest name{\pdfdestname} xyz}% 1389 } 1390 % 1391 % used to mark target names; must be expandable. 1392 \def\pdfmkpgn#1{#1} 1393 % 1394 % by default, use black for everything. 1395 \def\urlcolor{\rgbBlack} 1396 \def\linkcolor{\rgbBlack} 1397 \def\endlink{\setcolor{\maincolor}\pdfendlink} 1398 % 1399 % Adding outlines to PDF; macros for calculating structure of outlines 1400 % come from Petr Olsak 1401 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% 1402 \else \csname#1\endcsname \fi} 1403 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax 1404 \advance\tempnum by 1 1405 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} 1406 % 1407 % #1 is the section text, which is what will be displayed in the 1408 % outline by the pdf viewer. #2 is the pdf expression for the number 1409 % of subentries (or empty, for subsubsections). #3 is the node text, 1410 % which might be empty if this toc entry had no corresponding node. 1411 % #4 is the page number 1412 % 1413 \def\dopdfoutline#1#2#3#4{% 1414 % Generate a link to the node text if that exists; else, use the 1415 % page number. We could generate a destination for the section 1416 % text in the case where a section has no node, but it doesn't 1417 % seem worth the trouble, since most documents are normally structured. 1418 \setpdfoutlinetext{#1} 1419 \setpdfdestname{#3} 1420 \ifx\pdfdestname\empty 1421 \def\pdfdestname{#4}% 1422 \fi 1423 % 1424 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% 1425 } 1426 % 1427 \def\pdfmakeoutlines{% 1428 \begingroup 1429 % Read toc silently, to get counts of subentries for \pdfoutline. 1430 \def\partentry##1##2##3##4{}% ignore parts in the outlines 1431 \def\numchapentry##1##2##3##4{% 1432 \def\thischapnum{##2}% 1433 \def\thissecnum{0}% 1434 \def\thissubsecnum{0}% 1435 }% 1436 \def\numsecentry##1##2##3##4{% 1437 \advancenumber{chap\thischapnum}% 1438 \def\thissecnum{##2}% 1439 \def\thissubsecnum{0}% 1440 }% 1441 \def\numsubsecentry##1##2##3##4{% 1442 \advancenumber{sec\thissecnum}% 1443 \def\thissubsecnum{##2}% 1444 }% 1445 \def\numsubsubsecentry##1##2##3##4{% 1446 \advancenumber{subsec\thissubsecnum}% 1447 }% 1448 \def\thischapnum{0}% 1449 \def\thissecnum{0}% 1450 \def\thissubsecnum{0}% 1451 % 1452 % use \def rather than \let here because we redefine \chapentry et 1453 % al. a second time, below. 1454 \def\appentry{\numchapentry}% 1455 \def\appsecentry{\numsecentry}% 1456 \def\appsubsecentry{\numsubsecentry}% 1457 \def\appsubsubsecentry{\numsubsubsecentry}% 1458 \def\unnchapentry{\numchapentry}% 1459 \def\unnsecentry{\numsecentry}% 1460 \def\unnsubsecentry{\numsubsecentry}% 1461 \def\unnsubsubsecentry{\numsubsubsecentry}% 1462 \readdatafile{toc}% 1463 % 1464 % Read toc second time, this time actually producing the outlines. 1465 % The `-' means take the \expnumber as the absolute number of 1466 % subentries, which we calculated on our first read of the .toc above. 1467 % 1468 % We use the node names as the destinations. 1469 % 1470 % Currently we prefix the section name with the section number 1471 % for chapter and appendix headings only in order to avoid too much 1472 % horizontal space being required in the PDF viewer. 1473 \def\numchapentry##1##2##3##4{% 1474 \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}% 1475 \def\unnchapentry##1##2##3##4{% 1476 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% 1477 \def\numsecentry##1##2##3##4{% 1478 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% 1479 \def\numsubsecentry##1##2##3##4{% 1480 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% 1481 \def\numsubsubsecentry##1##2##3##4{% count is always zero 1482 \dopdfoutline{##1}{}{##3}{##4}}% 1483 % 1484 % PDF outlines are displayed using system fonts, instead of 1485 % document fonts. Therefore we cannot use special characters, 1486 % since the encoding is unknown. For example, the eogonek from 1487 % Latin 2 (0xea) gets translated to a | character. Info from 1488 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. 1489 % 1490 % TODO this right, we have to translate 8-bit characters to 1491 % their "best" equivalent, based on the @documentencoding. Too 1492 % much work for too little return. Just use the ASCII equivalents 1493 % we use for the index sort strings. 1494 % 1495 \indexnofonts 1496 \setupdatafile 1497 % We can have normal brace characters in the PDF outlines, unlike 1498 % Texinfo index files. So set that up. 1499 \def\{{\lbracecharliteral}% 1500 \def\}{\rbracecharliteral}% 1501 \catcode`\\=\active \otherbackslash 1502 \input \tocreadfilename 1503 \endgroup 1504 } 1505 {\catcode`[=1 \catcode`]=2 1506 \catcode`{=\other \catcode`}=\other 1507 \gdef\lbracecharliteral[{]% 1508 \gdef\rbracecharliteral[}]% 1509 ] 1510 % 1511 \def\skipspaces#1{\def\PP{#1}\def\D{|}% 1512 \ifx\PP\D\let\nextsp\relax 1513 \else\let\nextsp\skipspaces 1514 \addtokens{\filename}{\PP}% 1515 \advance\filenamelength by 1 1516 \fi 1517 \nextsp} 1518 \def\getfilename#1{% 1519 \filenamelength=0 1520 % If we don't expand the argument now, \skipspaces will get 1521 % snagged on things like "@value{foo}". 1522 \edef\temp{#1}% 1523 \expandafter\skipspaces\temp|\relax 1524 } 1525 \ifnum\pdftexversion < 14 1526 \let \startlink \pdfannotlink 1527 \else 1528 \let \startlink \pdfstartlink 1529 \fi 1530 % make a live url in pdf output. 1531 \def\pdfurl#1{% 1532 \begingroup 1533 % it seems we really need yet another set of dummies; have not 1534 % tried to figure out what each command should do in the context 1535 % of @url. for now, just make @/ a no-op, that's the only one 1536 % people have actually reported a problem with. 1537 % 1538 \normalturnoffactive 1539 \def\@{@}% 1540 \let\/=\empty 1541 \makevalueexpandable 1542 % do we want to go so far as to use \indexnofonts instead of just 1543 % special-casing \var here? 1544 \def\var##1{##1}% 1545 % 1546 \leavevmode\setcolor{\urlcolor}% 1547 \startlink attr{/Border [0 0 0]}% 1548 user{/Subtype /Link /A << /S /URI /URI (#1) >>}% 1549 \endgroup} 1550 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may 1551 % be a simple number, or a list of numbers in the case of an index 1552 % entry. 1553 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} 1554 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 1555 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} 1556 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} 1557 \def\maketoks{% 1558 \expandafter\poptoks\the\toksA|ENDTOKS|\relax 1559 \ifx\first0\adn0 1560 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 1561 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 1562 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 1563 \else 1564 \ifnum0=\countA\else\makelink\fi 1565 \ifx\first.\let\next=\done\else 1566 \let\next=\maketoks 1567 \addtokens{\toksB}{\the\toksD} 1568 \ifx\first,\addtokens{\toksB}{\space}\fi 1569 \fi 1570 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 1571 \next} 1572 \def\makelink{\addtokens{\toksB}% 1573 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} 1574 \def\pdflink#1{% 1575 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} 1576 \setcolor{\linkcolor}#1\endlink} 1577 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} 1578\else 1579 % non-pdf mode 1580 \let\pdfmkdest = \gobble 1581 \let\pdfurl = \gobble 1582 \let\endlink = \relax 1583 \let\setcolor = \gobble 1584 \let\pdfsetcolor = \gobble 1585 \let\pdfmakeoutlines = \relax 1586\fi % \ifx\pdfoutput 1587 1588% 1589% For XeTeX 1590% 1591\ifx\XeTeXrevision\thisisundefined 1592\else 1593 % 1594 % XeTeX version check 1595 % 1596 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1 1597 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307. 1598 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941). 1599 % For avoiding PDF destination name replacement, we use this special 1600 % instead of xdvipdfmx's command line option `-C 0x0010'. 1601 \special{dvipdfmx:config C 0x0010} 1602 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+. 1603 % It can handle Unicode destination names for PDF. 1604 \txiuseunicodedestnametrue 1605 \else 1606 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the 1607 % `dvipdfmx:config' special. 1608 % So for avoiding PDF destination name replacement, 1609 % xdvipdfmx's command line option `-C 0x0010' is necessary. 1610 % 1611 % XeTeX < 0.99995 can not handle Unicode destination names for PDF 1612 % because xdvipdfmx 20150315 has a UTF-16 conversion issue. 1613 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). 1614 \txiuseunicodedestnamefalse 1615 \fi 1616 % 1617 % Color support 1618 % 1619 \def\rgbDarkRed{0.50 0.09 0.12} 1620 \def\rgbBlack{0 0 0} 1621 % 1622 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}} 1623 % 1624 % Set color, and create a mark which defines \thiscolor accordingly, 1625 % so that \makeheadline knows which color to restore. 1626 \def\setcolor#1{% 1627 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% 1628 \domark 1629 \pdfsetcolor{#1}% 1630 } 1631 % 1632 \def\maincolor{\rgbBlack} 1633 \pdfsetcolor{\maincolor} 1634 \edef\thiscolor{\maincolor} 1635 \def\currentcolordefs{} 1636 % 1637 \def\makefootline{% 1638 \baselineskip24pt 1639 \line{\pdfsetcolor{\maincolor}\the\footline}% 1640 } 1641 % 1642 \def\makeheadline{% 1643 \vbox to 0pt{% 1644 \vskip-22.5pt 1645 \line{% 1646 \vbox to8.5pt{}% 1647 % Extract \thiscolor definition from the marks. 1648 \getcolormarks 1649 % Typeset the headline with \maincolor, then restore the color. 1650 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% 1651 }% 1652 \vss 1653 }% 1654 \nointerlineskip 1655 } 1656 % 1657 % PDF outline support 1658 % 1659 % Emulate pdfTeX primitive 1660 \def\pdfdest name#1 xyz{% 1661 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}% 1662 } 1663 % 1664 \def\setpdfdestname#1{{% 1665 % We have to set dummies so commands such as @code, and characters 1666 % such as \, aren't expanded when present in a section title. 1667 \indexnofonts 1668 \makevalueexpandable 1669 \turnoffactive 1670 \iftxiuseunicodedestname 1671 % Pass through Unicode characters. 1672 \else 1673 % Use ASCII approximations in destination names. 1674 \passthroughcharsfalse 1675 \fi 1676 \def\pdfdestname{#1}% 1677 \txiescapepdf\pdfdestname 1678 }} 1679 % 1680 \def\setpdfoutlinetext#1{{% 1681 \turnoffactive 1682 % Always use Unicode characters in title texts. 1683 \def\pdfoutlinetext{#1}% 1684 % For XeTeX, xdvipdfmx converts to UTF-16. 1685 % So we do not convert. 1686 \txiescapepdf\pdfoutlinetext 1687 }} 1688 % 1689 \def\pdfmkdest#1{% 1690 \setpdfdestname{#1}% 1691 \safewhatsit{\pdfdest name{\pdfdestname} xyz}% 1692 } 1693 % 1694 % by default, use black for everything. 1695 \def\urlcolor{\rgbBlack} 1696 \def\linkcolor{\rgbBlack} 1697 \def\endlink{\setcolor{\maincolor}\pdfendlink} 1698 % 1699 \def\dopdfoutline#1#2#3#4{% 1700 \setpdfoutlinetext{#1} 1701 \setpdfdestname{#3} 1702 \ifx\pdfdestname\empty 1703 \def\pdfdestname{#4}% 1704 \fi 1705 % 1706 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A 1707 << /S /GoTo /D (\pdfdestname) >> >> }% 1708 } 1709 % 1710 \def\pdfmakeoutlines{% 1711 \begingroup 1712 % 1713 % For XeTeX, counts of subentries are not necessary. 1714 % Therefore, we read toc only once. 1715 % 1716 % We use node names as destinations. 1717 % 1718 % Currently we prefix the section name with the section number 1719 % for chapter and appendix headings only in order to avoid too much 1720 % horizontal space being required in the PDF viewer. 1721 \def\partentry##1##2##3##4{}% ignore parts in the outlines 1722 \def\numchapentry##1##2##3##4{% 1723 \dopdfoutline{##2 ##1}{1}{##3}{##4}}% 1724 \def\numsecentry##1##2##3##4{% 1725 \dopdfoutline{##1}{2}{##3}{##4}}% 1726 \def\numsubsecentry##1##2##3##4{% 1727 \dopdfoutline{##1}{3}{##3}{##4}}% 1728 \def\numsubsubsecentry##1##2##3##4{% 1729 \dopdfoutline{##1}{4}{##3}{##4}}% 1730 % 1731 \let\appentry\numchapentry% 1732 \let\appsecentry\numsecentry% 1733 \let\appsubsecentry\numsubsecentry% 1734 \let\appsubsubsecentry\numsubsubsecentry% 1735 \def\unnchapentry##1##2##3##4{% 1736 \dopdfoutline{##1}{1}{##3}{##4}}% 1737 \let\unnsecentry\numsecentry% 1738 \let\unnsubsecentry\numsubsecentry% 1739 \let\unnsubsubsecentry\numsubsubsecentry% 1740 % 1741 % For XeTeX, xdvipdfmx converts strings to UTF-16. 1742 % Therefore, the encoding and the language may not be considered. 1743 % 1744 \indexnofonts 1745 \setupdatafile 1746 % We can have normal brace characters in the PDF outlines, unlike 1747 % Texinfo index files. So set that up. 1748 \def\{{\lbracecharliteral}% 1749 \def\}{\rbracecharliteral}% 1750 \catcode`\\=\active \otherbackslash 1751 \input \tocreadfilename 1752 \endgroup 1753 } 1754 {\catcode`[=1 \catcode`]=2 1755 \catcode`{=\other \catcode`}=\other 1756 \gdef\lbracecharliteral[{]% 1757 \gdef\rbracecharliteral[}]% 1758 ] 1759 1760 \special{pdf:docview << /PageMode /UseOutlines >> } 1761 % ``\special{pdf:tounicode ...}'' is not necessary 1762 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it. 1763 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315, 1764 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings. 1765 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). 1766% 1767 \def\skipspaces#1{\def\PP{#1}\def\D{|}% 1768 \ifx\PP\D\let\nextsp\relax 1769 \else\let\nextsp\skipspaces 1770 \addtokens{\filename}{\PP}% 1771 \advance\filenamelength by 1 1772 \fi 1773 \nextsp} 1774 \def\getfilename#1{% 1775 \filenamelength=0 1776 % If we don't expand the argument now, \skipspaces will get 1777 % snagged on things like "@value{foo}". 1778 \edef\temp{#1}% 1779 \expandafter\skipspaces\temp|\relax 1780 } 1781 % make a live url in pdf output. 1782 \def\pdfurl#1{% 1783 \begingroup 1784 % it seems we really need yet another set of dummies; have not 1785 % tried to figure out what each command should do in the context 1786 % of @url. for now, just make @/ a no-op, that's the only one 1787 % people have actually reported a problem with. 1788 % 1789 \normalturnoffactive 1790 \def\@{@}% 1791 \let\/=\empty 1792 \makevalueexpandable 1793 % do we want to go so far as to use \indexnofonts instead of just 1794 % special-casing \var here? 1795 \def\var##1{##1}% 1796 % 1797 \leavevmode\setcolor{\urlcolor}% 1798 \special{pdf:bann << /Border [0 0 0] 1799 /Subtype /Link /A << /S /URI /URI (#1) >> >>}% 1800 \endgroup} 1801 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}} 1802 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} 1803 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 1804 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} 1805 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} 1806 \def\maketoks{% 1807 \expandafter\poptoks\the\toksA|ENDTOKS|\relax 1808 \ifx\first0\adn0 1809 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 1810 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 1811 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 1812 \else 1813 \ifnum0=\countA\else\makelink\fi 1814 \ifx\first.\let\next=\done\else 1815 \let\next=\maketoks 1816 \addtokens{\toksB}{\the\toksD} 1817 \ifx\first,\addtokens{\toksB}{\space}\fi 1818 \fi 1819 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 1820 \next} 1821 \def\makelink{\addtokens{\toksB}% 1822 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} 1823 \def\pdflink#1{% 1824 \special{pdf:bann << /Border [0 0 0] 1825 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}% 1826 \setcolor{\linkcolor}#1\endlink} 1827 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} 1828% 1829 % 1830 % @image support 1831 % 1832 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). 1833 \def\doxeteximage#1#2#3{% 1834 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% 1835 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% 1836 % 1837 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among 1838 % others). Let's try in that order, PDF first since if 1839 % someone has a scalable image, presumably better to use that than a 1840 % bitmap. 1841 \let\xeteximgext=\empty 1842 \begingroup 1843 \openin 1 #1.pdf \ifeof 1 1844 \openin 1 #1.PDF \ifeof 1 1845 \openin 1 #1.png \ifeof 1 1846 \openin 1 #1.jpg \ifeof 1 1847 \openin 1 #1.jpeg \ifeof 1 1848 \openin 1 #1.JPG \ifeof 1 1849 \errmessage{Could not find image file #1 for XeTeX}% 1850 \else \gdef\xeteximgext{JPG}% 1851 \fi 1852 \else \gdef\xeteximgext{jpeg}% 1853 \fi 1854 \else \gdef\xeteximgext{jpg}% 1855 \fi 1856 \else \gdef\xeteximgext{png}% 1857 \fi 1858 \else \gdef\xeteximgext{PDF}% 1859 \fi 1860 \else \gdef\xeteximgext{pdf}% 1861 \fi 1862 \closein 1 1863 \endgroup 1864 % 1865 \def\xetexpdfext{pdf}% 1866 \ifx\xeteximgext\xetexpdfext 1867 \XeTeXpdffile "#1".\xeteximgext "" 1868 \else 1869 \def\xetexpdfext{PDF}% 1870 \ifx\xeteximgext\xetexpdfext 1871 \XeTeXpdffile "#1".\xeteximgext "" 1872 \else 1873 \XeTeXpicfile "#1".\xeteximgext "" 1874 \fi 1875 \fi 1876 \ifdim \wd0 >0pt width \xeteximagewidth \fi 1877 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax 1878 } 1879\fi 1880 1881 1882% 1883\message{fonts,} 1884 1885% Set the baselineskip to #1, and the lineskip and strut size 1886% correspondingly. There is no deep meaning behind these magic numbers 1887% used as factors; they just match (closely enough) what Knuth defined. 1888% 1889\def\lineskipfactor{.08333} 1890\def\strutheightpercent{.70833} 1891\def\strutdepthpercent {.29167} 1892% 1893% can get a sort of poor man's double spacing by redefining this. 1894\def\baselinefactor{1} 1895% 1896\newdimen\textleading 1897\def\setleading#1{% 1898 \dimen0 = #1\relax 1899 \normalbaselineskip = \baselinefactor\dimen0 1900 \normallineskip = \lineskipfactor\normalbaselineskip 1901 \normalbaselines 1902 \setbox\strutbox =\hbox{% 1903 \vrule width0pt height\strutheightpercent\baselineskip 1904 depth \strutdepthpercent \baselineskip 1905 }% 1906} 1907 1908% PDF CMaps. See also LaTeX's t1.cmap. 1909% 1910% do nothing with this by default. 1911\expandafter\let\csname cmapOT1\endcsname\gobble 1912\expandafter\let\csname cmapOT1IT\endcsname\gobble 1913\expandafter\let\csname cmapOT1TT\endcsname\gobble 1914 1915% if we are producing pdf, and we have \pdffontattr, then define cmaps. 1916% (\pdffontattr was introduced many years ago, but people still run 1917% older pdftex's; it's easy to conditionalize, so we do.) 1918\ifpdf \ifx\pdffontattr\thisisundefined \else 1919 \begingroup 1920 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 1921 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 1922%%DocumentNeededResources: ProcSet (CIDInit) 1923%%IncludeResource: ProcSet (CIDInit) 1924%%BeginResource: CMap (TeX-OT1-0) 1925%%Title: (TeX-OT1-0 TeX OT1 0) 1926%%Version: 1.000 1927%%EndComments 1928/CIDInit /ProcSet findresource begin 192912 dict begin 1930begincmap 1931/CIDSystemInfo 1932<< /Registry (TeX) 1933/Ordering (OT1) 1934/Supplement 0 1935>> def 1936/CMapName /TeX-OT1-0 def 1937/CMapType 2 def 19381 begincodespacerange 1939<00> <7F> 1940endcodespacerange 19418 beginbfrange 1942<00> <01> <0393> 1943<09> <0A> <03A8> 1944<23> <26> <0023> 1945<28> <3B> <0028> 1946<3F> <5B> <003F> 1947<5D> <5E> <005D> 1948<61> <7A> <0061> 1949<7B> <7C> <2013> 1950endbfrange 195140 beginbfchar 1952<02> <0398> 1953<03> <039B> 1954<04> <039E> 1955<05> <03A0> 1956<06> <03A3> 1957<07> <03D2> 1958<08> <03A6> 1959<0B> <00660066> 1960<0C> <00660069> 1961<0D> <0066006C> 1962<0E> <006600660069> 1963<0F> <00660066006C> 1964<10> <0131> 1965<11> <0237> 1966<12> <0060> 1967<13> <00B4> 1968<14> <02C7> 1969<15> <02D8> 1970<16> <00AF> 1971<17> <02DA> 1972<18> <00B8> 1973<19> <00DF> 1974<1A> <00E6> 1975<1B> <0153> 1976<1C> <00F8> 1977<1D> <00C6> 1978<1E> <0152> 1979<1F> <00D8> 1980<21> <0021> 1981<22> <201D> 1982<27> <2019> 1983<3C> <00A1> 1984<3D> <003D> 1985<3E> <00BF> 1986<5C> <201C> 1987<5F> <02D9> 1988<60> <2018> 1989<7D> <02DD> 1990<7E> <007E> 1991<7F> <00A8> 1992endbfchar 1993endcmap 1994CMapName currentdict /CMap defineresource pop 1995end 1996end 1997%%EndResource 1998%%EOF 1999 }\endgroup 2000 \expandafter\edef\csname cmapOT1\endcsname#1{% 2001 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 2002 }% 2003% 2004% \cmapOT1IT 2005 \begingroup 2006 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 2007 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 2008%%DocumentNeededResources: ProcSet (CIDInit) 2009%%IncludeResource: ProcSet (CIDInit) 2010%%BeginResource: CMap (TeX-OT1IT-0) 2011%%Title: (TeX-OT1IT-0 TeX OT1IT 0) 2012%%Version: 1.000 2013%%EndComments 2014/CIDInit /ProcSet findresource begin 201512 dict begin 2016begincmap 2017/CIDSystemInfo 2018<< /Registry (TeX) 2019/Ordering (OT1IT) 2020/Supplement 0 2021>> def 2022/CMapName /TeX-OT1IT-0 def 2023/CMapType 2 def 20241 begincodespacerange 2025<00> <7F> 2026endcodespacerange 20278 beginbfrange 2028<00> <01> <0393> 2029<09> <0A> <03A8> 2030<25> <26> <0025> 2031<28> <3B> <0028> 2032<3F> <5B> <003F> 2033<5D> <5E> <005D> 2034<61> <7A> <0061> 2035<7B> <7C> <2013> 2036endbfrange 203742 beginbfchar 2038<02> <0398> 2039<03> <039B> 2040<04> <039E> 2041<05> <03A0> 2042<06> <03A3> 2043<07> <03D2> 2044<08> <03A6> 2045<0B> <00660066> 2046<0C> <00660069> 2047<0D> <0066006C> 2048<0E> <006600660069> 2049<0F> <00660066006C> 2050<10> <0131> 2051<11> <0237> 2052<12> <0060> 2053<13> <00B4> 2054<14> <02C7> 2055<15> <02D8> 2056<16> <00AF> 2057<17> <02DA> 2058<18> <00B8> 2059<19> <00DF> 2060<1A> <00E6> 2061<1B> <0153> 2062<1C> <00F8> 2063<1D> <00C6> 2064<1E> <0152> 2065<1F> <00D8> 2066<21> <0021> 2067<22> <201D> 2068<23> <0023> 2069<24> <00A3> 2070<27> <2019> 2071<3C> <00A1> 2072<3D> <003D> 2073<3E> <00BF> 2074<5C> <201C> 2075<5F> <02D9> 2076<60> <2018> 2077<7D> <02DD> 2078<7E> <007E> 2079<7F> <00A8> 2080endbfchar 2081endcmap 2082CMapName currentdict /CMap defineresource pop 2083end 2084end 2085%%EndResource 2086%%EOF 2087 }\endgroup 2088 \expandafter\edef\csname cmapOT1IT\endcsname#1{% 2089 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 2090 }% 2091% 2092% \cmapOT1TT 2093 \begingroup 2094 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 2095 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 2096%%DocumentNeededResources: ProcSet (CIDInit) 2097%%IncludeResource: ProcSet (CIDInit) 2098%%BeginResource: CMap (TeX-OT1TT-0) 2099%%Title: (TeX-OT1TT-0 TeX OT1TT 0) 2100%%Version: 1.000 2101%%EndComments 2102/CIDInit /ProcSet findresource begin 210312 dict begin 2104begincmap 2105/CIDSystemInfo 2106<< /Registry (TeX) 2107/Ordering (OT1TT) 2108/Supplement 0 2109>> def 2110/CMapName /TeX-OT1TT-0 def 2111/CMapType 2 def 21121 begincodespacerange 2113<00> <7F> 2114endcodespacerange 21155 beginbfrange 2116<00> <01> <0393> 2117<09> <0A> <03A8> 2118<21> <26> <0021> 2119<28> <5F> <0028> 2120<61> <7E> <0061> 2121endbfrange 212232 beginbfchar 2123<02> <0398> 2124<03> <039B> 2125<04> <039E> 2126<05> <03A0> 2127<06> <03A3> 2128<07> <03D2> 2129<08> <03A6> 2130<0B> <2191> 2131<0C> <2193> 2132<0D> <0027> 2133<0E> <00A1> 2134<0F> <00BF> 2135<10> <0131> 2136<11> <0237> 2137<12> <0060> 2138<13> <00B4> 2139<14> <02C7> 2140<15> <02D8> 2141<16> <00AF> 2142<17> <02DA> 2143<18> <00B8> 2144<19> <00DF> 2145<1A> <00E6> 2146<1B> <0153> 2147<1C> <00F8> 2148<1D> <00C6> 2149<1E> <0152> 2150<1F> <00D8> 2151<20> <2423> 2152<27> <2019> 2153<60> <2018> 2154<7F> <00A8> 2155endbfchar 2156endcmap 2157CMapName currentdict /CMap defineresource pop 2158end 2159end 2160%%EndResource 2161%%EOF 2162 }\endgroup 2163 \expandafter\edef\csname cmapOT1TT\endcsname#1{% 2164 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 2165 }% 2166\fi\fi 2167 2168 2169% Set the font macro #1 to the font named \fontprefix#2. 2170% #3 is the font's design size, #4 is a scale factor, #5 is the CMap 2171% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). 2172% Example: 2173% #1 = \textrm 2174% #2 = \rmshape 2175% #3 = 10 2176% #4 = \mainmagstep 2177% #5 = OT1 2178% 2179\def\setfont#1#2#3#4#5{% 2180 \font#1=\fontprefix#2#3 scaled #4 2181 \csname cmap#5\endcsname#1% 2182} 2183% This is what gets called when #5 of \setfont is empty. 2184\let\cmap\gobble 2185% 2186% (end of cmaps) 2187 2188% Use cm as the default font prefix. 2189% To specify the font prefix, you must define \fontprefix 2190% before you read in texinfo.tex. 2191\ifx\fontprefix\thisisundefined 2192\def\fontprefix{cm} 2193\fi 2194% Support font families that don't use the same naming scheme as CM. 2195\def\rmshape{r} 2196\def\rmbshape{bx} % where the normal face is bold 2197\def\bfshape{b} 2198\def\bxshape{bx} 2199\def\ttshape{tt} 2200\def\ttbshape{tt} 2201\def\ttslshape{sltt} 2202\def\itshape{ti} 2203\def\itbshape{bxti} 2204\def\slshape{sl} 2205\def\slbshape{bxsl} 2206\def\sfshape{ss} 2207\def\sfbshape{ss} 2208\def\scshape{csc} 2209\def\scbshape{csc} 2210 2211% Definitions for a main text size of 11pt. (The default in Texinfo.) 2212% 2213\def\definetextfontsizexi{% 2214% Text fonts (11.2pt, magstep1). 2215\def\textnominalsize{11pt} 2216\edef\mainmagstep{\magstephalf} 2217\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} 2218\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} 2219\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} 2220\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} 2221\setfont\textsl\slshape{10}{\mainmagstep}{OT1} 2222\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} 2223\setfont\textsc\scshape{10}{\mainmagstep}{OT1} 2224\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} 2225\font\texti=cmmi10 scaled \mainmagstep 2226\font\textsy=cmsy10 scaled \mainmagstep 2227\def\textecsize{1095} 2228 2229% A few fonts for @defun names and args. 2230\setfont\defbf\bfshape{10}{\magstep1}{OT1} 2231\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} 2232\setfont\defsl\slshape{10}{\magstep1}{OT1} 2233\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} 2234\def\df{\let\ttfont=\deftt \let\bffont = \defbf 2235\let\ttslfont=\defttsl \let\slfont=\defsl \bf} 2236 2237% Fonts for indices, footnotes, small examples (9pt). 2238\def\smallnominalsize{9pt} 2239\setfont\smallrm\rmshape{9}{1000}{OT1} 2240\setfont\smalltt\ttshape{9}{1000}{OT1TT} 2241\setfont\smallbf\bfshape{10}{900}{OT1} 2242\setfont\smallit\itshape{9}{1000}{OT1IT} 2243\setfont\smallsl\slshape{9}{1000}{OT1} 2244\setfont\smallsf\sfshape{9}{1000}{OT1} 2245\setfont\smallsc\scshape{10}{900}{OT1} 2246\setfont\smallttsl\ttslshape{10}{900}{OT1TT} 2247\font\smalli=cmmi9 2248\font\smallsy=cmsy9 2249\def\smallecsize{0900} 2250 2251% Fonts for small examples (8pt). 2252\def\smallernominalsize{8pt} 2253\setfont\smallerrm\rmshape{8}{1000}{OT1} 2254\setfont\smallertt\ttshape{8}{1000}{OT1TT} 2255\setfont\smallerbf\bfshape{10}{800}{OT1} 2256\setfont\smallerit\itshape{8}{1000}{OT1IT} 2257\setfont\smallersl\slshape{8}{1000}{OT1} 2258\setfont\smallersf\sfshape{8}{1000}{OT1} 2259\setfont\smallersc\scshape{10}{800}{OT1} 2260\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} 2261\font\smalleri=cmmi8 2262\font\smallersy=cmsy8 2263\def\smallerecsize{0800} 2264 2265% Fonts for math mode superscripts (7pt). 2266\def\sevennominalsize{7pt} 2267\setfont\sevenrm\rmshape{7}{1000}{OT1} 2268\setfont\seventt\ttshape{10}{700}{OT1TT} 2269\setfont\sevenbf\bfshape{10}{700}{OT1} 2270\setfont\sevenit\itshape{7}{1000}{OT1IT} 2271\setfont\sevensl\slshape{10}{700}{OT1} 2272\setfont\sevensf\sfshape{10}{700}{OT1} 2273\setfont\sevensc\scshape{10}{700}{OT1} 2274\setfont\seventtsl\ttslshape{10}{700}{OT1TT} 2275\font\seveni=cmmi7 2276\font\sevensy=cmsy7 2277\def\sevenecsize{0700} 2278 2279% Fonts for title page (20.4pt): 2280\def\titlenominalsize{20pt} 2281\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} 2282\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} 2283\setfont\titlesl\slbshape{10}{\magstep4}{OT1} 2284\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} 2285\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} 2286\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} 2287\let\titlebf=\titlerm 2288\setfont\titlesc\scbshape{10}{\magstep4}{OT1} 2289\font\titlei=cmmi12 scaled \magstep3 2290\font\titlesy=cmsy10 scaled \magstep4 2291\def\titleecsize{2074} 2292 2293% Chapter (and unnumbered) fonts (17.28pt). 2294\def\chapnominalsize{17pt} 2295\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} 2296\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} 2297\setfont\chapsl\slbshape{10}{\magstep3}{OT1} 2298\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} 2299\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} 2300\setfont\chapsf\sfbshape{17}{1000}{OT1} 2301\let\chapbf=\chaprm 2302\setfont\chapsc\scbshape{10}{\magstep3}{OT1} 2303\font\chapi=cmmi12 scaled \magstep2 2304\font\chapsy=cmsy10 scaled \magstep3 2305\def\chapecsize{1728} 2306 2307% Section fonts (14.4pt). 2308\def\secnominalsize{14pt} 2309\setfont\secrm\rmbshape{12}{\magstep1}{OT1} 2310\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1} 2311\setfont\secit\itbshape{10}{\magstep2}{OT1IT} 2312\setfont\secsl\slbshape{10}{\magstep2}{OT1} 2313\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} 2314\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} 2315\setfont\secsf\sfbshape{12}{\magstep1}{OT1} 2316\let\secbf\secrm 2317\setfont\secsc\scbshape{10}{\magstep2}{OT1} 2318\font\seci=cmmi12 scaled \magstep1 2319\font\secsy=cmsy10 scaled \magstep2 2320\def\sececsize{1440} 2321 2322% Subsection fonts (13.15pt). 2323\def\ssecnominalsize{13pt} 2324\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} 2325\setfont\ssecit\itbshape{10}{1315}{OT1IT} 2326\setfont\ssecsl\slbshape{10}{1315}{OT1} 2327\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} 2328\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} 2329\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} 2330\let\ssecbf\ssecrm 2331\setfont\ssecsc\scbshape{10}{1315}{OT1} 2332\font\sseci=cmmi12 scaled \magstephalf 2333\font\ssecsy=cmsy10 scaled 1315 2334\def\ssececsize{1200} 2335 2336% Reduced fonts for @acronym in text (10pt). 2337\def\reducednominalsize{10pt} 2338\setfont\reducedrm\rmshape{10}{1000}{OT1} 2339\setfont\reducedtt\ttshape{10}{1000}{OT1TT} 2340\setfont\reducedbf\bfshape{10}{1000}{OT1} 2341\setfont\reducedit\itshape{10}{1000}{OT1IT} 2342\setfont\reducedsl\slshape{10}{1000}{OT1} 2343\setfont\reducedsf\sfshape{10}{1000}{OT1} 2344\setfont\reducedsc\scshape{10}{1000}{OT1} 2345\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} 2346\font\reducedi=cmmi10 2347\font\reducedsy=cmsy10 2348\def\reducedecsize{1000} 2349 2350\textleading = 13.2pt % line spacing for 11pt CM 2351\textfonts % reset the current fonts 2352\rm 2353} % end of 11pt text font size definitions, \definetextfontsizexi 2354 2355 2356% Definitions to make the main text be 10pt Computer Modern, with 2357% section, chapter, etc., sizes following suit. This is for the GNU 2358% Press printing of the Emacs 22 manual. Maybe other manuals in the 2359% future. Used with @smallbook, which sets the leading to 12pt. 2360% 2361\def\definetextfontsizex{% 2362% Text fonts (10pt). 2363\def\textnominalsize{10pt} 2364\edef\mainmagstep{1000} 2365\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} 2366\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} 2367\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} 2368\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} 2369\setfont\textsl\slshape{10}{\mainmagstep}{OT1} 2370\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} 2371\setfont\textsc\scshape{10}{\mainmagstep}{OT1} 2372\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} 2373\font\texti=cmmi10 scaled \mainmagstep 2374\font\textsy=cmsy10 scaled \mainmagstep 2375\def\textecsize{1000} 2376 2377% A few fonts for @defun names and args. 2378\setfont\defbf\bfshape{10}{\magstephalf}{OT1} 2379\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} 2380\setfont\defsl\slshape{10}{\magstephalf}{OT1} 2381\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} 2382\def\df{\let\ttfont=\deftt \let\bffont = \defbf 2383\let\slfont=\defsl \let\ttslfont=\defttsl \bf} 2384 2385% Fonts for indices, footnotes, small examples (9pt). 2386\def\smallnominalsize{9pt} 2387\setfont\smallrm\rmshape{9}{1000}{OT1} 2388\setfont\smalltt\ttshape{9}{1000}{OT1TT} 2389\setfont\smallbf\bfshape{10}{900}{OT1} 2390\setfont\smallit\itshape{9}{1000}{OT1IT} 2391\setfont\smallsl\slshape{9}{1000}{OT1} 2392\setfont\smallsf\sfshape{9}{1000}{OT1} 2393\setfont\smallsc\scshape{10}{900}{OT1} 2394\setfont\smallttsl\ttslshape{10}{900}{OT1TT} 2395\font\smalli=cmmi9 2396\font\smallsy=cmsy9 2397\def\smallecsize{0900} 2398 2399% Fonts for small examples (8pt). 2400\def\smallernominalsize{8pt} 2401\setfont\smallerrm\rmshape{8}{1000}{OT1} 2402\setfont\smallertt\ttshape{8}{1000}{OT1TT} 2403\setfont\smallerbf\bfshape{10}{800}{OT1} 2404\setfont\smallerit\itshape{8}{1000}{OT1IT} 2405\setfont\smallersl\slshape{8}{1000}{OT1} 2406\setfont\smallersf\sfshape{8}{1000}{OT1} 2407\setfont\smallersc\scshape{10}{800}{OT1} 2408\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} 2409\font\smalleri=cmmi8 2410\font\smallersy=cmsy8 2411\def\smallerecsize{0800} 2412 2413% Fonts for math mode superscripts (7pt). 2414\def\sevennominalsize{7pt} 2415\setfont\sevenrm\rmshape{7}{1000}{OT1} 2416\setfont\seventt\ttshape{10}{700}{OT1TT} 2417\setfont\sevenbf\bfshape{10}{700}{OT1} 2418\setfont\sevenit\itshape{7}{1000}{OT1IT} 2419\setfont\sevensl\slshape{10}{700}{OT1} 2420\setfont\sevensf\sfshape{10}{700}{OT1} 2421\setfont\sevensc\scshape{10}{700}{OT1} 2422\setfont\seventtsl\ttslshape{10}{700}{OT1TT} 2423\font\seveni=cmmi7 2424\font\sevensy=cmsy7 2425\def\sevenecsize{0700} 2426 2427% Fonts for title page (20.4pt): 2428\def\titlenominalsize{20pt} 2429\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} 2430\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} 2431\setfont\titlesl\slbshape{10}{\magstep4}{OT1} 2432\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} 2433\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} 2434\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} 2435\let\titlebf=\titlerm 2436\setfont\titlesc\scbshape{10}{\magstep4}{OT1} 2437\font\titlei=cmmi12 scaled \magstep3 2438\font\titlesy=cmsy10 scaled \magstep4 2439\def\titleecsize{2074} 2440 2441% Chapter fonts (14.4pt). 2442\def\chapnominalsize{14pt} 2443\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} 2444\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} 2445\setfont\chapsl\slbshape{10}{\magstep2}{OT1} 2446\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} 2447\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} 2448\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} 2449\let\chapbf\chaprm 2450\setfont\chapsc\scbshape{10}{\magstep2}{OT1} 2451\font\chapi=cmmi12 scaled \magstep1 2452\font\chapsy=cmsy10 scaled \magstep2 2453\def\chapecsize{1440} 2454 2455% Section fonts (12pt). 2456\def\secnominalsize{12pt} 2457\setfont\secrm\rmbshape{12}{1000}{OT1} 2458\setfont\secit\itbshape{10}{\magstep1}{OT1IT} 2459\setfont\secsl\slbshape{10}{\magstep1}{OT1} 2460\setfont\sectt\ttbshape{12}{1000}{OT1TT} 2461\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} 2462\setfont\secsf\sfbshape{12}{1000}{OT1} 2463\let\secbf\secrm 2464\setfont\secsc\scbshape{10}{\magstep1}{OT1} 2465\font\seci=cmmi12 2466\font\secsy=cmsy10 scaled \magstep1 2467\def\sececsize{1200} 2468 2469% Subsection fonts (10pt). 2470\def\ssecnominalsize{10pt} 2471\setfont\ssecrm\rmbshape{10}{1000}{OT1} 2472\setfont\ssecit\itbshape{10}{1000}{OT1IT} 2473\setfont\ssecsl\slbshape{10}{1000}{OT1} 2474\setfont\ssectt\ttbshape{10}{1000}{OT1TT} 2475\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} 2476\setfont\ssecsf\sfbshape{10}{1000}{OT1} 2477\let\ssecbf\ssecrm 2478\setfont\ssecsc\scbshape{10}{1000}{OT1} 2479\font\sseci=cmmi10 2480\font\ssecsy=cmsy10 2481\def\ssececsize{1000} 2482 2483% Reduced fonts for @acronym in text (9pt). 2484\def\reducednominalsize{9pt} 2485\setfont\reducedrm\rmshape{9}{1000}{OT1} 2486\setfont\reducedtt\ttshape{9}{1000}{OT1TT} 2487\setfont\reducedbf\bfshape{10}{900}{OT1} 2488\setfont\reducedit\itshape{9}{1000}{OT1IT} 2489\setfont\reducedsl\slshape{9}{1000}{OT1} 2490\setfont\reducedsf\sfshape{9}{1000}{OT1} 2491\setfont\reducedsc\scshape{10}{900}{OT1} 2492\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} 2493\font\reducedi=cmmi9 2494\font\reducedsy=cmsy9 2495\def\reducedecsize{0900} 2496 2497\divide\parskip by 2 % reduce space between paragraphs 2498\textleading = 12pt % line spacing for 10pt CM 2499\textfonts % reset the current fonts 2500\rm 2501} % end of 10pt text font size definitions, \definetextfontsizex 2502 2503% Fonts for short table of contents. 2504\setfont\shortcontrm\rmshape{12}{1000}{OT1} 2505\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 2506\setfont\shortcontsl\slshape{12}{1000}{OT1} 2507\setfont\shortconttt\ttshape{12}{1000}{OT1TT} 2508 2509 2510% We provide the user-level command 2511% @fonttextsize 10 2512% (or 11) to redefine the text font size. pt is assumed. 2513% 2514\def\xiword{11} 2515\def\xword{10} 2516\def\xwordpt{10pt} 2517% 2518\parseargdef\fonttextsize{% 2519 \def\textsizearg{#1}% 2520 %\wlog{doing @fonttextsize \textsizearg}% 2521 % 2522 % Set \globaldefs so that documents can use this inside @tex, since 2523 % makeinfo 4.8 does not support it, but we need it nonetheless. 2524 % 2525 \begingroup \globaldefs=1 2526 \ifx\textsizearg\xword \definetextfontsizex 2527 \else \ifx\textsizearg\xiword \definetextfontsizexi 2528 \else 2529 \errhelp=\EMsimple 2530 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} 2531 \fi\fi 2532 \endgroup 2533} 2534 2535% 2536% Change the current font style to #1, remembering it in \curfontstyle. 2537% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in 2538% italics, not bold italics. 2539% 2540\def\setfontstyle#1{% 2541 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. 2542 \csname #1font\endcsname % change the current font 2543} 2544 2545\def\rm{\fam=0 \setfontstyle{rm}} 2546\def\it{\fam=\itfam \setfontstyle{it}} 2547\def\sl{\fam=\slfam \setfontstyle{sl}} 2548\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} 2549\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt} 2550 2551% Texinfo sort of supports the sans serif font style, which plain TeX does not. 2552% So we set up a \sf. 2553\newfam\sffam 2554\def\sf{\fam=\sffam \setfontstyle{sf}} 2555 2556% We don't need math for this font style. 2557\def\ttsl{\setfontstyle{ttsl}} 2558 2559 2560% In order for the font changes to affect most math symbols and letters, 2561% we have to define the \textfont of the standard families. 2562% We don't bother to reset \scriptscriptfont; awaiting user need. 2563% 2564\def\resetmathfonts{% 2565 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont 2566 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont 2567 \textfont\ttfam=\ttfont \textfont\sffam=\sffont 2568 % 2569 % Fonts for superscript. Note that the 7pt fonts are used regardless 2570 % of the current font size. 2571 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy 2572 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl 2573 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt 2574 \scriptfont\sffam=\sevensf 2575} 2576 2577% 2578 2579% The font-changing commands (all called \...fonts) redefine the meanings 2580% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs 2581% to also set the current \fam for math mode. Our \STYLE (e.g., \rm) 2582% commands hardwire \STYLEfont to set the current font. 2583% 2584% The fonts used for \ifont are for "math italics" (\itfont is for italics 2585% in regular text). \syfont is also used in math mode only. 2586% 2587% Each font-changing command also sets the names \lsize (one size lower) 2588% and \lllsize (three sizes lower). These relative commands are used 2589% in, e.g., the LaTeX logo and acronyms. 2590% 2591% This all needs generalizing, badly. 2592% 2593 2594\def\assignfonts#1{% 2595 \expandafter\let\expandafter\rmfont\csname #1rm\endcsname 2596 \expandafter\let\expandafter\itfont\csname #1it\endcsname 2597 \expandafter\let\expandafter\slfont\csname #1sl\endcsname 2598 \expandafter\let\expandafter\bffont\csname #1bf\endcsname 2599 \expandafter\let\expandafter\ttfont\csname #1tt\endcsname 2600 \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname 2601 \expandafter\let\expandafter\sffont \csname #1sf\endcsname 2602 \expandafter\let\expandafter\ifont \csname #1i\endcsname 2603 \expandafter\let\expandafter\syfont \csname #1sy\endcsname 2604 \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname 2605} 2606 2607\newif\ifrmisbold 2608 2609% Select smaller font size with the current style. Used to change font size 2610% in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for 2611% normal roman text, also use bold fonts for roman text in the smaller size. 2612\def\switchtolllsize{% 2613 \expandafter\assignfonts\expandafter{\lllsize}% 2614 \ifrmisbold 2615 \let\rmfont\bffont 2616 \fi 2617 \csname\curfontstyle\endcsname 2618}% 2619 2620\def\switchtolsize{% 2621 \expandafter\assignfonts\expandafter{\lsize}% 2622 \ifrmisbold 2623 \let\rmfont\bffont 2624 \fi 2625 \csname\curfontstyle\endcsname 2626}% 2627 2628\def\definefontsetatsize#1#2#3#4#5{% 2629\expandafter\def\csname #1fonts\endcsname{% 2630 \def\curfontsize{#1}% 2631 \def\lsize{#2}\def\lllsize{#3}% 2632 \csname rmisbold#5\endcsname 2633 \assignfonts{#1}% 2634 \resetmathfonts 2635 \setleading{#4}% 2636}} 2637 2638\definefontsetatsize{text} {reduced}{smaller}{\textleading}{false} 2639\definefontsetatsize{title} {chap} {subsec} {27pt} {true} 2640\definefontsetatsize{chap} {sec} {text} {19pt} {true} 2641\definefontsetatsize{sec} {subsec} {reduced}{17pt} {true} 2642\definefontsetatsize{ssec} {text} {small} {15pt} {true} 2643\definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false} 2644\definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false} 2645\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false} 2646 2647\def\titlefont#1{{\titlefonts\rm #1}} 2648\let\subsecfonts = \ssecfonts 2649\let\subsubsecfonts = \ssecfonts 2650 2651% Define these just so they can be easily changed for other fonts. 2652\def\angleleft{$\langle$} 2653\def\angleright{$\rangle$} 2654 2655% Set the fonts to use with the @small... environments. 2656\let\smallexamplefonts = \smallfonts 2657 2658% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample 2659% can fit this many characters: 2660% 8.5x11=86 smallbook=72 a4=90 a5=69 2661% If we use \scriptfonts (8pt), then we can fit this many characters: 2662% 8.5x11=90+ smallbook=80 a4=90+ a5=77 2663% For me, subjectively, the few extra characters that fit aren't worth 2664% the additional smallness of 8pt. So I'm making the default 9pt. 2665% 2666% By the way, for comparison, here's what fits with @example (10pt): 2667% 8.5x11=71 smallbook=60 a4=75 a5=58 2668% --karl, 24jan03. 2669 2670% Set up the default fonts, so we can use them for creating boxes. 2671% 2672\definetextfontsizexi 2673 2674 2675% Check if we are currently using a typewriter font. Since all the 2676% Computer Modern typewriter fonts have zero interword stretch (and 2677% shrink), and it is reasonable to expect all typewriter fonts to have 2678% this property, we can check that font parameter. 2679% 2680\def\ifmonospace{\ifdim\fontdimen3\font=0pt } 2681 2682{ 2683\catcode`\'=\active 2684\catcode`\`=\active 2685 2686\gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright} 2687\gdef\setregularquotes{\let`\lq \let'\rq} 2688} 2689 2690% Allow an option to not use regular directed right quote/apostrophe 2691% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). 2692% The undirected quote is ugly, so don't make it the default, but it 2693% works for pasting with more pdf viewers (at least evince), the 2694% lilypond developers report. xpdf does work with the regular 0x27. 2695% 2696\def\codequoteright{% 2697 \ifmonospace 2698 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax 2699 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax 2700 '% 2701 \else \char'15 \fi 2702 \else \char'15 \fi 2703 \else 2704 '% 2705 \fi 2706} 2707% 2708% and a similar option for the left quote char vs. a grave accent. 2709% Modern fonts display ASCII 0x60 as a grave accent, so some people like 2710% the code environments to do likewise. 2711% 2712\def\codequoteleft{% 2713 \ifmonospace 2714 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax 2715 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax 2716 % [Knuth] pp. 380,381,391 2717 % \relax disables Spanish ligatures ?` and !` of \tt font. 2718 \relax`% 2719 \else \char'22 \fi 2720 \else \char'22 \fi 2721 \else 2722 \relax`% 2723 \fi 2724} 2725 2726% Commands to set the quote options. 2727% 2728\parseargdef\codequoteundirected{% 2729 \def\temp{#1}% 2730 \ifx\temp\onword 2731 \expandafter\let\csname SETtxicodequoteundirected\endcsname 2732 = t% 2733 \else\ifx\temp\offword 2734 \expandafter\let\csname SETtxicodequoteundirected\endcsname 2735 = \relax 2736 \else 2737 \errhelp = \EMsimple 2738 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% 2739 \fi\fi 2740} 2741% 2742\parseargdef\codequotebacktick{% 2743 \def\temp{#1}% 2744 \ifx\temp\onword 2745 \expandafter\let\csname SETtxicodequotebacktick\endcsname 2746 = t% 2747 \else\ifx\temp\offword 2748 \expandafter\let\csname SETtxicodequotebacktick\endcsname 2749 = \relax 2750 \else 2751 \errhelp = \EMsimple 2752 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% 2753 \fi\fi 2754} 2755 2756% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. 2757\def\noligaturesquoteleft{\relax\lq} 2758 2759% Count depth in font-changes, for error checks 2760\newcount\fontdepth \fontdepth=0 2761 2762% Font commands. 2763 2764% #1 is the font command (\sl or \it), #2 is the text to slant. 2765% If we are in a monospaced environment, however, 1) always use \ttsl, 2766% and 2) do not add an italic correction. 2767\def\dosmartslant#1#2{% 2768 \ifusingtt 2769 {{\ttsl #2}\let\next=\relax}% 2770 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% 2771 \next 2772} 2773\def\smartslanted{\dosmartslant\sl} 2774\def\smartitalic{\dosmartslant\it} 2775 2776% Output an italic correction unless \next (presumed to be the following 2777% character) is such as not to need one. 2778\def\smartitaliccorrection{% 2779 \ifx\next,% 2780 \else\ifx\next-% 2781 \else\ifx\next.% 2782 \else\ifx\next\.% 2783 \else\ifx\next\comma% 2784 \else\ptexslash 2785 \fi\fi\fi\fi\fi 2786 \aftersmartic 2787} 2788 2789% Unconditional use \ttsl, and no ic. @var is set to this for defuns. 2790\def\ttslanted#1{{\ttsl #1}} 2791 2792% @cite is like \smartslanted except unconditionally use \sl. We never want 2793% ttsl for book titles, do we? 2794\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} 2795 2796\def\aftersmartic{} 2797\def\var#1{% 2798 \let\saveaftersmartic = \aftersmartic 2799 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% 2800 \smartslanted{#1}% 2801} 2802 2803\let\i=\smartitalic 2804\let\slanted=\smartslanted 2805\let\dfn=\smartslanted 2806\let\emph=\smartitalic 2807 2808% Explicit font changes: @r, @sc, undocumented @ii. 2809\def\r#1{{\rm #1}} % roman font 2810\def\sc#1{{\smallcaps#1}} % smallcaps font 2811\def\ii#1{{\it #1}} % italic font 2812 2813% @b, explicit bold. Also @strong. 2814\def\b#1{{\bf #1}} 2815\let\strong=\b 2816 2817% @sansserif, explicit sans. 2818\def\sansserif#1{{\sf #1}} 2819 2820% We can't just use \exhyphenpenalty, because that only has effect at 2821% the end of a paragraph. Restore normal hyphenation at the end of the 2822% group within which \nohyphenation is presumably called. 2823% 2824\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} 2825\def\restorehyphenation{\hyphenchar\font = `- } 2826 2827% Set sfcode to normal for the chars that usually have another value. 2828% Can't use plain's \frenchspacing because it uses the `\x notation, and 2829% sometimes \x has an active definition that messes things up. 2830% 2831\catcode`@=11 2832 \def\plainfrenchspacing{% 2833 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m 2834 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m 2835 \def\endofsentencespacefactor{1000}% for @. and friends 2836 } 2837 \def\plainnonfrenchspacing{% 2838 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 2839 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 2840 \def\endofsentencespacefactor{3000}% for @. and friends 2841 } 2842\catcode`@=\other 2843\def\endofsentencespacefactor{3000}% default 2844 2845% @t, explicit typewriter. 2846\def\t#1{% 2847 {\tt \plainfrenchspacing #1}% 2848 \null 2849} 2850 2851% @samp. 2852\def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}} 2853 2854% @indicateurl is \samp, that is, with quotes. 2855\let\indicateurl=\samp 2856 2857% @code (and similar) prints in typewriter, but with spaces the same 2858% size as normal in the surrounding text, without hyphenation, etc. 2859% This is a subroutine for that. 2860\def\tclose#1{% 2861 {% 2862 % Change normal interword space to be same as for the current font. 2863 \spaceskip = \fontdimen2\font 2864 % 2865 % Switch to typewriter. 2866 \tt 2867 % 2868 % But `\ ' produces the large typewriter interword space. 2869 \def\ {{\spaceskip = 0pt{} }}% 2870 % 2871 % Turn off hyphenation. 2872 \nohyphenation 2873 % 2874 \plainfrenchspacing 2875 #1% 2876 }% 2877 \null % reset spacefactor to 1000 2878} 2879 2880% We *must* turn on hyphenation at `-' and `_' in @code. 2881% (But see \codedashfinish below.) 2882% Otherwise, it is too hard to avoid overfull hboxes 2883% in the Emacs manual, the Library manual, etc. 2884% 2885% Unfortunately, TeX uses one parameter (\hyphenchar) to control 2886% both hyphenation at - and hyphenation within words. 2887% We must therefore turn them both off (\tclose does that) 2888% and arrange explicitly to hyphenate at a dash. -- rms. 2889{ 2890 \catcode`\-=\active \catcode`\_=\active 2891 \catcode`\'=\active \catcode`\`=\active 2892 \global\let'=\rq \global\let`=\lq % default definitions 2893 % 2894 \global\def\code{\begingroup 2895 \setcodequotes 2896 \catcode\dashChar=\active \catcode\underChar=\active 2897 \ifallowcodebreaks 2898 \let-\codedash 2899 \let_\codeunder 2900 \else 2901 \let-\normaldash 2902 \let_\realunder 2903 \fi 2904 % Given -foo (with a single dash), we do not want to allow a break 2905 % after the hyphen. 2906 \global\let\codedashprev=\codedash 2907 % 2908 \codex 2909 } 2910 % 2911 \gdef\codedash{\futurelet\next\codedashfinish} 2912 \gdef\codedashfinish{% 2913 \normaldash % always output the dash character itself. 2914 % 2915 % Now, output a discretionary to allow a line break, unless 2916 % (a) the next character is a -, or 2917 % (b) the preceding character is a -. 2918 % E.g., given --posix, we do not want to allow a break after either -. 2919 % Given --foo-bar, we do want to allow a break between the - and the b. 2920 \ifx\next\codedash \else 2921 \ifx\codedashprev\codedash 2922 \else \discretionary{}{}{}\fi 2923 \fi 2924 % we need the space after the = for the case when \next itself is a 2925 % space token; it would get swallowed otherwise. As in @code{- a}. 2926 \global\let\codedashprev= \next 2927 } 2928} 2929\def\normaldash{-} 2930% 2931\def\codex #1{\tclose{#1}\endgroup} 2932 2933\def\codeunder{% 2934 % this is all so @math{@code{var_name}+1} can work. In math mode, _ 2935 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) 2936 % will therefore expand the active definition of _, which is us 2937 % (inside @code that is), therefore an endless loop. 2938 \ifusingtt{\ifmmode 2939 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. 2940 \else\normalunderscore \fi 2941 \discretionary{}{}{}}% 2942 {\_}% 2943} 2944 2945% An additional complication: the above will allow breaks after, e.g., 2946% each of the four underscores in __typeof__. This is bad. 2947% @allowcodebreaks provides a document-level way to turn breaking at - 2948% and _ on and off. 2949% 2950\newif\ifallowcodebreaks \allowcodebreakstrue 2951 2952\def\keywordtrue{true} 2953\def\keywordfalse{false} 2954 2955\parseargdef\allowcodebreaks{% 2956 \def\txiarg{#1}% 2957 \ifx\txiarg\keywordtrue 2958 \allowcodebreakstrue 2959 \else\ifx\txiarg\keywordfalse 2960 \allowcodebreaksfalse 2961 \else 2962 \errhelp = \EMsimple 2963 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% 2964 \fi\fi 2965} 2966 2967% For @command, @env, @file, @option quotes seem unnecessary, 2968% so use \code rather than \samp. 2969\let\command=\code 2970\let\env=\code 2971\let\file=\code 2972\let\option=\code 2973 2974% @uref (abbreviation for `urlref') aka @url takes an optional 2975% (comma-separated) second argument specifying the text to display and 2976% an optional third arg as text to display instead of (rather than in 2977% addition to) the url itself. First (mandatory) arg is the url. 2978 2979% TeX-only option to allow changing PDF output to show only the second 2980% arg (if given), and not the url (which is then just the link target). 2981\newif\ifurefurlonlylink 2982 2983% The default \pretolerance setting stops the penalty inserted in 2984% \urefallowbreak being a discouragement to line breaking. Set it to 2985% a negative value for this paragraph only. Hopefully this does not 2986% conflict with redefinitions of \par done elsewhere. 2987\def\nopretolerance{% 2988\pretolerance=-1 2989\def\par{\endgraf\pretolerance=100 \let\par\endgraf}% 2990} 2991 2992% The main macro is \urefbreak, which allows breaking at expected 2993% places within the url. 2994\def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak} 2995\let\uref=\urefbreak 2996% 2997\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} 2998\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example 2999 \unsepspaces 3000 \pdfurl{#1}% 3001 \setbox0 = \hbox{\ignorespaces #3}% 3002 \ifdim\wd0 > 0pt 3003 \unhbox0 % third arg given, show only that 3004 \else 3005 \setbox0 = \hbox{\ignorespaces #2}% look for second arg 3006 \ifdim\wd0 > 0pt 3007 \ifpdf 3008 % For pdfTeX and LuaTeX 3009 \ifurefurlonlylink 3010 % PDF plus option to not display url, show just arg 3011 \unhbox0 3012 \else 3013 % PDF, normally display both arg and url for consistency, 3014 % visibility, if the pdf is eventually used to print, etc. 3015 \unhbox0\ (\urefcode{#1})% 3016 \fi 3017 \else 3018 \ifx\XeTeXrevision\thisisundefined 3019 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url 3020 \else 3021 % For XeTeX 3022 \ifurefurlonlylink 3023 % PDF plus option to not display url, show just arg 3024 \unhbox0 3025 \else 3026 % PDF, normally display both arg and url for consistency, 3027 % visibility, if the pdf is eventually used to print, etc. 3028 \unhbox0\ (\urefcode{#1})% 3029 \fi 3030 \fi 3031 \fi 3032 \else 3033 \urefcode{#1}% only url given, so show it 3034 \fi 3035 \fi 3036 \endlink 3037\endgroup} 3038 3039% Allow line breaks around only a few characters (only). 3040\def\urefcatcodes{% 3041 \catcode`\&=\active \catcode`\.=\active 3042 \catcode`\#=\active \catcode`\?=\active 3043 \catcode`\/=\active 3044} 3045{ 3046 \urefcatcodes 3047 % 3048 \global\def\urefcode{\begingroup 3049 \setcodequotes 3050 \urefcatcodes 3051 \let&\urefcodeamp 3052 \let.\urefcodedot 3053 \let#\urefcodehash 3054 \let?\urefcodequest 3055 \let/\urefcodeslash 3056 \codex 3057 } 3058 % 3059 % By default, they are just regular characters. 3060 \global\def&{\normalamp} 3061 \global\def.{\normaldot} 3062 \global\def#{\normalhash} 3063 \global\def?{\normalquest} 3064 \global\def/{\normalslash} 3065} 3066 3067\def\urefcodeamp{\urefprebreak \&\urefpostbreak} 3068\def\urefcodedot{\urefprebreak .\urefpostbreak} 3069\def\urefcodehash{\urefprebreak \#\urefpostbreak} 3070\def\urefcodequest{\urefprebreak ?\urefpostbreak} 3071\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} 3072{ 3073 \catcode`\/=\active 3074 \global\def\urefcodeslashfinish{% 3075 \urefprebreak \slashChar 3076 % Allow line break only after the final / in a sequence of 3077 % slashes, to avoid line break between the slashes in http://. 3078 \ifx\next/\else \urefpostbreak \fi 3079 } 3080} 3081 3082% By default we'll break after the special characters, but some people like to 3083% break before the special chars, so allow that. Also allow no breaking at 3084% all, for manual control. 3085% 3086\parseargdef\urefbreakstyle{% 3087 \def\txiarg{#1}% 3088 \ifx\txiarg\wordnone 3089 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} 3090 \else\ifx\txiarg\wordbefore 3091 \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak} 3092 \else\ifx\txiarg\wordafter 3093 \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak} 3094 \else 3095 \errhelp = \EMsimple 3096 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% 3097 \fi\fi\fi 3098} 3099\def\wordafter{after} 3100\def\wordbefore{before} 3101\def\wordnone{none} 3102 3103% Allow a ragged right output to aid breaking long URL's. There can 3104% be a break at the \allowbreak with no extra glue (if the existing stretch in 3105% the line is sufficient), a break at the \penalty with extra glue added 3106% at the end of the line, or no break at all here. 3107% Changing the value of the penalty and/or the amount of stretch affects how 3108% preferable one choice is over the other. 3109\def\urefallowbreak{% 3110 \penalty0\relax 3111 \hskip 0pt plus 2 em\relax 3112 \penalty1000\relax 3113 \hskip 0pt plus -2 em\relax 3114} 3115 3116\urefbreakstyle after 3117 3118% @url synonym for @uref, since that's how everyone uses it. 3119% 3120\let\url=\uref 3121 3122% rms does not like angle brackets --karl, 17may97. 3123% So now @email is just like @uref, unless we are pdf. 3124% 3125%\def\email#1{\angleleft{\tt #1}\angleright} 3126\ifpdforxetex 3127 \def\email#1{\doemail#1,,\finish} 3128 \def\doemail#1,#2,#3\finish{\begingroup 3129 \unsepspaces 3130 \pdfurl{mailto:#1}% 3131 \setbox0 = \hbox{\ignorespaces #2}% 3132 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi 3133 \endlink 3134 \endgroup} 3135\else 3136 \let\email=\uref 3137\fi 3138 3139% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), 3140% `example' (@kbd uses ttsl only inside of @example and friends), 3141% or `code' (@kbd uses normal tty font always). 3142\parseargdef\kbdinputstyle{% 3143 \def\txiarg{#1}% 3144 \ifx\txiarg\worddistinct 3145 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% 3146 \else\ifx\txiarg\wordexample 3147 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% 3148 \else\ifx\txiarg\wordcode 3149 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% 3150 \else 3151 \errhelp = \EMsimple 3152 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% 3153 \fi\fi\fi 3154} 3155\def\worddistinct{distinct} 3156\def\wordexample{example} 3157\def\wordcode{code} 3158 3159% Default is `distinct'. 3160\kbdinputstyle distinct 3161 3162% @kbd is like @code, except that if the argument is just one @key command, 3163% then @kbd has no effect. 3164\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}} 3165 3166\def\xkey{\key} 3167\def\kbdsub#1#2#3\par{% 3168 \def\one{#1}\def\three{#3}\def\threex{??}% 3169 \ifx\one\xkey\ifx\threex\three \key{#2}% 3170 \else{\tclose{\kbdfont\setcodequotes\look}}\fi 3171 \else{\tclose{\kbdfont\setcodequotes\look}}\fi 3172} 3173 3174% definition of @key that produces a lozenge. Doesn't adjust to text size. 3175%\setfont\keyrm\rmshape{8}{1000}{OT1} 3176%\font\keysy=cmsy9 3177%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% 3178% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% 3179% \vbox{\hrule\kern-0.4pt 3180% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% 3181% \kern-0.4pt\hrule}% 3182% \kern-.06em\raise0.4pt\hbox{\angleright}}}} 3183 3184% definition of @key with no lozenge. If the current font is already 3185% monospace, don't change it; that way, we respect @kbdinputstyle. But 3186% if it isn't monospace, then use \tt. 3187% 3188\def\key#1{{\setregularquotes 3189 \nohyphenation 3190 \ifmonospace\else\tt\fi 3191 #1}\null} 3192 3193% @clicksequence{File @click{} Open ...} 3194\def\clicksequence#1{\begingroup #1\endgroup} 3195 3196% @clickstyle @arrow (by default) 3197\parseargdef\clickstyle{\def\click{#1}} 3198\def\click{\arrow} 3199 3200% Typeset a dimension, e.g., `in' or `pt'. The only reason for the 3201% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. 3202% 3203\def\dmn#1{\thinspace #1} 3204 3205% @acronym for "FBI", "NATO", and the like. 3206% We print this one point size smaller, since it's intended for 3207% all-uppercase. 3208% 3209\def\acronym#1{\doacronym #1,,\finish} 3210\def\doacronym#1,#2,#3\finish{% 3211 {\switchtolsize #1}% 3212 \def\temp{#2}% 3213 \ifx\temp\empty \else 3214 \space ({\unsepspaces \ignorespaces \temp \unskip})% 3215 \fi 3216 \null % reset \spacefactor=1000 3217} 3218 3219% @abbr for "Comput. J." and the like. 3220% No font change, but don't do end-of-sentence spacing. 3221% 3222\def\abbr#1{\doabbr #1,,\finish} 3223\def\doabbr#1,#2,#3\finish{% 3224 {\plainfrenchspacing #1}% 3225 \def\temp{#2}% 3226 \ifx\temp\empty \else 3227 \space ({\unsepspaces \ignorespaces \temp \unskip})% 3228 \fi 3229 \null % reset \spacefactor=1000 3230} 3231 3232% @asis just yields its argument. Used with @table, for example. 3233% 3234\def\asis#1{#1} 3235 3236% @math outputs its argument in math mode. 3237% 3238% One complication: _ usually means subscripts, but it could also mean 3239% an actual _ character, as in @math{@var{some_variable} + 1}. So make 3240% _ active, and distinguish by seeing if the current family is \slfam, 3241% which is what @var uses. 3242{ 3243 \catcode`\_ = \active 3244 \gdef\mathunderscore{% 3245 \catcode`\_=\active 3246 \def_{\ifnum\fam=\slfam \_\else\sb\fi}% 3247 } 3248} 3249% Another complication: we want \\ (and @\) to output a math (or tt) \. 3250% FYI, plain.tex uses \\ as a temporary control sequence (for no 3251% particular reason), but this is not advertised and we don't care. 3252% 3253% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. 3254\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} 3255% 3256\def\math{% 3257 \ifmmode\else % only go into math if not in math mode already 3258 \tex 3259 \mathunderscore 3260 \let\\ = \mathbackslash 3261 \mathactive 3262 % make the texinfo accent commands work in math mode 3263 \let\"=\ddot 3264 \let\'=\acute 3265 \let\==\bar 3266 \let\^=\hat 3267 \let\`=\grave 3268 \let\u=\breve 3269 \let\v=\check 3270 \let\~=\tilde 3271 \let\dotaccent=\dot 3272 % have to provide another name for sup operator 3273 \let\mathopsup=\sup 3274 $\expandafter\finishmath\fi 3275} 3276\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. 3277 3278% Some active characters (such as <) are spaced differently in math. 3279% We have to reset their definitions in case the @math was an argument 3280% to a command which sets the catcodes (such as @item or @section). 3281% 3282{ 3283 \catcode`^ = \active 3284 \catcode`< = \active 3285 \catcode`> = \active 3286 \catcode`+ = \active 3287 \catcode`' = \active 3288 \gdef\mathactive{% 3289 \let^ = \ptexhat 3290 \let< = \ptexless 3291 \let> = \ptexgtr 3292 \let+ = \ptexplus 3293 \let' = \ptexquoteright 3294 } 3295} 3296 3297% for @sub and @sup, if in math mode, just do a normal sub/superscript. 3298% If in text, use math to place as sub/superscript, but switch 3299% into text mode, with smaller fonts. This is a different font than the 3300% one used for real math sub/superscripts (8pt vs. 7pt), but let's not 3301% fix it (significant additions to font machinery) until someone notices. 3302% 3303\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi} 3304\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}% 3305% 3306\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi} 3307\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}% 3308 3309% provide this command from LaTeX as it is very common 3310\def\frac#1#2{{{#1}\over{#2}}} 3311 3312% @displaymath. 3313% \globaldefs is needed to recognize the end lines in \tex and 3314% \end tex. Set \thisenv as @end displaymath is seen before @end tex. 3315{\obeylines 3316\globaldefs=1 3317\envdef\displaymath{% 3318\tex% 3319\def\thisenv{\displaymath}% 3320\begingroup\let\end\displaymathend% 3321$$% 3322} 3323 3324\def\displaymathend{$$\endgroup\end}% 3325 3326\def\Edisplaymath{% 3327\def\thisenv{\tex}% 3328\end tex 3329}} 3330 3331 3332% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. 3333% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, 3334% except specified as a normal braced arg, so no newlines to worry about. 3335% 3336\def\outfmtnametex{tex} 3337% 3338\long\def\inlinefmt#1{\doinlinefmt #1,\finish} 3339\long\def\doinlinefmt#1,#2,\finish{% 3340 \def\inlinefmtname{#1}% 3341 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi 3342} 3343% 3344% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if 3345% FMTNAME is tex, else ELSE-TEXT. 3346\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish} 3347\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{% 3348 \def\inlinefmtname{#1}% 3349 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi 3350} 3351% 3352% For raw, must switch into @tex before parsing the argument, to avoid 3353% setting catcodes prematurely. Doing it this way means that, for 3354% example, @inlineraw{html, foo{bar} gets a parse error instead of being 3355% ignored. But this isn't important because if people want a literal 3356% *right* brace they would have to use a command anyway, so they may as 3357% well use a command to get a left brace too. We could re-use the 3358% delimiter character idea from \verb, but it seems like overkill. 3359% 3360\long\def\inlineraw{\tex \doinlineraw} 3361\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} 3362\def\doinlinerawtwo#1,#2,\finish{% 3363 \def\inlinerawname{#1}% 3364 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi 3365 \endgroup % close group opened by \tex. 3366} 3367 3368% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set. 3369% 3370\long\def\inlineifset#1{\doinlineifset #1,\finish} 3371\long\def\doinlineifset#1,#2,\finish{% 3372 \def\inlinevarname{#1}% 3373 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax 3374 \else\ignorespaces#2\fi 3375} 3376 3377% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set. 3378% 3379\long\def\inlineifclear#1{\doinlineifclear #1,\finish} 3380\long\def\doinlineifclear#1,#2,\finish{% 3381 \def\inlinevarname{#1}% 3382 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi 3383} 3384 3385 3386\message{glyphs,} 3387% and logos. 3388 3389% @@ prints an @, as does @atchar{}. 3390\def\@{\char64 } 3391\let\atchar=\@ 3392 3393% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. 3394\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}} 3395\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}} 3396\let\{=\lbracechar 3397\let\}=\rbracechar 3398 3399% @comma{} to avoid , parsing problems. 3400\let\comma = , 3401 3402% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent 3403% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. 3404\let\, = \ptexc 3405\let\dotaccent = \ptexdot 3406\def\ringaccent#1{{\accent23 #1}} 3407\let\tieaccent = \ptext 3408\let\ubaraccent = \ptexb 3409\let\udotaccent = \d 3410 3411% Other special characters: @questiondown @exclamdown @ordf @ordm 3412% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. 3413\def\questiondown{?`} 3414\def\exclamdown{!`} 3415\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}} 3416\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}} 3417 3418% Dotless i and dotless j, used for accents. 3419\def\imacro{i} 3420\def\jmacro{j} 3421\def\dotless#1{% 3422 \def\temp{#1}% 3423 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi 3424 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi 3425 \else \errmessage{@dotless can be used only with i or j}% 3426 \fi\fi 3427} 3428 3429% The \TeX{} logo, as in plain, but resetting the spacing so that a 3430% period following counts as ending a sentence. (Idea found in latex.) 3431% 3432\edef\TeX{\TeX \spacefactor=1000 } 3433 3434% @LaTeX{} logo. Not quite the same results as the definition in 3435% latex.ltx, since we use a different font for the raised A; it's most 3436% convenient for us to use an explicitly smaller font, rather than using 3437% the \scriptstyle font (since we don't reset \scriptstyle and 3438% \scriptscriptstyle). 3439% 3440\def\LaTeX{% 3441 L\kern-.36em 3442 {\setbox0=\hbox{T}% 3443 \vbox to \ht0{\hbox{% 3444 \ifx\textnominalsize\xwordpt 3445 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX. 3446 % Revert to plain's \scriptsize, which is 7pt. 3447 \count255=\the\fam $\fam\count255 \scriptstyle A$% 3448 \else 3449 % For 11pt, we can use our lllsize. 3450 \switchtolllsize A% 3451 \fi 3452 }% 3453 \vss 3454 }}% 3455 \kern-.15em 3456 \TeX 3457} 3458 3459% Some math mode symbols. Define \ensuremath to switch into math mode 3460% unless we are already there. Expansion tricks may not be needed here, 3461% but safer, and can't hurt. 3462\def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi} 3463\def\ensuredmath#1{$\relax#1$} 3464% 3465\def\bullet{\ensuremath\ptexbullet} 3466\def\geq{\ensuremath\ge} 3467\def\leq{\ensuremath\le} 3468\def\minus{\ensuremath-} 3469 3470% @dots{} outputs an ellipsis using the current font. 3471% We do .5em per period so that it has the same spacing in the cm 3472% typewriter fonts as three actual period characters; on the other hand, 3473% in other typewriter fonts three periods are wider than 1.5em. So do 3474% whichever is larger. 3475% 3476\def\dots{% 3477 \leavevmode 3478 \setbox0=\hbox{...}% get width of three periods 3479 \ifdim\wd0 > 1.5em 3480 \dimen0 = \wd0 3481 \else 3482 \dimen0 = 1.5em 3483 \fi 3484 \hbox to \dimen0{% 3485 \hskip 0pt plus.25fil 3486 .\hskip 0pt plus1fil 3487 .\hskip 0pt plus1fil 3488 .\hskip 0pt plus.5fil 3489 }% 3490} 3491 3492% @enddots{} is an end-of-sentence ellipsis. 3493% 3494\def\enddots{% 3495 \dots 3496 \spacefactor=\endofsentencespacefactor 3497} 3498 3499% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. 3500% 3501% Since these characters are used in examples, they should be an even number of 3502% \tt widths. Each \tt character is 1en, so two makes it 1em. 3503% 3504\def\point{$\star$} 3505\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} 3506\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} 3507\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} 3508\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} 3509\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} 3510 3511% The @error{} command. 3512% Adapted from the TeXbook's \boxit. 3513% 3514\newbox\errorbox 3515% 3516{\ttfont \global\dimen0 = 3em}% Width of the box. 3517\dimen2 = .55pt % Thickness of rules 3518% The text. (`r' is open on the right, `e' somewhat less so on the left.) 3519\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} 3520% 3521\setbox\errorbox=\hbox to \dimen0{\hfil 3522 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. 3523 \advance\hsize by -2\dimen2 % Rules. 3524 \vbox{% 3525 \hrule height\dimen2 3526 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. 3527 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. 3528 \kern3pt\vrule width\dimen2}% Space to right. 3529 \hrule height\dimen2} 3530 \hfil} 3531% 3532\def\error{\leavevmode\lower.7ex\copy\errorbox} 3533 3534% @pounds{} is a sterling sign, which Knuth put in the CM italic font. 3535% 3536\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi} 3537 3538% @euro{} comes from a separate font, depending on the current style. 3539% We use the free feym* fonts from the eurosym package by Henrik 3540% Theiling, which support regular, slanted, bold and bold slanted (and 3541% "outlined" (blackboard board, sort of) versions, which we don't need). 3542% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. 3543% 3544% Although only regular is the truly official Euro symbol, we ignore 3545% that. The Euro is designed to be slightly taller than the regular 3546% font height. 3547% 3548% feymr - regular 3549% feymo - slanted 3550% feybr - bold 3551% feybo - bold slanted 3552% 3553% There is no good (free) typewriter version, to my knowledge. 3554% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. 3555% Hmm. 3556% 3557% Also doesn't work in math. Do we need to do math with euro symbols? 3558% Hope not. 3559% 3560% 3561\def\euro{{\eurofont e}} 3562\def\eurofont{% 3563 % We set the font at each command, rather than predefining it in 3564 % \textfonts and the other font-switching commands, so that 3565 % installations which never need the symbol don't have to have the 3566 % font installed. 3567 % 3568 % There is only one designed size (nominal 10pt), so we always scale 3569 % that to the current nominal size. 3570 % 3571 % By the way, simply using "at 1em" works for cmr10 and the like, but 3572 % does not work for cmbx10 and other extended/shrunken fonts. 3573 % 3574 \def\eurosize{\csname\curfontsize nominalsize\endcsname}% 3575 % 3576 \ifx\curfontstyle\bfstylename 3577 % bold: 3578 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize 3579 \else 3580 % regular: 3581 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize 3582 \fi 3583 \thiseurofont 3584} 3585 3586% Glyphs from the EC fonts. We don't use \let for the aliases, because 3587% sometimes we redefine the original macro, and the alias should reflect 3588% the redefinition. 3589% 3590% Use LaTeX names for the Icelandic letters. 3591\def\DH{{\ecfont \char"D0}} % Eth 3592\def\dh{{\ecfont \char"F0}} % eth 3593\def\TH{{\ecfont \char"DE}} % Thorn 3594\def\th{{\ecfont \char"FE}} % thorn 3595% 3596\def\guillemetleft{{\ecfont \char"13}} 3597\def\guillemotleft{\guillemetleft} 3598\def\guillemetright{{\ecfont \char"14}} 3599\def\guillemotright{\guillemetright} 3600\def\guilsinglleft{{\ecfont \char"0E}} 3601\def\guilsinglright{{\ecfont \char"0F}} 3602\def\quotedblbase{{\ecfont \char"12}} 3603\def\quotesinglbase{{\ecfont \char"0D}} 3604% 3605% This positioning is not perfect (see the ogonek LaTeX package), but 3606% we have the precomposed glyphs for the most common cases. We put the 3607% tests to use those glyphs in the single \ogonek macro so we have fewer 3608% dummy definitions to worry about for index entries, etc. 3609% 3610% ogonek is also used with other letters in Lithuanian (IOU), but using 3611% the precomposed glyphs for those is not so easy since they aren't in 3612% the same EC font. 3613\def\ogonek#1{{% 3614 \def\temp{#1}% 3615 \ifx\temp\macrocharA\Aogonek 3616 \else\ifx\temp\macrochara\aogonek 3617 \else\ifx\temp\macrocharE\Eogonek 3618 \else\ifx\temp\macrochare\eogonek 3619 \else 3620 \ecfont \setbox0=\hbox{#1}% 3621 \ifdim\ht0=1ex\accent"0C #1% 3622 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% 3623 \fi 3624 \fi\fi\fi\fi 3625 }% 3626} 3627\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} 3628\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} 3629\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} 3630\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} 3631% 3632% Use the European Computer Modern fonts (cm-super in outline format) 3633% for non-CM glyphs. That is ec* for regular text and tc* for the text 3634% companion symbols (LaTeX TS1 encoding). Both are part of the ec 3635% package and follow the same conventions. 3636% 3637\def\ecfont{\etcfont{e}} 3638\def\tcfont{\etcfont{t}} 3639% 3640\def\etcfont#1{% 3641 % We can't distinguish serif/sans and italic/slanted, but this 3642 % is used for crude hacks anyway (like adding French and German 3643 % quotes to documents typeset with CM, where we lose kerning), so 3644 % hopefully nobody will notice/care. 3645 \edef\ecsize{\csname\curfontsize ecsize\endcsname}% 3646 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% 3647 \ifmonospace 3648 % typewriter: 3649 \font\thisecfont = #1ctt\ecsize \space at \nominalsize 3650 \else 3651 \ifx\curfontstyle\bfstylename 3652 % bold: 3653 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize 3654 \else 3655 % regular: 3656 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize 3657 \fi 3658 \fi 3659 \thisecfont 3660} 3661 3662% @registeredsymbol - R in a circle. The font for the R should really 3663% be smaller yet, but lllsize is the best we can do for now. 3664% Adapted from the plain.tex definition of \copyright. 3665% 3666\def\registeredsymbol{% 3667 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}% 3668 \hfil\crcr\Orb}}% 3669 }$% 3670} 3671 3672% @textdegree - the normal degrees sign. 3673% 3674\def\textdegree{$^\circ$} 3675 3676% Laurent Siebenmann reports \Orb undefined with: 3677% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 3678% so we'll define it if necessary. 3679% 3680\ifx\Orb\thisisundefined 3681\def\Orb{\mathhexbox20D} 3682\fi 3683 3684% Quotes. 3685\chardef\quoteleft=`\` 3686\chardef\quoteright=`\' 3687 3688% only change font for tt for correct kerning and to avoid using 3689% \ecfont unless necessary. 3690\def\quotedblleft{% 3691 \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi 3692} 3693 3694\def\quotedblright{% 3695 \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi 3696} 3697 3698 3699\message{page headings,} 3700 3701\newskip\titlepagetopglue \titlepagetopglue = 1.5in 3702\newskip\titlepagebottomglue \titlepagebottomglue = 2pc 3703 3704% First the title page. Must do @settitle before @titlepage. 3705\newif\ifseenauthor 3706\newif\iffinishedtitlepage 3707 3708% @setcontentsaftertitlepage used to do an implicit @contents or 3709% @shortcontents after @end titlepage, but it is now obsolete. 3710\def\setcontentsaftertitlepage{% 3711 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo 3712 command; move your @contents command if you want the contents 3713 after the title page.}}% 3714\def\setshortcontentsaftertitlepage{% 3715 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo 3716 command; move your @shortcontents and @contents commands if you 3717 want the contents after the title page.}}% 3718 3719\parseargdef\shorttitlepage{% 3720 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% 3721 \endgroup\page\hbox{}\page} 3722 3723\envdef\titlepage{% 3724 % Open one extra group, as we want to close it in the middle of \Etitlepage. 3725 \begingroup 3726 \parindent=0pt \textfonts 3727 % Leave some space at the very top of the page. 3728 \vglue\titlepagetopglue 3729 % No rule at page bottom unless we print one at the top with @title. 3730 \finishedtitlepagetrue 3731 % 3732 % Most title ``pages'' are actually two pages long, with space 3733 % at the top of the second. We don't want the ragged left on the second. 3734 \let\oldpage = \page 3735 \def\page{% 3736 \iffinishedtitlepage\else 3737 \finishtitlepage 3738 \fi 3739 \let\page = \oldpage 3740 \page 3741 \null 3742 }% 3743} 3744 3745\def\Etitlepage{% 3746 \iffinishedtitlepage\else 3747 \finishtitlepage 3748 \fi 3749 % It is important to do the page break before ending the group, 3750 % because the headline and footline are only empty inside the group. 3751 % If we use the new definition of \page, we always get a blank page 3752 % after the title page, which we certainly don't want. 3753 \oldpage 3754 \endgroup 3755 % 3756 % Need this before the \...aftertitlepage checks so that if they are 3757 % in effect the toc pages will come out with page numbers. 3758 \HEADINGSon 3759} 3760 3761\def\finishtitlepage{% 3762 \vskip4pt \hrule height 2pt width \hsize 3763 \vskip\titlepagebottomglue 3764 \finishedtitlepagetrue 3765} 3766 3767% Settings used for typesetting titles: no hyphenation, no indentation, 3768% don't worry much about spacing, ragged right. This should be used 3769% inside a \vbox, and fonts need to be set appropriately first. \par should 3770% be specified before the end of the \vbox, since a vbox is a group. 3771% 3772\def\raggedtitlesettings{% 3773 \rm 3774 \hyphenpenalty=10000 3775 \parindent=0pt 3776 \tolerance=5000 3777 \ptexraggedright 3778} 3779 3780% Macros to be used within @titlepage: 3781 3782\let\subtitlerm=\rmfont 3783\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} 3784 3785\parseargdef\title{% 3786 \checkenv\titlepage 3787 \vbox{\titlefonts \raggedtitlesettings #1\par}% 3788 % print a rule at the page bottom also. 3789 \finishedtitlepagefalse 3790 \vskip4pt \hrule height 4pt width \hsize \vskip4pt 3791} 3792 3793\parseargdef\subtitle{% 3794 \checkenv\titlepage 3795 {\subtitlefont \rightline{#1}}% 3796} 3797 3798% @author should come last, but may come many times. 3799% It can also be used inside @quotation. 3800% 3801\parseargdef\author{% 3802 \def\temp{\quotation}% 3803 \ifx\thisenv\temp 3804 \def\quotationauthor{#1}% printed in \Equotation. 3805 \else 3806 \checkenv\titlepage 3807 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi 3808 {\secfonts\rm \leftline{#1}}% 3809 \fi 3810} 3811 3812 3813% Set up page headings and footings. 3814 3815\let\thispage=\folio 3816 3817\newtoks\evenheadline % headline on even pages 3818\newtoks\oddheadline % headline on odd pages 3819\newtoks\evenchapheadline% headline on even pages with a new chapter 3820\newtoks\oddchapheadline % headline on odd pages with a new chapter 3821\newtoks\evenfootline % footline on even pages 3822\newtoks\oddfootline % footline on odd pages 3823 3824% Now make \makeheadline and \makefootline in Plain TeX use those variables 3825\headline={{\textfonts\rm 3826 \ifchapterpage 3827 \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi 3828 \else 3829 \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi 3830 \fi}} 3831 3832\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline 3833 \else \the\evenfootline \fi}\HEADINGShook} 3834\let\HEADINGShook=\relax 3835 3836% Commands to set those variables. 3837% For example, this is what @headings on does 3838% @evenheading @thistitle|@thispage|@thischapter 3839% @oddheading @thischapter|@thispage|@thistitle 3840% @evenfooting @thisfile|| 3841% @oddfooting ||@thisfile 3842 3843 3844\def\evenheading{\parsearg\evenheadingxxx} 3845\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} 3846\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% 3847 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}} 3848 \global\evenchapheadline=\evenheadline} 3849 3850\def\oddheading{\parsearg\oddheadingxxx} 3851\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} 3852\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% 3853 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}% 3854 \global\oddchapheadline=\oddheadline} 3855 3856\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% 3857 3858\def\evenfooting{\parsearg\evenfootingxxx} 3859\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} 3860\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% 3861\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 3862 3863\def\oddfooting{\parsearg\oddfootingxxx} 3864\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} 3865\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% 3866 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% 3867 % 3868 % Leave some space for the footline. Hopefully ok to assume 3869 % @evenfooting will not be used by itself. 3870 \global\advance\txipageheight by -12pt 3871 \global\advance\vsize by -12pt 3872} 3873 3874\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} 3875 3876% @evenheadingmarks top \thischapter <- chapter at the top of a page 3877% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page 3878% 3879% The same set of arguments for: 3880% 3881% @oddheadingmarks 3882% @evenfootingmarks 3883% @oddfootingmarks 3884% @everyheadingmarks 3885% @everyfootingmarks 3886 3887% These define \getoddheadingmarks, \getevenheadingmarks, 3888% \getoddfootingmarks, and \getevenfootingmarks, each to one of 3889% \gettopheadingmarks, \getbottomheadingmarks. 3890% 3891\def\evenheadingmarks{\headingmarks{even}{heading}} 3892\def\oddheadingmarks{\headingmarks{odd}{heading}} 3893\def\evenfootingmarks{\headingmarks{even}{footing}} 3894\def\oddfootingmarks{\headingmarks{odd}{footing}} 3895\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1} 3896 \headingmarks{odd}{heading}{#1} } 3897\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1} 3898 \headingmarks{odd}{footing}{#1} } 3899% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. 3900\def\headingmarks#1#2#3 {% 3901 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname 3902 \global\expandafter\let\csname get#1#2marks\endcsname \temp 3903} 3904 3905\everyheadingmarks bottom 3906\everyfootingmarks bottom 3907 3908% @headings double turns headings on for double-sided printing. 3909% @headings single turns headings on for single-sided printing. 3910% @headings off turns them off. 3911% @headings on same as @headings double, retained for compatibility. 3912% @headings after turns on double-sided headings after this page. 3913% @headings doubleafter turns on double-sided headings after this page. 3914% @headings singleafter turns on single-sided headings after this page. 3915% By default, they are off at the start of a document, 3916% and turned `on' after @end titlepage. 3917 3918\parseargdef\headings{\csname HEADINGS#1\endcsname} 3919 3920\def\headingsoff{% non-global headings elimination 3921 \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}% 3922 \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}% 3923} 3924 3925\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting 3926\HEADINGSoff % it's the default 3927 3928% When we turn headings on, set the page number to 1. 3929\def\pageone{ 3930 \global\pageno=1 3931 \global\arabiccount = \pagecount 3932} 3933 3934% For double-sided printing, put current file name in lower left corner, 3935% chapter name on inside top of right hand pages, document 3936% title on inside top of left hand pages, and page numbers on outside top 3937% edge of all pages. 3938\def\HEADINGSdouble{% 3939\pageone 3940\HEADINGSdoublex 3941} 3942\let\contentsalignmacro = \chappager 3943 3944% For single-sided printing, chapter title goes across top left of page, 3945% page number on top right. 3946\def\HEADINGSsingle{% 3947\pageone 3948\HEADINGSsinglex 3949} 3950\def\HEADINGSon{\HEADINGSdouble} 3951 3952\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} 3953\let\HEADINGSdoubleafter=\HEADINGSafter 3954\def\HEADINGSdoublex{% 3955\global\evenfootline={\hfil} 3956\global\oddfootline={\hfil} 3957\global\evenheadline={\line{\folio\hfil\thistitle}} 3958\global\oddheadline={\line{\thischapter\hfil\folio}} 3959\global\evenchapheadline={\line{\folio\hfil}} 3960\global\oddchapheadline={\line{\hfil\folio}} 3961\global\let\contentsalignmacro = \chapoddpage 3962} 3963 3964\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} 3965\def\HEADINGSsinglex{% 3966\global\evenfootline={\hfil} 3967\global\oddfootline={\hfil} 3968\global\evenheadline={\line{\thischapter\hfil\folio}} 3969\global\oddheadline={\line{\thischapter\hfil\folio}} 3970\global\evenchapheadline={\line{\hfil\folio}} 3971\global\oddchapheadline={\line{\hfil\folio}} 3972\global\let\contentsalignmacro = \chappager 3973} 3974 3975% for @setchapternewpage off 3976\def\HEADINGSsinglechapoff{% 3977\pageone 3978\global\evenfootline={\hfil} 3979\global\oddfootline={\hfil} 3980\global\evenheadline={\line{\thischapter\hfil\folio}} 3981\global\oddheadline={\line{\thischapter\hfil\folio}} 3982\global\evenchapheadline=\evenheadline 3983\global\oddchapheadline=\oddheadline 3984\global\let\contentsalignmacro = \chappager 3985} 3986 3987% Subroutines used in generating headings 3988% This produces Day Month Year style of output. 3989% Only define if not already defined, in case a txi-??.tex file has set 3990% up a different format (e.g., txi-cs.tex does this). 3991\ifx\today\thisisundefined 3992\def\today{% 3993 \number\day\space 3994 \ifcase\month 3995 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr 3996 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug 3997 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec 3998 \fi 3999 \space\number\year} 4000\fi 4001 4002% @settitle line... specifies the title of the document, for headings. 4003% It generates no output of its own. 4004\def\thistitle{\putwordNoTitle} 4005\def\settitle{\parsearg{\gdef\thistitle}} 4006 4007 4008\message{tables,} 4009% Tables -- @table, @ftable, @vtable, @item(x). 4010 4011% default indentation of table text 4012\newdimen\tableindent \tableindent=.8in 4013% default indentation of @itemize and @enumerate text 4014\newdimen\itemindent \itemindent=.3in 4015% margin between end of table item and start of table text. 4016\newdimen\itemmargin \itemmargin=.1in 4017 4018% used internally for \itemindent minus \itemmargin 4019\newdimen\itemmax 4020 4021% Note @table, @ftable, and @vtable define @item, @itemx, etc., with 4022% these defs. 4023% They also define \itemindex 4024% to index the item name in whatever manner is desired (perhaps none). 4025 4026\newif\ifitemxneedsnegativevskip 4027 4028\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} 4029 4030\def\internalBitem{\smallbreak \parsearg\itemzzz} 4031\def\internalBitemx{\itemxpar \parsearg\itemzzz} 4032 4033\def\itemzzz #1{\begingroup % 4034 \advance\hsize by -\rightskip 4035 \advance\hsize by -\tableindent 4036 \setbox0=\hbox{\itemindicate{#1}}% 4037 \itemindex{#1}% 4038 \nobreak % This prevents a break before @itemx. 4039 % 4040 % If the item text does not fit in the space we have, put it on a line 4041 % by itself, and do not allow a page break either before or after that 4042 % line. We do not start a paragraph here because then if the next 4043 % command is, e.g., @kindex, the whatsit would get put into the 4044 % horizontal list on a line by itself, resulting in extra blank space. 4045 \ifdim \wd0>\itemmax 4046 % 4047 % Make this a paragraph so we get the \parskip glue and wrapping, 4048 % but leave it ragged-right. 4049 \begingroup 4050 \advance\leftskip by-\tableindent 4051 \advance\hsize by\tableindent 4052 \advance\rightskip by0pt plus1fil\relax 4053 \leavevmode\unhbox0\par 4054 \endgroup 4055 % 4056 % We're going to be starting a paragraph, but we don't want the 4057 % \parskip glue -- logically it's part of the @item we just started. 4058 \nobreak \vskip-\parskip 4059 % 4060 % Stop a page break at the \parskip glue coming up. However, if 4061 % what follows is an environment such as @example, there will be no 4062 % \parskip glue; then the negative vskip we just inserted would 4063 % cause the example and the item to crash together. So we use this 4064 % bizarre value of 10001 as a signal to \aboveenvbreak to insert 4065 % \parskip glue after all. Section titles are handled this way also. 4066 % 4067 \penalty 10001 4068 \endgroup 4069 \itemxneedsnegativevskipfalse 4070 \else 4071 % The item text fits into the space. Start a paragraph, so that the 4072 % following text (if any) will end up on the same line. 4073 \noindent 4074 % Do this with kerns and \unhbox so that if there is a footnote in 4075 % the item text, it can migrate to the main vertical list and 4076 % eventually be printed. 4077 \nobreak\kern-\tableindent 4078 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 4079 \unhbox0 4080 \nobreak\kern\dimen0 4081 \endgroup 4082 \itemxneedsnegativevskiptrue 4083 \fi 4084} 4085 4086\def\item{\errmessage{@item while not in a list environment}} 4087\def\itemx{\errmessage{@itemx while not in a list environment}} 4088 4089% @table, @ftable, @vtable. 4090\envdef\table{% 4091 \let\itemindex\gobble 4092 \tablecheck{table}% 4093} 4094\envdef\ftable{% 4095 \def\itemindex ##1{\doind {fn}{\code{##1}}}% 4096 \tablecheck{ftable}% 4097} 4098\envdef\vtable{% 4099 \def\itemindex ##1{\doind {vr}{\code{##1}}}% 4100 \tablecheck{vtable}% 4101} 4102\def\tablecheck#1{% 4103 \ifnum \the\catcode`\^^M=\active 4104 \endgroup 4105 \errmessage{This command won't work in this context; perhaps the problem is 4106 that we are \inenvironment\thisenv}% 4107 \def\next{\doignore{#1}}% 4108 \else 4109 \let\next\tablex 4110 \fi 4111 \next 4112} 4113\def\tablex#1{% 4114 \def\itemindicate{#1}% 4115 \parsearg\tabley 4116} 4117\def\tabley#1{% 4118 {% 4119 \makevalueexpandable 4120 \edef\temp{\noexpand\tablez #1\space\space\space}% 4121 \expandafter 4122 }\temp \endtablez 4123} 4124\def\tablez #1 #2 #3 #4\endtablez{% 4125 \aboveenvbreak 4126 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi 4127 \ifnum 0#2>0 \tableindent=#2\mil \fi 4128 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi 4129 \itemmax=\tableindent 4130 \advance \itemmax by -\itemmargin 4131 \advance \leftskip by \tableindent 4132 \exdentamount=\tableindent 4133 \parindent = 0pt 4134 \parskip = \smallskipamount 4135 \ifdim \parskip=0pt \parskip=2pt \fi 4136 \let\item = \internalBitem 4137 \let\itemx = \internalBitemx 4138} 4139\def\Etable{\endgraf\afterenvbreak} 4140\let\Eftable\Etable 4141\let\Evtable\Etable 4142\let\Eitemize\Etable 4143\let\Eenumerate\Etable 4144 4145% This is the counter used by @enumerate, which is really @itemize 4146 4147\newcount \itemno 4148 4149\envdef\itemize{\parsearg\doitemize} 4150 4151\def\doitemize#1{% 4152 \aboveenvbreak 4153 \itemmax=\itemindent 4154 \advance\itemmax by -\itemmargin 4155 \advance\leftskip by \itemindent 4156 \exdentamount=\itemindent 4157 \parindent=0pt 4158 \parskip=\smallskipamount 4159 \ifdim\parskip=0pt \parskip=2pt \fi 4160 % 4161 % Try typesetting the item mark so that if the document erroneously says 4162 % something like @itemize @samp (intending @table), there's an error 4163 % right away at the @itemize. It's not the best error message in the 4164 % world, but it's better than leaving it to the @item. This means if 4165 % the user wants an empty mark, they have to say @w{} not just @w. 4166 \def\itemcontents{#1}% 4167 \setbox0 = \hbox{\itemcontents}% 4168 % 4169 % @itemize with no arg is equivalent to @itemize @bullet. 4170 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi 4171 % 4172 \let\item=\itemizeitem 4173} 4174 4175% Definition of @item while inside @itemize and @enumerate. 4176% 4177\def\itemizeitem{% 4178 \advance\itemno by 1 % for enumerations 4179 {\let\par=\endgraf \smallbreak}% reasonable place to break 4180 {% 4181 % If the document has an @itemize directly after a section title, a 4182 % \nobreak will be last on the list, and \sectionheading will have 4183 % done a \vskip-\parskip. In that case, we don't want to zero 4184 % parskip, or the item text will crash with the heading. On the 4185 % other hand, when there is normal text preceding the item (as there 4186 % usually is), we do want to zero parskip, or there would be too much 4187 % space. In that case, we won't have a \nobreak before. At least 4188 % that's the theory. 4189 \ifnum\lastpenalty<10000 \parskip=0in \fi 4190 \noindent 4191 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% 4192 % 4193 \ifinner\else 4194 \vadjust{\penalty 1200}% not good to break after first line of item. 4195 \fi 4196 % We can be in inner vertical mode in a footnote, although an 4197 % @itemize looks awful there. 4198 }% 4199 \flushcr 4200} 4201 4202% \splitoff TOKENS\endmark defines \first to be the first token in 4203% TOKENS, and \rest to be the remainder. 4204% 4205\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% 4206 4207% Allow an optional argument of an uppercase letter, lowercase letter, 4208% or number, to specify the first label in the enumerated list. No 4209% argument is the same as `1'. 4210% 4211\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} 4212\def\enumeratey #1 #2\endenumeratey{% 4213 % If we were given no argument, pretend we were given `1'. 4214 \def\thearg{#1}% 4215 \ifx\thearg\empty \def\thearg{1}\fi 4216 % 4217 % Detect if the argument is a single token. If so, it might be a 4218 % letter. Otherwise, the only valid thing it can be is a number. 4219 % (We will always have one token, because of the test we just made. 4220 % This is a good thing, since \splitoff doesn't work given nothing at 4221 % all -- the first parameter is undelimited.) 4222 \expandafter\splitoff\thearg\endmark 4223 \ifx\rest\empty 4224 % Only one token in the argument. It could still be anything. 4225 % A ``lowercase letter'' is one whose \lccode is nonzero. 4226 % An ``uppercase letter'' is one whose \lccode is both nonzero, and 4227 % not equal to itself. 4228 % Otherwise, we assume it's a number. 4229 % 4230 % We need the \relax at the end of the \ifnum lines to stop TeX from 4231 % continuing to look for a <number>. 4232 % 4233 \ifnum\lccode\expandafter`\thearg=0\relax 4234 \numericenumerate % a number (we hope) 4235 \else 4236 % It's a letter. 4237 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax 4238 \lowercaseenumerate % lowercase letter 4239 \else 4240 \uppercaseenumerate % uppercase letter 4241 \fi 4242 \fi 4243 \else 4244 % Multiple tokens in the argument. We hope it's a number. 4245 \numericenumerate 4246 \fi 4247} 4248 4249% An @enumerate whose labels are integers. The starting integer is 4250% given in \thearg. 4251% 4252\def\numericenumerate{% 4253 \itemno = \thearg 4254 \startenumeration{\the\itemno}% 4255} 4256 4257% The starting (lowercase) letter is in \thearg. 4258\def\lowercaseenumerate{% 4259 \itemno = \expandafter`\thearg 4260 \startenumeration{% 4261 % Be sure we're not beyond the end of the alphabet. 4262 \ifnum\itemno=0 4263 \errmessage{No more lowercase letters in @enumerate; get a bigger 4264 alphabet}% 4265 \fi 4266 \char\lccode\itemno 4267 }% 4268} 4269 4270% The starting (uppercase) letter is in \thearg. 4271\def\uppercaseenumerate{% 4272 \itemno = \expandafter`\thearg 4273 \startenumeration{% 4274 % Be sure we're not beyond the end of the alphabet. 4275 \ifnum\itemno=0 4276 \errmessage{No more uppercase letters in @enumerate; get a bigger 4277 alphabet} 4278 \fi 4279 \char\uccode\itemno 4280 }% 4281} 4282 4283% Call \doitemize, adding a period to the first argument and supplying the 4284% common last two arguments. Also subtract one from the initial value in 4285% \itemno, since @item increments \itemno. 4286% 4287\def\startenumeration#1{% 4288 \advance\itemno by -1 4289 \doitemize{#1.}\flushcr 4290} 4291 4292% @alphaenumerate and @capsenumerate are abbreviations for giving an arg 4293% to @enumerate. 4294% 4295\def\alphaenumerate{\enumerate{a}} 4296\def\capsenumerate{\enumerate{A}} 4297\def\Ealphaenumerate{\Eenumerate} 4298\def\Ecapsenumerate{\Eenumerate} 4299 4300 4301% @multitable macros 4302% Amy Hendrickson, 8/18/94, 3/6/96 4303% 4304% @multitable ... @end multitable will make as many columns as desired. 4305% Contents of each column will wrap at width given in preamble. Width 4306% can be specified either with sample text given in a template line, 4307% or in percent of \hsize, the current width of text on page. 4308 4309% Table can continue over pages but will only break between lines. 4310 4311% To make preamble: 4312% 4313% Either define widths of columns in terms of percent of \hsize: 4314% @multitable @columnfractions .25 .3 .45 4315% @item ... 4316% 4317% Numbers following @columnfractions are the percent of the total 4318% current hsize to be used for each column. You may use as many 4319% columns as desired. 4320 4321 4322% Or use a template: 4323% @multitable {Column 1 template} {Column 2 template} {Column 3 template} 4324% @item ... 4325% using the widest term desired in each column. 4326 4327% Each new table line starts with @item, each subsequent new column 4328% starts with @tab. Empty columns may be produced by supplying @tab's 4329% with nothing between them for as many times as empty columns are needed, 4330% ie, @tab@tab@tab will produce two empty columns. 4331 4332% @item, @tab do not need to be on their own lines, but it will not hurt 4333% if they are. 4334 4335% Sample multitable: 4336 4337% @multitable {Column 1 template} {Column 2 template} {Column 3 template} 4338% @item first col stuff @tab second col stuff @tab third col 4339% @item 4340% first col stuff 4341% @tab 4342% second col stuff 4343% @tab 4344% third col 4345% @item first col stuff @tab second col stuff 4346% @tab Many paragraphs of text may be used in any column. 4347% 4348% They will wrap at the width determined by the template. 4349% @item@tab@tab This will be in third column. 4350% @end multitable 4351 4352% Default dimensions may be reset by user. 4353% @multitableparskip is vertical space between paragraphs in table. 4354% @multitableparindent is paragraph indent in table. 4355% @multitablecolmargin is horizontal space to be left between columns. 4356% @multitablelinespace is space to leave between table items, baseline 4357% to baseline. 4358% 0pt means it depends on current normal line spacing. 4359% 4360\newskip\multitableparskip 4361\newskip\multitableparindent 4362\newdimen\multitablecolspace 4363\newskip\multitablelinespace 4364\multitableparskip=0pt 4365\multitableparindent=6pt 4366\multitablecolspace=12pt 4367\multitablelinespace=0pt 4368 4369% Macros used to set up halign preamble: 4370% 4371\let\endsetuptable\relax 4372\def\xendsetuptable{\endsetuptable} 4373\let\columnfractions\relax 4374\def\xcolumnfractions{\columnfractions} 4375\newif\ifsetpercent 4376 4377% #1 is the @columnfraction, usually a decimal number like .5, but might 4378% be just 1. We just use it, whatever it is. 4379% 4380\def\pickupwholefraction#1 {% 4381 \global\advance\colcount by 1 4382 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% 4383 \setuptable 4384} 4385 4386\newcount\colcount 4387\def\setuptable#1{% 4388 \def\firstarg{#1}% 4389 \ifx\firstarg\xendsetuptable 4390 \let\go = \relax 4391 \else 4392 \ifx\firstarg\xcolumnfractions 4393 \global\setpercenttrue 4394 \else 4395 \ifsetpercent 4396 \let\go\pickupwholefraction 4397 \else 4398 \global\advance\colcount by 1 4399 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a 4400 % separator; typically that is always in the input, anyway. 4401 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% 4402 \fi 4403 \fi 4404 \ifx\go\pickupwholefraction 4405 % Put the argument back for the \pickupwholefraction call, so 4406 % we'll always have a period there to be parsed. 4407 \def\go{\pickupwholefraction#1}% 4408 \else 4409 \let\go = \setuptable 4410 \fi% 4411 \fi 4412 \go 4413} 4414 4415% multitable-only commands. 4416% 4417% @headitem starts a heading row, which we typeset in bold. Assignments 4418% have to be global since we are inside the implicit group of an 4419% alignment entry. \everycr below resets \everytab so we don't have to 4420% undo it ourselves. 4421\def\headitemfont{\b}% for people to use in the template row; not changeable 4422\def\headitem{% 4423 \checkenv\multitable 4424 \crcr 4425 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings 4426 \global\everytab={\bf}% can't use \headitemfont since the parsing differs 4427 \the\everytab % for the first item 4428}% 4429% 4430% default for tables with no headings. 4431\let\headitemcrhook=\relax 4432% 4433% A \tab used to include \hskip1sp. But then the space in a template 4434% line is not enough. That is bad. So let's go back to just `&' until 4435% we again encounter the problem the 1sp was intended to solve. 4436% --karl, nathan@acm.org, 20apr99. 4437\def\tab{\checkenv\multitable &\the\everytab}% 4438 4439% @multitable ... @end multitable definitions: 4440% 4441\newtoks\everytab % insert after every tab. 4442% 4443\envdef\multitable{% 4444 \vskip\parskip 4445 \startsavinginserts 4446 % 4447 % @item within a multitable starts a normal row. 4448 % We use \def instead of \let so that if one of the multitable entries 4449 % contains an @itemize, we don't choke on the \item (seen as \crcr aka 4450 % \endtemplate) expanding \doitemize. 4451 \def\item{\crcr}% 4452 % 4453 \tolerance=9500 4454 \hbadness=9500 4455 \setmultitablespacing 4456 \parskip=\multitableparskip 4457 \parindent=\multitableparindent 4458 \overfullrule=0pt 4459 \global\colcount=0 4460 % 4461 \everycr = {% 4462 \noalign{% 4463 \global\everytab={}% Reset from possible headitem. 4464 \global\colcount=0 % Reset the column counter. 4465 % 4466 % Check for saved footnotes, etc.: 4467 \checkinserts 4468 % 4469 % Perhaps a \nobreak, then reset: 4470 \headitemcrhook 4471 \global\let\headitemcrhook=\relax 4472 }% 4473 }% 4474 % 4475 \parsearg\domultitable 4476} 4477\def\domultitable#1{% 4478 % To parse everything between @multitable and @item: 4479 \setuptable#1 \endsetuptable 4480 % 4481 % This preamble sets up a generic column definition, which will 4482 % be used as many times as user calls for columns. 4483 % \vtop will set a single line and will also let text wrap and 4484 % continue for many paragraphs if desired. 4485 \halign\bgroup &% 4486 \global\advance\colcount by 1 4487 \multistrut 4488 \vtop{% 4489 % Use the current \colcount to find the correct column width: 4490 \hsize=\expandafter\csname col\the\colcount\endcsname 4491 % 4492 % In order to keep entries from bumping into each other 4493 % we will add a \leftskip of \multitablecolspace to all columns after 4494 % the first one. 4495 % 4496 % If a template has been used, we will add \multitablecolspace 4497 % to the width of each template entry. 4498 % 4499 % If the user has set preamble in terms of percent of \hsize we will 4500 % use that dimension as the width of the column, and the \leftskip 4501 % will keep entries from bumping into each other. Table will start at 4502 % left margin and final column will justify at right margin. 4503 % 4504 % Make sure we don't inherit \rightskip from the outer environment. 4505 \rightskip=0pt 4506 \ifnum\colcount=1 4507 % The first column will be indented with the surrounding text. 4508 \advance\hsize by\leftskip 4509 \else 4510 \ifsetpercent \else 4511 % If user has not set preamble in terms of percent of \hsize 4512 % we will advance \hsize by \multitablecolspace. 4513 \advance\hsize by \multitablecolspace 4514 \fi 4515 % In either case we will make \leftskip=\multitablecolspace: 4516 \leftskip=\multitablecolspace 4517 \fi 4518 % Ignoring space at the beginning and end avoids an occasional spurious 4519 % blank line, when TeX decides to break the line at the space before the 4520 % box from the multistrut, so the strut ends up on a line by itself. 4521 % For example: 4522 % @multitable @columnfractions .11 .89 4523 % @item @code{#} 4524 % @tab Legal holiday which is valid in major parts of the whole country. 4525 % Is automatically provided with highlighting sequences respectively 4526 % marking characters. 4527 \noindent\ignorespaces##\unskip\multistrut 4528 }\cr 4529} 4530\def\Emultitable{% 4531 \crcr 4532 \egroup % end the \halign 4533 \global\setpercentfalse 4534} 4535 4536\def\setmultitablespacing{% 4537 \def\multistrut{\strut}% just use the standard line spacing 4538 % 4539 % Compute \multitablelinespace (if not defined by user) for use in 4540 % \multitableparskip calculation. We used define \multistrut based on 4541 % this, but (ironically) that caused the spacing to be off. 4542 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. 4543\ifdim\multitablelinespace=0pt 4544\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip 4545\global\advance\multitablelinespace by-\ht0 4546\fi 4547% Test to see if parskip is larger than space between lines of 4548% table. If not, do nothing. 4549% If so, set to same dimension as multitablelinespace. 4550\ifdim\multitableparskip>\multitablelinespace 4551\global\multitableparskip=\multitablelinespace 4552\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller 4553 % than skip between lines in the table. 4554\fi% 4555\ifdim\multitableparskip=0pt 4556\global\multitableparskip=\multitablelinespace 4557\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller 4558 % than skip between lines in the table. 4559\fi} 4560 4561 4562\message{conditionals,} 4563 4564% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, 4565% @ifnotxml always succeed. They currently do nothing; we don't 4566% attempt to check whether the conditionals are properly nested. But we 4567% have to remember that they are conditionals, so that @end doesn't 4568% attempt to close an environment group. 4569% 4570\def\makecond#1{% 4571 \expandafter\let\csname #1\endcsname = \relax 4572 \expandafter\let\csname iscond.#1\endcsname = 1 4573} 4574\makecond{iftex} 4575\makecond{ifnotdocbook} 4576\makecond{ifnothtml} 4577\makecond{ifnotinfo} 4578\makecond{ifnotplaintext} 4579\makecond{ifnotxml} 4580 4581% Ignore @ignore, @ifhtml, @ifinfo, and the like. 4582% 4583\def\direntry{\doignore{direntry}} 4584\def\documentdescription{\doignore{documentdescription}} 4585\def\docbook{\doignore{docbook}} 4586\def\html{\doignore{html}} 4587\def\ifdocbook{\doignore{ifdocbook}} 4588\def\ifhtml{\doignore{ifhtml}} 4589\def\ifinfo{\doignore{ifinfo}} 4590\def\ifnottex{\doignore{ifnottex}} 4591\def\ifplaintext{\doignore{ifplaintext}} 4592\def\ifxml{\doignore{ifxml}} 4593\def\ignore{\doignore{ignore}} 4594\def\menu{\doignore{menu}} 4595\def\xml{\doignore{xml}} 4596 4597% Ignore text until a line `@end #1', keeping track of nested conditionals. 4598% 4599% A count to remember the depth of nesting. 4600\newcount\doignorecount 4601 4602\def\doignore#1{\begingroup 4603 % Scan in ``verbatim'' mode: 4604 \obeylines 4605 \catcode`\@ = \other 4606 \catcode`\{ = \other 4607 \catcode`\} = \other 4608 % 4609 % Make sure that spaces turn into tokens that match what \doignoretext wants. 4610 \spaceisspace 4611 % 4612 % Count number of #1's that we've seen. 4613 \doignorecount = 0 4614 % 4615 % Swallow text until we reach the matching `@end #1'. 4616 \dodoignore{#1}% 4617} 4618 4619{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. 4620 \obeylines % 4621 % 4622 \gdef\dodoignore#1{% 4623 % #1 contains the command name as a string, e.g., `ifinfo'. 4624 % 4625 % Define a command to find the next `@end #1'. 4626 \long\def\doignoretext##1^^M@end #1{% 4627 \doignoretextyyy##1^^M@#1\_STOP_}% 4628 % 4629 % And this command to find another #1 command, at the beginning of a 4630 % line. (Otherwise, we would consider a line `@c @ifset', for 4631 % example, to count as an @ifset for nesting.) 4632 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% 4633 % 4634 % And now expand that command. 4635 \doignoretext ^^M% 4636 }% 4637} 4638 4639\def\doignoreyyy#1{% 4640 \def\temp{#1}% 4641 \ifx\temp\empty % Nothing found. 4642 \let\next\doignoretextzzz 4643 \else % Found a nested condition, ... 4644 \advance\doignorecount by 1 4645 \let\next\doignoretextyyy % ..., look for another. 4646 % If we're here, #1 ends with ^^M\ifinfo (for example). 4647 \fi 4648 \next #1% the token \_STOP_ is present just after this macro. 4649} 4650 4651% We have to swallow the remaining "\_STOP_". 4652% 4653\def\doignoretextzzz#1{% 4654 \ifnum\doignorecount = 0 % We have just found the outermost @end. 4655 \let\next\enddoignore 4656 \else % Still inside a nested condition. 4657 \advance\doignorecount by -1 4658 \let\next\doignoretext % Look for the next @end. 4659 \fi 4660 \next 4661} 4662 4663% Finish off ignored text. 4664{ \obeylines% 4665 % Ignore anything after the last `@end #1'; this matters in verbatim 4666 % environments, where otherwise the newline after an ignored conditional 4667 % would result in a blank line in the output. 4668 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% 4669} 4670 4671 4672% @set VAR sets the variable VAR to an empty value. 4673% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. 4674% 4675% Since we want to separate VAR from REST-OF-LINE (which might be 4676% empty), we can't just use \parsearg; we have to insert a space of our 4677% own to delimit the rest of the line, and then take it out again if we 4678% didn't need it. 4679% We rely on the fact that \parsearg sets \catcode`\ =10. 4680% 4681\parseargdef\set{\setyyy#1 \endsetyyy} 4682\def\setyyy#1 #2\endsetyyy{% 4683 {% 4684 \makevalueexpandable 4685 \def\temp{#2}% 4686 \edef\next{\gdef\makecsname{SET#1}}% 4687 \ifx\temp\empty 4688 \next{}% 4689 \else 4690 \setzzz#2\endsetzzz 4691 \fi 4692 }% 4693} 4694% Remove the trailing space \setxxx inserted. 4695\def\setzzz#1 \endsetzzz{\next{#1}} 4696 4697% @clear VAR clears (i.e., unsets) the variable VAR. 4698% 4699\parseargdef\clear{% 4700 {% 4701 \makevalueexpandable 4702 \global\expandafter\let\csname SET#1\endcsname=\relax 4703 }% 4704} 4705 4706% @value{foo} gets the text saved in variable foo. 4707\def\value{\begingroup\makevalueexpandable\valuexxx} 4708\def\valuexxx#1{\expandablevalue{#1}\endgroup} 4709{ 4710 \catcode`\-=\active \catcode`\_=\active 4711 % 4712 \gdef\makevalueexpandable{% 4713 \let\value = \expandablevalue 4714 % We don't want these characters active, ... 4715 \catcode`\-=\other \catcode`\_=\other 4716 % ..., but we might end up with active ones in the argument if 4717 % we're called from @code, as @code{@value{foo-bar_}}, though. 4718 % So \let them to their normal equivalents. 4719 \let-\normaldash \let_\normalunderscore 4720 } 4721} 4722 4723\def\expandablevalue#1{% 4724 \expandafter\ifx\csname SET#1\endcsname\relax 4725 {[No value for ``#1'']}% 4726 \message{Variable `#1', used in @value, is not set.}% 4727 \else 4728 \csname SET#1\endcsname 4729 \fi 4730} 4731 4732% Like \expandablevalue, but completely expandable (the \message in the 4733% definition above operates at the execution level of TeX). Used when 4734% writing to auxiliary files, due to the expansion that \write does. 4735% If flag is undefined, pass through an unexpanded @value command: maybe it 4736% will be set by the time it is read back in. 4737% 4738% NB flag names containing - or _ may not work here. 4739\def\dummyvalue#1{% 4740 \expandafter\ifx\csname SET#1\endcsname\relax 4741 \string\value{#1}% 4742 \else 4743 \csname SET#1\endcsname 4744 \fi 4745} 4746 4747% Used for @value's in index entries to form the sort key: expand the @value 4748% if possible, otherwise sort late. 4749\def\indexnofontsvalue#1{% 4750 \expandafter\ifx\csname SET#1\endcsname\relax 4751 ZZZZZZZ% 4752 \else 4753 \csname SET#1\endcsname 4754 \fi 4755} 4756 4757% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined 4758% with @set. 4759% 4760% To get the special treatment we need for `@end ifset,' we call 4761% \makecond and then redefine. 4762% 4763\makecond{ifset} 4764\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} 4765\def\doifset#1#2{% 4766 {% 4767 \makevalueexpandable 4768 \let\next=\empty 4769 \expandafter\ifx\csname SET#2\endcsname\relax 4770 #1% If not set, redefine \next. 4771 \fi 4772 \expandafter 4773 }\next 4774} 4775\def\ifsetfail{\doignore{ifset}} 4776 4777% @ifclear VAR ... @end executes the `...' iff VAR has never been 4778% defined with @set, or has been undefined with @clear. 4779% 4780% The `\else' inside the `\doifset' parameter is a trick to reuse the 4781% above code: if the variable is not set, do nothing, if it is set, 4782% then redefine \next to \ifclearfail. 4783% 4784\makecond{ifclear} 4785\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} 4786\def\ifclearfail{\doignore{ifclear}} 4787 4788% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written 4789% without the @) is in fact defined. We can only feasibly check at the 4790% TeX level, so something like `mathcode' is going to considered 4791% defined even though it is not a Texinfo command. 4792% 4793\makecond{ifcommanddefined} 4794\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} 4795% 4796\def\doifcmddefined#1#2{{% 4797 \makevalueexpandable 4798 \let\next=\empty 4799 \expandafter\ifx\csname #2\endcsname\relax 4800 #1% If not defined, \let\next as above. 4801 \fi 4802 \expandafter 4803 }\next 4804} 4805\def\ifcmddefinedfail{\doignore{ifcommanddefined}} 4806 4807% @ifcommandnotdefined CMD ... handled similar to @ifclear above. 4808\makecond{ifcommandnotdefined} 4809\def\ifcommandnotdefined{% 4810 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} 4811\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} 4812 4813% Set the `txicommandconditionals' variable, so documents have a way to 4814% test if the @ifcommand...defined conditionals are available. 4815\set txicommandconditionals 4816 4817% @dircategory CATEGORY -- specify a category of the dir file 4818% which this file should belong to. Ignore this in TeX. 4819\let\dircategory=\comment 4820 4821% @defininfoenclose. 4822\let\definfoenclose=\comment 4823 4824 4825\message{indexing,} 4826% Index generation facilities 4827 4828% Define \newwrite to be identical to plain tex's \newwrite 4829% except not \outer, so it can be used within macros and \if's. 4830\edef\newwrite{\makecsname{ptexnewwrite}} 4831 4832% \newindex {foo} defines an index named IX. 4833% It automatically defines \IXindex such that 4834% \IXindex ...rest of line... puts an entry in the index IX. 4835% It also defines \IXindfile to be the number of the output channel for 4836% the file that accumulates this index. The file's extension is IX. 4837% The name of an index should be no more than 2 characters long 4838% for the sake of vms. 4839% 4840\def\newindex#1{% 4841 \expandafter\chardef\csname#1indfile\endcsname=0 4842 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index 4843 \noexpand\doindex{#1}} 4844} 4845 4846% @defindex foo == \newindex{foo} 4847% 4848\def\defindex{\parsearg\newindex} 4849 4850% Define @defcodeindex, like @defindex except put all entries in @code. 4851% 4852\def\defcodeindex{\parsearg\newcodeindex} 4853% 4854\def\newcodeindex#1{% 4855 \expandafter\chardef\csname#1indfile\endcsname=0 4856 \expandafter\xdef\csname#1index\endcsname{% 4857 \noexpand\docodeindex{#1}}% 4858} 4859 4860% The default indices: 4861\newindex{cp}% concepts, 4862\newcodeindex{fn}% functions, 4863\newcodeindex{vr}% variables, 4864\newcodeindex{tp}% types, 4865\newcodeindex{ky}% keys 4866\newcodeindex{pg}% and programs. 4867 4868 4869% @synindex foo bar makes index foo feed into index bar. 4870% Do this instead of @defindex foo if you don't want it as a separate index. 4871% 4872% @syncodeindex foo bar similar, but put all entries made for index foo 4873% inside @code. 4874% 4875\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} 4876\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} 4877 4878% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), 4879% #3 the target index (bar). 4880\def\dosynindex#1#2#3{% 4881 \requireopenindexfile{#3}% 4882 % redefine \fooindfile: 4883 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname 4884 \expandafter\let\csname#2indfile\endcsname=\temp 4885 % redefine \fooindex: 4886 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% 4887} 4888 4889% Define \doindex, the driver for all index macros. 4890% Argument #1 is generated by the calling \fooindex macro, 4891% and it is the two-letter name of the index. 4892 4893\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx} 4894\def\doindexxxx #1{\doind{\indexname}{#1}} 4895 4896% like the previous two, but they put @code around the argument. 4897\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} 4898\def\docodeindexxxx #1{\docind{\indexname}{#1}} 4899 4900 4901% Used for the aux, toc and index files to prevent expansion of Texinfo 4902% commands. 4903% 4904\def\atdummies{% 4905 \definedummyletter\@% 4906 \definedummyletter\ % 4907 \definedummyletter\{% 4908 \definedummyletter\}% 4909 \definedummyletter\&% 4910 % 4911 % Do the redefinitions. 4912 \definedummies 4913 \otherbackslash 4914} 4915 4916% \definedummyword defines \#1 as \string\#1\space, thus effectively 4917% preventing its expansion. This is used only for control words, 4918% not control letters, because the \space would be incorrect for 4919% control characters, but is needed to separate the control word 4920% from whatever follows. 4921% 4922% These can be used both for control words that take an argument and 4923% those that do not. If it is followed by {arg} in the input, then 4924% that will dutifully get written to the index (or wherever). 4925% 4926% For control letters, we have \definedummyletter, which omits the 4927% space. 4928% 4929\def\definedummyword #1{\def#1{\string#1\space}}% 4930\def\definedummyletter#1{\def#1{\string#1}}% 4931\let\definedummyaccent\definedummyletter 4932 4933% Called from \atdummies to prevent the expansion of commands. 4934% 4935\def\definedummies{% 4936 % 4937 \let\commondummyword\definedummyword 4938 \let\commondummyletter\definedummyletter 4939 \let\commondummyaccent\definedummyaccent 4940 \commondummiesnofonts 4941 % 4942 \definedummyletter\_% 4943 \definedummyletter\-% 4944 % 4945 % Non-English letters. 4946 \definedummyword\AA 4947 \definedummyword\AE 4948 \definedummyword\DH 4949 \definedummyword\L 4950 \definedummyword\O 4951 \definedummyword\OE 4952 \definedummyword\TH 4953 \definedummyword\aa 4954 \definedummyword\ae 4955 \definedummyword\dh 4956 \definedummyword\exclamdown 4957 \definedummyword\l 4958 \definedummyword\o 4959 \definedummyword\oe 4960 \definedummyword\ordf 4961 \definedummyword\ordm 4962 \definedummyword\questiondown 4963 \definedummyword\ss 4964 \definedummyword\th 4965 % 4966 % Although these internal commands shouldn't show up, sometimes they do. 4967 \definedummyword\bf 4968 \definedummyword\gtr 4969 \definedummyword\hat 4970 \definedummyword\less 4971 \definedummyword\sf 4972 \definedummyword\sl 4973 \definedummyword\tclose 4974 \definedummyword\tt 4975 % 4976 \definedummyword\LaTeX 4977 \definedummyword\TeX 4978 % 4979 % Assorted special characters. 4980 \definedummyword\ampchar 4981 \definedummyword\atchar 4982 \definedummyword\arrow 4983 \definedummyword\backslashchar 4984 \definedummyword\bullet 4985 \definedummyword\comma 4986 \definedummyword\copyright 4987 \definedummyword\registeredsymbol 4988 \definedummyword\dots 4989 \definedummyword\enddots 4990 \definedummyword\entrybreak 4991 \definedummyword\equiv 4992 \definedummyword\error 4993 \definedummyword\euro 4994 \definedummyword\expansion 4995 \definedummyword\geq 4996 \definedummyword\guillemetleft 4997 \definedummyword\guillemetright 4998 \definedummyword\guilsinglleft 4999 \definedummyword\guilsinglright 5000 \definedummyword\lbracechar 5001 \definedummyword\leq 5002 \definedummyword\mathopsup 5003 \definedummyword\minus 5004 \definedummyword\ogonek 5005 \definedummyword\pounds 5006 \definedummyword\point 5007 \definedummyword\print 5008 \definedummyword\quotedblbase 5009 \definedummyword\quotedblleft 5010 \definedummyword\quotedblright 5011 \definedummyword\quoteleft 5012 \definedummyword\quoteright 5013 \definedummyword\quotesinglbase 5014 \definedummyword\rbracechar 5015 \definedummyword\result 5016 \definedummyword\sub 5017 \definedummyword\sup 5018 \definedummyword\textdegree 5019 % 5020 \definedummyword\subentry 5021 % 5022 % We want to disable all macros so that they are not expanded by \write. 5023 \macrolist 5024 \let\value\dummyvalue 5025 % 5026 \normalturnoffactive 5027} 5028 5029% \commondummiesnofonts: common to \definedummies and \indexnofonts. 5030% Define \commondummyletter, \commondummyaccent and \commondummyword before 5031% using. Used for accents, font commands, and various control letters. 5032% 5033\def\commondummiesnofonts{% 5034 % Control letters and accents. 5035 \commondummyletter\!% 5036 \commondummyaccent\"% 5037 \commondummyaccent\'% 5038 \commondummyletter\*% 5039 \commondummyaccent\,% 5040 \commondummyletter\.% 5041 \commondummyletter\/% 5042 \commondummyletter\:% 5043 \commondummyaccent\=% 5044 \commondummyletter\?% 5045 \commondummyaccent\^% 5046 \commondummyaccent\`% 5047 \commondummyaccent\~% 5048 \commondummyword\u 5049 \commondummyword\v 5050 \commondummyword\H 5051 \commondummyword\dotaccent 5052 \commondummyword\ogonek 5053 \commondummyword\ringaccent 5054 \commondummyword\tieaccent 5055 \commondummyword\ubaraccent 5056 \commondummyword\udotaccent 5057 \commondummyword\dotless 5058 % 5059 % Texinfo font commands. 5060 \commondummyword\b 5061 \commondummyword\i 5062 \commondummyword\r 5063 \commondummyword\sansserif 5064 \commondummyword\sc 5065 \commondummyword\slanted 5066 \commondummyword\t 5067 % 5068 % Commands that take arguments. 5069 \commondummyword\abbr 5070 \commondummyword\acronym 5071 \commondummyword\anchor 5072 \commondummyword\cite 5073 \commondummyword\code 5074 \commondummyword\command 5075 \commondummyword\dfn 5076 \commondummyword\dmn 5077 \commondummyword\email 5078 \commondummyword\emph 5079 \commondummyword\env 5080 \commondummyword\file 5081 \commondummyword\image 5082 \commondummyword\indicateurl 5083 \commondummyword\inforef 5084 \commondummyword\kbd 5085 \commondummyword\key 5086 \commondummyword\math 5087 \commondummyword\option 5088 \commondummyword\pxref 5089 \commondummyword\ref 5090 \commondummyword\samp 5091 \commondummyword\strong 5092 \commondummyword\tie 5093 \commondummyword\U 5094 \commondummyword\uref 5095 \commondummyword\url 5096 \commondummyword\var 5097 \commondummyword\verb 5098 \commondummyword\w 5099 \commondummyword\xref 5100} 5101 5102\let\indexlbrace\relax 5103\let\indexrbrace\relax 5104\let\indexatchar\relax 5105\let\indexbackslash\relax 5106 5107{\catcode`\@=0 5108\catcode`\\=13 5109 @gdef@backslashdisappear{@def\{}} 5110} 5111 5112{ 5113\catcode`\<=13 5114\catcode`\-=13 5115\catcode`\`=13 5116 \gdef\indexnonalnumdisappear{% 5117 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else 5118 % @set txiindexlquoteignore makes us ignore left quotes in the sort term. 5119 % (Introduced for FSFS 2nd ed.) 5120 \let`=\empty 5121 \fi 5122 % 5123 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else 5124 \backslashdisappear 5125 \fi 5126 % 5127 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else 5128 \def-{}% 5129 \fi 5130 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else 5131 \def<{}% 5132 \fi 5133 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else 5134 \def\@{}% 5135 \fi 5136 } 5137 5138 \gdef\indexnonalnumreappear{% 5139 \let-\normaldash 5140 \let<\normalless 5141 } 5142} 5143 5144 5145% \indexnofonts is used when outputting the strings to sort the index 5146% by, and when constructing control sequence names. It eliminates all 5147% control sequences and just writes whatever the best ASCII sort string 5148% would be for a given command (usually its argument). 5149% 5150\def\indexnofonts{% 5151 % Accent commands should become @asis. 5152 \def\commondummyaccent##1{\let##1\asis}% 5153 % We can just ignore other control letters. 5154 \def\commondummyletter##1{\let##1\empty}% 5155 % All control words become @asis by default; overrides below. 5156 \let\commondummyword\commondummyaccent 5157 \commondummiesnofonts 5158 % 5159 % Don't no-op \tt, since it isn't a user-level command 5160 % and is used in the definitions of the active chars like <, >, |, etc. 5161 % Likewise with the other plain tex font commands. 5162 %\let\tt=\asis 5163 % 5164 \def\ { }% 5165 \def\@{@}% 5166 \def\_{\normalunderscore}% 5167 \def\-{}% @- shouldn't affect sorting 5168 % 5169 \uccode`\1=`\{ \uppercase{\def\{{1}}% 5170 \uccode`\1=`\} \uppercase{\def\}{1}}% 5171 \let\lbracechar\{% 5172 \let\rbracechar\}% 5173 % 5174 % 5175 \let\do\indexnofontsdef 5176 % 5177 % Non-English letters. 5178 \do\AA{AA}% 5179 \do\AE{AE}% 5180 \do\DH{DZZ}% 5181 \do\L{L}% 5182 \do\OE{OE}% 5183 \do\O{O}% 5184 \do\TH{TH}% 5185 \do\aa{aa}% 5186 \do\ae{ae}% 5187 \do\dh{dzz}% 5188 \do\exclamdown{!}% 5189 \do\l{l}% 5190 \do\oe{oe}% 5191 \do\ordf{a}% 5192 \do\ordm{o}% 5193 \do\o{o}% 5194 \do\questiondown{?}% 5195 \do\ss{ss}% 5196 \do\th{th}% 5197 % 5198 \do\LaTeX{LaTeX}% 5199 \do\TeX{TeX}% 5200 % 5201 % Assorted special characters. 5202 \do\atchar{@}% 5203 \do\arrow{->}% 5204 \do\bullet{bullet}% 5205 \do\comma{,}% 5206 \do\copyright{copyright}% 5207 \do\dots{...}% 5208 \do\enddots{...}% 5209 \do\equiv{==}% 5210 \do\error{error}% 5211 \do\euro{euro}% 5212 \do\expansion{==>}% 5213 \do\geq{>=}% 5214 \do\guillemetleft{<<}% 5215 \do\guillemetright{>>}% 5216 \do\guilsinglleft{<}% 5217 \do\guilsinglright{>}% 5218 \do\leq{<=}% 5219 \do\lbracechar{\{}% 5220 \do\minus{-}% 5221 \do\point{.}% 5222 \do\pounds{pounds}% 5223 \do\print{-|}% 5224 \do\quotedblbase{"}% 5225 \do\quotedblleft{"}% 5226 \do\quotedblright{"}% 5227 \do\quoteleft{`}% 5228 \do\quoteright{'}% 5229 \do\quotesinglbase{,}% 5230 \do\rbracechar{\}}% 5231 \do\registeredsymbol{R}% 5232 \do\result{=>}% 5233 \do\textdegree{o}% 5234 % 5235 % We need to get rid of all macros, leaving only the arguments (if present). 5236 % Of course this is not nearly correct, but it is the best we can do for now. 5237 % makeinfo does not expand macros in the argument to @deffn, which ends up 5238 % writing an index entry, and texindex isn't prepared for an index sort entry 5239 % that starts with \. 5240 % 5241 % Since macro invocations are followed by braces, we can just redefine them 5242 % to take a single TeX argument. The case of a macro invocation that 5243 % goes to end-of-line is not handled. 5244 % 5245 \macrolist 5246 \let\value\indexnofontsvalue 5247} 5248 5249% Give the control sequence a definition that removes the {} that follows 5250% its use, e.g. @AA{} -> AA 5251\def\indexnofontsdef#1#2{\def#1##1{#2}}% 5252 5253 5254 5255 5256% #1 is the index name, #2 is the entry text. 5257\def\doind#1#2{% 5258 \iflinks 5259 {% 5260 % 5261 \requireopenindexfile{#1}% 5262 \edef\writeto{\csname#1indfile\endcsname}% 5263 % 5264 \def\indextext{#2}% 5265 \safewhatsit\doindwrite 5266 }% 5267 \fi 5268} 5269 5270% Same as \doind, but for code indices 5271\def\docind#1#2{% 5272 \iflinks 5273 {% 5274 % 5275 \requireopenindexfile{#1}% 5276 \edef\writeto{\csname#1indfile\endcsname}% 5277 % 5278 \def\indextext{#2}% 5279 \safewhatsit\docindwrite 5280 }% 5281 \fi 5282} 5283 5284% Check if an index file has been opened, and if not, open it. 5285\def\requireopenindexfile#1{% 5286\ifnum\csname #1indfile\endcsname=0 5287 \expandafter\newwrite \csname#1indfile\endcsname 5288 \edef\suffix{#1}% 5289 % A .fls suffix would conflict with the file extension for the output 5290 % of -recorder, so use .f1s instead. 5291 \ifx\suffix\indexisfl\def\suffix{f1}\fi 5292 % Open the file 5293 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix 5294 % Using \immediate above here prevents an object entering into the current 5295 % box, which could confound checks such as those in \safewhatsit for 5296 % preceding skips. 5297 \typeout{Writing index file \jobname.\suffix}% 5298\fi} 5299\def\indexisfl{fl} 5300 5301% Definition for writing index entry sort key. 5302{ 5303\catcode`\-=13 5304\gdef\indexwritesortas{% 5305 \begingroup 5306 \indexnonalnumreappear 5307 \indexwritesortasxxx} 5308\gdef\indexwritesortasxxx#1{% 5309 \xdef\indexsortkey{#1}\endgroup} 5310} 5311 5312\def\indexwriteseealso#1{ 5313 \gdef\pagenumbertext{\string\seealso{#1}}% 5314} 5315\def\indexwriteseeentry#1{ 5316 \gdef\pagenumbertext{\string\seeentry{#1}}% 5317} 5318 5319% The default definitions 5320\def\sortas#1{}% 5321\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only 5322\def\putwordSeeAlso{See also} 5323\def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only 5324 5325 5326% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}": 5327% * Set \bracedtext to "{aaa}{bbb}" 5328% * Set \fullindexsortkey to "aaa @subentry ZZZ" 5329% * If @seealso occurs, set \pagenumbertext 5330% 5331\def\splitindexentry#1{% 5332 \gdef\fullindexsortkey{}% 5333 \xdef\bracedtext{}% 5334 \def\sep{}% 5335 \def\seealso##1{}% 5336 \def\seeentry##1{}% 5337 \expandafter\doindexsegment#1\subentry\finish\subentry 5338} 5339 5340% append the results from the next segment 5341\def\doindexsegment#1\subentry{% 5342 \def\segment{#1}% 5343 \ifx\segment\isfinish 5344 \else 5345 % 5346 % Fully expand the segment, throwing away any @sortas directives, and 5347 % trim spaces. 5348 \edef\trimmed{\segment}% 5349 \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% 5350 \ifincodeindex 5351 \edef\trimmed{\noexpand\code{\trimmed}}% 5352 \fi 5353 % 5354 \xdef\bracedtext{\bracedtext{\trimmed}}% 5355 % 5356 % Get the string to sort by. Process the segment with all 5357 % font commands turned off. 5358 \bgroup 5359 \let\sortas\indexwritesortas 5360 \let\seealso\indexwriteseealso 5361 \let\seeentry\indexwriteseeentry 5362 \indexnofonts 5363 % The braces around the commands are recognized by texindex. 5364 \def\lbracechar{{\string\indexlbrace}}% 5365 \def\rbracechar{{\string\indexrbrace}}% 5366 \let\{=\lbracechar 5367 \let\}=\rbracechar 5368 \def\@{{\string\indexatchar}}% 5369 \def\atchar##1{\@}% 5370 \def\backslashchar{{\string\indexbackslash}}% 5371 \uccode`\~=`\\ \uppercase{\let~\backslashchar}% 5372 % 5373 \let\indexsortkey\empty 5374 \global\let\pagenumbertext\empty 5375 % Execute the segment and throw away the typeset output. This executes 5376 % any @sortas or @seealso commands in this segment. 5377 \setbox\dummybox = \hbox{\segment}% 5378 \ifx\indexsortkey\empty{% 5379 \indexnonalnumdisappear 5380 \xdef\trimmed{\segment}% 5381 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% 5382 \xdef\indexsortkey{\trimmed}% 5383 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi 5384 }\fi 5385 % 5386 % Append to \fullindexsortkey. 5387 \edef\tmp{\gdef\noexpand\fullindexsortkey{% 5388 \fullindexsortkey\sep\indexsortkey}}% 5389 \tmp 5390 \egroup 5391 \def\sep{\subentry}% 5392 % 5393 \expandafter\doindexsegment 5394 \fi 5395} 5396\def\isfinish{\finish}% 5397\newbox\dummybox % used above 5398 5399\let\subentry\relax 5400 5401% Use \ instead of @ in index files. To support old texi2dvi and texindex. 5402% This works without changing the escape character used in the toc or aux 5403% files because the index entries are fully expanded here, and \string uses 5404% the current value of \escapechar. 5405\def\escapeisbackslash{\escapechar=`\\} 5406 5407% Use \ in index files by default. texi2dvi didn't support @ as the escape 5408% character (as it checked for "\entry" in the files, and not "@entry"). When 5409% the new version of texi2dvi has had a chance to become more prevalent, then 5410% the escape character can change back to @ again. This should be an easy 5411% change to make now because both @ and \ are only used as escape characters in 5412% index files, never standing for themselves. 5413% 5414\set txiindexescapeisbackslash 5415 5416% Write the entry in \indextext to the index file. 5417% 5418 5419\newif\ifincodeindex 5420\def\doindwrite{\incodeindexfalse\doindwritex} 5421\def\docindwrite{\incodeindextrue\doindwritex} 5422 5423\def\doindwritex{% 5424 \maybemarginindex 5425 % 5426 \atdummies 5427 % 5428 \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else 5429 \escapeisbackslash 5430 \fi 5431 % 5432 % For texindex which always views { and } as separators. 5433 \def\{{\lbracechar{}}% 5434 \def\}{\rbracechar{}}% 5435 \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}% 5436 % 5437 % Split the entry into primary entry and any subentries, and get the index 5438 % sort key. 5439 \splitindexentry\indextext 5440 % 5441 % Set up the complete index entry, with both the sort key and 5442 % the original text, including any font commands. We write 5443 % three arguments to \entry to the .?? file (four in the 5444 % subentry case), texindex reduces to two when writing the .??s 5445 % sorted result. 5446 % 5447 \edef\temp{% 5448 \write\writeto{% 5449 \string\entry{\fullindexsortkey}% 5450 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}% 5451 \bracedtext}% 5452 }% 5453 \temp 5454} 5455 5456% Put the index entry in the margin if desired (undocumented). 5457\def\maybemarginindex{% 5458 \ifx\SETmarginindex\relax\else 5459 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}% 5460 \fi 5461} 5462\let\SETmarginindex=\relax 5463 5464 5465% Take care of unwanted page breaks/skips around a whatsit: 5466% 5467% If a skip is the last thing on the list now, preserve it 5468% by backing up by \lastskip, doing the \write, then inserting 5469% the skip again. Otherwise, the whatsit generated by the 5470% \write or \pdfdest will make \lastskip zero. The result is that 5471% sequences like this: 5472% @end defun 5473% @tindex whatever 5474% @defun ... 5475% will have extra space inserted, because the \medbreak in the 5476% start of the @defun won't see the skip inserted by the @end of 5477% the previous defun. 5478% 5479% But don't do any of this if we're not in vertical mode. We 5480% don't want to do a \vskip and prematurely end a paragraph. 5481% 5482% Avoid page breaks due to these extra skips, too. 5483% 5484% But wait, there is a catch there: 5485% We'll have to check whether \lastskip is zero skip. \ifdim is not 5486% sufficient for this purpose, as it ignores stretch and shrink parts 5487% of the skip. The only way seems to be to check the textual 5488% representation of the skip. 5489% 5490% The following is almost like \def\zeroskipmacro{0.0pt} except that 5491% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). 5492% 5493\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} 5494% 5495\newskip\whatsitskip 5496\newcount\whatsitpenalty 5497% 5498% ..., ready, GO: 5499% 5500\def\safewhatsit#1{\ifhmode 5501 #1% 5502 \else 5503 % \lastskip and \lastpenalty cannot both be nonzero simultaneously. 5504 \whatsitskip = \lastskip 5505 \edef\lastskipmacro{\the\lastskip}% 5506 \whatsitpenalty = \lastpenalty 5507 % 5508 % If \lastskip is nonzero, that means the last item was a 5509 % skip. And since a skip is discardable, that means this 5510 % -\whatsitskip glue we're inserting is preceded by a 5511 % non-discardable item, therefore it is not a potential 5512 % breakpoint, therefore no \nobreak needed. 5513 \ifx\lastskipmacro\zeroskipmacro 5514 \else 5515 \vskip-\whatsitskip 5516 \fi 5517 % 5518 #1% 5519 % 5520 \ifx\lastskipmacro\zeroskipmacro 5521 % If \lastskip was zero, perhaps the last item was a penalty, and 5522 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want 5523 % to re-insert the same penalty (values >10000 are used for various 5524 % signals); since we just inserted a non-discardable item, any 5525 % following glue (such as a \parskip) would be a breakpoint. For example: 5526 % @deffn deffn-whatever 5527 % @vindex index-whatever 5528 % Description. 5529 % would allow a break between the index-whatever whatsit 5530 % and the "Description." paragraph. 5531 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi 5532 \else 5533 % On the other hand, if we had a nonzero \lastskip, 5534 % this make-up glue would be preceded by a non-discardable item 5535 % (the whatsit from the \write), so we must insert a \nobreak. 5536 \nobreak\vskip\whatsitskip 5537 \fi 5538\fi} 5539 5540% The index entry written in the file actually looks like 5541% \entry {sortstring}{page}{topic} 5542% or 5543% \entry {sortstring}{page}{topic}{subtopic} 5544% The texindex program reads in these files and writes files 5545% containing these kinds of lines: 5546% \initial {c} 5547% before the first topic whose initial is c 5548% \entry {topic}{pagelist} 5549% for a topic that is used without subtopics 5550% \primary {topic} 5551% \entry {topic}{} 5552% for the beginning of a topic that is used with subtopics 5553% \secondary {subtopic}{pagelist} 5554% for each subtopic. 5555% \secondary {subtopic}{} 5556% for a subtopic with sub-subtopics 5557% \tertiary {subtopic}{subsubtopic}{pagelist} 5558% for each sub-subtopic. 5559 5560% Define the user-accessible indexing commands 5561% @findex, @vindex, @kindex, @cindex. 5562 5563\def\findex {\fnindex} 5564\def\kindex {\kyindex} 5565\def\cindex {\cpindex} 5566\def\vindex {\vrindex} 5567\def\tindex {\tpindex} 5568\def\pindex {\pgindex} 5569 5570% Define the macros used in formatting output of the sorted index material. 5571 5572% @printindex causes a particular index (the ??s file) to get printed. 5573% It does not print any chapter heading (usually an @unnumbered). 5574% 5575\parseargdef\printindex{\begingroup 5576 \dobreak \chapheadingskip{10000}% 5577 % 5578 \smallfonts \rm 5579 \tolerance = 9500 5580 \plainfrenchspacing 5581 \everypar = {}% don't want the \kern\-parindent from indentation suppression. 5582 % 5583 % See comment in \requireopenindexfile. 5584 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi 5585 % 5586 % See if the index file exists and is nonempty. 5587 \openin 1 \jobname.\indexname s 5588 \ifeof 1 5589 % \enddoublecolumns gets confused if there is no text in the index, 5590 % and it loses the chapter title and the aux file entries for the 5591 % index. The easiest way to prevent this problem is to make sure 5592 % there is some text. 5593 \putwordIndexNonexistent 5594 \typeout{No file \jobname.\indexname s.}% 5595 \else 5596 % If the index file exists but is empty, then \openin leaves \ifeof 5597 % false. We have to make TeX try to read something from the file, so 5598 % it can discover if there is anything in it. 5599 \read 1 to \thisline 5600 \ifeof 1 5601 \putwordIndexIsEmpty 5602 \else 5603 \expandafter\printindexzz\thisline\relax\relax\finish% 5604 \fi 5605 \fi 5606 \closein 1 5607\endgroup} 5608 5609% If the index file starts with a backslash, forgo reading the index 5610% file altogether. If somebody upgrades texinfo.tex they may still have 5611% old index files using \ as the escape character. Reading this would 5612% at best lead to typesetting garbage, at worst a TeX syntax error. 5613\def\printindexzz#1#2\finish{% 5614 \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax 5615 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1 5616 \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax 5617\errmessage{% 5618ERROR: A sorted index file in an obsolete format was skipped. 5619To fix this problem, please upgrade your version of 'texi2dvi' 5620or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>. 5621If you are using an old version of 'texindex' (part of the Texinfo 5622distribution), you may also need to upgrade to a newer version (at least 6.0). 5623You may be able to typeset the index if you run 5624'texindex \jobname.\indexname' yourself. 5625You could also try setting the 'txiindexescapeisbackslash' flag by 5626running a command like 5627'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do 5628this, Texinfo will try to use index files in the old format. 5629If you continue to have problems, deleting the index files and starting again 5630might help (with 'rm \jobname.?? \jobname.??s')% 5631}% 5632 \else 5633 (Skipped sorted index file in obsolete format) 5634 \fi 5635 \else 5636 \begindoublecolumns 5637 \input \jobname.\indexname s 5638 \enddoublecolumns 5639 \fi 5640 \else 5641 \begindoublecolumns 5642 \catcode`\\=0\relax 5643 % 5644 % Make @ an escape character to give macros a chance to work. This 5645 % should work because we (hopefully) don't otherwise use @ in index files. 5646 %\catcode`\@=12\relax 5647 \catcode`\@=0\relax 5648 \input \jobname.\indexname s 5649 \enddoublecolumns 5650 \fi 5651} 5652 5653% These macros are used by the sorted index file itself. 5654% Change them to control the appearance of the index. 5655 5656{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 5657\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 5658\catcode`\$=3 5659\gdef\initialglyphs{% 5660 % special control sequences used in the index sort key 5661 \let\indexlbrace\{% 5662 \let\indexrbrace\}% 5663 \let\indexatchar\@% 5664 \def\indexbackslash{\math{\backslash}}% 5665 % 5666 % Some changes for non-alphabetic characters. Using the glyphs from the 5667 % math fonts looks more consistent than the typewriter font used elsewhere 5668 % for these characters. 5669 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}} 5670 % 5671 % In case @\ is used for backslash 5672 \uppercase{\let\\=~} 5673 % Can't get bold backslash so don't use bold forward slash 5674 \catcode`\/=13 5675 \def/{{\secrmnotbold \normalslash}}% 5676 \def-{{\normaldash\normaldash}}% en dash `--' 5677 \def^{{\chapbf \normalcaret}}% 5678 \def~{{\chapbf \normaltilde}}% 5679 \def\_{% 5680 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }% 5681 \def|{$\vert$}% 5682 \def<{$\less$}% 5683 \def>{$\gtr$}% 5684 \def+{$\normalplus$}% 5685}} 5686 5687\def\initial{% 5688 \bgroup 5689 \initialglyphs 5690 \initialx 5691} 5692 5693\def\initialx#1{% 5694 % Remove any glue we may have, we'll be inserting our own. 5695 \removelastskip 5696 % 5697 % We like breaks before the index initials, so insert a bonus. 5698 % The glue before the bonus allows a little bit of space at the 5699 % bottom of a column to reduce an increase in inter-line spacing. 5700 \nobreak 5701 \vskip 0pt plus 5\baselineskip 5702 \penalty -300 5703 \vskip 0pt plus -5\baselineskip 5704 % 5705 % Typeset the initial. Making this add up to a whole number of 5706 % baselineskips increases the chance of the dots lining up from column 5707 % to column. It still won't often be perfect, because of the stretch 5708 % we need before each entry, but it's better. 5709 % 5710 % No shrink because it confuses \balancecolumns. 5711 \vskip 1.67\baselineskip plus 1\baselineskip 5712 \leftline{\secfonts \kern-0.05em \secbf #1}% 5713 % \secfonts is inside the argument of \leftline so that the change of 5714 % \baselineskip will not affect any glue inserted before the vbox that 5715 % \leftline creates. 5716 % Do our best not to break after the initial. 5717 \nobreak 5718 \vskip .33\baselineskip plus .1\baselineskip 5719 \egroup % \initialglyphs 5720} 5721 5722\newdimen\entryrightmargin 5723\entryrightmargin=0pt 5724 5725% \entry typesets a paragraph consisting of the text (#1), dot leaders, and 5726% then page number (#2) flushed to the right margin. It is used for index 5727% and table of contents entries. The paragraph is indented by \leftskip. 5728% 5729\def\entry{% 5730 \begingroup 5731 % 5732 % Start a new paragraph if necessary, so our assignments below can't 5733 % affect previous text. 5734 \par 5735 % 5736 % No extra space above this paragraph. 5737 \parskip = 0in 5738 % 5739 % When reading the text of entry, convert explicit line breaks 5740 % from @* into spaces. The user might give these in long section 5741 % titles, for instance. 5742 \def\*{\unskip\space\ignorespaces}% 5743 \def\entrybreak{\hfil\break}% An undocumented command 5744 % 5745 % Swallow the left brace of the text (first parameter): 5746 \afterassignment\doentry 5747 \let\temp = 5748} 5749\def\entrybreak{\unskip\space\ignorespaces}% 5750\def\doentry{% 5751 % Save the text of the entry 5752 \global\setbox\boxA=\hbox\bgroup 5753 \bgroup % Instead of the swallowed brace. 5754 \noindent 5755 \aftergroup\finishentry 5756 % And now comes the text of the entry. 5757 % Not absorbing as a macro argument reduces the chance of problems 5758 % with catcodes occurring. 5759} 5760{\catcode`\@=11 5761\gdef\finishentry#1{% 5762 \egroup % end box A 5763 \dimen@ = \wd\boxA % Length of text of entry 5764 \global\setbox\boxA=\hbox\bgroup 5765 \unhbox\boxA 5766 % #1 is the page number. 5767 % 5768 % Get the width of the page numbers, and only use 5769 % leaders if they are present. 5770 \global\setbox\boxB = \hbox{#1}% 5771 \ifdim\wd\boxB = 0pt 5772 \null\nobreak\hfill\ % 5773 \else 5774 % 5775 \null\nobreak\indexdotfill % Have leaders before the page number. 5776 % 5777 \ifpdforxetex 5778 \pdfgettoks#1.% 5779 \hskip\skip\thinshrinkable\the\toksA 5780 \else 5781 \hskip\skip\thinshrinkable #1% 5782 \fi 5783 \fi 5784 \egroup % end \boxA 5785 \ifdim\wd\boxB = 0pt 5786 \noindent\unhbox\boxA\par 5787 \nobreak 5788 \else\bgroup 5789 % We want the text of the entries to be aligned to the left, and the 5790 % page numbers to be aligned to the right. 5791 % 5792 \parindent = 0pt 5793 \advance\leftskip by 0pt plus 1fil 5794 \advance\leftskip by 0pt plus -1fill 5795 \rightskip = 0pt plus -1fil 5796 \advance\rightskip by 0pt plus 1fill 5797 % Cause last line, which could consist of page numbers on their own 5798 % if the list of page numbers is long, to be aligned to the right. 5799 \parfillskip=0pt plus -1fill 5800 % 5801 \advance\rightskip by \entryrightmargin 5802 % Determine how far we can stretch into the margin. 5803 % This allows, e.g., "Appendix H GNU Free Documentation License" to 5804 % fit on one line in @letterpaper format. 5805 \ifdim\entryrightmargin>2.1em 5806 \dimen@i=2.1em 5807 \else 5808 \dimen@i=0em 5809 \fi 5810 \advance \parfillskip by 0pt minus 1\dimen@i 5811 % 5812 \dimen@ii = \hsize 5813 \advance\dimen@ii by -1\leftskip 5814 \advance\dimen@ii by -1\entryrightmargin 5815 \advance\dimen@ii by 1\dimen@i 5816 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line 5817 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text 5818 % Try to split the text roughly evenly. \dimen@ will be the length of 5819 % the first line. 5820 \dimen@ = 0.7\dimen@ 5821 \dimen@ii = \hsize 5822 \ifnum\dimen@>\dimen@ii 5823 % If the entry is too long (for example, if it needs more than 5824 % two lines), use all the space in the first line. 5825 \dimen@ = \dimen@ii 5826 \fi 5827 \advance\leftskip by 0pt plus 1fill % ragged right 5828 \advance \dimen@ by 1\rightskip 5829 \parshape = 2 0pt \dimen@ 0em \dimen@ii 5830 % Ideally we'd add a finite glue at the end of the first line only, 5831 % instead of using \parshape with explicit line lengths, but TeX 5832 % doesn't seem to provide a way to do such a thing. 5833 % 5834 % Indent all lines but the first one. 5835 \advance\leftskip by 1em 5836 \advance\parindent by -1em 5837 \fi\fi 5838 \indent % start paragraph 5839 \unhbox\boxA 5840 % 5841 % Do not prefer a separate line ending with a hyphen to fewer lines. 5842 \finalhyphendemerits = 0 5843 % 5844 % Word spacing - no stretch 5845 \spaceskip=\fontdimen2\font minus \fontdimen4\font 5846 % 5847 \linepenalty=1000 % Discourage line breaks. 5848 \hyphenpenalty=5000 % Discourage hyphenation. 5849 % 5850 \par % format the paragraph 5851 \egroup % The \vbox 5852 \fi 5853 \endgroup 5854}} 5855 5856\newskip\thinshrinkable 5857\skip\thinshrinkable=.15em minus .15em 5858 5859% Like plain.tex's \dotfill, except uses up at least 1 em. 5860% The filll stretch here overpowers both the fil and fill stretch to push 5861% the page number to the right. 5862\def\indexdotfill{\cleaders 5863 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll} 5864 5865 5866\def\primary #1{\line{#1\hfil}} 5867 5868\def\secondary{\indententry{0.5cm}} 5869\def\tertiary{\indententry{1cm}} 5870 5871\def\indententry#1#2#3{% 5872 \bgroup 5873 \leftskip=#1 5874 \entry{#2}{#3}% 5875 \egroup 5876} 5877 5878% Define two-column mode, which we use to typeset indexes. 5879% Adapted from the TeXbook, page 416, which is to say, 5880% the manmac.tex format used to print the TeXbook itself. 5881\catcode`\@=11 % private names 5882 5883\newbox\partialpage 5884\newdimen\doublecolumnhsize 5885 5886\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns 5887 % If not much space left on page, start a new page. 5888 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi 5889 % 5890 % Grab any single-column material above us. 5891 \output = {% 5892 \savetopmark 5893 % 5894 \global\setbox\partialpage = \vbox{% 5895 % Unvbox the main output page. 5896 \unvbox\PAGE 5897 \kern-\topskip \kern\baselineskip 5898 }% 5899 }% 5900 \eject % run that output routine to set \partialpage 5901 % 5902 % Use the double-column output routine for subsequent pages. 5903 \output = {\doublecolumnout}% 5904 % 5905 % Change the page size parameters. We could do this once outside this 5906 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 5907 % format, but then we repeat the same computation. Repeating a couple 5908 % of assignments once per index is clearly meaningless for the 5909 % execution time, so we may as well do it in one place. 5910 % 5911 % First we halve the line length, less a little for the gutter between 5912 % the columns. We compute the gutter based on the line length, so it 5913 % changes automatically with the paper format. The magic constant 5914 % below is chosen so that the gutter has the same value (well, +-<1pt) 5915 % as it did when we hard-coded it. 5916 % 5917 % We put the result in a separate register, \doublecolumhsize, so we 5918 % can restore it in \pagesofar, after \hsize itself has (potentially) 5919 % been clobbered. 5920 % 5921 \doublecolumnhsize = \hsize 5922 \advance\doublecolumnhsize by -.04154\hsize 5923 \divide\doublecolumnhsize by 2 5924 \hsize = \doublecolumnhsize 5925 % 5926 % Get the available space for the double columns -- the normal 5927 % (undoubled) page height minus any material left over from the 5928 % previous page. 5929 \advance\vsize by -\ht\partialpage 5930 \vsize = 2\vsize 5931 % 5932 % For the benefit of balancing columns 5933 \advance\baselineskip by 0pt plus 0.5pt 5934} 5935 5936% The double-column output routine for all double-column pages except 5937% the last, which is done by \balancecolumns. 5938% 5939\def\doublecolumnout{% 5940 % 5941 \savetopmark 5942 \splittopskip=\topskip \splitmaxdepth=\maxdepth 5943 \dimen@ = \vsize 5944 \divide\dimen@ by 2 5945 % 5946 % box0 will be the left-hand column, box2 the right. 5947 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@ 5948 \global\advance\vsize by 2\ht\partialpage 5949 \onepageout\pagesofar % empty except for the first time we are called 5950 \unvbox\PAGE 5951 \penalty\outputpenalty 5952} 5953% 5954% Re-output the contents of the output page -- any previous material, 5955% followed by the two boxes we just split, in box0 and box2. 5956\def\pagesofar{% 5957 \unvbox\partialpage 5958 % 5959 \hsize = \doublecolumnhsize 5960 \wd0=\hsize \wd2=\hsize 5961 \hbox to\txipagewidth{\box0\hfil\box2}% 5962} 5963 5964 5965% Finished with double columns. 5966\def\enddoublecolumns{% 5967 % The following penalty ensures that the page builder is exercised 5968 % _before_ we change the output routine. This is necessary in the 5969 % following situation: 5970 % 5971 % The last section of the index consists only of a single entry. 5972 % Before this section, \pagetotal is less than \pagegoal, so no 5973 % break occurs before the last section starts. However, the last 5974 % section, consisting of \initial and the single \entry, does not 5975 % fit on the page and has to be broken off. Without the following 5976 % penalty the page builder will not be exercised until \eject 5977 % below, and by that time we'll already have changed the output 5978 % routine to the \balancecolumns version, so the next-to-last 5979 % double-column page will be processed with \balancecolumns, which 5980 % is wrong: The two columns will go to the main vertical list, with 5981 % the broken-off section in the recent contributions. As soon as 5982 % the output routine finishes, TeX starts reconsidering the page 5983 % break. The two columns and the broken-off section both fit on the 5984 % page, because the two columns now take up only half of the page 5985 % goal. When TeX sees \eject from below which follows the final 5986 % section, it invokes the new output routine that we've set after 5987 % \balancecolumns below; \onepageout will try to fit the two columns 5988 % and the final section into the vbox of \txipageheight (see 5989 % \pagebody), causing an overfull box. 5990 % 5991 % Note that glue won't work here, because glue does not exercise the 5992 % page builder, unlike penalties (see The TeXbook, pp. 280-281). 5993 \penalty0 5994 % 5995 \output = {% 5996 % Split the last of the double-column material. 5997 \savetopmark 5998 \balancecolumns 5999 }% 6000 \eject % call the \output just set 6001 \ifdim\pagetotal=0pt 6002 % Having called \balancecolumns once, we do not 6003 % want to call it again. Therefore, reset \output to its normal 6004 % definition right away. 6005 \global\output=\expandafter{\the\defaultoutput} 6006 % 6007 \endgroup % started in \begindoublecolumns 6008 % Leave the double-column material on the current page, no automatic 6009 % page break. 6010 \box\balancedcolumns 6011 % 6012 % \pagegoal was set to the doubled \vsize above, since we restarted 6013 % the current page. We're now back to normal single-column 6014 % typesetting, so reset \pagegoal to the normal \vsize. 6015 \global\vsize = \txipageheight % 6016 \pagegoal = \txipageheight % 6017 \else 6018 % We had some left-over material. This might happen when \doublecolumnout 6019 % is called in \balancecolumns. Try again. 6020 \expandafter\enddoublecolumns 6021 \fi 6022} 6023\newbox\balancedcolumns 6024\setbox\balancedcolumns=\vbox{shouldnt see this}% 6025% 6026% Only called for the last of the double column material. \doublecolumnout 6027% does the others. 6028\def\balancecolumns{% 6029 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120. 6030 \dimen@ = \ht0 6031 \ifdim\dimen@<7\baselineskip 6032 % Don't split a short final column in two. 6033 \setbox2=\vbox{}% 6034 \global\setbox\balancedcolumns=\vbox{\pagesofar}% 6035 \else 6036 % double the leading vertical space 6037 \advance\dimen@ by \topskip 6038 \advance\dimen@ by-\baselineskip 6039 \divide\dimen@ by 2 % target to split to 6040 \dimen@ii = \dimen@ 6041 \splittopskip = \topskip 6042 % Loop until left column is at least as high as the right column. 6043 {% 6044 \vbadness = 10000 6045 \loop 6046 \global\setbox3 = \copy0 6047 \global\setbox1 = \vsplit3 to \dimen@ 6048 \ifdim\ht1<\ht3 6049 \global\advance\dimen@ by 1pt 6050 \repeat 6051 }% 6052 % Now the left column is in box 1, and the right column in box 3. 6053 % 6054 % Check whether the left column has come out higher than the page itself. 6055 % (Note that we have doubled \vsize for the double columns, so 6056 % the actual height of the page is 0.5\vsize). 6057 \ifdim2\ht1>\vsize 6058 % It appears that we have been called upon to balance too much material. 6059 % Output some of it with \doublecolumnout, leaving the rest on the page. 6060 \setbox\PAGE=\box0 6061 \doublecolumnout 6062 \else 6063 % Compare the heights of the two columns. 6064 \ifdim4\ht1>5\ht3 6065 % Column heights are too different, so don't make their bottoms 6066 % flush with each other. 6067 \setbox2=\vbox to \ht1 {\unvbox3\vfill}% 6068 \setbox0=\vbox to \ht1 {\unvbox1\vfill}% 6069 \else 6070 % Make column bottoms flush with each other. 6071 \setbox2=\vbox to\ht1{\unvbox3\unskip}% 6072 \setbox0=\vbox to\ht1{\unvbox1\unskip}% 6073 \fi 6074 \global\setbox\balancedcolumns=\vbox{\pagesofar}% 6075 \fi 6076 \fi 6077 % 6078} 6079\catcode`\@ = \other 6080 6081 6082\message{sectioning,} 6083% Chapters, sections, etc. 6084 6085% Let's start with @part. 6086\outer\parseargdef\part{\partzzz{#1}} 6087\def\partzzz#1{% 6088 \chapoddpage 6089 \null 6090 \vskip.3\vsize % move it down on the page a bit 6091 \begingroup 6092 \noindent \titlefonts\rm #1\par % the text 6093 \let\lastnode=\empty % no node to associate with 6094 \writetocentry{part}{#1}{}% but put it in the toc 6095 \headingsoff % no headline or footline on the part page 6096 % This outputs a mark at the end of the page that clears \thischapter 6097 % and \thissection, as is done in \startcontents. 6098 \let\pchapsepmacro\relax 6099 \chapmacro{}{Yomitfromtoc}{}% 6100 \chapoddpage 6101 \endgroup 6102} 6103 6104% \unnumberedno is an oxymoron. But we count the unnumbered 6105% sections so that we can refer to them unambiguously in the pdf 6106% outlines by their "section number". We avoid collisions with chapter 6107% numbers by starting them at 10000. (If a document ever has 10000 6108% chapters, we're in trouble anyway, I'm sure.) 6109\newcount\unnumberedno \unnumberedno = 10000 6110\newcount\chapno 6111\newcount\secno \secno=0 6112\newcount\subsecno \subsecno=0 6113\newcount\subsubsecno \subsubsecno=0 6114 6115% This counter is funny since it counts through charcodes of letters A, B, ... 6116\newcount\appendixno \appendixno = `\@ 6117% 6118% \def\appendixletter{\char\the\appendixno} 6119% We do the following ugly conditional instead of the above simple 6120% construct for the sake of pdftex, which needs the actual 6121% letter in the expansion, not just typeset. 6122% 6123\def\appendixletter{% 6124 \ifnum\appendixno=`A A% 6125 \else\ifnum\appendixno=`B B% 6126 \else\ifnum\appendixno=`C C% 6127 \else\ifnum\appendixno=`D D% 6128 \else\ifnum\appendixno=`E E% 6129 \else\ifnum\appendixno=`F F% 6130 \else\ifnum\appendixno=`G G% 6131 \else\ifnum\appendixno=`H H% 6132 \else\ifnum\appendixno=`I I% 6133 \else\ifnum\appendixno=`J J% 6134 \else\ifnum\appendixno=`K K% 6135 \else\ifnum\appendixno=`L L% 6136 \else\ifnum\appendixno=`M M% 6137 \else\ifnum\appendixno=`N N% 6138 \else\ifnum\appendixno=`O O% 6139 \else\ifnum\appendixno=`P P% 6140 \else\ifnum\appendixno=`Q Q% 6141 \else\ifnum\appendixno=`R R% 6142 \else\ifnum\appendixno=`S S% 6143 \else\ifnum\appendixno=`T T% 6144 \else\ifnum\appendixno=`U U% 6145 \else\ifnum\appendixno=`V V% 6146 \else\ifnum\appendixno=`W W% 6147 \else\ifnum\appendixno=`X X% 6148 \else\ifnum\appendixno=`Y Y% 6149 \else\ifnum\appendixno=`Z Z% 6150 % The \the is necessary, despite appearances, because \appendixletter is 6151 % expanded while writing the .toc file. \char\appendixno is not 6152 % expandable, thus it is written literally, thus all appendixes come out 6153 % with the same letter (or @) in the toc without it. 6154 \else\char\the\appendixno 6155 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 6156 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} 6157 6158% Each @chapter defines these (using marks) as the number+name, number 6159% and name of the chapter. Page headings and footings can use 6160% these. @section does likewise. 6161\def\thischapter{} 6162\def\thischapternum{} 6163\def\thischaptername{} 6164\def\thissection{} 6165\def\thissectionnum{} 6166\def\thissectionname{} 6167 6168\newcount\absseclevel % used to calculate proper heading level 6169\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count 6170 6171% @raisesections: treat @section as chapter, @subsection as section, etc. 6172\def\raisesections{\global\advance\secbase by -1} 6173 6174% @lowersections: treat @chapter as section, @section as subsection, etc. 6175\def\lowersections{\global\advance\secbase by 1} 6176 6177% we only have subsub. 6178\chardef\maxseclevel = 3 6179% 6180% A numbered section within an unnumbered changes to unnumbered too. 6181% To achieve this, remember the "biggest" unnum. sec. we are currently in: 6182\chardef\unnlevel = \maxseclevel 6183% 6184% Trace whether the current chapter is an appendix or not: 6185% \chapheadtype is "N" or "A", unnumbered chapters are ignored. 6186\def\chapheadtype{N} 6187 6188% Choose a heading macro 6189% #1 is heading type 6190% #2 is heading level 6191% #3 is text for heading 6192\def\genhead#1#2#3{% 6193 % Compute the abs. sec. level: 6194 \absseclevel=#2 6195 \advance\absseclevel by \secbase 6196 % Make sure \absseclevel doesn't fall outside the range: 6197 \ifnum \absseclevel < 0 6198 \absseclevel = 0 6199 \else 6200 \ifnum \absseclevel > 3 6201 \absseclevel = 3 6202 \fi 6203 \fi 6204 % The heading type: 6205 \def\headtype{#1}% 6206 \if \headtype U% 6207 \ifnum \absseclevel < \unnlevel 6208 \chardef\unnlevel = \absseclevel 6209 \fi 6210 \else 6211 % Check for appendix sections: 6212 \ifnum \absseclevel = 0 6213 \edef\chapheadtype{\headtype}% 6214 \else 6215 \if \headtype A\if \chapheadtype N% 6216 \errmessage{@appendix... within a non-appendix chapter}% 6217 \fi\fi 6218 \fi 6219 % Check for numbered within unnumbered: 6220 \ifnum \absseclevel > \unnlevel 6221 \def\headtype{U}% 6222 \else 6223 \chardef\unnlevel = 3 6224 \fi 6225 \fi 6226 % Now print the heading: 6227 \if \headtype U% 6228 \ifcase\absseclevel 6229 \unnumberedzzz{#3}% 6230 \or \unnumberedseczzz{#3}% 6231 \or \unnumberedsubseczzz{#3}% 6232 \or \unnumberedsubsubseczzz{#3}% 6233 \fi 6234 \else 6235 \if \headtype A% 6236 \ifcase\absseclevel 6237 \appendixzzz{#3}% 6238 \or \appendixsectionzzz{#3}% 6239 \or \appendixsubseczzz{#3}% 6240 \or \appendixsubsubseczzz{#3}% 6241 \fi 6242 \else 6243 \ifcase\absseclevel 6244 \chapterzzz{#3}% 6245 \or \seczzz{#3}% 6246 \or \numberedsubseczzz{#3}% 6247 \or \numberedsubsubseczzz{#3}% 6248 \fi 6249 \fi 6250 \fi 6251 \suppressfirstparagraphindent 6252} 6253 6254% an interface: 6255\def\numhead{\genhead N} 6256\def\apphead{\genhead A} 6257\def\unnmhead{\genhead U} 6258 6259% @chapter, @appendix, @unnumbered. Increment top-level counter, reset 6260% all lower-level sectioning counters to zero. 6261% 6262% Also set \chaplevelprefix, which we prepend to @float sequence numbers 6263% (e.g., figures), q.v. By default (before any chapter), that is empty. 6264\let\chaplevelprefix = \empty 6265% 6266\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz 6267\def\chapterzzz#1{% 6268 % section resetting is \global in case the chapter is in a group, such 6269 % as an @include file. 6270 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6271 \global\advance\chapno by 1 6272 % 6273 % Used for \float. 6274 \gdef\chaplevelprefix{\the\chapno.}% 6275 \resetallfloatnos 6276 % 6277 % \putwordChapter can contain complex things in translations. 6278 \toks0=\expandafter{\putwordChapter}% 6279 \message{\the\toks0 \space \the\chapno}% 6280 % 6281 % Write the actual heading. 6282 \chapmacro{#1}{Ynumbered}{\the\chapno}% 6283 % 6284 % So @section and the like are numbered underneath this chapter. 6285 \global\let\section = \numberedsec 6286 \global\let\subsection = \numberedsubsec 6287 \global\let\subsubsection = \numberedsubsubsec 6288} 6289 6290\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz 6291% 6292\def\appendixzzz#1{% 6293 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6294 \global\advance\appendixno by 1 6295 \gdef\chaplevelprefix{\appendixletter.}% 6296 \resetallfloatnos 6297 % 6298 % \putwordAppendix can contain complex things in translations. 6299 \toks0=\expandafter{\putwordAppendix}% 6300 \message{\the\toks0 \space \appendixletter}% 6301 % 6302 \chapmacro{#1}{Yappendix}{\appendixletter}% 6303 % 6304 \global\let\section = \appendixsec 6305 \global\let\subsection = \appendixsubsec 6306 \global\let\subsubsection = \appendixsubsubsec 6307} 6308 6309% normally unnmhead0 calls unnumberedzzz: 6310\outer\parseargdef\unnumbered{\unnmhead0{#1}} 6311\def\unnumberedzzz#1{% 6312 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6313 \global\advance\unnumberedno by 1 6314 % 6315 % Since an unnumbered has no number, no prefix for figures. 6316 \global\let\chaplevelprefix = \empty 6317 \resetallfloatnos 6318 % 6319 % This used to be simply \message{#1}, but TeX fully expands the 6320 % argument to \message. Therefore, if #1 contained @-commands, TeX 6321 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX 6322 % expanded @cite (which turns out to cause errors because \cite is meant 6323 % to be executed, not expanded). 6324 % 6325 % Anyway, we don't want the fully-expanded definition of @cite to appear 6326 % as a result of the \message, we just want `@cite' itself. We use 6327 % \the<toks register> to achieve this: TeX expands \the<toks> only once, 6328 % simply yielding the contents of <toks register>. (We also do this for 6329 % the toc entries.) 6330 \toks0 = {#1}% 6331 \message{(\the\toks0)}% 6332 % 6333 \chapmacro{#1}{Ynothing}{\the\unnumberedno}% 6334 % 6335 \global\let\section = \unnumberedsec 6336 \global\let\subsection = \unnumberedsubsec 6337 \global\let\subsubsection = \unnumberedsubsubsec 6338} 6339 6340% @centerchap is like @unnumbered, but the heading is centered. 6341\outer\parseargdef\centerchap{% 6342 \let\centerparametersmaybe = \centerparameters 6343 \unnmhead0{#1}% 6344 \let\centerparametersmaybe = \relax 6345} 6346 6347% @top is like @unnumbered. 6348\let\top\unnumbered 6349 6350% Sections. 6351% 6352\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz 6353\def\seczzz#1{% 6354 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6355 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% 6356} 6357 6358% normally calls appendixsectionzzz: 6359\outer\parseargdef\appendixsection{\apphead1{#1}} 6360\def\appendixsectionzzz#1{% 6361 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6362 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% 6363} 6364\let\appendixsec\appendixsection 6365 6366% normally calls unnumberedseczzz: 6367\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} 6368\def\unnumberedseczzz#1{% 6369 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6370 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% 6371} 6372 6373% Subsections. 6374% 6375% normally calls numberedsubseczzz: 6376\outer\parseargdef\numberedsubsec{\numhead2{#1}} 6377\def\numberedsubseczzz#1{% 6378 \global\subsubsecno=0 \global\advance\subsecno by 1 6379 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% 6380} 6381 6382% normally calls appendixsubseczzz: 6383\outer\parseargdef\appendixsubsec{\apphead2{#1}} 6384\def\appendixsubseczzz#1{% 6385 \global\subsubsecno=0 \global\advance\subsecno by 1 6386 \sectionheading{#1}{subsec}{Yappendix}% 6387 {\appendixletter.\the\secno.\the\subsecno}% 6388} 6389 6390% normally calls unnumberedsubseczzz: 6391\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} 6392\def\unnumberedsubseczzz#1{% 6393 \global\subsubsecno=0 \global\advance\subsecno by 1 6394 \sectionheading{#1}{subsec}{Ynothing}% 6395 {\the\unnumberedno.\the\secno.\the\subsecno}% 6396} 6397 6398% Subsubsections. 6399% 6400% normally numberedsubsubseczzz: 6401\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} 6402\def\numberedsubsubseczzz#1{% 6403 \global\advance\subsubsecno by 1 6404 \sectionheading{#1}{subsubsec}{Ynumbered}% 6405 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% 6406} 6407 6408% normally appendixsubsubseczzz: 6409\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} 6410\def\appendixsubsubseczzz#1{% 6411 \global\advance\subsubsecno by 1 6412 \sectionheading{#1}{subsubsec}{Yappendix}% 6413 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% 6414} 6415 6416% normally unnumberedsubsubseczzz: 6417\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} 6418\def\unnumberedsubsubseczzz#1{% 6419 \global\advance\subsubsecno by 1 6420 \sectionheading{#1}{subsubsec}{Ynothing}% 6421 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% 6422} 6423 6424% These macros control what the section commands do, according 6425% to what kind of chapter we are in (ordinary, appendix, or unnumbered). 6426% Define them by default for a numbered chapter. 6427\let\section = \numberedsec 6428\let\subsection = \numberedsubsec 6429\let\subsubsection = \numberedsubsubsec 6430 6431% Define @majorheading, @heading and @subheading 6432 6433\def\majorheading{% 6434 {\advance\chapheadingskip by 10pt \chapbreak }% 6435 \parsearg\chapheadingzzz 6436} 6437 6438\def\chapheading{\chapbreak \parsearg\chapheadingzzz} 6439\def\chapheadingzzz#1{% 6440 \vbox{\chapfonts \raggedtitlesettings #1\par}% 6441 \nobreak\bigskip \nobreak 6442 \suppressfirstparagraphindent 6443} 6444 6445% @heading, @subheading, @subsubheading. 6446\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} 6447 \suppressfirstparagraphindent} 6448\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} 6449 \suppressfirstparagraphindent} 6450\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} 6451 \suppressfirstparagraphindent} 6452 6453% These macros generate a chapter, section, etc. heading only 6454% (including whitespace, linebreaking, etc. around it), 6455% given all the information in convenient, parsed form. 6456 6457% Args are the skip and penalty (usually negative) 6458\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} 6459 6460% Parameter controlling skip before chapter headings (if needed) 6461\newskip\chapheadingskip 6462 6463% Define plain chapter starts, and page on/off switching for it. 6464\def\chapbreak{\dobreak \chapheadingskip {-4000}} 6465 6466% Start a new page 6467\def\chappager{\par\vfill\supereject} 6468 6469% \chapoddpage - start on an odd page for a new chapter 6470% Because \domark is called before \chapoddpage, the filler page will 6471% get the headings for the next chapter, which is wrong. But we don't 6472% care -- we just disable all headings on the filler page. 6473\def\chapoddpage{% 6474 \chappager 6475 \ifodd\pageno \else 6476 \begingroup 6477 \headingsoff 6478 \null 6479 \chappager 6480 \endgroup 6481 \fi 6482} 6483 6484\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname} 6485 6486\def\CHAPPAGoff{% 6487\global\let\contentsalignmacro = \chappager 6488\global\let\pchapsepmacro=\chapbreak 6489\global\def\HEADINGSon{\HEADINGSsinglechapoff}} 6490 6491\def\CHAPPAGon{% 6492\global\let\contentsalignmacro = \chappager 6493\global\let\pchapsepmacro=\chappager 6494\global\def\HEADINGSon{\HEADINGSsingle}} 6495 6496\def\CHAPPAGodd{% 6497\global\let\contentsalignmacro = \chapoddpage 6498\global\let\pchapsepmacro=\chapoddpage 6499\global\def\HEADINGSon{\HEADINGSdouble}} 6500 6501\CHAPPAGon 6502 6503% \chapmacro - Chapter opening. 6504% 6505% #1 is the text, #2 is the section type (Ynumbered, Ynothing, 6506% Yappendix, Yomitfromtoc), #3 the chapter number. 6507% Not used for @heading series. 6508% 6509% To test against our argument. 6510\def\Ynothingkeyword{Ynothing} 6511\def\Yappendixkeyword{Yappendix} 6512\def\Yomitfromtockeyword{Yomitfromtoc} 6513% 6514\def\chapmacro#1#2#3{% 6515 \expandafter\ifx\thisenv\titlepage\else 6516 \checkenv{}% chapters, etc., should not start inside an environment. 6517 \fi 6518 % Insert the first mark before the heading break (see notes for \domark). 6519 \let\prevchapterdefs=\currentchapterdefs 6520 \let\prevsectiondefs=\currentsectiondefs 6521 \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% 6522 \gdef\thissection{}}% 6523 % 6524 \def\temptype{#2}% 6525 \ifx\temptype\Ynothingkeyword 6526 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% 6527 \gdef\thischapter{\thischaptername}}% 6528 \else\ifx\temptype\Yomitfromtockeyword 6529 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% 6530 \gdef\thischapter{}}% 6531 \else\ifx\temptype\Yappendixkeyword 6532 \toks0={#1}% 6533 \xdef\currentchapterdefs{% 6534 \gdef\noexpand\thischaptername{\the\toks0}% 6535 \gdef\noexpand\thischapternum{\appendixletter}% 6536 % \noexpand\putwordAppendix avoids expanding indigestible 6537 % commands in some of the translations. 6538 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} 6539 \noexpand\thischapternum: 6540 \noexpand\thischaptername}% 6541 }% 6542 \else 6543 \toks0={#1}% 6544 \xdef\currentchapterdefs{% 6545 \gdef\noexpand\thischaptername{\the\toks0}% 6546 \gdef\noexpand\thischapternum{\the\chapno}% 6547 % \noexpand\putwordChapter avoids expanding indigestible 6548 % commands in some of the translations. 6549 \gdef\noexpand\thischapter{\noexpand\putwordChapter{} 6550 \noexpand\thischapternum: 6551 \noexpand\thischaptername}% 6552 }% 6553 \fi\fi\fi 6554 % 6555 % Output the mark. Pass it through \safewhatsit, to take care of 6556 % the preceding space. 6557 \safewhatsit\domark 6558 % 6559 % Insert the chapter heading break. 6560 \pchapsepmacro 6561 % 6562 % Now the second mark, after the heading break. No break points 6563 % between here and the heading. 6564 \let\prevchapterdefs=\currentchapterdefs 6565 \let\prevsectiondefs=\currentsectiondefs 6566 \domark 6567 % 6568 {% 6569 \chapfonts \rm 6570 \let\footnote=\errfootnoteheading % give better error message 6571 % 6572 % Have to define \currentsection before calling \donoderef, because the 6573 % xref code eventually uses it. On the other hand, it has to be called 6574 % after \pchapsepmacro, or the headline will change too soon. 6575 \gdef\currentsection{#1}% 6576 % 6577 % Only insert the separating space if we have a chapter/appendix 6578 % number, and don't print the unnumbered ``number''. 6579 \ifx\temptype\Ynothingkeyword 6580 \setbox0 = \hbox{}% 6581 \def\toctype{unnchap}% 6582 \else\ifx\temptype\Yomitfromtockeyword 6583 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry 6584 \def\toctype{omit}% 6585 \else\ifx\temptype\Yappendixkeyword 6586 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% 6587 \def\toctype{app}% 6588 \else 6589 \setbox0 = \hbox{#3\enspace}% 6590 \def\toctype{numchap}% 6591 \fi\fi\fi 6592 % 6593 % Write the toc entry for this chapter. Must come before the 6594 % \donoderef, because we include the current node name in the toc 6595 % entry, and \donoderef resets it to empty. 6596 \writetocentry{\toctype}{#1}{#3}% 6597 % 6598 % For pdftex, we have to write out the node definition (aka, make 6599 % the pdfdest) after any page break, but before the actual text has 6600 % been typeset. If the destination for the pdf outline is after the 6601 % text, then jumping from the outline may wind up with the text not 6602 % being visible, for instance under high magnification. 6603 \donoderef{#2}% 6604 % 6605 % Typeset the actual heading. 6606 \nobreak % Avoid page breaks at the interline glue. 6607 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe 6608 \unhbox0 #1\par}% 6609 }% 6610 \nobreak\bigskip % no page break after a chapter title 6611 \nobreak 6612} 6613 6614% @centerchap -- centered and unnumbered. 6615\let\centerparametersmaybe = \relax 6616\def\centerparameters{% 6617 \advance\rightskip by 3\rightskip 6618 \leftskip = \rightskip 6619 \parfillskip = 0pt 6620} 6621 6622 6623% Section titles. These macros combine the section number parts and 6624% call the generic \sectionheading to do the printing. 6625% 6626\newskip\secheadingskip 6627\def\secheadingbreak{\dobreak \secheadingskip{-1000}} 6628 6629% Subsection titles. 6630\newskip\subsecheadingskip 6631\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} 6632 6633% Subsubsection titles. 6634\def\subsubsecheadingskip{\subsecheadingskip} 6635\def\subsubsecheadingbreak{\subsecheadingbreak} 6636 6637 6638% Print any size, any type, section title. 6639% 6640% #1 is the text of the title, 6641% #2 is the section level (sec/subsec/subsubsec), 6642% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc), 6643% #4 is the section number. 6644% 6645\def\seckeyword{sec} 6646% 6647\def\sectionheading#1#2#3#4{% 6648 {% 6649 \def\sectionlevel{#2}% 6650 \def\temptype{#3}% 6651 % 6652 % It is ok for the @heading series commands to appear inside an 6653 % environment (it's been historically allowed, though the logic is 6654 % dubious), but not the others. 6655 \ifx\temptype\Yomitfromtockeyword\else 6656 \checkenv{}% non-@*heading should not be in an environment. 6657 \fi 6658 \let\footnote=\errfootnoteheading 6659 % 6660 % Switch to the right set of fonts. 6661 \csname #2fonts\endcsname \rm 6662 % 6663 % Insert first mark before the heading break (see notes for \domark). 6664 \let\prevsectiondefs=\currentsectiondefs 6665 \ifx\temptype\Ynothingkeyword 6666 \ifx\sectionlevel\seckeyword 6667 \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% 6668 \gdef\thissection{\thissectionname}}% 6669 \fi 6670 \else\ifx\temptype\Yomitfromtockeyword 6671 % Don't redefine \thissection. 6672 \else\ifx\temptype\Yappendixkeyword 6673 \ifx\sectionlevel\seckeyword 6674 \toks0={#1}% 6675 \xdef\currentsectiondefs{% 6676 \gdef\noexpand\thissectionname{\the\toks0}% 6677 \gdef\noexpand\thissectionnum{#4}% 6678 % \noexpand\putwordSection avoids expanding indigestible 6679 % commands in some of the translations. 6680 \gdef\noexpand\thissection{\noexpand\putwordSection{} 6681 \noexpand\thissectionnum: 6682 \noexpand\thissectionname}% 6683 }% 6684 \fi 6685 \else 6686 \ifx\sectionlevel\seckeyword 6687 \toks0={#1}% 6688 \xdef\currentsectiondefs{% 6689 \gdef\noexpand\thissectionname{\the\toks0}% 6690 \gdef\noexpand\thissectionnum{#4}% 6691 % \noexpand\putwordSection avoids expanding indigestible 6692 % commands in some of the translations. 6693 \gdef\noexpand\thissection{\noexpand\putwordSection{} 6694 \noexpand\thissectionnum: 6695 \noexpand\thissectionname}% 6696 }% 6697 \fi 6698 \fi\fi\fi 6699 % 6700 % Go into vertical mode. Usually we'll already be there, but we 6701 % don't want the following whatsit to end up in a preceding paragraph 6702 % if the document didn't happen to have a blank line. 6703 \par 6704 % 6705 % Output the mark. Pass it through \safewhatsit, to take care of 6706 % the preceding space. 6707 \safewhatsit\domark 6708 % 6709 % Insert space above the heading. 6710 \csname #2headingbreak\endcsname 6711 % 6712 % Now the second mark, after the heading break. No break points 6713 % between here and the heading. 6714 \global\let\prevsectiondefs=\currentsectiondefs 6715 \domark 6716 % 6717 % Only insert the space after the number if we have a section number. 6718 \ifx\temptype\Ynothingkeyword 6719 \setbox0 = \hbox{}% 6720 \def\toctype{unn}% 6721 \gdef\currentsection{#1}% 6722 \else\ifx\temptype\Yomitfromtockeyword 6723 % for @headings -- no section number, don't include in toc, 6724 % and don't redefine \currentsection. 6725 \setbox0 = \hbox{}% 6726 \def\toctype{omit}% 6727 \let\sectionlevel=\empty 6728 \else\ifx\temptype\Yappendixkeyword 6729 \setbox0 = \hbox{#4\enspace}% 6730 \def\toctype{app}% 6731 \gdef\currentsection{#1}% 6732 \else 6733 \setbox0 = \hbox{#4\enspace}% 6734 \def\toctype{num}% 6735 \gdef\currentsection{#1}% 6736 \fi\fi\fi 6737 % 6738 % Write the toc entry (before \donoderef). See comments in \chapmacro. 6739 \writetocentry{\toctype\sectionlevel}{#1}{#4}% 6740 % 6741 % Write the node reference (= pdf destination for pdftex). 6742 % Again, see comments in \chapmacro. 6743 \donoderef{#3}% 6744 % 6745 % Interline glue will be inserted when the vbox is completed. 6746 % That glue will be a valid breakpoint for the page, since it'll be 6747 % preceded by a whatsit (usually from the \donoderef, or from the 6748 % \writetocentry if there was no node). We don't want to allow that 6749 % break, since then the whatsits could end up on page n while the 6750 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. 6751 \nobreak 6752 % 6753 % Output the actual section heading. 6754 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright 6755 \hangindent=\wd0 % zero if no section number 6756 \unhbox0 #1}% 6757 }% 6758 % Add extra space after the heading -- half of whatever came above it. 6759 % Don't allow stretch, though. 6760 \kern .5 \csname #2headingskip\endcsname 6761 % 6762 % Do not let the kern be a potential breakpoint, as it would be if it 6763 % was followed by glue. 6764 \nobreak 6765 % 6766 % We'll almost certainly start a paragraph next, so don't let that 6767 % glue accumulate. (Not a breakpoint because it's preceded by a 6768 % discardable item.) However, when a paragraph is not started next 6769 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out 6770 % or the negative glue will cause weirdly wrong output, typically 6771 % obscuring the section heading with something else. 6772 \vskip-\parskip 6773 % 6774 % This is so the last item on the main vertical list is a known 6775 % \penalty > 10000, so \startdefun, etc., can recognize the situation 6776 % and do the needful. 6777 \penalty 10001 6778} 6779 6780 6781\message{toc,} 6782% Table of contents. 6783\newwrite\tocfile 6784 6785% Write an entry to the toc file, opening it if necessary. 6786% Called from @chapter, etc. 6787% 6788% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} 6789% We append the current node name (if any) and page number as additional 6790% arguments for the \{chap,sec,...}entry macros which will eventually 6791% read this. The node name is used in the pdf outlines as the 6792% destination to jump to. 6793% 6794% We open the .toc file for writing here instead of at @setfilename (or 6795% any other fixed time) so that @contents can be anywhere in the document. 6796% But if #1 is `omit', then we don't do anything. This is used for the 6797% table of contents chapter openings themselves. 6798% 6799\newif\iftocfileopened 6800\def\omitkeyword{omit}% 6801% 6802\def\writetocentry#1#2#3{% 6803 \edef\writetoctype{#1}% 6804 \ifx\writetoctype\omitkeyword \else 6805 \iftocfileopened\else 6806 \immediate\openout\tocfile = \jobname.toc 6807 \global\tocfileopenedtrue 6808 \fi 6809 % 6810 \iflinks 6811 {\atdummies 6812 \edef\temp{% 6813 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% 6814 \temp 6815 }% 6816 \fi 6817 \fi 6818 % 6819 % Tell \shipout to create a pdf destination on each page, if we're 6820 % writing pdf. These are used in the table of contents. We can't 6821 % just write one on every page because the title pages are numbered 6822 % 1 and 2 (the page numbers aren't printed), and so are the first 6823 % two pages of the document. Thus, we'd have two destinations named 6824 % `1', and two named `2'. 6825 \ifpdforxetex 6826 \global\pdfmakepagedesttrue 6827 \fi 6828} 6829 6830 6831% These characters do not print properly in the Computer Modern roman 6832% fonts, so we must take special care. This is more or less redundant 6833% with the Texinfo input format setup at the end of this file. 6834% 6835\def\activecatcodes{% 6836 \catcode`\"=\active 6837 \catcode`\$=\active 6838 \catcode`\<=\active 6839 \catcode`\>=\active 6840 \catcode`\\=\active 6841 \catcode`\^=\active 6842 \catcode`\_=\active 6843 \catcode`\|=\active 6844 \catcode`\~=\active 6845} 6846 6847 6848% Read the toc file, which is essentially Texinfo input. 6849\def\readtocfile{% 6850 \setupdatafile 6851 \activecatcodes 6852 \input \tocreadfilename 6853} 6854 6855\newskip\contentsrightmargin \contentsrightmargin=1in 6856\newcount\savepageno 6857\newcount\lastnegativepageno \lastnegativepageno = -1 6858 6859% Prepare to read what we've written to \tocfile. 6860% 6861\def\startcontents#1{% 6862 % If @setchapternewpage on, and @headings double, the contents should 6863 % start on an odd page, unlike chapters. 6864 \contentsalignmacro 6865 \immediate\closeout\tocfile 6866 % 6867 % Don't need to put `Contents' or `Short Contents' in the headline. 6868 % It is abundantly clear what they are. 6869 \chapmacro{#1}{Yomitfromtoc}{}% 6870 % 6871 \savepageno = \pageno 6872 \begingroup % Set up to handle contents files properly. 6873 \raggedbottom % Worry more about breakpoints than the bottom. 6874 \entryrightmargin=\contentsrightmargin % Don't use the full line length. 6875 % 6876 % Roman numerals for page numbers. 6877 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi 6878 \def\thistitle{}% no title in double-sided headings 6879 % Record where the Roman numerals started. 6880 \ifnum\romancount=0 \global\romancount=\pagecount \fi 6881} 6882 6883% redefined for the two-volume lispref. We always output on 6884% \jobname.toc even if this is redefined. 6885% 6886\def\tocreadfilename{\jobname.toc} 6887 6888% Normal (long) toc. 6889% 6890\def\contents{% 6891 \startcontents{\putwordTOC}% 6892 \openin 1 \tocreadfilename\space 6893 \ifeof 1 \else 6894 \readtocfile 6895 \fi 6896 \vfill \eject 6897 \contentsalignmacro % in case @setchapternewpage odd is in effect 6898 \ifeof 1 \else 6899 \pdfmakeoutlines 6900 \fi 6901 \closein 1 6902 \endgroup 6903 \contentsendroman 6904} 6905 6906% And just the chapters. 6907\def\summarycontents{% 6908 \startcontents{\putwordShortTOC}% 6909 % 6910 \let\partentry = \shortpartentry 6911 \let\numchapentry = \shortchapentry 6912 \let\appentry = \shortchapentry 6913 \let\unnchapentry = \shortunnchapentry 6914 % We want a true roman here for the page numbers. 6915 \secfonts 6916 \let\rm=\shortcontrm \let\bf=\shortcontbf 6917 \let\sl=\shortcontsl \let\tt=\shortconttt 6918 \rm 6919 \hyphenpenalty = 10000 6920 \advance\baselineskip by 1pt % Open it up a little. 6921 \def\numsecentry##1##2##3##4{} 6922 \let\appsecentry = \numsecentry 6923 \let\unnsecentry = \numsecentry 6924 \let\numsubsecentry = \numsecentry 6925 \let\appsubsecentry = \numsecentry 6926 \let\unnsubsecentry = \numsecentry 6927 \let\numsubsubsecentry = \numsecentry 6928 \let\appsubsubsecentry = \numsecentry 6929 \let\unnsubsubsecentry = \numsecentry 6930 \openin 1 \tocreadfilename\space 6931 \ifeof 1 \else 6932 \readtocfile 6933 \fi 6934 \closein 1 6935 \vfill \eject 6936 \contentsalignmacro % in case @setchapternewpage odd is in effect 6937 \endgroup 6938 \contentsendroman 6939} 6940\let\shortcontents = \summarycontents 6941 6942% Get ready to use Arabic numerals again 6943\def\contentsendroman{% 6944 \lastnegativepageno = \pageno 6945 \global\pageno = \savepageno 6946 % 6947 % If \romancount > \arabiccount, the contents are at the end of the 6948 % document. Otherwise, advance where the Arabic numerals start for 6949 % the page numbers. 6950 \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi 6951} 6952 6953% Typeset the label for a chapter or appendix for the short contents. 6954% The arg is, e.g., `A' for an appendix, or `3' for a chapter. 6955% 6956\def\shortchaplabel#1{% 6957 % This space should be enough, since a single number is .5em, and the 6958 % widest letter (M) is 1em, at least in the Computer Modern fonts. 6959 % But use \hss just in case. 6960 % (This space doesn't include the extra space that gets added after 6961 % the label; that gets put in by \shortchapentry above.) 6962 % 6963 % We'd like to right-justify chapter numbers, but that looks strange 6964 % with appendix letters. And right-justifying numbers and 6965 % left-justifying letters looks strange when there is less than 10 6966 % chapters. Have to read the whole toc once to know how many chapters 6967 % there are before deciding ... 6968 \hbox to 1em{#1\hss}% 6969} 6970 6971% These macros generate individual entries in the table of contents. 6972% The first argument is the chapter or section name. 6973% The last argument is the page number. 6974% The arguments in between are the chapter number, section number, ... 6975 6976% Parts, in the main contents. Replace the part number, which doesn't 6977% exist, with an empty box. Let's hope all the numbers have the same width. 6978% Also ignore the page number, which is conventionally not printed. 6979\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} 6980\def\partentry#1#2#3#4{% 6981 % Add stretch and a bonus for breaking the page before the part heading. 6982 % This reduces the chance of the page being broken immediately after the 6983 % part heading, before a following chapter heading. 6984 \vskip 0pt plus 5\baselineskip 6985 \penalty-300 6986 \vskip 0pt plus -5\baselineskip 6987 \dochapentry{\numeralbox\labelspace#1}{}% 6988} 6989% 6990% Parts, in the short toc. 6991\def\shortpartentry#1#2#3#4{% 6992 \penalty-300 6993 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip 6994 \shortchapentry{{\bf #1}}{\numeralbox}{}{}% 6995} 6996 6997% Chapters, in the main contents. 6998\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} 6999 7000% Chapters, in the short toc. 7001% See comments in \dochapentry re vbox and related settings. 7002\def\shortchapentry#1#2#3#4{% 7003 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% 7004} 7005 7006% Appendices, in the main contents. 7007% Need the word Appendix, and a fixed-size box. 7008% 7009\def\appendixbox#1{% 7010 % We use M since it's probably the widest letter. 7011 \setbox0 = \hbox{\putwordAppendix{} M}% 7012 \hbox to \wd0{\putwordAppendix{} #1\hss}} 7013% 7014\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}} 7015 7016% Unnumbered chapters. 7017\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} 7018\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} 7019 7020% Sections. 7021\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} 7022\let\appsecentry=\numsecentry 7023\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} 7024 7025% Subsections. 7026\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} 7027\let\appsubsecentry=\numsubsecentry 7028\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} 7029 7030% And subsubsections. 7031\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} 7032\let\appsubsubsecentry=\numsubsubsecentry 7033\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} 7034 7035% This parameter controls the indentation of the various levels. 7036% Same as \defaultparindent. 7037\newdimen\tocindent \tocindent = 15pt 7038 7039% Now for the actual typesetting. In all these, #1 is the text and #2 is the 7040% page number. 7041% 7042% If the toc has to be broken over pages, we want it to be at chapters 7043% if at all possible; hence the \penalty. 7044\def\dochapentry#1#2{% 7045 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip 7046 \begingroup 7047 % Move the page numbers slightly to the right 7048 \advance\entryrightmargin by -0.05em 7049 \chapentryfonts 7050 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 7051 \endgroup 7052 \nobreak\vskip .25\baselineskip plus.1\baselineskip 7053} 7054 7055\def\dosecentry#1#2{\begingroup 7056 \secentryfonts \leftskip=\tocindent 7057 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 7058\endgroup} 7059 7060\def\dosubsecentry#1#2{\begingroup 7061 \subsecentryfonts \leftskip=2\tocindent 7062 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 7063\endgroup} 7064 7065\def\dosubsubsecentry#1#2{\begingroup 7066 \subsubsecentryfonts \leftskip=3\tocindent 7067 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 7068\endgroup} 7069 7070% We use the same \entry macro as for the index entries. 7071\let\tocentry = \entry 7072 7073% Space between chapter (or whatever) number and the title. 7074\def\labelspace{\hskip1em \relax} 7075 7076\def\dopageno#1{{\rm #1}} 7077\def\doshortpageno#1{{\rm #1}} 7078 7079\def\chapentryfonts{\secfonts \rm} 7080\def\secentryfonts{\textfonts} 7081\def\subsecentryfonts{\textfonts} 7082\def\subsubsecentryfonts{\textfonts} 7083 7084 7085\message{environments,} 7086% @foo ... @end foo. 7087 7088% @tex ... @end tex escapes into raw TeX temporarily. 7089% One exception: @ is still an escape character, so that @end tex works. 7090% But \@ or @@ will get a plain @ character. 7091 7092\envdef\tex{% 7093 \setregularquotes 7094 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 7095 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 7096 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie 7097 \catcode `\%=14 7098 \catcode `\+=\other 7099 \catcode `\"=\other 7100 \catcode `\|=\other 7101 \catcode `\<=\other 7102 \catcode `\>=\other 7103 \catcode `\`=\other 7104 \catcode `\'=\other 7105 % 7106 % ' is active in math mode (mathcode"8000). So reset it, and all our 7107 % other math active characters (just in case), to plain's definitions. 7108 \mathactive 7109 % 7110 % Inverse of the list at the beginning of the file. 7111 \let\b=\ptexb 7112 \let\bullet=\ptexbullet 7113 \let\c=\ptexc 7114 \let\,=\ptexcomma 7115 \let\.=\ptexdot 7116 \let\dots=\ptexdots 7117 \let\equiv=\ptexequiv 7118 \let\!=\ptexexclam 7119 \let\i=\ptexi 7120 \let\indent=\ptexindent 7121 \let\noindent=\ptexnoindent 7122 \let\{=\ptexlbrace 7123 \let\+=\tabalign 7124 \let\}=\ptexrbrace 7125 \let\/=\ptexslash 7126 \let\sp=\ptexsp 7127 \let\*=\ptexstar 7128 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode 7129 \let\t=\ptext 7130 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer 7131 \let\frenchspacing=\plainfrenchspacing 7132 % 7133 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% 7134 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% 7135 \def\@{@}% 7136} 7137% There is no need to define \Etex. 7138 7139% Define @lisp ... @end lisp. 7140% @lisp environment forms a group so it can rebind things, 7141% including the definition of @end lisp (which normally is erroneous). 7142 7143% Amount to narrow the margins by for @lisp. 7144\newskip\lispnarrowing \lispnarrowing=0.4in 7145 7146% This is the definition that ^^M gets inside @lisp, @example, and other 7147% such environments. \null is better than a space, since it doesn't 7148% have any width. 7149\def\lisppar{\null\endgraf} 7150 7151% This space is always present above and below environments. 7152\newskip\envskipamount \envskipamount = 0pt 7153 7154% Make spacing and below environment symmetrical. We use \parskip here 7155% to help in doing that, since in @example-like environments \parskip 7156% is reset to zero; thus the \afterenvbreak inserts no space -- but the 7157% start of the next paragraph will insert \parskip. 7158% 7159\def\aboveenvbreak{{% 7160 % =10000 instead of <10000 because of a special case in \itemzzz and 7161 % \sectionheading, q.v. 7162 \ifnum \lastpenalty=10000 \else 7163 \advance\envskipamount by \parskip 7164 \endgraf 7165 \ifdim\lastskip<\envskipamount 7166 \removelastskip 7167 \ifnum\lastpenalty<10000 7168 % Penalize breaking before the environment, because preceding text 7169 % often leads into it. 7170 \penalty100 7171 \fi 7172 \vskip\envskipamount 7173 \fi 7174 \fi 7175}} 7176 7177\def\afterenvbreak{{% 7178 % =10000 instead of <10000 because of a special case in \itemzzz and 7179 % \sectionheading, q.v. 7180 \ifnum \lastpenalty=10000 \else 7181 \advance\envskipamount by \parskip 7182 \endgraf 7183 \ifdim\lastskip<\envskipamount 7184 \removelastskip 7185 % it's not a good place to break if the last penalty was \nobreak 7186 % or better ... 7187 \ifnum\lastpenalty<10000 \penalty-50 \fi 7188 \vskip\envskipamount 7189 \fi 7190 \fi 7191}} 7192 7193% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will 7194% also clear it, so that its embedded environments do the narrowing again. 7195\let\nonarrowing=\relax 7196 7197% @cartouche ... @end cartouche: draw rectangle w/rounded corners around 7198% environment contents. 7199 7200% 7201\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth 7202\def\ctr{{\hskip 6pt\circle\char'010}} 7203\def\cbl{{\circle\char'012\hskip -6pt}} 7204\def\cbr{{\hskip 6pt\circle\char'011}} 7205\def\carttop{\hbox to \cartouter{\hskip\lskip 7206 \ctl\leaders\hrule height\circthick\hfil\ctr 7207 \hskip\rskip}} 7208\def\cartbot{\hbox to \cartouter{\hskip\lskip 7209 \cbl\leaders\hrule height\circthick\hfil\cbr 7210 \hskip\rskip}} 7211% 7212\newskip\lskip\newskip\rskip 7213 7214% only require the font if @cartouche is actually used 7215\def\cartouchefontdefs{% 7216 \font\circle=lcircle10\relax 7217 \circthick=\fontdimen8\circle 7218} 7219\newdimen\circthick 7220\newdimen\cartouter\newdimen\cartinner 7221\newskip\normbskip\newskip\normpskip\newskip\normlskip 7222 7223 7224\envdef\cartouche{% 7225 \cartouchefontdefs 7226 \ifhmode\par\fi % can't be in the midst of a paragraph. 7227 \startsavinginserts 7228 \lskip=\leftskip \rskip=\rightskip 7229 \leftskip=0pt\rightskip=0pt % we want these *outside*. 7230 \cartinner=\hsize \advance\cartinner by-\lskip 7231 \advance\cartinner by-\rskip 7232 \cartouter=\hsize 7233 \advance\cartouter by 18.4pt % allow for 3pt kerns on either 7234 % side, and for 6pt waste from 7235 % each corner char, and rule thickness 7236 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip 7237 % 7238 % If this cartouche directly follows a sectioning command, we need the 7239 % \parskip glue (backspaced over by default) or the cartouche can 7240 % collide with the section heading. 7241 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi 7242 % 7243 \setbox\groupbox=\vbox\bgroup 7244 \baselineskip=0pt\parskip=0pt\lineskip=0pt 7245 \carttop 7246 \hbox\bgroup 7247 \hskip\lskip 7248 \vrule\kern3pt 7249 \vbox\bgroup 7250 \kern3pt 7251 \hsize=\cartinner 7252 \baselineskip=\normbskip 7253 \lineskip=\normlskip 7254 \parskip=\normpskip 7255 \vskip -\parskip 7256 \comment % For explanation, see the end of def\group. 7257} 7258\def\Ecartouche{% 7259 \ifhmode\par\fi 7260 \kern3pt 7261 \egroup 7262 \kern3pt\vrule 7263 \hskip\rskip 7264 \egroup 7265 \cartbot 7266 \egroup 7267 \addgroupbox 7268 \checkinserts 7269} 7270 7271 7272% This macro is called at the beginning of all the @example variants, 7273% inside a group. 7274\newdimen\nonfillparindent 7275\def\nonfillstart{% 7276 \aboveenvbreak 7277 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy 7278 \sepspaces % Make spaces be word-separators rather than space tokens. 7279 \let\par = \lisppar % don't ignore blank lines 7280 \obeylines % each line of input is a line of output 7281 \parskip = 0pt 7282 % Turn off paragraph indentation but redefine \indent to emulate 7283 % the normal \indent. 7284 \nonfillparindent=\parindent 7285 \parindent = 0pt 7286 \let\indent\nonfillindent 7287 % 7288 \emergencystretch = 0pt % don't try to avoid overfull boxes 7289 \ifx\nonarrowing\relax 7290 \advance \leftskip by \lispnarrowing 7291 \exdentamount=\lispnarrowing 7292 \else 7293 \let\nonarrowing = \relax 7294 \fi 7295 \let\exdent=\nofillexdent 7296} 7297 7298\begingroup 7299\obeyspaces 7300% We want to swallow spaces (but not other tokens) after the fake 7301% @indent in our nonfill-environments, where spaces are normally 7302% active and set to @tie, resulting in them not being ignored after 7303% @indent. 7304\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% 7305\gdef\nonfillindentcheck{% 7306\ifx\temp % 7307\expandafter\nonfillindentgobble% 7308\else% 7309\leavevmode\nonfillindentbox% 7310\fi% 7311}% 7312\endgroup 7313\def\nonfillindentgobble#1{\nonfillindent} 7314\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} 7315 7316% If you want all examples etc. small: @set dispenvsize small. 7317% If you want even small examples the full size: @set dispenvsize nosmall. 7318% This affects the following displayed environments: 7319% @example, @display, @format, @lisp, @verbatim 7320% 7321\def\smallword{small} 7322\def\nosmallword{nosmall} 7323\let\SETdispenvsize\relax 7324\def\setnormaldispenv{% 7325 \ifx\SETdispenvsize\smallword 7326 % end paragraph for sake of leading, in case document has no blank 7327 % line. This is redundant with what happens in \aboveenvbreak, but 7328 % we need to do it before changing the fonts, and it's inconvenient 7329 % to change the fonts afterward. 7330 \ifnum \lastpenalty=10000 \else \endgraf \fi 7331 \smallexamplefonts \rm 7332 \fi 7333} 7334\def\setsmalldispenv{% 7335 \ifx\SETdispenvsize\nosmallword 7336 \else 7337 \ifnum \lastpenalty=10000 \else \endgraf \fi 7338 \smallexamplefonts \rm 7339 \fi 7340} 7341 7342% We often define two environments, @foo and @smallfoo. 7343% Let's do it in one command. #1 is the env name, #2 the definition. 7344\def\makedispenvdef#1#2{% 7345 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% 7346 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% 7347 \expandafter\let\csname E#1\endcsname \afterenvbreak 7348 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak 7349} 7350 7351% Define two environment synonyms (#1 and #2) for an environment. 7352\def\maketwodispenvdef#1#2#3{% 7353 \makedispenvdef{#1}{#3}% 7354 \makedispenvdef{#2}{#3}% 7355} 7356% 7357% @lisp: indented, narrowed, typewriter font; 7358% @example: same as @lisp. 7359% 7360% @smallexample and @smalllisp: use smaller fonts. 7361% Originally contributed by Pavel@xerox. 7362% 7363\maketwodispenvdef{lisp}{example}{% 7364 \nonfillstart 7365 \tt\setcodequotes 7366 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. 7367 \parsearg\gobble 7368} 7369% @display/@smalldisplay: same as @lisp except keep current font. 7370% 7371\makedispenvdef{display}{% 7372 \nonfillstart 7373 \gobble 7374} 7375 7376% @format/@smallformat: same as @display except don't narrow margins. 7377% 7378\makedispenvdef{format}{% 7379 \let\nonarrowing = t% 7380 \nonfillstart 7381 \gobble 7382} 7383 7384% @flushleft: same as @format, but doesn't obey \SETdispenvsize. 7385\envdef\flushleft{% 7386 \let\nonarrowing = t% 7387 \nonfillstart 7388 \gobble 7389} 7390\let\Eflushleft = \afterenvbreak 7391 7392% @flushright. 7393% 7394\envdef\flushright{% 7395 \let\nonarrowing = t% 7396 \nonfillstart 7397 \advance\leftskip by 0pt plus 1fill\relax 7398 \gobble 7399} 7400\let\Eflushright = \afterenvbreak 7401 7402 7403% @raggedright does more-or-less normal line breaking but no right 7404% justification. From plain.tex. 7405\envdef\raggedright{% 7406 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax 7407} 7408\let\Eraggedright\par 7409 7410\envdef\raggedleft{% 7411 \parindent=0pt \leftskip0pt plus2em 7412 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt 7413 \hbadness=10000 % Last line will usually be underfull, so turn off 7414 % badness reporting. 7415} 7416\let\Eraggedleft\par 7417 7418\envdef\raggedcenter{% 7419 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em 7420 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt 7421 \hbadness=10000 % Last line will usually be underfull, so turn off 7422 % badness reporting. 7423} 7424\let\Eraggedcenter\par 7425 7426 7427% @quotation does normal linebreaking (hence we can't use \nonfillstart) 7428% and narrows the margins. We keep \parskip nonzero in general, since 7429% we're doing normal filling. So, when using \aboveenvbreak and 7430% \afterenvbreak, temporarily make \parskip 0. 7431% 7432\makedispenvdef{quotation}{\quotationstart} 7433% 7434\def\quotationstart{% 7435 \indentedblockstart % same as \indentedblock, but increase right margin too. 7436 \ifx\nonarrowing\relax 7437 \advance\rightskip by \lispnarrowing 7438 \fi 7439 \parsearg\quotationlabel 7440} 7441 7442% We have retained a nonzero parskip for the environment, since we're 7443% doing normal filling. 7444% 7445\def\Equotation{% 7446 \par 7447 \ifx\quotationauthor\thisisundefined\else 7448 % indent a bit. 7449 \leftline{\kern 2\leftskip \sl ---\quotationauthor}% 7450 \fi 7451 {\parskip=0pt \afterenvbreak}% 7452} 7453\def\Esmallquotation{\Equotation} 7454 7455% If we're given an argument, typeset it in bold with a colon after. 7456\def\quotationlabel#1{% 7457 \def\temp{#1}% 7458 \ifx\temp\empty \else 7459 {\bf #1: }% 7460 \fi 7461} 7462 7463% @indentedblock is like @quotation, but indents only on the left and 7464% has no optional argument. 7465% 7466\makedispenvdef{indentedblock}{\indentedblockstart} 7467% 7468\def\indentedblockstart{% 7469 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip 7470 \parindent=0pt 7471 % 7472 % @cartouche defines \nonarrowing to inhibit narrowing at next level down. 7473 \ifx\nonarrowing\relax 7474 \advance\leftskip by \lispnarrowing 7475 \exdentamount = \lispnarrowing 7476 \else 7477 \let\nonarrowing = \relax 7478 \fi 7479} 7480 7481% Keep a nonzero parskip for the environment, since we're doing normal filling. 7482% 7483\def\Eindentedblock{% 7484 \par 7485 {\parskip=0pt \afterenvbreak}% 7486} 7487\def\Esmallindentedblock{\Eindentedblock} 7488 7489 7490% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} 7491% If we want to allow any <char> as delimiter, 7492% we need the curly braces so that makeinfo sees the @verb command, eg: 7493% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org 7494% 7495% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. 7496% 7497% [Knuth] p.344; only we need to do the other characters Texinfo sets 7498% active too. Otherwise, they get lost as the first character on a 7499% verbatim line. 7500\def\dospecials{% 7501 \do\ \do\\\do\{\do\}\do\$\do\&% 7502 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% 7503 \do\<\do\>\do\|\do\@\do+\do\"% 7504 % Don't do the quotes -- if we do, @set txicodequoteundirected and 7505 % @set txicodequotebacktick will not have effect on @verb and 7506 % @verbatim, and ?` and !` ligatures won't get disabled. 7507 %\do\`\do\'% 7508} 7509% 7510% [Knuth] p. 380 7511\def\uncatcodespecials{% 7512 \def\do##1{\catcode`##1=\other}\dospecials} 7513% 7514% Setup for the @verb command. 7515% 7516% Eight spaces for a tab 7517\begingroup 7518 \catcode`\^^I=\active 7519 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} 7520\endgroup 7521% 7522\def\setupverb{% 7523 \tt % easiest (and conventionally used) font for verbatim 7524 \def\par{\leavevmode\endgraf}% 7525 \setcodequotes 7526 \tabeightspaces 7527 % Respect line breaks, 7528 % print special symbols as themselves, and 7529 % make each space count 7530 % must do in this order: 7531 \obeylines \uncatcodespecials \sepspaces 7532} 7533 7534% Setup for the @verbatim environment 7535% 7536% Real tab expansion. 7537\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount 7538% 7539% We typeset each line of the verbatim in an \hbox, so we can handle 7540% tabs. 7541\newbox\verbbox 7542\def\starttabbox{\setbox\verbbox=\hbox\bgroup} 7543% 7544\begingroup 7545 \catcode`\^^I=\active 7546 \gdef\tabexpand{% 7547 \catcode`\^^I=\active 7548 \def^^I{\leavevmode\egroup 7549 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab 7550 \divide\dimen\verbbox by\tabw 7551 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw 7552 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw 7553 \wd\verbbox=\dimen\verbbox 7554 \leavevmode\box\verbbox \starttabbox 7555 }% 7556 } 7557\endgroup 7558 7559% start the verbatim environment. 7560\def\setupverbatim{% 7561 \let\nonarrowing = t% 7562 \nonfillstart 7563 \tt % easiest (and conventionally used) font for verbatim 7564 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}% 7565 \tabexpand 7566 \setcodequotes 7567 % Respect line breaks, 7568 % print special symbols as themselves, and 7569 % make each space count. 7570 % Must do in this order: 7571 \obeylines \uncatcodespecials \sepspaces 7572} 7573 7574% Do the @verb magic: verbatim text is quoted by unique 7575% delimiter characters. Before first delimiter expect a 7576% right brace, after last delimiter expect closing brace: 7577% 7578% \def\doverb'{'<char>#1<char>'}'{#1} 7579% 7580% [Knuth] p. 382; only eat outer {} 7581\begingroup 7582 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other 7583 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] 7584\endgroup 7585% 7586\def\verb{\begingroup\setupverb\doverb} 7587% 7588% 7589% Do the @verbatim magic: define the macro \doverbatim so that 7590% the (first) argument ends when '@end verbatim' is reached, ie: 7591% 7592% \def\doverbatim#1@end verbatim{#1} 7593% 7594% For Texinfo it's a lot easier than for LaTeX, 7595% because texinfo's \verbatim doesn't stop at '\end{verbatim}': 7596% we need not redefine '\', '{' and '}'. 7597% 7598% Inspired by LaTeX's verbatim command set [latex.ltx] 7599% 7600\begingroup 7601 \catcode`\ =\active 7602 \obeylines % 7603 % ignore everything up to the first ^^M, that's the newline at the end 7604 % of the @verbatim input line itself. Otherwise we get an extra blank 7605 % line in the output. 7606 \xdef\doverbatim#1^^M#2@end verbatim{% 7607 \starttabbox#2\egroup\noexpand\end\gobble verbatim}% 7608 % We really want {...\end verbatim} in the body of the macro, but 7609 % without the active space; thus we have to use \xdef and \gobble. 7610 % The \egroup ends the \verbbox started at the end of the last line in 7611 % the block. 7612\endgroup 7613% 7614\envdef\verbatim{% 7615 \setnormaldispenv\setupverbatim\doverbatim 7616} 7617\let\Everbatim = \afterenvbreak 7618 7619 7620% @verbatiminclude FILE - insert text of file in verbatim environment. 7621% 7622\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} 7623% 7624\def\doverbatiminclude#1{% 7625 {% 7626 \makevalueexpandable 7627 \setupverbatim 7628 {% 7629 \indexnofonts % Allow `@@' and other weird things in file names. 7630 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% 7631 \edef\tmp{\noexpand\input #1 } 7632 \expandafter 7633 }\expandafter\starttabbox\tmp\egroup 7634 \afterenvbreak 7635 }% 7636} 7637 7638% @copying ... @end copying. 7639% Save the text away for @insertcopying later. 7640% 7641% We save the uninterpreted tokens, rather than creating a box. 7642% Saving the text in a box would be much easier, but then all the 7643% typesetting commands (@smallbook, font changes, etc.) have to be done 7644% beforehand -- and a) we want @copying to be done first in the source 7645% file; b) letting users define the frontmatter in as flexible order as 7646% possible is desirable. 7647% 7648\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} 7649\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} 7650% 7651\def\insertcopying{% 7652 \begingroup 7653 \parindent = 0pt % paragraph indentation looks wrong on title page 7654 \scanexp\copyingtext 7655 \endgroup 7656} 7657 7658 7659\message{defuns,} 7660% @defun etc. 7661 7662\newskip\defbodyindent \defbodyindent=.4in 7663\newskip\defargsindent \defargsindent=50pt 7664\newskip\deflastargmargin \deflastargmargin=18pt 7665\newcount\defunpenalty 7666 7667% Start the processing of @deffn: 7668\def\startdefun{% 7669 \ifnum\lastpenalty<10000 7670 \medbreak 7671 \defunpenalty=10003 % Will keep this @deffn together with the 7672 % following @def command, see below. 7673 \else 7674 % If there are two @def commands in a row, we'll have a \nobreak, 7675 % which is there to keep the function description together with its 7676 % header. But if there's nothing but headers, we need to allow a 7677 % break somewhere. Check specifically for penalty 10002, inserted 7678 % by \printdefunline, instead of 10000, since the sectioning 7679 % commands also insert a nobreak penalty, and we don't want to allow 7680 % a break between a section heading and a defun. 7681 % 7682 % As a further refinement, we avoid "club" headers by signalling 7683 % with penalty of 10003 after the very first @deffn in the 7684 % sequence (see above), and penalty of 10002 after any following 7685 % @def command. 7686 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi 7687 % 7688 % Similarly, after a section heading, do not allow a break. 7689 % But do insert the glue. 7690 \medskip % preceded by discardable penalty, so not a breakpoint 7691 \fi 7692 % 7693 \parindent=0in 7694 \advance\leftskip by \defbodyindent 7695 \exdentamount=\defbodyindent 7696} 7697 7698\def\dodefunx#1{% 7699 % First, check whether we are in the right environment: 7700 \checkenv#1% 7701 % 7702 % As above, allow line break if we have multiple x headers in a row. 7703 % It's not a great place, though. 7704 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi 7705 % 7706 % And now, it's time to reuse the body of the original defun: 7707 \expandafter\gobbledefun#1% 7708} 7709\def\gobbledefun#1\startdefun{} 7710 7711% \printdefunline \deffnheader{text} 7712% 7713\def\printdefunline#1#2{% 7714 \begingroup 7715 % call \deffnheader: 7716 #1#2 \endheader 7717 % common ending: 7718 \interlinepenalty = 10000 7719 \advance\rightskip by 0pt plus 1fil\relax 7720 \endgraf 7721 \nobreak\vskip -\parskip 7722 \penalty\defunpenalty % signal to \startdefun and \dodefunx 7723 % Some of the @defun-type tags do not enable magic parentheses, 7724 % rendering the following check redundant. But we don't optimize. 7725 \checkparencounts 7726 \endgroup 7727} 7728 7729\def\Edefun{\endgraf\medbreak} 7730 7731% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; 7732% the only thing remaining is to define \deffnheader. 7733% 7734\def\makedefun#1{% 7735 \expandafter\let\csname E#1\endcsname = \Edefun 7736 \edef\temp{\noexpand\domakedefun 7737 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% 7738 \temp 7739} 7740 7741% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) } 7742% 7743% Define \deffn and \deffnx, without parameters. 7744% \deffnheader has to be defined explicitly. 7745% 7746\def\domakedefun#1#2#3{% 7747 \envdef#1{% 7748 \startdefun 7749 \doingtypefnfalse % distinguish typed functions from all else 7750 \parseargusing\activeparens{\printdefunline#3}% 7751 }% 7752 \def#2{\dodefunx#1}% 7753 \def#3% 7754} 7755 7756\newif\ifdoingtypefn % doing typed function? 7757\newif\ifrettypeownline % typeset return type on its own line? 7758 7759% @deftypefnnewline on|off says whether the return type of typed functions 7760% are printed on their own line. This affects @deftypefn, @deftypefun, 7761% @deftypeop, and @deftypemethod. 7762% 7763\parseargdef\deftypefnnewline{% 7764 \def\temp{#1}% 7765 \ifx\temp\onword 7766 \expandafter\let\csname SETtxideftypefnnl\endcsname 7767 = \empty 7768 \else\ifx\temp\offword 7769 \expandafter\let\csname SETtxideftypefnnl\endcsname 7770 = \relax 7771 \else 7772 \errhelp = \EMsimple 7773 \errmessage{Unknown @txideftypefnnl value `\temp', 7774 must be on|off}% 7775 \fi\fi 7776} 7777 7778% \dosubind {index}{topic}{subtopic} 7779% 7780% If SUBTOPIC is present, precede it with a space, and call \doind. 7781% (At some time during the 20th century, this made a two-level entry in an 7782% index such as the operation index. Nobody seemed to notice the change in 7783% behaviour though.) 7784\def\dosubind#1#2#3{% 7785 \def\thirdarg{#3}% 7786 \ifx\thirdarg\empty 7787 \doind{#1}{#2}% 7788 \else 7789 \doind{#1}{#2\space#3}% 7790 \fi 7791} 7792 7793% Untyped functions: 7794 7795% @deffn category name args 7796\makedefun{deffn}{\deffngeneral{}} 7797 7798% @deffn category class name args 7799\makedefun{defop}#1 {\defopon{#1\ \putwordon}} 7800 7801% \defopon {category on}class name args 7802\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } 7803 7804% \deffngeneral {subind}category name args 7805% 7806\def\deffngeneral#1#2 #3 #4\endheader{% 7807 \dosubind{fn}{\code{#3}}{#1}% 7808 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% 7809} 7810 7811% Typed functions: 7812 7813% @deftypefn category type name args 7814\makedefun{deftypefn}{\deftypefngeneral{}} 7815 7816% @deftypeop category class type name args 7817\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} 7818 7819% \deftypeopon {category on}class type name args 7820\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } 7821 7822% \deftypefngeneral {subind}category type name args 7823% 7824\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% 7825 \dosubind{fn}{\code{#4}}{#1}% 7826 \doingtypefntrue 7827 \defname{#2}{#3}{#4}\defunargs{#5\unskip}% 7828} 7829 7830% Typed variables: 7831 7832% @deftypevr category type var args 7833\makedefun{deftypevr}{\deftypecvgeneral{}} 7834 7835% @deftypecv category class type var args 7836\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} 7837 7838% \deftypecvof {category of}class type var args 7839\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } 7840 7841% \deftypecvgeneral {subind}category type var args 7842% 7843\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% 7844 \dosubind{vr}{\code{#4}}{#1}% 7845 \defname{#2}{#3}{#4}\defunargs{#5\unskip}% 7846} 7847 7848% Untyped variables: 7849 7850% @defvr category var args 7851\makedefun{defvr}#1 {\deftypevrheader{#1} {} } 7852 7853% @defcv category class var args 7854\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} 7855 7856% \defcvof {category of}class var args 7857\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } 7858 7859% Types: 7860 7861% @deftp category name args 7862\makedefun{deftp}#1 #2 #3\endheader{% 7863 \doind{tp}{\code{#2}}% 7864 \defname{#1}{}{#2}\defunargs{#3\unskip}% 7865} 7866 7867% Remaining @defun-like shortcuts: 7868\makedefun{defun}{\deffnheader{\putwordDeffunc} } 7869\makedefun{defmac}{\deffnheader{\putwordDefmac} } 7870\makedefun{defspec}{\deffnheader{\putwordDefspec} } 7871\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } 7872\makedefun{defvar}{\defvrheader{\putwordDefvar} } 7873\makedefun{defopt}{\defvrheader{\putwordDefopt} } 7874\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } 7875\makedefun{defmethod}{\defopon\putwordMethodon} 7876\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} 7877\makedefun{defivar}{\defcvof\putwordInstanceVariableof} 7878\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} 7879 7880% \defname, which formats the name of the @def (not the args). 7881% #1 is the category, such as "Function". 7882% #2 is the return type, if any. 7883% #3 is the function name. 7884% 7885% We are followed by (but not passed) the arguments, if any. 7886% 7887\def\defname#1#2#3{% 7888 \par 7889 % Get the values of \leftskip and \rightskip as they were outside the @def... 7890 \advance\leftskip by -\defbodyindent 7891 % 7892 % Determine if we are typesetting the return type of a typed function 7893 % on a line by itself. 7894 \rettypeownlinefalse 7895 \ifdoingtypefn % doing a typed function specifically? 7896 % then check user option for putting return type on its own line: 7897 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else 7898 \rettypeownlinetrue 7899 \fi 7900 \fi 7901 % 7902 % How we'll format the category name. Putting it in brackets helps 7903 % distinguish it from the body text that may end up on the next line 7904 % just below it. 7905 \def\temp{#1}% 7906 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} 7907 % 7908 % Figure out line sizes for the paragraph shape. We'll always have at 7909 % least two. 7910 \tempnum = 2 7911 % 7912 % The first line needs space for \box0; but if \rightskip is nonzero, 7913 % we need only space for the part of \box0 which exceeds it: 7914 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip 7915 % 7916 % If doing a return type on its own line, we'll have another line. 7917 \ifrettypeownline 7918 \advance\tempnum by 1 7919 \def\maybeshapeline{0in \hsize}% 7920 \else 7921 \def\maybeshapeline{}% 7922 \fi 7923 % 7924 % The continuations: 7925 \dimen2=\hsize \advance\dimen2 by -\defargsindent 7926 % 7927 % The final paragraph shape: 7928 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 7929 % 7930 % Put the category name at the right margin. 7931 \noindent 7932 \hbox to 0pt{% 7933 \hfil\box0 \kern-\hsize 7934 % \hsize has to be shortened this way: 7935 \kern\leftskip 7936 % Intentionally do not respect \rightskip, since we need the space. 7937 }% 7938 % 7939 % Allow all lines to be underfull without complaint: 7940 \tolerance=10000 \hbadness=10000 7941 \exdentamount=\defbodyindent 7942 {% 7943 % defun fonts. We use typewriter by default (used to be bold) because: 7944 % . we're printing identifiers, they should be in tt in principle. 7945 % . in languages with many accents, such as Czech or French, it's 7946 % common to leave accents off identifiers. The result looks ok in 7947 % tt, but exceedingly strange in rm. 7948 % . we don't want -- and --- to be treated as ligatures. 7949 % . this still does not fix the ?` and !` ligatures, but so far no 7950 % one has made identifiers using them :). 7951 \df \tt 7952 \def\temp{#2}% text of the return type 7953 \ifx\temp\empty\else 7954 \tclose{\temp}% typeset the return type 7955 \ifrettypeownline 7956 % put return type on its own line; prohibit line break following: 7957 \hfil\vadjust{\nobreak}\break 7958 \else 7959 \space % type on same line, so just followed by a space 7960 \fi 7961 \fi % no return type 7962 #3% output function name 7963 }% 7964 {\rm\enskip}% hskip 0.5 em of \rmfont 7965 % 7966 \boldbrax 7967 % arguments will be output next, if any. 7968} 7969 7970% Print arguments in slanted roman (not ttsl), inconsistently with using 7971% tt for the name. This is because literal text is sometimes needed in 7972% the argument list (groff manual), and ttsl and tt are not very 7973% distinguishable. Prevent hyphenation at `-' chars. 7974% 7975\def\defunargs#1{% 7976 % use sl by default (not ttsl), 7977 % tt for the names. 7978 \df \sl \hyphenchar\font=0 7979 % 7980 % On the other hand, if an argument has two dashes (for instance), we 7981 % want a way to get ttsl. We used to recommend @var for that, so 7982 % leave the code in, but it's strange for @var to lead to typewriter. 7983 % Nowadays we recommend @code, since the difference between a ttsl hyphen 7984 % and a tt hyphen is pretty tiny. @code also disables ?` !`. 7985 \def\var##1{{\setregularquotes\ttslanted{##1}}}% 7986 #1% 7987 \sl\hyphenchar\font=45 7988} 7989 7990% We want ()&[] to print specially on the defun line. 7991% 7992\def\activeparens{% 7993 \catcode`\(=\active \catcode`\)=\active 7994 \catcode`\[=\active \catcode`\]=\active 7995 \catcode`\&=\active 7996} 7997 7998% Make control sequences which act like normal parenthesis chars. 7999\let\lparen = ( \let\rparen = ) 8000 8001% Be sure that we always have a definition for `(', etc. For example, 8002% if the fn name has parens in it, \boldbrax will not be in effect yet, 8003% so TeX would otherwise complain about undefined control sequence. 8004{ 8005 \activeparens 8006 \global\let(=\lparen \global\let)=\rparen 8007 \global\let[=\lbrack \global\let]=\rbrack 8008 \global\let& = \& 8009 8010 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} 8011 \gdef\magicamp{\let&=\amprm} 8012} 8013\let\ampchar\& 8014 8015\newcount\parencount 8016 8017% If we encounter &foo, then turn on ()-hacking afterwards 8018\newif\ifampseen 8019\def\amprm#1 {\ampseentrue{\bf\ }} 8020 8021\def\parenfont{% 8022 \ifampseen 8023 % At the first level, print parens in roman, 8024 % otherwise use the default font. 8025 \ifnum \parencount=1 \rm \fi 8026 \else 8027 % The \sf parens (in \boldbrax) actually are a little bolder than 8028 % the contained text. This is especially needed for [ and ] . 8029 \sf 8030 \fi 8031} 8032\def\infirstlevel#1{% 8033 \ifampseen 8034 \ifnum\parencount=1 8035 #1% 8036 \fi 8037 \fi 8038} 8039\def\bfafterword#1 {#1 \bf} 8040 8041\def\opnr{% 8042 \global\advance\parencount by 1 8043 {\parenfont(}% 8044 \infirstlevel \bfafterword 8045} 8046\def\clnr{% 8047 {\parenfont)}% 8048 \infirstlevel \sl 8049 \global\advance\parencount by -1 8050} 8051 8052\newcount\brackcount 8053\def\lbrb{% 8054 \global\advance\brackcount by 1 8055 {\bf[}% 8056} 8057\def\rbrb{% 8058 {\bf]}% 8059 \global\advance\brackcount by -1 8060} 8061 8062\def\checkparencounts{% 8063 \ifnum\parencount=0 \else \badparencount \fi 8064 \ifnum\brackcount=0 \else \badbrackcount \fi 8065} 8066% these should not use \errmessage; the glibc manual, at least, actually 8067% has such constructs (when documenting function pointers). 8068\def\badparencount{% 8069 \message{Warning: unbalanced parentheses in @def...}% 8070 \global\parencount=0 8071} 8072\def\badbrackcount{% 8073 \message{Warning: unbalanced square brackets in @def...}% 8074 \global\brackcount=0 8075} 8076 8077 8078\message{macros,} 8079% @macro. 8080 8081% To do this right we need a feature of e-TeX, \scantokens, 8082% which we arrange to emulate with a temporary file in ordinary TeX. 8083\ifx\eTeXversion\thisisundefined 8084 \newwrite\macscribble 8085 \def\scantokens#1{% 8086 \toks0={#1}% 8087 \immediate\openout\macscribble=\jobname.tmp 8088 \immediate\write\macscribble{\the\toks0}% 8089 \immediate\closeout\macscribble 8090 \input \jobname.tmp 8091 } 8092\fi 8093 8094\let\E=\expandafter 8095 8096% Used at the time of macro expansion. 8097% Argument is macro body with arguments substituted 8098\def\scanmacro#1{% 8099 \newlinechar`\^^M 8100 % expand the expansion of \eatleadingcr twice to maybe remove a leading 8101 % newline (and \else and \fi tokens), then call \eatspaces on the result. 8102 \def\xeatspaces##1{% 8103 \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1% 8104 }}% 8105 \def\xempty##1{}% 8106 % 8107 % Process the macro body under the current catcode regime. 8108 \scantokens{#1@comment}% 8109 % 8110 % The \comment is to remove the \newlinechar added by \scantokens, and 8111 % can be noticed by \parsearg. Note \c isn't used because this means cedilla 8112 % in math mode. 8113} 8114 8115% Used for copying and captions 8116\def\scanexp#1{% 8117 \expandafter\scanmacro\expandafter{#1}% 8118} 8119 8120\newcount\paramno % Count of parameters 8121\newtoks\macname % Macro name 8122\newif\ifrecursive % Is it recursive? 8123 8124% List of all defined macros in the form 8125% \commondummyword\macro1\commondummyword\macro2... 8126% Currently is also contains all @aliases; the list can be split 8127% if there is a need. 8128\def\macrolist{} 8129 8130% Add the macro to \macrolist 8131\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} 8132\def\addtomacrolistxxx#1{% 8133 \toks0 = \expandafter{\macrolist\commondummyword#1}% 8134 \xdef\macrolist{\the\toks0}% 8135} 8136 8137% Utility routines. 8138% This does \let #1 = #2, with \csnames; that is, 8139% \let \csname#1\endcsname = \csname#2\endcsname 8140% (except of course we have to play expansion games). 8141% 8142\def\cslet#1#2{% 8143 \expandafter\let 8144 \csname#1\expandafter\endcsname 8145 \csname#2\endcsname 8146} 8147 8148% Trim leading and trailing spaces off a string. 8149% Concepts from aro-bend problem 15 (see CTAN). 8150{\catcode`\@=11 8151\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} 8152\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} 8153\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} 8154\def\unbrace#1{#1} 8155\unbrace{\gdef\trim@@@ #1 } #2@{#1} 8156} 8157 8158{\catcode`\^^M=\other% 8159\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}% 8160% Warning: this won't work for a delimited argument 8161% or for an empty argument 8162 8163% Trim a single trailing ^^M off a string. 8164{\catcode`\^^M=\other \catcode`\Q=3% 8165\gdef\eatcr #1{\eatcra #1Q^^MQ}% 8166\gdef\eatcra#1^^MQ{\eatcrb#1Q}% 8167\gdef\eatcrb#1Q#2Q{#1}% 8168} 8169 8170% Macro bodies are absorbed as an argument in a context where 8171% all characters are catcode 10, 11 or 12, except \ which is active 8172% (as in normal texinfo). It is necessary to change the definition of \ 8173% to recognize macro arguments; this is the job of \mbodybackslash. 8174% 8175% Non-ASCII encodings make 8-bit characters active, so un-activate 8176% them to avoid their expansion. Must do this non-globally, to 8177% confine the change to the current group. 8178% 8179% It's necessary to have hard CRs when the macro is executed. This is 8180% done by making ^^M (\endlinechar) catcode 12 when reading the macro 8181% body, and then making it the \newlinechar in \scanmacro. 8182% 8183\def\scanctxt{% used as subroutine 8184 \catcode`\"=\other 8185 \catcode`\+=\other 8186 \catcode`\<=\other 8187 \catcode`\>=\other 8188 \catcode`\^=\other 8189 \catcode`\_=\other 8190 \catcode`\|=\other 8191 \catcode`\~=\other 8192 \passthroughcharstrue 8193} 8194 8195\def\scanargctxt{% used for copying and captions, not macros. 8196 \scanctxt 8197 \catcode`\@=\other 8198 \catcode`\\=\other 8199 \catcode`\^^M=\other 8200} 8201 8202\def\macrobodyctxt{% used for @macro definitions 8203 \scanctxt 8204 \catcode`\ =\other 8205 \catcode`\@=\other 8206 \catcode`\{=\other 8207 \catcode`\}=\other 8208 \catcode`\^^M=\other 8209 \usembodybackslash 8210} 8211 8212% Used when scanning braced macro arguments. Note, however, that catcode 8213% changes here are ineffectual if the macro invocation was nested inside 8214% an argument to another Texinfo command. 8215\def\macroargctxt{% 8216 \scanctxt 8217 \catcode`\ =\active 8218 \catcode`\@=\other 8219 \catcode`\^^M=\other 8220 \catcode`\\=\active 8221} 8222 8223\def\macrolineargctxt{% used for whole-line arguments without braces 8224 \scanctxt 8225 \catcode`\@=\other 8226 \catcode`\{=\other 8227 \catcode`\}=\other 8228} 8229 8230% \mbodybackslash is the definition of \ in @macro bodies. 8231% It maps \foo\ => \csname macarg.foo\endcsname => #N 8232% where N is the macro parameter number. 8233% We define \csname macarg.\endcsname to be \realbackslash, so 8234% \\ in macro replacement text gets you a backslash. 8235% 8236{\catcode`@=0 @catcode`@\=@active 8237 @gdef@usembodybackslash{@let\=@mbodybackslash} 8238 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} 8239} 8240\expandafter\def\csname macarg.\endcsname{\realbackslash} 8241 8242\def\margbackslash#1{\char`\#1 } 8243 8244\def\macro{\recursivefalse\parsearg\macroxxx} 8245\def\rmacro{\recursivetrue\parsearg\macroxxx} 8246 8247\def\macroxxx#1{% 8248 \getargs{#1}% now \macname is the macname and \argl the arglist 8249 \ifx\argl\empty % no arguments 8250 \paramno=0\relax 8251 \else 8252 \expandafter\parsemargdef \argl;% 8253 \if\paramno>256\relax 8254 \ifx\eTeXversion\thisisundefined 8255 \errhelp = \EMsimple 8256 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} 8257 \fi 8258 \fi 8259 \fi 8260 \if1\csname ismacro.\the\macname\endcsname 8261 \message{Warning: redefining \the\macname}% 8262 \else 8263 \expandafter\ifx\csname \the\macname\endcsname \relax 8264 \else \errmessage{Macro name \the\macname\space already defined}\fi 8265 \global\cslet{macsave.\the\macname}{\the\macname}% 8266 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% 8267 \addtomacrolist{\the\macname}% 8268 \fi 8269 \begingroup \macrobodyctxt 8270 \ifrecursive \expandafter\parsermacbody 8271 \else \expandafter\parsemacbody 8272 \fi} 8273 8274\parseargdef\unmacro{% 8275 \if1\csname ismacro.#1\endcsname 8276 \global\cslet{#1}{macsave.#1}% 8277 \global\expandafter\let \csname ismacro.#1\endcsname=0% 8278 % Remove the macro name from \macrolist: 8279 \begingroup 8280 \expandafter\let\csname#1\endcsname \relax 8281 \let\commondummyword\unmacrodo 8282 \xdef\macrolist{\macrolist}% 8283 \endgroup 8284 \else 8285 \errmessage{Macro #1 not defined}% 8286 \fi 8287} 8288 8289% Called by \do from \dounmacro on each macro. The idea is to omit any 8290% macro definitions that have been changed to \relax. 8291% 8292\def\unmacrodo#1{% 8293 \ifx #1\relax 8294 % remove this 8295 \else 8296 \noexpand\commondummyword \noexpand#1% 8297 \fi 8298} 8299 8300% \getargs -- Parse the arguments to a @macro line. Set \macname to 8301% the name of the macro, and \argl to the braced argument list. 8302\def\getargs#1{\getargsxxx#1{}} 8303\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} 8304\def\getmacname#1 #2\relax{\macname={#1}} 8305\def\getmacargs#1{\def\argl{#1}} 8306% This made use of the feature that if the last token of a 8307% <parameter list> is #, then the preceding argument is delimited by 8308% an opening brace, and that opening brace is not consumed. 8309 8310% Parse the optional {params} list to @macro or @rmacro. 8311% Set \paramno to the number of arguments, 8312% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a 8313% three-param macro.) Define \macarg.BLAH for each BLAH in the params 8314% list to some hook where the argument is to be expanded. If there are 8315% less than 10 arguments that hook is to be replaced by ##N where N 8316% is the position in that list, that is to say the macro arguments are to be 8317% defined `a la TeX in the macro body. 8318% 8319% That gets used by \mbodybackslash (above). 8320% 8321% If there are 10 or more arguments, a different technique is used: see 8322% \parsemmanyargdef. 8323% 8324\def\parsemargdef#1;{% 8325 \paramno=0\def\paramlist{}% 8326 \let\hash\relax 8327 % \hash is redefined to `#' later to get it into definitions 8328 \let\xeatspaces\relax 8329 \let\xempty\relax 8330 \parsemargdefxxx#1,;,% 8331 \ifnum\paramno<10\relax\else 8332 \paramno0\relax 8333 \parsemmanyargdef@@#1,;,% 10 or more arguments 8334 \fi 8335} 8336\def\parsemargdefxxx#1,{% 8337 \if#1;\let\next=\relax 8338 \else \let\next=\parsemargdefxxx 8339 \advance\paramno by 1 8340 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname 8341 {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}% 8342 \edef\paramlist{\paramlist\hash\the\paramno,}% 8343 \fi\next} 8344% the \xempty{} is to give \eatleadingcr an argument in the case of an 8345% empty macro argument. 8346 8347% \parsemacbody, \parsermacbody 8348% 8349% Read recursive and nonrecursive macro bodies. (They're different since 8350% rec and nonrec macros end differently.) 8351% 8352% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 8353% body to be transformed. 8354% Set \macrobody to the body of the macro, and call \defmacro. 8355% 8356{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% 8357\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% 8358{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% 8359\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% 8360 8361% Make @ a letter, so that we can make private-to-Texinfo macro names. 8362\edef\texiatcatcode{\the\catcode`\@} 8363\catcode `@=11\relax 8364 8365%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% 8366 8367% If there are 10 or more arguments, a different technique is used, where the 8368% hook remains in the body, and when macro is to be expanded the body is 8369% processed again to replace the arguments. 8370% 8371% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the 8372% argument N value and then \edef the body (nothing else will expand because of 8373% the catcode regime under which the body was input). 8374% 8375% If you compile with TeX (not eTeX), and you have macros with 10 or more 8376% arguments, no macro can have more than 256 arguments (else error). 8377% 8378% In case that there are 10 or more arguments we parse again the arguments 8379% list to set new definitions for the \macarg.BLAH macros corresponding to 8380% each BLAH argument. It was anyhow needed to parse already once this list 8381% in order to count the arguments, and as macros with at most 9 arguments 8382% are by far more frequent than macro with 10 or more arguments, defining 8383% twice the \macarg.BLAH macros does not cost too much processing power. 8384\def\parsemmanyargdef@@#1,{% 8385 \if#1;\let\next=\relax 8386 \else 8387 \let\next=\parsemmanyargdef@@ 8388 \edef\tempb{\eatspaces{#1}}% 8389 \expandafter\def\expandafter\tempa 8390 \expandafter{\csname macarg.\tempb\endcsname}% 8391 % Note that we need some extra \noexpand\noexpand, this is because we 8392 % don't want \the to be expanded in the \parsermacbody as it uses an 8393 % \xdef . 8394 \expandafter\edef\tempa 8395 {\noexpand\noexpand\noexpand\the\toks\the\paramno}% 8396 \advance\paramno by 1\relax 8397 \fi\next} 8398 8399 8400\let\endargs@\relax 8401\let\nil@\relax 8402\def\nilm@{\nil@}% 8403\long\def\nillm@{\nil@}% 8404 8405% This macro is expanded during the Texinfo macro expansion, not during its 8406% definition. It gets all the arguments' values and assigns them to macros 8407% macarg.ARGNAME 8408% 8409% #1 is the macro name 8410% #2 is the list of argument names 8411% #3 is the list of argument values 8412\def\getargvals@#1#2#3{% 8413 \def\macargdeflist@{}% 8414 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. 8415 \def\paramlist{#2,\nil@}% 8416 \def\macroname{#1}% 8417 \begingroup 8418 \macroargctxt 8419 \def\argvaluelist{#3,\nil@}% 8420 \def\@tempa{#3}% 8421 \ifx\@tempa\empty 8422 \setemptyargvalues@ 8423 \else 8424 \getargvals@@ 8425 \fi 8426} 8427\def\getargvals@@{% 8428 \ifx\paramlist\nilm@ 8429 % Some sanity check needed here that \argvaluelist is also empty. 8430 \ifx\argvaluelist\nillm@ 8431 \else 8432 \errhelp = \EMsimple 8433 \errmessage{Too many arguments in macro `\macroname'!}% 8434 \fi 8435 \let\next\macargexpandinbody@ 8436 \else 8437 \ifx\argvaluelist\nillm@ 8438 % No more arguments values passed to macro. Set remaining named-arg 8439 % macros to empty. 8440 \let\next\setemptyargvalues@ 8441 \else 8442 % pop current arg name into \@tempb 8443 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% 8444 \expandafter\@tempa\expandafter{\paramlist}% 8445 % pop current argument value into \@tempc 8446 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% 8447 \expandafter\@tempa\expandafter{\argvaluelist}% 8448 % Here \@tempb is the current arg name and \@tempc is the current arg value. 8449 % First place the new argument macro definition into \@tempd 8450 \expandafter\macname\expandafter{\@tempc}% 8451 \expandafter\let\csname macarg.\@tempb\endcsname\relax 8452 \expandafter\def\expandafter\@tempe\expandafter{% 8453 \csname macarg.\@tempb\endcsname}% 8454 \edef\@tempd{\long\def\@tempe{\the\macname}}% 8455 \push@\@tempd\macargdeflist@ 8456 \let\next\getargvals@@ 8457 \fi 8458 \fi 8459 \next 8460} 8461 8462\def\push@#1#2{% 8463 \expandafter\expandafter\expandafter\def 8464 \expandafter\expandafter\expandafter#2% 8465 \expandafter\expandafter\expandafter{% 8466 \expandafter#1#2}% 8467} 8468 8469% Replace arguments by their values in the macro body, and place the result 8470% in macro \@tempa. 8471% 8472\def\macvalstoargs@{% 8473 % To do this we use the property that token registers that are \the'ed 8474 % within an \edef expand only once. So we are going to place all argument 8475 % values into respective token registers. 8476 % 8477 % First we save the token context, and initialize argument numbering. 8478 \begingroup 8479 \paramno0\relax 8480 % Then, for each argument number #N, we place the corresponding argument 8481 % value into a new token list register \toks#N 8482 \expandafter\putargsintokens@\saveparamlist@,;,% 8483 % Then, we expand the body so that argument are replaced by their 8484 % values. The trick for values not to be expanded themselves is that they 8485 % are within tokens and that tokens expand only once in an \edef . 8486 \edef\@tempc{\csname mac.\macroname .body\endcsname}% 8487 % Now we restore the token stack pointer to free the token list registers 8488 % which we have used, but we make sure that expanded body is saved after 8489 % group. 8490 \expandafter 8491 \endgroup 8492 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% 8493 } 8494 8495% Define the named-macro outside of this group and then close this group. 8496% 8497\def\macargexpandinbody@{% 8498 \expandafter 8499 \endgroup 8500 \macargdeflist@ 8501 % First the replace in body the macro arguments by their values, the result 8502 % is in \@tempa . 8503 \macvalstoargs@ 8504 % Then we point at the \norecurse or \gobble (for recursive) macro value 8505 % with \@tempb . 8506 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname 8507 % Depending on whether it is recursive or not, we need some tailing 8508 % \egroup . 8509 \ifx\@tempb\gobble 8510 \let\@tempc\relax 8511 \else 8512 \let\@tempc\egroup 8513 \fi 8514 % And now we do the real job: 8515 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% 8516 \@tempd 8517} 8518 8519\def\putargsintokens@#1,{% 8520 \if#1;\let\next\relax 8521 \else 8522 \let\next\putargsintokens@ 8523 % First we allocate the new token list register, and give it a temporary 8524 % alias \@tempb . 8525 \toksdef\@tempb\the\paramno 8526 % Then we place the argument value into that token list register. 8527 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname 8528 \expandafter\@tempb\expandafter{\@tempa}% 8529 \advance\paramno by 1\relax 8530 \fi 8531 \next 8532} 8533 8534% Trailing missing arguments are set to empty. 8535% 8536\def\setemptyargvalues@{% 8537 \ifx\paramlist\nilm@ 8538 \let\next\macargexpandinbody@ 8539 \else 8540 \expandafter\setemptyargvaluesparser@\paramlist\endargs@ 8541 \let\next\setemptyargvalues@ 8542 \fi 8543 \next 8544} 8545 8546\def\setemptyargvaluesparser@#1,#2\endargs@{% 8547 \expandafter\def\expandafter\@tempa\expandafter{% 8548 \expandafter\def\csname macarg.#1\endcsname{}}% 8549 \push@\@tempa\macargdeflist@ 8550 \def\paramlist{#2}% 8551} 8552 8553% #1 is the element target macro 8554% #2 is the list macro 8555% #3,#4\endargs@ is the list value 8556\def\pop@#1#2#3,#4\endargs@{% 8557 \def#1{#3}% 8558 \def#2{#4}% 8559} 8560\long\def\longpop@#1#2#3,#4\endargs@{% 8561 \long\def#1{#3}% 8562 \long\def#2{#4}% 8563} 8564 8565 8566%%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%% 8567 8568 8569% This defines a Texinfo @macro or @rmacro, called by \parsemacbody. 8570% \macrobody has the body of the macro in it, with placeholders for 8571% its parameters, looking like "\xeatspaces{\hash 1}". 8572% \paramno is the number of parameters 8573% \paramlist is a TeX parameter text, e.g. "#1,#2,#3," 8574% There are four cases: macros of zero, one, up to nine, and many arguments. 8575% \xdef is used so that macro definitions will survive the file 8576% they're defined in: @include reads the file inside a group. 8577% 8578\def\defmacro{% 8579 \let\hash=##% convert placeholders to macro parameter chars 8580 \ifnum\paramno=1 8581 \def\xeatspaces##1{##1}% 8582 % This removes the pair of braces around the argument. We don't 8583 % use \eatspaces, because this can cause ends of lines to be lost 8584 % when the argument to \eatspaces is read, leading to line-based 8585 % commands like "@itemize" not being read correctly. 8586 \else 8587 \let\xeatspaces\relax % suppress expansion 8588 \fi 8589 \ifcase\paramno 8590 % 0 8591 \expandafter\xdef\csname\the\macname\endcsname{% 8592 \bgroup 8593 \noexpand\spaceisspace 8594 \noexpand\endlineisspace 8595 \noexpand\expandafter % skip any whitespace after the macro name. 8596 \expandafter\noexpand\csname\the\macname @@@\endcsname}% 8597 \expandafter\xdef\csname\the\macname @@@\endcsname{% 8598 \egroup 8599 \noexpand\scanmacro{\macrobody}}% 8600 \or % 1 8601 \expandafter\xdef\csname\the\macname\endcsname{% 8602 \bgroup 8603 \noexpand\braceorline 8604 \expandafter\noexpand\csname\the\macname @@@\endcsname}% 8605 \expandafter\xdef\csname\the\macname @@@\endcsname##1{% 8606 \egroup 8607 \noexpand\scanmacro{\macrobody}% 8608 }% 8609 \else % at most 9 8610 \ifnum\paramno<10\relax 8611 % @MACNAME sets the context for reading the macro argument 8612 % @MACNAME@@ gets the argument, processes backslashes and appends a 8613 % comma. 8614 % @MACNAME@@@ removes braces surrounding the argument list. 8615 % @MACNAME@@@@ scans the macro body with arguments substituted. 8616 \expandafter\xdef\csname\the\macname\endcsname{% 8617 \bgroup 8618 \noexpand\expandafter % This \expandafter skip any spaces after the 8619 \noexpand\macroargctxt % macro before we change the catcode of space. 8620 \noexpand\expandafter 8621 \expandafter\noexpand\csname\the\macname @@\endcsname}% 8622 \expandafter\xdef\csname\the\macname @@\endcsname##1{% 8623 \noexpand\passargtomacro 8624 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% 8625 \expandafter\xdef\csname\the\macname @@@\endcsname##1{% 8626 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% 8627 \expandafter\expandafter 8628 \expandafter\xdef 8629 \expandafter\expandafter 8630 \csname\the\macname @@@@\endcsname\paramlist{% 8631 \egroup\noexpand\scanmacro{\macrobody}}% 8632 \else % 10 or more: 8633 \expandafter\xdef\csname\the\macname\endcsname{% 8634 \noexpand\getargvals@{\the\macname}{\argl}% 8635 }% 8636 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody 8637 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble 8638 \fi 8639 \fi} 8640 8641\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes 8642 8643\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} 8644 8645 8646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8647% 8648{\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape 8649@catcode`@_=11 % private names 8650@catcode`@!=11 % used as argument separator 8651 8652% \passargtomacro#1#2 - 8653% Call #1 with a list of tokens #2, with any doubled backslashes in #2 8654% compressed to one. 8655% 8656% This implementation works by expansion, and not execution (so we cannot use 8657% \def or similar). This reduces the risk of this failing in contexts where 8658% complete expansion is done with no execution (for example, in writing out to 8659% an auxiliary file for an index entry). 8660% 8661% State is kept in the input stream: the argument passed to 8662% @look_ahead, @gobble_and_check_finish and @add_segment is 8663% 8664% THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input) 8665% 8666% where: 8667% THE_MACRO - name of the macro we want to call 8668% ARG_RESULT - argument list we build to pass to that macro 8669% PENDING_BS - either a backslash or nothing 8670% NEXT_TOKEN - used to look ahead in the input stream to see what's coming next 8671 8672@gdef@passargtomacro#1#2{% 8673 @add_segment #1!{}@relax#2\@_finish\% 8674} 8675@gdef@_finish{@_finishx} @global@let@_finishx@relax 8676 8677% #1 - THE_MACRO ARG_RESULT 8678% #2 - PENDING_BS 8679% #3 - NEXT_TOKEN 8680% #4 used to look ahead 8681% 8682% If the next token is not a backslash, process the rest of the argument; 8683% otherwise, remove the next token. 8684@gdef@look_ahead#1!#2#3#4{% 8685 @ifx#4\% 8686 @expandafter@gobble_and_check_finish 8687 @else 8688 @expandafter@add_segment 8689 @fi#1!{#2}#4#4% 8690} 8691 8692% #1 - THE_MACRO ARG_RESULT 8693% #2 - PENDING_BS 8694% #3 - NEXT_TOKEN 8695% #4 should be a backslash, which is gobbled. 8696% #5 looks ahead 8697% 8698% Double backslash found. Add a single backslash, and look ahead. 8699@gdef@gobble_and_check_finish#1!#2#3#4#5{% 8700 @add_segment#1\!{}#5#5% 8701} 8702 8703@gdef@is_fi{@fi} 8704 8705% #1 - THE_MACRO ARG_RESULT 8706% #2 - PENDING_BS 8707% #3 - NEXT_TOKEN 8708% #4 is input stream until next backslash 8709% 8710% Input stream is either at the start of the argument, or just after a 8711% backslash sequence, either a lone backslash, or a doubled backslash. 8712% NEXT_TOKEN contains the first token in the input stream: if it is \finish, 8713% finish; otherwise, append to ARG_RESULT the segment of the argument up until 8714% the next backslash. PENDING_BACKSLASH contains a backslash to represent 8715% a backslash just before the start of the input stream that has not been 8716% added to ARG_RESULT. 8717@gdef@add_segment#1!#2#3#4\{% 8718@ifx#3@_finish 8719 @call_the_macro#1!% 8720@else 8721 % append the pending backslash to the result, followed by the next segment 8722 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi 8723 % this @fi is discarded by @look_ahead. 8724 % we can't get rid of it with \expandafter because we don't know how 8725 % long #4 is. 8726} 8727 8728% #1 - THE_MACRO 8729% #2 - ARG_RESULT 8730% #3 discards the res of the conditional in @add_segment, and @is_fi ends the 8731% conditional. 8732@gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}} 8733 8734} 8735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8736 8737% \braceorline MAC is used for a one-argument macro MAC. It checks 8738% whether the next non-whitespace character is a {. It sets the context 8739% for reading the argument (slightly different in the two cases). Then, 8740% to read the argument, in the whole-line case, it then calls the regular 8741% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC. 8742% 8743\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} 8744\def\braceorlinexxx{% 8745 \ifx\nchar\bgroup 8746 \macroargctxt 8747 \expandafter\passargtomacro 8748 \else 8749 \macrolineargctxt\expandafter\parsearg 8750 \fi \macnamexxx} 8751 8752 8753% @alias. 8754% We need some trickery to remove the optional spaces around the equal 8755% sign. Make them active and then expand them all to nothing. 8756% 8757\def\alias{\parseargusing\obeyspaces\aliasxxx} 8758\def\aliasxxx #1{\aliasyyy#1\relax} 8759\def\aliasyyy #1=#2\relax{% 8760 {% 8761 \expandafter\let\obeyedspace=\empty 8762 \addtomacrolist{#1}% 8763 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% 8764 }% 8765 \next 8766} 8767 8768 8769\message{cross references,} 8770 8771\newwrite\auxfile 8772\newif\ifhavexrefs % True if xref values are known. 8773\newif\ifwarnedxrefs % True if we warned once that they aren't known. 8774 8775% @inforef is relatively simple. 8776\def\inforef #1{\inforefzzz #1,,,,**} 8777\def\inforefzzz #1,#2,#3,#4**{% 8778 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, 8779 node \samp{\ignorespaces#1{}}} 8780 8781% @node's only job in TeX is to define \lastnode, which is used in 8782% cross-references. The @node line might or might not have commas, and 8783% might or might not have spaces before the first comma, like: 8784% @node foo , bar , ... 8785% We don't want such trailing spaces in the node name. 8786% 8787\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} 8788% 8789% also remove a trailing comma, in case of something like this: 8790% @node Help-Cross, , , Cross-refs 8791\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} 8792\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode} 8793 8794% Used so that the @top node doesn't have to be wrapped in an @ifnottex 8795% conditional. 8796% \doignore goes to more effort to skip nested conditionals but we don't need 8797% that here. 8798\def\omittopnode{% 8799 \ifx\lastnode\wordTop 8800 \expandafter\ignorenode\fi 8801} 8802\def\wordTop{Top} 8803 8804% Until the next @node or @bye command, divert output to a box that is not 8805% output. 8806\def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}% 8807\ignorenodebye 8808} 8809 8810{\let\bye\relax 8811\gdef\ignorenodebye{\let\bye\ignorenodebyedef} 8812\gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}} 8813% The redefinition of \bye here is because it is declared \outer 8814 8815\let\lastnode=\empty 8816 8817% Write a cross-reference definition for the current node. #1 is the 8818% type (Ynumbered, Yappendix, Ynothing). 8819% 8820\def\donoderef#1{% 8821 \ifx\lastnode\empty\else 8822 \setref{\lastnode}{#1}% 8823 \global\let\lastnode=\empty 8824 \fi 8825} 8826 8827% @anchor{NAME} -- define xref target at arbitrary point. 8828% 8829\newcount\savesfregister 8830% 8831\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} 8832\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} 8833\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} 8834 8835% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an 8836% anchor), which consists of three parts: 8837% 1) NAME-title - the current sectioning name taken from \currentsection, 8838% or the anchor name. 8839% 2) NAME-snt - section number and type, passed as the SNT arg, or 8840% empty for anchors. 8841% 3) NAME-pg - the page number. 8842% 8843% This is called from \donoderef, \anchor, and \dofloat. In the case of 8844% floats, there is an additional part, which is not written here: 8845% 4) NAME-lof - the text as it should appear in a @listoffloats. 8846% 8847\def\setref#1#2{% 8848 \pdfmkdest{#1}% 8849 \iflinks 8850 {% 8851 \requireauxfile 8852 \atdummies % preserve commands, but don't expand them 8853 % match definition in \xrdef, \refx, \xrefX. 8854 \def\value##1{##1}% 8855 \edef\writexrdef##1##2{% 8856 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef 8857 ##1}{##2}}% these are parameters of \writexrdef 8858 }% 8859 \toks0 = \expandafter{\currentsection}% 8860 \immediate \writexrdef{title}{\the\toks0 }% 8861 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. 8862 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout 8863 }% 8864 \fi 8865} 8866 8867% @xrefautosectiontitle on|off says whether @section(ing) names are used 8868% automatically in xrefs, if the third arg is not explicitly specified. 8869% This was provided as a "secret" @set xref-automatic-section-title 8870% variable, now it's official. 8871% 8872\parseargdef\xrefautomaticsectiontitle{% 8873 \def\temp{#1}% 8874 \ifx\temp\onword 8875 \expandafter\let\csname SETxref-automatic-section-title\endcsname 8876 = \empty 8877 \else\ifx\temp\offword 8878 \expandafter\let\csname SETxref-automatic-section-title\endcsname 8879 = \relax 8880 \else 8881 \errhelp = \EMsimple 8882 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', 8883 must be on|off}% 8884 \fi\fi 8885} 8886 8887% 8888% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is 8889% the node name, #2 the name of the Info cross-reference, #3 the printed 8890% node name, #4 the name of the Info file, #5 the name of the printed 8891% manual. All but the node name can be omitted. 8892% 8893\def\pxref{\putwordsee{} \xrefXX} 8894\def\xref{\putwordSee{} \xrefXX} 8895\def\ref{\xrefXX} 8896 8897\def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX} 8898\def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]} 8899% 8900\newbox\toprefbox 8901\newbox\printedrefnamebox 8902\newbox\infofilenamebox 8903\newbox\printedmanualbox 8904% 8905\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup 8906 \unsepspaces 8907 % 8908 % Get args without leading/trailing spaces. 8909 \def\printedrefname{\ignorespaces #3}% 8910 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% 8911 % 8912 \def\infofilename{\ignorespaces #4}% 8913 \setbox\infofilenamebox = \hbox{\infofilename\unskip}% 8914 % 8915 \def\printedmanual{\ignorespaces #5}% 8916 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% 8917 % 8918 % If the printed reference name (arg #3) was not explicitly given in 8919 % the @xref, figure out what we want to use. 8920 \ifdim \wd\printedrefnamebox = 0pt 8921 % No printed node name was explicitly given. 8922 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax 8923 % Not auto section-title: use node name inside the square brackets. 8924 \def\printedrefname{\ignorespaces #1}% 8925 \else 8926 % Auto section-title: use chapter/section title inside 8927 % the square brackets if we have it. 8928 \ifdim \wd\printedmanualbox > 0pt 8929 % It is in another manual, so we don't have it; use node name. 8930 \def\printedrefname{\ignorespaces #1}% 8931 \else 8932 \ifhavexrefs 8933 % We (should) know the real title if we have the xref values. 8934 \def\printedrefname{\refx{#1-title}{}}% 8935 \else 8936 % Otherwise just copy the Info node name. 8937 \def\printedrefname{\ignorespaces #1}% 8938 \fi% 8939 \fi 8940 \fi 8941 \fi 8942 % 8943 % Make link in pdf output. 8944 \ifpdf 8945 % For pdfTeX and LuaTeX 8946 {\indexnofonts 8947 \makevalueexpandable 8948 \turnoffactive 8949 % This expands tokens, so do it after making catcode changes, so _ 8950 % etc. don't get their TeX definitions. This ignores all spaces in 8951 % #4, including (wrongly) those in the middle of the filename. 8952 \getfilename{#4}% 8953 % 8954 % This (wrongly) does not take account of leading or trailing 8955 % spaces in #1, which should be ignored. 8956 \setpdfdestname{#1}% 8957 % 8958 \ifx\pdfdestname\empty 8959 \def\pdfdestname{Top}% no empty targets 8960 \fi 8961 % 8962 \leavevmode 8963 \startlink attr{/Border [0 0 0]}% 8964 \ifnum\filenamelength>0 8965 goto file{\the\filename.pdf} name{\pdfdestname}% 8966 \else 8967 goto name{\pdfmkpgn{\pdfdestname}}% 8968 \fi 8969 }% 8970 \setcolor{\linkcolor}% 8971 \else 8972 \ifx\XeTeXrevision\thisisundefined 8973 \else 8974 % For XeTeX 8975 {\indexnofonts 8976 \makevalueexpandable 8977 \turnoffactive 8978 % This expands tokens, so do it after making catcode changes, so _ 8979 % etc. don't get their TeX definitions. This ignores all spaces in 8980 % #4, including (wrongly) those in the middle of the filename. 8981 \getfilename{#4}% 8982 % 8983 % This (wrongly) does not take account of leading or trailing 8984 % spaces in #1, which should be ignored. 8985 \setpdfdestname{#1}% 8986 % 8987 \ifx\pdfdestname\empty 8988 \def\pdfdestname{Top}% no empty targets 8989 \fi 8990 % 8991 \leavevmode 8992 \ifnum\filenamelength>0 8993 % With default settings, 8994 % XeTeX (xdvipdfmx) replaces link destination names with integers. 8995 % In this case, the replaced destination names of 8996 % remote PDFs are no longer known. In order to avoid a replacement, 8997 % you can use xdvipdfmx's command line option `-C 0x0010'. 8998 % If you use XeTeX 0.99996+ (TeX Live 2016+), 8999 % this command line option is no longer necessary 9000 % because we can use the `dvipdfmx:config' special. 9001 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A 9002 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}% 9003 \else 9004 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A 9005 << /S /GoTo /D (\pdfdestname) >> >>}% 9006 \fi 9007 }% 9008 \setcolor{\linkcolor}% 9009 \fi 9010 \fi 9011 {% 9012 % Have to otherify everything special to allow the \csname to 9013 % include an _ in the xref name, etc. 9014 \indexnofonts 9015 \turnoffactive 9016 \def\value##1{##1}% 9017 \expandafter\global\expandafter\let\expandafter\Xthisreftitle 9018 \csname XR#1-title\endcsname 9019 }% 9020 % 9021 % Float references are printed completely differently: "Figure 1.2" 9022 % instead of "[somenode], p.3". \iffloat distinguishes them by 9023 % \Xthisreftitle being set to a magic string. 9024 \iffloat\Xthisreftitle 9025 % If the user specified the print name (third arg) to the ref, 9026 % print it instead of our usual "Figure 1.2". 9027 \ifdim\wd\printedrefnamebox = 0pt 9028 \refx{#1-snt}{}% 9029 \else 9030 \printedrefname 9031 \fi 9032 % 9033 % If the user also gave the printed manual name (fifth arg), append 9034 % "in MANUALNAME". 9035 \ifdim \wd\printedmanualbox > 0pt 9036 \space \putwordin{} \cite{\printedmanual}% 9037 \fi 9038 \else 9039 % node/anchor (non-float) references. 9040 % 9041 % If we use \unhbox to print the node names, TeX does not insert 9042 % empty discretionaries after hyphens, which means that it will not 9043 % find a line break at a hyphen in a node names. Since some manuals 9044 % are best written with fairly long node names, containing hyphens, 9045 % this is a loss. Therefore, we give the text of the node name 9046 % again, so it is as if TeX is seeing it for the first time. 9047 % 9048 \ifdim \wd\printedmanualbox > 0pt 9049 % Cross-manual reference with a printed manual name. 9050 % 9051 \crossmanualxref{\cite{\printedmanual\unskip}}% 9052 % 9053 \else\ifdim \wd\infofilenamebox > 0pt 9054 % Cross-manual reference with only an info filename (arg 4), no 9055 % printed manual name (arg 5). This is essentially the same as 9056 % the case above; we output the filename, since we have nothing else. 9057 % 9058 \crossmanualxref{\code{\infofilename\unskip}}% 9059 % 9060 \else 9061 % Reference within this manual. 9062 % 9063 % Only output a following space if the -snt ref is nonempty; for 9064 % @unnumbered and @anchor, it won't be. 9065 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% 9066 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi 9067 % 9068 % output the `[mynode]' via the macro below so it can be overridden. 9069 \xrefprintnodename\printedrefname 9070 % 9071 \expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax 9072 % But we always want a comma and a space: 9073 ,\space 9074 % 9075 % output the `page 3'. 9076 \turnoffactive \putwordpage\tie\refx{#1-pg}{}% 9077 % Add a , if xref followed by a space 9078 \if\space\noexpand\tokenafterxref ,% 9079 \else\ifx\ \tokenafterxref ,% @TAB 9080 \else\ifx\*\tokenafterxref ,% @* 9081 \else\ifx\ \tokenafterxref ,% @SPACE 9082 \else\ifx\ 9083 \tokenafterxref ,% @NL 9084 \else\ifx\tie\tokenafterxref ,% @tie 9085 \fi\fi\fi\fi\fi\fi 9086 \fi 9087 \fi\fi 9088 \fi 9089 \endlink 9090\endgroup} 9091 9092% Output a cross-manual xref to #1. Used just above (twice). 9093% 9094% Only include the text "Section ``foo'' in" if the foo is neither 9095% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply 9096% "see The Foo Manual", the idea being to refer to the whole manual. 9097% 9098% But, this being TeX, we can't easily compare our node name against the 9099% string "Top" while ignoring the possible spaces before and after in 9100% the input. By adding the arbitrary 7sp below, we make it much less 9101% likely that a real node name would have the same width as "Top" (e.g., 9102% in a monospaced font). Hopefully it will never happen in practice. 9103% 9104% For the same basic reason, we retypeset the "Top" at every 9105% reference, since the current font is indeterminate. 9106% 9107\def\crossmanualxref#1{% 9108 \setbox\toprefbox = \hbox{Top\kern7sp}% 9109 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% 9110 \ifdim \wd2 > 7sp % nonempty? 9111 \ifdim \wd2 = \wd\toprefbox \else % same as Top? 9112 \putwordSection{} ``\printedrefname'' \putwordin{}\space 9113 \fi 9114 \fi 9115 #1% 9116} 9117 9118% This macro is called from \xrefX for the `[nodename]' part of xref 9119% output. It's a separate macro only so it can be changed more easily, 9120% since square brackets don't work well in some documents. Particularly 9121% one that Bob is working on :). 9122% 9123\def\xrefprintnodename#1{[#1]} 9124 9125% Things referred to by \setref. 9126% 9127\def\Ynothing{} 9128\def\Yomitfromtoc{} 9129\def\Ynumbered{% 9130 \ifnum\secno=0 9131 \putwordChapter@tie \the\chapno 9132 \else \ifnum\subsecno=0 9133 \putwordSection@tie \the\chapno.\the\secno 9134 \else \ifnum\subsubsecno=0 9135 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno 9136 \else 9137 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno 9138 \fi\fi\fi 9139} 9140\def\Yappendix{% 9141 \ifnum\secno=0 9142 \putwordAppendix@tie @char\the\appendixno{}% 9143 \else \ifnum\subsecno=0 9144 \putwordSection@tie @char\the\appendixno.\the\secno 9145 \else \ifnum\subsubsecno=0 9146 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno 9147 \else 9148 \putwordSection@tie 9149 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno 9150 \fi\fi\fi 9151} 9152 9153% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX 9154% is output afterwards if non-empty. 9155\def\refx#1#2{% 9156 \requireauxfile 9157 {% 9158 \indexnofonts 9159 \turnoffactive 9160 \def\value##1{##1}% 9161 \expandafter\global\expandafter\let\expandafter\thisrefX 9162 \csname XR#1\endcsname 9163 }% 9164 \ifx\thisrefX\relax 9165 % If not defined, say something at least. 9166 \angleleft un\-de\-fined\angleright 9167 \iflinks 9168 \ifhavexrefs 9169 {\toks0 = {#1}% avoid expansion of possibly-complex value 9170 \message{\linenumber Undefined cross reference `\the\toks0'.}}% 9171 \else 9172 \ifwarnedxrefs\else 9173 \global\warnedxrefstrue 9174 \message{Cross reference values unknown; you must run TeX again.}% 9175 \fi 9176 \fi 9177 \fi 9178 \else 9179 % It's defined, so just use it. 9180 \thisrefX 9181 \fi 9182 #2% Output the suffix in any case. 9183} 9184 9185% This is the macro invoked by entries in the aux file. Define a control 9186% sequence for a cross-reference target (we prepend XR to the control sequence 9187% name to avoid collisions). The value is the page number. If this is a float 9188% type, we have more work to do. 9189% 9190\def\xrdef#1#2{% 9191 {% Expand the node or anchor name to remove control sequences. 9192 % \turnoffactive stops 8-bit characters being changed to commands 9193 % like @'e. \refx does the same to retrieve the value in the definition. 9194 \indexnofonts 9195 \turnoffactive 9196 \def\value##1{##1}% 9197 \xdef\safexrefname{#1}% 9198 }% 9199 % 9200 \bgroup 9201 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% 9202 \egroup 9203 % We put the \gdef inside a group to avoid the definitions building up on 9204 % TeX's save stack, which can cause it to run out of space for aux files with 9205 % thousands of lines. \gdef doesn't use the save stack, but \csname does 9206 % when it defines an unknown control sequence as \relax. 9207 % 9208 % Was that xref control sequence that we just defined for a float? 9209 \expandafter\iffloat\csname XR\safexrefname\endcsname 9210 % it was a float, and we have the (safe) float type in \iffloattype. 9211 \expandafter\let\expandafter\floatlist 9212 \csname floatlist\iffloattype\endcsname 9213 % 9214 % Is this the first time we've seen this float type? 9215 \expandafter\ifx\floatlist\relax 9216 \toks0 = {\do}% yes, so just \do 9217 \else 9218 % had it before, so preserve previous elements in list. 9219 \toks0 = \expandafter{\floatlist\do}% 9220 \fi 9221 % 9222 % Remember this xref in the control sequence \floatlistFLOATTYPE, 9223 % for later use in \listoffloats. 9224 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 9225 {\safexrefname}}% 9226 \fi 9227} 9228 9229% If working on a large document in chapters, it is convenient to 9230% be able to disable indexing, cross-referencing, and contents, for test runs. 9231% This is done with @novalidate at the beginning of the file. 9232% 9233\newif\iflinks \linkstrue % by default we want the aux files. 9234\let\novalidate = \linksfalse 9235 9236% Used when writing to the aux file, or when using data from it. 9237\def\requireauxfile{% 9238 \iflinks 9239 \tryauxfile 9240 % Open the new aux file. TeX will close it automatically at exit. 9241 \immediate\openout\auxfile=\jobname.aux 9242 \fi 9243 \global\let\requireauxfile=\relax % Only do this once. 9244} 9245 9246% Read the last existing aux file, if any. No error if none exists. 9247% 9248\def\tryauxfile{% 9249 \openin 1 \jobname.aux 9250 \ifeof 1 \else 9251 \readdatafile{aux}% 9252 \global\havexrefstrue 9253 \fi 9254 \closein 1 9255} 9256 9257\def\setupdatafile{% 9258 \catcode`\^^@=\other 9259 \catcode`\^^A=\other 9260 \catcode`\^^B=\other 9261 \catcode`\^^C=\other 9262 \catcode`\^^D=\other 9263 \catcode`\^^E=\other 9264 \catcode`\^^F=\other 9265 \catcode`\^^G=\other 9266 \catcode`\^^H=\other 9267 \catcode`\^^K=\other 9268 \catcode`\^^L=\other 9269 \catcode`\^^N=\other 9270 \catcode`\^^P=\other 9271 \catcode`\^^Q=\other 9272 \catcode`\^^R=\other 9273 \catcode`\^^S=\other 9274 \catcode`\^^T=\other 9275 \catcode`\^^U=\other 9276 \catcode`\^^V=\other 9277 \catcode`\^^W=\other 9278 \catcode`\^^X=\other 9279 \catcode`\^^Z=\other 9280 \catcode`\^^[=\other 9281 \catcode`\^^\=\other 9282 \catcode`\^^]=\other 9283 \catcode`\^^^=\other 9284 \catcode`\^^_=\other 9285 \catcode`\^=\other 9286 % 9287 % Special characters. Should be turned off anyway, but... 9288 \catcode`\~=\other 9289 \catcode`\[=\other 9290 \catcode`\]=\other 9291 \catcode`\"=\other 9292 \catcode`\_=\other 9293 \catcode`\|=\other 9294 \catcode`\<=\other 9295 \catcode`\>=\other 9296 \catcode`\$=\other 9297 \catcode`\#=\other 9298 \catcode`\&=\other 9299 \catcode`\%=\other 9300 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off 9301 % 9302 \catcode`\\=\active 9303 % 9304 % @ is our escape character in .aux files, and we need braces. 9305 \catcode`\{=1 9306 \catcode`\}=2 9307 \catcode`\@=0 9308} 9309 9310\def\readdatafile#1{% 9311\begingroup 9312 \setupdatafile 9313 \input\jobname.#1 9314\endgroup} 9315 9316 9317\message{insertions,} 9318% including footnotes. 9319 9320\newcount \footnoteno 9321 9322% The trailing space in the following definition for supereject is 9323% vital for proper filling; pages come out unaligned when you do a 9324% pagealignmacro call if that space before the closing brace is 9325% removed. (Generally, numeric constants should always be followed by a 9326% space to prevent strange expansion errors.) 9327\def\supereject{\par\penalty -20000\footnoteno =0 } 9328 9329% @footnotestyle is meaningful for Info output only. 9330\let\footnotestyle=\comment 9331 9332{\catcode `\@=11 9333% 9334% Auto-number footnotes. Otherwise like plain. 9335\gdef\footnote{% 9336 \global\advance\footnoteno by \@ne 9337 \edef\thisfootno{$^{\the\footnoteno}$}% 9338 % 9339 % In case the footnote comes at the end of a sentence, preserve the 9340 % extra spacing after we do the footnote number. 9341 \let\@sf\empty 9342 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi 9343 % 9344 % Remove inadvertent blank space before typesetting the footnote number. 9345 \unskip 9346 \thisfootno\@sf 9347 \dofootnote 9348}% 9349 9350% Don't bother with the trickery in plain.tex to not require the 9351% footnote text as a parameter. Our footnotes don't need to be so general. 9352% 9353% Oh yes, they do; otherwise, @ifset (and anything else that uses 9354% \parseargline) fails inside footnotes because the tokens are fixed when 9355% the footnote is read. --karl, 16nov96. 9356% 9357\gdef\dofootnote{% 9358 \insert\footins\bgroup 9359 % 9360 % Nested footnotes are not supported in TeX, that would take a lot 9361 % more work. (\startsavinginserts does not suffice.) 9362 \let\footnote=\errfootnotenest 9363 % 9364 % We want to typeset this text as a normal paragraph, even if the 9365 % footnote reference occurs in (for example) a display environment. 9366 % So reset some parameters. 9367 \hsize=\txipagewidth 9368 \interlinepenalty\interfootnotelinepenalty 9369 \splittopskip\ht\strutbox % top baseline for broken footnotes 9370 \splitmaxdepth\dp\strutbox 9371 \floatingpenalty\@MM 9372 \leftskip\z@skip 9373 \rightskip\z@skip 9374 \spaceskip\z@skip 9375 \xspaceskip\z@skip 9376 \parindent\defaultparindent 9377 % 9378 \smallfonts \rm 9379 % 9380 % Because we use hanging indentation in footnotes, a @noindent appears 9381 % to exdent this text, so make it be a no-op. makeinfo does not use 9382 % hanging indentation so @noindent can still be needed within footnote 9383 % text after an @example or the like (not that this is good style). 9384 \let\noindent = \relax 9385 % 9386 % Hang the footnote text off the number. Use \everypar in case the 9387 % footnote extends for more than one paragraph. 9388 \everypar = {\hang}% 9389 \textindent{\thisfootno}% 9390 % 9391 % Don't crash into the line above the footnote text. Since this 9392 % expands into a box, it must come within the paragraph, lest it 9393 % provide a place where TeX can split the footnote. 9394 \footstrut 9395 % 9396 % Invoke rest of plain TeX footnote routine. 9397 \futurelet\next\fo@t 9398} 9399}%end \catcode `\@=11 9400 9401\def\errfootnotenest{% 9402 \errhelp=\EMsimple 9403 \errmessage{Nested footnotes not supported in texinfo.tex, 9404 even though they work in makeinfo; sorry} 9405} 9406 9407\def\errfootnoteheading{% 9408 \errhelp=\EMsimple 9409 \errmessage{Footnotes in chapters, sections, etc., are not supported} 9410} 9411 9412% In case a @footnote appears in a vbox, save the footnote text and create 9413% the real \insert just after the vbox finished. Otherwise, the insertion 9414% would be lost. 9415% Similarly, if a @footnote appears inside an alignment, save the footnote 9416% text to a box and make the \insert when a row of the table is finished. 9417% And the same can be done for other insert classes. --kasal, 16nov03. 9418% 9419% Replace the \insert primitive by a cheating macro. 9420% Deeper inside, just make sure that the saved insertions are not spilled 9421% out prematurely. 9422% 9423\def\startsavinginserts{% 9424 \ifx \insert\ptexinsert 9425 \let\insert\saveinsert 9426 \else 9427 \let\checkinserts\relax 9428 \fi 9429} 9430 9431% This \insert replacement works for both \insert\footins{foo} and 9432% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. 9433% 9434\def\saveinsert#1{% 9435 \edef\next{\noexpand\savetobox \makeSAVEname#1}% 9436 \afterassignment\next 9437 % swallow the left brace 9438 \let\temp = 9439} 9440\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} 9441\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} 9442 9443\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} 9444 9445\def\placesaveins#1{% 9446 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname 9447 {\box#1}% 9448} 9449 9450% eat @SAVE -- beware, all of them have catcode \other: 9451{ 9452 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) 9453 \gdef\gobblesave @SAVE{} 9454} 9455 9456% initialization: 9457\def\newsaveins #1{% 9458 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% 9459 \next 9460} 9461\def\newsaveinsX #1{% 9462 \csname newbox\endcsname #1% 9463 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts 9464 \checksaveins #1}% 9465} 9466 9467% initialize: 9468\let\checkinserts\empty 9469\newsaveins\footins 9470\newsaveins\margin 9471 9472 9473% @image. We use the macros from epsf.tex to support this. 9474% If epsf.tex is not installed and @image is used, we complain. 9475% 9476% Check for and read epsf.tex up front. If we read it only at @image 9477% time, we might be inside a group, and then its definitions would get 9478% undone and the next image would fail. 9479\openin 1 = epsf.tex 9480\ifeof 1 \else 9481 % Do not bother showing banner with epsf.tex v2.7k (available in 9482 % doc/epsf.tex and on ctan). 9483 \def\epsfannounce{\toks0 = }% 9484 \input epsf.tex 9485\fi 9486\closein 1 9487% 9488% We will only complain once about lack of epsf.tex. 9489\newif\ifwarnednoepsf 9490\newhelp\noepsfhelp{epsf.tex must be installed for images to 9491 work. It is also included in the Texinfo distribution, or you can get 9492 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.} 9493% 9494\def\image#1{% 9495 \ifx\epsfbox\thisisundefined 9496 \ifwarnednoepsf \else 9497 \errhelp = \noepsfhelp 9498 \errmessage{epsf.tex not found, images will be ignored}% 9499 \global\warnednoepsftrue 9500 \fi 9501 \else 9502 \imagexxx #1,,,,,\finish 9503 \fi 9504} 9505% 9506% Arguments to @image: 9507% #1 is (mandatory) image filename; we tack on .eps extension. 9508% #2 is (optional) width, #3 is (optional) height. 9509% #4 is (ignored optional) html alt text. 9510% #5 is (ignored optional) extension. 9511% #6 is just the usual extra ignored arg for parsing stuff. 9512\newif\ifimagevmode 9513\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup 9514 \catcode`\^^M = 5 % in case we're inside an example 9515 \normalturnoffactive % allow _ et al. in names 9516 \makevalueexpandable 9517 % If the image is by itself, center it. 9518 \ifvmode 9519 \imagevmodetrue 9520 \else \ifx\centersub\centerV 9521 % for @center @image, we need a vbox so we can have our vertical space 9522 \imagevmodetrue 9523 \vbox\bgroup % vbox has better behavior than vtop herev 9524 \fi\fi 9525 % 9526 \ifimagevmode 9527 \nobreak\medskip 9528 % Usually we'll have text after the image which will insert 9529 % \parskip glue, so insert it here too to equalize the space 9530 % above and below. 9531 \nobreak\vskip\parskip 9532 \nobreak 9533 \fi 9534 % 9535 % Leave vertical mode so that indentation from an enclosing 9536 % environment such as @quotation is respected. 9537 % However, if we're at the top level, we don't want the 9538 % normal paragraph indentation. 9539 % On the other hand, if we are in the case of @center @image, we don't 9540 % want to start a paragraph, which will create a hsize-width box and 9541 % eradicate the centering. 9542 \ifx\centersub\centerV\else \noindent \fi 9543 % 9544 % Output the image. 9545 \ifpdf 9546 % For pdfTeX and LuaTeX <= 0.80 9547 \dopdfimage{#1}{#2}{#3}% 9548 \else 9549 \ifx\XeTeXrevision\thisisundefined 9550 % For epsf.tex 9551 % \epsfbox itself resets \epsf?size at each figure. 9552 \setbox0 = \hbox{\ignorespaces #2}% 9553 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi 9554 \setbox0 = \hbox{\ignorespaces #3}% 9555 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi 9556 \epsfbox{#1.eps}% 9557 \else 9558 % For XeTeX 9559 \doxeteximage{#1}{#2}{#3}% 9560 \fi 9561 \fi 9562 % 9563 \ifimagevmode 9564 \medskip % space after a standalone image 9565 \fi 9566 \ifx\centersub\centerV \egroup \fi 9567\endgroup} 9568 9569 9570% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, 9571% etc. We don't actually implement floating yet, we always include the 9572% float "here". But it seemed the best name for the future. 9573% 9574\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} 9575 9576% There may be a space before second and/or third parameter; delete it. 9577\def\eatcommaspace#1, {#1,} 9578 9579% #1 is the optional FLOATTYPE, the text label for this float, typically 9580% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, 9581% this float will not be numbered and cannot be referred to. 9582% 9583% #2 is the optional xref label. Also must be present for the float to 9584% be referable. 9585% 9586% #3 is the optional positioning argument; for now, it is ignored. It 9587% will somehow specify the positions allowed to float to (here, top, bottom). 9588% 9589% We keep a separate counter for each FLOATTYPE, which we reset at each 9590% chapter-level command. 9591\let\resetallfloatnos=\empty 9592% 9593\def\dofloat#1,#2,#3,#4\finish{% 9594 \let\thiscaption=\empty 9595 \let\thisshortcaption=\empty 9596 % 9597 % don't lose footnotes inside @float. 9598 % 9599 % BEWARE: when the floats start float, we have to issue warning whenever an 9600 % insert appears inside a float which could possibly float. --kasal, 26may04 9601 % 9602 \startsavinginserts 9603 % 9604 % We can't be used inside a paragraph. 9605 \par 9606 % 9607 \vtop\bgroup 9608 \def\floattype{#1}% 9609 \def\floatlabel{#2}% 9610 \def\floatloc{#3}% we do nothing with this yet. 9611 % 9612 \ifx\floattype\empty 9613 \let\safefloattype=\empty 9614 \else 9615 {% 9616 % the floattype might have accents or other special characters, 9617 % but we need to use it in a control sequence name. 9618 \indexnofonts 9619 \turnoffactive 9620 \xdef\safefloattype{\floattype}% 9621 }% 9622 \fi 9623 % 9624 % If label is given but no type, we handle that as the empty type. 9625 \ifx\floatlabel\empty \else 9626 % We want each FLOATTYPE to be numbered separately (Figure 1, 9627 % Table 1, Figure 2, ...). (And if no label, no number.) 9628 % 9629 \expandafter\getfloatno\csname\safefloattype floatno\endcsname 9630 \global\advance\floatno by 1 9631 % 9632 {% 9633 % This magic value for \currentsection is output by \setref as the 9634 % XREFLABEL-title value. \xrefX uses it to distinguish float 9635 % labels (which have a completely different output format) from 9636 % node and anchor labels. And \xrdef uses it to construct the 9637 % lists of floats. 9638 % 9639 \edef\currentsection{\floatmagic=\safefloattype}% 9640 \setref{\floatlabel}{Yfloat}% 9641 }% 9642 \fi 9643 % 9644 % start with \parskip glue, I guess. 9645 \vskip\parskip 9646 % 9647 % Don't suppress indentation if a float happens to start a section. 9648 \restorefirstparagraphindent 9649} 9650 9651% we have these possibilities: 9652% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap 9653% @float Foo,lbl & no caption: Foo 1.1 9654% @float Foo & @caption{Cap}: Foo: Cap 9655% @float Foo & no caption: Foo 9656% @float ,lbl & Caption{Cap}: 1.1: Cap 9657% @float ,lbl & no caption: 1.1 9658% @float & @caption{Cap}: Cap 9659% @float & no caption: 9660% 9661\def\Efloat{% 9662 \let\floatident = \empty 9663 % 9664 % In all cases, if we have a float type, it comes first. 9665 \ifx\floattype\empty \else \def\floatident{\floattype}\fi 9666 % 9667 % If we have an xref label, the number comes next. 9668 \ifx\floatlabel\empty \else 9669 \ifx\floattype\empty \else % if also had float type, need tie first. 9670 \appendtomacro\floatident{\tie}% 9671 \fi 9672 % the number. 9673 \appendtomacro\floatident{\chaplevelprefix\the\floatno}% 9674 \fi 9675 % 9676 % Start the printed caption with what we've constructed in 9677 % \floatident, but keep it separate; we need \floatident again. 9678 \let\captionline = \floatident 9679 % 9680 \ifx\thiscaption\empty \else 9681 \ifx\floatident\empty \else 9682 \appendtomacro\captionline{: }% had ident, so need a colon between 9683 \fi 9684 % 9685 % caption text. 9686 \appendtomacro\captionline{\scanexp\thiscaption}% 9687 \fi 9688 % 9689 % If we have anything to print, print it, with space before. 9690 % Eventually this needs to become an \insert. 9691 \ifx\captionline\empty \else 9692 \vskip.5\parskip 9693 \captionline 9694 % 9695 % Space below caption. 9696 \vskip\parskip 9697 \fi 9698 % 9699 % If have an xref label, write the list of floats info. Do this 9700 % after the caption, to avoid chance of it being a breakpoint. 9701 \ifx\floatlabel\empty \else 9702 % Write the text that goes in the lof to the aux file as 9703 % \floatlabel-lof. Besides \floatident, we include the short 9704 % caption if specified, else the full caption if specified, else nothing. 9705 {% 9706 \requireauxfile 9707 \atdummies 9708 % 9709 \ifx\thisshortcaption\empty 9710 \def\gtemp{\thiscaption}% 9711 \else 9712 \def\gtemp{\thisshortcaption}% 9713 \fi 9714 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident 9715 \ifx\gtemp\empty \else : \gtemp \fi}}% 9716 }% 9717 \fi 9718 \egroup % end of \vtop 9719 % 9720 \checkinserts 9721} 9722 9723% Append the tokens #2 to the definition of macro #1, not expanding either. 9724% 9725\def\appendtomacro#1#2{% 9726 \expandafter\def\expandafter#1\expandafter{#1#2}% 9727} 9728 9729% @caption, @shortcaption 9730% 9731\def\caption{\docaption\thiscaption} 9732\def\shortcaption{\docaption\thisshortcaption} 9733\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} 9734\def\defcaption#1#2{\egroup \def#1{#2}} 9735 9736% The parameter is the control sequence identifying the counter we are 9737% going to use. Create it if it doesn't exist and assign it to \floatno. 9738\def\getfloatno#1{% 9739 \ifx#1\relax 9740 % Haven't seen this figure type before. 9741 \csname newcount\endcsname #1% 9742 % 9743 % Remember to reset this floatno at the next chap. 9744 \expandafter\gdef\expandafter\resetallfloatnos 9745 \expandafter{\resetallfloatnos #1=0 }% 9746 \fi 9747 \let\floatno#1% 9748} 9749 9750% \setref calls this to get the XREFLABEL-snt value. We want an @xref 9751% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we 9752% first read the @float command. 9753% 9754\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% 9755 9756% Magic string used for the XREFLABEL-title value, so \xrefX can 9757% distinguish floats from other xref types. 9758\def\floatmagic{!!float!!} 9759 9760% #1 is the control sequence we are passed; we expand into a conditional 9761% which is true if #1 represents a float ref. That is, the magic 9762% \currentsection value which we \setref above. 9763% 9764\def\iffloat#1{\expandafter\doiffloat#1==\finish} 9765% 9766% #1 is (maybe) the \floatmagic string. If so, #2 will be the 9767% (safe) float type for this float. We set \iffloattype to #2. 9768% 9769\def\doiffloat#1=#2=#3\finish{% 9770 \def\temp{#1}% 9771 \def\iffloattype{#2}% 9772 \ifx\temp\floatmagic 9773} 9774 9775% @listoffloats FLOATTYPE - print a list of floats like a table of contents. 9776% 9777\parseargdef\listoffloats{% 9778 \def\floattype{#1}% floattype 9779 {% 9780 % the floattype might have accents or other special characters, 9781 % but we need to use it in a control sequence name. 9782 \indexnofonts 9783 \turnoffactive 9784 \xdef\safefloattype{\floattype}% 9785 }% 9786 % 9787 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. 9788 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax 9789 \ifhavexrefs 9790 % if the user said @listoffloats foo but never @float foo. 9791 \message{\linenumber No `\safefloattype' floats to list.}% 9792 \fi 9793 \else 9794 \begingroup 9795 \leftskip=\tocindent % indent these entries like a toc 9796 \let\do=\listoffloatsdo 9797 \csname floatlist\safefloattype\endcsname 9798 \endgroup 9799 \fi 9800} 9801 9802% This is called on each entry in a list of floats. We're passed the 9803% xref label, in the form LABEL-title, which is how we save it in the 9804% aux file. We strip off the -title and look up \XRLABEL-lof, which 9805% has the text we're supposed to typeset here. 9806% 9807% Figures without xref labels will not be included in the list (since 9808% they won't appear in the aux file). 9809% 9810\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} 9811\def\listoffloatsdoentry#1-title\finish{{% 9812 % Can't fully expand XR#1-lof because it can contain anything. Just 9813 % pass the control sequence. On the other hand, XR#1-pg is just the 9814 % page number, and we want to fully expand that so we can get a link 9815 % in pdf output. 9816 \toksA = \expandafter{\csname XR#1-lof\endcsname}% 9817 % 9818 % use the same \entry macro we use to generate the TOC and index. 9819 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% 9820 \writeentry 9821}} 9822 9823 9824\message{localization,} 9825 9826% For single-language documents, @documentlanguage is usually given very 9827% early, just after @documentencoding. Single argument is the language 9828% (de) or locale (de_DE) abbreviation. 9829% 9830{ 9831 \catcode`\_ = \active 9832 \globaldefs=1 9833\parseargdef\documentlanguage{% 9834 \tex % read txi-??.tex file in plain TeX. 9835 % Read the file by the name they passed if it exists. 9836 \let_ = \normalunderscore % normal _ character for filename test 9837 \openin 1 txi-#1.tex 9838 \ifeof 1 9839 \documentlanguagetrywithoutunderscore #1_\finish 9840 \else 9841 \globaldefs = 1 % everything in the txi-LL files needs to persist 9842 \input txi-#1.tex 9843 \fi 9844 \closein 1 9845 \endgroup % end raw TeX 9846} 9847% 9848% If they passed de_DE, and txi-de_DE.tex doesn't exist, 9849% try txi-de.tex. 9850% 9851\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% 9852 \openin 1 txi-#1.tex 9853 \ifeof 1 9854 \errhelp = \nolanghelp 9855 \errmessage{Cannot read language file txi-#1.tex}% 9856 \else 9857 \globaldefs = 1 % everything in the txi-LL files needs to persist 9858 \input txi-#1.tex 9859 \fi 9860 \closein 1 9861} 9862}% end of special _ catcode 9863% 9864\newhelp\nolanghelp{The given language definition file cannot be found or 9865is empty. Maybe you need to install it? Putting it in the current 9866directory should work if nowhere else does.} 9867 9868% This macro is called from txi-??.tex files; the first argument is the 9869% \language name to set (without the "\lang@" prefix), the second and 9870% third args are \{left,right}hyphenmin. 9871% 9872% The language names to pass are determined when the format is built. 9873% See the etex.log file created at that time, e.g., 9874% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. 9875% 9876% With TeX Live 2008, etex now includes hyphenation patterns for all 9877% available languages. This means we can support hyphenation in 9878% Texinfo, at least to some extent. (This still doesn't solve the 9879% accented characters problem.) 9880% 9881\catcode`@=11 9882\def\txisetlanguage#1#2#3{% 9883 % do not set the language if the name is undefined in the current TeX. 9884 \expandafter\ifx\csname lang@#1\endcsname \relax 9885 \message{no patterns for #1}% 9886 \else 9887 \global\language = \csname lang@#1\endcsname 9888 \fi 9889 % but there is no harm in adjusting the hyphenmin values regardless. 9890 \global\lefthyphenmin = #2\relax 9891 \global\righthyphenmin = #3\relax 9892} 9893 9894% XeTeX and LuaTeX can handle Unicode natively. 9895% Their default I/O uses UTF-8 sequences instead of a byte-wise operation. 9896% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise. 9897% 9898\newif\iftxinativeunicodecapable 9899\newif\iftxiusebytewiseio 9900 9901\ifx\XeTeXrevision\thisisundefined 9902 \ifx\luatexversion\thisisundefined 9903 \txinativeunicodecapablefalse 9904 \txiusebytewiseiotrue 9905 \else 9906 \txinativeunicodecapabletrue 9907 \txiusebytewiseiofalse 9908 \fi 9909\else 9910 \txinativeunicodecapabletrue 9911 \txiusebytewiseiofalse 9912\fi 9913 9914% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex 9915% for non-UTF-8 (byte-wise) encodings. 9916% 9917\def\setbytewiseio{% 9918 \ifx\XeTeXrevision\thisisundefined 9919 \else 9920 \XeTeXdefaultencoding "bytes" % For subsequent files to be read 9921 \XeTeXinputencoding "bytes" % For document root file 9922 % Unfortunately, there seems to be no corresponding XeTeX command for 9923 % output encoding. This is a problem for auxiliary index and TOC files. 9924 % The only solution would be perhaps to write out @U{...} sequences in 9925 % place of non-ASCII characters. 9926 \fi 9927 9928 \ifx\luatexversion\thisisundefined 9929 \else 9930 \directlua{ 9931 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub 9932 local function convert_char (char) 9933 return utf8_char(byte(char)) 9934 end 9935 9936 local function convert_line (line) 9937 return gsub(line, ".", convert_char) 9938 end 9939 9940 callback.register("process_input_buffer", convert_line) 9941 9942 local function convert_line_out (line) 9943 local line_out = "" 9944 for c in string.utfvalues(line) do 9945 line_out = line_out .. string.char(c) 9946 end 9947 return line_out 9948 end 9949 9950 callback.register("process_output_buffer", convert_line_out) 9951 } 9952 \fi 9953 9954 \txiusebytewiseiotrue 9955} 9956 9957 9958% Helpers for encodings. 9959% Set the catcode of characters 128 through 255 to the specified number. 9960% 9961\def\setnonasciicharscatcode#1{% 9962 \count255=128 9963 \loop\ifnum\count255<256 9964 \global\catcode\count255=#1\relax 9965 \advance\count255 by 1 9966 \repeat 9967} 9968 9969\def\setnonasciicharscatcodenonglobal#1{% 9970 \count255=128 9971 \loop\ifnum\count255<256 9972 \catcode\count255=#1\relax 9973 \advance\count255 by 1 9974 \repeat 9975} 9976 9977% @documentencoding sets the definition of non-ASCII characters 9978% according to the specified encoding. 9979% 9980\def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz} 9981\def\documentencodingzzz#1{% 9982 % 9983 % Encoding being declared for the document. 9984 \def\declaredencoding{\csname #1.enc\endcsname}% 9985 % 9986 % Supported encodings: names converted to tokens in order to be able 9987 % to compare them with \ifx. 9988 \def\ascii{\csname US-ASCII.enc\endcsname}% 9989 \def\latnine{\csname ISO-8859-15.enc\endcsname}% 9990 \def\latone{\csname ISO-8859-1.enc\endcsname}% 9991 \def\lattwo{\csname ISO-8859-2.enc\endcsname}% 9992 \def\utfeight{\csname UTF-8.enc\endcsname}% 9993 % 9994 \ifx \declaredencoding \ascii 9995 \asciichardefs 9996 % 9997 \else \ifx \declaredencoding \lattwo 9998 \iftxinativeunicodecapable 9999 \setbytewiseio 10000 \fi 10001 \setnonasciicharscatcode\active 10002 \lattwochardefs 10003 % 10004 \else \ifx \declaredencoding \latone 10005 \iftxinativeunicodecapable 10006 \setbytewiseio 10007 \fi 10008 \setnonasciicharscatcode\active 10009 \latonechardefs 10010 % 10011 \else \ifx \declaredencoding \latnine 10012 \iftxinativeunicodecapable 10013 \setbytewiseio 10014 \fi 10015 \setnonasciicharscatcode\active 10016 \latninechardefs 10017 % 10018 \else \ifx \declaredencoding \utfeight 10019 \iftxinativeunicodecapable 10020 % For native Unicode handling (XeTeX and LuaTeX) 10021 \nativeunicodechardefs 10022 \else 10023 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX) 10024 \setnonasciicharscatcode\active 10025 % since we already invoked \utfeightchardefs at the top level 10026 % (below), do not re-invoke it, otherwise our check for duplicated 10027 % definitions gets triggered. Making non-ascii chars active is 10028 % sufficient. 10029 \fi 10030 % 10031 \else 10032 \message{Ignoring unknown document encoding: #1.}% 10033 % 10034 \fi % utfeight 10035 \fi % latnine 10036 \fi % latone 10037 \fi % lattwo 10038 \fi % ascii 10039 % 10040 \ifx\XeTeXrevision\thisisundefined 10041 \else 10042 \ifx \declaredencoding \utfeight 10043 \else 10044 \ifx \declaredencoding \ascii 10045 \else 10046 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle % 10047 non-ASCII characters in auxiliary files.}% 10048 \fi 10049 \fi 10050 \fi 10051} 10052 10053% emacs-page 10054% A message to be logged when using a character that isn't available 10055% the default font encoding (OT1). 10056% 10057\def\missingcharmsg#1{\message{Character missing, sorry: #1.}} 10058 10059% Take account of \c (plain) vs. \, (Texinfo) difference. 10060\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} 10061 10062% First, make active non-ASCII characters in order for them to be 10063% correctly categorized when TeX reads the replacement text of 10064% macros containing the character definitions. 10065\setnonasciicharscatcode\active 10066% 10067 10068\def\gdefchar#1#2{% 10069\gdef#1{% 10070 \ifpassthroughchars 10071 \string#1% 10072 \else 10073 #2% 10074 \fi 10075}} 10076 10077% Latin1 (ISO-8859-1) character definitions. 10078\def\latonechardefs{% 10079 \gdefchar^^a0{\tie} 10080 \gdefchar^^a1{\exclamdown} 10081 \gdefchar^^a2{{\tcfont \char162}} % cent 10082 \gdefchar^^a3{\pounds{}} 10083 \gdefchar^^a4{{\tcfont \char164}} % currency 10084 \gdefchar^^a5{{\tcfont \char165}} % yen 10085 \gdefchar^^a6{{\tcfont \char166}} % broken bar 10086 \gdefchar^^a7{\S} 10087 \gdefchar^^a8{\"{}} 10088 \gdefchar^^a9{\copyright{}} 10089 \gdefchar^^aa{\ordf} 10090 \gdefchar^^ab{\guillemetleft{}} 10091 \gdefchar^^ac{\ensuremath\lnot} 10092 \gdefchar^^ad{\-} 10093 \gdefchar^^ae{\registeredsymbol{}} 10094 \gdefchar^^af{\={}} 10095 % 10096 \gdefchar^^b0{\textdegree} 10097 \gdefchar^^b1{$\pm$} 10098 \gdefchar^^b2{$^2$} 10099 \gdefchar^^b3{$^3$} 10100 \gdefchar^^b4{\'{}} 10101 \gdefchar^^b5{$\mu$} 10102 \gdefchar^^b6{\P} 10103 \gdefchar^^b7{\ensuremath\cdot} 10104 \gdefchar^^b8{\cedilla\ } 10105 \gdefchar^^b9{$^1$} 10106 \gdefchar^^ba{\ordm} 10107 \gdefchar^^bb{\guillemetright{}} 10108 \gdefchar^^bc{$1\over4$} 10109 \gdefchar^^bd{$1\over2$} 10110 \gdefchar^^be{$3\over4$} 10111 \gdefchar^^bf{\questiondown} 10112 % 10113 \gdefchar^^c0{\`A} 10114 \gdefchar^^c1{\'A} 10115 \gdefchar^^c2{\^A} 10116 \gdefchar^^c3{\~A} 10117 \gdefchar^^c4{\"A} 10118 \gdefchar^^c5{\ringaccent A} 10119 \gdefchar^^c6{\AE} 10120 \gdefchar^^c7{\cedilla C} 10121 \gdefchar^^c8{\`E} 10122 \gdefchar^^c9{\'E} 10123 \gdefchar^^ca{\^E} 10124 \gdefchar^^cb{\"E} 10125 \gdefchar^^cc{\`I} 10126 \gdefchar^^cd{\'I} 10127 \gdefchar^^ce{\^I} 10128 \gdefchar^^cf{\"I} 10129 % 10130 \gdefchar^^d0{\DH} 10131 \gdefchar^^d1{\~N} 10132 \gdefchar^^d2{\`O} 10133 \gdefchar^^d3{\'O} 10134 \gdefchar^^d4{\^O} 10135 \gdefchar^^d5{\~O} 10136 \gdefchar^^d6{\"O} 10137 \gdefchar^^d7{$\times$} 10138 \gdefchar^^d8{\O} 10139 \gdefchar^^d9{\`U} 10140 \gdefchar^^da{\'U} 10141 \gdefchar^^db{\^U} 10142 \gdefchar^^dc{\"U} 10143 \gdefchar^^dd{\'Y} 10144 \gdefchar^^de{\TH} 10145 \gdefchar^^df{\ss} 10146 % 10147 \gdefchar^^e0{\`a} 10148 \gdefchar^^e1{\'a} 10149 \gdefchar^^e2{\^a} 10150 \gdefchar^^e3{\~a} 10151 \gdefchar^^e4{\"a} 10152 \gdefchar^^e5{\ringaccent a} 10153 \gdefchar^^e6{\ae} 10154 \gdefchar^^e7{\cedilla c} 10155 \gdefchar^^e8{\`e} 10156 \gdefchar^^e9{\'e} 10157 \gdefchar^^ea{\^e} 10158 \gdefchar^^eb{\"e} 10159 \gdefchar^^ec{\`{\dotless i}} 10160 \gdefchar^^ed{\'{\dotless i}} 10161 \gdefchar^^ee{\^{\dotless i}} 10162 \gdefchar^^ef{\"{\dotless i}} 10163 % 10164 \gdefchar^^f0{\dh} 10165 \gdefchar^^f1{\~n} 10166 \gdefchar^^f2{\`o} 10167 \gdefchar^^f3{\'o} 10168 \gdefchar^^f4{\^o} 10169 \gdefchar^^f5{\~o} 10170 \gdefchar^^f6{\"o} 10171 \gdefchar^^f7{$\div$} 10172 \gdefchar^^f8{\o} 10173 \gdefchar^^f9{\`u} 10174 \gdefchar^^fa{\'u} 10175 \gdefchar^^fb{\^u} 10176 \gdefchar^^fc{\"u} 10177 \gdefchar^^fd{\'y} 10178 \gdefchar^^fe{\th} 10179 \gdefchar^^ff{\"y} 10180} 10181 10182% Latin9 (ISO-8859-15) encoding character definitions. 10183\def\latninechardefs{% 10184 % Encoding is almost identical to Latin1. 10185 \latonechardefs 10186 % 10187 \gdefchar^^a4{\euro{}} 10188 \gdefchar^^a6{\v S} 10189 \gdefchar^^a8{\v s} 10190 \gdefchar^^b4{\v Z} 10191 \gdefchar^^b8{\v z} 10192 \gdefchar^^bc{\OE} 10193 \gdefchar^^bd{\oe} 10194 \gdefchar^^be{\"Y} 10195} 10196 10197% Latin2 (ISO-8859-2) character definitions. 10198\def\lattwochardefs{% 10199 \gdefchar^^a0{\tie} 10200 \gdefchar^^a1{\ogonek{A}} 10201 \gdefchar^^a2{\u{}} 10202 \gdefchar^^a3{\L} 10203 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}} 10204 \gdefchar^^a5{\v L} 10205 \gdefchar^^a6{\'S} 10206 \gdefchar^^a7{\S} 10207 \gdefchar^^a8{\"{}} 10208 \gdefchar^^a9{\v S} 10209 \gdefchar^^aa{\cedilla S} 10210 \gdefchar^^ab{\v T} 10211 \gdefchar^^ac{\'Z} 10212 \gdefchar^^ad{\-} 10213 \gdefchar^^ae{\v Z} 10214 \gdefchar^^af{\dotaccent Z} 10215 % 10216 \gdefchar^^b0{\textdegree{}} 10217 \gdefchar^^b1{\ogonek{a}} 10218 \gdefchar^^b2{\ogonek{ }} 10219 \gdefchar^^b3{\l} 10220 \gdefchar^^b4{\'{}} 10221 \gdefchar^^b5{\v l} 10222 \gdefchar^^b6{\'s} 10223 \gdefchar^^b7{\v{}} 10224 \gdefchar^^b8{\cedilla\ } 10225 \gdefchar^^b9{\v s} 10226 \gdefchar^^ba{\cedilla s} 10227 \gdefchar^^bb{\v t} 10228 \gdefchar^^bc{\'z} 10229 \gdefchar^^bd{\H{}} 10230 \gdefchar^^be{\v z} 10231 \gdefchar^^bf{\dotaccent z} 10232 % 10233 \gdefchar^^c0{\'R} 10234 \gdefchar^^c1{\'A} 10235 \gdefchar^^c2{\^A} 10236 \gdefchar^^c3{\u A} 10237 \gdefchar^^c4{\"A} 10238 \gdefchar^^c5{\'L} 10239 \gdefchar^^c6{\'C} 10240 \gdefchar^^c7{\cedilla C} 10241 \gdefchar^^c8{\v C} 10242 \gdefchar^^c9{\'E} 10243 \gdefchar^^ca{\ogonek{E}} 10244 \gdefchar^^cb{\"E} 10245 \gdefchar^^cc{\v E} 10246 \gdefchar^^cd{\'I} 10247 \gdefchar^^ce{\^I} 10248 \gdefchar^^cf{\v D} 10249 % 10250 \gdefchar^^d0{\DH} 10251 \gdefchar^^d1{\'N} 10252 \gdefchar^^d2{\v N} 10253 \gdefchar^^d3{\'O} 10254 \gdefchar^^d4{\^O} 10255 \gdefchar^^d5{\H O} 10256 \gdefchar^^d6{\"O} 10257 \gdefchar^^d7{$\times$} 10258 \gdefchar^^d8{\v R} 10259 \gdefchar^^d9{\ringaccent U} 10260 \gdefchar^^da{\'U} 10261 \gdefchar^^db{\H U} 10262 \gdefchar^^dc{\"U} 10263 \gdefchar^^dd{\'Y} 10264 \gdefchar^^de{\cedilla T} 10265 \gdefchar^^df{\ss} 10266 % 10267 \gdefchar^^e0{\'r} 10268 \gdefchar^^e1{\'a} 10269 \gdefchar^^e2{\^a} 10270 \gdefchar^^e3{\u a} 10271 \gdefchar^^e4{\"a} 10272 \gdefchar^^e5{\'l} 10273 \gdefchar^^e6{\'c} 10274 \gdefchar^^e7{\cedilla c} 10275 \gdefchar^^e8{\v c} 10276 \gdefchar^^e9{\'e} 10277 \gdefchar^^ea{\ogonek{e}} 10278 \gdefchar^^eb{\"e} 10279 \gdefchar^^ec{\v e} 10280 \gdefchar^^ed{\'{\dotless{i}}} 10281 \gdefchar^^ee{\^{\dotless{i}}} 10282 \gdefchar^^ef{\v d} 10283 % 10284 \gdefchar^^f0{\dh} 10285 \gdefchar^^f1{\'n} 10286 \gdefchar^^f2{\v n} 10287 \gdefchar^^f3{\'o} 10288 \gdefchar^^f4{\^o} 10289 \gdefchar^^f5{\H o} 10290 \gdefchar^^f6{\"o} 10291 \gdefchar^^f7{$\div$} 10292 \gdefchar^^f8{\v r} 10293 \gdefchar^^f9{\ringaccent u} 10294 \gdefchar^^fa{\'u} 10295 \gdefchar^^fb{\H u} 10296 \gdefchar^^fc{\"u} 10297 \gdefchar^^fd{\'y} 10298 \gdefchar^^fe{\cedilla t} 10299 \gdefchar^^ff{\dotaccent{}} 10300} 10301 10302% UTF-8 character definitions. 10303% 10304% This code to support UTF-8 is based on LaTeX's utf8.def, with some 10305% changes for Texinfo conventions. It is included here under the GPL by 10306% permission from Frank Mittelbach and the LaTeX team. 10307% 10308\newcount\countUTFx 10309\newcount\countUTFy 10310\newcount\countUTFz 10311 10312\gdef\UTFviiiTwoOctets#1#2{\expandafter 10313 \UTFviiiDefined\csname u8:#1\string #2\endcsname} 10314% 10315\gdef\UTFviiiThreeOctets#1#2#3{\expandafter 10316 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} 10317% 10318\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter 10319 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} 10320 10321\gdef\UTFviiiDefined#1{% 10322 \ifx #1\relax 10323 \message{\linenumber Unicode char \string #1 not defined for Texinfo}% 10324 \else 10325 \expandafter #1% 10326 \fi 10327} 10328 10329% Give non-ASCII bytes the active definitions for processing UTF-8 sequences 10330\begingroup 10331 \catcode`\~13 10332 \catcode`\$12 10333 \catcode`\"12 10334 10335 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp 10336 % substituting ~ and $ with a character token of that value. 10337 \def\UTFviiiLoop{% 10338 \global\catcode\countUTFx\active 10339 \uccode`\~\countUTFx 10340 \uccode`\$\countUTFx 10341 \uppercase\expandafter{\UTFviiiTmp}% 10342 \advance\countUTFx by 1 10343 \ifnum\countUTFx < \countUTFy 10344 \expandafter\UTFviiiLoop 10345 \fi} 10346 10347 % For bytes other than the first in a UTF-8 sequence. Not expected to 10348 % be expanded except when writing to auxiliary files. 10349 \countUTFx = "80 10350 \countUTFy = "C2 10351 \def\UTFviiiTmp{% 10352 \gdef~{% 10353 \ifpassthroughchars $\fi}}% 10354 \UTFviiiLoop 10355 10356 \countUTFx = "C2 10357 \countUTFy = "E0 10358 \def\UTFviiiTmp{% 10359 \gdef~{% 10360 \ifpassthroughchars $% 10361 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}% 10362 \UTFviiiLoop 10363 10364 \countUTFx = "E0 10365 \countUTFy = "F0 10366 \def\UTFviiiTmp{% 10367 \gdef~{% 10368 \ifpassthroughchars $% 10369 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}% 10370 \UTFviiiLoop 10371 10372 \countUTFx = "F0 10373 \countUTFy = "F4 10374 \def\UTFviiiTmp{% 10375 \gdef~{% 10376 \ifpassthroughchars $% 10377 \else\expandafter\UTFviiiFourOctets\expandafter$\fi 10378 }}% 10379 \UTFviiiLoop 10380\endgroup 10381 10382\def\globallet{\global\let} % save some \expandafter's below 10383 10384% @U{xxxx} to produce U+xxxx, if we support it. 10385\def\U#1{% 10386 \expandafter\ifx\csname uni:#1\endcsname \relax 10387 \iftxinativeunicodecapable 10388 % All Unicode characters can be used if native Unicode handling is 10389 % active. However, if the font does not have the glyph, 10390 % letters are missing. 10391 \begingroup 10392 \uccode`\.="#1\relax 10393 \uppercase{.} 10394 \endgroup 10395 \else 10396 \errhelp = \EMsimple 10397 \errmessage{Unicode character U+#1 not supported, sorry}% 10398 \fi 10399 \else 10400 \csname uni:#1\endcsname 10401 \fi 10402} 10403 10404% These macros are used here to construct the name of a control 10405% sequence to be defined. 10406\def\UTFviiiTwoOctetsName#1#2{% 10407 \csname u8:#1\string #2\endcsname}% 10408\def\UTFviiiThreeOctetsName#1#2#3{% 10409 \csname u8:#1\string #2\string #3\endcsname}% 10410\def\UTFviiiFourOctetsName#1#2#3#4{% 10411 \csname u8:#1\string #2\string #3\string #4\endcsname}% 10412 10413% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX), 10414% provide a definition macro to replace a Unicode character; 10415% this gets used by the @U command 10416% 10417\begingroup 10418 \catcode`\"=12 10419 \catcode`\<=12 10420 \catcode`\.=12 10421 \catcode`\,=12 10422 \catcode`\;=12 10423 \catcode`\!=12 10424 \catcode`\~=13 10425 \gdef\DeclareUnicodeCharacterUTFviii#1#2{% 10426 \countUTFz = "#1\relax 10427 \begingroup 10428 \parseXMLCharref 10429 10430 % Give \u8:... its definition. The sequence of seven \expandafter's 10431 % expands after the \gdef three times, e.g. 10432 % 10433 % 1. \UTFviiTwoOctetsName B1 B2 10434 % 2. \csname u8:B1 \string B2 \endcsname 10435 % 3. \u8: B1 B2 (a single control sequence token) 10436 % 10437 \expandafter\expandafter 10438 \expandafter\expandafter 10439 \expandafter\expandafter 10440 \expandafter\gdef \UTFviiiTmp{#2}% 10441 % 10442 \expandafter\ifx\csname uni:#1\endcsname \relax \else 10443 \message{Internal error, already defined: #1}% 10444 \fi 10445 % 10446 % define an additional control sequence for this code point. 10447 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp 10448 \endgroup} 10449 % 10450 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp 10451 % to the corresponding UTF-8 sequence. 10452 \gdef\parseXMLCharref{% 10453 \ifnum\countUTFz < "A0\relax 10454 \errhelp = \EMsimple 10455 \errmessage{Cannot define Unicode char value < 00A0}% 10456 \else\ifnum\countUTFz < "800\relax 10457 \parseUTFviiiA,% 10458 \parseUTFviiiB C\UTFviiiTwoOctetsName.,% 10459 \else\ifnum\countUTFz < "10000\relax 10460 \parseUTFviiiA;% 10461 \parseUTFviiiA,% 10462 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}% 10463 \else 10464 \parseUTFviiiA;% 10465 \parseUTFviiiA,% 10466 \parseUTFviiiA!% 10467 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}% 10468 \fi\fi\fi 10469 } 10470 10471 % Extract a byte from the end of the UTF-8 representation of \countUTFx. 10472 % It must be a non-initial byte in the sequence. 10473 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one 10474 % of the bytes. 10475 \gdef\parseUTFviiiA#1{% 10476 \countUTFx = \countUTFz 10477 \divide\countUTFz by 64 10478 \countUTFy = \countUTFz % Save to be the future value of \countUTFz. 10479 \multiply\countUTFz by 64 10480 10481 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract 10482 % in order to get the last five bits. 10483 \advance\countUTFx by -\countUTFz 10484 10485 % Convert this to the byte in the UTF-8 sequence. 10486 \advance\countUTFx by 128 10487 \uccode `#1\countUTFx 10488 \countUTFz = \countUTFy} 10489 10490 % Used to put a UTF-8 byte sequence into \UTFviiiTmp 10491 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8 10492 % sequence. 10493 % #2 is one of the \UTFviii*OctetsName macros. 10494 % #3 is always a full stop (.) 10495 % #4 is a template for the other bytes in the sequence. The values for these 10496 % bytes is substituted in here with \uppercase using the \uccode's. 10497 \gdef\parseUTFviiiB#1#2#3#4{% 10498 \advance\countUTFz by "#10\relax 10499 \uccode `#3\countUTFz 10500 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} 10501\endgroup 10502 10503% For native Unicode handling (XeTeX and LuaTeX), 10504% provide a definition macro that sets a catcode to `other' non-globally 10505% 10506\def\DeclareUnicodeCharacterNativeOther#1#2{% 10507 \catcode"#1=\other 10508} 10509 10510% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M 10511% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block) 10512% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block) 10513% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A 10514% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B 10515% 10516% Many of our renditions are less than wonderful, and all the missing 10517% characters are available somewhere. Loading the necessary fonts 10518% awaits user request. We can't truly support Unicode without 10519% reimplementing everything that's been done in LaTeX for many years, 10520% plus probably using luatex or xetex, and who knows what else. 10521% We won't be doing that here in this simple file. But we can try to at 10522% least make most of the characters not bomb out. 10523% 10524\def\unicodechardefs{% 10525 \DeclareUnicodeCharacter{00A0}{\tie}% 10526 \DeclareUnicodeCharacter{00A1}{\exclamdown}% 10527 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent 10528 \DeclareUnicodeCharacter{00A3}{\pounds{}}% 10529 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency 10530 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen 10531 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar 10532 \DeclareUnicodeCharacter{00A7}{\S}% 10533 \DeclareUnicodeCharacter{00A8}{\"{ }}% 10534 \DeclareUnicodeCharacter{00A9}{\copyright{}}% 10535 \DeclareUnicodeCharacter{00AA}{\ordf}% 10536 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}% 10537 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}% 10538 \DeclareUnicodeCharacter{00AD}{\-}% 10539 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}% 10540 \DeclareUnicodeCharacter{00AF}{\={ }}% 10541 % 10542 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}% 10543 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}% 10544 \DeclareUnicodeCharacter{00B2}{$^2$}% 10545 \DeclareUnicodeCharacter{00B3}{$^3$}% 10546 \DeclareUnicodeCharacter{00B4}{\'{ }}% 10547 \DeclareUnicodeCharacter{00B5}{$\mu$}% 10548 \DeclareUnicodeCharacter{00B6}{\P}% 10549 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}% 10550 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}% 10551 \DeclareUnicodeCharacter{00B9}{$^1$}% 10552 \DeclareUnicodeCharacter{00BA}{\ordm}% 10553 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}% 10554 \DeclareUnicodeCharacter{00BC}{$1\over4$}% 10555 \DeclareUnicodeCharacter{00BD}{$1\over2$}% 10556 \DeclareUnicodeCharacter{00BE}{$3\over4$}% 10557 \DeclareUnicodeCharacter{00BF}{\questiondown}% 10558 % 10559 \DeclareUnicodeCharacter{00C0}{\`A}% 10560 \DeclareUnicodeCharacter{00C1}{\'A}% 10561 \DeclareUnicodeCharacter{00C2}{\^A}% 10562 \DeclareUnicodeCharacter{00C3}{\~A}% 10563 \DeclareUnicodeCharacter{00C4}{\"A}% 10564 \DeclareUnicodeCharacter{00C5}{\AA}% 10565 \DeclareUnicodeCharacter{00C6}{\AE}% 10566 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}% 10567 \DeclareUnicodeCharacter{00C8}{\`E}% 10568 \DeclareUnicodeCharacter{00C9}{\'E}% 10569 \DeclareUnicodeCharacter{00CA}{\^E}% 10570 \DeclareUnicodeCharacter{00CB}{\"E}% 10571 \DeclareUnicodeCharacter{00CC}{\`I}% 10572 \DeclareUnicodeCharacter{00CD}{\'I}% 10573 \DeclareUnicodeCharacter{00CE}{\^I}% 10574 \DeclareUnicodeCharacter{00CF}{\"I}% 10575 % 10576 \DeclareUnicodeCharacter{00D0}{\DH}% 10577 \DeclareUnicodeCharacter{00D1}{\~N}% 10578 \DeclareUnicodeCharacter{00D2}{\`O}% 10579 \DeclareUnicodeCharacter{00D3}{\'O}% 10580 \DeclareUnicodeCharacter{00D4}{\^O}% 10581 \DeclareUnicodeCharacter{00D5}{\~O}% 10582 \DeclareUnicodeCharacter{00D6}{\"O}% 10583 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}% 10584 \DeclareUnicodeCharacter{00D8}{\O}% 10585 \DeclareUnicodeCharacter{00D9}{\`U}% 10586 \DeclareUnicodeCharacter{00DA}{\'U}% 10587 \DeclareUnicodeCharacter{00DB}{\^U}% 10588 \DeclareUnicodeCharacter{00DC}{\"U}% 10589 \DeclareUnicodeCharacter{00DD}{\'Y}% 10590 \DeclareUnicodeCharacter{00DE}{\TH}% 10591 \DeclareUnicodeCharacter{00DF}{\ss}% 10592 % 10593 \DeclareUnicodeCharacter{00E0}{\`a}% 10594 \DeclareUnicodeCharacter{00E1}{\'a}% 10595 \DeclareUnicodeCharacter{00E2}{\^a}% 10596 \DeclareUnicodeCharacter{00E3}{\~a}% 10597 \DeclareUnicodeCharacter{00E4}{\"a}% 10598 \DeclareUnicodeCharacter{00E5}{\aa}% 10599 \DeclareUnicodeCharacter{00E6}{\ae}% 10600 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}% 10601 \DeclareUnicodeCharacter{00E8}{\`e}% 10602 \DeclareUnicodeCharacter{00E9}{\'e}% 10603 \DeclareUnicodeCharacter{00EA}{\^e}% 10604 \DeclareUnicodeCharacter{00EB}{\"e}% 10605 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}% 10606 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}% 10607 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}% 10608 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}% 10609 % 10610 \DeclareUnicodeCharacter{00F0}{\dh}% 10611 \DeclareUnicodeCharacter{00F1}{\~n}% 10612 \DeclareUnicodeCharacter{00F2}{\`o}% 10613 \DeclareUnicodeCharacter{00F3}{\'o}% 10614 \DeclareUnicodeCharacter{00F4}{\^o}% 10615 \DeclareUnicodeCharacter{00F5}{\~o}% 10616 \DeclareUnicodeCharacter{00F6}{\"o}% 10617 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}% 10618 \DeclareUnicodeCharacter{00F8}{\o}% 10619 \DeclareUnicodeCharacter{00F9}{\`u}% 10620 \DeclareUnicodeCharacter{00FA}{\'u}% 10621 \DeclareUnicodeCharacter{00FB}{\^u}% 10622 \DeclareUnicodeCharacter{00FC}{\"u}% 10623 \DeclareUnicodeCharacter{00FD}{\'y}% 10624 \DeclareUnicodeCharacter{00FE}{\th}% 10625 \DeclareUnicodeCharacter{00FF}{\"y}% 10626 % 10627 \DeclareUnicodeCharacter{0100}{\=A}% 10628 \DeclareUnicodeCharacter{0101}{\=a}% 10629 \DeclareUnicodeCharacter{0102}{\u{A}}% 10630 \DeclareUnicodeCharacter{0103}{\u{a}}% 10631 \DeclareUnicodeCharacter{0104}{\ogonek{A}}% 10632 \DeclareUnicodeCharacter{0105}{\ogonek{a}}% 10633 \DeclareUnicodeCharacter{0106}{\'C}% 10634 \DeclareUnicodeCharacter{0107}{\'c}% 10635 \DeclareUnicodeCharacter{0108}{\^C}% 10636 \DeclareUnicodeCharacter{0109}{\^c}% 10637 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}% 10638 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}% 10639 \DeclareUnicodeCharacter{010C}{\v{C}}% 10640 \DeclareUnicodeCharacter{010D}{\v{c}}% 10641 \DeclareUnicodeCharacter{010E}{\v{D}}% 10642 \DeclareUnicodeCharacter{010F}{d'}% 10643 % 10644 \DeclareUnicodeCharacter{0110}{\DH}% 10645 \DeclareUnicodeCharacter{0111}{\dh}% 10646 \DeclareUnicodeCharacter{0112}{\=E}% 10647 \DeclareUnicodeCharacter{0113}{\=e}% 10648 \DeclareUnicodeCharacter{0114}{\u{E}}% 10649 \DeclareUnicodeCharacter{0115}{\u{e}}% 10650 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}% 10651 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}% 10652 \DeclareUnicodeCharacter{0118}{\ogonek{E}}% 10653 \DeclareUnicodeCharacter{0119}{\ogonek{e}}% 10654 \DeclareUnicodeCharacter{011A}{\v{E}}% 10655 \DeclareUnicodeCharacter{011B}{\v{e}}% 10656 \DeclareUnicodeCharacter{011C}{\^G}% 10657 \DeclareUnicodeCharacter{011D}{\^g}% 10658 \DeclareUnicodeCharacter{011E}{\u{G}}% 10659 \DeclareUnicodeCharacter{011F}{\u{g}}% 10660 % 10661 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}% 10662 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}% 10663 \DeclareUnicodeCharacter{0122}{\cedilla{G}}% 10664 \DeclareUnicodeCharacter{0123}{\cedilla{g}}% 10665 \DeclareUnicodeCharacter{0124}{\^H}% 10666 \DeclareUnicodeCharacter{0125}{\^h}% 10667 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}% 10668 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}% 10669 \DeclareUnicodeCharacter{0128}{\~I}% 10670 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}% 10671 \DeclareUnicodeCharacter{012A}{\=I}% 10672 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}% 10673 \DeclareUnicodeCharacter{012C}{\u{I}}% 10674 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}% 10675 \DeclareUnicodeCharacter{012E}{\ogonek{I}}% 10676 \DeclareUnicodeCharacter{012F}{\ogonek{i}}% 10677 % 10678 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}% 10679 \DeclareUnicodeCharacter{0131}{\dotless{i}}% 10680 \DeclareUnicodeCharacter{0132}{IJ}% 10681 \DeclareUnicodeCharacter{0133}{ij}% 10682 \DeclareUnicodeCharacter{0134}{\^J}% 10683 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}% 10684 \DeclareUnicodeCharacter{0136}{\cedilla{K}}% 10685 \DeclareUnicodeCharacter{0137}{\cedilla{k}}% 10686 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}% 10687 \DeclareUnicodeCharacter{0139}{\'L}% 10688 \DeclareUnicodeCharacter{013A}{\'l}% 10689 \DeclareUnicodeCharacter{013B}{\cedilla{L}}% 10690 \DeclareUnicodeCharacter{013C}{\cedilla{l}}% 10691 \DeclareUnicodeCharacter{013D}{L'}% should kern 10692 \DeclareUnicodeCharacter{013E}{l'}% should kern 10693 \DeclareUnicodeCharacter{013F}{L\U{00B7}}% 10694 % 10695 \DeclareUnicodeCharacter{0140}{l\U{00B7}}% 10696 \DeclareUnicodeCharacter{0141}{\L}% 10697 \DeclareUnicodeCharacter{0142}{\l}% 10698 \DeclareUnicodeCharacter{0143}{\'N}% 10699 \DeclareUnicodeCharacter{0144}{\'n}% 10700 \DeclareUnicodeCharacter{0145}{\cedilla{N}}% 10701 \DeclareUnicodeCharacter{0146}{\cedilla{n}}% 10702 \DeclareUnicodeCharacter{0147}{\v{N}}% 10703 \DeclareUnicodeCharacter{0148}{\v{n}}% 10704 \DeclareUnicodeCharacter{0149}{'n}% 10705 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}% 10706 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}% 10707 \DeclareUnicodeCharacter{014C}{\=O}% 10708 \DeclareUnicodeCharacter{014D}{\=o}% 10709 \DeclareUnicodeCharacter{014E}{\u{O}}% 10710 \DeclareUnicodeCharacter{014F}{\u{o}}% 10711 % 10712 \DeclareUnicodeCharacter{0150}{\H{O}}% 10713 \DeclareUnicodeCharacter{0151}{\H{o}}% 10714 \DeclareUnicodeCharacter{0152}{\OE}% 10715 \DeclareUnicodeCharacter{0153}{\oe}% 10716 \DeclareUnicodeCharacter{0154}{\'R}% 10717 \DeclareUnicodeCharacter{0155}{\'r}% 10718 \DeclareUnicodeCharacter{0156}{\cedilla{R}}% 10719 \DeclareUnicodeCharacter{0157}{\cedilla{r}}% 10720 \DeclareUnicodeCharacter{0158}{\v{R}}% 10721 \DeclareUnicodeCharacter{0159}{\v{r}}% 10722 \DeclareUnicodeCharacter{015A}{\'S}% 10723 \DeclareUnicodeCharacter{015B}{\'s}% 10724 \DeclareUnicodeCharacter{015C}{\^S}% 10725 \DeclareUnicodeCharacter{015D}{\^s}% 10726 \DeclareUnicodeCharacter{015E}{\cedilla{S}}% 10727 \DeclareUnicodeCharacter{015F}{\cedilla{s}}% 10728 % 10729 \DeclareUnicodeCharacter{0160}{\v{S}}% 10730 \DeclareUnicodeCharacter{0161}{\v{s}}% 10731 \DeclareUnicodeCharacter{0162}{\cedilla{T}}% 10732 \DeclareUnicodeCharacter{0163}{\cedilla{t}}% 10733 \DeclareUnicodeCharacter{0164}{\v{T}}% 10734 \DeclareUnicodeCharacter{0165}{\v{t}}% 10735 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}% 10736 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}% 10737 \DeclareUnicodeCharacter{0168}{\~U}% 10738 \DeclareUnicodeCharacter{0169}{\~u}% 10739 \DeclareUnicodeCharacter{016A}{\=U}% 10740 \DeclareUnicodeCharacter{016B}{\=u}% 10741 \DeclareUnicodeCharacter{016C}{\u{U}}% 10742 \DeclareUnicodeCharacter{016D}{\u{u}}% 10743 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}% 10744 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}% 10745 % 10746 \DeclareUnicodeCharacter{0170}{\H{U}}% 10747 \DeclareUnicodeCharacter{0171}{\H{u}}% 10748 \DeclareUnicodeCharacter{0172}{\ogonek{U}}% 10749 \DeclareUnicodeCharacter{0173}{\ogonek{u}}% 10750 \DeclareUnicodeCharacter{0174}{\^W}% 10751 \DeclareUnicodeCharacter{0175}{\^w}% 10752 \DeclareUnicodeCharacter{0176}{\^Y}% 10753 \DeclareUnicodeCharacter{0177}{\^y}% 10754 \DeclareUnicodeCharacter{0178}{\"Y}% 10755 \DeclareUnicodeCharacter{0179}{\'Z}% 10756 \DeclareUnicodeCharacter{017A}{\'z}% 10757 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}% 10758 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}% 10759 \DeclareUnicodeCharacter{017D}{\v{Z}}% 10760 \DeclareUnicodeCharacter{017E}{\v{z}}% 10761 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}% 10762 % 10763 \DeclareUnicodeCharacter{01C4}{D\v{Z}}% 10764 \DeclareUnicodeCharacter{01C5}{D\v{z}}% 10765 \DeclareUnicodeCharacter{01C6}{d\v{z}}% 10766 \DeclareUnicodeCharacter{01C7}{LJ}% 10767 \DeclareUnicodeCharacter{01C8}{Lj}% 10768 \DeclareUnicodeCharacter{01C9}{lj}% 10769 \DeclareUnicodeCharacter{01CA}{NJ}% 10770 \DeclareUnicodeCharacter{01CB}{Nj}% 10771 \DeclareUnicodeCharacter{01CC}{nj}% 10772 \DeclareUnicodeCharacter{01CD}{\v{A}}% 10773 \DeclareUnicodeCharacter{01CE}{\v{a}}% 10774 \DeclareUnicodeCharacter{01CF}{\v{I}}% 10775 % 10776 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}% 10777 \DeclareUnicodeCharacter{01D1}{\v{O}}% 10778 \DeclareUnicodeCharacter{01D2}{\v{o}}% 10779 \DeclareUnicodeCharacter{01D3}{\v{U}}% 10780 \DeclareUnicodeCharacter{01D4}{\v{u}}% 10781 % 10782 \DeclareUnicodeCharacter{01E2}{\={\AE}}% 10783 \DeclareUnicodeCharacter{01E3}{\={\ae}}% 10784 \DeclareUnicodeCharacter{01E6}{\v{G}}% 10785 \DeclareUnicodeCharacter{01E7}{\v{g}}% 10786 \DeclareUnicodeCharacter{01E8}{\v{K}}% 10787 \DeclareUnicodeCharacter{01E9}{\v{k}}% 10788 % 10789 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}% 10790 \DeclareUnicodeCharacter{01F1}{DZ}% 10791 \DeclareUnicodeCharacter{01F2}{Dz}% 10792 \DeclareUnicodeCharacter{01F3}{dz}% 10793 \DeclareUnicodeCharacter{01F4}{\'G}% 10794 \DeclareUnicodeCharacter{01F5}{\'g}% 10795 \DeclareUnicodeCharacter{01F8}{\`N}% 10796 \DeclareUnicodeCharacter{01F9}{\`n}% 10797 \DeclareUnicodeCharacter{01FC}{\'{\AE}}% 10798 \DeclareUnicodeCharacter{01FD}{\'{\ae}}% 10799 \DeclareUnicodeCharacter{01FE}{\'{\O}}% 10800 \DeclareUnicodeCharacter{01FF}{\'{\o}}% 10801 % 10802 \DeclareUnicodeCharacter{021E}{\v{H}}% 10803 \DeclareUnicodeCharacter{021F}{\v{h}}% 10804 % 10805 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}% 10806 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}% 10807 \DeclareUnicodeCharacter{0228}{\cedilla{E}}% 10808 \DeclareUnicodeCharacter{0229}{\cedilla{e}}% 10809 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}% 10810 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}% 10811 % 10812 \DeclareUnicodeCharacter{0232}{\=Y}% 10813 \DeclareUnicodeCharacter{0233}{\=y}% 10814 \DeclareUnicodeCharacter{0237}{\dotless{j}}% 10815 % 10816 \DeclareUnicodeCharacter{02BC}{'}% 10817 % 10818 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}% 10819 % 10820 % Greek letters upper case 10821 \DeclareUnicodeCharacter{0391}{{\it A}}% 10822 \DeclareUnicodeCharacter{0392}{{\it B}}% 10823 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}% 10824 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}% 10825 \DeclareUnicodeCharacter{0395}{{\it E}}% 10826 \DeclareUnicodeCharacter{0396}{{\it Z}}% 10827 \DeclareUnicodeCharacter{0397}{{\it H}}% 10828 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}% 10829 \DeclareUnicodeCharacter{0399}{{\it I}}% 10830 \DeclareUnicodeCharacter{039A}{{\it K}}% 10831 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}% 10832 \DeclareUnicodeCharacter{039C}{{\it M}}% 10833 \DeclareUnicodeCharacter{039D}{{\it N}}% 10834 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}% 10835 \DeclareUnicodeCharacter{039F}{{\it O}}% 10836 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}% 10837 \DeclareUnicodeCharacter{03A1}{{\it P}}% 10838 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma 10839 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}% 10840 \DeclareUnicodeCharacter{03A4}{{\it T}}% 10841 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}% 10842 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}% 10843 \DeclareUnicodeCharacter{03A7}{{\it X}}% 10844 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}% 10845 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}% 10846 % 10847 % Vowels with accents 10848 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}% 10849 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}% 10850 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}% 10851 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}% 10852 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}% 10853 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}% 10854 % 10855 % Standalone accent 10856 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}% 10857 % 10858 % Greek letters lower case 10859 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}% 10860 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}% 10861 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}% 10862 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}% 10863 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}% 10864 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}% 10865 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}% 10866 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}% 10867 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}% 10868 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}% 10869 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}% 10870 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}% 10871 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}% 10872 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}% 10873 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron 10874 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}% 10875 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}% 10876 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}% 10877 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}% 10878 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}% 10879 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}% 10880 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}% 10881 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}% 10882 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}% 10883 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}% 10884 % 10885 % More Greek vowels with accents 10886 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}% 10887 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}% 10888 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}% 10889 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}% 10890 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}% 10891 % 10892 % Variant Greek letters 10893 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}% 10894 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}% 10895 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}% 10896 % 10897 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}% 10898 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}% 10899 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}% 10900 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}% 10901 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}% 10902 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}% 10903 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}% 10904 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}% 10905 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}% 10906 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}% 10907 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}% 10908 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}% 10909 % 10910 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}% 10911 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}% 10912 % 10913 \DeclareUnicodeCharacter{1E20}{\=G}% 10914 \DeclareUnicodeCharacter{1E21}{\=g}% 10915 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}% 10916 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}% 10917 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}% 10918 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}% 10919 \DeclareUnicodeCharacter{1E26}{\"H}% 10920 \DeclareUnicodeCharacter{1E27}{\"h}% 10921 % 10922 \DeclareUnicodeCharacter{1E30}{\'K}% 10923 \DeclareUnicodeCharacter{1E31}{\'k}% 10924 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}% 10925 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}% 10926 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}% 10927 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}% 10928 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}% 10929 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}% 10930 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}% 10931 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}% 10932 \DeclareUnicodeCharacter{1E3E}{\'M}% 10933 \DeclareUnicodeCharacter{1E3F}{\'m}% 10934 % 10935 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}% 10936 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}% 10937 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}% 10938 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}% 10939 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}% 10940 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}% 10941 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}% 10942 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}% 10943 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}% 10944 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}% 10945 % 10946 \DeclareUnicodeCharacter{1E54}{\'P}% 10947 \DeclareUnicodeCharacter{1E55}{\'p}% 10948 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}% 10949 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}% 10950 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}% 10951 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}% 10952 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}% 10953 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}% 10954 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}% 10955 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}% 10956 % 10957 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}% 10958 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}% 10959 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}% 10960 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}% 10961 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}% 10962 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}% 10963 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}% 10964 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}% 10965 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}% 10966 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}% 10967 % 10968 \DeclareUnicodeCharacter{1E7C}{\~V}% 10969 \DeclareUnicodeCharacter{1E7D}{\~v}% 10970 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}% 10971 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}% 10972 % 10973 \DeclareUnicodeCharacter{1E80}{\`W}% 10974 \DeclareUnicodeCharacter{1E81}{\`w}% 10975 \DeclareUnicodeCharacter{1E82}{\'W}% 10976 \DeclareUnicodeCharacter{1E83}{\'w}% 10977 \DeclareUnicodeCharacter{1E84}{\"W}% 10978 \DeclareUnicodeCharacter{1E85}{\"w}% 10979 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}% 10980 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}% 10981 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}% 10982 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}% 10983 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}% 10984 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}% 10985 \DeclareUnicodeCharacter{1E8C}{\"X}% 10986 \DeclareUnicodeCharacter{1E8D}{\"x}% 10987 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}% 10988 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}% 10989 % 10990 \DeclareUnicodeCharacter{1E90}{\^Z}% 10991 \DeclareUnicodeCharacter{1E91}{\^z}% 10992 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}% 10993 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}% 10994 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}% 10995 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}% 10996 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}% 10997 \DeclareUnicodeCharacter{1E97}{\"t}% 10998 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}% 10999 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}% 11000 % 11001 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}% 11002 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}% 11003 % 11004 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}% 11005 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}% 11006 \DeclareUnicodeCharacter{1EBC}{\~E}% 11007 \DeclareUnicodeCharacter{1EBD}{\~e}% 11008 % 11009 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}% 11010 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}% 11011 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}% 11012 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}% 11013 % 11014 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}% 11015 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}% 11016 % 11017 \DeclareUnicodeCharacter{1EF2}{\`Y}% 11018 \DeclareUnicodeCharacter{1EF3}{\`y}% 11019 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}% 11020 % 11021 \DeclareUnicodeCharacter{1EF8}{\~Y}% 11022 \DeclareUnicodeCharacter{1EF9}{\~y}% 11023 % 11024 % Punctuation 11025 \DeclareUnicodeCharacter{2013}{--}% 11026 \DeclareUnicodeCharacter{2014}{---}% 11027 \DeclareUnicodeCharacter{2018}{\quoteleft{}}% 11028 \DeclareUnicodeCharacter{2019}{\quoteright{}}% 11029 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}% 11030 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}% 11031 \DeclareUnicodeCharacter{201D}{\quotedblright{}}% 11032 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}% 11033 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}% 11034 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}% 11035 \DeclareUnicodeCharacter{2022}{\bullet{}}% 11036 \DeclareUnicodeCharacter{202F}{\thinspace}% 11037 \DeclareUnicodeCharacter{2026}{\dots{}}% 11038 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}% 11039 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}% 11040 % 11041 \DeclareUnicodeCharacter{20AC}{\euro{}}% 11042 % 11043 \DeclareUnicodeCharacter{2192}{\expansion{}}% 11044 \DeclareUnicodeCharacter{21D2}{\result{}}% 11045 % 11046 % Mathematical symbols 11047 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}% 11048 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}% 11049 \DeclareUnicodeCharacter{2208}{\ensuremath\in}% 11050 \DeclareUnicodeCharacter{2212}{\minus{}}% 11051 \DeclareUnicodeCharacter{2217}{\ast}% 11052 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}% 11053 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}% 11054 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}% 11055 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}% 11056 \DeclareUnicodeCharacter{2261}{\equiv{}}% 11057 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}% 11058 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}% 11059 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}% 11060 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}% 11061 % 11062 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}% 11063 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}% 11064 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}% 11065 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}% 11066 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}% 11067 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}% 11068 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}% 11069 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}% 11070 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}% 11071 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}% 11072 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}% 11073 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}% 11074 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}% 11075 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}% 11076 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}% 11077 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}% 11078 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}% 11079 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}% 11080 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}% 11081 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}% 11082 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}% 11083 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}% 11084 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}% 11085 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}% 11086 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}% 11087 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}% 11088 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}% 11089 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}% 11090 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}% 11091 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}% 11092 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}% 11093 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}% 11094 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}% 11095 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}% 11096 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}% 11097 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}% 11098 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}% 11099 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}% 11100 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}% 11101 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}% 11102 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}% 11103 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}% 11104 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}% 11105 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}% 11106 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}% 11107 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}% 11108 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}% 11109 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}% 11110 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}% 11111 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}% 11112 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}% 11113 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}% 11114 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}% 11115 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}% 11116 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}% 11117 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}% 11118 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}% 11119 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}% 11120 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}% 11121 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}% 11122 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}% 11123 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}% 11124 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}% 11125 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}% 11126 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}% 11127 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}% 11128 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}% 11129 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}% 11130 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}% 11131 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}% 11132 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}% 11133 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}% 11134 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}% 11135 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}% 11136 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}% 11137 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}% 11138 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}% 11139 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}% 11140 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}% 11141 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}% 11142 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}% 11143 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}% 11144 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}% 11145 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}% 11146 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}% 11147 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}% 11148 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}% 11149 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}% 11150 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}% 11151 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}% 11152 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}% 11153 % 11154 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}% 11155 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}% 11156 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}% 11157 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}% 11158 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}% 11159 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}% 11160 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}% 11161 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}% 11162 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}% 11163 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}% 11164 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}% 11165 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}% 11166 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}% 11167 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}% 11168 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}% 11169 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}% 11170 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}% 11171 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}% 11172 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}% 11173 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}% 11174 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}% 11175 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}% 11176 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}% 11177 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}% 11178 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}% 11179 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}% 11180 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}% 11181 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}% 11182 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}% 11183 % 11184 \global\mathchardef\checkmark="1370% actually the square root sign 11185 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}% 11186}% end of \unicodechardefs 11187 11188% UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command) 11189% It makes the setting that replace UTF-8 byte sequence. 11190\def\utfeightchardefs{% 11191 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii 11192 \unicodechardefs 11193} 11194 11195% Whether the active definitions of non-ASCII characters expand to 11196% non-active tokens with the same character code. This is used to 11197% write characters literally, instead of using active definitions for 11198% printing the correct glyphs. 11199\newif\ifpassthroughchars 11200\passthroughcharsfalse 11201 11202% For native Unicode handling (XeTeX and LuaTeX), 11203% provide a definition macro to replace/pass-through a Unicode character 11204% 11205\def\DeclareUnicodeCharacterNative#1#2{% 11206 \catcode"#1=\active 11207 \def\dodeclareunicodecharacternative##1##2##3{% 11208 \begingroup 11209 \uccode`\~="##2\relax 11210 \uppercase{\gdef~}{% 11211 \ifpassthroughchars 11212 ##1% 11213 \else 11214 ##3% 11215 \fi 11216 } 11217 \endgroup 11218 } 11219 \begingroup 11220 \uccode`\.="#1\relax 11221 \uppercase{\def\UTFNativeTmp{.}}% 11222 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}% 11223 \endgroup 11224} 11225 11226% Native Unicode handling (XeTeX and LuaTeX) character replacing definition. 11227% It activates the setting that replaces Unicode characters. 11228\def\nativeunicodechardefs{% 11229 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative 11230 \unicodechardefs 11231} 11232 11233% For native Unicode handling (XeTeX and LuaTeX), 11234% make the character token expand 11235% to the sequences given in \unicodechardefs for printing. 11236\def\DeclareUnicodeCharacterNativeAtU#1#2{% 11237 \def\UTFAtUTmp{#2} 11238 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp 11239} 11240 11241% @U command definitions for native Unicode handling (XeTeX and LuaTeX). 11242\def\nativeunicodechardefsatu{% 11243 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU 11244 \unicodechardefs 11245} 11246 11247% US-ASCII character definitions. 11248\def\asciichardefs{% nothing need be done 11249 \relax 11250} 11251 11252% Define all Unicode characters we know about. This makes UTF-8 the default 11253% input encoding and allows @U to work. 11254\iftxinativeunicodecapable 11255 \nativeunicodechardefsatu 11256\else 11257 \utfeightchardefs 11258\fi 11259 11260\message{formatting,} 11261 11262\newdimen\defaultparindent \defaultparindent = 15pt 11263 11264\chapheadingskip = 15pt plus 4pt minus 2pt 11265\secheadingskip = 12pt plus 3pt minus 2pt 11266\subsecheadingskip = 9pt plus 2pt minus 2pt 11267 11268% Prevent underfull vbox error messages. 11269\vbadness = 10000 11270 11271% Don't be very finicky about underfull hboxes, either. 11272\hbadness = 6666 11273 11274% Following George Bush, get rid of widows and orphans. 11275\widowpenalty=10000 11276\clubpenalty=10000 11277 11278% Use TeX 3.0's \emergencystretch to help line breaking, but if we're 11279% using an old version of TeX, don't do anything. We want the amount of 11280% stretch added to depend on the line length, hence the dependence on 11281% \hsize. We call this whenever the paper size is set. 11282% 11283\def\setemergencystretch{% 11284 \ifx\emergencystretch\thisisundefined 11285 % Allow us to assign to \emergencystretch anyway. 11286 \def\emergencystretch{\dimen0}% 11287 \else 11288 \emergencystretch = .15\hsize 11289 \fi 11290} 11291 11292% Parameters in order: 1) textheight; 2) textwidth; 11293% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; 11294% 7) physical page height; 8) physical page width. 11295% 11296% We also call \setleading{\textleading}, so the caller should define 11297% \textleading. The caller should also set \parskip. 11298% 11299\def\internalpagesizes#1#2#3#4#5#6#7#8{% 11300 \voffset = #3\relax 11301 \topskip = #6\relax 11302 \splittopskip = \topskip 11303 % 11304 \vsize = #1\relax 11305 \advance\vsize by \topskip 11306 \outervsize = \vsize 11307 \advance\outervsize by 2\topandbottommargin 11308 \txipageheight = \vsize 11309 % 11310 \hsize = #2\relax 11311 \outerhsize = \hsize 11312 \advance\outerhsize by 0.5in 11313 \txipagewidth = \hsize 11314 % 11315 \normaloffset = #4\relax 11316 \bindingoffset = #5\relax 11317 % 11318 \ifpdf 11319 \pdfpageheight #7\relax 11320 \pdfpagewidth #8\relax 11321 % if we don't reset these, they will remain at "1 true in" of 11322 % whatever layout pdftex was dumped with. 11323 \pdfhorigin = 1 true in 11324 \pdfvorigin = 1 true in 11325 \else 11326 \ifx\XeTeXrevision\thisisundefined 11327 \special{papersize=#8,#7}% 11328 \else 11329 \pdfpageheight #7\relax 11330 \pdfpagewidth #8\relax 11331 % XeTeX does not have \pdfhorigin and \pdfvorigin. 11332 \fi 11333 \fi 11334 % 11335 \setleading{\textleading} 11336 % 11337 \parindent = \defaultparindent 11338 \setemergencystretch 11339} 11340 11341% @letterpaper (the default). 11342\def\letterpaper{{\globaldefs = 1 11343 \parskip = 3pt plus 2pt minus 1pt 11344 \textleading = 13.2pt 11345 % 11346 % If page is nothing but text, make it come out even. 11347 \internalpagesizes{607.2pt}{6in}% that's 46 lines 11348 {\voffset}{.25in}% 11349 {\bindingoffset}{36pt}% 11350 {11in}{8.5in}% 11351}} 11352 11353% Use @smallbook to reset parameters for 7x9.25 trim size. 11354\def\smallbook{{\globaldefs = 1 11355 \parskip = 2pt plus 1pt 11356 \textleading = 12pt 11357 % 11358 \internalpagesizes{7.5in}{5in}% 11359 {-.2in}{0in}% 11360 {\bindingoffset}{16pt}% 11361 {9.25in}{7in}% 11362 % 11363 \lispnarrowing = 0.3in 11364 \tolerance = 700 11365 \contentsrightmargin = 0pt 11366 \defbodyindent = .5cm 11367}} 11368 11369% Use @smallerbook to reset parameters for 6x9 trim size. 11370% (Just testing, parameters still in flux.) 11371\def\smallerbook{{\globaldefs = 1 11372 \parskip = 1.5pt plus 1pt 11373 \textleading = 12pt 11374 % 11375 \internalpagesizes{7.4in}{4.8in}% 11376 {-.2in}{-.4in}% 11377 {0pt}{14pt}% 11378 {9in}{6in}% 11379 % 11380 \lispnarrowing = 0.25in 11381 \tolerance = 700 11382 \contentsrightmargin = 0pt 11383 \defbodyindent = .4cm 11384}} 11385 11386% Use @afourpaper to print on European A4 paper. 11387\def\afourpaper{{\globaldefs = 1 11388 \parskip = 3pt plus 2pt minus 1pt 11389 \textleading = 13.2pt 11390 % 11391 % Double-side printing via postscript on Laserjet 4050 11392 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. 11393 % To change the settings for a different printer or situation, adjust 11394 % \normaloffset until the front-side and back-side texts align. Then 11395 % do the same for \bindingoffset. You can set these for testing in 11396 % your texinfo source file like this: 11397 % @tex 11398 % \global\normaloffset = -6mm 11399 % \global\bindingoffset = 10mm 11400 % @end tex 11401 \internalpagesizes{673.2pt}{160mm}% that's 51 lines 11402 {\voffset}{\hoffset}% 11403 {\bindingoffset}{44pt}% 11404 {297mm}{210mm}% 11405 % 11406 \tolerance = 700 11407 \contentsrightmargin = 0pt 11408 \defbodyindent = 5mm 11409}} 11410 11411% Use @afivepaper to print on European A5 paper. 11412% From romildo@urano.iceb.ufop.br, 2 July 2000. 11413% He also recommends making @example and @lisp be small. 11414\def\afivepaper{{\globaldefs = 1 11415 \parskip = 2pt plus 1pt minus 0.1pt 11416 \textleading = 12.5pt 11417 % 11418 \internalpagesizes{160mm}{120mm}% 11419 {\voffset}{\hoffset}% 11420 {\bindingoffset}{8pt}% 11421 {210mm}{148mm}% 11422 % 11423 \lispnarrowing = 0.2in 11424 \tolerance = 800 11425 \contentsrightmargin = 0pt 11426 \defbodyindent = 2mm 11427 \tableindent = 12mm 11428}} 11429 11430% A specific text layout, 24x15cm overall, intended for A4 paper. 11431\def\afourlatex{{\globaldefs = 1 11432 \afourpaper 11433 \internalpagesizes{237mm}{150mm}% 11434 {\voffset}{4.6mm}% 11435 {\bindingoffset}{7mm}% 11436 {297mm}{210mm}% 11437 % 11438 % Must explicitly reset to 0 because we call \afourpaper. 11439 \globaldefs = 0 11440}} 11441 11442% Use @afourwide to print on A4 paper in landscape format. 11443\def\afourwide{{\globaldefs = 1 11444 \afourpaper 11445 \internalpagesizes{241mm}{165mm}% 11446 {\voffset}{-2.95mm}% 11447 {\bindingoffset}{7mm}% 11448 {297mm}{210mm}% 11449 \globaldefs = 0 11450}} 11451 11452\def\bsixpaper{{\globaldefs = 1 11453 \afourpaper 11454 \internalpagesizes{140mm}{100mm}% 11455 {-6.35mm}{-12.7mm}% 11456 {\bindingoffset}{14pt}% 11457 {176mm}{125mm}% 11458 \let\SETdispenvsize=\smallword 11459 \lispnarrowing = 0.2in 11460 \globaldefs = 0 11461}} 11462 11463 11464% @pagesizes TEXTHEIGHT[,TEXTWIDTH] 11465% Perhaps we should allow setting the margins, \topskip, \parskip, 11466% and/or leading, also. Or perhaps we should compute them somehow. 11467% 11468\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} 11469\def\pagesizesyyy#1,#2,#3\finish{{% 11470 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi 11471 \globaldefs = 1 11472 % 11473 \parskip = 3pt plus 2pt minus 1pt 11474 \setleading{\textleading}% 11475 % 11476 \dimen0 = #1\relax 11477 \advance\dimen0 by 2.5in % default 1in margin above heading line 11478 % and 1.5in to include heading, footing and 11479 % bottom margin 11480 % 11481 \dimen2 = \hsize 11482 \advance\dimen2 by 2in % default to 1 inch margin on each side 11483 % 11484 \internalpagesizes{#1}{\hsize}% 11485 {\voffset}{\normaloffset}% 11486 {\bindingoffset}{44pt}% 11487 {\dimen0}{\dimen2}% 11488}} 11489 11490% Set default to letter. 11491% 11492\letterpaper 11493 11494% Default value of \hfuzz, for suppressing warnings about overfull hboxes. 11495\hfuzz = 1pt 11496 11497 11498\message{and turning on texinfo input format.} 11499 11500\def^^L{\par} % remove \outer, so ^L can appear in an @comment 11501 11502% DEL is a comment character, in case @c does not suffice. 11503\catcode`\^^? = 14 11504 11505% Define macros to output various characters with catcode for normal text. 11506\catcode`\"=\other \def\normaldoublequote{"} 11507\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix 11508\catcode`\+=\other \def\normalplus{+} 11509\catcode`\<=\other \def\normalless{<} 11510\catcode`\>=\other \def\normalgreater{>} 11511\catcode`\^=\other \def\normalcaret{^} 11512\catcode`\_=\other \def\normalunderscore{_} 11513\catcode`\|=\other \def\normalverticalbar{|} 11514\catcode`\~=\other \def\normaltilde{~} 11515 11516% This macro is used to make a character print one way in \tt 11517% (where it can probably be output as-is), and another way in other fonts, 11518% where something hairier probably needs to be done. 11519% 11520% #1 is what to print if we are indeed using \tt; #2 is what to print 11521% otherwise. Since all the Computer Modern typewriter fonts have zero 11522% interword stretch (and shrink), and it is reasonable to expect all 11523% typewriter fonts to have this, we can check that font parameter. 11524% 11525\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} 11526 11527% Same as above, but check for italic font. Actually this also catches 11528% non-italic slanted fonts since it is impossible to distinguish them from 11529% italic fonts. But since this is only used by $ and it uses \sl anyway 11530% this is not a problem. 11531\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} 11532 11533% Set catcodes for Texinfo file 11534 11535% Active characters for printing the wanted glyph. 11536% Most of these we simply print from the \tt font, but for some, we can 11537% use math or other variants that look better in normal text. 11538% 11539\catcode`\"=\active 11540\def\activedoublequote{{\tt\char34}} 11541\let"=\activedoublequote 11542\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde 11543\chardef\hatchar=`\^ 11544\catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat 11545 11546\catcode`\_=\active 11547\def_{\ifusingtt\normalunderscore\_} 11548\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } 11549\let\realunder=_ 11550 11551\catcode`\|=\active \def|{{\tt\char124}} 11552 11553\chardef \less=`\< 11554\catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless 11555\chardef \gtr=`\> 11556\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr 11557\catcode`\+=\active \def+{{\tt \char 43}} 11558\catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix 11559\catcode`\-=\active \let-=\normaldash 11560 11561 11562% used for headline/footline in the output routine, in case the page 11563% breaks in the middle of an @tex block. 11564\def\texinfochars{% 11565 \let< = \activeless 11566 \let> = \activegtr 11567 \let~ = \activetilde 11568 \let^ = \activehat 11569 \setregularquotes 11570 \let\b = \strong 11571 \let\i = \smartitalic 11572 % in principle, all other definitions in \tex have to be undone too. 11573} 11574 11575% Used sometimes to turn off (effectively) the active characters even after 11576% parsing them. 11577\def\turnoffactive{% 11578 \normalturnoffactive 11579 \otherbackslash 11580} 11581 11582\catcode`\@=0 11583 11584% \backslashcurfont outputs one backslash character in current font, 11585% as in \char`\\. 11586\global\chardef\backslashcurfont=`\\ 11587 11588% \realbackslash is an actual character `\' with catcode other. 11589{\catcode`\\=\other @gdef@realbackslash{\}} 11590 11591% In Texinfo, backslash is an active character; it prints the backslash 11592% in fixed width font. 11593\catcode`\\=\active % @ for escape char from now on. 11594 11595% Print a typewriter backslash. For math mode, we can't simply use 11596% \backslashcurfont: the story here is that in math mode, the \char 11597% of \backslashcurfont ends up printing the roman \ from the math symbol 11598% font (because \char in math mode uses the \mathcode, and plain.tex 11599% sets \mathcode`\\="026E). Hence we use an explicit \mathchar, 11600% which is the decimal equivalent of "715c (class 7, e.g., use \fam; 11601% ignored family value; char position "5C). We can't use " for the 11602% usual hex value because it has already been made active. 11603 11604@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} 11605@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents. 11606 11607% \otherbackslash defines an active \ to be a literal `\' character with 11608% catcode other. 11609@gdef@otherbackslash{@let\=@realbackslash} 11610 11611% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of 11612% the literal character `\'. 11613% 11614{@catcode`- = @active 11615 @gdef@normalturnoffactive{% 11616 @passthroughcharstrue 11617 @let-=@normaldash 11618 @let"=@normaldoublequote 11619 @let$=@normaldollar %$ font-lock fix 11620 @let+=@normalplus 11621 @let<=@normalless 11622 @let>=@normalgreater 11623 @let^=@normalcaret 11624 @let_=@normalunderscore 11625 @let|=@normalverticalbar 11626 @let~=@normaltilde 11627 @let\=@ttbackslash 11628 @setregularquotes 11629 @unsepspaces 11630 } 11631} 11632 11633% If a .fmt file is being used, characters that might appear in a file 11634% name cannot be active until we have parsed the command line. 11635% So turn them off again, and have @fixbackslash turn them back on. 11636@catcode`+=@other @catcode`@_=@other 11637 11638% \enablebackslashhack - allow file to begin `\input texinfo' 11639% 11640% If a .fmt file is being used, we don't want the `\input texinfo' to show up. 11641% That is what \eatinput is for; after that, the `\' should revert to printing 11642% a backslash. 11643% If the file did not have a `\input texinfo', then it is turned off after 11644% the first line; otherwise the first `\' in the file would cause an error. 11645% This is used on the very last line of this file, texinfo.tex. 11646% We also use @c to call @fixbackslash, in case ends of lines are hidden. 11647{ 11648@catcode`@^=7 11649@catcode`@^^M=13@gdef@enablebackslashhack{% 11650 @global@let\ = @eatinput% 11651 @catcode`@^^M=13% 11652 @def@c{@fixbackslash@c}% 11653 % Definition for the newline at the end of this file. 11654 @def ^^M{@let^^M@secondlinenl}% 11655 % Definition for a newline in the main Texinfo file. 11656 @gdef @secondlinenl{@fixbackslash}% 11657 % In case the first line has a whole-line command on it 11658 @let@originalparsearg@parsearg 11659 @def@parsearg{@fixbackslash@originalparsearg} 11660}} 11661 11662{@catcode`@^=7 @catcode`@^^M=13% 11663@gdef@eatinput input texinfo#1^^M{@fixbackslash}} 11664 11665% Emergency active definition of newline, in case an active newline token 11666% appears by mistake. 11667{@catcode`@^=7 @catcode13=13% 11668@gdef@enableemergencynewline{% 11669 @gdef^^M{% 11670 @par% 11671 %<warning: active newline>@par% 11672}}} 11673 11674 11675@gdef@fixbackslash{% 11676 @ifx\@eatinput @let\ = @ttbackslash @fi 11677 @catcode13=5 % regular end of line 11678 @enableemergencynewline 11679 @let@c=@comment 11680 @let@parsearg@originalparsearg 11681 % Also turn back on active characters that might appear in the input 11682 % file name, in case not using a pre-dumped format. 11683 @catcode`+=@active 11684 @catcode`@_=@active 11685 % 11686 % If texinfo.cnf is present on the system, read it. 11687 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets 11688 % called at the beginning of every Texinfo file. Not opening texinfo.cnf 11689 % directly in this file, texinfo.tex, makes it possible to make a format 11690 % file for Texinfo. 11691 % 11692 @openin 1 texinfo.cnf 11693 @ifeof 1 @else @input texinfo.cnf @fi 11694 @closein 1 11695} 11696 11697 11698% Say @foo, not \foo, in error messages. 11699@escapechar = `@@ 11700 11701% These (along with & and #) are made active for url-breaking, so need 11702% active definitions as the normal characters. 11703@def@normaldot{.} 11704@def@normalquest{?} 11705@def@normalslash{/} 11706 11707% These look ok in all fonts, so just make them not special. 11708% @hashchar{} gets its own user-level command, because of #line. 11709@catcode`@& = @other @def@normalamp{&} 11710@catcode`@# = @other @def@normalhash{#} 11711@catcode`@% = @other @def@normalpercent{%} 11712 11713@let @hashchar = @normalhash 11714 11715@c Finally, make ` and ' active, so that txicodequoteundirected and 11716@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we 11717@c don't make ` and ' active, @code will not get them as active chars. 11718@c Do this last of all since we use ` in the previous @catcode assignments. 11719@catcode`@'=@active 11720@catcode`@`=@active 11721@setregularquotes 11722 11723@c Local variables: 11724@c eval: (add-hook 'before-save-hook 'time-stamp) 11725@c page-delimiter: "^\\\\message\\|emacs-page" 11726@c time-stamp-start: "def\\\\texinfoversion{" 11727@c time-stamp-format: "%:y-%02m-%02d.%02H" 11728@c time-stamp-end: "}" 11729@c End: 11730 11731@c vim:sw=2: 11732 11733@enablebackslashhack 11734