# Force grid of images to be centered alone on a page

I'm always facing the same problem when it comes to images. I sometimes need to place an image centered alone on a page but it keeps sticking to the top of the page. I used for some images the minipage environment. But now I need to do this with a grid of 20 images and nothing is working.

\newpage
\begin{figure}[p]
\centering
\captionsetup[subfigure]{justification=raggedright}
\subcaptionbox*{0,1 s}{\includegraphics[width=1.2in,height=1.2in]{25.png}}\hspace{1em}
\subcaptionbox*{25 s}{\includegraphics[width=1.2in,height=1.2in]{26.png}}\hspace{1em}
\subcaptionbox*{750 s}{\includegraphics[width=1.2in,height=1.2in]{27.png}}\hspace{1em}
\subcaptionbox*{1618,55 s}{\includegraphics[width=1.2in,height=1.2in]{28.png}}\hspace{1em}
\subcaptionbox*{Al}{\includegraphics[width=0.15in,height=1.2in]{29.png}}\\
\subcaptionbox*{0,1 s}{\includegraphics[width=1.2in,height=1.2in]{30.png}}\hspace{1em}
\subcaptionbox*{25 s}{\includegraphics[width=1.2in,height=1.2in]{31.png}}\hspace{1em}
\subcaptionbox*{750 s}{\includegraphics[width=1.2in,height=1.2in]{32.png}}\hspace{1em}
\subcaptionbox*{1618,55 s}{\includegraphics[width=1.2in,height=1.2in]{33.png}}\hspace{1em}
\subcaptionbox*{Re}{\includegraphics[width=0.15in,height=1.2in]{34.png}}\\
\subcaptionbox*{0,1 s}{\includegraphics[width=1.2in,height=1.2in]{35.png}}\hspace{1em}
\subcaptionbox*{25 s}{\includegraphics[width=1.2in,height=1.2in]{36.png}}\hspace{1em}
\subcaptionbox*{750 s}{\includegraphics[width=1.2in,height=1.2in]{37.png}}\hspace{1em}
\subcaptionbox*{1618,55 s}{\includegraphics[width=1.2in,height=1.2in]{38.png}}\hspace{1em}
\subcaptionbox*{Ta}{\includegraphics[width=0.15in,height=1.2in]{39.png}}\\
\subcaptionbox*{0,1 s}{\includegraphics[width=1.2in,height=1.2in]{40.png}}\hspace{1em}
\subcaptionbox*{25 s}{\includegraphics[width=1.2in,height=1.2in]{41.png}}\hspace{1em}
\subcaptionbox*{750 s}{\includegraphics[width=1.2in,height=1.2in]{42.png}}\hspace{1em}
\subcaptionbox*{1618,55 s}{\includegraphics[width=1.2in,height=1.2in]{43.png}}\hspace{1em}
\subcaptionbox*{W}{\includegraphics[width=0.15in,height=1.2in]{44.png}}\\
\end{figure}


Is there a "clean" way to do this for all type of images, because this is really frustrating.

\documentclass{article}
\usepackage{float}
\usepackage{subcaption}
\usepackage[demo]{graphicx}
\usepackage[margin = 1in]{geometry}
\begin{document}
\vspace*{\fill}
\begin{figure}[p]
\centering
\captionsetup[subfigure]{justification=raggedright}
\begin{tabular}{ccccc}
\subcaptionbox*{0,1 s}{\includegraphics[width=1.2in,height=1.2in]{25.png}}&
\subcaptionbox*{25 s}{\includegraphics[width=1.2in,height=1.2in]{26.png}}&
\subcaptionbox*{750 s}{\includegraphics[width=1.2in,height=1.2in]{27.png}}&
\subcaptionbox*{1618,55 s}{\includegraphics[width=1.2in,height=1.2in]{28.png}}&
\subcaptionbox*{Al}{\includegraphics[width=0.15in,height=1.2in]{29.png}}\\
\subcaptionbox*{0,1 s}{\includegraphics[width=1.2in,height=1.2in]{30.png}}&
\subcaptionbox*{25 s}{\includegraphics[width=1.2in,height=1.2in]{31.png}}&
\subcaptionbox*{750 s}{\includegraphics[width=1.2in,height=1.2in]{32.png}}&
\subcaptionbox*{1618,55 s}{\includegraphics[width=1.2in,height=1.2in]{33.png}}&
\subcaptionbox*{Re}{\includegraphics[width=0.15in,height=1.2in]{34.png}}\\
\subcaptionbox*{0,1 s}{\includegraphics[width=1.2in,height=1.2in]{35.png}}&
\subcaptionbox*{25 s}{\includegraphics[width=1.2in,height=1.2in]{36.png}}&
\subcaptionbox*{750 s}{\includegraphics[width=1.2in,height=1.2in]{37.png}}&
\subcaptionbox*{1618,55 s}{\includegraphics[width=1.2in,height=1.2in]{38.png}}&
\subcaptionbox*{Ta}{\includegraphics[width=0.15in,height=1.2in]{39.png}}\\
\subcaptionbox*{0,1 s}{\includegraphics[width=1.2in,height=1.2in]{40.png}}&
\subcaptionbox*{25 s}{\includegraphics[width=1.2in,height=1.2in]{41.png}}&
\subcaptionbox*{750 s}{\includegraphics[width=1.2in,height=1.2in]{42.png}}&
\subcaptionbox*{1618,55 s}{\includegraphics[width=1.2in,height=1.2in]{43.png}}&
\subcaptionbox*{W}{\includegraphics[width=0.15in,height=1.2in]{44.png}}
\end{tabular}
\end{figure}
\vspace*{\fill}
\end{document}


