# HG changeset patch # User Karl Berry # Date 1551650977 28800 # Node ID db8428454956beff2c9b8332ee1328dc74b3e406 # Parent 30d91797009f0834d74c2acc42941acf1a044dff autoupdate diff -r 30d91797009f -r db8428454956 build-aux/texinfo.tex --- a/build-aux/texinfo.tex Fri Mar 01 08:42:42 2019 -0800 +++ b/build-aux/texinfo.tex Sun Mar 03 14:09:37 2019 -0800 @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2019-02-28.20} +\def\texinfoversion{2019-03-02.16} % % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. @@ -258,8 +258,8 @@ % \domark is called twice inside \chapmacro, to add one % mark before the section break, and one after. -% In the second call \prevchapterdefs is the same as \lastchapterdefs, -% and \prevsectiondefs is the same as \lastsectiondefs. +% In the second call \prevchapterdefs is the same as \currentchapterdefs, +% and \prevsectiondefs is the same as \currentsectiondefs. % Then if the page is not broken at the mark, some of the previous % section appears on the page, and we can get the name of this section % from \firstmark for @everyheadingmarks top. @@ -267,11 +267,11 @@ % % See page 260 of The TeXbook. \def\domark{% - \toks0=\expandafter{\lastchapterdefs}% - \toks2=\expandafter{\lastsectiondefs}% + \toks0=\expandafter{\currentchapterdefs}% + \toks2=\expandafter{\currentsectiondefs}% \toks4=\expandafter{\prevchapterdefs}% \toks6=\expandafter{\prevsectiondefs}% - \toks8=\expandafter{\lastcolordefs}% + \toks8=\expandafter{\currentcolordefs}% \mark{% \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom @@ -288,19 +288,19 @@ % @setcolor (or @url, or @link, etc.) between @contents and the very % first @chapter. \def\gettopheadingmarks{% - \ifcase0\topmark\fi + \ifcase0\the\savedtopmark\fi \ifx\thischapter\empty \ifcase0\firstmark\fi \fi } \def\getbottomheadingmarks{\ifcase1\botmark\fi} -\def\getcolormarks{\ifcase2\topmark\fi} +\def\getcolormarks{\ifcase2\the\savedtopmark\fi} % Avoid "undefined control sequence" errors. -\def\lastchapterdefs{} -\def\lastsectiondefs{} -\def\lastsection{} +\def\currentchapterdefs{} +\def\currentsectiondefs{} +\def\currentsection{} \def\prevchapterdefs{} \def\prevsectiondefs{} -\def\lastcolordefs{} +\def\currentcolordefs{} % Margin to add to right of even pages, to left of odd pages. \newdimen\bindingoffset @@ -310,11 +310,33 @@ % Main output routine. % \chardef\PAGE = 255 -\output = {\onepageout{\pagecontents\PAGE}} +\output = {\savetopmark\onepageout{\pagecontents\PAGE}} \newbox\headlinebox \newbox\footlinebox +% When outputting the double column layout for indices, an output routine +% is run several times, which hides the original value of \topmark. This +% can lead to a page heading being output and duplicating the chapter heading +% of the index. Hence, save the contents of \topmark at the beginning of +% the output routine. The saved contents are valid until we actually +% \shipout a page. +% +% (We used to run a short output routine to actually set \topmark and +% \firstmark to the right values, but if this was called with an empty page +% containing whatsits for writing index entries, the whatsits would be thrown +% away and the index auxiliary file would remain empty.) +% +\newtoks\savedtopmark +\newif\iftopmarksaved +\topmarksavedtrue +\def\savetopmark{% + \iftopmarksaved\else + \global\savedtopmark=\expandafter{\topmark}% + \global\topmarksavedtrue + \fi +} + % \onepageout takes a vbox as an argument. % \shipout a vbox for a single page, adding an optional header, footer % and footnote. This also causes index entries for this page to be written @@ -326,23 +348,17 @@ \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % - % Common context changes for both heading and footing. - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). - \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars} - % % Retrieve the information for the headings from the marks in the page, % and call Plain TeX's \makeheadline and \makefootline, which use the % values in \headline and \footline. % % This is used to check if we are on the first page of a chapter. - \ifcase1\topmark\fi + \ifcase1\the\savedtopmark\fi \let\prevchaptername\thischaptername \ifcase0\firstmark\fi \let\curchaptername\thischaptername % \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi - \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi % \ifx\curchaptername\prevchaptername \let\thischapterheading\thischapter @@ -353,7 +369,14 @@ \def\thischapterheading{}% \fi % + % Common context changes for both heading and footing. + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars} + % \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}% + % + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}% % {% @@ -384,8 +407,9 @@ \unvbox\footlinebox \fi % - }% end of \shipout\vbox - }% end of group with \indexdummies + }% + }% + \global\topmarksavedfalse \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } @@ -1161,7 +1185,7 @@ % Set color, and create a mark which defines \thiscolor accordingly, % so that \makeheadline knows which color to restore. \def\setcolor#1{% - \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% \domark \pdfsetcolor{#1}% } @@ -1169,7 +1193,7 @@ \def\maincolor{\rgbBlack} \pdfsetcolor{\maincolor} \edef\thiscolor{\maincolor} - \def\lastcolordefs{} + \def\currentcolordefs{} % \def\makefootline{% \baselineskip24pt @@ -1547,7 +1571,7 @@ % Set color, and create a mark which defines \thiscolor accordingly, % so that \makeheadline knows which color to restore. \def\setcolor#1{% - \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}% \domark \pdfsetcolor{#1}% } @@ -1555,7 +1579,7 @@ \def\maincolor{\rgbBlack} \pdfsetcolor{\maincolor} \edef\thiscolor{\maincolor} - \def\lastcolordefs{} + \def\currentcolordefs{} % \def\makefootline{% \baselineskip24pt @@ -5255,9 +5279,6 @@ @gdef@useindexbackslash{@def\{{@indexbackslash}}} } -% Definition for writing index entry text. -\def\sortas#1{}% - % Definition for writing index entry sort key. { \catcode`\-=13 @@ -5269,6 +5290,67 @@ \xdef\indexsortkey{#1}\endgroup} } +% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}": +% * Set \bracedtext to "{aaa}{bbb}" +% * Set \fullindexsortkey to "aaa @subentry ZZZ" +% +\def\splitindexentry#1{% + \gdef\fullindexsortkey{}% + \xdef\bracedtext{}% + \def\sep{}% + \expandafter\doindexsegment#1\subentry\finish\subentry +} + +% append the results from the next segment +\def\doindexsegment#1\subentry{% + \def\segment{#1}% + \ifx\segment\isfinish + \else + % + % Fully expand the segment, throwing away any @sortas directives, and + % trim spaces. + \def\sortas##1{}% + \edef\trimmed{\segment}% + \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% + % + \xdef\bracedtext{\bracedtext{\trimmed}}% + % + % Get the string to sort by. Process the segment with all + % font commands turned off. + \bgroup + \let\sortas\indexwritesortas + \indexnofonts + % The braces around the commands are recognized by texindex. + \def\lbracechar{{\indexlbrace}}% + \def\rbracechar{{\indexrbrace}}% + \let\{=\lbracechar + \let\}=\rbracechar + % + \let\indexsortkey\empty + % Execute the segment and throw away the typeset output. This executes + % any @sortas commands in this segment. + \setbox\dummybox = \hbox{\segment}% + \ifx\indexsortkey\empty{% + \indexnonalnumdisappear + \xdef\trimmed{\segment}% + \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% + \xdef\indexsortkey{\trimmed}% + \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi + }\fi + % + % Append to \fullindexsortkey. + \edef\tmp{\gdef\noexpand\fullindexsortkey{% + \fullindexsortkey\sep\indexsortkey}}% + \tmp + \egroup + \def\sep{\subentry}% + % + \expandafter\doindexsegment + \fi +} +\def\isfinish{\finish}% + +\let\subentry\relax % Write the entry in \toks0 to the index file. % @@ -5282,24 +5364,10 @@ \indexdummies % Must do this here, since \bf, etc expand at this stage \useindexbackslash % \indexbackslash isn't defined now so it will be output % as is; and it will print as backslash. - % The braces around \indexbrace are recognized by texindex. - % - % Get the string to sort by, by processing the index entry with all - % font commands turned off. - {\indexnofonts - \def\lbracechar{{\indexlbrace}}% - \def\rbracechar{{\indexrbrace}}% - \let\{=\lbracechar - \let\}=\rbracechar - \indexnonalnumdisappear - \xdef\indexsortkey{}% - \let\sortas=\indexwritesortas - \setbox\dummybox = \hbox{\indextext}% Execute any \sortas - \ifx\indexsortkey\empty - \xdef\indexsortkey{\indextext}% - \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi - \fi - }% + % + % Split the entry into primary entry and any subentries, and get the index + % sort key. + \splitindexentry\indextext % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write @@ -5307,13 +5375,9 @@ % subentry case), texindex reduces to two when writing the .??s % sorted result. % - % Fully expand the text of the index entry and trim spaces. - \edef\indextext{\indextext}% - \edef\indextext{\expandafter\eatspaces\expandafter{\indextext}}% - \toks0=\expandafter{\indextext}% \edef\temp{% \write\writeto{% - \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}% + \string\entry{\fullindexsortkey}{\noexpand\folio}\bracedtext}% }% \temp } @@ -5789,34 +5853,13 @@ \newbox\partialpage \newdimen\doublecolumnhsize -% Use inside an output routine to save \topmark and \firstmark -\def\savemarks{% - \global\savedtopmark=\expandafter{\topmark }% - \global\savedfirstmark=\expandafter{\firstmark }% -} -\newtoks\savedtopmark -\newtoks\savedfirstmark - -% Set \topmark and \firstmark for next time \output runs. -% Can't be run from withinside \output (because any material -% added while an output routine is active, including -% penalties, is saved for after it finishes). The page so far -% should be empty, otherwise what's on it will be thrown away. -\def\restoremarks{% - \mark{\the\savedtopmark}% - \bgroup\output = {% - \setbox\dummybox=\box\PAGE - }abc\eject\egroup - % "abc" because output routine doesn't fire for a completely empty page. - \mark{\the\savedfirstmark}% -} - \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % If not much space left on page, start a new page. \ifdim\pagetotal>0.8\vsize\vfill\eject\fi % % Grab any single-column material above us. \output = {% + \savetopmark % % Here is a possibility not foreseen in manmac: if we accumulate a % whole lot of material, we might end up calling this \output @@ -5834,15 +5877,8 @@ \unvbox\PAGE \kern-\topskip \kern\baselineskip }% - \savemarks }% \eject % run that output routine to set \partialpage - \restoremarks - % - % We recover the two marks that the last output routine saved in order - % to propagate the information in marks added around a chapter heading, - % which could be otherwise be lost by the time the final page is output. - % % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% @@ -5883,6 +5919,7 @@ % \def\doublecolumnout{% % + \savetopmark \splittopskip=\topskip \splitmaxdepth=\maxdepth \dimen@ = \vsize \divide\dimen@ by 2 @@ -5938,7 +5975,7 @@ % \output = {% % Split the last of the double-column material. - \savemarks + \savetopmark \balancecolumns }% \eject % call the \output just set @@ -5949,7 +5986,6 @@ \global\output = {\onepageout{\pagecontents\PAGE}}% % \endgroup % started in \begindoublecolumns - \restoremarks % Leave the double-column material on the current page, no automatic % page break. \box\balancedcolumns @@ -6464,27 +6500,22 @@ \expandafter\ifx\thisenv\titlepage\else \checkenv{}% chapters, etc., should not start inside an environment. \fi - % FIXME: \chapmacro is currently called from inside \titlepage when - % \setcontentsaftertitlepage to print the "Table of Contents" heading, but - % this should probably be done by \sectionheading with an option to print - % in chapter size. - % % Insert the first mark before the heading break (see notes for \domark). - \let\prevchapterdefs=\lastchapterdefs - \let\prevsectiondefs=\lastsectiondefs - \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \let\prevchapterdefs=\currentchapterdefs + \let\prevsectiondefs=\currentsectiondefs + \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% \gdef\thissection{}}% % \def\temptype{#2}% \ifx\temptype\Ynothingkeyword - \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{\thischaptername}}% \else\ifx\temptype\Yomitfromtockeyword - \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{}}% \else\ifx\temptype\Yappendixkeyword \toks0={#1}% - \xdef\lastchapterdefs{% + \xdef\currentchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\appendixletter}% % \noexpand\putwordAppendix avoids expanding indigestible @@ -6495,7 +6526,7 @@ }% \else \toks0={#1}% - \xdef\lastchapterdefs{% + \xdef\currentchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\the\chapno}% % \noexpand\putwordChapter avoids expanding indigestible @@ -6515,18 +6546,18 @@ % % Now the second mark, after the heading break. No break points % between here and the heading. - \let\prevchapterdefs=\lastchapterdefs - \let\prevsectiondefs=\lastsectiondefs + \let\prevchapterdefs=\currentchapterdefs + \let\prevsectiondefs=\currentsectiondefs \domark % {% \chapfonts \rm \let\footnote=\errfootnoteheading % give better error message % - % Have to define \lastsection before calling \donoderef, because the + % Have to define \currentsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. - \gdef\lastsection{#1}% + \gdef\currentsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. @@ -6615,10 +6646,10 @@ \csname #2fonts\endcsname \rm % % Insert first mark before the heading break (see notes for \domark). - \let\prevsectiondefs=\lastsectiondefs + \let\prevsectiondefs=\currentsectiondefs \ifx\temptype\Ynothingkeyword \ifx\sectionlevel\seckeyword - \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% \gdef\thissection{\thissectionname}}% \fi \else\ifx\temptype\Yomitfromtockeyword @@ -6626,7 +6657,7 @@ \else\ifx\temptype\Yappendixkeyword \ifx\sectionlevel\seckeyword \toks0={#1}% - \xdef\lastsectiondefs{% + \xdef\currentsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible @@ -6639,7 +6670,7 @@ \else \ifx\sectionlevel\seckeyword \toks0={#1}% - \xdef\lastsectiondefs{% + \xdef\currentsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible @@ -6665,28 +6696,28 @@ % % Now the second mark, after the heading break. No break points % between here and the heading. - \global\let\prevsectiondefs=\lastsectiondefs + \global\let\prevsectiondefs=\currentsectiondefs \domark % % Only insert the space after the number if we have a section number. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% - \gdef\lastsection{#1}% + \gdef\currentsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, - % and don't redefine \lastsection. + % and don't redefine \currentsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% - \gdef\lastsection{#1}% + \gdef\currentsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% - \gdef\lastsection{#1}% + \gdef\currentsection{#1}% \fi\fi\fi % % Write the toc entry (before \donoderef). See comments in \chapmacro. @@ -8750,7 +8781,7 @@ % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: -% 1) NAME-title - the current sectioning name taken from \lastsection, +% 1) NAME-title - the current sectioning name taken from \currentsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. @@ -8772,7 +8803,7 @@ \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% - \toks0 = \expandafter{\lastsection}% + \toks0 = \expandafter{\currentsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout @@ -9570,13 +9601,13 @@ \global\advance\floatno by 1 % {% - % This magic value for \lastsection is output by \setref as the + % This magic value for \currentsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % - \edef\lastsection{\floatmagic=\safefloattype}% + \edef\currentsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi @@ -9699,7 +9730,7 @@ % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic -% \lastsection value which we \setref above. +% \currentsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} %