3

I have a two column document in which I display a lot of figures. I also have to display some figures spanning the two columns.

To display "normal" figures I use this piece of code, for example:

\documentclass[conference]{IEEEtran}
\usepackage{subfig}
\usepackage{fixltx2e}
\usepackage{stfloats}

\begin{document}

\begin{figure}[!htb]
\centering
\subfloat[]{\includegraphics[width=0.49\linewidth]{figs/Case1/potential1_sd}} \hfill
\subfloat[]{\includegraphics[width=0.49\linewidth]{figs/Case1/potential2_sd}} \hfill
\subfloat[]{\includegraphics[width=\linewidth]{figs/Case1/sd_colorbar}} 
\caption{}
\label{fig:case1_sd}
\end{figure}

\end{document}

To span a figure in two columns:

\begin{figure*}
\centering
\subfloat[]{\includegraphics[width=0.32\textwidth]{figs/Case1/potential1_feat}} \hfill
\subfloat[]{\includegraphics[width=0.32\textwidth]{figs/Case1/potential2_feat}} \hfill
\subfloat[]{\includegraphics[width=0.32\textwidth]{figs/Case1/sd_colorbar}} 
\caption{}
\label{fig:case1_feat}
\end{figure*}

EDIT:

The problem seems to be happening with this piece of code:

\begin{figure*}
\subfloat[Vector Field]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_vector_field}} \hfill
\subfloat[Curl-free Component]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_rotational_free}} \hfill
\subfloat[Divergence-free Component]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_divergence_free}} \hfill
\subfloat[Harmonic]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_harmonic}} \\
% If I comment this line, everything works. Can't I use two rows too?
\subfloat[]{\includegraphics[width=.5\textwidth]{figs/Case1/quiver_colorbar}} 
\caption{Mean vector fields. The color bar represents the vectors magnitudes.}
\label{fig:case1_meanvecs}
\end{figure*}

If I commented it, the others figures, including two column figures displayed with the code above, can be seen in the document.

However, when I enable the second piece of code, all figures in my .tex disappear. I lose references, everything. I don't know what I'm doing wrong.

Thank you in advance.

pceccon
  • 861
  • What happens if you switch the subfigure widths from 0.32\textwidth to, say, 0.3\textwidth? Incidentally, since the subfigures jointly span the width of either a column or the full text block, \centering isn't needed in either case. – Mico Sep 02 '14 at 19:45
  • Nothing has happened here. Still no figures. Thanks for the \centering tip. (: – pceccon Sep 02 '14 at 19:48
  • 2
    unrelated but [!htb] omits p so makes it quite hard to position the float and makes it more likely that all floats go to the end of the document. Also, habitually using ! is odd: it says to ignore the default constraints, so if you always do that it is better to simply change the specified constraints. – David Carlisle Sep 02 '14 at 20:17
  • Yes, that is happening and I was looking for a solution, @DavidCarlisle. Thank you. – pceccon Sep 02 '14 at 20:33

1 Answers1

2

To get a line break between (some of) the subfigures, just provide a blank line where the break should occur -- no need for \\.

By the way, I had to comment out the instruction \usepackage{stfloats} to get your code to compile. Do you really need this package?

enter image description here

\documentclass[conference]{IEEEtran}
\usepackage[demo]{graphicx} % added to make your file compilable
\usepackage{subfig}
\usepackage{fixltx2e}
%\usepackage{stfloats}

\begin{document}

\begin{figure*}
\subfloat[Vector Field]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_vector_field}} \hfill
\subfloat[Curl-free Component]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_rotational_free}} \hfill
\subfloat[Divergence-free Component]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_divergence_free}} \hfill
\subfloat[Harmonic]{\includegraphics[width=.2\textwidth]{figs/Case1/quiver_harmonic}} 

\subfloat[]{\includegraphics[width=.5\textwidth]{figs/Case1/quiver_colorbar}} 
\caption{Mean vector fields. The color bar represents the vectors magnitudes.}
\label{fig:case1_meanvecs}
\end{figure*}
\end{document}
Mico
  • 506,678
  • Hi, @Mico. Thank you. I don't think I need the stfloats, it was already in the template and, since I didn't had any problem with it, I let it there. (: – pceccon Sep 02 '14 at 21:28