# How to place several images on top of each other and center them on the page?

I can't figure out how to center the images. The aim is to center the images and make them large enough to stretch over the cropping line.

Optionally: Is it possible to control how close the images are (in other words how big is the gap between the bottom border of one image and the top border of another image).

\documentclass[12pt]{extbook}
% ############################## geometry
\usepackage%[showframe]
{geometry}
\geometry
{ hmarginratio =  1:1
, vmarginratio = 1:1
, bindingoffset = 0cm
, onecolumn
, a4paper
, layoutwidth = 50 mm
, layoutheight = 180 mm
, layouthoffset=\dimexpr(\paperwidth-\csname Gm@layoutwidth\endcsname)/2\relax
, layoutvoffset=\dimexpr(\paperheight-\csname Gm@layoutheight\endcsname)/2\relax
, showcrop
}
\usepackage{fancyhdr}
\usepackage{mwe}
\usepackage{graphicx}
% ############################### Document
\begin{document}
\pagenumbering{gobble}
\begin{figure}
\centering
\begin{minipage}[c]{\textwidth}
\centering
\noindent\includegraphics[width=5cm]{example-image}
\end{minipage}
\begin{minipage}[c]{\textwidth}
\centering
\noindent\includegraphics[width=5cm]{example-image}
\end{minipage}
\begin{minipage}[c]{\textwidth}
\centering
\noindent\includegraphics[width=5cm]{example-image}
\end{minipage}
\begin{minipage}[c]{\textwidth}
\centering
\noindent\includegraphics[width=5cm]{example-image}
\end{minipage}
\begin{minipage}[c]{\textwidth}
\centering
\noindent\includegraphics[width=5cm]{example-image}
\end{minipage}
\end{figure}
\end{document}

• Why all those minipages? I can't see the use. Try putting \vfill between the images. – Johannes_B Feb 17 '16 at 10:48
• Add package (not option) showframe additionally to geometry. – Johannes_B Feb 17 '16 at 10:52
• you do not want minipage or figure here, just \includegraphics and possibly some spacing commands. – David Carlisle Feb 17 '16 at 10:57
• see tex.stackexchange.com/questions/213286/christmas-list-catalog/… for explicit control over position of images and text – David Carlisle Feb 17 '16 at 11:01

The statement of the problem is not very clear, but perhaps this is what you want.

\documentclass[12pt]{extbook}

% ############################## geometry
\usepackage{geometry}
\geometry{
hmarginratio =  1:1,
vmarginratio = 1:1,
bindingoffset = 0cm,
onecolumn,
a4paper,
layoutwidth = 50 mm,
layoutheight = 180 mm,
layouthoffset=\dimexpr(\paperwidth-\csname Gm@layoutwidth\endcsname)/2\relax,
layoutvoffset=\dimexpr(\paperheight-\csname Gm@layoutheight\endcsname)/2\relax,
showcrop
}

\usepackage{graphicx}

% ############################### Document

\begin{document}
\thispagestyle{empty}

{\parindent=0pt
\newcommand{\shiftleft}{\hspace*{-0.5\dimexpr\csname Gm@layoutwidth\endcsname-\textwidth\relax}}

\shiftleft\includegraphics[width=5cm]{example-image}\shiftleft\vfill

\shiftleft\includegraphics[width=5cm]{example-image}\shiftleft\vfill

\shiftleft\includegraphics[width=5cm]{example-image}\shiftleft

}
\end{document}


• Excellent! How can I control the vertical position? (the gap between them). I want to place all 5 images close to each other. This is meant to be bookmark :) – chejnik Feb 17 '16 at 12:20
• @chejnik Put \vspace*{\fill} at the top and at the bottom, and \vspace{<whatever} between the images. – egreg Feb 17 '16 at 13:50
• Thank you, I am using \vspace and I have added also command to shift it up \newcommand{\shiftup}{\vspace*{-0.15\dimexpr\csname Gm@layoutheight\endcsname-\textwidth\relax}} (regards to your code). – chejnik Feb 17 '16 at 14:40