8

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?

  • 1
    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
7

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.