[texhax] Question about \setbox

Philip TAYLOR (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Fri Sep 16 11:13:01 CEST 2011



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

Philip Taylor


More information about the texhax mailing list