# “Extra }, or forgotten \endgroup” when combining “fixltx2e” and “preview” packages

In a two-column document with figure* floats, where the preview package is set up to preview floats, compilation seems to fail if the fixltx2e package is loaded:

\documentclass[twocolumn]{article}

\usepackage{fixltx2e}
\usepackage[active,floats]{preview}

\begin{document}
\begin{figure*}Test\end{figure*}
\end{document}


The first error message seen reads:

! Extra }, or forgotten \endgroup.
\@endfloatbox ...pagefalse \outer@nobreak \egroup
\color@endbox
l.7   \begin{figure*}Test\end{figure*}

?


The error vanishes if fixltx2e is not loaded or if the figure environment is used.

My goal is to "preview" all figures in a two-column document, so that \linewidth is set up correctly within the environments. What am I doing wrong? Is there a way to "fix" this while retaining fixltx2e? Is this package needed at all in a recent LaTeX installation?

-
The error happens when LaTeX is dealing with \@endfloatbox, which is modified by fixltx2e; the code of preview relies on the original kernel definition of \@endfloatbox. So I'm afraid it's a problem that should be solved on the preview side. – egreg Mar 5 '14 at 9:50
@egreg: Thanks, this explains it. If you could make your comment an answer, I'd accept and send a bug report to David Kastrup. – krlmlr Mar 5 '14 at 10:05

The error happens when \pr@\end@dblfloat is being executed, which uses \end@dblfloat.

Let's compare the definitions of \end@dblfloat in the kernel and in fixltx2e:

## latex.ltx

\def\end@dblfloat{%
\if@twocolumn
\@endfloatbox
\ifnum\@floatpenalty <\z@
\@largefloatcheck
\@cons\@dbldeferlist\@currbox
\fi
\ifnum \@floatpenalty =-\@Mii \@Esphack\fi
\else
\end@float
\fi
}


## fixltx2e.sty

\def\end@dblfloat{%
\if@twocolumn
\@endfloatbox
\ifnum\@floatpenalty <\z@
\@largefloatcheck
\global\dp\@currbox1sp %
\expandafter\@gobble\end@float
\fi
\else
\end@float
\fi
}


As you see, the \@largefloatcheck command is followed by two quite different paths and this confuses preview.sty that relies on the kernel definition.

I don't see any way around this, unless preview.sty is updated to consider the case when fixltx2e is loaded.

-
Thanks. I have notified David Kastrup. – krlmlr Mar 5 '14 at 11:59