28

我正在写我的论文,我正在努力将 2 个图像彼此相邻放置,以便第二个图像将沿着第一个图像垂直居中。我也试图使用subfigure而不是,subfloat但它们都不起作用。

这就是它的外观替代文本 http://img51.imageshack.us/img51/1174/screenshot20100224at712.png

我的代码是:

\begin{figure}[H]
\centering  \subfloat[H][sparse($\mathbf{A}$)]{\includegraphics[width=0.28\textwidth]{sparsesmall} \label{sparse}}
    \subfloat[H][full($\mathbf{A}$)]{\includegraphics[width=0.55\textwidth]{fullsmall}\label{full}}
  \caption{Representation of $\mathbf{A}$ in MATLAB}
  \label{schematic}
\end{figure}

有什么建议可以让它看起来比现在更好吗?谢谢

4

4 回答 4

45

您还可以使用\raisebox{x}{\includegraphics[...]{...}}wherex为负数将其向下移动,使用正数将其向上移动。

于 2010-06-23T21:27:51.363 回答
14

编辑:似乎subfig包有问题,特别是在使用 hyperref 时。在这种情况下,请尝试此答案subcaption中提到的包。

如果你使用subfig包,你可以很容易地做到这一点。解决方案在手册的第 5.4 节中:

\newsavebox{\tempbox}
\begin{figure}[H]
\sbox{\tempbox}{\includegraphics[width=0.28\textwidth]{sparsesmall}}
\subfloat[sparse($\mathbf{A}$)]{\usebox{\tempbox}\label{sparse}}%
\qquad
\subfloat[full($\mathbf{A}$)]{\vbox to \ht\tempbox{%
  \vfil
  \includegraphics[width=0.55\textwidth]{fullsmall}
  \vfil}\label{full}}%
  \caption{Representation of $\mathbf{A}$ in MATLAB}\label{schematic}
\end{figure}

我还没有测试过,可能有错别字,但它应该可以工作。

于 2010-02-24T18:51:47.263 回答
8

另一种解决方案(与subcaption包一起使用是

\begin{figure}[p]
        \centering
        \begin{subfigure}{.49\linewidth}
            \centering
            \caption{Large Picture}
            \includegraphics{LARGEPIC}
        \end{subfigure}
        \hfill
        \begin{subfigure}{.49\linewidth}
            \centering
            \caption{SMALL PIC}
            \includegraphics{small picture}
            \begin{minipage}{.1cm}
            \vfill
            \end{minipage}
        \end{subfigure} 
        \caption{Two pictures}
\end{figure}

单独的\vfill不起作用,这就是为什么它被放入minipage

于 2013-09-13T21:06:32.657 回答
2

我的方法是使用以内容为中心的方形 minipage:

\begin{figure}
\subfloat[Figure a]{%
\begin{minipage}[c][1\width]{0.5\textwidth}%
\includegraphics[clip,width=1\textwidth]{figurea}%
\end{minipage}}\subfloat[Figure b]{\centering{}%
\begin{minipage}[c][1\width]{0.5\textwidth}%
\begin{center}
\includegraphics[clip,width=0.6\textwidth]{figureb}
\par\end{center}%
\end{minipage}}
\caption{main caption}
\end{figure}

然而,这段代码是由 LyX 生成的,所以有点难看。

于 2011-01-31T11:17:06.330 回答