# Breaking very long equations

This is a frequent question, so let me specify a bit more what the problem is.

I have equations with very long fractions that are within integrals,

$$\int A \int \frac{A B C D E \ldots Z}{A' B' C' D' \ldots Z'} dx dy$$


Any suggestions how to break these and still make the equations look alright? I must say I am almost ready to typeset the offending pages with text running vertically.

EDIT: per @egreg's request, here is a typical form of the equation I am struggling with:

\int f(\vec x_{i})
\frac{\int A(\vec x_{0}) A(\vec x_{1} \mid \vec x_{0}) \ldots
A(\vec x_{i} \mid \vec x_{i-1}) d\vec x_{0} d\vec x_{1} \ldots d\vec x_{i-1}}
{\int A(\vec x_{0}) A(\vec x_{1} \mid \vec x_{0}) \ldots
A(\vec x_{i} \mid \vec x_{i-1}) d\vec x_{0} d\vec x_{1} \ldots d\vec x_{i-1}}
\left(\frac{B(\vec x_{i})}{C(\vec x_{i})}\right) d\vec x_{i}

-
Are you in a two-column article? Can you show a “real world” example? –  egreg Nov 7 '13 at 14:19
@egreg: I am on a regular letter-sized page, but using classicthesis so the text is not exactly wide. –  ANSI C Mastah Nov 7 '13 at 14:23
One way is to leave the actual integral in an abbreviated form such as you provided, and then underneath it, define all the terms A, B, ...A', B';, etc. in separate equations. –  Steven B. Segletes Nov 7 '13 at 14:23
Unfortunately, this equation is part of a derivation, so things change from line to line, and the terms A, B, and so on are as compact as possible. Defining them elsewhere does not make sense in this case, unfortunately. –  ANSI C Mastah Nov 7 '13 at 14:28

I can only suggest to make things more compact:

\documentclass{scrbook}
\usepackage{classicthesis}

\newcommand{\diff}{\mathop{}\!d} % better differential
\newcommand{\bmid}{\mathbin{|}}  % binary mid

\usepackage{amsmath}
\begin{document}
$$\int f(\vec{x}_{i}) \frac { \int \tilde{A}(\vec{x}_{0},\dots,\vec{x}_{i}) \diff\vec{x}_{0} \diff\vec{x}_{1} \dots \diff\vec{x}_{i-1} } { \int\tilde{Z}(\vec{x}_{0},\dots,\vec{x}_{i}) \diff\vec{x}_{0} \diff\vec{x}_{1} \dots \diff\vec{x}_{i-1} } \left(\frac{B(\vec{x}_{i})}{C(\vec{x}_{i})}\right) \diff\vec{x}_{i}$$
where $\tilde{A}(\vec{x}_{0})=A(\vec{x}_{0})$ and, for $k>0$,
$\tilde{A}(\vec{x}_{0},\vec{x}_{1},\dots,\vec{x}_{k})= A(\vec{x}_{0}) A(\vec{x}_{1} \bmid \vec{x}_{0}) \dots A(\vec{x}_{k} \bmid \vec{x}_{k-1})$
\end{document}


-
Thanks! Not sure if I will go this route, but it seems that a change in notation is necessary. –  ANSI C Mastah Nov 7 '13 at 14:51
@ANSICMastah It's not clear whether the integral in the numerator really depends only on the last variable, which could make an even more economic notation by adding the integral in the shorthand. –  egreg Nov 7 '13 at 14:54
@egreg According to page 12 of Short Math Guide for LaTeX, the dots could be typpset using \dotsc and \dotso. –  Svend Tveskæg Nov 7 '13 at 14:59
@SvendTveskæg The \dots macro in amsmath does a “look ahead”, so it generally does “the right thing”; \dotsc, \dotsm and \dotso should be used when the dots are at the end of an expression (say to denote an undetermined number of summands), not in between two items. –  egreg Nov 7 '13 at 15:02
Okay. Sorry for 'interrupting' and thank you for correcting me. –  Svend Tveskæg Nov 7 '13 at 15:03

To break up very long expressions in numerators and denominators, you could use the \splitdfrac{}{} macro of the mathtools package. In the example below, I place parentheses around the split numerator and denominator terms, but doing so may not appeal to your math style preferences. Separately, I would suggest you make the main integral symbol (really) big, e.g., by using one of the macros of the bigints package.

\documentclass{article}
\usepackage{mathtools,bigints}
\begin{document}
Before:
$$\int f(\vec x_{i}) \frac{\int A(\vec x_{0}) A(\vec x_{1} \mid \vec x_{0}) \dots A(\vec x_{i} \mid \vec x_{i-1}) d\vec x_{0} d\vec x_{1} \dots d\vec x_{i-1}} {\int A(\vec x_{0}) A(\vec x_{1} \mid \vec x_{0}) \dots A(\vec x_{i} \mid \vec x_{i-1}) d\vec x_{0} d\vec x_{1} \dots d\vec x_{i-1}} \left(\frac{B(\vec x_{i})}{C(\vec x_{i})}\right) d\vec x_{i}$$

After:
$$\bigintss \! f(\vec x_{i}) \, \dfrac{ \left(\splitdfrac{\int A(\vec x_{0}) A(\vec x_{1} \mid \vec x_{0}) \dots A(\vec x_{i} \mid \vec x_{i-1})}{ d\vec x_{0} d\vec x_{1} \dots d\vec x_{i-1}} \right)}{ \left(\splitdfrac{\int A(\vec x_{0}) A(\vec x_{1} \mid \vec x_{0}) \dots A(\vec x_{i} \mid \vec x_{i-1})}{ d\vec x_{0} d\vec x_{1} \dots d\vec x_{i-1}} \right)} \, \frac{B(\vec x_{i})}{C(\vec x_{i})} \, d\vec x_{i}$$
\end{document}

-