Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

\topmark : bug or feature ? In any case strange...

33 views
Skip to first unread message

GL

unread,
Apr 9, 2018, 4:28:53 PM4/9/18
to
Hello,

Looking carefully at the \output routine, I saw that \topmark
(and \topmarks) are modified at the entry in the \output routine, ie:

\topmark as the value that \botmark had during the last call to \output.

It seems strange to me, because TeX allows to say \holdinginserts =1
in order to reinsert box255 into the flow.

I mean, you can design an \output routine like that :

\holdinginserts =1
\output {
\ifnum 1=\holdinginserts
Here I check if \box255 is suitable for me
making some modifications to the box
but I won't go to \shipout (with \holdinginserts=1
it would be a bad idea anyway)
And finally I say :
\global\holdinginserts = 0
\unvbox\@cclv % in order to reinsert the material
% and call \output again but with
% \holdinginserts =0 this time
% so that \footnotes etc. can be inserted
\else % holdinginserts = 0 here : print out
... ... ... \shipout {....} ...
\fi
}

I thought this was the purpose of \holdinginserts to design such
an \output routine.

But unfortunately, in the second call \topmark is "wrong", in the
sense it has the same value as \botmark (supposing the break point
occurs at the same place in the second call to \output when
\holdinginserts=0)


I had expected \topmark and \topmarks to be modified at \shipout time :
if nothing is printed by \output, why does \topmark change ?


Thanks if you can enlighten me about this feature of TeX...

Yours sincerely.


Donald Arseneau

unread,
Apr 11, 2018, 8:14:53 PM4/11/18
to
GL <goua...@gmail.com> writes:

> Looking carefully at the \output routine,

Which \output routine?

> I saw that \topmark (and \topmarks) are modified at the entry in the
> \output routine, ie:
>
> \topmark as the value that \botmark had during the last call to \output.
>
> It seems strange to me, because TeX allows to say \holdinginserts =1
> in order to reinsert box255 into the flow.

That output routine does not support \holdinginserts, or otherwise
backing out of the page break. If you are doing such things, you will
need to use a customized output routine anyway, and that should include
restoration of marks.



--
Donald Arseneau as...@triumf.ca

GL

unread,
Apr 13, 2018, 11:24:27 AM4/13/18
to
Le 12/04/2018 à 02:14, Donald Arseneau a écrit :
> GL <goua...@gmail.com> writes:
>
>> Looking carefully at the \output routine,
>
> Which \output routine?

I meant the \output routine of the TeX engine (pdfTeX or LuaTeX
if you prefer).

I mean at the time you show in the .log file with
\tracingpages =1\tracingmacros =2 % < to see \output tokens list >
you see something like that :

%% goal height=556.47656, max depth=5.0
% t=0.0 g=556.47656 b=10000 p=0 c=100000#
% t=10.0 g=556.47656 b=10000 p=0 c=100000#
% t=10.0 plus 1.0fill g=556.47656 b=0 p=-1073741824 c=-1073741824#
\output->{ .........

TeX just found a break point, box255 is set, insertions are set into
their boxes registers, and \topmark is reset to the value \botmark
had at the last time the \output tokens list expanded.

I'm not pleased with this setting and would have preferred \topmark
to be changed at \shipout time.

It is not a problem for \topmark since there is only one register to
save/restore but with eTeX \topmarks i sould look at the allocation
number of \marks registers in order to save every \botmarks up to
this allocation number...

What is the purpose of \topmarks finally ? To refer to the previous
page, or to refer to the previous \box255 ???

I think this behaviour of TeX is in contradiction to the possibility
of saying \holdinginserts =1


>
>> I saw that \topmark (and \topmarks) are modified at the entry in the
>> \output routine, ie:
>>
>> \topmark as the value that \botmark had during the last call to \output.
>>
>> It seems strange to me, because TeX allows to say \holdinginserts =1
>> in order to reinsert box255 into the flow.
>
> That output routine does not support \holdinginserts, or otherwise
> backing out of the page break. If you are doing such things, you will
> need to use a customized output routine anyway, and that should include
> restoration of marks.

Yes. Restoration of \topmarks...

Best regards.

Donald Arseneau

unread,
Apr 17, 2018, 8:56:56 PM4/17/18
to
GL <goua...@gmail.com> writes:

> Le 12/04/2018 à 02:14, Donald Arseneau a écrit :
>> GL <goua...@gmail.com> writes:
>>
>>> Looking carefully at the \output routine,
>>
>> Which \output routine?
>
> I meant the \output routine of the TeX engine (pdfTeX or LuaTeX
> if you prefer).
>
No, the engine does not have an output routine... (Actually it does have
a very simple one built in, but it is only there for if no format gets
loaded.)

The plain TeX format has a still fairly simple output routine, and
maybe that is what you are looking at. It doesn't do any recycling.

The LaTeX output routine is more complex and does recycle material
back to the page contents, but it never touches \holdinginserts, nor
does it do much restoration of marks. It does not use \topmark at
all, but if you wanted to, you should remember the previous \botmark
in a macro in your own output routine, which is the only thing that
will be able to keep track. (That is much simpler than the alternative
which is to throw away a page to get the marks bach in order.

If you use \holdinginserts at all, you should have it on (1) most
of the time, and only set it off (0) when you unbox your recycled
page and you are sure it is the final trip going to \shipout.

> It is not a problem for \topmark since there is only one register to
> save/restore but with eTeX \topmarks i sould look at the allocation
> number of \marks registers in order to save every \botmarks up to
> this allocation number...

Just a loop.

> What is the purpose of \topmarks finally ? To refer to the previous
> page, or to refer to the previous \box255 ???

It is to give context to the \output routine. The way it works gives the
output routine the flexibility to use it as it likes. For example, there
are output routines to only ship out selected pages, which would disrupt
\topmark if it were only updated at \shipout. Yes, the effect could be
emulated using a macro, but any complex output routine needing \topmark
should probably be doing that.


--
Donald Arseneau as...@triumf.ca
0 new messages