TeX - LaTeX Asked by akdom on February 26, 2021
I’m very familiar with how symbols display differently in inline mode (with $ ... $
) vs. how display math shows them (with [ ... ]
or $$ ... $$
). Two examples would be with limits
$lim_{nrightarrow infty}f(x)$
vs.
[ lim_{nrightarrow infty}f(x) ]
and with sums
$sum_{n=1}^{x} n^2$
vs.
[ sum_{n=1}^{x} n^2 ]
My Question is:
How do you display these things in inline mode (with all the nice inline formatting) as if they were in display mode ?
The inverse — how to display things in display mode as if they were in inline mode — is also of interest.
There are two separate aspects to your question, which can be addressed separately:
How to control the size of the integral, sum and product symbols
How to control the placement of the limits of integration, summation, and multiplication, namely side-set or above/below.
The default settings, with the amsmath
package loaded, are
Inline math
sumlimits
and intlimits
options of amsmath
do not affect the placement of limits in inline math.Display math
Large symbol size. See Tables 72 through 83 in the Comprehensive LaTeX Symbol List for the names of these 'large' or, more precisely, Variable-sized Math Operators;
For int
-type symbols, the limits are side-set unless amsmath
was loaded with the option intlimits
.
The integral symbols are treated separately presumably because they are generally taller than the other variable-sized symbols.
For sum
, prod
, coprod
, etc the limits are set above and below the operator, except when the amsmath
was loaded with the option nosumlimits
.
The sumlimits
and nosumlimits
options and the limits
and nolimits
commands affect the appearance not only of sum-type symbols but of prod
,coprod
, bigcup
and bigcap
, etc. as well.
To control the size of the symbol, one writes before the command generating the symbol
textstyle
for small symbols;displaystyle
for large symbols; .textstyle
and displaystyle
may also affect the behavior of subsequent commands in the current math-mode environment, as observed by @HaraldHancheOlsen.To control the placement of the limits, one writes after the command generating the symbol
nolimits
for side-set limits;limits
for limits set above and below.These possibilities are illustrated in the table below:
The table was produced by the following code:
documentclass[letterpaper]{standalone}
usepackage{array,amsmath,booktabs}
begin{document}
Huge
begin{tabular}{l
>{$textstyle}l<{$} % first math column: text style
>{$displaystyle}l<{$}} % second math column: display style
toprule
Placement of limits & multicolumn{2}{c}{Size of operators}
cmidrule{2-3}
& multicolumn{1}{l}{small:}
& multicolumn{1}{l}{large:}
& multicolumn{1}{l}{texttt{textbackslash textstyle}}
& multicolumn{1}{l}{texttt{textbackslash displaystyle}}
cmidrule[lightrulewidth]{2-3}
Next to symbol: & multicolumn{1}{l}{phantom{texttt{textbackslash displaystyle }}}
texttt{textbackslash nolimits}
& sumnolimits_{i=1}^N a_i
& sumnolimits_{i=1}^N a_i [2ex]
& prodnolimits_{j=0}^J k_j
& prodnolimits_{j=0}^J k_j [2.5ex]
& intnolimits_{-infty}^infty f(x),mathrm{d}x
& intnolimits_{-infty}^infty f(x),mathrm{d}x [5ex]
Below & above symbol:[-1ex]
texttt{textbackslash limits}
& sumlimits_{i=1}^N a_i
& sumlimits_{i=1}^N a_i [3.5ex]
& prodlimits_{j=0}^J k_j
& prodlimits_{j=0}^J k_j [4ex]
& intlimits_{-infty}^infty f(x),mathrm{d}x
& intlimits_{-infty}^infty f(x),mathrm{d}x
bottomrule
end{tabular}
end{document}
Finally, some personal views on the (ab)uses of the limits
and displaystyle
commands when in inline math mode:
limits
command when in inline math mode. Otherwise, one is virtually assured of wrecking the appearance of the paragraph where the formula appears.sum_i
or prod_j
are usually just fine. You may even be able to get away with omitting the i
and j
indices of summation/multiplication.displaystyle
command (to force the creation of large symbols) while in inline math mode is an even worse idea than using limits
.Correct answer by Mico on February 26, 2021
The solution you seek is to use the displaystyle
command within the inline environment as such.
$displaystylesum_{n=1}^{x} n^2$
This will give the nice effect of the starting term being underneath the sigma and the maximum value above while keeping the symbols inline.
Answered by akdom on February 26, 2021
Good typography relies on the balance of all aspects of black and white on the page. Uniformly spaced lines for the ordinary text make for good legibility. That's why some symbols, that in display are rendered with limits above and below, are set with limits on the side when used in in-line formulas.
I too, when I began to use TeX, tried to set limits for sums above and below also in in-line formulas, but I soon realized that it's wrong: two white bands separated that line from the next ones.
For that very reason the symbols for summation and integral are set in two different sizes: a smaller one for in-line formulas, a larger one for displayed formulas that don't have spacing constraints.
Displayed formulas are set using (automatically) displaystyle
, so
$displaystylesum_{n=1}^{x} n^2$
would produce the same symbol used in displayed formulas and set limits above and below. But this will damage the balance of the page beyond repair. A less invasive construction
$sumlimits_{n=1}^{x} n^2$
and its sibling
$limlimits_{ntoinfty}f(x)$
will do less damage to the page, but will nevertheless spoil it.
Such constructions have their use, for examples in tables where TeX would use in-line math mode. But I will never suggest to use them in normal text.
Answered by egreg on February 26, 2021
The other answers are excellent, and normally I would not try to change the behavior of inline functions. However, there is one case where I wish inline functions to behave just like displayed functions. That is when I write exams. I am willing to compromise on typesetting for readability. If you put
everymath{displaystyle}
in your preamble, every equation will be typeset in that manner, and you don't have to put displaystyle
in every equation. Of course, if you are looking to change just a few equations, then displaystyle
is easy to use.
Answered by S. McKay on February 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP