如何将近 10 张图片放在一行多列中?

如何将近 10 张图片放在一行多列中?

我对这个 Latex 环境很陌生。

我已并排加载了最多 3 张图像0.3\textwidth

但我想将近 10 幅图像放在一行中,并分成多列,每列都有单独的标题。

例如这样

在此处输入图片描述

答案1

您似乎不需要标记子标题,因此一个简单的策略就可以起作用;如果需要对子标题进行编号,使用特定的命令将允许轻松修改其行为。

\documentclass{article}
\usepackage{graphicx}

\newcommand{\column}[2]{%
  % #1 = column of images
  % #2 = caption
  \begin{tabular}[b]{@{}c@{}}#1\\#2\end{tabular}%
}

\begin{document}

\begin{figure}[htp]
\centering

\begin{tabular}{
  @{}
  *{6}{c@{\hspace{4pt}}} % adjust to your needs (one less than the total)s
  c
  @{}
}
\column{
  \includegraphics[width=1.5cm]{example-image-a}\\
  \includegraphics[width=1.5cm]{example-image-b}\\
  \includegraphics[width=1.5cm]{example-image-c}
}{GS04}
&
\column{
  \includegraphics[width=1.5cm]{example-image-a}\\
  \includegraphics[width=1.5cm]{example-image-b}\\
  \includegraphics[width=1.5cm]{example-image-c}
}{NC05}
&
\column{
  \includegraphics[width=1.5cm]{example-image-a}\\
  \includegraphics[width=1.5cm]{example-image-b}\\
  \includegraphics[width=1.5cm]{example-image-c}
}{TP09}
&
\column{
  \includegraphics[width=1.5cm]{example-image-a}\\
  \includegraphics[width=1.5cm]{example-image-b}\\
  \includegraphics[width=1.5cm]{example-image-c}
}{QS09}
&
\column{
  \includegraphics[width=1.5cm]{example-image-a}\\
  \includegraphics[width=1.5cm]{example-image-b}\\
  \includegraphics[width=1.5cm]{example-image-c}
}{GCa10}
&
\column{
  \includegraphics[width=1.5cm]{example-image-a}\\
  \includegraphics[width=1.5cm]{example-image-b}\\
  \includegraphics[width=1.5cm]{example-image-c}
}{GCb10}
&
\column{
  \includegraphics[width=1.5cm]{example-image-a}\\
  \includegraphics[width=1.5cm]{example-image-b}\\
  \includegraphics[width=1.5cm]{example-image-c}
}{SLIC}
\end{tabular}

\caption{Some images}

\end{figure}

在此处输入图片描述

答案2

通过使用 tikz-matrix,我在这里显示了连续 6 张图像,但您可以将其扩展到 10 张图像。

    \documentclass{article}
    \usepackage{tikz}
    \usetikzlibrary{matrix,positioning}
   \begin{document}
   \begin{center}
     \begin{tikzpicture}
        \matrix (M)[matrix of math nodes,left delimiter={(},right delimiter={)}]
            {
              \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
              \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
             \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
             \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
              \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
            \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
             };

     \end{tikzpicture}
     \end{center}
     \end{document}

在此处输入图片描述

不使用分隔符,使用此命令left delimiter={.},right delimiter={.}可连续扩展至 10 幅图像

    \documentclass{article}        
    \usepackage{tikz}
    \usetikzlibrary{matrix,positioning}
   \begin{document}
   \begin{center}
     \begin{tikzpicture}
        \matrix (M)[matrix of math nodes,left delimiter={.},right delimiter={.}]
            {
              \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}};&\node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
              \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}};&\node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
             \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}};&\node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
             \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}};&\node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
              \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}};&\node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
            \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}};&\node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; & \node[]{\includegraphics[scale=0.1]{logo.jpg}}; \\
             };

     \end{tikzpicture}
     \end{center}
     \end{document}

在此处输入图片描述

答案3

floatrow使用及其环境很容易(sub)floatrow

\documentclass[11pt]{article}
\usepackage{geometry}
\usepackage{caption, subcaption}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{floatrow}

\DeclareFloatVCode{rowvsep}{\leavevmode} \renewcommand\captionskip{6pt}
\begin{document}

\lipsum[1]

\begin{figure}[!htb]
  \setlength\columnsep{0pt}
  \captionsetup{belowskip = 20pt}
  \floatsetup[table]{rowpostcode =rowvsep, midcode = captionskip}
  \ffigbox
  {\begin{subfloatrow}[10]
      \centering
      \ffigbox[0.1\textwidth]{\caption{SN1}\label{sn1}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN2}\label{sn2}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN3}\label{sn3}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN4}\label{sn4}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN5}\label{sn5}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN6}\label{sn6}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN7}\label{sn7}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN8}\label{sn8}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN9}\label{sn9}}{\includegraphics[scale=0.18]{snark}}
      \ffigbox[0.1\textwidth]{\caption{SN10}\label{sn10}}{\includegraphics[scale=0.18]{snark}}
    \end{subfloatrow}
    \bigskip

    \begin{subfloatrow}[8]
      \centering
      \ffigbox[0.125\textwidth]{\caption{SN1}\label{h-b1}}{\includegraphics[scale=0.18]{hare-blazon}}
      \ffigbox[0.125\textwidth]{\caption{SN2}\label{h-b2}}{\includegraphics[scale=0.18]{hare-blazon}}
      \ffigbox[0.125\textwidth]{\caption{SN3}\label{h-b3}}{\includegraphics[scale=0.18]{hare-blazon}}
      \ffigbox[0.125\textwidth]{\caption{SN4}\label{h-b4}}{\includegraphics[scale=0.18]{hare-blazon}}
      \ffigbox[0.125\textwidth]{\caption{SN5}\label{h-b5}}{\includegraphics[scale=0.18]{hare-blazon}}
      \ffigbox[0.125\textwidth]{\caption{SN6}\label{h-b6}}{\includegraphics[scale=0.18]{hare-blazon}}
      \ffigbox[0.125\textwidth]{\caption{SN7}\label{h-b7}}{\includegraphics[scale=0.18]{hare-blazon}}
      \ffigbox[0.125\textwidth]{\caption{SN8}\label{h-b8}}{\includegraphics[scale=0.18]{hare-blazon}}
    \end{subfloatrow}}{\caption{The Hunting of the Snark, and a Blazon}\label{hunt}}
\end{figure}

\end{document} 

在此处输入图片描述

相关内容