簡體   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