Why are there no dint or dsum like dfrac?
up vote
9
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
9
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
2 days ago
@egreg If they saydisplaystyleintis okay, they should also saydisplaystylefrac{}{}is okay :))
– Dũng Vũ
2 days ago
Of coursedfracis not defined asdisplaystylefrac.
– egreg
2 days ago
@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ũ
2 days ago
add a comment |
up vote
9
down vote
favorite
up vote
9
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 2 days ago
Peter Mortensen
52736
52736
asked 2 days ago
Dũng Vũ
1,05518
1,05518
Essentially becausedisplaystyleintwill make everything in the formula in display style. Or not work as you intend.
– egreg
2 days ago
@egreg If they saydisplaystyleintis okay, they should also saydisplaystylefrac{}{}is okay :))
– Dũng Vũ
2 days ago
Of coursedfracis not defined asdisplaystylefrac.
– egreg
2 days ago
@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ũ
2 days ago
add a comment |
Essentially becausedisplaystyleintwill make everything in the formula in display style. Or not work as you intend.
– egreg
2 days ago
@egreg If they saydisplaystyleintis okay, they should also saydisplaystylefrac{}{}is okay :))
– Dũng Vũ
2 days ago
Of coursedfracis not defined asdisplaystylefrac.
– egreg
2 days ago
@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ũ
2 days ago
Essentially because
displaystyleint will make everything in the formula in display style. Or not work as you intend.– egreg
2 days ago
Essentially because
displaystyleint will make everything in the formula in display style. Or not work as you intend.– egreg
2 days ago
@egreg If they say
displaystyleint is okay, they should also say displaystylefrac{}{} is okay :))– Dũng Vũ
2 days ago
@egreg If they say
displaystyleint is okay, they should also say displaystylefrac{}{} is okay :))– Dũng Vũ
2 days ago
Of course
dfrac is not defined as displaystylefrac.– egreg
2 days ago
Of course
dfrac is not defined as displaystylefrac.– egreg
2 days ago
@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ũ
2 days ago
@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ũ
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
11
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ũ
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
11
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ũ
2 days ago
add a comment |
up vote
11
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ũ
2 days ago
add a comment |
up vote
11
down vote
accepted
up vote
11
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 2 days ago
answered 2 days ago
egreg
698k8518553123
698k8518553123
Oh I see! Thank you very much!
– Dũng Vũ
2 days ago
add a comment |
Oh I see! Thank you very much!
– Dũng Vũ
2 days ago
Oh I see! Thank you very much!
– Dũng Vũ
2 days ago
Oh I see! Thank you very much!
– Dũng Vũ
2 days ago
add a comment |
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
2 days ago
@egreg If they say
displaystyleintis okay, they should also saydisplaystylefrac{}{}is okay :))– Dũng Vũ
2 days ago
Of course
dfracis not defined asdisplaystylefrac.– egreg
2 days ago
@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ũ
2 days ago