[texhax] Question about \setbox

Heiko Oberdiek heiko.oberdiek at googlemail.com
Fri Sep 16 11:41:32 CEST 2011


On Fri, Sep 16, 2011 at 10:13:01AM +0100, Philip TAYLOR (Webmaster, Ret'd) wrote:

> Heiko Oberdiek wrote:
> > On Fri, Sep 16, 2011 at 06:13:27PM +1000, VAFA KHALIGHI wrote:
> > 
> >> Why this does not work:
> >>
> >>  \setbox0=\vbox{I am a vbox}
> >>
> >> \setbox1=\hbox{\unvbox0}
> > 
> > You are in restricted horizontal mode inside \hbox. There
> > a "vertical command" (\unvbox, \unvcopy, \halign, ...}
> > is forbidden ("The TeX book", Chapter 25 "Summary of Horizonal Mode).
> 
> Thank you : that has been puzzling me ever since Vafa first
> asked the question and I confirmed that he was correct !
> 
> In that case, presumably the answer will be to use something
> along the lines of the following :
> 
>     \setbox 0 = \vbox {I am a vbox}
>     \setbox 2 = \vbox {\unvbox 0 \global \setbox 4 = \lastbox}
>     \unhbox 4
>     \bye

I don't know/remember what Vafa wants in the first place.
\lastbox only gets the last box/last line. It is even empty
if there is something different at the end of the
\vbox (\kern, whatsit, ...).

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list