如何将图像并排放置并叠放在一起

如何将图像并排放置并叠放在一起

我有 20 张图表,需要将它们并排放置以尽量减少它们占用的空间。理想的做法是这样的:在此处输入图片描述

我尝试了如下方法将它们分成 5 个不同的组:

\begin{center} 
\begin{figure}[H]
\centering\includegraphics[width=100mm]{Pics/h0.pdf}
\centering\includegraphics[width=100mm]{Pics/h1.pdf},
\centering\includegraphics[width=100mm]{Pics/h2.pdf}
\centering\includegraphics[width=100mm]{Pics/h4.pdf}
\caption{stuff.}
\label{markovianitydiagram}
\end{figure}
\end{center}

其他的也一样。这里我尝试将图像并排放在两行两列中。我使用的是 miktex。

答案1

这显示了如何在两页上打包 21 张图片。

\documentclass{article}
\usepackage{graphicx}
%\usepackage{subcaption}% \ContinuedFloat only needed if subcaptions are used
\usepackage{lipsum}% MWE only

\begin{document}
\lipsum[1]
\begin{figure}[htp!]% 1
\centering
\includegraphics[width=0.3\textwidth]{example-image-a}\hfil
\includegraphics[width=0.3\textwidth]{example-image-b}\hfil
\includegraphics[width=0.3\textwidth]{example-image-c}
\end{figure}
\begin{figure}[htp!]% 2
\centering
\includegraphics[width=0.3\textwidth]{example-image-a}\hfil
\includegraphics[width=0.3\textwidth]{example-image-b}\hfil
\includegraphics[width=0.3\textwidth]{example-image-c}
\end{figure}
\begin{figure}[htp!]% 3
\centering
\includegraphics[width=0.3\textwidth]{example-image-a}\hfil
\includegraphics[width=0.3\textwidth]{example-image-b}\hfil
\includegraphics[width=0.3\textwidth]{example-image-c}
\end{figure}
\begin{figure}[htp!]% 4
\centering
\includegraphics[width=0.3\textwidth]{example-image-a}\hfil
\includegraphics[width=0.3\textwidth]{example-image-b}\hfil
\includegraphics[width=0.3\textwidth]{example-image-c}
\end{figure}
\begin{figure}[htp!]% 5
\centering
\includegraphics[width=0.3\textwidth]{example-image-a}\hfil
\includegraphics[width=0.3\textwidth]{example-image-b}\hfil
\includegraphics[width=0.3\textwidth]{example-image-c}
\end{figure}
\begin{figure}[htp!]% 6
\centering
\includegraphics[width=0.3\textwidth]{example-image-a}\hfil
\includegraphics[width=0.3\textwidth]{example-image-b}\hfil
\includegraphics[width=0.3\textwidth]{example-image-c}
\end{figure}
\begin{figure}[htp!]% 7
\centering
\includegraphics[width=0.3\textwidth]{example-image-a}\hfil
\includegraphics[width=0.3\textwidth]{example-image-b}\hfil
\includegraphics[width=0.3\textwidth]{example-image-c}
\caption{21 Images}
\end{figure}

\lipsum[2-4]
\end{document}

答案2

正如评论中提到的,您可以尝试subfig并排对齐多个图形。

在这里,您可以指定每行和每列之间的距离,还可以为每个子图添加标题。

v01

\documentclass[varwidth=\maxdimen]{standalone}

\usepackage{graphicx,subfig,caption}

\begin{document}
    \begin{figure}
        \centering
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \\ \vspace{0.5cm}       
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \\ \vspace{0.5cm}   
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \\ \vspace{0.5cm}   
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
        \qquad
        \subfloat[subcaption]{\includegraphics[width=5cm]{example-image}}
    \end{figure}
\end{document}

答案3

在此处输入图片描述将来 您还可以轻松地为每幅图像添加\caption和。\label

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}

\begin{document}
\begin{minipage}{0.3\textwidth}
\includegraphics[width=1\linewidth]{example-image-a}
\end{minipage}
\hfill
\begin{minipage}{0.3\textwidth}
\includegraphics[width=1\linewidth]{example-image-b}
\end{minipage}
\hfill
\begin{minipage}{0.3\textwidth}
\includegraphics[width=1\linewidth]{example-image-c}
\end{minipage}

\vspace{1cm}

\begin{minipage}{0.3\textwidth}
\includegraphics[width=1\linewidth]{example-image-a}
\end{minipage}
\hfill
\begin{minipage}{0.3\textwidth}
\includegraphics[width=1\linewidth]{example-image-b}
\end{minipage}
\hfill
\begin{minipage}{0.3\textwidth}
\includegraphics[width=1\linewidth]{example-image-c}
\end{minipage}
\end{document}

相关内容