# Which length is inserted between the lines?

I want to put five images with a height of .2\textheight onto a single page. However, there is a tiny gap between two images which, I think, leads to the last image beeing put on a second page.

I do not know which length has to be set to 0pt to avoid this.

Update: Setting \lineskip to 0pt removes the gap, but still only four images are put on the first page.

\documentclass{article}

\newlength\myheight
\setlength\myheight{5cm}
\newlength\mywidth
\setlength\mywidth{16cm}
\usepackage[
textheight=5\myheight,
textwidth=\mywidth,
a4paper,
centering
]{geometry}

\usepackage{graphicx}
\setlength\parindent{0pt}
\setlength\lineskip{0pt}
\begin{document}\raggedright
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}%
\end{document}

• There is \offinterlineskip, but you should use it only in a group, but I think it will not be sufficient – user31729 Sep 6 '17 at 7:48
• Re-defining \offinterlineskip to {} does not help. – Patrick Happel Sep 6 '17 at 7:55
• I did not say you should redefine \offinterlineskip, did I? ;-) Just say \offinterlineskip in such cases, but as I wrote also, it might be not sufficient – user31729 Sep 6 '17 at 9:23
• No, you didn't ;-) I was just thinking that it inserts some lengths and/or glues, which is obviously nonsense. I've looked it up in the meanwhile. – Patrick Happel Sep 8 '17 at 21:41

It is \lineskip which needs to be set to 0pt. However, it is advisable to limit this change to the included images by putting it into a group {...}. (The vbox argument is already put in a group.)

\documentclass{article}

\newlength\myheight
\setlength\myheight{5cm}
\newlength\mywidth
\setlength\mywidth{16cm}
\usepackage[
textheight=5\myheight,
textwidth=\mywidth,
a4paper,
centering
]{geometry}

\usepackage{graphicx}
\setlength\parindent{0pt}

\begin{document}\raggedright%
\vbox to \textheight{\setlength\lineskip{0pt}% or: \offinterlineskip
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}}%
\end{document}

• I have found \lineskip in the suggested related questions, too. But if I compile your example, the last image is still put on a second page. – Patrick Happel Sep 6 '17 at 7:50
• You can put the whole thing into a vbox of definite height (see edit). – AlexG Sep 6 '17 at 8:01
[...]
\usepackage{graphicx}
\setlength\parindent{0pt}
\begin{document}\offinterlineskip\enlargethispage{1pt}
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}\\
\includegraphics[width=\mywidth, height=\myheight]{example-image-a}%
\end{document}