# Create zero vertical (and horizontal) between (non floating) images

Well right now I'm using a "hack & slash" approach to positioning figures. However I wish to position figures "inline": but connect the different figures without any space inbetween them.

\documentclass{article}
\usepackage{geometry}
\usepackage{graphicx}

\begin{document}
\includegraphics[width=3cm]{images/test1.jpg}
\hspace{-2.4mm}
\includegraphics[width=3cm]{images/test2.jpg}

\vspace{-0.4mm}
\includegraphics[width=3cm]{images/test3.jpg}
\end{document}


The "-2.4" and "-0.4" seem to do the trick: for the article class and for this specific case. I'm afraid this isn't a very good method and will break sooner or later.
Is there another way I can connect the images seamlessly? With less use of magic numbers?

• \includegraphics[width=3cm]{images/test1.jpg}\includegraphics[width=3cm]{images/test2.jpg} should work. If there are some white space between them probably it is because your images contain empty area around. – Sigur Jan 17 '17 at 22:14
• @Sigur, that solved the horizontal space problem (though makes the latex a bit harder to read). Vertically it doesn't (test images are just rectangles of a single color). – paul23 Jan 17 '17 at 22:19

The horizontal space is due to the end-of-lines: just suppress them. The vertical space can be suppressed by \nointerlineskip:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\includegraphics[width=3cm]{example-image}%
\includegraphics[width=3cm]{example-image}

\nointerlineskip
\includegraphics[width=3cm]{example-image}

\end{document}


A different approach is with a tabular, where again we suppress all spacings.

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}[htp]
\centering

% local settings
\setlength{\tabcolsep}{0pt}
\renewcommand{\arraystretch}{0}

\begin{tabular}{cc}
\includegraphics[width=3cm]{example-image} &
\includegraphics[width=3cm]{example-image} \\
\includegraphics[width=3cm]{example-image}
\end{tabular}

\end{figure}

\end{document}