# Getting indices for the sum and product functions to display above the symbols in a fraction

#### MarkFL

Staff member
Hello all,

In a recent post, I discovered that when putting a product function in a fraction (using the \prod command), the indices are displayed to the right of the product function's symbol rather than below and above, which I find much more pleasing to the eye. I find that the same thing happens with the \sum command.

Using the MATH tags, which implies the \displaystyle command, we see that alone, i.e., not in a fraction, we get:

$$\displaystyle \prod_{k=k_i}^{n}\left(\frac{f(k)}{g(k)} \right)$$

Writing this in its equivalent form, we get:

$$\displaystyle \frac{\prod_{k=k_i}^{n}\left(f(k) \right)}{\prod_{k=k_i}^{n}\left(g(k) \right)}$$

My question: is there a way to force the indices to be displayed as they are in the first expression of the product?

#### Jameson

Staff member
$\displaystyle \frac{\prod\limits_{k=k_i}^{n}\left(f(k) \right)}{\prod\limits_{k=k_i}^{n}\left(g(k) \right)}$

Like that? I just found that from a quick Google search. The two commands to keep in mind are \limits and \nolimits. \limits forces the top/bottom layout like you see above. On MHB and all sites that use Mathjax, you can scale all equations up or down if you wish. I had the scale set to 100%, or no scaling I suppose, and the above looked pretty bad. I just changed it to 115% and now it looks much better.

Right click -> "Math Settings" -> "Scale all math"

#### MarkFL

Staff member
Thank you kindly for the \limits command knowledge about the scaling...it does look better!

#### Evgeny.Makarov

##### Well-known member
MHB Math Scholar
TeX has four styles for typesetting mathematical formulas: displaystyle, textstyle, scriptstyle and scriptscriptstyle. Each style has a corresponding command. If a fraction is typeset in a certain style, the numerator and the denominator and rendered in the following smaller style, except that scriptscriptstyle is the smallest. The sub- and superscripts of a symbol in displaystyle or textstyle are written in scriprstyle; otherwise (for the two smallest styles) they are written in scriptscriptstyle.

The difference between displaystyle and textstyle shows, in particular, in the size of big operators like \prod and \sum and in the location of the operator's indices, which can also be specified using \limits and \nolimits. The size of regular symbols like $x$ and $+$, however, is the same.

Therefore, there are two ways to place indices above and below big operators: either write the formula in displaystyle or use \limits. Also, the package amsmath provides commands \dfrac and \tfrac, which are abbreviations of \displaystyle\frac and \textstyle\frac. Note, however, that the style is specified before the fraction, so the numerator and the denominator are never typeset in displaystyle.

Math styles are discussed in the TeXbook, chapter 17, and The LaTeX Companion (2nd ed.), section 8.7.1.