Mercurial > hg > octave-jordi > gnulib-hg
comparison build-aux/texinfo.tex @ 18076:1651a7ba703b
autoupdate
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Tue, 18 Aug 2015 11:00:32 -0700 |
parents | 1a83dacc0869 |
children | 96efb12fe384 |
comparison
equal
deleted
inserted
replaced
18075:4c772e8197e9 | 18076:1651a7ba703b |
---|---|
1 % texinfo.tex -- TeX macros to handle Texinfo files. | 1 % texinfo.tex -- TeX macros to handle Texinfo files. |
2 % | 2 % |
3 % Load plain if necessary, i.e., if running under initex. | 3 % Load plain if necessary, i.e., if running under initex. |
4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi | 4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi |
5 % | 5 % |
6 \def\texinfoversion{2015-08-01.14} | 6 \def\texinfoversion{2015-08-17.16} |
7 % | 7 % |
8 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, | 8 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, |
9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | 9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
10 % 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 | 10 % 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 |
11 % Free Software Foundation, Inc. | 11 % Free Software Foundation, Inc. |
1882 \def\chapecsize{1728} | 1882 \def\chapecsize{1728} |
1883 | 1883 |
1884 % Section fonts (14.4pt). | 1884 % Section fonts (14.4pt). |
1885 \def\secnominalsize{14pt} | 1885 \def\secnominalsize{14pt} |
1886 \setfont\secrm\rmbshape{12}{\magstep1}{OT1} | 1886 \setfont\secrm\rmbshape{12}{\magstep1}{OT1} |
1887 \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1} | |
1887 \setfont\secit\itbshape{10}{\magstep2}{OT1IT} | 1888 \setfont\secit\itbshape{10}{\magstep2}{OT1IT} |
1888 \setfont\secsl\slbshape{10}{\magstep2}{OT1} | 1889 \setfont\secsl\slbshape{10}{\magstep2}{OT1} |
1889 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} | 1890 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} |
1890 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} | 1891 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} |
1891 \setfont\secsf\sfbshape{12}{\magstep1}{OT1} | 1892 \setfont\secsf\sfbshape{12}{\magstep1}{OT1} |
5021 \endgroup} | 5022 \endgroup} |
5022 | 5023 |
5023 % These macros are used by the sorted index file itself. | 5024 % These macros are used by the sorted index file itself. |
5024 % Change them to control the appearance of the index. | 5025 % Change them to control the appearance of the index. |
5025 | 5026 |
5026 \def\initial#1{{% | 5027 \let\normalhyphen=- |
5027 % Some minor font changes for the special characters. | 5028 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 |
5028 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt | 5029 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 |
5029 % | 5030 \catcode`\$=3 |
5031 \gdef\initialfonts{% | |
5032 \usemathbackslash | |
5033 \secfonts | |
5034 % Some changes for non-alphabetic characters. Using the glyphs from the | |
5035 % math fonts looks more consistent than the typewriter font used elsewhere | |
5036 % for these characters. | |
5037 % Can't get bold backslash so don't use bold forward slash | |
5038 \catcode`\/=13 | |
5039 \def/{{\secrmnotbold \normalslash}} | |
5040 \catcode`\-=13 | |
5041 \def-{{\normalhyphen\normalhyphen}} | |
5042 \let^=\normalcaret | |
5043 \let~=\normaltilde | |
5044 \def\_{% | |
5045 \leavevmode \kern.07em \vbox{\hrule width.33em height.06ex}\kern .07em } | |
5046 \def|{$\vert$} | |
5047 \def<{$\less$} | |
5048 \def>{$\gtr$} | |
5049 \def+{$\normalplus$} | |
5050 \let"=\normaldoublequote | |
5051 }} | |
5052 | |
5053 \def\initial{% | |
5054 \bgroup | |
5055 \initialfonts | |
5056 \initialx | |
5057 } | |
5058 | |
5059 \def\initialx#1{% | |
5030 % Remove any glue we may have, we'll be inserting our own. | 5060 % Remove any glue we may have, we'll be inserting our own. |
5031 \removelastskip | 5061 \removelastskip |
5032 % | 5062 % |
5033 % We like breaks before the index initials, so insert a bonus. | 5063 % We like breaks before the index initials, so insert a bonus. |
5034 \nobreak | 5064 \nobreak |
5045 \vskip 1.67\baselineskip plus .5\baselineskip | 5075 \vskip 1.67\baselineskip plus .5\baselineskip |
5046 \leftline{\secbf #1}% | 5076 \leftline{\secbf #1}% |
5047 % Do our best not to break after the initial. | 5077 % Do our best not to break after the initial. |
5048 \nobreak | 5078 \nobreak |
5049 \vskip .33\baselineskip plus .1\baselineskip | 5079 \vskip .33\baselineskip plus .1\baselineskip |
5050 }} | 5080 \egroup % \initialfonts |
5081 } | |
5051 | 5082 |
5052 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and | 5083 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and |
5053 % then page number (#2) flushed to the right margin. It is used for index | 5084 % then page number (#2) flushed to the right margin. It is used for index |
5054 % and table of contents entries. The paragraph is indented by \leftskip. | 5085 % and table of contents entries. The paragraph is indented by \leftskip. |
5055 % | 5086 % |
7310 \immediate\closeout\macscribble | 7341 \immediate\closeout\macscribble |
7311 \input \jobname.tmp | 7342 \input \jobname.tmp |
7312 } | 7343 } |
7313 \fi | 7344 \fi |
7314 | 7345 |
7346 % Used to remove a category 13 newline, added to the end of the last | |
7347 % line read in by \scantokens. | |
7348 {\catcode`\^^M=13 \gdef\gobblecr^^M{}} | |
7349 | |
7350 % Argument is macro body with arguments substituted | |
7315 \def\scanmacro#1{\begingroup | 7351 \def\scanmacro#1{\begingroup |
7316 \newlinechar`\^^M | 7352 \newlinechar`\^^M |
7317 \let\xeatspaces\eatspaces | 7353 \let\xeatspaces\eatspaces |
7318 % | 7354 % |
7319 % Undo catcode changes of \startcontents and \doprintindex | 7355 % Undo catcode changes of \startcontents and \doprintindex |
7324 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ | 7360 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ |
7325 % | 7361 % |
7326 % ... and for \example: | 7362 % ... and for \example: |
7327 \spaceisspace | 7363 \spaceisspace |
7328 % | 7364 % |
7329 % The \empty here causes a following catcode 5 newline to be eaten as | 7365 \ifnum\catcode`\^^M=5 |
7330 % part of reading whitespace after a control sequence. It does not | 7366 % The \empty here causes a following catcode 5 newline to be eaten as |
7331 % eat a catcode 13 newline. There's no good way to handle the two | 7367 % part of reading whitespace after a control sequence. |
7332 % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX | 7368 \scantokens{#1\empty}% |
7333 % would then have different behavior). See the Macro Details node in | 7369 \else |
7334 % the manual for the workaround we recommend for macros and | 7370 \catcode`\^^M=13 |
7335 % line-oriented commands. | 7371 \scantokens{#1\gobblecr}% |
7336 % | 7372 \fi |
7337 \scantokens{#1\empty}% | |
7338 \endgroup} | 7373 \endgroup} |
7339 | 7374 |
7340 \def\scanexp#1{% | 7375 \def\scanexp#1{% |
7341 \edef\temp{\noexpand\scanmacro{#1}}% | 7376 \edef\temp{\noexpand\scanmacro{#1}}% |
7342 \temp | 7377 \temp |
7419 \catcode`\^^M=\other | 7454 \catcode`\^^M=\other |
7420 } | 7455 } |
7421 | 7456 |
7422 \def\macrobodyctxt{% used for @macro definitions | 7457 \def\macrobodyctxt{% used for @macro definitions |
7423 \scanctxt | 7458 \scanctxt |
7459 \catcode`\ =\other | |
7424 \catcode`\{=\other | 7460 \catcode`\{=\other |
7425 \catcode`\}=\other | 7461 \catcode`\}=\other |
7426 \catcode`\^^M=\other | 7462 \catcode`\^^M=\other |
7427 \usembodybackslash | 7463 \usembodybackslash |
7428 } | 7464 } |
7429 | 7465 |
7430 \def\macroargctxt{% used when scanning invocations | 7466 % Used when scanning braced macro arguments. Note, however, that catcode |
7467 % changes here are ineffectual if the macro invocation was nested inside | |
7468 % an argument to another Texinfo command. | |
7469 \def\macroargctxt{% | |
7431 \scanctxt | 7470 \scanctxt |
7432 \catcode`\\=0 | 7471 \catcode`\\=\active |
7433 } | 7472 } |
7434 % why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" | 7473 |
7435 % for the single characters \ { }. Thus, we end up with the "commands" | |
7436 % that would be written @\ @{ @} in a Texinfo document. | |
7437 % | |
7438 % We already have @{ and @}. For @\, we define it here, and only for | |
7439 % this purpose, to produce a typewriter backslash (so, the @\ that we | |
7440 % define for @math can't be used with @macro calls): | |
7441 % | |
7442 \def\\{\normalbackslash}% | 7474 \def\\{\normalbackslash}% |
7443 % | |
7444 % We would like to do this for \, too, since that is what makeinfo does. | |
7445 % But it is not possible, because Texinfo already has a command @, for a | |
7446 % cedilla accent. Documents must use @comma{} instead. | |
7447 % | |
7448 % \anythingelse will almost certainly be an error of some kind. | |
7449 | 7475 |
7450 \def\macrolineargctxt{% used for whole-line arguments without braces | 7476 \def\macrolineargctxt{% used for whole-line arguments without braces |
7451 \scanctxt | 7477 \scanctxt |
7452 \catcode`\{=\other | 7478 \catcode`\{=\other |
7453 \catcode`\}=\other | 7479 \catcode`\}=\other |
7605 \advance\paramno by 1\relax | 7631 \advance\paramno by 1\relax |
7606 \fi\next} | 7632 \fi\next} |
7607 | 7633 |
7608 % These two commands read recursive and nonrecursive macro bodies. | 7634 % These two commands read recursive and nonrecursive macro bodies. |
7609 % (They're different since rec and nonrec macros end differently.) | 7635 % (They're different since rec and nonrec macros end differently.) |
7610 % | 7636 % Set \temp to the body of the macro, and call \defmacro. |
7611 \catcode `\@\texiatcatcode | 7637 \catcode `\@\texiatcatcode |
7612 \long\def\parsemacbody#1@end macro% | 7638 {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% |
7613 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% | 7639 \xdef\temp{\eatcr{#1}}\endgroup\defmacro}}% |
7614 \long\def\parsermacbody#1@end rmacro% | 7640 {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% |
7615 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% | 7641 \xdef\temp{\eatcr{#1}}\endgroup\defmacro}}% |
7616 \catcode `\@=11\relax | 7642 \catcode `\@=11\relax |
7617 | 7643 |
7618 \let\endargs@\relax | 7644 \let\endargs@\relax |
7619 \let\nil@\relax | 7645 \let\nil@\relax |
7620 \def\nilm@{\nil@}% | 7646 \def\nilm@{\nil@}% |
7790 \long\def\longpop@#1#2#3,#4\endargs@{% | 7816 \long\def\longpop@#1#2#3,#4\endargs@{% |
7791 \long\def#1{#3}% | 7817 \long\def#1{#3}% |
7792 \long\def#2{#4}% | 7818 \long\def#2{#4}% |
7793 } | 7819 } |
7794 | 7820 |
7795 % This defines a Texinfo @macro. There are eight cases: recursive and | 7821 % This defines a Texinfo @macro. \temp has the body of the macro in it. |
7796 % nonrecursive macros of zero, one, up to nine, and many arguments. | 7822 % There are eight cases: recursive and nonrecursive macros of zero, one, |
7823 % up to nine, and many arguments. | |
7797 % Much magic with \expandafter here. | 7824 % Much magic with \expandafter here. |
7798 % \xdef is used so that macro definitions will survive the file | 7825 % \xdef is used so that macro definitions will survive the file |
7799 % they're defined in; @include reads the file inside a group. | 7826 % they're defined in; @include reads the file inside a group. |
7800 % | 7827 % |
7801 \def\defmacro{% | 7828 \def\defmacro{% |
7874 | 7901 |
7875 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes | 7902 \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes |
7876 | 7903 |
7877 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} | 7904 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} |
7878 | 7905 |
7906 | |
7907 {\catcode`\@=0 \catcode`\\=13 | |
7908 @catcode`@_=11 | |
7909 | |
7910 % Call #1 with a list of tokens #2, with any doubled backslashes in #2 | |
7911 % compressed to one. | |
7912 @gdef@passargtomacro#1#2{% | |
7913 @def@the_macro{#1}% | |
7914 @def@pending_backslash{}% | |
7915 @def@finish{@finish}% | |
7916 @def@arg_result{}% | |
7917 @let@next_token=@relax | |
7918 @add_segment#2\@finish\% | |
7919 } | |
7920 | |
7921 % Input stream is just after a backslash. If the next token is not a | |
7922 % backslash, process the rest of the argument; otherwise, remove the next | |
7923 % token. | |
7924 @gdef@look_ahead{% | |
7925 @futurelet@next_token@look_aheadzzz} | |
7926 @gdef@look_aheadzzz{% | |
7927 @ifx@next_token\% | |
7928 @let@next=@gobble_and_check_finish | |
7929 @else | |
7930 @let@next=@add_segment | |
7931 @fi@next | |
7932 } | |
7933 | |
7934 % Double backslash found. Add a single backslash here. | |
7935 @gdef@gobble_and_check_finish#1{% | |
7936 @add_the_backslash | |
7937 @def@pending_backslash{}% | |
7938 @futurelet@next_token@add_segment | |
7939 } | |
7940 | |
7941 % append a backslash to \arg_result | |
7942 @gdef@add_the_backslash{% | |
7943 @expandafter@gdef@expandafter@arg_result@expandafter{@arg_result\}% | |
7944 } | |
7945 | |
7946 % Input stream is either at the start of the argument, or just after a | |
7947 % backslash sequence, either a lone backslash, or a doubled backslash. | |
7948 % \next_token contains the first token in the input stream: if it is \finish, | |
7949 % finish; otherwise, append to \arg_result the segment of the argument up until | |
7950 % the next backslash. \pending_backslash contains a backslash to represent | |
7951 % a backslash just before the start of the input stream that has not been | |
7952 % added to \arg_result. | |
7953 @gdef@add_segment#1\{% | |
7954 @ifx@next_token@finish | |
7955 @let@next=@call_the_macro% | |
7956 @else | |
7957 @let@next=@look_ahead | |
7958 % | |
7959 % append to @arg_result | |
7960 % token list registers might be better | |
7961 @expandafter@expandafter@expandafter@gdef | |
7962 @expandafter@expandafter@expandafter@arg_result | |
7963 @expandafter@expandafter@expandafter{% | |
7964 @expandafter@arg_result | |
7965 @pending_backslash#1}% | |
7966 @def@pending_backslash{\}% | |
7967 @fi@next} | |
7968 | |
7969 @gdef@call_the_macro{@expandafter@the_macro@expandafter{@arg_result}} | |
7970 | |
7971 } | |
7972 | |
7879 % \braceorline MAC is used for a one-argument macro MAC. It checks | 7973 % \braceorline MAC is used for a one-argument macro MAC. It checks |
7880 % whether the next non-whitespace character is a {. It sets the context | 7974 % whether the next non-whitespace character is a {. It sets the context |
7881 % for reading the argument (slightly different in the two cases). Then, | 7975 % for reading the argument (slightly different in the two cases). Then, |
7882 % to read the argument, in the whole-line case, it then calls the | 7976 % to read the argument, in the whole-line case, it then calls the regular |
7883 % regular \parsearg MAC; in the lbrace case, it just calls MAC itself. | 7977 % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC. |
7884 % | 7978 % |
7885 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} | 7979 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} |
7886 \def\braceorlinexxx{% | 7980 \def\braceorlinexxx{% |
7887 \ifx\nchar\bgroup\macroargctxt | 7981 \ifx\nchar\bgroup |
7888 \else\macrolineargctxt\expandafter\parsearg | 7982 \macroargctxt |
7983 \expandafter\passargtomacro | |
7984 \else | |
7985 \macrolineargctxt\expandafter\parsearg | |
7889 \fi \macnamexxx} | 7986 \fi \macnamexxx} |
7890 | 7987 |
7891 | 7988 |
7892 % @alias. | 7989 % @alias. |
7893 % We need some trickery to remove the optional spaces around the equal | 7990 % We need some trickery to remove the optional spaces around the equal |
10260 % \otherbackslash defines an active \ to be a literal `\' character with | 10357 % \otherbackslash defines an active \ to be a literal `\' character with |
10261 % catcode other. We switch back and forth between these. | 10358 % catcode other. We switch back and forth between these. |
10262 @gdef@rawbackslash{@let\=@backslashcurfont} | 10359 @gdef@rawbackslash{@let\=@backslashcurfont} |
10263 @gdef@otherbackslash{@let\=@realbackslash} | 10360 @gdef@otherbackslash{@let\=@realbackslash} |
10264 | 10361 |
10362 @gdef@usemathbackslash{@def@backslashcurfont{@math{@backslash}}} | |
10363 | |
10265 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of | 10364 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of |
10266 % the literal character `\'. Also revert - to its normal character, in | 10365 % the literal character `\'. Also revert - to its normal character, in |
10267 % case the active - from code has slipped in. | 10366 % case the active - from code has slipped in. |
10268 % | 10367 % |
10269 {@catcode`- = @active | 10368 {@catcode`- = @active |