Mercurial > gnulib
comparison build-aux/texinfo.tex @ 18129:d57623645981
update from texinfo
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Wed, 14 Oct 2015 15:32:04 -0700 |
parents | fe0c1d00c894 |
children | 5a70f6c50ff3 |
comparison
equal
deleted
inserted
replaced
18128:c865ce93b51e | 18129:d57623645981 |
---|---|
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-10-09.18} | 6 \def\texinfoversion{2015-10-14.18} |
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. |
1104 \newtoks\toksA | 1104 \newtoks\toksA |
1105 \newtoks\toksB | 1105 \newtoks\toksB |
1106 \newtoks\toksC | 1106 \newtoks\toksC |
1107 \newtoks\toksD | 1107 \newtoks\toksD |
1108 \newbox\boxA | 1108 \newbox\boxA |
1109 \newbox\boxB | |
1109 \newcount\countA | 1110 \newcount\countA |
1110 \newif\ifpdf | 1111 \newif\ifpdf |
1111 \newif\ifpdfmakepagedest | 1112 \newif\ifpdfmakepagedest |
1112 | 1113 |
1113 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 | 1114 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 |
4603 % (non-fully-expandable) commands. | 4604 % (non-fully-expandable) commands. |
4604 \makevalueexpandable | 4605 \makevalueexpandable |
4605 } | 4606 } |
4606 | 4607 |
4607 % \commondummiesnofonts: common to \commondummies and \indexnofonts. | 4608 % \commondummiesnofonts: common to \commondummies and \indexnofonts. |
4609 % Define \definedumyletter, \definedummyaccent and \definedummyword before | |
4610 % using. | |
4608 % | 4611 % |
4609 \def\commondummiesnofonts{% | 4612 \def\commondummiesnofonts{% |
4610 % Control letters and accents. | 4613 % Control letters and accents. |
4611 \definedummyletter\!% | 4614 \definedummyletter\!% |
4612 \definedummyaccent\"% | 4615 \definedummyaccent\"% |
4698 } | 4701 } |
4699 | 4702 |
4700 { | 4703 { |
4701 \catcode`\<=13 | 4704 \catcode`\<=13 |
4702 \catcode`\-=13 | 4705 \catcode`\-=13 |
4706 \catcode`\`=13 | |
4703 \gdef\indexnonalnumdisappear{% | 4707 \gdef\indexnonalnumdisappear{% |
4704 \backslashdisappear | 4708 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else |
4705 \def-{}% | 4709 % @set txiindexlquoteignore makes us ignore left quotes in the sort term. |
4706 \def<{}% | 4710 % (Introduced for FSFS 2nd ed.) |
4707 \def\@{}% | 4711 \let`=\empty |
4712 \fi | |
4713 % | |
4714 \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else | |
4715 \backslashdisappear | |
4716 \fi | |
4717 % | |
4718 \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else | |
4719 \def-{}% | |
4720 \fi | |
4721 \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else | |
4722 \def<{}% | |
4723 \fi | |
4724 \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else | |
4725 \def\@{}% | |
4726 \fi | |
4708 } | 4727 } |
4709 | 4728 |
4710 \gdef\indexnonalnumreappear{% | 4729 \gdef\indexnonalnumreappear{% |
4711 \useindexbackslash | 4730 \useindexbackslash |
4712 \let-\normaldash | 4731 \let-\normaldash |
4726 \def\definedummyaccent##1{\let##1\asis}% | 4745 \def\definedummyaccent##1{\let##1\asis}% |
4727 % We can just ignore other control letters. | 4746 % We can just ignore other control letters. |
4728 \def\definedummyletter##1{\let##1\empty}% | 4747 \def\definedummyletter##1{\let##1\empty}% |
4729 % All control words become @asis by default; overrides below. | 4748 % All control words become @asis by default; overrides below. |
4730 \let\definedummyword\definedummyaccent | 4749 \let\definedummyword\definedummyaccent |
4731 % | |
4732 \commondummiesnofonts | 4750 \commondummiesnofonts |
4733 % | 4751 % |
4734 % Don't no-op \tt, since it isn't a user-level command | 4752 % Don't no-op \tt, since it isn't a user-level command |
4735 % and is used in the definitions of the active chars like <, >, |, etc. | 4753 % and is used in the definitions of the active chars like <, >, |, etc. |
4736 % Likewise with the other plain tex font commands. | 4754 % Likewise with the other plain tex font commands. |
4739 \def\ { }% | 4757 \def\ { }% |
4740 \def\@{@}% | 4758 \def\@{@}% |
4741 \def\_{\normalunderscore}% | 4759 \def\_{\normalunderscore}% |
4742 \def\-{}% @- shouldn't affect sorting | 4760 \def\-{}% @- shouldn't affect sorting |
4743 % | 4761 % |
4744 % Unfortunately, texindex < 6.0 is not prepared to handle braces in the | |
4745 % content at all, so these won't be sorted in ASCII order. | |
4746 \def\lbracechar{{\indexlbrace}}% | 4762 \def\lbracechar{{\indexlbrace}}% |
4747 \def\rbracechar{{\indexrbrace}}% | 4763 \def\rbracechar{{\indexrbrace}}% |
4748 \let\{=\lbracechar | 4764 \let\{=\lbracechar |
4749 \let\}=\rbracechar | 4765 \let\}=\rbracechar |
4750 % | 4766 % |
4803 \def\quotesinglbase{,}% | 4819 \def\quotesinglbase{,}% |
4804 \def\registeredsymbol{R}% | 4820 \def\registeredsymbol{R}% |
4805 \def\result{=>}% | 4821 \def\result{=>}% |
4806 \def\textdegree{o}% | 4822 \def\textdegree{o}% |
4807 % | 4823 % |
4808 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax | |
4809 \else \indexlquoteignore \fi | |
4810 % | |
4811 % We need to get rid of all macros, leaving only the arguments (if present). | 4824 % We need to get rid of all macros, leaving only the arguments (if present). |
4812 % Of course this is not nearly correct, but it is the best we can do for now. | 4825 % Of course this is not nearly correct, but it is the best we can do for now. |
4813 % makeinfo does not expand macros in the argument to @deffn, which ends up | 4826 % makeinfo does not expand macros in the argument to @deffn, which ends up |
4814 % writing an index entry, and texindex isn't prepared for an index sort entry | 4827 % writing an index entry, and texindex isn't prepared for an index sort entry |
4815 % that starts with \. | 4828 % that starts with \. |
4819 % goes to end-of-line is not handled. | 4832 % goes to end-of-line is not handled. |
4820 % | 4833 % |
4821 \macrolist | 4834 \macrolist |
4822 } | 4835 } |
4823 | 4836 |
4824 % Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us | |
4825 % ignore left quotes in the sort term. | |
4826 {\catcode`\`=\active | |
4827 \gdef\indexlquoteignore{\let`=\empty}} | |
4828 | 4837 |
4829 \let\SETmarginindex=\relax % put index entries in margin (undocumented)? | 4838 \let\SETmarginindex=\relax % put index entries in margin (undocumented)? |
4830 | 4839 |
4831 % Most index entries go through here, but \dosubind is the general case. | 4840 % Most index entries go through here, but \dosubind is the general case. |
4832 % #1 is the index name, #2 is the entry text. | 4841 % #1 is the index name, #2 is the entry text. |
4915 \useindexbackslash % \indexbackslash isn't defined now so it will be output | 4924 \useindexbackslash % \indexbackslash isn't defined now so it will be output |
4916 % as is; and it will print as backslash. | 4925 % as is; and it will print as backslash. |
4917 % Get the string to sort by, by processing the index entry with all | 4926 % Get the string to sort by, by processing the index entry with all |
4918 % font commands turned off. | 4927 % font commands turned off. |
4919 {\indexnofonts | 4928 {\indexnofonts |
4929 \indexnonalnumdisappear | |
4920 \xdef\indexsortkey{}% | 4930 \xdef\indexsortkey{}% |
4921 \let\sortas=\indexwritesortas | 4931 \let\sortas=\indexwritesortas |
4922 \indexnonalnumdisappear | |
4923 \edef\temp{\the\toks0}% | 4932 \edef\temp{\the\toks0}% |
4924 \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas | 4933 \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas |
4925 \ifx\indexsortkey\empty | 4934 \ifx\indexsortkey\empty |
4926 \xdef\indexsortkey{\temp}% | 4935 \xdef\indexsortkey{\temp}% |
4927 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi | 4936 \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi |
5212 % | 5221 % |
5213 % Badness calculation for paragraph affected by - | 5222 % Badness calculation for paragraph affected by - |
5214 % How much \indexdotfill is stretched, or how much \parfillskip is shrunk | 5223 % How much \indexdotfill is stretched, or how much \parfillskip is shrunk |
5215 % Number of lines (\linepenalty) | 5224 % Number of lines (\linepenalty) |
5216 % | 5225 % |
5217 % Do not prefer a separate line ending with a hyphen to fewer lines. | |
5218 \finalhyphendemerits = 0 | |
5219 % | |
5220 % Word spacing - no stretch | |
5221 \spaceskip=\fontdimen2\font minus \fontdimen4\font | |
5222 % | |
5223 \linepenalty=1000 % Discourage line breaks. | |
5224 \hyphenpenalty=5000 % Discourage hyphenation. | |
5225 % | |
5226 % Ragged right margin, but not for the last line with the leaders in it. | |
5227 % When an index entry spans lines, this stretch competes with the stretch | |
5228 % in \indexdotfill to determine how the line will be split. | |
5229 \rightskip=\entryrightmargin | |
5230 \advance\rightskip by 0pt plus .6\hsize | |
5231 % | |
5232 % \parfillskip is at the end of the line with the page number | |
5233 \parfillskip=0pt | |
5234 % Cancel the \rightskip stretch | |
5235 \advance \parfillskip by 0pt plus -.6\hsize | |
5236 % Determine how far we can stretch into the margin. | |
5237 % This allows, e.g., "Appendix H GNU Free Documentation License" to fit | |
5238 % on one line. | |
5239 \advance \parfillskip by 0pt minus .6\entryrightmargin | |
5240 % | |
5241 % Swallow the left brace of the text (first parameter): | 5226 % Swallow the left brace of the text (first parameter): |
5242 \afterassignment\doentry | 5227 \afterassignment\doentry |
5243 \let\temp = | 5228 \let\temp = |
5244 } | 5229 } |
5245 \def\entrybreak{\unskip\space\ignorespaces}% | 5230 \def\entrybreak{\unskip\space\ignorespaces}% |
5246 \def\doentry{% | 5231 \def\doentry{% |
5247 % Save the text of the entry in a \vtop. | 5232 % Save the text of the entry in a \vtop. |
5248 \global\setbox\entryindexbox=\vtop\bgroup | 5233 \global\setbox\boxA=\hbox\bgroup |
5249 \bgroup % Instead of the swallowed brace. | 5234 \bgroup % Instead of the swallowed brace. |
5250 \noindent | 5235 \noindent |
5251 \aftergroup\finishentry | 5236 \aftergroup\finishentry |
5252 % And now comes the text of the entry. | 5237 % And now comes the text of the entry. |
5253 } | 5238 % Not absorbing as a macro argument reduces the chance of problems |
5254 \def\finishentry#1{% | 5239 % with catcodes occurring. |
5240 } | |
5241 {\catcode`\@=11 | |
5242 \gdef\finishentry#1{% | |
5243 \egroup % end box A | |
5244 \dimen@ = \wd\boxA % Length of text of entry | |
5245 \global\setbox\boxA=\hbox\bgroup\unhbox\boxA | |
5255 % #1 is the page number. | 5246 % #1 is the page number. |
5256 % | 5247 % |
5257 % The following is kludged to not output a line of dots in the index if | 5248 % The following is kludged to not output a line of dots in the index if |
5258 % there are no page numbers. The next person who breaks this will be | 5249 % there are no page numbers. The next person who breaks this will be |
5259 % cursed by a Unix daemon. | 5250 % cursed by a Unix daemon. |
5260 \setbox\boxA = \hbox{#1}% | 5251 \setbox\boxB = \hbox{#1}% |
5261 \ifdim\wd\boxA = 0pt | 5252 \ifdim\wd\boxB = 0pt |
5262 \null\nobreak\hfill\ % | 5253 \null\nobreak\hfill\ % |
5263 \else | 5254 \else |
5264 % | 5255 % |
5265 \null\nobreak\indexdotfill % Have leaders before the page number. | 5256 \null\nobreak\indexdotfill % Have leaders before the page number. |
5266 % | 5257 % |
5269 \hskip\skip\thinshrinkable\the\toksA | 5260 \hskip\skip\thinshrinkable\the\toksA |
5270 \else | 5261 \else |
5271 \hskip\skip\thinshrinkable #1% | 5262 \hskip\skip\thinshrinkable #1% |
5272 \fi | 5263 \fi |
5273 \fi | 5264 \fi |
5274 % Parameters for formatting this paragraph, reset for each paragraph. | 5265 \egroup % end \boxA |
5266 \global\setbox\entryindexbox=\vtop\bgroup\noindent | |
5267 % We want the text of the entries to be aligned to the left, and the | |
5268 % page numbers to be aligned to the right. | |
5275 % | 5269 % |
5276 % \hangindent is only relevant when the entry text and page number | 5270 \advance\leftskip by 0pt plus 1fil |
5277 % don't both fit on one line. In that case, bob suggests starting the | 5271 \advance\leftskip by 0pt plus -1fill |
5278 % dots pretty far over on the line. Unfortunately, a large | 5272 \rightskip = 0pt plus -1fil |
5279 % indentation looks wrong when the entry text itself is broken across | 5273 \advance\rightskip by 0pt plus 1fill |
5280 % lines. So we use a small indentation and put up with long leaders. | 5274 % Cause last line, which could consist of page numbers on their own if the |
5275 % list of page numbers is long, to be aligned to the right. | |
5276 \parfillskip=0pt plus -1fill | |
5281 % | 5277 % |
5282 \hangafter = 1 | 5278 \hangindent=1em |
5283 \hangindent = 1em | 5279 % |
5284 \par | 5280 \advance\rightskip by \entryrightmargin |
5281 % Determine how far we can stretch into the margin. | |
5282 % This allows, e.g., "Appendix H GNU Free Documentation License" to fit | |
5283 % on one line. | |
5284 \advance \parfillskip by 0pt minus .6\entryrightmargin | |
5285 % | |
5286 \ifdim\wd\boxA > \hsize % If the entry doesn't fit in one line | |
5287 \ifdim\dimen@ > 0.9\hsize % due to long index text | |
5288 \dimen@ = 0.6\dimen@ % Try to split the text roughly evenly | |
5289 \dimen@ii = \hsize | |
5290 \advance \dimen@ii by -1em | |
5291 \ifnum\dimen@>\dimen@ii | |
5292 % If the entry is too long, use the whole line | |
5293 \dimen@ = \dimen@ii | |
5294 \else | |
5295 % Cause stretch of 1fill at the end of the first line, to avoid | |
5296 % extra spacing in a short first line. | |
5297 \hskip 0pt plus 1fill | |
5298 \fi | |
5299 \parshape = 2 0pt \dimen@ 1em \dimen@ii | |
5300 % Ideally we'd add a finite glue at the end of the first line only, but | |
5301 % TeX doesn't seem to provide a way to do such a thing. | |
5302 \fi\fi | |
5303 \unhbox\boxA | |
5304 % | |
5305 % Do not prefer a separate line ending with a hyphen to fewer lines. | |
5306 \finalhyphendemerits = 0 | |
5307 % | |
5308 % Word spacing - no stretch | |
5309 \spaceskip=\fontdimen2\font minus \fontdimen4\font | |
5310 % | |
5311 \linepenalty=1000 % Discourage line breaks. | |
5312 \hyphenpenalty=10000 % Discourage hyphenation. | |
5313 % | |
5314 \par % format the paragraph | |
5285 \egroup % The \vtop | 5315 \egroup % The \vtop |
5286 \endgroup | 5316 \endgroup |
5287 % delay text of entry until after penalty | 5317 % delay text of entry until after penalty |
5288 \bgroup\aftergroup\insertindexentrybox | 5318 \bgroup\aftergroup\insertindexentrybox |
5289 \entryorphanpenalty | 5319 \entryorphanpenalty |
5290 } | 5320 }} |
5291 | 5321 |
5292 \newskip\thinshrinkable | 5322 \newskip\thinshrinkable |
5293 \skip\thinshrinkable=.15em minus .15em | 5323 \skip\thinshrinkable=.15em minus .15em |
5294 | 5324 |
5295 \newbox\entryindexbox | 5325 \newbox\entryindexbox |
5320 \fi | 5350 \fi |
5321 \egroup % now comes the box added with \aftergroup | 5351 \egroup % now comes the box added with \aftergroup |
5322 } | 5352 } |
5323 | 5353 |
5324 % Like plain.tex's \dotfill, except uses up at least 1 em. | 5354 % Like plain.tex's \dotfill, except uses up at least 1 em. |
5325 % Using a finite stretch encourages several words to appear on a second line | 5355 % The filll stretch here overpowers both the fil and fill stretch to push |
5326 % if the entry is broken. | 5356 % the page number to the right. |
5327 \def\indexdotfill{\cleaders | 5357 \def\indexdotfill{\cleaders |
5328 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus .4\hsize} | 5358 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll} |
5359 | |
5329 | 5360 |
5330 \def\primary #1{\line{#1\hfil}} | 5361 \def\primary #1{\line{#1\hfil}} |
5331 | 5362 |
5332 \newskip\secondaryindent \secondaryindent=0.5cm | 5363 \newskip\secondaryindent \secondaryindent=0.5cm |
5333 \def\secondary#1#2{{% | 5364 \def\secondary#1#2{{% |