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

Philip TAYLOR P.Taylor at Rhul.Ac.Uk
Mon Nov 14 13:03:19 CET 2011



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 ...

** Phil.

[1] "The Advanced TeXbook", David Salomon



More information about the texhax mailing list