2

I want to include several images just below each other without vertical space. How can I do this by adding some code to the preamble (i.e. I want this setting globally). Consider the following example:

\documentclass{article}

\usepackage[demo]{graphicx}
\begin{document}

\includegraphics{image1}

\includegraphics{image2}

\includegraphics{image3}

%% and a lot more images

\end{document}

Output:

enter image description here

You see there is a little bit vertical space bewtween the pictures. But I want to have no vertical space at all.

  • Without vertical image? You mean vertical space? – user31729 Sep 7 '15 at 17:03
5

Between lines is an additional \interlineskip. You have to kill this with \offinterlineskip, within a group.

\documentclass{article}

\usepackage[demo]{graphicx}
\begin{document}

\begingroup
\offinterlineskip
\includegraphics{image1}

\includegraphics{image2}

\includegraphics{image3}

\endgroup


\includegraphics{image4}

\includegraphics{image5}


\end{document}

Please note: The PDF viewer might show glued lower images too, but this is an PDF viewer issue!. The lower ones are separated!

3

Here, I just use a \Shortstack with 0pt stacking gap. Default alignment of the stack is centered, but that can be set with \def\stackalignment{<l,c, or r>}.

Being a stack, each set of stacked images must fit on a single page.

\documentclass{article}
\usepackage{stackengine}
\setstackgap{S}{0pt}
\usepackage[demo]{graphicx}
\begin{document}
\Shortstack{
\includegraphics[width=1in]{image1}
\includegraphics{image2}
\includegraphics[width=2cm]{image3}
}
%% and a lot more images

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.