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{2022-12-10.11} 7% 8% Copyright 1985, 1986, 1988, 1990-2022 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% Output a mark which sets \thischapter, \thissection and \thiscolor. 245% We dump everything together because we only have one kind of mark. 246% This works because we only use \botmark / \topmark, not \firstmark. 247% 248% A mark contains a subexpression of the \ifcase ... \fi construct. 249% \get*marks macros below extract the needed part using \ifcase. 250% 251% Another complication is to let the user choose whether \thischapter 252% (\thissection) refers to the chapter (section) in effect at the top 253% of a page, or that at the bottom of a page. 254 255% \domark is called twice inside \chapmacro, to add one 256% mark before the section break, and one after. 257% In the second call \prevchapterdefs is the same as \currentchapterdefs, 258% and \prevsectiondefs is the same as \currentsectiondefs. 259% Then if the page is not broken at the mark, some of the previous 260% section appears on the page, and we can get the name of this section 261% from \firstmark for @everyheadingmarks top. 262% @everyheadingmarks bottom uses \botmark. 263% 264% See page 260 of The TeXbook. 265\def\domark{% 266 \toks0=\expandafter{\currentchapterdefs}% 267 \toks2=\expandafter{\currentsectiondefs}% 268 \toks4=\expandafter{\prevchapterdefs}% 269 \toks6=\expandafter{\prevsectiondefs}% 270 \toks8=\expandafter{\currentcolordefs}% 271 \mark{% 272 \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top 273 \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom 274 \noexpand\else \the\toks8 % 2: color marks 275 }% 276} 277 278% \gettopheadingmarks, \getbottomheadingmarks, 279% \getcolormarks - extract needed part of mark. 280% 281% \topmark doesn't work for the very first chapter (after the title 282% page or the contents), so we use \firstmark there -- this gets us 283% the mark with the chapter defs, unless the user sneaks in, e.g., 284% @setcolor (or @url, or @link, etc.) between @contents and the very 285% first @chapter. 286\def\gettopheadingmarks{% 287 \ifcase0\the\savedtopmark\fi 288 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi 289} 290\def\getbottomheadingmarks{\ifcase1\botmark\fi} 291\def\getcolormarks{\ifcase2\the\savedtopmark\fi} 292 293% Avoid "undefined control sequence" errors. 294\def\currentchapterdefs{} 295\def\currentsectiondefs{} 296\def\currentsection{} 297\def\prevchapterdefs{} 298\def\prevsectiondefs{} 299\def\currentcolordefs{} 300 301% Margin to add to right of even pages, to left of odd pages. 302\newdimen\bindingoffset 303\newdimen\normaloffset 304\newdimen\txipagewidth \newdimen\txipageheight 305 306% Main output routine. 307% 308\chardef\PAGE = 255 309\newtoks\defaultoutput 310\defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}} 311\output=\expandafter{\the\defaultoutput} 312 313\newbox\headlinebox 314\newbox\footlinebox 315 316% When outputting the double column layout for indices, an output routine 317% is run several times, hiding the original value of \topmark. Hence, save 318% \topmark at the beginning. 319% 320\newtoks\savedtopmark 321\newif\iftopmarksaved 322\topmarksavedtrue 323\def\savetopmark{% 324 \iftopmarksaved\else 325 \global\savedtopmark=\expandafter{\topmark}% 326 \global\topmarksavedtrue 327 \fi 328} 329 330% \onepageout takes a vbox as an argument. 331% \shipout a vbox for a single page, adding an optional header, footer 332% and footnote. This also causes index entries for this page to be written 333% to the auxiliary files. 334% 335\def\onepageout#1{% 336 \hoffset=\normaloffset 337 % 338 \ifodd\pageno \advance\hoffset by \bindingoffset 339 \else \advance\hoffset by -\bindingoffset\fi 340 % 341 \checkchapterpage 342 % 343 % Make the heading and footing. \makeheadline and \makefootline 344 % use the contents of \headline and \footline. 345 \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars} 346 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi 347 \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}% 348 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi 349 \global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}% 350 % 351 {% 352 % Set context for writing to auxiliary files like index files. 353 % Have to do this stuff outside the \shipout because we want it to 354 % take effect in \write's, yet the group defined by the \vbox ends 355 % before the \shipout runs. 356 % 357 \atdummies % don't expand commands in the output. 358 \turnoffactive 359 \shipout\vbox{% 360 % Do this early so pdf references go to the beginning of the page. 361 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi 362 % 363 \unvbox\headlinebox 364 \pagebody{#1}% 365 \ifdim\ht\footlinebox > 0pt 366 % Only leave this space if the footline is nonempty. 367 % (We lessened \vsize for it in \oddfootingyyy.) 368 % The \baselineskip=24pt in plain's \makefootline has no effect. 369 \vskip 24pt 370 \unvbox\footlinebox 371 \fi 372 % 373 }% 374 }% 375 \global\topmarksavedfalse 376 \advancepageno 377 \ifnum\outputpenalty>-20000 \else\dosupereject\fi 378} 379 380\newinsert\margin \dimen\margin=\maxdimen 381 382% Main part of page, including any footnotes 383\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}} 384{\catcode`\@ =11 385\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi 386% marginal hacks, juha@viisa.uucp (Juha Takala) 387\ifvoid\margin\else % marginal info is present 388 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi 389\dimen@=\dp#1\relax \unvbox#1\relax 390\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi 391\ifr@ggedbottom \kern-\dimen@ \vfil \fi} 392} 393 394% Check if we are on the first page of a chapter. Used for printing headings. 395\newif\ifchapterpage 396\def\checkchapterpage{% 397 % Get the chapter that was current at the end of the last page 398 \ifcase1\the\savedtopmark\fi 399 \let\prevchaptername\thischaptername 400 % 401 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi 402 \let\curchaptername\thischaptername 403 % 404 \ifx\curchaptername\prevchaptername 405 \chapterpagefalse 406 \else 407 \chapterpagetrue 408 \fi 409} 410 411% Argument parsing 412 413% Parse an argument, then pass it to #1. The argument is the rest of 414% the input line (except we remove a trailing comment). #1 should be a 415% macro which expects an ordinary undelimited TeX argument. 416% For example, \def\foo{\parsearg\fooxxx}. 417% 418\def\parsearg{\parseargusing{}} 419\def\parseargusing#1#2{% 420 \def\argtorun{#2}% 421 \begingroup 422 \obeylines 423 \spaceisspace 424 #1% 425 \parseargline\empty% Insert the \empty token, see \finishparsearg below. 426} 427 428{\obeylines % 429 \gdef\parseargline#1^^M{% 430 \endgroup % End of the group started in \parsearg. 431 \argremovecomment #1\comment\ArgTerm% 432 }% 433} 434 435% First remove any @comment, then any @c comment. Pass the result on to 436% \argcheckspaces. 437\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} 438\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} 439 440% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space. 441% 442% \argremovec might leave us with trailing space, e.g., 443% @end itemize @c foo 444% This space token undergoes the same procedure and is eventually removed 445% by \finishparsearg. 446% 447\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} 448\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} 449\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% 450 \def\temp{#3}% 451 \ifx\temp\empty 452 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: 453 \let\temp\finishparsearg 454 \else 455 \let\temp\argcheckspaces 456 \fi 457 % Put the space token in: 458 \temp#1 #3\ArgTerm 459} 460 461% If a _delimited_ argument is enclosed in braces, they get stripped; so 462% to get _exactly_ the rest of the line, we had to prevent such situation. 463% We prepended an \empty token at the very beginning and we expand it now, 464% just before passing the control to \argtorun. 465% (Similarly, we have to think about #3 of \argcheckspacesY above: it is 466% either the null string, or it ends with \^^M---thus there is no danger 467% that a pair of braces would be stripped. 468% 469% But first, we have to remove the trailing space token. 470% 471\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} 472 473 474% \parseargdef - define a command taking an argument on the line 475% 476% \parseargdef\foo{...} 477% is roughly equivalent to 478% \def\foo{\parsearg\Xfoo} 479% \def\Xfoo#1{...} 480\def\parseargdef#1{% 481 \expandafter \doparseargdef \csname\string#1\endcsname #1% 482} 483\def\doparseargdef#1#2{% 484 \def#2{\parsearg#1}% 485 \def#1##1% 486} 487 488% Several utility definitions with active space: 489{ 490 \obeyspaces 491 \gdef\obeyedspace{ } 492 493 % Make each space character in the input produce a normal interword 494 % space in the output. Don't allow a line break at this space, as this 495 % is used only in environments like @example, where each line of input 496 % should produce a line of output anyway. 497 % 498 \gdef\sepspaces{\obeyspaces\let =\tie} 499 500 % If an index command is used in an @example environment, any spaces 501 % therein should become regular spaces in the raw index file, not the 502 % expansion of \tie (\leavevmode \penalty \@M \ ). 503 \gdef\unsepspaces{\let =\space} 504} 505 506 507\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} 508 509% Define the framework for environments in texinfo.tex. It's used like this: 510% 511% \envdef\foo{...} 512% \def\Efoo{...} 513% 514% It's the responsibility of \envdef to insert \begingroup before the 515% actual body; @end closes the group after calling \Efoo. \envdef also 516% defines \thisenv, so the current environment is known; @end checks 517% whether the environment name matches. The \checkenv macro can also be 518% used to check whether the current environment is the one expected. 519% 520% Non-false conditionals (@iftex, @ifset) don't fit into this, so they 521% are not treated as environments; they don't open a group. (The 522% implementation of @end takes care not to call \endgroup in this 523% special case.) 524 525 526% At run-time, environments start with this: 527\def\startenvironment#1{\begingroup\def\thisenv{#1}} 528% initialize 529\let\thisenv\empty 530 531% ... but they get defined via ``\envdef\foo{...}'': 532\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} 533\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} 534 535% Check whether we're in the right environment: 536\def\checkenv#1{% 537 \def\temp{#1}% 538 \ifx\thisenv\temp 539 \else 540 \badenverr 541 \fi 542} 543 544% Environment mismatch, #1 expected: 545\def\badenverr{% 546 \errhelp = \EMsimple 547 \errmessage{This command can appear only \inenvironment\temp, 548 not \inenvironment\thisenv}% 549} 550\def\inenvironment#1{% 551 \ifx#1\empty 552 outside of any environment% 553 \else 554 in environment \expandafter\string#1% 555 \fi 556} 557 558 559% @end foo calls \checkenv and executes the definition of \Efoo. 560\parseargdef\end{% 561 \if 1\csname iscond.#1\endcsname 562 \else 563 % The general wording of \badenverr may not be ideal. 564 \expandafter\checkenv\csname#1\endcsname 565 \csname E#1\endcsname 566 \endgroup 567 \fi 568} 569 570\newhelp\EMsimple{Press RETURN to continue.} 571 572 573% Be sure we're in horizontal mode when doing a tie, since we make space 574% equivalent to this in @example-like environments. Otherwise, a space 575% at the beginning of a line will start with \penalty -- and 576% since \penalty is valid in vertical mode, we'd end up putting the 577% penalty on the vertical list instead of in the new paragraph. 578{\catcode`@ = 11 579 % Avoid using \@M directly, because that causes trouble 580 % if the definition is written into an index file. 581 \global\let\tiepenalty = \@M 582 \gdef\tie{\leavevmode\penalty\tiepenalty\ } 583} 584 585% @: forces normal size whitespace following. 586\def\:{\spacefactor=1000 } 587 588% @* forces a line break. 589\def\*{\unskip\hfil\break\hbox{}\ignorespaces} 590 591% @/ allows a line break. 592\let\/=\allowbreak 593 594% @. is an end-of-sentence period. 595\def\.{.\spacefactor=\endofsentencespacefactor\space} 596 597% @! is an end-of-sentence bang. 598\def\!{!\spacefactor=\endofsentencespacefactor\space} 599 600% @? is an end-of-sentence query. 601\def\?{?\spacefactor=\endofsentencespacefactor\space} 602 603% @w prevents a word break. Without the \leavevmode, @w at the 604% beginning of a paragraph, when TeX is still in vertical mode, would 605% produce a whole line of output instead of starting the paragraph. 606\def\w#1{\leavevmode\hbox{#1}} 607 608% @group ... @end group forces ... to be all on one page, by enclosing 609% it in a TeX vbox. We use \vtop instead of \vbox to construct the box 610% to keep its height that of a normal line. According to the rules for 611% \topskip (p.114 of the TeXbook), the glue inserted is 612% max (\topskip - \ht (first item), 0). If that height is large, 613% therefore, no glue is inserted, and the space between the headline and 614% the text is small, which looks bad. 615% 616% Another complication is that the group might be very large. This can 617% cause the glue on the previous page to be unduly stretched, because it 618% does not have much material. In this case, it's better to add an 619% explicit \vfill so that the extra space is at the bottom. The 620% threshold for doing this is if the group is more than \vfilllimit 621% percent of a page (\vfilllimit can be changed inside of @tex). 622% 623\newbox\groupbox 624\def\vfilllimit{0.7} 625% 626\envdef\group{% 627 \ifnum\catcode`\^^M=\active \else 628 \errhelp = \groupinvalidhelp 629 \errmessage{@group invalid in context where filling is enabled}% 630 \fi 631 \startsavinginserts 632 % 633 \setbox\groupbox = \vtop\bgroup 634 % Do @comment since we are called inside an environment such as 635 % @example, where each end-of-line in the input causes an 636 % end-of-line in the output. We don't want the end-of-line after 637 % the `@group' to put extra space in the output. Since @group 638 % should appear on a line by itself (according to the Texinfo 639 % manual), we don't worry about eating any user text. 640 \comment 641} 642% 643% The \vtop produces a box with normal height and large depth; thus, TeX puts 644% \baselineskip glue before it, and (when the next line of text is done) 645% \lineskip glue after it. Thus, space below is not quite equal to space 646% above. But it's pretty close. 647\def\Egroup{% 648 % To get correct interline space between the last line of the group 649 % and the first line afterwards, we have to propagate \prevdepth. 650 \endgraf % Not \par, as it may have been set to \lisppar. 651 \global\dimen1 = \prevdepth 652 \egroup % End the \vtop. 653 \addgroupbox 654 \prevdepth = \dimen1 655 \checkinserts 656} 657 658\def\addgroupbox{ 659 % \dimen0 is the vertical size of the group's box. 660 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox 661 % \dimen2 is how much space is left on the page (more or less). 662 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal 663 % if the group doesn't fit on the current page, and it's a big big 664 % group, force a page break. 665 \ifdim \dimen0 > \dimen2 666 \ifdim \pagetotal < \vfilllimit\txipageheight 667 \page 668 \fi 669 \fi 670 \box\groupbox 671} 672 673% 674% TeX puts in an \escapechar (i.e., `@') at the beginning of the help 675% message, so this ends up printing `@group can only ...'. 676% 677\newhelp\groupinvalidhelp{% 678group can only be used in environments such as @example,^^J% 679where each line of input produces a line of output.} 680 681% @need space-in-mils 682% forces a page break if there is not space-in-mils remaining. 683 684\newdimen\mil \mil=0.001in 685 686\parseargdef\need{% 687 % Ensure vertical mode, so we don't make a big box in the middle of a 688 % paragraph. 689 \par 690 % 691 % If the @need value is less than one line space, it's useless. 692 \dimen0 = #1\mil 693 \dimen2 = \ht\strutbox 694 \advance\dimen2 by \dp\strutbox 695 \ifdim\dimen0 > \dimen2 696 % This is similar to the 'needspace' module in LaTeX. 697 % The first penalty allows a break if the end of the page is 698 % not too far away. Following penalties and skips are discarded. 699 % Otherwise, require at least \dimen0 of vertical space. 700 % 701 % (We used to use a \vtop to reserve space, but this had spacing issues 702 % when followed by a section heading, as it was not a "discardable item". 703 % This also has the benefit of providing glue before the page break if 704 % there isn't enough space.) 705 \vskip0pt plus \dimen0 706 \penalty-100 707 \vskip0pt plus -\dimen0 708 \vskip \dimen0 709 \penalty9999 710 \vskip -\dimen0 711 \penalty0\relax % this hides the above glue from \safewhatsit and \dobreak 712 \fi 713} 714 715% @br forces paragraph break (and is undocumented). 716 717\let\br = \par 718 719% @page forces the start of a new page. 720% 721\def\page{\par\vfill\supereject} 722 723% @exdent text.... 724% outputs text on separate line in roman font, starting at standard page margin 725 726% This records the amount of indent in the innermost environment. 727% That's how much \exdent should take out. 728\newskip\exdentamount 729 730% This defn is used inside fill environments such as @defun. 731\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} 732 733% This defn is used inside nofill environments such as @example. 734\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount 735 \leftline{\hskip\leftskip{\rm#1}}}} 736 737% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current 738% paragraph. For more general purposes, use the \margin insertion 739% class. WHICH is `l' or `r'. Not documented, written for gawk manual. 740% 741\newskip\inmarginspacing \inmarginspacing=1cm 742\def\strutdepth{\dp\strutbox} 743% 744\def\doinmargin#1#2{\strut\vadjust{% 745 \nobreak 746 \kern-\strutdepth 747 \vtop to \strutdepth{% 748 \baselineskip=\strutdepth 749 \vss 750 % if you have multiple lines of stuff to put here, you'll need to 751 % make the vbox yourself of the appropriate size. 752 \ifx#1l% 753 \llap{\ignorespaces #2\hskip\inmarginspacing}% 754 \else 755 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% 756 \fi 757 \null 758 }% 759}} 760\def\inleftmargin{\doinmargin l} 761\def\inrightmargin{\doinmargin r} 762% 763% @inmargin{TEXT [, RIGHT-TEXT]} 764% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; 765% else use TEXT for both). 766% 767\def\inmargin#1{\parseinmargin #1,,\finish} 768\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. 769 \setbox0 = \hbox{\ignorespaces #2}% 770 \ifdim\wd0 > 0pt 771 \def\lefttext{#1}% have both texts 772 \def\righttext{#2}% 773 \else 774 \def\lefttext{#1}% have only one text 775 \def\righttext{#1}% 776 \fi 777 % 778 \ifodd\pageno 779 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin 780 \else 781 \def\temp{\inleftmargin\lefttext}% 782 \fi 783 \temp 784} 785 786% @include FILE -- \input text of FILE. 787% 788\def\include{\parseargusing\filenamecatcodes\includezzz} 789\def\includezzz#1{% 790 \pushthisfilestack 791 \def\thisfile{#1}% 792 {% 793 \makevalueexpandable % we want to expand any @value in FILE. 794 \turnoffactive % and allow special characters in the expansion 795 \indexnofonts % Allow `@@' and other weird things in file names. 796 \wlog{texinfo.tex: doing @include of #1^^J}% 797 \edef\temp{\noexpand\input #1 }% 798 % 799 % This trickery is to read FILE outside of a group, in case it makes 800 % definitions, etc. 801 \expandafter 802 }\temp 803 \popthisfilestack 804} 805\def\filenamecatcodes{% 806 \catcode`\\=\other 807 \catcode`~=\other 808 \catcode`^=\other 809 \catcode`_=\other 810 \catcode`|=\other 811 \catcode`<=\other 812 \catcode`>=\other 813 \catcode`+=\other 814 \catcode`-=\other 815 \catcode`\`=\other 816 \catcode`\'=\other 817} 818 819\def\pushthisfilestack{% 820 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm 821} 822\def\pushthisfilestackX{% 823 \expandafter\pushthisfilestackY\thisfile\StackTerm 824} 825\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% 826 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% 827} 828 829\def\popthisfilestack{\errthisfilestackempty} 830\def\errthisfilestackempty{\errmessage{Internal error: 831 the stack of filenames is empty.}} 832% 833\def\thisfile{} 834 835% @center line 836% outputs that line, centered. 837% 838\parseargdef\center{% 839 \ifhmode 840 \let\centersub\centerH 841 \else 842 \let\centersub\centerV 843 \fi 844 \centersub{\hfil \ignorespaces#1\unskip \hfil}% 845 \let\centersub\relax % don't let the definition persist, just in case 846} 847\def\centerH#1{{% 848 \hfil\break 849 \advance\hsize by -\leftskip 850 \advance\hsize by -\rightskip 851 \line{#1}% 852 \break 853}} 854% 855\newcount\centerpenalty 856\def\centerV#1{% 857 % The idea here is the same as in \startdefun, \cartouche, etc.: if 858 % @center is the first thing after a section heading, we need to wipe 859 % out the negative parskip inserted by \sectionheading, but still 860 % prevent a page break here. 861 \centerpenalty = \lastpenalty 862 \ifnum\centerpenalty>10000 \vskip\parskip \fi 863 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi 864 \line{\kern\leftskip #1\kern\rightskip}% 865} 866 867% @sp n outputs n lines of vertical space 868% 869\parseargdef\sp{\vskip #1\baselineskip} 870 871% @comment ...line which is ignored... 872% @c is the same as @comment 873% @ignore ... @end ignore is another way to write a comment 874 875 876\def\c{\begingroup \catcode`\^^M=\active% 877\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% 878\cxxx} 879{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}} 880% 881\let\comment\c 882 883% @paragraphindent NCHARS 884% We'll use ems for NCHARS, close enough. 885% NCHARS can also be the word `asis' or `none'. 886% We cannot feasibly implement @paragraphindent asis, though. 887% 888\def\asisword{asis} % no translation, these are keywords 889\def\noneword{none} 890% 891\parseargdef\paragraphindent{% 892 \def\temp{#1}% 893 \ifx\temp\asisword 894 \else 895 \ifx\temp\noneword 896 \defaultparindent = 0pt 897 \else 898 \defaultparindent = #1em 899 \fi 900 \fi 901 \parindent = \defaultparindent 902} 903 904% @exampleindent NCHARS 905% We'll use ems for NCHARS like @paragraphindent. 906% It seems @exampleindent asis isn't necessary, but 907% I preserve it to make it similar to @paragraphindent. 908\parseargdef\exampleindent{% 909 \def\temp{#1}% 910 \ifx\temp\asisword 911 \else 912 \ifx\temp\noneword 913 \lispnarrowing = 0pt 914 \else 915 \lispnarrowing = #1em 916 \fi 917 \fi 918} 919 920% @firstparagraphindent WORD 921% If WORD is `none', then suppress indentation of the first paragraph 922% after a section heading. If WORD is `insert', then do indent at such 923% paragraphs. 924% 925% The paragraph indentation is suppressed or not by calling 926% \suppressfirstparagraphindent, which the sectioning commands do. 927% We switch the definition of this back and forth according to WORD. 928% By default, we suppress indentation. 929% 930\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} 931\def\insertword{insert} 932% 933\parseargdef\firstparagraphindent{% 934 \def\temp{#1}% 935 \ifx\temp\noneword 936 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent 937 \else\ifx\temp\insertword 938 \let\suppressfirstparagraphindent = \relax 939 \else 940 \errhelp = \EMsimple 941 \errmessage{Unknown @firstparagraphindent option `\temp'}% 942 \fi\fi 943} 944 945% Here is how we actually suppress indentation. Redefine \everypar to 946% \kern backwards by \parindent, and then reset itself to empty. 947% 948% We also make \indent itself not actually do anything until the next 949% paragraph. 950% 951\gdef\dosuppressfirstparagraphindent{% 952 \gdef\indent {\restorefirstparagraphindent \indent}% 953 \gdef\noindent{\restorefirstparagraphindent \noindent}% 954 \global\everypar = {\kern -\parindent \restorefirstparagraphindent}% 955} 956% 957\gdef\restorefirstparagraphindent{% 958 \global\let\indent = \ptexindent 959 \global\let\noindent = \ptexnoindent 960 \global\everypar = {}% 961} 962 963% leave vertical mode without cancelling any first paragraph indent 964\gdef\imageindent{% 965 \toks0=\everypar 966 \everypar={}% 967 \ptexnoindent 968 \global\everypar=\toks0 969} 970 971 972% @refill is a no-op. 973\let\refill=\relax 974 975% @setfilename INFO-FILENAME - ignored 976\let\setfilename=\comment 977 978% @bye. 979\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend} 980 981 982\message{pdf,} 983% adobe `portable' document format 984\newcount\tempnum 985\newcount\lnkcount 986\newtoks\filename 987\newcount\filenamelength 988\newcount\pgn 989\newtoks\toksA 990\newtoks\toksB 991\newtoks\toksC 992\newtoks\toksD 993\newbox\boxA 994\newbox\boxB 995\newcount\countA 996\newif\ifpdf 997\newif\ifpdfmakepagedest 998 999% 1000% For LuaTeX 1001% 1002 1003\newif\iftxiuseunicodedestname 1004\txiuseunicodedestnamefalse % For pdfTeX etc. 1005 1006\ifx\luatexversion\thisisundefined 1007\else 1008 % Use Unicode destination names 1009 \txiuseunicodedestnametrue 1010 % Escape PDF strings with converting UTF-16 from UTF-8 1011 \begingroup 1012 \catcode`\%=12 1013 \directlua{ 1014 function UTF16oct(str) 1015 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377') 1016 for c in string.utfvalues(str) do 1017 if c < 0x10000 then 1018 tex.sprint( 1019 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. 1020 string.char(0x5c) .. string.char(0x25) .. '03o', 1021 math.floor(c / 256), math.floor(c % 256))) 1022 else 1023 c = c - 0x10000 1024 local c_hi = c / 1024 + 0xd800 1025 local c_lo = c % 1024 + 0xdc00 1026 tex.sprint( 1027 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' .. 1028 string.char(0x5c) .. string.char(0x25) .. '03o' .. 1029 string.char(0x5c) .. string.char(0x25) .. '03o' .. 1030 string.char(0x5c) .. string.char(0x25) .. '03o', 1031 math.floor(c_hi / 256), math.floor(c_hi % 256), 1032 math.floor(c_lo / 256), math.floor(c_lo % 256))) 1033 end 1034 end 1035 end 1036 } 1037 \endgroup 1038 \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}} 1039 % Escape PDF strings without converting 1040 \begingroup 1041 \directlua{ 1042 function PDFescstr(str) 1043 for c in string.bytes(str) do 1044 if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then 1045 tex.sprint(-2, 1046 string.format(string.char(0x5c) .. string.char(0x25) .. '03o', 1047 c)) 1048 else 1049 tex.sprint(-2, string.char(c)) 1050 end 1051 end 1052 end 1053 } 1054 % The -2 in the arguments here gives all the input to TeX catcode 12 1055 % (other) or 10 (space), preventing undefined control sequence errors. See 1056 % https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html 1057 % 1058 \endgroup 1059 \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}} 1060 \ifnum\luatexversion>84 1061 % For LuaTeX >= 0.85 1062 \def\pdfdest{\pdfextension dest} 1063 \let\pdfoutput\outputmode 1064 \def\pdfliteral{\pdfextension literal} 1065 \def\pdfcatalog{\pdfextension catalog} 1066 \def\pdftexversion{\numexpr\pdffeedback version\relax} 1067 \let\pdfximage\saveimageresource 1068 \let\pdfrefximage\useimageresource 1069 \let\pdflastximage\lastsavedimageresourceindex 1070 \def\pdfendlink{\pdfextension endlink\relax} 1071 \def\pdfoutline{\pdfextension outline} 1072 \def\pdfstartlink{\pdfextension startlink} 1073 \def\pdffontattr{\pdfextension fontattr} 1074 \def\pdfobj{\pdfextension obj} 1075 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax} 1076 \let\pdfpagewidth\pagewidth 1077 \let\pdfpageheight\pageheight 1078 \edef\pdfhorigin{\pdfvariable horigin} 1079 \edef\pdfvorigin{\pdfvariable vorigin} 1080 \fi 1081\fi 1082 1083% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 1084% can be set). So we test for \relax and 0 as well as being undefined. 1085\ifx\pdfoutput\thisisundefined 1086\else 1087 \ifx\pdfoutput\relax 1088 \else 1089 \ifcase\pdfoutput 1090 \else 1091 \pdftrue 1092 \fi 1093 \fi 1094\fi 1095 1096\newif\ifpdforxetex 1097\pdforxetexfalse 1098\ifpdf 1099 \pdforxetextrue 1100\fi 1101\ifx\XeTeXrevision\thisisundefined\else 1102 \pdforxetextrue 1103\fi 1104 1105 1106% Output page labels information. 1107% See PDF reference v.1.7 p.594, section 8.3.1. 1108\ifpdf 1109\def\pagelabels{% 1110 \def\title{0 << /P (T-) /S /D >>}% 1111 \edef\roman{\the\romancount << /S /r >>}% 1112 \edef\arabic{\the\arabiccount << /S /D >>}% 1113 % 1114 % Page label ranges must be increasing. Remove any duplicates. 1115 % (There is a slight chance of this being wrong if e.g. there is 1116 % a @contents but no @titlepage, etc.) 1117 % 1118 \ifnum\romancount=0 \def\roman{}\fi 1119 \ifnum\arabiccount=0 \def\title{}% 1120 \else 1121 \ifnum\romancount=\arabiccount \def\roman{}\fi 1122 \fi 1123 % 1124 \ifnum\romancount<\arabiccount 1125 \pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax 1126 \else 1127 \pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax 1128 \fi 1129} 1130\else 1131 \let\pagelabels\relax 1132\fi 1133 1134\newcount\pagecount \pagecount=0 1135\newcount\romancount \romancount=0 1136\newcount\arabiccount \arabiccount=0 1137\ifpdf 1138 \let\ptxadvancepageno\advancepageno 1139 \def\advancepageno{% 1140 \ptxadvancepageno\global\advance\pagecount by 1 1141 } 1142\fi 1143 1144 1145% PDF uses PostScript string constants for the names of xref targets, 1146% for display in the outlines, and in other places. Thus, we have to 1147% double any backslashes. Otherwise, a name like "\node" will be 1148% interpreted as a newline (\n), followed by o, d, e. Not good. 1149% 1150% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and 1151% related messages. The final outcome is that it is up to the TeX user 1152% to double the backslashes and otherwise make the string valid, so 1153% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to 1154% do this reliably, so we use it. 1155 1156% #1 is a control sequence in which to do the replacements, 1157% which we \xdef. 1158\def\txiescapepdf#1{% 1159 \ifx\pdfescapestring\thisisundefined 1160 % No primitive available; should we give a warning or log? 1161 % Many times it won't matter. 1162 \xdef#1{#1}% 1163 \else 1164 % The expandable \pdfescapestring primitive escapes parentheses, 1165 % backslashes, and other special chars. 1166 \xdef#1{\pdfescapestring{#1}}% 1167 \fi 1168} 1169\def\txiescapepdfutfsixteen#1{% 1170 \ifx\pdfescapestrutfsixteen\thisisundefined 1171 % No UTF-16 converting macro available. 1172 \txiescapepdf{#1}% 1173 \else 1174 \xdef#1{\pdfescapestrutfsixteen{#1}}% 1175 \fi 1176} 1177 1178\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images 1179with PDF output, and none of those formats could be found. (.eps cannot 1180be supported due to the design of the PDF format; use regular TeX (DVI 1181output) for that.)} 1182 1183\ifpdf 1184 % 1185 % Color manipulation macros using ideas from pdfcolor.tex, 1186 % except using rgb instead of cmyk; the latter is said to render as a 1187 % very dark gray on-screen and a very dark halftone in print, instead 1188 % of actual black. The dark red here is dark enough to print on paper as 1189 % nearly black, but still distinguishable for online viewing. We use 1190 % black by default, though. 1191 \def\rgbDarkRed{0.50 0.09 0.12} 1192 \def\rgbBlack{0 0 0} 1193 % 1194 % rg sets the color for filling (usual text, etc.); 1195 % RG sets the color for stroking (thin rules, e.g., normal _'s). 1196 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} 1197 % 1198 % Set color, and create a mark which defines \thiscolor accordingly, 1199 % so that \makeheadline knows which color to restore. 1200 \def\setcolor#1{% 1201 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% 1202 \domark 1203 \pdfsetcolor{#1}% 1204 } 1205 % 1206 \def\maincolor{\rgbBlack} 1207 \pdfsetcolor{\maincolor} 1208 \edef\thiscolor{\maincolor} 1209 \def\currentcolordefs{} 1210 % 1211 \def\makefootline{% 1212 \baselineskip24pt 1213 \line{\pdfsetcolor{\maincolor}\the\footline}% 1214 } 1215 % 1216 \def\makeheadline{% 1217 \vbox to 0pt{% 1218 \vskip-22.5pt 1219 \line{% 1220 \vbox to8.5pt{}% 1221 % Extract \thiscolor definition from the marks. 1222 \getcolormarks 1223 % Typeset the headline with \maincolor, then restore the color. 1224 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% 1225 }% 1226 \vss 1227 }% 1228 \nointerlineskip 1229 } 1230 % 1231 % 1232 \pdfcatalog{/PageMode /UseOutlines} 1233 % 1234 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). 1235 \def\dopdfimage#1#2#3{% 1236 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% 1237 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% 1238 % 1239 % pdftex (and the PDF format) support .pdf, .png, .jpg (among 1240 % others). Let's try in that order, PDF first since if 1241 % someone has a scalable image, presumably better to use that than a 1242 % bitmap. 1243 \let\pdfimgext=\empty 1244 \begingroup 1245 \openin 1 #1.pdf \ifeof 1 1246 \openin 1 #1.PDF \ifeof 1 1247 \openin 1 #1.png \ifeof 1 1248 \openin 1 #1.jpg \ifeof 1 1249 \openin 1 #1.jpeg \ifeof 1 1250 \openin 1 #1.JPG \ifeof 1 1251 \errhelp = \nopdfimagehelp 1252 \errmessage{Could not find image file #1 for pdf}% 1253 \else \gdef\pdfimgext{JPG}% 1254 \fi 1255 \else \gdef\pdfimgext{jpeg}% 1256 \fi 1257 \else \gdef\pdfimgext{jpg}% 1258 \fi 1259 \else \gdef\pdfimgext{png}% 1260 \fi 1261 \else \gdef\pdfimgext{PDF}% 1262 \fi 1263 \else \gdef\pdfimgext{pdf}% 1264 \fi 1265 \closein 1 1266 \endgroup 1267 % 1268 % without \immediate, ancient pdftex seg faults when the same image is 1269 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) 1270 \ifnum\pdftexversion < 14 1271 \immediate\pdfimage 1272 \else 1273 \immediate\pdfximage 1274 \fi 1275 \ifdim \wd0 >0pt width \pdfimagewidth \fi 1276 \ifdim \wd2 >0pt height \pdfimageheight \fi 1277 \ifnum\pdftexversion<13 1278 #1.\pdfimgext 1279 \else 1280 {#1.\pdfimgext}% 1281 \fi 1282 \ifnum\pdftexversion < 14 \else 1283 \pdfrefximage \pdflastximage 1284 \fi} 1285 % 1286 \def\setpdfdestname#1{{% 1287 % We have to set dummies so commands such as @code, and characters 1288 % such as \, aren't expanded when present in a section title. 1289 \indexnofonts 1290 \makevalueexpandable 1291 \turnoffactive 1292 \iftxiuseunicodedestname 1293 \ifx \declaredencoding \latone 1294 % Pass through Latin-1 characters. 1295 % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode. 1296 \else 1297 \ifx \declaredencoding \utfeight 1298 % Pass through Unicode characters. 1299 \else 1300 % Use ASCII approximations in destination names. 1301 \passthroughcharsfalse 1302 \fi 1303 \fi 1304 \else 1305 % Use ASCII approximations in destination names. 1306 \passthroughcharsfalse 1307 \fi 1308 \def\pdfdestname{#1}% 1309 \txiescapepdf\pdfdestname 1310 }} 1311 % 1312 \def\setpdfoutlinetext#1{{% 1313 \indexnofonts 1314 \makevalueexpandable 1315 \turnoffactive 1316 \ifx \declaredencoding \latone 1317 % The PDF format can use an extended form of Latin-1 in bookmark 1318 % strings. See Appendix D of the PDF Reference, Sixth Edition, for 1319 % the "PDFDocEncoding". 1320 \passthroughcharstrue 1321 % Pass through Latin-1 characters. 1322 % LuaTeX: Convert to Unicode 1323 % pdfTeX: Use Latin-1 as PDFDocEncoding 1324 \def\pdfoutlinetext{#1}% 1325 \else 1326 \ifx \declaredencoding \utfeight 1327 \ifx\luatexversion\thisisundefined 1328 % For pdfTeX with UTF-8. 1329 % TODO: the PDF format can use UTF-16 in bookmark strings, 1330 % but the code for this isn't done yet. 1331 % Use ASCII approximations. 1332 \passthroughcharsfalse 1333 \def\pdfoutlinetext{#1}% 1334 \else 1335 % For LuaTeX with UTF-8. 1336 % Pass through Unicode characters for title texts. 1337 \passthroughcharstrue 1338 \def\pdfoutlinetext{#1}% 1339 \fi 1340 \else 1341 % For non-Latin-1 or non-UTF-8 encodings. 1342 % Use ASCII approximations. 1343 \passthroughcharsfalse 1344 \def\pdfoutlinetext{#1}% 1345 \fi 1346 \fi 1347 % LuaTeX: Convert to UTF-16 1348 % pdfTeX: Use Latin-1 as PDFDocEncoding 1349 \txiescapepdfutfsixteen\pdfoutlinetext 1350 }} 1351 % 1352 \def\pdfmkdest#1{% 1353 \setpdfdestname{#1}% 1354 \safewhatsit{\pdfdest name{\pdfdestname} xyz}% 1355 } 1356 % 1357 % used to mark target names; must be expandable. 1358 \def\pdfmkpgn#1{#1} 1359 % 1360 % by default, use black for everything. 1361 \def\urlcolor{\rgbBlack} 1362 \def\linkcolor{\rgbBlack} 1363 \def\endlink{\setcolor{\maincolor}\pdfendlink} 1364 % 1365 % Adding outlines to PDF; macros for calculating structure of outlines 1366 % come from Petr Olsak 1367 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% 1368 \else \csname#1\endcsname \fi} 1369 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax 1370 \advance\tempnum by 1 1371 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} 1372 % 1373 % #1 is the section text, which is what will be displayed in the 1374 % outline by the pdf viewer. #2 is the pdf expression for the number 1375 % of subentries (or empty, for subsubsections). #3 is the node text, 1376 % which might be empty if this toc entry had no corresponding node. 1377 % #4 is the page number 1378 % 1379 \def\dopdfoutline#1#2#3#4{% 1380 % Generate a link to the node text if that exists; else, use the 1381 % page number. We could generate a destination for the section 1382 % text in the case where a section has no node, but it doesn't 1383 % seem worth the trouble, since most documents are normally structured. 1384 \setpdfoutlinetext{#1} 1385 \setpdfdestname{#3} 1386 \ifx\pdfdestname\empty 1387 \def\pdfdestname{#4}% 1388 \fi 1389 % 1390 \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}% 1391 } 1392 % 1393 \def\pdfmakeoutlines{% 1394 \begingroup 1395 % Read toc silently, to get counts of subentries for \pdfoutline. 1396 \def\partentry##1##2##3##4{}% ignore parts in the outlines 1397 \def\numchapentry##1##2##3##4{% 1398 \def\thischapnum{##2}% 1399 \def\thissecnum{0}% 1400 \def\thissubsecnum{0}% 1401 }% 1402 \def\numsecentry##1##2##3##4{% 1403 \advancenumber{chap\thischapnum}% 1404 \def\thissecnum{##2}% 1405 \def\thissubsecnum{0}% 1406 }% 1407 \def\numsubsecentry##1##2##3##4{% 1408 \advancenumber{sec\thissecnum}% 1409 \def\thissubsecnum{##2}% 1410 }% 1411 \def\numsubsubsecentry##1##2##3##4{% 1412 \advancenumber{subsec\thissubsecnum}% 1413 }% 1414 \def\thischapnum{0}% 1415 \def\thissecnum{0}% 1416 \def\thissubsecnum{0}% 1417 % 1418 % use \def rather than \let here because we redefine \chapentry et 1419 % al. a second time, below. 1420 \def\appentry{\numchapentry}% 1421 \def\appsecentry{\numsecentry}% 1422 \def\appsubsecentry{\numsubsecentry}% 1423 \def\appsubsubsecentry{\numsubsubsecentry}% 1424 \def\unnchapentry{\numchapentry}% 1425 \def\unnsecentry{\numsecentry}% 1426 \def\unnsubsecentry{\numsubsecentry}% 1427 \def\unnsubsubsecentry{\numsubsubsecentry}% 1428 \readdatafile{toc}% 1429 % 1430 % Read toc second time, this time actually producing the outlines. 1431 % The `-' means take the \expnumber as the absolute number of 1432 % subentries, which we calculated on our first read of the .toc above. 1433 % 1434 % We use the node names as the destinations. 1435 % 1436 % Currently we prefix the section name with the section number 1437 % for chapter and appendix headings only in order to avoid too much 1438 % horizontal space being required in the PDF viewer. 1439 \def\numchapentry##1##2##3##4{% 1440 \dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}% 1441 \def\unnchapentry##1##2##3##4{% 1442 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% 1443 \def\numsecentry##1##2##3##4{% 1444 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% 1445 \def\numsubsecentry##1##2##3##4{% 1446 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% 1447 \def\numsubsubsecentry##1##2##3##4{% count is always zero 1448 \dopdfoutline{##1}{}{##3}{##4}}% 1449 % 1450 % PDF outlines are displayed using system fonts, instead of 1451 % document fonts. Therefore we cannot use special characters, 1452 % since the encoding is unknown. For example, the eogonek from 1453 % Latin 2 (0xea) gets translated to a | character. Info from 1454 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. 1455 % 1456 % TODO this right, we have to translate 8-bit characters to 1457 % their "best" equivalent, based on the @documentencoding. Too 1458 % much work for too little return. Just use the ASCII equivalents 1459 % we use for the index sort strings. 1460 % 1461 \indexnofonts 1462 \setupdatafile 1463 % We can have normal brace characters in the PDF outlines, unlike 1464 % Texinfo index files. So set that up. 1465 \def\{{\lbracecharliteral}% 1466 \def\}{\rbracecharliteral}% 1467 \catcode`\\=\active \otherbackslash 1468 \input \tocreadfilename 1469 \endgroup 1470 } 1471 {\catcode`[=1 \catcode`]=2 1472 \catcode`{=\other \catcode`}=\other 1473 \gdef\lbracecharliteral[{]% 1474 \gdef\rbracecharliteral[}]% 1475 ] 1476 % 1477 \def\skipspaces#1{\def\PP{#1}\def\D{|}% 1478 \ifx\PP\D\let\nextsp\relax 1479 \else\let\nextsp\skipspaces 1480 \addtokens{\filename}{\PP}% 1481 \advance\filenamelength by 1 1482 \fi 1483 \nextsp} 1484 \def\getfilename#1{% 1485 \filenamelength=0 1486 % If we don't expand the argument now, \skipspaces will get 1487 % snagged on things like "@value{foo}". 1488 \edef\temp{#1}% 1489 \expandafter\skipspaces\temp|\relax 1490 } 1491 \ifnum\pdftexversion < 14 1492 \let \startlink \pdfannotlink 1493 \else 1494 \let \startlink \pdfstartlink 1495 \fi 1496 % make a live url in pdf output. 1497 \def\pdfurl#1{% 1498 \begingroup 1499 % it seems we really need yet another set of dummies; have not 1500 % tried to figure out what each command should do in the context 1501 % of @url. for now, just make @/ a no-op, that's the only one 1502 % people have actually reported a problem with. 1503 % 1504 \normalturnoffactive 1505 \def\@{@}% 1506 \let\/=\empty 1507 \makevalueexpandable 1508 % do we want to go so far as to use \indexnofonts instead of just 1509 % special-casing \var here? 1510 \def\var##1{##1}% 1511 % 1512 \leavevmode\setcolor{\urlcolor}% 1513 \startlink attr{/Border [0 0 0]}% 1514 user{/Subtype /Link /A << /S /URI /URI (#1) >>}% 1515 \endgroup} 1516 % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may 1517 % be a simple number, or a list of numbers in the case of an index 1518 % entry. 1519 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} 1520 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 1521 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} 1522 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} 1523 \def\maketoks{% 1524 \expandafter\poptoks\the\toksA|ENDTOKS|\relax 1525 \ifx\first0\adn0 1526 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 1527 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 1528 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 1529 \else 1530 \ifnum0=\countA\else\makelink\fi 1531 \ifx\first.\let\next=\done\else 1532 \let\next=\maketoks 1533 \addtokens{\toksB}{\the\toksD} 1534 \ifx\first,\addtokens{\toksB}{\space}\fi 1535 \fi 1536 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 1537 \next} 1538 \def\makelink{\addtokens{\toksB}% 1539 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} 1540 \def\pdflink#1{\pdflinkpage{#1}{#1}}% 1541 \def\pdflinkpage#1#2{% 1542 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} 1543 \setcolor{\linkcolor}#2\endlink} 1544 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} 1545\else 1546 % non-pdf mode 1547 \let\pdfmkdest = \gobble 1548 \let\pdfurl = \gobble 1549 \let\endlink = \relax 1550 \let\setcolor = \gobble 1551 \let\pdfsetcolor = \gobble 1552 \let\pdfmakeoutlines = \relax 1553\fi % \ifx\pdfoutput 1554 1555% 1556% For XeTeX 1557% 1558\ifx\XeTeXrevision\thisisundefined 1559\else 1560 % 1561 % XeTeX version check 1562 % 1563 \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1 1564 % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307. 1565 % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941). 1566 % For avoiding PDF destination name replacement, we use this special 1567 % instead of xdvipdfmx's command line option `-C 0x0010'. 1568 \special{dvipdfmx:config C 0x0010} 1569 % XeTeX 0.99995+ comes with xdvipdfmx 20160307+. 1570 % It can handle Unicode destination names for PDF. 1571 \txiuseunicodedestnametrue 1572 \else 1573 % XeTeX < 0.99996 (TeX Live < 2016) cannot use the 1574 % `dvipdfmx:config' special. 1575 % So for avoiding PDF destination name replacement, 1576 % xdvipdfmx's command line option `-C 0x0010' is necessary. 1577 % 1578 % XeTeX < 0.99995 can not handle Unicode destination names for PDF 1579 % because xdvipdfmx 20150315 has a UTF-16 conversion issue. 1580 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). 1581 \txiuseunicodedestnamefalse 1582 \fi 1583 % 1584 % Color support 1585 % 1586 \def\rgbDarkRed{0.50 0.09 0.12} 1587 \def\rgbBlack{0 0 0} 1588 % 1589 \def\pdfsetcolor#1{\special{pdf:scolor [#1]}} 1590 % 1591 % Set color, and create a mark which defines \thiscolor accordingly, 1592 % so that \makeheadline knows which color to restore. 1593 \def\setcolor#1{% 1594 \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% 1595 \domark 1596 \pdfsetcolor{#1}% 1597 } 1598 % 1599 \def\maincolor{\rgbBlack} 1600 \pdfsetcolor{\maincolor} 1601 \edef\thiscolor{\maincolor} 1602 \def\currentcolordefs{} 1603 % 1604 \def\makefootline{% 1605 \baselineskip24pt 1606 \line{\pdfsetcolor{\maincolor}\the\footline}% 1607 } 1608 % 1609 \def\makeheadline{% 1610 \vbox to 0pt{% 1611 \vskip-22.5pt 1612 \line{% 1613 \vbox to8.5pt{}% 1614 % Extract \thiscolor definition from the marks. 1615 \getcolormarks 1616 % Typeset the headline with \maincolor, then restore the color. 1617 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% 1618 }% 1619 \vss 1620 }% 1621 \nointerlineskip 1622 } 1623 % 1624 % PDF outline support 1625 % 1626 % Emulate pdfTeX primitive 1627 \def\pdfdest name#1 xyz{% 1628 \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}% 1629 } 1630 % 1631 \def\setpdfdestname#1{{% 1632 % We have to set dummies so commands such as @code, and characters 1633 % such as \, aren't expanded when present in a section title. 1634 \indexnofonts 1635 \makevalueexpandable 1636 \turnoffactive 1637 \iftxiuseunicodedestname 1638 % Pass through Unicode characters. 1639 \else 1640 % Use ASCII approximations in destination names. 1641 \passthroughcharsfalse 1642 \fi 1643 \def\pdfdestname{#1}% 1644 \txiescapepdf\pdfdestname 1645 }} 1646 % 1647 \def\setpdfoutlinetext#1{{% 1648 \turnoffactive 1649 % Always use Unicode characters in title texts. 1650 \def\pdfoutlinetext{#1}% 1651 % For XeTeX, xdvipdfmx converts to UTF-16. 1652 % So we do not convert. 1653 \txiescapepdf\pdfoutlinetext 1654 }} 1655 % 1656 \def\pdfmkdest#1{% 1657 \setpdfdestname{#1}% 1658 \safewhatsit{\pdfdest name{\pdfdestname} xyz}% 1659 } 1660 % 1661 % by default, use black for everything. 1662 \def\urlcolor{\rgbBlack} 1663 \def\linkcolor{\rgbBlack} 1664 \def\endlink{\setcolor{\maincolor}\pdfendlink} 1665 % 1666 \def\dopdfoutline#1#2#3#4{% 1667 \setpdfoutlinetext{#1} 1668 \setpdfdestname{#3} 1669 \ifx\pdfdestname\empty 1670 \def\pdfdestname{#4}% 1671 \fi 1672 % 1673 \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A 1674 << /S /GoTo /D (\pdfdestname) >> >> }% 1675 } 1676 % 1677 \def\pdfmakeoutlines{% 1678 \begingroup 1679 % 1680 % For XeTeX, counts of subentries are not necessary. 1681 % Therefore, we read toc only once. 1682 % 1683 % We use node names as destinations. 1684 % 1685 % Currently we prefix the section name with the section number 1686 % for chapter and appendix headings only in order to avoid too much 1687 % horizontal space being required in the PDF viewer. 1688 \def\partentry##1##2##3##4{}% ignore parts in the outlines 1689 \def\numchapentry##1##2##3##4{% 1690 \dopdfoutline{##2 ##1}{1}{##3}{##4}}% 1691 \def\numsecentry##1##2##3##4{% 1692 \dopdfoutline{##1}{2}{##3}{##4}}% 1693 \def\numsubsecentry##1##2##3##4{% 1694 \dopdfoutline{##1}{3}{##3}{##4}}% 1695 \def\numsubsubsecentry##1##2##3##4{% 1696 \dopdfoutline{##1}{4}{##3}{##4}}% 1697 % 1698 \let\appentry\numchapentry% 1699 \let\appsecentry\numsecentry% 1700 \let\appsubsecentry\numsubsecentry% 1701 \let\appsubsubsecentry\numsubsubsecentry% 1702 \def\unnchapentry##1##2##3##4{% 1703 \dopdfoutline{##1}{1}{##3}{##4}}% 1704 \let\unnsecentry\numsecentry% 1705 \let\unnsubsecentry\numsubsecentry% 1706 \let\unnsubsubsecentry\numsubsubsecentry% 1707 % 1708 % For XeTeX, xdvipdfmx converts strings to UTF-16. 1709 % Therefore, the encoding and the language may not be considered. 1710 % 1711 \indexnofonts 1712 \setupdatafile 1713 % We can have normal brace characters in the PDF outlines, unlike 1714 % Texinfo index files. So set that up. 1715 \def\{{\lbracecharliteral}% 1716 \def\}{\rbracecharliteral}% 1717 \catcode`\\=\active \otherbackslash 1718 \input \tocreadfilename 1719 \endgroup 1720 } 1721 {\catcode`[=1 \catcode`]=2 1722 \catcode`{=\other \catcode`}=\other 1723 \gdef\lbracecharliteral[{]% 1724 \gdef\rbracecharliteral[}]% 1725 ] 1726 1727 \special{pdf:docview << /PageMode /UseOutlines >> } 1728 % ``\special{pdf:tounicode ...}'' is not necessary 1729 % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it. 1730 % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315, 1731 % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings. 1732 % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753). 1733% 1734 \def\skipspaces#1{\def\PP{#1}\def\D{|}% 1735 \ifx\PP\D\let\nextsp\relax 1736 \else\let\nextsp\skipspaces 1737 \addtokens{\filename}{\PP}% 1738 \advance\filenamelength by 1 1739 \fi 1740 \nextsp} 1741 \def\getfilename#1{% 1742 \filenamelength=0 1743 % If we don't expand the argument now, \skipspaces will get 1744 % snagged on things like "@value{foo}". 1745 \edef\temp{#1}% 1746 \expandafter\skipspaces\temp|\relax 1747 } 1748 % make a live url in pdf output. 1749 \def\pdfurl#1{% 1750 \begingroup 1751 % it seems we really need yet another set of dummies; have not 1752 % tried to figure out what each command should do in the context 1753 % of @url. for now, just make @/ a no-op, that's the only one 1754 % people have actually reported a problem with. 1755 % 1756 \normalturnoffactive 1757 \def\@{@}% 1758 \let\/=\empty 1759 \makevalueexpandable 1760 % do we want to go so far as to use \indexnofonts instead of just 1761 % special-casing \var here? 1762 \def\var##1{##1}% 1763 % 1764 \leavevmode\setcolor{\urlcolor}% 1765 \special{pdf:bann << /Border [0 0 0] 1766 /Subtype /Link /A << /S /URI /URI (#1) >> >>}% 1767 \endgroup} 1768 \def\endlink{\setcolor{\maincolor}\special{pdf:eann}} 1769 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} 1770 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} 1771 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} 1772 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} 1773 \def\maketoks{% 1774 \expandafter\poptoks\the\toksA|ENDTOKS|\relax 1775 \ifx\first0\adn0 1776 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 1777 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 1778 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 1779 \else 1780 \ifnum0=\countA\else\makelink\fi 1781 \ifx\first.\let\next=\done\else 1782 \let\next=\maketoks 1783 \addtokens{\toksB}{\the\toksD} 1784 \ifx\first,\addtokens{\toksB}{\space}\fi 1785 \fi 1786 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 1787 \next} 1788 \def\makelink{\addtokens{\toksB}% 1789 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} 1790 \def\pdflink#1{\pdflinkpage{#1}{#1}}% 1791 \def\pdflinkpage#1#2{% 1792 \special{pdf:bann << /Border [0 0 0] 1793 /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}% 1794 \setcolor{\linkcolor}#2\endlink} 1795 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} 1796% 1797 % 1798 % @image support 1799 % 1800 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). 1801 \def\doxeteximage#1#2#3{% 1802 \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% 1803 \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% 1804 % 1805 % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among 1806 % others). Let's try in that order, PDF first since if 1807 % someone has a scalable image, presumably better to use that than a 1808 % bitmap. 1809 \let\xeteximgext=\empty 1810 \begingroup 1811 \openin 1 #1.pdf \ifeof 1 1812 \openin 1 #1.PDF \ifeof 1 1813 \openin 1 #1.png \ifeof 1 1814 \openin 1 #1.jpg \ifeof 1 1815 \openin 1 #1.jpeg \ifeof 1 1816 \openin 1 #1.JPG \ifeof 1 1817 \errmessage{Could not find image file #1 for XeTeX}% 1818 \else \gdef\xeteximgext{JPG}% 1819 \fi 1820 \else \gdef\xeteximgext{jpeg}% 1821 \fi 1822 \else \gdef\xeteximgext{jpg}% 1823 \fi 1824 \else \gdef\xeteximgext{png}% 1825 \fi 1826 \else \gdef\xeteximgext{PDF}% 1827 \fi 1828 \else \gdef\xeteximgext{pdf}% 1829 \fi 1830 \closein 1 1831 \endgroup 1832 % 1833 % Putting an \hbox around the image can prevent an over-long line 1834 % after the image. 1835 \hbox\bgroup 1836 \def\xetexpdfext{pdf}% 1837 \ifx\xeteximgext\xetexpdfext 1838 \XeTeXpdffile "#1".\xeteximgext "" 1839 \else 1840 \def\xetexpdfext{PDF}% 1841 \ifx\xeteximgext\xetexpdfext 1842 \XeTeXpdffile "#1".\xeteximgext "" 1843 \else 1844 \XeTeXpicfile "#1".\xeteximgext "" 1845 \fi 1846 \fi 1847 \ifdim \wd0 >0pt width \xeteximagewidth \fi 1848 \ifdim \wd2 >0pt height \xeteximageheight \fi \relax 1849 \egroup 1850 } 1851\fi 1852 1853 1854% 1855\message{fonts,} 1856 1857% Set the baselineskip to #1, and the lineskip and strut size 1858% correspondingly. There is no deep meaning behind these magic numbers 1859% used as factors; they just match (closely enough) what Knuth defined. 1860% 1861\def\lineskipfactor{.08333} 1862\def\strutheightpercent{.70833} 1863\def\strutdepthpercent {.29167} 1864% 1865% can get a sort of poor man's double spacing by redefining this. 1866\def\baselinefactor{1} 1867% 1868\newdimen\textleading 1869\def\setleading#1{% 1870 \dimen0 = #1\relax 1871 \normalbaselineskip = \baselinefactor\dimen0 1872 \normallineskip = \lineskipfactor\normalbaselineskip 1873 \normalbaselines 1874 \setbox\strutbox =\hbox{% 1875 \vrule width0pt height\strutheightpercent\baselineskip 1876 depth \strutdepthpercent \baselineskip 1877 }% 1878} 1879 1880% PDF CMaps. See also LaTeX's t1.cmap. 1881% 1882% do nothing with this by default. 1883\expandafter\let\csname cmapOT1\endcsname\gobble 1884\expandafter\let\csname cmapOT1IT\endcsname\gobble 1885\expandafter\let\csname cmapOT1TT\endcsname\gobble 1886 1887% if we are producing pdf, and we have \pdffontattr, then define cmaps. 1888% (\pdffontattr was introduced many years ago, but people still run 1889% older pdftex's; it's easy to conditionalize, so we do.) 1890\ifpdf \ifx\pdffontattr\thisisundefined \else 1891 \begingroup 1892 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 1893 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 1894%%DocumentNeededResources: ProcSet (CIDInit) 1895%%IncludeResource: ProcSet (CIDInit) 1896%%BeginResource: CMap (TeX-OT1-0) 1897%%Title: (TeX-OT1-0 TeX OT1 0) 1898%%Version: 1.000 1899%%EndComments 1900/CIDInit /ProcSet findresource begin 190112 dict begin 1902begincmap 1903/CIDSystemInfo 1904<< /Registry (TeX) 1905/Ordering (OT1) 1906/Supplement 0 1907>> def 1908/CMapName /TeX-OT1-0 def 1909/CMapType 2 def 19101 begincodespacerange 1911<00> <7F> 1912endcodespacerange 19138 beginbfrange 1914<00> <01> <0393> 1915<09> <0A> <03A8> 1916<23> <26> <0023> 1917<28> <3B> <0028> 1918<3F> <5B> <003F> 1919<5D> <5E> <005D> 1920<61> <7A> <0061> 1921<7B> <7C> <2013> 1922endbfrange 192340 beginbfchar 1924<02> <0398> 1925<03> <039B> 1926<04> <039E> 1927<05> <03A0> 1928<06> <03A3> 1929<07> <03D2> 1930<08> <03A6> 1931<0B> <00660066> 1932<0C> <00660069> 1933<0D> <0066006C> 1934<0E> <006600660069> 1935<0F> <00660066006C> 1936<10> <0131> 1937<11> <0237> 1938<12> <0060> 1939<13> <00B4> 1940<14> <02C7> 1941<15> <02D8> 1942<16> <00AF> 1943<17> <02DA> 1944<18> <00B8> 1945<19> <00DF> 1946<1A> <00E6> 1947<1B> <0153> 1948<1C> <00F8> 1949<1D> <00C6> 1950<1E> <0152> 1951<1F> <00D8> 1952<21> <0021> 1953<22> <201D> 1954<27> <2019> 1955<3C> <00A1> 1956<3D> <003D> 1957<3E> <00BF> 1958<5C> <201C> 1959<5F> <02D9> 1960<60> <2018> 1961<7D> <02DD> 1962<7E> <007E> 1963<7F> <00A8> 1964endbfchar 1965endcmap 1966CMapName currentdict /CMap defineresource pop 1967end 1968end 1969%%EndResource 1970%%EOF 1971 }\endgroup 1972 \expandafter\edef\csname cmapOT1\endcsname#1{% 1973 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 1974 }% 1975% 1976% \cmapOT1IT 1977 \begingroup 1978 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 1979 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 1980%%DocumentNeededResources: ProcSet (CIDInit) 1981%%IncludeResource: ProcSet (CIDInit) 1982%%BeginResource: CMap (TeX-OT1IT-0) 1983%%Title: (TeX-OT1IT-0 TeX OT1IT 0) 1984%%Version: 1.000 1985%%EndComments 1986/CIDInit /ProcSet findresource begin 198712 dict begin 1988begincmap 1989/CIDSystemInfo 1990<< /Registry (TeX) 1991/Ordering (OT1IT) 1992/Supplement 0 1993>> def 1994/CMapName /TeX-OT1IT-0 def 1995/CMapType 2 def 19961 begincodespacerange 1997<00> <7F> 1998endcodespacerange 19998 beginbfrange 2000<00> <01> <0393> 2001<09> <0A> <03A8> 2002<25> <26> <0025> 2003<28> <3B> <0028> 2004<3F> <5B> <003F> 2005<5D> <5E> <005D> 2006<61> <7A> <0061> 2007<7B> <7C> <2013> 2008endbfrange 200942 beginbfchar 2010<02> <0398> 2011<03> <039B> 2012<04> <039E> 2013<05> <03A0> 2014<06> <03A3> 2015<07> <03D2> 2016<08> <03A6> 2017<0B> <00660066> 2018<0C> <00660069> 2019<0D> <0066006C> 2020<0E> <006600660069> 2021<0F> <00660066006C> 2022<10> <0131> 2023<11> <0237> 2024<12> <0060> 2025<13> <00B4> 2026<14> <02C7> 2027<15> <02D8> 2028<16> <00AF> 2029<17> <02DA> 2030<18> <00B8> 2031<19> <00DF> 2032<1A> <00E6> 2033<1B> <0153> 2034<1C> <00F8> 2035<1D> <00C6> 2036<1E> <0152> 2037<1F> <00D8> 2038<21> <0021> 2039<22> <201D> 2040<23> <0023> 2041<24> <00A3> 2042<27> <2019> 2043<3C> <00A1> 2044<3D> <003D> 2045<3E> <00BF> 2046<5C> <201C> 2047<5F> <02D9> 2048<60> <2018> 2049<7D> <02DD> 2050<7E> <007E> 2051<7F> <00A8> 2052endbfchar 2053endcmap 2054CMapName currentdict /CMap defineresource pop 2055end 2056end 2057%%EndResource 2058%%EOF 2059 }\endgroup 2060 \expandafter\edef\csname cmapOT1IT\endcsname#1{% 2061 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 2062 }% 2063% 2064% \cmapOT1TT 2065 \begingroup 2066 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 2067 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 2068%%DocumentNeededResources: ProcSet (CIDInit) 2069%%IncludeResource: ProcSet (CIDInit) 2070%%BeginResource: CMap (TeX-OT1TT-0) 2071%%Title: (TeX-OT1TT-0 TeX OT1TT 0) 2072%%Version: 1.000 2073%%EndComments 2074/CIDInit /ProcSet findresource begin 207512 dict begin 2076begincmap 2077/CIDSystemInfo 2078<< /Registry (TeX) 2079/Ordering (OT1TT) 2080/Supplement 0 2081>> def 2082/CMapName /TeX-OT1TT-0 def 2083/CMapType 2 def 20841 begincodespacerange 2085<00> <7F> 2086endcodespacerange 20875 beginbfrange 2088<00> <01> <0393> 2089<09> <0A> <03A8> 2090<21> <26> <0021> 2091<28> <5F> <0028> 2092<61> <7E> <0061> 2093endbfrange 209432 beginbfchar 2095<02> <0398> 2096<03> <039B> 2097<04> <039E> 2098<05> <03A0> 2099<06> <03A3> 2100<07> <03D2> 2101<08> <03A6> 2102<0B> <2191> 2103<0C> <2193> 2104<0D> <0027> 2105<0E> <00A1> 2106<0F> <00BF> 2107<10> <0131> 2108<11> <0237> 2109<12> <0060> 2110<13> <00B4> 2111<14> <02C7> 2112<15> <02D8> 2113<16> <00AF> 2114<17> <02DA> 2115<18> <00B8> 2116<19> <00DF> 2117<1A> <00E6> 2118<1B> <0153> 2119<1C> <00F8> 2120<1D> <00C6> 2121<1E> <0152> 2122<1F> <00D8> 2123<20> <2423> 2124<27> <2019> 2125<60> <2018> 2126<7F> <00A8> 2127endbfchar 2128endcmap 2129CMapName currentdict /CMap defineresource pop 2130end 2131end 2132%%EndResource 2133%%EOF 2134 }\endgroup 2135 \expandafter\edef\csname cmapOT1TT\endcsname#1{% 2136 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% 2137 }% 2138\fi\fi 2139 2140 2141% Set the font macro #1 to the font named \fontprefix#2. 2142% #3 is the font's design size, #4 is a scale factor, #5 is the CMap 2143% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). 2144% Example: 2145% #1 = \textrm 2146% #2 = \rmshape 2147% #3 = 10 2148% #4 = \mainmagstep 2149% #5 = OT1 2150% 2151\def\setfont#1#2#3#4#5{% 2152 \font#1=\fontprefix#2#3 scaled #4 2153 \csname cmap#5\endcsname#1% 2154} 2155% This is what gets called when #5 of \setfont is empty. 2156\let\cmap\gobble 2157% 2158% (end of cmaps) 2159 2160% Use cm as the default font prefix. 2161% To specify the font prefix, you must define \fontprefix 2162% before you read in texinfo.tex. 2163\ifx\fontprefix\thisisundefined 2164\def\fontprefix{cm} 2165\fi 2166% Support font families that don't use the same naming scheme as CM. 2167\def\rmshape{r} 2168\def\rmbshape{bx} % where the normal face is bold 2169\def\bfshape{b} 2170\def\bxshape{bx} 2171\def\ttshape{tt} 2172\def\ttbshape{tt} 2173\def\ttslshape{sltt} 2174\def\itshape{ti} 2175\def\itbshape{bxti} 2176\def\slshape{sl} 2177\def\slbshape{bxsl} 2178\def\sfshape{ss} 2179\def\sfbshape{ss} 2180\def\scshape{csc} 2181\def\scbshape{csc} 2182 2183% Definitions for a main text size of 11pt. (The default in Texinfo.) 2184% 2185\def\definetextfontsizexi{% 2186% Text fonts (11.2pt, magstep1). 2187\def\textnominalsize{11pt} 2188\edef\mainmagstep{\magstephalf} 2189\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} 2190\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} 2191\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} 2192\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} 2193\setfont\textsl\slshape{10}{\mainmagstep}{OT1} 2194\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} 2195\setfont\textsc\scshape{10}{\mainmagstep}{OT1} 2196\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} 2197\font\texti=cmmi10 scaled \mainmagstep 2198\font\textsy=cmsy10 scaled \mainmagstep 2199\def\textecsize{1095} 2200 2201% A few fonts for @defun names and args. 2202\setfont\defbf\bfshape{10}{\magstep1}{OT1} 2203\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} 2204\setfont\defsl\slshape{10}{\magstep1}{OT1} 2205\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} 2206\def\df{\let\ttfont=\deftt \let\bffont = \defbf 2207\let\ttslfont=\defttsl \let\slfont=\defsl \bf} 2208 2209% Fonts for indices, footnotes, small examples (9pt). 2210\def\smallnominalsize{9pt} 2211\setfont\smallrm\rmshape{9}{1000}{OT1} 2212\setfont\smalltt\ttshape{9}{1000}{OT1TT} 2213\setfont\smallbf\bfshape{10}{900}{OT1} 2214\setfont\smallit\itshape{9}{1000}{OT1IT} 2215\setfont\smallsl\slshape{9}{1000}{OT1} 2216\setfont\smallsf\sfshape{9}{1000}{OT1} 2217\setfont\smallsc\scshape{10}{900}{OT1} 2218\setfont\smallttsl\ttslshape{10}{900}{OT1TT} 2219\font\smalli=cmmi9 2220\font\smallsy=cmsy9 2221\def\smallecsize{0900} 2222 2223% Fonts for small examples (8pt). 2224\def\smallernominalsize{8pt} 2225\setfont\smallerrm\rmshape{8}{1000}{OT1} 2226\setfont\smallertt\ttshape{8}{1000}{OT1TT} 2227\setfont\smallerbf\bfshape{10}{800}{OT1} 2228\setfont\smallerit\itshape{8}{1000}{OT1IT} 2229\setfont\smallersl\slshape{8}{1000}{OT1} 2230\setfont\smallersf\sfshape{8}{1000}{OT1} 2231\setfont\smallersc\scshape{10}{800}{OT1} 2232\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} 2233\font\smalleri=cmmi8 2234\font\smallersy=cmsy8 2235\def\smallerecsize{0800} 2236 2237% Fonts for math mode superscripts (7pt). 2238\def\sevennominalsize{7pt} 2239\setfont\sevenrm\rmshape{7}{1000}{OT1} 2240\setfont\seventt\ttshape{10}{700}{OT1TT} 2241\setfont\sevenbf\bfshape{10}{700}{OT1} 2242\setfont\sevenit\itshape{7}{1000}{OT1IT} 2243\setfont\sevensl\slshape{10}{700}{OT1} 2244\setfont\sevensf\sfshape{10}{700}{OT1} 2245\setfont\sevensc\scshape{10}{700}{OT1} 2246\setfont\seventtsl\ttslshape{10}{700}{OT1TT} 2247\font\seveni=cmmi7 2248\font\sevensy=cmsy7 2249\def\sevenecsize{0700} 2250 2251% Fonts for title page (20.4pt): 2252\def\titlenominalsize{20pt} 2253\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} 2254\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} 2255\setfont\titlesl\slbshape{10}{\magstep4}{OT1} 2256\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} 2257\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} 2258\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} 2259\let\titlebf=\titlerm 2260\setfont\titlesc\scbshape{10}{\magstep4}{OT1} 2261\font\titlei=cmmi12 scaled \magstep3 2262\font\titlesy=cmsy10 scaled \magstep4 2263\def\titleecsize{2074} 2264 2265% Chapter (and unnumbered) fonts (17.28pt). 2266\def\chapnominalsize{17pt} 2267\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} 2268\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} 2269\setfont\chapsl\slbshape{10}{\magstep3}{OT1} 2270\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} 2271\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} 2272\setfont\chapsf\sfbshape{17}{1000}{OT1} 2273\let\chapbf=\chaprm 2274\setfont\chapsc\scbshape{10}{\magstep3}{OT1} 2275\font\chapi=cmmi12 scaled \magstep2 2276\font\chapsy=cmsy10 scaled \magstep3 2277\def\chapecsize{1728} 2278 2279% Section fonts (14.4pt). 2280\def\secnominalsize{14pt} 2281\setfont\secrm\rmbshape{12}{\magstep1}{OT1} 2282\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1} 2283\setfont\secit\itbshape{10}{\magstep2}{OT1IT} 2284\setfont\secsl\slbshape{10}{\magstep2}{OT1} 2285\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} 2286\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} 2287\setfont\secsf\sfbshape{12}{\magstep1}{OT1} 2288\let\secbf\secrm 2289\setfont\secsc\scbshape{10}{\magstep2}{OT1} 2290\font\seci=cmmi12 scaled \magstep1 2291\font\secsy=cmsy10 scaled \magstep2 2292\def\sececsize{1440} 2293 2294% Subsection fonts (13.15pt). 2295\def\ssecnominalsize{13pt} 2296\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} 2297\setfont\ssecit\itbshape{10}{1315}{OT1IT} 2298\setfont\ssecsl\slbshape{10}{1315}{OT1} 2299\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} 2300\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} 2301\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} 2302\let\ssecbf\ssecrm 2303\setfont\ssecsc\scbshape{10}{1315}{OT1} 2304\font\sseci=cmmi12 scaled \magstephalf 2305\font\ssecsy=cmsy10 scaled 1315 2306\def\ssececsize{1200} 2307 2308% Reduced fonts for @acronym in text (10pt). 2309\def\reducednominalsize{10pt} 2310\setfont\reducedrm\rmshape{10}{1000}{OT1} 2311\setfont\reducedtt\ttshape{10}{1000}{OT1TT} 2312\setfont\reducedbf\bfshape{10}{1000}{OT1} 2313\setfont\reducedit\itshape{10}{1000}{OT1IT} 2314\setfont\reducedsl\slshape{10}{1000}{OT1} 2315\setfont\reducedsf\sfshape{10}{1000}{OT1} 2316\setfont\reducedsc\scshape{10}{1000}{OT1} 2317\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} 2318\font\reducedi=cmmi10 2319\font\reducedsy=cmsy10 2320\def\reducedecsize{1000} 2321 2322\textleading = 13.2pt % line spacing for 11pt CM 2323\textfonts % reset the current fonts 2324\rm 2325} % end of 11pt text font size definitions, \definetextfontsizexi 2326 2327 2328% Definitions to make the main text be 10pt Computer Modern, with 2329% section, chapter, etc., sizes following suit. This is for the GNU 2330% Press printing of the Emacs 22 manual. Maybe other manuals in the 2331% future. Used with @smallbook, which sets the leading to 12pt. 2332% 2333\def\definetextfontsizex{% 2334% Text fonts (10pt). 2335\def\textnominalsize{10pt} 2336\edef\mainmagstep{1000} 2337\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} 2338\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} 2339\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} 2340\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} 2341\setfont\textsl\slshape{10}{\mainmagstep}{OT1} 2342\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} 2343\setfont\textsc\scshape{10}{\mainmagstep}{OT1} 2344\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} 2345\font\texti=cmmi10 scaled \mainmagstep 2346\font\textsy=cmsy10 scaled \mainmagstep 2347\def\textecsize{1000} 2348 2349% A few fonts for @defun names and args. 2350\setfont\defbf\bfshape{10}{\magstephalf}{OT1} 2351\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} 2352\setfont\defsl\slshape{10}{\magstephalf}{OT1} 2353\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} 2354\def\df{\let\ttfont=\deftt \let\bffont = \defbf 2355\let\slfont=\defsl \let\ttslfont=\defttsl \bf} 2356 2357% Fonts for indices, footnotes, small examples (9pt). 2358\def\smallnominalsize{9pt} 2359\setfont\smallrm\rmshape{9}{1000}{OT1} 2360\setfont\smalltt\ttshape{9}{1000}{OT1TT} 2361\setfont\smallbf\bfshape{10}{900}{OT1} 2362\setfont\smallit\itshape{9}{1000}{OT1IT} 2363\setfont\smallsl\slshape{9}{1000}{OT1} 2364\setfont\smallsf\sfshape{9}{1000}{OT1} 2365\setfont\smallsc\scshape{10}{900}{OT1} 2366\setfont\smallttsl\ttslshape{10}{900}{OT1TT} 2367\font\smalli=cmmi9 2368\font\smallsy=cmsy9 2369\def\smallecsize{0900} 2370 2371% Fonts for small examples (8pt). 2372\def\smallernominalsize{8pt} 2373\setfont\smallerrm\rmshape{8}{1000}{OT1} 2374\setfont\smallertt\ttshape{8}{1000}{OT1TT} 2375\setfont\smallerbf\bfshape{10}{800}{OT1} 2376\setfont\smallerit\itshape{8}{1000}{OT1IT} 2377\setfont\smallersl\slshape{8}{1000}{OT1} 2378\setfont\smallersf\sfshape{8}{1000}{OT1} 2379\setfont\smallersc\scshape{10}{800}{OT1} 2380\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} 2381\font\smalleri=cmmi8 2382\font\smallersy=cmsy8 2383\def\smallerecsize{0800} 2384 2385% Fonts for math mode superscripts (7pt). 2386\def\sevennominalsize{7pt} 2387\setfont\sevenrm\rmshape{7}{1000}{OT1} 2388\setfont\seventt\ttshape{10}{700}{OT1TT} 2389\setfont\sevenbf\bfshape{10}{700}{OT1} 2390\setfont\sevenit\itshape{7}{1000}{OT1IT} 2391\setfont\sevensl\slshape{10}{700}{OT1} 2392\setfont\sevensf\sfshape{10}{700}{OT1} 2393\setfont\sevensc\scshape{10}{700}{OT1} 2394\setfont\seventtsl\ttslshape{10}{700}{OT1TT} 2395\font\seveni=cmmi7 2396\font\sevensy=cmsy7 2397\def\sevenecsize{0700} 2398 2399% Fonts for title page (20.4pt): 2400\def\titlenominalsize{20pt} 2401\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} 2402\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} 2403\setfont\titlesl\slbshape{10}{\magstep4}{OT1} 2404\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} 2405\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} 2406\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} 2407\let\titlebf=\titlerm 2408\setfont\titlesc\scbshape{10}{\magstep4}{OT1} 2409\font\titlei=cmmi12 scaled \magstep3 2410\font\titlesy=cmsy10 scaled \magstep4 2411\def\titleecsize{2074} 2412 2413% Chapter fonts (14.4pt). 2414\def\chapnominalsize{14pt} 2415\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} 2416\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} 2417\setfont\chapsl\slbshape{10}{\magstep2}{OT1} 2418\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} 2419\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} 2420\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} 2421\let\chapbf\chaprm 2422\setfont\chapsc\scbshape{10}{\magstep2}{OT1} 2423\font\chapi=cmmi12 scaled \magstep1 2424\font\chapsy=cmsy10 scaled \magstep2 2425\def\chapecsize{1440} 2426 2427% Section fonts (12pt). 2428\def\secnominalsize{12pt} 2429\setfont\secrm\rmbshape{12}{1000}{OT1} 2430\setfont\secit\itbshape{10}{\magstep1}{OT1IT} 2431\setfont\secsl\slbshape{10}{\magstep1}{OT1} 2432\setfont\sectt\ttbshape{12}{1000}{OT1TT} 2433\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} 2434\setfont\secsf\sfbshape{12}{1000}{OT1} 2435\let\secbf\secrm 2436\setfont\secsc\scbshape{10}{\magstep1}{OT1} 2437\font\seci=cmmi12 2438\font\secsy=cmsy10 scaled \magstep1 2439\def\sececsize{1200} 2440 2441% Subsection fonts (10pt). 2442\def\ssecnominalsize{10pt} 2443\setfont\ssecrm\rmbshape{10}{1000}{OT1} 2444\setfont\ssecit\itbshape{10}{1000}{OT1IT} 2445\setfont\ssecsl\slbshape{10}{1000}{OT1} 2446\setfont\ssectt\ttbshape{10}{1000}{OT1TT} 2447\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} 2448\setfont\ssecsf\sfbshape{10}{1000}{OT1} 2449\let\ssecbf\ssecrm 2450\setfont\ssecsc\scbshape{10}{1000}{OT1} 2451\font\sseci=cmmi10 2452\font\ssecsy=cmsy10 2453\def\ssececsize{1000} 2454 2455% Reduced fonts for @acronym in text (9pt). 2456\def\reducednominalsize{9pt} 2457\setfont\reducedrm\rmshape{9}{1000}{OT1} 2458\setfont\reducedtt\ttshape{9}{1000}{OT1TT} 2459\setfont\reducedbf\bfshape{10}{900}{OT1} 2460\setfont\reducedit\itshape{9}{1000}{OT1IT} 2461\setfont\reducedsl\slshape{9}{1000}{OT1} 2462\setfont\reducedsf\sfshape{9}{1000}{OT1} 2463\setfont\reducedsc\scshape{10}{900}{OT1} 2464\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} 2465\font\reducedi=cmmi9 2466\font\reducedsy=cmsy9 2467\def\reducedecsize{0900} 2468 2469\divide\parskip by 2 % reduce space between paragraphs 2470\textleading = 12pt % line spacing for 10pt CM 2471\textfonts % reset the current fonts 2472\rm 2473} % end of 10pt text font size definitions, \definetextfontsizex 2474 2475% Fonts for short table of contents. 2476\setfont\shortcontrm\rmshape{12}{1000}{OT1} 2477\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 2478\setfont\shortcontsl\slshape{12}{1000}{OT1} 2479\setfont\shortconttt\ttshape{12}{1000}{OT1TT} 2480 2481 2482% We provide the user-level command 2483% @fonttextsize 10 2484% (or 11) to redefine the text font size. pt is assumed. 2485% 2486\def\xiword{11} 2487\def\xword{10} 2488\def\xwordpt{10pt} 2489% 2490\parseargdef\fonttextsize{% 2491 \def\textsizearg{#1}% 2492 %\wlog{doing @fonttextsize \textsizearg}% 2493 % 2494 % Set \globaldefs so that documents can use this inside @tex, since 2495 % makeinfo 4.8 does not support it, but we need it nonetheless. 2496 % 2497 \begingroup \globaldefs=1 2498 \ifx\textsizearg\xword \definetextfontsizex 2499 \else \ifx\textsizearg\xiword \definetextfontsizexi 2500 \else 2501 \errhelp=\EMsimple 2502 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} 2503 \fi\fi 2504 \endgroup 2505} 2506 2507% 2508% Change the current font style to #1, remembering it in \curfontstyle. 2509% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in 2510% italics, not bold italics. 2511% 2512\def\setfontstyle#1{% 2513 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. 2514 \csname #1font\endcsname % change the current font 2515} 2516 2517\def\rm{\fam=0 \setfontstyle{rm}} 2518\def\it{\fam=\itfam \setfontstyle{it}} 2519\def\sl{\fam=\slfam \setfontstyle{sl}} 2520\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} 2521\def\tt{\fam=\ttfam \setfontstyle{tt}} 2522 2523% Texinfo sort of supports the sans serif font style, which plain TeX does not. 2524% So we set up a \sf. 2525\newfam\sffam 2526\def\sf{\fam=\sffam \setfontstyle{sf}} 2527 2528% We don't need math for this font style. 2529\def\ttsl{\setfontstyle{ttsl}} 2530 2531 2532% In order for the font changes to affect most math symbols and letters, 2533% we have to define the \textfont of the standard families. 2534% We don't bother to reset \scriptscriptfont; awaiting user need. 2535% 2536\def\resetmathfonts{% 2537 \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont 2538 \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont 2539 \textfont\ttfam=\ttfont \textfont\sffam=\sffont 2540 % 2541 % Fonts for superscript. Note that the 7pt fonts are used regardless 2542 % of the current font size. 2543 \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy 2544 \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl 2545 \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt 2546 \scriptfont\sffam=\sevensf 2547} 2548 2549 2550 2551% \defineassignfonts{SIZE} - 2552% Define sequence \assignfontsSIZE, which switches between font sizes 2553% by redefining the meanings of \STYLEfont. (Just \STYLE additionally sets 2554% the current \fam for math mode.) 2555% 2556\def\defineassignfonts#1{% 2557 \expandafter\edef\csname assignfonts#1\endcsname{% 2558 \let\noexpand\rmfont\csname #1rm\endcsname 2559 \let\noexpand\itfont\csname #1it\endcsname 2560 \let\noexpand\slfont\csname #1sl\endcsname 2561 \let\noexpand\bffont\csname #1bf\endcsname 2562 \let\noexpand\ttfont\csname #1tt\endcsname 2563 \let\noexpand\smallcaps\csname #1sc\endcsname 2564 \let\noexpand\sffont \csname #1sf\endcsname 2565 \let\noexpand\ifont \csname #1i\endcsname 2566 \let\noexpand\syfont \csname #1sy\endcsname 2567 \let\noexpand\ttslfont\csname #1ttsl\endcsname 2568 } 2569} 2570 2571\def\assignfonts#1{% 2572 \csname assignfonts#1\endcsname 2573} 2574 2575\newif\ifrmisbold 2576 2577% Select smaller font size with the current style. Used to change font size 2578% in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for 2579% normal roman text, also use bold fonts for roman text in the smaller size. 2580\def\switchtolllsize{% 2581 \expandafter\assignfonts\expandafter{\lllsize}% 2582 \ifrmisbold 2583 \let\rmfont\bffont 2584 \fi 2585 \csname\curfontstyle\endcsname 2586}% 2587 2588\def\switchtolsize{% 2589 \expandafter\assignfonts\expandafter{\lsize}% 2590 \ifrmisbold 2591 \let\rmfont\bffont 2592 \fi 2593 \csname\curfontstyle\endcsname 2594}% 2595 2596% Define the font-changing commands (all called \...fonts). 2597% Each font-changing command also sets the names \lsize (one size lower) 2598% and \lllsize (three sizes lower). These relative commands are used 2599% in, e.g., the LaTeX logo and acronyms. 2600% 2601% Note: The fonts used for \ifont are for "math italics" (\itfont is for 2602% italics in regular text). \syfont is also used in math mode only. 2603% 2604\def\definefontsetatsize#1#2#3#4#5{% 2605 \defineassignfonts{#1}% 2606\expandafter\def\csname #1fonts\endcsname{% 2607 \def\curfontsize{#1}% 2608 \def\lsize{#2}\def\lllsize{#3}% 2609 \csname rmisbold#5\endcsname 2610 \csname assignfonts#1\endcsname 2611 \resetmathfonts 2612 \setleading{#4}% 2613}} 2614 2615\definefontsetatsize{text} {reduced}{smaller}{\textleading}{false} 2616\definefontsetatsize{title} {chap} {subsec} {27pt} {true} 2617\definefontsetatsize{chap} {sec} {text} {19pt} {true} 2618\definefontsetatsize{sec} {subsec} {reduced}{17pt} {true} 2619\definefontsetatsize{ssec} {text} {small} {15pt} {true} 2620\definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false} 2621\definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false} 2622\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false} 2623 2624\def\titlefont#1{{\titlefonts\rm #1}} 2625\let\subsecfonts = \ssecfonts 2626\let\subsubsecfonts = \ssecfonts 2627 2628% Define these just so they can be easily changed for other fonts. 2629\def\angleleft{$\langle$} 2630\def\angleright{$\rangle$} 2631 2632% Set the fonts to use with the @small... environments. 2633\let\smallexamplefonts = \smallfonts 2634 2635% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample 2636% can fit this many characters: 2637% 8.5x11=86 smallbook=72 a4=90 a5=69 2638% If we use \scriptfonts (8pt), then we can fit this many characters: 2639% 8.5x11=90+ smallbook=80 a4=90+ a5=77 2640% For me, subjectively, the few extra characters that fit aren't worth 2641% the additional smallness of 8pt. So I'm making the default 9pt. 2642% 2643% By the way, for comparison, here's what fits with @example (10pt): 2644% 8.5x11=71 smallbook=60 a4=75 a5=58 2645% --karl, 24jan03. 2646 2647% Set up the default fonts, so we can use them for creating boxes. 2648% 2649\definetextfontsizexi 2650 2651 2652% Check if we are currently using a typewriter font. Since all the 2653% Computer Modern typewriter fonts have zero interword stretch (and 2654% shrink), and it is reasonable to expect all typewriter fonts to have 2655% this property, we can check that font parameter. #1 is what to 2656% print if we are indeed using \tt; #2 is what to print otherwise. 2657\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} 2658 2659% Same as above, but check for italic font. Actually this also catches 2660% non-italic slanted fonts since it is impossible to distinguish them from 2661% italic fonts. But since this is only used by $ and it uses \sl anyway 2662% this is not a problem. 2663\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} 2664 2665 2666% Check if internal flag is clear, i.e. has not been @set. 2667\def\ifflagclear#1#2#3{% 2668 \expandafter\ifx\csname SET#1\endcsname\relax 2669 #2\else#3\fi 2670} 2671 2672{ 2673\catcode`\'=\active 2674\catcode`\`=\active 2675 2676\gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright} 2677\gdef\setregularquotes{\let`\lq \let'\rq} 2678} 2679 2680% Allow an option to not use regular directed right quote/apostrophe 2681% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). 2682% The undirected quote is ugly, so don't make it the default, but it 2683% works for pasting with more pdf viewers (at least evince), the 2684% lilypond developers report. xpdf does work with the regular 0x27. 2685% 2686\def\codequoteright{% 2687 \ifusingtt 2688 {\ifflagclear{txicodequoteundirected}% 2689 {\ifflagclear{codequoteundirected}% 2690 {'}% 2691 {\char'15 }}% 2692 {\char'15 }}% 2693 {'}% 2694} 2695 2696% and a similar option for the left quote char vs. a grave accent. 2697% Modern fonts display ASCII 0x60 as a grave accent, so some people like 2698% the code environments to do likewise. 2699% \relax disables Spanish ligatures ?` and !` of \tt font. 2700% 2701\def\codequoteleft{% 2702 \ifusingtt 2703 {\ifflagclear{txicodequotebacktick}% 2704 {\ifflagclear{codequotebacktick}% 2705 {\relax`}% 2706 {\char'22 }}% 2707 {\char'22 }}% 2708 {\relax`}% 2709} 2710 2711% Commands to set the quote options. 2712% 2713\parseargdef\codequoteundirected{% 2714 \def\temp{#1}% 2715 \ifx\temp\onword 2716 \expandafter\let\csname SETtxicodequoteundirected\endcsname 2717 = t% 2718 \else\ifx\temp\offword 2719 \expandafter\let\csname SETtxicodequoteundirected\endcsname 2720 = \relax 2721 \else 2722 \errhelp = \EMsimple 2723 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% 2724 \fi\fi 2725} 2726% 2727\parseargdef\codequotebacktick{% 2728 \def\temp{#1}% 2729 \ifx\temp\onword 2730 \expandafter\let\csname SETtxicodequotebacktick\endcsname 2731 = t% 2732 \else\ifx\temp\offword 2733 \expandafter\let\csname SETtxicodequotebacktick\endcsname 2734 = \relax 2735 \else 2736 \errhelp = \EMsimple 2737 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% 2738 \fi\fi 2739} 2740 2741% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. 2742\def\noligaturesquoteleft{\relax\lq} 2743 2744% Count depth in font-changes, for error checks 2745\newcount\fontdepth \fontdepth=0 2746 2747% Font commands. 2748 2749% #1 is the font command (\sl or \it), #2 is the text to slant. 2750% If we are in a monospaced environment, however, 1) always use \ttsl, 2751% and 2) do not add an italic correction. 2752\def\dosmartslant#1#2{% 2753 \ifusingtt 2754 {{\ttsl #2}\let\next=\relax}% 2755 {\def\next{{#1#2}\smartitaliccorrection}}% 2756 \next 2757} 2758\def\smartslanted{\dosmartslant\sl} 2759\def\smartitalic{\dosmartslant\it} 2760 2761% Output an italic correction unless the following character is such as 2762% not to need one. 2763\def\smartitaliccorrection{\futurelet\next\smartitaliccorrectionx} 2764\def\smartitaliccorrectionx{% 2765 \ifx\next,% 2766 \else\ifx\next-% 2767 \else\ifx\next.% 2768 \else\ifx\next\.% 2769 \else\ifx\next\comma% 2770 \else\ptexslash 2771 \fi\fi\fi\fi\fi 2772 \aftersmartic 2773} 2774 2775% @cite unconditionally uses \sl with \smartitaliccorrection. 2776\def\cite#1{{\sl #1}\smartitaliccorrection} 2777 2778% @var unconditionally uses \sl. This gives consistency for 2779% parameter names whether they are in @def, @table @code or a 2780% regular paragraph. 2781% To get ttsl font for @var when used in code context, @set txicodevaristt. 2782% The \null is to reset \spacefactor. 2783\def\aftersmartic{} 2784\def\var#1{% 2785 \let\saveaftersmartic = \aftersmartic 2786 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% 2787 % 2788 \ifflagclear{txicodevaristt}% 2789 {\def\varnext{{{\sl #1}}\smartitaliccorrection}}% 2790 {\def\varnext{\smartslanted{#1}}}% 2791 \varnext 2792} 2793 2794% To be removed after next release 2795\def\SETtxicodevaristt{}% @set txicodevaristt 2796 2797\let\i=\smartitalic 2798\let\slanted=\smartslanted 2799\let\dfn=\smartslanted 2800\let\emph=\smartitalic 2801 2802% @r for roman font, used for code comment 2803\def\r#1{{% 2804 \usenormaldash % get --, --- ligatures even if in @code 2805 \defcharsdefault % in case on def line 2806 \rm #1}} 2807{\catcode`-=\active \gdef\usenormaldash{\let-\normaldash}} 2808 2809% @sc, undocumented @ii. 2810\def\sc#1{{\smallcaps#1}} % smallcaps font 2811\def\ii#1{{\it #1}} % italic font 2812 2813% @b, explicit bold. Also @strong. 2814\def\b#1{{\bf #1}} 2815\let\strong=\b 2816 2817% @sansserif, explicit sans. 2818\def\sansserif#1{{\sf #1}} 2819 2820% We can't just use \exhyphenpenalty, because that only has effect at 2821% the end of a paragraph. Restore normal hyphenation at the end of the 2822% group within which \nohyphenation is presumably called. 2823% 2824\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} 2825\def\restorehyphenation{\hyphenchar\font = `- } 2826 2827\newif\iffrenchspacing 2828\frenchspacingfalse 2829 2830% Set sfcode to normal for the chars that usually have another value. 2831% Can't use plain's \frenchspacing because it uses the `\x notation, and 2832% sometimes \x has an active definition that messes things up. 2833% 2834\catcode`@=11 2835 \def\plainfrenchspacing{% 2836 \iffrenchspacing\else 2837 \frenchspacingtrue 2838 \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m 2839 \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m 2840 \def\endofsentencespacefactor{1000}% for @. and friends 2841 \fi 2842 } 2843 \def\plainnonfrenchspacing{% 2844 \iffrenchspacing 2845 \frenchspacingfalse 2846 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 2847 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 2848 \def\endofsentencespacefactor{3000}% for @. and friends 2849 \fi 2850 } 2851\catcode`@=\other 2852\def\endofsentencespacefactor{3000}% default 2853 2854% @frenchspacing on|off says whether to put extra space after punctuation. 2855% 2856\def\onword{on} 2857\def\offword{off} 2858% 2859\let\frenchspacingsetting\plainnonfrenchspacing % used in output routine 2860\parseargdef\frenchspacing{% 2861 \def\temp{#1}% 2862 \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing 2863 \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing 2864 \else 2865 \errhelp = \EMsimple 2866 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% 2867 \fi\fi 2868 \frenchspacingsetting 2869} 2870 2871 2872% @t, explicit typewriter. 2873\def\t#1{% 2874 {\tt \defcharsdefault \plainfrenchspacing #1}% 2875 \null 2876} 2877 2878% @samp. 2879\def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}} 2880 2881% @indicateurl is \samp, that is, with quotes. 2882\let\indicateurl=\samp 2883 2884% @code (and similar) prints in typewriter, but with spaces the same 2885% size as normal in the surrounding text, without hyphenation, etc. 2886% This is a subroutine for that. 2887\def\tclose#1{% 2888 {% 2889 % Change normal interword space to be same as for the current font. 2890 \spaceskip = \fontdimen2\font 2891 % 2892 % Switch to typewriter. 2893 \tt 2894 % 2895 % But `\ ' produces the large typewriter interword space. 2896 \def\ {{\spaceskip = 0pt{} }}% 2897 % 2898 % Turn off hyphenation. 2899 \nohyphenation 2900 % 2901 \plainfrenchspacing 2902 #1% 2903 }% 2904 \null % reset spacefactor to 1000 2905} 2906 2907% We *must* turn on hyphenation at `-' and `_' in @code. 2908% (But see \codedashfinish below.) 2909% Otherwise, it is too hard to avoid overfull hboxes 2910% in the Emacs manual, the Library manual, etc. 2911% 2912% Unfortunately, TeX uses one parameter (\hyphenchar) to control 2913% both hyphenation at - and hyphenation within words. 2914% We must therefore turn them both off (\tclose does that) 2915% and arrange explicitly to hyphenate at a dash. -- rms. 2916{ 2917 \catcode`\-=\active \catcode`\_=\active 2918 \catcode`\'=\active \catcode`\`=\active 2919 \global\let'=\rq \global\let`=\lq % default definitions 2920 % 2921 \global\def\code{\begingroup 2922 \setcodequotes 2923 \catcode\dashChar=\active \catcode\underChar=\active 2924 \ifallowcodebreaks 2925 \let-\codedash 2926 \let_\codeunder 2927 \else 2928 \let-\normaldash 2929 \let_\realunder 2930 \fi 2931 % Given -foo (with a single dash), we do not want to allow a break 2932 % after the hyphen. 2933 \global\let\codedashprev=\codedash 2934 % 2935 \codex 2936 } 2937 % 2938 \gdef\codedash{\futurelet\next\codedashfinish} 2939 \gdef\codedashfinish{% 2940 \normaldash % always output the dash character itself. 2941 % 2942 % Now, output a discretionary to allow a line break, unless 2943 % (a) the next character is a -, or 2944 % (b) the preceding character is a -. 2945 % E.g., given --posix, we do not want to allow a break after either -. 2946 % Given --foo-bar, we do want to allow a break between the - and the b. 2947 \ifx\next\codedash \else 2948 \ifx\codedashprev\codedash 2949 \else \discretionary{}{}{}\fi 2950 \fi 2951 % we need the space after the = for the case when \next itself is a 2952 % space token; it would get swallowed otherwise. As in @code{- a}. 2953 \global\let\codedashprev= \next 2954 } 2955} 2956\def\normaldash{-} 2957% 2958\def\codex #1{\tclose{#1}\endgroup} 2959 2960\def\codeunder{% 2961 % this is all so @math{@code{var_name}+1} can work. In math mode, _ 2962 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) 2963 % will therefore expand the active definition of _, which is us 2964 % (inside @code that is), therefore an endless loop. 2965 \ifusingtt{\ifmmode 2966 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. 2967 \else\normalunderscore \fi 2968 \discretionary{}{}{}}% 2969 {\_}% 2970} 2971 2972% An additional complication: the above will allow breaks after, e.g., 2973% each of the four underscores in __typeof__. This is bad. 2974% @allowcodebreaks provides a document-level way to turn breaking at - 2975% and _ on and off. 2976% 2977\newif\ifallowcodebreaks \allowcodebreakstrue 2978 2979\def\keywordtrue{true} 2980\def\keywordfalse{false} 2981 2982\parseargdef\allowcodebreaks{% 2983 \def\txiarg{#1}% 2984 \ifx\txiarg\keywordtrue 2985 \allowcodebreakstrue 2986 \else\ifx\txiarg\keywordfalse 2987 \allowcodebreaksfalse 2988 \else 2989 \errhelp = \EMsimple 2990 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% 2991 \fi\fi 2992} 2993 2994% For @command, @env, @file, @option quotes seem unnecessary, 2995% so use \code rather than \samp. 2996\let\command=\code 2997\let\env=\code 2998\let\file=\code 2999\let\option=\code 3000 3001% @uref (abbreviation for `urlref') aka @url takes an optional 3002% (comma-separated) second argument specifying the text to display and 3003% an optional third arg as text to display instead of (rather than in 3004% addition to) the url itself. First (mandatory) arg is the url. 3005 3006% TeX-only option to allow changing PDF output to show only the second 3007% arg (if given), and not the url (which is then just the link target). 3008\newif\ifurefurlonlylink 3009 3010% The default \pretolerance setting stops the penalty inserted in 3011% \urefallowbreak being a discouragement to line breaking. Set it to 3012% a negative value for this paragraph only. Hopefully this does not 3013% conflict with redefinitions of \par done elsewhere. 3014\def\nopretolerance{% 3015\pretolerance=-1 3016\def\par{\endgraf\pretolerance=100 \let\par\endgraf}% 3017} 3018 3019% The main macro is \urefbreak, which allows breaking at expected 3020% places within the url. 3021\def\urefbreak{\nopretolerance \begingroup \urefcatcodes \dourefbreak} 3022\let\uref=\urefbreak 3023% 3024\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} 3025\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example 3026 \unsepspaces 3027 \pdfurl{#1}% 3028 \setbox0 = \hbox{\ignorespaces #3}% 3029 \ifdim\wd0 > 0pt 3030 \unhbox0 % third arg given, show only that 3031 \else 3032 \setbox0 = \hbox{\ignorespaces #2}% look for second arg 3033 \ifdim\wd0 > 0pt 3034 \ifpdf 3035 % For pdfTeX and LuaTeX 3036 \ifurefurlonlylink 3037 % PDF plus option to not display url, show just arg 3038 \unhbox0 3039 \else 3040 % PDF, normally display both arg and url for consistency, 3041 % visibility, if the pdf is eventually used to print, etc. 3042 \unhbox0\ (\urefcode{#1})% 3043 \fi 3044 \else 3045 \ifx\XeTeXrevision\thisisundefined 3046 \unhbox0\ (\urefcode{#1})% DVI, always show arg and url 3047 \else 3048 % For XeTeX 3049 \ifurefurlonlylink 3050 % PDF plus option to not display url, show just arg 3051 \unhbox0 3052 \else 3053 % PDF, normally display both arg and url for consistency, 3054 % visibility, if the pdf is eventually used to print, etc. 3055 \unhbox0\ (\urefcode{#1})% 3056 \fi 3057 \fi 3058 \fi 3059 \else 3060 \urefcode{#1}% only url given, so show it 3061 \fi 3062 \fi 3063 \endlink 3064\endgroup} 3065 3066% Allow line breaks around only a few characters (only). 3067\def\urefcatcodes{% 3068 \catcode`\&=\active \catcode`\.=\active 3069 \catcode`\#=\active \catcode`\?=\active 3070 \catcode`\/=\active 3071} 3072{ 3073 \urefcatcodes 3074 % 3075 \global\def\urefcode{\begingroup 3076 \setcodequotes 3077 \urefcatcodes 3078 \let&\urefcodeamp 3079 \let.\urefcodedot 3080 \let#\urefcodehash 3081 \let?\urefcodequest 3082 \let/\urefcodeslash 3083 \codex 3084 } 3085 % 3086 % By default, they are just regular characters. 3087 \global\def&{\normalamp} 3088 \global\def.{\normaldot} 3089 \global\def#{\normalhash} 3090 \global\def?{\normalquest} 3091 \global\def/{\normalslash} 3092} 3093 3094\def\urefcodeamp{\urefprebreak \&\urefpostbreak} 3095\def\urefcodedot{\urefprebreak .\urefpostbreak} 3096\def\urefcodehash{\urefprebreak \#\urefpostbreak} 3097\def\urefcodequest{\urefprebreak ?\urefpostbreak} 3098\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} 3099{ 3100 \catcode`\/=\active 3101 \global\def\urefcodeslashfinish{% 3102 \urefprebreak \slashChar 3103 % Allow line break only after the final / in a sequence of 3104 % slashes, to avoid line break between the slashes in http://. 3105 \ifx\next/\else \urefpostbreak \fi 3106 } 3107} 3108 3109% By default we'll break after the special characters, but some people like to 3110% break before the special chars, so allow that. Also allow no breaking at 3111% all, for manual control. 3112% 3113\parseargdef\urefbreakstyle{% 3114 \def\txiarg{#1}% 3115 \ifx\txiarg\wordnone 3116 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} 3117 \else\ifx\txiarg\wordbefore 3118 \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak} 3119 \else\ifx\txiarg\wordafter 3120 \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak} 3121 \else 3122 \errhelp = \EMsimple 3123 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% 3124 \fi\fi\fi 3125} 3126\def\wordafter{after} 3127\def\wordbefore{before} 3128\def\wordnone{none} 3129 3130% Allow a ragged right output to aid breaking long URL's. There can 3131% be a break at the \allowbreak with no extra glue (if the existing stretch in 3132% the line is sufficient), a break at the \penalty with extra glue added 3133% at the end of the line, or no break at all here. 3134% Changing the value of the penalty and/or the amount of stretch affects how 3135% preferable one choice is over the other. 3136\def\urefallowbreak{% 3137 \penalty0\relax 3138 \hskip 0pt plus 2 em\relax 3139 \penalty1000\relax 3140 \hskip 0pt plus -2 em\relax 3141} 3142 3143\urefbreakstyle after 3144 3145% @url synonym for @uref, since that's how everyone uses it. 3146% 3147\let\url=\uref 3148 3149% rms does not like angle brackets --karl, 17may97. 3150% So now @email is just like @uref, unless we are pdf. 3151% 3152%\def\email#1{\angleleft{\tt #1}\angleright} 3153\ifpdforxetex 3154 \def\email#1{\doemail#1,,\finish} 3155 \def\doemail#1,#2,#3\finish{\begingroup 3156 \unsepspaces 3157 \pdfurl{mailto:#1}% 3158 \setbox0 = \hbox{\ignorespaces #2}% 3159 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi 3160 \endlink 3161 \endgroup} 3162\else 3163 \let\email=\uref 3164\fi 3165 3166% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), 3167% `example' (@kbd uses ttsl only inside of @example and friends), 3168% or `code' (@kbd uses normal tty font always). 3169\parseargdef\kbdinputstyle{% 3170 \def\txiarg{#1}% 3171 \ifx\txiarg\worddistinct 3172 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% 3173 \else\ifx\txiarg\wordexample 3174 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% 3175 \else\ifx\txiarg\wordcode 3176 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% 3177 \else 3178 \errhelp = \EMsimple 3179 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% 3180 \fi\fi\fi 3181} 3182\def\worddistinct{distinct} 3183\def\wordexample{example} 3184\def\wordcode{code} 3185 3186% Default is `distinct'. 3187\kbdinputstyle distinct 3188 3189\def\kbd#1{% 3190 \tclose{\kbdfont\setcodequotes#1}% 3191} 3192 3193% definition of @key that produces a lozenge. Doesn't adjust to text size. 3194%\setfont\keyrm\rmshape{8}{1000}{OT1} 3195%\font\keysy=cmsy9 3196%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% 3197% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% 3198% \vbox{\hrule\kern-0.4pt 3199% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% 3200% \kern-0.4pt\hrule}% 3201% \kern-.06em\raise0.4pt\hbox{\angleright}}}} 3202 3203% definition of @key with no lozenge. 3204% 3205\def\key#1{{\setregularquotes \nohyphenation \tt #1}\null} 3206 3207% @clicksequence{File @click{} Open ...} 3208\def\clicksequence#1{\begingroup #1\endgroup} 3209 3210% @clickstyle @arrow (by default) 3211\parseargdef\clickstyle{\def\click{#1}} 3212\def\click{\arrow} 3213 3214% Typeset a dimension, e.g., `in' or `pt'. The only reason for the 3215% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. 3216% 3217\def\dmn#1{\thinspace #1} 3218 3219% @acronym for "FBI", "NATO", and the like. 3220% We print this one point size smaller, since it's intended for 3221% all-uppercase. 3222% 3223\def\acronym#1{\doacronym #1,,\finish} 3224\def\doacronym#1,#2,#3\finish{% 3225 {\switchtolsize #1}% 3226 \def\temp{#2}% 3227 \ifx\temp\empty \else 3228 \space ({\unsepspaces \ignorespaces \temp \unskip})% 3229 \fi 3230 \null % reset \spacefactor=1000 3231} 3232 3233% @abbr for "Comput. J." and the like. 3234% No font change, but don't do end-of-sentence spacing. 3235% 3236\def\abbr#1{\doabbr #1,,\finish} 3237\def\doabbr#1,#2,#3\finish{% 3238 {\plainfrenchspacing #1}% 3239 \def\temp{#2}% 3240 \ifx\temp\empty \else 3241 \space ({\unsepspaces \ignorespaces \temp \unskip})% 3242 \fi 3243 \null % reset \spacefactor=1000 3244} 3245 3246% @asis just yields its argument. Used with @table, for example. 3247% 3248\def\asis#1{#1} 3249 3250% @math outputs its argument in math mode. 3251% 3252% One complication: _ usually means subscripts, but it could also mean 3253% an actual _ character, as in @math{@var{some_variable} + 1}. So make 3254% _ active, and distinguish by seeing if the current family is \slfam, 3255% which is what @var uses. 3256{ 3257 \catcode`\_ = \active 3258 \gdef\mathunderscore{% 3259 \catcode`\_=\active 3260 \def_{\ifnum\fam=\slfam \_\else\sb\fi}% 3261 } 3262} 3263% Another complication: we want \\ (and @\) to output a math (or tt) \. 3264% FYI, plain.tex uses \\ as a temporary control sequence (for no 3265% particular reason), but this is not advertised and we don't care. 3266% 3267% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. 3268\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} 3269% 3270\def\math{% 3271 \ifmmode\else % only go into math if not in math mode already 3272 \tex 3273 \mathunderscore 3274 \let\\ = \mathbackslash 3275 \mathactive 3276 % make the texinfo accent commands work in math mode 3277 \let\"=\ddot 3278 \let\'=\acute 3279 \let\==\bar 3280 \let\^=\hat 3281 \let\`=\grave 3282 \let\u=\breve 3283 \let\v=\check 3284 \let\~=\tilde 3285 \let\dotaccent=\dot 3286 % have to provide another name for sup operator 3287 \let\mathopsup=\sup 3288 $\expandafter\finishmath\fi 3289} 3290\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. 3291 3292% Some active characters (such as <) are spaced differently in math. 3293% We have to reset their definitions in case the @math was an argument 3294% to a command which sets the catcodes (such as @item or @section). 3295% 3296{ 3297 \catcode`^ = \active 3298 \catcode`< = \active 3299 \catcode`> = \active 3300 \catcode`+ = \active 3301 \catcode`' = \active 3302 \gdef\mathactive{% 3303 \let^ = \ptexhat 3304 \let< = \ptexless 3305 \let> = \ptexgtr 3306 \let+ = \ptexplus 3307 \let' = \ptexquoteright 3308 } 3309} 3310 3311% for @sub and @sup, if in math mode, just do a normal sub/superscript. 3312% If in text, use math to place as sub/superscript, but switch 3313% into text mode, with smaller fonts. This is a different font than the 3314% one used for real math sub/superscripts (8pt vs. 7pt), but let's not 3315% fix it (significant additions to font machinery) until someone notices. 3316% 3317\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi} 3318\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}% 3319% 3320\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi} 3321\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}% 3322 3323% provide this command from LaTeX as it is very common 3324\def\frac#1#2{{{#1}\over{#2}}} 3325 3326% @displaymath. 3327% \globaldefs is needed to recognize the end lines in \tex and 3328% \end tex. Set \thisenv as @end displaymath is seen before @end tex. 3329{\obeylines 3330\globaldefs=1 3331\envdef\displaymath{% 3332\tex% 3333\def\thisenv{\displaymath}% 3334\begingroup\let\end\displaymathend% 3335$$% 3336} 3337 3338\def\displaymathend{$$\endgroup\end}% 3339 3340\def\Edisplaymath{% 3341\def\thisenv{\tex}% 3342\end tex 3343}} 3344 3345 3346% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. 3347% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, 3348% except specified as a normal braced arg, so no newlines to worry about. 3349% 3350\def\outfmtnametex{tex} 3351% 3352\long\def\inlinefmt#1{\doinlinefmt #1,\finish} 3353\long\def\doinlinefmt#1,#2,\finish{% 3354 \def\inlinefmtname{#1}% 3355 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi 3356} 3357% 3358% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if 3359% FMTNAME is tex, else ELSE-TEXT. 3360\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish} 3361\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{% 3362 \def\inlinefmtname{#1}% 3363 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi 3364} 3365% 3366% For raw, must switch into @tex before parsing the argument, to avoid 3367% setting catcodes prematurely. Doing it this way means that, for 3368% example, @inlineraw{html, foo{bar} gets a parse error instead of being 3369% ignored. But this isn't important because if people want a literal 3370% *right* brace they would have to use a command anyway, so they may as 3371% well use a command to get a left brace too. We could re-use the 3372% delimiter character idea from \verb, but it seems like overkill. 3373% 3374\long\def\inlineraw{\tex \doinlineraw} 3375\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} 3376\def\doinlinerawtwo#1,#2,\finish{% 3377 \def\inlinerawname{#1}% 3378 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi 3379 \endgroup % close group opened by \tex. 3380} 3381 3382% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set. 3383% 3384\long\def\inlineifset#1{\doinlineifset #1,\finish} 3385\long\def\doinlineifset#1,#2,\finish{% 3386 \def\inlinevarname{#1}% 3387 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax 3388 \else\ignorespaces#2\fi 3389} 3390 3391% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set. 3392% 3393\long\def\inlineifclear#1{\doinlineifclear #1,\finish} 3394\long\def\doinlineifclear#1,#2,\finish{% 3395 \def\inlinevarname{#1}% 3396 \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi 3397} 3398 3399 3400\message{glyphs,} 3401% and logos. 3402 3403% @@ prints an @, as does @atchar{}. 3404\def\@{\char64 } 3405\let\atchar=\@ 3406 3407% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. 3408\def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}} 3409\def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}} 3410\let\{=\lbracechar 3411\let\}=\rbracechar 3412 3413% @comma{} to avoid , parsing problems. 3414\let\comma = , 3415 3416% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent 3417% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. 3418\let\, = \ptexc 3419\let\dotaccent = \ptexdot 3420\def\ringaccent#1{{\accent23 #1}} 3421\let\tieaccent = \ptext 3422\let\ubaraccent = \ptexb 3423\let\udotaccent = \d 3424 3425% Other special characters: @questiondown @exclamdown @ordf @ordm 3426% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. 3427\def\questiondown{?`} 3428\def\exclamdown{!`} 3429\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}} 3430\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}} 3431 3432% Dotless i and dotless j, used for accents. 3433\def\imacro{i} 3434\def\jmacro{j} 3435\def\dotless#1{% 3436 \def\temp{#1}% 3437 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi 3438 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi 3439 \else \errmessage{@dotless can be used only with i or j}% 3440 \fi\fi 3441} 3442 3443% The \TeX{} logo, as in plain, but resetting the spacing so that a 3444% period following counts as ending a sentence. (Idea found in latex.) 3445% 3446\edef\TeX{\TeX \spacefactor=1000 } 3447 3448% @LaTeX{} logo. Not quite the same results as the definition in 3449% latex.ltx, since we use a different font for the raised A; it's most 3450% convenient for us to use an explicitly smaller font, rather than using 3451% the \scriptstyle font (since we don't reset \scriptstyle and 3452% \scriptscriptstyle). 3453% 3454\def\LaTeX{% 3455 L\kern-.36em 3456 {\setbox0=\hbox{T}% 3457 \vbox to \ht0{\hbox{% 3458 \ifx\textnominalsize\xwordpt 3459 % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX. 3460 % Revert to plain's \scriptsize, which is 7pt. 3461 \count255=\the\fam $\fam\count255 \scriptstyle A$% 3462 \else 3463 \ifx\curfontsize\smallword 3464 % For footnotes and indices 3465 \count255=\the\fam $\fam\count255 \scriptstyle A$% 3466 \else 3467 % For 11pt, we can use our lllsize. 3468 \switchtolllsize A% 3469 \fi 3470 \fi 3471 }% 3472 \vss 3473 }}% 3474 \kern-.15em 3475 \TeX 3476} 3477\def\smallword{small} 3478 3479% Some math mode symbols. Define \ensuremath to switch into math mode 3480% unless we are already there. Expansion tricks may not be needed here, 3481% but safer, and can't hurt. 3482\def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi} 3483\def\ensuredmath#1{$\relax#1$} 3484% 3485\def\bullet{\ensuremath\ptexbullet} 3486\def\geq{\ensuremath\ge} 3487\def\leq{\ensuremath\le} 3488\def\minus{\ensuremath-} 3489 3490% @dots{} outputs an ellipsis using the current font. 3491% We do .5em per period so that it has the same spacing in the cm 3492% typewriter fonts as three actual period characters; on the other hand, 3493% in other typewriter fonts three periods are wider than 1.5em. So do 3494% whichever is larger. 3495% 3496\def\dots{% 3497 \leavevmode 3498 \setbox0=\hbox{...}% get width of three periods 3499 \ifdim\wd0 > 1.5em 3500 \dimen0 = \wd0 3501 \else 3502 \dimen0 = 1.5em 3503 \fi 3504 \hbox to \dimen0{% 3505 \hskip 0pt plus.25fil 3506 .\hskip 0pt plus1fil 3507 .\hskip 0pt plus1fil 3508 .\hskip 0pt plus.5fil 3509 }% 3510} 3511 3512% @enddots{} is an end-of-sentence ellipsis. 3513% 3514\def\enddots{% 3515 \dots 3516 \spacefactor=\endofsentencespacefactor 3517} 3518 3519% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. 3520% 3521% Since these characters are used in examples, they should be an even number of 3522% \tt widths. Each \tt character is 1en, so two makes it 1em. 3523% 3524\def\point{$\star$} 3525\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} 3526\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} 3527\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} 3528\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} 3529\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} 3530 3531% The @error{} command. 3532% Adapted from the TeXbook's \boxit. 3533% 3534\newbox\errorbox 3535% 3536{\ttfont \global\dimen0 = 3em}% Width of the box. 3537\dimen2 = .55pt % Thickness of rules 3538% The text. (`r' is open on the right, `e' somewhat less so on the left.) 3539\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} 3540% 3541\setbox\errorbox=\hbox to \dimen0{\hfil 3542 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. 3543 \advance\hsize by -2\dimen2 % Rules. 3544 \vbox{% 3545 \hrule height\dimen2 3546 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. 3547 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. 3548 \kern3pt\vrule width\dimen2}% Space to right. 3549 \hrule height\dimen2} 3550 \hfil} 3551% 3552\def\error{\leavevmode\lower.7ex\copy\errorbox} 3553 3554% @pounds{} is a sterling sign, which Knuth put in the CM italic font. 3555% 3556\def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}} 3557 3558% @euro{} comes from a separate font, depending on the current style. 3559% We use the free feym* fonts from the eurosym package by Henrik 3560% Theiling, which support regular, slanted, bold and bold slanted (and 3561% "outlined" (blackboard board, sort of) versions, which we don't need). 3562% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. 3563% 3564% Although only regular is the truly official Euro symbol, we ignore 3565% that. The Euro is designed to be slightly taller than the regular 3566% font height. 3567% 3568% feymr - regular 3569% feymo - slanted 3570% feybr - bold 3571% feybo - bold slanted 3572% 3573% There is no good (free) typewriter version, to my knowledge. 3574% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. 3575% Hmm. 3576% 3577% Also doesn't work in math. Do we need to do math with euro symbols? 3578% Hope not. 3579% 3580% 3581\def\euro{{\eurofont e}} 3582\def\eurofont{% 3583 % We set the font at each command, rather than predefining it in 3584 % \textfonts and the other font-switching commands, so that 3585 % installations which never need the symbol don't have to have the 3586 % font installed. 3587 % 3588 % There is only one designed size (nominal 10pt), so we always scale 3589 % that to the current nominal size. 3590 % 3591 % By the way, simply using "at 1em" works for cmr10 and the like, but 3592 % does not work for cmbx10 and other extended/shrunken fonts. 3593 % 3594 \def\eurosize{\csname\curfontsize nominalsize\endcsname}% 3595 % 3596 \ifx\curfontstyle\bfstylename 3597 % bold: 3598 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize 3599 \else 3600 % regular: 3601 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize 3602 \fi 3603 \thiseurofont 3604} 3605 3606% Glyphs from the EC fonts. We don't use \let for the aliases, because 3607% sometimes we redefine the original macro, and the alias should reflect 3608% the redefinition. 3609% 3610% Use LaTeX names for the Icelandic letters. 3611\def\DH{{\ecfont \char"D0}} % Eth 3612\def\dh{{\ecfont \char"F0}} % eth 3613\def\TH{{\ecfont \char"DE}} % Thorn 3614\def\th{{\ecfont \char"FE}} % thorn 3615% 3616\def\guillemetleft{{\ecfont \char"13}} 3617\def\guillemotleft{\guillemetleft} 3618\def\guillemetright{{\ecfont \char"14}} 3619\def\guillemotright{\guillemetright} 3620\def\guilsinglleft{{\ecfont \char"0E}} 3621\def\guilsinglright{{\ecfont \char"0F}} 3622\def\quotedblbase{{\ecfont \char"12}} 3623\def\quotesinglbase{{\ecfont \char"0D}} 3624% 3625\def\L{{\ecfont \char"8A}} % L with stroke 3626\def\l{{\ecfont \char"AA}} % l with stroke 3627% 3628% This positioning is not perfect (see the ogonek LaTeX package), but 3629% we have the precomposed glyphs for the most common cases. We put the 3630% tests to use those glyphs in the single \ogonek macro so we have fewer 3631% dummy definitions to worry about for index entries, etc. 3632% 3633% ogonek is also used with other letters in Lithuanian (IOU), but using 3634% the precomposed glyphs for those is not so easy since they aren't in 3635% the same EC font. 3636\def\ogonek#1{{% 3637 \def\temp{#1}% 3638 \ifx\temp\macrocharA\Aogonek 3639 \else\ifx\temp\macrochara\aogonek 3640 \else\ifx\temp\macrocharE\Eogonek 3641 \else\ifx\temp\macrochare\eogonek 3642 \else 3643 \ecfont \setbox0=\hbox{#1}% 3644 \ifdim\ht0=1ex\accent"0C #1% 3645 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% 3646 \fi 3647 \fi\fi\fi\fi 3648 }% 3649} 3650\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} 3651\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} 3652\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} 3653\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} 3654% 3655% Use the European Computer Modern fonts (cm-super in outline format) 3656% for non-CM glyphs. That is ec* for regular text and tc* for the text 3657% companion symbols (LaTeX TS1 encoding). Both are part of the ec 3658% package and follow the same conventions. 3659% 3660\def\ecfont{\etcfont{e}} 3661\def\tcfont{\etcfont{t}} 3662% 3663\def\etcfont#1{% 3664 % We can't distinguish serif/sans and italic/slanted, but this 3665 % is used for crude hacks anyway (like adding French and German 3666 % quotes to documents typeset with CM, where we lose kerning), so 3667 % hopefully nobody will notice/care. 3668 \edef\ecsize{\csname\curfontsize ecsize\endcsname}% 3669 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% 3670 \ifusingtt 3671 % typewriter: 3672 {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}% 3673 % else 3674 {\ifx\curfontstyle\bfstylename 3675 % bold: 3676 \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize 3677 \else 3678 % regular: 3679 \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize 3680 \fi}% 3681 \thisecfont 3682} 3683 3684% @registeredsymbol - R in a circle. The font for the R should really 3685% be smaller yet, but lllsize is the best we can do for now. 3686% Adapted from the plain.tex definition of \copyright. 3687% 3688\def\registeredsymbol{% 3689 $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}% 3690 \hfil\crcr\Orb}}% 3691 }$% 3692} 3693 3694% @textdegree - the normal degrees sign. 3695% 3696\def\textdegree{% 3697 \ifmmode ^\circ 3698 \else {\tcfont \char 176}% 3699 \fi} 3700 3701% Laurent Siebenmann reports \Orb undefined with: 3702% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 3703% so we'll define it if necessary. 3704% 3705\ifx\Orb\thisisundefined 3706\def\Orb{\mathhexbox20D} 3707\fi 3708 3709% Quotes. 3710\chardef\quoteleft=`\` 3711\chardef\quoteright=`\' 3712 3713% only change font for tt for correct kerning and to avoid using 3714% \ecfont unless necessary. 3715\def\quotedblleft{% 3716 \ifusingtt{{\ecfont\char"10}}{{\char"5C}}% 3717} 3718 3719\def\quotedblright{% 3720 \ifusingtt{{\ecfont\char"11}}{{\char`\"}}% 3721} 3722 3723 3724\message{page headings,} 3725 3726\newskip\titlepagetopglue \titlepagetopglue = 1.5in 3727\newskip\titlepagebottomglue \titlepagebottomglue = 2pc 3728 3729% First the title page. Must do @settitle before @titlepage. 3730\newif\ifseenauthor 3731\newif\iffinishedtitlepage 3732 3733% @setcontentsaftertitlepage used to do an implicit @contents or 3734% @shortcontents after @end titlepage, but it is now obsolete. 3735\def\setcontentsaftertitlepage{% 3736 \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo 3737 command; move your @contents command if you want the contents 3738 after the title page.}}% 3739\def\setshortcontentsaftertitlepage{% 3740 \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo 3741 command; move your @shortcontents and @contents commands if you 3742 want the contents after the title page.}}% 3743 3744\parseargdef\shorttitlepage{% 3745 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% 3746 \endgroup\page\hbox{}\page} 3747 3748\envdef\titlepage{% 3749 % Open one extra group, as we want to close it in the middle of \Etitlepage. 3750 \begingroup 3751 \parindent=0pt \textfonts 3752 \headingsoff 3753 % Leave some space at the very top of the page. 3754 \vglue\titlepagetopglue 3755 % No rule at page bottom unless we print one at the top with @title. 3756 \finishedtitlepagetrue 3757 % 3758 % Most title ``pages'' are actually two pages long, with space 3759 % at the top of the second. We don't want the ragged left on the second. 3760 \let\oldpage = \page 3761 \def\page{% 3762 \iffinishedtitlepage\else 3763 \finishtitlepage 3764 \fi 3765 \let\page = \oldpage 3766 \page 3767 \null 3768 }% 3769} 3770 3771\def\Etitlepage{% 3772 \iffinishedtitlepage\else 3773 \finishtitlepage 3774 \fi 3775 % It is important to do the page break before ending the group, 3776 % because the headline and footline are only empty inside the group. 3777 % If we use the new definition of \page, we always get a blank page 3778 % after the title page, which we certainly don't want. 3779 \oldpage 3780 \pageone 3781 \endgroup 3782 % 3783} 3784 3785\def\finishtitlepage{% 3786 \vskip4pt \hrule height 2pt width \hsize 3787 \vskip\titlepagebottomglue 3788 \finishedtitlepagetrue 3789} 3790 3791% Settings used for typesetting titles: no hyphenation, no indentation, 3792% don't worry much about spacing, ragged right. This should be used 3793% inside a \vbox, and fonts need to be set appropriately first. \par should 3794% be specified before the end of the \vbox, since a vbox is a group. 3795% 3796\def\raggedtitlesettings{% 3797 \rm 3798 \hyphenpenalty=10000 3799 \parindent=0pt 3800 \tolerance=5000 3801 \ptexraggedright 3802} 3803 3804% Macros to be used within @titlepage: 3805 3806\let\subtitlerm=\rmfont 3807\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} 3808 3809\parseargdef\title{% 3810 \checkenv\titlepage 3811 \vbox{\titlefonts \raggedtitlesettings #1\par}% 3812 % print a rule at the page bottom also. 3813 \finishedtitlepagefalse 3814 \vskip4pt \hrule height 4pt width \hsize \vskip4pt 3815} 3816 3817\parseargdef\subtitle{% 3818 \checkenv\titlepage 3819 {\subtitlefont \rightline{#1}}% 3820} 3821 3822% @author should come last, but may come many times. 3823% It can also be used inside @quotation. 3824% 3825\parseargdef\author{% 3826 \def\temp{\quotation}% 3827 \ifx\thisenv\temp 3828 \def\quotationauthor{#1}% printed in \Equotation. 3829 \else 3830 \checkenv\titlepage 3831 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi 3832 {\secfonts\rm \leftline{#1}}% 3833 \fi 3834} 3835 3836 3837% Set up page headings and footings. 3838 3839\let\thispage=\folio 3840 3841\newtoks\evenheadline % headline on even pages 3842\newtoks\oddheadline % headline on odd pages 3843\newtoks\evenchapheadline% headline on even pages with a new chapter 3844\newtoks\oddchapheadline % headline on odd pages with a new chapter 3845\newtoks\evenfootline % footline on even pages 3846\newtoks\oddfootline % footline on odd pages 3847 3848% Now make \makeheadline and \makefootline in Plain TeX use those variables 3849\headline={{\textfonts\rm\frenchspacingsetting 3850 \ifchapterpage 3851 \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi 3852 \else 3853 \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi 3854 \fi}} 3855 3856\footline={{\textfonts\rm\frenchspacingsetting 3857 \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}% 3858 \HEADINGShook} 3859\let\HEADINGShook=\relax 3860 3861% Commands to set those variables. 3862% For example, this is what @headings on does 3863% @evenheading @thistitle|@thispage|@thischapter 3864% @oddheading @thischapter|@thispage|@thistitle 3865% @evenfooting @thisfile|| 3866% @oddfooting ||@thisfile 3867 3868 3869\def\evenheading{\parsearg\evenheadingxxx} 3870\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} 3871\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% 3872 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}} 3873 \global\evenchapheadline=\evenheadline} 3874 3875\def\oddheading{\parsearg\oddheadingxxx} 3876\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} 3877\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% 3878 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}% 3879 \global\oddchapheadline=\oddheadline} 3880 3881\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% 3882 3883\def\evenfooting{\parsearg\evenfootingxxx} 3884\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} 3885\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% 3886\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 3887 3888\def\oddfooting{\parsearg\oddfootingxxx} 3889\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} 3890\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% 3891 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% 3892 % 3893 % Leave some space for the footline. Hopefully ok to assume 3894 % @evenfooting will not be used by itself. 3895 \global\advance\txipageheight by -12pt 3896 \global\advance\vsize by -12pt 3897} 3898 3899\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} 3900 3901% @evenheadingmarks top \thischapter <- chapter at the top of a page 3902% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page 3903% 3904% The same set of arguments for: 3905% 3906% @oddheadingmarks 3907% @evenfootingmarks 3908% @oddfootingmarks 3909% @everyheadingmarks 3910% @everyfootingmarks 3911 3912% These define \getoddheadingmarks, \getevenheadingmarks, 3913% \getoddfootingmarks, and \getevenfootingmarks, each to one of 3914% \gettopheadingmarks, \getbottomheadingmarks. 3915% 3916\def\evenheadingmarks{\headingmarks{even}{heading}} 3917\def\oddheadingmarks{\headingmarks{odd}{heading}} 3918\def\evenfootingmarks{\headingmarks{even}{footing}} 3919\def\oddfootingmarks{\headingmarks{odd}{footing}} 3920\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1} 3921 \headingmarks{odd}{heading}{#1} } 3922\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1} 3923 \headingmarks{odd}{footing}{#1} } 3924% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. 3925\def\headingmarks#1#2#3 {% 3926 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname 3927 \global\expandafter\let\csname get#1#2marks\endcsname \temp 3928} 3929 3930\everyheadingmarks bottom 3931\everyfootingmarks bottom 3932 3933% @headings double turns headings on for double-sided printing. 3934% @headings single turns headings on for single-sided printing. 3935% @headings off turns them off. 3936% @headings on same as @headings double, retained for compatibility. 3937% @headings after turns on double-sided headings after this page. 3938% @headings doubleafter turns on double-sided headings after this page. 3939% @headings singleafter turns on single-sided headings after this page. 3940% By default, they are off at the start of a document, 3941% and turned `on' after @end titlepage. 3942 3943\parseargdef\headings{\csname HEADINGS#1\endcsname} 3944 3945\def\headingsoff{% non-global headings elimination 3946 \evenheadline={\hfil}\evenfootline={\hfil}\evenchapheadline={\hfil}% 3947 \oddheadline={\hfil}\oddfootline={\hfil}\oddchapheadline={\hfil}% 3948} 3949 3950\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting 3951 3952% When we turn headings on, set the page number to 1. 3953\def\pageone{ 3954 \global\pageno=1 3955 \global\arabiccount = \pagecount 3956} 3957 3958% For double-sided printing, put current file name in lower left corner, 3959% chapter name on inside top of right hand pages, document 3960% title on inside top of left hand pages, and page numbers on outside top 3961% edge of all pages. 3962\def\HEADINGSdouble{% 3963\pageone 3964\HEADINGSdoublex 3965} 3966\let\contentsalignmacro = \chappager 3967 3968% For single-sided printing, chapter title goes across top left of page, 3969% page number on top right. 3970\def\HEADINGSsingle{% 3971\pageone 3972\HEADINGSsinglex 3973} 3974% \def\HEADINGSon{\HEADINGSdouble} % defined by \CHAPPAGon 3975 3976\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} 3977\let\HEADINGSdoubleafter=\HEADINGSafter 3978\def\HEADINGSdoublex{% 3979\global\evenfootline={\hfil} 3980\global\oddfootline={\hfil} 3981\global\evenheadline={\line{\folio\hfil\thistitle}} 3982\global\oddheadline={\line{\thischapter\hfil\folio}} 3983\global\evenchapheadline={\line{\folio\hfil\thistitle}} 3984\global\oddchapheadline={\line{\hfil\folio}} 3985\global\let\contentsalignmacro = \chapoddpage 3986} 3987 3988\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} 3989\def\HEADINGSsinglex{% 3990\global\evenfootline={\hfil} 3991\global\oddfootline={\hfil} 3992\global\evenheadline={\line{\thischapter\hfil\folio}} 3993\global\oddheadline={\line{\thischapter\hfil\folio}} 3994\global\evenchapheadline={\line{\hfil\folio}} 3995\global\oddchapheadline={\line{\hfil\folio}} 3996\global\let\contentsalignmacro = \chappager 3997} 3998 3999% for @setchapternewpage off 4000\def\HEADINGSsinglechapoff{% 4001\pageone 4002\global\evenfootline={\hfil} 4003\global\oddfootline={\hfil} 4004\global\evenheadline={\line{\thischapter\hfil\folio}} 4005\global\oddheadline={\line{\thischapter\hfil\folio}} 4006\global\evenchapheadline=\evenheadline 4007\global\oddchapheadline=\oddheadline 4008\global\let\contentsalignmacro = \chappager 4009} 4010 4011% Subroutines used in generating headings 4012% This produces Day Month Year style of output. 4013% Only define if not already defined, in case a txi-??.tex file has set 4014% up a different format (e.g., txi-cs.tex does this). 4015\ifx\today\thisisundefined 4016\def\today{% 4017 \number\day\space 4018 \ifcase\month 4019 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr 4020 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug 4021 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec 4022 \fi 4023 \space\number\year} 4024\fi 4025 4026% @settitle line... specifies the title of the document, for headings. 4027% It generates no output of its own. 4028\def\thistitle{\putwordNoTitle} 4029\def\settitle{\parsearg{\gdef\thistitle}} 4030 4031 4032\message{tables,} 4033% Tables -- @table, @ftable, @vtable, @item(x). 4034 4035% default indentation of table text 4036\newdimen\tableindent \tableindent=.8in 4037% default indentation of @itemize and @enumerate text 4038\newdimen\itemindent \itemindent=.3in 4039% margin between end of table item and start of table text. 4040\newdimen\itemmargin \itemmargin=.1in 4041 4042% used internally for \itemindent minus \itemmargin 4043\newdimen\itemmax 4044 4045% Note @table, @ftable, and @vtable define @item, @itemx, etc., with 4046% these defs. 4047% They also define \itemindex 4048% to index the item name in whatever manner is desired (perhaps none). 4049 4050\newif\ifitemxneedsnegativevskip 4051 4052\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} 4053 4054\def\internalBitem{\smallbreak \parsearg\itemzzz} 4055\def\internalBitemx{\itemxpar \parsearg\itemzzz} 4056 4057\def\itemzzz #1{\begingroup % 4058 \advance\hsize by -\rightskip 4059 \advance\hsize by -\tableindent 4060 \setbox0=\hbox{\itemindicate{#1}}% 4061 \itemindex{#1}% 4062 \nobreak % This prevents a break before @itemx. 4063 % 4064 % If the item text does not fit in the space we have, put it on a line 4065 % by itself, and do not allow a page break either before or after that 4066 % line. We do not start a paragraph here because then if the next 4067 % command is, e.g., @kindex, the whatsit would get put into the 4068 % horizontal list on a line by itself, resulting in extra blank space. 4069 \ifdim \wd0>\itemmax 4070 % 4071 % Make this a paragraph so we get the \parskip glue and wrapping, 4072 % but leave it ragged-right. 4073 \begingroup 4074 \advance\leftskip by-\tableindent 4075 \advance\hsize by\tableindent 4076 \advance\rightskip by0pt plus1fil\relax 4077 \leavevmode\unhbox0\par 4078 \endgroup 4079 % 4080 % We're going to be starting a paragraph, but we don't want the 4081 % \parskip glue -- logically it's part of the @item we just started. 4082 \nobreak \vskip-\parskip 4083 % 4084 % Stop a page break at the \parskip glue coming up. However, if 4085 % what follows is an environment such as @example, there will be no 4086 % \parskip glue; then the negative vskip we just inserted would 4087 % cause the example and the item to crash together. So we use this 4088 % bizarre value of 10001 as a signal to \aboveenvbreak to insert 4089 % \parskip glue after all. Section titles are handled this way also. 4090 % 4091 \penalty 10001 4092 \endgroup 4093 \itemxneedsnegativevskipfalse 4094 \else 4095 % The item text fits into the space. Start a paragraph, so that the 4096 % following text (if any) will end up on the same line. 4097 \noindent 4098 % Do this with kerns and \unhbox so that if there is a footnote in 4099 % the item text, it can migrate to the main vertical list and 4100 % eventually be printed. 4101 \nobreak\kern-\tableindent 4102 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 4103 \unhbox0 4104 \nobreak\kern\dimen0 4105 \endgroup 4106 \itemxneedsnegativevskiptrue 4107 \fi 4108} 4109 4110\def\item{\errmessage{@item while not in a list environment}} 4111\def\itemx{\errmessage{@itemx while not in a list environment}} 4112 4113% @table, @ftable, @vtable. 4114\envdef\table{% 4115 \let\itemindex\gobble 4116 \tablecheck{table}% 4117} 4118\envdef\ftable{% 4119 \def\itemindex ##1{\doind {fn}{\code{##1}}}% 4120 \tablecheck{ftable}% 4121} 4122\envdef\vtable{% 4123 \def\itemindex ##1{\doind {vr}{\code{##1}}}% 4124 \tablecheck{vtable}% 4125} 4126\def\tablecheck#1{% 4127 \ifnum \the\catcode`\^^M=\active 4128 \endgroup 4129 \errmessage{This command won't work in this context; perhaps the problem is 4130 that we are \inenvironment\thisenv}% 4131 \def\next{\doignore{#1}}% 4132 \else 4133 \let\next\tablex 4134 \fi 4135 \next 4136} 4137\def\tablex#1{% 4138 \def\itemindicate{#1}% 4139 \parsearg\tabley 4140} 4141\def\tabley#1{% 4142 {% 4143 \makevalueexpandable 4144 \edef\temp{\noexpand\tablez #1\space\space\space}% 4145 \expandafter 4146 }\temp \endtablez 4147} 4148\def\tablez #1 #2 #3 #4\endtablez{% 4149 \aboveenvbreak 4150 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi 4151 \ifnum 0#2>0 \tableindent=#2\mil \fi 4152 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi 4153 \itemmax=\tableindent 4154 \advance \itemmax by -\itemmargin 4155 \advance \leftskip by \tableindent 4156 \exdentamount=\tableindent 4157 \parindent = 0pt 4158 \parskip = \smallskipamount 4159 \ifdim \parskip=0pt \parskip=2pt \fi 4160 \let\item = \internalBitem 4161 \let\itemx = \internalBitemx 4162} 4163\def\Etable{\endgraf\afterenvbreak} 4164\let\Eftable\Etable 4165\let\Evtable\Etable 4166\let\Eitemize\Etable 4167\let\Eenumerate\Etable 4168 4169% This is the counter used by @enumerate, which is really @itemize 4170 4171\newcount \itemno 4172 4173\envdef\itemize{\parsearg\doitemize} 4174 4175\def\doitemize#1{% 4176 \aboveenvbreak 4177 \itemmax=\itemindent 4178 \advance\itemmax by -\itemmargin 4179 \advance\leftskip by \itemindent 4180 \exdentamount=\itemindent 4181 \parindent=0pt 4182 \parskip=\smallskipamount 4183 \ifdim\parskip=0pt \parskip=2pt \fi 4184 % 4185 % Try typesetting the item mark so that if the document erroneously says 4186 % something like @itemize @samp (intending @table), there's an error 4187 % right away at the @itemize. It's not the best error message in the 4188 % world, but it's better than leaving it to the @item. This means if 4189 % the user wants an empty mark, they have to say @w{} not just @w. 4190 \def\itemcontents{#1}% 4191 \setbox0 = \hbox{\itemcontents}% 4192 % 4193 % @itemize with no arg is equivalent to @itemize @bullet. 4194 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi 4195 % 4196 \let\item=\itemizeitem 4197} 4198 4199% Definition of @item while inside @itemize and @enumerate. 4200% 4201\def\itemizeitem{% 4202 \advance\itemno by 1 % for enumerations 4203 {\let\par=\endgraf \smallbreak}% reasonable place to break 4204 {% 4205 % If the document has an @itemize directly after a section title, a 4206 % \nobreak will be last on the list, and \sectionheading will have 4207 % done a \vskip-\parskip. In that case, we don't want to zero 4208 % parskip, or the item text will crash with the heading. On the 4209 % other hand, when there is normal text preceding the item (as there 4210 % usually is), we do want to zero parskip, or there would be too much 4211 % space. In that case, we won't have a \nobreak before. At least 4212 % that's the theory. 4213 \ifnum\lastpenalty<10000 \parskip=0in \fi 4214 \noindent 4215 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% 4216 % 4217 \ifinner\else 4218 \vadjust{\penalty 1200}% not good to break after first line of item. 4219 \fi 4220 % We can be in inner vertical mode in a footnote, although an 4221 % @itemize looks awful there. 4222 }% 4223 \flushcr 4224} 4225 4226% \splitoff TOKENS\endmark defines \first to be the first token in 4227% TOKENS, and \rest to be the remainder. 4228% 4229\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% 4230 4231% Allow an optional argument of an uppercase letter, lowercase letter, 4232% or number, to specify the first label in the enumerated list. No 4233% argument is the same as `1'. 4234% 4235\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} 4236\def\enumeratey #1 #2\endenumeratey{% 4237 % If we were given no argument, pretend we were given `1'. 4238 \def\thearg{#1}% 4239 \ifx\thearg\empty \def\thearg{1}\fi 4240 % 4241 % Detect if the argument is a single token. If so, it might be a 4242 % letter. Otherwise, the only valid thing it can be is a number. 4243 % (We will always have one token, because of the test we just made. 4244 % This is a good thing, since \splitoff doesn't work given nothing at 4245 % all -- the first parameter is undelimited.) 4246 \expandafter\splitoff\thearg\endmark 4247 \ifx\rest\empty 4248 % Only one token in the argument. It could still be anything. 4249 % A ``lowercase letter'' is one whose \lccode is nonzero. 4250 % An ``uppercase letter'' is one whose \lccode is both nonzero, and 4251 % not equal to itself. 4252 % Otherwise, we assume it's a number. 4253 % 4254 % We need the \relax at the end of the \ifnum lines to stop TeX from 4255 % continuing to look for a <number>. 4256 % 4257 \ifnum\lccode\expandafter`\thearg=0\relax 4258 \numericenumerate % a number (we hope) 4259 \else 4260 % It's a letter. 4261 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax 4262 \lowercaseenumerate % lowercase letter 4263 \else 4264 \uppercaseenumerate % uppercase letter 4265 \fi 4266 \fi 4267 \else 4268 % Multiple tokens in the argument. We hope it's a number. 4269 \numericenumerate 4270 \fi 4271} 4272 4273% An @enumerate whose labels are integers. The starting integer is 4274% given in \thearg. 4275% 4276\def\numericenumerate{% 4277 \itemno = \thearg 4278 \startenumeration{\the\itemno}% 4279} 4280 4281% The starting (lowercase) letter is in \thearg. 4282\def\lowercaseenumerate{% 4283 \itemno = \expandafter`\thearg 4284 \startenumeration{% 4285 % Be sure we're not beyond the end of the alphabet. 4286 \ifnum\itemno=0 4287 \errmessage{No more lowercase letters in @enumerate; get a bigger 4288 alphabet}% 4289 \fi 4290 \char\lccode\itemno 4291 }% 4292} 4293 4294% The starting (uppercase) letter is in \thearg. 4295\def\uppercaseenumerate{% 4296 \itemno = \expandafter`\thearg 4297 \startenumeration{% 4298 % Be sure we're not beyond the end of the alphabet. 4299 \ifnum\itemno=0 4300 \errmessage{No more uppercase letters in @enumerate; get a bigger 4301 alphabet} 4302 \fi 4303 \char\uccode\itemno 4304 }% 4305} 4306 4307% Call \doitemize, adding a period to the first argument and supplying the 4308% common last two arguments. Also subtract one from the initial value in 4309% \itemno, since @item increments \itemno. 4310% 4311\def\startenumeration#1{% 4312 \advance\itemno by -1 4313 \doitemize{#1.}\flushcr 4314} 4315 4316 4317% @multitable macros 4318 4319% Macros used to set up halign preamble: 4320% 4321\let\endsetuptable\relax 4322\def\xendsetuptable{\endsetuptable} 4323\let\columnfractions\relax 4324\def\xcolumnfractions{\columnfractions} 4325\newif\ifsetpercent 4326 4327% #1 is the @columnfraction, usually a decimal number like .5, but might 4328% be just 1. We just use it, whatever it is. 4329% 4330\def\pickupwholefraction#1 {% 4331 \global\advance\colcount by 1 4332 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% 4333 \setuptable 4334} 4335 4336\newcount\colcount 4337\def\setuptable#1{% 4338 \def\firstarg{#1}% 4339 \ifx\firstarg\xendsetuptable 4340 \let\go = \relax 4341 \else 4342 \ifx\firstarg\xcolumnfractions 4343 \global\setpercenttrue 4344 \else 4345 \ifsetpercent 4346 \let\go\pickupwholefraction 4347 \else 4348 \global\advance\colcount by 1 4349 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a 4350 % separator; typically that is always in the input, anyway. 4351 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% 4352 \fi 4353 \fi 4354 \ifx\go\pickupwholefraction 4355 % Put the argument back for the \pickupwholefraction call, so 4356 % we'll always have a period there to be parsed. 4357 \def\go{\pickupwholefraction#1}% 4358 \else 4359 \let\go = \setuptable 4360 \fi% 4361 \fi 4362 \go 4363} 4364 4365% @headitem starts a heading row, which we typeset in bold. Assignments 4366% have to be global since we are inside the implicit group of an 4367% alignment entry. \everycr below resets \everytab so we don't have to 4368% undo it ourselves. 4369\def\headitemfont{\b}% for people to use in the template row; not changeable 4370\def\headitem{% 4371 \crcr % must appear first 4372 \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings 4373 \global\everytab={\bf}% can't use \headitemfont since the parsing differs 4374 \the\everytab % for the first item 4375}% 4376% 4377% default for tables with no headings. 4378\let\headitemcrhook=\relax 4379% 4380\def\tab{\checkenv\multitable &\the\everytab}% 4381 4382\newtoks\everytab % insert after every tab. 4383% 4384\envdef\multitable{% 4385 \vskip\parskip 4386 \startsavinginserts 4387 % 4388 % @item within a multitable starts a normal row. 4389 % We use \def instead of \let so that if one of the multitable entries 4390 % contains an @itemize, we don't choke on the \item (seen as \crcr aka 4391 % \endtemplate) expanding \doitemize. 4392 \def\item{\crcr}% 4393 % 4394 \tolerance=9500 4395 \hbadness=9500 4396 \parskip=0pt 4397 \parindent=6pt 4398 \overfullrule=0pt 4399 \global\colcount=0 4400 % 4401 \everycr = {% 4402 \noalign{% 4403 \global\everytab={}% Reset from possible headitem. 4404 \global\colcount=0 % Reset the column counter. 4405 % 4406 % Check for saved footnotes, etc.: 4407 \checkinserts 4408 % 4409 % Perhaps a \nobreak, then reset: 4410 \headitemcrhook 4411 \global\let\headitemcrhook=\relax 4412 }% 4413 }% 4414 % 4415 \parsearg\domultitable 4416} 4417\def\domultitable#1{% 4418 % To parse everything between @multitable and @item: 4419 \setuptable#1 \endsetuptable 4420 % 4421 % This preamble sets up a generic column definition, which will 4422 % be used as many times as user calls for columns. 4423 % \vtop will set a single line and will also let text wrap and 4424 % continue for many paragraphs if desired. 4425 \halign\bgroup &% 4426 \global\advance\colcount by 1 4427 \strut 4428 \vtop{% 4429 \advance\hsize by -1\leftskip 4430 % Find the correct column width 4431 \hsize=\expandafter\csname col\the\colcount\endcsname 4432 % 4433 \advance\rightskip by -1\rightskip % Zero leaving only any stretch 4434 \ifnum\colcount=1 4435 \advance\hsize by\leftskip % Add indent of surrounding text 4436 \else 4437 % In order to keep entries from bumping into each other. 4438 \leftskip=12pt 4439 \ifsetpercent \else 4440 % If a template has been used 4441 \advance\hsize by \leftskip 4442 \fi 4443 \fi 4444 \noindent\ignorespaces##\unskip\strut 4445 }\cr 4446} 4447\def\Emultitable{% 4448 \crcr 4449 \egroup % end the \halign 4450 \global\setpercentfalse 4451} 4452 4453 4454\message{conditionals,} 4455 4456% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotlatex, @ifnotplaintext, 4457% @ifnotxml always succeed. They currently do nothing; we don't 4458% attempt to check whether the conditionals are properly nested. But we 4459% have to remember that they are conditionals, so that @end doesn't 4460% attempt to close an environment group. 4461% 4462\def\makecond#1{% 4463 \expandafter\let\csname #1\endcsname = \relax 4464 \expandafter\let\csname iscond.#1\endcsname = 1 4465} 4466\makecond{iftex} 4467\makecond{ifnotdocbook} 4468\makecond{ifnothtml} 4469\makecond{ifnotinfo} 4470\makecond{ifnotlatex} 4471\makecond{ifnotplaintext} 4472\makecond{ifnotxml} 4473 4474% Ignore @ignore, @ifhtml, @ifinfo, and the like. 4475% 4476\def\direntry{\doignore{direntry}} 4477\def\documentdescription{\doignore{documentdescription}} 4478\def\docbook{\doignore{docbook}} 4479\def\html{\doignore{html}} 4480\def\ifdocbook{\doignore{ifdocbook}} 4481\def\ifhtml{\doignore{ifhtml}} 4482\def\ifinfo{\doignore{ifinfo}} 4483\def\iflatex{\doignore{iflatex}} 4484\def\ifnottex{\doignore{ifnottex}} 4485\def\ifplaintext{\doignore{ifplaintext}} 4486\def\ifxml{\doignore{ifxml}} 4487\def\ignore{\doignore{ignore}} 4488\def\latex{\doignore{latex}} 4489\def\menu{\doignore{menu}} 4490\def\xml{\doignore{xml}} 4491 4492% Ignore text until a line `@end #1', keeping track of nested conditionals. 4493% 4494% A count to remember the depth of nesting. 4495\newcount\doignorecount 4496 4497\def\doignore#1{\begingroup 4498 % Scan in ``verbatim'' mode: 4499 \obeylines 4500 \catcode`\@ = \other 4501 \catcode`\{ = \other 4502 \catcode`\} = \other 4503 % 4504 % Make sure that spaces turn into tokens that match what \doignoretext wants. 4505 \spaceisspace 4506 % 4507 % Count number of #1's that we've seen. 4508 \doignorecount = 0 4509 % 4510 % Swallow text until we reach the matching `@end #1'. 4511 \dodoignore{#1}% 4512} 4513 4514{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. 4515 \obeylines % 4516 % 4517 \gdef\dodoignore#1{% 4518 % #1 contains the command name as a string, e.g., `ifinfo'. 4519 % 4520 % Define a command to find the next `@end #1'. 4521 \long\def\doignoretext##1^^M@end #1{% 4522 \doignoretextyyy##1^^M@#1\_STOP_}% 4523 % 4524 % And this command to find another #1 command, at the beginning of a 4525 % line. (Otherwise, we would consider a line `@c @ifset', for 4526 % example, to count as an @ifset for nesting.) 4527 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% 4528 % 4529 % And now expand that command. 4530 \doignoretext ^^M% 4531 }% 4532} 4533 4534\def\doignoreyyy#1{% 4535 \def\temp{#1}% 4536 \ifx\temp\empty % Nothing found. 4537 \let\next\doignoretextzzz 4538 \else % Found a nested condition, ... 4539 \advance\doignorecount by 1 4540 \let\next\doignoretextyyy % ..., look for another. 4541 % If we're here, #1 ends with ^^M\ifinfo (for example). 4542 \fi 4543 \next #1% the token \_STOP_ is present just after this macro. 4544} 4545 4546% We have to swallow the remaining "\_STOP_". 4547% 4548\def\doignoretextzzz#1{% 4549 \ifnum\doignorecount = 0 % We have just found the outermost @end. 4550 \let\next\enddoignore 4551 \else % Still inside a nested condition. 4552 \advance\doignorecount by -1 4553 \let\next\doignoretext % Look for the next @end. 4554 \fi 4555 \next 4556} 4557 4558% Finish off ignored text. 4559{ \obeylines% 4560 % Ignore anything after the last `@end #1'; this matters in verbatim 4561 % environments, where otherwise the newline after an ignored conditional 4562 % would result in a blank line in the output. 4563 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% 4564} 4565 4566 4567% @set VAR sets the variable VAR to an empty value. 4568% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. 4569% 4570% Since we want to separate VAR from REST-OF-LINE (which might be 4571% empty), we can't just use \parsearg; we have to insert a space of our 4572% own to delimit the rest of the line, and then take it out again if we 4573% didn't need it. 4574% We rely on the fact that \parsearg sets \catcode`\ =10. 4575% 4576\parseargdef\set{\setyyy#1 \endsetyyy} 4577\def\setyyy#1 #2\endsetyyy{% 4578 {% 4579 \makevalueexpandable 4580 \def\temp{#2}% 4581 \edef\next{\gdef\makecsname{SET#1}}% 4582 \ifx\temp\empty 4583 \next{}% 4584 \else 4585 \setzzz#2\endsetzzz 4586 \fi 4587 }% 4588} 4589% Remove the trailing space \setxxx inserted. 4590\def\setzzz#1 \endsetzzz{\next{#1}} 4591 4592% @clear VAR clears (i.e., unsets) the variable VAR. 4593% 4594\parseargdef\clear{% 4595 {% 4596 \makevalueexpandable 4597 \global\expandafter\let\csname SET#1\endcsname=\relax 4598 }% 4599} 4600 4601% @value{foo} gets the text saved in variable foo. 4602\def\value{\begingroup\makevalueexpandable\valuexxx} 4603\def\valuexxx#1{\expandablevalue{#1}\endgroup} 4604{ 4605 \catcode`\-=\active \catcode`\_=\active 4606 % 4607 \gdef\makevalueexpandable{% 4608 \let\value = \expandablevalue 4609 % We don't want these characters active, ... 4610 \catcode`\-=\other \catcode`\_=\other 4611 % ..., but we might end up with active ones in the argument if 4612 % we're called from @code, as @code{@value{foo-bar_}}, though. 4613 % So \let them to their normal equivalents. 4614 \let-\normaldash \let_\normalunderscore 4615 } 4616} 4617 4618\def\expandablevalue#1{% 4619 \expandafter\ifx\csname SET#1\endcsname\relax 4620 {[No value for ``#1'']}% 4621 \message{Variable `#1', used in @value, is not set.}% 4622 \else 4623 \csname SET#1\endcsname 4624 \fi 4625} 4626 4627% Like \expandablevalue, but completely expandable (the \message in the 4628% definition above operates at the execution level of TeX). Used when 4629% writing to auxiliary files, due to the expansion that \write does. 4630% If flag is undefined, pass through an unexpanded @value command: maybe it 4631% will be set by the time it is read back in. 4632% 4633% NB flag names containing - or _ may not work here. 4634\def\dummyvalue#1{% 4635 \expandafter\ifx\csname SET#1\endcsname\relax 4636 \string\value{#1}% 4637 \else 4638 \csname SET#1\endcsname 4639 \fi 4640} 4641 4642% Used for @value's in index entries to form the sort key: expand the @value 4643% if possible, otherwise sort late. 4644\def\indexnofontsvalue#1{% 4645 \expandafter\ifx\csname SET#1\endcsname\relax 4646 ZZZZZZZ% 4647 \else 4648 \csname SET#1\endcsname 4649 \fi 4650} 4651 4652% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined 4653% with @set. 4654% 4655% To get the special treatment we need for `@end ifset,' we call 4656% \makecond and then redefine. 4657% 4658\makecond{ifset} 4659\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} 4660\def\doifset#1#2{% 4661 {% 4662 \makevalueexpandable 4663 \let\next=\empty 4664 \expandafter\ifx\csname SET#2\endcsname\relax 4665 #1% If not set, redefine \next. 4666 \fi 4667 \expandafter 4668 }\next 4669} 4670\def\ifsetfail{\doignore{ifset}} 4671 4672% @ifclear VAR ... @end executes the `...' iff VAR has never been 4673% defined with @set, or has been undefined with @clear. 4674% 4675% The `\else' inside the `\doifset' parameter is a trick to reuse the 4676% above code: if the variable is not set, do nothing, if it is set, 4677% then redefine \next to \ifclearfail. 4678% 4679\makecond{ifclear} 4680\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} 4681\def\ifclearfail{\doignore{ifclear}} 4682 4683% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written 4684% without the @) is in fact defined. We can only feasibly check at the 4685% TeX level, so something like `mathcode' is going to considered 4686% defined even though it is not a Texinfo command. 4687% 4688\makecond{ifcommanddefined} 4689\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} 4690% 4691\def\doifcmddefined#1#2{{% 4692 \makevalueexpandable 4693 \let\next=\empty 4694 \expandafter\ifx\csname #2\endcsname\relax 4695 #1% If not defined, \let\next as above. 4696 \fi 4697 \expandafter 4698 }\next 4699} 4700\def\ifcmddefinedfail{\doignore{ifcommanddefined}} 4701 4702% @ifcommandnotdefined CMD ... handled similar to @ifclear above. 4703\makecond{ifcommandnotdefined} 4704\def\ifcommandnotdefined{% 4705 \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} 4706\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} 4707 4708% Set the `txicommandconditionals' variable, so documents have a way to 4709% test if the @ifcommand...defined conditionals are available. 4710\set txicommandconditionals 4711 4712% @dircategory CATEGORY -- specify a category of the dir file 4713% which this file should belong to. Ignore this in TeX. 4714\let\dircategory=\comment 4715 4716% @defininfoenclose. 4717\let\definfoenclose=\comment 4718 4719 4720\message{indexing,} 4721% Index generation facilities 4722 4723% Define \newwrite to be identical to plain tex's \newwrite 4724% except not \outer, so it can be used within macros and \if's. 4725\edef\newwrite{\makecsname{ptexnewwrite}} 4726 4727% \newindex {foo} defines an index named IX. 4728% It automatically defines \IXindex such that 4729% \IXindex ...rest of line... puts an entry in the index IX. 4730% It also defines \IXindfile to be the number of the output channel for 4731% the file that accumulates this index. The file's extension is IX. 4732% The name of an index should be no more than 2 characters long 4733% for the sake of vms. 4734% 4735\def\newindex#1{% 4736 \expandafter\chardef\csname#1indfile\endcsname=0 4737 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index 4738 \noexpand\doindex{#1}} 4739} 4740 4741% @defindex foo == \newindex{foo} 4742% 4743\def\defindex{\parsearg\newindex} 4744 4745% Define @defcodeindex, like @defindex except put all entries in @code. 4746% 4747\def\defcodeindex{\parsearg\newcodeindex} 4748% 4749\def\newcodeindex#1{% 4750 \expandafter\chardef\csname#1indfile\endcsname=0 4751 \expandafter\xdef\csname#1index\endcsname{% 4752 \noexpand\docodeindex{#1}}% 4753} 4754 4755% The default indices: 4756\newindex{cp}% concepts, 4757\newcodeindex{fn}% functions, 4758\newcodeindex{vr}% variables, 4759\newcodeindex{tp}% types, 4760\newcodeindex{ky}% keys 4761\newcodeindex{pg}% and programs. 4762 4763 4764% @synindex foo bar makes index foo feed into index bar. 4765% Do this instead of @defindex foo if you don't want it as a separate index. 4766% 4767% @syncodeindex foo bar similar, but put all entries made for index foo 4768% inside @code. 4769% 4770\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} 4771\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} 4772 4773% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), 4774% #3 the target index (bar). 4775\def\dosynindex#1#2#3{% 4776 \requireopenindexfile{#3}% 4777 % redefine \fooindfile: 4778 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname 4779 \expandafter\let\csname#2indfile\endcsname=\temp 4780 % redefine \fooindex: 4781 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% 4782} 4783 4784% Define \doindex, the driver for all index macros. 4785% Argument #1 is generated by the calling \fooindex macro, 4786% and it is the two-letter name of the index. 4787 4788\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx} 4789\def\doindexxxx #1{\doind{\indexname}{#1}} 4790 4791% like the previous two, but they put @code around the argument. 4792\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} 4793\def\docodeindexxxx #1{\docind{\indexname}{#1}} 4794 4795 4796% Used for the aux, toc and index files to prevent expansion of Texinfo 4797% commands. 4798% 4799\def\atdummies{% 4800 \definedummyletter\@% 4801 \definedummyletter\ % 4802 \definedummyletter\{% 4803 \definedummyletter\}% 4804 \definedummyletter\&% 4805 % 4806 % Do the redefinitions. 4807 \definedummies 4808 \otherbackslash 4809} 4810 4811% \definedummyword defines \#1 as \string\#1\space, thus effectively 4812% preventing its expansion. This is used only for control words, 4813% not control letters, because the \space would be incorrect for 4814% control characters, but is needed to separate the control word 4815% from whatever follows. 4816% 4817% These can be used both for control words that take an argument and 4818% those that do not. If it is followed by {arg} in the input, then 4819% that will dutifully get written to the index (or wherever). 4820% 4821% For control letters, we have \definedummyletter, which omits the 4822% space. 4823% 4824\def\definedummyword #1{\def#1{\string#1\space}}% 4825\def\definedummyletter#1{\def#1{\string#1}}% 4826\let\definedummyaccent\definedummyletter 4827 4828% Called from \atdummies to prevent the expansion of commands. 4829% 4830\def\definedummies{% 4831 % 4832 \let\commondummyword\definedummyword 4833 \let\commondummyletter\definedummyletter 4834 \let\commondummyaccent\definedummyaccent 4835 \commondummiesnofonts 4836 % 4837 \definedummyletter\_% 4838 \definedummyletter\-% 4839 % 4840 % Non-English letters. 4841 \definedummyword\AA 4842 \definedummyword\AE 4843 \definedummyword\DH 4844 \definedummyword\L 4845 \definedummyword\O 4846 \definedummyword\OE 4847 \definedummyword\TH 4848 \definedummyword\aa 4849 \definedummyword\ae 4850 \definedummyword\dh 4851 \definedummyword\exclamdown 4852 \definedummyword\l 4853 \definedummyword\o 4854 \definedummyword\oe 4855 \definedummyword\ordf 4856 \definedummyword\ordm 4857 \definedummyword\questiondown 4858 \definedummyword\ss 4859 \definedummyword\th 4860 % 4861 % Although these internal commands shouldn't show up, sometimes they do. 4862 \definedummyword\bf 4863 \definedummyword\gtr 4864 \definedummyword\hat 4865 \definedummyword\less 4866 \definedummyword\sf 4867 \definedummyword\sl 4868 \definedummyword\tclose 4869 \definedummyword\tt 4870 % 4871 \definedummyword\LaTeX 4872 \definedummyword\TeX 4873 % 4874 % Assorted special characters. 4875 \definedummyword\ampchar 4876 \definedummyword\atchar 4877 \definedummyword\arrow 4878 \definedummyword\backslashchar 4879 \definedummyword\bullet 4880 \definedummyword\comma 4881 \definedummyword\copyright 4882 \definedummyword\registeredsymbol 4883 \definedummyword\dots 4884 \definedummyword\enddots 4885 \definedummyword\entrybreak 4886 \definedummyword\equiv 4887 \definedummyword\error 4888 \definedummyword\euro 4889 \definedummyword\expansion 4890 \definedummyword\geq 4891 \definedummyword\guillemetleft 4892 \definedummyword\guillemetright 4893 \definedummyword\guilsinglleft 4894 \definedummyword\guilsinglright 4895 \definedummyword\lbracechar 4896 \definedummyword\leq 4897 \definedummyword\mathopsup 4898 \definedummyword\minus 4899 \definedummyword\ogonek 4900 \definedummyword\pounds 4901 \definedummyword\point 4902 \definedummyword\print 4903 \definedummyword\quotedblbase 4904 \definedummyword\quotedblleft 4905 \definedummyword\quotedblright 4906 \definedummyword\quoteleft 4907 \definedummyword\quoteright 4908 \definedummyword\quotesinglbase 4909 \definedummyword\rbracechar 4910 \definedummyword\result 4911 \definedummyword\sub 4912 \definedummyword\sup 4913 \definedummyword\textdegree 4914 % 4915 \definedummyword\subentry 4916 % 4917 % We want to disable all macros so that they are not expanded by \write. 4918 \macrolist 4919 \let\value\dummyvalue 4920 % 4921 \normalturnoffactive 4922} 4923 4924% \commondummiesnofonts: common to \definedummies and \indexnofonts. 4925% Define \commondummyletter, \commondummyaccent and \commondummyword before 4926% using. Used for accents, font commands, and various control letters. 4927% 4928\def\commondummiesnofonts{% 4929 % Control letters and accents. 4930 \commondummyletter\!% 4931 \commondummyaccent\"% 4932 \commondummyaccent\'% 4933 \commondummyletter\*% 4934 \commondummyaccent\,% 4935 \commondummyletter\.% 4936 \commondummyletter\/% 4937 \commondummyletter\:% 4938 \commondummyaccent\=% 4939 \commondummyletter\?% 4940 \commondummyaccent\^% 4941 \commondummyaccent\`% 4942 \commondummyaccent\~% 4943 \commondummyword\u 4944 \commondummyword\v 4945 \commondummyword\H 4946 \commondummyword\dotaccent 4947 \commondummyword\ogonek 4948 \commondummyword\ringaccent 4949 \commondummyword\tieaccent 4950 \commondummyword\ubaraccent 4951 \commondummyword\udotaccent 4952 \commondummyword\dotless 4953 % 4954 % Texinfo font commands. 4955 \commondummyword\b 4956 \commondummyword\i 4957 \commondummyword\r 4958 \commondummyword\sansserif 4959 \commondummyword\sc 4960 \commondummyword\slanted 4961 \commondummyword\t 4962 % 4963 % Commands that take arguments. 4964 \commondummyword\abbr 4965 \commondummyword\acronym 4966 \commondummyword\anchor 4967 \commondummyword\cite 4968 \commondummyword\code 4969 \commondummyword\command 4970 \commondummyword\dfn 4971 \commondummyword\dmn 4972 \commondummyword\email 4973 \commondummyword\emph 4974 \commondummyword\env 4975 \commondummyword\file 4976 \commondummyword\image 4977 \commondummyword\indicateurl 4978 \commondummyword\inforef 4979 \commondummyword\kbd 4980 \commondummyword\key 4981 \commondummyword\math 4982 \commondummyword\option 4983 \commondummyword\pxref 4984 \commondummyword\ref 4985 \commondummyword\samp 4986 \commondummyword\strong 4987 \commondummyword\tie 4988 \commondummyword\U 4989 \commondummyword\uref 4990 \commondummyword\url 4991 \commondummyword\var 4992 \commondummyword\verb 4993 \commondummyword\w 4994 \commondummyword\xref 4995} 4996 4997\let\indexlbrace\relax 4998\let\indexrbrace\relax 4999\let\indexatchar\relax 5000\let\indexbackslash\relax 5001 5002{\catcode`\@=0 5003\catcode`\\=13 5004 @gdef@backslashdisappear{@def\{}} 5005} 5006 5007{ 5008\catcode`\<=13 5009\catcode`\-=13 5010\catcode`\`=13 5011 \gdef\indexnonalnumdisappear{% 5012 \ifflagclear{txiindexlquoteignore}{}{% 5013 % @set txiindexlquoteignore makes us ignore left quotes in the sort term. 5014 % (Introduced for FSFS 2nd ed.) 5015 \let`=\empty 5016 }% 5017 % 5018 \ifflagclear{txiindexbackslashignore}{}{% 5019 \backslashdisappear 5020 }% 5021 \ifflagclear{txiindexhyphenignore}{}{% 5022 \def-{}% 5023 }% 5024 \ifflagclear{txiindexlessthanignore}{}{% 5025 \def<{}% 5026 }% 5027 \ifflagclear{txiindexatsignignore}{}{% 5028 \def\@{}% 5029 }% 5030 } 5031 5032 \gdef\indexnonalnumreappear{% 5033 \let-\normaldash 5034 \let<\normalless 5035 } 5036} 5037 5038 5039% \indexnofonts is used when outputting the strings to sort the index 5040% by, and when constructing control sequence names. It eliminates all 5041% control sequences and just writes whatever the best ASCII sort string 5042% would be for a given command (usually its argument). 5043% 5044\def\indexnofonts{% 5045 % Accent commands should become @asis. 5046 \def\commondummyaccent##1{\let##1\asis}% 5047 % We can just ignore other control letters. 5048 \def\commondummyletter##1{\let##1\empty}% 5049 % All control words become @asis by default; overrides below. 5050 \let\commondummyword\commondummyaccent 5051 \commondummiesnofonts 5052 % 5053 % Don't no-op \tt, since it isn't a user-level command 5054 % and is used in the definitions of the active chars like <, >, |, etc. 5055 % Likewise with the other plain tex font commands. 5056 %\let\tt=\asis 5057 % 5058 \def\ { }% 5059 \def\@{@}% 5060 \def\_{\normalunderscore}% 5061 \def\-{}% @- shouldn't affect sorting 5062 % 5063 \uccode`\1=`\{ \uppercase{\def\{{1}}% 5064 \uccode`\1=`\} \uppercase{\def\}{1}}% 5065 \let\lbracechar\{% 5066 \let\rbracechar\}% 5067 % 5068 % Non-English letters. 5069 \def\AA{AA}% 5070 \def\AE{AE}% 5071 \def\DH{DZZ}% 5072 \def\L{L}% 5073 \def\OE{OE}% 5074 \def\O{O}% 5075 \def\TH{TH}% 5076 \def\aa{aa}% 5077 \def\ae{ae}% 5078 \def\dh{dzz}% 5079 \def\exclamdown{!}% 5080 \def\l{l}% 5081 \def\oe{oe}% 5082 \def\ordf{a}% 5083 \def\ordm{o}% 5084 \def\o{o}% 5085 \def\questiondown{?}% 5086 \def\ss{ss}% 5087 \def\th{th}% 5088 % 5089 \let\do\indexnofontsdef 5090 % 5091 \do\LaTeX{LaTeX}% 5092 \do\TeX{TeX}% 5093 % 5094 % Assorted special characters. 5095 \do\atchar{@}% 5096 \do\arrow{->}% 5097 \do\bullet{bullet}% 5098 \do\comma{,}% 5099 \do\copyright{copyright}% 5100 \do\dots{...}% 5101 \do\enddots{...}% 5102 \do\equiv{==}% 5103 \do\error{error}% 5104 \do\euro{euro}% 5105 \do\expansion{==>}% 5106 \do\geq{>=}% 5107 \do\guillemetleft{<<}% 5108 \do\guillemetright{>>}% 5109 \do\guilsinglleft{<}% 5110 \do\guilsinglright{>}% 5111 \do\leq{<=}% 5112 \do\lbracechar{\{}% 5113 \do\minus{-}% 5114 \do\point{.}% 5115 \do\pounds{pounds}% 5116 \do\print{-|}% 5117 \do\quotedblbase{"}% 5118 \do\quotedblleft{"}% 5119 \do\quotedblright{"}% 5120 \do\quoteleft{`}% 5121 \do\quoteright{'}% 5122 \do\quotesinglbase{,}% 5123 \do\rbracechar{\}}% 5124 \do\registeredsymbol{R}% 5125 \do\result{=>}% 5126 \do\textdegree{o}% 5127 % 5128 % We need to get rid of all macros, leaving only the arguments (if present). 5129 % Of course this is not nearly correct, but it is the best we can do for now. 5130 % makeinfo does not expand macros in the argument to @deffn, which ends up 5131 % writing an index entry, and texindex isn't prepared for an index sort entry 5132 % that starts with \. 5133 % 5134 % Since macro invocations are followed by braces, we can just redefine them 5135 % to take a single TeX argument. The case of a macro invocation that 5136 % goes to end-of-line is not handled. 5137 % 5138 \macrolist 5139 \let\value\indexnofontsvalue 5140} 5141 5142% Give the control sequence a definition that removes the {} that follows 5143% its use, e.g. @AA{} -> AA 5144\def\indexnofontsdef#1#2{\def#1##1{#2}}% 5145 5146 5147 5148 5149% #1 is the index name, #2 is the entry text. 5150\def\doind#1#2{% 5151 \iflinks 5152 {% 5153 % 5154 \requireopenindexfile{#1}% 5155 \edef\writeto{\csname#1indfile\endcsname}% 5156 % 5157 \def\indextext{#2}% 5158 \safewhatsit\doindwrite 5159 }% 5160 \fi 5161} 5162 5163% Same as \doind, but for code indices 5164\def\docind#1#2{% 5165 \iflinks 5166 {% 5167 % 5168 \requireopenindexfile{#1}% 5169 \edef\writeto{\csname#1indfile\endcsname}% 5170 % 5171 \def\indextext{#2}% 5172 \safewhatsit\docindwrite 5173 }% 5174 \fi 5175} 5176 5177% Check if an index file has been opened, and if not, open it. 5178\def\requireopenindexfile#1{% 5179\ifnum\csname #1indfile\endcsname=0 5180 \expandafter\newwrite \csname#1indfile\endcsname 5181 \edef\suffix{#1}% 5182 % A .fls suffix would conflict with the file extension for the output 5183 % of -recorder, so use .f1s instead. 5184 \ifx\suffix\indexisfl\def\suffix{f1}\fi 5185 % Open the file 5186 \immediate\openout\csname#1indfile\endcsname \jobname.\suffix 5187 % Using \immediate above here prevents an object entering into the current 5188 % box, which could confound checks such as those in \safewhatsit for 5189 % preceding skips. 5190 \typeout{Writing index file \jobname.\suffix}% 5191\fi} 5192\def\indexisfl{fl} 5193 5194% Definition for writing index entry sort key. 5195{ 5196\catcode`\-=13 5197\gdef\indexwritesortas{% 5198 \begingroup 5199 \indexnonalnumreappear 5200 \indexwritesortasxxx} 5201\gdef\indexwritesortasxxx#1{% 5202 \xdef\indexsortkey{#1}\endgroup} 5203} 5204 5205\def\indexwriteseealso#1{ 5206 \gdef\pagenumbertext{\string\seealso{#1}}% 5207} 5208\def\indexwriteseeentry#1{ 5209 \gdef\pagenumbertext{\string\seeentry{#1}}% 5210} 5211 5212% The default definitions 5213\def\sortas#1{}% 5214\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only 5215\def\putwordSeeAlso{See also} 5216\def\seeentry#1{\i{\putwordSee}\ #1}% for sorted index file only 5217 5218 5219% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}": 5220% * Set \bracedtext to "{aaa}{bbb}" 5221% * Set \fullindexsortkey to "aaa @subentry ZZZ" 5222% * If @seealso occurs, set \pagenumbertext 5223% 5224\def\splitindexentry#1{% 5225 \gdef\fullindexsortkey{}% 5226 \xdef\bracedtext{}% 5227 \def\sep{}% 5228 \def\seealso##1{}% 5229 \def\seeentry##1{}% 5230 \expandafter\doindexsegment#1\subentry\finish\subentry 5231} 5232 5233% append the results from the next segment 5234\def\doindexsegment#1\subentry{% 5235 \def\segment{#1}% 5236 \ifx\segment\isfinish 5237 \else 5238 % 5239 % Fully expand the segment, throwing away any @sortas directives, and 5240 % trim spaces. 5241 \edef\trimmed{\segment}% 5242 \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% 5243 \ifincodeindex 5244 \edef\trimmed{\noexpand\code{\trimmed}}% 5245 \fi 5246 % 5247 \xdef\bracedtext{\bracedtext{\trimmed}}% 5248 % 5249 % Get the string to sort by. Process the segment with all 5250 % font commands turned off. 5251 \bgroup 5252 \let\sortas\indexwritesortas 5253 \let\seealso\indexwriteseealso 5254 \let\seeentry\indexwriteseeentry 5255 \indexnofonts 5256 % The braces around the commands are recognized by texindex. 5257 \def\lbracechar{{\string\indexlbrace}}% 5258 \def\rbracechar{{\string\indexrbrace}}% 5259 \let\{=\lbracechar 5260 \let\}=\rbracechar 5261 \def\@{{\string\indexatchar}}% 5262 \def\atchar##1{\@}% 5263 \def\backslashchar{{\string\indexbackslash}}% 5264 \uccode`\~=`\\ \uppercase{\let~\backslashchar}% 5265 % 5266 \let\indexsortkey\empty 5267 \global\let\pagenumbertext\empty 5268 % Execute the segment and throw away the typeset output. This executes 5269 % any @sortas or @seealso commands in this segment. 5270 \setbox\dummybox = \hbox{\segment}% 5271 \ifx\indexsortkey\empty{% 5272 \indexnonalnumdisappear 5273 \xdef\trimmed{\segment}% 5274 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% 5275 \xdef\indexsortkey{\trimmed}% 5276 \ifx\indexsortkey\empty 5277 \message{Empty index sort key near line \the\inputlineno}% 5278 \xdef\indexsortkey{ }% 5279 \fi 5280 }\fi 5281 % 5282 % Append to \fullindexsortkey. 5283 \edef\tmp{\gdef\noexpand\fullindexsortkey{% 5284 \fullindexsortkey\sep\indexsortkey}}% 5285 \tmp 5286 \egroup 5287 \def\sep{\subentry}% 5288 % 5289 \expandafter\doindexsegment 5290 \fi 5291} 5292\def\isfinish{\finish}% 5293\newbox\dummybox % used above 5294 5295\let\subentry\relax 5296 5297% Use \ instead of @ in index files. To support old texi2dvi and texindex. 5298% This works without changing the escape character used in the toc or aux 5299% files because the index entries are fully expanded here, and \string uses 5300% the current value of \escapechar. 5301\def\escapeisbackslash{\escapechar=`\\} 5302 5303% Use \ in index files by default. texi2dvi didn't support @ as the escape 5304% character (as it checked for "\entry" in the files, and not "@entry"). When 5305% the new version of texi2dvi has had a chance to become more prevalent, then 5306% the escape character can change back to @ again. This should be an easy 5307% change to make now because both @ and \ are only used as escape characters in 5308% index files, never standing for themselves. 5309% 5310\set txiindexescapeisbackslash 5311 5312% Write the entry in \indextext to the index file. 5313% 5314 5315\newif\ifincodeindex 5316\def\doindwrite{\incodeindexfalse\doindwritex} 5317\def\docindwrite{\incodeindextrue\doindwritex} 5318 5319\def\doindwritex{% 5320 \maybemarginindex 5321 % 5322 \atdummies 5323 % 5324 \ifflagclear{txiindexescapeisbackslash}{}{\escapeisbackslash}% 5325 % 5326 % For texindex which always views { and } as separators. 5327 \def\{{\lbracechar{}}% 5328 \def\}{\rbracechar{}}% 5329 \uccode`\~=`\\ \uppercase{\def~{\backslashchar{}}}% 5330 % 5331 % Split the entry into primary entry and any subentries, and get the index 5332 % sort key. 5333 \splitindexentry\indextext 5334 % 5335 % Set up the complete index entry, with both the sort key and 5336 % the original text, including any font commands. We write 5337 % three arguments to \entry to the .?? file (four in the 5338 % subentry case), texindex reduces to two when writing the .??s 5339 % sorted result. 5340 % 5341 \edef\temp{% 5342 \write\writeto{% 5343 \string\entry{\fullindexsortkey}% 5344 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}% 5345 \bracedtext}% 5346 }% 5347 \temp 5348} 5349 5350% Put the index entry in the margin if desired (undocumented). 5351\def\maybemarginindex{% 5352 \ifx\SETmarginindex\relax\else 5353 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}% 5354 \fi 5355} 5356\let\SETmarginindex=\relax 5357 5358 5359% Take care of unwanted page breaks/skips around a whatsit: 5360% 5361% If a skip is the last thing on the list now, preserve it 5362% by backing up by \lastskip, doing the \write, then inserting 5363% the skip again. Otherwise, the whatsit generated by the 5364% \write or \pdfdest will make \lastskip zero. The result is that 5365% sequences like this: 5366% @end defun 5367% @tindex whatever 5368% @defun ... 5369% will have extra space inserted, because the \medbreak in the 5370% start of the @defun won't see the skip inserted by the @end of 5371% the previous defun. 5372% 5373% But don't do any of this if we're not in vertical mode. We 5374% don't want to do a \vskip and prematurely end a paragraph. 5375% 5376% Avoid page breaks due to these extra skips, too. 5377% 5378% But wait, there is a catch there: 5379% We'll have to check whether \lastskip is zero skip. \ifdim is not 5380% sufficient for this purpose, as it ignores stretch and shrink parts 5381% of the skip. The only way seems to be to check the textual 5382% representation of the skip. 5383% 5384% The following is almost like \def\zeroskipmacro{0.0pt} except that 5385% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). 5386% 5387\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} 5388% 5389\newskip\whatsitskip 5390\newcount\whatsitpenalty 5391% 5392% ..., ready, GO: 5393% 5394\def\safewhatsit#1{\ifhmode 5395 #1% 5396 \else 5397 % \lastskip and \lastpenalty cannot both be nonzero simultaneously. 5398 \whatsitskip = \lastskip 5399 \edef\lastskipmacro{\the\lastskip}% 5400 \whatsitpenalty = \lastpenalty 5401 % 5402 % If \lastskip is nonzero, that means the last item was a 5403 % skip. And since a skip is discardable, that means this 5404 % -\whatsitskip glue we're inserting is preceded by a 5405 % non-discardable item, therefore it is not a potential 5406 % breakpoint, therefore no \nobreak needed. 5407 \ifx\lastskipmacro\zeroskipmacro 5408 \else 5409 \vskip-\whatsitskip 5410 \fi 5411 % 5412 #1% 5413 % 5414 \ifx\lastskipmacro\zeroskipmacro 5415 % If \lastskip was zero, perhaps the last item was a penalty, and 5416 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want 5417 % to re-insert the same penalty (values >10000 are used for various 5418 % signals); since we just inserted a non-discardable item, any 5419 % following glue (such as a \parskip) would be a breakpoint. For example: 5420 % @deffn deffn-whatever 5421 % @vindex index-whatever 5422 % Description. 5423 % would allow a break between the index-whatever whatsit 5424 % and the "Description." paragraph. 5425 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi 5426 \else 5427 % On the other hand, if we had a nonzero \lastskip, 5428 % this make-up glue would be preceded by a non-discardable item 5429 % (the whatsit from the \write), so we must insert a \nobreak. 5430 \nobreak\vskip\whatsitskip 5431 \fi 5432\fi} 5433 5434% The index entry written in the file actually looks like 5435% \entry {sortstring}{page}{topic} 5436% or 5437% \entry {sortstring}{page}{topic}{subtopic} 5438% The texindex program reads in these files and writes files 5439% containing these kinds of lines: 5440% \initial {c} 5441% before the first topic whose initial is c 5442% \entry {topic}{pagelist} 5443% for a topic that is used without subtopics 5444% \primary {topic} 5445% \entry {topic}{} 5446% for the beginning of a topic that is used with subtopics 5447% \secondary {subtopic}{pagelist} 5448% for each subtopic. 5449% \secondary {subtopic}{} 5450% for a subtopic with sub-subtopics 5451% \tertiary {subtopic}{subsubtopic}{pagelist} 5452% for each sub-subtopic. 5453 5454% Define the user-accessible indexing commands 5455% @findex, @vindex, @kindex, @cindex. 5456 5457\def\findex {\fnindex} 5458\def\kindex {\kyindex} 5459\def\cindex {\cpindex} 5460\def\vindex {\vrindex} 5461\def\tindex {\tpindex} 5462\def\pindex {\pgindex} 5463 5464% Define the macros used in formatting output of the sorted index material. 5465 5466% @printindex causes a particular index (the ??s file) to get printed. 5467% It does not print any chapter heading (usually an @unnumbered). 5468% 5469\parseargdef\printindex{\begingroup 5470 \dobreak \chapheadingskip{10000}% 5471 % 5472 \smallfonts \rm 5473 \tolerance = 9500 5474 \plainfrenchspacing 5475 \everypar = {}% don't want the \kern\-parindent from indentation suppression. 5476 % 5477 % See comment in \requireopenindexfile. 5478 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi 5479 % 5480 % See if the index file exists and is nonempty. 5481 \openin 1 \jobname.\indexname s 5482 \ifeof 1 5483 % \enddoublecolumns gets confused if there is no text in the index, 5484 % and it loses the chapter title and the aux file entries for the 5485 % index. The easiest way to prevent this problem is to make sure 5486 % there is some text. 5487 \putwordIndexNonexistent 5488 \typeout{No file \jobname.\indexname s.}% 5489 \else 5490 % If the index file exists but is empty, then \openin leaves \ifeof 5491 % false. We have to make TeX try to read something from the file, so 5492 % it can discover if there is anything in it. 5493 \read 1 to \thisline 5494 \ifeof 1 5495 \putwordIndexIsEmpty 5496 \else 5497 \expandafter\printindexzz\thisline\relax\relax\finish% 5498 \fi 5499 \fi 5500 \closein 1 5501\endgroup} 5502 5503% If the index file starts with a backslash, forgo reading the index 5504% file altogether. If somebody upgrades texinfo.tex they may still have 5505% old index files using \ as the escape character. Reading this would 5506% at best lead to typesetting garbage, at worst a TeX syntax error. 5507\def\printindexzz#1#2\finish{% 5508 \ifflagclear{txiindexescapeisbackslash}{% 5509 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1 5510 \ifflagclear{txiskipindexfileswithbackslash}{% 5511\errmessage{% 5512ERROR: A sorted index file in an obsolete format was skipped. 5513To fix this problem, please upgrade your version of 'texi2dvi' 5514or 'texi2pdf' to that at <https://ftp.gnu.org/gnu/texinfo>. 5515If you are using an old version of 'texindex' (part of the Texinfo 5516distribution), you may also need to upgrade to a newer version (at least 6.0). 5517You may be able to typeset the index if you run 5518'texindex \jobname.\indexname' yourself. 5519You could also try setting the 'txiindexescapeisbackslash' flag by 5520running a command like 5521'texi2dvi -t "@set txiindexescapeisbackslash" \jobname.texi'. If you do 5522this, Texinfo will try to use index files in the old format. 5523If you continue to have problems, deleting the index files and starting again 5524might help (with 'rm \jobname.?? \jobname.??s')% 5525}% 5526 }{% 5527 (Skipped sorted index file in obsolete format) 5528 }% 5529 \else 5530 \begindoublecolumns 5531 \input \jobname.\indexname s 5532 \enddoublecolumns 5533 \fi 5534 }{% 5535 \begindoublecolumns 5536 \catcode`\\=0\relax 5537 % 5538 % Make @ an escape character to give macros a chance to work. This 5539 % should work because we (hopefully) don't otherwise use @ in index files. 5540 %\catcode`\@=12\relax 5541 \catcode`\@=0\relax 5542 \input \jobname.\indexname s 5543 \enddoublecolumns 5544 }% 5545} 5546 5547% These macros are used by the sorted index file itself. 5548% Change them to control the appearance of the index. 5549 5550{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 5551\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 5552\catcode`\$=3 5553\gdef\initialglyphs{% 5554 % special control sequences used in the index sort key 5555 \let\indexlbrace\{% 5556 \let\indexrbrace\}% 5557 \let\indexatchar\@% 5558 \def\indexbackslash{\math{\backslash}}% 5559 % 5560 % Some changes for non-alphabetic characters. Using the glyphs from the 5561 % math fonts looks more consistent than the typewriter font used elsewhere 5562 % for these characters. 5563 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}} 5564 % 5565 % In case @\ is used for backslash 5566 \uppercase{\let\\=~} 5567 % Can't get bold backslash so don't use bold forward slash 5568 \catcode`\/=13 5569 \def/{{\secrmnotbold \normalslash}}% 5570 \def-{{\normaldash\normaldash}}% en dash `--' 5571 \def^{{\chapbf \normalcaret}}% 5572 \def~{{\chapbf \normaltilde}}% 5573 \def\_{% 5574 \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }% 5575 \def|{$\vert$}% 5576 \def<{$\less$}% 5577 \def>{$\gtr$}% 5578 \def+{$\normalplus$}% 5579}} 5580 5581\def\initial{% 5582 \bgroup 5583 \initialglyphs 5584 \initialx 5585} 5586 5587\def\initialx#1{% 5588 % Remove any glue we may have, we'll be inserting our own. 5589 \removelastskip 5590 % 5591 % We like breaks before the index initials, so insert a bonus. 5592 % The glue before the bonus allows a little bit of space at the 5593 % bottom of a column to reduce an increase in inter-line spacing. 5594 \nobreak 5595 \vskip 0pt plus 5\baselineskip 5596 \penalty -300 5597 \vskip 0pt plus -5\baselineskip 5598 % 5599 % Typeset the initial. Making this add up to a whole number of 5600 % baselineskips increases the chance of the dots lining up from column 5601 % to column. It still won't often be perfect, because of the stretch 5602 % we need before each entry, but it's better. 5603 % 5604 % No shrink because it confuses \balancecolumns. 5605 \vskip 1.67\baselineskip plus 1\baselineskip 5606 \leftline{\secfonts \kern-0.05em \secbf #1}% 5607 % \secfonts is inside the argument of \leftline so that the change of 5608 % \baselineskip will not affect any glue inserted before the vbox that 5609 % \leftline creates. 5610 % Do our best not to break after the initial. 5611 \nobreak 5612 \vskip .33\baselineskip plus .1\baselineskip 5613 \egroup % \initialglyphs 5614} 5615 5616\newdimen\entryrightmargin 5617\entryrightmargin=0pt 5618 5619% for PDF output, whether to make the text of the entry a link to the page 5620% number. set for @contents and @shortcontents where there is only one 5621% page number. 5622\newif\iflinkentrytext 5623 5624% \entry typesets a paragraph consisting of the text (#1), dot leaders, and 5625% then page number (#2) flushed to the right margin. It is used for index 5626% and table of contents entries. The paragraph is indented by \leftskip. 5627% 5628\def\entry{% 5629 \begingroup 5630 % 5631 % Start a new paragraph if necessary, so our assignments below can't 5632 % affect previous text. 5633 \par 5634 % 5635 % No extra space above this paragraph. 5636 \parskip = 0in 5637 % 5638 % When reading the text of entry, convert explicit line breaks 5639 % from @* into spaces. The user might give these in long section 5640 % titles, for instance. 5641 \def\*{\unskip\space\ignorespaces}% 5642 \def\entrybreak{\hfil\break}% An undocumented command 5643 % 5644 % Swallow the left brace of the text (first parameter): 5645 \afterassignment\doentry 5646 \let\temp = 5647} 5648\def\entrybreak{\unskip\space\ignorespaces}% 5649\def\doentry{% 5650 % Save the text of the entry in \boxA 5651 \global\setbox\boxA=\hbox\bgroup 5652 \bgroup % Instead of the swallowed brace. 5653 \noindent 5654 \aftergroup\finishentry 5655 % And now comes the text of the entry. 5656 % Not absorbing as a macro argument reduces the chance of problems 5657 % with catcodes occurring. 5658} 5659{\catcode`\@=11 5660% #1 is the page number 5661\gdef\finishentry#1{% 5662 \egroup % end \boxA 5663 \dimen@ = \wd\boxA % Length of text of entry 5664 % add any leaders and page number to \boxA. 5665 \global\setbox\boxA=\hbox\bgroup 5666 \ifpdforxetex 5667 \iflinkentrytext 5668 \pdflinkpage{#1}{\unhbox\boxA}% 5669 \else 5670 \unhbox\boxA 5671 \fi 5672 \else 5673 \unhbox\boxA 5674 \fi 5675 % 5676 % Get the width of the page numbers, and only use 5677 % leaders if they are present. 5678 \global\setbox\boxB = \hbox{#1}% 5679 \ifdim\wd\boxB = 0pt 5680 \null\nobreak\hfill\ % 5681 \else 5682 % 5683 \null\nobreak\indexdotfill % Have leaders before the page number. 5684 % 5685 \ifpdforxetex 5686 \pdfgettoks#1.% 5687 \hskip\skip\thinshrinkable\the\toksA 5688 \else 5689 \hskip\skip\thinshrinkable #1% 5690 \fi 5691 \fi 5692 \egroup % end \boxA 5693 % 5694 % now output 5695 \ifdim\wd\boxB = 0pt 5696 \noindent\unhbox\boxA\par 5697 \nobreak 5698 \else\bgroup 5699 % We want the text of the entries to be aligned to the left, and the 5700 % page numbers to be aligned to the right. 5701 % 5702 \parindent = 0pt 5703 \advance\leftskip by 0pt plus 1fil 5704 \advance\leftskip by 0pt plus -1fill 5705 \rightskip = 0pt plus -1fil 5706 \advance\rightskip by 0pt plus 1fill 5707 % Cause last line, which could consist of page numbers on their own 5708 % if the list of page numbers is long, to be aligned to the right. 5709 \parfillskip=0pt plus -1fill 5710 % 5711 \advance\rightskip by \entryrightmargin 5712 % Determine how far we can stretch into the margin. 5713 % This allows, e.g., "Appendix H GNU Free Documentation License" to 5714 % fit on one line in @letterpaper format. 5715 \ifdim\entryrightmargin>2.1em 5716 \dimen@i=2.1em 5717 \else 5718 \dimen@i=0em 5719 \fi 5720 \advance \parfillskip by 0pt minus 1\dimen@i 5721 % 5722 \dimen@ii = \hsize 5723 \advance\dimen@ii by -1\leftskip 5724 \advance\dimen@ii by -1\entryrightmargin 5725 \advance\dimen@ii by 1\dimen@i 5726 \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line 5727 \ifdim\dimen@ > 0.8\dimen@ii % due to long index text 5728 % Try to split the text roughly evenly. \dimen@ will be the length of 5729 % the first line. 5730 \dimen@ = 0.7\dimen@ 5731 \dimen@ii = \hsize 5732 \ifnum\dimen@>\dimen@ii 5733 % If the entry is too long (for example, if it needs more than 5734 % two lines), use all the space in the first line. 5735 \dimen@ = \dimen@ii 5736 \fi 5737 \advance\leftskip by 0pt plus 1fill % ragged right 5738 \advance \dimen@ by 1\rightskip 5739 \parshape = 2 0pt \dimen@ 0em \dimen@ii 5740 % Ideally we'd add a finite glue at the end of the first line only, 5741 % instead of using \parshape with explicit line lengths, but TeX 5742 % doesn't seem to provide a way to do such a thing. 5743 % 5744 % Indent all lines but the first one. 5745 \advance\leftskip by 1em 5746 \advance\parindent by -1em 5747 \fi\fi 5748 \indent % start paragraph 5749 \unhbox\boxA 5750 % 5751 % Do not prefer a separate line ending with a hyphen to fewer lines. 5752 \finalhyphendemerits = 0 5753 % 5754 % Word spacing - no stretch 5755 \spaceskip=\fontdimen2\font minus \fontdimen4\font 5756 % 5757 \linepenalty=1000 % Discourage line breaks. 5758 \hyphenpenalty=5000 % Discourage hyphenation. 5759 % 5760 \par % format the paragraph 5761 \egroup % The \vbox 5762 \fi 5763 \endgroup 5764}} 5765 5766\newskip\thinshrinkable 5767\skip\thinshrinkable=.15em minus .15em 5768 5769% Like plain.tex's \dotfill, except uses up at least 1 em. 5770% The filll stretch here overpowers both the fil and fill stretch to push 5771% the page number to the right. 5772\def\indexdotfill{\cleaders 5773 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll} 5774 5775 5776\def\primary #1{\line{#1\hfil}} 5777 5778\def\secondary{\indententry{0.5cm}} 5779\def\tertiary{\indententry{1cm}} 5780 5781\def\indententry#1#2#3{% 5782 \bgroup 5783 \leftskip=#1 5784 \entry{#2}{#3}% 5785 \egroup 5786} 5787 5788% Define two-column mode, which we use to typeset indexes. 5789% Adapted from the TeXbook, page 416, which is to say, 5790% the manmac.tex format used to print the TeXbook itself. 5791\catcode`\@=11 % private names 5792 5793\newbox\partialpage 5794\newdimen\doublecolumnhsize 5795 5796\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns 5797 % If not much space left on page, start a new page. 5798 \ifdim\pagetotal>0.8\vsize\vfill\eject\fi 5799 % 5800 % Grab any single-column material above us. 5801 \output = {% 5802 \savetopmark 5803 % 5804 \global\setbox\partialpage = \vbox{% 5805 % Unvbox the main output page. 5806 \unvbox\PAGE 5807 \kern-\topskip \kern\baselineskip 5808 }% 5809 }% 5810 \eject % run that output routine to set \partialpage 5811 % 5812 % Use the double-column output routine for subsequent pages. 5813 \output = {\doublecolumnout}% 5814 % 5815 % Change the page size parameters. We could do this once outside this 5816 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 5817 % format, but then we repeat the same computation. Repeating a couple 5818 % of assignments once per index is clearly meaningless for the 5819 % execution time, so we may as well do it in one place. 5820 % 5821 % First we halve the line length, less a little for the gutter between 5822 % the columns. We compute the gutter based on the line length, so it 5823 % changes automatically with the paper format. The magic constant 5824 % below is chosen so that the gutter has the same value (well, +-<1pt) 5825 % as it did when we hard-coded it. 5826 % 5827 % We put the result in a separate register, \doublecolumhsize, so we 5828 % can restore it in \pagesofar, after \hsize itself has (potentially) 5829 % been clobbered. 5830 % 5831 \doublecolumnhsize = \hsize 5832 \advance\doublecolumnhsize by -.04154\hsize 5833 \divide\doublecolumnhsize by 2 5834 \hsize = \doublecolumnhsize 5835 % 5836 % Get the available space for the double columns -- the normal 5837 % (undoubled) page height minus any material left over from the 5838 % previous page. 5839 \advance\vsize by -\ht\partialpage 5840 \vsize = 2\vsize 5841 % 5842 % For the benefit of balancing columns 5843 \advance\baselineskip by 0pt plus 0.5pt 5844} 5845 5846% The double-column output routine for all double-column pages except 5847% the last, which is done by \balancecolumns. 5848% 5849\def\doublecolumnout{% 5850 % 5851 \savetopmark 5852 \splittopskip=\topskip \splitmaxdepth=\maxdepth 5853 \dimen@ = \vsize 5854 \divide\dimen@ by 2 5855 % 5856 % box0 will be the left-hand column, box2 the right. 5857 \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@ 5858 \global\advance\vsize by 2\ht\partialpage 5859 \onepageout\pagesofar % empty except for the first time we are called 5860 \unvbox\PAGE 5861 \penalty\outputpenalty 5862} 5863% 5864% Re-output the contents of the output page -- any previous material, 5865% followed by the two boxes we just split, in box0 and box2. 5866\def\pagesofar{% 5867 \unvbox\partialpage 5868 % 5869 \hsize = \doublecolumnhsize 5870 \wd0=\hsize \wd2=\hsize 5871 \hbox to\txipagewidth{\box0\hfil\box2}% 5872} 5873 5874 5875% Finished with double columns. 5876\def\enddoublecolumns{% 5877 % The following penalty ensures that the page builder is exercised 5878 % _before_ we change the output routine. This is necessary in the 5879 % following situation: 5880 % 5881 % The last section of the index consists only of a single entry. 5882 % Before this section, \pagetotal is less than \pagegoal, so no 5883 % break occurs before the last section starts. However, the last 5884 % section, consisting of \initial and the single \entry, does not 5885 % fit on the page and has to be broken off. Without the following 5886 % penalty the page builder will not be exercised until \eject 5887 % below, and by that time we'll already have changed the output 5888 % routine to the \balancecolumns version, so the next-to-last 5889 % double-column page will be processed with \balancecolumns, which 5890 % is wrong: The two columns will go to the main vertical list, with 5891 % the broken-off section in the recent contributions. As soon as 5892 % the output routine finishes, TeX starts reconsidering the page 5893 % break. The two columns and the broken-off section both fit on the 5894 % page, because the two columns now take up only half of the page 5895 % goal. When TeX sees \eject from below which follows the final 5896 % section, it invokes the new output routine that we've set after 5897 % \balancecolumns below; \onepageout will try to fit the two columns 5898 % and the final section into the vbox of \txipageheight (see 5899 % \pagebody), causing an overfull box. 5900 % 5901 % Note that glue won't work here, because glue does not exercise the 5902 % page builder, unlike penalties (see The TeXbook, pp. 280-281). 5903 \penalty0 5904 % 5905 \output = {% 5906 % Split the last of the double-column material. 5907 \savetopmark 5908 \balancecolumns 5909 }% 5910 \eject % call the \output just set 5911 \ifdim\pagetotal=0pt 5912 % Having called \balancecolumns once, we do not 5913 % want to call it again. Therefore, reset \output to its normal 5914 % definition right away. 5915 \global\output=\expandafter{\the\defaultoutput} 5916 % 5917 \endgroup % started in \begindoublecolumns 5918 % Leave the double-column material on the current page, no automatic 5919 % page break. 5920 \box\balancedcolumns 5921 % 5922 % \pagegoal was set to the doubled \vsize above, since we restarted 5923 % the current page. We're now back to normal single-column 5924 % typesetting, so reset \pagegoal to the normal \vsize. 5925 \global\vsize = \txipageheight % 5926 \pagegoal = \txipageheight % 5927 \else 5928 % We had some left-over material. This might happen when \doublecolumnout 5929 % is called in \balancecolumns. Try again. 5930 \expandafter\enddoublecolumns 5931 \fi 5932} 5933\newbox\balancedcolumns 5934\setbox\balancedcolumns=\vbox{shouldnt see this}% 5935% 5936% Only called for the last of the double column material. \doublecolumnout 5937% does the others. 5938\def\balancecolumns{% 5939 \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120. 5940 \dimen@ = \ht0 5941 \ifdim\dimen@<7\baselineskip 5942 % Don't split a short final column in two. 5943 \setbox2=\vbox{}% 5944 \global\setbox\balancedcolumns=\vbox{\pagesofar}% 5945 \else 5946 % double the leading vertical space 5947 \advance\dimen@ by \topskip 5948 \advance\dimen@ by-\baselineskip 5949 \divide\dimen@ by 2 % target to split to 5950 \dimen@ii = \dimen@ 5951 \splittopskip = \topskip 5952 % Loop until left column is at least as high as the right column. 5953 {% 5954 \vbadness = 10000 5955 \loop 5956 \global\setbox3 = \copy0 5957 \global\setbox1 = \vsplit3 to \dimen@ 5958 \ifdim\ht1<\ht3 5959 \global\advance\dimen@ by 1pt 5960 \repeat 5961 }% 5962 % Now the left column is in box 1, and the right column in box 3. 5963 % 5964 % Check whether the left column has come out higher than the page itself. 5965 % (Note that we have doubled \vsize for the double columns, so 5966 % the actual height of the page is 0.5\vsize). 5967 \ifdim2\ht1>\vsize 5968 % It appears that we have been called upon to balance too much material. 5969 % Output some of it with \doublecolumnout, leaving the rest on the page. 5970 \setbox\PAGE=\box0 5971 \doublecolumnout 5972 \else 5973 % Compare the heights of the two columns. 5974 \ifdim4\ht1>5\ht3 5975 % Column heights are too different, so don't make their bottoms 5976 % flush with each other. 5977 \setbox2=\vbox to \ht1 {\unvbox3\vfill}% 5978 \setbox0=\vbox to \ht1 {\unvbox1\vfill}% 5979 \else 5980 % Make column bottoms flush with each other. 5981 \setbox2=\vbox to\ht1{\unvbox3\unskip}% 5982 \setbox0=\vbox to\ht1{\unvbox1\unskip}% 5983 \fi 5984 \global\setbox\balancedcolumns=\vbox{\pagesofar}% 5985 \fi 5986 \fi 5987 % 5988} 5989\catcode`\@ = \other 5990 5991 5992\message{sectioning,} 5993% Chapters, sections, etc. 5994 5995% Let's start with @part. 5996\parseargdef\part{\partzzz{#1}} 5997\def\partzzz#1{% 5998 \chapoddpage 5999 \null 6000 \vskip.3\vsize % move it down on the page a bit 6001 \begingroup 6002 \noindent \titlefonts\rm #1\par % the text 6003 \let\lastnode=\empty % no node to associate with 6004 \writetocentry{part}{#1}{}% but put it in the toc 6005 \headingsoff % no headline or footline on the part page 6006 % This outputs a mark at the end of the page that clears \thischapter 6007 % and \thissection, as is done in \startcontents. 6008 \let\pchapsepmacro\relax 6009 \chapmacro{}{Yomitfromtoc}{}% 6010 \chapoddpage 6011 \endgroup 6012} 6013 6014% \unnumberedno is an oxymoron. But we count the unnumbered 6015% sections so that we can refer to them unambiguously in the pdf 6016% outlines by their "section number". We avoid collisions with chapter 6017% numbers by starting them at 10000. (If a document ever has 10000 6018% chapters, we're in trouble anyway, I'm sure.) 6019\newcount\unnumberedno \unnumberedno = 10000 6020\newcount\chapno 6021\newcount\secno \secno=0 6022\newcount\subsecno \subsecno=0 6023\newcount\subsubsecno \subsubsecno=0 6024 6025% This counter is funny since it counts through charcodes of letters A, B, ... 6026\newcount\appendixno \appendixno = `\@ 6027% 6028% \def\appendixletter{\char\the\appendixno} 6029% We do the following ugly conditional instead of the above simple 6030% construct for the sake of pdftex, which needs the actual 6031% letter in the expansion, not just typeset. 6032% 6033\def\appendixletter{% 6034 \ifnum\appendixno=`A A% 6035 \else\ifnum\appendixno=`B B% 6036 \else\ifnum\appendixno=`C C% 6037 \else\ifnum\appendixno=`D D% 6038 \else\ifnum\appendixno=`E E% 6039 \else\ifnum\appendixno=`F F% 6040 \else\ifnum\appendixno=`G G% 6041 \else\ifnum\appendixno=`H H% 6042 \else\ifnum\appendixno=`I I% 6043 \else\ifnum\appendixno=`J J% 6044 \else\ifnum\appendixno=`K K% 6045 \else\ifnum\appendixno=`L L% 6046 \else\ifnum\appendixno=`M M% 6047 \else\ifnum\appendixno=`N N% 6048 \else\ifnum\appendixno=`O O% 6049 \else\ifnum\appendixno=`P P% 6050 \else\ifnum\appendixno=`Q Q% 6051 \else\ifnum\appendixno=`R R% 6052 \else\ifnum\appendixno=`S S% 6053 \else\ifnum\appendixno=`T T% 6054 \else\ifnum\appendixno=`U U% 6055 \else\ifnum\appendixno=`V V% 6056 \else\ifnum\appendixno=`W W% 6057 \else\ifnum\appendixno=`X X% 6058 \else\ifnum\appendixno=`Y Y% 6059 \else\ifnum\appendixno=`Z Z% 6060 % The \the is necessary, despite appearances, because \appendixletter is 6061 % expanded while writing the .toc file. \char\appendixno is not 6062 % expandable, thus it is written literally, thus all appendixes come out 6063 % with the same letter (or @) in the toc without it. 6064 \else\char\the\appendixno 6065 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 6066 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} 6067 6068% Each @chapter defines these (using marks) as the number+name, number 6069% and name of the chapter. Page headings and footings can use 6070% these. @section does likewise. 6071\def\thischapter{} 6072\def\thischapternum{} 6073\def\thischaptername{} 6074\def\thissection{} 6075\def\thissectionnum{} 6076\def\thissectionname{} 6077 6078\newcount\absseclevel % used to calculate proper heading level 6079\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count 6080 6081% @raisesections: treat @section as chapter, @subsection as section, etc. 6082\def\raisesections{\global\advance\secbase by -1} 6083 6084% @lowersections: treat @chapter as section, @section as subsection, etc. 6085\def\lowersections{\global\advance\secbase by 1} 6086 6087% we only have subsub. 6088\chardef\maxseclevel = 3 6089% 6090% A numbered section within an unnumbered changes to unnumbered too. 6091% To achieve this, remember the "biggest" unnum. sec. we are currently in: 6092\chardef\unnlevel = \maxseclevel 6093% 6094% Trace whether the current chapter is an appendix or not: 6095% \chapheadtype is "N" or "A", unnumbered chapters are ignored. 6096\def\chapheadtype{N} 6097 6098% Choose a heading macro 6099% #1 is heading type 6100% #2 is heading level 6101% #3 is text for heading 6102\def\genhead#1#2#3{% 6103 % Compute the abs. sec. level: 6104 \absseclevel=#2 6105 \advance\absseclevel by \secbase 6106 % Make sure \absseclevel doesn't fall outside the range: 6107 \ifnum \absseclevel < 0 6108 \absseclevel = 0 6109 \else 6110 \ifnum \absseclevel > 3 6111 \absseclevel = 3 6112 \fi 6113 \fi 6114 % The heading type: 6115 \def\headtype{#1}% 6116 \if \headtype U% 6117 \ifnum \absseclevel < \unnlevel 6118 \chardef\unnlevel = \absseclevel 6119 \fi 6120 \else 6121 % Check for appendix sections: 6122 \ifnum \absseclevel = 0 6123 \edef\chapheadtype{\headtype}% 6124 \else 6125 \if \headtype A\if \chapheadtype N% 6126 \errmessage{@appendix... within a non-appendix chapter}% 6127 \fi\fi 6128 \fi 6129 % Check for numbered within unnumbered: 6130 \ifnum \absseclevel > \unnlevel 6131 \def\headtype{U}% 6132 \else 6133 \chardef\unnlevel = 3 6134 \fi 6135 \fi 6136 % Now print the heading: 6137 \if \headtype U% 6138 \ifcase\absseclevel 6139 \unnumberedzzz{#3}% 6140 \or \unnumberedseczzz{#3}% 6141 \or \unnumberedsubseczzz{#3}% 6142 \or \unnumberedsubsubseczzz{#3}% 6143 \fi 6144 \else 6145 \if \headtype A% 6146 \ifcase\absseclevel 6147 \appendixzzz{#3}% 6148 \or \appendixsectionzzz{#3}% 6149 \or \appendixsubseczzz{#3}% 6150 \or \appendixsubsubseczzz{#3}% 6151 \fi 6152 \else 6153 \ifcase\absseclevel 6154 \chapterzzz{#3}% 6155 \or \seczzz{#3}% 6156 \or \numberedsubseczzz{#3}% 6157 \or \numberedsubsubseczzz{#3}% 6158 \fi 6159 \fi 6160 \fi 6161 \suppressfirstparagraphindent 6162} 6163 6164% an interface: 6165\def\numhead{\genhead N} 6166\def\apphead{\genhead A} 6167\def\unnmhead{\genhead U} 6168 6169% @chapter, @appendix, @unnumbered. Increment top-level counter, reset 6170% all lower-level sectioning counters to zero. 6171% 6172% Also set \chaplevelprefix, which we prepend to @float sequence numbers 6173% (e.g., figures), q.v. By default (before any chapter), that is empty. 6174\let\chaplevelprefix = \empty 6175% 6176\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz 6177\def\chapterzzz#1{% 6178 % section resetting is \global in case the chapter is in a group, such 6179 % as an @include file. 6180 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6181 \global\advance\chapno by 1 6182 % 6183 % Used for \float. 6184 \gdef\chaplevelprefix{\the\chapno.}% 6185 \resetallfloatnos 6186 % 6187 % \putwordChapter can contain complex things in translations. 6188 \toks0=\expandafter{\putwordChapter}% 6189 \message{\the\toks0 \space \the\chapno}% 6190 % 6191 % Write the actual heading. 6192 \chapmacro{#1}{Ynumbered}{\the\chapno}% 6193 % 6194 % So @section and the like are numbered underneath this chapter. 6195 \global\let\section = \numberedsec 6196 \global\let\subsection = \numberedsubsec 6197 \global\let\subsubsection = \numberedsubsubsec 6198} 6199 6200\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz 6201% 6202\def\appendixzzz#1{% 6203 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6204 \global\advance\appendixno by 1 6205 \gdef\chaplevelprefix{\appendixletter.}% 6206 \resetallfloatnos 6207 % 6208 % \putwordAppendix can contain complex things in translations. 6209 \toks0=\expandafter{\putwordAppendix}% 6210 \message{\the\toks0 \space \appendixletter}% 6211 % 6212 \chapmacro{#1}{Yappendix}{\appendixletter}% 6213 % 6214 \global\let\section = \appendixsec 6215 \global\let\subsection = \appendixsubsec 6216 \global\let\subsubsection = \appendixsubsubsec 6217} 6218 6219% normally unnmhead0 calls unnumberedzzz: 6220\outer\parseargdef\unnumbered{\unnmhead0{#1}} 6221\def\unnumberedzzz#1{% 6222 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 6223 \global\advance\unnumberedno by 1 6224 % 6225 % Since an unnumbered has no number, no prefix for figures. 6226 \global\let\chaplevelprefix = \empty 6227 \resetallfloatnos 6228 % 6229 % This used to be simply \message{#1}, but TeX fully expands the 6230 % argument to \message. Therefore, if #1 contained @-commands, TeX 6231 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX 6232 % expanded @cite (which turns out to cause errors because \cite is meant 6233 % to be executed, not expanded). 6234 % 6235 % Anyway, we don't want the fully-expanded definition of @cite to appear 6236 % as a result of the \message, we just want `@cite' itself. We use 6237 % \the<toks register> to achieve this: TeX expands \the<toks> only once, 6238 % simply yielding the contents of <toks register>. (We also do this for 6239 % the toc entries.) 6240 \toks0 = {#1}% 6241 \message{(\the\toks0)}% 6242 % 6243 \chapmacro{#1}{Ynothing}{\the\unnumberedno}% 6244 % 6245 \global\let\section = \unnumberedsec 6246 \global\let\subsection = \unnumberedsubsec 6247 \global\let\subsubsection = \unnumberedsubsubsec 6248} 6249 6250% @centerchap is like @unnumbered, but the heading is centered. 6251\outer\parseargdef\centerchap{% 6252 \let\centerparametersmaybe = \centerparameters 6253 \unnmhead0{#1}% 6254 \let\centerparametersmaybe = \relax 6255} 6256 6257% @top is like @unnumbered. 6258\let\top\unnumbered 6259 6260% Sections. 6261% 6262\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz 6263\def\seczzz#1{% 6264 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6265 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% 6266} 6267 6268% normally calls appendixsectionzzz: 6269\outer\parseargdef\appendixsection{\apphead1{#1}} 6270\def\appendixsectionzzz#1{% 6271 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6272 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% 6273} 6274\let\appendixsec\appendixsection 6275 6276% normally calls unnumberedseczzz: 6277\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} 6278\def\unnumberedseczzz#1{% 6279 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 6280 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% 6281} 6282 6283% Subsections. 6284% 6285% normally calls numberedsubseczzz: 6286\outer\parseargdef\numberedsubsec{\numhead2{#1}} 6287\def\numberedsubseczzz#1{% 6288 \global\subsubsecno=0 \global\advance\subsecno by 1 6289 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% 6290} 6291 6292% normally calls appendixsubseczzz: 6293\outer\parseargdef\appendixsubsec{\apphead2{#1}} 6294\def\appendixsubseczzz#1{% 6295 \global\subsubsecno=0 \global\advance\subsecno by 1 6296 \sectionheading{#1}{subsec}{Yappendix}% 6297 {\appendixletter.\the\secno.\the\subsecno}% 6298} 6299 6300% normally calls unnumberedsubseczzz: 6301\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} 6302\def\unnumberedsubseczzz#1{% 6303 \global\subsubsecno=0 \global\advance\subsecno by 1 6304 \sectionheading{#1}{subsec}{Ynothing}% 6305 {\the\unnumberedno.\the\secno.\the\subsecno}% 6306} 6307 6308% Subsubsections. 6309% 6310% normally numberedsubsubseczzz: 6311\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} 6312\def\numberedsubsubseczzz#1{% 6313 \global\advance\subsubsecno by 1 6314 \sectionheading{#1}{subsubsec}{Ynumbered}% 6315 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% 6316} 6317 6318% normally appendixsubsubseczzz: 6319\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} 6320\def\appendixsubsubseczzz#1{% 6321 \global\advance\subsubsecno by 1 6322 \sectionheading{#1}{subsubsec}{Yappendix}% 6323 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% 6324} 6325 6326% normally unnumberedsubsubseczzz: 6327\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} 6328\def\unnumberedsubsubseczzz#1{% 6329 \global\advance\subsubsecno by 1 6330 \sectionheading{#1}{subsubsec}{Ynothing}% 6331 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% 6332} 6333 6334% These macros control what the section commands do, according 6335% to what kind of chapter we are in (ordinary, appendix, or unnumbered). 6336% Define them by default for a numbered chapter. 6337\let\section = \numberedsec 6338\let\subsection = \numberedsubsec 6339\let\subsubsection = \numberedsubsubsec 6340 6341% Define @majorheading, @heading and @subheading 6342 6343\def\majorheading{% 6344 {\advance\chapheadingskip by 10pt \chapbreak }% 6345 \parsearg\chapheadingzzz 6346} 6347 6348\def\chapheading{\chapbreak \parsearg\chapheadingzzz} 6349\def\chapheadingzzz#1{% 6350 \vbox{\chapfonts \raggedtitlesettings #1\par}% 6351 \nobreak\bigskip \nobreak 6352 \suppressfirstparagraphindent 6353} 6354 6355% @heading, @subheading, @subsubheading. 6356\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} 6357 \suppressfirstparagraphindent} 6358\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} 6359 \suppressfirstparagraphindent} 6360\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} 6361 \suppressfirstparagraphindent} 6362 6363% These macros generate a chapter, section, etc. heading only 6364% (including whitespace, linebreaking, etc. around it), 6365% given all the information in convenient, parsed form. 6366 6367% Args are the skip and penalty (usually negative) 6368\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} 6369 6370% Parameter controlling skip before chapter headings (if needed) 6371\newskip\chapheadingskip 6372 6373% Define plain chapter starts, and page on/off switching for it. 6374\def\chapbreak{\dobreak \chapheadingskip {-4000}} 6375 6376% Start a new page 6377\def\chappager{\par\vfill\supereject} 6378 6379% \chapoddpage - start on an odd page for a new chapter 6380% Because \domark is called before \chapoddpage, the filler page will 6381% get the headings for the next chapter, which is wrong. But we don't 6382% care -- we just disable all headings on the filler page. 6383\def\chapoddpage{% 6384 \chappager 6385 \ifodd\pageno \else 6386 \begingroup 6387 \headingsoff 6388 \null 6389 \chappager 6390 \endgroup 6391 \fi 6392} 6393 6394\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname\HEADINGSon} 6395 6396\def\CHAPPAGoff{% 6397\global\let\contentsalignmacro = \chappager 6398\global\let\pchapsepmacro=\chapbreak 6399\global\def\HEADINGSon{\HEADINGSsinglechapoff}} 6400 6401\def\CHAPPAGon{% 6402\global\let\contentsalignmacro = \chappager 6403\global\let\pchapsepmacro=\chappager 6404\global\def\HEADINGSon{\HEADINGSsingle}} 6405 6406\def\CHAPPAGodd{% 6407\global\let\contentsalignmacro = \chapoddpage 6408\global\let\pchapsepmacro=\chapoddpage 6409\global\def\HEADINGSon{\HEADINGSdouble}} 6410 6411\setchapternewpage on 6412 6413% \chapmacro - Chapter opening. 6414% 6415% #1 is the text, #2 is the section type (Ynumbered, Ynothing, 6416% Yappendix, Yomitfromtoc), #3 the chapter number. 6417% Not used for @heading series. 6418% 6419% To test against our argument. 6420\def\Ynothingkeyword{Ynothing} 6421\def\Yappendixkeyword{Yappendix} 6422\def\Yomitfromtockeyword{Yomitfromtoc} 6423% 6424% 6425% Definitions for @thischapter. These can be overridden in translation 6426% files. 6427\def\thischapterAppendix{% 6428 \putwordAppendix{} \thischapternum: \thischaptername} 6429 6430\def\thischapterChapter{% 6431 \putwordChapter{} \thischapternum: \thischaptername} 6432% 6433% 6434\def\chapmacro#1#2#3{% 6435 \expandafter\ifx\thisenv\titlepage\else 6436 \checkenv{}% chapters, etc., should not start inside an environment. 6437 \fi 6438 % Insert the first mark before the heading break (see notes for \domark). 6439 \let\prevchapterdefs=\currentchapterdefs 6440 \let\prevsectiondefs=\currentsectiondefs 6441 \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% 6442 \gdef\thissection{}}% 6443 % 6444 \def\temptype{#2}% 6445 \ifx\temptype\Ynothingkeyword 6446 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% 6447 \gdef\thischapter{\thischaptername}}% 6448 \else\ifx\temptype\Yomitfromtockeyword 6449 \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% 6450 \gdef\thischapter{}}% 6451 \else\ifx\temptype\Yappendixkeyword 6452 \toks0={#1}% 6453 \xdef\currentchapterdefs{% 6454 \gdef\noexpand\thischaptername{\the\toks0}% 6455 \gdef\noexpand\thischapternum{\appendixletter}% 6456 \let\noexpand\thischapter\noexpand\thischapterAppendix 6457 }% 6458 \else 6459 \toks0={#1}% 6460 \xdef\currentchapterdefs{% 6461 \gdef\noexpand\thischaptername{\the\toks0}% 6462 \gdef\noexpand\thischapternum{\the\chapno}% 6463 \let\noexpand\thischapter\noexpand\thischapterChapter 6464 }% 6465 \fi\fi\fi 6466 % 6467 % Output the mark. Pass it through \safewhatsit, to take care of 6468 % the preceding space. 6469 \safewhatsit\domark 6470 % 6471 % Insert the chapter heading break. 6472 \pchapsepmacro 6473 % 6474 % Now the second mark, after the heading break. No break points 6475 % between here and the heading. 6476 \let\prevchapterdefs=\currentchapterdefs 6477 \let\prevsectiondefs=\currentsectiondefs 6478 \domark 6479 % 6480 {% 6481 \chapfonts \rm 6482 \let\footnote=\errfootnoteheading % give better error message 6483 % 6484 % Have to define \currentsection before calling \donoderef, because the 6485 % xref code eventually uses it. On the other hand, it has to be called 6486 % after \pchapsepmacro, or the headline will change too soon. 6487 \gdef\currentsection{#1}% 6488 % 6489 % Only insert the separating space if we have a chapter/appendix 6490 % number, and don't print the unnumbered ``number''. 6491 \ifx\temptype\Ynothingkeyword 6492 \setbox0 = \hbox{}% 6493 \def\toctype{unnchap}% 6494 \else\ifx\temptype\Yomitfromtockeyword 6495 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry 6496 \def\toctype{omit}% 6497 \else\ifx\temptype\Yappendixkeyword 6498 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% 6499 \def\toctype{app}% 6500 \else 6501 \setbox0 = \hbox{#3\enspace}% 6502 \def\toctype{numchap}% 6503 \fi\fi\fi 6504 % 6505 % Write the toc entry for this chapter. Must come before the 6506 % \donoderef, because we include the current node name in the toc 6507 % entry, and \donoderef resets it to empty. 6508 \writetocentry{\toctype}{#1}{#3}% 6509 % 6510 % For pdftex, we have to write out the node definition (aka, make 6511 % the pdfdest) after any page break, but before the actual text has 6512 % been typeset. If the destination for the pdf outline is after the 6513 % text, then jumping from the outline may wind up with the text not 6514 % being visible, for instance under high magnification. 6515 \donoderef{#2}% 6516 % 6517 % Typeset the actual heading. 6518 \nobreak % Avoid page breaks at the interline glue. 6519 \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe 6520 \unhbox0 #1\par}% 6521 }% 6522 \nobreak\bigskip % no page break after a chapter title 6523 \nobreak 6524} 6525 6526% @centerchap -- centered and unnumbered. 6527\let\centerparametersmaybe = \relax 6528\def\centerparameters{% 6529 \advance\rightskip by 3\rightskip 6530 \leftskip = \rightskip 6531 \parfillskip = 0pt 6532} 6533 6534 6535% Section titles. These macros combine the section number parts and 6536% call the generic \sectionheading to do the printing. 6537% 6538\newskip\secheadingskip 6539\def\secheadingbreak{\dobreak \secheadingskip{-1000}} 6540 6541% Subsection titles. 6542\newskip\subsecheadingskip 6543\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} 6544 6545% Subsubsection titles. 6546\def\subsubsecheadingskip{\subsecheadingskip} 6547\def\subsubsecheadingbreak{\subsecheadingbreak} 6548 6549% Definition for @thissection. This can be overridden in translation 6550% files. 6551\def\thissectionDef{% 6552 \putwordSection{} \thissectionnum: \thissectionname} 6553% 6554 6555 6556% Print any size, any type, section title. 6557% 6558% #1 is the text of the title, 6559% #2 is the section level (sec/subsec/subsubsec), 6560% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc), 6561% #4 is the section number. 6562% 6563\def\seckeyword{sec} 6564% 6565\def\sectionheading#1#2#3#4{% 6566 {% 6567 \def\sectionlevel{#2}% 6568 \def\temptype{#3}% 6569 % 6570 % It is ok for the @heading series commands to appear inside an 6571 % environment (it's been historically allowed, though the logic is 6572 % dubious), but not the others. 6573 \ifx\temptype\Yomitfromtockeyword\else 6574 \checkenv{}% non-@*heading should not be in an environment. 6575 \fi 6576 \let\footnote=\errfootnoteheading 6577 % 6578 % Switch to the right set of fonts. 6579 \csname #2fonts\endcsname \rm 6580 % 6581 % Insert first mark before the heading break (see notes for \domark). 6582 \let\prevsectiondefs=\currentsectiondefs 6583 \ifx\temptype\Ynothingkeyword 6584 \ifx\sectionlevel\seckeyword 6585 \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% 6586 \gdef\thissection{\thissectionname}}% 6587 \fi 6588 \else\ifx\temptype\Yomitfromtockeyword 6589 % Don't redefine \thissection. 6590 \else\ifx\temptype\Yappendixkeyword 6591 \ifx\sectionlevel\seckeyword 6592 \toks0={#1}% 6593 \xdef\currentsectiondefs{% 6594 \gdef\noexpand\thissectionname{\the\toks0}% 6595 \gdef\noexpand\thissectionnum{#4}% 6596 \let\noexpand\thissection\noexpand\thissectionDef 6597 }% 6598 \fi 6599 \else 6600 \ifx\sectionlevel\seckeyword 6601 \toks0={#1}% 6602 \xdef\currentsectiondefs{% 6603 \gdef\noexpand\thissectionname{\the\toks0}% 6604 \gdef\noexpand\thissectionnum{#4}% 6605 \let\noexpand\thissection\noexpand\thissectionDef 6606 }% 6607 \fi 6608 \fi\fi\fi 6609 % 6610 % Go into vertical mode. Usually we'll already be there, but we 6611 % don't want the following whatsit to end up in a preceding paragraph 6612 % if the document didn't happen to have a blank line. 6613 \par 6614 % 6615 % Output the mark. Pass it through \safewhatsit, to take care of 6616 % the preceding space. 6617 \safewhatsit\domark 6618 % 6619 % Insert space above the heading. 6620 \csname #2headingbreak\endcsname 6621 % 6622 % Now the second mark, after the heading break. No break points 6623 % between here and the heading. 6624 \global\let\prevsectiondefs=\currentsectiondefs 6625 \domark 6626 % 6627 % Only insert the space after the number if we have a section number. 6628 \ifx\temptype\Ynothingkeyword 6629 \setbox0 = \hbox{}% 6630 \def\toctype{unn}% 6631 \gdef\currentsection{#1}% 6632 \else\ifx\temptype\Yomitfromtockeyword 6633 % for @headings -- no section number, don't include in toc, 6634 % and don't redefine \currentsection. 6635 \setbox0 = \hbox{}% 6636 \def\toctype{omit}% 6637 \let\sectionlevel=\empty 6638 \else\ifx\temptype\Yappendixkeyword 6639 \setbox0 = \hbox{#4\enspace}% 6640 \def\toctype{app}% 6641 \gdef\currentsection{#1}% 6642 \else 6643 \setbox0 = \hbox{#4\enspace}% 6644 \def\toctype{num}% 6645 \gdef\currentsection{#1}% 6646 \fi\fi\fi 6647 % 6648 % Write the toc entry (before \donoderef). See comments in \chapmacro. 6649 \writetocentry{\toctype\sectionlevel}{#1}{#4}% 6650 % 6651 % Write the node reference (= pdf destination for pdftex). 6652 % Again, see comments in \chapmacro. 6653 \donoderef{#3}% 6654 % 6655 % Interline glue will be inserted when the vbox is completed. 6656 % That glue will be a valid breakpoint for the page, since it'll be 6657 % preceded by a whatsit (usually from the \donoderef, or from the 6658 % \writetocentry if there was no node). We don't want to allow that 6659 % break, since then the whatsits could end up on page n while the 6660 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. 6661 \nobreak 6662 % 6663 % Output the actual section heading. 6664 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright 6665 \hangindent=\wd0 % zero if no section number 6666 \unhbox0 #1}% 6667 }% 6668 % Add extra space after the heading -- half of whatever came above it. 6669 % Don't allow stretch, though. 6670 \kern .5 \csname #2headingskip\endcsname 6671 % 6672 % Do not let the kern be a potential breakpoint, as it would be if it 6673 % was followed by glue. 6674 \nobreak 6675 % 6676 % We'll almost certainly start a paragraph next, so don't let that 6677 % glue accumulate. (Not a breakpoint because it's preceded by a 6678 % discardable item.) However, when a paragraph is not started next 6679 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out 6680 % or the negative glue will cause weirdly wrong output, typically 6681 % obscuring the section heading with something else. 6682 \vskip-\parskip 6683 % 6684 % This is so the last item on the main vertical list is a known 6685 % \penalty > 10000, so \startdefun, etc., can recognize the situation 6686 % and do the needful. 6687 \penalty 10001 6688} 6689 6690 6691\message{toc,} 6692% Table of contents. 6693\newwrite\tocfile 6694 6695% Write an entry to the toc file, opening it if necessary. 6696% Called from @chapter, etc. 6697% 6698% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} 6699% We append the current node name (if any) and page number as additional 6700% arguments for the \{chap,sec,...}entry macros which will eventually 6701% read this. The node name is used in the pdf outlines as the 6702% destination to jump to. 6703% 6704% We open the .toc file for writing here instead of at @setfilename (or 6705% any other fixed time) so that @contents can be anywhere in the document. 6706% But if #1 is `omit', then we don't do anything. This is used for the 6707% table of contents chapter openings themselves. 6708% 6709\newif\iftocfileopened 6710\def\omitkeyword{omit}% 6711% 6712\def\writetocentry#1#2#3{% 6713 \edef\writetoctype{#1}% 6714 \ifx\writetoctype\omitkeyword \else 6715 \iftocfileopened\else 6716 \immediate\openout\tocfile = \jobname.toc 6717 \global\tocfileopenedtrue 6718 \fi 6719 % 6720 \iflinks 6721 {\atdummies 6722 \edef\temp{% 6723 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% 6724 \temp 6725 }% 6726 \fi 6727 \fi 6728 % 6729 % Tell \shipout to create a pdf destination on each page, if we're 6730 % writing pdf. These are used in the table of contents. We can't 6731 % just write one on every page because the title pages are numbered 6732 % 1 and 2 (the page numbers aren't printed), and so are the first 6733 % two pages of the document. Thus, we'd have two destinations named 6734 % `1', and two named `2'. 6735 \ifpdforxetex 6736 \global\pdfmakepagedesttrue 6737 \fi 6738} 6739 6740 6741% These characters do not print properly in the Computer Modern roman 6742% fonts, so we must take special care. This is more or less redundant 6743% with the Texinfo input format setup at the end of this file. 6744% 6745\def\activecatcodes{% 6746 \catcode`\"=\active 6747 \catcode`\$=\active 6748 \catcode`\<=\active 6749 \catcode`\>=\active 6750 \catcode`\\=\active 6751 \catcode`\^=\active 6752 \catcode`\_=\active 6753 \catcode`\|=\active 6754 \catcode`\~=\active 6755} 6756 6757 6758% Read the toc file, which is essentially Texinfo input. 6759\def\readtocfile{% 6760 \setupdatafile 6761 \activecatcodes 6762 \input \tocreadfilename 6763} 6764 6765\newskip\contentsrightmargin \contentsrightmargin=1in 6766\newcount\savepageno 6767\newcount\lastnegativepageno \lastnegativepageno = -1 6768 6769% Prepare to read what we've written to \tocfile. 6770% 6771\def\startcontents#1{% 6772 % If @setchapternewpage on, and @headings double, the contents should 6773 % start on an odd page, unlike chapters. 6774 \contentsalignmacro 6775 \immediate\closeout\tocfile 6776 % 6777 % Don't need to put `Contents' or `Short Contents' in the headline. 6778 % It is abundantly clear what they are. 6779 \chapmacro{#1}{Yomitfromtoc}{}% 6780 % 6781 \savepageno = \pageno 6782 \begingroup % Set up to handle contents files properly. 6783 \raggedbottom % Worry more about breakpoints than the bottom. 6784 \entryrightmargin=\contentsrightmargin % Don't use the full line length. 6785 % 6786 % Roman numerals for page numbers. 6787 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi 6788 \def\thistitle{}% no title in double-sided headings 6789 % Record where the Roman numerals started. 6790 \ifnum\romancount=0 \global\romancount=\pagecount \fi 6791 \linkentrytexttrue 6792} 6793 6794% \raggedbottom in plain.tex hardcodes \topskip so override it 6795\catcode`\@=11 6796\def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue} 6797\catcode`\@=\other 6798 6799% redefined for the two-volume lispref. We always output on 6800% \jobname.toc even if this is redefined. 6801% 6802\def\tocreadfilename{\jobname.toc} 6803 6804% Normal (long) toc. 6805% 6806\def\contents{% 6807 \startcontents{\putwordTOC}% 6808 \openin 1 \tocreadfilename\space 6809 \ifeof 1 \else 6810 \readtocfile 6811 \fi 6812 \vfill \eject 6813 \contentsalignmacro % in case @setchapternewpage odd is in effect 6814 \ifeof 1 \else 6815 \pdfmakeoutlines 6816 \fi 6817 \closein 1 6818 \endgroup 6819 \contentsendroman 6820} 6821 6822% And just the chapters. 6823\def\summarycontents{% 6824 \startcontents{\putwordShortTOC}% 6825 % 6826 \let\partentry = \shortpartentry 6827 \let\numchapentry = \shortchapentry 6828 \let\appentry = \shortchapentry 6829 \let\unnchapentry = \shortunnchapentry 6830 % We want a true roman here for the page numbers. 6831 \secfonts 6832 \let\rm=\shortcontrm \let\bf=\shortcontbf 6833 \let\sl=\shortcontsl \let\tt=\shortconttt 6834 \rm 6835 \hyphenpenalty = 10000 6836 \advance\baselineskip by 1pt % Open it up a little. 6837 \def\numsecentry##1##2##3##4{} 6838 \let\appsecentry = \numsecentry 6839 \let\unnsecentry = \numsecentry 6840 \let\numsubsecentry = \numsecentry 6841 \let\appsubsecentry = \numsecentry 6842 \let\unnsubsecentry = \numsecentry 6843 \let\numsubsubsecentry = \numsecentry 6844 \let\appsubsubsecentry = \numsecentry 6845 \let\unnsubsubsecentry = \numsecentry 6846 \openin 1 \tocreadfilename\space 6847 \ifeof 1 \else 6848 \readtocfile 6849 \fi 6850 \closein 1 6851 \vfill \eject 6852 \contentsalignmacro % in case @setchapternewpage odd is in effect 6853 \endgroup 6854 \contentsendroman 6855} 6856\let\shortcontents = \summarycontents 6857 6858% Get ready to use Arabic numerals again 6859\def\contentsendroman{% 6860 \lastnegativepageno = \pageno 6861 \global\pageno = \savepageno 6862 % 6863 % If \romancount > \arabiccount, the contents are at the end of the 6864 % document. Otherwise, advance where the Arabic numerals start for 6865 % the page numbers. 6866 \ifnum\romancount>\arabiccount\else\global\arabiccount=\pagecount\fi 6867} 6868 6869% Typeset the label for a chapter or appendix for the short contents. 6870% The arg is, e.g., `A' for an appendix, or `3' for a chapter. 6871% 6872\def\shortchaplabel#1{% 6873 % This space should be enough, since a single number is .5em, and the 6874 % widest letter (M) is 1em, at least in the Computer Modern fonts. 6875 % But use \hss just in case. 6876 % (This space doesn't include the extra space that gets added after 6877 % the label; that gets put in by \shortchapentry above.) 6878 % 6879 % We'd like to right-justify chapter numbers, but that looks strange 6880 % with appendix letters. And right-justifying numbers and 6881 % left-justifying letters looks strange when there is less than 10 6882 % chapters. Have to read the whole toc once to know how many chapters 6883 % there are before deciding ... 6884 \hbox to 1em{#1\hss}% 6885} 6886 6887% These macros generate individual entries in the table of contents. 6888% The first argument is the chapter or section name. 6889% The last argument is the page number. 6890% The arguments in between are the chapter number, section number, ... 6891 6892% Parts, in the main contents. Replace the part number, which doesn't 6893% exist, with an empty box. Let's hope all the numbers have the same width. 6894% Also ignore the page number, which is conventionally not printed. 6895\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} 6896\def\partentry#1#2#3#4{% 6897 % Add stretch and a bonus for breaking the page before the part heading. 6898 % This reduces the chance of the page being broken immediately after the 6899 % part heading, before a following chapter heading. 6900 \vskip 0pt plus 5\baselineskip 6901 \penalty-300 6902 \vskip 0pt plus -5\baselineskip 6903 \dochapentry{\numeralbox\labelspace#1}{}% 6904} 6905% 6906% Parts, in the short toc. 6907\def\shortpartentry#1#2#3#4{% 6908 \penalty-300 6909 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip 6910 \shortchapentry{{\bf #1}}{\numeralbox}{}{}% 6911} 6912 6913% Chapters, in the main contents. 6914\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} 6915 6916% Chapters, in the short toc. 6917% See comments in \dochapentry re vbox and related settings. 6918\def\shortchapentry#1#2#3#4{% 6919 \tocentry{\shortchaplabel{#2}\labelspace #1}{#4}% 6920} 6921 6922% Appendices, in the main contents. 6923% Need the word Appendix, and a fixed-size box. 6924% 6925\def\appendixbox#1{% 6926 % We use M since it's probably the widest letter. 6927 \setbox0 = \hbox{\putwordAppendix{} M}% 6928 \hbox to \wd0{\putwordAppendix{} #1\hss}} 6929% 6930\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}} 6931 6932% Unnumbered chapters. 6933\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} 6934\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{#4}} 6935 6936% Sections. 6937\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} 6938\let\appsecentry=\numsecentry 6939\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} 6940 6941% Subsections. 6942\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} 6943\let\appsubsecentry=\numsubsecentry 6944\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} 6945 6946% And subsubsections. 6947\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} 6948\let\appsubsubsecentry=\numsubsubsecentry 6949\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} 6950 6951% This parameter controls the indentation of the various levels. 6952% Same as \defaultparindent. 6953\newdimen\tocindent \tocindent = 15pt 6954 6955% Now for the actual typesetting. In all these, #1 is the text and #2 is the 6956% page number. 6957% 6958% If the toc has to be broken over pages, we want it to be at chapters 6959% if at all possible; hence the \penalty. 6960\def\dochapentry#1#2{% 6961 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip 6962 \begingroup 6963 % Move the page numbers slightly to the right 6964 \advance\entryrightmargin by -0.05em 6965 \chapentryfonts 6966 \tocentry{#1}{#2}% 6967 \endgroup 6968 \nobreak\vskip .25\baselineskip plus.1\baselineskip 6969} 6970 6971\def\dosecentry#1#2{\begingroup 6972 \secentryfonts \leftskip=\tocindent 6973 \tocentry{#1}{#2}% 6974\endgroup} 6975 6976\def\dosubsecentry#1#2{\begingroup 6977 \subsecentryfonts \leftskip=2\tocindent 6978 \tocentry{#1}{#2}% 6979\endgroup} 6980 6981\def\dosubsubsecentry#1#2{\begingroup 6982 \subsubsecentryfonts \leftskip=3\tocindent 6983 \tocentry{#1}{#2}% 6984\endgroup} 6985 6986% We use the same \entry macro as for the index entries. 6987\let\tocentry = \entry 6988 6989% Space between chapter (or whatever) number and the title. 6990\def\labelspace{\hskip1em \relax} 6991 6992\def\chapentryfonts{\secfonts \rm} 6993\def\secentryfonts{\textfonts} 6994\def\subsecentryfonts{\textfonts} 6995\def\subsubsecentryfonts{\textfonts} 6996 6997 6998\message{environments,} 6999% @foo ... @end foo. 7000 7001% @tex ... @end tex escapes into raw TeX temporarily. 7002% One exception: @ is still an escape character, so that @end tex works. 7003% But \@ or @@ will get a plain @ character. 7004 7005\envdef\tex{% 7006 \setregularquotes 7007 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 7008 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 7009 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie 7010 \catcode `\%=14 7011 \catcode `\+=\other 7012 \catcode `\"=\other 7013 \catcode `\|=\other 7014 \catcode `\<=\other 7015 \catcode `\>=\other 7016 \catcode `\`=\other 7017 \catcode `\'=\other 7018 % 7019 % ' is active in math mode (mathcode"8000). So reset it, and all our 7020 % other math active characters (just in case), to plain's definitions. 7021 \mathactive 7022 % 7023 % Inverse of the list at the beginning of the file. 7024 \let\b=\ptexb 7025 \let\bullet=\ptexbullet 7026 \let\c=\ptexc 7027 \let\,=\ptexcomma 7028 \let\.=\ptexdot 7029 \let\dots=\ptexdots 7030 \let\equiv=\ptexequiv 7031 \let\!=\ptexexclam 7032 \let\i=\ptexi 7033 \let\indent=\ptexindent 7034 \let\noindent=\ptexnoindent 7035 \let\{=\ptexlbrace 7036 \let\+=\tabalign 7037 \let\}=\ptexrbrace 7038 \let\/=\ptexslash 7039 \let\sp=\ptexsp 7040 \let\*=\ptexstar 7041 %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode 7042 \let\t=\ptext 7043 \expandafter \let\csname top\endcsname=\ptextop % we've made it outer 7044 \let\frenchspacing=\plainfrenchspacing 7045 % 7046 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% 7047 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% 7048 \def\@{@}% 7049} 7050% There is no need to define \Etex. 7051 7052% Define @lisp ... @end lisp. 7053% @lisp environment forms a group so it can rebind things, 7054% including the definition of @end lisp (which normally is erroneous). 7055 7056% Amount to narrow the margins by for @lisp. 7057\newskip\lispnarrowing \lispnarrowing=0.4in 7058 7059% This is the definition that ^^M gets inside @lisp, @example, and other 7060% such environments. \null is better than a space, since it doesn't 7061% have any width. 7062\def\lisppar{\null\endgraf} 7063 7064% This space is always present above and below environments. 7065\newskip\envskipamount \envskipamount = 0pt 7066 7067% Make spacing and below environment symmetrical. We use \parskip here 7068% to help in doing that, since in @example-like environments \parskip 7069% is reset to zero; thus the \afterenvbreak inserts no space -- but the 7070% start of the next paragraph will insert \parskip. 7071% 7072\def\aboveenvbreak{{% 7073 % =10000 instead of <10000 because of a special case in \itemzzz and 7074 % \sectionheading, q.v. 7075 \ifnum \lastpenalty=10000 \else 7076 \advance\envskipamount by \parskip 7077 \endgraf 7078 \ifdim\lastskip<\envskipamount 7079 \removelastskip 7080 \ifnum\lastpenalty<10000 7081 % Penalize breaking before the environment, because preceding text 7082 % often leads into it. 7083 \penalty100 7084 \fi 7085 \vskip\envskipamount 7086 \fi 7087 \fi 7088}} 7089 7090\def\afterenvbreak{{% 7091 % =10000 instead of <10000 because of a special case in \itemzzz and 7092 % \sectionheading, q.v. 7093 \ifnum \lastpenalty=10000 \else 7094 \advance\envskipamount by \parskip 7095 \endgraf 7096 \ifdim\lastskip<\envskipamount 7097 \removelastskip 7098 % it's not a good place to break if the last penalty was \nobreak 7099 % or better ... 7100 \ifnum\lastpenalty<10000 \penalty-50 \fi 7101 \vskip\envskipamount 7102 \fi 7103 \fi 7104}} 7105 7106% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will 7107% also clear it, so that its embedded environments do the narrowing again. 7108\let\nonarrowing=\relax 7109 7110% @cartouche ... @end cartouche: draw rectangle w/rounded corners around 7111% environment contents. 7112 7113% 7114\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth 7115\def\ctr{{\hskip 6pt\circle\char'010}} 7116\def\cbl{{\circle\char'012\hskip -6pt}} 7117\def\cbr{{\hskip 6pt\circle\char'011}} 7118\def\carttop{\hbox to \cartouter{\hskip\lskip 7119 \ctl\leaders\hrule height\circthick\hfil\ctr 7120 \hskip\rskip}} 7121\def\cartbot{\hbox to \cartouter{\hskip\lskip 7122 \cbl\leaders\hrule height\circthick\hfil\cbr 7123 \hskip\rskip}} 7124% 7125\newskip\lskip\newskip\rskip 7126 7127% only require the font if @cartouche is actually used 7128\def\cartouchefontdefs{% 7129 \font\circle=lcircle10\relax 7130 \circthick=\fontdimen8\circle 7131} 7132\newdimen\circthick 7133\newdimen\cartouter\newdimen\cartinner 7134\newskip\normbskip\newskip\normpskip\newskip\normlskip 7135 7136 7137\envdef\cartouche{% 7138 \cartouchefontdefs 7139 \ifhmode\par\fi % can't be in the midst of a paragraph. 7140 \startsavinginserts 7141 \lskip=\leftskip \rskip=\rightskip 7142 \leftskip=0pt\rightskip=0pt % we want these *outside*. 7143 % 7144 % Set paragraph width for text inside cartouche. There are 7145 % left and right margins of 3pt each plus two vrules 0.4pt each. 7146 \cartinner=\hsize \advance\cartinner by-\lskip 7147 \advance\cartinner by-\rskip 7148 \advance\cartinner by -6.8pt 7149 % 7150 % For drawing top and bottom of cartouche. Each corner char 7151 % adds 6pt and we take off the width of a rule to line up with the 7152 % right boundary perfectly. 7153 \cartouter=\hsize 7154 \advance\cartouter by 11.6pt 7155 % 7156 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip 7157 % 7158 % If this cartouche directly follows a sectioning command, we need the 7159 % \parskip glue (backspaced over by default) or the cartouche can 7160 % collide with the section heading. 7161 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi 7162 % 7163 \setbox\groupbox=\vtop\bgroup 7164 \baselineskip=0pt\parskip=0pt\lineskip=0pt 7165 \carttop 7166 \hbox\bgroup 7167 \hskip\lskip 7168 \vrule\kern3pt 7169 \vbox\bgroup 7170 \kern3pt 7171 \hsize=\cartinner 7172 \baselineskip=\normbskip 7173 \lineskip=\normlskip 7174 \parskip=\normpskip 7175 \vskip -\parskip 7176 \comment % For explanation, see the end of def\group. 7177} 7178\def\Ecartouche{% 7179 \ifhmode\par\fi 7180 \kern3pt 7181 \egroup 7182 \kern3pt\vrule 7183 \hskip\rskip 7184 \egroup 7185 \cartbot 7186 \egroup 7187 \addgroupbox 7188 \checkinserts 7189} 7190 7191 7192% This macro is called at the beginning of all the @example variants, 7193% inside a group. 7194\newdimen\nonfillparindent 7195\def\nonfillstart{% 7196 \aboveenvbreak 7197 \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy 7198 \sepspaces % Make spaces be word-separators rather than space tokens. 7199 \let\par = \lisppar % don't ignore blank lines 7200 \obeylines % each line of input is a line of output 7201 \parskip = 0pt 7202 % Turn off paragraph indentation but redefine \indent to emulate 7203 % the normal \indent. 7204 \nonfillparindent=\parindent 7205 \parindent = 0pt 7206 \let\indent\nonfillindent 7207 % 7208 \emergencystretch = 0pt % don't try to avoid overfull boxes 7209 \ifx\nonarrowing\relax 7210 \advance \leftskip by \lispnarrowing 7211 \exdentamount=\lispnarrowing 7212 \else 7213 \let\nonarrowing = \relax 7214 \fi 7215 \let\exdent=\nofillexdent 7216} 7217 7218\begingroup 7219\obeyspaces 7220% We want to swallow spaces (but not other tokens) after the fake 7221% @indent in our nonfill-environments, where spaces are normally 7222% active and set to @tie, resulting in them not being ignored after 7223% @indent. 7224\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% 7225\gdef\nonfillindentcheck{% 7226\ifx\temp % 7227\expandafter\nonfillindentgobble% 7228\else% 7229\leavevmode\nonfillindentbox% 7230\fi% 7231}% 7232\endgroup 7233\def\nonfillindentgobble#1{\nonfillindent} 7234\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} 7235 7236% If you want all examples etc. small: @set dispenvsize small. 7237% If you want even small examples the full size: @set dispenvsize nosmall. 7238% This affects the following displayed environments: 7239% @example, @display, @format, @lisp, @verbatim 7240% 7241\def\smallword{small} 7242\def\nosmallword{nosmall} 7243\let\SETdispenvsize\relax 7244\def\setnormaldispenv{% 7245 \ifx\SETdispenvsize\smallword 7246 % end paragraph for sake of leading, in case document has no blank 7247 % line. This is redundant with what happens in \aboveenvbreak, but 7248 % we need to do it before changing the fonts, and it's inconvenient 7249 % to change the fonts afterward. 7250 \ifnum \lastpenalty=10000 \else \endgraf \fi 7251 \smallexamplefonts \rm 7252 \fi 7253} 7254\def\setsmalldispenv{% 7255 \ifx\SETdispenvsize\nosmallword 7256 \else 7257 \ifnum \lastpenalty=10000 \else \endgraf \fi 7258 \smallexamplefonts \rm 7259 \fi 7260} 7261 7262% We often define two environments, @foo and @smallfoo. 7263% Let's do it in one command. #1 is the env name, #2 the definition. 7264\def\makedispenvdef#1#2{% 7265 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% 7266 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% 7267 \expandafter\let\csname E#1\endcsname \afterenvbreak 7268 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak 7269} 7270 7271% Define two environment synonyms (#1 and #2) for an environment. 7272\def\maketwodispenvdef#1#2#3{% 7273 \makedispenvdef{#1}{#3}% 7274 \makedispenvdef{#2}{#3}% 7275} 7276% 7277% @lisp: indented, narrowed, typewriter font; 7278% @example: same as @lisp. 7279% 7280% @smallexample and @smalllisp: use smaller fonts. 7281% Originally contributed by Pavel@xerox. 7282% 7283\maketwodispenvdef{lisp}{example}{% 7284 \nonfillstart 7285 \tt\setcodequotes 7286 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. 7287 \parsearg\gobble 7288} 7289% @display/@smalldisplay: same as @lisp except keep current font. 7290% 7291\makedispenvdef{display}{% 7292 \nonfillstart 7293 \gobble 7294} 7295 7296% @format/@smallformat: same as @display except don't narrow margins. 7297% 7298\makedispenvdef{format}{% 7299 \let\nonarrowing = t% 7300 \nonfillstart 7301 \gobble 7302} 7303 7304% @flushleft: same as @format, but doesn't obey \SETdispenvsize. 7305\envdef\flushleft{% 7306 \let\nonarrowing = t% 7307 \nonfillstart 7308 \gobble 7309} 7310\let\Eflushleft = \afterenvbreak 7311 7312% @flushright. 7313% 7314\envdef\flushright{% 7315 \let\nonarrowing = t% 7316 \nonfillstart 7317 \advance\leftskip by 0pt plus 1fill\relax 7318 \gobble 7319} 7320\let\Eflushright = \afterenvbreak 7321 7322 7323% @raggedright does more-or-less normal line breaking but no right 7324% justification. From plain.tex. 7325\envdef\raggedright{% 7326 \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax 7327} 7328\let\Eraggedright\par 7329 7330 7331% @quotation does normal linebreaking (hence we can't use \nonfillstart) 7332% and narrows the margins. We keep \parskip nonzero in general, since 7333% we're doing normal filling. So, when using \aboveenvbreak and 7334% \afterenvbreak, temporarily make \parskip 0. 7335% 7336\makedispenvdef{quotation}{\quotationstart} 7337% 7338\def\quotationstart{% 7339 \indentedblockstart % same as \indentedblock, but increase right margin too. 7340 \ifx\nonarrowing\relax 7341 \advance\rightskip by \lispnarrowing 7342 \fi 7343 \parsearg\quotationlabel 7344} 7345 7346% We have retained a nonzero parskip for the environment, since we're 7347% doing normal filling. 7348% 7349\def\Equotation{% 7350 \par 7351 \ifx\quotationauthor\thisisundefined\else 7352 % indent a bit. 7353 \leftline{\kern 2\leftskip \sl ---\quotationauthor}% 7354 \fi 7355 {\parskip=0pt \afterenvbreak}% 7356} 7357\def\Esmallquotation{\Equotation} 7358 7359% If we're given an argument, typeset it in bold with a colon after. 7360\def\quotationlabel#1{% 7361 \def\temp{#1}% 7362 \ifx\temp\empty \else 7363 {\bf #1: }% 7364 \fi 7365} 7366 7367% @indentedblock is like @quotation, but indents only on the left and 7368% has no optional argument. 7369% 7370\makedispenvdef{indentedblock}{\indentedblockstart} 7371% 7372\def\indentedblockstart{% 7373 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip 7374 \parindent=0pt 7375 % 7376 % @cartouche defines \nonarrowing to inhibit narrowing at next level down. 7377 \ifx\nonarrowing\relax 7378 \advance\leftskip by \lispnarrowing 7379 \exdentamount = \lispnarrowing 7380 \else 7381 \let\nonarrowing = \relax 7382 \fi 7383} 7384 7385% Keep a nonzero parskip for the environment, since we're doing normal filling. 7386% 7387\def\Eindentedblock{% 7388 \par 7389 {\parskip=0pt \afterenvbreak}% 7390} 7391\def\Esmallindentedblock{\Eindentedblock} 7392 7393 7394% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} 7395% If we want to allow any <char> as delimiter, 7396% we need the curly braces so that makeinfo sees the @verb command, eg: 7397% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org 7398% 7399% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. 7400% 7401% [Knuth] p.344; only we need to do the other characters Texinfo sets 7402% active too. Otherwise, they get lost as the first character on a 7403% verbatim line. 7404\def\dospecials{% 7405 \do\ \do\\\do\{\do\}\do\$\do\&% 7406 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% 7407 \do\<\do\>\do\|\do\@\do+\do\"% 7408 % Don't do the quotes -- if we do, @set txicodequoteundirected and 7409 % @set txicodequotebacktick will not have effect on @verb and 7410 % @verbatim, and ?` and !` ligatures won't get disabled. 7411 %\do\`\do\'% 7412} 7413% 7414% [Knuth] p. 380 7415\def\uncatcodespecials{% 7416 \def\do##1{\catcode`##1=\other}\dospecials} 7417% 7418% Setup for the @verb command. 7419% 7420% Eight spaces for a tab 7421\begingroup 7422 \catcode`\^^I=\active 7423 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} 7424\endgroup 7425% 7426\def\setupverb{% 7427 \tt 7428 \def\par{\leavevmode\endgraf}% 7429 \setcodequotes 7430 \tabeightspaces 7431 \nohyphenation 7432 % Respect line breaks, 7433 % print special symbols as themselves, and 7434 % make each space count 7435 % must do in this order: 7436 \obeylines \uncatcodespecials \sepspaces 7437} 7438 7439% Setup for the @verbatim environment 7440% 7441% Real tab expansion. 7442\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount 7443% 7444% We typeset each line of the verbatim in an \hbox, so we can handle 7445% tabs. 7446\newbox\verbbox 7447\def\starttabbox{\setbox\verbbox=\hbox\bgroup} 7448% 7449\begingroup 7450 \catcode`\^^I=\active 7451 \gdef\tabexpand{% 7452 \catcode`\^^I=\active 7453 \def^^I{\leavevmode\egroup 7454 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab 7455 \divide\dimen\verbbox by\tabw 7456 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw 7457 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw 7458 \wd\verbbox=\dimen\verbbox 7459 \leavevmode\box\verbbox \starttabbox 7460 }% 7461 } 7462\endgroup 7463 7464% start the verbatim environment. 7465\def\setupverbatim{% 7466 \let\nonarrowing = t% 7467 \nonfillstart 7468 \tt % easiest (and conventionally used) font for verbatim 7469 \def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}% 7470 \tabexpand 7471 \setcodequotes 7472 % Respect line breaks, 7473 % print special symbols as themselves, and 7474 % make each space count. 7475 % Must do in this order: 7476 \obeylines \uncatcodespecials \sepspaces 7477} 7478 7479% Do the @verb magic: verbatim text is quoted by unique 7480% delimiter characters. Before first delimiter expect a 7481% right brace, after last delimiter expect closing brace: 7482% 7483% \def\doverb'{'<char>#1<char>'}'{#1} 7484% 7485% [Knuth] p. 382; only eat outer {} 7486\begingroup 7487 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other 7488 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] 7489\endgroup 7490% 7491\def\verb{\begingroup\setupverb\doverb} 7492% 7493% 7494% Do the @verbatim magic: define the macro \doverbatim so that 7495% the (first) argument ends when '@end verbatim' is reached, ie: 7496% 7497% \def\doverbatim#1@end verbatim{#1} 7498% 7499% For Texinfo it's a lot easier than for LaTeX, 7500% because texinfo's \verbatim doesn't stop at '\end{verbatim}': 7501% we need not redefine '\', '{' and '}'. 7502% 7503% Inspired by LaTeX's verbatim command set [latex.ltx] 7504% 7505\begingroup 7506 \catcode`\ =\active 7507 \obeylines % 7508 % ignore everything up to the first ^^M, that's the newline at the end 7509 % of the @verbatim input line itself. Otherwise we get an extra blank 7510 % line in the output. 7511 \xdef\doverbatim#1^^M#2@end verbatim{% 7512 \starttabbox#2\egroup\noexpand\end\gobble verbatim}% 7513 % We really want {...\end verbatim} in the body of the macro, but 7514 % without the active space; thus we have to use \xdef and \gobble. 7515 % The \egroup ends the \verbbox started at the end of the last line in 7516 % the block. 7517\endgroup 7518% 7519\envdef\verbatim{% 7520 \setnormaldispenv\setupverbatim\doverbatim 7521} 7522\let\Everbatim = \afterenvbreak 7523 7524 7525% @verbatiminclude FILE - insert text of file in verbatim environment. 7526% 7527\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} 7528% 7529\def\doverbatiminclude#1{% 7530 {% 7531 \makevalueexpandable 7532 \setupverbatim 7533 {% 7534 \indexnofonts % Allow `@@' and other weird things in file names. 7535 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% 7536 \edef\tmp{\noexpand\input #1 } 7537 \expandafter 7538 }\expandafter\starttabbox\tmp\egroup 7539 \afterenvbreak 7540 }% 7541} 7542 7543% @copying ... @end copying. 7544% Save the text away for @insertcopying later. 7545% 7546% We save the uninterpreted tokens, rather than creating a box. 7547% Saving the text in a box would be much easier, but then all the 7548% typesetting commands (@smallbook, font changes, etc.) have to be done 7549% beforehand -- and a) we want @copying to be done first in the source 7550% file; b) letting users define the frontmatter in as flexible order as 7551% possible is desirable. 7552% 7553\def\copying{\checkenv{}\begingroup\macrobodyctxt\docopying} 7554{\catcode`\ =\other 7555\gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}} 7556} 7557 7558\def\insertcopying{% 7559 \begingroup 7560 \parindent = 0pt % paragraph indentation looks wrong on title page 7561 \scanexp\copyingtext 7562 \endgroup 7563} 7564 7565 7566\message{defuns,} 7567% @defun etc. 7568 7569\newskip\defbodyindent \defbodyindent=.4in 7570\newskip\defargsindent \defargsindent=50pt 7571\newskip\deflastargmargin \deflastargmargin=18pt 7572\newcount\defunpenalty 7573 7574% Start the processing of @deffn: 7575\def\startdefun{% 7576 \ifnum\lastpenalty<10000 7577 \medbreak 7578 \defunpenalty=10003 % Will keep this @deffn together with the 7579 % following @def command, see below. 7580 \else 7581 % If there are two @def commands in a row, we'll have a \nobreak, 7582 % which is there to keep the function description together with its 7583 % header. But if there's nothing but headers, we need to allow a 7584 % break somewhere. Check specifically for penalty 10002, inserted 7585 % by \printdefunline, instead of 10000, since the sectioning 7586 % commands also insert a nobreak penalty, and we don't want to allow 7587 % a break between a section heading and a defun. 7588 % 7589 % As a further refinement, we avoid "club" headers by signalling 7590 % with penalty of 10003 after the very first @deffn in the 7591 % sequence (see above), and penalty of 10002 after any following 7592 % @def command. 7593 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi 7594 % 7595 % Similarly, after a section heading, do not allow a break. 7596 % But do insert the glue. 7597 \medskip % preceded by discardable penalty, so not a breakpoint 7598 \fi 7599 % 7600 \parindent=0in 7601 \advance\leftskip by \defbodyindent 7602 \exdentamount=\defbodyindent 7603} 7604 7605\def\dodefunx#1{% 7606 % First, check whether we are in the right environment: 7607 \checkenv#1% 7608 % 7609 % As above, allow line break if we have multiple x headers in a row. 7610 % It's not a great place, though. 7611 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi 7612 % 7613 % And now, it's time to reuse the body of the original defun: 7614 \expandafter\gobbledefun#1% 7615} 7616\def\gobbledefun#1\startdefun{} 7617 7618% \printdefunline \deffnheader{text} 7619% 7620\def\printdefunline#1#2{% 7621 \begingroup 7622 \plainfrenchspacing 7623 % call \deffnheader: 7624 #1#2 \endheader 7625 % common ending: 7626 \interlinepenalty = 10000 7627 \advance\rightskip by 0pt plus 1fil\relax 7628 \endgraf 7629 \nobreak\vskip -\parskip 7630 \penalty\defunpenalty % signal to \startdefun and \dodefunx 7631 % Some of the @defun-type tags do not enable magic parentheses, 7632 % rendering the following check redundant. But we don't optimize. 7633 \checkparencounts 7634 \endgroup 7635} 7636 7637\def\Edefun{\endgraf\medbreak} 7638 7639% \makedefun{deffoo}{ (definition of \deffooheader) } 7640% 7641% Define \deffoo, \deffoox \Edeffoo and \deffooheader. 7642\def\makedefun#1{% 7643 \expandafter\let\csname E#1\endcsname = \Edefun 7644 \edef\temp{\noexpand\domakedefun 7645 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% 7646 \temp 7647} 7648\def\domakedefun#1#2#3{% 7649 \envdef#1{% 7650 \startdefun 7651 \doingtypefnfalse % distinguish typed functions from all else 7652 \parseargusing\activeparens{\printdefunline#3}% 7653 }% 7654 \def#2{\dodefunx#1}% 7655 \def#3% 7656} 7657 7658\newif\ifdoingtypefn % doing typed function? 7659\newif\ifrettypeownline % typeset return type on its own line? 7660 7661% @deftypefnnewline on|off says whether the return type of typed functions 7662% are printed on their own line. This affects @deftypefn, @deftypefun, 7663% @deftypeop, and @deftypemethod. 7664% 7665\parseargdef\deftypefnnewline{% 7666 \def\temp{#1}% 7667 \ifx\temp\onword 7668 \expandafter\let\csname SETtxideftypefnnl\endcsname 7669 = \empty 7670 \else\ifx\temp\offword 7671 \expandafter\let\csname SETtxideftypefnnl\endcsname 7672 = \relax 7673 \else 7674 \errhelp = \EMsimple 7675 \errmessage{Unknown @txideftypefnnl value `\temp', 7676 must be on|off}% 7677 \fi\fi 7678} 7679 7680% Untyped functions: 7681 7682% @deffn category name args 7683\makedefun{deffn}#1 #2 #3\endheader{% 7684 \doind{fn}{\code{#2}}% 7685 \defname{#1}{}{#2}\magicamp\defunargs{#3\unskip}% 7686} 7687 7688% @defop category class name args 7689\makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}} 7690\def\defopheaderx#1#2 #3 #4\endheader{% 7691 \doind{fn}{\code{#3}\space\putwordon\ \code{#2}}% 7692 \defname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}% 7693} 7694 7695% Typed functions: 7696 7697% @deftypefn category type name args 7698\makedefun{deftypefn}#1 #2 #3 #4\endheader{% 7699 \doind{fn}{\code{#3}}% 7700 \doingtypefntrue 7701 \defname{#1}{#2}{#3}\defunargs{#4\unskip}% 7702} 7703 7704% @deftypeop category class type name args 7705\makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}} 7706\def\deftypeopheaderx#1#2 #3 #4 #5\endheader{% 7707 \doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}% 7708 \doingtypefntrue 7709 \defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}% 7710} 7711 7712% Typed variables: 7713 7714% @deftypevr category type var args 7715\makedefun{deftypevr}#1 #2 #3 #4\endheader{% 7716 \doind{vr}{\code{#3}}% 7717 \defname{#1}{#2}{#3}\defunargs{#4\unskip}% 7718} 7719 7720% @deftypecv category class type var args 7721\makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}} 7722\def\deftypecvheaderx#1#2 #3 #4 #5\endheader{% 7723 \doind{vr}{\code{#4}\space\putwordof\ \code{#2}}% 7724 \defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}% 7725} 7726 7727% Untyped variables: 7728 7729% @defvr category var args 7730\makedefun{defvr}#1 {\deftypevrheader{#1} {} } 7731 7732% @defcv category class var args 7733\makedefun{defcv}#1 {\defcvheaderx{#1\ \putwordof}} 7734\def\defcvheaderx#1#2 {\deftypecvheaderx{#1}#2 {} } 7735 7736% Types: 7737 7738% @deftp category name args 7739\makedefun{deftp}#1 #2 #3\endheader{% 7740 \doind{tp}{\code{#2}}% 7741 \defname{#1}{}{#2}\defunargs{#3\unskip}% 7742} 7743 7744% Remaining @defun-like shortcuts: 7745\makedefun{defun}{\deffnheader{\putwordDeffunc} } 7746\makedefun{defmac}{\deffnheader{\putwordDefmac} } 7747\makedefun{defspec}{\deffnheader{\putwordDefspec} } 7748\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } 7749\makedefun{defvar}{\defvrheader{\putwordDefvar} } 7750\makedefun{defopt}{\defvrheader{\putwordDefopt} } 7751\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } 7752\makedefun{defmethod}{\defopheaderx\putwordMethodon} 7753\makedefun{deftypemethod}{\deftypeopheaderx\putwordMethodon} 7754\makedefun{defivar}{\defcvheaderx\putwordInstanceVariableof} 7755\makedefun{deftypeivar}{\deftypecvheaderx\putwordInstanceVariableof} 7756 7757% \defname, which formats the name of the @def (not the args). 7758% #1 is the category, such as "Function". 7759% #2 is the return type, if any. 7760% #3 is the function name. 7761% 7762% We are followed by (but not passed) the arguments, if any. 7763% 7764\def\defname#1#2#3{% 7765 \par 7766 % Get the values of \leftskip and \rightskip as they were outside the @def... 7767 \advance\leftskip by -\defbodyindent 7768 % 7769 % Determine if we are typesetting the return type of a typed function 7770 % on a line by itself. 7771 \rettypeownlinefalse 7772 \ifdoingtypefn % doing a typed function specifically? 7773 % then check user option for putting return type on its own line: 7774 \ifflagclear{txideftypefnnl}{}{\rettypeownlinetrue}% 7775 \fi 7776 % 7777 % How we'll format the category name. Putting it in brackets helps 7778 % distinguish it from the body text that may end up on the next line 7779 % just below it. 7780 \def\temp{#1}% 7781 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} 7782 % 7783 % Figure out line sizes for the paragraph shape. We'll always have at 7784 % least two. 7785 \tempnum = 2 7786 % 7787 % The first line needs space for \box0; but if \rightskip is nonzero, 7788 % we need only space for the part of \box0 which exceeds it: 7789 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip 7790 % 7791 % If doing a return type on its own line, we'll have another line. 7792 \ifrettypeownline 7793 \advance\tempnum by 1 7794 \def\maybeshapeline{0in \hsize}% 7795 \else 7796 \def\maybeshapeline{}% 7797 \fi 7798 % 7799 % The continuations: 7800 \dimen2=\hsize \advance\dimen2 by -\defargsindent 7801 % 7802 % The final paragraph shape: 7803 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 7804 % 7805 % Put the category name at the right margin. 7806 \noindent 7807 \hbox to 0pt{% 7808 \hfil\box0 \kern-\hsize 7809 % \hsize has to be shortened this way: 7810 \kern\leftskip 7811 % Intentionally do not respect \rightskip, since we need the space. 7812 }% 7813 % 7814 % Allow all lines to be underfull without complaint: 7815 \tolerance=10000 \hbadness=10000 7816 \exdentamount=\defbodyindent 7817 {% 7818 % defun fonts. We use typewriter by default (used to be bold) because: 7819 % . we're printing identifiers, they should be in tt in principle. 7820 % . in languages with many accents, such as Czech or French, it's 7821 % common to leave accents off identifiers. The result looks ok in 7822 % tt, but exceedingly strange in rm. 7823 % . we don't want -- and --- to be treated as ligatures. 7824 % . this still does not fix the ?` and !` ligatures, but so far no 7825 % one has made identifiers using them :). 7826 \df \tt 7827 \def\temp{#2}% text of the return type 7828 \ifx\temp\empty\else 7829 \tclose{\temp}% typeset the return type 7830 \ifrettypeownline 7831 % put return type on its own line; prohibit line break following: 7832 \hfil\vadjust{\nobreak}\break 7833 \else 7834 \space % type on same line, so just followed by a space 7835 \fi 7836 \fi % no return type 7837 #3% output function name 7838 }% 7839 \ifflagclear{txidefnamenospace}{% 7840 {\rm\enskip}% hskip 0.5 em of \rmfont 7841 }{}% 7842 % 7843 \boldbrax 7844 % arguments will be output next, if any. 7845} 7846 7847% Print arguments. Use slanted for @def*, typewriter for @deftype*. 7848\def\defunargs#1{% 7849 \df \ifdoingtypefn \tt \else \sl \fi 7850 \ifflagclear{txicodevaristt}{}% 7851 {\def\var##1{{\setregularquotes \ttsl ##1}}}% 7852 #1% 7853} 7854 7855% We want ()&[] to print specially on the defun line. 7856% 7857\def\activeparens{% 7858 \catcode`\(=\active \catcode`\)=\active 7859 \catcode`\[=\active \catcode`\]=\active 7860 \catcode`\&=\active 7861} 7862 7863% Make control sequences which act like normal parenthesis chars. 7864\let\lparen = ( \let\rparen = ) 7865 7866% Be sure that we always have a definition for `(', etc. For example, 7867% if the fn name has parens in it, \boldbrax will not be in effect yet, 7868% so TeX would otherwise complain about undefined control sequence. 7869{ 7870 \activeparens 7871 \gdef\defcharsdefault{% 7872 \let(=\lparen \let)=\rparen 7873 \let[=\lbrack \let]=\rbrack 7874 \let& = \&% 7875 } 7876 \globaldefs=1 \defcharsdefault 7877 7878 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} 7879 \gdef\magicamp{\let&=\amprm} 7880} 7881\let\ampchar\& 7882 7883\newcount\parencount 7884 7885% If we encounter &foo, then turn on ()-hacking afterwards 7886\newif\ifampseen 7887\def\amprm#1 {\ampseentrue{\bf\ }} 7888 7889\def\parenfont{% 7890 \ifampseen 7891 % At the first level, print parens in roman, 7892 % otherwise use the default font. 7893 \ifnum \parencount=1 \rm \fi 7894 \else 7895 % The \sf parens (in \boldbrax) actually are a little bolder than 7896 % the contained text. This is especially needed for [ and ] . 7897 \sf 7898 \fi 7899} 7900\def\infirstlevel#1{% 7901 \ifampseen 7902 \ifnum\parencount=1 7903 #1% 7904 \fi 7905 \fi 7906} 7907\def\bfafterword#1 {#1 \bf} 7908 7909\def\opnr{% 7910 \global\advance\parencount by 1 7911 {\parenfont(}% 7912 \infirstlevel \bfafterword 7913} 7914\def\clnr{% 7915 {\parenfont)}% 7916 \infirstlevel \sl 7917 \global\advance\parencount by -1 7918} 7919 7920\newcount\brackcount 7921\def\lbrb{% 7922 \global\advance\brackcount by 1 7923 {\bf[}% 7924} 7925\def\rbrb{% 7926 {\bf]}% 7927 \global\advance\brackcount by -1 7928} 7929 7930\def\checkparencounts{% 7931 \ifnum\parencount=0 \else \badparencount \fi 7932 \ifnum\brackcount=0 \else \badbrackcount \fi 7933} 7934% these should not use \errmessage; the glibc manual, at least, actually 7935% has such constructs (when documenting function pointers). 7936\def\badparencount{% 7937 \message{Warning: unbalanced parentheses in @def...}% 7938 \global\parencount=0 7939} 7940\def\badbrackcount{% 7941 \message{Warning: unbalanced square brackets in @def...}% 7942 \global\brackcount=0 7943} 7944 7945 7946\message{macros,} 7947% @macro. 7948 7949% To do this right we need a feature of e-TeX, \scantokens, 7950% which we arrange to emulate with a temporary file in ordinary TeX. 7951\ifx\eTeXversion\thisisundefined 7952 \newwrite\macscribble 7953 \def\scantokens#1{% 7954 \toks0={#1}% 7955 \immediate\openout\macscribble=\jobname.tmp 7956 \immediate\write\macscribble{\the\toks0}% 7957 \immediate\closeout\macscribble 7958 \input \jobname.tmp 7959 } 7960\fi 7961 7962\let\E=\expandafter 7963 7964% Used at the time of macro expansion. 7965% Argument is macro body with arguments substituted 7966\def\scanmacro#1{% 7967 \newlinechar`\^^M 7968 % expand the expansion of \eatleadingcr twice to maybe remove a leading 7969 % newline (and \else and \fi tokens), then call \eatspaces on the result. 7970 \def\xeatspaces##1{% 7971 \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1% 7972 }}% 7973 \def\xempty##1{}% 7974 % 7975 % Process the macro body under the current catcode regime. 7976 \scantokens{#1@comment}% 7977 % 7978 % The \comment is to remove the \newlinechar added by \scantokens, and 7979 % can be noticed by \parsearg. Note \c isn't used because this means cedilla 7980 % in math mode. 7981} 7982 7983% Used for copying and captions 7984\def\scanexp#1{% 7985 \expandafter\scanmacro\expandafter{#1}% 7986} 7987 7988\newcount\paramno % Count of parameters 7989\newtoks\macname % Macro name 7990\newif\ifrecursive % Is it recursive? 7991 7992% List of all defined macros in the form 7993% \commondummyword\macro1\commondummyword\macro2... 7994% Currently is also contains all @aliases; the list can be split 7995% if there is a need. 7996\def\macrolist{} 7997 7998% Add the macro to \macrolist 7999\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} 8000\def\addtomacrolistxxx#1{% 8001 \toks0 = \expandafter{\macrolist\commondummyword#1}% 8002 \xdef\macrolist{\the\toks0}% 8003} 8004 8005% Utility routines. 8006% This does \let #1 = #2, with \csnames; that is, 8007% \let \csname#1\endcsname = \csname#2\endcsname 8008% (except of course we have to play expansion games). 8009% 8010\def\cslet#1#2{% 8011 \expandafter\let 8012 \csname#1\expandafter\endcsname 8013 \csname#2\endcsname 8014} 8015 8016% Trim leading and trailing spaces off a string. 8017% Concepts from aro-bend problem 15 (see CTAN). 8018{\catcode`\@=11 8019\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} 8020\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} 8021\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} 8022\def\unbrace#1{#1} 8023\unbrace{\gdef\trim@@@ #1 } #2@{#1} 8024} 8025 8026{\catcode`\^^M=\other% 8027\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}% 8028% Warning: this won't work for a delimited argument 8029% or for an empty argument 8030 8031% Trim a single trailing ^^M off a string. 8032{\catcode`\^^M=\other \catcode`\Q=3% 8033\gdef\eatcr #1{\eatcra #1Q^^MQ}% 8034\gdef\eatcra#1^^MQ{\eatcrb#1Q}% 8035\gdef\eatcrb#1Q#2Q{#1}% 8036} 8037 8038% Macro bodies are absorbed as an argument in a context where 8039% all characters are catcode 10, 11 or 12, except \ which is active 8040% (as in normal texinfo). It is necessary to change the definition of \ 8041% to recognize macro arguments; this is the job of \mbodybackslash. 8042% 8043% Non-ASCII encodings make 8-bit characters active, so un-activate 8044% them to avoid their expansion. Must do this non-globally, to 8045% confine the change to the current group. 8046% 8047% It's necessary to have hard CRs when the macro is executed. This is 8048% done by making ^^M (\endlinechar) catcode 12 when reading the macro 8049% body, and then making it the \newlinechar in \scanmacro. 8050% 8051\def\scanctxt{% used as subroutine 8052 \catcode`\"=\other 8053 \catcode`\+=\other 8054 \catcode`\<=\other 8055 \catcode`\>=\other 8056 \catcode`\^=\other 8057 \catcode`\_=\other 8058 \catcode`\|=\other 8059 \catcode`\~=\other 8060 \catcode`\@=\other 8061 \catcode`\^^M=\other 8062 \catcode`\\=\active 8063 \passthroughcharstrue 8064} 8065 8066\def\macrobodyctxt{% used for @macro definitions and @copying 8067 \scanctxt 8068 \catcode`\ =\other 8069 \catcode`\{=\other 8070 \catcode`\}=\other 8071} 8072 8073% Used when scanning braced macro arguments. Note, however, that catcode 8074% changes here are ineffectual if the macro invocation was nested inside 8075% an argument to another Texinfo command. 8076\def\macroargctxt{% 8077 \scanctxt 8078 \catcode`\ =\active 8079} 8080 8081\def\macrolineargctxt{% used for whole-line arguments without braces 8082 \scanctxt 8083 \catcode`\{=\other 8084 \catcode`\}=\other 8085} 8086 8087% \mbodybackslash is the definition of \ in @macro bodies. 8088% It maps \foo\ => \csname macarg.foo\endcsname => #N 8089% where N is the macro parameter number. 8090% We define \csname macarg.\endcsname to be \realbackslash, so 8091% \\ in macro replacement text gets you a backslash. 8092% 8093{\catcode`@=0 @catcode`@\=@active 8094 @gdef@usembodybackslash{@let\=@mbodybackslash} 8095 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} 8096} 8097\expandafter\def\csname macarg.\endcsname{\realbackslash} 8098 8099\def\margbackslash#1{\char`\#1 } 8100 8101\def\macro{\recursivefalse\parsearg\macroxxx} 8102\def\rmacro{\recursivetrue\parsearg\macroxxx} 8103 8104\def\macroxxx#1{% 8105 \getargs{#1}% now \macname is the macname and \argl the arglist 8106 \ifx\argl\empty % no arguments 8107 \paramno=0\relax 8108 \else 8109 \expandafter\parsemargdef \argl;% 8110 \if\paramno>256\relax 8111 \ifx\eTeXversion\thisisundefined 8112 \errhelp = \EMsimple 8113 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} 8114 \fi 8115 \fi 8116 \fi 8117 \if1\csname ismacro.\the\macname\endcsname 8118 \message{Warning: redefining \the\macname}% 8119 \else 8120 \expandafter\ifx\csname \the\macname\endcsname \relax 8121 \else \errmessage{Macro name \the\macname\space already defined}\fi 8122 \global\cslet{macsave.\the\macname}{\the\macname}% 8123 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% 8124 \addtomacrolist{\the\macname}% 8125 \fi 8126 \begingroup \macrobodyctxt \usembodybackslash 8127 \ifrecursive \expandafter\parsermacbody 8128 \else \expandafter\parsemacbody 8129 \fi} 8130 8131\parseargdef\unmacro{% 8132 \if1\csname ismacro.#1\endcsname 8133 \global\cslet{#1}{macsave.#1}% 8134 \global\expandafter\let \csname ismacro.#1\endcsname=0% 8135 % Remove the macro name from \macrolist: 8136 \begingroup 8137 \expandafter\let\csname#1\endcsname \relax 8138 \let\commondummyword\unmacrodo 8139 \xdef\macrolist{\macrolist}% 8140 \endgroup 8141 \else 8142 \errmessage{Macro #1 not defined}% 8143 \fi 8144} 8145 8146% Called by \do from \dounmacro on each macro. The idea is to omit any 8147% macro definitions that have been changed to \relax. 8148% 8149\def\unmacrodo#1{% 8150 \ifx #1\relax 8151 % remove this 8152 \else 8153 \noexpand\commondummyword \noexpand#1% 8154 \fi 8155} 8156 8157% \getargs -- Parse the arguments to a @macro line. Set \macname to 8158% the name of the macro, and \argl to the braced argument list. 8159\def\getargs#1{\getargsxxx#1{}} 8160\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} 8161\def\getmacname#1 #2\relax{\macname={#1}} 8162\def\getmacargs#1{\def\argl{#1}} 8163% This made use of the feature that if the last token of a 8164% <parameter list> is #, then the preceding argument is delimited by 8165% an opening brace, and that opening brace is not consumed. 8166 8167% Parse the optional {params} list to @macro or @rmacro. 8168% Set \paramno to the number of arguments, 8169% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a 8170% three-param macro.) Define \macarg.BLAH for each BLAH in the params 8171% list to some hook where the argument is to be expanded. If there are 8172% less than 10 arguments that hook is to be replaced by ##N where N 8173% is the position in that list, that is to say the macro arguments are to be 8174% defined `a la TeX in the macro body. 8175% 8176% That gets used by \mbodybackslash (above). 8177% 8178% If there are 10 or more arguments, a different technique is used: see 8179% \parsemmanyargdef. 8180% 8181\def\parsemargdef#1;{% 8182 \paramno=0\def\paramlist{}% 8183 \let\hash\relax 8184 % \hash is redefined to `#' later to get it into definitions 8185 \let\xeatspaces\relax 8186 \let\xempty\relax 8187 \parsemargdefxxx#1,;,% 8188 \ifnum\paramno<10\relax\else 8189 \paramno0\relax 8190 \parsemmanyargdef@@#1,;,% 10 or more arguments 8191 \fi 8192} 8193\def\parsemargdefxxx#1,{% 8194 \if#1;\let\next=\relax 8195 \else \let\next=\parsemargdefxxx 8196 \advance\paramno by 1 8197 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname 8198 {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}% 8199 \edef\paramlist{\paramlist\hash\the\paramno,}% 8200 \fi\next} 8201% the \xempty{} is to give \eatleadingcr an argument in the case of an 8202% empty macro argument. 8203 8204% \parsemacbody, \parsermacbody 8205% 8206% Read recursive and nonrecursive macro bodies. (They're different since 8207% rec and nonrec macros end differently.) 8208% 8209% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 8210% body to be transformed. 8211% Set \macrobody to the body of the macro, and call \defmacro. 8212% 8213{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% 8214\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% 8215{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% 8216\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% 8217 8218% Make @ a letter, so that we can make private-to-Texinfo macro names. 8219\edef\texiatcatcode{\the\catcode`\@} 8220\catcode `@=11\relax 8221 8222%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% 8223 8224% If there are 10 or more arguments, a different technique is used, where the 8225% hook remains in the body, and when macro is to be expanded the body is 8226% processed again to replace the arguments. 8227% 8228% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the 8229% argument N value and then \edef the body (nothing else will expand because of 8230% the catcode regime under which the body was input). 8231% 8232% If you compile with TeX (not eTeX), and you have macros with 10 or more 8233% arguments, no macro can have more than 256 arguments (else error). 8234% 8235% In case that there are 10 or more arguments we parse again the arguments 8236% list to set new definitions for the \macarg.BLAH macros corresponding to 8237% each BLAH argument. It was anyhow needed to parse already once this list 8238% in order to count the arguments, and as macros with at most 9 arguments 8239% are by far more frequent than macro with 10 or more arguments, defining 8240% twice the \macarg.BLAH macros does not cost too much processing power. 8241\def\parsemmanyargdef@@#1,{% 8242 \if#1;\let\next=\relax 8243 \else 8244 \let\next=\parsemmanyargdef@@ 8245 \edef\tempb{\eatspaces{#1}}% 8246 \expandafter\def\expandafter\tempa 8247 \expandafter{\csname macarg.\tempb\endcsname}% 8248 % Note that we need some extra \noexpand\noexpand, this is because we 8249 % don't want \the to be expanded in the \parsermacbody as it uses an 8250 % \xdef . 8251 \expandafter\edef\tempa 8252 {\noexpand\noexpand\noexpand\the\toks\the\paramno}% 8253 \advance\paramno by 1\relax 8254 \fi\next} 8255 8256 8257\let\endargs@\relax 8258\let\nil@\relax 8259\def\nilm@{\nil@}% 8260\long\def\nillm@{\nil@}% 8261 8262% This macro is expanded during the Texinfo macro expansion, not during its 8263% definition. It gets all the arguments' values and assigns them to macros 8264% macarg.ARGNAME 8265% 8266% #1 is the macro name 8267% #2 is the list of argument names 8268% #3 is the list of argument values 8269\def\getargvals@#1#2#3{% 8270 \def\macargdeflist@{}% 8271 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. 8272 \def\paramlist{#2,\nil@}% 8273 \def\macroname{#1}% 8274 \begingroup 8275 \macroargctxt 8276 \def\argvaluelist{#3,\nil@}% 8277 \def\@tempa{#3}% 8278 \ifx\@tempa\empty 8279 \setemptyargvalues@ 8280 \else 8281 \getargvals@@ 8282 \fi 8283} 8284\def\getargvals@@{% 8285 \ifx\paramlist\nilm@ 8286 % Some sanity check needed here that \argvaluelist is also empty. 8287 \ifx\argvaluelist\nillm@ 8288 \else 8289 \errhelp = \EMsimple 8290 \errmessage{Too many arguments in macro `\macroname'!}% 8291 \fi 8292 \let\next\macargexpandinbody@ 8293 \else 8294 \ifx\argvaluelist\nillm@ 8295 % No more arguments values passed to macro. Set remaining named-arg 8296 % macros to empty. 8297 \let\next\setemptyargvalues@ 8298 \else 8299 % pop current arg name into \@tempb 8300 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% 8301 \expandafter\@tempa\expandafter{\paramlist}% 8302 % pop current argument value into \@tempc 8303 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% 8304 \expandafter\@tempa\expandafter{\argvaluelist}% 8305 % Here \@tempb is the current arg name and \@tempc is the current arg value. 8306 % First place the new argument macro definition into \@tempd 8307 \expandafter\macname\expandafter{\@tempc}% 8308 \expandafter\let\csname macarg.\@tempb\endcsname\relax 8309 \expandafter\def\expandafter\@tempe\expandafter{% 8310 \csname macarg.\@tempb\endcsname}% 8311 \edef\@tempd{\long\def\@tempe{\the\macname}}% 8312 \push@\@tempd\macargdeflist@ 8313 \let\next\getargvals@@ 8314 \fi 8315 \fi 8316 \next 8317} 8318 8319\def\push@#1#2{% 8320 \expandafter\expandafter\expandafter\def 8321 \expandafter\expandafter\expandafter#2% 8322 \expandafter\expandafter\expandafter{% 8323 \expandafter#1#2}% 8324} 8325 8326% Replace arguments by their values in the macro body, and place the result 8327% in macro \@tempa. 8328% 8329\def\macvalstoargs@{% 8330 % To do this we use the property that token registers that are \the'ed 8331 % within an \edef expand only once. So we are going to place all argument 8332 % values into respective token registers. 8333 % 8334 % First we save the token context, and initialize argument numbering. 8335 \begingroup 8336 \paramno0\relax 8337 % Then, for each argument number #N, we place the corresponding argument 8338 % value into a new token list register \toks#N 8339 \expandafter\putargsintokens@\saveparamlist@,;,% 8340 % Then, we expand the body so that argument are replaced by their 8341 % values. The trick for values not to be expanded themselves is that they 8342 % are within tokens and that tokens expand only once in an \edef . 8343 \edef\@tempc{\csname mac.\macroname .body\endcsname}% 8344 % Now we restore the token stack pointer to free the token list registers 8345 % which we have used, but we make sure that expanded body is saved after 8346 % group. 8347 \expandafter 8348 \endgroup 8349 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% 8350 } 8351 8352% Define the named-macro outside of this group and then close this group. 8353% 8354\def\macargexpandinbody@{% 8355 \expandafter 8356 \endgroup 8357 \macargdeflist@ 8358 % First the replace in body the macro arguments by their values, the result 8359 % is in \@tempa . 8360 \macvalstoargs@ 8361 % Then we point at the \norecurse or \gobble (for recursive) macro value 8362 % with \@tempb . 8363 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname 8364 % Depending on whether it is recursive or not, we need some tailing 8365 % \egroup . 8366 \ifx\@tempb\gobble 8367 \let\@tempc\relax 8368 \else 8369 \let\@tempc\egroup 8370 \fi 8371 % And now we do the real job: 8372 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% 8373 \@tempd 8374} 8375 8376\def\putargsintokens@#1,{% 8377 \if#1;\let\next\relax 8378 \else 8379 \let\next\putargsintokens@ 8380 % First we allocate the new token list register, and give it a temporary 8381 % alias \@tempb . 8382 \toksdef\@tempb\the\paramno 8383 % Then we place the argument value into that token list register. 8384 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname 8385 \expandafter\@tempb\expandafter{\@tempa}% 8386 \advance\paramno by 1\relax 8387 \fi 8388 \next 8389} 8390 8391% Trailing missing arguments are set to empty. 8392% 8393\def\setemptyargvalues@{% 8394 \ifx\paramlist\nilm@ 8395 \let\next\macargexpandinbody@ 8396 \else 8397 \expandafter\setemptyargvaluesparser@\paramlist\endargs@ 8398 \let\next\setemptyargvalues@ 8399 \fi 8400 \next 8401} 8402 8403\def\setemptyargvaluesparser@#1,#2\endargs@{% 8404 \expandafter\def\expandafter\@tempa\expandafter{% 8405 \expandafter\def\csname macarg.#1\endcsname{}}% 8406 \push@\@tempa\macargdeflist@ 8407 \def\paramlist{#2}% 8408} 8409 8410% #1 is the element target macro 8411% #2 is the list macro 8412% #3,#4\endargs@ is the list value 8413\def\pop@#1#2#3,#4\endargs@{% 8414 \def#1{#3}% 8415 \def#2{#4}% 8416} 8417\long\def\longpop@#1#2#3,#4\endargs@{% 8418 \long\def#1{#3}% 8419 \long\def#2{#4}% 8420} 8421 8422 8423%%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%% 8424 8425 8426% This defines a Texinfo @macro or @rmacro, called by \parsemacbody. 8427% \macrobody has the body of the macro in it, with placeholders for 8428% its parameters, looking like "\xeatspaces{\hash 1}". 8429% \paramno is the number of parameters 8430% \paramlist is a TeX parameter text, e.g. "#1,#2,#3," 8431% There are four cases: macros of zero, one, up to nine, and many arguments. 8432% \xdef is used so that macro definitions will survive the file 8433% they're defined in: @include reads the file inside a group. 8434% 8435\def\defmacro{% 8436 \let\hash=##% convert placeholders to macro parameter chars 8437 \ifnum\paramno=1 8438 \def\xeatspaces##1{##1}% 8439 % This removes the pair of braces around the argument. We don't 8440 % use \eatspaces, because this can cause ends of lines to be lost 8441 % when the argument to \eatspaces is read, leading to line-based 8442 % commands like "@itemize" not being read correctly. 8443 \else 8444 \let\xeatspaces\relax % suppress expansion 8445 \fi 8446 \ifcase\paramno 8447 % 0 8448 \expandafter\xdef\csname\the\macname\endcsname{% 8449 \begingroup 8450 \noexpand\spaceisspace 8451 \noexpand\endlineisspace 8452 \noexpand\expandafter % skip any whitespace after the macro name. 8453 \expandafter\noexpand\csname\the\macname @@@\endcsname}% 8454 \expandafter\xdef\csname\the\macname @@@\endcsname{% 8455 \endgroup 8456 \noexpand\scanmacro{\macrobody}}% 8457 \or % 1 8458 \expandafter\xdef\csname\the\macname\endcsname{% 8459 \begingroup 8460 \noexpand\braceorline 8461 \expandafter\noexpand\csname\the\macname @@@\endcsname}% 8462 \expandafter\xdef\csname\the\macname @@@\endcsname##1{% 8463 \endgroup 8464 \noexpand\scanmacro{\macrobody}% 8465 }% 8466 \else % at most 9 8467 \ifnum\paramno<10\relax 8468 % @MACNAME sets the context for reading the macro argument 8469 % @MACNAME@@ gets the argument, processes backslashes and appends a 8470 % comma. 8471 % @MACNAME@@@ removes braces surrounding the argument list. 8472 % @MACNAME@@@@ scans the macro body with arguments substituted. 8473 \expandafter\xdef\csname\the\macname\endcsname{% 8474 \begingroup 8475 \noexpand\expandafter % This \expandafter skip any spaces after the 8476 \noexpand\macroargctxt % macro before we change the catcode of space. 8477 \noexpand\expandafter 8478 \expandafter\noexpand\csname\the\macname @@\endcsname}% 8479 \expandafter\xdef\csname\the\macname @@\endcsname##1{% 8480 \noexpand\passargtomacro 8481 \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}% 8482 \expandafter\xdef\csname\the\macname @@@\endcsname##1{% 8483 \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}% 8484 \expandafter\expandafter 8485 \expandafter\xdef 8486 \expandafter\expandafter 8487 \csname\the\macname @@@@\endcsname\paramlist{% 8488 \endgroup\noexpand\scanmacro{\macrobody}}% 8489 \else % 10 or more: 8490 \expandafter\xdef\csname\the\macname\endcsname{% 8491 \noexpand\getargvals@{\the\macname}{\argl}% 8492 }% 8493 \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody 8494 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble 8495 \fi 8496 \fi} 8497 8498\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes 8499 8500\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} 8501 8502 8503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8504% 8505{\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape 8506@catcode`@_=11 % private names 8507@catcode`@!=11 % used as argument separator 8508 8509% \passargtomacro#1#2 - 8510% Call #1 with a list of tokens #2, with any doubled backslashes in #2 8511% compressed to one. 8512% 8513% This implementation works by expansion, and not execution (so we cannot use 8514% \def or similar). This reduces the risk of this failing in contexts where 8515% complete expansion is done with no execution (for example, in writing out to 8516% an auxiliary file for an index entry). 8517% 8518% State is kept in the input stream: the argument passed to 8519% @look_ahead, @gobble_and_check_finish and @add_segment is 8520% 8521% THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input) 8522% 8523% where: 8524% THE_MACRO - name of the macro we want to call 8525% ARG_RESULT - argument list we build to pass to that macro 8526% PENDING_BS - either a backslash or nothing 8527% NEXT_TOKEN - used to look ahead in the input stream to see what's coming next 8528 8529@gdef@passargtomacro#1#2{% 8530 @add_segment #1!{}@relax#2\@_finish\% 8531} 8532@gdef@_finish{@_finishx} @global@let@_finishx@relax 8533 8534% #1 - THE_MACRO ARG_RESULT 8535% #2 - PENDING_BS 8536% #3 - NEXT_TOKEN 8537% #4 used to look ahead 8538% 8539% If the next token is not a backslash, process the rest of the argument; 8540% otherwise, remove the next token. 8541@gdef@look_ahead#1!#2#3#4{% 8542 @ifx#4\% 8543 @expandafter@gobble_and_check_finish 8544 @else 8545 @expandafter@add_segment 8546 @fi#1!{#2}#4#4% 8547} 8548 8549% #1 - THE_MACRO ARG_RESULT 8550% #2 - PENDING_BS 8551% #3 - NEXT_TOKEN 8552% #4 should be a backslash, which is gobbled. 8553% #5 looks ahead 8554% 8555% Double backslash found. Add a single backslash, and look ahead. 8556@gdef@gobble_and_check_finish#1!#2#3#4#5{% 8557 @add_segment#1\!{}#5#5% 8558} 8559 8560@gdef@is_fi{@fi} 8561 8562% #1 - THE_MACRO ARG_RESULT 8563% #2 - PENDING_BS 8564% #3 - NEXT_TOKEN 8565% #4 is input stream until next backslash 8566% 8567% Input stream is either at the start of the argument, or just after a 8568% backslash sequence, either a lone backslash, or a doubled backslash. 8569% NEXT_TOKEN contains the first token in the input stream: if it is \finish, 8570% finish; otherwise, append to ARG_RESULT the segment of the argument up until 8571% the next backslash. PENDING_BACKSLASH contains a backslash to represent 8572% a backslash just before the start of the input stream that has not been 8573% added to ARG_RESULT. 8574@gdef@add_segment#1!#2#3#4\{% 8575@ifx#3@_finish 8576 @call_the_macro#1!% 8577@else 8578 % append the pending backslash to the result, followed by the next segment 8579 @expandafter@is_fi@look_ahead#1#2#4!{\}@fi 8580 % this @fi is discarded by @look_ahead. 8581 % we can't get rid of it with \expandafter because we don't know how 8582 % long #4 is. 8583} 8584 8585% #1 - THE_MACRO 8586% #2 - ARG_RESULT 8587% #3 discards the res of the conditional in @add_segment, and @is_fi ends the 8588% conditional. 8589@gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}} 8590 8591} 8592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8593 8594% \braceorline MAC is used for a one-argument macro MAC. It checks 8595% whether the next non-whitespace character is a {. It sets the context 8596% for reading the argument (slightly different in the two cases). Then, 8597% to read the argument, in the whole-line case, it then calls the regular 8598% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC. 8599% 8600\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} 8601\def\braceorlinexxx{% 8602 \ifx\nchar\bgroup 8603 \macroargctxt 8604 \expandafter\passargtomacro 8605 \else 8606 \macrolineargctxt\expandafter\parsearg 8607 \fi \macnamexxx} 8608 8609 8610% @alias. 8611% We need some trickery to remove the optional spaces around the equal 8612% sign. Make them active and then expand them all to nothing. 8613% 8614\def\alias{\parseargusing\obeyspaces\aliasxxx} 8615\def\aliasxxx #1{\aliasyyy#1\relax} 8616\def\aliasyyy #1=#2\relax{% 8617 {% 8618 \expandafter\let\obeyedspace=\empty 8619 \addtomacrolist{#1}% 8620 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% 8621 }% 8622 \next 8623} 8624 8625 8626\message{cross references,} 8627 8628\newwrite\auxfile 8629\newif\ifhavexrefs % True if xref values are known. 8630\newif\ifwarnedxrefs % True if we warned once that they aren't known. 8631 8632% @inforef is relatively simple. 8633\def\inforef #1{\inforefzzz #1,,,,**} 8634\def\inforefzzz #1,#2,#3,#4**{% 8635 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, 8636 node \samp{\ignorespaces#1{}}} 8637 8638% @node's only job in TeX is to define \lastnode, which is used in 8639% cross-references. The @node line might or might not have commas, and 8640% might or might not have spaces before the first comma, like: 8641% @node foo , bar , ... 8642% We don't want such trailing spaces in the node name. 8643% 8644\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} 8645% 8646% also remove a trailing comma, in case of something like this: 8647% @node Help-Cross, , , Cross-refs 8648\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} 8649\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode} 8650 8651% Used so that the @top node doesn't have to be wrapped in an @ifnottex 8652% conditional. 8653% \doignore goes to more effort to skip nested conditionals but we don't need 8654% that here. 8655\def\omittopnode{% 8656 \ifx\lastnode\wordTop 8657 \expandafter\ignorenode\fi 8658} 8659\def\wordTop{Top} 8660 8661% Until the next @node, @part or @bye command, divert output to a box that 8662% is not output. 8663\def\ignorenode{\setbox\dummybox\vbox\bgroup 8664\def\part{\egroup\part}% 8665\def\node{\egroup\node}% 8666\ignorenodebye 8667} 8668 8669{\let\bye\relax 8670\gdef\ignorenodebye{\let\bye\ignorenodebyedef} 8671\gdef\ignorenodebyedef{\egroup(`Top' node ignored)\bye}} 8672% The redefinition of \bye here is because it is declared \outer 8673 8674\let\lastnode=\empty 8675 8676% Write a cross-reference definition for the current node. #1 is the 8677% type (Ynumbered, Yappendix, Ynothing). 8678% 8679\def\donoderef#1{% 8680 \ifx\lastnode\empty\else 8681 \setref{\lastnode}{#1}% 8682 \global\let\lastnode=\empty 8683 \fi 8684} 8685 8686% @anchor{NAME} -- define xref target at arbitrary point. 8687% 8688\newcount\savesfregister 8689% 8690\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} 8691\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} 8692\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} 8693 8694% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an 8695% anchor), which consists of three parts: 8696% 1) NAME-title - the current sectioning name taken from \currentsection, 8697% or the anchor name. 8698% 2) NAME-snt - section number and type, passed as the SNT arg, or 8699% empty for anchors. 8700% 3) NAME-pg - the page number. 8701% 8702% This is called from \donoderef, \anchor, and \dofloat. In the case of 8703% floats, there is an additional part, which is not written here: 8704% 4) NAME-lof - the text as it should appear in a @listoffloats. 8705% 8706\def\setref#1#2{% 8707 \pdfmkdest{#1}% 8708 \iflinks 8709 {% 8710 \requireauxfile 8711 \atdummies % preserve commands, but don't expand them 8712 % match definition in \xrdef, \refx, \xrefX. 8713 \def\value##1{##1}% 8714 \edef\writexrdef##1##2{% 8715 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef 8716 ##1}{##2}}% these are parameters of \writexrdef 8717 }% 8718 \toks0 = \expandafter{\currentsection}% 8719 \immediate \writexrdef{title}{\the\toks0 }% 8720 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. 8721 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout 8722 }% 8723 \fi 8724} 8725 8726% @xrefautosectiontitle on|off says whether @section(ing) names are used 8727% automatically in xrefs, if the third arg is not explicitly specified. 8728% This was provided as a "secret" @set xref-automatic-section-title 8729% variable, now it's official. 8730% 8731\parseargdef\xrefautomaticsectiontitle{% 8732 \def\temp{#1}% 8733 \ifx\temp\onword 8734 \expandafter\let\csname SETxref-automatic-section-title\endcsname 8735 = \empty 8736 \else\ifx\temp\offword 8737 \expandafter\let\csname SETxref-automatic-section-title\endcsname 8738 = \relax 8739 \else 8740 \errhelp = \EMsimple 8741 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', 8742 must be on|off}% 8743 \fi\fi 8744} 8745 8746% 8747% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is 8748% the node name, #2 the name of the Info cross-reference, #3 the printed 8749% node name, #4 the name of the Info file, #5 the name of the printed 8750% manual. All but the node name can be omitted. 8751% 8752\def\pxref{\putwordsee{} \xrefXX} 8753\def\xref{\putwordSee{} \xrefXX} 8754\def\ref{\xrefXX} 8755 8756\def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX} 8757\def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]} 8758% 8759\newbox\toprefbox 8760\newbox\printedrefnamebox 8761\newbox\infofilenamebox 8762\newbox\printedmanualbox 8763% 8764\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup 8765 \unsepspaces 8766 % 8767 % Get args without leading/trailing spaces. 8768 \def\printedrefname{\ignorespaces #3}% 8769 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% 8770 % 8771 \def\infofilename{\ignorespaces #4}% 8772 \setbox\infofilenamebox = \hbox{\infofilename\unskip}% 8773 % 8774 \def\printedmanual{\ignorespaces #5}% 8775 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% 8776 % 8777 % If the printed reference name (arg #3) was not explicitly given in 8778 % the @xref, figure out what we want to use. 8779 \ifdim \wd\printedrefnamebox = 0pt 8780 % No printed node name was explicitly given. 8781 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax 8782 % Not auto section-title: use node name inside the square brackets. 8783 \def\printedrefname{\ignorespaces #1}% 8784 \else 8785 % Auto section-title: use chapter/section title inside 8786 % the square brackets if we have it. 8787 \ifdim \wd\printedmanualbox > 0pt 8788 % It is in another manual, so we don't have it; use node name. 8789 \def\printedrefname{\ignorespaces #1}% 8790 \else 8791 \ifhavexrefs 8792 % We (should) know the real title if we have the xref values. 8793 \def\printedrefname{\refx{#1-title}}% 8794 \else 8795 % Otherwise just copy the Info node name. 8796 \def\printedrefname{\ignorespaces #1}% 8797 \fi% 8798 \fi 8799 \fi 8800 \fi 8801 % 8802 % Make link in pdf output. 8803 \ifpdf 8804 % For pdfTeX and LuaTeX 8805 {\indexnofonts 8806 \makevalueexpandable 8807 \turnoffactive 8808 % This expands tokens, so do it after making catcode changes, so _ 8809 % etc. don't get their TeX definitions. This ignores all spaces in 8810 % #4, including (wrongly) those in the middle of the filename. 8811 \getfilename{#4}% 8812 % 8813 % This (wrongly) does not take account of leading or trailing 8814 % spaces in #1, which should be ignored. 8815 \setpdfdestname{#1}% 8816 % 8817 \ifx\pdfdestname\empty 8818 \def\pdfdestname{Top}% no empty targets 8819 \fi 8820 % 8821 \leavevmode 8822 \startlink attr{/Border [0 0 0]}% 8823 \ifnum\filenamelength>0 8824 goto file{\the\filename.pdf} name{\pdfdestname}% 8825 \else 8826 goto name{\pdfmkpgn{\pdfdestname}}% 8827 \fi 8828 }% 8829 \setcolor{\linkcolor}% 8830 \else 8831 \ifx\XeTeXrevision\thisisundefined 8832 \else 8833 % For XeTeX 8834 {\indexnofonts 8835 \makevalueexpandable 8836 \turnoffactive 8837 % This expands tokens, so do it after making catcode changes, so _ 8838 % etc. don't get their TeX definitions. This ignores all spaces in 8839 % #4, including (wrongly) those in the middle of the filename. 8840 \getfilename{#4}% 8841 % 8842 % This (wrongly) does not take account of leading or trailing 8843 % spaces in #1, which should be ignored. 8844 \setpdfdestname{#1}% 8845 % 8846 \ifx\pdfdestname\empty 8847 \def\pdfdestname{Top}% no empty targets 8848 \fi 8849 % 8850 \leavevmode 8851 \ifnum\filenamelength>0 8852 % With default settings, 8853 % XeTeX (xdvipdfmx) replaces link destination names with integers. 8854 % In this case, the replaced destination names of 8855 % remote PDFs are no longer known. In order to avoid a replacement, 8856 % you can use xdvipdfmx's command line option `-C 0x0010'. 8857 % If you use XeTeX 0.99996+ (TeX Live 2016+), 8858 % this command line option is no longer necessary 8859 % because we can use the `dvipdfmx:config' special. 8860 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A 8861 << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}% 8862 \else 8863 \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A 8864 << /S /GoTo /D (\pdfdestname) >> >>}% 8865 \fi 8866 }% 8867 \setcolor{\linkcolor}% 8868 \fi 8869 \fi 8870 {% 8871 % Have to otherify everything special to allow the \csname to 8872 % include an _ in the xref name, etc. 8873 \indexnofonts 8874 \turnoffactive 8875 \def\value##1{##1}% 8876 \expandafter\global\expandafter\let\expandafter\Xthisreftitle 8877 \csname XR#1-title\endcsname 8878 }% 8879 % 8880 % Float references are printed completely differently: "Figure 1.2" 8881 % instead of "[somenode], p.3". \iffloat distinguishes them by 8882 % \Xthisreftitle being set to a magic string. 8883 \iffloat\Xthisreftitle 8884 % If the user specified the print name (third arg) to the ref, 8885 % print it instead of our usual "Figure 1.2". 8886 \ifdim\wd\printedrefnamebox = 0pt 8887 \refx{#1-snt}% 8888 \else 8889 \printedrefname 8890 \fi 8891 % 8892 % If the user also gave the printed manual name (fifth arg), append 8893 % "in MANUALNAME". 8894 \ifdim \wd\printedmanualbox > 0pt 8895 \space \putwordin{} \cite{\printedmanual}% 8896 \fi 8897 \else 8898 % node/anchor (non-float) references. 8899 % 8900 % If we use \unhbox to print the node names, TeX does not insert 8901 % empty discretionaries after hyphens, which means that it will not 8902 % find a line break at a hyphen in a node names. Since some manuals 8903 % are best written with fairly long node names, containing hyphens, 8904 % this is a loss. Therefore, we give the text of the node name 8905 % again, so it is as if TeX is seeing it for the first time. 8906 % 8907 \ifdim \wd\printedmanualbox > 0pt 8908 % Cross-manual reference with a printed manual name. 8909 % 8910 \crossmanualxref{\cite{\printedmanual\unskip}}% 8911 % 8912 \else\ifdim \wd\infofilenamebox > 0pt 8913 % Cross-manual reference with only an info filename (arg 4), no 8914 % printed manual name (arg 5). This is essentially the same as 8915 % the case above; we output the filename, since we have nothing else. 8916 % 8917 \crossmanualxref{\code{\infofilename\unskip}}% 8918 % 8919 \else 8920 % Reference within this manual. 8921 % 8922 % Only output a following space if the -snt ref is nonempty, as the ref 8923 % will be empty for @unnumbered and @anchor. 8924 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}% 8925 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi 8926 % 8927 % output the `[mynode]' via the macro below so it can be overridden. 8928 \xrefprintnodename\printedrefname 8929 % 8930 \ifflagclear{txiomitxrefpg}{% 8931 % We always want a comma 8932 ,% 8933 % output the `page 3'. 8934 \turnoffactive \putpageref{#1}% 8935 % Add a , if xref followed by a space 8936 \if\space\noexpand\tokenafterxref ,% 8937 \else\ifx\ \tokenafterxref ,% @TAB 8938 \else\ifx\*\tokenafterxref ,% @* 8939 \else\ifx\ \tokenafterxref ,% @SPACE 8940 \else\ifx\ 8941 \tokenafterxref ,% @NL 8942 \else\ifx\tie\tokenafterxref ,% @tie 8943 \fi\fi\fi\fi\fi\fi 8944 }{}% 8945 \fi\fi 8946 \fi 8947 \endlink 8948\endgroup} 8949 8950% can be overridden in translation files 8951\def\putpageref#1{% 8952 \space\putwordpage\tie\refx{#1-pg}} 8953 8954% Output a cross-manual xref to #1. Used just above (twice). 8955% 8956% Only include the text "Section ``foo'' in" if the foo is neither 8957% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply 8958% "see The Foo Manual", the idea being to refer to the whole manual. 8959% 8960% But, this being TeX, we can't easily compare our node name against the 8961% string "Top" while ignoring the possible spaces before and after in 8962% the input. By adding the arbitrary 7sp below, we make it much less 8963% likely that a real node name would have the same width as "Top" (e.g., 8964% in a monospaced font). Hopefully it will never happen in practice. 8965% 8966% For the same basic reason, we retypeset the "Top" at every 8967% reference, since the current font is indeterminate. 8968% 8969\def\crossmanualxref#1{% 8970 \setbox\toprefbox = \hbox{Top\kern7sp}% 8971 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% 8972 \ifdim \wd2 > 7sp % nonempty? 8973 \ifdim \wd2 = \wd\toprefbox \else % same as Top? 8974 \putwordSection{} ``\printedrefname'' \putwordin{}\space 8975 \fi 8976 \fi 8977 #1% 8978} 8979 8980% This macro is called from \xrefX for the `[nodename]' part of xref 8981% output. It's a separate macro only so it can be changed more easily, 8982% since square brackets don't work well in some documents. Particularly 8983% one that Bob is working on :). 8984% 8985\def\xrefprintnodename#1{[#1]} 8986 8987% Things referred to by \setref. 8988% 8989\def\Ynothing{} 8990\def\Yomitfromtoc{} 8991\def\Ynumbered{% 8992 \ifnum\secno=0 8993 \putwordChapter@tie \the\chapno 8994 \else \ifnum\subsecno=0 8995 \putwordSection@tie \the\chapno.\the\secno 8996 \else \ifnum\subsubsecno=0 8997 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno 8998 \else 8999 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno 9000 \fi\fi\fi 9001} 9002\def\Yappendix{% 9003 \ifnum\secno=0 9004 \putwordAppendix@tie @char\the\appendixno{}% 9005 \else \ifnum\subsecno=0 9006 \putwordSection@tie @char\the\appendixno.\the\secno 9007 \else \ifnum\subsubsecno=0 9008 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno 9009 \else 9010 \putwordSection@tie 9011 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno 9012 \fi\fi\fi 9013} 9014 9015% \refx{NAME} - reference a cross-reference string named NAME. 9016\def\refx#1{% 9017 \requireauxfile 9018 {% 9019 \indexnofonts 9020 \turnoffactive 9021 \def\value##1{##1}% 9022 \expandafter\global\expandafter\let\expandafter\thisrefX 9023 \csname XR#1\endcsname 9024 }% 9025 \ifx\thisrefX\relax 9026 % If not defined, say something at least. 9027 \angleleft un\-de\-fined\angleright 9028 \iflinks 9029 \ifhavexrefs 9030 {\toks0 = {#1}% avoid expansion of possibly-complex value 9031 \message{\linenumber Undefined cross reference `\the\toks0'.}}% 9032 \else 9033 \ifwarnedxrefs\else 9034 \global\warnedxrefstrue 9035 \message{Cross reference values unknown; you must run TeX again.}% 9036 \fi 9037 \fi 9038 \fi 9039 \else 9040 % It's defined, so just use it. 9041 \thisrefX 9042 \fi 9043} 9044 9045% This is the macro invoked by entries in the aux file. Define a control 9046% sequence for a cross-reference target (we prepend XR to the control sequence 9047% name to avoid collisions). The value is the page number. If this is a float 9048% type, we have more work to do. 9049% 9050\def\xrdef#1#2{% 9051 {% Expand the node or anchor name to remove control sequences. 9052 % \turnoffactive stops 8-bit characters being changed to commands 9053 % like @'e. \refx does the same to retrieve the value in the definition. 9054 \indexnofonts 9055 \turnoffactive 9056 \def\value##1{##1}% 9057 \xdef\safexrefname{#1}% 9058 }% 9059 % 9060 \bgroup 9061 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% 9062 \egroup 9063 % We put the \gdef inside a group to avoid the definitions building up on 9064 % TeX's save stack, which can cause it to run out of space for aux files with 9065 % thousands of lines. \gdef doesn't use the save stack, but \csname does 9066 % when it defines an unknown control sequence as \relax. 9067 % 9068 % Was that xref control sequence that we just defined for a float? 9069 \expandafter\iffloat\csname XR\safexrefname\endcsname 9070 % it was a float, and we have the (safe) float type in \iffloattype. 9071 \expandafter\let\expandafter\floatlist 9072 \csname floatlist\iffloattype\endcsname 9073 % 9074 % Is this the first time we've seen this float type? 9075 \expandafter\ifx\floatlist\relax 9076 \toks0 = {\do}% yes, so just \do 9077 \else 9078 % had it before, so preserve previous elements in list. 9079 \toks0 = \expandafter{\floatlist\do}% 9080 \fi 9081 % 9082 % Remember this xref in the control sequence \floatlistFLOATTYPE, 9083 % for later use in \listoffloats. 9084 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 9085 {\safexrefname}}% 9086 \fi 9087} 9088 9089% If working on a large document in chapters, it is convenient to 9090% be able to disable indexing, cross-referencing, and contents, for test runs. 9091% This is done with @novalidate at the beginning of the file. 9092% 9093\newif\iflinks \linkstrue % by default we want the aux files. 9094\let\novalidate = \linksfalse 9095 9096% Used when writing to the aux file, or when using data from it. 9097\def\requireauxfile{% 9098 \iflinks 9099 \tryauxfile 9100 % Open the new aux file. TeX will close it automatically at exit. 9101 \immediate\openout\auxfile=\jobname.aux 9102 \fi 9103 \global\let\requireauxfile=\relax % Only do this once. 9104} 9105 9106% Read the last existing aux file, if any. No error if none exists. 9107% 9108\def\tryauxfile{% 9109 \openin 1 \jobname.aux 9110 \ifeof 1 \else 9111 \readdatafile{aux}% 9112 \global\havexrefstrue 9113 \fi 9114 \closein 1 9115} 9116 9117\def\setupdatafile{% 9118 \catcode`\^^@=\other 9119 \catcode`\^^A=\other 9120 \catcode`\^^B=\other 9121 \catcode`\^^C=\other 9122 \catcode`\^^D=\other 9123 \catcode`\^^E=\other 9124 \catcode`\^^F=\other 9125 \catcode`\^^G=\other 9126 \catcode`\^^H=\other 9127 \catcode`\^^K=\other 9128 \catcode`\^^L=\other 9129 \catcode`\^^N=\other 9130 \catcode`\^^P=\other 9131 \catcode`\^^Q=\other 9132 \catcode`\^^R=\other 9133 \catcode`\^^S=\other 9134 \catcode`\^^T=\other 9135 \catcode`\^^U=\other 9136 \catcode`\^^V=\other 9137 \catcode`\^^W=\other 9138 \catcode`\^^X=\other 9139 \catcode`\^^Z=\other 9140 \catcode`\^^[=\other 9141 \catcode`\^^\=\other 9142 \catcode`\^^]=\other 9143 \catcode`\^^^=\other 9144 \catcode`\^^_=\other 9145 \catcode`\^=\other 9146 % 9147 % Special characters. Should be turned off anyway, but... 9148 \catcode`\~=\other 9149 \catcode`\[=\other 9150 \catcode`\]=\other 9151 \catcode`\"=\other 9152 \catcode`\_=\active 9153 \catcode`\|=\active 9154 \catcode`\<=\active 9155 \catcode`\>=\active 9156 \catcode`\$=\other 9157 \catcode`\#=\other 9158 \catcode`\&=\other 9159 \catcode`\%=\other 9160 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off 9161 % 9162 \catcode`\\=\active 9163 % 9164 % @ is our escape character in .aux files, and we need braces. 9165 \catcode`\{=1 9166 \catcode`\}=2 9167 \catcode`\@=0 9168} 9169 9170\def\readdatafile#1{% 9171\begingroup 9172 \setupdatafile 9173 \input\jobname.#1 9174\endgroup} 9175 9176 9177\message{insertions,} 9178% including footnotes. 9179 9180\newcount \footnoteno 9181 9182% The trailing space in the following definition for supereject is 9183% vital for proper filling; pages come out unaligned when you do a 9184% pagealignmacro call if that space before the closing brace is 9185% removed. (Generally, numeric constants should always be followed by a 9186% space to prevent strange expansion errors.) 9187\def\supereject{\par\penalty -20000\footnoteno =0 } 9188 9189% @footnotestyle is meaningful for Info output only. 9190\let\footnotestyle=\comment 9191 9192{\catcode `\@=11 9193% 9194% Auto-number footnotes. Otherwise like plain. 9195\gdef\footnote{% 9196 \global\advance\footnoteno by \@ne 9197 \edef\thisfootno{$^{\the\footnoteno}$}% 9198 % 9199 % In case the footnote comes at the end of a sentence, preserve the 9200 % extra spacing after we do the footnote number. 9201 \let\@sf\empty 9202 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi 9203 % 9204 % Remove inadvertent blank space before typesetting the footnote number. 9205 \unskip 9206 \thisfootno\@sf 9207 \dofootnote 9208}% 9209 9210% Don't bother with the trickery in plain.tex to not require the 9211% footnote text as a parameter. Our footnotes don't need to be so general. 9212% 9213% Oh yes, they do; otherwise, @ifset (and anything else that uses 9214% \parseargline) fails inside footnotes because the tokens are fixed when 9215% the footnote is read. --karl, 16nov96. 9216% 9217\gdef\dofootnote{% 9218 \insert\footins\bgroup 9219 % 9220 % Nested footnotes are not supported in TeX, that would take a lot 9221 % more work. (\startsavinginserts does not suffice.) 9222 \let\footnote=\errfootnotenest 9223 % 9224 % We want to typeset this text as a normal paragraph, even if the 9225 % footnote reference occurs in (for example) a display environment. 9226 % So reset some parameters. 9227 \hsize=\txipagewidth 9228 \interlinepenalty\interfootnotelinepenalty 9229 \splittopskip\ht\strutbox % top baseline for broken footnotes 9230 \splitmaxdepth\dp\strutbox 9231 \floatingpenalty\@MM 9232 \leftskip\z@skip 9233 \rightskip\z@skip 9234 \spaceskip\z@skip 9235 \xspaceskip\z@skip 9236 \parindent\defaultparindent 9237 % 9238 \smallfonts \rm 9239 % 9240 % Because we use hanging indentation in footnotes, a @noindent appears 9241 % to exdent this text, so make it be a no-op. makeinfo does not use 9242 % hanging indentation so @noindent can still be needed within footnote 9243 % text after an @example or the like (not that this is good style). 9244 \let\noindent = \relax 9245 % 9246 % Hang the footnote text off the number. Use \everypar in case the 9247 % footnote extends for more than one paragraph. 9248 \everypar = {\hang}% 9249 \textindent{\thisfootno}% 9250 % 9251 % Don't crash into the line above the footnote text. Since this 9252 % expands into a box, it must come within the paragraph, lest it 9253 % provide a place where TeX can split the footnote. 9254 \footstrut 9255 % 9256 % Invoke rest of plain TeX footnote routine. 9257 \futurelet\next\fo@t 9258} 9259}%end \catcode `\@=11 9260 9261\def\errfootnotenest{% 9262 \errhelp=\EMsimple 9263 \errmessage{Nested footnotes not supported in texinfo.tex, 9264 even though they work in makeinfo; sorry} 9265} 9266 9267\def\errfootnoteheading{% 9268 \errhelp=\EMsimple 9269 \errmessage{Footnotes in chapters, sections, etc., are not supported} 9270} 9271 9272% In case a @footnote appears in a vbox, save the footnote text and create 9273% the real \insert just after the vbox finished. Otherwise, the insertion 9274% would be lost. 9275% Similarly, if a @footnote appears inside an alignment, save the footnote 9276% text to a box and make the \insert when a row of the table is finished. 9277% And the same can be done for other insert classes. --kasal, 16nov03. 9278% 9279% Replace the \insert primitive by a cheating macro. 9280% Deeper inside, just make sure that the saved insertions are not spilled 9281% out prematurely. 9282% 9283\def\startsavinginserts{% 9284 \ifx \insert\ptexinsert 9285 \let\insert\saveinsert 9286 \else 9287 \let\checkinserts\relax 9288 \fi 9289} 9290 9291% This \insert replacement works for both \insert\footins{foo} and 9292% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. 9293% 9294\def\saveinsert#1{% 9295 \edef\next{\noexpand\savetobox \makeSAVEname#1}% 9296 \afterassignment\next 9297 % swallow the left brace 9298 \let\temp = 9299} 9300\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} 9301\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} 9302 9303\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} 9304 9305\def\placesaveins#1{% 9306 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname 9307 {\box#1}% 9308} 9309 9310% eat @SAVE -- beware, all of them have catcode \other: 9311{ 9312 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) 9313 \gdef\gobblesave @SAVE{} 9314} 9315 9316% initialization: 9317\def\newsaveins #1{% 9318 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% 9319 \next 9320} 9321\def\newsaveinsX #1{% 9322 \csname newbox\endcsname #1% 9323 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts 9324 \checksaveins #1}% 9325} 9326 9327% initialize: 9328\let\checkinserts\empty 9329\newsaveins\footins 9330\newsaveins\margin 9331 9332 9333% @image. We use the macros from epsf.tex to support this. 9334% If epsf.tex is not installed and @image is used, we complain. 9335% 9336% Check for and read epsf.tex up front. If we read it only at @image 9337% time, we might be inside a group, and then its definitions would get 9338% undone and the next image would fail. 9339\openin 1 = epsf.tex 9340\ifeof 1 \else 9341 % Do not bother showing banner with epsf.tex v2.7k (available in 9342 % doc/epsf.tex and on ctan). 9343 \def\epsfannounce{\toks0 = }% 9344 \input epsf.tex 9345\fi 9346\closein 1 9347% 9348% We will only complain once about lack of epsf.tex. 9349\newif\ifwarnednoepsf 9350\newhelp\noepsfhelp{epsf.tex must be installed for images to 9351 work. It is also included in the Texinfo distribution, or you can get 9352 it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.} 9353% 9354\def\image#1{% 9355 \ifx\epsfbox\thisisundefined 9356 \ifwarnednoepsf \else 9357 \errhelp = \noepsfhelp 9358 \errmessage{epsf.tex not found, images will be ignored}% 9359 \global\warnednoepsftrue 9360 \fi 9361 \else 9362 \imagexxx #1,,,,,\finish 9363 \fi 9364} 9365 9366% Approximate height of a line in the standard text font. 9367\newdimen\capheight 9368\setbox0=\vbox{\tenrm H} 9369\capheight=\ht0 9370 9371% 9372% Arguments to @image: 9373% #1 is (mandatory) image filename; we tack on .eps extension. 9374% #2 is (optional) width, #3 is (optional) height. 9375% #4 is (ignored optional) html alt text. 9376% #5 is (ignored optional) extension. 9377% #6 is just the usual extra ignored arg for parsing stuff. 9378\newif\ifimagevmode 9379\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup 9380 \catcode`\^^M = 5 % in case we're inside an example 9381 \normalturnoffactive % allow _ et al. in names 9382 \makevalueexpandable 9383 \ifvmode 9384 \imagevmodetrue 9385 \medskip 9386 % Usually we'll have text after the image which will insert 9387 % \parskip glue, so insert it here too to equalize the space 9388 % above and below. 9389 \vskip\parskip 9390 % 9391 % Place image in a \vtop for a top page margin that is (close to) correct, 9392 % as \topskip glue is relative to the first baseline. 9393 \vtop\bgroup \kern -\capheight \vskip-\parskip 9394 \fi 9395 % 9396 \ifx\centersub\centerV 9397 % For @center @image, enter vertical mode and add vertical space 9398 % Enter an extra \parskip because @center doesn't add space itself. 9399 \vbox\bgroup\vskip\parskip\medskip\vskip\parskip 9400 \else 9401 % Enter horizontal mode so that indentation from an enclosing 9402 % environment such as @quotation is respected. 9403 % However, if we're at the top level, we don't want the 9404 % normal paragraph indentation. 9405 \imageindent 9406 \fi 9407 % 9408 % Output the image. 9409 \ifpdf 9410 % For pdfTeX and LuaTeX <= 0.80 9411 \dopdfimage{#1}{#2}{#3}% 9412 \else 9413 \ifx\XeTeXrevision\thisisundefined 9414 % For epsf.tex 9415 % \epsfbox itself resets \epsf?size at each figure. 9416 \setbox0 = \hbox{\ignorespaces #2}% 9417 \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi 9418 \setbox0 = \hbox{\ignorespaces #3}% 9419 \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi 9420 \epsfbox{#1.eps}% 9421 \else 9422 % For XeTeX 9423 \doxeteximage{#1}{#2}{#3}% 9424 \fi 9425 \fi 9426 % 9427 \ifimagevmode 9428 \egroup 9429 \medskip % space after a standalone image 9430 \fi 9431 \ifx\centersub\centerV % @center @image 9432 \medskip 9433 \egroup % close \vbox 9434 \fi 9435\endgroup} 9436 9437 9438% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, 9439% etc. We don't actually implement floating yet, we always include the 9440% float "here". But it seemed the best name for the future. 9441% 9442\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} 9443 9444% There may be a space before second and/or third parameter; delete it. 9445\def\eatcommaspace#1, {#1,} 9446 9447% #1 is the optional FLOATTYPE, the text label for this float, typically 9448% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, 9449% this float will not be numbered and cannot be referred to. 9450% 9451% #2 is the optional xref label. Also must be present for the float to 9452% be referable. 9453% 9454% #3 is the optional positioning argument; for now, it is ignored. It 9455% will somehow specify the positions allowed to float to (here, top, bottom). 9456% 9457% We keep a separate counter for each FLOATTYPE, which we reset at each 9458% chapter-level command. 9459\let\resetallfloatnos=\empty 9460% 9461\def\dofloat#1,#2,#3,#4\finish{% 9462 \let\thiscaption=\empty 9463 \let\thisshortcaption=\empty 9464 % 9465 % don't lose footnotes inside @float. 9466 % 9467 % BEWARE: when the floats start float, we have to issue warning whenever an 9468 % insert appears inside a float which could possibly float. --kasal, 26may04 9469 % 9470 \startsavinginserts 9471 % 9472 % We can't be used inside a paragraph. 9473 \par 9474 % 9475 \vtop\bgroup 9476 \def\floattype{#1}% 9477 \def\floatlabel{#2}% 9478 \def\floatloc{#3}% we do nothing with this yet. 9479 % 9480 \ifx\floattype\empty 9481 \let\safefloattype=\empty 9482 \else 9483 {% 9484 % the floattype might have accents or other special characters, 9485 % but we need to use it in a control sequence name. 9486 \indexnofonts 9487 \turnoffactive 9488 \xdef\safefloattype{\floattype}% 9489 }% 9490 \fi 9491 % 9492 % If label is given but no type, we handle that as the empty type. 9493 \ifx\floatlabel\empty \else 9494 % We want each FLOATTYPE to be numbered separately (Figure 1, 9495 % Table 1, Figure 2, ...). (And if no label, no number.) 9496 % 9497 \expandafter\getfloatno\csname\safefloattype floatno\endcsname 9498 \global\advance\floatno by 1 9499 % 9500 {% 9501 % This magic value for \currentsection is output by \setref as the 9502 % XREFLABEL-title value. \xrefX uses it to distinguish float 9503 % labels (which have a completely different output format) from 9504 % node and anchor labels. And \xrdef uses it to construct the 9505 % lists of floats. 9506 % 9507 \edef\currentsection{\floatmagic=\safefloattype}% 9508 \setref{\floatlabel}{Yfloat}% 9509 }% 9510 \fi 9511 % 9512 % start with \parskip glue, I guess. 9513 \vskip\parskip 9514 % 9515 % Don't suppress indentation if a float happens to start a section. 9516 \restorefirstparagraphindent 9517} 9518 9519% we have these possibilities: 9520% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap 9521% @float Foo,lbl & no caption: Foo 1.1 9522% @float Foo & @caption{Cap}: Foo: Cap 9523% @float Foo & no caption: Foo 9524% @float ,lbl & Caption{Cap}: 1.1: Cap 9525% @float ,lbl & no caption: 1.1 9526% @float & @caption{Cap}: Cap 9527% @float & no caption: 9528% 9529\def\Efloat{% 9530 \let\floatident = \empty 9531 % 9532 % In all cases, if we have a float type, it comes first. 9533 \ifx\floattype\empty \else \def\floatident{\floattype}\fi 9534 % 9535 % If we have an xref label, the number comes next. 9536 \ifx\floatlabel\empty \else 9537 \ifx\floattype\empty \else % if also had float type, need tie first. 9538 \appendtomacro\floatident{\tie}% 9539 \fi 9540 % the number. 9541 \appendtomacro\floatident{\chaplevelprefix\the\floatno}% 9542 \fi 9543 % 9544 % Start the printed caption with what we've constructed in 9545 % \floatident, but keep it separate; we need \floatident again. 9546 \let\captionline = \floatident 9547 % 9548 \ifx\thiscaption\empty \else 9549 \ifx\floatident\empty \else 9550 \appendtomacro\captionline{: }% had ident, so need a colon between 9551 \fi 9552 % 9553 % caption text. 9554 \appendtomacro\captionline{\scanexp\thiscaption}% 9555 \fi 9556 % 9557 % If we have anything to print, print it, with space before. 9558 % Eventually this needs to become an \insert. 9559 \ifx\captionline\empty \else 9560 \vskip.5\parskip 9561 \captionline 9562 % 9563 % Space below caption. 9564 \vskip\parskip 9565 \fi 9566 % 9567 % If have an xref label, write the list of floats info. Do this 9568 % after the caption, to avoid chance of it being a breakpoint. 9569 \ifx\floatlabel\empty \else 9570 % Write the text that goes in the lof to the aux file as 9571 % \floatlabel-lof. Besides \floatident, we include the short 9572 % caption if specified, else the full caption if specified, else nothing. 9573 {% 9574 \requireauxfile 9575 \atdummies 9576 % 9577 \ifx\thisshortcaption\empty 9578 \def\gtemp{\thiscaption}% 9579 \else 9580 \def\gtemp{\thisshortcaption}% 9581 \fi 9582 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident 9583 \ifx\gtemp\empty \else : \gtemp \fi}}% 9584 }% 9585 \fi 9586 \egroup % end of \vtop 9587 % 9588 \checkinserts 9589} 9590 9591% Append the tokens #2 to the definition of macro #1, not expanding either. 9592% 9593\def\appendtomacro#1#2{% 9594 \expandafter\def\expandafter#1\expandafter{#1#2}% 9595} 9596 9597% @caption, @shortcaption 9598% 9599\def\caption{\docaption\thiscaption} 9600\def\shortcaption{\docaption\thisshortcaption} 9601\def\docaption{\checkenv\float \bgroup\scanctxt\defcaption} 9602\def\defcaption#1#2{\egroup \def#1{#2}} 9603 9604% The parameter is the control sequence identifying the counter we are 9605% going to use. Create it if it doesn't exist and assign it to \floatno. 9606\def\getfloatno#1{% 9607 \ifx#1\relax 9608 % Haven't seen this figure type before. 9609 \csname newcount\endcsname #1% 9610 % 9611 % Remember to reset this floatno at the next chap. 9612 \expandafter\gdef\expandafter\resetallfloatnos 9613 \expandafter{\resetallfloatnos #1=0 }% 9614 \fi 9615 \let\floatno#1% 9616} 9617 9618% \setref calls this to get the XREFLABEL-snt value. We want an @xref 9619% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we 9620% first read the @float command. 9621% 9622\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% 9623 9624% Magic string used for the XREFLABEL-title value, so \xrefX can 9625% distinguish floats from other xref types. 9626\def\floatmagic{!!float!!} 9627 9628% #1 is the control sequence we are passed; we expand into a conditional 9629% which is true if #1 represents a float ref. That is, the magic 9630% \currentsection value which we \setref above. 9631% 9632\def\iffloat#1{\expandafter\doiffloat#1==\finish} 9633% 9634% #1 is (maybe) the \floatmagic string. If so, #2 will be the 9635% (safe) float type for this float. We set \iffloattype to #2. 9636% 9637\def\doiffloat#1=#2=#3\finish{% 9638 \def\temp{#1}% 9639 \def\iffloattype{#2}% 9640 \ifx\temp\floatmagic 9641} 9642 9643% @listoffloats FLOATTYPE - print a list of floats like a table of contents. 9644% 9645\parseargdef\listoffloats{% 9646 \def\floattype{#1}% floattype 9647 {% 9648 % the floattype might have accents or other special characters, 9649 % but we need to use it in a control sequence name. 9650 \indexnofonts 9651 \turnoffactive 9652 \xdef\safefloattype{\floattype}% 9653 }% 9654 % 9655 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. 9656 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax 9657 \ifhavexrefs 9658 % if the user said @listoffloats foo but never @float foo. 9659 \message{\linenumber No `\safefloattype' floats to list.}% 9660 \fi 9661 \else 9662 \begingroup 9663 \leftskip=\tocindent % indent these entries like a toc 9664 \let\do=\listoffloatsdo 9665 \csname floatlist\safefloattype\endcsname 9666 \endgroup 9667 \fi 9668} 9669 9670% This is called on each entry in a list of floats. We're passed the 9671% xref label, in the form LABEL-title, which is how we save it in the 9672% aux file. We strip off the -title and look up \XRLABEL-lof, which 9673% has the text we're supposed to typeset here. 9674% 9675% Figures without xref labels will not be included in the list (since 9676% they won't appear in the aux file). 9677% 9678\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} 9679\def\listoffloatsdoentry#1-title\finish{{% 9680 % Can't fully expand XR#1-lof because it can contain anything. Just 9681 % pass the control sequence. On the other hand, XR#1-pg is just the 9682 % page number, and we want to fully expand that so we can get a link 9683 % in pdf output. 9684 \toksA = \expandafter{\csname XR#1-lof\endcsname}% 9685 % 9686 % use the same \entry macro we use to generate the TOC and index. 9687 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% 9688 \writeentry 9689}} 9690 9691 9692\message{localization,} 9693 9694% For single-language documents, @documentlanguage is usually given very 9695% early, just after @documentencoding. Single argument is the language 9696% (de) or locale (de_DE) abbreviation. 9697% 9698{ 9699 \catcode`\_ = \active 9700 \globaldefs=1 9701\parseargdef\documentlanguage{% 9702 \tex % read txi-??.tex file in plain TeX. 9703 % Read the file by the name they passed if it exists. 9704 \let_ = \normalunderscore % normal _ character for filename test 9705 \openin 1 txi-#1.tex 9706 \ifeof 1 9707 \documentlanguagetrywithoutunderscore #1_\finish 9708 \else 9709 \globaldefs = 1 % everything in the txi-LL files needs to persist 9710 \input txi-#1.tex 9711 \fi 9712 \closein 1 9713 \endgroup % end raw TeX 9714} 9715% 9716% If they passed de_DE, and txi-de_DE.tex doesn't exist, 9717% try txi-de.tex. 9718% 9719\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% 9720 \openin 1 txi-#1.tex 9721 \ifeof 1 9722 \errhelp = \nolanghelp 9723 \errmessage{Cannot read language file txi-#1.tex}% 9724 \else 9725 \globaldefs = 1 % everything in the txi-LL files needs to persist 9726 \input txi-#1.tex 9727 \fi 9728 \closein 1 9729} 9730}% end of special _ catcode 9731% 9732\newhelp\nolanghelp{The given language definition file cannot be found or 9733is empty. Maybe you need to install it? Putting it in the current 9734directory should work if nowhere else does.} 9735 9736% This macro is called from txi-??.tex files; the first argument is the 9737% \language name to set (without the "\lang@" prefix), the second and 9738% third args are \{left,right}hyphenmin. 9739% 9740% The language names to pass are determined when the format is built. 9741% See the etex.log file created at that time, e.g., 9742% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. 9743% 9744% With TeX Live 2008, etex now includes hyphenation patterns for all 9745% available languages. This means we can support hyphenation in 9746% Texinfo, at least to some extent. (This still doesn't solve the 9747% accented characters problem.) 9748% 9749\catcode`@=11 9750\def\txisetlanguage#1#2#3{% 9751 % do not set the language if the name is undefined in the current TeX. 9752 \expandafter\ifx\csname lang@#1\endcsname \relax 9753 \message{no patterns for #1}% 9754 \else 9755 \global\language = \csname lang@#1\endcsname 9756 \fi 9757 % but there is no harm in adjusting the hyphenmin values regardless. 9758 \global\lefthyphenmin = #2\relax 9759 \global\righthyphenmin = #3\relax 9760} 9761 9762% XeTeX and LuaTeX can handle Unicode natively. 9763% Their default I/O uses UTF-8 sequences instead of a byte-wise operation. 9764% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise. 9765% 9766\newif\iftxinativeunicodecapable 9767\newif\iftxiusebytewiseio 9768 9769\ifx\XeTeXrevision\thisisundefined 9770 \ifx\luatexversion\thisisundefined 9771 \txinativeunicodecapablefalse 9772 \txiusebytewiseiotrue 9773 \else 9774 \txinativeunicodecapabletrue 9775 \txiusebytewiseiofalse 9776 \fi 9777\else 9778 \txinativeunicodecapabletrue 9779 \txiusebytewiseiofalse 9780\fi 9781 9782% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex 9783% for non-UTF-8 (byte-wise) encodings. 9784% 9785\def\setbytewiseio{% 9786 \ifx\XeTeXrevision\thisisundefined 9787 \else 9788 \XeTeXdefaultencoding "bytes" % For subsequent files to be read 9789 \XeTeXinputencoding "bytes" % For document root file 9790 % Unfortunately, there seems to be no corresponding XeTeX command for 9791 % output encoding. This is a problem for auxiliary index and TOC files. 9792 % The only solution would be perhaps to write out @U{...} sequences in 9793 % place of non-ASCII characters. 9794 \fi 9795 9796 \ifx\luatexversion\thisisundefined 9797 \else 9798 \directlua{ 9799 local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub 9800 local function convert_char (char) 9801 return utf8_char(byte(char)) 9802 end 9803 9804 local function convert_line (line) 9805 return gsub(line, ".", convert_char) 9806 end 9807 9808 callback.register("process_input_buffer", convert_line) 9809 9810 local function convert_line_out (line) 9811 local line_out = "" 9812 for c in string.utfvalues(line) do 9813 line_out = line_out .. string.char(c) 9814 end 9815 return line_out 9816 end 9817 9818 callback.register("process_output_buffer", convert_line_out) 9819 } 9820 \fi 9821 9822 \txiusebytewiseiotrue 9823} 9824 9825 9826% Helpers for encodings. 9827% Set the catcode of characters 128 through 255 to the specified number. 9828% 9829\def\setnonasciicharscatcode#1{% 9830 \count255=128 9831 \loop\ifnum\count255<256 9832 \global\catcode\count255=#1\relax 9833 \advance\count255 by 1 9834 \repeat 9835} 9836 9837\def\setnonasciicharscatcodenonglobal#1{% 9838 \count255=128 9839 \loop\ifnum\count255<256 9840 \catcode\count255=#1\relax 9841 \advance\count255 by 1 9842 \repeat 9843} 9844 9845% @documentencoding sets the definition of non-ASCII characters 9846% according to the specified encoding. 9847% 9848\def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz} 9849\def\documentencodingzzz#1{% 9850 % 9851 % Encoding being declared for the document. 9852 \def\declaredencoding{\csname #1.enc\endcsname}% 9853 % 9854 % Supported encodings: names converted to tokens in order to be able 9855 % to compare them with \ifx. 9856 \def\ascii{\csname US-ASCII.enc\endcsname}% 9857 \def\latnine{\csname ISO-8859-15.enc\endcsname}% 9858 \def\latone{\csname ISO-8859-1.enc\endcsname}% 9859 \def\lattwo{\csname ISO-8859-2.enc\endcsname}% 9860 \def\utfeight{\csname UTF-8.enc\endcsname}% 9861 % 9862 \ifx \declaredencoding \ascii 9863 \asciichardefs 9864 % 9865 \else \ifx \declaredencoding \lattwo 9866 \iftxinativeunicodecapable 9867 \setbytewiseio 9868 \fi 9869 \setnonasciicharscatcode\active 9870 \lattwochardefs 9871 % 9872 \else \ifx \declaredencoding \latone 9873 \iftxinativeunicodecapable 9874 \setbytewiseio 9875 \fi 9876 \setnonasciicharscatcode\active 9877 \latonechardefs 9878 % 9879 \else \ifx \declaredencoding \latnine 9880 \iftxinativeunicodecapable 9881 \setbytewiseio 9882 \fi 9883 \setnonasciicharscatcode\active 9884 \latninechardefs 9885 % 9886 \else \ifx \declaredencoding \utfeight 9887 \iftxinativeunicodecapable 9888 % For native Unicode handling (XeTeX and LuaTeX) 9889 \nativeunicodechardefs 9890 \else 9891 % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX) 9892 \setnonasciicharscatcode\active 9893 % since we already invoked \utfeightchardefs at the top level 9894 % (below), do not re-invoke it, otherwise our check for duplicated 9895 % definitions gets triggered. Making non-ascii chars active is 9896 % sufficient. 9897 \fi 9898 % 9899 \else 9900 \message{Ignoring unknown document encoding: #1.}% 9901 % 9902 \fi % utfeight 9903 \fi % latnine 9904 \fi % latone 9905 \fi % lattwo 9906 \fi % ascii 9907 % 9908 \ifx\XeTeXrevision\thisisundefined 9909 \else 9910 \ifx \declaredencoding \utfeight 9911 \else 9912 \ifx \declaredencoding \ascii 9913 \else 9914 \message{Warning: XeTeX with non-UTF-8 encodings cannot handle % 9915 non-ASCII characters in auxiliary files.}% 9916 \fi 9917 \fi 9918 \fi 9919} 9920 9921% emacs-page 9922% A message to be logged when using a character that isn't available 9923% the default font encoding (OT1). 9924% 9925\def\missingcharmsg#1{\message{Character missing, sorry: #1.}} 9926 9927% Take account of \c (plain) vs. \, (Texinfo) difference. 9928\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} 9929 9930% First, make active non-ASCII characters in order for them to be 9931% correctly categorized when TeX reads the replacement text of 9932% macros containing the character definitions. 9933\setnonasciicharscatcode\active 9934% 9935 9936\def\gdefchar#1#2{% 9937\gdef#1{% 9938 \ifpassthroughchars 9939 \string#1% 9940 \else 9941 #2% 9942 \fi 9943}} 9944 9945% Latin1 (ISO-8859-1) character definitions. 9946\def\latonechardefs{% 9947 \gdefchar^^a0{\tie} 9948 \gdefchar^^a1{\exclamdown} 9949 \gdefchar^^a2{{\tcfont \char162}} % cent 9950 \gdefchar^^a3{\pounds{}} 9951 \gdefchar^^a4{{\tcfont \char164}} % currency 9952 \gdefchar^^a5{{\tcfont \char165}} % yen 9953 \gdefchar^^a6{{\tcfont \char166}} % broken bar 9954 \gdefchar^^a7{\S} 9955 \gdefchar^^a8{\"{}} 9956 \gdefchar^^a9{\copyright{}} 9957 \gdefchar^^aa{\ordf} 9958 \gdefchar^^ab{\guillemetleft{}} 9959 \gdefchar^^ac{\ensuremath\lnot} 9960 \gdefchar^^ad{\-} 9961 \gdefchar^^ae{\registeredsymbol{}} 9962 \gdefchar^^af{\={}} 9963 % 9964 \gdefchar^^b0{\textdegree} 9965 \gdefchar^^b1{$\pm$} 9966 \gdefchar^^b2{$^2$} 9967 \gdefchar^^b3{$^3$} 9968 \gdefchar^^b4{\'{}} 9969 \gdefchar^^b5{$\mu$} 9970 \gdefchar^^b6{\P} 9971 \gdefchar^^b7{\ensuremath\cdot} 9972 \gdefchar^^b8{\cedilla\ } 9973 \gdefchar^^b9{$^1$} 9974 \gdefchar^^ba{\ordm} 9975 \gdefchar^^bb{\guillemetright{}} 9976 \gdefchar^^bc{$1\over4$} 9977 \gdefchar^^bd{$1\over2$} 9978 \gdefchar^^be{$3\over4$} 9979 \gdefchar^^bf{\questiondown} 9980 % 9981 \gdefchar^^c0{\`A} 9982 \gdefchar^^c1{\'A} 9983 \gdefchar^^c2{\^A} 9984 \gdefchar^^c3{\~A} 9985 \gdefchar^^c4{\"A} 9986 \gdefchar^^c5{\ringaccent A} 9987 \gdefchar^^c6{\AE} 9988 \gdefchar^^c7{\cedilla C} 9989 \gdefchar^^c8{\`E} 9990 \gdefchar^^c9{\'E} 9991 \gdefchar^^ca{\^E} 9992 \gdefchar^^cb{\"E} 9993 \gdefchar^^cc{\`I} 9994 \gdefchar^^cd{\'I} 9995 \gdefchar^^ce{\^I} 9996 \gdefchar^^cf{\"I} 9997 % 9998 \gdefchar^^d0{\DH} 9999 \gdefchar^^d1{\~N} 10000 \gdefchar^^d2{\`O} 10001 \gdefchar^^d3{\'O} 10002 \gdefchar^^d4{\^O} 10003 \gdefchar^^d5{\~O} 10004 \gdefchar^^d6{\"O} 10005 \gdefchar^^d7{$\times$} 10006 \gdefchar^^d8{\O} 10007 \gdefchar^^d9{\`U} 10008 \gdefchar^^da{\'U} 10009 \gdefchar^^db{\^U} 10010 \gdefchar^^dc{\"U} 10011 \gdefchar^^dd{\'Y} 10012 \gdefchar^^de{\TH} 10013 \gdefchar^^df{\ss} 10014 % 10015 \gdefchar^^e0{\`a} 10016 \gdefchar^^e1{\'a} 10017 \gdefchar^^e2{\^a} 10018 \gdefchar^^e3{\~a} 10019 \gdefchar^^e4{\"a} 10020 \gdefchar^^e5{\ringaccent a} 10021 \gdefchar^^e6{\ae} 10022 \gdefchar^^e7{\cedilla c} 10023 \gdefchar^^e8{\`e} 10024 \gdefchar^^e9{\'e} 10025 \gdefchar^^ea{\^e} 10026 \gdefchar^^eb{\"e} 10027 \gdefchar^^ec{\`{\dotless i}} 10028 \gdefchar^^ed{\'{\dotless i}} 10029 \gdefchar^^ee{\^{\dotless i}} 10030 \gdefchar^^ef{\"{\dotless i}} 10031 % 10032 \gdefchar^^f0{\dh} 10033 \gdefchar^^f1{\~n} 10034 \gdefchar^^f2{\`o} 10035 \gdefchar^^f3{\'o} 10036 \gdefchar^^f4{\^o} 10037 \gdefchar^^f5{\~o} 10038 \gdefchar^^f6{\"o} 10039 \gdefchar^^f7{$\div$} 10040 \gdefchar^^f8{\o} 10041 \gdefchar^^f9{\`u} 10042 \gdefchar^^fa{\'u} 10043 \gdefchar^^fb{\^u} 10044 \gdefchar^^fc{\"u} 10045 \gdefchar^^fd{\'y} 10046 \gdefchar^^fe{\th} 10047 \gdefchar^^ff{\"y} 10048} 10049 10050% Latin9 (ISO-8859-15) encoding character definitions. 10051\def\latninechardefs{% 10052 % Encoding is almost identical to Latin1. 10053 \latonechardefs 10054 % 10055 \gdefchar^^a4{\euro{}} 10056 \gdefchar^^a6{\v S} 10057 \gdefchar^^a8{\v s} 10058 \gdefchar^^b4{\v Z} 10059 \gdefchar^^b8{\v z} 10060 \gdefchar^^bc{\OE} 10061 \gdefchar^^bd{\oe} 10062 \gdefchar^^be{\"Y} 10063} 10064 10065% Latin2 (ISO-8859-2) character definitions. 10066\def\lattwochardefs{% 10067 \gdefchar^^a0{\tie} 10068 \gdefchar^^a1{\ogonek{A}} 10069 \gdefchar^^a2{\u{}} 10070 \gdefchar^^a3{\L} 10071 \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}} 10072 \gdefchar^^a5{\v L} 10073 \gdefchar^^a6{\'S} 10074 \gdefchar^^a7{\S} 10075 \gdefchar^^a8{\"{}} 10076 \gdefchar^^a9{\v S} 10077 \gdefchar^^aa{\cedilla S} 10078 \gdefchar^^ab{\v T} 10079 \gdefchar^^ac{\'Z} 10080 \gdefchar^^ad{\-} 10081 \gdefchar^^ae{\v Z} 10082 \gdefchar^^af{\dotaccent Z} 10083 % 10084 \gdefchar^^b0{\textdegree} 10085 \gdefchar^^b1{\ogonek{a}} 10086 \gdefchar^^b2{\ogonek{ }} 10087 \gdefchar^^b3{\l} 10088 \gdefchar^^b4{\'{}} 10089 \gdefchar^^b5{\v l} 10090 \gdefchar^^b6{\'s} 10091 \gdefchar^^b7{\v{}} 10092 \gdefchar^^b8{\cedilla\ } 10093 \gdefchar^^b9{\v s} 10094 \gdefchar^^ba{\cedilla s} 10095 \gdefchar^^bb{\v t} 10096 \gdefchar^^bc{\'z} 10097 \gdefchar^^bd{\H{}} 10098 \gdefchar^^be{\v z} 10099 \gdefchar^^bf{\dotaccent z} 10100 % 10101 \gdefchar^^c0{\'R} 10102 \gdefchar^^c1{\'A} 10103 \gdefchar^^c2{\^A} 10104 \gdefchar^^c3{\u A} 10105 \gdefchar^^c4{\"A} 10106 \gdefchar^^c5{\'L} 10107 \gdefchar^^c6{\'C} 10108 \gdefchar^^c7{\cedilla C} 10109 \gdefchar^^c8{\v C} 10110 \gdefchar^^c9{\'E} 10111 \gdefchar^^ca{\ogonek{E}} 10112 \gdefchar^^cb{\"E} 10113 \gdefchar^^cc{\v E} 10114 \gdefchar^^cd{\'I} 10115 \gdefchar^^ce{\^I} 10116 \gdefchar^^cf{\v D} 10117 % 10118 \gdefchar^^d0{\DH} 10119 \gdefchar^^d1{\'N} 10120 \gdefchar^^d2{\v N} 10121 \gdefchar^^d3{\'O} 10122 \gdefchar^^d4{\^O} 10123 \gdefchar^^d5{\H O} 10124 \gdefchar^^d6{\"O} 10125 \gdefchar^^d7{$\times$} 10126 \gdefchar^^d8{\v R} 10127 \gdefchar^^d9{\ringaccent U} 10128 \gdefchar^^da{\'U} 10129 \gdefchar^^db{\H U} 10130 \gdefchar^^dc{\"U} 10131 \gdefchar^^dd{\'Y} 10132 \gdefchar^^de{\cedilla T} 10133 \gdefchar^^df{\ss} 10134 % 10135 \gdefchar^^e0{\'r} 10136 \gdefchar^^e1{\'a} 10137 \gdefchar^^e2{\^a} 10138 \gdefchar^^e3{\u a} 10139 \gdefchar^^e4{\"a} 10140 \gdefchar^^e5{\'l} 10141 \gdefchar^^e6{\'c} 10142 \gdefchar^^e7{\cedilla c} 10143 \gdefchar^^e8{\v c} 10144 \gdefchar^^e9{\'e} 10145 \gdefchar^^ea{\ogonek{e}} 10146 \gdefchar^^eb{\"e} 10147 \gdefchar^^ec{\v e} 10148 \gdefchar^^ed{\'{\dotless{i}}} 10149 \gdefchar^^ee{\^{\dotless{i}}} 10150 \gdefchar^^ef{\v d} 10151 % 10152 \gdefchar^^f0{\dh} 10153 \gdefchar^^f1{\'n} 10154 \gdefchar^^f2{\v n} 10155 \gdefchar^^f3{\'o} 10156 \gdefchar^^f4{\^o} 10157 \gdefchar^^f5{\H o} 10158 \gdefchar^^f6{\"o} 10159 \gdefchar^^f7{$\div$} 10160 \gdefchar^^f8{\v r} 10161 \gdefchar^^f9{\ringaccent u} 10162 \gdefchar^^fa{\'u} 10163 \gdefchar^^fb{\H u} 10164 \gdefchar^^fc{\"u} 10165 \gdefchar^^fd{\'y} 10166 \gdefchar^^fe{\cedilla t} 10167 \gdefchar^^ff{\dotaccent{}} 10168} 10169 10170% UTF-8 character definitions. 10171% 10172% This code to support UTF-8 is based on LaTeX's utf8.def, with some 10173% changes for Texinfo conventions. It is included here under the GPL by 10174% permission from Frank Mittelbach and the LaTeX team. 10175% 10176\newcount\countUTFx 10177\newcount\countUTFy 10178\newcount\countUTFz 10179 10180\gdef\UTFviiiTwoOctets#1#2{\expandafter 10181 \UTFviiiDefined\csname u8:#1\string #2\endcsname} 10182% 10183\gdef\UTFviiiThreeOctets#1#2#3{\expandafter 10184 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} 10185% 10186\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter 10187 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} 10188 10189\gdef\UTFviiiDefined#1{% 10190 \ifx #1\relax 10191 \message{\linenumber Unicode char \string #1 not defined for Texinfo}% 10192 \else 10193 \expandafter #1% 10194 \fi 10195} 10196 10197% Give non-ASCII bytes the active definitions for processing UTF-8 sequences 10198\begingroup 10199 \catcode`\~13 10200 \catcode`\$12 10201 \catcode`\"12 10202 10203 % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp 10204 % substituting ~ and $ with a character token of that value. 10205 \def\UTFviiiLoop{% 10206 \global\catcode\countUTFx\active 10207 \uccode`\~\countUTFx 10208 \uccode`\$\countUTFx 10209 \uppercase\expandafter{\UTFviiiTmp}% 10210 \advance\countUTFx by 1 10211 \ifnum\countUTFx < \countUTFy 10212 \expandafter\UTFviiiLoop 10213 \fi} 10214 10215 % For bytes other than the first in a UTF-8 sequence. Not expected to 10216 % be expanded except when writing to auxiliary files. 10217 \countUTFx = "80 10218 \countUTFy = "C2 10219 \def\UTFviiiTmp{% 10220 \gdef~{% 10221 \ifpassthroughchars $\fi}}% 10222 \UTFviiiLoop 10223 10224 \countUTFx = "C2 10225 \countUTFy = "E0 10226 \def\UTFviiiTmp{% 10227 \gdef~{% 10228 \ifpassthroughchars $% 10229 \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}% 10230 \UTFviiiLoop 10231 10232 \countUTFx = "E0 10233 \countUTFy = "F0 10234 \def\UTFviiiTmp{% 10235 \gdef~{% 10236 \ifpassthroughchars $% 10237 \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}% 10238 \UTFviiiLoop 10239 10240 \countUTFx = "F0 10241 \countUTFy = "F4 10242 \def\UTFviiiTmp{% 10243 \gdef~{% 10244 \ifpassthroughchars $% 10245 \else\expandafter\UTFviiiFourOctets\expandafter$\fi 10246 }}% 10247 \UTFviiiLoop 10248\endgroup 10249 10250\def\globallet{\global\let} % save some \expandafter's below 10251 10252% @U{xxxx} to produce U+xxxx, if we support it. 10253\def\U#1{% 10254 \expandafter\ifx\csname uni:#1\endcsname \relax 10255 \iftxinativeunicodecapable 10256 % All Unicode characters can be used if native Unicode handling is 10257 % active. However, if the font does not have the glyph, 10258 % letters are missing. 10259 \begingroup 10260 \uccode`\.="#1\relax 10261 \uppercase{.} 10262 \endgroup 10263 \else 10264 \errhelp = \EMsimple 10265 \errmessage{Unicode character U+#1 not supported, sorry}% 10266 \fi 10267 \else 10268 \csname uni:#1\endcsname 10269 \fi 10270} 10271 10272% These macros are used here to construct the name of a control 10273% sequence to be defined. 10274\def\UTFviiiTwoOctetsName#1#2{% 10275 \csname u8:#1\string #2\endcsname}% 10276\def\UTFviiiThreeOctetsName#1#2#3{% 10277 \csname u8:#1\string #2\string #3\endcsname}% 10278\def\UTFviiiFourOctetsName#1#2#3#4{% 10279 \csname u8:#1\string #2\string #3\string #4\endcsname}% 10280 10281% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX), 10282% provide a definition macro to replace a Unicode character; 10283% this gets used by the @U command 10284% 10285\begingroup 10286 \catcode`\"=12 10287 \catcode`\<=12 10288 \catcode`\.=12 10289 \catcode`\,=12 10290 \catcode`\;=12 10291 \catcode`\!=12 10292 \catcode`\~=13 10293 \gdef\DeclareUnicodeCharacterUTFviii#1#2{% 10294 \countUTFz = "#1\relax 10295 \begingroup 10296 \parseXMLCharref 10297 10298 % Give \u8:... its definition. The sequence of seven \expandafter's 10299 % expands after the \gdef three times, e.g. 10300 % 10301 % 1. \UTFviiTwoOctetsName B1 B2 10302 % 2. \csname u8:B1 \string B2 \endcsname 10303 % 3. \u8: B1 B2 (a single control sequence token) 10304 % 10305 \expandafter\expandafter 10306 \expandafter\expandafter 10307 \expandafter\expandafter 10308 \expandafter\gdef \UTFviiiTmp{#2}% 10309 % 10310 \expandafter\ifx\csname uni:#1\endcsname \relax \else 10311 \message{Internal error, already defined: #1}% 10312 \fi 10313 % 10314 % define an additional control sequence for this code point. 10315 \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp 10316 \endgroup} 10317 % 10318 % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp 10319 % to the corresponding UTF-8 sequence. 10320 \gdef\parseXMLCharref{% 10321 \ifnum\countUTFz < "20\relax 10322 \errhelp = \EMsimple 10323 \errmessage{Cannot define Unicode char value < 0020}% 10324 \else\ifnum\countUTFz < "800\relax 10325 \parseUTFviiiA,% 10326 \parseUTFviiiB C\UTFviiiTwoOctetsName.,% 10327 \else\ifnum\countUTFz < "10000\relax 10328 \parseUTFviiiA;% 10329 \parseUTFviiiA,% 10330 \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}% 10331 \else 10332 \parseUTFviiiA;% 10333 \parseUTFviiiA,% 10334 \parseUTFviiiA!% 10335 \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}% 10336 \fi\fi\fi 10337 } 10338 10339 % Extract a byte from the end of the UTF-8 representation of \countUTFx. 10340 % It must be a non-initial byte in the sequence. 10341 % Change \uccode of #1 for it to be used in \parseUTFviiiB as one 10342 % of the bytes. 10343 \gdef\parseUTFviiiA#1{% 10344 \countUTFx = \countUTFz 10345 \divide\countUTFz by 64 10346 \countUTFy = \countUTFz % Save to be the future value of \countUTFz. 10347 \multiply\countUTFz by 64 10348 10349 % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract 10350 % in order to get the last five bits. 10351 \advance\countUTFx by -\countUTFz 10352 10353 % Convert this to the byte in the UTF-8 sequence. 10354 \advance\countUTFx by 128 10355 \uccode `#1\countUTFx 10356 \countUTFz = \countUTFy} 10357 10358 % Used to put a UTF-8 byte sequence into \UTFviiiTmp 10359 % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8 10360 % sequence. 10361 % #2 is one of the \UTFviii*OctetsName macros. 10362 % #3 is always a full stop (.) 10363 % #4 is a template for the other bytes in the sequence. The values for these 10364 % bytes is substituted in here with \uppercase using the \uccode's. 10365 \gdef\parseUTFviiiB#1#2#3#4{% 10366 \advance\countUTFz by "#10\relax 10367 \uccode `#3\countUTFz 10368 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} 10369\endgroup 10370 10371% For native Unicode handling (XeTeX and LuaTeX), 10372% provide a definition macro that sets a catcode to `other' non-globally 10373% 10374\def\DeclareUnicodeCharacterNativeOther#1#2{% 10375 \catcode"#1=\other 10376} 10377 10378% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M 10379% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block) 10380% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block) 10381% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A 10382% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B 10383% 10384% Many of our renditions are less than wonderful, and all the missing 10385% characters are available somewhere. Loading the necessary fonts 10386% awaits user request. We can't truly support Unicode without 10387% reimplementing everything that's been done in LaTeX for many years, 10388% plus probably using luatex or xetex, and who knows what else. 10389% We won't be doing that here in this simple file. But we can try to at 10390% least make most of the characters not bomb out. 10391% 10392\def\unicodechardefs{% 10393 \DeclareUnicodeCharacter{0020}{ } % space 10394 \DeclareUnicodeCharacter{0021}{\char"21 }% % space to terminate number 10395 \DeclareUnicodeCharacter{0022}{\char"22 }% 10396 \DeclareUnicodeCharacter{0023}{\char"23 }% 10397 \DeclareUnicodeCharacter{0024}{\char"24 }% 10398 \DeclareUnicodeCharacter{0025}{\char"25 }% 10399 \DeclareUnicodeCharacter{0026}{\char"26 }% 10400 \DeclareUnicodeCharacter{0027}{\char"27 }% 10401 \DeclareUnicodeCharacter{0028}{\char"28 }% 10402 \DeclareUnicodeCharacter{0029}{\char"29 }% 10403 \DeclareUnicodeCharacter{002A}{\char"2A }% 10404 \DeclareUnicodeCharacter{002B}{\char"2B }% 10405 \DeclareUnicodeCharacter{002C}{\char"2C }% 10406 \DeclareUnicodeCharacter{002D}{\char"2D }% 10407 \DeclareUnicodeCharacter{002E}{\char"2E }% 10408 \DeclareUnicodeCharacter{002F}{\char"2F }% 10409 \DeclareUnicodeCharacter{0030}{0}% 10410 \DeclareUnicodeCharacter{0031}{1}% 10411 \DeclareUnicodeCharacter{0032}{2}% 10412 \DeclareUnicodeCharacter{0033}{3}% 10413 \DeclareUnicodeCharacter{0034}{4}% 10414 \DeclareUnicodeCharacter{0035}{5}% 10415 \DeclareUnicodeCharacter{0036}{6}% 10416 \DeclareUnicodeCharacter{0037}{7}% 10417 \DeclareUnicodeCharacter{0038}{8}% 10418 \DeclareUnicodeCharacter{0039}{9}% 10419 \DeclareUnicodeCharacter{003A}{\char"3A }% 10420 \DeclareUnicodeCharacter{003B}{\char"3B }% 10421 \DeclareUnicodeCharacter{003C}{\char"3C }% 10422 \DeclareUnicodeCharacter{003D}{\char"3D }% 10423 \DeclareUnicodeCharacter{003E}{\char"3E }% 10424 \DeclareUnicodeCharacter{003F}{\char"3F }% 10425 \DeclareUnicodeCharacter{0040}{\char"40 }% 10426 \DeclareUnicodeCharacter{0041}{A}% 10427 \DeclareUnicodeCharacter{0042}{B}% 10428 \DeclareUnicodeCharacter{0043}{C}% 10429 \DeclareUnicodeCharacter{0044}{D}% 10430 \DeclareUnicodeCharacter{0045}{E}% 10431 \DeclareUnicodeCharacter{0046}{F}% 10432 \DeclareUnicodeCharacter{0047}{G}% 10433 \DeclareUnicodeCharacter{0048}{H}% 10434 \DeclareUnicodeCharacter{0049}{I}% 10435 \DeclareUnicodeCharacter{004A}{J}% 10436 \DeclareUnicodeCharacter{004B}{K}% 10437 \DeclareUnicodeCharacter{004C}{L}% 10438 \DeclareUnicodeCharacter{004D}{M}% 10439 \DeclareUnicodeCharacter{004E}{N}% 10440 \DeclareUnicodeCharacter{004F}{O}% 10441 \DeclareUnicodeCharacter{0050}{P}% 10442 \DeclareUnicodeCharacter{0051}{Q}% 10443 \DeclareUnicodeCharacter{0052}{R}% 10444 \DeclareUnicodeCharacter{0053}{S}% 10445 \DeclareUnicodeCharacter{0054}{T}% 10446 \DeclareUnicodeCharacter{0055}{U}% 10447 \DeclareUnicodeCharacter{0056}{V}% 10448 \DeclareUnicodeCharacter{0057}{W}% 10449 \DeclareUnicodeCharacter{0058}{X}% 10450 \DeclareUnicodeCharacter{0059}{Y}% 10451 \DeclareUnicodeCharacter{005A}{Z}% 10452 \DeclareUnicodeCharacter{005B}{\char"5B }% 10453 \DeclareUnicodeCharacter{005C}{\char"5C }% 10454 \DeclareUnicodeCharacter{005D}{\char"5D }% 10455 \DeclareUnicodeCharacter{005E}{\char"5E }% 10456 \DeclareUnicodeCharacter{005F}{\char"5F }% 10457 \DeclareUnicodeCharacter{0060}{\char"60 }% 10458 \DeclareUnicodeCharacter{0061}{a}% 10459 \DeclareUnicodeCharacter{0062}{b}% 10460 \DeclareUnicodeCharacter{0063}{c}% 10461 \DeclareUnicodeCharacter{0064}{d}% 10462 \DeclareUnicodeCharacter{0065}{e}% 10463 \DeclareUnicodeCharacter{0066}{f}% 10464 \DeclareUnicodeCharacter{0067}{g}% 10465 \DeclareUnicodeCharacter{0068}{h}% 10466 \DeclareUnicodeCharacter{0069}{i}% 10467 \DeclareUnicodeCharacter{006A}{j}% 10468 \DeclareUnicodeCharacter{006B}{k}% 10469 \DeclareUnicodeCharacter{006C}{l}% 10470 \DeclareUnicodeCharacter{006D}{m}% 10471 \DeclareUnicodeCharacter{006E}{n}% 10472 \DeclareUnicodeCharacter{006F}{o}% 10473 \DeclareUnicodeCharacter{0070}{p}% 10474 \DeclareUnicodeCharacter{0071}{q}% 10475 \DeclareUnicodeCharacter{0072}{r}% 10476 \DeclareUnicodeCharacter{0073}{s}% 10477 \DeclareUnicodeCharacter{0074}{t}% 10478 \DeclareUnicodeCharacter{0075}{u}% 10479 \DeclareUnicodeCharacter{0076}{v}% 10480 \DeclareUnicodeCharacter{0077}{w}% 10481 \DeclareUnicodeCharacter{0078}{x}% 10482 \DeclareUnicodeCharacter{0079}{y}% 10483 \DeclareUnicodeCharacter{007A}{z}% 10484 \DeclareUnicodeCharacter{007B}{\char"7B }% 10485 \DeclareUnicodeCharacter{007C}{\char"7C }% 10486 \DeclareUnicodeCharacter{007D}{\char"7D }% 10487 \DeclareUnicodeCharacter{007E}{\char"7E }% 10488 % \DeclareUnicodeCharacter{007F}{} % DEL 10489 % 10490 \DeclareUnicodeCharacter{00A0}{\tie}% 10491 \DeclareUnicodeCharacter{00A1}{\exclamdown}% 10492 \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent 10493 \DeclareUnicodeCharacter{00A3}{\pounds{}}% 10494 \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency 10495 \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen 10496 \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar 10497 \DeclareUnicodeCharacter{00A7}{\S}% 10498 \DeclareUnicodeCharacter{00A8}{\"{ }}% 10499 \DeclareUnicodeCharacter{00A9}{\copyright{}}% 10500 \DeclareUnicodeCharacter{00AA}{\ordf}% 10501 \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}% 10502 \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}% 10503 \DeclareUnicodeCharacter{00AD}{\-}% 10504 \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}% 10505 \DeclareUnicodeCharacter{00AF}{\={ }}% 10506 % 10507 \DeclareUnicodeCharacter{00B0}{\textdegree}% 10508 \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}% 10509 \DeclareUnicodeCharacter{00B2}{$^2$}% 10510 \DeclareUnicodeCharacter{00B3}{$^3$}% 10511 \DeclareUnicodeCharacter{00B4}{\'{ }}% 10512 \DeclareUnicodeCharacter{00B5}{$\mu$}% 10513 \DeclareUnicodeCharacter{00B6}{\P}% 10514 \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}% 10515 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}% 10516 \DeclareUnicodeCharacter{00B9}{$^1$}% 10517 \DeclareUnicodeCharacter{00BA}{\ordm}% 10518 \DeclareUnicodeCharacter{00BB}{\guillemetright{}}% 10519 \DeclareUnicodeCharacter{00BC}{$1\over4$}% 10520 \DeclareUnicodeCharacter{00BD}{$1\over2$}% 10521 \DeclareUnicodeCharacter{00BE}{$3\over4$}% 10522 \DeclareUnicodeCharacter{00BF}{\questiondown}% 10523 % 10524 \DeclareUnicodeCharacter{00C0}{\`A}% 10525 \DeclareUnicodeCharacter{00C1}{\'A}% 10526 \DeclareUnicodeCharacter{00C2}{\^A}% 10527 \DeclareUnicodeCharacter{00C3}{\~A}% 10528 \DeclareUnicodeCharacter{00C4}{\"A}% 10529 \DeclareUnicodeCharacter{00C5}{\AA}% 10530 \DeclareUnicodeCharacter{00C6}{\AE}% 10531 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}% 10532 \DeclareUnicodeCharacter{00C8}{\`E}% 10533 \DeclareUnicodeCharacter{00C9}{\'E}% 10534 \DeclareUnicodeCharacter{00CA}{\^E}% 10535 \DeclareUnicodeCharacter{00CB}{\"E}% 10536 \DeclareUnicodeCharacter{00CC}{\`I}% 10537 \DeclareUnicodeCharacter{00CD}{\'I}% 10538 \DeclareUnicodeCharacter{00CE}{\^I}% 10539 \DeclareUnicodeCharacter{00CF}{\"I}% 10540 % 10541 \DeclareUnicodeCharacter{00D0}{\DH}% 10542 \DeclareUnicodeCharacter{00D1}{\~N}% 10543 \DeclareUnicodeCharacter{00D2}{\`O}% 10544 \DeclareUnicodeCharacter{00D3}{\'O}% 10545 \DeclareUnicodeCharacter{00D4}{\^O}% 10546 \DeclareUnicodeCharacter{00D5}{\~O}% 10547 \DeclareUnicodeCharacter{00D6}{\"O}% 10548 \DeclareUnicodeCharacter{00D7}{\ensuremath\times}% 10549 \DeclareUnicodeCharacter{00D8}{\O}% 10550 \DeclareUnicodeCharacter{00D9}{\`U}% 10551 \DeclareUnicodeCharacter{00DA}{\'U}% 10552 \DeclareUnicodeCharacter{00DB}{\^U}% 10553 \DeclareUnicodeCharacter{00DC}{\"U}% 10554 \DeclareUnicodeCharacter{00DD}{\'Y}% 10555 \DeclareUnicodeCharacter{00DE}{\TH}% 10556 \DeclareUnicodeCharacter{00DF}{\ss}% 10557 % 10558 \DeclareUnicodeCharacter{00E0}{\`a}% 10559 \DeclareUnicodeCharacter{00E1}{\'a}% 10560 \DeclareUnicodeCharacter{00E2}{\^a}% 10561 \DeclareUnicodeCharacter{00E3}{\~a}% 10562 \DeclareUnicodeCharacter{00E4}{\"a}% 10563 \DeclareUnicodeCharacter{00E5}{\aa}% 10564 \DeclareUnicodeCharacter{00E6}{\ae}% 10565 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}% 10566 \DeclareUnicodeCharacter{00E8}{\`e}% 10567 \DeclareUnicodeCharacter{00E9}{\'e}% 10568 \DeclareUnicodeCharacter{00EA}{\^e}% 10569 \DeclareUnicodeCharacter{00EB}{\"e}% 10570 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}% 10571 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}% 10572 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}% 10573 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}% 10574 % 10575 \DeclareUnicodeCharacter{00F0}{\dh}% 10576 \DeclareUnicodeCharacter{00F1}{\~n}% 10577 \DeclareUnicodeCharacter{00F2}{\`o}% 10578 \DeclareUnicodeCharacter{00F3}{\'o}% 10579 \DeclareUnicodeCharacter{00F4}{\^o}% 10580 \DeclareUnicodeCharacter{00F5}{\~o}% 10581 \DeclareUnicodeCharacter{00F6}{\"o}% 10582 \DeclareUnicodeCharacter{00F7}{\ensuremath\div}% 10583 \DeclareUnicodeCharacter{00F8}{\o}% 10584 \DeclareUnicodeCharacter{00F9}{\`u}% 10585 \DeclareUnicodeCharacter{00FA}{\'u}% 10586 \DeclareUnicodeCharacter{00FB}{\^u}% 10587 \DeclareUnicodeCharacter{00FC}{\"u}% 10588 \DeclareUnicodeCharacter{00FD}{\'y}% 10589 \DeclareUnicodeCharacter{00FE}{\th}% 10590 \DeclareUnicodeCharacter{00FF}{\"y}% 10591 % 10592 \DeclareUnicodeCharacter{0100}{\=A}% 10593 \DeclareUnicodeCharacter{0101}{\=a}% 10594 \DeclareUnicodeCharacter{0102}{\u{A}}% 10595 \DeclareUnicodeCharacter{0103}{\u{a}}% 10596 \DeclareUnicodeCharacter{0104}{\ogonek{A}}% 10597 \DeclareUnicodeCharacter{0105}{\ogonek{a}}% 10598 \DeclareUnicodeCharacter{0106}{\'C}% 10599 \DeclareUnicodeCharacter{0107}{\'c}% 10600 \DeclareUnicodeCharacter{0108}{\^C}% 10601 \DeclareUnicodeCharacter{0109}{\^c}% 10602 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}% 10603 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}% 10604 \DeclareUnicodeCharacter{010C}{\v{C}}% 10605 \DeclareUnicodeCharacter{010D}{\v{c}}% 10606 \DeclareUnicodeCharacter{010E}{\v{D}}% 10607 \DeclareUnicodeCharacter{010F}{d'}% 10608 % 10609 \DeclareUnicodeCharacter{0110}{\DH}% 10610 \DeclareUnicodeCharacter{0111}{\dh}% 10611 \DeclareUnicodeCharacter{0112}{\=E}% 10612 \DeclareUnicodeCharacter{0113}{\=e}% 10613 \DeclareUnicodeCharacter{0114}{\u{E}}% 10614 \DeclareUnicodeCharacter{0115}{\u{e}}% 10615 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}% 10616 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}% 10617 \DeclareUnicodeCharacter{0118}{\ogonek{E}}% 10618 \DeclareUnicodeCharacter{0119}{\ogonek{e}}% 10619 \DeclareUnicodeCharacter{011A}{\v{E}}% 10620 \DeclareUnicodeCharacter{011B}{\v{e}}% 10621 \DeclareUnicodeCharacter{011C}{\^G}% 10622 \DeclareUnicodeCharacter{011D}{\^g}% 10623 \DeclareUnicodeCharacter{011E}{\u{G}}% 10624 \DeclareUnicodeCharacter{011F}{\u{g}}% 10625 % 10626 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}% 10627 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}% 10628 \DeclareUnicodeCharacter{0122}{\cedilla{G}}% 10629 \DeclareUnicodeCharacter{0123}{\cedilla{g}}% 10630 \DeclareUnicodeCharacter{0124}{\^H}% 10631 \DeclareUnicodeCharacter{0125}{\^h}% 10632 \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}% 10633 \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}% 10634 \DeclareUnicodeCharacter{0128}{\~I}% 10635 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}% 10636 \DeclareUnicodeCharacter{012A}{\=I}% 10637 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}% 10638 \DeclareUnicodeCharacter{012C}{\u{I}}% 10639 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}% 10640 \DeclareUnicodeCharacter{012E}{\ogonek{I}}% 10641 \DeclareUnicodeCharacter{012F}{\ogonek{i}}% 10642 % 10643 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}% 10644 \DeclareUnicodeCharacter{0131}{\dotless{i}}% 10645 \DeclareUnicodeCharacter{0132}{IJ}% 10646 \DeclareUnicodeCharacter{0133}{ij}% 10647 \DeclareUnicodeCharacter{0134}{\^J}% 10648 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}% 10649 \DeclareUnicodeCharacter{0136}{\cedilla{K}}% 10650 \DeclareUnicodeCharacter{0137}{\cedilla{k}}% 10651 \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}% 10652 \DeclareUnicodeCharacter{0139}{\'L}% 10653 \DeclareUnicodeCharacter{013A}{\'l}% 10654 \DeclareUnicodeCharacter{013B}{\cedilla{L}}% 10655 \DeclareUnicodeCharacter{013C}{\cedilla{l}}% 10656 \DeclareUnicodeCharacter{013D}{L'}% should kern 10657 \DeclareUnicodeCharacter{013E}{l'}% should kern 10658 \DeclareUnicodeCharacter{013F}{L\U{00B7}}% 10659 % 10660 \DeclareUnicodeCharacter{0140}{l\U{00B7}}% 10661 \DeclareUnicodeCharacter{0141}{\L}% 10662 \DeclareUnicodeCharacter{0142}{\l}% 10663 \DeclareUnicodeCharacter{0143}{\'N}% 10664 \DeclareUnicodeCharacter{0144}{\'n}% 10665 \DeclareUnicodeCharacter{0145}{\cedilla{N}}% 10666 \DeclareUnicodeCharacter{0146}{\cedilla{n}}% 10667 \DeclareUnicodeCharacter{0147}{\v{N}}% 10668 \DeclareUnicodeCharacter{0148}{\v{n}}% 10669 \DeclareUnicodeCharacter{0149}{'n}% 10670 \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}% 10671 \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}% 10672 \DeclareUnicodeCharacter{014C}{\=O}% 10673 \DeclareUnicodeCharacter{014D}{\=o}% 10674 \DeclareUnicodeCharacter{014E}{\u{O}}% 10675 \DeclareUnicodeCharacter{014F}{\u{o}}% 10676 % 10677 \DeclareUnicodeCharacter{0150}{\H{O}}% 10678 \DeclareUnicodeCharacter{0151}{\H{o}}% 10679 \DeclareUnicodeCharacter{0152}{\OE}% 10680 \DeclareUnicodeCharacter{0153}{\oe}% 10681 \DeclareUnicodeCharacter{0154}{\'R}% 10682 \DeclareUnicodeCharacter{0155}{\'r}% 10683 \DeclareUnicodeCharacter{0156}{\cedilla{R}}% 10684 \DeclareUnicodeCharacter{0157}{\cedilla{r}}% 10685 \DeclareUnicodeCharacter{0158}{\v{R}}% 10686 \DeclareUnicodeCharacter{0159}{\v{r}}% 10687 \DeclareUnicodeCharacter{015A}{\'S}% 10688 \DeclareUnicodeCharacter{015B}{\'s}% 10689 \DeclareUnicodeCharacter{015C}{\^S}% 10690 \DeclareUnicodeCharacter{015D}{\^s}% 10691 \DeclareUnicodeCharacter{015E}{\cedilla{S}}% 10692 \DeclareUnicodeCharacter{015F}{\cedilla{s}}% 10693 % 10694 \DeclareUnicodeCharacter{0160}{\v{S}}% 10695 \DeclareUnicodeCharacter{0161}{\v{s}}% 10696 \DeclareUnicodeCharacter{0162}{\cedilla{T}}% 10697 \DeclareUnicodeCharacter{0163}{\cedilla{t}}% 10698 \DeclareUnicodeCharacter{0164}{\v{T}}% 10699 \DeclareUnicodeCharacter{0165}{\v{t}}% 10700 \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}% 10701 \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}% 10702 \DeclareUnicodeCharacter{0168}{\~U}% 10703 \DeclareUnicodeCharacter{0169}{\~u}% 10704 \DeclareUnicodeCharacter{016A}{\=U}% 10705 \DeclareUnicodeCharacter{016B}{\=u}% 10706 \DeclareUnicodeCharacter{016C}{\u{U}}% 10707 \DeclareUnicodeCharacter{016D}{\u{u}}% 10708 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}% 10709 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}% 10710 % 10711 \DeclareUnicodeCharacter{0170}{\H{U}}% 10712 \DeclareUnicodeCharacter{0171}{\H{u}}% 10713 \DeclareUnicodeCharacter{0172}{\ogonek{U}}% 10714 \DeclareUnicodeCharacter{0173}{\ogonek{u}}% 10715 \DeclareUnicodeCharacter{0174}{\^W}% 10716 \DeclareUnicodeCharacter{0175}{\^w}% 10717 \DeclareUnicodeCharacter{0176}{\^Y}% 10718 \DeclareUnicodeCharacter{0177}{\^y}% 10719 \DeclareUnicodeCharacter{0178}{\"Y}% 10720 \DeclareUnicodeCharacter{0179}{\'Z}% 10721 \DeclareUnicodeCharacter{017A}{\'z}% 10722 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}% 10723 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}% 10724 \DeclareUnicodeCharacter{017D}{\v{Z}}% 10725 \DeclareUnicodeCharacter{017E}{\v{z}}% 10726 \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}% 10727 % 10728 \DeclareUnicodeCharacter{01C4}{D\v{Z}}% 10729 \DeclareUnicodeCharacter{01C5}{D\v{z}}% 10730 \DeclareUnicodeCharacter{01C6}{d\v{z}}% 10731 \DeclareUnicodeCharacter{01C7}{LJ}% 10732 \DeclareUnicodeCharacter{01C8}{Lj}% 10733 \DeclareUnicodeCharacter{01C9}{lj}% 10734 \DeclareUnicodeCharacter{01CA}{NJ}% 10735 \DeclareUnicodeCharacter{01CB}{Nj}% 10736 \DeclareUnicodeCharacter{01CC}{nj}% 10737 \DeclareUnicodeCharacter{01CD}{\v{A}}% 10738 \DeclareUnicodeCharacter{01CE}{\v{a}}% 10739 \DeclareUnicodeCharacter{01CF}{\v{I}}% 10740 % 10741 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}% 10742 \DeclareUnicodeCharacter{01D1}{\v{O}}% 10743 \DeclareUnicodeCharacter{01D2}{\v{o}}% 10744 \DeclareUnicodeCharacter{01D3}{\v{U}}% 10745 \DeclareUnicodeCharacter{01D4}{\v{u}}% 10746 % 10747 \DeclareUnicodeCharacter{01E2}{\={\AE}}% 10748 \DeclareUnicodeCharacter{01E3}{\={\ae}}% 10749 \DeclareUnicodeCharacter{01E6}{\v{G}}% 10750 \DeclareUnicodeCharacter{01E7}{\v{g}}% 10751 \DeclareUnicodeCharacter{01E8}{\v{K}}% 10752 \DeclareUnicodeCharacter{01E9}{\v{k}}% 10753 % 10754 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}% 10755 \DeclareUnicodeCharacter{01F1}{DZ}% 10756 \DeclareUnicodeCharacter{01F2}{Dz}% 10757 \DeclareUnicodeCharacter{01F3}{dz}% 10758 \DeclareUnicodeCharacter{01F4}{\'G}% 10759 \DeclareUnicodeCharacter{01F5}{\'g}% 10760 \DeclareUnicodeCharacter{01F8}{\`N}% 10761 \DeclareUnicodeCharacter{01F9}{\`n}% 10762 \DeclareUnicodeCharacter{01FC}{\'{\AE}}% 10763 \DeclareUnicodeCharacter{01FD}{\'{\ae}}% 10764 \DeclareUnicodeCharacter{01FE}{\'{\O}}% 10765 \DeclareUnicodeCharacter{01FF}{\'{\o}}% 10766 % 10767 \DeclareUnicodeCharacter{021E}{\v{H}}% 10768 \DeclareUnicodeCharacter{021F}{\v{h}}% 10769 % 10770 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}% 10771 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}% 10772 \DeclareUnicodeCharacter{0228}{\cedilla{E}}% 10773 \DeclareUnicodeCharacter{0229}{\cedilla{e}}% 10774 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}% 10775 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}% 10776 % 10777 \DeclareUnicodeCharacter{0232}{\=Y}% 10778 \DeclareUnicodeCharacter{0233}{\=y}% 10779 \DeclareUnicodeCharacter{0237}{\dotless{j}}% 10780 % 10781 \DeclareUnicodeCharacter{02BC}{'}% 10782 % 10783 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}% 10784 % 10785 % Greek letters upper case 10786 \DeclareUnicodeCharacter{0391}{{\it A}}% 10787 \DeclareUnicodeCharacter{0392}{{\it B}}% 10788 \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}% 10789 \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}% 10790 \DeclareUnicodeCharacter{0395}{{\it E}}% 10791 \DeclareUnicodeCharacter{0396}{{\it Z}}% 10792 \DeclareUnicodeCharacter{0397}{{\it H}}% 10793 \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}% 10794 \DeclareUnicodeCharacter{0399}{{\it I}}% 10795 \DeclareUnicodeCharacter{039A}{{\it K}}% 10796 \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}% 10797 \DeclareUnicodeCharacter{039C}{{\it M}}% 10798 \DeclareUnicodeCharacter{039D}{{\it N}}% 10799 \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}% 10800 \DeclareUnicodeCharacter{039F}{{\it O}}% 10801 \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}% 10802 \DeclareUnicodeCharacter{03A1}{{\it P}}% 10803 %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma 10804 \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}% 10805 \DeclareUnicodeCharacter{03A4}{{\it T}}% 10806 \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}% 10807 \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}% 10808 \DeclareUnicodeCharacter{03A7}{{\it X}}% 10809 \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}% 10810 \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}% 10811 % 10812 % Vowels with accents 10813 \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}% 10814 \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}% 10815 \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}% 10816 \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}% 10817 \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}% 10818 \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}% 10819 % 10820 % Standalone accent 10821 \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}% 10822 % 10823 % Greek letters lower case 10824 \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}% 10825 \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}% 10826 \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}% 10827 \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}% 10828 \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}% 10829 \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}% 10830 \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}% 10831 \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}% 10832 \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}% 10833 \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}% 10834 \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}% 10835 \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}% 10836 \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}% 10837 \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}% 10838 \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron 10839 \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}% 10840 \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}% 10841 \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}% 10842 \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}% 10843 \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}% 10844 \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}% 10845 \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}% 10846 \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}% 10847 \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}% 10848 \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}% 10849 % 10850 % More Greek vowels with accents 10851 \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}% 10852 \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}% 10853 \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}% 10854 \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}% 10855 \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}% 10856 % 10857 % Variant Greek letters 10858 \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}% 10859 \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}% 10860 \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}% 10861 % 10862 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}% 10863 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}% 10864 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}% 10865 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}% 10866 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}% 10867 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}% 10868 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}% 10869 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}% 10870 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}% 10871 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}% 10872 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}% 10873 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}% 10874 % 10875 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}% 10876 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}% 10877 % 10878 \DeclareUnicodeCharacter{1E20}{\=G}% 10879 \DeclareUnicodeCharacter{1E21}{\=g}% 10880 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}% 10881 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}% 10882 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}% 10883 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}% 10884 \DeclareUnicodeCharacter{1E26}{\"H}% 10885 \DeclareUnicodeCharacter{1E27}{\"h}% 10886 % 10887 \DeclareUnicodeCharacter{1E30}{\'K}% 10888 \DeclareUnicodeCharacter{1E31}{\'k}% 10889 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}% 10890 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}% 10891 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}% 10892 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}% 10893 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}% 10894 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}% 10895 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}% 10896 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}% 10897 \DeclareUnicodeCharacter{1E3E}{\'M}% 10898 \DeclareUnicodeCharacter{1E3F}{\'m}% 10899 % 10900 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}% 10901 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}% 10902 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}% 10903 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}% 10904 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}% 10905 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}% 10906 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}% 10907 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}% 10908 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}% 10909 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}% 10910 % 10911 \DeclareUnicodeCharacter{1E54}{\'P}% 10912 \DeclareUnicodeCharacter{1E55}{\'p}% 10913 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}% 10914 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}% 10915 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}% 10916 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}% 10917 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}% 10918 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}% 10919 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}% 10920 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}% 10921 % 10922 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}% 10923 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}% 10924 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}% 10925 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}% 10926 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}% 10927 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}% 10928 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}% 10929 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}% 10930 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}% 10931 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}% 10932 % 10933 \DeclareUnicodeCharacter{1E7C}{\~V}% 10934 \DeclareUnicodeCharacter{1E7D}{\~v}% 10935 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}% 10936 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}% 10937 % 10938 \DeclareUnicodeCharacter{1E80}{\`W}% 10939 \DeclareUnicodeCharacter{1E81}{\`w}% 10940 \DeclareUnicodeCharacter{1E82}{\'W}% 10941 \DeclareUnicodeCharacter{1E83}{\'w}% 10942 \DeclareUnicodeCharacter{1E84}{\"W}% 10943 \DeclareUnicodeCharacter{1E85}{\"w}% 10944 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}% 10945 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}% 10946 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}% 10947 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}% 10948 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}% 10949 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}% 10950 \DeclareUnicodeCharacter{1E8C}{\"X}% 10951 \DeclareUnicodeCharacter{1E8D}{\"x}% 10952 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}% 10953 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}% 10954 % 10955 \DeclareUnicodeCharacter{1E90}{\^Z}% 10956 \DeclareUnicodeCharacter{1E91}{\^z}% 10957 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}% 10958 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}% 10959 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}% 10960 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}% 10961 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}% 10962 \DeclareUnicodeCharacter{1E97}{\"t}% 10963 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}% 10964 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}% 10965 % 10966 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}% 10967 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}% 10968 % 10969 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}% 10970 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}% 10971 \DeclareUnicodeCharacter{1EBC}{\~E}% 10972 \DeclareUnicodeCharacter{1EBD}{\~e}% 10973 % 10974 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}% 10975 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}% 10976 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}% 10977 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}% 10978 % 10979 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}% 10980 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}% 10981 % 10982 \DeclareUnicodeCharacter{1EF2}{\`Y}% 10983 \DeclareUnicodeCharacter{1EF3}{\`y}% 10984 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}% 10985 % 10986 \DeclareUnicodeCharacter{1EF8}{\~Y}% 10987 \DeclareUnicodeCharacter{1EF9}{\~y}% 10988 % 10989 % Exotic spaces 10990 \DeclareUnicodeCharacter{2007}{\hphantom{0}}% 10991 % 10992 % Punctuation 10993 \DeclareUnicodeCharacter{2013}{--}% 10994 \DeclareUnicodeCharacter{2014}{---}% 10995 \DeclareUnicodeCharacter{2018}{\quoteleft{}}% 10996 \DeclareUnicodeCharacter{2019}{\quoteright{}}% 10997 \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}% 10998 \DeclareUnicodeCharacter{201C}{\quotedblleft{}}% 10999 \DeclareUnicodeCharacter{201D}{\quotedblright{}}% 11000 \DeclareUnicodeCharacter{201E}{\quotedblbase{}}% 11001 \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}% 11002 \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}% 11003 \DeclareUnicodeCharacter{2022}{\bullet{}}% 11004 \DeclareUnicodeCharacter{202F}{\thinspace}% 11005 \DeclareUnicodeCharacter{2026}{\dots{}}% 11006 \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}% 11007 \DeclareUnicodeCharacter{203A}{\guilsinglright{}}% 11008 % 11009 \DeclareUnicodeCharacter{20AC}{\euro{}}% 11010 % 11011 \DeclareUnicodeCharacter{2192}{\arrow}% 11012 \DeclareUnicodeCharacter{21D2}{\result{}}% 11013 % 11014 % Mathematical symbols 11015 \DeclareUnicodeCharacter{2200}{\ensuremath\forall}% 11016 \DeclareUnicodeCharacter{2203}{\ensuremath\exists}% 11017 \DeclareUnicodeCharacter{2208}{\ensuremath\in}% 11018 \DeclareUnicodeCharacter{2212}{\minus{}}% 11019 \DeclareUnicodeCharacter{2217}{\ast}% 11020 \DeclareUnicodeCharacter{221E}{\ensuremath\infty}% 11021 \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}% 11022 \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}% 11023 \DeclareUnicodeCharacter{2229}{\ensuremath\cap}% 11024 \DeclareUnicodeCharacter{2261}{\equiv{}}% 11025 \DeclareUnicodeCharacter{2264}{\ensuremath\leq}% 11026 \DeclareUnicodeCharacter{2265}{\ensuremath\geq}% 11027 \DeclareUnicodeCharacter{2282}{\ensuremath\subset}% 11028 \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}% 11029 % 11030 \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}% 11031 \DeclareUnicodeCharacter{2032}{\ensuremath\prime}% 11032 \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}% 11033 \DeclareUnicodeCharacter{2111}{\ensuremath\Im}% 11034 \DeclareUnicodeCharacter{2113}{\ensuremath\ell}% 11035 \DeclareUnicodeCharacter{2118}{\ensuremath\wp}% 11036 \DeclareUnicodeCharacter{211C}{\ensuremath\Re}% 11037 \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}% 11038 \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}% 11039 \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}% 11040 \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}% 11041 \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}% 11042 \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}% 11043 \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}% 11044 \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}% 11045 \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}% 11046 \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}% 11047 \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}% 11048 \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}% 11049 \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}% 11050 \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}% 11051 \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}% 11052 \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}% 11053 \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}% 11054 \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}% 11055 \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}% 11056 \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}% 11057 \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}% 11058 \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}% 11059 \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}% 11060 \DeclareUnicodeCharacter{2202}{\ensuremath\partial}% 11061 \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}% 11062 \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}% 11063 \DeclareUnicodeCharacter{2209}{\ensuremath\notin}% 11064 \DeclareUnicodeCharacter{220B}{\ensuremath\owns}% 11065 \DeclareUnicodeCharacter{220F}{\ensuremath\prod}% 11066 \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}% 11067 \DeclareUnicodeCharacter{2211}{\ensuremath\sum}% 11068 \DeclareUnicodeCharacter{2213}{\ensuremath\mp}% 11069 \DeclareUnicodeCharacter{2218}{\ensuremath\circ}% 11070 \DeclareUnicodeCharacter{221A}{\ensuremath\surd}% 11071 \DeclareUnicodeCharacter{221D}{\ensuremath\propto}% 11072 \DeclareUnicodeCharacter{2220}{\ensuremath\angle}% 11073 \DeclareUnicodeCharacter{2223}{\ensuremath\mid}% 11074 \DeclareUnicodeCharacter{2228}{\ensuremath\vee}% 11075 \DeclareUnicodeCharacter{222A}{\ensuremath\cup}% 11076 \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}% 11077 \DeclareUnicodeCharacter{222E}{\ensuremath\oint}% 11078 \DeclareUnicodeCharacter{223C}{\ensuremath\sim}% 11079 \DeclareUnicodeCharacter{2240}{\ensuremath\wr}% 11080 \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}% 11081 \DeclareUnicodeCharacter{2245}{\ensuremath\cong}% 11082 \DeclareUnicodeCharacter{2248}{\ensuremath\approx}% 11083 \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}% 11084 \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}% 11085 \DeclareUnicodeCharacter{2260}{\ensuremath\neq}% 11086 \DeclareUnicodeCharacter{226A}{\ensuremath\ll}% 11087 \DeclareUnicodeCharacter{226B}{\ensuremath\gg}% 11088 \DeclareUnicodeCharacter{227A}{\ensuremath\prec}% 11089 \DeclareUnicodeCharacter{227B}{\ensuremath\succ}% 11090 \DeclareUnicodeCharacter{2283}{\ensuremath\supset}% 11091 \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}% 11092 \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}% 11093 \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}% 11094 \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}% 11095 \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}% 11096 \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}% 11097 \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}% 11098 \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}% 11099 \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}% 11100 \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}% 11101 \DeclareUnicodeCharacter{2299}{\ensuremath\odot}% 11102 \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}% 11103 \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}% 11104 \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}% 11105 \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}% 11106 \DeclareUnicodeCharacter{22A8}{\ensuremath\models}% 11107 \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}% 11108 \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}% 11109 \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}% 11110 \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}% 11111 \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}% 11112 \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}% 11113 \DeclareUnicodeCharacter{22C6}{\ensuremath\star}% 11114 \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}% 11115 \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}% 11116 \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}% 11117 \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}% 11118 \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}% 11119 \DeclareUnicodeCharacter{2322}{\ensuremath\frown}% 11120 \DeclareUnicodeCharacter{2323}{\ensuremath\smile}% 11121 % 11122 \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}% 11123 \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}% 11124 \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}% 11125 \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}% 11126 \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}% 11127 \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}% 11128 \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}% 11129 \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}% 11130 \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}% 11131 \DeclareUnicodeCharacter{266D}{\ensuremath\flat}% 11132 \DeclareUnicodeCharacter{266E}{\ensuremath\natural}% 11133 \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}% 11134 \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}% 11135 \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}% 11136 \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}% 11137 \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}% 11138 \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}% 11139 \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}% 11140 \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}% 11141 \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}% 11142 \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}% 11143 \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}% 11144 \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}% 11145 \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}% 11146 \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}% 11147 \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}% 11148 \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}% 11149 \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}% 11150 \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}% 11151 % 11152 \global\mathchardef\checkmark="1370% actually the square root sign 11153 \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}% 11154}% end of \unicodechardefs 11155 11156% UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command) 11157% It makes the setting that replace UTF-8 byte sequence. 11158\def\utfeightchardefs{% 11159 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii 11160 \unicodechardefs 11161} 11162 11163% Whether the active definitions of non-ASCII characters expand to 11164% non-active tokens with the same character code. This is used to 11165% write characters literally, instead of using active definitions for 11166% printing the correct glyphs. 11167\newif\ifpassthroughchars 11168\passthroughcharsfalse 11169 11170% For native Unicode handling (XeTeX and LuaTeX), 11171% provide a definition macro to replace/pass-through a Unicode character 11172% 11173\def\DeclareUnicodeCharacterNative#1#2{% 11174 \ifnum"#1>"7F % only make non-ASCII chars active 11175 \catcode"#1=\active 11176 \def\dodeclareunicodecharacternative##1##2##3{% 11177 \begingroup 11178 \uccode`\~="##2\relax 11179 \uppercase{\gdef~}{% 11180 \ifpassthroughchars 11181 ##1% 11182 \else 11183 ##3% 11184 \fi 11185 } 11186 \endgroup 11187 } 11188 \begingroup 11189 \uccode`\.="#1\relax 11190 \uppercase{\def\UTFNativeTmp{.}}% 11191 \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}% 11192 \endgroup 11193 \fi 11194} 11195 11196% Native Unicode handling (XeTeX and LuaTeX) character replacing definition. 11197% It activates the setting that replaces Unicode characters. 11198\def\nativeunicodechardefs{% 11199 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative 11200 \unicodechardefs 11201} 11202 11203% For native Unicode handling (XeTeX and LuaTeX), 11204% make the character token expand 11205% to the sequences given in \unicodechardefs for printing. 11206\def\DeclareUnicodeCharacterNativeAtU#1#2{% 11207 \def\UTFAtUTmp{#2} 11208 \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp 11209} 11210 11211% @U command definitions for native Unicode handling (XeTeX and LuaTeX). 11212\def\nativeunicodechardefsatu{% 11213 \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU 11214 \unicodechardefs 11215} 11216 11217% US-ASCII character definitions. 11218\def\asciichardefs{% nothing need be done 11219 \relax 11220} 11221 11222% Define all Unicode characters we know about. This makes UTF-8 the default 11223% input encoding and allows @U to work. 11224\iftxinativeunicodecapable 11225 \nativeunicodechardefsatu 11226\else 11227 \utfeightchardefs 11228\fi 11229 11230\message{formatting,} 11231 11232\newdimen\defaultparindent \defaultparindent = 15pt 11233 11234\chapheadingskip = 15pt plus 4pt minus 2pt 11235\secheadingskip = 12pt plus 3pt minus 2pt 11236\subsecheadingskip = 9pt plus 2pt minus 2pt 11237 11238% Prevent underfull vbox error messages. 11239\vbadness = 10000 11240 11241% Don't be very finicky about underfull hboxes, either. 11242\hbadness = 6666 11243 11244% Following George Bush, get rid of widows and orphans. 11245\widowpenalty=10000 11246\clubpenalty=10000 11247 11248% Use TeX 3.0's \emergencystretch to help line breaking, but if we're 11249% using an old version of TeX, don't do anything. We want the amount of 11250% stretch added to depend on the line length, hence the dependence on 11251% \hsize. We call this whenever the paper size is set. 11252% 11253\def\setemergencystretch{% 11254 \ifx\emergencystretch\thisisundefined 11255 % Allow us to assign to \emergencystretch anyway. 11256 \def\emergencystretch{\dimen0}% 11257 \else 11258 \emergencystretch = .15\hsize 11259 \fi 11260} 11261 11262% Parameters in order: 1) textheight; 2) textwidth; 11263% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; 11264% 7) physical page height; 8) physical page width. 11265% 11266% We also call \setleading{\textleading}, so the caller should define 11267% \textleading. The caller should also set \parskip. 11268% 11269\def\internalpagesizes#1#2#3#4#5#6#7#8{% 11270 \voffset = #3\relax 11271 \topskip = #6\relax 11272 \splittopskip = \topskip 11273 % 11274 \vsize = #1\relax 11275 \advance\vsize by \topskip 11276 \txipageheight = \vsize 11277 % 11278 \hsize = #2\relax 11279 \txipagewidth = \hsize 11280 % 11281 \normaloffset = #4\relax 11282 \bindingoffset = #5\relax 11283 % 11284 \ifpdf 11285 \pdfpageheight #7\relax 11286 \pdfpagewidth #8\relax 11287 % if we don't reset these, they will remain at "1 true in" of 11288 % whatever layout pdftex was dumped with. 11289 \pdfhorigin = 1 true in 11290 \pdfvorigin = 1 true in 11291 \else 11292 \ifx\XeTeXrevision\thisisundefined 11293 \special{papersize=#8,#7}% 11294 \else 11295 \pdfpageheight #7\relax 11296 \pdfpagewidth #8\relax 11297 % XeTeX does not have \pdfhorigin and \pdfvorigin. 11298 \fi 11299 \fi 11300 % 11301 \setleading{\textleading} 11302 % 11303 \parindent = \defaultparindent 11304 \setemergencystretch 11305} 11306 11307% @letterpaper (the default). 11308\def\letterpaper{{\globaldefs = 1 11309 \parskip = 3pt plus 2pt minus 1pt 11310 \textleading = 13.2pt 11311 % 11312 % If page is nothing but text, make it come out even. 11313 \internalpagesizes{607.2pt}{6in}% that's 46 lines 11314 {\voffset}{.25in}% 11315 {\bindingoffset}{36pt}% 11316 {11in}{8.5in}% 11317}} 11318 11319% Use @smallbook to reset parameters for 7x9.25 trim size. 11320\def\smallbook{{\globaldefs = 1 11321 \parskip = 2pt plus 1pt 11322 \textleading = 12pt 11323 % 11324 \internalpagesizes{7.5in}{5in}% 11325 {-.2in}{0in}% 11326 {\bindingoffset}{16pt}% 11327 {9.25in}{7in}% 11328 % 11329 \lispnarrowing = 0.3in 11330 \tolerance = 700 11331 \contentsrightmargin = 0pt 11332 \defbodyindent = .5cm 11333}} 11334 11335% Use @afourpaper to print on European A4 paper. 11336\def\afourpaper{{\globaldefs = 1 11337 \parskip = 3pt plus 2pt minus 1pt 11338 \textleading = 13.2pt 11339 % 11340 % Double-side printing via postscript on Laserjet 4050 11341 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. 11342 % To change the settings for a different printer or situation, adjust 11343 % \normaloffset until the front-side and back-side texts align. Then 11344 % do the same for \bindingoffset. You can set these for testing in 11345 % your texinfo source file like this: 11346 % @tex 11347 % \global\normaloffset = -6mm 11348 % \global\bindingoffset = 10mm 11349 % @end tex 11350 \internalpagesizes{673.2pt}{160mm}% that's 51 lines 11351 {\voffset}{\hoffset}% 11352 {\bindingoffset}{44pt}% 11353 {297mm}{210mm}% 11354 % 11355 \tolerance = 700 11356 \contentsrightmargin = 0pt 11357 \defbodyindent = 5mm 11358}} 11359 11360% Use @afivepaper to print on European A5 paper. 11361% From romildo@urano.iceb.ufop.br, 2 July 2000. 11362% He also recommends making @example and @lisp be small. 11363\def\afivepaper{{\globaldefs = 1 11364 \parskip = 2pt plus 1pt minus 0.1pt 11365 \textleading = 12.5pt 11366 % 11367 \internalpagesizes{160mm}{120mm}% 11368 {\voffset}{-11.4mm}% 11369 {\bindingoffset}{8pt}% 11370 {210mm}{148mm}% 11371 % 11372 \lispnarrowing = 0.2in 11373 \tolerance = 800 11374 \contentsrightmargin = 0pt 11375 \defbodyindent = 2mm 11376 \tableindent = 12mm 11377}} 11378 11379% A specific text layout, 24x15cm overall, intended for A4 paper. 11380\def\afourlatex{{\globaldefs = 1 11381 \afourpaper 11382 \internalpagesizes{237mm}{150mm}% 11383 {\voffset}{4.6mm}% 11384 {\bindingoffset}{7mm}% 11385 {297mm}{210mm}% 11386 % 11387 % Must explicitly reset to 0 because we call \afourpaper. 11388 \globaldefs = 0 11389}} 11390 11391% Use @afourwide to print on A4 paper in landscape format. 11392\def\afourwide{{\globaldefs = 1 11393 \afourpaper 11394 \internalpagesizes{241mm}{165mm}% 11395 {\voffset}{-2.95mm}% 11396 {\bindingoffset}{7mm}% 11397 {297mm}{210mm}% 11398 \globaldefs = 0 11399}} 11400 11401\def\bsixpaper{{\globaldefs = 1 11402 \afourpaper 11403 \internalpagesizes{140mm}{100mm}% 11404 {-6.35mm}{-12.7mm}% 11405 {\bindingoffset}{14pt}% 11406 {176mm}{125mm}% 11407 \let\SETdispenvsize=\smallword 11408 \lispnarrowing = 0.2in 11409 \globaldefs = 0 11410}} 11411 11412 11413% @pagesizes TEXTHEIGHT[,TEXTWIDTH] 11414% Perhaps we should allow setting the margins, \topskip, \parskip, 11415% and/or leading, also. Or perhaps we should compute them somehow. 11416% 11417\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} 11418\def\pagesizesyyy#1,#2,#3\finish{{% 11419 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi 11420 \globaldefs = 1 11421 % 11422 \parskip = 3pt plus 2pt minus 1pt 11423 \setleading{\textleading}% 11424 % 11425 \dimen0 = #1\relax 11426 \advance\dimen0 by 2.5in % default 1in margin above heading line 11427 % and 1.5in to include heading, footing and 11428 % bottom margin 11429 % 11430 \dimen2 = \hsize 11431 \advance\dimen2 by 2in % default to 1 inch margin on each side 11432 % 11433 \internalpagesizes{#1}{\hsize}% 11434 {\voffset}{\normaloffset}% 11435 {\bindingoffset}{44pt}% 11436 {\dimen0}{\dimen2}% 11437}} 11438 11439% Set default to letter. 11440% 11441\letterpaper 11442 11443% Default value of \hfuzz, for suppressing warnings about overfull hboxes. 11444\hfuzz = 1pt 11445 11446 11447\message{microtype,} 11448 11449% protrusion, from Thanh's protcode.tex. 11450\def\mtsetprotcode#1{% 11451 \rpcode#1`\!=200 \rpcode#1`\,=700 \rpcode#1`\-=700 \rpcode#1`\.=700 11452 \rpcode#1`\;=500 \rpcode#1`\:=500 \rpcode#1`\?=200 11453 \rpcode#1`\'=700 11454 \rpcode#1 34=500 % '' 11455 \rpcode#1 123=300 % -- 11456 \rpcode#1 124=200 % --- 11457 \rpcode#1`\)=50 \rpcode#1`\A=50 \rpcode#1`\F=50 \rpcode#1`\K=50 11458 \rpcode#1`\L=50 \rpcode#1`\T=50 \rpcode#1`\V=50 \rpcode#1`\W=50 11459 \rpcode#1`\X=50 \rpcode#1`\Y=50 \rpcode#1`\k=50 \rpcode#1`\r=50 11460 \rpcode#1`\t=50 \rpcode#1`\v=50 \rpcode#1`\w=50 \rpcode#1`\x=50 11461 \rpcode#1`\y=50 11462 % 11463 \lpcode#1`\`=700 11464 \lpcode#1 92=500 % `` 11465 \lpcode#1`\(=50 \lpcode#1`\A=50 \lpcode#1`\J=50 \lpcode#1`\T=50 11466 \lpcode#1`\V=50 \lpcode#1`\W=50 \lpcode#1`\X=50 \lpcode#1`\Y=50 11467 \lpcode#1`\v=50 \lpcode#1`\w=50 \lpcode#1`\x=50 \lpcode#1`\y=0 11468 % 11469 \mtadjustprotcode#1\relax 11470} 11471 11472\newcount\countC 11473\def\mtadjustprotcode#1{% 11474 \countC=0 11475 \loop 11476 \ifcase\lpcode#1\countC\else 11477 \mtadjustcp\lpcode#1\countC 11478 \fi 11479 \ifcase\rpcode#1\countC\else 11480 \mtadjustcp\rpcode#1\countC 11481 \fi 11482 \advance\countC 1 11483 \ifnum\countC < 256 \repeat 11484} 11485 11486\newcount\countB 11487\def\mtadjustcp#1#2#3{% 11488 \setbox\boxA=\hbox{% 11489 \ifx#2\font\else#2\fi 11490 \char#3}% 11491 \countB=\wd\boxA 11492 \multiply\countB #1#2#3\relax 11493 \divide\countB \fontdimen6 #2\relax 11494 #1#2#3=\countB\relax 11495} 11496 11497\ifx\XeTeXrevision\thisisundefined 11498 \ifx\luatexversion\thisisundefined 11499 \ifpdf % pdfTeX 11500 \mtsetprotcode\textrm 11501 \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax} 11502 \else % TeX 11503 \def\mtfontexpand#1{} 11504 \fi 11505 \else % LuaTeX 11506 \mtsetprotcode\textrm 11507 \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax} 11508 \fi 11509\else % XeTeX 11510 \mtsetprotcode\textrm 11511 \def\mtfontexpand#1{} 11512\fi 11513 11514 11515\newif\ifmicrotype 11516 11517\def\microtypeON{% 11518 \microtypetrue 11519 % 11520 \ifx\XeTeXrevision\thisisundefined 11521 \ifx\luatexversion\thisisundefined 11522 \ifpdf % pdfTeX 11523 \pdfadjustspacing=2 11524 \pdfprotrudechars=2 11525 \fi 11526 \else % LuaTeX 11527 \adjustspacing=2 11528 \protrudechars=2 11529 \fi 11530 \else % XeTeX 11531 \XeTeXprotrudechars=2 11532 \fi 11533 % 11534 \mtfontexpand\textrm 11535 \mtfontexpand\textsl 11536 \mtfontexpand\textbf 11537} 11538 11539\def\microtypeOFF{% 11540 \microtypefalse 11541 % 11542 \ifx\XeTeXrevision\thisisundefined 11543 \ifx\luatexversion\thisisundefined 11544 \ifpdf % pdfTeX 11545 \pdfadjustspacing=0 11546 \pdfprotrudechars=0 11547 \fi 11548 \else % LuaTeX 11549 \adjustspacing=0 11550 \protrudechars=0 11551 \fi 11552 \else % XeTeX 11553 \XeTeXprotrudechars=0 11554 \fi 11555} 11556 11557\microtypeON 11558 11559\parseargdef\microtype{% 11560 \def\txiarg{#1}% 11561 \ifx\txiarg\onword 11562 \microtypeON 11563 \else\ifx\txiarg\offword 11564 \microtypeOFF 11565 \else 11566 \errhelp = \EMsimple 11567 \errmessage{Unknown @microtype option `\txiarg', must be on|off}% 11568 \fi\fi 11569} 11570 11571 11572\message{and turning on texinfo input format.} 11573 11574\def^^L{\par} % remove \outer, so ^L can appear in an @comment 11575\catcode`\^^K = 10 % treat vertical tab as whitespace 11576 11577% DEL is a comment character, in case @c does not suffice. 11578\catcode`\^^? = 14 11579 11580% Define macros to output various characters with catcode for normal text. 11581\catcode`\"=\other \def\normaldoublequote{"} 11582\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix 11583\catcode`\+=\other \def\normalplus{+} 11584\catcode`\<=\other \def\normalless{<} 11585\catcode`\>=\other \def\normalgreater{>} 11586\catcode`\^=\other \def\normalcaret{^} 11587\catcode`\_=\other \def\normalunderscore{_} 11588\catcode`\|=\other \def\normalverticalbar{|} 11589\catcode`\~=\other \def\normaltilde{~} 11590 11591% Set catcodes for Texinfo file 11592 11593% Active characters for printing the wanted glyph. 11594% Most of these we simply print from the \tt font, but for some, we can 11595% use math or other variants that look better in normal text. 11596% 11597\catcode`\"=\active 11598\def\activedoublequote{{\tt\char34}} 11599\let"=\activedoublequote 11600\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde 11601\chardef\hatchar=`\^ 11602\catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat 11603 11604\catcode`\_=\active 11605\def_{\ifusingtt\normalunderscore\_} 11606\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } 11607\let\realunder=_ 11608 11609\catcode`\|=\active \def|{{\tt\char124}} 11610 11611\chardef \less=`\< 11612\catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless 11613\chardef \gtr=`\> 11614\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr 11615\catcode`\+=\active \def+{{\tt \char 43}} 11616\catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix 11617\catcode`\-=\active \let-=\normaldash 11618 11619 11620% used for headline/footline in the output routine, in case the page 11621% breaks in the middle of an @tex block. 11622\def\texinfochars{% 11623 \let< = \activeless 11624 \let> = \activegtr 11625 \let~ = \activetilde 11626 \let^ = \activehat 11627 \setregularquotes 11628 \let\b = \strong 11629 \let\i = \smartitalic 11630 % in principle, all other definitions in \tex have to be undone too. 11631} 11632 11633% Used sometimes to turn off (effectively) the active characters even after 11634% parsing them. 11635\def\turnoffactive{% 11636 \normalturnoffactive 11637 \otherbackslash 11638} 11639 11640\catcode`\@=0 11641 11642% \backslashcurfont outputs one backslash character in current font, 11643% as in \char`\\. 11644\global\chardef\backslashcurfont=`\\ 11645 11646% \realbackslash is an actual character `\' with catcode other. 11647{\catcode`\\=\other @gdef@realbackslash{\}} 11648 11649% In Texinfo, backslash is an active character; it prints the backslash 11650% in fixed width font. 11651\catcode`\\=\active % @ for escape char from now on. 11652 11653% Print a typewriter backslash. For math mode, we can't simply use 11654% \backslashcurfont: the story here is that in math mode, the \char 11655% of \backslashcurfont ends up printing the roman \ from the math symbol 11656% font (because \char in math mode uses the \mathcode, and plain.tex 11657% sets \mathcode`\\="026E). Hence we use an explicit \mathchar, 11658% which is the decimal equivalent of "715c (class 7, e.g., use \fam; 11659% ignored family value; char position "5C). We can't use " for the 11660% usual hex value because it has already been made active. 11661 11662@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} 11663@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents. 11664 11665% \otherbackslash defines an active \ to be a literal `\' character with 11666% catcode other. 11667@gdef@otherbackslash{@let\=@realbackslash} 11668 11669% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of 11670% the literal character `\'. 11671% 11672{@catcode`- = @active 11673 @gdef@normalturnoffactive{% 11674 @passthroughcharstrue 11675 @let-=@normaldash 11676 @let"=@normaldoublequote 11677 @let$=@normaldollar %$ font-lock fix 11678 @let+=@normalplus 11679 @let<=@normalless 11680 @let>=@normalgreater 11681 @let^=@normalcaret 11682 @let_=@normalunderscore 11683 @let|=@normalverticalbar 11684 @let~=@normaltilde 11685 @let\=@ttbackslash 11686 @setregularquotes 11687 @unsepspaces 11688 } 11689} 11690 11691% If a .fmt file is being used, characters that might appear in a file 11692% name cannot be active until we have parsed the command line. 11693% So turn them off again, and have @fixbackslash turn them back on. 11694@catcode`+=@other @catcode`@_=@other 11695 11696% \enablebackslashhack - allow file to begin `\input texinfo' 11697% 11698% If a .fmt file is being used, we don't want the `\input texinfo' to show up. 11699% That is what \eatinput is for; after that, the `\' should revert to printing 11700% a backslash. 11701% If the file did not have a `\input texinfo', then it is turned off after 11702% the first line; otherwise the first `\' in the file would cause an error. 11703% This is used on the very last line of this file, texinfo.tex. 11704% We also use @c to call @fixbackslash, in case ends of lines are hidden. 11705{ 11706@catcode`@^=7 11707@catcode`@^^M=13@gdef@enablebackslashhack{% 11708 @global@let\ = @eatinput% 11709 @catcode`@^^M=13% 11710 @def@c{@fixbackslash@c}% 11711 % Definition for the newline at the end of this file. 11712 @def ^^M{@let^^M@secondlinenl}% 11713 % Definition for a newline in the main Texinfo file. 11714 @gdef @secondlinenl{@fixbackslash}% 11715 % In case the first line has a whole-line command on it 11716 @let@originalparsearg@parsearg 11717 @def@parsearg{@fixbackslash@originalparsearg} 11718}} 11719 11720{@catcode`@^=7 @catcode`@^^M=13% 11721@gdef@eatinput input texinfo#1^^M{@fixbackslash}} 11722 11723% Emergency active definition of newline, in case an active newline token 11724% appears by mistake. 11725{@catcode`@^=7 @catcode13=13% 11726@gdef@enableemergencynewline{% 11727 @gdef^^M{% 11728 @par% 11729 %<warning: active newline>@par% 11730}}} 11731 11732 11733@gdef@fixbackslash{% 11734 @ifx\@eatinput @let\ = @ttbackslash @fi 11735 @catcode13=5 % regular end of line 11736 @enableemergencynewline 11737 @let@c=@comment 11738 @let@parsearg@originalparsearg 11739 % Also turn back on active characters that might appear in the input 11740 % file name, in case not using a pre-dumped format. 11741 @catcode`+=@active 11742 @catcode`@_=@active 11743 % 11744 % If texinfo.cnf is present on the system, read it. 11745 % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets 11746 % called at the beginning of every Texinfo file. Not opening texinfo.cnf 11747 % directly in this file, texinfo.tex, makes it possible to make a format 11748 % file for Texinfo. 11749 % 11750 @openin 1 texinfo.cnf 11751 @ifeof 1 @else @input texinfo.cnf @fi 11752 @closein 1 11753} 11754 11755 11756% Say @foo, not \foo, in error messages. 11757@escapechar = `@@ 11758 11759% These (along with & and #) are made active for url-breaking, so need 11760% active definitions as the normal characters. 11761@def@normaldot{.} 11762@def@normalquest{?} 11763@def@normalslash{/} 11764 11765% These look ok in all fonts, so just make them not special. 11766% @hashchar{} gets its own user-level command, because of #line. 11767@catcode`@& = @other @def@normalamp{&} 11768@catcode`@# = @other @def@normalhash{#} 11769@catcode`@% = @other @def@normalpercent{%} 11770 11771@let @hashchar = @normalhash 11772 11773@c Finally, make ` and ' active, so that txicodequoteundirected and 11774@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we 11775@c don't make ` and ' active, @code will not get them as active chars. 11776@c Do this last of all since we use ` in the previous @catcode assignments. 11777@catcode`@'=@active 11778@catcode`@`=@active 11779@setregularquotes 11780 11781@c Local variables: 11782@c eval: (add-hook 'before-save-hook 'time-stamp nil t) 11783@c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}" 11784@c page-delimiter: "^\\\\message\\|emacs-page" 11785@c End: 11786 11787@c vim:sw=2: 11788 11789@enablebackslashhack 11790 11791