40

What is best practice for typesetting fractions with large objects in the numerator and denominator?

For example, fractions with limits, integrals, summations, etc... cause the expressions to look contracted and somewhat odd.

I understand that it is probably best to leave this as is when writing mathematics inline, but as a stand-alone fraction I feel it would be much less distracting if the symbols were typeset at normal size and the fraction was given more height in which to place itself.

Are there standards (for pure mathematics) regarding this problem? And what are the options - if it's generally permitted - for expanding the fraction size to incorporate large objects?


Example

\frac{\sum_{i=0}^{n} i^2}{\iint_{D}\frac{\partial (x,y)}{\partial (u,v)}\,\mathrm{d}u\,\mathrm{d}v}

Both the summation and the integral look somewhat cramped.

6
  • This site deliberately doesn't use MathJax since we're as likely to be interested in the TeX/LaTex code itself as in the resulting output. To make the elements in the numerator and/or denominator of a fraction be typeset in display style, insert the instruction \displaystyle immediately after the item's opening curly brace.
    – Mico
    Apr 28, 2014 at 6:01
  • Please provide a MWE (minimum working example, starting with \documentclass and ending with \end{document}) with some fractional expressions you're interested in. Without such concrete information it's going to be difficult to provide specific advice.
    – Mico
    Apr 28, 2014 at 6:59
  • 1
    Or you can use \dfrac instead of \frac
    – user11232
    Apr 28, 2014 at 7:41
  • Yes, Harish is right, check this to see the difference, \dfrac vs. other fractions... Apr 28, 2014 at 7:49
  • 1
    Some examples of what you mean could be useful.
    – egreg
    Apr 28, 2014 at 10:58

2 Answers 2

55

When TeX is in display-style math mode and the amsmath package is loaded, \frac and \dfrac are equivalent, and the material in the numerator and denominator portions of \frac will be typeset in "text-style math" mode by default. This entails, among other things, that summation and integral symbols will be typeset in text style, as will any fractional expressions. The resulting tight, or "cramped", look is probably what you're looking to avoid.

To override the default setting, i.e., to force TeX to render the material in both the numerator and denominator terms in display-style math mode, one needs to insert an explicit \displaystyle instruction at the start of both the numerator and denominator material. For more on this subject, see the posting Show inline math as if it were display math.

If you have a lot of these expressions, it's worthwhile to create a macro called, say, \ddfrac (short for "double displaystyle frac", I suppose):

\newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}}

enter image description here

\documentclass[12pt]{article}
\usepackage{amsmath}
\newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}}
\begin{document}
\begin{align*}
\frac{\sum_{i=1}^\infty \frac{1}{i^2}}{ \int_{-\infty}^\infty 
   \frac{1}{\sqrt{2\pi\sigma^2}} \exp\bigl(-\frac{(x-\mu)^2}{2\sigma^2}\bigr)
   \,\mathrm{d}x} &= \frac{\pi^2}{6}
\qquad\text{too cramped?}\\[2ex]
\ddfrac{\sum_{i=1}^\infty \frac{1}{i^2}}{\int_{-\infty}^\infty 
   \frac{1}{\sqrt{2\pi\sigma^2}} \exp\biggl(-\frac{(x-\mu)^2}{2\sigma^2}\biggr)
   \,\mathrm{d}x} &= \frac{\pi^2}{6}
\qquad\text{about right?}
\end{align*}
\end{document}
2
  • 1
    x-\mu should be squared, I guess. :) P.S. Nice solution. Apr 28, 2014 at 15:57
  • @SvendTveskæg - I knew I'd forgotten a term... Thanks for pointing it out!
    – Mico
    Apr 28, 2014 at 16:12
5

I'm also having trouble with this and I'm not quite aware why fractions "crunch" limits, integrals, summations and so on in pure math environments. With amsmath or mathtools you can write dfrac instead of frac, but since dfrac is used for inline fractions, it won't change anything for you in math environments.

My workaround is using \displaystyle in the fractions, like Mico mentioned, where I have summations or such elements. Although I would also be glad to have a global option for those things in amsmath or mathtools. I've looked around the internet but couldn't find anything useful.

I have written my "own" fraction command for using summations, integrals and so on in equations. The command just writes \displaystyle at the first position of the numerator and denominator. Instead of ffrac you can of course name it whatever you want (and isn't used by LaTeX or any other usepackages you use):

\documentclass{scrartcl}
\usepackage{mathtools}
\usepackage{amssymb}

\newcommand{\ffrac}[2]{\ensuremath{\frac{\displaystyle #1}{\displaystyle #2}}}

\begin{document}
\begin{align}
    U^{2} &= \frac{\sum_{t=0}^{T}u^{2}\cdot \Delta t}{T}\\
    U^{2} &= \ffrac{\sum_{t=0}^{T}u^{2}\cdot \Delta t}{T}
\end{align}
\end{document}
2
  • 1
    Sometimes, it is better for the general layout of the page, to use \frac{\sum\limits_{t=0}^{T} ….
    – Bernard
    Apr 28, 2014 at 9:06
  • I totally agree with you. Especially with more than a single equation. I use it for important equations which mostly stand alone.
    – Cheesey
    Apr 28, 2014 at 13:41

You must log in to answer this question.

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