I use \vspace*{\fill} to center the figure vertically. I like using tabular for something with this many figures but you don't need to if you don't want to. I used the package geometry with standard 1in margin and everything fit. Is your 5th picture having a width 0.15in a typo? As it is, I assumed that is what you wanted.

In case the 5th image size was a typo:

I had to set the margin to .75in. If you want to use the 1in margin for your document, you can set the margin of that page alone .75in to get it centered too.

• Thank you! I think I'm now using the float function correctly. For many tables and images in my document I used this \hspace*{\fill} \vspace{\fill} \pagebreak \newpage \makeatletter \setlength{\@fptop}{0pt} \setlength{\@fpbot}{0pt plus 1fil} \makeatother \clearpage I don't even know what this is, I just copied pasted it from somewhere. But now it's working.
– abdu
Jul 7 '13 at 12:50

Part of your problem may occur if your figure exceeds the right margin. You didn't include a full MWE, so it couldn't be checked. However, here is one way to achieve what I think is your goal, if the right margin is not at issue.

In the first figure, I use \includegraphics, just to show it works. For the rest, I left it as a \rule, for simplicity.

\documentclass{article}
\usepackage[oldsyntax]{stackengine}
\usepackage[demo]{graphicx}
\usepackage[letterpaper, portrait]{geometry}
% DEFINE TEXT LIMITS ON LETTER PAPER ACCORDING TO ARL STYLE.
\setlength\paperheight {11in}
\setlength\paperwidth  {8.5in}
\setlength\textwidth {7in}
\setlength\oddsidemargin {-0.3in}
\setlength\evensidemargin {-0.3in}
\setlength\topmargin {-0.5in}
\setlength\textheight {9.0in}
\raggedbottom
\begin{document}
\def\stackalignment{l}
\def\myfiga{\stackunder[3pt]{%
\includegraphics[width=1.2in,height=1.2in]{demo}}{0,1 s}}
\def\myfigb{\stackunder[3pt]{\rule{1.2in}{1.2in}}{25 s}}
\def\myfigc{\stackunder[3pt]{\rule{1.2in}{1.2in}}{750 s}}
\def\myfigd{\stackunder[3pt]{\rule{1.2in}{1.2in}}{1618,55 s}}
\def\myfige{\stackunder[3pt]{\rule{1.2in}{1.2in}}{Al}}
\def\myfigf{\stackunder[3pt]{\rule{1.2in}{1.2in}}{0,1 s}}
\def\myfigg{\stackunder[3pt]{\rule{1.2in}{1.2in}}{25 s}}
\def\myfigh{\stackunder[3pt]{\rule{1.2in}{1.2in}}{750 s}}
\def\myfigi{\stackunder[3pt]{\rule{1.2in}{1.2in}}{1618,55 s}}
\def\myfigj{\stackunder[3pt]{\rule{1.2in}{1.2in}}{Re}}
\def\myfigk{\stackunder[3pt]{\rule{1.2in}{1.2in}}{0,1 s}}
\def\myfigl{\stackunder[3pt]{\rule{1.2in}{1.2in}}{25 s}}
\def\myfigm{\stackunder[3pt]{\rule{1.2in}{1.2in}}{750 s}}
\def\myfign{\stackunder[3pt]{\rule{1.2in}{1.2in}}{1618,55 s}}
\def\myfigo{\stackunder[3pt]{\rule{1.2in}{1.2in}}{Ta}}
\def\myfigp{\stackunder[3pt]{\rule{1.2in}{1.2in}}{0,1 s}}
\def\myfigq{\stackunder[3pt]{\rule{1.2in}{1.2in}}{25 s}}
\def\myfigr{\stackunder[3pt]{\rule{1.2in}{1.2in}}{750 s}}
\def\myfigs{\stackunder[3pt]{\rule{1.2in}{1.2in}}{1618,55 s}}
\def\myfigt{\stackunder[3pt]{\rule{1.2in}{1.2in}}{W}}
\Sstackgap=1em

\begin{figure}
\centering
\Lstackgap=1.45in
\Longstack{%
{\protect\myfiga} {\protect\myfigf} {\protect\myfigk} {\protect\myfigp}%
}%
\hspace{1em}%
\Longstack{%
{\protect\myfigb} {\protect\myfigg} {\protect\myfigl} {\protect\myfigq}%
}%
\hspace{1em}%
\Longstack{%
{\protect\myfigc} {\protect\myfigh} {\protect\myfigm} {\protect\myfigr}%
}%
\hspace{1em}%
\Longstack{%
{\protect\myfigd} {\protect\myfigi} {\protect\myfign} {\protect\myfigs}%
}
\hspace{1em}%
\Longstack{%
{\protect\myfige} {\protect\myfigj} {\protect\myfigo} {\protect\myfigt}%
}
\end{figure}

\end{document}


[EDIT: This MWE uses obsolete stackengine syntax for setting stackgap lengths (e.g., \Sstackgap=1ex), which prevented scalable lengths from scaling under a fontsize change. Version 2 of the package (submitted JUL-11-13) remedies the problem with a small syntax change.]