Commit 50cd2e68 by Karl Berry

(\onepageout): \ifcropmarks, center the page body.

Lost this when merged \croppageout with \onepageout.
Found by Arnold.

(\doprintindex): Do not bother to go into double column mode unless
there actually is a non-empty index.

(\begindoublecolumns): Include any existing \partialpage in the new one,
lest we lose a whole page of output.
Found by M J Morley <mjm@scs.leeds.ac.uk>.

(\chapternofonts): Remove spurious spaces, both in the definitions that
get output to the aux file(s) and in this macro.

Fix comments and rationalize whitespace in various other places.

From-SVN: r14015
parent 3f76745e
%% TeX macros to handle Texinfo files. %% TeX macros to handle Texinfo files.
%% $Id: texinfo.tex,v 2.197 1997/04/26 23:22:03 karl Exp $ %% $Id: texinfo.tex,v 2.197 1997/04/27 19:40:44 karl Exp karl $
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, % Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
% 94, 95, 96, 97 Free Software Foundation, Inc. % 94, 95, 96, 97 Free Software Foundation, Inc.
...@@ -147,11 +147,7 @@ ...@@ -147,11 +147,7 @@
% \onepageout takes a vbox as an argument. Note that \pagecontents % \onepageout takes a vbox as an argument. Note that \pagecontents
% does insertions, but you have to call it yourself. % does insertions, but you have to call it yourself.
\def\onepageout#1{% \def\onepageout#1{%
\ifcropmarks \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
\hoffset = 0pt
\else
\hoffset = \normaloffset
\fi
% %
\ifodd\pageno \advance\hoffset by \bindingoffset \ifodd\pageno \advance\hoffset by \bindingoffset
\else \advance\hoffset by -\bindingoffset\fi \else \advance\hoffset by -\bindingoffset\fi
...@@ -171,10 +167,9 @@ ...@@ -171,10 +167,9 @@
\normalturnoffactive % \ in index entries must not stay \, e.g., if \normalturnoffactive % \ in index entries must not stay \, e.g., if
% the page break happens to be in the middle of an example. % the page break happens to be in the middle of an example.
\shipout\vbox{% \shipout\vbox{%
\ifcropmarks \ifcropmarks \vbox to \outervsize\bgroup
\vbox to \outervsize\bgroup
\hsize = \outerhsize \hsize = \outerhsize
\vbox{\line{\ewtop\hfill\ewtop}}% \line{\ewtop\hfil\ewtop}%
\nointerlineskip \nointerlineskip
\line{% \line{%
\vbox{\moveleft\cornerthick\nstop}% \vbox{\moveleft\cornerthick\nstop}%
...@@ -182,6 +177,10 @@ ...@@ -182,6 +177,10 @@
\vbox{\moveright\cornerthick\nstop}% \vbox{\moveright\cornerthick\nstop}%
}% }%
\vskip\topandbottommargin \vskip\topandbottommargin
\line\bgroup
\hfil % center the page within the outer (page) hsize.
\ifodd\pageno\hskip\bindingoffset\fi
\vbox\bgroup
\fi \fi
% %
\unvbox\headlinebox \unvbox\headlinebox
...@@ -189,6 +188,8 @@ ...@@ -189,6 +188,8 @@
\unvbox\footlinebox \unvbox\footlinebox
% %
\ifcropmarks \ifcropmarks
\egroup % end of \vbox\bgroup
\hfil\egroup % end of (centering) \line\bgroup
\vskip\topandbottommargin plus1fill minus1fill \vskip\topandbottommargin plus1fill minus1fill
\boxmaxdepth = \cornerthick \boxmaxdepth = \cornerthick
\line{% \line{%
...@@ -197,11 +198,11 @@ ...@@ -197,11 +198,11 @@
\vbox{\moveright\cornerthick\nsbot}% \vbox{\moveright\cornerthick\nsbot}%
}% }%
\nointerlineskip \nointerlineskip
\vbox{\line{\ewbot\hfill\ewbot}}% \line{\ewbot\hfil\ewbot}%
\egroup % \vbox from first cropmarks clause \egroup % \vbox from first cropmarks clause
\fi \fi
}% }% end of \shipout\vbox
}% }% end of group with \turnoffactive
\advancepageno \advancepageno
\ifnum\outputpenalty>-20000 \else\dosupereject\fi \ifnum\outputpenalty>-20000 \else\dosupereject\fi
} }
...@@ -219,7 +220,6 @@ ...@@ -219,7 +220,6 @@
\ifr@ggedbottom \kern-\dimen@ \vfil \fi} \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
} }
%
% Here are the rules for the cropmarks. Note that they are % Here are the rules for the cropmarks. Note that they are
% offset so that the space between them is truly \outerhsize or \outervsize % offset so that the space between them is truly \outerhsize or \outervsize
% (P. A. MacKay, 12 November, 1986) % (P. A. MacKay, 12 November, 1986)
...@@ -2408,27 +2408,16 @@ width0pt\relax} \fi ...@@ -2408,27 +2408,16 @@ width0pt\relax} \fi
% Define the macros used in formatting output of the sorted index material. % Define the macros used in formatting output of the sorted index material.
% This is what you call to cause a particular index to get printed. % @printindex causes a particular index (the ??s file) to get printed.
% Write % It does not print any chapter heading (usually an @unnumbered).
% @unnumbered Function Index %
% @printindex fn
\def\printindex{\parsearg\doprintindex} \def\printindex{\parsearg\doprintindex}
\def\doprintindex#1{\begingroup \def\doprintindex#1{\begingroup
\dobreak \chapheadingskip{10000}% \dobreak \chapheadingskip{10000}%
% %
\indexfonts \rm \indexfonts \rm
\tolerance = 9500 \tolerance = 9500
\indexbreaks \indexbreaks
\def\indexbackslash{\rawbackslashxx}%
% 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.
\catcode`\\ = 0
\catcode`\@ = 11
\escapechar = `\\
\begindoublecolumns
% %
% See if the index file exists and is nonempty. % See if the index file exists and is nonempty.
\openin 1 \jobname.#1s \openin 1 \jobname.#1s
...@@ -2447,11 +2436,19 @@ width0pt\relax} \fi ...@@ -2447,11 +2436,19 @@ width0pt\relax} \fi
\ifeof 1 \ifeof 1
(Index is empty) (Index is empty)
\else \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{\rawbackslashxx}%
\catcode`\\ = 0
\catcode`\@ = 11
\escapechar = `\\
\begindoublecolumns
\input \jobname.#1s \input \jobname.#1s
\enddoublecolumns
\fi \fi
\fi \fi
\closein 1 \closein 1
\enddoublecolumns
\endgroup} \endgroup}
% These macros are used by the sorted index file itself. % These macros are used by the sorted index file itself.
...@@ -2553,24 +2550,39 @@ width0pt\relax} \fi ...@@ -2553,24 +2550,39 @@ width0pt\relax} \fi
\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
% Grab any single-column material above us. % Grab any single-column material above us.
\output = {\global\setbox\partialpage \output = {\global\setbox\partialpage = \vbox{%
=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}% %
% Here is a possibility not foreseen in manmac: if we accumulate a
% whole lot of material, we might end up calling this \output
% routine twice in a row (see the doublecol-lose test, which is
% essentially a couple of indexes with @setchapternewpage off). In
% that case, we must prevent the second \partialpage from
% simply overwriting the first, causing us to lose the page.
% This will preserve it until a real output routine can ship it
% out. Generally, \partialpage will be empty when this runs and
% this will be a no-op.
\unvbox\partialpage
%
% Unvbox the main output page.
\unvbox255
\kern-\topskip \kern\baselineskip
}}%
\eject \eject
% %
% Now switch to the double-column output routine. % Use the double-column output routine for subsequent pages.
\output={\doublecolumnout}% \output = {\doublecolumnout}%
% %
% Change the page size parameters. We could do this once outside this % Change the page size parameters. We could do this once outside this
% routine, in each of @smallbook, @afourpaper, and the default 8.5x11 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
% format, but then we repeat the same computation. Repeating a couple % format, but then we repeat the same computation. Repeating a couple
% of assignments once per index is clearly meaningless for the % of assignments once per index is clearly meaningless for the
% execution time, so we may as well do it once. % execution time, so we may as well do it in one place.
% %
% First we halve the line length, less a little for the gutter between % First we halve the line length, less a little for the gutter between
% the columns. We compute the gutter based on the line length, so it % the columns. We compute the gutter based on the line length, so it
% changes automatically with the paper format. The magic constant % changes automatically with the paper format. The magic constant
% below is chosen so that the gutter has the same value (well, +- < % below is chosen so that the gutter has the same value (well, +-<1pt)
% 1pt) as it did when we hard-coded it. % as it did when we hard-coded it.
% %
% We put the result in a separate register, \doublecolumhsize, so we % We put the result in a separate register, \doublecolumhsize, so we
% can restore it in \pagesofar, after \hsize itself has (potentially) % can restore it in \pagesofar, after \hsize itself has (potentially)
...@@ -2591,100 +2603,103 @@ width0pt\relax} \fi ...@@ -2591,100 +2603,103 @@ width0pt\relax} \fi
% (undoubled) page height minus any material left over from the % (undoubled) page height minus any material left over from the
% previous page. % previous page.
\dimen@=\pageheight \advance\dimen@ by-\ht\partialpage \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
% box0 will be the left-hand column, box1 the right. % box0 will be the left-hand column, box2 the right.
\setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
\onepageout\pagesofar \onepageout\pagesofar
\unvbox255 \penalty\outputpenalty \unvbox255
\penalty\outputpenalty
} }
\def\pagesofar{% \def\pagesofar{%
% The contents of the output page -- any previous material, % Re-output the contents of the output page -- any previous material,
% followed by the two boxes we just split. % followed by the two boxes we just split.
\unvbox\partialpage \unvbox\partialpage
\hsize = \doublecolumnhsize \hsize = \doublecolumnhsize
\wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
} }
\def\enddoublecolumns{% \def\enddoublecolumns{%
\output={\balancecolumns}\eject % split what we have \output = {\balancecolumns}\eject % split what we have
\endgroup \endgroup % started in \begindoublecolumns
%
% Back to normal single-column typesetting, but take account of the % Back to normal single-column typesetting, but take account of the
% fact that we just accumulated some stuff on the output page. % fact that we just accumulated some stuff on the output page.
\pagegoal=\vsize \pagegoal = \vsize
} }
\def\balancecolumns{% \def\balancecolumns{%
% Called on the last page of the double column material. % Called at the end of the double column material.
\setbox0=\vbox{\unvbox255}% \setbox0 = \vbox{\unvbox255}%
\dimen@ = \ht0 \dimen@ = \ht0
\advance\dimen@ by \topskip \advance\dimen@ by \topskip
\advance\dimen@ by-\baselineskip \advance\dimen@ by-\baselineskip
\divide\dimen@ by 2 \divide\dimen@ by 2
\splittopskip = \topskip \splittopskip = \topskip
% Loop until we get a decent breakpoint. % Loop until we get a decent breakpoint.
{\vbadness=10000 \loop \global\setbox3=\copy0 {\vbadness=10000 \loop
\global\setbox3=\copy0
\global\setbox1=\vsplit3 to\dimen@ \global\setbox1=\vsplit3 to\dimen@
\ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}% \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt
\repeat}%
\setbox0=\vbox to\dimen@{\unvbox1}% \setbox0=\vbox to\dimen@{\unvbox1}%
\setbox2=\vbox to\dimen@{\unvbox3}% \setbox2=\vbox to\dimen@{\unvbox3}%
\pagesofar \pagesofar
} }
\catcode `\@=\other \catcode`\@ = \other
\message{sectioning,} \message{sectioning,}
% Define chapters, sections, etc. % Define chapters, sections, etc.
\newcount \chapno \newcount\chapno
\newcount \secno \secno=0 \newcount\secno \secno=0
\newcount \subsecno \subsecno=0 \newcount\subsecno \subsecno=0
\newcount \subsubsecno \subsubsecno=0 \newcount\subsubsecno \subsubsecno=0
% This counter is funny since it counts through charcodes of letters A, B, ... % This counter is funny since it counts through charcodes of letters A, B, ...
\newcount \appendixno \appendixno = `\@ \newcount\appendixno \appendixno = `\@
\def\appendixletter{\char\the\appendixno} \def\appendixletter{\char\the\appendixno}
\newwrite \contentsfile \newwrite\contentsfile
% This is called from \setfilename. % This is called from \setfilename.
\def\opencontents{\openout \contentsfile = \jobname.toc} \def\opencontents{\openout\contentsfile = \jobname.toc }
% Each @chapter defines this as the name of the chapter. % Each @chapter defines this as the name of the chapter.
% page headings and footings can use it. @section does likewise % page headings and footings can use it. @section does likewise
\def\thischapter{} \def\thissection{} \def\thischapter{} \def\thissection{}
\def\seccheck#1{\if \pageno<0 % \def\seccheck#1{\ifnum \pageno<0
\errmessage{@#1 not allowed after generating table of contents}\fi \errmessage{@#1 not allowed after generating table of contents}%
% \fi}
}
\def\chapternofonts{% \def\chapternofonts{%
\let\rawbackslash=\relax% \let\rawbackslash=\relax
\let\frenchspacing=\relax% \let\frenchspacing=\relax
\def\result{\realbackslash result} \def\result{\realbackslash result}%
\def\equiv{\realbackslash equiv} \def\equiv{\realbackslash equiv}%
\def\expansion{\realbackslash expansion} \def\expansion{\realbackslash expansion}%
\def\print{\realbackslash print} \def\print{\realbackslash print}%
\def\TeX{\realbackslash TeX} \def\TeX{\realbackslash TeX}%
\def\dots{\realbackslash dots} \def\dots{\realbackslash dots}%
\def\copyright{\realbackslash copyright} \def\copyright{\realbackslash copyright}%
\def\tt{\realbackslash tt} \def\tt{\realbackslash tt}%
\def\bf{\realbackslash bf } \def\bf{\realbackslash bf}%
\def\w{\realbackslash w} \def\w{\realbackslash w}%
\def\less{\realbackslash less} \def\less{\realbackslash less}%
\def\gtr{\realbackslash gtr} \def\gtr{\realbackslash gtr}%
\def\hat{\realbackslash hat} \def\hat{\realbackslash hat}%
\def\char{\realbackslash char} \def\char{\realbackslash char}%
\def\tclose##1{\realbackslash tclose {##1}} \def\tclose##1{\realbackslash tclose{##1}}%
\def\code##1{\realbackslash code {##1}} \def\code##1{\realbackslash code{##1}}%
\def\samp##1{\realbackslash samp {##1}} \def\samp##1{\realbackslash samp{##1}}%
\def\r##1{\realbackslash r {##1}} \def\r##1{\realbackslash r{##1}}%
\def\b##1{\realbackslash b {##1}} \def\b##1{\realbackslash b{##1}}%
\def\key##1{\realbackslash key {##1}} \def\key##1{\realbackslash key{##1}}%
\def\file##1{\realbackslash file {##1}} \def\file##1{\realbackslash file{##1}}%
\def\kbd##1{\realbackslash kbd {##1}} \def\kbd##1{\realbackslash kbd{##1}}%
% These are redefined because @smartitalic wouldn't work inside xdef. % These are redefined because @smartitalic wouldn't work inside xdef.
\def\i##1{\realbackslash i {##1}} \def\i##1{\realbackslash i{##1}}%
\def\cite##1{\realbackslash cite {##1}} \def\cite##1{\realbackslash cite{##1}}%
\def\var##1{\realbackslash var {##1}} \def\var##1{\realbackslash var{##1}}%
\def\emph##1{\realbackslash emph {##1}} \def\emph##1{\realbackslash emph{##1}}%
\def\dfn##1{\realbackslash dfn {##1}} \def\dfn##1{\realbackslash dfn{##1}}%
} }
\newcount\absseclevel % used to calculate proper heading level \newcount\absseclevel % used to calculate proper heading level
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment