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

Philip TAYLOR P.Taylor at Rhul.Ac.Uk
Mon Nov 14 10:51:51 CET 2011


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