线与线之间插入的长度是多少?

线与线之间插入的长度是多少?

我想将五张高度为 的图片.2\textheight放在一页上。但是,两张图片之间有一个很小的间隙,我认为这会导致最后一张图片放在第二页上。

我不知道要设置多少长度才能0pt避免这种情况。

更新:设置\lineskip为可0pt消除间隙,但第一页上仍然只放置四幅图像。

\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}

答案1

需要将其\lineskip设置为0pt。但是,建议将此更改限制在包含的图像中,方法是将其放入一个组中{...}。(vbox 参数已放入组中。)

\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}

答案2

[...]
\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}

相关内容