Adding vertical space at the start of a page
The space added by \vspace
is deleted at the beginning of the page, as you have seen. The command \vspace*
adds the space that is not deleted.
\documentclass{article}
\begin{document}
\vspace*{250px}
I want to be further down on the page :(
\vspace{250px}
Haha! Sucker :D
\end{document}
Spaces at page breaks are swallowed, as usually one doesn't want them. TeX starts counting from zero, so the first page is after a page break. :)
The solution is to issue \vspace*
instead of \vspace
.
I recommend not to use px
which is not what one with a CSS background would expect. Use rather cm
, mm
or in
or multiples of \baselineskip
:
\vspace*{2cm}
\vspace*{4\baselineskip}
The default value of 1px
is just 1bp
(where 72bp = 1in); it's a special unit of measure that can be tailored for specific applications concerning on-screen only documents. For example, to make a document as wide as a 1200 pixel screen at 96dpi, one can pass geometry a paper width of 1200px by
\pdfpxdimen=1in % just to start the computation
\divide\pdfpxdimen by 96 % 96 px are now 1in
\geometry{paperwidth=1200px}
For "paper" document, this is irrelevant.
In addition to the flurry of \vspace*
suggestions, you could also issue a "nothing" command to allow subsequent \vspace
s to typeset as expected. This "nothing" command could be an \mbox{}
(an empty box) or \null
, provided that you leave an empty line (or \par
) to be in vertical mode.
More specifically, you would need
\documentclass{article}
\begin{document}
\mbox{}% or \null; note the blank line below. Alternative, add \par on this line.
\vspace{250px}
I want to be further down on the page :(
\end{document}
although \null
is a better choice - it does not require the blank line or even \par
.