[Tex/LaTex] Double column float number with IEEEtran and dblfloatfix

floatstwo-column

dblfloatfix allow to place floats at the bottom of the page, however if by lack of chance there is another float on the same page, the correct numbering is not achieved (i.e. the double column float number is lower than the one of the other float on the same page). Is there an easy fix? Or only a workaround with manual setting of the float number (with \renewcommand\thefigure{x} for example)?

Here is a MWE:

\documentclass[a4paper,10pt,conference,twocolumn]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[cmex10]{amsmath}
\usepackage{mathtools}

\usepackage[demo]{graphicx}
\usepackage{dblfloatfix}

\usepackage{lipsum}

\begin{document}

\lipsum[1-5]

\begin{figure*}[b] % will appear at the bottom of the next page
\centering
  \includegraphics{Some-image-1}
\caption{A caption}
\end{figure*}

\newpage

\begin{figure}[t]
\centering
  \includegraphics{Some-image-2}
\caption{Another caption}
\end{figure}

\end{document}

Best Answer

LaTeX had a longstanding bug (or rather, documented deficiency) that the numbering of double column floats could get out of sequence with single column floats. There were packages available to address this, and form the 2015 LaTeX release onwards the fix was included in the format by default.

However the bottom float addition added here is based on the earlier code and so gets out of sequence. Updating it to match the new code would be relatively involved and for a single document it is easier just to correct the numbering as below, forcing the value of the figure counter for the floats that swapped position, making sure to reset it back to normal at the end so later floats get the correct automatic numbering.

enter image description here

\documentclass[a4paper,10pt,conference,twocolumn]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[cmex10]{amsmath}
\usepackage{mathtools}

\usepackage[demo]{graphicx}
\usepackage{dblfloatfix}

\usepackage{lipsum}

\begin{document}

\lipsum[1-5]

\begin{figure*}[b] % will appear at the bottom of the next page
\centering
  \includegraphics{Some-image-1}
\setcounter{figure}{1}
\caption{A caption}
\end{figure*}

\newpage

\begin{figure}[t]
\centering
  \includegraphics{Some-image-2}
\setcounter{figure}{0}
\caption{Another caption}
\setcounter{figure}{2}
\end{figure}

\end{document}
Related Question