I was trying to experiment with the code in this answer: Breakable vboxes, and I got something I didn't expect; consider this MWE:
\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
% \usepackage{lua-visual-debug}
\pagecolor{yellow!10}
\begin{document}
\lipsum[1]
\def\shouldUseParbox{1} % comment to undefine
\newbox\mybox
\ifx\shouldUseParbox\undefined%
%
\setbox\mybox=\vbox{%
\rightskip=35mm%
\lipsum[2-4]
}
%
\else% \shouldUseParbox defined:
%
\setbox\mybox=\vbox{%
\parbox[t]{0.7\textwidth}{%
\lipsum[2-4]
}%
}
%
\fi
First bit here:
\setlength{\fboxsep}{0pt}
% \copy\mybox
\hskip-1\parindent %\fbox will indent;
\fbox{\copy\mybox} %ok
\newbox\myboxtemp
\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;
\fbox{\copy\myboxtemp}
remains here:
\hskip-1\parindent %\fbox will indent;
\fbox{\copy\mybox}
% \setbox\myboxtemp=\unvbox\myboxtemp % "! A <box> was supposed to be here." ??
% \fbox{\unvbox\myboxtemp} % "! Missing } inserted." ??
\end{document}
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:
- Why can I not vsplit a parbox (in a vbox)? All I know is
\parboxis a LaTeX command, while\vsplitand rest are TeX core... What should one do if one need to split\parboxmaterial? - You can see I have to "unindent" (with
\hskip-1\parindent), so that the\fboxoutput is at the same position, as when fbox isn't used - why is this so? - Why can I use syntax like
\fbox{\copy\myboxtemp}- but I cannot use\fbox{\unvbox\myboxtemp}?? (I thought the effect of\unvboxwas the same as\boxand\copy, but apparently not?)


\vsplitto\vbox{\vbox{...}}either. A\vboxis treated as a single object (unless it is\unvboxed, but you can't\unvboxa\parbox). – egreg Jul 02 '14 at 21:00