[Tex/LaTex] Problems with captions in the environment wrapfigure

captionsenvironmentserrorswrapfigure

I'm dealing with a rather weird issue. Using the enviroment \wrapfigure, I receive an error message

undefined control sequence \float@caption ... oxrestore ... 
\normalize @fs@capt ... 

let alone the caption doesn't show up the .pdf; while caption is working in any other environments (figure, subfigure, tabular). What is wrong?

Best Answer

Remove \restylefloat{figure} (and \restylefloat{table}) from your document preamble. In most cases it is simply not needed and it is only in the preamble because it was copied from another LaTeX document given by a friend or colleague (who did not know what \restylefloat does either).

But if you really need it (and really know what's good for and why you need it), you can try the following load order of packages:

...
\usepackage{float}
\usepackage{wrapfig}
...
\floatstyle{boxed} % or whatever
\restylefloat{figure}
...

This should fix the issue, too.