[texhax] output routine question: index "continued" lines
Paul Isambert
zappathustra at free.fr
Wed Jun 9 09:36:19 CEST 2010
Watch out interline glue and baseline distance.
The first line (hbox) of box 255 is \topskip in height, instead of
\baselineskip, and anyway it won't adjust to the height of the added
line because \unvbox doesn't do so.
On the other hand, when you \shipout box 255 with the added line, the
later has its naturel height, not \topskip, hence pages with added lines
will be shifted upward with respect to pages without.
(Although \topskip will be added in the content is sent back because
\ht255>\pagegoal, reason why you might not see it on full pages.)
And when you do \unvbox255 you should return the \outputpenalty (if not
10000), otherwise the last box of box 255 will be followed by a 10000
penalty, which will probably do no harm unless TeX rebuilds exactly the
same page plus the added line by shrinking here and there. (I.e. \ht255
was indeed larger than \pagegoal, but then it was built withouth shrink.)
Paul
Stan a écrit :
> Thanks for the info, and the example. I think I've made a macro that
> does (almost) what I want. I'd greatly appreciate any comments you
> have, especially about possible shortcomings. One thing I know it
> fails to do is deal properly with the spacing between the added "!"
> lines and the lines of text.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> \vsize=24pt%just two lines per page for this example
>
> \newif\iflineadded% conditional to test whether ! has been added already
>
> \output={%
> \iflineadded
> % if already added, do nothing
> \else
> \setbox255=\vbox{!\unvbox255}
> \global\lineaddedtrue
> \fi
> \ifdim\ht255>\pagegoal% if \box255 too high
> \unvbox255% send contents back to page builder
> \else
> \shipout\box255
> \global\lineaddedfalse
> \fi
> }
>
>
> Now is the time
>
> for all good men
>
> to come to the aid
>
> of the party.
>
> \bye
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
>
>
> On Mon, 07 Jun 2010 03:34:43 -0500, Philip Taylor (Webmaster, Ret'd)
> <P.Taylor at rhul.ac.uk> wrote:
>
>>
>>
>> Stan wrote:
>>> I'm trying to set up a basic output routine that will handle automatic
>>> insertion of "continued" lines at the top of pages where appropriate.
>>
>> Let me address your final example first (I have to leave shortly) --
>>
>>> All of my attempts have resulted in the same type of error that
>>> results,
>>> for example, from changing
>>>
>>> \output={\plainoutput}
>>>
>>> to
>>>
>>> \output={\plainoutput!}
>>>
>>> In other words, pages were ejected until some limitation was hit.
>>> (In my
>>> case, I got a "TeX capacity exceeded, sorry [main memory size=2500000]"
>>> message.)
>>
>> Because every time \output is threaded, it tries to append
>> a shriek marker to the current page; you would want to
>> look into the guts of \plainoutput to see how you could
>> intercalate additional material without causing this
>> infinite loop. A simple example is as follows; this
>> shews the simplest output routine, followed by one that
>> append a single line containing "!".
>>
>> \output = {\shipout \box 255 }
>> Now is the time \eject
>> for all good men \eject
>> to come to the aid \eject
>> of the party.
>> \end
>>
>> \output = {\setbox 255 = \vbox {\unvbox 255 \centerline {!}}\shipout
>> \box 255 }
>> Now is the time \eject
>> for all good men \eject
>> to come to the aid \eject
>> of the party.
>> \end
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
More information about the texhax
mailing list