4

I tried all 3 options above that I have seen recommended in other threads/answers, but none seem to work

\begin{dmath}
P (A>B \cap A>B+C)=P(A>B+C)=P(A=\nolinebreak 3 \cap B=\nolinebreak 1 \cap C=\nolinebreak 1)=\frac{1}{3}\frac{1}{3}\frac{1}{3}=\frac{1}{27}
\end{dmath}

\begin{dmath}
P (A>B \cap A>B+C)=P(A>B+C)=P(A=\nolinebreak3 \cap B=\nolinebreak 1 \cap C=\nolinebreak1)=\frac{1}{3}\frac{1}{3}\frac{1}{3}=\frac{1}{27}
\end{dmath}

\begin{dmath}
P (A>B \cap A>B+C)=P(A>B+C)=P(A\hiderel{=}3 \cap B\hiderel{=}\cap C\hiderel{=}1)=\frac{1}{3}\frac{1}{3}\frac{1}{3}=\frac{1}{27}
\end{dmath}
1

2 Answers 2

3

Add a pair of braces ({}) around the part that shouldn't break:

\documentclass{article}

\usepackage{breqn}

\begin{document}
\begin{dmath}
P({A>B \cap A>B+C}) 
= P({A>B+C})
= P({A= 3 \cap B=1 \cap C=1})
=\frac{1}{3}\frac{1}{3}\frac{1}{3}
=\frac{1}{27}
\end{dmath}

\end{document}
1
  • Which shows the shortcomings of breqn. I want to decide where to break my equations.
    – egreg
    Sep 22, 2014 at 15:46
0

Althought it is not said in your question, neither exposed in the MWE, I suppose you are using the breqn package since it provides the dmath environment. This environment specifically breaks the equations, since it is meant to do so:

'breqn - Automatic line breaking of displayed equations (...) The sin­gle most am­bi­tious goal of the pack­age, how­ever, is to sup­port au­to­matic line­break­ing of dis­played equa­tions'.

Using another equation environment will solve it:

\[
P (A>B \cap A>B+C)=P(A>B+C)=P(A=\nolinebreak 3 \cap B=\nolinebreak 1 \cap C=\nolinebreak 1)=\frac{1}{3}\frac{1}{3}\frac{1}{3}=\frac{1}{27}
\]

\begin{equation}
P (A>B \cap A>B+C)=P(A>B+C)=P(A=\nolinebreak3 \cap B=\nolinebreak 1 \cap C=\nolinebreak1)=\frac{1}{3}\frac{1}{3}\frac{1}{3}=\frac{1}{27}
%label{eq:myeq} %optional
\end{equation}

\begin{dmath}
P (A>B \cap A>B+C)=P(A>B+C)=P(A\hiderel{=}3 \cap B\hiderel{=}\cap C\hiderel{=}1)=\frac{1}{3}\frac{1}{3}\frac{1}{3}=\frac{1}{27}
\end{dmath}

With \[ and \] you get numberless equations, and with the equation you get them numbered.

Since you equation is quite wide, you may want to display it in two lines, to have the numbering correctly set at the right:

\begin{equation}
\begin{aligned}
P (A>B \cap A>B+C) & = P(A>B+C)\\
& = P(A=\nolinebreak3 \cap B=\nolinebreak 1 \cap C=\nolinebreak1) = \frac{1}{3}\frac{1}{3}\frac{1}{3}=\frac{1}{27}
\end{aligned}
\end{equation}
2
  • Thank you for you response. The reason why I like dmath is because it is breaking equations pretty nicely automatically, so I don't have to do a manual approach :(
    – user62955
    Sep 22, 2014 at 14:47
  • array switches to \textstyle, and the spacing around the = is wrong, use aligned from amsmath. Sep 22, 2014 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .