Am I correct in saying that the
dcases
environment replaces\frac
with\dfrac
? The replacement only occurs at the outer-most level of\frac
, so if I have\documentclass{article} \usepackage{mathtools} \begin{document} $$ \begin{dcases} \frac{arg1}{arg2 \frac{arg3}{arg4}} \end{dcases} $$ \end{document}
Only the
\frac
corresponding to\frac{arg1}{arg2}
gets replaced with\dfrac
.Is
\dfrac{arg1}{arg2}
equivalent to\frac{\displaystyle arg1}{\displaystyle arg2}
?\documentclass{article} \usepackage{mathtools} \begin{document} $\dfrac{arg1}{arg2}$ $\frac{\displaystyle arg1}{\displaystyle arg2}$ $\frac{arg1}{arg2}$ \end{document}
Where does
\displaystyle
(and\textstyle
) take effect?{\displaystyle var_1 var_2 \cmd1 \cmd2}
\documentclass{article} \usepackage{mathtools} % The page-size might be larger with mathtools \begin{document} $\displaystyle \sum_a^b \sum_a^b \frac{a}{\sum_c^d}$ $\sum_a^b \displaystyle \sum_a^b$ $\sum_a^b \sum_c^d \displaystyle\frac{\sum_e^f}{\sum_g^h}$ $\sum_a^b \sum_c^d \frac{\displaystyle \sum_e^f}{\sum_g^h}$ \end{document}
Lastly, for certain commands like
\sum
the\displaystyle
has non-size related effects. However, for other objects like\frac
,\displaystyle
seems to change the size of the variable and some vertical spacing. Is there a set of style-rules to know when to use\displaystyle
vs. not,\dfrac
vs.\frac
,\dcases
vs.\cases
?
1 Answer
There are four main math styles: \displaystyle
, \textstyle
\subscriptstyle
and \subsubscriptstyle
. Let's call them D, T, S and SS.
Style D holds automatically in displayed formulas (displaymath
or \[...\]
, equation
, align
, gather
, multline
); style T is selected in in-line formulas ($...$
or \(...\)
). Styles S and SS are selected in superscripts and subscripts, first level or second (and further) respectively. Also dcases
typesets its contents in style D.
One can also declare a math style with the above commands, which respect grouping as usual.
The rules for fractions are:
if the fraction appears in style D, the two parts (numerator and denominator) are in style T;
if the fraction appears in style T, the two parts are in style S;
if the fraction appears in style S, the two parts are in style SS.
Further levels always choose style SS.
The construction \dfrac{num}{den}
is equivalent to saying
{\displaystyle\frac{num}{den}}
So it's not correct to say that dcases
changes \frac
into \dfrac
. Indeed, inside it (as well as in equation
), we'll have
\frac{\frac{S}{S}}{T}
where the letters denote the style chosen, because the numerator will be in style T as follows from the rules. Here's an example, where the overall style is D.
As it can be seen, the styles have their effect also on other symbols, the "big operators": a \sum
in style D will be bigger than in style T. Style D usually forces subscript and superscripts to big operators to be set below and above it (look for \displaylimits
, \limits
and \nolimits
).
Thus there is a big difference between
$\displaystyle\sum_{i=1}^{n} a_{i}$
and
$\sum\limits_{i=1}^{n} a_{i}$
In the first case the summation symbol will be big, in the second one it will be the normal one for style T, but with limits above and below as imposed by \limits
(it's not recommended to do it).
Answers to the questions.
No, you're not correct.
No.
\displaystyle
acts from the point it's declared, but when in a group its effect ceases at the end of it.Use
\displaystyle
when you want to emulate the style chosen in displayed math. Don't use it and\dfrac
in in-line formulas (in general).
Note
There's much more about math styles; for example, styles D and T differ for the placement of exponents. Moreover, the denominator of fractions is in the "cramped" version of the selected style, but discussing this would take too far away.
-
From what I can deduce from experiments, for both in-line math mode, and displayed math mode, for cases like
a^b
, theb
part will always be typeset in style subscriptstyle. The typesetting style forb
doesn't change, regardless of which of the four styles I apply to the group.– jrandSep 10, 2012 at 23:14 -
@jrand Yes. The exponent is in style S when it's associated to something in styles D or T; it's in style SS if it's associated to something in style S (or SS).– egregSep 10, 2012 at 23:25
-
Yes, I should have used something simpler to show change in size in the exponent, instead of
\sum
. It's more apparent withA
, like inb^A
.– jrandSep 10, 2012 at 23:29 -
@jrand As I said, styles D and T differ slightly in the positioning of exponents, which becomes apparent with an uppercase letter.– egregSep 10, 2012 at 23:37
-
1@cacamailg If summations are involved in the numerator or denominator, in general yes.– egregJun 12, 2014 at 12:19