Mercurial > gnulib
comparison build-aux/texinfo.tex @ 40230:25f5a9e7e5fb
autoupdate
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Mon, 11 Mar 2019 09:16:52 -0700 |
parents | bb9e295185c8 |
children | 6771da173563 |
comparison
equal
deleted
inserted
replaced
40229:6abc91ece034 | 40230:25f5a9e7e5fb |
---|---|
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{2019-03-09.13} | 6 \def\texinfoversion{2019-03-10.13} |
7 | 7 |
8 % | 8 % |
9 % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. | 9 % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. |
10 % | 10 % |
11 % This texinfo.tex file is free software: you can redistribute it and/or | 11 % This texinfo.tex file is free software: you can redistribute it and/or |
2836 \catcode`@=\other | 2836 \catcode`@=\other |
2837 \def\endofsentencespacefactor{3000}% default | 2837 \def\endofsentencespacefactor{3000}% default |
2838 | 2838 |
2839 % @t, explicit typewriter. | 2839 % @t, explicit typewriter. |
2840 \def\t#1{% | 2840 \def\t#1{% |
2841 {\tt \rawbackslash \plainfrenchspacing #1}% | 2841 {\tt \plainfrenchspacing #1}% |
2842 \null | 2842 \null |
2843 } | 2843 } |
2844 | 2844 |
2845 % @samp. | 2845 % @samp. |
2846 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} | 2846 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} |
2863 \def\ {{\spaceskip = 0pt{} }}% | 2863 \def\ {{\spaceskip = 0pt{} }}% |
2864 % | 2864 % |
2865 % Turn off hyphenation. | 2865 % Turn off hyphenation. |
2866 \nohyphenation | 2866 \nohyphenation |
2867 % | 2867 % |
2868 \rawbackslash | |
2869 \plainfrenchspacing | 2868 \plainfrenchspacing |
2870 #1% | 2869 #1% |
2871 }% | 2870 }% |
2872 \null % reset spacefactor to 1000 | 2871 \null % reset spacefactor to 1000 |
2873 } | 2872 } |
5473 % it can discover if there is anything in it. | 5472 % it can discover if there is anything in it. |
5474 \read 1 to \thisline | 5473 \read 1 to \thisline |
5475 \ifeof 1 | 5474 \ifeof 1 |
5476 \putwordIndexIsEmpty | 5475 \putwordIndexIsEmpty |
5477 \else | 5476 \else |
5478 \expandafter\printindexzz\thisline\relax\relax\finish% | 5477 \expandafter\printindexzz{#1}\thisline\relax\relax\finish% |
5479 \fi | 5478 \fi |
5480 \fi | 5479 \fi |
5481 \closein 1 | 5480 \closein 1 |
5482 \endgroup} | 5481 \endgroup} |
5483 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx} | |
5484 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next} | |
5485 | 5482 |
5486 % If the index file starts with a backslash, forgo reading the index | 5483 % If the index file starts with a backslash, forgo reading the index |
5487 % file altogether. If somebody upgrades texinfo.tex they may still have | 5484 % file altogether. If somebody upgrades texinfo.tex they may still have |
5488 % old index files using \ as the escape character. Reading this would | 5485 % old index files using \ as the escape character. Reading this would |
5489 % at best lead to typesetting garbage, at worst a TeX syntax error. | 5486 % at best lead to typesetting garbage, at worst a TeX syntax error. |
5490 \def\printindexzz#1#2\finish{% | 5487 \def\printindexzz#1#2#3\finish{% |
5491 % NB this won't work if the index file starts with a group... | 5488 % NB this won't work if the index file starts with a group... |
5492 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1 | 5489 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#2 |
5493 \message{skipping sorted index file}% | 5490 \message{skipping sorted index file}% |
5494 (Skipped sorted index file in obsolete format) | 5491 (Skipped sorted index file in obsolete format) |
5495 \else | 5492 \else |
5496 \printindexzzz | 5493 \begindoublecolumns |
5494 \input \jobname.#1s | |
5495 \enddoublecolumns | |
5497 \fi | 5496 \fi |
5498 } | 5497 } |
5499 | |
5500 \def\printindexzzz{% | |
5501 \begindoublecolumns | |
5502 \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty | |
5503 % | |
5504 % Read input from the index file line by line. | |
5505 \loopdo | |
5506 \ifeof1 \else | |
5507 \read 1 to \nextline | |
5508 \fi | |
5509 % | |
5510 \indexinputprocessing | |
5511 \thisline | |
5512 % | |
5513 \ifeof1\else | |
5514 \let\thisline\nextline | |
5515 \repeat | |
5516 %% | |
5517 \enddoublecolumns | |
5518 } | |
5519 | |
5520 \def\indexinputprocessing{% | |
5521 \ifeof1 | |
5522 \let\firsttoken\relax | |
5523 \else | |
5524 \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}% | |
5525 \act | |
5526 \fi | |
5527 } | |
5528 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken} | |
5529 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1} | |
5530 | |
5531 | 5498 |
5532 % These macros are used by the sorted index file itself. | 5499 % These macros are used by the sorted index file itself. |
5533 % Change them to control the appearance of the index. | 5500 % Change them to control the appearance of the index. |
5534 | 5501 |
5535 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 | 5502 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 |
5604 % then page number (#2) flushed to the right margin. It is used for index | 5571 % then page number (#2) flushed to the right margin. It is used for index |
5605 % and table of contents entries. The paragraph is indented by \leftskip. | 5572 % and table of contents entries. The paragraph is indented by \leftskip. |
5606 % | 5573 % |
5607 \def\entry{% | 5574 \def\entry{% |
5608 \begingroup | 5575 \begingroup |
5609 % | |
5610 % For pdfTeX and XeTeX. | |
5611 % The redefinition of \domark stops marks being added in \pdflink to | |
5612 % preserve coloured links across page boundaries. Otherwise the marks | |
5613 % would get in the way of \lastbox in \insertentrybox. | |
5614 \let\domark\relax | |
5615 % | 5576 % |
5616 % Start a new paragraph if necessary, so our assignments below can't | 5577 % Start a new paragraph if necessary, so our assignments below can't |
5617 % affect previous text. | 5578 % affect previous text. |
5618 \par | 5579 \par |
5619 % | 5580 % |
5669 \fi | 5630 \fi |
5670 \fi | 5631 \fi |
5671 \fi | 5632 \fi |
5672 \egroup % end \boxA | 5633 \egroup % end \boxA |
5673 \ifdim\wd\boxB = 0pt | 5634 \ifdim\wd\boxB = 0pt |
5674 \global\setbox\entrybox=\vbox{\unhbox\boxA}% | 5635 \unhbox\boxA |
5675 \else | 5636 \else\bgroup |
5676 \global\setbox\entrybox=\vbox\bgroup | |
5677 % We want the text of the entries to be aligned to the left, and the | 5637 % We want the text of the entries to be aligned to the left, and the |
5678 % page numbers to be aligned to the right. | 5638 % page numbers to be aligned to the right. |
5679 % | 5639 % |
5680 \parindent = 0pt | 5640 \parindent = 0pt |
5681 \advance\leftskip by 0pt plus 1fil | 5641 \advance\leftskip by 0pt plus 1fil |
5737 % | 5697 % |
5738 \par % format the paragraph | 5698 \par % format the paragraph |
5739 \egroup % The \vbox | 5699 \egroup % The \vbox |
5740 \fi | 5700 \fi |
5741 \endgroup | 5701 \endgroup |
5742 \dotheinsertentrybox | |
5743 }} | 5702 }} |
5744 | 5703 |
5745 \newskip\thinshrinkable | 5704 \newskip\thinshrinkable |
5746 \skip\thinshrinkable=.15em minus .15em | 5705 \skip\thinshrinkable=.15em minus .15em |
5747 | |
5748 \newbox\entrybox | |
5749 \def\insertentrybox{% | |
5750 \ourunvbox\entrybox | |
5751 } | |
5752 | |
5753 % default definition | |
5754 \let\dotheinsertentrybox\insertentrybox | |
5755 | |
5756 % Use \lastbox to take apart vbox box by box, and add each sub-box | |
5757 % to the current vertical list. | |
5758 \def\ourunvbox#1{% | |
5759 \bgroup % for local binding of \delayedbox | |
5760 % Remove the last box from box #1 | |
5761 \global\setbox#1=\vbox{% | |
5762 \unvbox#1% | |
5763 \unskip % remove any glue | |
5764 \unpenalty | |
5765 \global\setbox\interbox=\lastbox | |
5766 }% | |
5767 \setbox\delayedbox=\box\interbox | |
5768 \ifdim\ht#1=0pt\else | |
5769 \ourunvbox#1 % Repeat on what's left of the box | |
5770 \nobreak | |
5771 \fi | |
5772 \box\delayedbox | |
5773 \egroup | |
5774 } | |
5775 \newbox\delayedbox | |
5776 \newbox\interbox | |
5777 | |
5778 % Used from \printindex. \firsttoken should be the first token | |
5779 % after the \entry. If it's not another \entry, we are at the last | |
5780 % line of a group of index entries, so insert a penalty to discourage | |
5781 % widowed index entries. | |
5782 \def\dotheinsertentryboxwithpenalty{% | |
5783 \ifx\firsttoken\isentry | |
5784 \else | |
5785 \penalty 9000 | |
5786 \fi | |
5787 \insertentrybox | |
5788 } | |
5789 \def\isentry{\entry}% | |
5790 | 5706 |
5791 % Like plain.tex's \dotfill, except uses up at least 1 em. | 5707 % Like plain.tex's \dotfill, except uses up at least 1 em. |
5792 % The filll stretch here overpowers both the fil and fill stretch to push | 5708 % The filll stretch here overpowers both the fil and fill stretch to push |
5793 % the page number to the right. | 5709 % the page number to the right. |
5794 \def\indexdotfill{\cleaders | 5710 \def\indexdotfill{\cleaders |
8150 % changes here are ineffectual if the macro invocation was nested inside | 8066 % changes here are ineffectual if the macro invocation was nested inside |
8151 % an argument to another Texinfo command. | 8067 % an argument to another Texinfo command. |
8152 \def\macroargctxt{% | 8068 \def\macroargctxt{% |
8153 \scanctxt | 8069 \scanctxt |
8154 \catcode`\ =\active | 8070 \catcode`\ =\active |
8071 \catcode`\@=\other | |
8155 \catcode`\^^M=\other | 8072 \catcode`\^^M=\other |
8156 \catcode`\\=\active | 8073 \catcode`\\=\active |
8157 } | 8074 } |
8158 | 8075 |
8159 \def\macrolineargctxt{% used for whole-line arguments without braces | 8076 \def\macrolineargctxt{% used for whole-line arguments without braces |
8160 \scanctxt | 8077 \scanctxt |
8078 \catcode`\@=\other | |
8161 \catcode`\{=\other | 8079 \catcode`\{=\other |
8162 \catcode`\}=\other | 8080 \catcode`\}=\other |
8163 } | 8081 } |
8164 | 8082 |
8165 % \mbodybackslash is the definition of \ in @macro bodies. | 8083 % \mbodybackslash is the definition of \ in @macro bodies. |
11504 \catcode`\@=0 | 11422 \catcode`\@=0 |
11505 | 11423 |
11506 % \backslashcurfont outputs one backslash character in current font, | 11424 % \backslashcurfont outputs one backslash character in current font, |
11507 % as in \char`\\. | 11425 % as in \char`\\. |
11508 \global\chardef\backslashcurfont=`\\ | 11426 \global\chardef\backslashcurfont=`\\ |
11509 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work | 11427 |
11510 | 11428 % \realbackslash is an actual character `\' with catcode other. |
11511 % \realbackslash is an actual character `\' with catcode other, and | 11429 {\catcode`\\=\other @gdef@realbackslash{\}} |
11512 % \doublebackslash is two of them (for the pdf outlines). | |
11513 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} | |
11514 | 11430 |
11515 % In Texinfo, backslash is an active character; it prints the backslash | 11431 % In Texinfo, backslash is an active character; it prints the backslash |
11516 % in fixed width font. | 11432 % in fixed width font. |
11517 \catcode`\\=\active % @ for escape char from now on. | 11433 \catcode`\\=\active % @ for escape char from now on. |
11518 | 11434 |
11526 % usual hex value because it has already been made active. | 11442 % usual hex value because it has already been made active. |
11527 | 11443 |
11528 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} | 11444 @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} |
11529 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents. | 11445 @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents. |
11530 | 11446 |
11531 % \rawbackslash defines an active \ to do \backslashcurfont. | |
11532 % \otherbackslash defines an active \ to be a literal `\' character with | 11447 % \otherbackslash defines an active \ to be a literal `\' character with |
11533 % catcode other. We switch back and forth between these. | 11448 % catcode other. |
11534 @gdef@rawbackslash{@let\=@backslashcurfont} | |
11535 @gdef@otherbackslash{@let\=@realbackslash} | 11449 @gdef@otherbackslash{@let\=@realbackslash} |
11536 | 11450 |
11537 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of | 11451 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of |
11538 % the literal character `\'. | 11452 % the literal character `\'. |
11539 % | 11453 % |