Why are there no dint or dsum like dfrac?











up vote
9
down vote

favorite
2












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).



Enter image description here



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?










share|improve this question
























  • 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










  • 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















up vote
9
down vote

favorite
2












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).



Enter image description here



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?










share|improve this question
























  • 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










  • 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













up vote
9
down vote

favorite
2









up vote
9
down vote

favorite
2






2





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).



Enter image description here



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?










share|improve this question















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).



Enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Peter Mortensen

52736




52736










asked 2 days ago









Dũng Vũ

1,05018




1,05018












  • 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










  • 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


















  • 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










  • 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
















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










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:



enter image description here



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}


enter image description here






share|improve this answer























  • Oh I see! Thank you very much!
    – Dũng Vũ
    2 days ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















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

























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:



enter image description here



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}


enter image description here






share|improve this answer























  • Oh I see! Thank you very much!
    – Dũng Vũ
    2 days ago















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:



enter image description here



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}


enter image description here






share|improve this answer























  • Oh I see! Thank you very much!
    – Dũng Vũ
    2 days ago













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:



enter image description here



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}


enter image description here






share|improve this answer














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:



enter image description here



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}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago

























answered 2 days ago









egreg

698k8518553123




698k8518553123












  • 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




Oh I see! Thank you very much!
– Dũng Vũ
2 days ago


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?