Place figures after evoking the figure* environment using fixltx2e

I know there is a couple of questions about placing figures, tables, floats in general as in, e.g., Keeping tables/figures close to where they are mentioned.

But my question is different. I am using the IEEEtran template. In the middle of the text I evoked the figure* environment because the figure that I have in hands is to big for just a column. However, that figure is shifted to the next page. Nothing wrong with that.

After doing that, I used the figure environment to place another figure. This new figure will appear after the last one. However, I think it looks better before the previous one (in previous page), otherwise there will be much text between the place that I want it to appear and the actual placement.

I noticed this only happens because I am using also the fixltx2e. The logical solutions would be to comment the \usepackage{fixltx2e} line or using the [H] from the float package. However, I am wondering if there is a better (clever) way to do this, while keeping the benefits of fixltx2e.

\documentclass{IEEEtran}

\usepackage{fixltx2e}
\usepackage{blindtext}
\usepackage{float}

\begin{document}

\Blindtext

\begin{figure*}
\caption{fig1}
\label{fig1}
\end{figure*}

\blindtext

\begin{figure}
\caption{fig2}
\label{fig2}
\end{figure}

\begin{figure}[H]
\caption{fig3}
\label{fig3}
\end{figure}

\end{document}

• If you dont use fixltx2e the floats will be numbered out of order, if you want the single column float to appear before the double you really want it to have a lower number so the easiest thing is to move it forward in the source file. – David Carlisle Sep 24 '14 at 20:49

The usual approach to these problems is to save the 'old' definitions of macros that are changed by loading the offending package, and then restore the old versions after \usepackage. The fixltx2e package changes nine macros which affect double column float placement. This example changes them back.

\documentclass{IEEEtran}

\makeatletter
\let\old@dblfloatplacement\@dblfloatplacement
\let\old@end@dblfloat\end@dblfloat
\let\old@doclearpage\@doclearpage
\let\old@startdblcolumn\@startdblcolumn
\let\old@xtryfc\@xtryfc
\let\old@ztryfc\@ztryfc
\usepackage{fixltx2e}
\let\@dblfloatplacement\old@dblfloatplacement
\let\end@dblfloat\old@end@dblfloat
\let\@doclearpage\old@doclearpage
\let\@startdblcolumn\old@startdblcolumn
\let\@xtryfc\old@xtryfc
\let\@ztryfc\old@ztryfc
\makeatother

\usepackage{blindtext}
\usepackage{float}

\begin{document}
\Blindtext
\begin{figure*}
\rule{0.9\textwidth}{20pt}
\caption{fig1}
\label{fig1}
\end{figure*}
\blindtext
\begin{figure}
\rule{0.45\textwidth}{20pt}
\caption{fig2}
\label{fig2}
\end{figure}
\end{document}


It should be noted that the float placement code in LaTeX is rather complex, so I can't be certain that this won't have an adverse effect on something else. In fact I wouldn't be surprised if either egreg or David Carlisle were to show up shortly and point out that this hack is a complete disaster.

• I wouldn't be so rude:-) – David Carlisle Sep 24 '14 at 20:48
• @DavidCarlisle --- Well I wouldn't take offense anyway; I'm perfectly happy to admit that I don't understand the code for fixltx2e, so I shouldn't really be hacking it. – Ian Thompson Sep 24 '14 at 20:51