I am using the IEEEtran
template, two columns. When I want to put 4 figures in the same line (spanning two columns) using the \subfigure
package, with the width of each figure setting to 0.24\textwidth
, these four figures cannot be placed in the same line. (see below latex code and the resulting figure.)
\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*}
However, when I do not use the \subfigure
package, 4 figures can be correctly reside in one line. (see below)
\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*}
Why the same width leads to different formats?
Edit: I have upload the tex and eps files to here: http://pan.baidu.com/share/link?shareid=1594110695&uk=3776487005, which compose a MWE. Please open that link and click the button as shown in the figure below to download. (The opened page will be in Chinese.)
Best Answer
Inside
subfigure
, you're in horizontal mode, so you need to be careful of escaping your line ends. Where you haveyou insert an additional space character every time a line doesn't end with
%
, and this is inserting just enough space to cause the boxes to overfill the line; see below.As a side-note, you shouldn't be manually changing the font size inside each caption. Use the
caption
package (etc.) to do this automatically across your whole document.