1

I have a an equation with a long fraction and at each derivation step the fraction gets longer and the final fraction looks something like this :

    \begin{equation*}
\begin{split}
\frac{\sum_{A} P(Y|C= B, Y, G = H, A, K=0) P(Y, X < R, A)P(Y, X < R, A)P(C= Z | Y, W > K, A, U=0) P(Y, X < R, A)}{\sum_{A} P(T = K| A,S < Q A, W=0) P(N = K, A)P(N = K, A)P(N = K, A)P(N = K, A)}\\
\end{split}
\end{equation*}

I am on two column setting and have viewed a couple of posts where they were able to break the fraction either because it has a short dominator or it contains summation that can be broken into multiple lines like in here, here2, and here3. But in my case I am summing over the products in the nominator and dominator.

Moh
  • 35
  • 2

2 Answers2

1

You can introduce named terms, and split things up

enter image description here

\documentclass[twocolumn]{article}

\usepackage{amsmath}

\begin{document}

\noindent X\dotfill X

\begin{equation} \begin{split} \frac {\sum_{A} P(Y|C= B, Y, G = H, A, K=0) P(Y, X < R, A)P(Y, X < R, A)P(C= Z | Y, W > K, A, U=0) P(Y, X < R, A)} {\sum_{A} P(T = K| A,S < Q A, W=0) P(N = K, A)P(N = K, A)P(N = K, A)P(N = K, A)}\ \end{split} \end{equation}

\noindent X\dotfill X

\begin{align} &\frac{n}{d}\ \intertext{where} n&=\sum_{A} \left(\begin{aligned} &P(Y|C= B, Y, G = H, A, K=0)\ &P(Y, X < R, A)P(Y, X < R, A)\ &P(C= Z | Y, W > K, A, U=0)\ &P(Y, X < R, A) \end{aligned}\right)\[5pt] d&=\sum_{A} \left(\begin{aligned} & P(T = K| A,S < Q A, W=0)\ &P(N = K, A)P(N = K, A)\ &P(N = K, A)P(N = K, A) \end{aligned}\right) \end{align}

\noindent X\dotfill X \end{document}

David Carlisle
  • 757,742
  • Thank you. I also have some long equations without fractions and will do it the way you illustrated. Thanks again – Moh Nov 04 '23 at 00:18
1

The mathtools package, a superset of the amsmath package, provides a macro called \splitfrac, which can be nested, and lets users split long numerators and/or denominators into shorter, stacked parts. For the fraction at hand, it looks like applying 3 nested \splitfrac directives to the numerator (for a total of four rows) and 2 nested \splitfrac directives to the denominator (for a total of three rows) will get the job done.

Optionally, encase both the numerator and the denominator in \left( ... \right) pairs.

enter image description here

\documentclass[twocolumn]{article}
\usepackage{mathtools} % for \splitfrac
\let\P\relax % undefinet the `\P` macro
\DeclareMathOperator{\P}{P} % probability operator

\usepackage{lipsum} % filler text

\begin{document}

\begin{equation} \frac{% \left( \splitfrac{\sum_{A} \P(Y\mid C= B, Y, G = H, A, K=0)} {\splitfrac{\P(Y, X < R, A) \P(Y, X < R, A)} {\splitfrac{\P(C= Z \mid Y, W > K, A, U=0)} {\P(Y, X < R, A)}}} \right) }{% \left( \splitfrac{\sum_{A} \P(T = K\mid A,S < Q A, W=0)} {\splitfrac{\P(N = K, A)\P(N = K, A)} {\P(N = K, A)\P(N = K, A)}} \right) } \end{equation} \lipsum[1][1-5] % some filler text

\end{document}

Mico
  • 506,678