# Tight connection of \vbox es

I don't understand why TeX put a thin whitespace between my two vertical boxes:

\documentclass{article}

\begin{document}

\vbox to 1cm {\rule{1cm}{1cm}}

\vbox to 1cm {\rule{1cm}{1cm}}

\end{document}


I would like this to show no whitespace between the black squares.

-
\lineskip glue. Just add \nointerlineskip between the boxes. –  egreg Oct 30 '13 at 22:31
Thanks! That helped :) –  yo' Oct 30 '13 at 22:33

## 1 Answer

A \vbox has for reference point the one corresponding to the last item in it, in this case the lower left corner of the rule. With \vbox to 1cm you force a height of 1cm (you probably have something else than a rule).

The second \vbox will be placed below the first one, but TeX always does its computations related to the interline skip. Since 1cm is way more than \baselineskip, under normal circumstances, TeX will insert \lineskip glue between the items.

No \parskip glue will be inserted, though, as a paragraph is never started.

Answer: inhibit the insertion of interline glue with

\nointerlineskip


Complete example:

\documentclass{article}

\begin{document}

\vbox to 1cm {\rule{1cm}{1cm}}
\nointerlineskip
\vbox to 1cm {\rule{1cm}{1cm}}

\end{document}


(blank lines can be used, because no paragraph will be started).

More information about \nointerlineskip can be found in TeX by Topic or, of course, the TeXbook.

-
You can accept an answer in 6 minutes :) –  yo' Oct 30 '13 at 22:38