I would like to add even vertical spaces after minipages in a same page. In other words, vertical spaces between adjacent minipages, the vertical space between the last minipage and the bottom of a page should be the same.
Expected page layout:
When all minipages can be put into 1 page, the typesetting is expected. But when all minipages spread to multiple pages, there is no vertical space after the last minipage in a page.
MWE:
\documentclass[a4paper]{article}
\usepackage[pass,showframe]{geometry}
\usepackage[demo]{graphicx}
\usepackage{pgffor}
\usepackage{multicol}
\begin{document}
\foreach \img / \imgw / \imgh in {{xxx.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.7\textheight}}} {
\noindent%
\begin{minipage}[t]{\linewidth}%
\includegraphics[width=\imgw,height=\imgh]{\img}%
\end{minipage}\par\vfill%
}
\end{document}
The output from the above code is:
How to achieve the expected layout?
Edit: Experiments with proposals
Because a minipage may contain text, caption and image in my real TeX source, I tried proposals:
\vspace*{\fill}\pagebreak[0]
from @egreg\vfill\null
from @Herbert
When a minipage only contains image, layouts looks the same. When a minipage contains 1 line text and an image, layouts looks the same.
But when a minipage contains a caption and an image, \vspace*{\fill}\pagebreak[0]
gives more compact layout, while \vfill\null
gives relative loose layout.
MWE:
\documentclass[a4paper]{article}
\usepackage[pass,showframe]{geometry}
\usepackage[demo]{graphicx}
\usepackage{pgffor}
\usepackage{caption}
\begin{document}
\foreach \img / \imgw / \imgh in {{xxx.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}},
{yyy.png/{\linewidth}/{0.2\textheight}}%
} {
\noindent%
\begin{minipage}[t]{\linewidth}%
\captionof{figure}{This is a caption}
\includegraphics[width=\imgw,height=\imgh]{\img}%
\end{minipage}\par\VFILL_PLACEHOLDER
}
\end{document}
And the question is how /null
changes space behavior?
\vspace*{\fill}