2
\documentclass{article}

\usepackage[showframe, nohead]{geometry}

\begin{document}
    \vspace*{-3em}
    \rule{3em}{3em}
\end{document}

Why does the rule protrude into the text area?

output

As a comparison, this is how it looks without the \vspace:

without vspace

And this is what I would have expected:

expected

jakun
  • 5,981

1 Answers1

6

You have to consider both \topskip and \lineskip.

\documentclass{article}

\usepackage[showframe, nohead]{geometry}

\begin{document}

\vspace*{\dimexpr-3em-\topskip-\lineskip}
\rule{3em}{3em}

\end{document}

enter image description here

egreg
  • 1,121,712