I was trying to experiment with the code in this answer: Breakable vboxes, and I got something I didn't expect; consider this MWE:

% \usepackage{lua-visual-debug}



\def\shouldUseParbox{1} % comment to undefine

\else% \shouldUseParbox defined:

First bit here:

% \copy\mybox
\hskip-1\parindent %\fbox will indent;
\fbox{\copy\mybox} %ok

\setbox\myboxtemp=\vsplit\mybox to 0.3\textheight

Split bit here:

% \copy\myboxtemp % ok
% \unvbox\myboxtemp % ok; same out as \copy in this case
\hskip-1\parindent %\fbox will indent;

remains here:

\hskip-1\parindent %\fbox will indent;

% \setbox\myboxtemp=\unvbox\myboxtemp % "! A <box> was supposed to be here." ??
% \fbox{\unvbox\myboxtemp} % "! Missing } inserted." ??


If I want to \vsplit a parbox placed in a vbox (\shouldUseParbox is active, as in the MWE), then I get this (lua-visual-debug) output (click for full res):


... which is totally unexpected: there is nothing on the first page - and I cannot really tell if the boxes are split, even if the framebox indicates that is the case; in any case, the boxes aren't interleaved with the rest of the text.

Now, if \shouldUseParbox is inactive - which means contents directly in a vbox with rightskip (as in the answer posted above), then all works as expected (click for full res):


My questions are:

  1. Why can I not vsplit a parbox (in a vbox)? All I know is \parbox is a LaTeX command, while \vsplit and rest are TeX core... What should one do if one need to split \parbox material?
  2. You can see I have to "unindent" (with \hskip-1\parindent), so that the \fbox output is at the same position, as when fbox isn't used - why is this so?
  3. Why can I use syntax like \fbox{\copy\myboxtemp} - but I cannot use \fbox{\unvbox\myboxtemp} ?? (I thought the effect of \unvbox was the same as \box and \copy, but apparently not?)
  • 2
    You can't apply \vsplit to \vbox{\vbox{...}} either. A \vbox is treated as a single object (unless it is \unvboxed, but you can't \unvbox a \parbox).
    – egreg
    Jul 2 '14 at 21:00

\vsplit splits a vbox at a legal breakpoint in the vertical list in that box. The vertical list in \mybox only contains a single unbreakable item the hbox from the one line paragraph that contains your parbox in its first line.

All latex box commands start with \leavevmode so they start a paragraph with the normal indent, center in a center environment etc. If you put a tex primitive box onto the vertical list it is placed directly without any paragraph positioning.

\unvbox unboxes a box placing its contents on the current vertical list (and generates an error if the current list is horizontal) \box and \copy places the box itself on the current horizontal or vertical list.

  • Many thanks for that, @DavidCarlisle - I had no idea about these intricacies, until now. Cheers!
    – sdaau
    Jul 2 '14 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.