diff options
Diffstat (limited to 'doc/texinfo.tex')
-rw-r--r-- | doc/texinfo.tex | 1262 |
1 files changed, 425 insertions, 837 deletions
diff --git a/doc/texinfo.tex b/doc/texinfo.tex index 347f8639..152e9853 100644 --- a/doc/texinfo.tex +++ b/doc/texinfo.tex @@ -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{2015-09-23.01} +\def\texinfoversion{2015-05-06.11} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -196,6 +196,17 @@ wide-spread wrap-around } +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt } + % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make @@ -240,15 +251,6 @@ \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} -% Output routine -% - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt } - % Do @cropmarks to get crop marks. % \newif\ifcropmarks @@ -275,7 +277,6 @@ % described on page 260 of The TeXbook. It involves outputting two % marks for the sectioning macros, one before the section break, and % one after. I won't pretend I can describe this better than DEK... -% \def\domark{% \toks0=\expandafter{\lastchapterdefs}% \toks2=\expandafter{\lastsectiondefs}% @@ -288,9 +289,6 @@ \noexpand\else \the\toks8 % 2: color marks }% } - -% \gettopheadingmarks, \getbottomheadingmarks - extract needed part of mark. -% % \topmark doesn't work for the very first chapter (after the title % page or the contents), so we use \firstmark there -- this gets us % the mark with the chapter defs, unless the user sneaks in, e.g., @@ -306,74 +304,36 @@ % Avoid "undefined control sequence" errors. \def\lastchapterdefs{} \def\lastsectiondefs{} -\def\lastsection{} \def\prevchapterdefs{} \def\prevsectiondefs{} \def\lastcolordefs{} -% Margin to add to right of even pages, to left of odd pages. -\newdimen\bindingoffset -\newdimen\normaloffset -\newdimen\pagewidth \newdimen\pageheight - % Main output routine. -% \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} \newbox\headlinebox \newbox\footlinebox -% \onepageout takes a vbox as an argument. -% \shipout a vbox for a single page, adding an optional header, footer, -% cropmarks, and footnote. This also causes index entries for this page -% to be written to the auxiliary files. -% +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. \def\onepageout#1{% \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi % \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=\pagewidth \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. - \ifcase0\topmark\fi - \ifx\thischapter\empty - % See comment for \gettopheadingmarks - \ifcase0\firstmark\fi - \let\curchaptername\thischaptername - \ifcase1\firstmark\fi - \let\prevchaptername\thischaptername - \else - \let\curchaptername\thischaptername - \ifcase1\topmark\fi - \let\prevchaptername\thischaptername - \fi - % \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi - \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi - % - \ifx\curchaptername\prevchaptername - \else - % If on the first page of a chapter, clear @thischapter so it - % doesn't appear in the headline, because the chapter is already - % shown in the chapter heading. - \def\thischapter{}% - \fi - % \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}% + % + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}% % {% - % Set context for writing to auxiliary files like index files. % Have to do this stuff outside the \shipout because we want it to % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. @@ -382,10 +342,10 @@ \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. % We don't want .vr (or whatever) entries like this: - % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}} + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} % "\acronym" won't work when it's read back in; % it needs to be - % {\code {{\backslashcurfont }acronym} + % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi @@ -443,7 +403,6 @@ \newinsert\margin \dimen\margin=\maxdimen -% Main part of page, including any footnotes \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} {\catcode`\@ =11 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi @@ -466,13 +425,9 @@ \def\nsbot{\vbox {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Argument parsing - % Parse an argument, then pass it to #1. The argument is the rest of % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. -% For example, \def\foo{\parsearg\fooxxx}. % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% @@ -491,11 +446,9 @@ }% } -% First remove any @comment, then any @c comment. Also remove a @texinfoc -% comment (see \scanmacro for details). Pass the result on to \argcheckspaces. +% First remove any @comment, then any @c comment. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} -\def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm} -\def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space. % @@ -727,12 +680,6 @@ \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. - \addgroupbox - \prevdepth = \dimen1 - \checkinserts -} - -\def\addgroupbox{ % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). @@ -745,8 +692,9 @@ \fi \fi \box\groupbox + \prevdepth = \dimen1 + \checkinserts } - % % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. @@ -989,20 +937,12 @@ where each line of input produces a line of output.} % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment % -\def\comment{\begingroup \catcode`\^^M=\active% -\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other\commentxxx}% - -{\catcode`\^^M=\active% -\gdef\commentxxx#1^^M{\endgroup% -\futurelet\nexttoken\commentxxxx}% -\gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}% -} - -\def\c{\begingroup \catcode`\^^M=\active% +\def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% -\cxxx} -{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}} -% See comment in \scanmacro about why the definitions of @c and @comment differ +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} +% +\let\c=\comment % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. @@ -1088,8 +1028,45 @@ where each line of input produces a line of output.} % @refill is a no-op. \let\refill=\relax -% @setfilename INFO-FILENAME - ignored -\let\setfilename=\comment +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} % @bye. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} @@ -1843,10 +1820,8 @@ end % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1}{OT1} \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} -\setfont\defsl\slshape{10}{\magstep1}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf -\let\tenttsl=\defttsl \let\tensl=\defsl \bf} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} @@ -1907,7 +1882,6 @@ end % Section fonts (14.4pt). \def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1}{OT1} -\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1} \setfont\secit\itbshape{10}{\magstep2}{OT1IT} \setfont\secsl\slbshape{10}{\magstep2}{OT1} \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} @@ -1977,10 +1951,8 @@ end % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstephalf}{OT1} \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} -\setfont\defsl\slshape{10}{\magstephalf}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf -\let\tensl=\defsl \let\tenttsl=\defttsl \bf} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} @@ -2799,6 +2771,11 @@ end % \def\dmn#1{\thinspace #1} +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. @@ -2902,6 +2879,9 @@ end \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi} \def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}% +% ctrl is no longer a Texinfo command, but leave this definition for fun. +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, % except specified as a normal braced arg, so no newlines to worry about. @@ -3215,15 +3195,8 @@ end \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} % -% Use the European Computer Modern fonts (cm-super in outline format) -% for non-CM glyphs. That is ec* for regular text and tc* for the text -% companion symbols (LaTeX TS1 encoding). Both are part of the ec -% package and follow the same conventions. -% -\def\ecfont{\etcfont{e}} -\def\tcfont{\etcfont{t}} -% -\def\etcfont#1{% +% Use the ec* fonts (cm-super in outline format) for non-CM glyphs. +\def\ecfont{% % We can't distinguish serif/sans and italic/slanted, but this % is used for crude hacks anyway (like adding French and German % quotes to documents typeset with CM, where we lose kerning), so @@ -3232,14 +3205,14 @@ end \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% \ifmonospace % typewriter: - \font\thisecfont = #1ctt\ecsize \space at \nominalsize + \font\thisecfont = ectt\ecsize \space at \nominalsize \else \ifx\curfontstyle\bfstylename % bold: - \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize \else % regular: - \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize \fi \fi \thisecfont @@ -3409,7 +3382,7 @@ end \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages -% Now make \makeheadline and \makefootline in Plain TeX use those variables +% Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline @@ -3465,10 +3438,6 @@ end % @everyheadingmarks % @everyfootingmarks -% These define \getoddheadingmarks, \getevenheadingmarks, -% \getoddfootingmarks, and \getevenfootingmarks, each to one of -% \gettopheadingmarks, \getbottomheadingmarks. -% \def\evenheadingmarks{\headingmarks{even}{heading}} \def\oddheadingmarks{\headingmarks{odd}{heading}} \def\evenfootingmarks{\headingmarks{even}{footing}} @@ -3758,12 +3727,7 @@ end \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% % - \ifinner\else - \vadjust{\penalty 1200}% not good to break after first line of item. - \fi - % We can be in inner vertical mode in a footnote, although an - % @itemize looks awful there. - }% + \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } @@ -4385,16 +4349,19 @@ end % except not \outer, so it can be used within macros and \if's. \edef\newwrite{\makecsname{ptexnewwrite}} -% \newindex {foo} defines an index named IX. -% It automatically defines \IXindex such that -% \IXindex ...rest of line... puts an entry in the index IX. -% It also defines \IXindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is IX. +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. % The name of an index should be no more than 2 characters long % for the sake of vms. % \def\newindex#1{% - \expandafter\chardef\csname#1indfile\endcsname=0 + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi \expandafter\xdef\csname#1index\endcsname{% % Define @#1index \noexpand\doindex{#1}} } @@ -4408,19 +4375,14 @@ end \def\defcodeindex{\parsearg\newcodeindex} % \def\newcodeindex#1{% - \expandafter\chardef\csname#1indfile\endcsname=0 + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi \expandafter\xdef\csname#1index\endcsname{% \noexpand\docodeindex{#1}}% } -% The default indices: -\newindex{cp}% concepts, -\newcodeindex{fn}% functions, -\newcodeindex{vr}% variables, -\newcodeindex{tp}% types, -\newcodeindex{ky}% keys -\newcodeindex{pg}% and programs. - % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. @@ -4449,19 +4411,26 @@ end \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } -% Define \doindex, the driver for all index macros. +% Define \doindex, the driver for all \fooindex macros. % Argument #1 is generated by the calling \fooindex macro, -% and it the two-letter name of the index. +% and it is "foo", the name of the index. -\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx} -\def\doindexxxx #1{\doind{\indexname}{#1}} +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} % like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} -\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}} +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} -% Used when writing an index entry out to an index file, to prevent -% expansion of Texinfo commands that can appear in an index entry. +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. % \def\indexdummies{% \escapechar = `\\ % use backslash in output files. @@ -4477,6 +4446,31 @@ end \def\{{{\tt\char123}}% \def\}{{\tt\char125}}% % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % This is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} + % + % So: + \let\endinput = \empty + % % Do the redefinitions. \commondummies } @@ -4683,39 +4677,11 @@ end % that we make for arg2 (see \parsemargdef ff.). We want all this to be % expanded for the sake of the index, so we end up just seeing "bar". \let\xeatspaces = \eatspaces - \let\xprocessmacroarg\eatspaces } % For testing: output @{ and @} in index sort strings as \{ and \}. \newif\ifusebracesinindexes -\let\indexlbrace\relax -\let\indexrbrace\relax - -{\catcode`\@=0 -\catcode`\\=13 - @gdef@backslashdisappear{@def\{}} -} - -{ -\catcode`\<=13 -\catcode`\-=13 - \gdef\indexnonalnumdisappear{% - \backslashdisappear - \def-{}% - \def<{}% - \def\@{}% - } - - \gdef\indexnonalnumreappear{% - \useindexbackslash - \let-\normaldash - \let<\normalless - \def\@{@}% - } -} - - % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string @@ -4741,10 +4707,16 @@ end \def\_{\normalunderscore}% \def\-{}% @- shouldn't affect sorting % - % Unfortunately, texindex < 6.0 is not prepared to handle braces in the - % content at all, so these won't be sorted in ASCII order. - \def\lbracechar{{\indexlbrace}}% - \def\rbracechar{{\indexrbrace}}% + % Unfortunately, texindex is not prepared to handle braces in the + % content at all. So for index sorting, we map @{ and @} to strings + % starting with |, since that ASCII character is between ASCII { and }. + \ifusebracesinindexes + \def\lbracechar{\lbracecmd}% + \def\rbracechar{\rbracecmd}% + \else + \def\lbracechar{|a}% + \def\rbracechar{|b}% + \fi \let\{=\lbracechar \let\}=\rbracechar % @@ -4756,7 +4728,7 @@ end \def\L{L}% \def\OE{OE}% \def\O{O}% - \def\TH{TH}% + \def\TH{ZZZ}% \def\aa{aa}% \def\ae{ae}% \def\dh{dzz}% @@ -4768,7 +4740,7 @@ end \def\o{o}% \def\questiondown{?}% \def\ss{ss}% - \def\th{th}% + \def\th{zzz}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% @@ -4826,17 +4798,14 @@ end {\catcode`\`=\active \gdef\indexlquoteignore{\let`=\empty}} +\let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? % Most index entries go through here, but \dosubind is the general case. % #1 is the index name, #2 is the entry text. \def\doind#1#2{\dosubind{#1}{#2}{}} -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. -% TODO: Two-level index? Operation index? - -% Workhorse for all indexes. +% Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- % empty if called from \doind, as we usually are (the main exception % is with most defuns, which call us directly). @@ -4844,7 +4813,6 @@ end \def\dosubind#1#2#3{% \iflinks {% - \requireopenindexfile{#1}% % Store the main index entry text (including the third arg). \toks0 = {#2}% % If third arg is present, precede it with a space. @@ -4860,49 +4828,7 @@ end \fi } -% Check if an index file has been opened, and if not, open it. -\def\requireopenindexfile#1{% -\ifnum\csname #1indfile\endcsname=0 - \expandafter\newwrite \csname#1indfile\endcsname - \edef\suffix{#1}% - % A .fls suffix would conflict with the file extension for the output - % of -recorder, so use .f1s instead. - \ifx\suffix\indexisfl\def\suffix{f1}\fi - % Open the file - \immediate\openout\csname#1indfile\endcsname \jobname.\suffix - % Using \immediate here prevents an object entering into the current box, - % which could confound checks such as those in \safewhatsit for preceding - % skips. -\fi} -\def\indexisfl{fl} - -% Output \ as {\indexbackslash}, because \ is an escape character in -% the index files. -\let\indexbackslash=\relax -{\catcode`\@=0 \catcode`\\=\active - @gdef@useindexbackslash{@def\{{@indexbackslash}}} -} - -% Definition for writing index entry text. -\def\sortas#1{\ignorespaces}% - -% Definition for writing index entry sort key. Should occur at the at -% the beginning of the index entry, like -% @cindex @sortas{september} \september -% The \ignorespaces takes care of following space, but there's no way -% to remove space before it. -{ -\catcode`\-=13 -\gdef\indexwritesortas{% - \begingroup - \indexnonalnumreappear - \indexwritesortasxxx} -\gdef\indexwritesortasxxx#1{% - \xdef\indexsortkey{#1}\endgroup} -} - - -% Write the entry in \toks0 to the index file. +% Write the entry in \toks0 to the index file: % \def\dosubindwrite{% % Put the index entry in the margin if desired. @@ -4912,20 +4838,14 @@ end % % Remember, we are within a group. \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. - % Get the string to sort by, by processing the index entry with all - % font commands turned off. + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. {\indexnofonts - \xdef\indexsortkey{}% - \let\sortas=\indexwritesortas - \indexnonalnumdisappear - \edef\temp{\the\toks0}% - \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas - \ifx\indexsortkey\empty - \xdef\indexsortkey{\temp}% - \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi - \fi + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% }% % % Set up the complete index entry, with both the sort key and @@ -4935,11 +4855,10 @@ end % sorted result. \edef\temp{% \write\writeto{% - \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% }% \temp } -\newbox\dummybox % used above % Take care of unwanted page breaks/skips around a whatsit: % @@ -5065,9 +4984,7 @@ end % as its first line, TeX doesn't complain about mismatched braces % (because it thinks @} is a control sequence). \catcode`\@ = 11 - % See comment in \requireopenindexfile. - \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi - \openin 1 \jobname.\indexname s + \openin 1 \jobname.#1s \ifeof 1 % \enddoublecolumns gets confused if there is no text in the index, % and it loses the chapter title and the aux file entries for the @@ -5075,96 +4992,43 @@ end % there is some text. \putwordIndexNonexistent \else - \catcode`\\ = 0 - \escapechar = `\\ % % If the index file exists but is empty, then \openin leaves \ifeof % false. We have to make TeX try to read something from the file, so % it can discover if there is anything in it. - \read 1 to \thisline + \read 1 to \temp \ifeof 1 \putwordIndexIsEmpty \else % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. - \def\indexbackslash{\ttbackslash}% - \let\indexlbrace\{ % Likewise, set these sequences for braces - \let\indexrbrace\} % used in the sort key. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ \begindoublecolumns - \let\entryorphanpenalty=\indexorphanpenalty - % - % Read input from the index file line by line. - \loopdo - \ifeof1 - \let\firsttoken\relax - \else - \read 1 to \nextline - \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}% - \act - \fi - \thisline - % - \ifeof1\else - \let\thisline\nextline - \repeat - %% + \input \jobname.#1s \enddoublecolumns \fi \fi \closein 1 \endgroup} -\def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken} -\long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1} - -\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx} -\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next} - % These macros are used by the sorted index file itself. % Change them to control the appearance of the index. -{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13 -\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13 -\catcode`\$=3 -\gdef\initialglyphs{% - % Some changes for non-alphabetic characters. Using the glyphs from the - % math fonts looks more consistent than the typewriter font used elsewhere - % for these characters. - \def\indexbackslash{\math{\backslash}}% - \let\\=\indexbackslash - % - % Can't get bold backslash so don't use bold forward slash - \catcode`\/=13 - \def/{{\secrmnotbold \normalslash}}% - \def-{{\normaldash\normaldash}}% en dash `--' - \def^{{\chapbf \normalcaret}}% - \def~{{\chapbf \normaltilde}}% - \def\_{% - \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }% - \def|{$\vert$}% - \def<{$\less$}% - \def>{$\gtr$}% - \def+{$\normalplus$}% -}} - -\def\initial{% - \bgroup - \initialglyphs - \initialx -} - -\def\initialx#1{% +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % % Remove any glue we may have, we'll be inserting our own. \removelastskip % % We like breaks before the index initials, so insert a bonus. - % The glue before the bonus allows a little bit of space at the - % bottom of a column to reduce an increase in inter-line spacing. \nobreak - \vskip 0pt plus 5\baselineskip - \penalty -300 - \vskip 0pt plus -5\baselineskip + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column @@ -5172,24 +5036,24 @@ end % we need before each entry, but it's better. % % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus 1\baselineskip - \leftline{\secfonts \kern-0.05em \secbf #1}% - % \secfonts is inside the argument of \leftline so that the change of - % \baselineskip will not affect any glue inserted before the vbox that - % \leftline creates. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% % Do our best not to break after the initial. \nobreak \vskip .33\baselineskip plus .1\baselineskip - \egroup % \initialglyphs -} - -\newdimen\entryrightmargin -\entryrightmargin=0pt +}} % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. % +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this freezes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 \def\entry{% \begingroup % @@ -5197,46 +5061,38 @@ end % affect previous text. \par % + % Do not fill out the last line with white space. + \parfillskip = 0in + % % No extra space above this paragraph. \parskip = 0in % - % When reading the text of entry, convert explicit line breaks - % from @* into spaces. The user might give these in long section - % titles, for instance. - \def\*{\unskip\space\ignorespaces}% - \def\entrybreak{\hfil\break}% - % - % A bit of stretch before each entry for the benefit of balancing - % columns. - \vskip 0pt plus0.5pt - % - % Badness calculation for paragraph affected by - - % How much \indexdotfill is stretched, or how much \parfillskip is shrunk - % Number of lines (\linepenalty) - % % Do not prefer a separate line ending with a hyphen to fewer lines. \finalhyphendemerits = 0 % - % Word spacing - no stretch - \spaceskip=\fontdimen2\font minus \fontdimen4\font + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em % - \linepenalty=1000 % Discourage line breaks. - \hyphenpenalty=5000 % Discourage hyphenation. + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil % - % Ragged right margin, but not for the last line with the leaders in it. - % When an index entry spans lines, this stretch competes with the stretch - % in \indexdotfill to determine how the line will be split. - \rightskip=\entryrightmargin - \advance\rightskip by 0pt plus .6\hsize + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt % - % \parfillskip is at the end of the line with the page number - \parfillskip=0pt - % Cancel the \rightskip stretch - \advance \parfillskip by 0pt plus -.6\hsize - % Determine how far we can stretch into the margin. - % This allows, e.g., "Appendix H GNU Free Documentation License" to fit - % on one line. - \advance \parfillskip by 0pt minus .6\entryrightmargin + % When reading the text of entry, convert explicit line breaks + % from @* into spaces. The user might give these in long section + % titles, for instance. + \def\*{\unskip\space\ignorespaces}% + \def\entrybreak{\hfil\break}% % % Swallow the left brace of the text (first parameter): \afterassignment\doentry @@ -5244,8 +5100,6 @@ end } \def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% - % Save the text of the entry in a \vtop. - \global\setbox\entryindexbox=\vtop\bgroup \bgroup % Instead of the swallowed brace. \noindent \aftergroup\finishentry @@ -5262,70 +5116,29 @@ end \ % \else % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 \null\nobreak\indexdotfill % Have leaders before the page number. % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. \ifpdf - \pdfgettoks#1.% - \hskip\skip\thinshrinkable\the\toksA + \pdfgettoks#1.% + \ \the\toksA \else - \hskip\skip\thinshrinkable #1% + \ #1% \fi \fi - % Parameters for formatting this paragraph, reset for each paragraph. - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - \hangafter = 1 - \hangindent = 1em \par - \egroup % The \vtop \endgroup - % delay text of entry until after penalty - \bgroup\aftergroup\insertindexentrybox - \entryorphanpenalty -} - -\newskip\thinshrinkable -\skip\thinshrinkable=.15em minus .15em - -\newbox\entryindexbox -\def\insertindexentrybox{% -\lineskip=.8ex plus .6ex % This comes into effect when the \vtop has a large - % depth due to the paragraph in it having several - % lines. -\box\entryindexbox} - -% Default is no penalty -\let\entryorphanpenalty\egroup - -% Used from \printindex. \firsttoken should be the first token -% after the \entry. If it's not another \entry, we are at the last -% line of a group of index entries, so insert a penalty to discourage -% orphaned index entries. -\long\def\indexorphanpenalty{% - \def\isentry{\entry}% - \ifx\firsttoken\isentry - \else - \unskip\penalty 9000 - % The \unskip here stops breaking before the glue. It relies on the - % \vskip above being there, otherwise there is an error - % "You can't use `\unskip' in vertical mode". There has to be glue - % in the current vertical list that hasn't been added to the - % "current page". See Chapter 24 of the TeXbook. This contradicts - % Section 8.3.7 in "TeX by Topic," though. - \fi - \egroup % now comes the box added with \aftergroup } % Like plain.tex's \dotfill, except uses up at least 1 em. -% Using a finite stretch encourages several words to appear on a second line -% if the entry is broken. \def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus .4\hsize} + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} @@ -5352,9 +5165,6 @@ end \newbox\partialpage \newdimen\doublecolumnhsize -\newtoks\savedtopmark % Used in \begindoublecolumns -\newtoks\savedfirstmark - \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % Grab any single-column material above us. \output = {% @@ -5375,23 +5185,9 @@ end \unvbox\PAGE \kern-\topskip \kern\baselineskip }% - % Save \topmark and \firstmark - \global\savedtopmark=\expandafter{\topmark}% - \global\savedfirstmark=\expandafter{\firstmark}% }% \eject % run that output routine to set \partialpage % - % 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. - % - \mark{\the\savedtopmark}% Only mark in page passed to following \output. - \output = {% - \setbox0=\box\PAGE % clear box 255 - }abc\eject - % - \mark{\the\savedfirstmark}% - % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% % @@ -5422,7 +5218,7 @@ end } % The double-column output routine for all double-column pages except -% the last, which is done by \balancecolumns. +% the last. % \def\doublecolumnout{% \splittopskip=\topskip \splitmaxdepth=\maxdepth @@ -5504,47 +5300,28 @@ end \pagegoal = \vsize } % -% Only called for the last of the double column material. \doublecolumnout -% does the others. +% Called at the end of the double column material. \def\balancecolumns{% \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip - \ifdim\dimen@<14\baselineskip - % Don't split a short final column in two. - \setbox2=\vbox{}% - \else - \divide\dimen@ by 2 % target to split to - \dimen@ii = \dimen@ - \splittopskip = \topskip - % Loop until the second column is no higher than the first - {% - \vbadness = 10000 - \loop - \global\setbox3 = \copy0 - \global\setbox1 = \vsplit3 to \dimen@ - % Remove glue from bottom of first column to - % make sure it is higher than the second. - \global\setbox1 = \vbox{\unvbox1\unpenalty\unskip}% - \ifdim\ht3>\ht1 - \global\advance\dimen@ by 1pt - \repeat - }% - \multiply\dimen@ii by 4 - \divide\dimen@ii by 5 - \ifdim\ht3<\dimen@ii - % Column heights are too different, so don't make their bottoms - % flush with each other. The glue at the end of the second column - % allows a second column to stretch, reducing the difference in - % height between the two. - \setbox0=\vbox to\dimen@{\unvbox1\vfill}% - \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}% - \else - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% - \fi - \fi + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% % \pagesofar } @@ -5565,9 +5342,6 @@ end \let\lastnode=\empty % no node to associate with \writetocentry{part}{#1}{}% but put it in the toc \headingsoff % no headline or footline on the part page - % This outputs a mark at the end of the page that clears \thischapter - % and \thissection, like is done in \startcontents. - \chapmacro{}{Yomitfromtoc}{}% \chapoddpage \endgroup } @@ -5812,6 +5586,9 @@ end % @centerchap is like @unnumbered, but the heading is centered. \outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 \let\centerparametersmaybe = \centerparameters \unnmhead0{#1}% \let\centerparametersmaybe = \relax @@ -5935,11 +5712,7 @@ end % Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} - -% Start a new page \def\chappager{\par\vfill\supereject} - -% \chapoddpage - start on an odd page for a new chapter % Because \domark is called before \chapoddpage, the filler page will % get the headings for the next chapter, which is wrong. But we don't % care -- we just disable all headings on the filler page. @@ -5975,7 +5748,7 @@ end \CHAPPAGon -% \chapmacro - Chapter opening. +% Chapter opening. % % #1 is the text, #2 is the section type (Ynumbered, Ynothing, % Yappendix, Yomitfromtoc), #3 the chapter number. @@ -6369,7 +6142,7 @@ end \savepageno = \pageno \begingroup % Set up to handle contents files properly. \raggedbottom % Worry more about breakpoints than the bottom. - \entryrightmargin=\contentsrightmargin % Don't use the full line length. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi @@ -6474,7 +6247,7 @@ end % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} - +% % Chapters, in the short toc. % See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% @@ -6489,7 +6262,7 @@ end \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % -\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}} +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} % Unnumbered chapters. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} @@ -6522,8 +6295,6 @@ end \def\dochapentry#1#2{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup - % Move the page numbers slightly to the right - \advance\entryrightmargin by -0.05em \chapentryfonts \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup @@ -6643,24 +6414,6 @@ end \endgraf \ifdim\lastskip<\envskipamount \removelastskip - \ifnum\lastpenalty<10000 - % Penalize breaking before the environment, because preceding text - % often leads into it. - \penalty100 - \fi - \vskip\envskipamount - \fi - \fi -}} - -\def\afterenvbreak{{% - % =10000 instead of <10000 because of a special case in \itemzzz and - % \sectionheading, q.v. - \ifnum \lastpenalty=10000 \else - \advance\envskipamount by \parskip - \endgraf - \ifdim\lastskip<\envskipamount - \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... \ifnum\lastpenalty<10000 \penalty-50 \fi @@ -6669,6 +6422,8 @@ end \fi }} +\let\afterenvbreak = \aboveenvbreak + % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will % also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax @@ -6712,7 +6467,7 @@ end % collide with the section heading. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi % - \setbox\groupbox=\vbox\bgroup + \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup @@ -6736,7 +6491,6 @@ end \egroup \cartbot \egroup - \addgroupbox \checkinserts } @@ -7119,7 +6873,7 @@ end % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as -% possible is desirable. +% possible is very desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} @@ -7214,7 +6968,7 @@ end \temp } -% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) } +% \domakedefun \deffn \deffnx \deffnheader % % Define \deffn and \deffnx, without parameters. % \deffnheader has to be defined explicitly. @@ -7552,44 +7306,34 @@ end } \fi -\let\aftermacroxxx\relax -\def\aftermacro{\aftermacroxxx} - -% alias because \c means cedilla in @tex or @math -\let\texinfoc=\c - -% Used at the time of macro expansion. -% Argument is macro body with arguments substituted -\def\scanmacro#1{% +\def\scanmacro#1{\begingroup \newlinechar`\^^M \let\xeatspaces\eatspaces - % Reduce doubled backslashes to one - \def\xprocessmacroarg{\passargtomacro\eatspaces}% % - % Process the macro body under the current catcode regime. - \scantokens{#1\texinfoc}\aftermacro% + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ % - % The \c is to remove the \newlinechar added by \scantokens, and - % can be noticed by \parsearg. - % The \aftermacro allows a \comment at the end of the macro definition - % to duplicate itself past the final \newlinechar added by \scantokens: - % this is used in the definition of \group to comment out a newline. We - % don't do the same for \c to support Texinfo files with macros that ended - % with a @c, which should no longer be necessary. - % We avoid surrounding the call to \scantokens with \bgroup and \egroup - % to allow macros to open or close groups themselves. -} + % ... and for \example: + \spaceisspace + % + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and + % line-oriented commands. + % + \scantokens{#1\empty}% +\endgroup} \def\scanexp#1{% - \bgroup - % Undo catcode changes of \startcontents and \printindex - % When called from @insertcopying or (short)caption, we need active - % backslash to get it printed correctly. - % FIXME: This may not be needed. - %\catcode`\@=0 \catcode`\\=\active \escapechar=`\@ \edef\temp{\noexpand\scanmacro{#1}}% \temp - \egroup } \newcount\paramno % Count of parameters @@ -7655,6 +7399,7 @@ end \catcode`\+=\other \catcode`\<=\other \catcode`\>=\other + \catcode`\@=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other @@ -7664,35 +7409,37 @@ end \def\scanargctxt{% used for copying and captions, not macros. \scanctxt - \catcode`\@=\other \catcode`\\=\other \catcode`\^^M=\other } \def\macrobodyctxt{% used for @macro definitions \scanctxt - \catcode`\ =\other - \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other \catcode`\^^M=\other \usembodybackslash } -% Used when scanning braced macro arguments. Note, however, that catcode -% changes here are ineffectual if the macro invocation was nested inside -% an argument to another Texinfo command. -\def\macroargctxt{% - \scanctxt - \catcode`\^^M=\other - \catcode`\\=\active -} - -\def\macrolineargctxt{% used for whole-line arguments without braces +\def\macroargctxt{% used when scanning invocations \scanctxt - \catcode`\{=\other - \catcode`\}=\other + \catcode`\\=0 } +% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" +% for the single characters \ { }. Thus, we end up with the "commands" +% that would be written @\ @{ @} in a Texinfo document. +% +% We already have @{ and @}. For @\, we define it here, and only for +% this purpose, to produce a typewriter backslash (so, the @\ that we +% define for @math can't be used with @macro calls): +% +\def\\{\normalbackslash}% +% +% We would like to do this for \, too, since that is what makeinfo does. +% But it is not possible, because Texinfo already has a command @, for a +% cedilla accent. Documents must use @comma{} instead. +% +% \anythingelse will almost certainly be an error of some kind. % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N @@ -7764,36 +7511,56 @@ end \fi } -% \getargs -- Parse the arguments to a @macro line. Set \macname to -% the name of the macro, and \argl to the braced argument list. +% This makes use of the obscure feature that if the last token of a +% <parameter list> is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} -% This made use of the feature that if the last token of a -% <parameter list> is #, then the preceding argument is delimited by -% an opening brace, and that opening brace is not consumed. -% Parse the optional {params} list to @macro or @rmacro. -% Set \paramno to the number of arguments, -% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a -% three-param macro.) Define \macarg.BLAH for each BLAH in the params -% list to some hook where the argument is to be expanded. If there are -% less than 10 arguments that hook is to be replaced by ##N where N +% For macro processing make @ a letter so that we can make Texinfo private macro names. +\edef\texiatcatcode{\the\catcode`\@} +\catcode `@=11\relax + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH +% in the params list to some hook where the argument is to be expanded. If +% there are less than 10 arguments that hook is to be replaced by ##N where N % is the position in that list, that is to say the macro arguments are to be % defined `a la TeX in the macro body. % % That gets used by \mbodybackslash (above). % -% If there are 10 or more arguments, a different technique is used: see -% \parsemmanyargdef. +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. % +% The same technique is used to protect \eatspaces till just before +% the macro is used. +% +% If there are 10 or more arguments, a different technique is used, where the +% hook remains in the body, and when macro is to be expanded the body is +% processed again to replace the arguments. +% +% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the +% argument N value and then \edef the body (nothing else will expand because of +% the catcode regime underwhich the body was input). +% +% If you compile with TeX (not eTeX), and you have macros with 10 or more +% arguments, no macro can have more than 256 arguments (else error). \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax - % \hash is redefined to `#' later to get it into definitions - \let\processmacroarg\relax + \let\xeatspaces\relax \parsemargdefxxx#1,;,% + % In case that there are 10 or more arguments we parse again the arguments + % list to set new definitions for the \macarg.BLAH macros corresponding to + % each BLAH argument. It was anyhow needed to parse already once this list + % in order to count the arguments, and as macros with at most 9 arguments + % are by far more frequent than macro with 10 or more arguments, defining + % twice the \macarg.BLAH macros does not cost too much processing power. \ifnum\paramno<10\relax\else \paramno0\relax \parsemmanyargdef@@#1,;,% 10 or more arguments @@ -7804,47 +7571,10 @@ end \else \let\next=\parsemargdefxxx \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname - {\processmacroarg{\hash\the\paramno}}% + {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} -% \parsemacbody, \parsermacbody -% -% Read recursive and nonrecursive macro bodies. (They're different since -% rec and nonrec macros end differently.) -% -% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro -% body to be transformed. -% Set \macrobody to the body of the macro, and call \defmacro. -% -{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% -\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% -{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% -\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% - -% Make @ a letter, so that we can make private-to-Texinfo macro names. -\edef\texiatcatcode{\the\catcode`\@} -\catcode `@=11\relax - -%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% - -% If there are 10 or more arguments, a different technique is used, where the -% hook remains in the body, and when macro is to be expanded the body is -% processed again to replace the arguments. -% -% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the -% argument N value and then \edef the body (nothing else will expand because of -% the catcode regime under which the body was input). -% -% If you compile with TeX (not eTeX), and you have macros with 10 or more -% arguments, no macro can have more than 256 arguments (else error). -% -% In case that there are 10 or more arguments we parse again the arguments -% list to set new definitions for the \macarg.BLAH macros corresponding to -% each BLAH argument. It was anyhow needed to parse already once this list -% in order to count the arguments, and as macros with at most 9 arguments -% are by far more frequent than macro with 10 or more arguments, defining -% twice the \macarg.BLAH macros does not cost too much processing power. \def\parsemmanyargdef@@#1,{% \if#1;\let\next=\relax \else @@ -7860,6 +7590,16 @@ end \advance\paramno by 1\relax \fi\next} +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) +% + +\catcode `\@\texiatcatcode +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\catcode `\@=11\relax \let\endargs@\relax \let\nil@\relax @@ -7867,7 +7607,7 @@ end \long\def\nillm@{\nil@}% % This macro is expanded during the Texinfo macro expansion, not during its -% definition. It gets all the arguments' values and assigns them to macros +% definition. It gets all the arguments values and assigns them to macros % macarg.ARGNAME % % #1 is the macro name @@ -7888,6 +7628,8 @@ end \getargvals@@ \fi } + +% \def\getargvals@@{% \ifx\paramlist\nilm@ % Some sanity check needed here that \argvaluelist is also empty. @@ -7931,8 +7673,7 @@ end } % Replace arguments by their values in the macro body, and place the result -% in macro \@tempa. -% +% in macro \@tempa \def\macvalstoargs@{% % To do this we use the property that token registers that are \the'ed % within an \edef expand only once. So we are going to place all argument @@ -7956,9 +7697,8 @@ end \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% } -% Define the named-macro outside of this group and then close this group. -% \def\macargexpandinbody@{% + %% Define the named-macro outside of this group and then close this group. \expandafter \endgroup \macargdeflist@ @@ -7995,8 +7735,14 @@ end \next } -% Trailing missing arguments are set to empty. -% +% Save the token stack pointer into macro #1 +\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} +% Restore the token stack pointer from number in macro #1 +\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} +% newtoks that can be used non \outer . +\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} + +% Tailing missing arguments are set to empty \def\setemptyargvalues@{% \ifx\paramlist\nilm@ \let\next\macargexpandinbody@ @@ -8026,204 +7772,99 @@ end \long\def#2{#4}% } - -%%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%% - - - -% Remove following spaces at the expansion stage. -% This works because spaces are discarded before each argument when TeX is -% getting the arguments for a macro. -% This must not be immediately followed by a }. -\long\def\gobblespaces#1{#1} - -% This defines a Texinfo @macro or @rmacro, called by \parsemacbody. -% \macrobody has the body of the macro in it, with placeholders for -% its parameters, looking like "\processmacroarg{\hash 1}". -% \paramno is the number of parameters -% \paramlist is a TeX parameter text, e.g. "#1,#2,#3," -% There are eight cases: recursive and nonrecursive macros of zero, one, -% up to nine, and many arguments. +% This defines a Texinfo @macro. There are eight cases: recursive and +% nonrecursive macros of zero, one, up to nine, and many arguments. +% Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file -% they're defined in: @include reads the file inside a group. +% they're defined in; @include reads the file inside a group. % \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars - \ifnum\paramno=1 - \def\processmacroarg{\gobblespaces}% - % This removes the pair of braces around the argument. We don't - % use \eatspaces, because this can cause ends of lines to be lost - % when the argument to \eatspaces is read, leading to line-based - % commands like "@itemize" not being read correctly. - \else - \def\processmacroarg{\xprocessmacroarg}% - \let\xprocessmacroarg\relax - \fi - \ifrecursive %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \ifrecursive \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\macrobody}}% + \noexpand\scanmacro{\temp}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup + \bgroup\noexpand\macroargctxt \noexpand\braceorline - \expandafter\noexpand\csname\the\macname @@@\endcsname}% - \expandafter\xdef\csname\the\macname @@@\endcsname##1{% - \expandafter\noexpand\csname\the\macname @@@@\endcsname{% - \noexpand\gobblespaces##1\empty}% - % The \empty is for \gobblespaces in case #1 is empty - }% - \expandafter\xdef\csname\the\macname @@@@\endcsname##1{% - \egroup\noexpand\scanmacro{\macrobody}}% + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% \else \ifnum\paramno<10\relax % at most 9 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname @@\endcsname}% - \expandafter\xdef\csname\the\macname @@\endcsname##1{% - \expandafter\noexpand\csname\the\macname @@@\endcsname ##1,}% + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter - \csname\the\macname @@@\endcsname - \paramlist{\egroup\noexpand\scanmacro{\macrobody}}% + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% \else % 10 or more \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% - \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble \fi \fi - \else %%%%%%%%%%%%%%%%%%%%%% Non-recursive %%%%%%%%%%%%%%%%%%%%%%%%%% + \else \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\macrobody}}% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup + \bgroup\noexpand\macroargctxt \noexpand\braceorline - \expandafter\noexpand\csname\the\macname @@@\endcsname}% - \expandafter\xdef\csname\the\macname @@@\endcsname##1{% - \expandafter\noexpand\csname\the\macname @@@@\endcsname{% - \noexpand\gobblespaces##1\empty}% - % The \empty is for \gobblespaces in case #1 is empty - }% - \expandafter\xdef\csname\the\macname @@@@\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup - \noexpand\scanmacro{\macrobody}% - }% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% \else % at most 9 \ifnum\paramno<10\relax \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname @@\endcsname}% - \expandafter\xdef\csname\the\macname @@\endcsname##1{% - \expandafter\noexpand\csname\the\macname @@@\endcsname ##1,}% + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter - \csname\the\macname @@@\endcsname + \csname\the\macname xxx\endcsname \paramlist{% \egroup - \noexpand\scanmacro{\macrobody}% - }% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% - \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse \fi \fi \fi} -\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes +\catcode `\@\texiatcatcode\relax \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} - -{\catcode`\@=0 \catcode`\\=13 -@catcode`@_=11 - -% Call #1 with a list of tokens #2, with any doubled backslashes in #2 -% compressed to one. -@gdef@passargtomacro#1#2{% - @def@the_macro{#1}% - @def@pending_backslash{}% - @def@finish{@finish}% - @def@arg_result{}% - @let@next_token=@relax - @add_segment#2\@finish\% -} - -% Input stream is just after a backslash. If the next token is not a -% backslash, process the rest of the argument; otherwise, remove the next -% token. -@gdef@look_ahead{% - @futurelet@next_token@look_aheadzzz} -@gdef@look_aheadzzz{% - @ifx@next_token\% - @let@next=@gobble_and_check_finish - @else - @let@next=@add_segment - @fi@next -} - -% Double backslash found. Add a single backslash here. -@gdef@gobble_and_check_finish#1{% - @add_the_backslash - @def@pending_backslash{}% - @futurelet@next_token@add_segment -} - -% append a backslash to \arg_result -@gdef@add_the_backslash{% - @expandafter@gdef@expandafter@arg_result@expandafter{@arg_result\}% -} - -% Input stream is either at the start of the argument, or just after a -% backslash sequence, either a lone backslash, or a doubled backslash. -% \next_token contains the first token in the input stream: if it is \finish, -% finish; otherwise, append to \arg_result the segment of the argument up until -% the next backslash. \pending_backslash contains a backslash to represent -% a backslash just before the start of the input stream that has not been -% added to \arg_result. -@gdef@add_segment#1\{% -@ifx@next_token@finish - @let@next=@call_the_macro% -@else - @let@next=@look_ahead - % - % append to @arg_result - % token list registers might be better - @expandafter@expandafter@expandafter@gdef - @expandafter@expandafter@expandafter@arg_result - @expandafter@expandafter@expandafter{% - @expandafter@arg_result - @pending_backslash#1}% - @def@pending_backslash{\}% -@fi@next} - -@gdef@call_the_macro{@expandafter@the_macro@expandafter{@arg_result}} - -} - -% \braceorline MAC is used for a one-argument macro MAC. It checks -% whether the next non-whitespace character is a {. It sets the context -% for reading the argument (slightly different in the two cases). Then, -% to read the argument, in the whole-line case, it then calls the regular -% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC. +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg). % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% - \ifx\nchar\bgroup - \macroargctxt - \expandafter\passargtomacro - \else - \macrolineargctxt\expandafter\parsearg + \ifx\nchar\bgroup\else + \expandafter\parsearg \fi \macnamexxx} @@ -8305,7 +7946,6 @@ end \pdfmkdest{#1}% \iflinks {% - \requireauxfile \atdummies % preserve commands, but don't expand them \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef @@ -8345,12 +7985,9 @@ end % node name, #4 the name of the Info file, #5 the name of the printed % manual. All but the node name can be omitted. % -\def\pxref{\putwordsee{} \xrefXX} -\def\xref{\putwordSee{} \xrefXX} -\def\ref{\xrefXX} - -\def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX} -\def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]} +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} % \newbox\toprefbox \newbox\printedrefnamebox @@ -8494,12 +8131,6 @@ end % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \ifx,\tokenafterxref - \else\ifx.\tokenafterxref - \else\ifx;\tokenafterxref - \else\ifx)\tokenafterxref - \else,% add a , if xref not followed by punctuation - \fi\fi\fi\fi \fi\fi \fi \endlink @@ -8570,7 +8201,6 @@ end % If its value is nonempty, SUFFIX is output afterward. % \def\refx#1#2{% - \requireauxfile {% \indexnofonts \otherbackslash @@ -8634,23 +8264,6 @@ end \fi } -% If working on a large document in chapters, it is convenient to -% be able to disable indexing, cross-referencing, and contents, for test runs. -% This is done with @novalidate at the beginning of the file. -% -\newif\iflinks \linkstrue % by default we want the aux files. -\let\novalidate = \linksfalse - -% Used when writing to the aux file, or when using data from it. -\def\requireauxfile{% - \iflinks - \tryauxfile - % Open the new aux file. TeX will close it automatically at exit. - \immediate\openout\auxfile=\jobname.aux - \fi - \global\let\requireauxfile=\relax % Only do this once. -} - % Read the last existing aux file, if any. No error if none exists. % \def\tryauxfile{% @@ -9124,7 +8737,6 @@ end % \floatlabel-lof. Besides \floatident, we include the short % caption if specified, else the full caption if specified, else nothing. {% - \requireauxfile \atdummies % % since we read the caption text in the macro world, where ^^M @@ -9342,6 +8954,7 @@ directory should work if nowhere else does.} \catcode\count255=#1\relax \advance\count255 by 1 \repeat + } % @documentencoding sets the definition of non-ASCII characters @@ -9408,17 +9021,17 @@ directory should work if nowhere else does.} \def\latonechardefs{% \gdef^^a0{\tie} \gdef^^a1{\exclamdown} - \gdef^^a2{{\tcfont \char162}} % cent - \gdef^^a3{\pounds} - \gdef^^a4{{\tcfont \char164}} % currency - \gdef^^a5{{\tcfont \char165}} % yen - \gdef^^a6{{\tcfont \char166}} % broken bar + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\copyright} \gdef^^aa{\ordf} \gdef^^ab{\guillemetleft} - \gdef^^ac{\ensuremath\lnot} + \gdef^^ac{$\lnot$} \gdef^^ad{\-} \gdef^^ae{\registeredsymbol} \gdef^^af{\={}} @@ -9783,11 +9396,7 @@ directory should work if nowhere else does.} \def\utfeightchardefs{% \DeclareUnicodeCharacter{00A0}{\tie} \DeclareUnicodeCharacter{00A1}{\exclamdown} - \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent \DeclareUnicodeCharacter{00A3}{\pounds} - \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency - \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen - \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar \DeclareUnicodeCharacter{00A7}{\S} \DeclareUnicodeCharacter{00A8}{\"{ }} \DeclareUnicodeCharacter{00A9}{\copyright} @@ -10550,8 +10159,8 @@ directory should work if nowhere else does.} \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde -\chardef\hatchar=`\^ -\catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat +\chardef\hat=`\^ +\catcode`\^=\active \def\activehat{{\tt \hat}} \let^ = \activehat \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} @@ -10568,8 +10177,6 @@ directory should work if nowhere else does.} \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix -\catcode`\-=\active \let-=\normaldash - % used for headline/footline in the output routine, in case the page % breaks in the middle of an @tex block. @@ -10584,6 +10191,12 @@ directory should work if nowhere else does.} % in principle, all other definitions in \tex have to be undone too. } +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + % Used sometimes to turn off (effectively) the active characters even after % parsing them. \def\turnoffactive{% @@ -10602,22 +10215,23 @@ directory should work if nowhere else does.} % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} -% In Texinfo, backslash is an active character; it prints the backslash +% In texinfo, backslash is an active character; it prints the backslash % in fixed width font. \catcode`\\=\active % @ for escape char from now on. -% Print a typewriter backslash. For math mode, we can't simply use -% \backslashcurfont: the story here is that in math mode, the \char -% of \backslashcurfont ends up printing the roman \ from the math symbol -% font (because \char in math mode uses the \mathcode, and plain.tex -% sets \mathcode`\\="026E). Hence we use an explicit \mathchar, +% The story here is that in math mode, the \char of \backslashcurfont +% ends up printing the roman \ from the math symbol font (because \char +% in math mode uses the \mathcode, and plain.tex sets +% \mathcode`\\="026E). It seems better for @backslashchar{} to always +% print a typewriter backslash, hence we use an explicit \mathchar, % which is the decimal equivalent of "715c (class 7, e.g., use \fam; % ignored family value; char position "5C). We can't use " for the % usual hex value because it has already been made active. +@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} +@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. -@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} -@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents. - +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash % \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. We switch back and forth between these. @@ -10625,7 +10239,8 @@ directory should work if nowhere else does.} @gdef@otherbackslash{@let\=@realbackslash} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of -% the literal character `\'. +% the literal character `\'. Also revert - to its normal character, in +% case the active - from code has slipped in. % {@catcode`- = @active @gdef@normalturnoffactive{% @@ -10636,66 +10251,40 @@ directory should work if nowhere else does.} @let+=@normalplus @let<=@normalless @let>=@normalgreater + @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar @let~=@normaltilde - @let\=@ttbackslash @markupsetuplqdefault @markupsetuprqdefault @unsepspaces } } -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have @fixbackslash turn them back on. -@catcode`+=@other @catcode`@_=@other +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive -% \enablebackslashhack - allow file to begin `\input texinfo' -% % If a .fmt file is being used, we don't want the `\input texinfo' to show up. % That is what \eatinput is for; after that, the `\' should revert to printing % a backslash. -% If the file did not have a `\input texinfo', then it is turned off after -% the first line; otherwise the first `\' in the file would cause an error. -% This is used on the very last line of this file, texinfo.tex. -% We also use @c to call @fixbackslash, in case ends of lines are hidden. -{ -@catcode`@^=7 -@catcode`@^^M=13@gdef@enablebackslashhack{% - @global@let\ = @eatinput% - @catcode`@^^M=13% - @def@c{@fixbackslash@c}% - @def ^^M{@let^^M@secondlinenl}% - @gdef @secondlinenl{@let^^M@thirdlinenl}% - @gdef @thirdlinenl{@fixbackslash}% -}} - -{@catcode`@^=7 @catcode`@^^M=13% -@gdef@eatinput input texinfo#1^^M{@fixbackslash}} +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\' in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% @gdef@fixbackslash{% - @ifx\@eatinput @let\ = @ttbackslash @fi - @catcode13=5 % regular end of line - @let@c=@texinfoc - % Also turn back on active characters that might appear in the input - % file name, in case not using a pre-dumped format. + @ifx\@eatinput @let\ = @normalbackslash @fi @catcode`+=@active @catcode`@_=@active - % - % If texinfo.cnf is present on the system, read it. - % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets - % called at the beginning of every Texinfo file. Not opening texinfo.cnf - % directly in this file, texinfo.tex, makes it possible to make a format - % file for Texinfo. - % - @openin 1 texinfo.cnf - @ifeof 1 @else @input texinfo.cnf @fi - @closein 1 } - % Say @foo, not \foo, in error messages. @escapechar = `@@ @@ -10735,4 +10324,3 @@ directory should work if nowhere else does.} @ignore arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 @end ignore -@enablebackslashhack |