Mercurial > gnulib
comparison build-aux/texinfo.tex @ 40209:c43e83386661
autoupdate
author | Karl Berry <karl@freefriends.org> |
---|---|
date | Fri, 08 Mar 2019 09:27:47 -0800 |
parents | 053dfcf64bef |
children | bb9e295185c8 |
comparison
equal
deleted
inserted
replaced
40208:f746878ee9be | 40209:c43e83386661 |
---|---|
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-03.15} | 6 \def\texinfoversion{2019-03-07.19} |
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 |
386 % Have to do this stuff outside the \shipout because we want it to | 386 % Have to do this stuff outside the \shipout because we want it to |
387 % take effect in \write's, yet the group defined by the \vbox ends | 387 % take effect in \write's, yet the group defined by the \vbox ends |
388 % before the \shipout runs. | 388 % before the \shipout runs. |
389 % | 389 % |
390 \indexdummies % don't expand commands in the output. | 390 \indexdummies % don't expand commands in the output. |
391 \normalturnoffactive % \ in index entries must not stay \, e.g., if | 391 \turnoffactive |
392 % the page break happens to be in the middle of an example. | |
393 % We don't want .vr (or whatever) entries like this: | |
394 % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}} | |
395 % "\acronym" won't work when it's read back in; | |
396 % it needs to be | |
397 % {\code {{\backslashcurfont }acronym} | |
398 \shipout\vbox{% | 392 \shipout\vbox{% |
399 % Do this early so pdf references go to the beginning of the page. | 393 % Do this early so pdf references go to the beginning of the page. |
400 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi | 394 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi |
401 % | 395 % |
402 \unvbox\headlinebox | 396 \unvbox\headlinebox |
4860 | 4854 |
4861 % Used when writing an index entry out to an index file to prevent | 4855 % Used when writing an index entry out to an index file to prevent |
4862 % expansion of Texinfo commands that can appear in an index entry. | 4856 % expansion of Texinfo commands that can appear in an index entry. |
4863 % | 4857 % |
4864 \def\indexdummies{% | 4858 \def\indexdummies{% |
4865 \escapechar = `\\ % use backslash in output files. | |
4866 \definedummyletter\@% | 4859 \definedummyletter\@% |
4867 \definedummyletter\ % | 4860 \definedummyletter\ % |
4868 % | 4861 % |
4869 % For texindex which always views { and } as separators. | 4862 % For texindex which always views { and } as separators. |
4870 \def\{{\lbracechar{}}% | 4863 \def\{{\lbracechar{}}% |
4871 \def\}{\rbracechar{}}% | 4864 \def\}{\rbracechar{}}% |
4872 % | 4865 % |
4873 % Do the redefinitions. | 4866 % Do the redefinitions. |
4874 \definedummies | 4867 \definedummies |
4868 \otherbackslash | |
4875 } | 4869 } |
4876 | 4870 |
4877 % Used for the aux and toc files, where @ is the escape character. | 4871 % Used for the aux and toc files, where @ is the escape character. |
4878 % | 4872 % |
4879 \def\atdummies{% | 4873 \def\atdummies{% |
5068 \commondummyword\verb | 5062 \commondummyword\verb |
5069 \commondummyword\w | 5063 \commondummyword\w |
5070 \commondummyword\xref | 5064 \commondummyword\xref |
5071 } | 5065 } |
5072 | 5066 |
5073 % This does nothing, but for a time it was recommended to use | |
5074 % \usebracesinindexestrue to be able to use braces in index entries. | |
5075 | |
5076 \let\indexlbrace\relax | 5067 \let\indexlbrace\relax |
5077 \let\indexrbrace\relax | 5068 \let\indexrbrace\relax |
5069 \let\indexatchar\relax | |
5078 | 5070 |
5079 {\catcode`\@=0 | 5071 {\catcode`\@=0 |
5080 \catcode`\\=13 | 5072 \catcode`\\=13 |
5081 @gdef@backslashdisappear{@def\{}} | 5073 @gdef@backslashdisappear{@def\{}} |
5082 } | 5074 } |
5106 \def\@{}% | 5098 \def\@{}% |
5107 \fi | 5099 \fi |
5108 } | 5100 } |
5109 | 5101 |
5110 \gdef\indexnonalnumreappear{% | 5102 \gdef\indexnonalnumreappear{% |
5111 \useindexbackslash | |
5112 \let-\normaldash | 5103 \let-\normaldash |
5113 \let<\normalless | 5104 \let<\normalless |
5114 \def\@{@}% | |
5115 } | 5105 } |
5116 } | 5106 } |
5117 | 5107 |
5118 | 5108 |
5119 % \indexnofonts is used when outputting the strings to sort the index | 5109 % \indexnofonts is used when outputting the strings to sort the index |
5253 % preceding skips. | 5243 % preceding skips. |
5254 \typeout{Writing index file \jobname.\suffix}% | 5244 \typeout{Writing index file \jobname.\suffix}% |
5255 \fi} | 5245 \fi} |
5256 \def\indexisfl{fl} | 5246 \def\indexisfl{fl} |
5257 | 5247 |
5258 % Output \ as {\indexbackslash}, because \ is an escape character in | |
5259 % the index files. | |
5260 \let\indexbackslash=\relax | |
5261 {\catcode`\@=0 \catcode`\\=\active | |
5262 @gdef@useindexbackslash{@def\{{@indexbackslash}}} | |
5263 } | |
5264 | |
5265 % Definition for writing index entry sort key. | 5248 % Definition for writing index entry sort key. |
5266 { | 5249 { |
5267 \catcode`\-=13 | 5250 \catcode`\-=13 |
5268 \gdef\indexwritesortas{% | 5251 \gdef\indexwritesortas{% |
5269 \begingroup | 5252 \begingroup |
5306 % The braces around the commands are recognized by texindex. | 5289 % The braces around the commands are recognized by texindex. |
5307 \def\lbracechar{{\indexlbrace}}% | 5290 \def\lbracechar{{\indexlbrace}}% |
5308 \def\rbracechar{{\indexrbrace}}% | 5291 \def\rbracechar{{\indexrbrace}}% |
5309 \let\{=\lbracechar | 5292 \let\{=\lbracechar |
5310 \let\}=\rbracechar | 5293 \let\}=\rbracechar |
5294 \def\@{{\indexatchar}}% | |
5295 \def\atchar##1{\@}% | |
5311 % | 5296 % |
5312 \let\indexsortkey\empty | 5297 \let\indexsortkey\empty |
5313 % Execute the segment and throw away the typeset output. This executes | 5298 % Execute the segment and throw away the typeset output. This executes |
5314 % any @sortas commands in this segment. | 5299 % any @sortas commands in this segment. |
5315 \setbox\dummybox = \hbox{\segment}% | 5300 \setbox\dummybox = \hbox{\segment}% |
5343 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% | 5328 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% |
5344 \fi | 5329 \fi |
5345 % | 5330 % |
5346 % Remember, we are within a group. | 5331 % Remember, we are within a group. |
5347 \indexdummies % Must do this here, since \bf, etc expand at this stage | 5332 \indexdummies % Must do this here, since \bf, etc expand at this stage |
5348 \useindexbackslash % \indexbackslash isn't defined now so it will be output | |
5349 % as is; and it will print as backslash. | |
5350 % | 5333 % |
5351 % Split the entry into primary entry and any subentries, and get the index | 5334 % Split the entry into primary entry and any subentries, and get the index |
5352 % sort key. | 5335 % sort key. |
5353 \splitindexentry\indextext | 5336 \splitindexentry\indextext |
5354 % | 5337 % |
5477 \smallfonts \rm | 5460 \smallfonts \rm |
5478 \tolerance = 9500 | 5461 \tolerance = 9500 |
5479 \plainfrenchspacing | 5462 \plainfrenchspacing |
5480 \everypar = {}% don't want the \kern\-parindent from indentation suppression. | 5463 \everypar = {}% don't want the \kern\-parindent from indentation suppression. |
5481 % | 5464 % |
5482 % See if the index file exists and is nonempty. | |
5483 % Change catcode of @ here so that if the index file contains | |
5484 % \initial {@} | |
5485 % as its first line, TeX doesn't complain about mismatched braces | |
5486 % (because it thinks @} is a control sequence). | |
5487 \catcode`\@ = 12 | |
5488 % See comment in \requireopenindexfile. | 5465 % See comment in \requireopenindexfile. |
5489 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi | 5466 \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi |
5467 % | |
5468 % See if the index file exists and is nonempty. | |
5490 \openin 1 \jobname.\indexname s | 5469 \openin 1 \jobname.\indexname s |
5491 \ifeof 1 | 5470 \ifeof 1 |
5492 % \enddoublecolumns gets confused if there is no text in the index, | 5471 % \enddoublecolumns gets confused if there is no text in the index, |
5493 % and it loses the chapter title and the aux file entries for the | 5472 % and it loses the chapter title and the aux file entries for the |
5494 % index. The easiest way to prevent this problem is to make sure | 5473 % index. The easiest way to prevent this problem is to make sure |
5495 % there is some text. | 5474 % there is some text. |
5496 \putwordIndexNonexistent | 5475 \putwordIndexNonexistent |
5497 \typeout{No file \jobname.\indexname s.}% | 5476 \typeout{No file \jobname.\indexname s.}% |
5498 \else | 5477 \else |
5499 \catcode`\\ = 0 | |
5500 % | |
5501 % If the index file exists but is empty, then \openin leaves \ifeof | 5478 % If the index file exists but is empty, then \openin leaves \ifeof |
5502 % false. We have to make TeX try to read something from the file, so | 5479 % false. We have to make TeX try to read something from the file, so |
5503 % it can discover if there is anything in it. | 5480 % it can discover if there is anything in it. |
5504 \read 1 to \thisline | 5481 \read 1 to \thisline |
5505 \ifeof 1 | 5482 \ifeof 1 |
5506 \putwordIndexIsEmpty | 5483 \putwordIndexIsEmpty |
5507 \else | 5484 \else |
5508 % Index files are almost Texinfo source, but we use \ as the escape | 5485 \expandafter\printindexzz\thisline\relax\relax\finish% |
5509 % character. It would be better to use @, but that's too big a change | |
5510 % to make right now. | |
5511 \def\indexbackslash{\ttbackslash}% | |
5512 \let\indexlbrace\{ % Likewise, set these sequences for braces | |
5513 \let\indexrbrace\} % used in the sort key. | |
5514 \begindoublecolumns | |
5515 \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty | |
5516 % | |
5517 % Read input from the index file line by line. | |
5518 \loopdo | |
5519 \ifeof1 \else | |
5520 \read 1 to \nextline | |
5521 \fi | |
5522 % | |
5523 \indexinputprocessing | |
5524 \thisline | |
5525 % | |
5526 \ifeof1\else | |
5527 \let\thisline\nextline | |
5528 \repeat | |
5529 %% | |
5530 \enddoublecolumns | |
5531 \fi | 5486 \fi |
5532 \fi | 5487 \fi |
5533 \closein 1 | 5488 \closein 1 |
5534 \endgroup} | 5489 \endgroup} |
5535 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx} | 5490 \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx} |
5536 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next} | 5491 \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next} |
5492 | |
5493 % If the index file starts with a backslash, forgo reading the index | |
5494 % file altogether. If somebody upgrades texinfo.tex they may still have | |
5495 % old index files using \ as the escape character. Reading this would | |
5496 % at best lead to typesetting garbage, at worst a TeX syntax error. | |
5497 \def\printindexzz#1#2\finish{% | |
5498 % NB this won't work if the index file starts with a group... | |
5499 \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1 | |
5500 \message{skipping sorted index file}% | |
5501 (Skipped sorted index file in obsolete format) | |
5502 \else | |
5503 \printindexzzz | |
5504 \fi | |
5505 } | |
5506 | |
5507 \def\printindexzzz{% | |
5508 \begindoublecolumns | |
5509 \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty | |
5510 % | |
5511 % Read input from the index file line by line. | |
5512 \loopdo | |
5513 \ifeof1 \else | |
5514 \read 1 to \nextline | |
5515 \fi | |
5516 % | |
5517 \indexinputprocessing | |
5518 \thisline | |
5519 % | |
5520 \ifeof1\else | |
5521 \let\thisline\nextline | |
5522 \repeat | |
5523 %% | |
5524 \enddoublecolumns | |
5525 } | |
5537 | 5526 |
5538 \def\indexinputprocessing{% | 5527 \def\indexinputprocessing{% |
5539 \ifeof1 | 5528 \ifeof1 |
5540 \let\firsttoken\relax | 5529 \let\firsttoken\relax |
5541 \else | 5530 \else |
5552 | 5541 |
5553 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 | 5542 {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 |
5554 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 | 5543 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 |
5555 \catcode`\$=3 | 5544 \catcode`\$=3 |
5556 \gdef\initialglyphs{% | 5545 \gdef\initialglyphs{% |
5546 % special control sequences used in the index sort key | |
5547 \let\indexlbrace\{% | |
5548 \let\indexrbrace\}% | |
5549 \let\indexatchar\@% | |
5550 % | |
5557 % Some changes for non-alphabetic characters. Using the glyphs from the | 5551 % Some changes for non-alphabetic characters. Using the glyphs from the |
5558 % math fonts looks more consistent than the typewriter font used elsewhere | 5552 % math fonts looks more consistent than the typewriter font used elsewhere |
5559 % for these characters. | 5553 % for these characters. |
5560 \def\indexbackslash{\math{\backslash}}% | 5554 \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}} |
5561 \let\\=\indexbackslash | 5555 % |
5562 % | 5556 % In case @\ is used for backslash |
5557 \uppercase{\let\\=~} | |
5563 % Can't get bold backslash so don't use bold forward slash | 5558 % Can't get bold backslash so don't use bold forward slash |
5564 \catcode`\/=13 | 5559 \catcode`\/=13 |
5565 \def/{{\secrmnotbold \normalslash}}% | 5560 \def/{{\secrmnotbold \normalslash}}% |
5566 \def-{{\normaldash\normaldash}}% en dash `--' | 5561 \def-{{\normaldash\normaldash}}% en dash `--' |
5567 \def^{{\chapbf \normalcaret}}% | 5562 \def^{{\chapbf \normalcaret}}% |