14

我有兴趣制作一个包含多个子图的图。通过一些搜索,我发现了不同的方法,但对我不起作用。可能是我使用的是 shareLatex 而其他人使用的是适当的 Latex (我不知道有多大区别,如果我说一些奇怪的话,很抱歉)。下面给出的是代码...

\begin{figure}[t!]
    \centering
    \begin{subfigure}[t]{0.5\textwidth}
        \centering
        \includegraphics[height=1.2in]{Bilder/sample.png}
        \caption{Sample1}
    \end{subfigure}%
    ~ 
    \begin{subfigure}[t]{0.5\textwidth}
        \centering
        \includegraphics[height=1.2in]{Bilder/sample.png}
        \caption{sample2}
    \end{subfigure}
    \caption{Caption place holder}
\end{figure}

我的输出是这样的。

在此处输入图像描述

这与建议的解决方案既不合意也不相同。建议的解决方案示例如下。如何解决?

在此处输入图像描述

4

1 回答 1

20

我找到了这段代码,它非常适合子图。对于两个子图使用

\begin{figure}%
\centering
\subfigure[Sample1]{%
\label{fig:first}%
\includegraphics[height=2in]{Bilder/sample.png}}%
\qquad
\subfigure[Sample2]{%
\label{fig:second}%
\includegraphics[height=2in]{Bilder/sample.png}}%
\caption{sample}
\end{figure}

带样本输出

在此处输入图像描述

对于级联子图......

\begin{figure}%
\centering
\subfigure[][]{%
\label{fig:ex3-a}%
\includegraphics[height=2in]{Bilder/sample.png}}%
\hspace{8pt}%
\subfigure[][]{%
\label{fig:ex3-b}%
\includegraphics[height=2in]{Bilder/sample.png}} \\
\subfigure[][]{%
\label{fig:ex3-c}%
\includegraphics[height=2in]{Bilder/sample.png}}%
\hspace{8pt}%
\subfigure[][]{%
\label{fig:ex3-d}%
\includegraphics[height=2in]{Bilder/sample.png}}%
\caption[A set of four subfigures.]{A set of four subfigures:
\subref{fig:ex3-a} describes the first subfigure;
\subref{fig:ex3-b} describes the second subfigure;
\subref{fig:ex3-c} describes the third subfigure; and,
\subref{fig:ex3-d} describes the last subfigure.}%
\label{fig:ex3}%
\end{figure}

4 个子图的样本

在此处输入图像描述

于 2016-12-08T15:53:21.230 回答