2

How do I insert some text in exactly the vertical middle of the remainder of a page? Something like \vspace{0.5\fill}

The following MWE currently adds the text to the end of the page.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\vfill
\centering{END OF DOCUMENT}
\end{document}
3
  • 5
    add another \vfill after the text. Feb 12, 2020 at 17:34
  • Or use \vfil instead of \vfill because TeX insert \vfil automatically on the end of outputted page. Feb 12, 2020 at 18:19
  • 1
    \centering does not take an argument so the braces in \centering{END OF DOCUMENT} are not doing anything. (or course as it's the end , it doesn't matter that the rest of the document is centred but it looks odd in the source. Feb 12, 2020 at 18:21

1 Answer 1

3

Fill before and after. Of course, if the “end of document” doesn't fit the page, you will get an almost empty new page.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]

\vspace*{\fill}
{\centering END OF DOCUMENT\par\nopagebreak}
\vspace*{\fill}

\end{document}
1
  • how does one calculate the space after \lipsum to end of page - idea was to then get the midway point and use tikz to insert text
    – js bibra
    Feb 13, 2020 at 1:29

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.