繁体   English   中英

子图 LATEX 的垂直对齐

[英]Vertical alignment of subfigures LATEX

我正在写我的论文,我正在努力将 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}

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

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

编辑:似乎subfig包有问题,尤其是在使用subfig时。 在这种情况下,请尝试本答案中提到的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}

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

另一个解决方案(与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

我的方法是使用以内容为中心的方形 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 生成的,所以有点难看。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM