# Inconsistent spacing between \unvbox and following text

The below MWE (from a cookbook document) has three parts: (1) a recipe name centered and in a 24pt script font, (2) a recipe story indented 17pts on the left and right and in a 12pt roman font, and (3) the actual recipe in a 2-column multicols environment and in an 11pt font.

What is interesting (and confusing) to me is that the specific characters used in section (1) impact the vertical distance between sections (2) and (3).

The MWE uses my actual script font Italianno (available for free under a SIL open font license). I realize that creates a problem in recreating my results. I commented out a substitute French Script font (that came with my Word installation) -- it also shows the problem. I imagine any script font having a 'g' with a large descender will work.

Here is a MWE:

\documentclass[11pt]{book}
\raggedbottom

\usepackage{fontspec, lipsum, multicol}

\newfontfamily\MyScriptFont{Italianno}[ % Available under SIL Open Font License
Extension=.otf,
UprightFont=*-Regular-OTF,
]

%\newfontfamily\MyScriptFont{FRSCRIPT}[ % included with my Microsoft Word installation
%Extension=.ttf,
%UprightFont=*,
%]

\begin{document}
\begin{center}%
{\MyScriptFont\fontsize{24}{29}\selectfont %
Chicken Sausage and Black Bean Chili\par %
}%
\end{center}%
%
\newbox\StoryBox
\setbox\StoryBox\vbox
{   \rmfamily\fontsize{12}{14.4}\selectfont
\newdimen\Width \Width = 17 pt \leftskip=\Width \rightskip=\leftskip
\lipsum[66]
}
\unvbox\StoryBox
%
\begin{multicols}{2}
\lipsum[66]
\end{multicols}
\end{document}


To see the issue, remove the 'g' from Sausage and recompile. Here is an image that shows the different vertical distances between sections (2) and (3) depending on whether the 'g' is in Sausage:

My question: In the "with g" and "without g" cases, why the different vertical distances between the indented text (I call section 2) and the multicols text (I call section 3).

As to why I am using \unvbox, see Wrapping (Jumping Over) One Text Block With Another Text Block

• multicols checks and uses prevdepth, but an unvbox doesn't change prevdepth, so you get the one from the previous "box" (your title). – Ulrike Fischer Jun 15 '18 at 21:24
• save the prevdepth in force after the last paragraph of the saved vbox and reset it after you unvbox it – David Carlisle Jun 15 '18 at 21:39

The command \unvbox doesn't update the parameter \prevdepth after the box is delivered (TeXbook, page 282).

You can remove the last box and reinsert it, so the \prevdepth will be updated.

\documentclass[11pt]{book}

\usepackage{fontspec, lipsum, multicol}

\newfontface\MyScriptFont{Italianno}[ % Available under SIL Open Font License
Extension=.ttf,
Path=./,
UprightFont=*-Regular,
]

\newdimen\Width
\newbox\StoryBox

\begin{document}

\setbox\StoryBox\vbox{
\rmfamily\fontsize{12}{14.4}\selectfont
\Width = 17 pt \leftskip=\Width \rightskip=\leftskip
\lipsum[66]\par
}

\begin{center}
\MyScriptFont\fontsize{24}{29}\selectfont
Chicken Sausage and Black Bean Chili\par
\end{center}
\unvcopy\StoryBox
\setbox0=\lastbox
\nointerlineskip
\box0
\begin{multicols}{2}
\lipsum[66]
\end{multicols}

\begin{center}
\MyScriptFont\fontsize{24}{29}\selectfont
Chicken and Black Bean Chili\par
\end{center}
\unvcopy\StoryBox
\setbox0=\lastbox
\nointerlineskip
\copy0
\begin{multicols}{2}
\lipsum[66]
\end{multicols}

\end{document}


Here I use \unvcopy in order to reuse the same box without destroying it.

Note that \newdimen should not be stated in the box, but in the preamble.

• The \unvbox purpose is shown in the link at the end of my question. My actual code includes an optional parameter so only an indicated number of lines are inserted if it otherwise pushes the recipe past the current page. If so, those indicated lines are \vsplit\StoryBox before the recipe and the rest are \unvbox\StoryBox after the recipe. I'm not clear whether that option is preserved in your (nice) solution. Is it valid (per David and implied by Ulrike) to \setlength{\saveprevdepth}{\prevdepth} within the \setbox and restore \predepth after the \unvbox? That seems to work in test code. – TMurphy Jun 15 '18 at 22:29
• @TMurphy You can only save the prevdepth at the end of the box (and the saving has to be global). Assuming that your \vsplit operations don't create empty boxes, the method with \lastbox will work for every \unvbox, because you want the depth of the last used line, not the depth of the last line in the main box that's then split. – egreg Jun 15 '18 at 22:33