[Tex/LaTex] dmath inside dgroup writes over equation number

breqnequations

The following gives an output where the second eqaution writes over the equation number

\documentclass{report}
\usepackage{amssymb,amsmath}
\usepackage{breqn}

\begin{document}

\begin{dgroup}
  \begin{dmath}
    a = a
  \end{dmath}
  \begin{dmath}
    a = a +a+a+a+ b+b+b+b+b+b+b+b+b+b+b+b+b+a+a+a
 \end{dmath}
\end{dgroup}

\end{document}

Using just

  \begin{dmath}
    a = a +a+a+a+ b+b+b+b+b+b+b+b+b+b+b+b+b+a+a+a
 \end{dmath}

without the dgroup environment leads to correct output.

It looks like this ((1a) and (1.b) are in the dgroup environment whereas (2) is not):
enter image description here

Did I make a mistake or is this a bug?
What is the correct way to handle this situation?

Best Answer

The bregn package is alpha software and this unlikely to change. See the package's documentation for a number of open issues. So to answer your first question, yes this is a bug.

There are a number of internal variables you can adjust, either globally or internally in a given group, to work around your problem. The most relevant choice seems to be

  • \eqnumsep a dimension specifying the minimum space between the body and the equation number, default 10pt

In your example \eqnumsep=4em resolves the problem causing the line to break by moving the equation number to the next line. A larger value will cause the equation itself to break over two lines.

Sample output

\documentclass{report}
\usepackage{amssymb,amsmath}
\usepackage{breqn}

\begin{document}

\noindent
\verb+\eqnumsep=4em+
\begin{dgroup}\eqnumsep=4em
  \begin{dmath}
    a = a
  \end{dmath}
  \begin{dmath}
    a = a +a+a+a+ b+b+b+b+b+b+b+b+b+b+b+b+b+a+a+a
 \end{dmath}
\end{dgroup}

\noindent
\verb+\eqnumsep=5em+
\begin{dgroup}\eqnumsep=5em
  \begin{dmath}
    a = a
  \end{dmath}
  \begin{dmath}
    a = a +a+a+a+ b+b+b+b+b+b+b+b+b+b+b+b+b+a+a+a
 \end{dmath}
\end{dgroup}

\noindent
Default \verb+\eqnumsep+
\begin{dgroup}
  \begin{dmath}
    a = a
  \end{dmath}
  \begin{dmath}
    a = a +a+a+a+ b+b+b+b+b+b+b+b+b+b+b+b+b+a+a+a
 \end{dmath}
\end{dgroup}

\end{document}