# How to get \baselineskip instead of \lineskip when using a stored box?

Consider this code:

\documentclass{article}
\begin{document}
\pagestyle{empty}

\def\contents{%
\parindent = 0pt
\LARGE
\strut
\raise\baselineskip
\vtop
{%
{\Large\smash{Chapter}\par}%
title\par
}%
\par
}
\newbox\tempbox

\loggingoutput

\vspace*{20pt}%
\begingroup
\contents
\endgroup

\clearpage

\vspace*{20pt}%
\setbox\tempbox\vbox
\bgroup
\contents
\egroup
\noindent \box \tempbox

\end{document}

The \contents are supposed to be the a chapter heading, with Chapter written in one line and the chapter title in the line below.

I use that \raise\baselineskip\vtop{...} contraption to allow me to remove the Chapter text from starred chapters but still have the chapter titles in the same vertical position of the page.

All was fine until I needed to set this chapter head in a box before putting it on the output page. I thought that simply enclosing the whole thing in a \vbox to use later with \box would work, but I wouldn't be asking here if it did :)

The log shows this for the first page:

...\glue 20.0
...\glue 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 0.0
...\hbox(22.0+6.60007)x345.0

and this for the second:

...\glue 20.0
...\glue 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\lineskip) 1.0
...\hbox(22.0+6.60007)x345.0

the only difference being that in the first one TeX inserts \baselineskip before the contents and in the second it inserts a \lineskip.

Why does it do that? And how to do otherwise?

• Try \unvbox instead of \box. A box only has one baseline. – John Kormylo Mar 19 at 21:57
• @JohnKormylo Hm... Seems to work as well. I swear I had a good reason to use \box instead of \unvbox, but I can't remember it right now :P Thanks for the suggestion :-) – Phelype Oleinik Mar 19 at 22:15

• @PhelypeOleinik the two things are different \baselineskip is a target reference to reference space so the amount added depends on the depth of the previous line and the height of this, \lineskip is just an "emergency padding that tex adds to stop lines touching if baseline spacing can not be maintained. you can use \nointerlineskip before the line then neither is added and you can add an explicit vkip. – David Carlisle Mar 19 at 22:18