[Tex/LaTex] dmath puts too many line breaks in

breqnequationsmath-modepositioning

I've got the following code for an equation:

\begin{dmath}
    x \in A - B \leftrightarrow x \in A \textrm{ and } x \not\in B
\end{dmath}

It produces the output:

enter image description here

The equation really doesn't need so many line breaks, the whole thing could fit on one line. I then put a frame around it to see the bounds of the equation:

enter image description here

Is there a way to define the bounds of a dmath equation so that it isn't crammed into a really small box and given loads of line breaks?

Best Answer

I believe that breqn makes more problems that it solves. By default, every relation symbol in dmath marks a line break point for alignment. Those you don't want should be hidden. Choose one of the methods below.

\documentclass{article}
\usepackage{amsmath}
\usepackage{breqn}

\begin{document}
\begin{dmath}
    x \in A - B \leftrightarrow x \in A \text{ and } x \notin B
\end{dmath}
\begin{dmath}
    x \hiderel{\in} A - B \leftrightarrow x \hiderel \in A \text{ and } x \hiderel{\notin} B
\end{dmath}
\begin{dmath}
    {x \in A - B} \leftrightarrow {x \in A \text{ and } x \notin B}
\end{dmath}
\end{document}

Note that \not\in produces a wrong symbol and \notin should be used; this doesn't depend on breqn.

enter image description here

Related Question