[texhax] Displaying the \current value of \prevgraf in the log file

Paul Isambert zappathustra at free.fr
Mon Nov 14 13:20:37 CET 2011


Le 14/11/2011 13:03, Philip TAYLOR a écrit :
>
>
> Paul Isambert wrote:
>
>> I'm not sure I understand you correctly: you want the value of \prevgraf
>> for the paragraph where the \vadjust appears? Then I see two problems:
>> first, the \vadjust is processed before the paragraph itself, just like
>> a \vbox that occurs in a paragraph; second (but the previous point is
>> enough anyway), I don't think \prevgraf is updated after each line, but
>> rather when the paragraph is done. But something tells me I've
>> misunderstood you.
>
> No, you've not misunderstood, Paul, and you have, in effect,
> "hit the nail on the head".  But although the \vadjust itself
> is processed before the \par, the vlist that it constructs
> is injected into the MVL at line-breaking time, which is
> exactly the time at which \prevgraf is incremented :
>
> 4.15 \prevgraf :
>
> This primitive [103] contains the number of the current paragraph 
> line. It
> is set to zero at the beginning of each paragraph and is is 
> incremented each time
> a line is broken and is appended to the MVL.  Its value can be shown 
> by either
> \the\prevgraf, \number\prevgraf or \showthe\prevgraf.  However, this can
> only be done in V mode, between paragraphs.  Placing \the\prevgraf inside
> a paragraph will typeset a zero, since \prevgraf is only updated after 
> the paragraph
> has been fully read and typeset.
>
> In other words, \prevgraf is potentially /extremely/ useful,
> but DEK has made it (almost ?) impossible to interrogate
> it at the one time it would be most valuable (during a \vadjust
> that -- for reasons that need not concern us here -- needs to
> "know" in which line of the paragraph its contents have been
> injected).
>
> So I was trying to think of some TeX entity that I could
> include in the \vadjust general text that would  remain
> dormant until the contents of the \vadjust were being
> injected into the MVL and which could then interrogate
> \prevgraf and record its current value in some way ...

I don't think that's possible. The \vadjust-ed material is turned into a 
list before the paragraph is typeset. So, unless you consider complex 
list manipulation (and such manipulation can't be done without LuaTeX, 
I'd wager -- what, me, a LuaTeX fanatic?), I can't see what could be 
left dormant.

But perhaphs you might say what you're trying to do. Then perhaps we'll 
find a back street you've overlooked.

Paul


More information about the texhax mailing list