comparison build-aux/texinfo.tex @ 40243:667e4c89e4d3

autoupdate
author Karl Berry <karl@freefriends.org>
date Sun, 17 Mar 2019 09:24:57 -0700
parents 331ec5f027a2
children
comparison
equal deleted inserted replaced
40242:e84036edb2ff 40243:667e4c89e4d3
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-12.20} 6 \def\texinfoversion{2019-03-16.20}
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
1122 \else 1122 \else
1123 \pdftrue 1123 \pdftrue
1124 \fi 1124 \fi
1125 \fi 1125 \fi
1126 \fi 1126 \fi
1127
1128 \newif\ifpdforxetex
1129 \pdforxetexfalse
1130 \ifpdf
1131 \pdforxetextrue
1132 \fi
1133 \ifx\XeTeXrevision\thisisundefined\else
1134 \pdforxetextrue
1135 \fi
1136
1127 1137
1128 % PDF uses PostScript string constants for the names of xref targets, 1138 % PDF uses PostScript string constants for the names of xref targets,
1129 % for display in the outlines, and in other places. Thus, we have to 1139 % for display in the outlines, and in other places. Thus, we have to
1130 % double any backslashes. Otherwise, a name like "\node" will be 1140 % double any backslashes. Otherwise, a name like "\node" will be
1131 % interpreted as a newline (\n), followed by o, d, e. Not good. 1141 % interpreted as a newline (\n), followed by o, d, e. Not good.
3103 3113
3104 % rms does not like angle brackets --karl, 17may97. 3114 % rms does not like angle brackets --karl, 17may97.
3105 % So now @email is just like @uref, unless we are pdf. 3115 % So now @email is just like @uref, unless we are pdf.
3106 % 3116 %
3107 %\def\email#1{\angleleft{\tt #1}\angleright} 3117 %\def\email#1{\angleleft{\tt #1}\angleright}
3108 \ifpdf 3118 \ifpdforxetex
3109 \def\email#1{\doemail#1,,\finish} 3119 \def\email#1{\doemail#1,,\finish}
3110 \def\doemail#1,#2,#3\finish{\begingroup 3120 \def\doemail#1,#2,#3\finish{\begingroup
3111 \unsepspaces 3121 \unsepspaces
3112 \pdfurl{mailto:#1}% 3122 \pdfurl{mailto:#1}%
3113 \setbox0 = \hbox{\ignorespaces #2}% 3123 \setbox0 = \hbox{\ignorespaces #2}%
3114 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi 3124 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3115 \endlink 3125 \endlink
3116 \endgroup} 3126 \endgroup}
3117 \else 3127 \else
3118 \ifx\XeTeXrevision\thisisundefined 3128 \let\email=\uref
3119 \let\email=\uref
3120 \else
3121 \def\email#1{\doemail#1,,\finish}
3122 \def\doemail#1,#2,#3\finish{\begingroup
3123 \unsepspaces
3124 \pdfurl{mailto:#1}%
3125 \setbox0 = \hbox{\ignorespaces #2}%
3126 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
3127 \endlink
3128 \endgroup}
3129 \fi
3130 \fi 3129 \fi
3131 3130
3132 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), 3131 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
3133 % `example' (@kbd uses ttsl only inside of @example and friends), 3132 % `example' (@kbd uses ttsl only inside of @example and friends),
3134 % or `code' (@kbd uses normal tty font always). 3133 % or `code' (@kbd uses normal tty font always).
5235 \indexwritesortasxxx} 5234 \indexwritesortasxxx}
5236 \gdef\indexwritesortasxxx#1{% 5235 \gdef\indexwritesortasxxx#1{%
5237 \xdef\indexsortkey{#1}\endgroup} 5236 \xdef\indexsortkey{#1}\endgroup}
5238 } 5237 }
5239 5238
5240 % The default definition 5239 \def\indexwriteseealso#1{
5240 \gdef\pagenumbertext{@seealso{#1}}%
5241 }
5242
5243 % The default definitions
5241 \def\sortas#1{}% 5244 \def\sortas#1{}%
5245 \def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
5246 \def\putwordSeeAlso{see also}
5242 5247
5243 % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}": 5248 % Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
5244 % * Set \bracedtext to "{aaa}{bbb}" 5249 % * Set \bracedtext to "{aaa}{bbb}"
5245 % * Set \fullindexsortkey to "aaa @subentry ZZZ" 5250 % * Set \fullindexsortkey to "aaa @subentry ZZZ"
5251 % * If @seealso occurs, set \pagenumbertext
5246 % 5252 %
5247 \def\splitindexentry#1{% 5253 \def\splitindexentry#1{%
5248 \gdef\fullindexsortkey{}% 5254 \gdef\fullindexsortkey{}%
5249 \xdef\bracedtext{}% 5255 \xdef\bracedtext{}%
5250 \def\sep{}% 5256 \def\sep{}%
5257 \def\seealso##1{}%
5251 \expandafter\doindexsegment#1\subentry\finish\subentry 5258 \expandafter\doindexsegment#1\subentry\finish\subentry
5252 } 5259 }
5253 5260
5254 % append the results from the next segment 5261 % append the results from the next segment
5255 \def\doindexsegment#1\subentry{% 5262 \def\doindexsegment#1\subentry{%
5266 % 5273 %
5267 % Get the string to sort by. Process the segment with all 5274 % Get the string to sort by. Process the segment with all
5268 % font commands turned off. 5275 % font commands turned off.
5269 \bgroup 5276 \bgroup
5270 \let\sortas\indexwritesortas 5277 \let\sortas\indexwritesortas
5278 \let\seealso\indexwriteseealso
5271 \indexnofonts 5279 \indexnofonts
5272 % The braces around the commands are recognized by texindex. 5280 % The braces around the commands are recognized by texindex.
5273 \def\lbracechar{{\indexlbrace}}% 5281 \def\lbracechar{{\indexlbrace}}%
5274 \def\rbracechar{{\indexrbrace}}% 5282 \def\rbracechar{{\indexrbrace}}%
5275 \let\{=\lbracechar 5283 \let\{=\lbracechar
5276 \let\}=\rbracechar 5284 \let\}=\rbracechar
5277 \def\@{{\indexatchar}}% 5285 \def\@{{\indexatchar}}%
5278 \def\atchar##1{\@}% 5286 \def\atchar##1{\@}%
5279 % 5287 %
5280 \let\indexsortkey\empty 5288 \let\indexsortkey\empty
5289 \global\let\pagenumbertext\empty
5281 % Execute the segment and throw away the typeset output. This executes 5290 % Execute the segment and throw away the typeset output. This executes
5282 % any @sortas commands in this segment. 5291 % any @sortas or @seealso commands in this segment.
5283 \setbox\dummybox = \hbox{\segment}% 5292 \setbox\dummybox = \hbox{\segment}%
5284 \ifx\indexsortkey\empty{% 5293 \ifx\indexsortkey\empty{%
5285 \indexnonalnumdisappear 5294 \indexnonalnumdisappear
5286 \xdef\trimmed{\segment}% 5295 \xdef\trimmed{\segment}%
5287 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% 5296 \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
5325 % subentry case), texindex reduces to two when writing the .??s 5334 % subentry case), texindex reduces to two when writing the .??s
5326 % sorted result. 5335 % sorted result.
5327 % 5336 %
5328 \edef\temp{% 5337 \edef\temp{%
5329 \write\writeto{% 5338 \write\writeto{%
5330 \string\entry{\fullindexsortkey}{\noexpand\folio}\bracedtext}% 5339 \string\entry{\fullindexsortkey}%
5340 {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
5341 \bracedtext}%
5331 }% 5342 }%
5332 \temp 5343 \temp
5333 } 5344 }
5334 5345
5335 % Put the index entry in the margin if desired (undocumented). 5346 % Put the index entry in the margin if desired (undocumented).
5425 % \initial {c} 5436 % \initial {c}
5426 % before the first topic whose initial is c 5437 % before the first topic whose initial is c
5427 % \entry {topic}{pagelist} 5438 % \entry {topic}{pagelist}
5428 % for a topic that is used without subtopics 5439 % for a topic that is used without subtopics
5429 % \primary {topic} 5440 % \primary {topic}
5441 % \entry {topic}{}
5430 % for the beginning of a topic that is used with subtopics 5442 % for the beginning of a topic that is used with subtopics
5431 % \secondary {subtopic}{pagelist} 5443 % \secondary {subtopic}{pagelist}
5432 % for each subtopic. 5444 % for each subtopic.
5445 % \secondary {subtopic}{}
5446 % for a subtopic with sub-subtopics
5447 % \tertiary {subtopic}{subsubtopic}{pagelist}
5448 % for each sub-subtopic.
5433 5449
5434 % Define the user-accessible indexing commands 5450 % Define the user-accessible indexing commands
5435 % @findex, @vindex, @kindex, @cindex. 5451 % @findex, @vindex, @kindex, @cindex.
5436 5452
5437 \def\findex {\fnindex} 5453 \def\findex {\fnindex}
5472 % it can discover if there is anything in it. 5488 % it can discover if there is anything in it.
5473 \read 1 to \thisline 5489 \read 1 to \thisline
5474 \ifeof 1 5490 \ifeof 1
5475 \putwordIndexIsEmpty 5491 \putwordIndexIsEmpty
5476 \else 5492 \else
5477 \expandafter\printindexzz{#1}\thisline\relax\relax\finish% 5493 \expandafter\printindexzz\thisline\relax\relax\finish%
5478 \fi 5494 \fi
5479 \fi 5495 \fi
5480 \closein 1 5496 \closein 1
5481 \endgroup} 5497 \endgroup}
5482 5498
5483 % If the index file starts with a backslash, forgo reading the index 5499 % If the index file starts with a backslash, forgo reading the index
5484 % file altogether. If somebody upgrades texinfo.tex they may still have 5500 % file altogether. If somebody upgrades texinfo.tex they may still have
5485 % old index files using \ as the escape character. Reading this would 5501 % old index files using \ as the escape character. Reading this would
5486 % at best lead to typesetting garbage, at worst a TeX syntax error. 5502 % at best lead to typesetting garbage, at worst a TeX syntax error.
5487 \def\printindexzz#1#2#3\finish{% 5503 \def\printindexzz#1#2\finish{%
5488 % NB this won't work if the index file starts with a group... 5504 % NB this won't work if the index file starts with a group...
5489 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#2 5505 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
5490 \message{skipping sorted index file}% 5506 \message{skipping sorted index file}%
5491 (Skipped sorted index file in obsolete format) 5507 (Skipped sorted index file in obsolete format)
5492 \else 5508 \else
5493 \begindoublecolumns 5509 \begindoublecolumns
5494 \input \jobname.#1s 5510 \input \jobname.\indexname s
5495 \enddoublecolumns 5511 \enddoublecolumns
5496 \fi 5512 \fi
5497 } 5513 }
5498 5514
5499 % These macros are used by the sorted index file itself. 5515 % These macros are used by the sorted index file itself.
5604 } 5620 }
5605 {\catcode`\@=11 5621 {\catcode`\@=11
5606 \gdef\finishentry#1{% 5622 \gdef\finishentry#1{%
5607 \egroup % end box A 5623 \egroup % end box A
5608 \dimen@ = \wd\boxA % Length of text of entry 5624 \dimen@ = \wd\boxA % Length of text of entry
5609 \global\setbox\boxA=\hbox\bgroup\unhbox\boxA 5625 \global\setbox\boxA=\hbox\bgroup
5610 % #1 is the page number. 5626 \unhbox\boxA
5611 % 5627 % #1 is the page number.
5612 % Get the width of the page numbers, and only use
5613 % leaders if they are present.
5614 \global\setbox\boxB = \hbox{#1}%
5615 \ifdim\wd\boxB = 0pt
5616 \null\nobreak\hfill\ %
5617 \else
5618 % 5628 %
5619 \null\nobreak\indexdotfill % Have leaders before the page number. 5629 % Get the width of the page numbers, and only use
5620 % 5630 % leaders if they are present.
5621 \ifpdf 5631 \global\setbox\boxB = \hbox{#1}%
5622 \pdfgettoks#1.% 5632 \ifdim\wd\boxB = 0pt
5623 \hskip\skip\thinshrinkable\the\toksA 5633 \null\nobreak\hfill\ %
5624 \else 5634 \else
5625 \ifx\XeTeXrevision\thisisundefined 5635 %
5626 \hskip\skip\thinshrinkable #1% 5636 \null\nobreak\indexdotfill % Have leaders before the page number.
5627 \else 5637 %
5638 \ifpdforxetex
5628 \pdfgettoks#1.% 5639 \pdfgettoks#1.%
5629 \hskip\skip\thinshrinkable\the\toksA 5640 \hskip\skip\thinshrinkable\the\toksA
5641 \else
5642 \hskip\skip\thinshrinkable #1%
5630 \fi 5643 \fi
5631 \fi 5644 \fi
5632 \fi
5633 \egroup % end \boxA 5645 \egroup % end \boxA
5634 \ifdim\wd\boxB = 0pt 5646 \ifdim\wd\boxB = 0pt
5635 \unhbox\boxA 5647 \noindent\unhbox\boxA\par
5648 \nobreak
5636 \else\bgroup 5649 \else\bgroup
5637 % We want the text of the entries to be aligned to the left, and the 5650 % We want the text of the entries to be aligned to the left, and the
5638 % page numbers to be aligned to the right. 5651 % page numbers to be aligned to the right.
5639 % 5652 %
5640 \parindent = 0pt 5653 \parindent = 0pt
5711 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll} 5724 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
5712 5725
5713 5726
5714 \def\primary #1{\line{#1\hfil}} 5727 \def\primary #1{\line{#1\hfil}}
5715 5728
5716 \newskip\secondaryindent \secondaryindent=0.5cm 5729 \def\secondary{\indententry{0.5cm}}
5717 \def\secondary#1#2{{% 5730 \def\tertiary{\indententry{1cm}}
5718 \parfillskip=0in 5731
5719 \parskip=0in 5732 \def\indententry#1#2#3{%
5720 \hangindent=1in 5733 \bgroup
5721 \hangafter=1 5734 \leftskip=#1
5722 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill 5735 \entry{#2}{#3}%
5723 \ifpdf 5736 \egroup
5724 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. 5737 }
5725 \else
5726 \ifx\XeTeXrevision\thisisundefined
5727 #2
5728 \else
5729 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
5730 \fi
5731 \fi
5732 \par
5733 }}
5734 5738
5735 % Define two-column mode, which we use to typeset indexes. 5739 % Define two-column mode, which we use to typeset indexes.
5736 % Adapted from the TeXbook, page 416, which is to say, 5740 % Adapted from the TeXbook, page 416, which is to say,
5737 % the manmac.tex format used to print the TeXbook itself. 5741 % the manmac.tex format used to print the TeXbook itself.
5738 \catcode`\@=11 % private names 5742 \catcode`\@=11 % private names
6692 % writing pdf. These are used in the table of contents. We can't 6696 % writing pdf. These are used in the table of contents. We can't
6693 % just write one on every page because the title pages are numbered 6697 % just write one on every page because the title pages are numbered
6694 % 1 and 2 (the page numbers aren't printed), and so are the first 6698 % 1 and 2 (the page numbers aren't printed), and so are the first
6695 % two pages of the document. Thus, we'd have two destinations named 6699 % two pages of the document. Thus, we'd have two destinations named
6696 % `1', and two named `2'. 6700 % `1', and two named `2'.
6697 \ifpdf 6701 \ifpdforxetex
6698 \global\pdfmakepagedesttrue 6702 \global\pdfmakepagedesttrue
6699 \else
6700 \ifx\XeTeXrevision\thisisundefined
6701 \else
6702 \global\pdfmakepagedesttrue
6703 \fi
6704 \fi 6703 \fi
6705 } 6704 }
6706 6705
6707 6706
6708 % These characters do not print properly in the Computer Modern roman 6707 % These characters do not print properly in the Computer Modern roman