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 \vbox
es 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 \vbox
es, 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}