[texhax] Question about \unvbox and longtable package

Philip TAYLOR (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Mon Sep 19 08:27:45 CEST 2011



VAFA KHALIGHI wrote:
> Thanks Phillip for the response.
>
> To answer your questions, I need to say that if I use the followings instead \unvbox\z@, the same problem appears so it seems that \unvbox\z@ is unavoidable:
>
> 1- \box\z@
>
> 2- \copy\z@
>
> However I could say \unvcopy\z at .
> Why I put \vbox{\unvbox\z@}, it is because I can not put \unvbox inside an
> \hbox as it is forbidden that is why I am putting it as \hbox{\vbox{\unvbox\z@}}.

OK, (sort of) understood.  But my real point was that unless
\box \z@ contains any stretchable/shrinkable glue that has
been stretched/shrunk, there is no benefit in writing

	\vbox{\unvbox\z@}

since you could just write \box \z@ or \copy \z@ as you
choose (i.e., the resulting boxes will be identical).

Only if \box \z@ contains any stretchable/shrinkable glue that
has been stretched/shrunk is there any (possible) benefit to
your approach, in that in your unboxing and reboxing all
stretched/shrunk glue will be reset (which may or may
not bw what you want/intended).

As to the deeper problem, the data structures (TeX internal
lists) resulting from \unvbox \z@ and \hbox {...} will be
completely different, unless (by some miracle) \box \z@
contains exactly one hbox and no additional vertical material
at all.

So I would recommend starting by inspecting the contents of
\box \z@, using \showbox, \showboxdepth and perhaps even
\showboxbreadth, at the point at which you are considering
\unvboxing \re-vboxing \hboxing ... it.  That will disclose
whether you have a \box \z@ that can be replaced by an
\hbox {\vbox {\unbox \z@}} or whether you have a far more
complex data structure that will need very carefully pulling
to pieces (see my earlier suggestion of using \lastbox to
extract just one item from the internal vertical list as
an example), and then reconstructing to achieve your intended
aim.

Philip Taylor



More information about the texhax mailing list