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-10-24.12} 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% @end foo executes the definition of \Efoo. 576% But first, it executes a specialized version of \checkenv 577% 578\parseargdef\end{% 579 \if 1\csname iscond.#1\endcsname 580 \else 581 % The general wording of \badenverr may not be ideal. 582 \expandafter\checkenv\csname#1\endcsname 583 \csname E#1\endcsname 584 \endgroup 585 \fi 586} 587 588\newhelp\EMsimple{Press RETURN to continue.} 589 590 591% Be sure we're in horizontal mode when doing a tie, since we make space 592% equivalent to this in @example-like environments. Otherwise, a space 593% at the beginning of a line will start with \penalty -- and 594% since \penalty is valid in vertical mode, we'd end up putting the 595% penalty on the vertical list instead of in the new paragraph. 596{\catcode`@ = 11 597 % Avoid using \@M directly, because that causes trouble 598 % if the definition is written into an index file. 599 \global\let\tiepenalty = \@M 600 \gdef\tie{\leavevmode\penalty\tiepenalty\ } 601} 602 603% @: forces normal size whitespace following. 604\def\:{\spacefactor=1000 } 605 606% @* forces a line break. 607\def\*{\unskip\hfil\break\hbox{}\ignorespaces} 608 609% @/ allows a line break. 610\let\/=\allowbreak 611 612% @. is an end-of-sentence period. 613\def\.{.\spacefactor=\endofsentencespacefactor\space} 614 615% @! is an end-of-sentence bang. 616\def\!{!\spacefactor=\endofsentencespacefactor\space} 617 618% @? is an end-of-sentence query. 619\def\?{?\spacefactor=\endofsentencespacefactor\space} 620 621% @frenchspacing on|off says whether to put extra space after punctuation. 622% 623\def\onword{on} 624\def\offword{off} 625% 626\parseargdef\frenchspacing{% 627 \def\temp{#1}% 628 \ifx\temp\onword \plainfrenchspacing 629 \else\ifx\temp\offword \plainnonfrenchspacing 630 \else 631 \errhelp = \EMsimple 632 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% 633 \fi\fi 634} 635 636% @w prevents a word break. Without the \leavevmode, @w at the 637% beginning of a paragraph, when TeX is still in vertical mode, would 638% produce a whole line of output instead of starting the paragraph. 639\def\w#1{\leavevmode\hbox{#1}} 640 641% @group ... @end group forces ... to be all on one page, by enclosing 642% it in a TeX vbox. We use \vtop instead of \vbox to construct the box 643% to keep its height that of a normal line. According to the rules for 644% \topskip (p.114 of the TeXbook), the glue inserted is 645% max (\topskip - \ht (first item), 0). If that height is large, 646% therefore, no glue is inserted, and the space between the headline and 647% the text is small, which looks bad. 648% 649% Another complication is that the group might be very large. This can 650% cause the glue on the previous page to be unduly stretched, because it 651% does not have much material. In this case, it's better to add an 652% explicit \vfill so that the extra space is at the bottom. The 653% threshold for doing this is if the group is more than \vfilllimit 654% percent of a page (\vfilllimit can be changed inside of @tex). 655% 656\newbox\groupbox 657\def\vfilllimit{0.7} 658% 659\envdef\group{% 660 \ifnum\catcode`\^^M=\active \else 661 \errhelp = \groupinvalidhelp 662 \errmessage{@group invalid in context where filling is enabled}% 663 \fi 664 \startsavinginserts 665 % 666 \setbox\groupbox = \vtop\bgroup 667 % Do @comment since we are called inside an environment such as 668 % @example, where each end-of-line in the input causes an 669 % end-of-line in the output. We don't want the end-of-line after 670 % the `@group' to put extra space in the output. Since @group 671 % should appear on a line by itself (according to the Texinfo 672 % manual), we don't worry about eating any user text. 673 \comment 674} 675% 676% The \vtop produces a box with normal height and large depth; thus, TeX puts 677% \baselineskip glue before it, and (when the next line of text is done) 678% \lineskip glue after it. Thus, space below is not quite equal to space 679% above. But it's pretty close. 680\def\Egroup{% 681 % To get correct interline space between the last line of the group 682 % and the first line afterwards, we have to propagate \prevdepth. 683 \endgraf % Not \par, as it may have been set to \lisppar. 684 \global\dimen1 = \prevdepth 685 \egroup % End the \vtop. 686 \addgroupbox 687 \prevdepth = \dimen1 688 \checkinserts 689} 690 691\def\addgroupbox{ 692 % \dimen0 is the vertical size of the group's box. 693 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox 694 % \dimen2 is how much space is left on the page (more or less). 695 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal 696 % if the group doesn't fit on the current page, and it's a big big 697 % group, force a page break. 698 \ifdim \dimen0 > \dimen2 699 \ifdim \pagetotal < \vfilllimit\txipageheight 700 \page 701 \fi 702 \fi 703 \box\groupbox 704} 705 706% 707% TeX puts in an \escapechar (i.e., `@') at the beginning of the help 708% message, so this ends up printing `@group can only ...'. 709% 710\newhelp\groupinvalidhelp{% 711group can only be used in environments such as @example,^^J% 712where each line of input produces a line of output.} 713 714% @need space-in-mils 715% forces a page break if there is not space-in-mils remaining. 716 717\newdimen\mil \mil=0.001in 718 719\parseargdef\need{% 720 % Ensure vertical mode, so we don't make a big box in the middle of a 721 % paragraph. 722 \par 723 % 724 % If the @need value is less than one line space, it's useless. 725 \dimen0 = #1\mil 726 \dimen2 = \ht\strutbox 727 \advance\dimen2 by \dp\strutbox 728 \ifdim\dimen0 > \dimen2 729 % 730 % Do a \strut just to make the height of this box be normal, so the 731 % normal leading is inserted relative to the preceding line. 732 % And a page break here is fine. 733 \vtop to #1\mil{\strut\vfil}% 734 % 735 % TeX does not even consider page breaks if a penalty added to the 736 % main vertical list is 10000 or more. But in order to see if the 737 % empty box we just added fits on the page, we must make it consider 738 % page breaks. On the other hand, we don't want to actually break the 739 % page after the empty box. So we use a penalty of 9999. 740 % 741 % There is an extremely small chance that TeX will actually break the 742 % page at this \penalty, if there are no other feasible breakpoints in 743 % sight. (If the user is using lots of big @group commands, which 744 % almost-but-not-quite fill up a page, TeX will have a hard time doing 745 % good page breaking, for example.) However, I could not construct an 746 % example where a page broke at this \penalty; if it happens in a real 747 % document, then we can reconsider our strategy. 748 \penalty9999 749 % 750 % Back up by the size of the box, whether we did a page break or not. 751 \kern -#1\mil 752 % 753 % Do not allow a page break right after this kern. 754 \nobreak 755 \fi 756} 757 758% @br forces paragraph break (and is undocumented). 759 760\let\br = \par 761 762% @page forces the start of a new page. 763% 764\def\page{\par\vfill\supereject} 765 766% @exdent text.... 767% outputs text on separate line in roman font, starting at standard page margin 768 769% This records the amount of indent in the innermost environment. 770% That's how much \exdent should take out. 771\newskip\exdentamount 772 773% This defn is used inside fill environments such as @defun. 774\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} 775 776% This defn is used inside nofill environments such as @example. 777\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount 778 \leftline{\hskip\leftskip{\rm#1}}}} 779 780% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current 781% paragraph. For more general purposes, use the \margin insertion 782% class. WHICH is `l' or `r'. Not documented, written for gawk manual. 783% 784\newskip\inmarginspacing \inmarginspacing=1cm 785\def\strutdepth{\dp\strutbox} 786% 787\def\doinmargin#1#2{\strut\vadjust{% 788 \nobreak 789 \kern-\strutdepth 790 \vtop to \strutdepth{% 791 \baselineskip=\strutdepth 792 \vss 793 % if you have multiple lines of stuff to put here, you'll need to 794 % make the vbox yourself of the appropriate size. 795 \ifx#1l% 796 \llap{\ignorespaces #2\hskip\inmarginspacing}% 797 \else 798 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% 799 \fi 800 \null 801 }% 802}} 803\def\inleftmargin{\doinmargin l} 804\def\inrightmargin{\doinmargin r} 805% 806% @inmargin{TEXT [, RIGHT-TEXT]} 807% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; 808% else use TEXT for both). 809% 810\def\inmargin#1{\parseinmargin #1,,\finish} 811\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. 812 \setbox0 = \hbox{\ignorespaces #2}% 813 \ifdim\wd0 > 0pt 814 \def\lefttext{#1}% have both texts 815 \def\righttext{#2}% 816 \else 817 \def\lefttext{#1}% have only one text 818 \def\righttext{#1}% 819 \fi 820 % 821 \ifodd\pageno 822 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin 823 \else 824 \def\temp{\inleftmargin\lefttext}% 825 \fi 826 \temp 827} 828 829% @include FILE -- \input text of FILE. 830% 831\def\include{\parseargusing\filenamecatcodes\includezzz} 832\def\includezzz#1{% 833 \pushthisfilestack 834 \def\thisfile{#1}% 835 {% 836 \makevalueexpandable % we want to expand any @value in FILE. 837 \turnoffactive % and allow special characters in the expansion 838 \indexnofonts % Allow `@@' and other weird things in file names. 839 \wlog{texinfo.tex: doing @include of #1^^J}% 840 \edef\temp{\noexpand\input #1 }% 841 % 842 % This trickery is to read FILE outside of a group, in case it makes 843 % definitions, etc. 844 \expandafter 845 }\temp 846 \popthisfilestack 847} 848\def\filenamecatcodes{% 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 \catcode`\'=\other 860} 861 862\def\pushthisfilestack{% 863 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm 864} 865\def\pushthisfilestackX{% 866 \expandafter\pushthisfilestackY\thisfile\StackTerm 867} 868\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% 869 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% 870} 871 872\def\popthisfilestack{\errthisfilestackempty} 873\def\errthisfilestackempty{\errmessage{Internal error: 874 the stack of filenames is empty.}} 875% 876\def\thisfile{} 877 878% @center line 879% outputs that line, centered. 880% 881\parseargdef\center{% 882 \ifhmode 883 \let\centersub\centerH 884 \else 885 \let\centersub\centerV 886 \fi 887 \centersub{\hfil \ignorespaces#1\unskip \hfil}% 888 \let\centersub\relax % don't let the definition persist, just in case 889} 890\def\centerH#1{{% 891 \hfil\break 892 \advance\hsize by -\leftskip 893 \advance\hsize by -\rightskip 894 \line{#1}% 895 \break 896}} 897% 898\newcount\centerpenalty 899\def\centerV#1{% 900 % The idea here is the same as in \startdefun, \cartouche, etc.: if 901 % @center is the first thing after a section heading, we need to wipe 902 % out the negative parskip inserted by \sectionheading, but still 903 % prevent a page break here. 904 \centerpenalty = \lastpenalty 905 \ifnum\centerpenalty>10000 \vskip\parskip \fi 906 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi 907 \line{\kern\leftskip #1\kern\rightskip}% 908} 909 910% @sp n outputs n lines of vertical space 911% 912\parseargdef\sp{\vskip #1\baselineskip} 913 914% @comment ...line which is ignored... 915% @c is the same as @comment 916% @ignore ... @end ignore is another way to write a comment 917 918 919\def\c{\begingroup \catcode`\^^M=\active% 920\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% 921\cxxx} 922{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}} 923% 924\let\comment\c 925 926% @paragraphindent NCHARS 927% We'll use ems for NCHARS, close enough. 928% NCHARS can also be the word `asis' or `none'. 929% We cannot feasibly implement @paragraphindent asis, though. 930% 931\def\asisword{asis} % no translation, these are keywords 932\def\noneword{none} 933% 934\parseargdef\paragraphindent{% 935 \def\temp{#1}% 936 \ifx\temp\asisword 937 \else 938 \ifx\temp\noneword 939 \defaultparindent = 0pt 940 \else 941 \defaultparindent = #1em 942 \fi 943 \fi 944 \parindent = \defaultparindent 945} 946 947% @exampleindent NCHARS 948% We'll use ems for NCHARS like @paragraphindent. 949% It seems @exampleindent asis isn't necessary, but 950% I preserve it to make it similar to @paragraphindent. 951\parseargdef\exampleindent{% 952 \def\temp{#1}% 953 \ifx\temp\asisword 954 \else 955 \ifx\temp\noneword 956 \lispnarrowing = 0pt 957 \else 958 \lispnarrowing = #1em 959 \fi 960 \fi 961} 962 963% @firstparagraphindent WORD 964% If WORD is `none', then suppress indentation of the first paragraph 965% after a section heading. If WORD is `insert', then do indent at such 966% paragraphs. 967% 968% The paragraph indentation is suppressed or not by calling 969% \suppressfirstparagraphindent, which the sectioning commands do. 970% We switch the definition of this back and forth according to WORD. 971% By default, we suppress indentation. 972% 973\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} 974\def\insertword{insert} 975% 976\parseargdef\firstparagraphindent{% 977 \def\temp{#1}% 978 \ifx\temp\noneword 979 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent 980 \else\ifx\temp\insertword 981 \let\suppressfirstparagraphindent = \relax 982 \else 983 \errhelp = \EMsimple 984 \errmessage{Unknown @firstparagraphindent option `\temp'}% 985 \fi\fi 986} 987 988% Here is how we actually suppress indentation. Redefine \everypar to 989% \kern backwards by \parindent, and then reset itself to empty. 990% 991% We also make \indent itself not actually do anything until the next 992% paragraph. 993% 994\gdef\dosuppressfirstparagraphindent{% 995 \gdef\indent {\restorefirstparagraphindent \indent}% 996 \gdef\noindent{\restorefirstparagraphindent \noindent}% 997 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}% 998} 999% 1000\gdef\restorefirstparagraphindent{% 1001 \global\let\indent = \ptexindent 1002 \global\let\noindent = \ptexnoindent 1003 \global\everypar = {}% 1004} 1005 1006 1007% @refill is a no-op. 1008\let\refill=\relax 1009 1010% @setfilename INFO-FILENAME - ignored 1011\let\setfilename=\comment 1012 1013% @bye. 1014\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend} 1015 1016 1017\message{pdf,} 1018% adobe `portable' document format 1019\newcount\tempnum 1020\newcount\lnkcount 1021\newtoks\filename 1022\newcount\filenamelength 1023\newcount\pgn 1024\newtoks\toksA 1025\newtoks\toksB 1026\newtoks\toksC 1027\newtoks\toksD 1028\newbox\boxA 1029\newbox\boxB 1030\newcount\countA 1031\newif\ifpdf 1032\newif\ifpdfmakepagedest 1033 1034% 1035% For LuaTeX 1036% 1037 1038\newif\iftxiuseunicodedestname 1039\txiuseunicodedestnamefalse % For pdfTeX etc. 1040 1041\ifx\luatexversion\thisisundefined 1042\else 1043 % Use Unicode destination names 1044 \txiuseunicodedestnametrue 1045 % Escape PDF strings with converting UTF-16 from UTF-8 1046 \begingroup 1047 \catcode`\%=12 1048 \directlua{ 1049 function UTF16oct(str) 1050 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377') 1051 for c in string.utfvalues(str) do 1052 if c < 0x10000 then 1053 tex.sprint( 1054 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. 1055 string.char(0x5c) .. string.char(0x25) .. '03o', 1056 math.floor(c / 256), math.floor(c % 256))) 1057 else 1058 c = c - 0x10000 1059 local c_hi = c / 1024 + 0xd800 1060 local c_lo = c % 1024 + 0xdc00 1061 tex.sprint( 1062 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. 1063 string.char(0x5c) .. string.char(0x25) .. '03o' .. 1064 string.char(0x5c) .. string.char(0x25) .. '03o' .. 1065 string.char(0x5c) .. string.char(0x25) .. '03o', 1066 math.floor(c_hi / 256), math.floor(c_hi % 256), 1067 math.floor(c_lo / 256), math.floor(c_lo % 256))) 1068 end 1069 end 1070 end 1071 } 1072 \endgroup 1073 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}} 1074 % Escape PDF strings without converting 1075 \begingroup 1076 \directlua{ 1077 function PDFescstr(str) 1078 for c in string.bytes(str) do 1079 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then 1080 tex.sprint(-2, 1081 string.format(string.char(0x5c) .. string.char(0x25) .. '03o', 1082 c)) 1083 else 1084 tex.sprint(-2, string.char(c)) 1085 end 1086 end 1087 end 1088 } 1089 % The -2 in the arguments here gives all the input to TeX catcode 12 1090 % (other) or 10 (space), preventing undefined control sequence errors. See 1091 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html 1092 % 1093 \endgroup 1094 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} 1095 \ifnum\luatexversion>84 1096 % For LuaTeX >= 0.85 1097 \def\pdfdest{\pdfextension dest} 1098 \let\pdfoutput\outputmode 1099 \def\pdfliteral{\pdfextension literal} 1100 \def\pdfcatalog{\pdfextension catalog} 1101 \def\pdftexversion{\numexpr\pdffeedback version\relax} 1102 \let\pdfximage\saveimageresource 1103 \let\pdfrefximage\useimageresource 1104 \let\pdflastximage\lastsavedimageresourceindex 1105 \def\pdfendlink{\pdfextension endlink\relax} 1106 \def\pdfoutline{\pdfextension outline} 1107 \def\pdfstartlink{\pdfextension startlink} 1108 \def\pdffontattr{\pdfextension fontattr} 1109 \def\pdfobj{\pdfextension obj} 1110 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax} 1111 \let\pdfpagewidth\pagewidth 1112 \let\pdfpageheight\pageheight 1113 \edef\pdfhorigin{\pdfvariable horigin} 1114 \edef\pdfvorigin{\pdfvariable vorigin} 1115 \fi 1116\fi 1117 1118% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 1119% can be set). So we test for \relax and 0 as well as being undefined. 1120\ifx\pdfoutput\thisisundefined 1121\else 1122 \ifx\pdfoutput\relax 1123 \else 1124 \ifcase\pdfoutput 1125 \else 1126 \pdftrue 1127 \fi 1128 \fi 1129\fi 1130 1131\newif\ifpdforxetex 1132\pdforxetexfalse 1133\ifpdf 1134 \pdforxetextrue 1135\fi 1136\ifx\XeTeXrevision\thisisundefined\else 1137 \pdforxetextrue 1138\fi 1139 1140 1141% Output page labels information. 1142% See PDF reference v.1.7 p.594, section 8.3.1. 1143\ifpdf 1144\def\pagelabels{% 1145 \def\title{0 << /P (T-) /S /D >>}% 1146 \edef\roman{\the\romancount << /S /r >>}% 1147 \edef\arabic{\the\arabiccount << /S /D >>}% 1148 % 1149 % Page label ranges must be increasing. Remove any duplicates. 1150 % (There is a slight chance of this being wrong if e.g. there is 1151 % a @contents but no @titlepage, etc.) 1152 % 1153 \ifnum\romancount=0 \def\roman{}\fi 1154 \ifnum\arabiccount=0 \def\title{}% 1155 \else 1156 \ifnum\romancount=\arabiccount \def\roman{}\fi 1157 \fi 1158 % 1159 \ifnum\romancount<\arabiccount 1160 \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax 1161 \else 1162 \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax 1163 \fi 1164} 1165\else 1166 \let\pagelabels\relax 1167\fi 1168 1169\newcount\pagecount \pagecount=0 1170\newcount\romancount \romancount=0 1171\newcount\arabiccount \arabiccount=0 1172\ifpdf 1173 \let\ptxadvancepageno\advancepageno 1174 \def\advancepageno{% 1175 \ptxadvancepageno\global\advance\pagecount by 1 1176 } 1177\fi 1178 1179 1180% PDF uses PostScript string constants for the names of xref targets, 1181% for display in the outlines, and in other places. Thus, we have to 1182% double any backslashes. Otherwise, a name like "\node" will be 1183% interpreted as a newline (\n), followed by o, d, e. Not good. 1184% 1185% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and 1186% related messages. The final outcome is that it is up to the TeX user 1187% to double the backslashes and otherwise make the string valid, so 1188% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to 1189% do this reliably, so we use it. 1190 1191% #1 is a control sequence in which to do the replacements, 1192% which we \xdef. 1193\def\txiescapepdf#1{% 1194 \ifx\pdfescapestring\thisisundefined 1195 % No primitive available; should we give a warning or log? 1196 % Many times it won't matter. 1197 \xdef#1{#1}% 1198 \else 1199 % The expandable \pdfescapestring primitive escapes parentheses, 1200 % backslashes, and other special chars. 1201 \xdef#1{\pdfescapestring{#1}}% 1202 \fi 1203} 1204\def\txiescapepdfutfsixteen#1{% 1205 \ifx\pdfescapestrutfsixteen\thisisundefined 1206 % No UTF-16 converting macro available. 1207 \txiescapepdf{#1}% 1208 \else 1209 \xdef#1{\pdfescapestrutfsixteen{#1}}% 1210 \fi 1211} 1212 1213\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images 1214with PDF output, and none of those formats could be found. (.eps cannot 1215be supported due to the design of the PDF format; use regular TeX (DVI 1216output) for that.)} 1217 1218\ifpdf 1219 % 1220 % Color manipulation macros using ideas from pdfcolor.tex, 1221 % except using rgb instead of cmyk; the latter is said to render as a 1222 % very dark gray on-screen and a very dark halftone in print, instead 1223 % of actual black. The dark red here is dark enough to print on paper as 1224 % nearly black, but still distinguishable for online viewing. We use 1225 % black by default, though. 1226 \def\rgbDarkRed{0.50 0.09 0.12} 1227 \def\rgbBlack{0 0 0} 1228 % 1229 % rg sets the color for filling (usual text, etc.); 1230 % RG sets the color for stroking (thin rules, e.g., normal _'s). 1231 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} 1232 % 1233 % Set color, and create a mark which defines \thiscolor accordingly, 1234 % so that \makeheadline knows which color to restore. 1235 \def\setcolor#1{% 1236 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% 1237 \domark 1238 \pdfsetcolor{#1}% 1239 } 1240 % 1241 \def\maincolor{\rgbBlack} 1242 \pdfsetcolor{\maincolor} 1243 \edef\thiscolor{\maincolor} 1244 \def\currentcolordefs{} 1245 % 1246 \def\makefootline{% 1247 \baselineskip24pt 1248 \line{\pdfsetcolor{\maincolor}\the\footline}% 1249 } 1250 % 1251 \def\makeheadline{% 1252 \vbox to 0pt{% 1253 \vskip-22.5pt 1254 \line{% 1255 \vbox to8.5pt{}% 1256 % Extract \thiscolor definition from the marks. 1257 \getcolormarks 1258 % Typeset the headline with \maincolor, then restore the color. 1259 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% 1260 }% 1261 \vss 1262 }% 1263 \nointerlineskip 1264 } 1265 % 1266 % 1267 \pdfcatalog{/PageMode /UseOutlines} 1268 % 1269 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). 1270 \def\dopdfimage#1#2#3{% 1271 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% 1272 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% 1273 % 1274 % pdftex (and the PDF format) support .pdf, .png, .jpg (among 1275 % others). Let's try in that order, PDF first since if 1276 % someone has a scalable image, presumably better to use that than a 1277 % bitmap. 1278 \let\pdfimgext=\empty 1279 \begingroup 1280 \openin 1 #1.pdf \ifeof 1 1281 \openin 1 #1.PDF \ifeof 1 1282 \openin 1 #1.png \ifeof 1 1283 \openin 1 #1.jpg \ifeof 1 1284 \openin 1 #1.jpeg \ifeof 1 1285 \openin 1 #1.JPG \ifeof 1 1286 \errhelp = \nopdfimagehelp 1287 \errmessage{Could not find image file #1 for pdf}% 1288 \else \gdef\pdfimgext{JPG}% 1289 \fi 1290 \else \gdef\pdfimgext{jpeg}% 1291 \fi 1292 \else \gdef\pdfimgext{jpg}% 1293 \fi 1294 \else \gdef\pdfimgext{png}% 1295 \fi 1296 \else \gdef\pdfimgext{PDF}% 1297 \fi 1298 \else \gdef\pdfimgext{pdf}% 1299 \fi 1300 \closein 1 1301 \endgroup 1302 % 1303 % without \immediate, ancient pdftex seg faults when the same image is 1304 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) 1305 \ifnum\pdftexversion < 14 1306 \immediate\pdfimage 1307 \else 1308 \immediate\pdfximage 1309 \fi 1310 \ifdim \wd0 >0pt width \pdfimagewidth \fi 1311 \ifdim \wd2 >0pt height \pdfimageheight \fi 1312 \ifnum\pdftexversion<13 1313 #1.\pdfimgext 1314 \else 1315 {#1.\pdfimgext}% 1316 \fi 1317 \ifnum\pdftexversion < 14 \else 1318 \pdfrefximage \pdflastximage 1319 \fi} 1320 % 1321 \def\setpdfdestname#1{{% 1322 % We have to set dummies so commands such as @code, and characters 1323 % such as \, aren't expanded when present in a section title. 1324 \indexnofonts 1325 \makevalueexpandable 1326 \turnoffactive 1327 \iftxiuseunicodedestname 1328 \ifx \declaredencoding \latone 1329 % Pass through Latin-1 characters. 1330 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode. 1331 \else 1332 \ifx \declaredencoding \utfeight 1333 % Pass through Unicode characters. 1334 \else 1335 % Use ASCII approximations in destination names. 1336 \passthroughcharsfalse 1337 \fi 1338 \fi 1339 \else 1340 % Use ASCII approximations in destination names. 1341 \passthroughcharsfalse 1342 \fi 1343 \def\pdfdestname{#1}% 1344 \txiescapepdf\pdfdestname 1345 }} 1346 % 1347 \def\setpdfoutlinetext#1{{% 1348 \indexnofonts 1349 \makevalueexpandable 1350 \turnoffactive 1351 \ifx \declaredencoding \latone 1352 % The PDF format can use an extended form of Latin-1 in bookmark 1353 % strings. See Appendix D of the PDF Reference, Sixth Edition, for 1354 % the "PDFDocEncoding". 1355 \passthroughcharstrue 1356 % Pass through Latin-1 characters. 1357 % LuaTeX: Convert to Unicode 1358 % pdfTeX: Use Latin-1 as PDFDocEncoding 1359 \def\pdfoutlinetext{#1}% 1360 \else 1361 \ifx \declaredencoding \utfeight 1362 \ifx\luatexversion\thisisundefined 1363 % For pdfTeX with UTF-8. 1364 % TODO: the PDF format can use UTF-16 in bookmark strings, 1365 % but the code for this isn't done yet. 1366 % Use ASCII approximations. 1367 \passthroughcharsfalse 1368 \def\pdfoutlinetext{#1}% 1369 \else 1370 % For LuaTeX with UTF-8. 1371 % Pass through Unicode characters for title texts. 1372 \passthroughcharstrue 1373 \def\pdfoutlinetext{#1}% 1374 \fi 1375 \else 1376 % For non-Latin-1 or non-UTF-8 encodings. 1377 % Use ASCII approximations. 1378 \passthroughcharsfalse 1379 \def\pdfoutlinetext{#1}% 1380 \fi 1381 \fi 1382 % LuaTeX: Convert to UTF-16 1383 % pdfTeX: Use Latin-1 as PDFDocEncoding 1384 \txiescapepdfutfsixteen\pdfoutlinetext 1385 }} 1386 % 1387 \def\pdfmkdest#1{% 1388 \setpdfdestname{#1}% 1389 \safewhatsit{\pdfdest name{\pdfdestname} xyz}% 1390 } 1391 % 1392 % used to mark target names; must be expandable. 1393 \def\pdfmkpgn#1{#1} 1394 % 1395 % by default, use black for everything. 1396 \def\urlcolor{\rgbBlack} 1397 \def\linkcolor{\rgbBlack} 1398 \def\endlink{\setcolor{\maincolor}\pdfendlink} 1399 % 1400 % Adding outlines to PDF; macros for calculating structure of outlines 1401 % come from Petr Olsak 1402 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% 1403 \else \csname#1\endcsname \fi} 1404 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax 1405 \advance\tempnum by 1 1406 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} 1407 % 1408 % #1 is the section text, which is what will be displayed in the 1409 % outline by the pdf viewer. #2 is the pdf expression for the number 1410 % of subentries (or empty, for subsubsections). #3 is the node text, 1411 % which might be empty if this toc entry had no corresponding node. 1412 % #4 is the page number 1413 % 1414 \def\dopdfoutline#1#2#3#4{% 1415 % Generate a link to the node text if that exists; else, use the 1416 % page number. We could generate a destination for the section 1417 % text in the case where a section has no node, but it doesn't 1418 % seem worth the trouble, since most documents are normally structured. 1419 \setpdfoutlinetext{#1} 1420 \setpdfdestname{#3} 1421 \ifx\pdfdestname\empty 1422 \def\pdfdestname{#4}% 1423 \fi 1424 % 1425 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% 1426 } 1427 % 1428 \def\pdfmakeoutlines{% 1429 \begingroup 1430 % Read toc silently, to get counts of subentries for \pdfoutline. 1431 \def\partentry##1##2##3##4{}% ignore parts in the outlines 1432 \def\numchapentry##1##2##3##4{% 1433 \def\thischapnum{##2}% 1434 \def\thissecnum{0}% 1435 \def\thissubsecnum{0}% 1436 }% 1437 \def\numsecentry##1##2##3##4{% 1438 \advancenumber{chap\thischapnum}% 1439 \def\thissecnum{##2}% 1440 \def\thissubsecnum{0}% 1441 }% 1442 \def\numsubsecentry##1##2##3##4{% 1443 \advancenumber{sec\thissecnum}% 1444 \def\thissubsecnum{##2}% 1445 }% 1446 \def\numsubsubsecentry##1##2##3##4{% 1447 \advancenumber{subsec\thissubsecnum}% 1448 }% 1449 \def\thischapnum{0}% 1450 \def\thissecnum{0}% 1451 \def\thissubsecnum{0}% 1452 % 1453 % use \def rather than \let here because we redefine \chapentry et 1454 % al. a second time, below. 1455 \def\appentry{\numchapentry}% 1456 \def\appsecentry{\numsecentry}% 1457 \def\appsubsecentry{\numsubsecentry}% 1458 \def\appsubsubsecentry{\numsubsubsecentry}% 1459 \def\unnchapentry{\numchapentry}% 1460 \def\unnsecentry{\numsecentry}% 1461 \def\unnsubsecentry{\numsubsecentry}% 1462 \def\unnsubsubsecentry{\numsubsubsecentry}% 1463 \readdatafile{toc}% 1464 % 1465 % Read toc second time, this time actually producing the outlines. 1466 % The `-' means take the \expnumber as the absolute number of 1467 % subentries, which we calculated on our first read of the .toc above. 1468 % 1469 % We use the node names as the destinations. 1470 % 1471 % Currently we prefix the section name with the section number 1472 % for chapter and appendix headings only in order to avoid too much 1473 % horizontal space being required in the PDF viewer. 1474 \def\numchapentry##1##2##3##4{% 1475 \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}% 1476 \def\unnchapentry##1##2##3##4{% 1477 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% 1478 \def\numsecentry##1##2##3##4{% 1479 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% 1480 \def\numsubsecentry##1##2##3##4{% 1481 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% 1482 \def\numsubsubsecentry##1##2##3##4{% count is always zero 1483 \dopdfoutline{##1}{}{##3}{##4}}% 1484 % 1485 % PDF outlines are displayed using system fonts, instead of 1486 % document fonts. Therefore we cannot use special characters, 1487 % since the encoding is unknown. For example, the eogonek from 1488 % Latin 2 (0xea) gets translated to a | character. Info from 1489 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. 1490 % 1491 % TODO this right, we have to translate 8-bit characters to 1492 % their "best" equivalent, based on the @documentencoding. Too 1493 % much work for too little return. Just use the ASCII equivalents 1494 % we use for the index sort strings. 1495 % 1496 \indexnofonts 1497 \setupdatafile 1498 % We can have normal brace characters in the PDF outlines, unlike 1499 % Texinfo index files. So set that up. 1500 \def\{{\lbracecharliteral}% 1501 \def\}{\rbracecharliteral}% 1502 \catcode`\\=\active \otherbackslash 1503 \input \tocreadfilename 1504 \endgroup 1505 } 1506 {\catcode`[=1 \catcode`]=2 1507 \catcode`{=\other \catcode`}=\other 1508 \gdef\lbracecharliteral[{]% 1509 \gdef\rbracecharliteral[}]% 1510 ] 1511 % 1512 \def\skipspaces#1{\def\PP{#1}\def\D{|}% 1513 \ifx\PP\D\let\nextsp\relax 1514 \else\let\nextsp\skipspaces 1515 \addtokens{\filename}{\PP}% 1516 \advance\filenamelength by 1 1517 \fi 1518 \nextsp} 1519 \def\getfilename#1{% 1520 \filenamelength=0 1521 % If we don't expand the argument now, \skipspaces will get 1522 % snagged on things like "@value{foo}". 1523 \edef\temp{#1}% 1524 \expandafter\skipspaces\temp|\relax 1525 } 1526 \ifnum\pdftexversion < 14 1527 \let \startlink \pdfannotlink 1528 \else 1529 \let \startlink \pdfstartlink 1530 \fi 1531 % make a live url in pdf output. 1532 \def\pdfurl#1{% 1533 \begingroup 1534 % it seems we really need yet another set of dummies; have not 1535 % tried to figure out what each command should do in the context 1536 % of @url. for now, just make @/ a no-op, that's the only one 1537 % people have actually reported a problem with. 1538 % 1539 \normalturnoffactive 1540 \def\@{@}% 1541 \let\/=\empty 1542 \makevalueexpandable 1543 % do we want to go so far as to use \indexnofonts instead of just 1544 % special-casing \var here? 1545 \def\var##1{##1}% 1546 % 1547 \leavevmode\setcolor{\urlcolor}% 1548 \startlink attr{/Border [0 0 0]}% 1549 user{/Subtype /Link /A << /S /URI /URI (#1) >>}% 1550 \endgroup} 1551 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may 1552 % be a simple number, or a list of numbers in the case of an index 1553 % entry. 1554 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} 1555 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 1556 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} 1557 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} 1558 \def\maketoks{% 1559 \expandafter\poptoks\the\toksA|ENDTOKS|\relax 1560 \ifx\first0\adn0 1561 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 1562 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 1563 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 1564 \else 1565 \ifnum0=\countA\else\makelink\fi 1566 \ifx\first.\let\next=\done\else 1567 \let\next=\maketoks 1568 \addtokens{\toksB}{\the\toksD} 1569 \ifx\first,\addtokens{\toksB}{\space}\fi 1570 \fi 1571 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 1572 \next} 1573 \def\makelink{\addtokens{\toksB}% 1574 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} 1575 \def\pdflink#1{% 1576 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} 1577 \setcolor{\linkcolor}#1\endlink} 1578 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} 1579\else 1580 % non-pdf mode 1581 \let\pdfmkdest = \gobble 1582 \let\pdfurl = \gobble 1583 \let\endlink = \relax 1584 \let\setcolor = \gobble 1585 \let\pdfsetcolor = \gobble 1586 \let\pdfmakeoutlines = \relax 1587\fi % \ifx\pdfoutput 1588 1589% 1590% For XeTeX 1591% 1592\ifx\XeTeXrevision\thisisundefined 1593\else 1594 % 1595 % XeTeX version check 1596 % 1597 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1 1598 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307. 1599 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941). 1600 % For avoiding PDF destination name replacement, we use this special 1601 % instead of xdvipdfmx's command line option `-C 0x0010'. 1602 \special{dvipdfmx:config C 0x0010} 1603 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+. 1604 % It can handle Unicode destination names for PDF. 1605 \txiuseunicodedestnametrue 1606 \else 1607 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the 1608 % `dvipdfmx:config' special. 1609 % So for avoiding PDF destination name replacement, 1610 % xdvipdfmx's command line option `-C 0x0010' is necessary. 1611 % 1612 % XeTeX < 0.99995 can not handle Unicode destination names for PDF 1613 % because xdvipdfmx 20150315 has a UTF-16 conversion issue. 1614 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). 1615 \txiuseunicodedestnamefalse 1616 \fi 1617 % 1618 % Color support 1619 % 1620 \def\rgbDarkRed{0.50 0.09 0.12} 1621 \def\rgbBlack{0 0 0} 1622 % 1623 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}} 1624 % 1625 % Set color, and create a mark which defines \thiscolor accordingly, 1626 % so that \makeheadline knows which color to restore. 1627 \def\setcolor#1{% 1628 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% 1629 \domark 1630 \pdfsetcolor{#1}% 1631 } 1632 % 1633 \def\maincolor{\rgbBlack} 1634 \pdfsetcolor{\maincolor} 1635 \edef\thiscolor{\maincolor} 1636 \def\currentcolordefs{} 1637 % 1638 \def\makefootline{% 1639 \baselineskip24pt 1640 \line{\pdfsetcolor{\maincolor}\the\footline}% 1641 } 1642 % 1643 \def\makeheadline{% 1644 \vbox to 0pt{% 1645 \vskip-22.5pt 1646 \line{% 1647 \vbox to8.5pt{}% 1648 % Extract \thiscolor definition from the marks. 1649 \getcolormarks 1650 % Typeset the headline with \maincolor, then restore the color. 1651 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% 1652 }% 1653 \vss 1654 }% 1655 \nointerlineskip 1656 } 1657 % 1658 % PDF outline support 1659 % 1660 % Emulate pdfTeX primitive 1661 \def\pdfdest name#1 xyz{% 1662 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}% 1663 } 1664 % 1665 \def\setpdfdestname#1{{% 1666 % We have to set dummies so commands such as @code, and characters 1667 % such as \, aren't expanded when present in a section title. 1668 \indexnofonts 1669 \makevalueexpandable 1670 \turnoffactive 1671 \iftxiuseunicodedestname 1672 % Pass through Unicode characters. 1673 \else 1674 % Use ASCII approximations in destination names. 1675 \passthroughcharsfalse 1676 \fi 1677 \def\pdfdestname{#1}% 1678 \txiescapepdf\pdfdestname 1679 }} 1680 % 1681 \def\setpdfoutlinetext#1{{% 1682 \turnoffactive 1683 % Always use Unicode characters in title texts. 1684 \def\pdfoutlinetext{#1}% 1685 % For XeTeX, xdvipdfmx converts to UTF-16. 1686 % So we do not convert. 1687 \txiescapepdf\pdfoutlinetext 1688 }} 1689 % 1690 \def\pdfmkdest#1{% 1691 \setpdfdestname{#1}% 1692 \safewhatsit{\pdfdest name{\pdfdestname} xyz}% 1693 } 1694 % 1695 % by default, use black for everything. 1696 \def\urlcolor{\rgbBlack} 1697 \def\linkcolor{\rgbBlack} 1698 \def\endlink{\setcolor{\maincolor}\pdfendlink} 1699 % 1700 \def\dopdfoutline#1#2#3#4{% 1701 \setpdfoutlinetext{#1} 1702 \setpdfdestname{#3} 1703 \ifx\pdfdestname\empty 1704 \def\pdfdestname{#4}% 1705 \fi 1706 % 1707 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A 1708 << /S /GoTo /D (\pdfdestname) >> >> }% 1709 } 1710 % 1711 \def\pdfmakeoutlines{% 1712 \begingroup 1713 % 1714 % For XeTeX, counts of subentries are not necessary. 1715 % Therefore, we read toc only once. 1716 % 1717 % We use node names as destinations. 1718 % 1719 % Currently we prefix the section name with the section number 1720 % for chapter and appendix headings only in order to avoid too much 1721 % horizontal space being required in the PDF viewer. 1722 \def\partentry##1##2##3##4{}% ignore parts in the outlines 1723 \def\numchapentry##1##2##3##4{% 1724 \dopdfoutline{##2 ##1}{1}{##3}{##4}}% 1725 \def\numsecentry##1##2##3##4{% 1726 \dopdfoutline{##1}{2}{##3}{##4}}% 1727 \def\numsubsecentry##1##2##3##4{% 1728 \dopdfoutline{##1}{3}{##3}{##4}}% 1729 \def\numsubsubsecentry##1##2##3##4{% 1730 \dopdfoutline{##1}{4}{##3}{##4}}% 1731 % 1732 \let\appentry\numchapentry% 1733 \let\appsecentry\numsecentry% 1734 \let\appsubsecentry\numsubsecentry% 1735 \let\appsubsubsecentry\numsubsubsecentry% 1736 \def\unnchapentry##1##2##3##4{% 1737 \dopdfoutline{##1}{1}{##3}{##4}}% 1738 \let\unnsecentry\numsecentry% 1739 \let\unnsubsecentry\numsubsecentry% 1740 \let\unnsubsubsecentry\numsubsubsecentry% 1741 % 1742 % For XeTeX, xdvipdfmx converts strings to UTF-16. 1743 % Therefore, the encoding and the language may not be considered. 1744 % 1745 \indexnofonts 1746 \setupdatafile 1747 % We can have normal brace characters in the PDF outlines, unlike 1748 % Texinfo index files. So set that up. 1749 \def\{{\lbracecharliteral}% 1750 \def\}{\rbracecharliteral}% 1751 \catcode`\\=\active \otherbackslash 1752 \input \tocreadfilename 1753 \endgroup 1754 } 1755 {\catcode`[=1 \catcode`]=2 1756 \catcode`{=\other \catcode`}=\other 1757 \gdef\lbracecharliteral[{]% 1758 \gdef\rbracecharliteral[}]% 1759 ] 1760 1761 \special{pdf:docview << /PageMode /UseOutlines >> } 1762 % ``\special{pdf:tounicode ...}'' is not necessary 1763 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it. 1764 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315, 1765 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings. 1766 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). 1767% 1768 \def\skipspaces#1{\def\PP{#1}\def\D{|}% 1769 \ifx\PP\D\let\nextsp\relax 1770 \else\let\nextsp\skipspaces 1771 \addtokens{\filename}{\PP}% 1772 \advance\filenamelength by 1 1773 \fi 1774 \nextsp} 1775 \def\getfilename#1{% 1776 \filenamelength=0 1777 % If we don't expand the argument now, \skipspaces will get 1778 % snagged on things like "@value{foo}". 1779 \edef\temp{#1}% 1780 \expandafter\skipspaces\temp|\relax 1781 } 1782 % make a live url in pdf output. 1783 \def\pdfurl#1{% 1784 \begingroup 1785 % it seems we really need yet another set of dummies; have not 1786 % tried to figure out what each command should do in the context 1787 % of @url. for now, just make @/ a no-op, that's the only one 1788 % people have actually reported a problem with. 1789 % 1790 \normalturnoffactive 1791 \def\@{@}% 1792 \let\/=\empty 1793 \makevalueexpandable 1794 % do we want to go so far as to use \indexnofonts instead of just 1795 % special-casing \var here? 1796 \def\var##1{##1}% 1797 % 1798 \leavevmode\setcolor{\urlcolor}% 1799 \special{pdf:bann << /Border [0 0 0] 1800 /Subtype /Link /A << /S /URI /URI (#1) >> >>}% 1801 \endgroup} 1802 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}} 1803 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} 1804 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 1805 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} 1806 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} 1807 \def\maketoks{% 1808 \expandafter\poptoks\the\toksA|ENDTOKS|\relax 1809 \ifx\first0\adn0 1810 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 1811 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 1812 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 1813 \else 1814 \ifnum0=\countA\else\makelink\fi 1815 \ifx\first.\let\next=\done\else 1816 \let\next=\maketoks 1817 \addtokens{\toksB}{\the\toksD} 1818 \ifx\first,\addtokens{\toksB}{\space}\fi 1819 \fi 1820 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 1821 \next} 1822 \def\makelink{\addtokens{\toksB}% 1823 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} 1824 \def\pdflink#1{% 1825 \special{pdf:bann << /Border [0 0 0] 1826 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}% 1827 \setcolor{\linkcolor}#1\endlink} 1828 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} 1829% 1830 % 1831 % @image support 1832 % 1833 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). 1834 \def\doxeteximage#1#2#3{% 1835 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% 1836 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% 1837 % 1838 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among 1839 % others). Let's try in that order, PDF first since if 1840 % someone has a scalable image, presumably better to use that than a 1841 % bitmap. 1842 \let\xeteximgext=\empty 1843 \begingroup 1844 \openin 1 #1.pdf \ifeof 1 1845 \openin 1 #1.PDF \ifeof 1 1846 \openin 1 #1.png \ifeof 1 1847 \openin 1 #1.jpg \ifeof 1 1848 \openin 1 #1.jpeg \ifeof 1 1849 \openin 1 #1.JPG \ifeof 1 1850 \errmessage{Could not find image file #1 for XeTeX}% 1851 \else \gdef\xeteximgext{JPG}% 1852 \fi 1853 \else \gdef\xeteximgext{jpeg}% 1854 \fi 1855 \else \gdef\xeteximgext{jpg}% 1856 \fi 1857 \else \gdef\xeteximgext{png}% 1858 \fi 1859 \else \gdef\xeteximgext{PDF}% 1860 \fi 1861 \else \gdef\xeteximgext{pdf}% 1862 \fi 1863 \closein 1 1864 \endgroup 1865 % 1866 \def\xetexpdfext{pdf}% 1867 \ifx\xeteximgext\xetexpdfext 1868 \XeTeXpdffile "#1".\xeteximgext "" 1869 \else 1870 \def\xetexpdfext{PDF}% 1871 \ifx\xeteximgext\xetexpdfext 1872 \XeTeXpdffile "#1".\xeteximgext "" 1873 \else 1874 \XeTeXpicfile "#1".\xeteximgext "" 1875 \fi 1876 \fi 1877 \ifdim \wd0 >0pt width \xeteximagewidth \fi 1878 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax 1879 } 1880\fi 1881 1882 1883% 1884\message{fonts,} 1885 1886% Set the baselineskip to #1, and the lineskip and strut size 1887% correspondingly. There is no deep meaning behind these magic numbers 1888% used as factors; they just match (closely enough) what Knuth defined. 1889% 1890\def\lineskipfactor{.08333} 1891\def\strutheightpercent{.70833} 1892\def\strutdepthpercent {.29167} 1893% 1894% can get a sort of poor man's double spacing by redefining this. 1895\def\baselinefactor{1} 1896% 1897\newdimen\textleading 1898\def\setleading#1{% 1899 \dimen0 = #1\relax 1900 \normalbaselineskip = \baselinefactor\dimen0 1901 \normallineskip = \lineskipfactor\normalbaselineskip 1902 \normalbaselines 1903 \setbox\strutbox =\hbox{% 1904 \vrule width0pt height\strutheightpercent\baselineskip 1905 depth \strutdepthpercent \baselineskip 1906 }% 1907} 1908 1909% PDF CMaps. See also LaTeX's t1.cmap. 1910% 1911% do nothing with this by default. 1912\expandafter\let\csname cmapOT1\endcsname\gobble 1913\expandafter\let\csname cmapOT1IT\endcsname\gobble 1914\expandafter\let\csname cmapOT1TT\endcsname\gobble 1915 1916% if we are producing pdf, and we have \pdffontattr, then define cmaps. 1917% (\pdffontattr was introduced many years ago, but people still run 1918% older pdftex's; it's easy to conditionalize, so we do.) 1919\ifpdf \ifx\pdffontattr\thisisundefined \else 1920 \begingroup 1921 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 1922 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 1923%%DocumentNeededResources: ProcSet (CIDInit) 1924%%IncludeResource: ProcSet (CIDInit) 1925%%BeginResource: CMap (TeX-OT1-0) 1926%%Title: (TeX-OT1-0 TeX OT1 0) 1927%%Version: 1.000 1928%%EndComments 1929/CIDInit /ProcSet findresource begin 193012 dict begin 1931begincmap 1932/CIDSystemInfo 1933<< /Registry (TeX) 1934/Ordering (OT1) 1935/Supplement 0 1936>> def 1937/CMapName /TeX-OT1-0 def 1938/CMapType 2 def 19391 begincodespacerange 1940<00> <7F> 1941endcodespacerange 19428 beginbfrange 1943<00> <01> <0393> 1944<09> <0A> <03A8> 1945<23> <26> <0023> 1946<28> <3B> <0028> 1947<3F> <5B> <003F> 1948<5D> <5E> <005D> 1949<61> <7A> <0061> 1950<7B> <7C> <2013> 1951endbfrange 195240 beginbfchar 1953<02> <0398> 1954<03> <039B> 1955<04> <039E> 1956<05> <03A0> 1957<06> <03A3> 1958<07> <03D2> 1959<08> <03A6> 1960<0B> <00660066> 1961<0C> <00660069> 1962<0D> <0066006C> 1963<0E> <006600660069> 1964<0F> <00660066006C> 1965<10> <0131> 1966<11> <0237> 1967<12> <0060> 1968<13> <00B4> 1969<14> <02C7> 1970<15> <02D8> 1971<16> <00AF> 1972<17> <02DA> 1973<18> <00B8> 1974<19> <00DF> 1975<1A> <00E6> 1976<1B> <0153> 1977<1C> <00F8> 1978<1D> <00C6> 1979<1E> <0152> 1980<1F> <00D8> 1981<21> <0021> 1982<22> <201D> 1983<27> <2019> 1984<3C> <00A1> 1985<3D> <003D> 1986<3E> <00BF> 1987<5C> <201C> 1988<5F> <02D9> 1989<60> <2018> 1990<7D> <02DD> 1991<7E> <007E> 1992<7F> <00A8> 1993endbfchar 1994endcmap 1995CMapName currentdict /CMap defineresource pop 1996end 1997end 1998%%EndResource 1999%%EOF 2000 }\endgroup 2001 \expandafter\edef\csname cmapOT1\endcsname#1{% 2002 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 2003 }% 2004% 2005% \cmapOT1IT 2006 \begingroup 2007 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 2008 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 2009%%DocumentNeededResources: ProcSet (CIDInit) 2010%%IncludeResource: ProcSet (CIDInit) 2011%%BeginResource: CMap (TeX-OT1IT-0) 2012%%Title: (TeX-OT1IT-0 TeX OT1IT 0) 2013%%Version: 1.000 2014%%EndComments 2015/CIDInit /ProcSet findresource begin 201612 dict begin 2017begincmap 2018/CIDSystemInfo 2019<< /Registry (TeX) 2020/Ordering (OT1IT) 2021/Supplement 0 2022>> def 2023/CMapName /TeX-OT1IT-0 def 2024/CMapType 2 def 20251 begincodespacerange 2026<00> <7F> 2027endcodespacerange 20288 beginbfrange 2029<00> <01> <0393> 2030<09> <0A> <03A8> 2031<25> <26> <0025> 2032<28> <3B> <0028> 2033<3F> <5B> <003F> 2034<5D> <5E> <005D> 2035<61> <7A> <0061> 2036<7B> <7C> <2013> 2037endbfrange 203842 beginbfchar 2039<02> <0398> 2040<03> <039B> 2041<04> <039E> 2042<05> <03A0> 2043<06> <03A3> 2044<07> <03D2> 2045<08> <03A6> 2046<0B> <00660066> 2047<0C> <00660069> 2048<0D> <0066006C> 2049<0E> <006600660069> 2050<0F> <00660066006C> 2051<10> <0131> 2052<11> <0237> 2053<12> <0060> 2054<13> <00B4> 2055<14> <02C7> 2056<15> <02D8> 2057<16> <00AF> 2058<17> <02DA> 2059<18> <00B8> 2060<19> <00DF> 2061<1A> <00E6> 2062<1B> <0153> 2063<1C> <00F8> 2064<1D> <00C6> 2065<1E> <0152> 2066<1F> <00D8> 2067<21> <0021> 2068<22> <201D> 2069<23> <0023> 2070<24> <00A3> 2071<27> <2019> 2072<3C> <00A1> 2073<3D> <003D> 2074<3E> <00BF> 2075<5C> <201C> 2076<5F> <02D9> 2077<60> <2018> 2078<7D> <02DD> 2079<7E> <007E> 2080<7F> <00A8> 2081endbfchar 2082endcmap 2083CMapName currentdict /CMap defineresource pop 2084end 2085end 2086%%EndResource 2087%%EOF 2088 }\endgroup 2089 \expandafter\edef\csname cmapOT1IT\endcsname#1{% 2090 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 2091 }% 2092% 2093% \cmapOT1TT 2094 \begingroup 2095 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 2096 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 2097%%DocumentNeededResources: ProcSet (CIDInit) 2098%%IncludeResource: ProcSet (CIDInit) 2099%%BeginResource: CMap (TeX-OT1TT-0) 2100%%Title: (TeX-OT1TT-0 TeX OT1TT 0) 2101%%Version: 1.000 2102%%EndComments 2103/CIDInit /ProcSet findresource begin 210412 dict begin 2105begincmap 2106/CIDSystemInfo 2107<< /Registry (TeX) 2108/Ordering (OT1TT) 2109/Supplement 0 2110>> def 2111/CMapName /TeX-OT1TT-0 def 2112/CMapType 2 def 21131 begincodespacerange 2114<00> <7F> 2115endcodespacerange 21165 beginbfrange 2117<00> <01> <0393> 2118<09> <0A> <03A8> 2119<21> <26> <0021> 2120<28> <5F> <0028> 2121<61> <7E> <0061> 2122endbfrange 212332 beginbfchar 2124<02> <0398> 2125<03> <039B> 2126<04> <039E> 2127<05> <03A0> 2128<06> <03A3> 2129<07> <03D2> 2130<08> <03A6> 2131<0B> <2191> 2132<0C> <2193> 2133<0D> <0027> 2134<0E> <00A1> 2135<0F> <00BF> 2136<10> <0131> 2137<11> <0237> 2138<12> <0060> 2139<13> <00B4> 2140<14> <02C7> 2141<15> <02D8> 2142<16> <00AF> 2143<17> <02DA> 2144<18> <00B8> 2145<19> <00DF> 2146<1A> <00E6> 2147<1B> <0153> 2148<1C> <00F8> 2149<1D> <00C6> 2150<1E> <0152> 2151<1F> <00D8> 2152<20> <2423> 2153<27> <2019> 2154<60> <2018> 2155<7F> <00A8> 2156endbfchar 2157endcmap 2158CMapName currentdict /CMap defineresource pop 2159end 2160end 2161%%EndResource 2162%%EOF 2163 }\endgroup 2164 \expandafter\edef\csname cmapOT1TT\endcsname#1{% 2165 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 2166 }% 2167\fi\fi 2168 2169 2170% Set the font macro #1 to the font named \fontprefix#2. 2171% #3 is the font's design size, #4 is a scale factor, #5 is the CMap 2172% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). 2173% Example: 2174% #1 = \textrm 2175% #2 = \rmshape 2176% #3 = 10 2177% #4 = \mainmagstep 2178% #5 = OT1 2179% 2180\def\setfont#1#2#3#4#5{% 2181 \font#1=\fontprefix#2#3 scaled #4 2182 \csname cmap#5\endcsname#1% 2183} 2184% This is what gets called when #5 of \setfont is empty. 2185\let\cmap\gobble 2186% 2187% (end of cmaps) 2188 2189% Use cm as the default font prefix. 2190% To specify the font prefix, you must define \fontprefix 2191% before you read in texinfo.tex. 2192\ifx\fontprefix\thisisundefined 2193\def\fontprefix{cm} 2194\fi 2195% Support font families that don't use the same naming scheme as CM. 2196\def\rmshape{r} 2197\def\rmbshape{bx} % where the normal face is bold 2198\def\bfshape{b} 2199\def\bxshape{bx} 2200\def\ttshape{tt} 2201\def\ttbshape{tt} 2202\def\ttslshape{sltt} 2203\def\itshape{ti} 2204\def\itbshape{bxti} 2205\def\slshape{sl} 2206\def\slbshape{bxsl} 2207\def\sfshape{ss} 2208\def\sfbshape{ss} 2209\def\scshape{csc} 2210\def\scbshape{csc} 2211 2212% Definitions for a main text size of 11pt. (The default in Texinfo.) 2213% 2214\def\definetextfontsizexi{% 2215% Text fonts (11.2pt, magstep1). 2216\def\textnominalsize{11pt} 2217\edef\mainmagstep{\magstephalf} 2218\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} 2219\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} 2220\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} 2221\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} 2222\setfont\textsl\slshape{10}{\mainmagstep}{OT1} 2223\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} 2224\setfont\textsc\scshape{10}{\mainmagstep}{OT1} 2225\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} 2226\font\texti=cmmi10 scaled \mainmagstep 2227\font\textsy=cmsy10 scaled \mainmagstep 2228\def\textecsize{1095} 2229 2230% A few fonts for @defun names and args. 2231\setfont\defbf\bfshape{10}{\magstep1}{OT1} 2232\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} 2233\setfont\defsl\slshape{10}{\magstep1}{OT1} 2234\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} 2235\def\df{\let\ttfont=\deftt \let\bffont = \defbf 2236\let\ttslfont=\defttsl \let\slfont=\defsl \bf} 2237 2238% Fonts for indices, footnotes, small examples (9pt). 2239\def\smallnominalsize{9pt} 2240\setfont\smallrm\rmshape{9}{1000}{OT1} 2241\setfont\smalltt\ttshape{9}{1000}{OT1TT} 2242\setfont\smallbf\bfshape{10}{900}{OT1} 2243\setfont\smallit\itshape{9}{1000}{OT1IT} 2244\setfont\smallsl\slshape{9}{1000}{OT1} 2245\setfont\smallsf\sfshape{9}{1000}{OT1} 2246\setfont\smallsc\scshape{10}{900}{OT1} 2247\setfont\smallttsl\ttslshape{10}{900}{OT1TT} 2248\font\smalli=cmmi9 2249\font\smallsy=cmsy9 2250\def\smallecsize{0900} 2251 2252% Fonts for small examples (8pt). 2253\def\smallernominalsize{8pt} 2254\setfont\smallerrm\rmshape{8}{1000}{OT1} 2255\setfont\smallertt\ttshape{8}{1000}{OT1TT} 2256\setfont\smallerbf\bfshape{10}{800}{OT1} 2257\setfont\smallerit\itshape{8}{1000}{OT1IT} 2258\setfont\smallersl\slshape{8}{1000}{OT1} 2259\setfont\smallersf\sfshape{8}{1000}{OT1} 2260\setfont\smallersc\scshape{10}{800}{OT1} 2261\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} 2262\font\smalleri=cmmi8 2263\font\smallersy=cmsy8 2264\def\smallerecsize{0800} 2265 2266% Fonts for math mode superscripts (7pt). 2267\def\sevennominalsize{7pt} 2268\setfont\sevenrm\rmshape{7}{1000}{OT1} 2269\setfont\seventt\ttshape{10}{700}{OT1TT} 2270\setfont\sevenbf\bfshape{10}{700}{OT1} 2271\setfont\sevenit\itshape{7}{1000}{OT1IT} 2272\setfont\sevensl\slshape{10}{700}{OT1} 2273\setfont\sevensf\sfshape{10}{700}{OT1} 2274\setfont\sevensc\scshape{10}{700}{OT1} 2275\setfont\seventtsl\ttslshape{10}{700}{OT1TT} 2276\font\seveni=cmmi7 2277\font\sevensy=cmsy7 2278\def\sevenecsize{0700} 2279 2280% Fonts for title page (20.4pt): 2281\def\titlenominalsize{20pt} 2282\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} 2283\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} 2284\setfont\titlesl\slbshape{10}{\magstep4}{OT1} 2285\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} 2286\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} 2287\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} 2288\let\titlebf=\titlerm 2289\setfont\titlesc\scbshape{10}{\magstep4}{OT1} 2290\font\titlei=cmmi12 scaled \magstep3 2291\font\titlesy=cmsy10 scaled \magstep4 2292\def\titleecsize{2074} 2293 2294% Chapter (and unnumbered) fonts (17.28pt). 2295\def\chapnominalsize{17pt} 2296\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} 2297\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} 2298\setfont\chapsl\slbshape{10}{\magstep3}{OT1} 2299\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} 2300\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} 2301\setfont\chapsf\sfbshape{17}{1000}{OT1} 2302\let\chapbf=\chaprm 2303\setfont\chapsc\scbshape{10}{\magstep3}{OT1} 2304\font\chapi=cmmi12 scaled \magstep2 2305\font\chapsy=cmsy10 scaled \magstep3 2306\def\chapecsize{1728} 2307 2308% Section fonts (14.4pt). 2309\def\secnominalsize{14pt} 2310\setfont\secrm\rmbshape{12}{\magstep1}{OT1} 2311\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1} 2312\setfont\secit\itbshape{10}{\magstep2}{OT1IT} 2313\setfont\secsl\slbshape{10}{\magstep2}{OT1} 2314\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} 2315\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} 2316\setfont\secsf\sfbshape{12}{\magstep1}{OT1} 2317\let\secbf\secrm 2318\setfont\secsc\scbshape{10}{\magstep2}{OT1} 2319\font\seci=cmmi12 scaled \magstep1 2320\font\secsy=cmsy10 scaled \magstep2 2321\def\sececsize{1440} 2322 2323% Subsection fonts (13.15pt). 2324\def\ssecnominalsize{13pt} 2325\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} 2326\setfont\ssecit\itbshape{10}{1315}{OT1IT} 2327\setfont\ssecsl\slbshape{10}{1315}{OT1} 2328\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} 2329\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} 2330\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} 2331\let\ssecbf\ssecrm 2332\setfont\ssecsc\scbshape{10}{1315}{OT1} 2333\font\sseci=cmmi12 scaled \magstephalf 2334\font\ssecsy=cmsy10 scaled 1315 2335\def\ssececsize{1200} 2336 2337% Reduced fonts for @acronym in text (10pt). 2338\def\reducednominalsize{10pt} 2339\setfont\reducedrm\rmshape{10}{1000}{OT1} 2340\setfont\reducedtt\ttshape{10}{1000}{OT1TT} 2341\setfont\reducedbf\bfshape{10}{1000}{OT1} 2342\setfont\reducedit\itshape{10}{1000}{OT1IT} 2343\setfont\reducedsl\slshape{10}{1000}{OT1} 2344\setfont\reducedsf\sfshape{10}{1000}{OT1} 2345\setfont\reducedsc\scshape{10}{1000}{OT1} 2346\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} 2347\font\reducedi=cmmi10 2348\font\reducedsy=cmsy10 2349\def\reducedecsize{1000} 2350 2351\textleading = 13.2pt % line spacing for 11pt CM 2352\textfonts % reset the current fonts 2353\rm 2354} % end of 11pt text font size definitions, \definetextfontsizexi 2355 2356 2357% Definitions to make the main text be 10pt Computer Modern, with 2358% section, chapter, etc., sizes following suit. This is for the GNU 2359% Press printing of the Emacs 22 manual. Maybe other manuals in the 2360% future. Used with @smallbook, which sets the leading to 12pt. 2361% 2362\def\definetextfontsizex{% 2363% Text fonts (10pt). 2364\def\textnominalsize{10pt} 2365\edef\mainmagstep{1000} 2366\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} 2367\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} 2368\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} 2369\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} 2370\setfont\textsl\slshape{10}{\mainmagstep}{OT1} 2371\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} 2372\setfont\textsc\scshape{10}{\mainmagstep}{OT1} 2373\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} 2374\font\texti=cmmi10 scaled \mainmagstep 2375\font\textsy=cmsy10 scaled \mainmagstep 2376\def\textecsize{1000} 2377 2378% A few fonts for @defun names and args. 2379\setfont\defbf\bfshape{10}{\magstephalf}{OT1} 2380\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} 2381\setfont\defsl\slshape{10}{\magstephalf}{OT1} 2382\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} 2383\def\df{\let\ttfont=\deftt \let\bffont = \defbf 2384\let\slfont=\defsl \let\ttslfont=\defttsl \bf} 2385 2386% Fonts for indices, footnotes, small examples (9pt). 2387\def\smallnominalsize{9pt} 2388\setfont\smallrm\rmshape{9}{1000}{OT1} 2389\setfont\smalltt\ttshape{9}{1000}{OT1TT} 2390\setfont\smallbf\bfshape{10}{900}{OT1} 2391\setfont\smallit\itshape{9}{1000}{OT1IT} 2392\setfont\smallsl\slshape{9}{1000}{OT1} 2393\setfont\smallsf\sfshape{9}{1000}{OT1} 2394\setfont\smallsc\scshape{10}{900}{OT1} 2395\setfont\smallttsl\ttslshape{10}{900}{OT1TT} 2396\font\smalli=cmmi9 2397\font\smallsy=cmsy9 2398\def\smallecsize{0900} 2399 2400% Fonts for small examples (8pt). 2401\def\smallernominalsize{8pt} 2402\setfont\smallerrm\rmshape{8}{1000}{OT1} 2403\setfont\smallertt\ttshape{8}{1000}{OT1TT} 2404\setfont\smallerbf\bfshape{10}{800}{OT1} 2405\setfont\smallerit\itshape{8}{1000}{OT1IT} 2406\setfont\smallersl\slshape{8}{1000}{OT1} 2407\setfont\smallersf\sfshape{8}{1000}{OT1} 2408\setfont\smallersc\scshape{10}{800}{OT1} 2409\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} 2410\font\smalleri=cmmi8 2411\font\smallersy=cmsy8 2412\def\smallerecsize{0800} 2413 2414% Fonts for math mode superscripts (7pt). 2415\def\sevennominalsize{7pt} 2416\setfont\sevenrm\rmshape{7}{1000}{OT1} 2417\setfont\seventt\ttshape{10}{700}{OT1TT} 2418\setfont\sevenbf\bfshape{10}{700}{OT1} 2419\setfont\sevenit\itshape{7}{1000}{OT1IT} 2420\setfont\sevensl\slshape{10}{700}{OT1} 2421\setfont\sevensf\sfshape{10}{700}{OT1} 2422\setfont\sevensc\scshape{10}{700}{OT1} 2423\setfont\seventtsl\ttslshape{10}{700}{OT1TT} 2424\font\seveni=cmmi7 2425\font\sevensy=cmsy7 2426\def\sevenecsize{0700} 2427 2428% Fonts for title page (20.4pt): 2429\def\titlenominalsize{20pt} 2430\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} 2431\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} 2432\setfont\titlesl\slbshape{10}{\magstep4}{OT1} 2433\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} 2434\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} 2435\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} 2436\let\titlebf=\titlerm 2437\setfont\titlesc\scbshape{10}{\magstep4}{OT1} 2438\font\titlei=cmmi12 scaled \magstep3 2439\font\titlesy=cmsy10 scaled \magstep4 2440\def\titleecsize{2074} 2441 2442% Chapter fonts (14.4pt). 2443\def\chapnominalsize{14pt} 2444\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} 2445\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} 2446\setfont\chapsl\slbshape{10}{\magstep2}{OT1} 2447\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} 2448\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} 2449\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} 2450\let\chapbf\chaprm 2451\setfont\chapsc\scbshape{10}{\magstep2}{OT1} 2452\font\chapi=cmmi12 scaled \magstep1 2453\font\chapsy=cmsy10 scaled \magstep2 2454\def\chapecsize{1440} 2455 2456% Section fonts (12pt). 2457\def\secnominalsize{12pt} 2458\setfont\secrm\rmbshape{12}{1000}{OT1} 2459\setfont\secit\itbshape{10}{\magstep1}{OT1IT} 2460\setfont\secsl\slbshape{10}{\magstep1}{OT1} 2461\setfont\sectt\ttbshape{12}{1000}{OT1TT} 2462\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} 2463\setfont\secsf\sfbshape{12}{1000}{OT1} 2464\let\secbf\secrm 2465\setfont\secsc\scbshape{10}{\magstep1}{OT1} 2466\font\seci=cmmi12 2467\font\secsy=cmsy10 scaled \magstep1 2468\def\sececsize{1200} 2469 2470% Subsection fonts (10pt). 2471\def\ssecnominalsize{10pt} 2472\setfont\ssecrm\rmbshape{10}{1000}{OT1} 2473\setfont\ssecit\itbshape{10}{1000}{OT1IT} 2474\setfont\ssecsl\slbshape{10}{1000}{OT1} 2475\setfont\ssectt\ttbshape{10}{1000}{OT1TT} 2476\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} 2477\setfont\ssecsf\sfbshape{10}{1000}{OT1} 2478\let\ssecbf\ssecrm 2479\setfont\ssecsc\scbshape{10}{1000}{OT1} 2480\font\sseci=cmmi10 2481\font\ssecsy=cmsy10 2482\def\ssececsize{1000} 2483 2484% Reduced fonts for @acronym in text (9pt). 2485\def\reducednominalsize{9pt} 2486\setfont\reducedrm\rmshape{9}{1000}{OT1} 2487\setfont\reducedtt\ttshape{9}{1000}{OT1TT} 2488\setfont\reducedbf\bfshape{10}{900}{OT1} 2489\setfont\reducedit\itshape{9}{1000}{OT1IT} 2490\setfont\reducedsl\slshape{9}{1000}{OT1} 2491\setfont\reducedsf\sfshape{9}{1000}{OT1} 2492\setfont\reducedsc\scshape{10}{900}{OT1} 2493\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} 2494\font\reducedi=cmmi9 2495\font\reducedsy=cmsy9 2496\def\reducedecsize{0900} 2497 2498\divide\parskip by 2 % reduce space between paragraphs 2499\textleading = 12pt % line spacing for 10pt CM 2500\textfonts % reset the current fonts 2501\rm 2502} % end of 10pt text font size definitions, \definetextfontsizex 2503 2504% Fonts for short table of contents. 2505\setfont\shortcontrm\rmshape{12}{1000}{OT1} 2506\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 2507\setfont\shortcontsl\slshape{12}{1000}{OT1} 2508\setfont\shortconttt\ttshape{12}{1000}{OT1TT} 2509 2510 2511% We provide the user-level command 2512% @fonttextsize 10 2513% (or 11) to redefine the text font size. pt is assumed. 2514% 2515\def\xiword{11} 2516\def\xword{10} 2517\def\xwordpt{10pt} 2518% 2519\parseargdef\fonttextsize{% 2520 \def\textsizearg{#1}% 2521 %\wlog{doing @fonttextsize \textsizearg}% 2522 % 2523 % Set \globaldefs so that documents can use this inside @tex, since 2524 % makeinfo 4.8 does not support it, but we need it nonetheless. 2525 % 2526 \begingroup \globaldefs=1 2527 \ifx\textsizearg\xword \definetextfontsizex 2528 \else \ifx\textsizearg\xiword \definetextfontsizexi 2529 \else 2530 \errhelp=\EMsimple 2531 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} 2532 \fi\fi 2533 \endgroup 2534} 2535 2536% 2537% Change the current font style to #1, remembering it in \curfontstyle. 2538% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in 2539% italics, not bold italics. 2540% 2541\def\setfontstyle#1{% 2542 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. 2543 \csname #1font\endcsname % change the current font 2544} 2545 2546\def\rm{\fam=0 \setfontstyle{rm}} 2547\def\it{\fam=\itfam \setfontstyle{it}} 2548\def\sl{\fam=\slfam \setfontstyle{sl}} 2549\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} 2550\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt} 2551 2552% Texinfo sort of supports the sans serif font style, which plain TeX does not. 2553% So we set up a \sf. 2554\newfam\sffam 2555\def\sf{\fam=\sffam \setfontstyle{sf}} 2556 2557% We don't need math for this font style. 2558\def\ttsl{\setfontstyle{ttsl}} 2559 2560 2561% In order for the font changes to affect most math symbols and letters, 2562% we have to define the \textfont of the standard families. 2563% We don't bother to reset \scriptscriptfont; awaiting user need. 2564% 2565\def\resetmathfonts{% 2566 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont 2567 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont 2568 \textfont\ttfam=\ttfont \textfont\sffam=\sffont 2569 % 2570 % Fonts for superscript. Note that the 7pt fonts are used regardless 2571 % of the current font size. 2572 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy 2573 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl 2574 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt 2575 \scriptfont\sffam=\sevensf 2576} 2577 2578% 2579 2580% The font-changing commands (all called \...fonts) redefine the meanings 2581% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs 2582% to also set the current \fam for math mode. Our \STYLE (e.g., \rm) 2583% commands hardwire \STYLEfont to set the current font. 2584% 2585% The fonts used for \ifont are for "math italics" (\itfont is for italics 2586% in regular text). \syfont is also used in math mode only. 2587% 2588% Each font-changing command also sets the names \lsize (one size lower) 2589% and \lllsize (three sizes lower). These relative commands are used 2590% in, e.g., the LaTeX logo and acronyms. 2591% 2592% This all needs generalizing, badly. 2593% 2594 2595\def\assignfonts#1{% 2596 \expandafter\let\expandafter\rmfont\csname #1rm\endcsname 2597 \expandafter\let\expandafter\itfont\csname #1it\endcsname 2598 \expandafter\let\expandafter\slfont\csname #1sl\endcsname 2599 \expandafter\let\expandafter\bffont\csname #1bf\endcsname 2600 \expandafter\let\expandafter\ttfont\csname #1tt\endcsname 2601 \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname 2602 \expandafter\let\expandafter\sffont \csname #1sf\endcsname 2603 \expandafter\let\expandafter\ifont \csname #1i\endcsname 2604 \expandafter\let\expandafter\syfont \csname #1sy\endcsname 2605 \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname 2606} 2607 2608\newif\ifrmisbold 2609 2610% Select smaller font size with the current style. Used to change font size 2611% in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for 2612% normal roman text, also use bold fonts for roman text in the smaller size. 2613\def\switchtolllsize{% 2614 \expandafter\assignfonts\expandafter{\lllsize}% 2615 \ifrmisbold 2616 \let\rmfont\bffont 2617 \fi 2618 \csname\curfontstyle\endcsname 2619}% 2620 2621\def\switchtolsize{% 2622 \expandafter\assignfonts\expandafter{\lsize}% 2623 \ifrmisbold 2624 \let\rmfont\bffont 2625 \fi 2626 \csname\curfontstyle\endcsname 2627}% 2628 2629\def\definefontsetatsize#1#2#3#4#5{% 2630\expandafter\def\csname #1fonts\endcsname{% 2631 \def\curfontsize{#1}% 2632 \def\lsize{#2}\def\lllsize{#3}% 2633 \csname rmisbold#5\endcsname 2634 \assignfonts{#1}% 2635 \resetmathfonts 2636 \setleading{#4}% 2637}} 2638 2639\definefontsetatsize{text} {reduced}{smaller}{\textleading}{false} 2640\definefontsetatsize{title} {chap} {subsec} {27pt} {true} 2641\definefontsetatsize{chap} {sec} {text} {19pt} {true} 2642\definefontsetatsize{sec} {subsec} {reduced}{17pt} {true} 2643\definefontsetatsize{ssec} {text} {small} {15pt} {true} 2644\definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false} 2645\definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false} 2646\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false} 2647 2648\def\titlefont#1{{\titlefonts\rm #1}} 2649\let\subsecfonts = \ssecfonts 2650\let\subsubsecfonts = \ssecfonts 2651 2652% Define these just so they can be easily changed for other fonts. 2653\def\angleleft{$\langle$} 2654\def\angleright{$\rangle$} 2655 2656% Set the fonts to use with the @small... environments. 2657\let\smallexamplefonts = \smallfonts 2658 2659% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample 2660% can fit this many characters: 2661% 8.5x11=86 smallbook=72 a4=90 a5=69 2662% If we use \scriptfonts (8pt), then we can fit this many characters: 2663% 8.5x11=90+ smallbook=80 a4=90+ a5=77 2664% For me, subjectively, the few extra characters that fit aren't worth 2665% the additional smallness of 8pt. So I'm making the default 9pt. 2666% 2667% By the way, for comparison, here's what fits with @example (10pt): 2668% 8.5x11=71 smallbook=60 a4=75 a5=58 2669% --karl, 24jan03. 2670 2671% Set up the default fonts, so we can use them for creating boxes. 2672% 2673\definetextfontsizexi 2674 2675 2676\message{markup,} 2677 2678% Check if we are currently using a typewriter font. Since all the 2679% Computer Modern typewriter fonts have zero interword stretch (and 2680% shrink), and it is reasonable to expect all typewriter fonts to have 2681% this property, we can check that font parameter. 2682% 2683\def\ifmonospace{\ifdim\fontdimen3\font=0pt } 2684 2685% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will 2686% define and register \INITMACRO to be called on markup style changes. 2687% \INITMACRO can check \currentmarkupstyle for the innermost 2688% style. 2689 2690\let\currentmarkupstyle\empty 2691 2692\def\setupmarkupstyle#1{% 2693 \def\currentmarkupstyle{#1}% 2694 \markupstylesetup 2695} 2696 2697\let\markupstylesetup\empty 2698 2699\def\defmarkupstylesetup#1{% 2700 \expandafter\def\expandafter\markupstylesetup 2701 \expandafter{\markupstylesetup #1}% 2702 \def#1% 2703} 2704 2705% Markup style setup for left and right quotes. 2706\defmarkupstylesetup\markupsetuplq{% 2707 \expandafter\let\expandafter \temp 2708 \csname markupsetuplq\currentmarkupstyle\endcsname 2709 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi 2710} 2711 2712\defmarkupstylesetup\markupsetuprq{% 2713 \expandafter\let\expandafter \temp 2714 \csname markupsetuprq\currentmarkupstyle\endcsname 2715 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi 2716} 2717 2718{ 2719\catcode`\'=\active 2720\catcode`\`=\active 2721 2722\gdef\markupsetuplqdefault{\let`\lq} 2723\gdef\markupsetuprqdefault{\let'\rq} 2724 2725\gdef\markupsetcodequoteleft{\let`\codequoteleft} 2726\gdef\markupsetcodequoteright{\let'\codequoteright} 2727} 2728 2729\let\markupsetuplqcode \markupsetcodequoteleft 2730\let\markupsetuprqcode \markupsetcodequoteright 2731% 2732\let\markupsetuplqexample \markupsetcodequoteleft 2733\let\markupsetuprqexample \markupsetcodequoteright 2734% 2735\let\markupsetuplqkbd \markupsetcodequoteleft 2736\let\markupsetuprqkbd \markupsetcodequoteright 2737% 2738\let\markupsetuplqsamp \markupsetcodequoteleft 2739\let\markupsetuprqsamp \markupsetcodequoteright 2740% 2741\let\markupsetuplqverb \markupsetcodequoteleft 2742\let\markupsetuprqverb \markupsetcodequoteright 2743% 2744\let\markupsetuplqverbatim \markupsetcodequoteleft 2745\let\markupsetuprqverbatim \markupsetcodequoteright 2746 2747% Allow an option to not use regular directed right quote/apostrophe 2748% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). 2749% The undirected quote is ugly, so don't make it the default, but it 2750% works for pasting with more pdf viewers (at least evince), the 2751% lilypond developers report. xpdf does work with the regular 0x27. 2752% 2753\def\codequoteright{% 2754 \ifmonospace 2755 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax 2756 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax 2757 '% 2758 \else \char'15 \fi 2759 \else \char'15 \fi 2760 \else 2761 '% 2762 \fi 2763} 2764% 2765% and a similar option for the left quote char vs. a grave accent. 2766% Modern fonts display ASCII 0x60 as a grave accent, so some people like 2767% the code environments to do likewise. 2768% 2769\def\codequoteleft{% 2770 \ifmonospace 2771 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax 2772 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax 2773 % [Knuth] pp. 380,381,391 2774 % \relax disables Spanish ligatures ?` and !` of \tt font. 2775 \relax`% 2776 \else \char'22 \fi 2777 \else \char'22 \fi 2778 \else 2779 \relax`% 2780 \fi 2781} 2782 2783% Commands to set the quote options. 2784% 2785\parseargdef\codequoteundirected{% 2786 \def\temp{#1}% 2787 \ifx\temp\onword 2788 \expandafter\let\csname SETtxicodequoteundirected\endcsname 2789 = t% 2790 \else\ifx\temp\offword 2791 \expandafter\let\csname SETtxicodequoteundirected\endcsname 2792 = \relax 2793 \else 2794 \errhelp = \EMsimple 2795 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% 2796 \fi\fi 2797} 2798% 2799\parseargdef\codequotebacktick{% 2800 \def\temp{#1}% 2801 \ifx\temp\onword 2802 \expandafter\let\csname SETtxicodequotebacktick\endcsname 2803 = t% 2804 \else\ifx\temp\offword 2805 \expandafter\let\csname SETtxicodequotebacktick\endcsname 2806 = \relax 2807 \else 2808 \errhelp = \EMsimple 2809 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% 2810 \fi\fi 2811} 2812 2813% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. 2814\def\noligaturesquoteleft{\relax\lq} 2815 2816% Count depth in font-changes, for error checks 2817\newcount\fontdepth \fontdepth=0 2818 2819% Font commands. 2820 2821% #1 is the font command (\sl or \it), #2 is the text to slant. 2822% If we are in a monospaced environment, however, 1) always use \ttsl, 2823% and 2) do not add an italic correction. 2824\def\dosmartslant#1#2{% 2825 \ifusingtt 2826 {{\ttsl #2}\let\next=\relax}% 2827 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% 2828 \next 2829} 2830\def\smartslanted{\dosmartslant\sl} 2831\def\smartitalic{\dosmartslant\it} 2832 2833% Output an italic correction unless \next (presumed to be the following 2834% character) is such as not to need one. 2835\def\smartitaliccorrection{% 2836 \ifx\next,% 2837 \else\ifx\next-% 2838 \else\ifx\next.% 2839 \else\ifx\next\.% 2840 \else\ifx\next\comma% 2841 \else\ptexslash 2842 \fi\fi\fi\fi\fi 2843 \aftersmartic 2844} 2845 2846% Unconditional use \ttsl, and no ic. @var is set to this for defuns. 2847\def\ttslanted#1{{\ttsl #1}} 2848 2849% @cite is like \smartslanted except unconditionally use \sl. We never want 2850% ttsl for book titles, do we? 2851\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} 2852 2853\def\aftersmartic{} 2854\def\var#1{% 2855 \let\saveaftersmartic = \aftersmartic 2856 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% 2857 \smartslanted{#1}% 2858} 2859 2860\let\i=\smartitalic 2861\let\slanted=\smartslanted 2862\let\dfn=\smartslanted 2863\let\emph=\smartitalic 2864 2865% Explicit font changes: @r, @sc, undocumented @ii. 2866\def\r#1{{\rm #1}} % roman font 2867\def\sc#1{{\smallcaps#1}} % smallcaps font 2868\def\ii#1{{\it #1}} % italic font 2869 2870% @b, explicit bold. Also @strong. 2871\def\b#1{{\bf #1}} 2872\let\strong=\b 2873 2874% @sansserif, explicit sans. 2875\def\sansserif#1{{\sf #1}} 2876 2877% We can't just use \exhyphenpenalty, because that only has effect at 2878% the end of a paragraph. Restore normal hyphenation at the end of the 2879% group within which \nohyphenation is presumably called. 2880% 2881\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} 2882\def\restorehyphenation{\hyphenchar\font = `- } 2883 2884% Set sfcode to normal for the chars that usually have another value. 2885% Can't use plain's \frenchspacing because it uses the `\x notation, and 2886% sometimes \x has an active definition that messes things up. 2887% 2888\catcode`@=11 2889 \def\plainfrenchspacing{% 2890 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m 2891 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m 2892 \def\endofsentencespacefactor{1000}% for @. and friends 2893 } 2894 \def\plainnonfrenchspacing{% 2895 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 2896 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 2897 \def\endofsentencespacefactor{3000}% for @. and friends 2898 } 2899\catcode`@=\other 2900\def\endofsentencespacefactor{3000}% default 2901 2902% @t, explicit typewriter. 2903\def\t#1{% 2904 {\tt \plainfrenchspacing #1}% 2905 \null 2906} 2907 2908% @samp. 2909\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} 2910 2911% @indicateurl is \samp, that is, with quotes. 2912\let\indicateurl=\samp 2913 2914% @code (and similar) prints in typewriter, but with spaces the same 2915% size as normal in the surrounding text, without hyphenation, etc. 2916% This is a subroutine for that. 2917\def\tclose#1{% 2918 {% 2919 % Change normal interword space to be same as for the current font. 2920 \spaceskip = \fontdimen2\font 2921 % 2922 % Switch to typewriter. 2923 \tt 2924 % 2925 % But `\ ' produces the large typewriter interword space. 2926 \def\ {{\spaceskip = 0pt{} }}% 2927 % 2928 % Turn off hyphenation. 2929 \nohyphenation 2930 % 2931 \plainfrenchspacing 2932 #1% 2933 }% 2934 \null % reset spacefactor to 1000 2935} 2936 2937% We *must* turn on hyphenation at `-' and `_' in @code. 2938% (But see \codedashfinish below.) 2939% Otherwise, it is too hard to avoid overfull hboxes 2940% in the Emacs manual, the Library manual, etc. 2941% 2942% Unfortunately, TeX uses one parameter (\hyphenchar) to control 2943% both hyphenation at - and hyphenation within words. 2944% We must therefore turn them both off (\tclose does that) 2945% and arrange explicitly to hyphenate at a dash. -- rms. 2946{ 2947 \catcode`\-=\active \catcode`\_=\active 2948 \catcode`\'=\active \catcode`\`=\active 2949 \global\let'=\rq \global\let`=\lq % default definitions 2950 % 2951 \global\def\code{\begingroup 2952 \setupmarkupstyle{code}% 2953 % The following should really be moved into \setupmarkupstyle handlers. 2954 \catcode\dashChar=\active \catcode\underChar=\active 2955 \ifallowcodebreaks 2956 \let-\codedash 2957 \let_\codeunder 2958 \else 2959 \let-\normaldash 2960 \let_\realunder 2961 \fi 2962 % Given -foo (with a single dash), we do not want to allow a break 2963 % after the hyphen. 2964 \global\let\codedashprev=\codedash 2965 % 2966 \codex 2967 } 2968 % 2969 \gdef\codedash{\futurelet\next\codedashfinish} 2970 \gdef\codedashfinish{% 2971 \normaldash % always output the dash character itself. 2972 % 2973 % Now, output a discretionary to allow a line break, unless 2974 % (a) the next character is a -, or 2975 % (b) the preceding character is a -. 2976 % E.g., given --posix, we do not want to allow a break after either -. 2977 % Given --foo-bar, we do want to allow a break between the - and the b. 2978 \ifx\next\codedash \else 2979 \ifx\codedashprev\codedash 2980 \else \discretionary{}{}{}\fi 2981 \fi 2982 % we need the space after the = for the case when \next itself is a 2983 % space token; it would get swallowed otherwise. As in @code{- a}. 2984 \global\let\codedashprev= \next 2985 } 2986} 2987\def\normaldash{-} 2988% 2989\def\codex #1{\tclose{#1}\endgroup} 2990 2991\def\codeunder{% 2992 % this is all so @math{@code{var_name}+1} can work. In math mode, _ 2993 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) 2994 % will therefore expand the active definition of _, which is us 2995 % (inside @code that is), therefore an endless loop. 2996 \ifusingtt{\ifmmode 2997 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. 2998 \else\normalunderscore \fi 2999 \discretionary{}{}{}}% 3000 {\_}% 3001} 3002 3003% An additional complication: the above will allow breaks after, e.g., 3004% each of the four underscores in __typeof__. This is bad. 3005% @allowcodebreaks provides a document-level way to turn breaking at - 3006% and _ on and off. 3007% 3008\newif\ifallowcodebreaks \allowcodebreakstrue 3009 3010\def\keywordtrue{true} 3011\def\keywordfalse{false} 3012 3013\parseargdef\allowcodebreaks{% 3014 \def\txiarg{#1}% 3015 \ifx\txiarg\keywordtrue 3016 \allowcodebreakstrue 3017 \else\ifx\txiarg\keywordfalse 3018 \allowcodebreaksfalse 3019 \else 3020 \errhelp = \EMsimple 3021 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% 3022 \fi\fi 3023} 3024 3025% For @command, @env, @file, @option quotes seem unnecessary, 3026% so use \code rather than \samp. 3027\let\command=\code 3028\let\env=\code 3029\let\file=\code 3030\let\option=\code 3031 3032% @uref (abbreviation for `urlref') aka @url takes an optional 3033% (comma-separated) second argument specifying the text to display and 3034% an optional third arg as text to display instead of (rather than in 3035% addition to) the url itself. First (mandatory) arg is the url. 3036 3037% TeX-only option to allow changing PDF output to show only the second 3038% arg (if given), and not the url (which is then just the link target). 3039\newif\ifurefurlonlylink 3040 3041% The default \pretolerance setting stops the penalty inserted in 3042% \urefallowbreak being a discouragement to line breaking. Set it to 3043% a negative value for this paragraph only. Hopefully this does not 3044% conflict with redefinitions of \par done elsewhere. 3045\def\nopretolerance{% 3046\pretolerance=-1 3047\def\par{\endgraf\pretolerance=100 \let\par\endgraf}% 3048} 3049 3050% The main macro is \urefbreak, which allows breaking at expected 3051% places within the url. 3052\def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak} 3053\let\uref=\urefbreak 3054% 3055\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} 3056\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example 3057 \unsepspaces 3058 \pdfurl{#1}% 3059 \setbox0 = \hbox{\ignorespaces #3}% 3060 \ifdim\wd0 > 0pt 3061 \unhbox0 % third arg given, show only that 3062 \else 3063 \setbox0 = \hbox{\ignorespaces #2}% look for second arg 3064 \ifdim\wd0 > 0pt 3065 \ifpdf 3066 % For pdfTeX and LuaTeX 3067 \ifurefurlonlylink 3068 % PDF plus option to not display url, show just arg 3069 \unhbox0 3070 \else 3071 % PDF, normally display both arg and url for consistency, 3072 % visibility, if the pdf is eventually used to print, etc. 3073 \unhbox0\ (\urefcode{#1})% 3074 \fi 3075 \else 3076 \ifx\XeTeXrevision\thisisundefined 3077 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url 3078 \else 3079 % For XeTeX 3080 \ifurefurlonlylink 3081 % PDF plus option to not display url, show just arg 3082 \unhbox0 3083 \else 3084 % PDF, normally display both arg and url for consistency, 3085 % visibility, if the pdf is eventually used to print, etc. 3086 \unhbox0\ (\urefcode{#1})% 3087 \fi 3088 \fi 3089 \fi 3090 \else 3091 \urefcode{#1}% only url given, so show it 3092 \fi 3093 \fi 3094 \endlink 3095\endgroup} 3096 3097% Allow line breaks around only a few characters (only). 3098\def\urefcatcodes{% 3099 \catcode`\&=\active \catcode`\.=\active 3100 \catcode`\#=\active \catcode`\?=\active 3101 \catcode`\/=\active 3102} 3103{ 3104 \urefcatcodes 3105 % 3106 \global\def\urefcode{\begingroup 3107 \setupmarkupstyle{code}% 3108 \urefcatcodes 3109 \let&\urefcodeamp 3110 \let.\urefcodedot 3111 \let#\urefcodehash 3112 \let?\urefcodequest 3113 \let/\urefcodeslash 3114 \codex 3115 } 3116 % 3117 % By default, they are just regular characters. 3118 \global\def&{\normalamp} 3119 \global\def.{\normaldot} 3120 \global\def#{\normalhash} 3121 \global\def?{\normalquest} 3122 \global\def/{\normalslash} 3123} 3124 3125\def\urefcodeamp{\urefprebreak \&\urefpostbreak} 3126\def\urefcodedot{\urefprebreak .\urefpostbreak} 3127\def\urefcodehash{\urefprebreak \#\urefpostbreak} 3128\def\urefcodequest{\urefprebreak ?\urefpostbreak} 3129\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} 3130{ 3131 \catcode`\/=\active 3132 \global\def\urefcodeslashfinish{% 3133 \urefprebreak \slashChar 3134 % Allow line break only after the final / in a sequence of 3135 % slashes, to avoid line break between the slashes in http://. 3136 \ifx\next/\else \urefpostbreak \fi 3137 } 3138} 3139 3140% By default we'll break after the special characters, but some people like to 3141% break before the special chars, so allow that. Also allow no breaking at 3142% all, for manual control. 3143% 3144\parseargdef\urefbreakstyle{% 3145 \def\txiarg{#1}% 3146 \ifx\txiarg\wordnone 3147 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} 3148 \else\ifx\txiarg\wordbefore 3149 \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak} 3150 \else\ifx\txiarg\wordafter 3151 \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak} 3152 \else 3153 \errhelp = \EMsimple 3154 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% 3155 \fi\fi\fi 3156} 3157\def\wordafter{after} 3158\def\wordbefore{before} 3159\def\wordnone{none} 3160 3161% Allow a ragged right output to aid breaking long URL's. There can 3162% be a break at the \allowbreak with no extra glue (if the existing stretch in 3163% the line is sufficient), a break at the \penalty with extra glue added 3164% at the end of the line, or no break at all here. 3165% Changing the value of the penalty and/or the amount of stretch affects how 3166% preferable one choice is over the other. 3167\def\urefallowbreak{% 3168 \penalty0\relax 3169 \hskip 0pt plus 2 em\relax 3170 \penalty1000\relax 3171 \hskip 0pt plus -2 em\relax 3172} 3173 3174\urefbreakstyle after 3175 3176% @url synonym for @uref, since that's how everyone uses it. 3177% 3178\let\url=\uref 3179 3180% rms does not like angle brackets --karl, 17may97. 3181% So now @email is just like @uref, unless we are pdf. 3182% 3183%\def\email#1{\angleleft{\tt #1}\angleright} 3184\ifpdforxetex 3185 \def\email#1{\doemail#1,,\finish} 3186 \def\doemail#1,#2,#3\finish{\begingroup 3187 \unsepspaces 3188 \pdfurl{mailto:#1}% 3189 \setbox0 = \hbox{\ignorespaces #2}% 3190 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi 3191 \endlink 3192 \endgroup} 3193\else 3194 \let\email=\uref 3195\fi 3196 3197% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), 3198% `example' (@kbd uses ttsl only inside of @example and friends), 3199% or `code' (@kbd uses normal tty font always). 3200\parseargdef\kbdinputstyle{% 3201 \def\txiarg{#1}% 3202 \ifx\txiarg\worddistinct 3203 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% 3204 \else\ifx\txiarg\wordexample 3205 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% 3206 \else\ifx\txiarg\wordcode 3207 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% 3208 \else 3209 \errhelp = \EMsimple 3210 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% 3211 \fi\fi\fi 3212} 3213\def\worddistinct{distinct} 3214\def\wordexample{example} 3215\def\wordcode{code} 3216 3217% Default is `distinct'. 3218\kbdinputstyle distinct 3219 3220% @kbd is like @code, except that if the argument is just one @key command, 3221% then @kbd has no effect. 3222\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}} 3223 3224\def\xkey{\key} 3225\def\kbdsub#1#2#3\par{% 3226 \def\one{#1}\def\three{#3}\def\threex{??}% 3227 \ifx\one\xkey\ifx\threex\three \key{#2}% 3228 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi 3229 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi 3230} 3231 3232% definition of @key that produces a lozenge. Doesn't adjust to text size. 3233%\setfont\keyrm\rmshape{8}{1000}{OT1} 3234%\font\keysy=cmsy9 3235%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% 3236% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% 3237% \vbox{\hrule\kern-0.4pt 3238% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% 3239% \kern-0.4pt\hrule}% 3240% \kern-.06em\raise0.4pt\hbox{\angleright}}}} 3241 3242% definition of @key with no lozenge. If the current font is already 3243% monospace, don't change it; that way, we respect @kbdinputstyle. But 3244% if it isn't monospace, then use \tt. 3245% 3246\def\key#1{{\setupmarkupstyle{key}% 3247 \nohyphenation 3248 \ifmonospace\else\tt\fi 3249 #1}\null} 3250 3251% @clicksequence{File @click{} Open ...} 3252\def\clicksequence#1{\begingroup #1\endgroup} 3253 3254% @clickstyle @arrow (by default) 3255\parseargdef\clickstyle{\def\click{#1}} 3256\def\click{\arrow} 3257 3258% Typeset a dimension, e.g., `in' or `pt'. The only reason for the 3259% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. 3260% 3261\def\dmn#1{\thinspace #1} 3262 3263% @acronym for "FBI", "NATO", and the like. 3264% We print this one point size smaller, since it's intended for 3265% all-uppercase. 3266% 3267\def\acronym#1{\doacronym #1,,\finish} 3268\def\doacronym#1,#2,#3\finish{% 3269 {\switchtolsize #1}% 3270 \def\temp{#2}% 3271 \ifx\temp\empty \else 3272 \space ({\unsepspaces \ignorespaces \temp \unskip})% 3273 \fi 3274 \null % reset \spacefactor=1000 3275} 3276 3277% @abbr for "Comput. J." and the like. 3278% No font change, but don't do end-of-sentence spacing. 3279% 3280\def\abbr#1{\doabbr #1,,\finish} 3281\def\doabbr#1,#2,#3\finish{% 3282 {\plainfrenchspacing #1}% 3283 \def\temp{#2}% 3284 \ifx\temp\empty \else 3285 \space ({\unsepspaces \ignorespaces \temp \unskip})% 3286 \fi 3287 \null % reset \spacefactor=1000 3288} 3289 3290% @asis just yields its argument. Used with @table, for example. 3291% 3292\def\asis#1{#1} 3293 3294% @math outputs its argument in math mode. 3295% 3296% One complication: _ usually means subscripts, but it could also mean 3297% an actual _ character, as in @math{@var{some_variable} + 1}. So make 3298% _ active, and distinguish by seeing if the current family is \slfam, 3299% which is what @var uses. 3300{ 3301 \catcode`\_ = \active 3302 \gdef\mathunderscore{% 3303 \catcode`\_=\active 3304 \def_{\ifnum\fam=\slfam \_\else\sb\fi}% 3305 } 3306} 3307% Another complication: we want \\ (and @\) to output a math (or tt) \. 3308% FYI, plain.tex uses \\ as a temporary control sequence (for no 3309% particular reason), but this is not advertised and we don't care. 3310% 3311% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. 3312\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} 3313% 3314\def\math{% 3315 \ifmmode\else % only go into math if not in math mode already 3316 \tex 3317 \mathunderscore 3318 \let\\ = \mathbackslash 3319 \mathactive 3320 % make the texinfo accent commands work in math mode 3321 \let\"=\ddot 3322 \let\'=\acute 3323 \let\==\bar 3324 \let\^=\hat 3325 \let\`=\grave 3326 \let\u=\breve 3327 \let\v=\check 3328 \let\~=\tilde 3329 \let\dotaccent=\dot 3330 % have to provide another name for sup operator 3331 \let\mathopsup=\sup 3332 $\expandafter\finishmath\fi 3333} 3334\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. 3335 3336% Some active characters (such as <) are spaced differently in math. 3337% We have to reset their definitions in case the @math was an argument 3338% to a command which sets the catcodes (such as @item or @section). 3339% 3340{ 3341 \catcode`^ = \active 3342 \catcode`< = \active 3343 \catcode`> = \active 3344 \catcode`+ = \active 3345 \catcode`' = \active 3346 \gdef\mathactive{% 3347 \let^ = \ptexhat 3348 \let< = \ptexless 3349 \let> = \ptexgtr 3350 \let+ = \ptexplus 3351 \let' = \ptexquoteright 3352 } 3353} 3354 3355% for @sub and @sup, if in math mode, just do a normal sub/superscript. 3356% If in text, use math to place as sub/superscript, but switch 3357% into text mode, with smaller fonts. This is a different font than the 3358% one used for real math sub/superscripts (8pt vs. 7pt), but let's not 3359% fix it (significant additions to font machinery) until someone notices. 3360% 3361\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi} 3362\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}% 3363% 3364\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi} 3365\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}% 3366 3367% provide this command from LaTeX as it is very common 3368\def\frac#1#2{{{#1}\over{#2}}} 3369 3370% @displaymath. 3371% \globaldefs is needed to recognize the end lines in \tex and 3372% \end tex. Set \thisenv as @end displaymath is seen before @end tex. 3373{\obeylines 3374\globaldefs=1 3375\envdef\displaymath{% 3376\tex 3377\def\thisenv{\displaymath}% 3378$$% 3379} 3380 3381\def\Edisplaymath{$$ 3382\def\thisenv{\tex}% 3383\end tex 3384}} 3385 3386% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. 3387% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, 3388% except specified as a normal braced arg, so no newlines to worry about. 3389% 3390\def\outfmtnametex{tex} 3391% 3392\long\def\inlinefmt#1{\doinlinefmt #1,\finish} 3393\long\def\doinlinefmt#1,#2,\finish{% 3394 \def\inlinefmtname{#1}% 3395 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi 3396} 3397% 3398% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if 3399% FMTNAME is tex, else ELSE-TEXT. 3400\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish} 3401\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{% 3402 \def\inlinefmtname{#1}% 3403 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi 3404} 3405% 3406% For raw, must switch into @tex before parsing the argument, to avoid 3407% setting catcodes prematurely. Doing it this way means that, for 3408% example, @inlineraw{html, foo{bar} gets a parse error instead of being 3409% ignored. But this isn't important because if people want a literal 3410% *right* brace they would have to use a command anyway, so they may as 3411% well use a command to get a left brace too. We could re-use the 3412% delimiter character idea from \verb, but it seems like overkill. 3413% 3414\long\def\inlineraw{\tex \doinlineraw} 3415\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} 3416\def\doinlinerawtwo#1,#2,\finish{% 3417 \def\inlinerawname{#1}% 3418 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi 3419 \endgroup % close group opened by \tex. 3420} 3421 3422% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set. 3423% 3424\long\def\inlineifset#1{\doinlineifset #1,\finish} 3425\long\def\doinlineifset#1,#2,\finish{% 3426 \def\inlinevarname{#1}% 3427 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax 3428 \else\ignorespaces#2\fi 3429} 3430 3431% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set. 3432% 3433\long\def\inlineifclear#1{\doinlineifclear #1,\finish} 3434\long\def\doinlineifclear#1,#2,\finish{% 3435 \def\inlinevarname{#1}% 3436 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi 3437} 3438 3439 3440\message{glyphs,} 3441% and logos. 3442 3443% @@ prints an @, as does @atchar{}. 3444\def\@{\char64 } 3445\let\atchar=\@ 3446 3447% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. 3448\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}} 3449\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}} 3450\let\{=\lbracechar 3451\let\}=\rbracechar 3452 3453% @comma{} to avoid , parsing problems. 3454\let\comma = , 3455 3456% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent 3457% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. 3458\let\, = \ptexc 3459\let\dotaccent = \ptexdot 3460\def\ringaccent#1{{\accent23 #1}} 3461\let\tieaccent = \ptext 3462\let\ubaraccent = \ptexb 3463\let\udotaccent = \d 3464 3465% Other special characters: @questiondown @exclamdown @ordf @ordm 3466% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. 3467\def\questiondown{?`} 3468\def\exclamdown{!`} 3469\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}} 3470\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}} 3471 3472% Dotless i and dotless j, used for accents. 3473\def\imacro{i} 3474\def\jmacro{j} 3475\def\dotless#1{% 3476 \def\temp{#1}% 3477 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi 3478 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi 3479 \else \errmessage{@dotless can be used only with i or j}% 3480 \fi\fi 3481} 3482 3483% The \TeX{} logo, as in plain, but resetting the spacing so that a 3484% period following counts as ending a sentence. (Idea found in latex.) 3485% 3486\edef\TeX{\TeX \spacefactor=1000 } 3487 3488% @LaTeX{} logo. Not quite the same results as the definition in 3489% latex.ltx, since we use a different font for the raised A; it's most 3490% convenient for us to use an explicitly smaller font, rather than using 3491% the \scriptstyle font (since we don't reset \scriptstyle and 3492% \scriptscriptstyle). 3493% 3494\def\LaTeX{% 3495 L\kern-.36em 3496 {\setbox0=\hbox{T}% 3497 \vbox to \ht0{\hbox{% 3498 \ifx\textnominalsize\xwordpt 3499 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX. 3500 % Revert to plain's \scriptsize, which is 7pt. 3501 \count255=\the\fam $\fam\count255 \scriptstyle A$% 3502 \else 3503 % For 11pt, we can use our lllsize. 3504 \switchtolllsize A% 3505 \fi 3506 }% 3507 \vss 3508 }}% 3509 \kern-.15em 3510 \TeX 3511} 3512 3513% Some math mode symbols. Define \ensuremath to switch into math mode 3514% unless we are already there. Expansion tricks may not be needed here, 3515% but safer, and can't hurt. 3516\def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi} 3517\def\ensuredmath#1{$\relax#1$} 3518% 3519\def\bullet{\ensuremath\ptexbullet} 3520\def\geq{\ensuremath\ge} 3521\def\leq{\ensuremath\le} 3522\def\minus{\ensuremath-} 3523 3524% @dots{} outputs an ellipsis using the current font. 3525% We do .5em per period so that it has the same spacing in the cm 3526% typewriter fonts as three actual period characters; on the other hand, 3527% in other typewriter fonts three periods are wider than 1.5em. So do 3528% whichever is larger. 3529% 3530\def\dots{% 3531 \leavevmode 3532 \setbox0=\hbox{...}% get width of three periods 3533 \ifdim\wd0 > 1.5em 3534 \dimen0 = \wd0 3535 \else 3536 \dimen0 = 1.5em 3537 \fi 3538 \hbox to \dimen0{% 3539 \hskip 0pt plus.25fil 3540 .\hskip 0pt plus1fil 3541 .\hskip 0pt plus1fil 3542 .\hskip 0pt plus.5fil 3543 }% 3544} 3545 3546% @enddots{} is an end-of-sentence ellipsis. 3547% 3548\def\enddots{% 3549 \dots 3550 \spacefactor=\endofsentencespacefactor 3551} 3552 3553% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. 3554% 3555% Since these characters are used in examples, they should be an even number of 3556% \tt widths. Each \tt character is 1en, so two makes it 1em. 3557% 3558\def\point{$\star$} 3559\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} 3560\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} 3561\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} 3562\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} 3563\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} 3564 3565% The @error{} command. 3566% Adapted from the TeXbook's \boxit. 3567% 3568\newbox\errorbox 3569% 3570{\ttfont \global\dimen0 = 3em}% Width of the box. 3571\dimen2 = .55pt % Thickness of rules 3572% The text. (`r' is open on the right, `e' somewhat less so on the left.) 3573\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} 3574% 3575\setbox\errorbox=\hbox to \dimen0{\hfil 3576 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. 3577 \advance\hsize by -2\dimen2 % Rules. 3578 \vbox{% 3579 \hrule height\dimen2 3580 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. 3581 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. 3582 \kern3pt\vrule width\dimen2}% Space to right. 3583 \hrule height\dimen2} 3584 \hfil} 3585% 3586\def\error{\leavevmode\lower.7ex\copy\errorbox} 3587 3588% @pounds{} is a sterling sign, which Knuth put in the CM italic font. 3589% 3590\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi} 3591 3592% @euro{} comes from a separate font, depending on the current style. 3593% We use the free feym* fonts from the eurosym package by Henrik 3594% Theiling, which support regular, slanted, bold and bold slanted (and 3595% "outlined" (blackboard board, sort of) versions, which we don't need). 3596% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. 3597% 3598% Although only regular is the truly official Euro symbol, we ignore 3599% that. The Euro is designed to be slightly taller than the regular 3600% font height. 3601% 3602% feymr - regular 3603% feymo - slanted 3604% feybr - bold 3605% feybo - bold slanted 3606% 3607% There is no good (free) typewriter version, to my knowledge. 3608% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. 3609% Hmm. 3610% 3611% Also doesn't work in math. Do we need to do math with euro symbols? 3612% Hope not. 3613% 3614% 3615\def\euro{{\eurofont e}} 3616\def\eurofont{% 3617 % We set the font at each command, rather than predefining it in 3618 % \textfonts and the other font-switching commands, so that 3619 % installations which never need the symbol don't have to have the 3620 % font installed. 3621 % 3622 % There is only one designed size (nominal 10pt), so we always scale 3623 % that to the current nominal size. 3624 % 3625 % By the way, simply using "at 1em" works for cmr10 and the like, but 3626 % does not work for cmbx10 and other extended/shrunken fonts. 3627 % 3628 \def\eurosize{\csname\curfontsize nominalsize\endcsname}% 3629 % 3630 \ifx\curfontstyle\bfstylename 3631 % bold: 3632 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize 3633 \else 3634 % regular: 3635 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize 3636 \fi 3637 \thiseurofont 3638} 3639 3640% Glyphs from the EC fonts. We don't use \let for the aliases, because 3641% sometimes we redefine the original macro, and the alias should reflect 3642% the redefinition. 3643% 3644% Use LaTeX names for the Icelandic letters. 3645\def\DH{{\ecfont \char"D0}} % Eth 3646\def\dh{{\ecfont \char"F0}} % eth 3647\def\TH{{\ecfont \char"DE}} % Thorn 3648\def\th{{\ecfont \char"FE}} % thorn 3649% 3650\def\guillemetleft{{\ecfont \char"13}} 3651\def\guillemotleft{\guillemetleft} 3652\def\guillemetright{{\ecfont \char"14}} 3653\def\guillemotright{\guillemetright} 3654\def\guilsinglleft{{\ecfont \char"0E}} 3655\def\guilsinglright{{\ecfont \char"0F}} 3656\def\quotedblbase{{\ecfont \char"12}} 3657\def\quotesinglbase{{\ecfont \char"0D}} 3658% 3659% This positioning is not perfect (see the ogonek LaTeX package), but 3660% we have the precomposed glyphs for the most common cases. We put the 3661% tests to use those glyphs in the single \ogonek macro so we have fewer 3662% dummy definitions to worry about for index entries, etc. 3663% 3664% ogonek is also used with other letters in Lithuanian (IOU), but using 3665% the precomposed glyphs for those is not so easy since they aren't in 3666% the same EC font. 3667\def\ogonek#1{{% 3668 \def\temp{#1}% 3669 \ifx\temp\macrocharA\Aogonek 3670 \else\ifx\temp\macrochara\aogonek 3671 \else\ifx\temp\macrocharE\Eogonek 3672 \else\ifx\temp\macrochare\eogonek 3673 \else 3674 \ecfont \setbox0=\hbox{#1}% 3675 \ifdim\ht0=1ex\accent"0C #1% 3676 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% 3677 \fi 3678 \fi\fi\fi\fi 3679 }% 3680} 3681\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} 3682\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} 3683\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} 3684\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} 3685% 3686% Use the European Computer Modern fonts (cm-super in outline format) 3687% for non-CM glyphs. That is ec* for regular text and tc* for the text 3688% companion symbols (LaTeX TS1 encoding). Both are part of the ec 3689% package and follow the same conventions. 3690% 3691\def\ecfont{\etcfont{e}} 3692\def\tcfont{\etcfont{t}} 3693% 3694\def\etcfont#1{% 3695 % We can't distinguish serif/sans and italic/slanted, but this 3696 % is used for crude hacks anyway (like adding French and German 3697 % quotes to documents typeset with CM, where we lose kerning), so 3698 % hopefully nobody will notice/care. 3699 \edef\ecsize{\csname\curfontsize ecsize\endcsname}% 3700 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% 3701 \ifmonospace 3702 % typewriter: 3703 \font\thisecfont = #1ctt\ecsize \space at \nominalsize 3704 \else 3705 \ifx\curfontstyle\bfstylename 3706 % bold: 3707 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize 3708 \else 3709 % regular: 3710 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize 3711 \fi 3712 \fi 3713 \thisecfont 3714} 3715 3716% @registeredsymbol - R in a circle. The font for the R should really 3717% be smaller yet, but lllsize is the best we can do for now. 3718% Adapted from the plain.tex definition of \copyright. 3719% 3720\def\registeredsymbol{% 3721 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}% 3722 \hfil\crcr\Orb}}% 3723 }$% 3724} 3725 3726% @textdegree - the normal degrees sign. 3727% 3728\def\textdegree{$^\circ$} 3729 3730% Laurent Siebenmann reports \Orb undefined with: 3731% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 3732% so we'll define it if necessary. 3733% 3734\ifx\Orb\thisisundefined 3735\def\Orb{\mathhexbox20D} 3736\fi 3737 3738% Quotes. 3739\chardef\quoteleft=`\` 3740\chardef\quoteright=`\' 3741 3742% only change font for tt for correct kerning and to avoid using 3743% \ecfont unless necessary. 3744\def\quotedblleft{% 3745 \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi 3746} 3747 3748\def\quotedblright{% 3749 \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi 3750} 3751 3752 3753\message{page headings,} 3754 3755\newskip\titlepagetopglue \titlepagetopglue = 1.5in 3756\newskip\titlepagebottomglue \titlepagebottomglue = 2pc 3757 3758% First the title page. Must do @settitle before @titlepage. 3759\newif\ifseenauthor 3760\newif\iffinishedtitlepage 3761 3762% @setcontentsaftertitlepage used to do an implicit @contents or 3763% @shortcontents after @end titlepage, but it is now obsolete. 3764\def\setcontentsaftertitlepage{% 3765 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo 3766 command; move your @contents command if you want the contents 3767 after the title page.}}% 3768\def\setshortcontentsaftertitlepage{% 3769 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo 3770 command; move your @shortcontents and @contents commands if you 3771 want the contents after the title page.}}% 3772 3773\parseargdef\shorttitlepage{% 3774 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% 3775 \endgroup\page\hbox{}\page} 3776 3777\envdef\titlepage{% 3778 % Open one extra group, as we want to close it in the middle of \Etitlepage. 3779 \begingroup 3780 \parindent=0pt \textfonts 3781 % Leave some space at the very top of the page. 3782 \vglue\titlepagetopglue 3783 % No rule at page bottom unless we print one at the top with @title. 3784 \finishedtitlepagetrue 3785 % 3786 % Most title ``pages'' are actually two pages long, with space 3787 % at the top of the second. We don't want the ragged left on the second. 3788 \let\oldpage = \page 3789 \def\page{% 3790 \iffinishedtitlepage\else 3791 \finishtitlepage 3792 \fi 3793 \let\page = \oldpage 3794 \page 3795 \null 3796 }% 3797} 3798 3799\def\Etitlepage{% 3800 \iffinishedtitlepage\else 3801 \finishtitlepage 3802 \fi 3803 % It is important to do the page break before ending the group, 3804 % because the headline and footline are only empty inside the group. 3805 % If we use the new definition of \page, we always get a blank page 3806 % after the title page, which we certainly don't want. 3807 \oldpage 3808 \endgroup 3809 % 3810 % Need this before the \...aftertitlepage checks so that if they are 3811 % in effect the toc pages will come out with page numbers. 3812 \HEADINGSon 3813} 3814 3815\def\finishtitlepage{% 3816 \vskip4pt \hrule height 2pt width \hsize 3817 \vskip\titlepagebottomglue 3818 \finishedtitlepagetrue 3819} 3820 3821% Settings used for typesetting titles: no hyphenation, no indentation, 3822% don't worry much about spacing, ragged right. This should be used 3823% inside a \vbox, and fonts need to be set appropriately first. \par should 3824% be specified before the end of the \vbox, since a vbox is a group. 3825% 3826\def\raggedtitlesettings{% 3827 \rm 3828 \hyphenpenalty=10000 3829 \parindent=0pt 3830 \tolerance=5000 3831 \ptexraggedright 3832} 3833 3834% Macros to be used within @titlepage: 3835 3836\let\subtitlerm=\rmfont 3837\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} 3838 3839\parseargdef\title{% 3840 \checkenv\titlepage 3841 \vbox{\titlefonts \raggedtitlesettings #1\par}% 3842 % print a rule at the page bottom also. 3843 \finishedtitlepagefalse 3844 \vskip4pt \hrule height 4pt width \hsize \vskip4pt 3845} 3846 3847\parseargdef\subtitle{% 3848 \checkenv\titlepage 3849 {\subtitlefont \rightline{#1}}% 3850} 3851 3852% @author should come last, but may come many times. 3853% It can also be used inside @quotation. 3854% 3855\parseargdef\author{% 3856 \def\temp{\quotation}% 3857 \ifx\thisenv\temp 3858 \def\quotationauthor{#1}% printed in \Equotation. 3859 \else 3860 \checkenv\titlepage 3861 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi 3862 {\secfonts\rm \leftline{#1}}% 3863 \fi 3864} 3865 3866 3867% Set up page headings and footings. 3868 3869\let\thispage=\folio 3870 3871\newtoks\evenheadline % headline on even pages 3872\newtoks\oddheadline % headline on odd pages 3873\newtoks\evenchapheadline% headline on even pages with a new chapter 3874\newtoks\oddchapheadline % headline on odd pages with a new chapter 3875\newtoks\evenfootline % footline on even pages 3876\newtoks\oddfootline % footline on odd pages 3877 3878% Now make \makeheadline and \makefootline in Plain TeX use those variables 3879\headline={{\textfonts\rm 3880 \ifchapterpage 3881 \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi 3882 \else 3883 \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi 3884 \fi}} 3885 3886\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline 3887 \else \the\evenfootline \fi}\HEADINGShook} 3888\let\HEADINGShook=\relax 3889 3890% Commands to set those variables. 3891% For example, this is what @headings on does 3892% @evenheading @thistitle|@thispage|@thischapter 3893% @oddheading @thischapter|@thispage|@thistitle 3894% @evenfooting @thisfile|| 3895% @oddfooting ||@thisfile 3896 3897 3898\def\evenheading{\parsearg\evenheadingxxx} 3899\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} 3900\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% 3901 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}} 3902 \global\evenchapheadline=\evenheadline} 3903 3904\def\oddheading{\parsearg\oddheadingxxx} 3905\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} 3906\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% 3907 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}% 3908 \global\oddchapheadline=\oddheadline} 3909 3910\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% 3911 3912\def\evenfooting{\parsearg\evenfootingxxx} 3913\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} 3914\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% 3915\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 3916 3917\def\oddfooting{\parsearg\oddfootingxxx} 3918\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} 3919\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% 3920 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% 3921 % 3922 % Leave some space for the footline. Hopefully ok to assume 3923 % @evenfooting will not be used by itself. 3924 \global\advance\txipageheight by -12pt 3925 \global\advance\vsize by -12pt 3926} 3927 3928\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} 3929 3930% @evenheadingmarks top \thischapter <- chapter at the top of a page 3931% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page 3932% 3933% The same set of arguments for: 3934% 3935% @oddheadingmarks 3936% @evenfootingmarks 3937% @oddfootingmarks 3938% @everyheadingmarks 3939% @everyfootingmarks 3940 3941% These define \getoddheadingmarks, \getevenheadingmarks, 3942% \getoddfootingmarks, and \getevenfootingmarks, each to one of 3943% \gettopheadingmarks, \getbottomheadingmarks. 3944% 3945\def\evenheadingmarks{\headingmarks{even}{heading}} 3946\def\oddheadingmarks{\headingmarks{odd}{heading}} 3947\def\evenfootingmarks{\headingmarks{even}{footing}} 3948\def\oddfootingmarks{\headingmarks{odd}{footing}} 3949\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1} 3950 \headingmarks{odd}{heading}{#1} } 3951\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1} 3952 \headingmarks{odd}{footing}{#1} } 3953% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. 3954\def\headingmarks#1#2#3 {% 3955 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname 3956 \global\expandafter\let\csname get#1#2marks\endcsname \temp 3957} 3958 3959\everyheadingmarks bottom 3960\everyfootingmarks bottom 3961 3962% @headings double turns headings on for double-sided printing. 3963% @headings single turns headings on for single-sided printing. 3964% @headings off turns them off. 3965% @headings on same as @headings double, retained for compatibility. 3966% @headings after turns on double-sided headings after this page. 3967% @headings doubleafter turns on double-sided headings after this page. 3968% @headings singleafter turns on single-sided headings after this page. 3969% By default, they are off at the start of a document, 3970% and turned `on' after @end titlepage. 3971 3972\parseargdef\headings{\csname HEADINGS#1\endcsname} 3973 3974\def\headingsoff{% non-global headings elimination 3975 \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}% 3976 \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}% 3977} 3978 3979\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting 3980\HEADINGSoff % it's the default 3981 3982% When we turn headings on, set the page number to 1. 3983\def\pageone{ 3984 \global\pageno=1 3985 \global\arabiccount = \pagecount 3986} 3987 3988% For double-sided printing, put current file name in lower left corner, 3989% chapter name on inside top of right hand pages, document 3990% title on inside top of left hand pages, and page numbers on outside top 3991% edge of all pages. 3992\def\HEADINGSdouble{% 3993\pageone 3994\HEADINGSdoublex 3995} 3996\let\contentsalignmacro = \chappager 3997 3998% For single-sided printing, chapter title goes across top left of page, 3999% page number on top right. 4000\def\HEADINGSsingle{% 4001\pageone 4002\HEADINGSsinglex 4003} 4004\def\HEADINGSon{\HEADINGSdouble} 4005 4006\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} 4007\let\HEADINGSdoubleafter=\HEADINGSafter 4008\def\HEADINGSdoublex{% 4009\global\evenfootline={\hfil} 4010\global\oddfootline={\hfil} 4011\global\evenheadline={\line{\folio\hfil\thistitle}} 4012\global\oddheadline={\line{\thischapter\hfil\folio}} 4013\global\evenchapheadline={\line{\folio\hfil}} 4014\global\oddchapheadline={\line{\hfil\folio}} 4015\global\let\contentsalignmacro = \chapoddpage 4016} 4017 4018\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} 4019\def\HEADINGSsinglex{% 4020\global\evenfootline={\hfil} 4021\global\oddfootline={\hfil} 4022\global\evenheadline={\line{\thischapter\hfil\folio}} 4023\global\oddheadline={\line{\thischapter\hfil\folio}} 4024\global\evenchapheadline={\line{\hfil\folio}} 4025\global\oddchapheadline={\line{\hfil\folio}} 4026\global\let\contentsalignmacro = \chappager 4027} 4028 4029% for @setchapternewpage off 4030\def\HEADINGSsinglechapoff{% 4031\pageone 4032\global\evenfootline={\hfil} 4033\global\oddfootline={\hfil} 4034\global\evenheadline={\line{\thischapter\hfil\folio}} 4035\global\oddheadline={\line{\thischapter\hfil\folio}} 4036\global\evenchapheadline=\evenheadline 4037\global\oddchapheadline=\oddheadline 4038\global\let\contentsalignmacro = \chappager 4039} 4040 4041% Subroutines used in generating headings 4042% This produces Day Month Year style of output. 4043% Only define if not already defined, in case a txi-??.tex file has set 4044% up a different format (e.g., txi-cs.tex does this). 4045\ifx\today\thisisundefined 4046\def\today{% 4047 \number\day\space 4048 \ifcase\month 4049 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr 4050 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug 4051 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec 4052 \fi 4053 \space\number\year} 4054\fi 4055 4056% @settitle line... specifies the title of the document, for headings. 4057% It generates no output of its own. 4058\def\thistitle{\putwordNoTitle} 4059\def\settitle{\parsearg{\gdef\thistitle}} 4060 4061 4062\message{tables,} 4063% Tables -- @table, @ftable, @vtable, @item(x). 4064 4065% default indentation of table text 4066\newdimen\tableindent \tableindent=.8in 4067% default indentation of @itemize and @enumerate text 4068\newdimen\itemindent \itemindent=.3in 4069% margin between end of table item and start of table text. 4070\newdimen\itemmargin \itemmargin=.1in 4071 4072% used internally for \itemindent minus \itemmargin 4073\newdimen\itemmax 4074 4075% Note @table, @ftable, and @vtable define @item, @itemx, etc., with 4076% these defs. 4077% They also define \itemindex 4078% to index the item name in whatever manner is desired (perhaps none). 4079 4080\newif\ifitemxneedsnegativevskip 4081 4082\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} 4083 4084\def\internalBitem{\smallbreak \parsearg\itemzzz} 4085\def\internalBitemx{\itemxpar \parsearg\itemzzz} 4086 4087\def\itemzzz #1{\begingroup % 4088 \advance\hsize by -\rightskip 4089 \advance\hsize by -\tableindent 4090 \setbox0=\hbox{\itemindicate{#1}}% 4091 \itemindex{#1}% 4092 \nobreak % This prevents a break before @itemx. 4093 % 4094 % If the item text does not fit in the space we have, put it on a line 4095 % by itself, and do not allow a page break either before or after that 4096 % line. We do not start a paragraph here because then if the next 4097 % command is, e.g., @kindex, the whatsit would get put into the 4098 % horizontal list on a line by itself, resulting in extra blank space. 4099 \ifdim \wd0>\itemmax 4100 % 4101 % Make this a paragraph so we get the \parskip glue and wrapping, 4102 % but leave it ragged-right. 4103 \begingroup 4104 \advance\leftskip by-\tableindent 4105 \advance\hsize by\tableindent 4106 \advance\rightskip by0pt plus1fil\relax 4107 \leavevmode\unhbox0\par 4108 \endgroup 4109 % 4110 % We're going to be starting a paragraph, but we don't want the 4111 % \parskip glue -- logically it's part of the @item we just started. 4112 \nobreak \vskip-\parskip 4113 % 4114 % Stop a page break at the \parskip glue coming up. However, if 4115 % what follows is an environment such as @example, there will be no 4116 % \parskip glue; then the negative vskip we just inserted would 4117 % cause the example and the item to crash together. So we use this 4118 % bizarre value of 10001 as a signal to \aboveenvbreak to insert 4119 % \parskip glue after all. Section titles are handled this way also. 4120 % 4121 \penalty 10001 4122 \endgroup 4123 \itemxneedsnegativevskipfalse 4124 \else 4125 % The item text fits into the space. Start a paragraph, so that the 4126 % following text (if any) will end up on the same line. 4127 \noindent 4128 % Do this with kerns and \unhbox so that if there is a footnote in 4129 % the item text, it can migrate to the main vertical list and 4130 % eventually be printed. 4131 \nobreak\kern-\tableindent 4132 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 4133 \unhbox0 4134 \nobreak\kern\dimen0 4135 \endgroup 4136 \itemxneedsnegativevskiptrue 4137 \fi 4138} 4139 4140\def\item{\errmessage{@item while not in a list environment}} 4141\def\itemx{\errmessage{@itemx while not in a list environment}} 4142 4143% @table, @ftable, @vtable. 4144\envdef\table{% 4145 \let\itemindex\gobble 4146 \tablecheck{table}% 4147} 4148\envdef\ftable{% 4149 \def\itemindex ##1{\doind {fn}{\code{##1}}}% 4150 \tablecheck{ftable}% 4151} 4152\envdef\vtable{% 4153 \def\itemindex ##1{\doind {vr}{\code{##1}}}% 4154 \tablecheck{vtable}% 4155} 4156\def\tablecheck#1{% 4157 \ifnum \the\catcode`\^^M=\active 4158 \endgroup 4159 \errmessage{This command won't work in this context; perhaps the problem is 4160 that we are \inenvironment\thisenv}% 4161 \def\next{\doignore{#1}}% 4162 \else 4163 \let\next\tablex 4164 \fi 4165 \next 4166} 4167\def\tablex#1{% 4168 \def\itemindicate{#1}% 4169 \parsearg\tabley 4170} 4171\def\tabley#1{% 4172 {% 4173 \makevalueexpandable 4174 \edef\temp{\noexpand\tablez #1\space\space\space}% 4175 \expandafter 4176 }\temp \endtablez 4177} 4178\def\tablez #1 #2 #3 #4\endtablez{% 4179 \aboveenvbreak 4180 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi 4181 \ifnum 0#2>0 \tableindent=#2\mil \fi 4182 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi 4183 \itemmax=\tableindent 4184 \advance \itemmax by -\itemmargin 4185 \advance \leftskip by \tableindent 4186 \exdentamount=\tableindent 4187 \parindent = 0pt 4188 \parskip = \smallskipamount 4189 \ifdim \parskip=0pt \parskip=2pt \fi 4190 \let\item = \internalBitem 4191 \let\itemx = \internalBitemx 4192} 4193\def\Etable{\endgraf\afterenvbreak} 4194\let\Eftable\Etable 4195\let\Evtable\Etable 4196\let\Eitemize\Etable 4197\let\Eenumerate\Etable 4198 4199% This is the counter used by @enumerate, which is really @itemize 4200 4201\newcount \itemno 4202 4203\envdef\itemize{\parsearg\doitemize} 4204 4205\def\doitemize#1{% 4206 \aboveenvbreak 4207 \itemmax=\itemindent 4208 \advance\itemmax by -\itemmargin 4209 \advance\leftskip by \itemindent 4210 \exdentamount=\itemindent 4211 \parindent=0pt 4212 \parskip=\smallskipamount 4213 \ifdim\parskip=0pt \parskip=2pt \fi 4214 % 4215 % Try typesetting the item mark so that if the document erroneously says 4216 % something like @itemize @samp (intending @table), there's an error 4217 % right away at the @itemize. It's not the best error message in the 4218 % world, but it's better than leaving it to the @item. This means if 4219 % the user wants an empty mark, they have to say @w{} not just @w. 4220 \def\itemcontents{#1}% 4221 \setbox0 = \hbox{\itemcontents}% 4222 % 4223 % @itemize with no arg is equivalent to @itemize @bullet. 4224 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi 4225 % 4226 \let\item=\itemizeitem 4227} 4228 4229% Definition of @item while inside @itemize and @enumerate. 4230% 4231\def\itemizeitem{% 4232 \advance\itemno by 1 % for enumerations 4233 {\let\par=\endgraf \smallbreak}% reasonable place to break 4234 {% 4235 % If the document has an @itemize directly after a section title, a 4236 % \nobreak will be last on the list, and \sectionheading will have 4237 % done a \vskip-\parskip. In that case, we don't want to zero 4238 % parskip, or the item text will crash with the heading. On the 4239 % other hand, when there is normal text preceding the item (as there 4240 % usually is), we do want to zero parskip, or there would be too much 4241 % space. In that case, we won't have a \nobreak before. At least 4242 % that's the theory. 4243 \ifnum\lastpenalty<10000 \parskip=0in \fi 4244 \noindent 4245 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% 4246 % 4247 \ifinner\else 4248 \vadjust{\penalty 1200}% not good to break after first line of item. 4249 \fi 4250 % We can be in inner vertical mode in a footnote, although an 4251 % @itemize looks awful there. 4252 }% 4253 \flushcr 4254} 4255 4256% \splitoff TOKENS\endmark defines \first to be the first token in 4257% TOKENS, and \rest to be the remainder. 4258% 4259\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% 4260 4261% Allow an optional argument of an uppercase letter, lowercase letter, 4262% or number, to specify the first label in the enumerated list. No 4263% argument is the same as `1'. 4264% 4265\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} 4266\def\enumeratey #1 #2\endenumeratey{% 4267 % If we were given no argument, pretend we were given `1'. 4268 \def\thearg{#1}% 4269 \ifx\thearg\empty \def\thearg{1}\fi 4270 % 4271 % Detect if the argument is a single token. If so, it might be a 4272 % letter. Otherwise, the only valid thing it can be is a number. 4273 % (We will always have one token, because of the test we just made. 4274 % This is a good thing, since \splitoff doesn't work given nothing at 4275 % all -- the first parameter is undelimited.) 4276 \expandafter\splitoff\thearg\endmark 4277 \ifx\rest\empty 4278 % Only one token in the argument. It could still be anything. 4279 % A ``lowercase letter'' is one whose \lccode is nonzero. 4280 % An ``uppercase letter'' is one whose \lccode is both nonzero, and 4281 % not equal to itself. 4282 % Otherwise, we assume it's a number. 4283 % 4284 % We need the \relax at the end of the \ifnum lines to stop TeX from 4285 % continuing to look for a <number>. 4286 % 4287 \ifnum\lccode\expandafter`\thearg=0\relax 4288 \numericenumerate % a number (we hope) 4289 \else 4290 % It's a letter. 4291 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax 4292 \lowercaseenumerate % lowercase letter 4293 \else 4294 \uppercaseenumerate % uppercase letter 4295 \fi 4296 \fi 4297 \else 4298 % Multiple tokens in the argument. We hope it's a number. 4299 \numericenumerate 4300 \fi 4301} 4302 4303% An @enumerate whose labels are integers. The starting integer is 4304% given in \thearg. 4305% 4306\def\numericenumerate{% 4307 \itemno = \thearg 4308 \startenumeration{\the\itemno}% 4309} 4310 4311% The starting (lowercase) letter is in \thearg. 4312\def\lowercaseenumerate{% 4313 \itemno = \expandafter`\thearg 4314 \startenumeration{% 4315 % Be sure we're not beyond the end of the alphabet. 4316 \ifnum\itemno=0 4317 \errmessage{No more lowercase letters in @enumerate; get a bigger 4318 alphabet}% 4319 \fi 4320 \char\lccode\itemno 4321 }% 4322} 4323 4324% The starting (uppercase) letter is in \thearg. 4325\def\uppercaseenumerate{% 4326 \itemno = \expandafter`\thearg 4327 \startenumeration{% 4328 % Be sure we're not beyond the end of the alphabet. 4329 \ifnum\itemno=0 4330 \errmessage{No more uppercase letters in @enumerate; get a bigger 4331 alphabet} 4332 \fi 4333 \char\uccode\itemno 4334 }% 4335} 4336 4337% Call \doitemize, adding a period to the first argument and supplying the 4338% common last two arguments. Also subtract one from the initial value in 4339% \itemno, since @item increments \itemno. 4340% 4341\def\startenumeration#1{% 4342 \advance\itemno by -1 4343 \doitemize{#1.}\flushcr 4344} 4345 4346% @alphaenumerate and @capsenumerate are abbreviations for giving an arg 4347% to @enumerate. 4348% 4349\def\alphaenumerate{\enumerate{a}} 4350\def\capsenumerate{\enumerate{A}} 4351\def\Ealphaenumerate{\Eenumerate} 4352\def\Ecapsenumerate{\Eenumerate} 4353 4354 4355% @multitable macros 4356% Amy Hendrickson, 8/18/94, 3/6/96 4357% 4358% @multitable ... @end multitable will make as many columns as desired. 4359% Contents of each column will wrap at width given in preamble. Width 4360% can be specified either with sample text given in a template line, 4361% or in percent of \hsize, the current width of text on page. 4362 4363% Table can continue over pages but will only break between lines. 4364 4365% To make preamble: 4366% 4367% Either define widths of columns in terms of percent of \hsize: 4368% @multitable @columnfractions .25 .3 .45 4369% @item ... 4370% 4371% Numbers following @columnfractions are the percent of the total 4372% current hsize to be used for each column. You may use as many 4373% columns as desired. 4374 4375 4376% Or use a template: 4377% @multitable {Column 1 template} {Column 2 template} {Column 3 template} 4378% @item ... 4379% using the widest term desired in each column. 4380 4381% Each new table line starts with @item, each subsequent new column 4382% starts with @tab. Empty columns may be produced by supplying @tab's 4383% with nothing between them for as many times as empty columns are needed, 4384% ie, @tab@tab@tab will produce two empty columns. 4385 4386% @item, @tab do not need to be on their own lines, but it will not hurt 4387% if they are. 4388 4389% Sample multitable: 4390 4391% @multitable {Column 1 template} {Column 2 template} {Column 3 template} 4392% @item first col stuff @tab second col stuff @tab third col 4393% @item 4394% first col stuff 4395% @tab 4396% second col stuff 4397% @tab 4398% third col 4399% @item first col stuff @tab second col stuff 4400% @tab Many paragraphs of text may be used in any column. 4401% 4402% They will wrap at the width determined by the template. 4403% @item@tab@tab This will be in third column. 4404% @end multitable 4405 4406% Default dimensions may be reset by user. 4407% @multitableparskip is vertical space between paragraphs in table. 4408% @multitableparindent is paragraph indent in table. 4409% @multitablecolmargin is horizontal space to be left between columns. 4410% @multitablelinespace is space to leave between table items, baseline 4411% to baseline. 4412% 0pt means it depends on current normal line spacing. 4413% 4414\newskip\multitableparskip 4415\newskip\multitableparindent 4416\newdimen\multitablecolspace 4417\newskip\multitablelinespace 4418\multitableparskip=0pt 4419\multitableparindent=6pt 4420\multitablecolspace=12pt 4421\multitablelinespace=0pt 4422 4423% Macros used to set up halign preamble: 4424% 4425\let\endsetuptable\relax 4426\def\xendsetuptable{\endsetuptable} 4427\let\columnfractions\relax 4428\def\xcolumnfractions{\columnfractions} 4429\newif\ifsetpercent 4430 4431% #1 is the @columnfraction, usually a decimal number like .5, but might 4432% be just 1. We just use it, whatever it is. 4433% 4434\def\pickupwholefraction#1 {% 4435 \global\advance\colcount by 1 4436 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% 4437 \setuptable 4438} 4439 4440\newcount\colcount 4441\def\setuptable#1{% 4442 \def\firstarg{#1}% 4443 \ifx\firstarg\xendsetuptable 4444 \let\go = \relax 4445 \else 4446 \ifx\firstarg\xcolumnfractions 4447 \global\setpercenttrue 4448 \else 4449 \ifsetpercent 4450 \let\go\pickupwholefraction 4451 \else 4452 \global\advance\colcount by 1 4453 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a 4454 % separator; typically that is always in the input, anyway. 4455 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% 4456 \fi 4457 \fi 4458 \ifx\go\pickupwholefraction 4459 % Put the argument back for the \pickupwholefraction call, so 4460 % we'll always have a period there to be parsed. 4461 \def\go{\pickupwholefraction#1}% 4462 \else 4463 \let\go = \setuptable 4464 \fi% 4465 \fi 4466 \go 4467} 4468 4469% multitable-only commands. 4470% 4471% @headitem starts a heading row, which we typeset in bold. Assignments 4472% have to be global since we are inside the implicit group of an 4473% alignment entry. \everycr below resets \everytab so we don't have to 4474% undo it ourselves. 4475\def\headitemfont{\b}% for people to use in the template row; not changeable 4476\def\headitem{% 4477 \checkenv\multitable 4478 \crcr 4479 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings 4480 \global\everytab={\bf}% can't use \headitemfont since the parsing differs 4481 \the\everytab % for the first item 4482}% 4483% 4484% default for tables with no headings. 4485\let\headitemcrhook=\relax 4486% 4487% A \tab used to include \hskip1sp. But then the space in a template 4488% line is not enough. That is bad. So let's go back to just `&' until 4489% we again encounter the problem the 1sp was intended to solve. 4490% --karl, nathan@acm.org, 20apr99. 4491\def\tab{\checkenv\multitable &\the\everytab}% 4492 4493% @multitable ... @end multitable definitions: 4494% 4495\newtoks\everytab % insert after every tab. 4496% 4497\envdef\multitable{% 4498 \vskip\parskip 4499 \startsavinginserts 4500 % 4501 % @item within a multitable starts a normal row. 4502 % We use \def instead of \let so that if one of the multitable entries 4503 % contains an @itemize, we don't choke on the \item (seen as \crcr aka 4504 % \endtemplate) expanding \doitemize. 4505 \def\item{\crcr}% 4506 % 4507 \tolerance=9500 4508 \hbadness=9500 4509 \setmultitablespacing 4510 \parskip=\multitableparskip 4511 \parindent=\multitableparindent 4512 \overfullrule=0pt 4513 \global\colcount=0 4514 % 4515 \everycr = {% 4516 \noalign{% 4517 \global\everytab={}% Reset from possible headitem. 4518 \global\colcount=0 % Reset the column counter. 4519 % 4520 % Check for saved footnotes, etc.: 4521 \checkinserts 4522 % 4523 % Perhaps a \nobreak, then reset: 4524 \headitemcrhook 4525 \global\let\headitemcrhook=\relax 4526 }% 4527 }% 4528 % 4529 \parsearg\domultitable 4530} 4531\def\domultitable#1{% 4532 % To parse everything between @multitable and @item: 4533 \setuptable#1 \endsetuptable 4534 % 4535 % This preamble sets up a generic column definition, which will 4536 % be used as many times as user calls for columns. 4537 % \vtop will set a single line and will also let text wrap and 4538 % continue for many paragraphs if desired. 4539 \halign\bgroup &% 4540 \global\advance\colcount by 1 4541 \multistrut 4542 \vtop{% 4543 % Use the current \colcount to find the correct column width: 4544 \hsize=\expandafter\csname col\the\colcount\endcsname 4545 % 4546 % In order to keep entries from bumping into each other 4547 % we will add a \leftskip of \multitablecolspace to all columns after 4548 % the first one. 4549 % 4550 % If a template has been used, we will add \multitablecolspace 4551 % to the width of each template entry. 4552 % 4553 % If the user has set preamble in terms of percent of \hsize we will 4554 % use that dimension as the width of the column, and the \leftskip 4555 % will keep entries from bumping into each other. Table will start at 4556 % left margin and final column will justify at right margin. 4557 % 4558 % Make sure we don't inherit \rightskip from the outer environment. 4559 \rightskip=0pt 4560 \ifnum\colcount=1 4561 % The first column will be indented with the surrounding text. 4562 \advance\hsize by\leftskip 4563 \else 4564 \ifsetpercent \else 4565 % If user has not set preamble in terms of percent of \hsize 4566 % we will advance \hsize by \multitablecolspace. 4567 \advance\hsize by \multitablecolspace 4568 \fi 4569 % In either case we will make \leftskip=\multitablecolspace: 4570 \leftskip=\multitablecolspace 4571 \fi 4572 % Ignoring space at the beginning and end avoids an occasional spurious 4573 % blank line, when TeX decides to break the line at the space before the 4574 % box from the multistrut, so the strut ends up on a line by itself. 4575 % For example: 4576 % @multitable @columnfractions .11 .89 4577 % @item @code{#} 4578 % @tab Legal holiday which is valid in major parts of the whole country. 4579 % Is automatically provided with highlighting sequences respectively 4580 % marking characters. 4581 \noindent\ignorespaces##\unskip\multistrut 4582 }\cr 4583} 4584\def\Emultitable{% 4585 \crcr 4586 \egroup % end the \halign 4587 \global\setpercentfalse 4588} 4589 4590\def\setmultitablespacing{% 4591 \def\multistrut{\strut}% just use the standard line spacing 4592 % 4593 % Compute \multitablelinespace (if not defined by user) for use in 4594 % \multitableparskip calculation. We used define \multistrut based on 4595 % this, but (ironically) that caused the spacing to be off. 4596 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. 4597\ifdim\multitablelinespace=0pt 4598\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip 4599\global\advance\multitablelinespace by-\ht0 4600\fi 4601% Test to see if parskip is larger than space between lines of 4602% table. If not, do nothing. 4603% If so, set to same dimension as multitablelinespace. 4604\ifdim\multitableparskip>\multitablelinespace 4605\global\multitableparskip=\multitablelinespace 4606\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller 4607 % than skip between lines in the table. 4608\fi% 4609\ifdim\multitableparskip=0pt 4610\global\multitableparskip=\multitablelinespace 4611\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller 4612 % than skip between lines in the table. 4613\fi} 4614 4615 4616\message{conditionals,} 4617 4618% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, 4619% @ifnotxml always succeed. They currently do nothing; we don't 4620% attempt to check whether the conditionals are properly nested. But we 4621% have to remember that they are conditionals, so that @end doesn't 4622% attempt to close an environment group. 4623% 4624\def\makecond#1{% 4625 \expandafter\let\csname #1\endcsname = \relax 4626 \expandafter\let\csname iscond.#1\endcsname = 1 4627} 4628\makecond{iftex} 4629\makecond{ifnotdocbook} 4630\makecond{ifnothtml} 4631\makecond{ifnotinfo} 4632\makecond{ifnotplaintext} 4633\makecond{ifnotxml} 4634 4635% Ignore @ignore, @ifhtml, @ifinfo, and the like. 4636% 4637\def\direntry{\doignore{direntry}} 4638\def\documentdescription{\doignore{documentdescription}} 4639\def\docbook{\doignore{docbook}} 4640\def\html{\doignore{html}} 4641\def\ifdocbook{\doignore{ifdocbook}} 4642\def\ifhtml{\doignore{ifhtml}} 4643\def\ifinfo{\doignore{ifinfo}} 4644\def\ifnottex{\doignore{ifnottex}} 4645\def\ifplaintext{\doignore{ifplaintext}} 4646\def\ifxml{\doignore{ifxml}} 4647\def\ignore{\doignore{ignore}} 4648\def\menu{\doignore{menu}} 4649\def\xml{\doignore{xml}} 4650 4651% Ignore text until a line `@end #1', keeping track of nested conditionals. 4652% 4653% A count to remember the depth of nesting. 4654\newcount\doignorecount 4655 4656\def\doignore#1{\begingroup 4657 % Scan in ``verbatim'' mode: 4658 \obeylines 4659 \catcode`\@ = \other 4660 \catcode`\{ = \other 4661 \catcode`\} = \other 4662 % 4663 % Make sure that spaces turn into tokens that match what \doignoretext wants. 4664 \spaceisspace 4665 % 4666 % Count number of #1's that we've seen. 4667 \doignorecount = 0 4668 % 4669 % Swallow text until we reach the matching `@end #1'. 4670 \dodoignore{#1}% 4671} 4672 4673{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. 4674 \obeylines % 4675 % 4676 \gdef\dodoignore#1{% 4677 % #1 contains the command name as a string, e.g., `ifinfo'. 4678 % 4679 % Define a command to find the next `@end #1'. 4680 \long\def\doignoretext##1^^M@end #1{% 4681 \doignoretextyyy##1^^M@#1\_STOP_}% 4682 % 4683 % And this command to find another #1 command, at the beginning of a 4684 % line. (Otherwise, we would consider a line `@c @ifset', for 4685 % example, to count as an @ifset for nesting.) 4686 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% 4687 % 4688 % And now expand that command. 4689 \doignoretext ^^M% 4690 }% 4691} 4692 4693\def\doignoreyyy#1{% 4694 \def\temp{#1}% 4695 \ifx\temp\empty % Nothing found. 4696 \let\next\doignoretextzzz 4697 \else % Found a nested condition, ... 4698 \advance\doignorecount by 1 4699 \let\next\doignoretextyyy % ..., look for another. 4700 % If we're here, #1 ends with ^^M\ifinfo (for example). 4701 \fi 4702 \next #1% the token \_STOP_ is present just after this macro. 4703} 4704 4705% We have to swallow the remaining "\_STOP_". 4706% 4707\def\doignoretextzzz#1{% 4708 \ifnum\doignorecount = 0 % We have just found the outermost @end. 4709 \let\next\enddoignore 4710 \else % Still inside a nested condition. 4711 \advance\doignorecount by -1 4712 \let\next\doignoretext % Look for the next @end. 4713 \fi 4714 \next 4715} 4716 4717% Finish off ignored text. 4718{ \obeylines% 4719 % Ignore anything after the last `@end #1'; this matters in verbatim 4720 % environments, where otherwise the newline after an ignored conditional 4721 % would result in a blank line in the output. 4722 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% 4723} 4724 4725 4726% @set VAR sets the variable VAR to an empty value. 4727% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. 4728% 4729% Since we want to separate VAR from REST-OF-LINE (which might be 4730% empty), we can't just use \parsearg; we have to insert a space of our 4731% own to delimit the rest of the line, and then take it out again if we 4732% didn't need it. 4733% We rely on the fact that \parsearg sets \catcode`\ =10. 4734% 4735\parseargdef\set{\setyyy#1 \endsetyyy} 4736\def\setyyy#1 #2\endsetyyy{% 4737 {% 4738 \makevalueexpandable 4739 \def\temp{#2}% 4740 \edef\next{\gdef\makecsname{SET#1}}% 4741 \ifx\temp\empty 4742 \next{}% 4743 \else 4744 \setzzz#2\endsetzzz 4745 \fi 4746 }% 4747} 4748% Remove the trailing space \setxxx inserted. 4749\def\setzzz#1 \endsetzzz{\next{#1}} 4750 4751% @clear VAR clears (i.e., unsets) the variable VAR. 4752% 4753\parseargdef\clear{% 4754 {% 4755 \makevalueexpandable 4756 \global\expandafter\let\csname SET#1\endcsname=\relax 4757 }% 4758} 4759 4760% @value{foo} gets the text saved in variable foo. 4761\def\value{\begingroup\makevalueexpandable\valuexxx} 4762\def\valuexxx#1{\expandablevalue{#1}\endgroup} 4763{ 4764 \catcode`\-=\active \catcode`\_=\active 4765 % 4766 \gdef\makevalueexpandable{% 4767 \let\value = \expandablevalue 4768 % We don't want these characters active, ... 4769 \catcode`\-=\other \catcode`\_=\other 4770 % ..., but we might end up with active ones in the argument if 4771 % we're called from @code, as @code{@value{foo-bar_}}, though. 4772 % So \let them to their normal equivalents. 4773 \let-\normaldash \let_\normalunderscore 4774 } 4775} 4776 4777\def\expandablevalue#1{% 4778 \expandafter\ifx\csname SET#1\endcsname\relax 4779 {[No value for ``#1'']}% 4780 \message{Variable `#1', used in @value, is not set.}% 4781 \else 4782 \csname SET#1\endcsname 4783 \fi 4784} 4785 4786% Like \expandablevalue, but completely expandable (the \message in the 4787% definition above operates at the execution level of TeX). Used when 4788% writing to auxiliary files, due to the expansion that \write does. 4789% If flag is undefined, pass through an unexpanded @value command: maybe it 4790% will be set by the time it is read back in. 4791% 4792% NB flag names containing - or _ may not work here. 4793\def\dummyvalue#1{% 4794 \expandafter\ifx\csname SET#1\endcsname\relax 4795 \string\value{#1}% 4796 \else 4797 \csname SET#1\endcsname 4798 \fi 4799} 4800 4801% Used for @value's in index entries to form the sort key: expand the @value 4802% if possible, otherwise sort late. 4803\def\indexnofontsvalue#1{% 4804 \expandafter\ifx\csname SET#1\endcsname\relax 4805 ZZZZZZZ% 4806 \else 4807 \csname SET#1\endcsname 4808 \fi 4809} 4810 4811% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined 4812% with @set. 4813% 4814% To get the special treatment we need for `@end ifset,' we call 4815% \makecond and then redefine. 4816% 4817\makecond{ifset} 4818\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} 4819\def\doifset#1#2{% 4820 {% 4821 \makevalueexpandable 4822 \let\next=\empty 4823 \expandafter\ifx\csname SET#2\endcsname\relax 4824 #1% If not set, redefine \next. 4825 \fi 4826 \expandafter 4827 }\next 4828} 4829\def\ifsetfail{\doignore{ifset}} 4830 4831% @ifclear VAR ... @end executes the `...' iff VAR has never been 4832% defined with @set, or has been undefined with @clear. 4833% 4834% The `\else' inside the `\doifset' parameter is a trick to reuse the 4835% above code: if the variable is not set, do nothing, if it is set, 4836% then redefine \next to \ifclearfail. 4837% 4838\makecond{ifclear} 4839\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} 4840\def\ifclearfail{\doignore{ifclear}} 4841 4842% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written 4843% without the @) is in fact defined. We can only feasibly check at the 4844% TeX level, so something like `mathcode' is going to considered 4845% defined even though it is not a Texinfo command. 4846% 4847\makecond{ifcommanddefined} 4848\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} 4849% 4850\def\doifcmddefined#1#2{{% 4851 \makevalueexpandable 4852 \let\next=\empty 4853 \expandafter\ifx\csname #2\endcsname\relax 4854 #1% If not defined, \let\next as above. 4855 \fi 4856 \expandafter 4857 }\next 4858} 4859\def\ifcmddefinedfail{\doignore{ifcommanddefined}} 4860 4861% @ifcommandnotdefined CMD ... handled similar to @ifclear above. 4862\makecond{ifcommandnotdefined} 4863\def\ifcommandnotdefined{% 4864 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} 4865\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} 4866 4867% Set the `txicommandconditionals' variable, so documents have a way to 4868% test if the @ifcommand...defined conditionals are available. 4869\set txicommandconditionals 4870 4871% @dircategory CATEGORY -- specify a category of the dir file 4872% which this file should belong to. Ignore this in TeX. 4873\let\dircategory=\comment 4874 4875% @defininfoenclose. 4876\let\definfoenclose=\comment 4877 4878 4879\message{indexing,} 4880% Index generation facilities 4881 4882% Define \newwrite to be identical to plain tex's \newwrite 4883% except not \outer, so it can be used within macros and \if's. 4884\edef\newwrite{\makecsname{ptexnewwrite}} 4885 4886% \newindex {foo} defines an index named IX. 4887% It automatically defines \IXindex such that 4888% \IXindex ...rest of line... puts an entry in the index IX. 4889% It also defines \IXindfile to be the number of the output channel for 4890% the file that accumulates this index. The file's extension is IX. 4891% The name of an index should be no more than 2 characters long 4892% for the sake of vms. 4893% 4894\def\newindex#1{% 4895 \expandafter\chardef\csname#1indfile\endcsname=0 4896 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index 4897 \noexpand\doindex{#1}} 4898} 4899 4900% @defindex foo == \newindex{foo} 4901% 4902\def\defindex{\parsearg\newindex} 4903 4904% Define @defcodeindex, like @defindex except put all entries in @code. 4905% 4906\def\defcodeindex{\parsearg\newcodeindex} 4907% 4908\def\newcodeindex#1{% 4909 \expandafter\chardef\csname#1indfile\endcsname=0 4910 \expandafter\xdef\csname#1index\endcsname{% 4911 \noexpand\docodeindex{#1}}% 4912} 4913 4914% The default indices: 4915\newindex{cp}% concepts, 4916\newcodeindex{fn}% functions, 4917\newcodeindex{vr}% variables, 4918\newcodeindex{tp}% types, 4919\newcodeindex{ky}% keys 4920\newcodeindex{pg}% and programs. 4921 4922 4923% @synindex foo bar makes index foo feed into index bar. 4924% Do this instead of @defindex foo if you don't want it as a separate index. 4925% 4926% @syncodeindex foo bar similar, but put all entries made for index foo 4927% inside @code. 4928% 4929\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} 4930\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} 4931 4932% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), 4933% #3 the target index (bar). 4934\def\dosynindex#1#2#3{% 4935 \requireopenindexfile{#3}% 4936 % redefine \fooindfile: 4937 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname 4938 \expandafter\let\csname#2indfile\endcsname=\temp 4939 % redefine \fooindex: 4940 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% 4941} 4942 4943% Define \doindex, the driver for all index macros. 4944% Argument #1 is generated by the calling \fooindex macro, 4945% and it is the two-letter name of the index. 4946 4947\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx} 4948\def\doindexxxx #1{\doind{\indexname}{#1}} 4949 4950% like the previous two, but they put @code around the argument. 4951\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} 4952\def\docodeindexxxx #1{\docind{\indexname}{#1}} 4953 4954 4955% Used for the aux, toc and index files to prevent expansion of Texinfo 4956% commands. 4957% 4958\def\atdummies{% 4959 \definedummyletter\@% 4960 \definedummyletter\ % 4961 \definedummyletter\{% 4962 \definedummyletter\}% 4963 \definedummyletter\&% 4964 % 4965 % Do the redefinitions. 4966 \definedummies 4967 \otherbackslash 4968} 4969 4970% \definedummyword defines \#1 as \string\#1\space, thus effectively 4971% preventing its expansion. This is used only for control words, 4972% not control letters, because the \space would be incorrect for 4973% control characters, but is needed to separate the control word 4974% from whatever follows. 4975% 4976% These can be used both for control words that take an argument and 4977% those that do not. If it is followed by {arg} in the input, then 4978% that will dutifully get written to the index (or wherever). 4979% 4980% For control letters, we have \definedummyletter, which omits the 4981% space. 4982% 4983\def\definedummyword #1{\def#1{\string#1\space}}% 4984\def\definedummyletter#1{\def#1{\string#1}}% 4985\let\definedummyaccent\definedummyletter 4986 4987% Called from \atdummies to prevent the expansion of commands. 4988% 4989\def\definedummies{% 4990 % 4991 \let\commondummyword\definedummyword 4992 \let\commondummyletter\definedummyletter 4993 \let\commondummyaccent\definedummyaccent 4994 \commondummiesnofonts 4995 % 4996 \definedummyletter\_% 4997 \definedummyletter\-% 4998 % 4999 % Non-English letters. 5000 \definedummyword\AA 5001 \definedummyword\AE 5002 \definedummyword\DH 5003 \definedummyword\L 5004 \definedummyword\O 5005 \definedummyword\OE 5006 \definedummyword\TH 5007 \definedummyword\aa 5008 \definedummyword\ae 5009 \definedummyword\dh 5010 \definedummyword\exclamdown 5011 \definedummyword\l 5012 \definedummyword\o 5013 \definedummyword\oe 5014 \definedummyword\ordf 5015 \definedummyword\ordm 5016 \definedummyword\questiondown 5017 \definedummyword\ss 5018 \definedummyword\th 5019 % 5020 % Although these internal commands shouldn't show up, sometimes they do. 5021 \definedummyword\bf 5022 \definedummyword\gtr 5023 \definedummyword\hat 5024 \definedummyword\less 5025 \definedummyword\sf 5026 \definedummyword\sl 5027 \definedummyword\tclose 5028 \definedummyword\tt 5029 % 5030 \definedummyword\LaTeX 5031 \definedummyword\TeX 5032 % 5033 % Assorted special characters. 5034 \definedummyword\ampchar 5035 \definedummyword\atchar 5036 \definedummyword\arrow 5037 \definedummyword\backslashchar 5038 \definedummyword\bullet 5039 \definedummyword\comma 5040 \definedummyword\copyright 5041 \definedummyword\registeredsymbol 5042 \definedummyword\dots 5043 \definedummyword\enddots 5044 \definedummyword\entrybreak 5045 \definedummyword\equiv 5046 \definedummyword\error 5047 \definedummyword\euro 5048 \definedummyword\expansion 5049 \definedummyword\geq 5050 \definedummyword\guillemetleft 5051 \definedummyword\guillemetright 5052 \definedummyword\guilsinglleft 5053 \definedummyword\guilsinglright 5054 \definedummyword\lbracechar 5055 \definedummyword\leq 5056 \definedummyword\mathopsup 5057 \definedummyword\minus 5058 \definedummyword\ogonek 5059 \definedummyword\pounds 5060 \definedummyword\point 5061 \definedummyword\print 5062 \definedummyword\quotedblbase 5063 \definedummyword\quotedblleft 5064 \definedummyword\quotedblright 5065 \definedummyword\quoteleft 5066 \definedummyword\quoteright 5067 \definedummyword\quotesinglbase 5068 \definedummyword\rbracechar 5069 \definedummyword\result 5070 \definedummyword\sub 5071 \definedummyword\sup 5072 \definedummyword\textdegree 5073 % 5074 \definedummyword\subentry 5075 % 5076 % We want to disable all macros so that they are not expanded by \write. 5077 \macrolist 5078 \let\value\dummyvalue 5079 % 5080 \normalturnoffactive 5081} 5082 5083% \commondummiesnofonts: common to \definedummies and \indexnofonts. 5084% Define \commondummyletter, \commondummyaccent and \commondummyword before 5085% using. Used for accents, font commands, and various control letters. 5086% 5087\def\commondummiesnofonts{% 5088 % Control letters and accents. 5089 \commondummyletter\!% 5090 \commondummyaccent\"% 5091 \commondummyaccent\'% 5092 \commondummyletter\*% 5093 \commondummyaccent\,% 5094 \commondummyletter\.% 5095 \commondummyletter\/% 5096 \commondummyletter\:% 5097 \commondummyaccent\=% 5098 \commondummyletter\?% 5099 \commondummyaccent\^% 5100 \commondummyaccent\`% 5101 \commondummyaccent\~% 5102 \commondummyword\u 5103 \commondummyword\v 5104 \commondummyword\H 5105 \commondummyword\dotaccent 5106 \commondummyword\ogonek 5107 \commondummyword\ringaccent 5108 \commondummyword\tieaccent 5109 \commondummyword\ubaraccent 5110 \commondummyword\udotaccent 5111 \commondummyword\dotless 5112 % 5113 % Texinfo font commands. 5114 \commondummyword\b 5115 \commondummyword\i 5116 \commondummyword\r 5117 \commondummyword\sansserif 5118 \commondummyword\sc 5119 \commondummyword\slanted 5120 \commondummyword\t 5121 % 5122 % Commands that take arguments. 5123 \commondummyword\abbr 5124 \commondummyword\acronym 5125 \commondummyword\anchor 5126 \commondummyword\cite 5127 \commondummyword\code 5128 \commondummyword\command 5129 \commondummyword\dfn 5130 \commondummyword\dmn 5131 \commondummyword\email 5132 \commondummyword\emph 5133 \commondummyword\env 5134 \commondummyword\file 5135 \commondummyword\image 5136 \commondummyword\indicateurl 5137 \commondummyword\inforef 5138 \commondummyword\kbd 5139 \commondummyword\key 5140 \commondummyword\math 5141 \commondummyword\option 5142 \commondummyword\pxref 5143 \commondummyword\ref 5144 \commondummyword\samp 5145 \commondummyword\strong 5146 \commondummyword\tie 5147 \commondummyword\U 5148 \commondummyword\uref 5149 \commondummyword\url 5150 \commondummyword\var 5151 \commondummyword\verb 5152 \commondummyword\w 5153 \commondummyword\xref 5154} 5155 5156\let\indexlbrace\relax 5157\let\indexrbrace\relax 5158\let\indexatchar\relax 5159\let\indexbackslash\relax 5160 5161{\catcode`\@=0 5162\catcode`\\=13 5163 @gdef@backslashdisappear{@def\{}} 5164} 5165 5166{ 5167\catcode`\<=13 5168\catcode`\-=13 5169\catcode`\`=13 5170 \gdef\indexnonalnumdisappear{% 5171 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else 5172 % @set txiindexlquoteignore makes us ignore left quotes in the sort term. 5173 % (Introduced for FSFS 2nd ed.) 5174 \let`=\empty 5175 \fi 5176 % 5177 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else 5178 \backslashdisappear 5179 \fi 5180 % 5181 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else 5182 \def-{}% 5183 \fi 5184 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else 5185 \def<{}% 5186 \fi 5187 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else 5188 \def\@{}% 5189 \fi 5190 } 5191 5192 \gdef\indexnonalnumreappear{% 5193 \let-\normaldash 5194 \let<\normalless 5195 } 5196} 5197 5198 5199% \indexnofonts is used when outputting the strings to sort the index 5200% by, and when constructing control sequence names. It eliminates all 5201% control sequences and just writes whatever the best ASCII sort string 5202% would be for a given command (usually its argument). 5203% 5204\def\indexnofonts{% 5205 % Accent commands should become @asis. 5206 \def\commondummyaccent##1{\let##1\asis}% 5207 % We can just ignore other control letters. 5208 \def\commondummyletter##1{\let##1\empty}% 5209 % All control words become @asis by default; overrides below. 5210 \let\commondummyword\commondummyaccent 5211 \commondummiesnofonts 5212 % 5213 % Don't no-op \tt, since it isn't a user-level command 5214 % and is used in the definitions of the active chars like <, >, |, etc. 5215 % Likewise with the other plain tex font commands. 5216 %\let\tt=\asis 5217 % 5218 \def\ { }% 5219 \def\@{@}% 5220 \def\_{\normalunderscore}% 5221 \def\-{}% @- shouldn't affect sorting 5222 % 5223 \uccode`\1=`\{ \uppercase{\def\{{1}}% 5224 \uccode`\1=`\} \uppercase{\def\}{1}}% 5225 \let\lbracechar\{% 5226 \let\rbracechar\}% 5227 % 5228 % 5229 \let\do\indexnofontsdef 5230 % 5231 % Non-English letters. 5232 \do\AA{AA}% 5233 \do\AE{AE}% 5234 \do\DH{DZZ}% 5235 \do\L{L}% 5236 \do\OE{OE}% 5237 \do\O{O}% 5238 \do\TH{TH}% 5239 \do\aa{aa}% 5240 \do\ae{ae}% 5241 \do\dh{dzz}% 5242 \do\exclamdown{!}% 5243 \do\l{l}% 5244 \do\oe{oe}% 5245 \do\ordf{a}% 5246 \do\ordm{o}% 5247 \do\o{o}% 5248 \do\questiondown{?}% 5249 \do\ss{ss}% 5250 \do\th{th}% 5251 % 5252 \do\LaTeX{LaTeX}% 5253 \do\TeX{TeX}% 5254 % 5255 % Assorted special characters. 5256 \do\atchar{@}% 5257 \do\arrow{->}% 5258 \do\bullet{bullet}% 5259 \do\comma{,}% 5260 \do\copyright{copyright}% 5261 \do\dots{...}% 5262 \do\enddots{...}% 5263 \do\equiv{==}% 5264 \do\error{error}% 5265 \do\euro{euro}% 5266 \do\expansion{==>}% 5267 \do\geq{>=}% 5268 \do\guillemetleft{<<}% 5269 \do\guillemetright{>>}% 5270 \do\guilsinglleft{<}% 5271 \do\guilsinglright{>}% 5272 \do\leq{<=}% 5273 \do\lbracechar{\{}% 5274 \do\minus{-}% 5275 \do\point{.}% 5276 \do\pounds{pounds}% 5277 \do\print{-|}% 5278 \do\quotedblbase{"}% 5279 \do\quotedblleft{"}% 5280 \do\quotedblright{"}% 5281 \do\quoteleft{`}% 5282 \do\quoteright{'}% 5283 \do\quotesinglbase{,}% 5284 \do\rbracechar{\}}% 5285 \do\registeredsymbol{R}% 5286 \do\result{=>}% 5287 \do\textdegree{o}% 5288 % 5289 % We need to get rid of all macros, leaving only the arguments (if present). 5290 % Of course this is not nearly correct, but it is the best we can do for now. 5291 % makeinfo does not expand macros in the argument to @deffn, which ends up 5292 % writing an index entry, and texindex isn't prepared for an index sort entry 5293 % that starts with \. 5294 % 5295 % Since macro invocations are followed by braces, we can just redefine them 5296 % to take a single TeX argument. The case of a macro invocation that 5297 % goes to end-of-line is not handled. 5298 % 5299 \macrolist 5300 \let\value\indexnofontsvalue 5301} 5302 5303% Give the control sequence a definition that removes the {} that follows 5304% its use, e.g. @AA{} -> AA 5305\def\indexnofontsdef#1#2{\def#1##1{#2}}% 5306 5307 5308 5309 5310% #1 is the index name, #2 is the entry text. 5311\def\doind#1#2{% 5312 \iflinks 5313 {% 5314 % 5315 \requireopenindexfile{#1}% 5316 \edef\writeto{\csname#1indfile\endcsname}% 5317 % 5318 \def\indextext{#2}% 5319 \safewhatsit\doindwrite 5320 }% 5321 \fi 5322} 5323 5324% Same as \doind, but for code indices 5325\def\docind#1#2{% 5326 \iflinks 5327 {% 5328 % 5329 \requireopenindexfile{#1}% 5330 \edef\writeto{\csname#1indfile\endcsname}% 5331 % 5332 \def\indextext{#2}% 5333 \safewhatsit\docindwrite 5334 }% 5335 \fi 5336} 5337 5338% Check if an index file has been opened, and if not, open it. 5339\def\requireopenindexfile#1{% 5340\ifnum\csname #1indfile\endcsname=0 5341 \expandafter\newwrite \csname#1indfile\endcsname 5342 \edef\suffix{#1}% 5343 % A .fls suffix would conflict with the file extension for the output 5344 % of -recorder, so use .f1s instead. 5345 \ifx\suffix\indexisfl\def\suffix{f1}\fi 5346 % Open the file 5347 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix 5348 % Using \immediate above here prevents an object entering into the current 5349 % box, which could confound checks such as those in \safewhatsit for 5350 % preceding skips. 5351 \typeout{Writing index file \jobname.\suffix}% 5352\fi} 5353\def\indexisfl{fl} 5354 5355% Definition for writing index entry sort key. 5356{ 5357\catcode`\-=13 5358\gdef\indexwritesortas{% 5359 \begingroup 5360 \indexnonalnumreappear 5361 \indexwritesortasxxx} 5362\gdef\indexwritesortasxxx#1{% 5363 \xdef\indexsortkey{#1}\endgroup} 5364} 5365 5366\def\indexwriteseealso#1{ 5367 \gdef\pagenumbertext{\string\seealso{#1}}% 5368} 5369\def\indexwriteseeentry#1{ 5370 \gdef\pagenumbertext{\string\seeentry{#1}}% 5371} 5372 5373% The default definitions 5374\def\sortas#1{}% 5375\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only 5376\def\putwordSeeAlso{See also} 5377\def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only 5378 5379 5380% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}": 5381% * Set \bracedtext to "{aaa}{bbb}" 5382% * Set \fullindexsortkey to "aaa @subentry ZZZ" 5383% * If @seealso occurs, set \pagenumbertext 5384% 5385\def\splitindexentry#1{% 5386 \gdef\fullindexsortkey{}% 5387 \xdef\bracedtext{}% 5388 \def\sep{}% 5389 \def\seealso##1{}% 5390 \def\seeentry##1{}% 5391 \expandafter\doindexsegment#1\subentry\finish\subentry 5392} 5393 5394% append the results from the next segment 5395\def\doindexsegment#1\subentry{% 5396 \def\segment{#1}% 5397 \ifx\segment\isfinish 5398 \else 5399 % 5400 % Fully expand the segment, throwing away any @sortas directives, and 5401 % trim spaces. 5402 \edef\trimmed{\segment}% 5403 \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% 5404 \ifincodeindex 5405 \edef\trimmed{\noexpand\code{\trimmed}}% 5406 \fi 5407 % 5408 \xdef\bracedtext{\bracedtext{\trimmed}}% 5409 % 5410 % Get the string to sort by. Process the segment with all 5411 % font commands turned off. 5412 \bgroup 5413 \let\sortas\indexwritesortas 5414 \let\seealso\indexwriteseealso 5415 \let\seeentry\indexwriteseeentry 5416 \indexnofonts 5417 % The braces around the commands are recognized by texindex. 5418 \def\lbracechar{{\string\indexlbrace}}% 5419 \def\rbracechar{{\string\indexrbrace}}% 5420 \let\{=\lbracechar 5421 \let\}=\rbracechar 5422 \def\@{{\string\indexatchar}}% 5423 \def\atchar##1{\@}% 5424 \def\backslashchar{{\string\indexbackslash}}% 5425 \uccode`\~=`\\ \uppercase{\let~\backslashchar}% 5426 % 5427 \let\indexsortkey\empty 5428 \global\let\pagenumbertext\empty 5429 % Execute the segment and throw away the typeset output. This executes 5430 % any @sortas or @seealso commands in this segment. 5431 \setbox\dummybox = \hbox{\segment}% 5432 \ifx\indexsortkey\empty{% 5433 \indexnonalnumdisappear 5434 \xdef\trimmed{\segment}% 5435 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% 5436 \xdef\indexsortkey{\trimmed}% 5437 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi 5438 }\fi 5439 % 5440 % Append to \fullindexsortkey. 5441 \edef\tmp{\gdef\noexpand\fullindexsortkey{% 5442 \fullindexsortkey\sep\indexsortkey}}% 5443 \tmp 5444 \egroup 5445 \def\sep{\subentry}% 5446 % 5447 \expandafter\doindexsegment 5448 \fi 5449} 5450\def\isfinish{\finish}% 5451\newbox\dummybox % used above 5452 5453\let\subentry\relax 5454 5455% Use \ instead of @ in index files. To support old texi2dvi and texindex. 5456% This works without changing the escape character used in the toc or aux 5457% files because the index entries are fully expanded here, and \string uses 5458% the current value of \escapechar. 5459\def\escapeisbackslash{\escapechar=`\\} 5460 5461% Use \ in index files by default. texi2dvi didn't support @ as the escape 5462% character (as it checked for "\entry" in the files, and not "@entry"). When 5463% the new version of texi2dvi has had a chance to become more prevalent, then 5464% the escape character can change back to @ again. This should be an easy 5465% change to make now because both @ and \ are only used as escape characters in 5466% index files, never standing for themselves. 5467% 5468\set txiindexescapeisbackslash 5469 5470% Write the entry in \indextext to the index file. 5471% 5472 5473\newif\ifincodeindex 5474\def\doindwrite{\incodeindexfalse\doindwritex} 5475\def\docindwrite{\incodeindextrue\doindwritex} 5476 5477\def\doindwritex{% 5478 \maybemarginindex 5479 % 5480 \atdummies 5481 % 5482 \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax\else 5483 \escapeisbackslash 5484 \fi 5485 % 5486 % For texindex which always views { and } as separators. 5487 \def\{{\lbracechar{}}% 5488 \def\}{\rbracechar{}}% 5489 \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}% 5490 % 5491 % Split the entry into primary entry and any subentries, and get the index 5492 % sort key. 5493 \splitindexentry\indextext 5494 % 5495 % Set up the complete index entry, with both the sort key and 5496 % the original text, including any font commands. We write 5497 % three arguments to \entry to the .?? file (four in the 5498 % subentry case), texindex reduces to two when writing the .??s 5499 % sorted result. 5500 % 5501 \edef\temp{% 5502 \write\writeto{% 5503 \string\entry{\fullindexsortkey}% 5504 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}% 5505 \bracedtext}% 5506 }% 5507 \temp 5508} 5509 5510% Put the index entry in the margin if desired (undocumented). 5511\def\maybemarginindex{% 5512 \ifx\SETmarginindex\relax\else 5513 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}% 5514 \fi 5515} 5516\let\SETmarginindex=\relax 5517 5518 5519% Take care of unwanted page breaks/skips around a whatsit: 5520% 5521% If a skip is the last thing on the list now, preserve it 5522% by backing up by \lastskip, doing the \write, then inserting 5523% the skip again. Otherwise, the whatsit generated by the 5524% \write or \pdfdest will make \lastskip zero. The result is that 5525% sequences like this: 5526% @end defun 5527% @tindex whatever 5528% @defun ... 5529% will have extra space inserted, because the \medbreak in the 5530% start of the @defun won't see the skip inserted by the @end of 5531% the previous defun. 5532% 5533% But don't do any of this if we're not in vertical mode. We 5534% don't want to do a \vskip and prematurely end a paragraph. 5535% 5536% Avoid page breaks due to these extra skips, too. 5537% 5538% But wait, there is a catch there: 5539% We'll have to check whether \lastskip is zero skip. \ifdim is not 5540% sufficient for this purpose, as it ignores stretch and shrink parts 5541% of the skip. The only way seems to be to check the textual 5542% representation of the skip. 5543% 5544% The following is almost like \def\zeroskipmacro{0.0pt} except that 5545% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). 5546% 5547\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} 5548% 5549\newskip\whatsitskip 5550\newcount\whatsitpenalty 5551% 5552% ..., ready, GO: 5553% 5554\def\safewhatsit#1{\ifhmode 5555 #1% 5556 \else 5557 % \lastskip and \lastpenalty cannot both be nonzero simultaneously. 5558 \whatsitskip = \lastskip 5559 \edef\lastskipmacro{\the\lastskip}% 5560 \whatsitpenalty = \lastpenalty 5561 % 5562 % If \lastskip is nonzero, that means the last item was a 5563 % skip. And since a skip is discardable, that means this 5564 % -\whatsitskip glue we're inserting is preceded by a 5565 % non-discardable item, therefore it is not a potential 5566 % breakpoint, therefore no \nobreak needed. 5567 \ifx\lastskipmacro\zeroskipmacro 5568 \else 5569 \vskip-\whatsitskip 5570 \fi 5571 % 5572 #1% 5573 % 5574 \ifx\lastskipmacro\zeroskipmacro 5575 % If \lastskip was zero, perhaps the last item was a penalty, and 5576 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want 5577 % to re-insert the same penalty (values >10000 are used for various 5578 % signals); since we just inserted a non-discardable item, any 5579 % following glue (such as a \parskip) would be a breakpoint. For example: 5580 % @deffn deffn-whatever 5581 % @vindex index-whatever 5582 % Description. 5583 % would allow a break between the index-whatever whatsit 5584 % and the "Description." paragraph. 5585 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi 5586 \else 5587 % On the other hand, if we had a nonzero \lastskip, 5588 % this make-up glue would be preceded by a non-discardable item 5589 % (the whatsit from the \write), so we must insert a \nobreak. 5590 \nobreak\vskip\whatsitskip 5591 \fi 5592\fi} 5593 5594% The index entry written in the file actually looks like 5595% \entry {sortstring}{page}{topic} 5596% or 5597% \entry {sortstring}{page}{topic}{subtopic} 5598% The texindex program reads in these files and writes files 5599% containing these kinds of lines: 5600% \initial {c} 5601% before the first topic whose initial is c 5602% \entry {topic}{pagelist} 5603% for a topic that is used without subtopics 5604% \primary {topic} 5605% \entry {topic}{} 5606% for the beginning of a topic that is used with subtopics 5607% \secondary {subtopic}{pagelist} 5608% for each subtopic. 5609% \secondary {subtopic}{} 5610% for a subtopic with sub-subtopics 5611% \tertiary {subtopic}{subsubtopic}{pagelist} 5612% for each sub-subtopic. 5613 5614% Define the user-accessible indexing commands 5615% @findex, @vindex, @kindex, @cindex. 5616 5617\def\findex {\fnindex} 5618\def\kindex {\kyindex} 5619\def\cindex {\cpindex} 5620\def\vindex {\vrindex} 5621\def\tindex {\tpindex} 5622\def\pindex {\pgindex} 5623 5624% Define the macros used in formatting output of the sorted index material. 5625 5626% @printindex causes a particular index (the ??s file) to get printed. 5627% It does not print any chapter heading (usually an @unnumbered). 5628% 5629\parseargdef\printindex{\begingroup 5630 \dobreak \chapheadingskip{10000}% 5631 % 5632 \smallfonts \rm 5633 \tolerance = 9500 5634 \plainfrenchspacing 5635 \everypar = {}% don't want the \kern\-parindent from indentation suppression. 5636 % 5637 % See comment in \requireopenindexfile. 5638 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi 5639 % 5640 % See if the index file exists and is nonempty. 5641 \openin 1 \jobname.\indexname s 5642 \ifeof 1 5643 % \enddoublecolumns gets confused if there is no text in the index, 5644 % and it loses the chapter title and the aux file entries for the 5645 % index. The easiest way to prevent this problem is to make sure 5646 % there is some text. 5647 \putwordIndexNonexistent 5648 \typeout{No file \jobname.\indexname s.}% 5649 \else 5650 % If the index file exists but is empty, then \openin leaves \ifeof 5651 % false. We have to make TeX try to read something from the file, so 5652 % it can discover if there is anything in it. 5653 \read 1 to \thisline 5654 \ifeof 1 5655 \putwordIndexIsEmpty 5656 \else 5657 \expandafter\printindexzz\thisline\relax\relax\finish% 5658 \fi 5659 \fi 5660 \closein 1 5661\endgroup} 5662 5663% If the index file starts with a backslash, forgo reading the index 5664% file altogether. If somebody upgrades texinfo.tex they may still have 5665% old index files using \ as the escape character. Reading this would 5666% at best lead to typesetting garbage, at worst a TeX syntax error. 5667\def\printindexzz#1#2\finish{% 5668 \expandafter\ifx\csname SETtxiindexescapeisbackslash\endcsname\relax 5669 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1 5670 \expandafter\ifx\csname SETtxiskipindexfileswithbackslash\endcsname\relax 5671\errmessage{% 5672ERROR: A sorted index file in an obsolete format was skipped. 5673To fix this problem, please upgrade your version of 'texi2dvi' 5674or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>. 5675If you are using an old version of 'texindex' (part of the Texinfo 5676distribution), you may also need to upgrade to a newer version (at least 6.0). 5677You may be able to typeset the index if you run 5678'texindex \jobname.\indexname' yourself. 5679You could also try setting the 'txiindexescapeisbackslash' flag by 5680running a command like 5681'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do 5682this, Texinfo will try to use index files in the old format. 5683If you continue to have problems, deleting the index files and starting again 5684might help (with 'rm \jobname.?? \jobname.??s')% 5685}% 5686 \else 5687 (Skipped sorted index file in obsolete format) 5688 \fi 5689 \else 5690 \begindoublecolumns 5691 \input \jobname.\indexname s 5692 \enddoublecolumns 5693 \fi 5694 \else 5695 \begindoublecolumns 5696 \catcode`\\=0\relax 5697 % 5698 % Make @ an escape character to give macros a chance to work. This 5699 % should work because we (hopefully) don't otherwise use @ in index files. 5700 %\catcode`\@=12\relax 5701 \catcode`\@=0\relax 5702 \input \jobname.\indexname s 5703 \enddoublecolumns 5704 \fi 5705} 5706 5707% These macros are used by the sorted index file itself. 5708% Change them to control the appearance of the index. 5709 5710{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 5711\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 5712\catcode`\$=3 5713\gdef\initialglyphs{% 5714 % special control sequences used in the index sort key 5715 \let\indexlbrace\{% 5716 \let\indexrbrace\}% 5717 \let\indexatchar\@% 5718 \def\indexbackslash{\math{\backslash}}% 5719 % 5720 % Some changes for non-alphabetic characters. Using the glyphs from the 5721 % math fonts looks more consistent than the typewriter font used elsewhere 5722 % for these characters. 5723 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}} 5724 % 5725 % In case @\ is used for backslash 5726 \uppercase{\let\\=~} 5727 % Can't get bold backslash so don't use bold forward slash 5728 \catcode`\/=13 5729 \def/{{\secrmnotbold \normalslash}}% 5730 \def-{{\normaldash\normaldash}}% en dash `--' 5731 \def^{{\chapbf \normalcaret}}% 5732 \def~{{\chapbf \normaltilde}}% 5733 \def\_{% 5734 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }% 5735 \def|{$\vert$}% 5736 \def<{$\less$}% 5737 \def>{$\gtr$}% 5738 \def+{$\normalplus$}% 5739}} 5740 5741\def\initial{% 5742 \bgroup 5743 \initialglyphs 5744 \initialx 5745} 5746 5747\def\initialx#1{% 5748 % Remove any glue we may have, we'll be inserting our own. 5749 \removelastskip 5750 % 5751 % We like breaks before the index initials, so insert a bonus. 5752 % The glue before the bonus allows a little bit of space at the 5753 % bottom of a column to reduce an increase in inter-line spacing. 5754 \nobreak 5755 \vskip 0pt plus 5\baselineskip 5756 \penalty -300 5757 \vskip 0pt plus -5\baselineskip 5758 % 5759 % Typeset the initial. Making this add up to a whole number of 5760 % baselineskips increases the chance of the dots lining up from column 5761 % to column. It still won't often be perfect, because of the stretch 5762 % we need before each entry, but it's better. 5763 % 5764 % No shrink because it confuses \balancecolumns. 5765 \vskip 1.67\baselineskip plus 1\baselineskip 5766 \leftline{\secfonts \kern-0.05em \secbf #1}% 5767 % \secfonts is inside the argument of \leftline so that the change of 5768 % \baselineskip will not affect any glue inserted before the vbox that 5769 % \leftline creates. 5770 % Do our best not to break after the initial. 5771 \nobreak 5772 \vskip .33\baselineskip plus .1\baselineskip 5773 \egroup % \initialglyphs 5774} 5775 5776\newdimen\entryrightmargin 5777\entryrightmargin=0pt 5778 5779% \entry typesets a paragraph consisting of the text (#1), dot leaders, and 5780% then page number (#2) flushed to the right margin. It is used for index 5781% and table of contents entries. The paragraph is indented by \leftskip. 5782% 5783\def\entry{% 5784 \begingroup 5785 % 5786 % Start a new paragraph if necessary, so our assignments below can't 5787 % affect previous text. 5788 \par 5789 % 5790 % No extra space above this paragraph. 5791 \parskip = 0in 5792 % 5793 % When reading the text of entry, convert explicit line breaks 5794 % from @* into spaces. The user might give these in long section 5795 % titles, for instance. 5796 \def\*{\unskip\space\ignorespaces}% 5797 \def\entrybreak{\hfil\break}% An undocumented command 5798 % 5799 % Swallow the left brace of the text (first parameter): 5800 \afterassignment\doentry 5801 \let\temp = 5802} 5803\def\entrybreak{\unskip\space\ignorespaces}% 5804\def\doentry{% 5805 % Save the text of the entry 5806 \global\setbox\boxA=\hbox\bgroup 5807 \bgroup % Instead of the swallowed brace. 5808 \noindent 5809 \aftergroup\finishentry 5810 % And now comes the text of the entry. 5811 % Not absorbing as a macro argument reduces the chance of problems 5812 % with catcodes occurring. 5813} 5814{\catcode`\@=11 5815\gdef\finishentry#1{% 5816 \egroup % end box A 5817 \dimen@ = \wd\boxA % Length of text of entry 5818 \global\setbox\boxA=\hbox\bgroup 5819 \unhbox\boxA 5820 % #1 is the page number. 5821 % 5822 % Get the width of the page numbers, and only use 5823 % leaders if they are present. 5824 \global\setbox\boxB = \hbox{#1}% 5825 \ifdim\wd\boxB = 0pt 5826 \null\nobreak\hfill\ % 5827 \else 5828 % 5829 \null\nobreak\indexdotfill % Have leaders before the page number. 5830 % 5831 \ifpdforxetex 5832 \pdfgettoks#1.% 5833 \hskip\skip\thinshrinkable\the\toksA 5834 \else 5835 \hskip\skip\thinshrinkable #1% 5836 \fi 5837 \fi 5838 \egroup % end \boxA 5839 \ifdim\wd\boxB = 0pt 5840 \noindent\unhbox\boxA\par 5841 \nobreak 5842 \else\bgroup 5843 % We want the text of the entries to be aligned to the left, and the 5844 % page numbers to be aligned to the right. 5845 % 5846 \parindent = 0pt 5847 \advance\leftskip by 0pt plus 1fil 5848 \advance\leftskip by 0pt plus -1fill 5849 \rightskip = 0pt plus -1fil 5850 \advance\rightskip by 0pt plus 1fill 5851 % Cause last line, which could consist of page numbers on their own 5852 % if the list of page numbers is long, to be aligned to the right. 5853 \parfillskip=0pt plus -1fill 5854 % 5855 \advance\rightskip by \entryrightmargin 5856 % Determine how far we can stretch into the margin. 5857 % This allows, e.g., "Appendix H GNU Free Documentation License" to 5858 % fit on one line in @letterpaper format. 5859 \ifdim\entryrightmargin>2.1em 5860 \dimen@i=2.1em 5861 \else 5862 \dimen@i=0em 5863 \fi 5864 \advance \parfillskip by 0pt minus 1\dimen@i 5865 % 5866 \dimen@ii = \hsize 5867 \advance\dimen@ii by -1\leftskip 5868 \advance\dimen@ii by -1\entryrightmargin 5869 \advance\dimen@ii by 1\dimen@i 5870 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line 5871 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text 5872 % Try to split the text roughly evenly. \dimen@ will be the length of 5873 % the first line. 5874 \dimen@ = 0.7\dimen@ 5875 \dimen@ii = \hsize 5876 \ifnum\dimen@>\dimen@ii 5877 % If the entry is too long (for example, if it needs more than 5878 % two lines), use all the space in the first line. 5879 \dimen@ = \dimen@ii 5880 \fi 5881 \advance\leftskip by 0pt plus 1fill % ragged right 5882 \advance \dimen@ by 1\rightskip 5883 \parshape = 2 0pt \dimen@ 0em \dimen@ii 5884 % Ideally we'd add a finite glue at the end of the first line only, 5885 % instead of using \parshape with explicit line lengths, but TeX 5886 % doesn't seem to provide a way to do such a thing. 5887 % 5888 % Indent all lines but the first one. 5889 \advance\leftskip by 1em 5890 \advance\parindent by -1em 5891 \fi\fi 5892 \indent % start paragraph 5893 \unhbox\boxA 5894 % 5895 % Do not prefer a separate line ending with a hyphen to fewer lines. 5896 \finalhyphendemerits = 0 5897 % 5898 % Word spacing - no stretch 5899 \spaceskip=\fontdimen2\font minus \fontdimen4\font 5900 % 5901 \linepenalty=1000 % Discourage line breaks. 5902 \hyphenpenalty=5000 % Discourage hyphenation. 5903 % 5904 \par % format the paragraph 5905 \egroup % The \vbox 5906 \fi 5907 \endgroup 5908}} 5909 5910\newskip\thinshrinkable 5911\skip\thinshrinkable=.15em minus .15em 5912 5913% Like plain.tex's \dotfill, except uses up at least 1 em. 5914% The filll stretch here overpowers both the fil and fill stretch to push 5915% the page number to the right. 5916\def\indexdotfill{\cleaders 5917 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll} 5918 5919 5920\def\primary #1{\line{#1\hfil}} 5921 5922\def\secondary{\indententry{0.5cm}} 5923\def\tertiary{\indententry{1cm}} 5924 5925\def\indententry#1#2#3{% 5926 \bgroup 5927 \leftskip=#1 5928 \entry{#2}{#3}% 5929 \egroup 5930} 5931 5932% Define two-column mode, which we use to typeset indexes. 5933% Adapted from the TeXbook, page 416, which is to say, 5934% the manmac.tex format used to print the TeXbook itself. 5935\catcode`\@=11 % private names 5936 5937\newbox\partialpage 5938\newdimen\doublecolumnhsize 5939 5940\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns 5941 % If not much space left on page, start a new page. 5942 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi 5943 % 5944 % Grab any single-column material above us. 5945 \output = {% 5946 \savetopmark 5947 % 5948 \global\setbox\partialpage = \vbox{% 5949 % Unvbox the main output page. 5950 \unvbox\PAGE 5951 \kern-\topskip \kern\baselineskip 5952 }% 5953 }% 5954 \eject % run that output routine to set \partialpage 5955 % 5956 % Use the double-column output routine for subsequent pages. 5957 \output = {\doublecolumnout}% 5958 % 5959 % Change the page size parameters. We could do this once outside this 5960 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 5961 % format, but then we repeat the same computation. Repeating a couple 5962 % of assignments once per index is clearly meaningless for the 5963 % execution time, so we may as well do it in one place. 5964 % 5965 % First we halve the line length, less a little for the gutter between 5966 % the columns. We compute the gutter based on the line length, so it 5967 % changes automatically with the paper format. The magic constant 5968 % below is chosen so that the gutter has the same value (well, +-<1pt) 5969 % as it did when we hard-coded it. 5970 % 5971 % We put the result in a separate register, \doublecolumhsize, so we 5972 % can restore it in \pagesofar, after \hsize itself has (potentially) 5973 % been clobbered. 5974 % 5975 \doublecolumnhsize = \hsize 5976 \advance\doublecolumnhsize by -.04154\hsize 5977 \divide\doublecolumnhsize by 2 5978 \hsize = \doublecolumnhsize 5979 % 5980 % Get the available space for the double columns -- the normal 5981 % (undoubled) page height minus any material left over from the 5982 % previous page. 5983 \advance\vsize by -\ht\partialpage 5984 \vsize = 2\vsize 5985 % 5986 % For the benefit of balancing columns 5987 \advance\baselineskip by 0pt plus 0.5pt 5988} 5989 5990% The double-column output routine for all double-column pages except 5991% the last, which is done by \balancecolumns. 5992% 5993\def\doublecolumnout{% 5994 % 5995 \savetopmark 5996 \splittopskip=\topskip \splitmaxdepth=\maxdepth 5997 \dimen@ = \vsize 5998 \divide\dimen@ by 2 5999 % 6000 % box0 will be the left-hand column, box2 the right. 6001 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@ 6002 \global\advance\vsize by 2\ht\partialpage 6003 \onepageout\pagesofar % empty except for the first time we are called 6004 \unvbox\PAGE 6005 \penalty\outputpenalty 6006} 6007% 6008% Re-output the contents of the output page -- any previous material, 6009% followed by the two boxes we just split, in box0 and box2. 6010\def\pagesofar{% 6011 \unvbox\partialpage 6012 % 6013 \hsize = \doublecolumnhsize 6014 \wd0=\hsize \wd2=\hsize 6015 \hbox to\txipagewidth{\box0\hfil\box2}% 6016} 6017 6018 6019% Finished with double columns. 6020\def\enddoublecolumns{% 6021 % The following penalty ensures that the page builder is exercised 6022 % _before_ we change the output routine. This is necessary in the 6023 % following situation: 6024 % 6025 % The last section of the index consists only of a single entry. 6026 % Before this section, \pagetotal is less than \pagegoal, so no 6027 % break occurs before the last section starts. However, the last 6028 % section, consisting of \initial and the single \entry, does not 6029 % fit on the page and has to be broken off. Without the following 6030 % penalty the page builder will not be exercised until \eject 6031 % below, and by that time we'll already have changed the output 6032 % routine to the \balancecolumns version, so the next-to-last 6033 % double-column page will be processed with \balancecolumns, which 6034 % is wrong: The two columns will go to the main vertical list, with 6035 % the broken-off section in the recent contributions. As soon as 6036 % the output routine finishes, TeX starts reconsidering the page 6037 % break. The two columns and the broken-off section both fit on the 6038 % page, because the two columns now take up only half of the page 6039 % goal. When TeX sees \eject from below which follows the final 6040 % section, it invokes the new output routine that we've set after 6041 % \balancecolumns below; \onepageout will try to fit the two columns 6042 % and the final section into the vbox of \txipageheight (see 6043 % \pagebody), causing an overfull box. 6044 % 6045 % Note that glue won't work here, because glue does not exercise the 6046 % page builder, unlike penalties (see The TeXbook, pp. 280-281). 6047 \penalty0 6048 % 6049 \output = {% 6050 % Split the last of the double-column material. 6051 \savetopmark 6052 \balancecolumns 6053 }% 6054 \eject % call the \output just set 6055 \ifdim\pagetotal=0pt 6056 % Having called \balancecolumns once, we do not 6057 % want to call it again. Therefore, reset \output to its normal 6058 % definition right away. 6059 \global\output=\expandafter{\the\defaultoutput} 6060 % 6061 \endgroup % started in \begindoublecolumns 6062 % Leave the double-column material on the current page, no automatic 6063 % page break. 6064 \box\balancedcolumns 6065 % 6066 % \pagegoal was set to the doubled \vsize above, since we restarted 6067 % the current page. We're now back to normal single-column 6068 % typesetting, so reset \pagegoal to the normal \vsize. 6069 \global\vsize = \txipageheight % 6070 \pagegoal = \txipageheight % 6071 \else 6072 % We had some left-over material. This might happen when \doublecolumnout 6073 % is called in \balancecolumns. Try again. 6074 \expandafter\enddoublecolumns 6075 \fi 6076} 6077\newbox\balancedcolumns 6078\setbox\balancedcolumns=\vbox{shouldnt see this}% 6079% 6080% Only called for the last of the double column material. \doublecolumnout 6081% does the others. 6082\def\balancecolumns{% 6083 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120. 6084 \dimen@ = \ht0 6085 \ifdim\dimen@<7\baselineskip 6086 % Don't split a short final column in two. 6087 \setbox2=\vbox{}% 6088 \global\setbox\balancedcolumns=\vbox{\pagesofar}% 6089 \else 6090 % double the leading vertical space 6091 \advance\dimen@ by \topskip 6092 \advance\dimen@ by-\baselineskip 6093 \divide\dimen@ by 2 % target to split to 6094 \dimen@ii = \dimen@ 6095 \splittopskip = \topskip 6096 % Loop until left column is at least as high as the right column. 6097 {% 6098 \vbadness = 10000 6099 \loop 6100 \global\setbox3 = \copy0 6101 \global\setbox1 = \vsplit3 to \dimen@ 6102 \ifdim\ht1<\ht3 6103 \global\advance\dimen@ by 1pt 6104 \repeat 6105 }% 6106 % Now the left column is in box 1, and the right column in box 3. 6107 % 6108 % Check whether the left column has come out higher than the page itself. 6109 % (Note that we have doubled \vsize for the double columns, so 6110 % the actual height of the page is 0.5\vsize). 6111 \ifdim2\ht1>\vsize 6112 % It appears that we have been called upon to balance too much material. 6113 % Output some of it with \doublecolumnout, leaving the rest on the page. 6114 \setbox\PAGE=\box0 6115 \doublecolumnout 6116 \else 6117 % Compare the heights of the two columns. 6118 \ifdim4\ht1>5\ht3 6119 % Column heights are too different, so don't make their bottoms 6120 % flush with each other. 6121 \setbox2=\vbox to \ht1 {\unvbox3\vfill}% 6122 \setbox0=\vbox to \ht1 {\unvbox1\vfill}% 6123 \else 6124 % Make column bottoms flush with each other. 6125 \setbox2=\vbox to\ht1{\unvbox3\unskip}% 6126 \setbox0=\vbox to\ht1{\unvbox1\unskip}% 6127 \fi 6128 \global\setbox\balancedcolumns=\vbox{\pagesofar}% 6129 \fi 6130 \fi 6131 % 6132} 6133\catcode`\@ = \other 6134 6135 6136\message{sectioning,} 6137% Chapters, sections, etc. 6138 6139% Let's start with @part. 6140\outer\parseargdef\part{\partzzz{#1}} 6141\def\partzzz#1{% 6142 \chapoddpage 6143 \null 6144 \vskip.3\vsize % move it down on the page a bit 6145 \begingroup 6146 \noindent \titlefonts\rm #1\par % the text 6147 \let\lastnode=\empty % no node to associate with 6148 \writetocentry{part}{#1}{}% but put it in the toc 6149 \headingsoff % no headline or footline on the part page 6150 % This outputs a mark at the end of the page that clears \thischapter 6151 % and \thissection, as is done in \startcontents. 6152 \let\pchapsepmacro\relax 6153 \chapmacro{}{Yomitfromtoc}{}% 6154 \chapoddpage 6155 \endgroup 6156} 6157 6158% \unnumberedno is an oxymoron. But we count the unnumbered 6159% sections so that we can refer to them unambiguously in the pdf 6160% outlines by their "section number". We avoid collisions with chapter 6161% numbers by starting them at 10000. (If a document ever has 10000 6162% chapters, we're in trouble anyway, I'm sure.) 6163\newcount\unnumberedno \unnumberedno = 10000 6164\newcount\chapno 6165\newcount\secno \secno=0 6166\newcount\subsecno \subsecno=0 6167\newcount\subsubsecno \subsubsecno=0 6168 6169% This counter is funny since it counts through charcodes of letters A, B, ... 6170\newcount\appendixno \appendixno = `\@ 6171% 6172% \def\appendixletter{\char\the\appendixno} 6173% We do the following ugly conditional instead of the above simple 6174% construct for the sake of pdftex, which needs the actual 6175% letter in the expansion, not just typeset. 6176% 6177\def\appendixletter{% 6178 \ifnum\appendixno=`A A% 6179 \else\ifnum\appendixno=`B B% 6180 \else\ifnum\appendixno=`C C% 6181 \else\ifnum\appendixno=`D D% 6182 \else\ifnum\appendixno=`E E% 6183 \else\ifnum\appendixno=`F F% 6184 \else\ifnum\appendixno=`G G% 6185 \else\ifnum\appendixno=`H H% 6186 \else\ifnum\appendixno=`I I% 6187 \else\ifnum\appendixno=`J J% 6188 \else\ifnum\appendixno=`K K% 6189 \else\ifnum\appendixno=`L L% 6190 \else\ifnum\appendixno=`M M% 6191 \else\ifnum\appendixno=`N N% 6192 \else\ifnum\appendixno=`O O% 6193 \else\ifnum\appendixno=`P P% 6194 \else\ifnum\appendixno=`Q Q% 6195 \else\ifnum\appendixno=`R R% 6196 \else\ifnum\appendixno=`S S% 6197 \else\ifnum\appendixno=`T T% 6198 \else\ifnum\appendixno=`U U% 6199 \else\ifnum\appendixno=`V V% 6200 \else\ifnum\appendixno=`W W% 6201 \else\ifnum\appendixno=`X X% 6202 \else\ifnum\appendixno=`Y Y% 6203 \else\ifnum\appendixno=`Z Z% 6204 % The \the is necessary, despite appearances, because \appendixletter is 6205 % expanded while writing the .toc file. \char\appendixno is not 6206 % expandable, thus it is written literally, thus all appendixes come out 6207 % with the same letter (or @) in the toc without it. 6208 \else\char\the\appendixno 6209 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 6210 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} 6211 6212% Each @chapter defines these (using marks) as the number+name, number 6213% and name of the chapter. Page headings and footings can use 6214% these. @section does likewise. 6215\def\thischapter{} 6216\def\thischapternum{} 6217\def\thischaptername{} 6218\def\thissection{} 6219\def\thissectionnum{} 6220\def\thissectionname{} 6221 6222\newcount\absseclevel % used to calculate proper heading level 6223\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count 6224 6225% @raisesections: treat @section as chapter, @subsection as section, etc. 6226\def\raisesections{\global\advance\secbase by -1} 6227 6228% @lowersections: treat @chapter as section, @section as subsection, etc. 6229\def\lowersections{\global\advance\secbase by 1} 6230 6231% we only have subsub. 6232\chardef\maxseclevel = 3 6233% 6234% A numbered section within an unnumbered changes to unnumbered too. 6235% To achieve this, remember the "biggest" unnum. sec. we are currently in: 6236\chardef\unnlevel = \maxseclevel 6237% 6238% Trace whether the current chapter is an appendix or not: 6239% \chapheadtype is "N" or "A", unnumbered chapters are ignored. 6240\def\chapheadtype{N} 6241 6242% Choose a heading macro 6243% #1 is heading type 6244% #2 is heading level 6245% #3 is text for heading 6246\def\genhead#1#2#3{% 6247 % Compute the abs. sec. level: 6248 \absseclevel=#2 6249 \advance\absseclevel by \secbase 6250 % Make sure \absseclevel doesn't fall outside the range: 6251 \ifnum \absseclevel < 0 6252 \absseclevel = 0 6253 \else 6254 \ifnum \absseclevel > 3 6255 \absseclevel = 3 6256 \fi 6257 \fi 6258 % The heading type: 6259 \def\headtype{#1}% 6260 \if \headtype U% 6261 \ifnum \absseclevel < \unnlevel 6262 \chardef\unnlevel = \absseclevel 6263 \fi 6264 \else 6265 % Check for appendix sections: 6266 \ifnum \absseclevel = 0 6267 \edef\chapheadtype{\headtype}% 6268 \else 6269 \if \headtype A\if \chapheadtype N% 6270 \errmessage{@appendix... within a non-appendix chapter}% 6271 \fi\fi 6272 \fi 6273 % Check for numbered within unnumbered: 6274 \ifnum \absseclevel > \unnlevel 6275 \def\headtype{U}% 6276 \else 6277 \chardef\unnlevel = 3 6278 \fi 6279 \fi 6280 % Now print the heading: 6281 \if \headtype U% 6282 \ifcase\absseclevel 6283 \unnumberedzzz{#3}% 6284 \or \unnumberedseczzz{#3}% 6285 \or \unnumberedsubseczzz{#3}% 6286 \or \unnumberedsubsubseczzz{#3}% 6287 \fi 6288 \else 6289 \if \headtype A% 6290 \ifcase\absseclevel 6291 \appendixzzz{#3}% 6292 \or \appendixsectionzzz{#3}% 6293 \or \appendixsubseczzz{#3}% 6294 \or \appendixsubsubseczzz{#3}% 6295 \fi 6296 \else 6297 \ifcase\absseclevel 6298 \chapterzzz{#3}% 6299 \or \seczzz{#3}% 6300 \or \numberedsubseczzz{#3}% 6301 \or \numberedsubsubseczzz{#3}% 6302 \fi 6303 \fi 6304 \fi 6305 \suppressfirstparagraphindent 6306} 6307 6308% an interface: 6309\def\numhead{\genhead N} 6310\def\apphead{\genhead A} 6311\def\unnmhead{\genhead U} 6312 6313% @chapter, @appendix, @unnumbered. Increment top-level counter, reset 6314% all lower-level sectioning counters to zero. 6315% 6316% Also set \chaplevelprefix, which we prepend to @float sequence numbers 6317% (e.g., figures), q.v. By default (before any chapter), that is empty. 6318\let\chaplevelprefix = \empty 6319% 6320\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz 6321\def\chapterzzz#1{% 6322 % section resetting is \global in case the chapter is in a group, such 6323 % as an @include file. 6324 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6325 \global\advance\chapno by 1 6326 % 6327 % Used for \float. 6328 \gdef\chaplevelprefix{\the\chapno.}% 6329 \resetallfloatnos 6330 % 6331 % \putwordChapter can contain complex things in translations. 6332 \toks0=\expandafter{\putwordChapter}% 6333 \message{\the\toks0 \space \the\chapno}% 6334 % 6335 % Write the actual heading. 6336 \chapmacro{#1}{Ynumbered}{\the\chapno}% 6337 % 6338 % So @section and the like are numbered underneath this chapter. 6339 \global\let\section = \numberedsec 6340 \global\let\subsection = \numberedsubsec 6341 \global\let\subsubsection = \numberedsubsubsec 6342} 6343 6344\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz 6345% 6346\def\appendixzzz#1{% 6347 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6348 \global\advance\appendixno by 1 6349 \gdef\chaplevelprefix{\appendixletter.}% 6350 \resetallfloatnos 6351 % 6352 % \putwordAppendix can contain complex things in translations. 6353 \toks0=\expandafter{\putwordAppendix}% 6354 \message{\the\toks0 \space \appendixletter}% 6355 % 6356 \chapmacro{#1}{Yappendix}{\appendixletter}% 6357 % 6358 \global\let\section = \appendixsec 6359 \global\let\subsection = \appendixsubsec 6360 \global\let\subsubsection = \appendixsubsubsec 6361} 6362 6363% normally unnmhead0 calls unnumberedzzz: 6364\outer\parseargdef\unnumbered{\unnmhead0{#1}} 6365\def\unnumberedzzz#1{% 6366 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6367 \global\advance\unnumberedno by 1 6368 % 6369 % Since an unnumbered has no number, no prefix for figures. 6370 \global\let\chaplevelprefix = \empty 6371 \resetallfloatnos 6372 % 6373 % This used to be simply \message{#1}, but TeX fully expands the 6374 % argument to \message. Therefore, if #1 contained @-commands, TeX 6375 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX 6376 % expanded @cite (which turns out to cause errors because \cite is meant 6377 % to be executed, not expanded). 6378 % 6379 % Anyway, we don't want the fully-expanded definition of @cite to appear 6380 % as a result of the \message, we just want `@cite' itself. We use 6381 % \the<toks register> to achieve this: TeX expands \the<toks> only once, 6382 % simply yielding the contents of <toks register>. (We also do this for 6383 % the toc entries.) 6384 \toks0 = {#1}% 6385 \message{(\the\toks0)}% 6386 % 6387 \chapmacro{#1}{Ynothing}{\the\unnumberedno}% 6388 % 6389 \global\let\section = \unnumberedsec 6390 \global\let\subsection = \unnumberedsubsec 6391 \global\let\subsubsection = \unnumberedsubsubsec 6392} 6393 6394% @centerchap is like @unnumbered, but the heading is centered. 6395\outer\parseargdef\centerchap{% 6396 \let\centerparametersmaybe = \centerparameters 6397 \unnmhead0{#1}% 6398 \let\centerparametersmaybe = \relax 6399} 6400 6401% @top is like @unnumbered. 6402\let\top\unnumbered 6403 6404% Sections. 6405% 6406\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz 6407\def\seczzz#1{% 6408 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6409 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% 6410} 6411 6412% normally calls appendixsectionzzz: 6413\outer\parseargdef\appendixsection{\apphead1{#1}} 6414\def\appendixsectionzzz#1{% 6415 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6416 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% 6417} 6418\let\appendixsec\appendixsection 6419 6420% normally calls unnumberedseczzz: 6421\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} 6422\def\unnumberedseczzz#1{% 6423 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6424 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% 6425} 6426 6427% Subsections. 6428% 6429% normally calls numberedsubseczzz: 6430\outer\parseargdef\numberedsubsec{\numhead2{#1}} 6431\def\numberedsubseczzz#1{% 6432 \global\subsubsecno=0 \global\advance\subsecno by 1 6433 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% 6434} 6435 6436% normally calls appendixsubseczzz: 6437\outer\parseargdef\appendixsubsec{\apphead2{#1}} 6438\def\appendixsubseczzz#1{% 6439 \global\subsubsecno=0 \global\advance\subsecno by 1 6440 \sectionheading{#1}{subsec}{Yappendix}% 6441 {\appendixletter.\the\secno.\the\subsecno}% 6442} 6443 6444% normally calls unnumberedsubseczzz: 6445\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} 6446\def\unnumberedsubseczzz#1{% 6447 \global\subsubsecno=0 \global\advance\subsecno by 1 6448 \sectionheading{#1}{subsec}{Ynothing}% 6449 {\the\unnumberedno.\the\secno.\the\subsecno}% 6450} 6451 6452% Subsubsections. 6453% 6454% normally numberedsubsubseczzz: 6455\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} 6456\def\numberedsubsubseczzz#1{% 6457 \global\advance\subsubsecno by 1 6458 \sectionheading{#1}{subsubsec}{Ynumbered}% 6459 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% 6460} 6461 6462% normally appendixsubsubseczzz: 6463\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} 6464\def\appendixsubsubseczzz#1{% 6465 \global\advance\subsubsecno by 1 6466 \sectionheading{#1}{subsubsec}{Yappendix}% 6467 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% 6468} 6469 6470% normally unnumberedsubsubseczzz: 6471\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} 6472\def\unnumberedsubsubseczzz#1{% 6473 \global\advance\subsubsecno by 1 6474 \sectionheading{#1}{subsubsec}{Ynothing}% 6475 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% 6476} 6477 6478% These macros control what the section commands do, according 6479% to what kind of chapter we are in (ordinary, appendix, or unnumbered). 6480% Define them by default for a numbered chapter. 6481\let\section = \numberedsec 6482\let\subsection = \numberedsubsec 6483\let\subsubsection = \numberedsubsubsec 6484 6485% Define @majorheading, @heading and @subheading 6486 6487\def\majorheading{% 6488 {\advance\chapheadingskip by 10pt \chapbreak }% 6489 \parsearg\chapheadingzzz 6490} 6491 6492\def\chapheading{\chapbreak \parsearg\chapheadingzzz} 6493\def\chapheadingzzz#1{% 6494 \vbox{\chapfonts \raggedtitlesettings #1\par}% 6495 \nobreak\bigskip \nobreak 6496 \suppressfirstparagraphindent 6497} 6498 6499% @heading, @subheading, @subsubheading. 6500\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} 6501 \suppressfirstparagraphindent} 6502\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} 6503 \suppressfirstparagraphindent} 6504\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} 6505 \suppressfirstparagraphindent} 6506 6507% These macros generate a chapter, section, etc. heading only 6508% (including whitespace, linebreaking, etc. around it), 6509% given all the information in convenient, parsed form. 6510 6511% Args are the skip and penalty (usually negative) 6512\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} 6513 6514% Parameter controlling skip before chapter headings (if needed) 6515\newskip\chapheadingskip 6516 6517% Define plain chapter starts, and page on/off switching for it. 6518\def\chapbreak{\dobreak \chapheadingskip {-4000}} 6519 6520% Start a new page 6521\def\chappager{\par\vfill\supereject} 6522 6523% \chapoddpage - start on an odd page for a new chapter 6524% Because \domark is called before \chapoddpage, the filler page will 6525% get the headings for the next chapter, which is wrong. But we don't 6526% care -- we just disable all headings on the filler page. 6527\def\chapoddpage{% 6528 \chappager 6529 \ifodd\pageno \else 6530 \begingroup 6531 \headingsoff 6532 \null 6533 \chappager 6534 \endgroup 6535 \fi 6536} 6537 6538\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname} 6539 6540\def\CHAPPAGoff{% 6541\global\let\contentsalignmacro = \chappager 6542\global\let\pchapsepmacro=\chapbreak 6543\global\def\HEADINGSon{\HEADINGSsinglechapoff}} 6544 6545\def\CHAPPAGon{% 6546\global\let\contentsalignmacro = \chappager 6547\global\let\pchapsepmacro=\chappager 6548\global\def\HEADINGSon{\HEADINGSsingle}} 6549 6550\def\CHAPPAGodd{% 6551\global\let\contentsalignmacro = \chapoddpage 6552\global\let\pchapsepmacro=\chapoddpage 6553\global\def\HEADINGSon{\HEADINGSdouble}} 6554 6555\CHAPPAGon 6556 6557% \chapmacro - Chapter opening. 6558% 6559% #1 is the text, #2 is the section type (Ynumbered, Ynothing, 6560% Yappendix, Yomitfromtoc), #3 the chapter number. 6561% Not used for @heading series. 6562% 6563% To test against our argument. 6564\def\Ynothingkeyword{Ynothing} 6565\def\Yappendixkeyword{Yappendix} 6566\def\Yomitfromtockeyword{Yomitfromtoc} 6567% 6568\def\chapmacro#1#2#3{% 6569 \expandafter\ifx\thisenv\titlepage\else 6570 \checkenv{}% chapters, etc., should not start inside an environment. 6571 \fi 6572 % Insert the first mark before the heading break (see notes for \domark). 6573 \let\prevchapterdefs=\currentchapterdefs 6574 \let\prevsectiondefs=\currentsectiondefs 6575 \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% 6576 \gdef\thissection{}}% 6577 % 6578 \def\temptype{#2}% 6579 \ifx\temptype\Ynothingkeyword 6580 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% 6581 \gdef\thischapter{\thischaptername}}% 6582 \else\ifx\temptype\Yomitfromtockeyword 6583 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% 6584 \gdef\thischapter{}}% 6585 \else\ifx\temptype\Yappendixkeyword 6586 \toks0={#1}% 6587 \xdef\currentchapterdefs{% 6588 \gdef\noexpand\thischaptername{\the\toks0}% 6589 \gdef\noexpand\thischapternum{\appendixletter}% 6590 % \noexpand\putwordAppendix avoids expanding indigestible 6591 % commands in some of the translations. 6592 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} 6593 \noexpand\thischapternum: 6594 \noexpand\thischaptername}% 6595 }% 6596 \else 6597 \toks0={#1}% 6598 \xdef\currentchapterdefs{% 6599 \gdef\noexpand\thischaptername{\the\toks0}% 6600 \gdef\noexpand\thischapternum{\the\chapno}% 6601 % \noexpand\putwordChapter avoids expanding indigestible 6602 % commands in some of the translations. 6603 \gdef\noexpand\thischapter{\noexpand\putwordChapter{} 6604 \noexpand\thischapternum: 6605 \noexpand\thischaptername}% 6606 }% 6607 \fi\fi\fi 6608 % 6609 % Output the mark. Pass it through \safewhatsit, to take care of 6610 % the preceding space. 6611 \safewhatsit\domark 6612 % 6613 % Insert the chapter heading break. 6614 \pchapsepmacro 6615 % 6616 % Now the second mark, after the heading break. No break points 6617 % between here and the heading. 6618 \let\prevchapterdefs=\currentchapterdefs 6619 \let\prevsectiondefs=\currentsectiondefs 6620 \domark 6621 % 6622 {% 6623 \chapfonts \rm 6624 \let\footnote=\errfootnoteheading % give better error message 6625 % 6626 % Have to define \currentsection before calling \donoderef, because the 6627 % xref code eventually uses it. On the other hand, it has to be called 6628 % after \pchapsepmacro, or the headline will change too soon. 6629 \gdef\currentsection{#1}% 6630 % 6631 % Only insert the separating space if we have a chapter/appendix 6632 % number, and don't print the unnumbered ``number''. 6633 \ifx\temptype\Ynothingkeyword 6634 \setbox0 = \hbox{}% 6635 \def\toctype{unnchap}% 6636 \else\ifx\temptype\Yomitfromtockeyword 6637 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry 6638 \def\toctype{omit}% 6639 \else\ifx\temptype\Yappendixkeyword 6640 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% 6641 \def\toctype{app}% 6642 \else 6643 \setbox0 = \hbox{#3\enspace}% 6644 \def\toctype{numchap}% 6645 \fi\fi\fi 6646 % 6647 % Write the toc entry for this chapter. Must come before the 6648 % \donoderef, because we include the current node name in the toc 6649 % entry, and \donoderef resets it to empty. 6650 \writetocentry{\toctype}{#1}{#3}% 6651 % 6652 % For pdftex, we have to write out the node definition (aka, make 6653 % the pdfdest) after any page break, but before the actual text has 6654 % been typeset. If the destination for the pdf outline is after the 6655 % text, then jumping from the outline may wind up with the text not 6656 % being visible, for instance under high magnification. 6657 \donoderef{#2}% 6658 % 6659 % Typeset the actual heading. 6660 \nobreak % Avoid page breaks at the interline glue. 6661 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe 6662 \unhbox0 #1\par}% 6663 }% 6664 \nobreak\bigskip % no page break after a chapter title 6665 \nobreak 6666} 6667 6668% @centerchap -- centered and unnumbered. 6669\let\centerparametersmaybe = \relax 6670\def\centerparameters{% 6671 \advance\rightskip by 3\rightskip 6672 \leftskip = \rightskip 6673 \parfillskip = 0pt 6674} 6675 6676 6677% Section titles. These macros combine the section number parts and 6678% call the generic \sectionheading to do the printing. 6679% 6680\newskip\secheadingskip 6681\def\secheadingbreak{\dobreak \secheadingskip{-1000}} 6682 6683% Subsection titles. 6684\newskip\subsecheadingskip 6685\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} 6686 6687% Subsubsection titles. 6688\def\subsubsecheadingskip{\subsecheadingskip} 6689\def\subsubsecheadingbreak{\subsecheadingbreak} 6690 6691 6692% Print any size, any type, section title. 6693% 6694% #1 is the text of the title, 6695% #2 is the section level (sec/subsec/subsubsec), 6696% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc), 6697% #4 is the section number. 6698% 6699\def\seckeyword{sec} 6700% 6701\def\sectionheading#1#2#3#4{% 6702 {% 6703 \def\sectionlevel{#2}% 6704 \def\temptype{#3}% 6705 % 6706 % It is ok for the @heading series commands to appear inside an 6707 % environment (it's been historically allowed, though the logic is 6708 % dubious), but not the others. 6709 \ifx\temptype\Yomitfromtockeyword\else 6710 \checkenv{}% non-@*heading should not be in an environment. 6711 \fi 6712 \let\footnote=\errfootnoteheading 6713 % 6714 % Switch to the right set of fonts. 6715 \csname #2fonts\endcsname \rm 6716 % 6717 % Insert first mark before the heading break (see notes for \domark). 6718 \let\prevsectiondefs=\currentsectiondefs 6719 \ifx\temptype\Ynothingkeyword 6720 \ifx\sectionlevel\seckeyword 6721 \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% 6722 \gdef\thissection{\thissectionname}}% 6723 \fi 6724 \else\ifx\temptype\Yomitfromtockeyword 6725 % Don't redefine \thissection. 6726 \else\ifx\temptype\Yappendixkeyword 6727 \ifx\sectionlevel\seckeyword 6728 \toks0={#1}% 6729 \xdef\currentsectiondefs{% 6730 \gdef\noexpand\thissectionname{\the\toks0}% 6731 \gdef\noexpand\thissectionnum{#4}% 6732 % \noexpand\putwordSection avoids expanding indigestible 6733 % commands in some of the translations. 6734 \gdef\noexpand\thissection{\noexpand\putwordSection{} 6735 \noexpand\thissectionnum: 6736 \noexpand\thissectionname}% 6737 }% 6738 \fi 6739 \else 6740 \ifx\sectionlevel\seckeyword 6741 \toks0={#1}% 6742 \xdef\currentsectiondefs{% 6743 \gdef\noexpand\thissectionname{\the\toks0}% 6744 \gdef\noexpand\thissectionnum{#4}% 6745 % \noexpand\putwordSection avoids expanding indigestible 6746 % commands in some of the translations. 6747 \gdef\noexpand\thissection{\noexpand\putwordSection{} 6748 \noexpand\thissectionnum: 6749 \noexpand\thissectionname}% 6750 }% 6751 \fi 6752 \fi\fi\fi 6753 % 6754 % Go into vertical mode. Usually we'll already be there, but we 6755 % don't want the following whatsit to end up in a preceding paragraph 6756 % if the document didn't happen to have a blank line. 6757 \par 6758 % 6759 % Output the mark. Pass it through \safewhatsit, to take care of 6760 % the preceding space. 6761 \safewhatsit\domark 6762 % 6763 % Insert space above the heading. 6764 \csname #2headingbreak\endcsname 6765 % 6766 % Now the second mark, after the heading break. No break points 6767 % between here and the heading. 6768 \global\let\prevsectiondefs=\currentsectiondefs 6769 \domark 6770 % 6771 % Only insert the space after the number if we have a section number. 6772 \ifx\temptype\Ynothingkeyword 6773 \setbox0 = \hbox{}% 6774 \def\toctype{unn}% 6775 \gdef\currentsection{#1}% 6776 \else\ifx\temptype\Yomitfromtockeyword 6777 % for @headings -- no section number, don't include in toc, 6778 % and don't redefine \currentsection. 6779 \setbox0 = \hbox{}% 6780 \def\toctype{omit}% 6781 \let\sectionlevel=\empty 6782 \else\ifx\temptype\Yappendixkeyword 6783 \setbox0 = \hbox{#4\enspace}% 6784 \def\toctype{app}% 6785 \gdef\currentsection{#1}% 6786 \else 6787 \setbox0 = \hbox{#4\enspace}% 6788 \def\toctype{num}% 6789 \gdef\currentsection{#1}% 6790 \fi\fi\fi 6791 % 6792 % Write the toc entry (before \donoderef). See comments in \chapmacro. 6793 \writetocentry{\toctype\sectionlevel}{#1}{#4}% 6794 % 6795 % Write the node reference (= pdf destination for pdftex). 6796 % Again, see comments in \chapmacro. 6797 \donoderef{#3}% 6798 % 6799 % Interline glue will be inserted when the vbox is completed. 6800 % That glue will be a valid breakpoint for the page, since it'll be 6801 % preceded by a whatsit (usually from the \donoderef, or from the 6802 % \writetocentry if there was no node). We don't want to allow that 6803 % break, since then the whatsits could end up on page n while the 6804 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. 6805 \nobreak 6806 % 6807 % Output the actual section heading. 6808 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright 6809 \hangindent=\wd0 % zero if no section number 6810 \unhbox0 #1}% 6811 }% 6812 % Add extra space after the heading -- half of whatever came above it. 6813 % Don't allow stretch, though. 6814 \kern .5 \csname #2headingskip\endcsname 6815 % 6816 % Do not let the kern be a potential breakpoint, as it would be if it 6817 % was followed by glue. 6818 \nobreak 6819 % 6820 % We'll almost certainly start a paragraph next, so don't let that 6821 % glue accumulate. (Not a breakpoint because it's preceded by a 6822 % discardable item.) However, when a paragraph is not started next 6823 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out 6824 % or the negative glue will cause weirdly wrong output, typically 6825 % obscuring the section heading with something else. 6826 \vskip-\parskip 6827 % 6828 % This is so the last item on the main vertical list is a known 6829 % \penalty > 10000, so \startdefun, etc., can recognize the situation 6830 % and do the needful. 6831 \penalty 10001 6832} 6833 6834 6835\message{toc,} 6836% Table of contents. 6837\newwrite\tocfile 6838 6839% Write an entry to the toc file, opening it if necessary. 6840% Called from @chapter, etc. 6841% 6842% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} 6843% We append the current node name (if any) and page number as additional 6844% arguments for the \{chap,sec,...}entry macros which will eventually 6845% read this. The node name is used in the pdf outlines as the 6846% destination to jump to. 6847% 6848% We open the .toc file for writing here instead of at @setfilename (or 6849% any other fixed time) so that @contents can be anywhere in the document. 6850% But if #1 is `omit', then we don't do anything. This is used for the 6851% table of contents chapter openings themselves. 6852% 6853\newif\iftocfileopened 6854\def\omitkeyword{omit}% 6855% 6856\def\writetocentry#1#2#3{% 6857 \edef\writetoctype{#1}% 6858 \ifx\writetoctype\omitkeyword \else 6859 \iftocfileopened\else 6860 \immediate\openout\tocfile = \jobname.toc 6861 \global\tocfileopenedtrue 6862 \fi 6863 % 6864 \iflinks 6865 {\atdummies 6866 \edef\temp{% 6867 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% 6868 \temp 6869 }% 6870 \fi 6871 \fi 6872 % 6873 % Tell \shipout to create a pdf destination on each page, if we're 6874 % writing pdf. These are used in the table of contents. We can't 6875 % just write one on every page because the title pages are numbered 6876 % 1 and 2 (the page numbers aren't printed), and so are the first 6877 % two pages of the document. Thus, we'd have two destinations named 6878 % `1', and two named `2'. 6879 \ifpdforxetex 6880 \global\pdfmakepagedesttrue 6881 \fi 6882} 6883 6884 6885% These characters do not print properly in the Computer Modern roman 6886% fonts, so we must take special care. This is more or less redundant 6887% with the Texinfo input format setup at the end of this file. 6888% 6889\def\activecatcodes{% 6890 \catcode`\"=\active 6891 \catcode`\$=\active 6892 \catcode`\<=\active 6893 \catcode`\>=\active 6894 \catcode`\\=\active 6895 \catcode`\^=\active 6896 \catcode`\_=\active 6897 \catcode`\|=\active 6898 \catcode`\~=\active 6899} 6900 6901 6902% Read the toc file, which is essentially Texinfo input. 6903\def\readtocfile{% 6904 \setupdatafile 6905 \activecatcodes 6906 \input \tocreadfilename 6907} 6908 6909\newskip\contentsrightmargin \contentsrightmargin=1in 6910\newcount\savepageno 6911\newcount\lastnegativepageno \lastnegativepageno = -1 6912 6913% Prepare to read what we've written to \tocfile. 6914% 6915\def\startcontents#1{% 6916 % If @setchapternewpage on, and @headings double, the contents should 6917 % start on an odd page, unlike chapters. 6918 \contentsalignmacro 6919 \immediate\closeout\tocfile 6920 % 6921 % Don't need to put `Contents' or `Short Contents' in the headline. 6922 % It is abundantly clear what they are. 6923 \chapmacro{#1}{Yomitfromtoc}{}% 6924 % 6925 \savepageno = \pageno 6926 \begingroup % Set up to handle contents files properly. 6927 \raggedbottom % Worry more about breakpoints than the bottom. 6928 \entryrightmargin=\contentsrightmargin % Don't use the full line length. 6929 % 6930 % Roman numerals for page numbers. 6931 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi 6932 \def\thistitle{}% no title in double-sided headings 6933 % Record where the Roman numerals started. 6934 \ifnum\romancount=0 \global\romancount=\pagecount \fi 6935} 6936 6937% redefined for the two-volume lispref. We always output on 6938% \jobname.toc even if this is redefined. 6939% 6940\def\tocreadfilename{\jobname.toc} 6941 6942% Normal (long) toc. 6943% 6944\def\contents{% 6945 \startcontents{\putwordTOC}% 6946 \openin 1 \tocreadfilename\space 6947 \ifeof 1 \else 6948 \readtocfile 6949 \fi 6950 \vfill \eject 6951 \contentsalignmacro % in case @setchapternewpage odd is in effect 6952 \ifeof 1 \else 6953 \pdfmakeoutlines 6954 \fi 6955 \closein 1 6956 \endgroup 6957 \contentsendroman 6958} 6959 6960% And just the chapters. 6961\def\summarycontents{% 6962 \startcontents{\putwordShortTOC}% 6963 % 6964 \let\partentry = \shortpartentry 6965 \let\numchapentry = \shortchapentry 6966 \let\appentry = \shortchapentry 6967 \let\unnchapentry = \shortunnchapentry 6968 % We want a true roman here for the page numbers. 6969 \secfonts 6970 \let\rm=\shortcontrm \let\bf=\shortcontbf 6971 \let\sl=\shortcontsl \let\tt=\shortconttt 6972 \rm 6973 \hyphenpenalty = 10000 6974 \advance\baselineskip by 1pt % Open it up a little. 6975 \def\numsecentry##1##2##3##4{} 6976 \let\appsecentry = \numsecentry 6977 \let\unnsecentry = \numsecentry 6978 \let\numsubsecentry = \numsecentry 6979 \let\appsubsecentry = \numsecentry 6980 \let\unnsubsecentry = \numsecentry 6981 \let\numsubsubsecentry = \numsecentry 6982 \let\appsubsubsecentry = \numsecentry 6983 \let\unnsubsubsecentry = \numsecentry 6984 \openin 1 \tocreadfilename\space 6985 \ifeof 1 \else 6986 \readtocfile 6987 \fi 6988 \closein 1 6989 \vfill \eject 6990 \contentsalignmacro % in case @setchapternewpage odd is in effect 6991 \endgroup 6992 \contentsendroman 6993} 6994\let\shortcontents = \summarycontents 6995 6996% Get ready to use Arabic numerals again 6997\def\contentsendroman{% 6998 \lastnegativepageno = \pageno 6999 \global\pageno = \savepageno 7000 % 7001 % If \romancount > \arabiccount, the contents are at the end of the 7002 % document. Otherwise, advance where the Arabic numerals start for 7003 % the page numbers. 7004 \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi 7005} 7006 7007% Typeset the label for a chapter or appendix for the short contents. 7008% The arg is, e.g., `A' for an appendix, or `3' for a chapter. 7009% 7010\def\shortchaplabel#1{% 7011 % This space should be enough, since a single number is .5em, and the 7012 % widest letter (M) is 1em, at least in the Computer Modern fonts. 7013 % But use \hss just in case. 7014 % (This space doesn't include the extra space that gets added after 7015 % the label; that gets put in by \shortchapentry above.) 7016 % 7017 % We'd like to right-justify chapter numbers, but that looks strange 7018 % with appendix letters. And right-justifying numbers and 7019 % left-justifying letters looks strange when there is less than 10 7020 % chapters. Have to read the whole toc once to know how many chapters 7021 % there are before deciding ... 7022 \hbox to 1em{#1\hss}% 7023} 7024 7025% These macros generate individual entries in the table of contents. 7026% The first argument is the chapter or section name. 7027% The last argument is the page number. 7028% The arguments in between are the chapter number, section number, ... 7029 7030% Parts, in the main contents. Replace the part number, which doesn't 7031% exist, with an empty box. Let's hope all the numbers have the same width. 7032% Also ignore the page number, which is conventionally not printed. 7033\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} 7034\def\partentry#1#2#3#4{% 7035 % Add stretch and a bonus for breaking the page before the part heading. 7036 % This reduces the chance of the page being broken immediately after the 7037 % part heading, before a following chapter heading. 7038 \vskip 0pt plus 5\baselineskip 7039 \penalty-300 7040 \vskip 0pt plus -5\baselineskip 7041 \dochapentry{\numeralbox\labelspace#1}{}% 7042} 7043% 7044% Parts, in the short toc. 7045\def\shortpartentry#1#2#3#4{% 7046 \penalty-300 7047 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip 7048 \shortchapentry{{\bf #1}}{\numeralbox}{}{}% 7049} 7050 7051% Chapters, in the main contents. 7052\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} 7053 7054% Chapters, in the short toc. 7055% See comments in \dochapentry re vbox and related settings. 7056\def\shortchapentry#1#2#3#4{% 7057 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% 7058} 7059 7060% Appendices, in the main contents. 7061% Need the word Appendix, and a fixed-size box. 7062% 7063\def\appendixbox#1{% 7064 % We use M since it's probably the widest letter. 7065 \setbox0 = \hbox{\putwordAppendix{} M}% 7066 \hbox to \wd0{\putwordAppendix{} #1\hss}} 7067% 7068\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}} 7069 7070% Unnumbered chapters. 7071\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} 7072\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} 7073 7074% Sections. 7075\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} 7076\let\appsecentry=\numsecentry 7077\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} 7078 7079% Subsections. 7080\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} 7081\let\appsubsecentry=\numsubsecentry 7082\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} 7083 7084% And subsubsections. 7085\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} 7086\let\appsubsubsecentry=\numsubsubsecentry 7087\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} 7088 7089% This parameter controls the indentation of the various levels. 7090% Same as \defaultparindent. 7091\newdimen\tocindent \tocindent = 15pt 7092 7093% Now for the actual typesetting. In all these, #1 is the text and #2 is the 7094% page number. 7095% 7096% If the toc has to be broken over pages, we want it to be at chapters 7097% if at all possible; hence the \penalty. 7098\def\dochapentry#1#2{% 7099 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip 7100 \begingroup 7101 % Move the page numbers slightly to the right 7102 \advance\entryrightmargin by -0.05em 7103 \chapentryfonts 7104 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 7105 \endgroup 7106 \nobreak\vskip .25\baselineskip plus.1\baselineskip 7107} 7108 7109\def\dosecentry#1#2{\begingroup 7110 \secentryfonts \leftskip=\tocindent 7111 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 7112\endgroup} 7113 7114\def\dosubsecentry#1#2{\begingroup 7115 \subsecentryfonts \leftskip=2\tocindent 7116 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 7117\endgroup} 7118 7119\def\dosubsubsecentry#1#2{\begingroup 7120 \subsubsecentryfonts \leftskip=3\tocindent 7121 \tocentry{#1}{\dopageno\bgroup#2\egroup}% 7122\endgroup} 7123 7124% We use the same \entry macro as for the index entries. 7125\let\tocentry = \entry 7126 7127% Space between chapter (or whatever) number and the title. 7128\def\labelspace{\hskip1em \relax} 7129 7130\def\dopageno#1{{\rm #1}} 7131\def\doshortpageno#1{{\rm #1}} 7132 7133\def\chapentryfonts{\secfonts \rm} 7134\def\secentryfonts{\textfonts} 7135\def\subsecentryfonts{\textfonts} 7136\def\subsubsecentryfonts{\textfonts} 7137 7138 7139\message{environments,} 7140% @foo ... @end foo. 7141 7142% @tex ... @end tex escapes into raw TeX temporarily. 7143% One exception: @ is still an escape character, so that @end tex works. 7144% But \@ or @@ will get a plain @ character. 7145 7146\envdef\tex{% 7147 \setupmarkupstyle{tex}% 7148 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 7149 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 7150 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie 7151 \catcode `\%=14 7152 \catcode `\+=\other 7153 \catcode `\"=\other 7154 \catcode `\|=\other 7155 \catcode `\<=\other 7156 \catcode `\>=\other 7157 \catcode `\`=\other 7158 \catcode `\'=\other 7159 % 7160 % ' is active in math mode (mathcode"8000). So reset it, and all our 7161 % other math active characters (just in case), to plain's definitions. 7162 \mathactive 7163 % 7164 % Inverse of the list at the beginning of the file. 7165 \let\b=\ptexb 7166 \let\bullet=\ptexbullet 7167 \let\c=\ptexc 7168 \let\,=\ptexcomma 7169 \let\.=\ptexdot 7170 \let\dots=\ptexdots 7171 \let\equiv=\ptexequiv 7172 \let\!=\ptexexclam 7173 \let\i=\ptexi 7174 \let\indent=\ptexindent 7175 \let\noindent=\ptexnoindent 7176 \let\{=\ptexlbrace 7177 \let\+=\tabalign 7178 \let\}=\ptexrbrace 7179 \let\/=\ptexslash 7180 \let\sp=\ptexsp 7181 \let\*=\ptexstar 7182 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode 7183 \let\t=\ptext 7184 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer 7185 \let\frenchspacing=\plainfrenchspacing 7186 % 7187 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% 7188 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% 7189 \def\@{@}% 7190} 7191% There is no need to define \Etex. 7192 7193% Define @lisp ... @end lisp. 7194% @lisp environment forms a group so it can rebind things, 7195% including the definition of @end lisp (which normally is erroneous). 7196 7197% Amount to narrow the margins by for @lisp. 7198\newskip\lispnarrowing \lispnarrowing=0.4in 7199 7200% This is the definition that ^^M gets inside @lisp, @example, and other 7201% such environments. \null is better than a space, since it doesn't 7202% have any width. 7203\def\lisppar{\null\endgraf} 7204 7205% This space is always present above and below environments. 7206\newskip\envskipamount \envskipamount = 0pt 7207 7208% Make spacing and below environment symmetrical. We use \parskip here 7209% to help in doing that, since in @example-like environments \parskip 7210% is reset to zero; thus the \afterenvbreak inserts no space -- but the 7211% start of the next paragraph will insert \parskip. 7212% 7213\def\aboveenvbreak{{% 7214 % =10000 instead of <10000 because of a special case in \itemzzz and 7215 % \sectionheading, q.v. 7216 \ifnum \lastpenalty=10000 \else 7217 \advance\envskipamount by \parskip 7218 \endgraf 7219 \ifdim\lastskip<\envskipamount 7220 \removelastskip 7221 \ifnum\lastpenalty<10000 7222 % Penalize breaking before the environment, because preceding text 7223 % often leads into it. 7224 \penalty100 7225 \fi 7226 \vskip\envskipamount 7227 \fi 7228 \fi 7229}} 7230 7231\def\afterenvbreak{{% 7232 % =10000 instead of <10000 because of a special case in \itemzzz and 7233 % \sectionheading, q.v. 7234 \ifnum \lastpenalty=10000 \else 7235 \advance\envskipamount by \parskip 7236 \endgraf 7237 \ifdim\lastskip<\envskipamount 7238 \removelastskip 7239 % it's not a good place to break if the last penalty was \nobreak 7240 % or better ... 7241 \ifnum\lastpenalty<10000 \penalty-50 \fi 7242 \vskip\envskipamount 7243 \fi 7244 \fi 7245}} 7246 7247% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will 7248% also clear it, so that its embedded environments do the narrowing again. 7249\let\nonarrowing=\relax 7250 7251% @cartouche ... @end cartouche: draw rectangle w/rounded corners around 7252% environment contents. 7253 7254% 7255\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth 7256\def\ctr{{\hskip 6pt\circle\char'010}} 7257\def\cbl{{\circle\char'012\hskip -6pt}} 7258\def\cbr{{\hskip 6pt\circle\char'011}} 7259\def\carttop{\hbox to \cartouter{\hskip\lskip 7260 \ctl\leaders\hrule height\circthick\hfil\ctr 7261 \hskip\rskip}} 7262\def\cartbot{\hbox to \cartouter{\hskip\lskip 7263 \cbl\leaders\hrule height\circthick\hfil\cbr 7264 \hskip\rskip}} 7265% 7266\newskip\lskip\newskip\rskip 7267 7268% only require the font if @cartouche is actually used 7269\def\cartouchefontdefs{% 7270 \font\circle=lcircle10\relax 7271 \circthick=\fontdimen8\circle 7272} 7273\newdimen\circthick 7274\newdimen\cartouter\newdimen\cartinner 7275\newskip\normbskip\newskip\normpskip\newskip\normlskip 7276 7277 7278\envdef\cartouche{% 7279 \cartouchefontdefs 7280 \ifhmode\par\fi % can't be in the midst of a paragraph. 7281 \startsavinginserts 7282 \lskip=\leftskip \rskip=\rightskip 7283 \leftskip=0pt\rightskip=0pt % we want these *outside*. 7284 \cartinner=\hsize \advance\cartinner by-\lskip 7285 \advance\cartinner by-\rskip 7286 \cartouter=\hsize 7287 \advance\cartouter by 18.4pt % allow for 3pt kerns on either 7288 % side, and for 6pt waste from 7289 % each corner char, and rule thickness 7290 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip 7291 % 7292 % If this cartouche directly follows a sectioning command, we need the 7293 % \parskip glue (backspaced over by default) or the cartouche can 7294 % collide with the section heading. 7295 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi 7296 % 7297 \setbox\groupbox=\vbox\bgroup 7298 \baselineskip=0pt\parskip=0pt\lineskip=0pt 7299 \carttop 7300 \hbox\bgroup 7301 \hskip\lskip 7302 \vrule\kern3pt 7303 \vbox\bgroup 7304 \kern3pt 7305 \hsize=\cartinner 7306 \baselineskip=\normbskip 7307 \lineskip=\normlskip 7308 \parskip=\normpskip 7309 \vskip -\parskip 7310 \comment % For explanation, see the end of def\group. 7311} 7312\def\Ecartouche{% 7313 \ifhmode\par\fi 7314 \kern3pt 7315 \egroup 7316 \kern3pt\vrule 7317 \hskip\rskip 7318 \egroup 7319 \cartbot 7320 \egroup 7321 \addgroupbox 7322 \checkinserts 7323} 7324 7325 7326% This macro is called at the beginning of all the @example variants, 7327% inside a group. 7328\newdimen\nonfillparindent 7329\def\nonfillstart{% 7330 \aboveenvbreak 7331 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy 7332 \sepspaces % Make spaces be word-separators rather than space tokens. 7333 \let\par = \lisppar % don't ignore blank lines 7334 \obeylines % each line of input is a line of output 7335 \parskip = 0pt 7336 % Turn off paragraph indentation but redefine \indent to emulate 7337 % the normal \indent. 7338 \nonfillparindent=\parindent 7339 \parindent = 0pt 7340 \let\indent\nonfillindent 7341 % 7342 \emergencystretch = 0pt % don't try to avoid overfull boxes 7343 \ifx\nonarrowing\relax 7344 \advance \leftskip by \lispnarrowing 7345 \exdentamount=\lispnarrowing 7346 \else 7347 \let\nonarrowing = \relax 7348 \fi 7349 \let\exdent=\nofillexdent 7350} 7351 7352\begingroup 7353\obeyspaces 7354% We want to swallow spaces (but not other tokens) after the fake 7355% @indent in our nonfill-environments, where spaces are normally 7356% active and set to @tie, resulting in them not being ignored after 7357% @indent. 7358\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% 7359\gdef\nonfillindentcheck{% 7360\ifx\temp % 7361\expandafter\nonfillindentgobble% 7362\else% 7363\leavevmode\nonfillindentbox% 7364\fi% 7365}% 7366\endgroup 7367\def\nonfillindentgobble#1{\nonfillindent} 7368\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} 7369 7370% If you want all examples etc. small: @set dispenvsize small. 7371% If you want even small examples the full size: @set dispenvsize nosmall. 7372% This affects the following displayed environments: 7373% @example, @display, @format, @lisp 7374% 7375\def\smallword{small} 7376\def\nosmallword{nosmall} 7377\let\SETdispenvsize\relax 7378\def\setnormaldispenv{% 7379 \ifx\SETdispenvsize\smallword 7380 % end paragraph for sake of leading, in case document has no blank 7381 % line. This is redundant with what happens in \aboveenvbreak, but 7382 % we need to do it before changing the fonts, and it's inconvenient 7383 % to change the fonts afterward. 7384 \ifnum \lastpenalty=10000 \else \endgraf \fi 7385 \smallexamplefonts \rm 7386 \fi 7387} 7388\def\setsmalldispenv{% 7389 \ifx\SETdispenvsize\nosmallword 7390 \else 7391 \ifnum \lastpenalty=10000 \else \endgraf \fi 7392 \smallexamplefonts \rm 7393 \fi 7394} 7395 7396% We often define two environments, @foo and @smallfoo. 7397% Let's do it in one command. #1 is the env name, #2 the definition. 7398\def\makedispenvdef#1#2{% 7399 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% 7400 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% 7401 \expandafter\let\csname E#1\endcsname \afterenvbreak 7402 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak 7403} 7404 7405% Define two environment synonyms (#1 and #2) for an environment. 7406\def\maketwodispenvdef#1#2#3{% 7407 \makedispenvdef{#1}{#3}% 7408 \makedispenvdef{#2}{#3}% 7409} 7410% 7411% @lisp: indented, narrowed, typewriter font; 7412% @example: same as @lisp. 7413% 7414% @smallexample and @smalllisp: use smaller fonts. 7415% Originally contributed by Pavel@xerox. 7416% 7417\maketwodispenvdef{lisp}{example}{% 7418 \nonfillstart 7419 \tt\setupmarkupstyle{example}% 7420 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. 7421 \gobble % eat return 7422} 7423% @display/@smalldisplay: same as @lisp except keep current font. 7424% 7425\makedispenvdef{display}{% 7426 \nonfillstart 7427 \gobble 7428} 7429 7430% @format/@smallformat: same as @display except don't narrow margins. 7431% 7432\makedispenvdef{format}{% 7433 \let\nonarrowing = t% 7434 \nonfillstart 7435 \gobble 7436} 7437 7438% @flushleft: same as @format, but doesn't obey \SETdispenvsize. 7439\envdef\flushleft{% 7440 \let\nonarrowing = t% 7441 \nonfillstart 7442 \gobble 7443} 7444\let\Eflushleft = \afterenvbreak 7445 7446% @flushright. 7447% 7448\envdef\flushright{% 7449 \let\nonarrowing = t% 7450 \nonfillstart 7451 \advance\leftskip by 0pt plus 1fill\relax 7452 \gobble 7453} 7454\let\Eflushright = \afterenvbreak 7455 7456 7457% @raggedright does more-or-less normal line breaking but no right 7458% justification. From plain.tex. 7459\envdef\raggedright{% 7460 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax 7461} 7462\let\Eraggedright\par 7463 7464\envdef\raggedleft{% 7465 \parindent=0pt \leftskip0pt plus2em 7466 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt 7467 \hbadness=10000 % Last line will usually be underfull, so turn off 7468 % badness reporting. 7469} 7470\let\Eraggedleft\par 7471 7472\envdef\raggedcenter{% 7473 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em 7474 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt 7475 \hbadness=10000 % Last line will usually be underfull, so turn off 7476 % badness reporting. 7477} 7478\let\Eraggedcenter\par 7479 7480 7481% @quotation does normal linebreaking (hence we can't use \nonfillstart) 7482% and narrows the margins. We keep \parskip nonzero in general, since 7483% we're doing normal filling. So, when using \aboveenvbreak and 7484% \afterenvbreak, temporarily make \parskip 0. 7485% 7486\makedispenvdef{quotation}{\quotationstart} 7487% 7488\def\quotationstart{% 7489 \indentedblockstart % same as \indentedblock, but increase right margin too. 7490 \ifx\nonarrowing\relax 7491 \advance\rightskip by \lispnarrowing 7492 \fi 7493 \parsearg\quotationlabel 7494} 7495 7496% We have retained a nonzero parskip for the environment, since we're 7497% doing normal filling. 7498% 7499\def\Equotation{% 7500 \par 7501 \ifx\quotationauthor\thisisundefined\else 7502 % indent a bit. 7503 \leftline{\kern 2\leftskip \sl ---\quotationauthor}% 7504 \fi 7505 {\parskip=0pt \afterenvbreak}% 7506} 7507\def\Esmallquotation{\Equotation} 7508 7509% If we're given an argument, typeset it in bold with a colon after. 7510\def\quotationlabel#1{% 7511 \def\temp{#1}% 7512 \ifx\temp\empty \else 7513 {\bf #1: }% 7514 \fi 7515} 7516 7517% @indentedblock is like @quotation, but indents only on the left and 7518% has no optional argument. 7519% 7520\makedispenvdef{indentedblock}{\indentedblockstart} 7521% 7522\def\indentedblockstart{% 7523 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip 7524 \parindent=0pt 7525 % 7526 % @cartouche defines \nonarrowing to inhibit narrowing at next level down. 7527 \ifx\nonarrowing\relax 7528 \advance\leftskip by \lispnarrowing 7529 \exdentamount = \lispnarrowing 7530 \else 7531 \let\nonarrowing = \relax 7532 \fi 7533} 7534 7535% Keep a nonzero parskip for the environment, since we're doing normal filling. 7536% 7537\def\Eindentedblock{% 7538 \par 7539 {\parskip=0pt \afterenvbreak}% 7540} 7541\def\Esmallindentedblock{\Eindentedblock} 7542 7543 7544% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} 7545% If we want to allow any <char> as delimiter, 7546% we need the curly braces so that makeinfo sees the @verb command, eg: 7547% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org 7548% 7549% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. 7550% 7551% [Knuth] p.344; only we need to do the other characters Texinfo sets 7552% active too. Otherwise, they get lost as the first character on a 7553% verbatim line. 7554\def\dospecials{% 7555 \do\ \do\\\do\{\do\}\do\$\do\&% 7556 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% 7557 \do\<\do\>\do\|\do\@\do+\do\"% 7558 % Don't do the quotes -- if we do, @set txicodequoteundirected and 7559 % @set txicodequotebacktick will not have effect on @verb and 7560 % @verbatim, and ?` and !` ligatures won't get disabled. 7561 %\do\`\do\'% 7562} 7563% 7564% [Knuth] p. 380 7565\def\uncatcodespecials{% 7566 \def\do##1{\catcode`##1=\other}\dospecials} 7567% 7568% Setup for the @verb command. 7569% 7570% Eight spaces for a tab 7571\begingroup 7572 \catcode`\^^I=\active 7573 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} 7574\endgroup 7575% 7576\def\setupverb{% 7577 \tt % easiest (and conventionally used) font for verbatim 7578 \def\par{\leavevmode\endgraf}% 7579 \setupmarkupstyle{verb}% 7580 \tabeightspaces 7581 % Respect line breaks, 7582 % print special symbols as themselves, and 7583 % make each space count 7584 % must do in this order: 7585 \obeylines \uncatcodespecials \sepspaces 7586} 7587 7588% Setup for the @verbatim environment 7589% 7590% Real tab expansion. 7591\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount 7592% 7593% We typeset each line of the verbatim in an \hbox, so we can handle 7594% tabs. 7595\newbox\verbbox 7596\def\starttabbox{\setbox\verbbox=\hbox\bgroup} 7597% 7598\begingroup 7599 \catcode`\^^I=\active 7600 \gdef\tabexpand{% 7601 \catcode`\^^I=\active 7602 \def^^I{\leavevmode\egroup 7603 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab 7604 \divide\dimen\verbbox by\tabw 7605 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw 7606 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw 7607 \wd\verbbox=\dimen\verbbox 7608 \leavevmode\box\verbbox \starttabbox 7609 }% 7610 } 7611\endgroup 7612 7613% start the verbatim environment. 7614\def\setupverbatim{% 7615 \let\nonarrowing = t% 7616 \nonfillstart 7617 \tt % easiest (and conventionally used) font for verbatim 7618 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}% 7619 \tabexpand 7620 \setupmarkupstyle{verbatim}% 7621 % Respect line breaks, 7622 % print special symbols as themselves, and 7623 % make each space count. 7624 % Must do in this order: 7625 \obeylines \uncatcodespecials \sepspaces 7626} 7627 7628% Do the @verb magic: verbatim text is quoted by unique 7629% delimiter characters. Before first delimiter expect a 7630% right brace, after last delimiter expect closing brace: 7631% 7632% \def\doverb'{'<char>#1<char>'}'{#1} 7633% 7634% [Knuth] p. 382; only eat outer {} 7635\begingroup 7636 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other 7637 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] 7638\endgroup 7639% 7640\def\verb{\begingroup\setupverb\doverb} 7641% 7642% 7643% Do the @verbatim magic: define the macro \doverbatim so that 7644% the (first) argument ends when '@end verbatim' is reached, ie: 7645% 7646% \def\doverbatim#1@end verbatim{#1} 7647% 7648% For Texinfo it's a lot easier than for LaTeX, 7649% because texinfo's \verbatim doesn't stop at '\end{verbatim}': 7650% we need not redefine '\', '{' and '}'. 7651% 7652% Inspired by LaTeX's verbatim command set [latex.ltx] 7653% 7654\begingroup 7655 \catcode`\ =\active 7656 \obeylines % 7657 % ignore everything up to the first ^^M, that's the newline at the end 7658 % of the @verbatim input line itself. Otherwise we get an extra blank 7659 % line in the output. 7660 \xdef\doverbatim#1^^M#2@end verbatim{% 7661 \starttabbox#2\egroup\noexpand\end\gobble verbatim}% 7662 % We really want {...\end verbatim} in the body of the macro, but 7663 % without the active space; thus we have to use \xdef and \gobble. 7664 % The \egroup ends the \verbbox started at the end of the last line in 7665 % the block. 7666\endgroup 7667% 7668\envdef\verbatim{% 7669 \setnormaldispenv\setupverbatim\doverbatim 7670} 7671\let\Everbatim = \afterenvbreak 7672 7673 7674% @verbatiminclude FILE - insert text of file in verbatim environment. 7675% 7676\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} 7677% 7678\def\doverbatiminclude#1{% 7679 {% 7680 \makevalueexpandable 7681 \setupverbatim 7682 {% 7683 \indexnofonts % Allow `@@' and other weird things in file names. 7684 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% 7685 \edef\tmp{\noexpand\input #1 } 7686 \expandafter 7687 }\expandafter\starttabbox\tmp\egroup 7688 \afterenvbreak 7689 }% 7690} 7691 7692% @copying ... @end copying. 7693% Save the text away for @insertcopying later. 7694% 7695% We save the uninterpreted tokens, rather than creating a box. 7696% Saving the text in a box would be much easier, but then all the 7697% typesetting commands (@smallbook, font changes, etc.) have to be done 7698% beforehand -- and a) we want @copying to be done first in the source 7699% file; b) letting users define the frontmatter in as flexible order as 7700% possible is desirable. 7701% 7702\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} 7703\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} 7704% 7705\def\insertcopying{% 7706 \begingroup 7707 \parindent = 0pt % paragraph indentation looks wrong on title page 7708 \scanexp\copyingtext 7709 \endgroup 7710} 7711 7712 7713\message{defuns,} 7714% @defun etc. 7715 7716\newskip\defbodyindent \defbodyindent=.4in 7717\newskip\defargsindent \defargsindent=50pt 7718\newskip\deflastargmargin \deflastargmargin=18pt 7719\newcount\defunpenalty 7720 7721% Start the processing of @deffn: 7722\def\startdefun{% 7723 \ifnum\lastpenalty<10000 7724 \medbreak 7725 \defunpenalty=10003 % Will keep this @deffn together with the 7726 % following @def command, see below. 7727 \else 7728 % If there are two @def commands in a row, we'll have a \nobreak, 7729 % which is there to keep the function description together with its 7730 % header. But if there's nothing but headers, we need to allow a 7731 % break somewhere. Check specifically for penalty 10002, inserted 7732 % by \printdefunline, instead of 10000, since the sectioning 7733 % commands also insert a nobreak penalty, and we don't want to allow 7734 % a break between a section heading and a defun. 7735 % 7736 % As a further refinement, we avoid "club" headers by signalling 7737 % with penalty of 10003 after the very first @deffn in the 7738 % sequence (see above), and penalty of 10002 after any following 7739 % @def command. 7740 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi 7741 % 7742 % Similarly, after a section heading, do not allow a break. 7743 % But do insert the glue. 7744 \medskip % preceded by discardable penalty, so not a breakpoint 7745 \fi 7746 % 7747 \parindent=0in 7748 \advance\leftskip by \defbodyindent 7749 \exdentamount=\defbodyindent 7750} 7751 7752\def\dodefunx#1{% 7753 % First, check whether we are in the right environment: 7754 \checkenv#1% 7755 % 7756 % As above, allow line break if we have multiple x headers in a row. 7757 % It's not a great place, though. 7758 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi 7759 % 7760 % And now, it's time to reuse the body of the original defun: 7761 \expandafter\gobbledefun#1% 7762} 7763\def\gobbledefun#1\startdefun{} 7764 7765% \printdefunline \deffnheader{text} 7766% 7767\def\printdefunline#1#2{% 7768 \begingroup 7769 % call \deffnheader: 7770 #1#2 \endheader 7771 % common ending: 7772 \interlinepenalty = 10000 7773 \advance\rightskip by 0pt plus 1fil\relax 7774 \endgraf 7775 \nobreak\vskip -\parskip 7776 \penalty\defunpenalty % signal to \startdefun and \dodefunx 7777 % Some of the @defun-type tags do not enable magic parentheses, 7778 % rendering the following check redundant. But we don't optimize. 7779 \checkparencounts 7780 \endgroup 7781} 7782 7783\def\Edefun{\endgraf\medbreak} 7784 7785% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; 7786% the only thing remaining is to define \deffnheader. 7787% 7788\def\makedefun#1{% 7789 \expandafter\let\csname E#1\endcsname = \Edefun 7790 \edef\temp{\noexpand\domakedefun 7791 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% 7792 \temp 7793} 7794 7795% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) } 7796% 7797% Define \deffn and \deffnx, without parameters. 7798% \deffnheader has to be defined explicitly. 7799% 7800\def\domakedefun#1#2#3{% 7801 \envdef#1{% 7802 \startdefun 7803 \doingtypefnfalse % distinguish typed functions from all else 7804 \parseargusing\activeparens{\printdefunline#3}% 7805 }% 7806 \def#2{\dodefunx#1}% 7807 \def#3% 7808} 7809 7810\newif\ifdoingtypefn % doing typed function? 7811\newif\ifrettypeownline % typeset return type on its own line? 7812 7813% @deftypefnnewline on|off says whether the return type of typed functions 7814% are printed on their own line. This affects @deftypefn, @deftypefun, 7815% @deftypeop, and @deftypemethod. 7816% 7817\parseargdef\deftypefnnewline{% 7818 \def\temp{#1}% 7819 \ifx\temp\onword 7820 \expandafter\let\csname SETtxideftypefnnl\endcsname 7821 = \empty 7822 \else\ifx\temp\offword 7823 \expandafter\let\csname SETtxideftypefnnl\endcsname 7824 = \relax 7825 \else 7826 \errhelp = \EMsimple 7827 \errmessage{Unknown @txideftypefnnl value `\temp', 7828 must be on|off}% 7829 \fi\fi 7830} 7831 7832% \dosubind {index}{topic}{subtopic} 7833% 7834% If SUBTOPIC is present, precede it with a space, and call \doind. 7835% (At some time during the 20th century, this made a two-level entry in an 7836% index such as the operation index. Nobody seemed to notice the change in 7837% behaviour though.) 7838\def\dosubind#1#2#3{% 7839 \def\thirdarg{#3}% 7840 \ifx\thirdarg\empty 7841 \doind{#1}{#2}% 7842 \else 7843 \doind{#1}{#2\space#3}% 7844 \fi 7845} 7846 7847% Untyped functions: 7848 7849% @deffn category name args 7850\makedefun{deffn}{\deffngeneral{}} 7851 7852% @deffn category class name args 7853\makedefun{defop}#1 {\defopon{#1\ \putwordon}} 7854 7855% \defopon {category on}class name args 7856\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } 7857 7858% \deffngeneral {subind}category name args 7859% 7860\def\deffngeneral#1#2 #3 #4\endheader{% 7861 \dosubind{fn}{\code{#3}}{#1}% 7862 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% 7863} 7864 7865% Typed functions: 7866 7867% @deftypefn category type name args 7868\makedefun{deftypefn}{\deftypefngeneral{}} 7869 7870% @deftypeop category class type name args 7871\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} 7872 7873% \deftypeopon {category on}class type name args 7874\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } 7875 7876% \deftypefngeneral {subind}category type name args 7877% 7878\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% 7879 \dosubind{fn}{\code{#4}}{#1}% 7880 \doingtypefntrue 7881 \defname{#2}{#3}{#4}\defunargs{#5\unskip}% 7882} 7883 7884% Typed variables: 7885 7886% @deftypevr category type var args 7887\makedefun{deftypevr}{\deftypecvgeneral{}} 7888 7889% @deftypecv category class type var args 7890\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} 7891 7892% \deftypecvof {category of}class type var args 7893\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } 7894 7895% \deftypecvgeneral {subind}category type var args 7896% 7897\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% 7898 \dosubind{vr}{\code{#4}}{#1}% 7899 \defname{#2}{#3}{#4}\defunargs{#5\unskip}% 7900} 7901 7902% Untyped variables: 7903 7904% @defvr category var args 7905\makedefun{defvr}#1 {\deftypevrheader{#1} {} } 7906 7907% @defcv category class var args 7908\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} 7909 7910% \defcvof {category of}class var args 7911\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } 7912 7913% Types: 7914 7915% @deftp category name args 7916\makedefun{deftp}#1 #2 #3\endheader{% 7917 \doind{tp}{\code{#2}}% 7918 \defname{#1}{}{#2}\defunargs{#3\unskip}% 7919} 7920 7921% Remaining @defun-like shortcuts: 7922\makedefun{defun}{\deffnheader{\putwordDeffunc} } 7923\makedefun{defmac}{\deffnheader{\putwordDefmac} } 7924\makedefun{defspec}{\deffnheader{\putwordDefspec} } 7925\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } 7926\makedefun{defvar}{\defvrheader{\putwordDefvar} } 7927\makedefun{defopt}{\defvrheader{\putwordDefopt} } 7928\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } 7929\makedefun{defmethod}{\defopon\putwordMethodon} 7930\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} 7931\makedefun{defivar}{\defcvof\putwordInstanceVariableof} 7932\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} 7933 7934% \defname, which formats the name of the @def (not the args). 7935% #1 is the category, such as "Function". 7936% #2 is the return type, if any. 7937% #3 is the function name. 7938% 7939% We are followed by (but not passed) the arguments, if any. 7940% 7941\def\defname#1#2#3{% 7942 \par 7943 % Get the values of \leftskip and \rightskip as they were outside the @def... 7944 \advance\leftskip by -\defbodyindent 7945 % 7946 % Determine if we are typesetting the return type of a typed function 7947 % on a line by itself. 7948 \rettypeownlinefalse 7949 \ifdoingtypefn % doing a typed function specifically? 7950 % then check user option for putting return type on its own line: 7951 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else 7952 \rettypeownlinetrue 7953 \fi 7954 \fi 7955 % 7956 % How we'll format the category name. Putting it in brackets helps 7957 % distinguish it from the body text that may end up on the next line 7958 % just below it. 7959 \def\temp{#1}% 7960 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} 7961 % 7962 % Figure out line sizes for the paragraph shape. We'll always have at 7963 % least two. 7964 \tempnum = 2 7965 % 7966 % The first line needs space for \box0; but if \rightskip is nonzero, 7967 % we need only space for the part of \box0 which exceeds it: 7968 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip 7969 % 7970 % If doing a return type on its own line, we'll have another line. 7971 \ifrettypeownline 7972 \advance\tempnum by 1 7973 \def\maybeshapeline{0in \hsize}% 7974 \else 7975 \def\maybeshapeline{}% 7976 \fi 7977 % 7978 % The continuations: 7979 \dimen2=\hsize \advance\dimen2 by -\defargsindent 7980 % 7981 % The final paragraph shape: 7982 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 7983 % 7984 % Put the category name at the right margin. 7985 \noindent 7986 \hbox to 0pt{% 7987 \hfil\box0 \kern-\hsize 7988 % \hsize has to be shortened this way: 7989 \kern\leftskip 7990 % Intentionally do not respect \rightskip, since we need the space. 7991 }% 7992 % 7993 % Allow all lines to be underfull without complaint: 7994 \tolerance=10000 \hbadness=10000 7995 \exdentamount=\defbodyindent 7996 {% 7997 % defun fonts. We use typewriter by default (used to be bold) because: 7998 % . we're printing identifiers, they should be in tt in principle. 7999 % . in languages with many accents, such as Czech or French, it's 8000 % common to leave accents off identifiers. The result looks ok in 8001 % tt, but exceedingly strange in rm. 8002 % . we don't want -- and --- to be treated as ligatures. 8003 % . this still does not fix the ?` and !` ligatures, but so far no 8004 % one has made identifiers using them :). 8005 \df \tt 8006 \def\temp{#2}% text of the return type 8007 \ifx\temp\empty\else 8008 \tclose{\temp}% typeset the return type 8009 \ifrettypeownline 8010 % put return type on its own line; prohibit line break following: 8011 \hfil\vadjust{\nobreak}\break 8012 \else 8013 \space % type on same line, so just followed by a space 8014 \fi 8015 \fi % no return type 8016 #3% output function name 8017 }% 8018 {\rm\enskip}% hskip 0.5 em of \rmfont 8019 % 8020 \boldbrax 8021 % arguments will be output next, if any. 8022} 8023 8024% Print arguments in slanted roman (not ttsl), inconsistently with using 8025% tt for the name. This is because literal text is sometimes needed in 8026% the argument list (groff manual), and ttsl and tt are not very 8027% distinguishable. Prevent hyphenation at `-' chars. 8028% 8029\def\defunargs#1{% 8030 % use sl by default (not ttsl), 8031 % tt for the names. 8032 \df \sl \hyphenchar\font=0 8033 % 8034 % On the other hand, if an argument has two dashes (for instance), we 8035 % want a way to get ttsl. We used to recommend @var for that, so 8036 % leave the code in, but it's strange for @var to lead to typewriter. 8037 % Nowadays we recommend @code, since the difference between a ttsl hyphen 8038 % and a tt hyphen is pretty tiny. @code also disables ?` !`. 8039 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% 8040 #1% 8041 \sl\hyphenchar\font=45 8042} 8043 8044% We want ()&[] to print specially on the defun line. 8045% 8046\def\activeparens{% 8047 \catcode`\(=\active \catcode`\)=\active 8048 \catcode`\[=\active \catcode`\]=\active 8049 \catcode`\&=\active 8050} 8051 8052% Make control sequences which act like normal parenthesis chars. 8053\let\lparen = ( \let\rparen = ) 8054 8055% Be sure that we always have a definition for `(', etc. For example, 8056% if the fn name has parens in it, \boldbrax will not be in effect yet, 8057% so TeX would otherwise complain about undefined control sequence. 8058{ 8059 \activeparens 8060 \global\let(=\lparen \global\let)=\rparen 8061 \global\let[=\lbrack \global\let]=\rbrack 8062 \global\let& = \& 8063 8064 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} 8065 \gdef\magicamp{\let&=\amprm} 8066} 8067\let\ampchar\& 8068 8069\newcount\parencount 8070 8071% If we encounter &foo, then turn on ()-hacking afterwards 8072\newif\ifampseen 8073\def\amprm#1 {\ampseentrue{\bf\ }} 8074 8075\def\parenfont{% 8076 \ifampseen 8077 % At the first level, print parens in roman, 8078 % otherwise use the default font. 8079 \ifnum \parencount=1 \rm \fi 8080 \else 8081 % The \sf parens (in \boldbrax) actually are a little bolder than 8082 % the contained text. This is especially needed for [ and ] . 8083 \sf 8084 \fi 8085} 8086\def\infirstlevel#1{% 8087 \ifampseen 8088 \ifnum\parencount=1 8089 #1% 8090 \fi 8091 \fi 8092} 8093\def\bfafterword#1 {#1 \bf} 8094 8095\def\opnr{% 8096 \global\advance\parencount by 1 8097 {\parenfont(}% 8098 \infirstlevel \bfafterword 8099} 8100\def\clnr{% 8101 {\parenfont)}% 8102 \infirstlevel \sl 8103 \global\advance\parencount by -1 8104} 8105 8106\newcount\brackcount 8107\def\lbrb{% 8108 \global\advance\brackcount by 1 8109 {\bf[}% 8110} 8111\def\rbrb{% 8112 {\bf]}% 8113 \global\advance\brackcount by -1 8114} 8115 8116\def\checkparencounts{% 8117 \ifnum\parencount=0 \else \badparencount \fi 8118 \ifnum\brackcount=0 \else \badbrackcount \fi 8119} 8120% these should not use \errmessage; the glibc manual, at least, actually 8121% has such constructs (when documenting function pointers). 8122\def\badparencount{% 8123 \message{Warning: unbalanced parentheses in @def...}% 8124 \global\parencount=0 8125} 8126\def\badbrackcount{% 8127 \message{Warning: unbalanced square brackets in @def...}% 8128 \global\brackcount=0 8129} 8130 8131 8132\message{macros,} 8133% @macro. 8134 8135% To do this right we need a feature of e-TeX, \scantokens, 8136% which we arrange to emulate with a temporary file in ordinary TeX. 8137\ifx\eTeXversion\thisisundefined 8138 \newwrite\macscribble 8139 \def\scantokens#1{% 8140 \toks0={#1}% 8141 \immediate\openout\macscribble=\jobname.tmp 8142 \immediate\write\macscribble{\the\toks0}% 8143 \immediate\closeout\macscribble 8144 \input \jobname.tmp 8145 } 8146\fi 8147 8148% Used at the time of macro expansion. 8149% Argument is macro body with arguments substituted 8150\def\scanmacro#1{% 8151 \newlinechar`\^^M 8152 \def\xeatspaces{\eatspaces}% 8153 % 8154 % Process the macro body under the current catcode regime. 8155 \scantokens{#1@comment}% 8156 % 8157 % The \comment is to remove the \newlinechar added by \scantokens, and 8158 % can be noticed by \parsearg. Note \c isn't used because this means cedilla 8159 % in math mode. 8160} 8161 8162% Used for copying and captions 8163\def\scanexp#1{% 8164 \expandafter\scanmacro\expandafter{#1}% 8165} 8166 8167\newcount\paramno % Count of parameters 8168\newtoks\macname % Macro name 8169\newif\ifrecursive % Is it recursive? 8170 8171% List of all defined macros in the form 8172% \commondummyword\macro1\commondummyword\macro2... 8173% Currently is also contains all @aliases; the list can be split 8174% if there is a need. 8175\def\macrolist{} 8176 8177% Add the macro to \macrolist 8178\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} 8179\def\addtomacrolistxxx#1{% 8180 \toks0 = \expandafter{\macrolist\commondummyword#1}% 8181 \xdef\macrolist{\the\toks0}% 8182} 8183 8184% Utility routines. 8185% This does \let #1 = #2, with \csnames; that is, 8186% \let \csname#1\endcsname = \csname#2\endcsname 8187% (except of course we have to play expansion games). 8188% 8189\def\cslet#1#2{% 8190 \expandafter\let 8191 \csname#1\expandafter\endcsname 8192 \csname#2\endcsname 8193} 8194 8195% Trim leading and trailing spaces off a string. 8196% Concepts from aro-bend problem 15 (see CTAN). 8197{\catcode`\@=11 8198\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} 8199\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} 8200\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} 8201\def\unbrace#1{#1} 8202\unbrace{\gdef\trim@@@ #1 } #2@{#1} 8203} 8204 8205% Trim a single trailing ^^M off a string. 8206{\catcode`\^^M=\other \catcode`\Q=3% 8207\gdef\eatcr #1{\eatcra #1Q^^MQ}% 8208\gdef\eatcra#1^^MQ{\eatcrb#1Q}% 8209\gdef\eatcrb#1Q#2Q{#1}% 8210} 8211 8212% Macro bodies are absorbed as an argument in a context where 8213% all characters are catcode 10, 11 or 12, except \ which is active 8214% (as in normal texinfo). It is necessary to change the definition of \ 8215% to recognize macro arguments; this is the job of \mbodybackslash. 8216% 8217% Non-ASCII encodings make 8-bit characters active, so un-activate 8218% them to avoid their expansion. Must do this non-globally, to 8219% confine the change to the current group. 8220% 8221% It's necessary to have hard CRs when the macro is executed. This is 8222% done by making ^^M (\endlinechar) catcode 12 when reading the macro 8223% body, and then making it the \newlinechar in \scanmacro. 8224% 8225\def\scanctxt{% used as subroutine 8226 \catcode`\"=\other 8227 \catcode`\+=\other 8228 \catcode`\<=\other 8229 \catcode`\>=\other 8230 \catcode`\^=\other 8231 \catcode`\_=\other 8232 \catcode`\|=\other 8233 \catcode`\~=\other 8234 \passthroughcharstrue 8235} 8236 8237\def\scanargctxt{% used for copying and captions, not macros. 8238 \scanctxt 8239 \catcode`\@=\other 8240 \catcode`\\=\other 8241 \catcode`\^^M=\other 8242} 8243 8244\def\macrobodyctxt{% used for @macro definitions 8245 \scanctxt 8246 \catcode`\ =\other 8247 \catcode`\@=\other 8248 \catcode`\{=\other 8249 \catcode`\}=\other 8250 \catcode`\^^M=\other 8251 \usembodybackslash 8252} 8253 8254% Used when scanning braced macro arguments. Note, however, that catcode 8255% changes here are ineffectual if the macro invocation was nested inside 8256% an argument to another Texinfo command. 8257\def\macroargctxt{% 8258 \scanctxt 8259 \catcode`\ =\active 8260 \catcode`\@=\other 8261 \catcode`\^^M=\other 8262 \catcode`\\=\active 8263} 8264 8265\def\macrolineargctxt{% used for whole-line arguments without braces 8266 \scanctxt 8267 \catcode`\@=\other 8268 \catcode`\{=\other 8269 \catcode`\}=\other 8270} 8271 8272% \mbodybackslash is the definition of \ in @macro bodies. 8273% It maps \foo\ => \csname macarg.foo\endcsname => #N 8274% where N is the macro parameter number. 8275% We define \csname macarg.\endcsname to be \realbackslash, so 8276% \\ in macro replacement text gets you a backslash. 8277% 8278{\catcode`@=0 @catcode`@\=@active 8279 @gdef@usembodybackslash{@let\=@mbodybackslash} 8280 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} 8281} 8282\expandafter\def\csname macarg.\endcsname{\realbackslash} 8283 8284\def\margbackslash#1{\char`\#1 } 8285 8286\def\macro{\recursivefalse\parsearg\macroxxx} 8287\def\rmacro{\recursivetrue\parsearg\macroxxx} 8288 8289\def\macroxxx#1{% 8290 \getargs{#1}% now \macname is the macname and \argl the arglist 8291 \ifx\argl\empty % no arguments 8292 \paramno=0\relax 8293 \else 8294 \expandafter\parsemargdef \argl;% 8295 \if\paramno>256\relax 8296 \ifx\eTeXversion\thisisundefined 8297 \errhelp = \EMsimple 8298 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} 8299 \fi 8300 \fi 8301 \fi 8302 \if1\csname ismacro.\the\macname\endcsname 8303 \message{Warning: redefining \the\macname}% 8304 \else 8305 \expandafter\ifx\csname \the\macname\endcsname \relax 8306 \else \errmessage{Macro name \the\macname\space already defined}\fi 8307 \global\cslet{macsave.\the\macname}{\the\macname}% 8308 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% 8309 \addtomacrolist{\the\macname}% 8310 \fi 8311 \begingroup \macrobodyctxt 8312 \ifrecursive \expandafter\parsermacbody 8313 \else \expandafter\parsemacbody 8314 \fi} 8315 8316\parseargdef\unmacro{% 8317 \if1\csname ismacro.#1\endcsname 8318 \global\cslet{#1}{macsave.#1}% 8319 \global\expandafter\let \csname ismacro.#1\endcsname=0% 8320 % Remove the macro name from \macrolist: 8321 \begingroup 8322 \expandafter\let\csname#1\endcsname \relax 8323 \let\commondummyword\unmacrodo 8324 \xdef\macrolist{\macrolist}% 8325 \endgroup 8326 \else 8327 \errmessage{Macro #1 not defined}% 8328 \fi 8329} 8330 8331% Called by \do from \dounmacro on each macro. The idea is to omit any 8332% macro definitions that have been changed to \relax. 8333% 8334\def\unmacrodo#1{% 8335 \ifx #1\relax 8336 % remove this 8337 \else 8338 \noexpand\commondummyword \noexpand#1% 8339 \fi 8340} 8341 8342% \getargs -- Parse the arguments to a @macro line. Set \macname to 8343% the name of the macro, and \argl to the braced argument list. 8344\def\getargs#1{\getargsxxx#1{}} 8345\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} 8346\def\getmacname#1 #2\relax{\macname={#1}} 8347\def\getmacargs#1{\def\argl{#1}} 8348% This made use of the feature that if the last token of a 8349% <parameter list> is #, then the preceding argument is delimited by 8350% an opening brace, and that opening brace is not consumed. 8351 8352% Parse the optional {params} list to @macro or @rmacro. 8353% Set \paramno to the number of arguments, 8354% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a 8355% three-param macro.) Define \macarg.BLAH for each BLAH in the params 8356% list to some hook where the argument is to be expanded. If there are 8357% less than 10 arguments that hook is to be replaced by ##N where N 8358% is the position in that list, that is to say the macro arguments are to be 8359% defined `a la TeX in the macro body. 8360% 8361% That gets used by \mbodybackslash (above). 8362% 8363% If there are 10 or more arguments, a different technique is used: see 8364% \parsemmanyargdef. 8365% 8366\def\parsemargdef#1;{% 8367 \paramno=0\def\paramlist{}% 8368 \let\hash\relax 8369 % \hash is redefined to `#' later to get it into definitions 8370 \let\xeatspaces\relax 8371 \parsemargdefxxx#1,;,% 8372 \ifnum\paramno<10\relax\else 8373 \paramno0\relax 8374 \parsemmanyargdef@@#1,;,% 10 or more arguments 8375 \fi 8376} 8377\def\parsemargdefxxx#1,{% 8378 \if#1;\let\next=\relax 8379 \else \let\next=\parsemargdefxxx 8380 \advance\paramno by 1 8381 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname 8382 {\xeatspaces{\hash\the\paramno}}% 8383 \edef\paramlist{\paramlist\hash\the\paramno,}% 8384 \fi\next} 8385 8386% \parsemacbody, \parsermacbody 8387% 8388% Read recursive and nonrecursive macro bodies. (They're different since 8389% rec and nonrec macros end differently.) 8390% 8391% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 8392% body to be transformed. 8393% Set \macrobody to the body of the macro, and call \defmacro. 8394% 8395{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% 8396\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% 8397{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% 8398\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% 8399 8400% Make @ a letter, so that we can make private-to-Texinfo macro names. 8401\edef\texiatcatcode{\the\catcode`\@} 8402\catcode `@=11\relax 8403 8404%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% 8405 8406% If there are 10 or more arguments, a different technique is used, where the 8407% hook remains in the body, and when macro is to be expanded the body is 8408% processed again to replace the arguments. 8409% 8410% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the 8411% argument N value and then \edef the body (nothing else will expand because of 8412% the catcode regime under which the body was input). 8413% 8414% If you compile with TeX (not eTeX), and you have macros with 10 or more 8415% arguments, no macro can have more than 256 arguments (else error). 8416% 8417% In case that there are 10 or more arguments we parse again the arguments 8418% list to set new definitions for the \macarg.BLAH macros corresponding to 8419% each BLAH argument. It was anyhow needed to parse already once this list 8420% in order to count the arguments, and as macros with at most 9 arguments 8421% are by far more frequent than macro with 10 or more arguments, defining 8422% twice the \macarg.BLAH macros does not cost too much processing power. 8423\def\parsemmanyargdef@@#1,{% 8424 \if#1;\let\next=\relax 8425 \else 8426 \let\next=\parsemmanyargdef@@ 8427 \edef\tempb{\eatspaces{#1}}% 8428 \expandafter\def\expandafter\tempa 8429 \expandafter{\csname macarg.\tempb\endcsname}% 8430 % Note that we need some extra \noexpand\noexpand, this is because we 8431 % don't want \the to be expanded in the \parsermacbody as it uses an 8432 % \xdef . 8433 \expandafter\edef\tempa 8434 {\noexpand\noexpand\noexpand\the\toks\the\paramno}% 8435 \advance\paramno by 1\relax 8436 \fi\next} 8437 8438 8439\let\endargs@\relax 8440\let\nil@\relax 8441\def\nilm@{\nil@}% 8442\long\def\nillm@{\nil@}% 8443 8444% This macro is expanded during the Texinfo macro expansion, not during its 8445% definition. It gets all the arguments' values and assigns them to macros 8446% macarg.ARGNAME 8447% 8448% #1 is the macro name 8449% #2 is the list of argument names 8450% #3 is the list of argument values 8451\def\getargvals@#1#2#3{% 8452 \def\macargdeflist@{}% 8453 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. 8454 \def\paramlist{#2,\nil@}% 8455 \def\macroname{#1}% 8456 \begingroup 8457 \macroargctxt 8458 \def\argvaluelist{#3,\nil@}% 8459 \def\@tempa{#3}% 8460 \ifx\@tempa\empty 8461 \setemptyargvalues@ 8462 \else 8463 \getargvals@@ 8464 \fi 8465} 8466\def\getargvals@@{% 8467 \ifx\paramlist\nilm@ 8468 % Some sanity check needed here that \argvaluelist is also empty. 8469 \ifx\argvaluelist\nillm@ 8470 \else 8471 \errhelp = \EMsimple 8472 \errmessage{Too many arguments in macro `\macroname'!}% 8473 \fi 8474 \let\next\macargexpandinbody@ 8475 \else 8476 \ifx\argvaluelist\nillm@ 8477 % No more arguments values passed to macro. Set remaining named-arg 8478 % macros to empty. 8479 \let\next\setemptyargvalues@ 8480 \else 8481 % pop current arg name into \@tempb 8482 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% 8483 \expandafter\@tempa\expandafter{\paramlist}% 8484 % pop current argument value into \@tempc 8485 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% 8486 \expandafter\@tempa\expandafter{\argvaluelist}% 8487 % Here \@tempb is the current arg name and \@tempc is the current arg value. 8488 % First place the new argument macro definition into \@tempd 8489 \expandafter\macname\expandafter{\@tempc}% 8490 \expandafter\let\csname macarg.\@tempb\endcsname\relax 8491 \expandafter\def\expandafter\@tempe\expandafter{% 8492 \csname macarg.\@tempb\endcsname}% 8493 \edef\@tempd{\long\def\@tempe{\the\macname}}% 8494 \push@\@tempd\macargdeflist@ 8495 \let\next\getargvals@@ 8496 \fi 8497 \fi 8498 \next 8499} 8500 8501\def\push@#1#2{% 8502 \expandafter\expandafter\expandafter\def 8503 \expandafter\expandafter\expandafter#2% 8504 \expandafter\expandafter\expandafter{% 8505 \expandafter#1#2}% 8506} 8507 8508% Replace arguments by their values in the macro body, and place the result 8509% in macro \@tempa. 8510% 8511\def\macvalstoargs@{% 8512 % To do this we use the property that token registers that are \the'ed 8513 % within an \edef expand only once. So we are going to place all argument 8514 % values into respective token registers. 8515 % 8516 % First we save the token context, and initialize argument numbering. 8517 \begingroup 8518 \paramno0\relax 8519 % Then, for each argument number #N, we place the corresponding argument 8520 % value into a new token list register \toks#N 8521 \expandafter\putargsintokens@\saveparamlist@,;,% 8522 % Then, we expand the body so that argument are replaced by their 8523 % values. The trick for values not to be expanded themselves is that they 8524 % are within tokens and that tokens expand only once in an \edef . 8525 \edef\@tempc{\csname mac.\macroname .body\endcsname}% 8526 % Now we restore the token stack pointer to free the token list registers 8527 % which we have used, but we make sure that expanded body is saved after 8528 % group. 8529 \expandafter 8530 \endgroup 8531 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% 8532 } 8533 8534% Define the named-macro outside of this group and then close this group. 8535% 8536\def\macargexpandinbody@{% 8537 \expandafter 8538 \endgroup 8539 \macargdeflist@ 8540 % First the replace in body the macro arguments by their values, the result 8541 % is in \@tempa . 8542 \macvalstoargs@ 8543 % Then we point at the \norecurse or \gobble (for recursive) macro value 8544 % with \@tempb . 8545 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname 8546 % Depending on whether it is recursive or not, we need some tailing 8547 % \egroup . 8548 \ifx\@tempb\gobble 8549 \let\@tempc\relax 8550 \else 8551 \let\@tempc\egroup 8552 \fi 8553 % And now we do the real job: 8554 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% 8555 \@tempd 8556} 8557 8558\def\putargsintokens@#1,{% 8559 \if#1;\let\next\relax 8560 \else 8561 \let\next\putargsintokens@ 8562 % First we allocate the new token list register, and give it a temporary 8563 % alias \@tempb . 8564 \toksdef\@tempb\the\paramno 8565 % Then we place the argument value into that token list register. 8566 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname 8567 \expandafter\@tempb\expandafter{\@tempa}% 8568 \advance\paramno by 1\relax 8569 \fi 8570 \next 8571} 8572 8573% Trailing missing arguments are set to empty. 8574% 8575\def\setemptyargvalues@{% 8576 \ifx\paramlist\nilm@ 8577 \let\next\macargexpandinbody@ 8578 \else 8579 \expandafter\setemptyargvaluesparser@\paramlist\endargs@ 8580 \let\next\setemptyargvalues@ 8581 \fi 8582 \next 8583} 8584 8585\def\setemptyargvaluesparser@#1,#2\endargs@{% 8586 \expandafter\def\expandafter\@tempa\expandafter{% 8587 \expandafter\def\csname macarg.#1\endcsname{}}% 8588 \push@\@tempa\macargdeflist@ 8589 \def\paramlist{#2}% 8590} 8591 8592% #1 is the element target macro 8593% #2 is the list macro 8594% #3,#4\endargs@ is the list value 8595\def\pop@#1#2#3,#4\endargs@{% 8596 \def#1{#3}% 8597 \def#2{#4}% 8598} 8599\long\def\longpop@#1#2#3,#4\endargs@{% 8600 \long\def#1{#3}% 8601 \long\def#2{#4}% 8602} 8603 8604 8605%%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%% 8606 8607 8608% This defines a Texinfo @macro or @rmacro, called by \parsemacbody. 8609% \macrobody has the body of the macro in it, with placeholders for 8610% its parameters, looking like "\xeatspaces{\hash 1}". 8611% \paramno is the number of parameters 8612% \paramlist is a TeX parameter text, e.g. "#1,#2,#3," 8613% There are four cases: macros of zero, one, up to nine, and many arguments. 8614% \xdef is used so that macro definitions will survive the file 8615% they're defined in: @include reads the file inside a group. 8616% 8617\def\defmacro{% 8618 \let\hash=##% convert placeholders to macro parameter chars 8619 \ifnum\paramno=1 8620 \def\xeatspaces##1{##1}% 8621 % This removes the pair of braces around the argument. We don't 8622 % use \eatspaces, because this can cause ends of lines to be lost 8623 % when the argument to \eatspaces is read, leading to line-based 8624 % commands like "@itemize" not being read correctly. 8625 \else 8626 \let\xeatspaces\relax % suppress expansion 8627 \fi 8628 \ifcase\paramno 8629 % 0 8630 \expandafter\xdef\csname\the\macname\endcsname{% 8631 \bgroup 8632 \noexpand\spaceisspace 8633 \noexpand\endlineisspace 8634 \noexpand\expandafter % skip any whitespace after the macro name. 8635 \expandafter\noexpand\csname\the\macname @@@\endcsname}% 8636 \expandafter\xdef\csname\the\macname @@@\endcsname{% 8637 \egroup 8638 \noexpand\scanmacro{\macrobody}}% 8639 \or % 1 8640 \expandafter\xdef\csname\the\macname\endcsname{% 8641 \bgroup 8642 \noexpand\braceorline 8643 \expandafter\noexpand\csname\the\macname @@@\endcsname}% 8644 \expandafter\xdef\csname\the\macname @@@\endcsname##1{% 8645 \egroup 8646 \noexpand\scanmacro{\macrobody}% 8647 }% 8648 \else % at most 9 8649 \ifnum\paramno<10\relax 8650 % @MACNAME sets the context for reading the macro argument 8651 % @MACNAME@@ gets the argument, processes backslashes and appends a 8652 % comma. 8653 % @MACNAME@@@ removes braces surrounding the argument list. 8654 % @MACNAME@@@@ scans the macro body with arguments substituted. 8655 \expandafter\xdef\csname\the\macname\endcsname{% 8656 \bgroup 8657 \noexpand\expandafter % This \expandafter skip any spaces after the 8658 \noexpand\macroargctxt % macro before we change the catcode of space. 8659 \noexpand\expandafter 8660 \expandafter\noexpand\csname\the\macname @@\endcsname}% 8661 \expandafter\xdef\csname\the\macname @@\endcsname##1{% 8662 \noexpand\passargtomacro 8663 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% 8664 \expandafter\xdef\csname\the\macname @@@\endcsname##1{% 8665 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% 8666 \expandafter\expandafter 8667 \expandafter\xdef 8668 \expandafter\expandafter 8669 \csname\the\macname @@@@\endcsname\paramlist{% 8670 \egroup\noexpand\scanmacro{\macrobody}}% 8671 \else % 10 or more: 8672 \expandafter\xdef\csname\the\macname\endcsname{% 8673 \noexpand\getargvals@{\the\macname}{\argl}% 8674 }% 8675 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody 8676 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble 8677 \fi 8678 \fi} 8679 8680\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes 8681 8682\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} 8683 8684 8685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8686% 8687{\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape 8688@catcode`@_=11 % private names 8689@catcode`@!=11 % used as argument separator 8690 8691% \passargtomacro#1#2 - 8692% Call #1 with a list of tokens #2, with any doubled backslashes in #2 8693% compressed to one. 8694% 8695% This implementation works by expansion, and not execution (so we cannot use 8696% \def or similar). This reduces the risk of this failing in contexts where 8697% complete expansion is done with no execution (for example, in writing out to 8698% an auxiliary file for an index entry). 8699% 8700% State is kept in the input stream: the argument passed to 8701% @look_ahead, @gobble_and_check_finish and @add_segment is 8702% 8703% THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input) 8704% 8705% where: 8706% THE_MACRO - name of the macro we want to call 8707% ARG_RESULT - argument list we build to pass to that macro 8708% PENDING_BS - either a backslash or nothing 8709% NEXT_TOKEN - used to look ahead in the input stream to see what's coming next 8710 8711@gdef@passargtomacro#1#2{% 8712 @add_segment #1!{}@relax#2\@_finish\% 8713} 8714@gdef@_finish{@_finishx} @global@let@_finishx@relax 8715 8716% #1 - THE_MACRO ARG_RESULT 8717% #2 - PENDING_BS 8718% #3 - NEXT_TOKEN 8719% #4 used to look ahead 8720% 8721% If the next token is not a backslash, process the rest of the argument; 8722% otherwise, remove the next token. 8723@gdef@look_ahead#1!#2#3#4{% 8724 @ifx#4\% 8725 @expandafter@gobble_and_check_finish 8726 @else 8727 @expandafter@add_segment 8728 @fi#1!{#2}#4#4% 8729} 8730 8731% #1 - THE_MACRO ARG_RESULT 8732% #2 - PENDING_BS 8733% #3 - NEXT_TOKEN 8734% #4 should be a backslash, which is gobbled. 8735% #5 looks ahead 8736% 8737% Double backslash found. Add a single backslash, and look ahead. 8738@gdef@gobble_and_check_finish#1!#2#3#4#5{% 8739 @add_segment#1\!{}#5#5% 8740} 8741 8742@gdef@is_fi{@fi} 8743 8744% #1 - THE_MACRO ARG_RESULT 8745% #2 - PENDING_BS 8746% #3 - NEXT_TOKEN 8747% #4 is input stream until next backslash 8748% 8749% Input stream is either at the start of the argument, or just after a 8750% backslash sequence, either a lone backslash, or a doubled backslash. 8751% NEXT_TOKEN contains the first token in the input stream: if it is \finish, 8752% finish; otherwise, append to ARG_RESULT the segment of the argument up until 8753% the next backslash. PENDING_BACKSLASH contains a backslash to represent 8754% a backslash just before the start of the input stream that has not been 8755% added to ARG_RESULT. 8756@gdef@add_segment#1!#2#3#4\{% 8757@ifx#3@_finish 8758 @call_the_macro#1!% 8759@else 8760 % append the pending backslash to the result, followed by the next segment 8761 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi 8762 % this @fi is discarded by @look_ahead. 8763 % we can't get rid of it with \expandafter because we don't know how 8764 % long #4 is. 8765} 8766 8767% #1 - THE_MACRO 8768% #2 - ARG_RESULT 8769% #3 discards the res of the conditional in @add_segment, and @is_fi ends the 8770% conditional. 8771@gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}} 8772 8773} 8774%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8775 8776% \braceorline MAC is used for a one-argument macro MAC. It checks 8777% whether the next non-whitespace character is a {. It sets the context 8778% for reading the argument (slightly different in the two cases). Then, 8779% to read the argument, in the whole-line case, it then calls the regular 8780% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC. 8781% 8782\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} 8783\def\braceorlinexxx{% 8784 \ifx\nchar\bgroup 8785 \macroargctxt 8786 \expandafter\passargtomacro 8787 \else 8788 \macrolineargctxt\expandafter\parsearg 8789 \fi \macnamexxx} 8790 8791 8792% @alias. 8793% We need some trickery to remove the optional spaces around the equal 8794% sign. Make them active and then expand them all to nothing. 8795% 8796\def\alias{\parseargusing\obeyspaces\aliasxxx} 8797\def\aliasxxx #1{\aliasyyy#1\relax} 8798\def\aliasyyy #1=#2\relax{% 8799 {% 8800 \expandafter\let\obeyedspace=\empty 8801 \addtomacrolist{#1}% 8802 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% 8803 }% 8804 \next 8805} 8806 8807 8808\message{cross references,} 8809 8810\newwrite\auxfile 8811\newif\ifhavexrefs % True if xref values are known. 8812\newif\ifwarnedxrefs % True if we warned once that they aren't known. 8813 8814% @inforef is relatively simple. 8815\def\inforef #1{\inforefzzz #1,,,,**} 8816\def\inforefzzz #1,#2,#3,#4**{% 8817 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, 8818 node \samp{\ignorespaces#1{}}} 8819 8820% @node's only job in TeX is to define \lastnode, which is used in 8821% cross-references. The @node line might or might not have commas, and 8822% might or might not have spaces before the first comma, like: 8823% @node foo , bar , ... 8824% We don't want such trailing spaces in the node name. 8825% 8826\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} 8827% 8828% also remove a trailing comma, in case of something like this: 8829% @node Help-Cross, , , Cross-refs 8830\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} 8831\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode} 8832 8833% Used so that the @top node doesn't have to be wrapped in an @ifnottex 8834% conditional. 8835% \doignore goes to more effort to skip nested conditionals but we don't need 8836% that here. 8837\def\omittopnode{% 8838 \ifx\lastnode\wordTop 8839 \expandafter\ignorenode\fi 8840} 8841\def\wordTop{Top} 8842 8843% Until the next @node or @bye command, divert output to a box that is not 8844% output. 8845\def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}% 8846\ignorenodebye 8847} 8848 8849{\let\bye\relax 8850\gdef\ignorenodebye{\let\bye\ignorenodebyedef} 8851\gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}} 8852% The redefinition of \bye here is because it is declared \outer 8853 8854\let\lastnode=\empty 8855 8856% Write a cross-reference definition for the current node. #1 is the 8857% type (Ynumbered, Yappendix, Ynothing). 8858% 8859\def\donoderef#1{% 8860 \ifx\lastnode\empty\else 8861 \setref{\lastnode}{#1}% 8862 \global\let\lastnode=\empty 8863 \fi 8864} 8865 8866% @anchor{NAME} -- define xref target at arbitrary point. 8867% 8868\newcount\savesfregister 8869% 8870\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} 8871\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} 8872\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} 8873 8874% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an 8875% anchor), which consists of three parts: 8876% 1) NAME-title - the current sectioning name taken from \currentsection, 8877% or the anchor name. 8878% 2) NAME-snt - section number and type, passed as the SNT arg, or 8879% empty for anchors. 8880% 3) NAME-pg - the page number. 8881% 8882% This is called from \donoderef, \anchor, and \dofloat. In the case of 8883% floats, there is an additional part, which is not written here: 8884% 4) NAME-lof - the text as it should appear in a @listoffloats. 8885% 8886\def\setref#1#2{% 8887 \pdfmkdest{#1}% 8888 \iflinks 8889 {% 8890 \requireauxfile 8891 \atdummies % preserve commands, but don't expand them 8892 % match definition in \xrdef, \refx, \xrefX. 8893 \def\value##1{##1}% 8894 \edef\writexrdef##1##2{% 8895 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef 8896 ##1}{##2}}% these are parameters of \writexrdef 8897 }% 8898 \toks0 = \expandafter{\currentsection}% 8899 \immediate \writexrdef{title}{\the\toks0 }% 8900 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. 8901 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout 8902 }% 8903 \fi 8904} 8905 8906% @xrefautosectiontitle on|off says whether @section(ing) names are used 8907% automatically in xrefs, if the third arg is not explicitly specified. 8908% This was provided as a "secret" @set xref-automatic-section-title 8909% variable, now it's official. 8910% 8911\parseargdef\xrefautomaticsectiontitle{% 8912 \def\temp{#1}% 8913 \ifx\temp\onword 8914 \expandafter\let\csname SETxref-automatic-section-title\endcsname 8915 = \empty 8916 \else\ifx\temp\offword 8917 \expandafter\let\csname SETxref-automatic-section-title\endcsname 8918 = \relax 8919 \else 8920 \errhelp = \EMsimple 8921 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', 8922 must be on|off}% 8923 \fi\fi 8924} 8925 8926% 8927% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is 8928% the node name, #2 the name of the Info cross-reference, #3 the printed 8929% node name, #4 the name of the Info file, #5 the name of the printed 8930% manual. All but the node name can be omitted. 8931% 8932\def\pxref{\putwordsee{} \xrefXX} 8933\def\xref{\putwordSee{} \xrefXX} 8934\def\ref{\xrefXX} 8935 8936\def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX} 8937\def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]} 8938% 8939\newbox\toprefbox 8940\newbox\printedrefnamebox 8941\newbox\infofilenamebox 8942\newbox\printedmanualbox 8943% 8944\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup 8945 \unsepspaces 8946 % 8947 % Get args without leading/trailing spaces. 8948 \def\printedrefname{\ignorespaces #3}% 8949 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% 8950 % 8951 \def\infofilename{\ignorespaces #4}% 8952 \setbox\infofilenamebox = \hbox{\infofilename\unskip}% 8953 % 8954 \def\printedmanual{\ignorespaces #5}% 8955 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% 8956 % 8957 % If the printed reference name (arg #3) was not explicitly given in 8958 % the @xref, figure out what we want to use. 8959 \ifdim \wd\printedrefnamebox = 0pt 8960 % No printed node name was explicitly given. 8961 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax 8962 % Not auto section-title: use node name inside the square brackets. 8963 \def\printedrefname{\ignorespaces #1}% 8964 \else 8965 % Auto section-title: use chapter/section title inside 8966 % the square brackets if we have it. 8967 \ifdim \wd\printedmanualbox > 0pt 8968 % It is in another manual, so we don't have it; use node name. 8969 \def\printedrefname{\ignorespaces #1}% 8970 \else 8971 \ifhavexrefs 8972 % We (should) know the real title if we have the xref values. 8973 \def\printedrefname{\refx{#1-title}{}}% 8974 \else 8975 % Otherwise just copy the Info node name. 8976 \def\printedrefname{\ignorespaces #1}% 8977 \fi% 8978 \fi 8979 \fi 8980 \fi 8981 % 8982 % Make link in pdf output. 8983 \ifpdf 8984 % For pdfTeX and LuaTeX 8985 {\indexnofonts 8986 \makevalueexpandable 8987 \turnoffactive 8988 % This expands tokens, so do it after making catcode changes, so _ 8989 % etc. don't get their TeX definitions. This ignores all spaces in 8990 % #4, including (wrongly) those in the middle of the filename. 8991 \getfilename{#4}% 8992 % 8993 % This (wrongly) does not take account of leading or trailing 8994 % spaces in #1, which should be ignored. 8995 \setpdfdestname{#1}% 8996 % 8997 \ifx\pdfdestname\empty 8998 \def\pdfdestname{Top}% no empty targets 8999 \fi 9000 % 9001 \leavevmode 9002 \startlink attr{/Border [0 0 0]}% 9003 \ifnum\filenamelength>0 9004 goto file{\the\filename.pdf} name{\pdfdestname}% 9005 \else 9006 goto name{\pdfmkpgn{\pdfdestname}}% 9007 \fi 9008 }% 9009 \setcolor{\linkcolor}% 9010 \else 9011 \ifx\XeTeXrevision\thisisundefined 9012 \else 9013 % For XeTeX 9014 {\indexnofonts 9015 \makevalueexpandable 9016 \turnoffactive 9017 % This expands tokens, so do it after making catcode changes, so _ 9018 % etc. don't get their TeX definitions. This ignores all spaces in 9019 % #4, including (wrongly) those in the middle of the filename. 9020 \getfilename{#4}% 9021 % 9022 % This (wrongly) does not take account of leading or trailing 9023 % spaces in #1, which should be ignored. 9024 \setpdfdestname{#1}% 9025 % 9026 \ifx\pdfdestname\empty 9027 \def\pdfdestname{Top}% no empty targets 9028 \fi 9029 % 9030 \leavevmode 9031 \ifnum\filenamelength>0 9032 % With default settings, 9033 % XeTeX (xdvipdfmx) replaces link destination names with integers. 9034 % In this case, the replaced destination names of 9035 % remote PDFs are no longer known. In order to avoid a replacement, 9036 % you can use xdvipdfmx's command line option `-C 0x0010'. 9037 % If you use XeTeX 0.99996+ (TeX Live 2016+), 9038 % this command line option is no longer necessary 9039 % because we can use the `dvipdfmx:config' special. 9040 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A 9041 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}% 9042 \else 9043 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A 9044 << /S /GoTo /D (\pdfdestname) >> >>}% 9045 \fi 9046 }% 9047 \setcolor{\linkcolor}% 9048 \fi 9049 \fi 9050 {% 9051 % Have to otherify everything special to allow the \csname to 9052 % include an _ in the xref name, etc. 9053 \indexnofonts 9054 \turnoffactive 9055 \def\value##1{##1}% 9056 \expandafter\global\expandafter\let\expandafter\Xthisreftitle 9057 \csname XR#1-title\endcsname 9058 }% 9059 % 9060 % Float references are printed completely differently: "Figure 1.2" 9061 % instead of "[somenode], p.3". \iffloat distinguishes them by 9062 % \Xthisreftitle being set to a magic string. 9063 \iffloat\Xthisreftitle 9064 % If the user specified the print name (third arg) to the ref, 9065 % print it instead of our usual "Figure 1.2". 9066 \ifdim\wd\printedrefnamebox = 0pt 9067 \refx{#1-snt}{}% 9068 \else 9069 \printedrefname 9070 \fi 9071 % 9072 % If the user also gave the printed manual name (fifth arg), append 9073 % "in MANUALNAME". 9074 \ifdim \wd\printedmanualbox > 0pt 9075 \space \putwordin{} \cite{\printedmanual}% 9076 \fi 9077 \else 9078 % node/anchor (non-float) references. 9079 % 9080 % If we use \unhbox to print the node names, TeX does not insert 9081 % empty discretionaries after hyphens, which means that it will not 9082 % find a line break at a hyphen in a node names. Since some manuals 9083 % are best written with fairly long node names, containing hyphens, 9084 % this is a loss. Therefore, we give the text of the node name 9085 % again, so it is as if TeX is seeing it for the first time. 9086 % 9087 \ifdim \wd\printedmanualbox > 0pt 9088 % Cross-manual reference with a printed manual name. 9089 % 9090 \crossmanualxref{\cite{\printedmanual\unskip}}% 9091 % 9092 \else\ifdim \wd\infofilenamebox > 0pt 9093 % Cross-manual reference with only an info filename (arg 4), no 9094 % printed manual name (arg 5). This is essentially the same as 9095 % the case above; we output the filename, since we have nothing else. 9096 % 9097 \crossmanualxref{\code{\infofilename\unskip}}% 9098 % 9099 \else 9100 % Reference within this manual. 9101 % 9102 % Only output a following space if the -snt ref is nonempty; for 9103 % @unnumbered and @anchor, it won't be. 9104 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% 9105 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi 9106 % 9107 % output the `[mynode]' via the macro below so it can be overridden. 9108 \xrefprintnodename\printedrefname 9109 % 9110 % But we always want a comma and a space: 9111 ,\space 9112 % 9113 % output the `page 3'. 9114 \turnoffactive \putwordpage\tie\refx{#1-pg}{}% 9115 % Add a , if xref followed by a space 9116 \if\space\noexpand\tokenafterxref ,% 9117 \else\ifx\ \tokenafterxref ,% @TAB 9118 \else\ifx\*\tokenafterxref ,% @* 9119 \else\ifx\ \tokenafterxref ,% @SPACE 9120 \else\ifx\ 9121 \tokenafterxref ,% @NL 9122 \else\ifx\tie\tokenafterxref ,% @tie 9123 \fi\fi\fi\fi\fi\fi 9124 \fi\fi 9125 \fi 9126 \endlink 9127\endgroup} 9128 9129% Output a cross-manual xref to #1. Used just above (twice). 9130% 9131% Only include the text "Section ``foo'' in" if the foo is neither 9132% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply 9133% "see The Foo Manual", the idea being to refer to the whole manual. 9134% 9135% But, this being TeX, we can't easily compare our node name against the 9136% string "Top" while ignoring the possible spaces before and after in 9137% the input. By adding the arbitrary 7sp below, we make it much less 9138% likely that a real node name would have the same width as "Top" (e.g., 9139% in a monospaced font). Hopefully it will never happen in practice. 9140% 9141% For the same basic reason, we retypeset the "Top" at every 9142% reference, since the current font is indeterminate. 9143% 9144\def\crossmanualxref#1{% 9145 \setbox\toprefbox = \hbox{Top\kern7sp}% 9146 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% 9147 \ifdim \wd2 > 7sp % nonempty? 9148 \ifdim \wd2 = \wd\toprefbox \else % same as Top? 9149 \putwordSection{} ``\printedrefname'' \putwordin{}\space 9150 \fi 9151 \fi 9152 #1% 9153} 9154 9155% This macro is called from \xrefX for the `[nodename]' part of xref 9156% output. It's a separate macro only so it can be changed more easily, 9157% since square brackets don't work well in some documents. Particularly 9158% one that Bob is working on :). 9159% 9160\def\xrefprintnodename#1{[#1]} 9161 9162% Things referred to by \setref. 9163% 9164\def\Ynothing{} 9165\def\Yomitfromtoc{} 9166\def\Ynumbered{% 9167 \ifnum\secno=0 9168 \putwordChapter@tie \the\chapno 9169 \else \ifnum\subsecno=0 9170 \putwordSection@tie \the\chapno.\the\secno 9171 \else \ifnum\subsubsecno=0 9172 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno 9173 \else 9174 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno 9175 \fi\fi\fi 9176} 9177\def\Yappendix{% 9178 \ifnum\secno=0 9179 \putwordAppendix@tie @char\the\appendixno{}% 9180 \else \ifnum\subsecno=0 9181 \putwordSection@tie @char\the\appendixno.\the\secno 9182 \else \ifnum\subsubsecno=0 9183 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno 9184 \else 9185 \putwordSection@tie 9186 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno 9187 \fi\fi\fi 9188} 9189 9190% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX 9191% is output afterwards if non-empty. 9192\def\refx#1#2{% 9193 \requireauxfile 9194 {% 9195 \indexnofonts 9196 \turnoffactive 9197 \def\value##1{##1}% 9198 \expandafter\global\expandafter\let\expandafter\thisrefX 9199 \csname XR#1\endcsname 9200 }% 9201 \ifx\thisrefX\relax 9202 % If not defined, say something at least. 9203 \angleleft un\-de\-fined\angleright 9204 \iflinks 9205 \ifhavexrefs 9206 {\toks0 = {#1}% avoid expansion of possibly-complex value 9207 \message{\linenumber Undefined cross reference `\the\toks0'.}}% 9208 \else 9209 \ifwarnedxrefs\else 9210 \global\warnedxrefstrue 9211 \message{Cross reference values unknown; you must run TeX again.}% 9212 \fi 9213 \fi 9214 \fi 9215 \else 9216 % It's defined, so just use it. 9217 \thisrefX 9218 \fi 9219 #2% Output the suffix in any case. 9220} 9221 9222% This is the macro invoked by entries in the aux file. Define a control 9223% sequence for a cross-reference target (we prepend XR to the control sequence 9224% name to avoid collisions). The value is the page number. If this is a float 9225% type, we have more work to do. 9226% 9227\def\xrdef#1#2{% 9228 {% Expand the node or anchor name to remove control sequences. 9229 % \turnoffactive stops 8-bit characters being changed to commands 9230 % like @'e. \refx does the same to retrieve the value in the definition. 9231 \indexnofonts 9232 \turnoffactive 9233 \def\value##1{##1}% 9234 \xdef\safexrefname{#1}% 9235 }% 9236 % 9237 \bgroup 9238 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% 9239 \egroup 9240 % We put the \gdef inside a group to avoid the definitions building up on 9241 % TeX's save stack, which can cause it to run out of space for aux files with 9242 % thousands of lines. \gdef doesn't use the save stack, but \csname does 9243 % when it defines an unknown control sequence as \relax. 9244 % 9245 % Was that xref control sequence that we just defined for a float? 9246 \expandafter\iffloat\csname XR\safexrefname\endcsname 9247 % it was a float, and we have the (safe) float type in \iffloattype. 9248 \expandafter\let\expandafter\floatlist 9249 \csname floatlist\iffloattype\endcsname 9250 % 9251 % Is this the first time we've seen this float type? 9252 \expandafter\ifx\floatlist\relax 9253 \toks0 = {\do}% yes, so just \do 9254 \else 9255 % had it before, so preserve previous elements in list. 9256 \toks0 = \expandafter{\floatlist\do}% 9257 \fi 9258 % 9259 % Remember this xref in the control sequence \floatlistFLOATTYPE, 9260 % for later use in \listoffloats. 9261 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 9262 {\safexrefname}}% 9263 \fi 9264} 9265 9266% If working on a large document in chapters, it is convenient to 9267% be able to disable indexing, cross-referencing, and contents, for test runs. 9268% This is done with @novalidate at the beginning of the file. 9269% 9270\newif\iflinks \linkstrue % by default we want the aux files. 9271\let\novalidate = \linksfalse 9272 9273% Used when writing to the aux file, or when using data from it. 9274\def\requireauxfile{% 9275 \iflinks 9276 \tryauxfile 9277 % Open the new aux file. TeX will close it automatically at exit. 9278 \immediate\openout\auxfile=\jobname.aux 9279 \fi 9280 \global\let\requireauxfile=\relax % Only do this once. 9281} 9282 9283% Read the last existing aux file, if any. No error if none exists. 9284% 9285\def\tryauxfile{% 9286 \openin 1 \jobname.aux 9287 \ifeof 1 \else 9288 \readdatafile{aux}% 9289 \global\havexrefstrue 9290 \fi 9291 \closein 1 9292} 9293 9294\def\setupdatafile{% 9295 \catcode`\^^@=\other 9296 \catcode`\^^A=\other 9297 \catcode`\^^B=\other 9298 \catcode`\^^C=\other 9299 \catcode`\^^D=\other 9300 \catcode`\^^E=\other 9301 \catcode`\^^F=\other 9302 \catcode`\^^G=\other 9303 \catcode`\^^H=\other 9304 \catcode`\^^K=\other 9305 \catcode`\^^L=\other 9306 \catcode`\^^N=\other 9307 \catcode`\^^P=\other 9308 \catcode`\^^Q=\other 9309 \catcode`\^^R=\other 9310 \catcode`\^^S=\other 9311 \catcode`\^^T=\other 9312 \catcode`\^^U=\other 9313 \catcode`\^^V=\other 9314 \catcode`\^^W=\other 9315 \catcode`\^^X=\other 9316 \catcode`\^^Z=\other 9317 \catcode`\^^[=\other 9318 \catcode`\^^\=\other 9319 \catcode`\^^]=\other 9320 \catcode`\^^^=\other 9321 \catcode`\^^_=\other 9322 \catcode`\^=\other 9323 % 9324 % Special characters. Should be turned off anyway, but... 9325 \catcode`\~=\other 9326 \catcode`\[=\other 9327 \catcode`\]=\other 9328 \catcode`\"=\other 9329 \catcode`\_=\other 9330 \catcode`\|=\other 9331 \catcode`\<=\other 9332 \catcode`\>=\other 9333 \catcode`\$=\other 9334 \catcode`\#=\other 9335 \catcode`\&=\other 9336 \catcode`\%=\other 9337 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off 9338 % 9339 \catcode`\\=\active 9340 % 9341 % @ is our escape character in .aux files, and we need braces. 9342 \catcode`\{=1 9343 \catcode`\}=2 9344 \catcode`\@=0 9345} 9346 9347\def\readdatafile#1{% 9348\begingroup 9349 \setupdatafile 9350 \input\jobname.#1 9351\endgroup} 9352 9353 9354\message{insertions,} 9355% including footnotes. 9356 9357\newcount \footnoteno 9358 9359% The trailing space in the following definition for supereject is 9360% vital for proper filling; pages come out unaligned when you do a 9361% pagealignmacro call if that space before the closing brace is 9362% removed. (Generally, numeric constants should always be followed by a 9363% space to prevent strange expansion errors.) 9364\def\supereject{\par\penalty -20000\footnoteno =0 } 9365 9366% @footnotestyle is meaningful for Info output only. 9367\let\footnotestyle=\comment 9368 9369{\catcode `\@=11 9370% 9371% Auto-number footnotes. Otherwise like plain. 9372\gdef\footnote{% 9373 \global\advance\footnoteno by \@ne 9374 \edef\thisfootno{$^{\the\footnoteno}$}% 9375 % 9376 % In case the footnote comes at the end of a sentence, preserve the 9377 % extra spacing after we do the footnote number. 9378 \let\@sf\empty 9379 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi 9380 % 9381 % Remove inadvertent blank space before typesetting the footnote number. 9382 \unskip 9383 \thisfootno\@sf 9384 \dofootnote 9385}% 9386 9387% Don't bother with the trickery in plain.tex to not require the 9388% footnote text as a parameter. Our footnotes don't need to be so general. 9389% 9390% Oh yes, they do; otherwise, @ifset (and anything else that uses 9391% \parseargline) fails inside footnotes because the tokens are fixed when 9392% the footnote is read. --karl, 16nov96. 9393% 9394\gdef\dofootnote{% 9395 \insert\footins\bgroup 9396 % 9397 % Nested footnotes are not supported in TeX, that would take a lot 9398 % more work. (\startsavinginserts does not suffice.) 9399 \let\footnote=\errfootnotenest 9400 % 9401 % We want to typeset this text as a normal paragraph, even if the 9402 % footnote reference occurs in (for example) a display environment. 9403 % So reset some parameters. 9404 \hsize=\txipagewidth 9405 \interlinepenalty\interfootnotelinepenalty 9406 \splittopskip\ht\strutbox % top baseline for broken footnotes 9407 \splitmaxdepth\dp\strutbox 9408 \floatingpenalty\@MM 9409 \leftskip\z@skip 9410 \rightskip\z@skip 9411 \spaceskip\z@skip 9412 \xspaceskip\z@skip 9413 \parindent\defaultparindent 9414 % 9415 \smallfonts \rm 9416 % 9417 % Because we use hanging indentation in footnotes, a @noindent appears 9418 % to exdent this text, so make it be a no-op. makeinfo does not use 9419 % hanging indentation so @noindent can still be needed within footnote 9420 % text after an @example or the like (not that this is good style). 9421 \let\noindent = \relax 9422 % 9423 % Hang the footnote text off the number. Use \everypar in case the 9424 % footnote extends for more than one paragraph. 9425 \everypar = {\hang}% 9426 \textindent{\thisfootno}% 9427 % 9428 % Don't crash into the line above the footnote text. Since this 9429 % expands into a box, it must come within the paragraph, lest it 9430 % provide a place where TeX can split the footnote. 9431 \footstrut 9432 % 9433 % Invoke rest of plain TeX footnote routine. 9434 \futurelet\next\fo@t 9435} 9436}%end \catcode `\@=11 9437 9438\def\errfootnotenest{% 9439 \errhelp=\EMsimple 9440 \errmessage{Nested footnotes not supported in texinfo.tex, 9441 even though they work in makeinfo; sorry} 9442} 9443 9444\def\errfootnoteheading{% 9445 \errhelp=\EMsimple 9446 \errmessage{Footnotes in chapters, sections, etc., are not supported} 9447} 9448 9449% In case a @footnote appears in a vbox, save the footnote text and create 9450% the real \insert just after the vbox finished. Otherwise, the insertion 9451% would be lost. 9452% Similarly, if a @footnote appears inside an alignment, save the footnote 9453% text to a box and make the \insert when a row of the table is finished. 9454% And the same can be done for other insert classes. --kasal, 16nov03. 9455% 9456% Replace the \insert primitive by a cheating macro. 9457% Deeper inside, just make sure that the saved insertions are not spilled 9458% out prematurely. 9459% 9460\def\startsavinginserts{% 9461 \ifx \insert\ptexinsert 9462 \let\insert\saveinsert 9463 \else 9464 \let\checkinserts\relax 9465 \fi 9466} 9467 9468% This \insert replacement works for both \insert\footins{foo} and 9469% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. 9470% 9471\def\saveinsert#1{% 9472 \edef\next{\noexpand\savetobox \makeSAVEname#1}% 9473 \afterassignment\next 9474 % swallow the left brace 9475 \let\temp = 9476} 9477\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} 9478\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} 9479 9480\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} 9481 9482\def\placesaveins#1{% 9483 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname 9484 {\box#1}% 9485} 9486 9487% eat @SAVE -- beware, all of them have catcode \other: 9488{ 9489 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) 9490 \gdef\gobblesave @SAVE{} 9491} 9492 9493% initialization: 9494\def\newsaveins #1{% 9495 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% 9496 \next 9497} 9498\def\newsaveinsX #1{% 9499 \csname newbox\endcsname #1% 9500 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts 9501 \checksaveins #1}% 9502} 9503 9504% initialize: 9505\let\checkinserts\empty 9506\newsaveins\footins 9507\newsaveins\margin 9508 9509 9510% @image. We use the macros from epsf.tex to support this. 9511% If epsf.tex is not installed and @image is used, we complain. 9512% 9513% Check for and read epsf.tex up front. If we read it only at @image 9514% time, we might be inside a group, and then its definitions would get 9515% undone and the next image would fail. 9516\openin 1 = epsf.tex 9517\ifeof 1 \else 9518 % Do not bother showing banner with epsf.tex v2.7k (available in 9519 % doc/epsf.tex and on ctan). 9520 \def\epsfannounce{\toks0 = }% 9521 \input epsf.tex 9522\fi 9523\closein 1 9524% 9525% We will only complain once about lack of epsf.tex. 9526\newif\ifwarnednoepsf 9527\newhelp\noepsfhelp{epsf.tex must be installed for images to 9528 work. It is also included in the Texinfo distribution, or you can get 9529 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.} 9530% 9531\def\image#1{% 9532 \ifx\epsfbox\thisisundefined 9533 \ifwarnednoepsf \else 9534 \errhelp = \noepsfhelp 9535 \errmessage{epsf.tex not found, images will be ignored}% 9536 \global\warnednoepsftrue 9537 \fi 9538 \else 9539 \imagexxx #1,,,,,\finish 9540 \fi 9541} 9542% 9543% Arguments to @image: 9544% #1 is (mandatory) image filename; we tack on .eps extension. 9545% #2 is (optional) width, #3 is (optional) height. 9546% #4 is (ignored optional) html alt text. 9547% #5 is (ignored optional) extension. 9548% #6 is just the usual extra ignored arg for parsing stuff. 9549\newif\ifimagevmode 9550\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup 9551 \catcode`\^^M = 5 % in case we're inside an example 9552 \normalturnoffactive % allow _ et al. in names 9553 \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro 9554 % If the image is by itself, center it. 9555 \ifvmode 9556 \imagevmodetrue 9557 \else \ifx\centersub\centerV 9558 % for @center @image, we need a vbox so we can have our vertical space 9559 \imagevmodetrue 9560 \vbox\bgroup % vbox has better behavior than vtop herev 9561 \fi\fi 9562 % 9563 \ifimagevmode 9564 \nobreak\medskip 9565 % Usually we'll have text after the image which will insert 9566 % \parskip glue, so insert it here too to equalize the space 9567 % above and below. 9568 \nobreak\vskip\parskip 9569 \nobreak 9570 \fi 9571 % 9572 % Leave vertical mode so that indentation from an enclosing 9573 % environment such as @quotation is respected. 9574 % However, if we're at the top level, we don't want the 9575 % normal paragraph indentation. 9576 % On the other hand, if we are in the case of @center @image, we don't 9577 % want to start a paragraph, which will create a hsize-width box and 9578 % eradicate the centering. 9579 \ifx\centersub\centerV\else \noindent \fi 9580 % 9581 % Output the image. 9582 \ifpdf 9583 % For pdfTeX and LuaTeX <= 0.80 9584 \dopdfimage{#1}{#2}{#3}% 9585 \else 9586 \ifx\XeTeXrevision\thisisundefined 9587 % For epsf.tex 9588 % \epsfbox itself resets \epsf?size at each figure. 9589 \setbox0 = \hbox{\ignorespaces #2}% 9590 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi 9591 \setbox0 = \hbox{\ignorespaces #3}% 9592 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi 9593 \epsfbox{#1.eps}% 9594 \else 9595 % For XeTeX 9596 \doxeteximage{#1}{#2}{#3}% 9597 \fi 9598 \fi 9599 % 9600 \ifimagevmode 9601 \medskip % space after a standalone image 9602 \fi 9603 \ifx\centersub\centerV \egroup \fi 9604\endgroup} 9605 9606 9607% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, 9608% etc. We don't actually implement floating yet, we always include the 9609% float "here". But it seemed the best name for the future. 9610% 9611\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} 9612 9613% There may be a space before second and/or third parameter; delete it. 9614\def\eatcommaspace#1, {#1,} 9615 9616% #1 is the optional FLOATTYPE, the text label for this float, typically 9617% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, 9618% this float will not be numbered and cannot be referred to. 9619% 9620% #2 is the optional xref label. Also must be present for the float to 9621% be referable. 9622% 9623% #3 is the optional positioning argument; for now, it is ignored. It 9624% will somehow specify the positions allowed to float to (here, top, bottom). 9625% 9626% We keep a separate counter for each FLOATTYPE, which we reset at each 9627% chapter-level command. 9628\let\resetallfloatnos=\empty 9629% 9630\def\dofloat#1,#2,#3,#4\finish{% 9631 \let\thiscaption=\empty 9632 \let\thisshortcaption=\empty 9633 % 9634 % don't lose footnotes inside @float. 9635 % 9636 % BEWARE: when the floats start float, we have to issue warning whenever an 9637 % insert appears inside a float which could possibly float. --kasal, 26may04 9638 % 9639 \startsavinginserts 9640 % 9641 % We can't be used inside a paragraph. 9642 \par 9643 % 9644 \vtop\bgroup 9645 \def\floattype{#1}% 9646 \def\floatlabel{#2}% 9647 \def\floatloc{#3}% we do nothing with this yet. 9648 % 9649 \ifx\floattype\empty 9650 \let\safefloattype=\empty 9651 \else 9652 {% 9653 % the floattype might have accents or other special characters, 9654 % but we need to use it in a control sequence name. 9655 \indexnofonts 9656 \turnoffactive 9657 \xdef\safefloattype{\floattype}% 9658 }% 9659 \fi 9660 % 9661 % If label is given but no type, we handle that as the empty type. 9662 \ifx\floatlabel\empty \else 9663 % We want each FLOATTYPE to be numbered separately (Figure 1, 9664 % Table 1, Figure 2, ...). (And if no label, no number.) 9665 % 9666 \expandafter\getfloatno\csname\safefloattype floatno\endcsname 9667 \global\advance\floatno by 1 9668 % 9669 {% 9670 % This magic value for \currentsection is output by \setref as the 9671 % XREFLABEL-title value. \xrefX uses it to distinguish float 9672 % labels (which have a completely different output format) from 9673 % node and anchor labels. And \xrdef uses it to construct the 9674 % lists of floats. 9675 % 9676 \edef\currentsection{\floatmagic=\safefloattype}% 9677 \setref{\floatlabel}{Yfloat}% 9678 }% 9679 \fi 9680 % 9681 % start with \parskip glue, I guess. 9682 \vskip\parskip 9683 % 9684 % Don't suppress indentation if a float happens to start a section. 9685 \restorefirstparagraphindent 9686} 9687 9688% we have these possibilities: 9689% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap 9690% @float Foo,lbl & no caption: Foo 1.1 9691% @float Foo & @caption{Cap}: Foo: Cap 9692% @float Foo & no caption: Foo 9693% @float ,lbl & Caption{Cap}: 1.1: Cap 9694% @float ,lbl & no caption: 1.1 9695% @float & @caption{Cap}: Cap 9696% @float & no caption: 9697% 9698\def\Efloat{% 9699 \let\floatident = \empty 9700 % 9701 % In all cases, if we have a float type, it comes first. 9702 \ifx\floattype\empty \else \def\floatident{\floattype}\fi 9703 % 9704 % If we have an xref label, the number comes next. 9705 \ifx\floatlabel\empty \else 9706 \ifx\floattype\empty \else % if also had float type, need tie first. 9707 \appendtomacro\floatident{\tie}% 9708 \fi 9709 % the number. 9710 \appendtomacro\floatident{\chaplevelprefix\the\floatno}% 9711 \fi 9712 % 9713 % Start the printed caption with what we've constructed in 9714 % \floatident, but keep it separate; we need \floatident again. 9715 \let\captionline = \floatident 9716 % 9717 \ifx\thiscaption\empty \else 9718 \ifx\floatident\empty \else 9719 \appendtomacro\captionline{: }% had ident, so need a colon between 9720 \fi 9721 % 9722 % caption text. 9723 \appendtomacro\captionline{\scanexp\thiscaption}% 9724 \fi 9725 % 9726 % If we have anything to print, print it, with space before. 9727 % Eventually this needs to become an \insert. 9728 \ifx\captionline\empty \else 9729 \vskip.5\parskip 9730 \captionline 9731 % 9732 % Space below caption. 9733 \vskip\parskip 9734 \fi 9735 % 9736 % If have an xref label, write the list of floats info. Do this 9737 % after the caption, to avoid chance of it being a breakpoint. 9738 \ifx\floatlabel\empty \else 9739 % Write the text that goes in the lof to the aux file as 9740 % \floatlabel-lof. Besides \floatident, we include the short 9741 % caption if specified, else the full caption if specified, else nothing. 9742 {% 9743 \requireauxfile 9744 \atdummies 9745 % 9746 \ifx\thisshortcaption\empty 9747 \def\gtemp{\thiscaption}% 9748 \else 9749 \def\gtemp{\thisshortcaption}% 9750 \fi 9751 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident 9752 \ifx\gtemp\empty \else : \gtemp \fi}}% 9753 }% 9754 \fi 9755 \egroup % end of \vtop 9756 % 9757 \checkinserts 9758} 9759 9760% Append the tokens #2 to the definition of macro #1, not expanding either. 9761% 9762\def\appendtomacro#1#2{% 9763 \expandafter\def\expandafter#1\expandafter{#1#2}% 9764} 9765 9766% @caption, @shortcaption 9767% 9768\def\caption{\docaption\thiscaption} 9769\def\shortcaption{\docaption\thisshortcaption} 9770\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} 9771\def\defcaption#1#2{\egroup \def#1{#2}} 9772 9773% The parameter is the control sequence identifying the counter we are 9774% going to use. Create it if it doesn't exist and assign it to \floatno. 9775\def\getfloatno#1{% 9776 \ifx#1\relax 9777 % Haven't seen this figure type before. 9778 \csname newcount\endcsname #1% 9779 % 9780 % Remember to reset this floatno at the next chap. 9781 \expandafter\gdef\expandafter\resetallfloatnos 9782 \expandafter{\resetallfloatnos #1=0 }% 9783 \fi 9784 \let\floatno#1% 9785} 9786 9787% \setref calls this to get the XREFLABEL-snt value. We want an @xref 9788% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we 9789% first read the @float command. 9790% 9791\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% 9792 9793% Magic string used for the XREFLABEL-title value, so \xrefX can 9794% distinguish floats from other xref types. 9795\def\floatmagic{!!float!!} 9796 9797% #1 is the control sequence we are passed; we expand into a conditional 9798% which is true if #1 represents a float ref. That is, the magic 9799% \currentsection value which we \setref above. 9800% 9801\def\iffloat#1{\expandafter\doiffloat#1==\finish} 9802% 9803% #1 is (maybe) the \floatmagic string. If so, #2 will be the 9804% (safe) float type for this float. We set \iffloattype to #2. 9805% 9806\def\doiffloat#1=#2=#3\finish{% 9807 \def\temp{#1}% 9808 \def\iffloattype{#2}% 9809 \ifx\temp\floatmagic 9810} 9811 9812% @listoffloats FLOATTYPE - print a list of floats like a table of contents. 9813% 9814\parseargdef\listoffloats{% 9815 \def\floattype{#1}% floattype 9816 {% 9817 % the floattype might have accents or other special characters, 9818 % but we need to use it in a control sequence name. 9819 \indexnofonts 9820 \turnoffactive 9821 \xdef\safefloattype{\floattype}% 9822 }% 9823 % 9824 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. 9825 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax 9826 \ifhavexrefs 9827 % if the user said @listoffloats foo but never @float foo. 9828 \message{\linenumber No `\safefloattype' floats to list.}% 9829 \fi 9830 \else 9831 \begingroup 9832 \leftskip=\tocindent % indent these entries like a toc 9833 \let\do=\listoffloatsdo 9834 \csname floatlist\safefloattype\endcsname 9835 \endgroup 9836 \fi 9837} 9838 9839% This is called on each entry in a list of floats. We're passed the 9840% xref label, in the form LABEL-title, which is how we save it in the 9841% aux file. We strip off the -title and look up \XRLABEL-lof, which 9842% has the text we're supposed to typeset here. 9843% 9844% Figures without xref labels will not be included in the list (since 9845% they won't appear in the aux file). 9846% 9847\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} 9848\def\listoffloatsdoentry#1-title\finish{{% 9849 % Can't fully expand XR#1-lof because it can contain anything. Just 9850 % pass the control sequence. On the other hand, XR#1-pg is just the 9851 % page number, and we want to fully expand that so we can get a link 9852 % in pdf output. 9853 \toksA = \expandafter{\csname XR#1-lof\endcsname}% 9854 % 9855 % use the same \entry macro we use to generate the TOC and index. 9856 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% 9857 \writeentry 9858}} 9859 9860 9861\message{localization,} 9862 9863% For single-language documents, @documentlanguage is usually given very 9864% early, just after @documentencoding. Single argument is the language 9865% (de) or locale (de_DE) abbreviation. 9866% 9867{ 9868 \catcode`\_ = \active 9869 \globaldefs=1 9870\parseargdef\documentlanguage{% 9871 \tex % read txi-??.tex file in plain TeX. 9872 % Read the file by the name they passed if it exists. 9873 \let_ = \normalunderscore % normal _ character for filename test 9874 \openin 1 txi-#1.tex 9875 \ifeof 1 9876 \documentlanguagetrywithoutunderscore #1_\finish 9877 \else 9878 \globaldefs = 1 % everything in the txi-LL files needs to persist 9879 \input txi-#1.tex 9880 \fi 9881 \closein 1 9882 \endgroup % end raw TeX 9883} 9884% 9885% If they passed de_DE, and txi-de_DE.tex doesn't exist, 9886% try txi-de.tex. 9887% 9888\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% 9889 \openin 1 txi-#1.tex 9890 \ifeof 1 9891 \errhelp = \nolanghelp 9892 \errmessage{Cannot read language file txi-#1.tex}% 9893 \else 9894 \globaldefs = 1 % everything in the txi-LL files needs to persist 9895 \input txi-#1.tex 9896 \fi 9897 \closein 1 9898} 9899}% end of special _ catcode 9900% 9901\newhelp\nolanghelp{The given language definition file cannot be found or 9902is empty. Maybe you need to install it? Putting it in the current 9903directory should work if nowhere else does.} 9904 9905% This macro is called from txi-??.tex files; the first argument is the 9906% \language name to set (without the "\lang@" prefix), the second and 9907% third args are \{left,right}hyphenmin. 9908% 9909% The language names to pass are determined when the format is built. 9910% See the etex.log file created at that time, e.g., 9911% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. 9912% 9913% With TeX Live 2008, etex now includes hyphenation patterns for all 9914% available languages. This means we can support hyphenation in 9915% Texinfo, at least to some extent. (This still doesn't solve the 9916% accented characters problem.) 9917% 9918\catcode`@=11 9919\def\txisetlanguage#1#2#3{% 9920 % do not set the language if the name is undefined in the current TeX. 9921 \expandafter\ifx\csname lang@#1\endcsname \relax 9922 \message{no patterns for #1}% 9923 \else 9924 \global\language = \csname lang@#1\endcsname 9925 \fi 9926 % but there is no harm in adjusting the hyphenmin values regardless. 9927 \global\lefthyphenmin = #2\relax 9928 \global\righthyphenmin = #3\relax 9929} 9930 9931% XeTeX and LuaTeX can handle Unicode natively. 9932% Their default I/O uses UTF-8 sequences instead of a byte-wise operation. 9933% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise. 9934% 9935\newif\iftxinativeunicodecapable 9936\newif\iftxiusebytewiseio 9937 9938\ifx\XeTeXrevision\thisisundefined 9939 \ifx\luatexversion\thisisundefined 9940 \txinativeunicodecapablefalse 9941 \txiusebytewiseiotrue 9942 \else 9943 \txinativeunicodecapabletrue 9944 \txiusebytewiseiofalse 9945 \fi 9946\else 9947 \txinativeunicodecapabletrue 9948 \txiusebytewiseiofalse 9949\fi 9950 9951% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex 9952% for non-UTF-8 (byte-wise) encodings. 9953% 9954\def\setbytewiseio{% 9955 \ifx\XeTeXrevision\thisisundefined 9956 \else 9957 \XeTeXdefaultencoding "bytes" % For subsequent files to be read 9958 \XeTeXinputencoding "bytes" % For document root file 9959 % Unfortunately, there seems to be no corresponding XeTeX command for 9960 % output encoding. This is a problem for auxiliary index and TOC files. 9961 % The only solution would be perhaps to write out @U{...} sequences in 9962 % place of non-ASCII characters. 9963 \fi 9964 9965 \ifx\luatexversion\thisisundefined 9966 \else 9967 \directlua{ 9968 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub 9969 local function convert_char (char) 9970 return utf8_char(byte(char)) 9971 end 9972 9973 local function convert_line (line) 9974 return gsub(line, ".", convert_char) 9975 end 9976 9977 callback.register("process_input_buffer", convert_line) 9978 9979 local function convert_line_out (line) 9980 local line_out = "" 9981 for c in string.utfvalues(line) do 9982 line_out = line_out .. string.char(c) 9983 end 9984 return line_out 9985 end 9986 9987 callback.register("process_output_buffer", convert_line_out) 9988 } 9989 \fi 9990 9991 \txiusebytewiseiotrue 9992} 9993 9994 9995% Helpers for encodings. 9996% Set the catcode of characters 128 through 255 to the specified number. 9997% 9998\def\setnonasciicharscatcode#1{% 9999 \count255=128 10000 \loop\ifnum\count255<256 10001 \global\catcode\count255=#1\relax 10002 \advance\count255 by 1 10003 \repeat 10004} 10005 10006\def\setnonasciicharscatcodenonglobal#1{% 10007 \count255=128 10008 \loop\ifnum\count255<256 10009 \catcode\count255=#1\relax 10010 \advance\count255 by 1 10011 \repeat 10012} 10013 10014% @documentencoding sets the definition of non-ASCII characters 10015% according to the specified encoding. 10016% 10017\def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz} 10018\def\documentencodingzzz#1{% 10019 % 10020 % Encoding being declared for the document. 10021 \def\declaredencoding{\csname #1.enc\endcsname}% 10022 % 10023 % Supported encodings: names converted to tokens in order to be able 10024 % to compare them with \ifx. 10025 \def\ascii{\csname US-ASCII.enc\endcsname}% 10026 \def\latnine{\csname ISO-8859-15.enc\endcsname}% 10027 \def\latone{\csname ISO-8859-1.enc\endcsname}% 10028 \def\lattwo{\csname ISO-8859-2.enc\endcsname}% 10029 \def\utfeight{\csname UTF-8.enc\endcsname}% 10030 % 10031 \ifx \declaredencoding \ascii 10032 \asciichardefs 10033 % 10034 \else \ifx \declaredencoding \lattwo 10035 \iftxinativeunicodecapable 10036 \setbytewiseio 10037 \fi 10038 \setnonasciicharscatcode\active 10039 \lattwochardefs 10040 % 10041 \else \ifx \declaredencoding \latone 10042 \iftxinativeunicodecapable 10043 \setbytewiseio 10044 \fi 10045 \setnonasciicharscatcode\active 10046 \latonechardefs 10047 % 10048 \else \ifx \declaredencoding \latnine 10049 \iftxinativeunicodecapable 10050 \setbytewiseio 10051 \fi 10052 \setnonasciicharscatcode\active 10053 \latninechardefs 10054 % 10055 \else \ifx \declaredencoding \utfeight 10056 \iftxinativeunicodecapable 10057 % For native Unicode handling (XeTeX and LuaTeX) 10058 \nativeunicodechardefs 10059 \else 10060 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX) 10061 \setnonasciicharscatcode\active 10062 % since we already invoked \utfeightchardefs at the top level 10063 % (below), do not re-invoke it, otherwise our check for duplicated 10064 % definitions gets triggered. Making non-ascii chars active is 10065 % sufficient. 10066 \fi 10067 % 10068 \else 10069 \message{Ignoring unknown document encoding: #1.}% 10070 % 10071 \fi % utfeight 10072 \fi % latnine 10073 \fi % latone 10074 \fi % lattwo 10075 \fi % ascii 10076 % 10077 \ifx\XeTeXrevision\thisisundefined 10078 \else 10079 \ifx \declaredencoding \utfeight 10080 \else 10081 \ifx \declaredencoding \ascii 10082 \else 10083 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle % 10084 non-ASCII characters in auxiliary files.}% 10085 \fi 10086 \fi 10087 \fi 10088} 10089 10090% emacs-page 10091% A message to be logged when using a character that isn't available 10092% the default font encoding (OT1). 10093% 10094\def\missingcharmsg#1{\message{Character missing, sorry: #1.}} 10095 10096% Take account of \c (plain) vs. \, (Texinfo) difference. 10097\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} 10098 10099% First, make active non-ASCII characters in order for them to be 10100% correctly categorized when TeX reads the replacement text of 10101% macros containing the character definitions. 10102\setnonasciicharscatcode\active 10103% 10104 10105\def\gdefchar#1#2{% 10106\gdef#1{% 10107 \ifpassthroughchars 10108 \string#1% 10109 \else 10110 #2% 10111 \fi 10112}} 10113 10114% Latin1 (ISO-8859-1) character definitions. 10115\def\latonechardefs{% 10116 \gdefchar^^a0{\tie} 10117 \gdefchar^^a1{\exclamdown} 10118 \gdefchar^^a2{{\tcfont \char162}} % cent 10119 \gdefchar^^a3{\pounds{}} 10120 \gdefchar^^a4{{\tcfont \char164}} % currency 10121 \gdefchar^^a5{{\tcfont \char165}} % yen 10122 \gdefchar^^a6{{\tcfont \char166}} % broken bar 10123 \gdefchar^^a7{\S} 10124 \gdefchar^^a8{\"{}} 10125 \gdefchar^^a9{\copyright{}} 10126 \gdefchar^^aa{\ordf} 10127 \gdefchar^^ab{\guillemetleft{}} 10128 \gdefchar^^ac{\ensuremath\lnot} 10129 \gdefchar^^ad{\-} 10130 \gdefchar^^ae{\registeredsymbol{}} 10131 \gdefchar^^af{\={}} 10132 % 10133 \gdefchar^^b0{\textdegree} 10134 \gdefchar^^b1{$\pm$} 10135 \gdefchar^^b2{$^2$} 10136 \gdefchar^^b3{$^3$} 10137 \gdefchar^^b4{\'{}} 10138 \gdefchar^^b5{$\mu$} 10139 \gdefchar^^b6{\P} 10140 \gdefchar^^b7{\ensuremath\cdot} 10141 \gdefchar^^b8{\cedilla\ } 10142 \gdefchar^^b9{$^1$} 10143 \gdefchar^^ba{\ordm} 10144 \gdefchar^^bb{\guillemetright{}} 10145 \gdefchar^^bc{$1\over4$} 10146 \gdefchar^^bd{$1\over2$} 10147 \gdefchar^^be{$3\over4$} 10148 \gdefchar^^bf{\questiondown} 10149 % 10150 \gdefchar^^c0{\`A} 10151 \gdefchar^^c1{\'A} 10152 \gdefchar^^c2{\^A} 10153 \gdefchar^^c3{\~A} 10154 \gdefchar^^c4{\"A} 10155 \gdefchar^^c5{\ringaccent A} 10156 \gdefchar^^c6{\AE} 10157 \gdefchar^^c7{\cedilla C} 10158 \gdefchar^^c8{\`E} 10159 \gdefchar^^c9{\'E} 10160 \gdefchar^^ca{\^E} 10161 \gdefchar^^cb{\"E} 10162 \gdefchar^^cc{\`I} 10163 \gdefchar^^cd{\'I} 10164 \gdefchar^^ce{\^I} 10165 \gdefchar^^cf{\"I} 10166 % 10167 \gdefchar^^d0{\DH} 10168 \gdefchar^^d1{\~N} 10169 \gdefchar^^d2{\`O} 10170 \gdefchar^^d3{\'O} 10171 \gdefchar^^d4{\^O} 10172 \gdefchar^^d5{\~O} 10173 \gdefchar^^d6{\"O} 10174 \gdefchar^^d7{$\times$} 10175 \gdefchar^^d8{\O} 10176 \gdefchar^^d9{\`U} 10177 \gdefchar^^da{\'U} 10178 \gdefchar^^db{\^U} 10179 \gdefchar^^dc{\"U} 10180 \gdefchar^^dd{\'Y} 10181 \gdefchar^^de{\TH} 10182 \gdefchar^^df{\ss} 10183 % 10184 \gdefchar^^e0{\`a} 10185 \gdefchar^^e1{\'a} 10186 \gdefchar^^e2{\^a} 10187 \gdefchar^^e3{\~a} 10188 \gdefchar^^e4{\"a} 10189 \gdefchar^^e5{\ringaccent a} 10190 \gdefchar^^e6{\ae} 10191 \gdefchar^^e7{\cedilla c} 10192 \gdefchar^^e8{\`e} 10193 \gdefchar^^e9{\'e} 10194 \gdefchar^^ea{\^e} 10195 \gdefchar^^eb{\"e} 10196 \gdefchar^^ec{\`{\dotless i}} 10197 \gdefchar^^ed{\'{\dotless i}} 10198 \gdefchar^^ee{\^{\dotless i}} 10199 \gdefchar^^ef{\"{\dotless i}} 10200 % 10201 \gdefchar^^f0{\dh} 10202 \gdefchar^^f1{\~n} 10203 \gdefchar^^f2{\`o} 10204 \gdefchar^^f3{\'o} 10205 \gdefchar^^f4{\^o} 10206 \gdefchar^^f5{\~o} 10207 \gdefchar^^f6{\"o} 10208 \gdefchar^^f7{$\div$} 10209 \gdefchar^^f8{\o} 10210 \gdefchar^^f9{\`u} 10211 \gdefchar^^fa{\'u} 10212 \gdefchar^^fb{\^u} 10213 \gdefchar^^fc{\"u} 10214 \gdefchar^^fd{\'y} 10215 \gdefchar^^fe{\th} 10216 \gdefchar^^ff{\"y} 10217} 10218 10219% Latin9 (ISO-8859-15) encoding character definitions. 10220\def\latninechardefs{% 10221 % Encoding is almost identical to Latin1. 10222 \latonechardefs 10223 % 10224 \gdefchar^^a4{\euro{}} 10225 \gdefchar^^a6{\v S} 10226 \gdefchar^^a8{\v s} 10227 \gdefchar^^b4{\v Z} 10228 \gdefchar^^b8{\v z} 10229 \gdefchar^^bc{\OE} 10230 \gdefchar^^bd{\oe} 10231 \gdefchar^^be{\"Y} 10232} 10233 10234% Latin2 (ISO-8859-2) character definitions. 10235\def\lattwochardefs{% 10236 \gdefchar^^a0{\tie} 10237 \gdefchar^^a1{\ogonek{A}} 10238 \gdefchar^^a2{\u{}} 10239 \gdefchar^^a3{\L} 10240 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}} 10241 \gdefchar^^a5{\v L} 10242 \gdefchar^^a6{\'S} 10243 \gdefchar^^a7{\S} 10244 \gdefchar^^a8{\"{}} 10245 \gdefchar^^a9{\v S} 10246 \gdefchar^^aa{\cedilla S} 10247 \gdefchar^^ab{\v T} 10248 \gdefchar^^ac{\'Z} 10249 \gdefchar^^ad{\-} 10250 \gdefchar^^ae{\v Z} 10251 \gdefchar^^af{\dotaccent Z} 10252 % 10253 \gdefchar^^b0{\textdegree{}} 10254 \gdefchar^^b1{\ogonek{a}} 10255 \gdefchar^^b2{\ogonek{ }} 10256 \gdefchar^^b3{\l} 10257 \gdefchar^^b4{\'{}} 10258 \gdefchar^^b5{\v l} 10259 \gdefchar^^b6{\'s} 10260 \gdefchar^^b7{\v{}} 10261 \gdefchar^^b8{\cedilla\ } 10262 \gdefchar^^b9{\v s} 10263 \gdefchar^^ba{\cedilla s} 10264 \gdefchar^^bb{\v t} 10265 \gdefchar^^bc{\'z} 10266 \gdefchar^^bd{\H{}} 10267 \gdefchar^^be{\v z} 10268 \gdefchar^^bf{\dotaccent z} 10269 % 10270 \gdefchar^^c0{\'R} 10271 \gdefchar^^c1{\'A} 10272 \gdefchar^^c2{\^A} 10273 \gdefchar^^c3{\u A} 10274 \gdefchar^^c4{\"A} 10275 \gdefchar^^c5{\'L} 10276 \gdefchar^^c6{\'C} 10277 \gdefchar^^c7{\cedilla C} 10278 \gdefchar^^c8{\v C} 10279 \gdefchar^^c9{\'E} 10280 \gdefchar^^ca{\ogonek{E}} 10281 \gdefchar^^cb{\"E} 10282 \gdefchar^^cc{\v E} 10283 \gdefchar^^cd{\'I} 10284 \gdefchar^^ce{\^I} 10285 \gdefchar^^cf{\v D} 10286 % 10287 \gdefchar^^d0{\DH} 10288 \gdefchar^^d1{\'N} 10289 \gdefchar^^d2{\v N} 10290 \gdefchar^^d3{\'O} 10291 \gdefchar^^d4{\^O} 10292 \gdefchar^^d5{\H O} 10293 \gdefchar^^d6{\"O} 10294 \gdefchar^^d7{$\times$} 10295 \gdefchar^^d8{\v R} 10296 \gdefchar^^d9{\ringaccent U} 10297 \gdefchar^^da{\'U} 10298 \gdefchar^^db{\H U} 10299 \gdefchar^^dc{\"U} 10300 \gdefchar^^dd{\'Y} 10301 \gdefchar^^de{\cedilla T} 10302 \gdefchar^^df{\ss} 10303 % 10304 \gdefchar^^e0{\'r} 10305 \gdefchar^^e1{\'a} 10306 \gdefchar^^e2{\^a} 10307 \gdefchar^^e3{\u a} 10308 \gdefchar^^e4{\"a} 10309 \gdefchar^^e5{\'l} 10310 \gdefchar^^e6{\'c} 10311 \gdefchar^^e7{\cedilla c} 10312 \gdefchar^^e8{\v c} 10313 \gdefchar^^e9{\'e} 10314 \gdefchar^^ea{\ogonek{e}} 10315 \gdefchar^^eb{\"e} 10316 \gdefchar^^ec{\v e} 10317 \gdefchar^^ed{\'{\dotless{i}}} 10318 \gdefchar^^ee{\^{\dotless{i}}} 10319 \gdefchar^^ef{\v d} 10320 % 10321 \gdefchar^^f0{\dh} 10322 \gdefchar^^f1{\'n} 10323 \gdefchar^^f2{\v n} 10324 \gdefchar^^f3{\'o} 10325 \gdefchar^^f4{\^o} 10326 \gdefchar^^f5{\H o} 10327 \gdefchar^^f6{\"o} 10328 \gdefchar^^f7{$\div$} 10329 \gdefchar^^f8{\v r} 10330 \gdefchar^^f9{\ringaccent u} 10331 \gdefchar^^fa{\'u} 10332 \gdefchar^^fb{\H u} 10333 \gdefchar^^fc{\"u} 10334 \gdefchar^^fd{\'y} 10335 \gdefchar^^fe{\cedilla t} 10336 \gdefchar^^ff{\dotaccent{}} 10337} 10338 10339% UTF-8 character definitions. 10340% 10341% This code to support UTF-8 is based on LaTeX's utf8.def, with some 10342% changes for Texinfo conventions. It is included here under the GPL by 10343% permission from Frank Mittelbach and the LaTeX team. 10344% 10345\newcount\countUTFx 10346\newcount\countUTFy 10347\newcount\countUTFz 10348 10349\gdef\UTFviiiTwoOctets#1#2{\expandafter 10350 \UTFviiiDefined\csname u8:#1\string #2\endcsname} 10351% 10352\gdef\UTFviiiThreeOctets#1#2#3{\expandafter 10353 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} 10354% 10355\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter 10356 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} 10357 10358\gdef\UTFviiiDefined#1{% 10359 \ifx #1\relax 10360 \message{\linenumber Unicode char \string #1 not defined for Texinfo}% 10361 \else 10362 \expandafter #1% 10363 \fi 10364} 10365 10366% Give non-ASCII bytes the active definitions for processing UTF-8 sequences 10367\begingroup 10368 \catcode`\~13 10369 \catcode`\$12 10370 \catcode`\"12 10371 10372 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp 10373 % substituting ~ and $ with a character token of that value. 10374 \def\UTFviiiLoop{% 10375 \global\catcode\countUTFx\active 10376 \uccode`\~\countUTFx 10377 \uccode`\$\countUTFx 10378 \uppercase\expandafter{\UTFviiiTmp}% 10379 \advance\countUTFx by 1 10380 \ifnum\countUTFx < \countUTFy 10381 \expandafter\UTFviiiLoop 10382 \fi} 10383 10384 % For bytes other than the first in a UTF-8 sequence. Not expected to 10385 % be expanded except when writing to auxiliary files. 10386 \countUTFx = "80 10387 \countUTFy = "C2 10388 \def\UTFviiiTmp{% 10389 \gdef~{% 10390 \ifpassthroughchars $\fi}}% 10391 \UTFviiiLoop 10392 10393 \countUTFx = "C2 10394 \countUTFy = "E0 10395 \def\UTFviiiTmp{% 10396 \gdef~{% 10397 \ifpassthroughchars $% 10398 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}% 10399 \UTFviiiLoop 10400 10401 \countUTFx = "E0 10402 \countUTFy = "F0 10403 \def\UTFviiiTmp{% 10404 \gdef~{% 10405 \ifpassthroughchars $% 10406 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}% 10407 \UTFviiiLoop 10408 10409 \countUTFx = "F0 10410 \countUTFy = "F4 10411 \def\UTFviiiTmp{% 10412 \gdef~{% 10413 \ifpassthroughchars $% 10414 \else\expandafter\UTFviiiFourOctets\expandafter$\fi 10415 }}% 10416 \UTFviiiLoop 10417\endgroup 10418 10419\def\globallet{\global\let} % save some \expandafter's below 10420 10421% @U{xxxx} to produce U+xxxx, if we support it. 10422\def\U#1{% 10423 \expandafter\ifx\csname uni:#1\endcsname \relax 10424 \iftxinativeunicodecapable 10425 % All Unicode characters can be used if native Unicode handling is 10426 % active. However, if the font does not have the glyph, 10427 % letters are missing. 10428 \begingroup 10429 \uccode`\.="#1\relax 10430 \uppercase{.} 10431 \endgroup 10432 \else 10433 \errhelp = \EMsimple 10434 \errmessage{Unicode character U+#1 not supported, sorry}% 10435 \fi 10436 \else 10437 \csname uni:#1\endcsname 10438 \fi 10439} 10440 10441% These macros are used here to construct the name of a control 10442% sequence to be defined. 10443\def\UTFviiiTwoOctetsName#1#2{% 10444 \csname u8:#1\string #2\endcsname}% 10445\def\UTFviiiThreeOctetsName#1#2#3{% 10446 \csname u8:#1\string #2\string #3\endcsname}% 10447\def\UTFviiiFourOctetsName#1#2#3#4{% 10448 \csname u8:#1\string #2\string #3\string #4\endcsname}% 10449 10450% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX), 10451% provide a definition macro to replace a Unicode character; 10452% this gets used by the @U command 10453% 10454\begingroup 10455 \catcode`\"=12 10456 \catcode`\<=12 10457 \catcode`\.=12 10458 \catcode`\,=12 10459 \catcode`\;=12 10460 \catcode`\!=12 10461 \catcode`\~=13 10462 \gdef\DeclareUnicodeCharacterUTFviii#1#2{% 10463 \countUTFz = "#1\relax 10464 \begingroup 10465 \parseXMLCharref 10466 10467 % Give \u8:... its definition. The sequence of seven \expandafter's 10468 % expands after the \gdef three times, e.g. 10469 % 10470 % 1. \UTFviiTwoOctetsName B1 B2 10471 % 2. \csname u8:B1 \string B2 \endcsname 10472 % 3. \u8: B1 B2 (a single control sequence token) 10473 % 10474 \expandafter\expandafter 10475 \expandafter\expandafter 10476 \expandafter\expandafter 10477 \expandafter\gdef \UTFviiiTmp{#2}% 10478 % 10479 \expandafter\ifx\csname uni:#1\endcsname \relax \else 10480 \message{Internal error, already defined: #1}% 10481 \fi 10482 % 10483 % define an additional control sequence for this code point. 10484 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp 10485 \endgroup} 10486 % 10487 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp 10488 % to the corresponding UTF-8 sequence. 10489 \gdef\parseXMLCharref{% 10490 \ifnum\countUTFz < "A0\relax 10491 \errhelp = \EMsimple 10492 \errmessage{Cannot define Unicode char value < 00A0}% 10493 \else\ifnum\countUTFz < "800\relax 10494 \parseUTFviiiA,% 10495 \parseUTFviiiB C\UTFviiiTwoOctetsName.,% 10496 \else\ifnum\countUTFz < "10000\relax 10497 \parseUTFviiiA;% 10498 \parseUTFviiiA,% 10499 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}% 10500 \else 10501 \parseUTFviiiA;% 10502 \parseUTFviiiA,% 10503 \parseUTFviiiA!% 10504 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}% 10505 \fi\fi\fi 10506 } 10507 10508 % Extract a byte from the end of the UTF-8 representation of \countUTFx. 10509 % It must be a non-initial byte in the sequence. 10510 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one 10511 % of the bytes. 10512 \gdef\parseUTFviiiA#1{% 10513 \countUTFx = \countUTFz 10514 \divide\countUTFz by 64 10515 \countUTFy = \countUTFz % Save to be the future value of \countUTFz. 10516 \multiply\countUTFz by 64 10517 10518 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract 10519 % in order to get the last five bits. 10520 \advance\countUTFx by -\countUTFz 10521 10522 % Convert this to the byte in the UTF-8 sequence. 10523 \advance\countUTFx by 128 10524 \uccode `#1\countUTFx 10525 \countUTFz = \countUTFy} 10526 10527 % Used to put a UTF-8 byte sequence into \UTFviiiTmp 10528 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8 10529 % sequence. 10530 % #2 is one of the \UTFviii*OctetsName macros. 10531 % #3 is always a full stop (.) 10532 % #4 is a template for the other bytes in the sequence. The values for these 10533 % bytes is substituted in here with \uppercase using the \uccode's. 10534 \gdef\parseUTFviiiB#1#2#3#4{% 10535 \advance\countUTFz by "#10\relax 10536 \uccode `#3\countUTFz 10537 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} 10538\endgroup 10539 10540% For native Unicode handling (XeTeX and LuaTeX), 10541% provide a definition macro that sets a catcode to `other' non-globally 10542% 10543\def\DeclareUnicodeCharacterNativeOther#1#2{% 10544 \catcode"#1=\other 10545} 10546 10547% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M 10548% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block) 10549% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block) 10550% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A 10551% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B 10552% 10553% Many of our renditions are less than wonderful, and all the missing 10554% characters are available somewhere. Loading the necessary fonts 10555% awaits user request. We can't truly support Unicode without 10556% reimplementing everything that's been done in LaTeX for many years, 10557% plus probably using luatex or xetex, and who knows what else. 10558% We won't be doing that here in this simple file. But we can try to at 10559% least make most of the characters not bomb out. 10560% 10561\def\unicodechardefs{% 10562 \DeclareUnicodeCharacter{00A0}{\tie}% 10563 \DeclareUnicodeCharacter{00A1}{\exclamdown}% 10564 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent 10565 \DeclareUnicodeCharacter{00A3}{\pounds{}}% 10566 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency 10567 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen 10568 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar 10569 \DeclareUnicodeCharacter{00A7}{\S}% 10570 \DeclareUnicodeCharacter{00A8}{\"{ }}% 10571 \DeclareUnicodeCharacter{00A9}{\copyright{}}% 10572 \DeclareUnicodeCharacter{00AA}{\ordf}% 10573 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}% 10574 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}% 10575 \DeclareUnicodeCharacter{00AD}{\-}% 10576 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}% 10577 \DeclareUnicodeCharacter{00AF}{\={ }}% 10578 % 10579 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}% 10580 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}% 10581 \DeclareUnicodeCharacter{00B2}{$^2$}% 10582 \DeclareUnicodeCharacter{00B3}{$^3$}% 10583 \DeclareUnicodeCharacter{00B4}{\'{ }}% 10584 \DeclareUnicodeCharacter{00B5}{$\mu$}% 10585 \DeclareUnicodeCharacter{00B6}{\P}% 10586 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}% 10587 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}% 10588 \DeclareUnicodeCharacter{00B9}{$^1$}% 10589 \DeclareUnicodeCharacter{00BA}{\ordm}% 10590 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}% 10591 \DeclareUnicodeCharacter{00BC}{$1\over4$}% 10592 \DeclareUnicodeCharacter{00BD}{$1\over2$}% 10593 \DeclareUnicodeCharacter{00BE}{$3\over4$}% 10594 \DeclareUnicodeCharacter{00BF}{\questiondown}% 10595 % 10596 \DeclareUnicodeCharacter{00C0}{\`A}% 10597 \DeclareUnicodeCharacter{00C1}{\'A}% 10598 \DeclareUnicodeCharacter{00C2}{\^A}% 10599 \DeclareUnicodeCharacter{00C3}{\~A}% 10600 \DeclareUnicodeCharacter{00C4}{\"A}% 10601 \DeclareUnicodeCharacter{00C5}{\AA}% 10602 \DeclareUnicodeCharacter{00C6}{\AE}% 10603 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}% 10604 \DeclareUnicodeCharacter{00C8}{\`E}% 10605 \DeclareUnicodeCharacter{00C9}{\'E}% 10606 \DeclareUnicodeCharacter{00CA}{\^E}% 10607 \DeclareUnicodeCharacter{00CB}{\"E}% 10608 \DeclareUnicodeCharacter{00CC}{\`I}% 10609 \DeclareUnicodeCharacter{00CD}{\'I}% 10610 \DeclareUnicodeCharacter{00CE}{\^I}% 10611 \DeclareUnicodeCharacter{00CF}{\"I}% 10612 % 10613 \DeclareUnicodeCharacter{00D0}{\DH}% 10614 \DeclareUnicodeCharacter{00D1}{\~N}% 10615 \DeclareUnicodeCharacter{00D2}{\`O}% 10616 \DeclareUnicodeCharacter{00D3}{\'O}% 10617 \DeclareUnicodeCharacter{00D4}{\^O}% 10618 \DeclareUnicodeCharacter{00D5}{\~O}% 10619 \DeclareUnicodeCharacter{00D6}{\"O}% 10620 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}% 10621 \DeclareUnicodeCharacter{00D8}{\O}% 10622 \DeclareUnicodeCharacter{00D9}{\`U}% 10623 \DeclareUnicodeCharacter{00DA}{\'U}% 10624 \DeclareUnicodeCharacter{00DB}{\^U}% 10625 \DeclareUnicodeCharacter{00DC}{\"U}% 10626 \DeclareUnicodeCharacter{00DD}{\'Y}% 10627 \DeclareUnicodeCharacter{00DE}{\TH}% 10628 \DeclareUnicodeCharacter{00DF}{\ss}% 10629 % 10630 \DeclareUnicodeCharacter{00E0}{\`a}% 10631 \DeclareUnicodeCharacter{00E1}{\'a}% 10632 \DeclareUnicodeCharacter{00E2}{\^a}% 10633 \DeclareUnicodeCharacter{00E3}{\~a}% 10634 \DeclareUnicodeCharacter{00E4}{\"a}% 10635 \DeclareUnicodeCharacter{00E5}{\aa}% 10636 \DeclareUnicodeCharacter{00E6}{\ae}% 10637 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}% 10638 \DeclareUnicodeCharacter{00E8}{\`e}% 10639 \DeclareUnicodeCharacter{00E9}{\'e}% 10640 \DeclareUnicodeCharacter{00EA}{\^e}% 10641 \DeclareUnicodeCharacter{00EB}{\"e}% 10642 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}% 10643 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}% 10644 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}% 10645 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}% 10646 % 10647 \DeclareUnicodeCharacter{00F0}{\dh}% 10648 \DeclareUnicodeCharacter{00F1}{\~n}% 10649 \DeclareUnicodeCharacter{00F2}{\`o}% 10650 \DeclareUnicodeCharacter{00F3}{\'o}% 10651 \DeclareUnicodeCharacter{00F4}{\^o}% 10652 \DeclareUnicodeCharacter{00F5}{\~o}% 10653 \DeclareUnicodeCharacter{00F6}{\"o}% 10654 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}% 10655 \DeclareUnicodeCharacter{00F8}{\o}% 10656 \DeclareUnicodeCharacter{00F9}{\`u}% 10657 \DeclareUnicodeCharacter{00FA}{\'u}% 10658 \DeclareUnicodeCharacter{00FB}{\^u}% 10659 \DeclareUnicodeCharacter{00FC}{\"u}% 10660 \DeclareUnicodeCharacter{00FD}{\'y}% 10661 \DeclareUnicodeCharacter{00FE}{\th}% 10662 \DeclareUnicodeCharacter{00FF}{\"y}% 10663 % 10664 \DeclareUnicodeCharacter{0100}{\=A}% 10665 \DeclareUnicodeCharacter{0101}{\=a}% 10666 \DeclareUnicodeCharacter{0102}{\u{A}}% 10667 \DeclareUnicodeCharacter{0103}{\u{a}}% 10668 \DeclareUnicodeCharacter{0104}{\ogonek{A}}% 10669 \DeclareUnicodeCharacter{0105}{\ogonek{a}}% 10670 \DeclareUnicodeCharacter{0106}{\'C}% 10671 \DeclareUnicodeCharacter{0107}{\'c}% 10672 \DeclareUnicodeCharacter{0108}{\^C}% 10673 \DeclareUnicodeCharacter{0109}{\^c}% 10674 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}% 10675 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}% 10676 \DeclareUnicodeCharacter{010C}{\v{C}}% 10677 \DeclareUnicodeCharacter{010D}{\v{c}}% 10678 \DeclareUnicodeCharacter{010E}{\v{D}}% 10679 \DeclareUnicodeCharacter{010F}{d'}% 10680 % 10681 \DeclareUnicodeCharacter{0110}{\DH}% 10682 \DeclareUnicodeCharacter{0111}{\dh}% 10683 \DeclareUnicodeCharacter{0112}{\=E}% 10684 \DeclareUnicodeCharacter{0113}{\=e}% 10685 \DeclareUnicodeCharacter{0114}{\u{E}}% 10686 \DeclareUnicodeCharacter{0115}{\u{e}}% 10687 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}% 10688 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}% 10689 \DeclareUnicodeCharacter{0118}{\ogonek{E}}% 10690 \DeclareUnicodeCharacter{0119}{\ogonek{e}}% 10691 \DeclareUnicodeCharacter{011A}{\v{E}}% 10692 \DeclareUnicodeCharacter{011B}{\v{e}}% 10693 \DeclareUnicodeCharacter{011C}{\^G}% 10694 \DeclareUnicodeCharacter{011D}{\^g}% 10695 \DeclareUnicodeCharacter{011E}{\u{G}}% 10696 \DeclareUnicodeCharacter{011F}{\u{g}}% 10697 % 10698 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}% 10699 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}% 10700 \DeclareUnicodeCharacter{0122}{\cedilla{G}}% 10701 \DeclareUnicodeCharacter{0123}{\cedilla{g}}% 10702 \DeclareUnicodeCharacter{0124}{\^H}% 10703 \DeclareUnicodeCharacter{0125}{\^h}% 10704 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}% 10705 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}% 10706 \DeclareUnicodeCharacter{0128}{\~I}% 10707 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}% 10708 \DeclareUnicodeCharacter{012A}{\=I}% 10709 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}% 10710 \DeclareUnicodeCharacter{012C}{\u{I}}% 10711 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}% 10712 \DeclareUnicodeCharacter{012E}{\ogonek{I}}% 10713 \DeclareUnicodeCharacter{012F}{\ogonek{i}}% 10714 % 10715 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}% 10716 \DeclareUnicodeCharacter{0131}{\dotless{i}}% 10717 \DeclareUnicodeCharacter{0132}{IJ}% 10718 \DeclareUnicodeCharacter{0133}{ij}% 10719 \DeclareUnicodeCharacter{0134}{\^J}% 10720 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}% 10721 \DeclareUnicodeCharacter{0136}{\cedilla{K}}% 10722 \DeclareUnicodeCharacter{0137}{\cedilla{k}}% 10723 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}% 10724 \DeclareUnicodeCharacter{0139}{\'L}% 10725 \DeclareUnicodeCharacter{013A}{\'l}% 10726 \DeclareUnicodeCharacter{013B}{\cedilla{L}}% 10727 \DeclareUnicodeCharacter{013C}{\cedilla{l}}% 10728 \DeclareUnicodeCharacter{013D}{L'}% should kern 10729 \DeclareUnicodeCharacter{013E}{l'}% should kern 10730 \DeclareUnicodeCharacter{013F}{L\U{00B7}}% 10731 % 10732 \DeclareUnicodeCharacter{0140}{l\U{00B7}}% 10733 \DeclareUnicodeCharacter{0141}{\L}% 10734 \DeclareUnicodeCharacter{0142}{\l}% 10735 \DeclareUnicodeCharacter{0143}{\'N}% 10736 \DeclareUnicodeCharacter{0144}{\'n}% 10737 \DeclareUnicodeCharacter{0145}{\cedilla{N}}% 10738 \DeclareUnicodeCharacter{0146}{\cedilla{n}}% 10739 \DeclareUnicodeCharacter{0147}{\v{N}}% 10740 \DeclareUnicodeCharacter{0148}{\v{n}}% 10741 \DeclareUnicodeCharacter{0149}{'n}% 10742 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}% 10743 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}% 10744 \DeclareUnicodeCharacter{014C}{\=O}% 10745 \DeclareUnicodeCharacter{014D}{\=o}% 10746 \DeclareUnicodeCharacter{014E}{\u{O}}% 10747 \DeclareUnicodeCharacter{014F}{\u{o}}% 10748 % 10749 \DeclareUnicodeCharacter{0150}{\H{O}}% 10750 \DeclareUnicodeCharacter{0151}{\H{o}}% 10751 \DeclareUnicodeCharacter{0152}{\OE}% 10752 \DeclareUnicodeCharacter{0153}{\oe}% 10753 \DeclareUnicodeCharacter{0154}{\'R}% 10754 \DeclareUnicodeCharacter{0155}{\'r}% 10755 \DeclareUnicodeCharacter{0156}{\cedilla{R}}% 10756 \DeclareUnicodeCharacter{0157}{\cedilla{r}}% 10757 \DeclareUnicodeCharacter{0158}{\v{R}}% 10758 \DeclareUnicodeCharacter{0159}{\v{r}}% 10759 \DeclareUnicodeCharacter{015A}{\'S}% 10760 \DeclareUnicodeCharacter{015B}{\'s}% 10761 \DeclareUnicodeCharacter{015C}{\^S}% 10762 \DeclareUnicodeCharacter{015D}{\^s}% 10763 \DeclareUnicodeCharacter{015E}{\cedilla{S}}% 10764 \DeclareUnicodeCharacter{015F}{\cedilla{s}}% 10765 % 10766 \DeclareUnicodeCharacter{0160}{\v{S}}% 10767 \DeclareUnicodeCharacter{0161}{\v{s}}% 10768 \DeclareUnicodeCharacter{0162}{\cedilla{T}}% 10769 \DeclareUnicodeCharacter{0163}{\cedilla{t}}% 10770 \DeclareUnicodeCharacter{0164}{\v{T}}% 10771 \DeclareUnicodeCharacter{0165}{\v{t}}% 10772 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}% 10773 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}% 10774 \DeclareUnicodeCharacter{0168}{\~U}% 10775 \DeclareUnicodeCharacter{0169}{\~u}% 10776 \DeclareUnicodeCharacter{016A}{\=U}% 10777 \DeclareUnicodeCharacter{016B}{\=u}% 10778 \DeclareUnicodeCharacter{016C}{\u{U}}% 10779 \DeclareUnicodeCharacter{016D}{\u{u}}% 10780 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}% 10781 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}% 10782 % 10783 \DeclareUnicodeCharacter{0170}{\H{U}}% 10784 \DeclareUnicodeCharacter{0171}{\H{u}}% 10785 \DeclareUnicodeCharacter{0172}{\ogonek{U}}% 10786 \DeclareUnicodeCharacter{0173}{\ogonek{u}}% 10787 \DeclareUnicodeCharacter{0174}{\^W}% 10788 \DeclareUnicodeCharacter{0175}{\^w}% 10789 \DeclareUnicodeCharacter{0176}{\^Y}% 10790 \DeclareUnicodeCharacter{0177}{\^y}% 10791 \DeclareUnicodeCharacter{0178}{\"Y}% 10792 \DeclareUnicodeCharacter{0179}{\'Z}% 10793 \DeclareUnicodeCharacter{017A}{\'z}% 10794 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}% 10795 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}% 10796 \DeclareUnicodeCharacter{017D}{\v{Z}}% 10797 \DeclareUnicodeCharacter{017E}{\v{z}}% 10798 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}% 10799 % 10800 \DeclareUnicodeCharacter{01C4}{D\v{Z}}% 10801 \DeclareUnicodeCharacter{01C5}{D\v{z}}% 10802 \DeclareUnicodeCharacter{01C6}{d\v{z}}% 10803 \DeclareUnicodeCharacter{01C7}{LJ}% 10804 \DeclareUnicodeCharacter{01C8}{Lj}% 10805 \DeclareUnicodeCharacter{01C9}{lj}% 10806 \DeclareUnicodeCharacter{01CA}{NJ}% 10807 \DeclareUnicodeCharacter{01CB}{Nj}% 10808 \DeclareUnicodeCharacter{01CC}{nj}% 10809 \DeclareUnicodeCharacter{01CD}{\v{A}}% 10810 \DeclareUnicodeCharacter{01CE}{\v{a}}% 10811 \DeclareUnicodeCharacter{01CF}{\v{I}}% 10812 % 10813 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}% 10814 \DeclareUnicodeCharacter{01D1}{\v{O}}% 10815 \DeclareUnicodeCharacter{01D2}{\v{o}}% 10816 \DeclareUnicodeCharacter{01D3}{\v{U}}% 10817 \DeclareUnicodeCharacter{01D4}{\v{u}}% 10818 % 10819 \DeclareUnicodeCharacter{01E2}{\={\AE}}% 10820 \DeclareUnicodeCharacter{01E3}{\={\ae}}% 10821 \DeclareUnicodeCharacter{01E6}{\v{G}}% 10822 \DeclareUnicodeCharacter{01E7}{\v{g}}% 10823 \DeclareUnicodeCharacter{01E8}{\v{K}}% 10824 \DeclareUnicodeCharacter{01E9}{\v{k}}% 10825 % 10826 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}% 10827 \DeclareUnicodeCharacter{01F1}{DZ}% 10828 \DeclareUnicodeCharacter{01F2}{Dz}% 10829 \DeclareUnicodeCharacter{01F3}{dz}% 10830 \DeclareUnicodeCharacter{01F4}{\'G}% 10831 \DeclareUnicodeCharacter{01F5}{\'g}% 10832 \DeclareUnicodeCharacter{01F8}{\`N}% 10833 \DeclareUnicodeCharacter{01F9}{\`n}% 10834 \DeclareUnicodeCharacter{01FC}{\'{\AE}}% 10835 \DeclareUnicodeCharacter{01FD}{\'{\ae}}% 10836 \DeclareUnicodeCharacter{01FE}{\'{\O}}% 10837 \DeclareUnicodeCharacter{01FF}{\'{\o}}% 10838 % 10839 \DeclareUnicodeCharacter{021E}{\v{H}}% 10840 \DeclareUnicodeCharacter{021F}{\v{h}}% 10841 % 10842 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}% 10843 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}% 10844 \DeclareUnicodeCharacter{0228}{\cedilla{E}}% 10845 \DeclareUnicodeCharacter{0229}{\cedilla{e}}% 10846 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}% 10847 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}% 10848 % 10849 \DeclareUnicodeCharacter{0232}{\=Y}% 10850 \DeclareUnicodeCharacter{0233}{\=y}% 10851 \DeclareUnicodeCharacter{0237}{\dotless{j}}% 10852 % 10853 \DeclareUnicodeCharacter{02BC}{'}% 10854 % 10855 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}% 10856 % 10857 % Greek letters upper case 10858 \DeclareUnicodeCharacter{0391}{{\it A}}% 10859 \DeclareUnicodeCharacter{0392}{{\it B}}% 10860 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}% 10861 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}% 10862 \DeclareUnicodeCharacter{0395}{{\it E}}% 10863 \DeclareUnicodeCharacter{0396}{{\it Z}}% 10864 \DeclareUnicodeCharacter{0397}{{\it H}}% 10865 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}% 10866 \DeclareUnicodeCharacter{0399}{{\it I}}% 10867 \DeclareUnicodeCharacter{039A}{{\it K}}% 10868 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}% 10869 \DeclareUnicodeCharacter{039C}{{\it M}}% 10870 \DeclareUnicodeCharacter{039D}{{\it N}}% 10871 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}% 10872 \DeclareUnicodeCharacter{039F}{{\it O}}% 10873 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}% 10874 \DeclareUnicodeCharacter{03A1}{{\it P}}% 10875 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma 10876 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}% 10877 \DeclareUnicodeCharacter{03A4}{{\it T}}% 10878 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}% 10879 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}% 10880 \DeclareUnicodeCharacter{03A7}{{\it X}}% 10881 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}% 10882 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}% 10883 % 10884 % Vowels with accents 10885 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}% 10886 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}% 10887 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}% 10888 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}% 10889 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}% 10890 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}% 10891 % 10892 % Standalone accent 10893 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}% 10894 % 10895 % Greek letters lower case 10896 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}% 10897 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}% 10898 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}% 10899 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}% 10900 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}% 10901 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}% 10902 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}% 10903 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}% 10904 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}% 10905 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}% 10906 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}% 10907 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}% 10908 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}% 10909 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}% 10910 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron 10911 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}% 10912 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}% 10913 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}% 10914 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}% 10915 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}% 10916 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}% 10917 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}% 10918 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}% 10919 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}% 10920 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}% 10921 % 10922 % More Greek vowels with accents 10923 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}% 10924 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}% 10925 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}% 10926 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}% 10927 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}% 10928 % 10929 % Variant Greek letters 10930 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}% 10931 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}% 10932 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}% 10933 % 10934 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}% 10935 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}% 10936 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}% 10937 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}% 10938 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}% 10939 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}% 10940 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}% 10941 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}% 10942 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}% 10943 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}% 10944 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}% 10945 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}% 10946 % 10947 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}% 10948 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}% 10949 % 10950 \DeclareUnicodeCharacter{1E20}{\=G}% 10951 \DeclareUnicodeCharacter{1E21}{\=g}% 10952 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}% 10953 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}% 10954 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}% 10955 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}% 10956 \DeclareUnicodeCharacter{1E26}{\"H}% 10957 \DeclareUnicodeCharacter{1E27}{\"h}% 10958 % 10959 \DeclareUnicodeCharacter{1E30}{\'K}% 10960 \DeclareUnicodeCharacter{1E31}{\'k}% 10961 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}% 10962 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}% 10963 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}% 10964 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}% 10965 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}% 10966 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}% 10967 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}% 10968 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}% 10969 \DeclareUnicodeCharacter{1E3E}{\'M}% 10970 \DeclareUnicodeCharacter{1E3F}{\'m}% 10971 % 10972 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}% 10973 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}% 10974 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}% 10975 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}% 10976 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}% 10977 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}% 10978 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}% 10979 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}% 10980 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}% 10981 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}% 10982 % 10983 \DeclareUnicodeCharacter{1E54}{\'P}% 10984 \DeclareUnicodeCharacter{1E55}{\'p}% 10985 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}% 10986 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}% 10987 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}% 10988 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}% 10989 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}% 10990 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}% 10991 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}% 10992 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}% 10993 % 10994 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}% 10995 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}% 10996 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}% 10997 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}% 10998 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}% 10999 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}% 11000 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}% 11001 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}% 11002 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}% 11003 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}% 11004 % 11005 \DeclareUnicodeCharacter{1E7C}{\~V}% 11006 \DeclareUnicodeCharacter{1E7D}{\~v}% 11007 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}% 11008 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}% 11009 % 11010 \DeclareUnicodeCharacter{1E80}{\`W}% 11011 \DeclareUnicodeCharacter{1E81}{\`w}% 11012 \DeclareUnicodeCharacter{1E82}{\'W}% 11013 \DeclareUnicodeCharacter{1E83}{\'w}% 11014 \DeclareUnicodeCharacter{1E84}{\"W}% 11015 \DeclareUnicodeCharacter{1E85}{\"w}% 11016 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}% 11017 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}% 11018 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}% 11019 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}% 11020 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}% 11021 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}% 11022 \DeclareUnicodeCharacter{1E8C}{\"X}% 11023 \DeclareUnicodeCharacter{1E8D}{\"x}% 11024 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}% 11025 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}% 11026 % 11027 \DeclareUnicodeCharacter{1E90}{\^Z}% 11028 \DeclareUnicodeCharacter{1E91}{\^z}% 11029 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}% 11030 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}% 11031 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}% 11032 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}% 11033 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}% 11034 \DeclareUnicodeCharacter{1E97}{\"t}% 11035 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}% 11036 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}% 11037 % 11038 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}% 11039 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}% 11040 % 11041 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}% 11042 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}% 11043 \DeclareUnicodeCharacter{1EBC}{\~E}% 11044 \DeclareUnicodeCharacter{1EBD}{\~e}% 11045 % 11046 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}% 11047 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}% 11048 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}% 11049 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}% 11050 % 11051 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}% 11052 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}% 11053 % 11054 \DeclareUnicodeCharacter{1EF2}{\`Y}% 11055 \DeclareUnicodeCharacter{1EF3}{\`y}% 11056 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}% 11057 % 11058 \DeclareUnicodeCharacter{1EF8}{\~Y}% 11059 \DeclareUnicodeCharacter{1EF9}{\~y}% 11060 % 11061 % Punctuation 11062 \DeclareUnicodeCharacter{2013}{--}% 11063 \DeclareUnicodeCharacter{2014}{---}% 11064 \DeclareUnicodeCharacter{2018}{\quoteleft{}}% 11065 \DeclareUnicodeCharacter{2019}{\quoteright{}}% 11066 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}% 11067 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}% 11068 \DeclareUnicodeCharacter{201D}{\quotedblright{}}% 11069 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}% 11070 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}% 11071 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}% 11072 \DeclareUnicodeCharacter{2022}{\bullet{}}% 11073 \DeclareUnicodeCharacter{202F}{\thinspace}% 11074 \DeclareUnicodeCharacter{2026}{\dots{}}% 11075 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}% 11076 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}% 11077 % 11078 \DeclareUnicodeCharacter{20AC}{\euro{}}% 11079 % 11080 \DeclareUnicodeCharacter{2192}{\expansion{}}% 11081 \DeclareUnicodeCharacter{21D2}{\result{}}% 11082 % 11083 % Mathematical symbols 11084 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}% 11085 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}% 11086 \DeclareUnicodeCharacter{2208}{\ensuremath\in}% 11087 \DeclareUnicodeCharacter{2212}{\minus{}}% 11088 \DeclareUnicodeCharacter{2217}{\ast}% 11089 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}% 11090 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}% 11091 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}% 11092 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}% 11093 \DeclareUnicodeCharacter{2261}{\equiv{}}% 11094 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}% 11095 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}% 11096 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}% 11097 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}% 11098 % 11099 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}% 11100 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}% 11101 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}% 11102 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}% 11103 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}% 11104 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}% 11105 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}% 11106 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}% 11107 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}% 11108 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}% 11109 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}% 11110 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}% 11111 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}% 11112 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}% 11113 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}% 11114 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}% 11115 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}% 11116 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}% 11117 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}% 11118 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}% 11119 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}% 11120 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}% 11121 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}% 11122 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}% 11123 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}% 11124 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}% 11125 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}% 11126 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}% 11127 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}% 11128 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}% 11129 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}% 11130 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}% 11131 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}% 11132 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}% 11133 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}% 11134 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}% 11135 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}% 11136 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}% 11137 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}% 11138 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}% 11139 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}% 11140 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}% 11141 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}% 11142 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}% 11143 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}% 11144 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}% 11145 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}% 11146 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}% 11147 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}% 11148 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}% 11149 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}% 11150 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}% 11151 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}% 11152 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}% 11153 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}% 11154 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}% 11155 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}% 11156 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}% 11157 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}% 11158 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}% 11159 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}% 11160 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}% 11161 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}% 11162 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}% 11163 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}% 11164 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}% 11165 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}% 11166 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}% 11167 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}% 11168 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}% 11169 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}% 11170 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}% 11171 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}% 11172 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}% 11173 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}% 11174 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}% 11175 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}% 11176 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}% 11177 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}% 11178 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}% 11179 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}% 11180 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}% 11181 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}% 11182 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}% 11183 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}% 11184 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}% 11185 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}% 11186 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}% 11187 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}% 11188 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}% 11189 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}% 11190 % 11191 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}% 11192 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}% 11193 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}% 11194 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}% 11195 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}% 11196 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}% 11197 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}% 11198 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}% 11199 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}% 11200 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}% 11201 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}% 11202 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}% 11203 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}% 11204 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}% 11205 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}% 11206 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}% 11207 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}% 11208 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}% 11209 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}% 11210 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}% 11211 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}% 11212 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}% 11213 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}% 11214 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}% 11215 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}% 11216 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}% 11217 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}% 11218 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}% 11219 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}% 11220 % 11221 \global\mathchardef\checkmark="1370% actually the square root sign 11222 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}% 11223}% end of \unicodechardefs 11224 11225% UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command) 11226% It makes the setting that replace UTF-8 byte sequence. 11227\def\utfeightchardefs{% 11228 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii 11229 \unicodechardefs 11230} 11231 11232% Whether the active definitions of non-ASCII characters expand to 11233% non-active tokens with the same character code. This is used to 11234% write characters literally, instead of using active definitions for 11235% printing the correct glyphs. 11236\newif\ifpassthroughchars 11237\passthroughcharsfalse 11238 11239% For native Unicode handling (XeTeX and LuaTeX), 11240% provide a definition macro to replace/pass-through a Unicode character 11241% 11242\def\DeclareUnicodeCharacterNative#1#2{% 11243 \catcode"#1=\active 11244 \def\dodeclareunicodecharacternative##1##2##3{% 11245 \begingroup 11246 \uccode`\~="##2\relax 11247 \uppercase{\gdef~}{% 11248 \ifpassthroughchars 11249 ##1% 11250 \else 11251 ##3% 11252 \fi 11253 } 11254 \endgroup 11255 } 11256 \begingroup 11257 \uccode`\.="#1\relax 11258 \uppercase{\def\UTFNativeTmp{.}}% 11259 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}% 11260 \endgroup 11261} 11262 11263% Native Unicode handling (XeTeX and LuaTeX) character replacing definition. 11264% It activates the setting that replaces Unicode characters. 11265\def\nativeunicodechardefs{% 11266 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative 11267 \unicodechardefs 11268} 11269 11270% For native Unicode handling (XeTeX and LuaTeX), 11271% make the character token expand 11272% to the sequences given in \unicodechardefs for printing. 11273\def\DeclareUnicodeCharacterNativeAtU#1#2{% 11274 \def\UTFAtUTmp{#2} 11275 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp 11276} 11277 11278% @U command definitions for native Unicode handling (XeTeX and LuaTeX). 11279\def\nativeunicodechardefsatu{% 11280 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU 11281 \unicodechardefs 11282} 11283 11284% US-ASCII character definitions. 11285\def\asciichardefs{% nothing need be done 11286 \relax 11287} 11288 11289% Define all Unicode characters we know about. This makes UTF-8 the default 11290% input encoding and allows @U to work. 11291\iftxinativeunicodecapable 11292 \nativeunicodechardefsatu 11293\else 11294 \utfeightchardefs 11295\fi 11296 11297\message{formatting,} 11298 11299\newdimen\defaultparindent \defaultparindent = 15pt 11300 11301\chapheadingskip = 15pt plus 4pt minus 2pt 11302\secheadingskip = 12pt plus 3pt minus 2pt 11303\subsecheadingskip = 9pt plus 2pt minus 2pt 11304 11305% Prevent underfull vbox error messages. 11306\vbadness = 10000 11307 11308% Don't be very finicky about underfull hboxes, either. 11309\hbadness = 6666 11310 11311% Following George Bush, get rid of widows and orphans. 11312\widowpenalty=10000 11313\clubpenalty=10000 11314 11315% Use TeX 3.0's \emergencystretch to help line breaking, but if we're 11316% using an old version of TeX, don't do anything. We want the amount of 11317% stretch added to depend on the line length, hence the dependence on 11318% \hsize. We call this whenever the paper size is set. 11319% 11320\def\setemergencystretch{% 11321 \ifx\emergencystretch\thisisundefined 11322 % Allow us to assign to \emergencystretch anyway. 11323 \def\emergencystretch{\dimen0}% 11324 \else 11325 \emergencystretch = .15\hsize 11326 \fi 11327} 11328 11329% Parameters in order: 1) textheight; 2) textwidth; 11330% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; 11331% 7) physical page height; 8) physical page width. 11332% 11333% We also call \setleading{\textleading}, so the caller should define 11334% \textleading. The caller should also set \parskip. 11335% 11336\def\internalpagesizes#1#2#3#4#5#6#7#8{% 11337 \voffset = #3\relax 11338 \topskip = #6\relax 11339 \splittopskip = \topskip 11340 % 11341 \vsize = #1\relax 11342 \advance\vsize by \topskip 11343 \outervsize = \vsize 11344 \advance\outervsize by 2\topandbottommargin 11345 \txipageheight = \vsize 11346 % 11347 \hsize = #2\relax 11348 \outerhsize = \hsize 11349 \advance\outerhsize by 0.5in 11350 \txipagewidth = \hsize 11351 % 11352 \normaloffset = #4\relax 11353 \bindingoffset = #5\relax 11354 % 11355 \ifpdf 11356 \pdfpageheight #7\relax 11357 \pdfpagewidth #8\relax 11358 % if we don't reset these, they will remain at "1 true in" of 11359 % whatever layout pdftex was dumped with. 11360 \pdfhorigin = 1 true in 11361 \pdfvorigin = 1 true in 11362 \else 11363 \ifx\XeTeXrevision\thisisundefined 11364 \special{papersize=#8,#7}% 11365 \else 11366 \pdfpageheight #7\relax 11367 \pdfpagewidth #8\relax 11368 % XeTeX does not have \pdfhorigin and \pdfvorigin. 11369 \fi 11370 \fi 11371 % 11372 \setleading{\textleading} 11373 % 11374 \parindent = \defaultparindent 11375 \setemergencystretch 11376} 11377 11378% @letterpaper (the default). 11379\def\letterpaper{{\globaldefs = 1 11380 \parskip = 3pt plus 2pt minus 1pt 11381 \textleading = 13.2pt 11382 % 11383 % If page is nothing but text, make it come out even. 11384 \internalpagesizes{607.2pt}{6in}% that's 46 lines 11385 {\voffset}{.25in}% 11386 {\bindingoffset}{36pt}% 11387 {11in}{8.5in}% 11388}} 11389 11390% Use @smallbook to reset parameters for 7x9.25 trim size. 11391\def\smallbook{{\globaldefs = 1 11392 \parskip = 2pt plus 1pt 11393 \textleading = 12pt 11394 % 11395 \internalpagesizes{7.5in}{5in}% 11396 {-.2in}{0in}% 11397 {\bindingoffset}{16pt}% 11398 {9.25in}{7in}% 11399 % 11400 \lispnarrowing = 0.3in 11401 \tolerance = 700 11402 \contentsrightmargin = 0pt 11403 \defbodyindent = .5cm 11404}} 11405 11406% Use @smallerbook to reset parameters for 6x9 trim size. 11407% (Just testing, parameters still in flux.) 11408\def\smallerbook{{\globaldefs = 1 11409 \parskip = 1.5pt plus 1pt 11410 \textleading = 12pt 11411 % 11412 \internalpagesizes{7.4in}{4.8in}% 11413 {-.2in}{-.4in}% 11414 {0pt}{14pt}% 11415 {9in}{6in}% 11416 % 11417 \lispnarrowing = 0.25in 11418 \tolerance = 700 11419 \contentsrightmargin = 0pt 11420 \defbodyindent = .4cm 11421}} 11422 11423% Use @afourpaper to print on European A4 paper. 11424\def\afourpaper{{\globaldefs = 1 11425 \parskip = 3pt plus 2pt minus 1pt 11426 \textleading = 13.2pt 11427 % 11428 % Double-side printing via postscript on Laserjet 4050 11429 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. 11430 % To change the settings for a different printer or situation, adjust 11431 % \normaloffset until the front-side and back-side texts align. Then 11432 % do the same for \bindingoffset. You can set these for testing in 11433 % your texinfo source file like this: 11434 % @tex 11435 % \global\normaloffset = -6mm 11436 % \global\bindingoffset = 10mm 11437 % @end tex 11438 \internalpagesizes{673.2pt}{160mm}% that's 51 lines 11439 {\voffset}{\hoffset}% 11440 {\bindingoffset}{44pt}% 11441 {297mm}{210mm}% 11442 % 11443 \tolerance = 700 11444 \contentsrightmargin = 0pt 11445 \defbodyindent = 5mm 11446}} 11447 11448% Use @afivepaper to print on European A5 paper. 11449% From romildo@urano.iceb.ufop.br, 2 July 2000. 11450% He also recommends making @example and @lisp be small. 11451\def\afivepaper{{\globaldefs = 1 11452 \parskip = 2pt plus 1pt minus 0.1pt 11453 \textleading = 12.5pt 11454 % 11455 \internalpagesizes{160mm}{120mm}% 11456 {\voffset}{\hoffset}% 11457 {\bindingoffset}{8pt}% 11458 {210mm}{148mm}% 11459 % 11460 \lispnarrowing = 0.2in 11461 \tolerance = 800 11462 \contentsrightmargin = 0pt 11463 \defbodyindent = 2mm 11464 \tableindent = 12mm 11465}} 11466 11467% A specific text layout, 24x15cm overall, intended for A4 paper. 11468\def\afourlatex{{\globaldefs = 1 11469 \afourpaper 11470 \internalpagesizes{237mm}{150mm}% 11471 {\voffset}{4.6mm}% 11472 {\bindingoffset}{7mm}% 11473 {297mm}{210mm}% 11474 % 11475 % Must explicitly reset to 0 because we call \afourpaper. 11476 \globaldefs = 0 11477}} 11478 11479% Use @afourwide to print on A4 paper in landscape format. 11480\def\afourwide{{\globaldefs = 1 11481 \afourpaper 11482 \internalpagesizes{241mm}{165mm}% 11483 {\voffset}{-2.95mm}% 11484 {\bindingoffset}{7mm}% 11485 {297mm}{210mm}% 11486 \globaldefs = 0 11487}} 11488 11489\def\bsixpaper{{\globaldefs = 1 11490 \afourpaper 11491 \internalpagesizes{140mm}{100mm}% 11492 {-6.35mm}{-12.7mm}% 11493 {\bindingoffset}{14pt}% 11494 {176mm}{125mm}% 11495 \let\SETdispenvsize=\smallword 11496 \lispnarrowing = 0.2in 11497 \globaldefs = 0 11498}} 11499 11500 11501% @pagesizes TEXTHEIGHT[,TEXTWIDTH] 11502% Perhaps we should allow setting the margins, \topskip, \parskip, 11503% and/or leading, also. Or perhaps we should compute them somehow. 11504% 11505\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} 11506\def\pagesizesyyy#1,#2,#3\finish{{% 11507 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi 11508 \globaldefs = 1 11509 % 11510 \parskip = 3pt plus 2pt minus 1pt 11511 \setleading{\textleading}% 11512 % 11513 \dimen0 = #1\relax 11514 \advance\dimen0 by 2.5in % default 1in margin above heading line 11515 % and 1.5in to include heading, footing and 11516 % bottom margin 11517 % 11518 \dimen2 = \hsize 11519 \advance\dimen2 by 2in % default to 1 inch margin on each side 11520 % 11521 \internalpagesizes{#1}{\hsize}% 11522 {\voffset}{\normaloffset}% 11523 {\bindingoffset}{44pt}% 11524 {\dimen0}{\dimen2}% 11525}} 11526 11527% Set default to letter. 11528% 11529\letterpaper 11530 11531% Default value of \hfuzz, for suppressing warnings about overfull hboxes. 11532\hfuzz = 1pt 11533 11534 11535\message{and turning on texinfo input format.} 11536 11537\def^^L{\par} % remove \outer, so ^L can appear in an @comment 11538 11539% DEL is a comment character, in case @c does not suffice. 11540\catcode`\^^? = 14 11541 11542% Define macros to output various characters with catcode for normal text. 11543\catcode`\"=\other \def\normaldoublequote{"} 11544\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix 11545\catcode`\+=\other \def\normalplus{+} 11546\catcode`\<=\other \def\normalless{<} 11547\catcode`\>=\other \def\normalgreater{>} 11548\catcode`\^=\other \def\normalcaret{^} 11549\catcode`\_=\other \def\normalunderscore{_} 11550\catcode`\|=\other \def\normalverticalbar{|} 11551\catcode`\~=\other \def\normaltilde{~} 11552 11553% This macro is used to make a character print one way in \tt 11554% (where it can probably be output as-is), and another way in other fonts, 11555% where something hairier probably needs to be done. 11556% 11557% #1 is what to print if we are indeed using \tt; #2 is what to print 11558% otherwise. Since all the Computer Modern typewriter fonts have zero 11559% interword stretch (and shrink), and it is reasonable to expect all 11560% typewriter fonts to have this, we can check that font parameter. 11561% 11562\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} 11563 11564% Same as above, but check for italic font. Actually this also catches 11565% non-italic slanted fonts since it is impossible to distinguish them from 11566% italic fonts. But since this is only used by $ and it uses \sl anyway 11567% this is not a problem. 11568\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} 11569 11570% Set catcodes for Texinfo file 11571 11572% Active characters for printing the wanted glyph. 11573% Most of these we simply print from the \tt font, but for some, we can 11574% use math or other variants that look better in normal text. 11575% 11576\catcode`\"=\active 11577\def\activedoublequote{{\tt\char34}} 11578\let"=\activedoublequote 11579\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde 11580\chardef\hatchar=`\^ 11581\catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat 11582 11583\catcode`\_=\active 11584\def_{\ifusingtt\normalunderscore\_} 11585\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } 11586\let\realunder=_ 11587 11588\catcode`\|=\active \def|{{\tt\char124}} 11589 11590\chardef \less=`\< 11591\catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless 11592\chardef \gtr=`\> 11593\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr 11594\catcode`\+=\active \def+{{\tt \char 43}} 11595\catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix 11596\catcode`\-=\active \let-=\normaldash 11597 11598 11599% used for headline/footline in the output routine, in case the page 11600% breaks in the middle of an @tex block. 11601\def\texinfochars{% 11602 \let< = \activeless 11603 \let> = \activegtr 11604 \let~ = \activetilde 11605 \let^ = \activehat 11606 \markupsetuplqdefault \markupsetuprqdefault 11607 \let\b = \strong 11608 \let\i = \smartitalic 11609 % in principle, all other definitions in \tex have to be undone too. 11610} 11611 11612% Used sometimes to turn off (effectively) the active characters even after 11613% parsing them. 11614\def\turnoffactive{% 11615 \normalturnoffactive 11616 \otherbackslash 11617} 11618 11619\catcode`\@=0 11620 11621% \backslashcurfont outputs one backslash character in current font, 11622% as in \char`\\. 11623\global\chardef\backslashcurfont=`\\ 11624 11625% \realbackslash is an actual character `\' with catcode other. 11626{\catcode`\\=\other @gdef@realbackslash{\}} 11627 11628% In Texinfo, backslash is an active character; it prints the backslash 11629% in fixed width font. 11630\catcode`\\=\active % @ for escape char from now on. 11631 11632% Print a typewriter backslash. For math mode, we can't simply use 11633% \backslashcurfont: the story here is that in math mode, the \char 11634% of \backslashcurfont ends up printing the roman \ from the math symbol 11635% font (because \char in math mode uses the \mathcode, and plain.tex 11636% sets \mathcode`\\="026E). Hence we use an explicit \mathchar, 11637% which is the decimal equivalent of "715c (class 7, e.g., use \fam; 11638% ignored family value; char position "5C). We can't use " for the 11639% usual hex value because it has already been made active. 11640 11641@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} 11642@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents. 11643 11644% \otherbackslash defines an active \ to be a literal `\' character with 11645% catcode other. 11646@gdef@otherbackslash{@let\=@realbackslash} 11647 11648% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of 11649% the literal character `\'. 11650% 11651{@catcode`- = @active 11652 @gdef@normalturnoffactive{% 11653 @passthroughcharstrue 11654 @let-=@normaldash 11655 @let"=@normaldoublequote 11656 @let$=@normaldollar %$ font-lock fix 11657 @let+=@normalplus 11658 @let<=@normalless 11659 @let>=@normalgreater 11660 @let^=@normalcaret 11661 @let_=@normalunderscore 11662 @let|=@normalverticalbar 11663 @let~=@normaltilde 11664 @let\=@ttbackslash 11665 @markupsetuplqdefault 11666 @markupsetuprqdefault 11667 @unsepspaces 11668 } 11669} 11670 11671% If a .fmt file is being used, characters that might appear in a file 11672% name cannot be active until we have parsed the command line. 11673% So turn them off again, and have @fixbackslash turn them back on. 11674@catcode`+=@other @catcode`@_=@other 11675 11676% \enablebackslashhack - allow file to begin `\input texinfo' 11677% 11678% If a .fmt file is being used, we don't want the `\input texinfo' to show up. 11679% That is what \eatinput is for; after that, the `\' should revert to printing 11680% a backslash. 11681% If the file did not have a `\input texinfo', then it is turned off after 11682% the first line; otherwise the first `\' in the file would cause an error. 11683% This is used on the very last line of this file, texinfo.tex. 11684% We also use @c to call @fixbackslash, in case ends of lines are hidden. 11685{ 11686@catcode`@^=7 11687@catcode`@^^M=13@gdef@enablebackslashhack{% 11688 @global@let\ = @eatinput% 11689 @catcode`@^^M=13% 11690 @def@c{@fixbackslash@c}% 11691 % Definition for the newline at the end of this file. 11692 @def ^^M{@let^^M@secondlinenl}% 11693 % Definition for a newline in the main Texinfo file. 11694 @gdef @secondlinenl{@fixbackslash}% 11695 % In case the first line has a whole-line command on it 11696 @let@originalparsearg@parsearg 11697 @def@parsearg{@fixbackslash@originalparsearg} 11698}} 11699 11700{@catcode`@^=7 @catcode`@^^M=13% 11701@gdef@eatinput input texinfo#1^^M{@fixbackslash}} 11702 11703% Emergency active definition of newline, in case an active newline token 11704% appears by mistake. 11705{@catcode`@^=7 @catcode13=13% 11706@gdef@enableemergencynewline{% 11707 @gdef^^M{% 11708 @par% 11709 %<warning: active newline>@par% 11710}}} 11711 11712 11713@gdef@fixbackslash{% 11714 @ifx\@eatinput @let\ = @ttbackslash @fi 11715 @catcode13=5 % regular end of line 11716 @enableemergencynewline 11717 @let@c=@comment 11718 @let@parsearg@originalparsearg 11719 % Also turn back on active characters that might appear in the input 11720 % file name, in case not using a pre-dumped format. 11721 @catcode`+=@active 11722 @catcode`@_=@active 11723 % 11724 % If texinfo.cnf is present on the system, read it. 11725 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets 11726 % called at the beginning of every Texinfo file. Not opening texinfo.cnf 11727 % directly in this file, texinfo.tex, makes it possible to make a format 11728 % file for Texinfo. 11729 % 11730 @openin 1 texinfo.cnf 11731 @ifeof 1 @else @input texinfo.cnf @fi 11732 @closein 1 11733} 11734 11735 11736% Say @foo, not \foo, in error messages. 11737@escapechar = `@@ 11738 11739% These (along with & and #) are made active for url-breaking, so need 11740% active definitions as the normal characters. 11741@def@normaldot{.} 11742@def@normalquest{?} 11743@def@normalslash{/} 11744 11745% These look ok in all fonts, so just make them not special. 11746% @hashchar{} gets its own user-level command, because of #line. 11747@catcode`@& = @other @def@normalamp{&} 11748@catcode`@# = @other @def@normalhash{#} 11749@catcode`@% = @other @def@normalpercent{%} 11750 11751@let @hashchar = @normalhash 11752 11753@c Finally, make ` and ' active, so that txicodequoteundirected and 11754@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we 11755@c don't make ` and ' active, @code will not get them as active chars. 11756@c Do this last of all since we use ` in the previous @catcode assignments. 11757@catcode`@'=@active 11758@catcode`@`=@active 11759@markupsetuplqdefault 11760@markupsetuprqdefault 11761 11762@c Local variables: 11763@c eval: (add-hook 'before-save-hook 'time-stamp) 11764@c page-delimiter: "^\\\\message\\|emacs-page" 11765@c time-stamp-start: "def\\\\texinfoversion{" 11766@c time-stamp-format: "%:y-%02m-%02d.%02H" 11767@c time-stamp-end: "}" 11768@c End: 11769 11770@c vim:sw=2: 11771 11772@enablebackslashhack 11773