TransWikia.com

Why does unhboxing seem to ignore vertical mode and why does unvboxing seem to ignore horizontal mode?

TeX - LaTeX Asked by Marsupial Wallaby on February 14, 2021

First question

Why does unhboxing seem to ignore vertical mode and why does unvboxing seem to ignore horizontal mode?

The MWE after the next two pictures

  • both delivers the text of the first question
  • and illustrates the effects of unhbox/unhcopy in vertical mode and of unvbox/unvcopy in horizontal mode.

The text of the first question also is in the next two pictures. They are the result of compiling the MWE.

enter image description here

enter image description here

newboxMyBox

setboxMyBox=hbox{%
                      vbox{hbox{box1a}hbox{box1b}}%
                      vbox{hbox{box2a}hbox{box2b}}%
                      vbox{hbox{box3a}hbox{box3b}}%
                    }

noindent{%
bf The {ttstringhbox} in box-register {ttstringMyBox} is:hfillbreak
ttstringhboxstring{char37 hfillbreak
null       %
stringvboxstring{stringhboxstring{box1astring}stringhboxstring{box1bstring}string}char37 hfillbreak
null       %
stringvboxstring{stringhboxstring{box2astring}stringhboxstring{box2bstring}string}char37 hfillbreak
null       %
stringvboxstring{stringhboxstring{box3astring}stringhboxstring{box3bstring}string}char37 hfillbreak
null     %
string}char37 hfill
}%

noindent{bf In vertical mode I expect boxes to be placed atop/below each 
other no matter if the boxes to be placed themselves are horizontal or vertical 
boxes.hfillbreak
Thus in vertical mode I expect from {ttstringunhcopy}ing the {ttstringhbox} held in
box-register {ttstringMyBbox} that the three {ttstringvbox}es it contains are 
placed atop/below each other:}bigskip

parvbox{hbox{box1a}hbox{box1b}}%
    vbox{hbox{box2a}hbox{box2b}}%
    vbox{hbox{box3a}hbox{box3b}}%

bigskipnoindent{bf But in vertical mode from {ttstringunhcopy}ing  I
get the three vertical boxes placed to the left/right of each other, with {ttstringparindent}-glue
at the left of the leftmost box:}bigskip

parunhcopyMyBox

bigskipnoindent{bf Just as if I did {ttstringbox} the {ttstringhbox}
in horizontal mode:}bigskip

parleavevmodeboxMyBox

bigskipnoindent{bf Why? Where am I wrong in my understanding of the workings of {ttstringunhbox}/{ttstringunhcopy}?}

vfilleject

setboxMyBox=vbox{%
                hbox{vbox{hbox{box1a}hbox{box1b}}}%
                hbox{vbox{hbox{box2a}hbox{box2b}}}%
                hbox{vbox{hbox{box3a}hbox{box3b}}}%
              }

bigskipnoindent{bf
bf The {ttstringvbox} in box-register {ttstringMyBox} is:hfillbreak
tt
stringvboxstring{char37 hfillbreak
null       stringhboxstring{stringvboxstring{stringhboxstring{box1astring}%
stringhboxstring{box1bstring}string}string}char37 hfillbreak
null       stringhboxstring{stringvboxstring{stringhboxstring{box2astring}%
stringhboxstring{box2bstring}string}string}char37 hfillbreak
null       stringhboxstring{stringvboxstring{stringhboxstring{box3astring}%
stringhboxstring{box3bstring}string}string}char37 hfillbreak
null     string}char37 hfill
}%

noindent{bf In horizontal mode I expect boxes to be placed left/right to each other no 
matter if the boxes to be placed themselves are horizontal or vertical boxes.hfillbreak
Thus in horizontal mode I expect from {ttstringunvcopy}ing the {ttstringvbox} held in
box-register {ttstringMyBbox} that the three {ttstringhbox}es it contains are placed
left/right to each other, with {ttstringparindent}-glue at the left of the leftmost
{ttstringhbox}:}bigskip

leavevmodehbox{vbox{hbox{box1a}hbox{box1b}}}%
           hbox{vbox{hbox{box2a}hbox{box2b}}}%
           hbox{vbox{hbox{box3a}hbox{box3b}}}%

bigskipnoindent{bf But in horizontal mode from {ttstringunvcopy}ing 
I get the three horizontal boxes placed atop/below each other:}bigskip

leavevmodeunvcopyMyBox

bigskipnoindent{bf Just as if I did {ttstringbox} the {ttstringvbox} in vertical mode:}bigskip

parboxMyBox

bigskipnoindent{bf Why? Where am I wrong in my understanding of the workings of {ttstringunvbox}/{ttstringunvcopy}?}

bye


Second question:

Assume a box-register MyBox holding a vbox which in turn contains many lines/many hboxes of equal length.

boxing that box register yields a vertical box whose single lines won’t be split across pages:

newcounttmpcnt
newboxMyBox
setboxMyBox=vbox{%
  tmpcnt=0 %
  loopadvancetmpcnt by 1 hbox to 3cm{Line:hfillnumbertmpcnt.}ifnumtmpcnt<100 repeat
}%
noindent
boxMyBox
bye

enter image description here

When unvboxing that box-register, then the single lines will be split across pages:

newcounttmpcnt
newboxMyBox
setboxMyBox=vbox{%
  tmpcnt=0 %
  loopadvancetmpcnt by 1 hbox to 3cm{Line:hfillnumbertmpcnt.}ifnumtmpcnt<100 repeat
}%
noindent
nobreakunvboxMyBox
bye

enter image description here

enter image description here

How can you achieve in combination with unvbox that these lines will not only be split across pages but will also be flushed to the right? As if you did:

newcounttmpcnt
tmpcnt=0 %
noindent
loop
advancetmpcnt by 1 %
nullhfillhbox to 3cm{Line:hfillnumbertmpcnt.}break
ifnumtmpcnt<100 repeat
par
bye

enter image description here

enter image description here

One Answer

unhbox exposes a horizontal list so starts a new paragraph and new horizontal list just as a letter would do, the commonleavevmode is just defleavevmode{unhboxvoidb@x}

Answered by David Carlisle on February 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP