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'm new to LaTeX altogether and discovered something strange while fiddling around with a few commands. Take this simple case of the vspace command:

\documentclass[]{article}

\begin{document}

\noindent
p

\vspace{10 mm}

\noindent
b

\end{document}

This should just insert a 10mm gap between the lower tip of p and the upper tip of b. Unfortunately, when I typeset it and measured the gap with a rule, it turned out to be around 18-19mm. I use TeXstudio as my LaTeX editor and was wondering whether the editor has something to do with this?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

TeX doesn't work as you're conjecturing.

The normal distance between the two lines would be, measured from the baseline where the p is sitting to the next baseline (the b), 12pt.

The lower tip of the p is 1.94444pt below the baseline, the upper tip of the b is 6.94444pt above the baseline. So the normal distance between the two points is 3.11112pt = 1.09343mm

If you add to this 10mm you get a distance of 11.09343mm, which corresponds to the image below, generated by the minimal document

\documentclass{article}
\begin{document}

\noindent p

\vspace{10mm}

\noindent b%
\settoheight{\dimen0}{b}\smash{\raisebox{\dimen0}{\vrule height 11.09343mm}}

\end{document}

The line under \noindent b just adds the measuring rule that doesn't contribute to the normal spacing because of the \smash. If you get 18mm then you have other settings that you're not specifying.

enter image description here

share|improve this answer
    
Sorry for the stupid question. The generated .pdf file was zoomed in to 150-160% and I had completely overlooked that. Thanks for the information though –  Chatterjee May 27 '12 at 10:30
    
It's not a stupid question at all! It underlines a very important feature of TeX. –  egreg May 27 '12 at 10:40
1  
If you're on Windows, PDF XChange Viewer has a built-in measuring rule that will give you the actual "PDF's" distance, independently of zooming –  Brent.Longborough May 27 '12 at 18:32

To see what TeX is doing add

\showoutput
\showboxdepth=3

To your preamble, and TeX will log:

...\glue(\topskip) 5.69446
...\hbox(4.30554+1.94444)x345.0, glue set 339.44443fil []
...\glue 28.45274
...\glue 0.0
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 3.11111
...\hbox(6.94444+0.0)x345.0, glue set 339.44443fil []

The two hboxes are your p and b, between them is the glue you specified, the baselineskip and parskip glue (which can stretch but won't in this case).

The vspace you added is additional space not the space between the letters. If you had not added a space then the space would not have been 0, TeX does not set lines of text so that ascenders of one line touch the descenders of the line above unless you set very non-standard settings of its parameters.

share|improve this answer

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.