10

I have a two-column document and as you can see a long mathematical formula, consisting of a fraction, can't fit in the column width.

enter image description here

What I don't know is what is the right way to typeset such kind of long formulas with respect to typography. If you absolutely have to use a two-column document and you have a long fraction that doesn't fit, how do you typeset it?

  • Is it an option that the formula can span both columns? This could be a solution. Alternatively, define parts of the formula in the body text and refer to them by that variable. – 1010011010 Nov 11 '15 at 3:10
  • Will it fit if you just break before the long fraction i.e. at the =. It is hard to tell just looking, but that is at least the obvious first step if nothing else. Can't you define the denominator as a sum? It looks to follow a pattern then you just need the summation sign, with limits and one instance of the pattern. – cfr Nov 11 '15 at 3:18
  • 2
    The first step in typesetting anything is to type the content into your .tex file. If you need help with a later step, please post the results of that first step so that other people can focus on the problematic later step. That is, please post an MWE. – cfr Nov 11 '15 at 3:29
  • Use \sum_{i=1}^n P(E|A_i)\cdot P(A_i) – egreg Nov 11 '15 at 7:20
  • @1010011010 No that is not an option but generally it is a nice idea. – Adam Nov 11 '15 at 20:31
13

I suggest you use the \splitdfrac macro of the mathtools package, as well as an align* environment, to typeset the formula.

enter image description here

\documentclass[twocolumn]{article}
\usepackage{mathtools,lipsum}
\begin{document}
\lipsum[1] % filler text
\begin{align*}
P(A_i\mid E ) &= \frac{P(A_i\cap E)}{P(E)}\\
&= \frac{P(E\mid A_i)P(A_i)}{%
  \splitdfrac{P(E\mid A_1)P(A_1)+ P(E\mid A_2)P(A_2)}
             { + \dots + P(E\mid A_n)P(A_n)} }
\end{align*}

\lipsum[2] % more filler text
\end{document}

Addendum: As @WillRobertson has pointed out in a comment, encasing the split-line denominator in parentheses may help avoid any ambiguity as to what the denominator is made up of. Doing so lengthens the second line; this can be handled by switching from an align* to a multline* environment for the entire two-line equation.

enter image description here

\documentclass[twocolumn]{article}
\usepackage{mathtools,lipsum}
\begin{document}
\lipsum[1] % filler text
\begin{multline*}
P(A_i\mid E ) = \frac{P(A_i\cap E)}{P(E)}\\
= \frac{P(E\mid A_i)P(A_i)}{%
  \biggl(\splitdfrac{P(E\mid A_1)P(A_1)+ P(E\mid A_2)P(A_2)}
             { + \dots + P(E\mid A_n)P(A_n)}\biggr) }
\end{multline*}

\lipsum[2] % more filler text
\end{document}
  • But put brackets around the denominator to avoid ambiguity about what the final terms are adding to. – Will Robertson Nov 13 '15 at 2:14
  • @WillRobertson - Thanks. I've provided an addendum to address your comment. – Mico Nov 13 '15 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.