I have two \vbox typeset in different parts of the document, and I intend to append them as if all their contents were typeset only once in one \vbox. So linespacing remains constant going from one \vboxes contents to another, etc. Is there a clean way to do such an append?
My current technique causes insufficient space between baselines of last line of first \vbox, and first line of second \vbox. Ideally I would want a generic solution that works for appending any two \vboxes, and the result behaves as if all the contents of the final box were typeset once in one \vbox. Corollary: For now assume the line spacing in both boxes was same when they were independently typeset; as a corollary is it possible to have line spacing between last line of first box and first line of second box to be equal to the line spacing used in first box (assuming when the second box was typeset in the document it had a different linespacing).
Check the linespacing problem in this screenshot, and the full code example after it:
Code:
% file: vboxappend.tex
% >> lualatex vboxappend.tex
\documentclass[notitlepage,letterpaper]{article}
%NOTE: Uncomment the following line, and run with lualatex if you want to visualize debug markers
%\usepackage{lua-visual-debug}
\usepackage{geometry}
\usepackage[expansion=alltext,shrink=20,stretch=20]{microtype}
\usepackage{fontspec}
\usepackage{blindtext}
\geometry{left=2in,right=2in,top=1in,bottom=1in}
\setmainfont{Verdana}
\begin{document}
% First page without using vboxes
\thispagestyle{empty}
\newcommand{\mytesttext}{\blindtext[1]}
\mytesttext\par
\mytesttext
% Second page using vboxes
\newpage
\thispagestyle{empty}
\newbox\myvboxone
\setbox\myvboxone=\vbox{{\hsize=\textwidth \mytesttext \endgraf}}%
\newbox\myvboxtwo
\setbox\myvboxtwo=\vbox{{\hsize=\textwidth \mytesttext \endgraf}}%
\newbox\myvboxthree
\setbox\myvboxthree=\vbox{{\hsize=\textwidth \unvbox\myvboxone\unvbox\myvboxtwo \endgraf}}%
\box\myvboxthree
\end{document}




\vbox. The one thing I like about it so far is it can be split and/or joined, am not sure if any other boxes (parbox/minipage) can be. Though the one thing I do not like about\vbox(afaik) is that it cannot be nested like minipage. – codepoet Apr 12 '20 at 05:20\strutliberally, and if it does affect the typesetting of contents. I have used\vphantomin past, and surprisingly even though it is a zero-width entity, it does affect typesetting my moving the contents on the line as if it were real text. – codepoet Apr 12 '20 at 05:32\strutcan affect typesetting by interrupting the ignoring of spaces or by interfering with the hyphenation of words. Starting the text with\strutis no problem because the first word can't hyphenate anyway, and spaces are ignored after command names (after\strut, but not after arguments with\vphantom{}). For the\strutas the last thing in the last paragraph, make sure there is no space before the\strut, or you run the risk of having a blank line at the end of the paragraph (containing only\strut). – Donald Arseneau Apr 12 '20 at 06:10\myvboxtwoand tried to append the bottom split to\myvboxone, and it does not work; thats probably because the\strutwas in the top split, and since we don't know the position of a split upfront we cannot add a\strutupfront at some location. Is there a way to rebox a split\vboxto again add that\strut? That would enable appending\vboxsplits to another\vbox. – codepoet Apr 12 '20 at 07:30\vsplit\myvboxtwo? You don't need the strut in the bottom part after a split because you can set\splittopskip=\ht\strutbox\relax. Instead of adding a strut to text at the bottom of a box, add a vskip calculated using the depth of the box. – Donald Arseneau Apr 12 '20 at 09:00\splittopskip=\ht\strutbox\relaxworks if I split\myvboxtwo, but not if I instead split\myvboxone& append the top split of\myvboxone, to\myvboxtwo. – codepoet Apr 13 '20 at 02:24