Missing space with DeclarePairedDelimiter
up vote
6
down vote
favorite
I’m trying to define an abs
command for absolute values using DeclarePairedDelimiter
from the mathtools
package, but I’m running into some spacing issues.
I’d normall write sup_n abs{a_n}
defined by DeclarePairedDelimiter{abs}{lvert}{rvert}
.
But then there is some space missing.
I would instead expect the following output, which I get using sup_n |a_n|
.
With sup_n {abs{a_n}}
this issue does not appear, but I find this additional pair of curly braces too cumbersome.
I also tried some variations, but both versions of abs
seem to have the same issue.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{abs}{lvert}{rvert}
DeclarePairedDelimiter{altabs}{|}{|}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n lvert a_n rvert quad
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
end{document}
Where is this problem coming from, and how can I get DeclarePairedDelimiter
to give the right spacing?
spacing delimiters mathtools
add a comment |
up vote
6
down vote
favorite
I’m trying to define an abs
command for absolute values using DeclarePairedDelimiter
from the mathtools
package, but I’m running into some spacing issues.
I’d normall write sup_n abs{a_n}
defined by DeclarePairedDelimiter{abs}{lvert}{rvert}
.
But then there is some space missing.
I would instead expect the following output, which I get using sup_n |a_n|
.
With sup_n {abs{a_n}}
this issue does not appear, but I find this additional pair of curly braces too cumbersome.
I also tried some variations, but both versions of abs
seem to have the same issue.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{abs}{lvert}{rvert}
DeclarePairedDelimiter{altabs}{|}{|}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n lvert a_n rvert quad
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
end{document}
Where is this problem coming from, and how can I get DeclarePairedDelimiter
to give the right spacing?
spacing delimiters mathtools
3
The fact is that the space should not be there: if you use the propersup_nlvert a_nrvert
, you see it. Just likesup(a_1,dots,a_n)
should not have space.
– egreg
Nov 26 at 11:33
1
In addition to egregs comment, remember that|...|
is not the correct syntax for absolute value.|
is a normal symbol (an ord), whereaslvert
andrvert
are|
with type math open and math close respectfully (just as()
). Whensub
sees an ord like a letter or|
it inserts a space, whereas it does not insert a space when it sees something of type math open. InternallyDeclarePairedDelimiter
will always make the fences into open and close types which is why yourabs
andaltabs
gives the same result.
– daleif
Nov 26 at 11:56
I guess then that my latex code does not properly reflect what I actually want to express: I understand something like “sup(f)” as “sup( ) applied to f”, but “sup |f|” as “sup (written without paratheses) applied |f|”, not as “sup| | applied to f”. Hence I expect the same spacing for both “sup f” and “sup |f|”.
– Jendrik Stelzner
Nov 26 at 12:19
add a comment |
up vote
6
down vote
favorite
up vote
6
down vote
favorite
I’m trying to define an abs
command for absolute values using DeclarePairedDelimiter
from the mathtools
package, but I’m running into some spacing issues.
I’d normall write sup_n abs{a_n}
defined by DeclarePairedDelimiter{abs}{lvert}{rvert}
.
But then there is some space missing.
I would instead expect the following output, which I get using sup_n |a_n|
.
With sup_n {abs{a_n}}
this issue does not appear, but I find this additional pair of curly braces too cumbersome.
I also tried some variations, but both versions of abs
seem to have the same issue.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{abs}{lvert}{rvert}
DeclarePairedDelimiter{altabs}{|}{|}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n lvert a_n rvert quad
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
end{document}
Where is this problem coming from, and how can I get DeclarePairedDelimiter
to give the right spacing?
spacing delimiters mathtools
I’m trying to define an abs
command for absolute values using DeclarePairedDelimiter
from the mathtools
package, but I’m running into some spacing issues.
I’d normall write sup_n abs{a_n}
defined by DeclarePairedDelimiter{abs}{lvert}{rvert}
.
But then there is some space missing.
I would instead expect the following output, which I get using sup_n |a_n|
.
With sup_n {abs{a_n}}
this issue does not appear, but I find this additional pair of curly braces too cumbersome.
I also tried some variations, but both versions of abs
seem to have the same issue.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{abs}{lvert}{rvert}
DeclarePairedDelimiter{altabs}{|}{|}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n lvert a_n rvert quad
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
end{document}
Where is this problem coming from, and how can I get DeclarePairedDelimiter
to give the right spacing?
spacing delimiters mathtools
spacing delimiters mathtools
asked Nov 26 at 11:28
Jendrik Stelzner
21327
21327
3
The fact is that the space should not be there: if you use the propersup_nlvert a_nrvert
, you see it. Just likesup(a_1,dots,a_n)
should not have space.
– egreg
Nov 26 at 11:33
1
In addition to egregs comment, remember that|...|
is not the correct syntax for absolute value.|
is a normal symbol (an ord), whereaslvert
andrvert
are|
with type math open and math close respectfully (just as()
). Whensub
sees an ord like a letter or|
it inserts a space, whereas it does not insert a space when it sees something of type math open. InternallyDeclarePairedDelimiter
will always make the fences into open and close types which is why yourabs
andaltabs
gives the same result.
– daleif
Nov 26 at 11:56
I guess then that my latex code does not properly reflect what I actually want to express: I understand something like “sup(f)” as “sup( ) applied to f”, but “sup |f|” as “sup (written without paratheses) applied |f|”, not as “sup| | applied to f”. Hence I expect the same spacing for both “sup f” and “sup |f|”.
– Jendrik Stelzner
Nov 26 at 12:19
add a comment |
3
The fact is that the space should not be there: if you use the propersup_nlvert a_nrvert
, you see it. Just likesup(a_1,dots,a_n)
should not have space.
– egreg
Nov 26 at 11:33
1
In addition to egregs comment, remember that|...|
is not the correct syntax for absolute value.|
is a normal symbol (an ord), whereaslvert
andrvert
are|
with type math open and math close respectfully (just as()
). Whensub
sees an ord like a letter or|
it inserts a space, whereas it does not insert a space when it sees something of type math open. InternallyDeclarePairedDelimiter
will always make the fences into open and close types which is why yourabs
andaltabs
gives the same result.
– daleif
Nov 26 at 11:56
I guess then that my latex code does not properly reflect what I actually want to express: I understand something like “sup(f)” as “sup( ) applied to f”, but “sup |f|” as “sup (written without paratheses) applied |f|”, not as “sup| | applied to f”. Hence I expect the same spacing for both “sup f” and “sup |f|”.
– Jendrik Stelzner
Nov 26 at 12:19
3
3
The fact is that the space should not be there: if you use the proper
sup_nlvert a_nrvert
, you see it. Just like sup(a_1,dots,a_n)
should not have space.– egreg
Nov 26 at 11:33
The fact is that the space should not be there: if you use the proper
sup_nlvert a_nrvert
, you see it. Just like sup(a_1,dots,a_n)
should not have space.– egreg
Nov 26 at 11:33
1
1
In addition to egregs comment, remember that
|...|
is not the correct syntax for absolute value. |
is a normal symbol (an ord), whereas lvert
and rvert
are |
with type math open and math close respectfully (just as ()
). When sub
sees an ord like a letter or |
it inserts a space, whereas it does not insert a space when it sees something of type math open. Internally DeclarePairedDelimiter
will always make the fences into open and close types which is why your abs
and altabs
gives the same result.– daleif
Nov 26 at 11:56
In addition to egregs comment, remember that
|...|
is not the correct syntax for absolute value. |
is a normal symbol (an ord), whereas lvert
and rvert
are |
with type math open and math close respectfully (just as ()
). When sub
sees an ord like a letter or |
it inserts a space, whereas it does not insert a space when it sees something of type math open. Internally DeclarePairedDelimiter
will always make the fences into open and close types which is why your abs
and altabs
gives the same result.– daleif
Nov 26 at 11:56
I guess then that my latex code does not properly reflect what I actually want to express: I understand something like “sup(f)” as “sup( ) applied to f”, but “sup |f|” as “sup (written without paratheses) applied |f|”, not as “sup| | applied to f”. Hence I expect the same spacing for both “sup f” and “sup |f|”.
– Jendrik Stelzner
Nov 26 at 12:19
I guess then that my latex code does not properly reflect what I actually want to express: I understand something like “sup(f)” as “sup( ) applied to f”, but “sup |f|” as “sup (written without paratheses) applied |f|”, not as “sup| | applied to f”. Hence I expect the same spacing for both “sup f” and “sup |f|”.
– Jendrik Stelzner
Nov 26 at 12:19
add a comment |
1 Answer
1
active
oldest
votes
up vote
7
down vote
There should be no space between the operator name and a delimiter, so the output one gets from
sup_{n}lvert a_{n}rvert
is right (and is one of the reasons why amsmath
introduced lvert
and rvert
to begin with).
On the other hand, you may like the thin space when the delimiter is a vertical bar. Easy enough: add a dummy mathop{}
before it.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{absinner}{lvert}{rvert}
DeclarePairedDelimiter{altabsinner}{|}{|}
newcommand{abs}{mathop{}absinner}
newcommand{altabs}{mathop{}altabsinner}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
begin{alignat*}{3}
a_n - abs{a_n} &quad& a_n-lvert a_nrvert &quad& a_n-|a_n|\
-abs{a_n} && -abs{a_n} && -|a_n|
end{alignat*}
end{document}
I'd not do it myself, though.
Is there a reason why you chose anmathop{}
instead of just{}
?
– Jendrik Stelzner
Dec 1 at 11:31
@JendrikStelzner Try and see the differences in the examples.
– egreg
Dec 1 at 11:36
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
There should be no space between the operator name and a delimiter, so the output one gets from
sup_{n}lvert a_{n}rvert
is right (and is one of the reasons why amsmath
introduced lvert
and rvert
to begin with).
On the other hand, you may like the thin space when the delimiter is a vertical bar. Easy enough: add a dummy mathop{}
before it.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{absinner}{lvert}{rvert}
DeclarePairedDelimiter{altabsinner}{|}{|}
newcommand{abs}{mathop{}absinner}
newcommand{altabs}{mathop{}altabsinner}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
begin{alignat*}{3}
a_n - abs{a_n} &quad& a_n-lvert a_nrvert &quad& a_n-|a_n|\
-abs{a_n} && -abs{a_n} && -|a_n|
end{alignat*}
end{document}
I'd not do it myself, though.
Is there a reason why you chose anmathop{}
instead of just{}
?
– Jendrik Stelzner
Dec 1 at 11:31
@JendrikStelzner Try and see the differences in the examples.
– egreg
Dec 1 at 11:36
add a comment |
up vote
7
down vote
There should be no space between the operator name and a delimiter, so the output one gets from
sup_{n}lvert a_{n}rvert
is right (and is one of the reasons why amsmath
introduced lvert
and rvert
to begin with).
On the other hand, you may like the thin space when the delimiter is a vertical bar. Easy enough: add a dummy mathop{}
before it.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{absinner}{lvert}{rvert}
DeclarePairedDelimiter{altabsinner}{|}{|}
newcommand{abs}{mathop{}absinner}
newcommand{altabs}{mathop{}altabsinner}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
begin{alignat*}{3}
a_n - abs{a_n} &quad& a_n-lvert a_nrvert &quad& a_n-|a_n|\
-abs{a_n} && -abs{a_n} && -|a_n|
end{alignat*}
end{document}
I'd not do it myself, though.
Is there a reason why you chose anmathop{}
instead of just{}
?
– Jendrik Stelzner
Dec 1 at 11:31
@JendrikStelzner Try and see the differences in the examples.
– egreg
Dec 1 at 11:36
add a comment |
up vote
7
down vote
up vote
7
down vote
There should be no space between the operator name and a delimiter, so the output one gets from
sup_{n}lvert a_{n}rvert
is right (and is one of the reasons why amsmath
introduced lvert
and rvert
to begin with).
On the other hand, you may like the thin space when the delimiter is a vertical bar. Easy enough: add a dummy mathop{}
before it.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{absinner}{lvert}{rvert}
DeclarePairedDelimiter{altabsinner}{|}{|}
newcommand{abs}{mathop{}absinner}
newcommand{altabs}{mathop{}altabsinner}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
begin{alignat*}{3}
a_n - abs{a_n} &quad& a_n-lvert a_nrvert &quad& a_n-|a_n|\
-abs{a_n} && -abs{a_n} && -|a_n|
end{alignat*}
end{document}
I'd not do it myself, though.
There should be no space between the operator name and a delimiter, so the output one gets from
sup_{n}lvert a_{n}rvert
is right (and is one of the reasons why amsmath
introduced lvert
and rvert
to begin with).
On the other hand, you may like the thin space when the delimiter is a vertical bar. Easy enough: add a dummy mathop{}
before it.
documentclass[a4paper,10pt]{scrartcl}
usepackage{mathtools}
DeclarePairedDelimiter{absinner}{lvert}{rvert}
DeclarePairedDelimiter{altabsinner}{|}{|}
newcommand{abs}{mathop{}absinner}
newcommand{altabs}{mathop{}altabsinner}
begin{document}
[
sup_n |a_n| quad % expected output
sup_n abs{a_n} quad
sup_n {abs{a_n}} quad % expected output
sup_n altabs{a_n} quad
sup_n {altabs{a_n}} % expected output
]
begin{alignat*}{3}
a_n - abs{a_n} &quad& a_n-lvert a_nrvert &quad& a_n-|a_n|\
-abs{a_n} && -abs{a_n} && -|a_n|
end{alignat*}
end{document}
I'd not do it myself, though.
edited Nov 26 at 14:10
answered Nov 26 at 14:04
egreg
703k8618753154
703k8618753154
Is there a reason why you chose anmathop{}
instead of just{}
?
– Jendrik Stelzner
Dec 1 at 11:31
@JendrikStelzner Try and see the differences in the examples.
– egreg
Dec 1 at 11:36
add a comment |
Is there a reason why you chose anmathop{}
instead of just{}
?
– Jendrik Stelzner
Dec 1 at 11:31
@JendrikStelzner Try and see the differences in the examples.
– egreg
Dec 1 at 11:36
Is there a reason why you chose an
mathop{}
instead of just {}
?– Jendrik Stelzner
Dec 1 at 11:31
Is there a reason why you chose an
mathop{}
instead of just {}
?– Jendrik Stelzner
Dec 1 at 11:31
@JendrikStelzner Try and see the differences in the examples.
– egreg
Dec 1 at 11:36
@JendrikStelzner Try and see the differences in the examples.
– egreg
Dec 1 at 11:36
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%2f461806%2fmissing-space-with-declarepaireddelimiter%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
3
The fact is that the space should not be there: if you use the proper
sup_nlvert a_nrvert
, you see it. Just likesup(a_1,dots,a_n)
should not have space.– egreg
Nov 26 at 11:33
1
In addition to egregs comment, remember that
|...|
is not the correct syntax for absolute value.|
is a normal symbol (an ord), whereaslvert
andrvert
are|
with type math open and math close respectfully (just as()
). Whensub
sees an ord like a letter or|
it inserts a space, whereas it does not insert a space when it sees something of type math open. InternallyDeclarePairedDelimiter
will always make the fences into open and close types which is why yourabs
andaltabs
gives the same result.– daleif
Nov 26 at 11:56
I guess then that my latex code does not properly reflect what I actually want to express: I understand something like “sup(f)” as “sup( ) applied to f”, but “sup |f|” as “sup (written without paratheses) applied |f|”, not as “sup| | applied to f”. Hence I expect the same spacing for both “sup f” and “sup |f|”.
– Jendrik Stelzner
Nov 26 at 12:19