Why are there no dint or dsum like dfrac?
up vote
10
down vote
favorite
This was inspired by How to have nice-looking symbols within an itemize environment? and Sigur's comment which remind me about the display style of math formulas and the fractions.
I know that, in the amsmath package there is already dfrac{}{} for us to have display-style fractions (as well as tfrac{}{} for in-line fraction).

Then why don't dsum, dprod, dint, etc. exist?
If they are not to exist, then why does dfrac exist?
Actually, we can define, for example, dint as
DeclareMathOperator{dint}{displaystyleint}
but I want to know the reason why there are no dint, etc. Or can you tell me the packages in which these d- are in?
macros amsmath inline displaystyle
add a comment |
up vote
10
down vote
favorite
This was inspired by How to have nice-looking symbols within an itemize environment? and Sigur's comment which remind me about the display style of math formulas and the fractions.
I know that, in the amsmath package there is already dfrac{}{} for us to have display-style fractions (as well as tfrac{}{} for in-line fraction).

Then why don't dsum, dprod, dint, etc. exist?
If they are not to exist, then why does dfrac exist?
Actually, we can define, for example, dint as
DeclareMathOperator{dint}{displaystyleint}
but I want to know the reason why there are no dint, etc. Or can you tell me the packages in which these d- are in?
macros amsmath inline displaystyle
Essentially becausedisplaystyleintwill make everything in the formula in display style. Or not work as you intend.
– egreg
Nov 17 at 15:38
@egreg If they saydisplaystyleintis okay, they should also saydisplaystylefrac{}{}is okay :))
– Dũng Vũ
Nov 17 at 15:41
1
Of coursedfracis not defined asdisplaystylefrac.
– egreg
Nov 17 at 15:43
@egreg I agree. But they are the same, or nearly. If developers can find a way to definedfracnot asdisplaystylefrac, I think they can do the same for the rest :))
– Dũng Vũ
Nov 17 at 15:48
add a comment |
up vote
10
down vote
favorite
up vote
10
down vote
favorite
This was inspired by How to have nice-looking symbols within an itemize environment? and Sigur's comment which remind me about the display style of math formulas and the fractions.
I know that, in the amsmath package there is already dfrac{}{} for us to have display-style fractions (as well as tfrac{}{} for in-line fraction).

Then why don't dsum, dprod, dint, etc. exist?
If they are not to exist, then why does dfrac exist?
Actually, we can define, for example, dint as
DeclareMathOperator{dint}{displaystyleint}
but I want to know the reason why there are no dint, etc. Or can you tell me the packages in which these d- are in?
macros amsmath inline displaystyle
This was inspired by How to have nice-looking symbols within an itemize environment? and Sigur's comment which remind me about the display style of math formulas and the fractions.
I know that, in the amsmath package there is already dfrac{}{} for us to have display-style fractions (as well as tfrac{}{} for in-line fraction).

