MHB Improving the Look of Product Functions in Math

  • Thread starter Thread starter MarkFL
  • Start date Start date
  • Tags Tags
    Functions Product
AI Thread Summary
The discussion centers on the formatting of mathematical expressions in LaTeX, specifically regarding the placement of indices for product (\prod) and sum (\sum) symbols. Users express a preference for displaying indices above and below these symbols rather than to the right, which is the default in fractions. The solution involves using the \limits command to force the desired layout. Additionally, the conversation touches on the scaling of equations in Mathjax, where adjusting the scale can improve visual presentation. The typesetting styles in TeX—displaystyle, textstyle, scriptstyle, and scriptscriptstyle—are explained, highlighting how they affect the appearance of operators and their indices. The amsmath package offers commands like \dfrac and \tfrac for different styles of fractions. Overall, the thread emphasizes the importance of style commands in achieving visually appealing mathematical formatting.
MarkFL
Gold Member
MHB
Messages
13,284
Reaction score
12
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:

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

Writing this in its equivalent form, we get:

$$\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?
 
Physics news on Phys.org
$\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"
 
Thank you kindly for the \limits command knowledge about the scaling...it does look better! (Yes)
 
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.
 
Back
Top