# Breqn and wrapfig incompatibilitiy

Hello I finally arrived to this awesome place :) ,

I noticed that breqn does not go very well with wrapfigure:

\documentclass[]{article}
\usepackage{mathtools}  % Math packages

\usepackage{wrapfig}
\usepackage{breqn} % better equations

\begin{document}
\begin{wrapfigure}{r}{0.4\linewidth}
\centering
\def\svgwidth{1cm}
\includegraphics[width=1\linewidth]{./Figures/ell.pdf}
\end{wrapfigure}
With gravitational force in z direction:

\begin{dmath*}
g = 0
\end{dmath*}
\end{document}


This produces multiple errors for me using MiKTeX:

! Missing number, treated as zero. ! Illegal unit of measure (pt
inserted). ! Missing \endcsname inserted. ! TeX capacity exceeded,
sorry [main memory size=3000000].


Now in that particular example, if I lower 0.4\linewidth to 0.2\linewidth, it works. Also, when I use \equation instead of \dmath, it works. It seems as if breqn doesn't like stuff to float into its equations.

Is there any workaround for this situation? Or could I use something else instead of wrapfigure? I just want my figures to float around in my document without producing error messages. Thanks

breqn should be considered as an interesting but highly experimental package that is incompatible with virtually everything. It's probably not robust enough for use in a production setting.

However you can hide it in a minipage here so it isn't confused by wrapfig.

\documentclass[]{article}
\usepackage{mathtools}  % Math packages

\usepackage{wrapfig}

\usepackage{breqn} % better equations

\begin{document}

\begin{wrapfigure}{r}{0.4\linewidth}
\centering
\def\svgwidth{1cm}
\rule{\linewidth}{2cm}
\end{wrapfigure}
With gravitational force in z direction:

\noindent\begin{minipage}{.6\linewidth}
\begin{dmath*}
g = 0
\end{dmath*}
\end{minipage}
\end{document}