子图LATEX的垂直对齐

Ver*_*a D 25 formatting latex image vertical-alignment

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

这是它看起来如何alt文本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}
Run Code Online (Sandbox Code Playgroud)

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

kra*_*lot 39

你也可以使用\raisebox{x}{\includegraphics[...]{...}}哪里x是负面向下移动而正面向上移动.


Alo*_*hal 13

如果使用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}
Run Code Online (Sandbox Code Playgroud)

我没有测试它,可能有拼写错误,但它应该工作.

  • 仅供参考,“subfig”包现在已经过时了。因此,应该使用“subcaption”(/sf/answers/1315667321/)的答案。 (2认同)

Jon*_*nas 5

另一个解决方案(与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}
Run Code Online (Sandbox Code Playgroud)

\vfill本身并不能工作,这就是为什么它被放入minipage