0

I'm working with small pages and I'll have one, two, or three short paragraphs per page.

I would like these paragraphs to be vertically centered and approximately-evenly spaced.

I am close with \setlength{\parskip}{\fill} and defining a \page command which is \vspace{\fill}\newpage or \vfill\newpage. However, I'm having trouble getting that equal amount of space before the first paragraph of each page.

Here's MWE demonstrating the issue

enter image description here

\vspace{\fill}/\vfill is discarded after a page-break, and so does nothing before the first paragraph, but \vspace*{\fill} creates a space that is much larger than what \parskip or \vspace{\fill} later on the page.

\documentclass{article}
\usepackage[paperheight=88mm, paperwidth=62mm, margin=4mm, nomarginpar, showframe]{geometry}

\setlength{\parskip}{\fill}
\setlength{\parindent}{0pt}
\newcommand{\page}{\vspace{\fill}\newpage\vspace{\fill}}

\begin{document}

\page

This should be at approximately 50\%.

\page

This should be at approx 33\%.

This should be at approx 66\%.

\page

This should be at approx 25\%.

This should be at approx 50\%.

This should be at approx 75\%.

\page
\vspace*{\fill}

This page starts with an explicit \verb|\vspace*{\fill}|

You can see the first space is larger than the others.

This should be at 75\%.

\vspace{\fill}
\end{document}

Note, there are a few similar un-answered questions:

Adding space before and after paragraph How to add space before and after paragraph?

1
  • You could also put each paragraph into a separate \begin{figure}[p] ... \end{figure} Aug 20 at 19:38

1 Answer 1

0

I found close behavior when using \vspace*{1\fill} but couldn't explain why. Thanks to David Carlisle's comment to my other (deleted) answer, I think I understand what's going on.

\vspace*{1\fill} adds zero-space, then starts a new paragraph (adding a new-line and then the implicit \parskip (aka \fill). So the answer is to use the \vspace*{} to undo the newline, then let the implicit \parskip take care of the rest.

\newcommand{\nextpage}{\vspace{\fill}\newpage\vspace*{-\baselineskip}} 

Here's the corrected MWE and the result. It's not perfect. Using my calipers on my physical screen, a better value is \vspace*{-1.2\baselineskip}. I don't understand why, but that is good enough.

\documentclass{article}
\usepackage[paperheight=88mm, paperwidth=62mm, margin=4mm, nomarginpar, showframe]{geometry}

\setlength{\parskip}{\fill}
\setlength{\parindent}{0pt}
\newcommand{\nextpage}{\vfill\newpage\vspace*{-\baselineskip}}

\begin{document}
\nextpage

This should be at approximately 50\%.

\nextpage

This should be at approx 33\%.

This should be at approx 66\%.

\nextpage

This should be at approx 25\%.

This should be at approx 50\%.

This should be at approx 75\%.

\nextpage

This page starts with an explicit \verb|\vspace*{\fill}|

You can see the first space is larger than the others.

This should be at 75\%.

\vspace{\fill}
\end{document}

enter image description here

It looks to me like the first paragraph is a little low

2
  • it would have been better to edit the previous example (or now delete in favour of this) Aug 21 at 7:26
  • It's not clear what this post is about. The last page doesn't start with an explicit \vspace{\fill}, but ends with it.
    – egreg
    Aug 21 at 10:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .