[Tex/LaTex] Minted and floatrow incompatible

floatrowminted

I encountered this error message while trying to use the minted package along the floatrow package:

(/usr/share/texlive/texmf-dist/tex/latex/floatrow/floatrow.sty
Package: floatrow 2008/08/02 v0.3b floatrow: float package extension
! Package floatrow Error: Do not use float package with floatrow.
(floatrow) The latter will be skipped.
See the floatrow package documentation for explanation.
Type H <return> for immediate help.
...
l.33 \@namedef{opt@floatrow.sty}{}\endinput}
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.

And I'm not Hercule Poirot at all.
I have to discard floatrow to make minted works.

mwe:

\documentclass{report}
\usepackage{minted}
\usepackage{floatrow}
\begin{document}
Hi
\end{document}

Best Answer

The packages float and floatrow are incompatible with each other.

However, minted has \RequirePackage{float} at the beginning, so that's the source of the message. Loading the two packages in the reverse order appears to solve the issue, but it can lead to problems later.

Actually, the float package seems to be used just in order to provide minted floats with the [H] option, which is bad anyway. The other features of float relevant for minted can be obtained with newfloat, that's not incompatible with floatrow.

You should make a feature request to the maintainer of minted, so as to provide a way to disable the loading of float.

In the meantime, you can disable it yourself.

\documentclass{report}

% pretend to already have loaded float
\makeatletter 
\@namedef{ver@float.sty}{3000/12/31}
\makeatother

\usepackage[newfloat]{minted}
\usepackage{floatrow}

\begin{document}

Hi

\begin{figure}
\fcapside
  {\caption{...}\label{...}}
  {...}
\end{figure}

\end{document}
Related Question