
我正在使用IEEEtran
模板,兩列。當我想使用套件將4個圖形放在同一行(跨越兩列)時\subfigure
,每個圖形的寬度都設定為0.24\textwidth
,這四個圖形不能放在同一行。 (請參閱下面的乳膠程式碼和結果圖。)
\begin{figure*}[!t]
\centering
\begin{minipage}[htp]{1\textwidth}
\subfigure[\footnotesize x1.]{
\includegraphics[width=0.24\textwidth]{x1.eps}
\label{fig:x1}
}
\hfill
\subfigure[\footnotesize x2.]{
\includegraphics[width=0.24\textwidth]{x2.eps}
\label{fig:x2}
}
\hfill
\subfigure[\footnotesize x3.]{
\includegraphics[width=0.24\textwidth]{x3.eps}
\label{fig:x3}
}
\hfill
\subfigure[\footnotesize x4.]{
\includegraphics[width=0.24\textwidth]{x4.eps}
\label{fig:x4}
}
\vspace{-0.2cm}
\caption{\footnotesize xxxx.}\label{xxxx}
\end{minipage}
\end{figure*}
然而,當我不使用該\subfigure
包時,4 個數字可以正確地駐留在一行中。 (見下文)
\begin{figure*}[!t]
\centering
\begin{minipage}[htp]{0.24\textwidth}
\centering
\includegraphics[width=1\textwidth]{x1.eps}
\vspace{-0.6cm}%
\caption{\footnotesize x1.}
\label{fig:x1}
%\vspace{-0.2cm}%
\end{minipage}
\centering
\begin{minipage}[htp]{0.24\textwidth}
\centering
\includegraphics[width=1\textwidth]{x2.eps}
\vspace{-0.6cm}%
\caption{\footnotesize x2.}\label{fig:x2}
%\vspace{-0.2cm}%
\end{minipage}
\begin{minipage}[htp]{0.24\textwidth}
\centering
\includegraphics[width=1\textwidth]{x3.eps}
\vspace{-0.6cm}%
\caption{\footnotesize x3.}
\label{fig:x3}
%\vspace{-0.2cm}%
\end{minipage}
\centering
\begin{minipage}[htp]{0.24\textwidth}
\centering
\includegraphics[width=1\textwidth]{x4.eps}
\vspace{-0.6cm}%
\caption{\footnotesize x4.}\label{fig:x4}
%\vspace{-0.2cm}%
\end{minipage}
\vspace{-0.3cm}%
\end{figure*}
為什麼相同的寬度會導致不同的格式?
編輯:我已將 tex 和 eps 檔案上傳到這裡:http://pan.baidu.com/share/link?shareid=1594110695&uk=3776487005,組成一個 MWE。請打開該連結並點擊下圖所示的按鈕進行下載。 (打開的頁面將為中文。)
答案1
在內部subfigure
,您處於水平模式,因此您需要小心轉義行尾。你在哪裡有
\subfigure[\footnotesize x1.]{
\includegraphics[width=0.24\textwidth]{x1.eps}
\label{fig:x1}
}
每當一行不以 結尾時%
,您都會插入一個額外的空格字符,這會插入足夠的空間以使框填滿該行;見下文。
\documentclass[a4paper]{article}
\usepackage[draft]{graphicx}
\usepackage{subfigure}
\begin{document}
\begin{figure*}
\centering
\subfigure[x1.]{%
\includegraphics[width=0.24\textwidth]{x1.eps}%
\label{fig:x1}%
}%
\hfill
\subfigure[x2.]{%
\includegraphics[width=0.24\textwidth]{x2.eps}%
\label{fig:x2}%
}%
\hfill
\subfigure[x3.]{%
\includegraphics[width=0.24\textwidth]{x3.eps}%
\label{fig:x3}%
}%
\hfill
\subfigure[x4.]{%
\includegraphics[width=0.24\textwidth]{x4.eps}%
\label{fig:x4}%
}%
\caption{xxxx.}
\label{xxxx}
\end{figure*}
\end{document}
作為旁注,您不應該手動更改每個標題內的字體大小。使用caption
套件(等)在整個文件中自動執行此操作。