How to split long Equations with long denominator in Latex
(this answer is based on the code provided in the "Corrected MWE" above.)
I suggest you load the mathtools
package and use several \splitdfrac
and \splitfrac
instructions; see below for an application of this idea. Second, I would replace the e^{...}
notation with \exp(...)
, as otherwise it's not easy to read the second-level superscript material. Third, I would use \bigl
and \bigr
to increase the sizes of some (but certainly not all) round parentheses and square brackets.
\documentclass{article}
\usepackage{mathtools} % for '\splitfrac' macro
\DeclareMathOperator{\E}{E} % expectations operator
\begin{document}
\begin{align}
\E_{q_2}(A,B)
&=\frac{1}{3n}\sum_{i=1}^{n}
\frac{\bigl[1-\exp\bigl(-\mu_{\!A}(x_i)\bigr)\bigr]\times
\bigl[1-\exp\bigl(-\mu_{\!B}(x_i)\bigr)\bigr]}{%
\biggl(\splitdfrac{%
\bigl[1-\exp\bigl(-\mu_{\!A}(x_i)\bigr)\bigr]^2
+\bigl[1-\exp\bigl(-\mu_{\!B}(x_i)\bigr)\bigr]^2}{%
-\bigl[1-\exp\bigl(-\mu_{\!A}(x_i)\bigr)\bigr]\times
\bigl[1-\exp\bigl(-\mu_{\!B}(x_i)\bigr)\bigr]}
\biggr)} \notag\\[1ex]
&+\frac{\bigl[1-\exp\bigl(-(1-v_{\!A}(x_i))\bigr)\bigr]\times
\bigl[1-\exp\bigl(-(1-v_{\!B}(x_i))\bigr)\bigr]}{%
\biggl(\splitdfrac{%
\bigl[1-\exp\bigl(-(1-v_{\!A}(x_i))\bigr)\bigr]^2
+\bigl[1-\exp\bigl(-(1-v_{\!B}(x_i))\bigr)\bigr]^2}{%
-\bigl[1-\exp\bigl(-(1-v_{\!A}(x_i))\bigr)\bigr]\times
\bigl[1-\exp\bigl(-(1-v_{\!B}(x_i))\bigr)\bigr]}
\biggr)} \notag\\[1ex]
&+\frac{%
\biggl(\splitdfrac{%
\bigl[1-\exp\bigl(-\frac{1}{2}(1+\mu_{\!A}(x_i)-v_{\!A}(x_i))\bigr)\bigr]}{%
\times
\bigl[1-\exp\bigl(-\frac{1}{2}(1+\mu_{\!B}(x_i)-v_{\!B}(x_i))\bigr)\bigr]}
\biggr)}{%
\left(\splitdfrac{%
\splitfrac{%
\bigl[1-\exp\bigl(-\frac{1}{2}(1+\mu_{\!A}(x_i)-v_{\!A}(x_i))\bigr)\bigr]^2}{%
+\bigl[1-\exp\bigl(-\frac{1}{2}(1+\mu_{\!B}(x_i)-v_{\!B}(x_i))\bigr)\bigr]^2}}{%
\splitfrac{%
{}-{} % make this a binary rather than a unary operator...
\bigl[1-\exp\bigl(-\frac{1}{2}(1+\mu_{\!A}(x_i)-v_{\!A}(x_i))\bigr)\bigr]}{
\times
\bigl[1-\exp\bigl(-\frac{1}{2}(1+\mu_{\!B}(x_i)-v_{\!B}(x_i))\bigr)\bigr]}}
\right)}
\end{align}
\end{document}
If I were writing it, I would use something like
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
E_{q_2}(A,B) = \frac{1}{3n}\sum_{i=1}^{n} \left( \frac{P_1(x_i)}{Q_1(x_i)}
+ \frac{P_2(x_i)}{Q_2(x_i)} + \frac{P_3(x_i)}{Q_3(x_i)} \right)
\end{equation}
where
\addtocounter{equation}{-1}%
\begin{subequations}
\begin{align}
P_1(x_i) &= \left(1-e^{{-\mu}_{A}(x_i)}\right)\left(1-e^{-\mu_{B}(x_i)}\right)\\
Q_1(x_i) &= \left(1-e^{{-\mu}_{A}(x_i)}\right)^2+\left(1-e^{-\mu_{B}(x_i)}\right)^2 \notag\\
&\quad - \left(1-e^{{-\mu}_{A}(x_i)}\right)\left(1-e^{-\mu_{B}(x_i)}\right)\\
P_2(x_i) &= \left(1-e^{-(1-v_{A}(x_i))}\right)\left(1-e^{-(1-v_{B}(x_i))}\right)\\
Q_2(x_i) &= \left(1-e^{-(1-v_{A}(x_i))}\right)^2+\left(1-e^{-(1-v_{B}(x_i))}\right)^2 \notag\\
&\quad - \left(1-e^{-(1-v_{A}(x_i))}\right)\left(1-e^{-(1-v_{B}(x_i))}\right)\\
P_3(x_i) &= \left(1-e^{-\frac{1}{2}(1+\mu_{A}(x_i)-v_{A}(x_i))}\right)
\left(1-e^{-\frac{1}{2}(1+\mu_{B}(x_i)-v_{B}(x_i))}\right)\\
\shortintertext{and}
Q_3(x_i) &= \left(1-e^{-\frac{1}{2}(1+\mu_{A}(x_i)-v_{A}(x_i))}\right)^2
+\left(1-e^{-\frac{1}{2}(1+\mu_{B}(x_i)-v_{B}(x_i))}\right)^2 \notag\\
&\quad - \left(1-e^{-\frac{1}{2}(1+\mu_{A}(x_i)-v_{A}(x_i))}\right)
\left(1-e^{-\frac{1}{2}(1+\mu_{B}(x_i)-v_{B}(x_i))}\right)
\end{align}
\end{subequations}
\end{document}
I have edited @mico's code to make it a bit shorter.
\documentclass{article}
\usepackage{mathtools} % for '\splitfrac' macro
\DeclareMathOperator{\E}{E} % expectations operator
\DeclarePairedDelimiter{\parens}()
\DeclarePairedDelimiter{\sparens}[]
\newcommand{\myexp}[1]{\exp\parens[\big]{#1}}
\newcommand{\ome}[1]{\sparens[\big]{1-\myexp{#1}}}
\begin{document}
\begin{align}
\E_{q_2}(A,B)
&=\frac{1}{3n}\sum_{i=1}^{n}
\frac{\ome{-\mu_{\!A}(x_i)}\times
\ome{-\mu_{\!B}(x_i)}}{%
\biggl(\splitdfrac{%
\ome{-\mu_{\!A}(x_i)}^2
+\ome{-\mu_{\!B}(x_i)}^2}{%
-\ome{-\mu_{\!A}(x_i)}\times
\ome{-\mu_{\!B}(x_i)}}\biggr)} \notag\\[1ex]
&+\frac{\ome{-(1-v_{\!A}(x_i))}\times
\ome{-(1-v_{\!B}(x_i))}}{%
\biggl(\splitdfrac{%
\ome{-(1-v_{\!A}(x_i))}^2
+\ome{-(1-v_{\!B}(x_i)))}^2}{%
-\bigl\{\ome{-(1-v_{\!A}(x_i))}\times
\ome{-(1-v_{\!B}(x_i))}\bigr\}}
\biggr)} \notag\\[1ex]
&+\frac{%
\biggl(\splitdfrac{%
\ome{-\frac{1}{2}(1+\mu_{\!A}(x_i)-v_{\!A}(x_i))}}{%
\times
\ome{-\frac{1}{2}(1+\mu_{\!B}(x_i)-v_{\!B}(x_i))}}
\biggr)}{%
\left(\splitdfrac{%
\splitfrac{%
\ome{-\frac{1}{2}(1+\mu_{\!A}(x_i)-v_{\!A}(x_i))}^2}{%
+\ome{-\frac{1}{2}(1+\mu_{\!B}(x_i)-v_{\!B}(x_i))}^2}}{%
\splitfrac{%
-\ome{-\frac{1}{2}(1+\mu_{\!A}(x_i)-v_{\!A}(x_i))}}{
\times
\ome{-\frac{1}{2}(1+\mu_{\!B}(x_i)-v_{\!B}(x_i))}\bigr\} }}
\right)}
\end{align}
\end{document}
And, with smaller margins the code can be further sanitized:
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{mathtools} % for '\splitfrac' macro
\DeclareMathOperator{\E}{E} % expectations operator
\DeclarePairedDelimiter{\parens}()
\DeclarePairedDelimiter{\sparens}[]
\newcommand{\myexp}[1]{\exp\parens[\big]{#1}}
\newcommand{\ome}[1]{\sparens[\big]{1-\myexp{#1}}}
\newcommand{\rat}[2]{%
\frac{\ome{#1} \times \ome{#2}}{
\parens[\bigg]{\splitdfrac{\ome{#1}^2 + \ome{#2}^2}{- \ome{#1}\times \ome{#2}}}}
}
\begin{document}
\begin{multline}
\E_{q_2}(A,B)
=\frac{1}{3n}\sum_{i=1}^{n}
\rat{-\mu_{\!A}(x_i)}{-\mu_{\!B}(x_i)}
\\
+\rat{-(1-v_{\!A}(x_i))}{-(1-v_{\!B}(x_i))}\\
+
\rat{-\frac{1}{2}(1+\mu_{\!A}(x_i)-v_{\!A}(x_i))}{%
{-\frac{1}{2}(1+\mu_{\!B}(x_i)-v_{\!B}(x_i))}}.
\end{multline}
\end{document}