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 when using \vbox of a certain height, there is some extra space added below it.

I'm trying - towards grid typesetting - to put for example graphics in the vbox of a certain height (say 2 \baselineskip), so the picture should occupy the multiplicity of \baselineskip. However, it fails, since some extra space is added below the \vbox. Why?

I've tried to use \nointerlineskip after the \vbox, but no result.

I'm aware of the post How can I get interline spacing to ignore a vbox? , but it does not help me.

There is a MWE below, I include some rulers to more easily clarify the problem:

\documentclass[11pt]{article}  
\usepackage{lipsum}
%%% rulers
\usepackage{atbegshi,picture}
\makeatletter 
\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
  \put(\dimexpr
    \ifodd\value{page}\oddsidemargin\else\evensidemargin\fi + 1in\relax,
      -\dimexpr\topmargin + 1in + \headheight + \headsep\relax){%
       \begin{picture}(0,0)%
       \setlength{\unitlength}{13bp}%
        \setlength{\dimen0 }{0pt}%
        \@whiledim\dimen0<\dimexpr\textheight+1sp\relax\do{%
        \put(0,-\dimen0){\line(1,0){\textwidth}}%
        \addtolength{\dimen0 }{\unitlength}%
      }%
   \end{picture}%
  }%
 }%
}
\makeatother
 \makeatletter
 \setlength{\topskip}{13bp}
 \renewcommand\normalsize{%
  % \baselineskip to 13bp for \normalsize
  \@setfontsize\normalsize\@xipt{13bp}%
  % the following values are taken from size11.clo.
  \abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@
   \abovedisplayshortskip \z@ \@plus3\p@
   \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI 
   }
   \usepackage{parskip}
   \setlength{\parskip}{13bp}
   \makeatother
  \begin{document}
  \lipsum[1]
  \vbox to 2\baselineskip{ }
   \lipsum[1]
   \end{document}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

enter image description here

You need to take care of the depth of the previous line.

\documentclass[11pt]{article}  
\usepackage{lipsum}
%%% rulers
\usepackage{atbegshi,picture}
\makeatletter 
\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
  \put(\dimexpr
    \ifodd\value{page}\oddsidemargin\else\evensidemargin\fi + 1in\relax,
      -\dimexpr\topmargin + 1in + \headheight + \headsep\relax){%
       \begin{picture}(0,0)%
       \setlength{\unitlength}{13bp}%
        \setlength{\dimen0 }{0pt}%
        \@whiledim\dimen0<\dimexpr\textheight+1sp\relax\do{%
        \put(0,-\dimen0){\line(1,0){\textwidth}}%
        \addtolength{\dimen0 }{\unitlength}%
      }%
   \end{picture}%
  }%
 }%
}
\makeatother
 \makeatletter
 \setlength{\topskip}{13bp}
 \renewcommand\normalsize{%
  % \baselineskip to 13bp for \normalsize
  \@setfontsize\normalsize\@xipt{13bp}%
  % the following values are taken from size11.clo.
  \abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@
   \abovedisplayshortskip \z@ \@plus3\p@
   \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI 
   }
   \usepackage{parskip}
   \setlength{\parskip}{13bp}
   \makeatother
  \begin{document}
  \lipsum[1]
  \par\kern-\prevdepth%%%%%%%%%%%%%%%%%%%%%%%%
  \nointerlineskip
  \vbox to 2\baselineskip{ }
   \lipsum[1]
   \end{document}
share|improve this answer
    
marvellous, but why there are 3\baselineskip instead of 2? –  pml Feb 7 '13 at 22:45
1  
@pml The parskip, of course. Are you really sure you want big white stripes between paragraphs? –  egreg Feb 7 '13 at 22:45
    
clear, thanks a lot –  pml Feb 7 '13 at 22:47
    
@pml A tip: if you want to "see" the empty \vbox write \vbox to 2\baselineskip{\leaders\vrule width 1pt\vfill} –  egreg Feb 7 '13 at 22:52

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.