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

Paul Isambert zappathustra at free.fr
Mon Nov 14 12:33:46 CET 2011

Le 14/11/2011 10:51, Philip TAYLOR a écrit :
>
>
> Paul Isambert wrote:
>
>> But I suppose you're interested in the the first line?
>> Apparently, \showlists displays prevgraf when non-zero, i.e. only in
>> vmode after a paragraph (which is also how I understand the code from
>> tex.web).
>>
>> So, at the beginning of a \vadjust (i.e. before a paragraph), even if
>> you retrieved \prevgraf, it would be 0, as it is in horizontal mode or
>> in vertical mode in an empty list. Your problem is thus rather to make
>> \prevgraf survive a little bit longer; apart from hacking \par to
>> something like \def\par{\endgraf\mycount=\prevgraf}, I can't see a
>> solution. Unless you're willing to go LuaTeX, in which case the \par
>> hack can be made a little bit more elegant (and less dangerous) with:
>>
>> callback.register("post_linebreak_filter",
>> function (h)
>> tex.count.mycount = tex.nest[tex.nest.ptr].prevgraf
>> return h
>> end)
>
> I have no problem with hacking \par, as I am already
> doing so in order to ensure that \everypar can have
>
> \def \par {\endgraf \global \prevgraph = \prevgraf}
> \everypar = {\runonfloat}
> \def \runonfloat
>     {%
>         \ifnum \prevgraph ...
>
> but I still can't see how that can help me get at the
> \prevgraf of the outer \paragraph during a \vadjust
> is that it injects its content into the outer vertical
> list during line-breaking, so \prevgraf is well-defined
> at that time, but I just cannot see how to access it ...

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.

Best,
Paul