Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

enter image description here

\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.

share|improve this question
5  
\lineskip glue. Just add \nointerlineskip between the boxes. –  egreg Oct 30 '13 at 22:31
    
Thanks! That helped :) –  tohecz Oct 30 '13 at 22:33
add comment

1 Answer

up vote 11 down vote accepted

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.

share|improve this answer
    
You can accept an answer in 6 minutes :) –  tohecz Oct 30 '13 at 22:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.