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

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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