1

This is sort a follow-up to my question How can I make a series of images (with some text) flow with minimal whitespace?. There are a couple differences from that question that hopefully simplify things.

I want to display several images in a row (vertically stacked) that were originally cropped from the same image. This means that the images should not just be close to each other, but match exactly.

If I do this using a series of \includegraphics[width=\textwidth]{imageFilename} commands, then the images all have at least 1pt of whitespace between them. Setting \setlength{\lineskip}{0pt} removes 1pt from in between all images, but some images (I have not figured out what makes them different) still have varying amounts of space in between them.

How can I remove all of these spaces while also not making the images overlap?

EDIT: here's a full example:

\documentclass{book}
    \usepackage[utf8]{inputenc}
    \usepackage{graphicx}
    \usepackage[margin=30px,paperwidth=780px,paperheight=1100px,footskip=0px]{geometry}


    \setlength{\lineskip}{0pt}


    \begin{document}
    \noindent
        \includegraphics[width=\textwidth]{image0.jpg}
        \includegraphics[width=\textwidth]{image1.jpg}
        \includegraphics[width=\textwidth]{image2.jpg}
        \includegraphics[width=\textwidth]{image3.jpg}
        \includegraphics[width=\textwidth]{image4.jpg}
        \includegraphics[width=\textwidth]{image5.jpg}
        \includegraphics[width=\textwidth]{image6.jpg}
        \includegraphics[width=\textwidth]{image7.jpg}
        \includegraphics[width=\textwidth]{image8.jpg}
        \includegraphics[width=\textwidth]{image9.jpg}
        \includegraphics[width=\textwidth]{image10.jpg}
        \includegraphics[width=\textwidth]{image11.jpg}
        \includegraphics[width=\textwidth]{image12.jpg}
        \includegraphics[width=\textwidth]{image13.jpg}
        \includegraphics[width=\textwidth]{image14.jpg}
        \includegraphics[width=\textwidth]{image15.jpg}
        \includegraphics[width=\textwidth]{image16.jpg}
        \includegraphics[width=\textwidth]{image17.jpg}
        \includegraphics[width=\textwidth]{image18.jpg}
        \includegraphics[width=\textwidth]{image19.jpg}
        \includegraphics[width=\textwidth]{image20.jpg}
        \includegraphics[width=\textwidth]{image21.jpg}
        \includegraphics[width=\textwidth]{image22.jpg}
        \includegraphics[width=\textwidth]{image23.jpg}
        \includegraphics[width=\textwidth]{image24.jpg}
\end{document}

The images are of varying heights, but are all the same width. All together, they are taller than the page they are on.

1 Answers1

0

The height of some of your images (for example, image5.jpg) is smaller than the normal baseline skip, hence a vertical space of value \baselineskip - <height of image> is shown. This happens between image4.jpg and image5.jpg for the first time.

Locally sets \setlength\baselineskip{0pt} solves your problem.

An example using image4.jpg and image5.jpg from https://www.overleaf.com/read/dcsspgpjdxnj (can be cloned using git clone https://git.overleaf.com/5ec05f431ad7ca00019d99ae):

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[margin=30px,paperwidth=780px,paperheight=1100px,footskip=0px]{geometry}

\raggedbottom

\begin{document}
    \begingroup
    \par
    \setlength{\lineskip}{0pt}
    \setlength{\baselineskip}{0pt}
    \noindent
    %
    \includegraphics[width=\textwidth]{image4.jpg}
    \includegraphics[width=\textwidth]{image5.jpg}
    \par
    \endgroup
\end{document}
muzimuzhi Z
  • 26,474
  • 1
    You probably want to set \raggedbottom locally and to use \raggedright rather than \noindent. – egreg May 17 '20 at 09:16