Then why don't dsum, dprod, dint, etc. exist?
If they are not to exist, then why does dfrac exist?
Actually, we can define, for example, dint as
DeclareMathOperator{dint}{displaystyleint}
but I want to know the reason why there are no dint, etc. Or can you tell me the packages in which these d- are in?
macros amsmath inline displaystyle
macros amsmath inline displaystyle
edited Nov 18 at 2:05
Peter Mortensen
53136
53136
asked Nov 17 at 15:26
Dũng Vũ
1,188121
1,188121
Essentially becausedisplaystyleintwill make everything in the formula in display style. Or not work as you intend.
– egreg
Nov 17 at 15:38
@egreg If they saydisplaystyleintis okay, they should also saydisplaystylefrac{}{}is okay :))
– Dũng Vũ
Nov 17 at 15:41
1
Of coursedfracis not defined asdisplaystylefrac.
– egreg
Nov 17 at 15:43
@egreg I agree. But they are the same, or nearly. If developers can find a way to definedfracnot asdisplaystylefrac, I think they can do the same for the rest :))
– Dũng Vũ
Nov 17 at 15:48
add a comment |
Essentially becausedisplaystyleintwill make everything in the formula in display style. Or not work as you intend.
– egreg
Nov 17 at 15:38
@egreg If they saydisplaystyleintis okay, they should also saydisplaystylefrac{}{}is okay :))
– Dũng Vũ
Nov 17 at 15:41
1
Of coursedfracis not defined asdisplaystylefrac.
– egreg
Nov 17 at 15:43
@egreg I agree. But they are the same, or nearly. If developers can find a way to definedfracnot asdisplaystylefrac, I think they can do the same for the rest :))
– Dũng Vũ
Nov 17 at 15:48
Essentially because
displaystyleint will make everything in the formula in display style. Or not work as you intend.– egreg
Nov 17 at 15:38
Essentially because
displaystyleint will make everything in the formula in display style. Or not work as you intend.– egreg
Nov 17 at 15:38
@egreg If they say
displaystyleint is okay, they should also say displaystylefrac{}{} is okay :))– Dũng Vũ
Nov 17 at 15:41
@egreg If they say
displaystyleint is okay, they should also say displaystylefrac{}{} is okay :))– Dũng Vũ
Nov 17 at 15:41
1
1
Of course
dfrac is not defined as displaystylefrac.– egreg
Nov 17 at 15:43
Of course
dfrac is not defined as displaystylefrac.– egreg
Nov 17 at 15:43
@egreg I agree. But they are the same, or nearly. If developers can find a way to define
dfrac not as displaystylefrac, I think they can do the same for the rest :))– Dũng Vũ
Nov 17 at 15:48
@egreg I agree. But they are the same, or nearly. If developers can find a way to define
dfrac not as displaystylefrac, I think they can do the same for the rest :))– Dũng Vũ
Nov 17 at 15:48
add a comment |
1 Answer
1
active
oldest
votes
up vote
13
down vote
accepted
The command dfrac exists for rendering multistory fractions, say
[
frac{dfrac{a}{b}-dfrac{c}{d}}{dfrac{a}{b}+dfrac{c}{d}
]
and is not generally intended for usage in an inline formula. It is not defined using the simplistic format displaystylefrac, but rather
% amsmath.sty, line 214:
newcommand{dfrac}{genfrac{}{}{}0}
where genfrac is
% amsmath.sty, line 221:
DeclareRobustCommand{genfrac}[4]{%
def@tempa{#1#2}%
edef@tempb{@nx@genfrac@mathstyle{#4}%
csname @@ifx @#3@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{#1#2#3}}
% amsmath.sty, line 289:
def@genfrac#1#2#3#4#5{{#1{begingroup#4endgroup#2#3relax#5}}}
def@mathstyle#1{%
ifx@empty#1@emptyrelax
elseifcase#1displaystyle % case 0
ortextstyleorscriptstyleelsescriptscriptstylefifi}
What happens with dfrac{a}{b}? By definition this becomes genfrac{}{}{}0{a}{b}, so
def@tempa{}%
edef@tempb{@nx@genfrac@mathstyle{0}%
csname @@ifx @@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{}{a}{b}
By definition of @mathstyle, @tempb is defined to be @genfracdisplaystyle@@over, so we're left with
@genfracdisplaystyle@@over{}{a}{b}
which in turn becomes
{displaystyle{begingroup aendgroup@@overrelax b}}
and @@over is the primitive over. Note the braces around the whole construction. You may enjoy chasing the expansion of frac, binom and dbinom.
With int one cannot do displaystyleint, because this wouldn't confine the scope of displaystyle, nor {displaystyleint}, because this would not place correctly the limits. Indeed, the test file
documentclass{article}
usepackage{amsmath}
DeclareMathOperator{dint}{displaystyleint}
newcommand{ddint}{displaystyleint}
begin{document}
$dint_0^1frac{x}{2},dx$
$ddint_0^1frac{x}{2},dx$
end{document}
produces wrong output in either case:

Can one do something about this? Yes, but I don't think it's worth the pain. Anyway, here it is:
documentclass{article}
usepackage{amsmath}
usepackage{xparse}
NewDocumentCommand{dint}{tlimits e{_^}}{%
mathop{
displaystyleint
IfBooleanT{#1}{limits}
IfValueT{#2}{_{#2}}
IfValueT{#3}{^{#3}}
}%
}
begin{document}
$dint_0^1frac{x}{2},dx$
$dintlimits_0^1frac{x}{2},dx$
$dintfrac{x}{2},dx$
end{document}

Oh I see! Thank you very much!
– Dũng Vũ
Nov 17 at 16:03
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
13
down vote
accepted
The command dfrac exists for rendering multistory fractions, say
[
frac{dfrac{a}{b}-dfrac{c}{d}}{dfrac{a}{b}+dfrac{c}{d}
]
and is not generally intended for usage in an inline formula. It is not defined using the simplistic format displaystylefrac, but rather
% amsmath.sty, line 214:
newcommand{dfrac}{genfrac{}{}{}0}
where genfrac is
% amsmath.sty, line 221:
DeclareRobustCommand{genfrac}[4]{%
def@tempa{#1#2}%
edef@tempb{@nx@genfrac@mathstyle{#4}%
csname @@ifx @#3@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{#1#2#3}}
% amsmath.sty, line 289:
def@genfrac#1#2#3#4#5{{#1{begingroup#4endgroup#2#3relax#5}}}
def@mathstyle#1{%
ifx@empty#1@emptyrelax
elseifcase#1displaystyle % case 0
ortextstyleorscriptstyleelsescriptscriptstylefifi}
What happens with dfrac{a}{b}? By definition this becomes genfrac{}{}{}0{a}{b}, so
def@tempa{}%
edef@tempb{@nx@genfrac@mathstyle{0}%
csname @@ifx @@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{}{a}{b}
By definition of @mathstyle, @tempb is defined to be @genfracdisplaystyle@@over, so we're left with
@genfracdisplaystyle@@over{}{a}{b}
which in turn becomes
{displaystyle{begingroup aendgroup@@overrelax b}}
and @@over is the primitive over. Note the braces around the whole construction. You may enjoy chasing the expansion of frac, binom and dbinom.
With int one cannot do displaystyleint, because this wouldn't confine the scope of displaystyle, nor {displaystyleint}, because this would not place correctly the limits. Indeed, the test file
documentclass{article}
usepackage{amsmath}
DeclareMathOperator{dint}{displaystyleint}
newcommand{ddint}{displaystyleint}
begin{document}
$dint_0^1frac{x}{2},dx$
$ddint_0^1frac{x}{2},dx$
end{document}
produces wrong output in either case:

Can one do something about this? Yes, but I don't think it's worth the pain. Anyway, here it is:
documentclass{article}
usepackage{amsmath}
usepackage{xparse}
NewDocumentCommand{dint}{tlimits e{_^}}{%
mathop{
displaystyleint
IfBooleanT{#1}{limits}
IfValueT{#2}{_{#2}}
IfValueT{#3}{^{#3}}
}%
}
begin{document}
$dint_0^1frac{x}{2},dx$
$dintlimits_0^1frac{x}{2},dx$
$dintfrac{x}{2},dx$
end{document}

Oh I see! Thank you very much!
– Dũng Vũ
Nov 17 at 16:03
add a comment |
up vote
13
down vote
accepted
The command dfrac exists for rendering multistory fractions, say
[
frac{dfrac{a}{b}-dfrac{c}{d}}{dfrac{a}{b}+dfrac{c}{d}
]
and is not generally intended for usage in an inline formula. It is not defined using the simplistic format displaystylefrac, but rather
% amsmath.sty, line 214:
newcommand{dfrac}{genfrac{}{}{}0}
where genfrac is
% amsmath.sty, line 221:
DeclareRobustCommand{genfrac}[4]{%
def@tempa{#1#2}%
edef@tempb{@nx@genfrac@mathstyle{#4}%
csname @@ifx @#3@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{#1#2#3}}
% amsmath.sty, line 289:
def@genfrac#1#2#3#4#5{{#1{begingroup#4endgroup#2#3relax#5}}}
def@mathstyle#1{%
ifx@empty#1@emptyrelax
elseifcase#1displaystyle % case 0
ortextstyleorscriptstyleelsescriptscriptstylefifi}
What happens with dfrac{a}{b}? By definition this becomes genfrac{}{}{}0{a}{b}, so
def@tempa{}%
edef@tempb{@nx@genfrac@mathstyle{0}%
csname @@ifx @@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{}{a}{b}
By definition of @mathstyle, @tempb is defined to be @genfracdisplaystyle@@over, so we're left with
@genfracdisplaystyle@@over{}{a}{b}
which in turn becomes
{displaystyle{begingroup aendgroup@@overrelax b}}
and @@over is the primitive over. Note the braces around the whole construction. You may enjoy chasing the expansion of frac, binom and dbinom.
With int one cannot do displaystyleint, because this wouldn't confine the scope of displaystyle, nor {displaystyleint}, because this would not place correctly the limits. Indeed, the test file
documentclass{article}
usepackage{amsmath}
DeclareMathOperator{dint}{displaystyleint}
newcommand{ddint}{displaystyleint}
begin{document}
$dint_0^1frac{x}{2},dx$
$ddint_0^1frac{x}{2},dx$
end{document}
produces wrong output in either case:

Can one do something about this? Yes, but I don't think it's worth the pain. Anyway, here it is:
documentclass{article}
usepackage{amsmath}
usepackage{xparse}
NewDocumentCommand{dint}{tlimits e{_^}}{%
mathop{
displaystyleint
IfBooleanT{#1}{limits}
IfValueT{#2}{_{#2}}
IfValueT{#3}{^{#3}}
}%
}
begin{document}
$dint_0^1frac{x}{2},dx$
$dintlimits_0^1frac{x}{2},dx$
$dintfrac{x}{2},dx$
end{document}

Oh I see! Thank you very much!
– Dũng Vũ
Nov 17 at 16:03
add a comment |
up vote
13
down vote
accepted
up vote
13
down vote
accepted
The command dfrac exists for rendering multistory fractions, say
[
frac{dfrac{a}{b}-dfrac{c}{d}}{dfrac{a}{b}+dfrac{c}{d}
]
and is not generally intended for usage in an inline formula. It is not defined using the simplistic format displaystylefrac, but rather
% amsmath.sty, line 214:
newcommand{dfrac}{genfrac{}{}{}0}
where genfrac is
% amsmath.sty, line 221:
DeclareRobustCommand{genfrac}[4]{%
def@tempa{#1#2}%
edef@tempb{@nx@genfrac@mathstyle{#4}%
csname @@ifx @#3@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{#1#2#3}}
% amsmath.sty, line 289:
def@genfrac#1#2#3#4#5{{#1{begingroup#4endgroup#2#3relax#5}}}
def@mathstyle#1{%
ifx@empty#1@emptyrelax
elseifcase#1displaystyle % case 0
ortextstyleorscriptstyleelsescriptscriptstylefifi}
What happens with dfrac{a}{b}? By definition this becomes genfrac{}{}{}0{a}{b}, so
def@tempa{}%
edef@tempb{@nx@genfrac@mathstyle{0}%
csname @@ifx @@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{}{a}{b}
By definition of @mathstyle, @tempb is defined to be @genfracdisplaystyle@@over, so we're left with
@genfracdisplaystyle@@over{}{a}{b}
which in turn becomes
{displaystyle{begingroup aendgroup@@overrelax b}}
and @@over is the primitive over. Note the braces around the whole construction. You may enjoy chasing the expansion of frac, binom and dbinom.
With int one cannot do displaystyleint, because this wouldn't confine the scope of displaystyle, nor {displaystyleint}, because this would not place correctly the limits. Indeed, the test file
documentclass{article}
usepackage{amsmath}
DeclareMathOperator{dint}{displaystyleint}
newcommand{ddint}{displaystyleint}
begin{document}
$dint_0^1frac{x}{2},dx$
$ddint_0^1frac{x}{2},dx$
end{document}
produces wrong output in either case:

Can one do something about this? Yes, but I don't think it's worth the pain. Anyway, here it is:
documentclass{article}
usepackage{amsmath}
usepackage{xparse}
NewDocumentCommand{dint}{tlimits e{_^}}{%
mathop{
displaystyleint
IfBooleanT{#1}{limits}
IfValueT{#2}{_{#2}}
IfValueT{#3}{^{#3}}
}%
}
begin{document}
$dint_0^1frac{x}{2},dx$
$dintlimits_0^1frac{x}{2},dx$
$dintfrac{x}{2},dx$
end{document}

The command dfrac exists for rendering multistory fractions, say
[
frac{dfrac{a}{b}-dfrac{c}{d}}{dfrac{a}{b}+dfrac{c}{d}
]
and is not generally intended for usage in an inline formula. It is not defined using the simplistic format displaystylefrac, but rather
% amsmath.sty, line 214:
newcommand{dfrac}{genfrac{}{}{}0}
where genfrac is
% amsmath.sty, line 221:
DeclareRobustCommand{genfrac}[4]{%
def@tempa{#1#2}%
edef@tempb{@nx@genfrac@mathstyle{#4}%
csname @@ifx @#3@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{#1#2#3}}
% amsmath.sty, line 289:
def@genfrac#1#2#3#4#5{{#1{begingroup#4endgroup#2#3relax#5}}}
def@mathstyle#1{%
ifx@empty#1@emptyrelax
elseifcase#1displaystyle % case 0
ortextstyleorscriptstyleelsescriptscriptstylefifi}
What happens with dfrac{a}{b}? By definition this becomes genfrac{}{}{}0{a}{b}, so
def@tempa{}%
edef@tempb{@nx@genfrac@mathstyle{0}%
csname @@ifx @@overelse abovefi
ifx@tempa@empty else withdelimsfiendcsname}
@tempb{}{a}{b}
By definition of @mathstyle, @tempb is defined to be @genfracdisplaystyle@@over, so we're left with
@genfracdisplaystyle@@over{}{a}{b}
which in turn becomes
{displaystyle{begingroup aendgroup@@overrelax b}}
and @@over is the primitive over. Note the braces around the whole construction. You may enjoy chasing the expansion of frac, binom and dbinom.
With int one cannot do displaystyleint, because this wouldn't confine the scope of displaystyle, nor {displaystyleint}, because this would not place correctly the limits. Indeed, the test file
documentclass{article}
usepackage{amsmath}
DeclareMathOperator{dint}{displaystyleint}
newcommand{ddint}{displaystyleint}
begin{document}
$dint_0^1frac{x}{2},dx$
$ddint_0^1frac{x}{2},dx$
end{document}
produces wrong output in either case:

Can one do something about this? Yes, but I don't think it's worth the pain. Anyway, here it is:
documentclass{article}
usepackage{amsmath}
usepackage{xparse}
NewDocumentCommand{dint}{tlimits e{_^}}{%
mathop{
displaystyleint
IfBooleanT{#1}{limits}
IfValueT{#2}{_{#2}}
IfValueT{#3}{^{#3}}
}%
}
begin{document}
$dint_0^1frac{x}{2},dx$
$dintlimits_0^1frac{x}{2},dx$
$dintfrac{x}{2},dx$
end{document}

edited Nov 17 at 16:19
answered Nov 17 at 16:01
egreg
701k8618673141
701k8618673141
Oh I see! Thank you very much!
– Dũng Vũ
Nov 17 at 16:03
add a comment |
Oh I see! Thank you very much!
– Dũng Vũ
Nov 17 at 16:03
Oh I see! Thank you very much!
– Dũng Vũ
Nov 17 at 16:03
Oh I see! Thank you very much!
– Dũng Vũ
Nov 17 at 16:03
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460464%2fwhy-are-there-no-dint-or-dsum-like-dfrac%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Essentially because
displaystyleintwill make everything in the formula in display style. Or not work as you intend.– egreg
Nov 17 at 15:38
@egreg If they say
displaystyleintis okay, they should also saydisplaystylefrac{}{}is okay :))– Dũng Vũ
Nov 17 at 15:41
1
Of course
dfracis not defined asdisplaystylefrac.– egreg
Nov 17 at 15:43
@egreg I agree. But they are the same, or nearly. If developers can find a way to define
dfracnot asdisplaystylefrac, I think they can do the same for the rest :))– Dũng Vũ
Nov 17 at 15:48