Why underbrace has _… instead of an optional parameter?
Clash Royale CLAN TAG#URR8PPP
up vote
25
down vote
favorite
Why is underbrace
(and similar commands) in the form
underbracemy formula_some text under my formula
?
Shouldn't a standard macro be in the form
underbrace[some text under my formula]my formula
since the text to put under is optional?
Why is it treated like a math operator?
documentclassarticle
usepackageamsmath
begindocument
[
underbracea+b=c
]
[
underbracea+b=c_textsomething
]
[
lim_xto a x= a
]
enddocument
math-mode macros
|
show 1 more comment
up vote
25
down vote
favorite
Why is underbrace
(and similar commands) in the form
underbracemy formula_some text under my formula
?
Shouldn't a standard macro be in the form
underbrace[some text under my formula]my formula
since the text to put under is optional?
Why is it treated like a math operator?
documentclassarticle
usepackageamsmath
begindocument
[
underbracea+b=c
]
[
underbracea+b=c_textsomething
]
[
lim_xto a x= a
]
enddocument
math-mode macros
I don't know, but probably to be consistent with plain TeX.
– TeXnician
Dec 2 at 9:47
@TeXnician I'm curious :)
– CarLaTeX
Dec 2 at 9:48
1
And, don't forget the related expression foroverbrace
:overbracea+b=c^textsomething
. I'm surmising that the use of_
and^
in these directives was meant to be, at least in part, somewhat mnemonic.
– Mico
Dec 2 at 10:01
If that plain TeX syntax bother:letoldunderbraceunderbrace
defunderbrace#1#2oldunderbrace#1_#2
– Fran
Dec 2 at 10:58
1
@manooooh Thank you!
– CarLaTeX
Dec 5 at 5:44
|
show 1 more comment
up vote
25
down vote
favorite
up vote
25
down vote
favorite
Why is underbrace
(and similar commands) in the form
underbracemy formula_some text under my formula
?
Shouldn't a standard macro be in the form
underbrace[some text under my formula]my formula
since the text to put under is optional?
Why is it treated like a math operator?
documentclassarticle
usepackageamsmath
begindocument
[
underbracea+b=c
]
[
underbracea+b=c_textsomething
]
[
lim_xto a x= a
]
enddocument
math-mode macros
Why is underbrace
(and similar commands) in the form
underbracemy formula_some text under my formula
?
Shouldn't a standard macro be in the form
underbrace[some text under my formula]my formula
since the text to put under is optional?
Why is it treated like a math operator?
documentclassarticle
usepackageamsmath
begindocument
[
underbracea+b=c
]
[
underbracea+b=c_textsomething
]
[
lim_xto a x= a
]
enddocument
math-mode macros
math-mode macros
asked Dec 2 at 9:39
CarLaTeX
28.6k446122
28.6k446122
I don't know, but probably to be consistent with plain TeX.
– TeXnician
Dec 2 at 9:47
@TeXnician I'm curious :)
– CarLaTeX
Dec 2 at 9:48
1
And, don't forget the related expression foroverbrace
:overbracea+b=c^textsomething
. I'm surmising that the use of_
and^
in these directives was meant to be, at least in part, somewhat mnemonic.
– Mico
Dec 2 at 10:01
If that plain TeX syntax bother:letoldunderbraceunderbrace
defunderbrace#1#2oldunderbrace#1_#2
– Fran
Dec 2 at 10:58
1
@manooooh Thank you!
– CarLaTeX
Dec 5 at 5:44
|
show 1 more comment
I don't know, but probably to be consistent with plain TeX.
– TeXnician
Dec 2 at 9:47
@TeXnician I'm curious :)
– CarLaTeX
Dec 2 at 9:48
1
And, don't forget the related expression foroverbrace
:overbracea+b=c^textsomething
. I'm surmising that the use of_
and^
in these directives was meant to be, at least in part, somewhat mnemonic.
– Mico
Dec 2 at 10:01
If that plain TeX syntax bother:letoldunderbraceunderbrace
defunderbrace#1#2oldunderbrace#1_#2
– Fran
Dec 2 at 10:58
1
@manooooh Thank you!
– CarLaTeX
Dec 5 at 5:44
I don't know, but probably to be consistent with plain TeX.
– TeXnician
Dec 2 at 9:47
I don't know, but probably to be consistent with plain TeX.
– TeXnician
Dec 2 at 9:47
@TeXnician I'm curious :)
– CarLaTeX
Dec 2 at 9:48
@TeXnician I'm curious :)
– CarLaTeX
Dec 2 at 9:48
1
1
And, don't forget the related expression for
overbrace
: overbracea+b=c^textsomething
. I'm surmising that the use of _
and ^
in these directives was meant to be, at least in part, somewhat mnemonic.– Mico
Dec 2 at 10:01
And, don't forget the related expression for
overbrace
: overbracea+b=c^textsomething
. I'm surmising that the use of _
and ^
in these directives was meant to be, at least in part, somewhat mnemonic.– Mico
Dec 2 at 10:01
If that plain TeX syntax bother:
letoldunderbraceunderbrace
defunderbrace#1#2oldunderbrace#1_#2
– Fran
Dec 2 at 10:58
If that plain TeX syntax bother:
letoldunderbraceunderbrace
defunderbrace#1#2oldunderbrace#1_#2
– Fran
Dec 2 at 10:58
1
1
@manooooh Thank you!
– CarLaTeX
Dec 5 at 5:44
@manooooh Thank you!
– CarLaTeX
Dec 5 at 5:44
|
show 1 more comment
3 Answers
3
active
oldest
votes
up vote
17
down vote
accepted
The underbrace
macro is exactly the same in LaTeX as in plain: it's one of those things which came with the original 'load on top of plain' approach, well before latex.ltx
. Moreover, the _
'argument' isn't an argument at all, it's a TeX core subscript. It looks like an argument, but the construction uses low-level TeX math mode primitives.
Re-implemented today, one would likely set up such that the alignment is done without the primitives, and thus the text part would be an argument. But that's a completely different question!
1
Thank you, so TeXnician was right :)
– CarLaTeX
Dec 2 at 9:59
2
One might argue that it is more-or-less a subscript anyway, so the interface is consistent withsum
,int
, ...
– Joseph Wright♦
Dec 2 at 10:00
1
And also mnemonic, as Mico said.
– CarLaTeX
Dec 2 at 10:10
8
@JosephWright There's the added problem thatunderbracea_b
is treated as an Op atom, with consequences on spacing. It's usually better to brace it:underbracea_b
.
– egreg
Dec 2 at 10:26
@egreg Sure, but that's not directly related to the syntax ...
– Joseph Wright♦
Dec 2 at 10:37
add a comment |
up vote
3
down vote
When you look at the definition of underbrace
(or overbrace
) you'll see the following:
> underbrace=macro:
#1->mathop vtop m@th ialign ##crcr $hfil displaystyle #1hfil $crcr
noalign kern 3p@ nointerlineskip upbracefill crcr noalign kern 3p@
limits .
It shows that the first (and only) argument to underbrace
is set as a math
op
erator and closes with limits
. And, math operators have their limits (superscripts and subscripts) set on top/below it. It's therefore no surprise that you can do:
$underbraceabcd_dcba underbraceabcd^dcba$
It's treated like a math operator because that's the primitive way of stacking elements below/above something so that it doesn't displace the someting vertically.
add a comment |
up vote
1
down vote
I think it's much easier to iterate with the underscore syntax. For example
documentclassarticle
usepackageamsmath
begindocument
beginequation*
underbraceleft(frac12+frac13right)_
>underbracefrac14+frac14_
underbrace2cdot frac14_
frac12
quad + quad
underbraceleft(frac14+frac15+frac16+frac17right)_
>underbracefrac18+frac18+frac18+frac18_
underbrace4cdot frac18_
frac12
quad > quad frac12+frac12
endequation*
enddocument
Try to do the same with the "option" syntax. The point is that with the "underscore" syntax, you write the code for the iteration sequentially, from left to right, similarly to what the output will look like, while with the option syntax, you'd end up writing from right to left, so the bottom 1/2
in the output will be the leftmost formula after the three underbrace
commands.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
17
down vote
accepted
The underbrace
macro is exactly the same in LaTeX as in plain: it's one of those things which came with the original 'load on top of plain' approach, well before latex.ltx
. Moreover, the _
'argument' isn't an argument at all, it's a TeX core subscript. It looks like an argument, but the construction uses low-level TeX math mode primitives.
Re-implemented today, one would likely set up such that the alignment is done without the primitives, and thus the text part would be an argument. But that's a completely different question!
1
Thank you, so TeXnician was right :)
– CarLaTeX
Dec 2 at 9:59
2
One might argue that it is more-or-less a subscript anyway, so the interface is consistent withsum
,int
, ...
– Joseph Wright♦
Dec 2 at 10:00
1
And also mnemonic, as Mico said.
– CarLaTeX
Dec 2 at 10:10
8
@JosephWright There's the added problem thatunderbracea_b
is treated as an Op atom, with consequences on spacing. It's usually better to brace it:underbracea_b
.
– egreg
Dec 2 at 10:26
@egreg Sure, but that's not directly related to the syntax ...
– Joseph Wright♦
Dec 2 at 10:37
add a comment |
up vote
17
down vote
accepted
The underbrace
macro is exactly the same in LaTeX as in plain: it's one of those things which came with the original 'load on top of plain' approach, well before latex.ltx
. Moreover, the _
'argument' isn't an argument at all, it's a TeX core subscript. It looks like an argument, but the construction uses low-level TeX math mode primitives.
Re-implemented today, one would likely set up such that the alignment is done without the primitives, and thus the text part would be an argument. But that's a completely different question!
1
Thank you, so TeXnician was right :)
– CarLaTeX
Dec 2 at 9:59
2
One might argue that it is more-or-less a subscript anyway, so the interface is consistent withsum
,int
, ...
– Joseph Wright♦
Dec 2 at 10:00
1
And also mnemonic, as Mico said.
– CarLaTeX
Dec 2 at 10:10
8
@JosephWright There's the added problem thatunderbracea_b
is treated as an Op atom, with consequences on spacing. It's usually better to brace it:underbracea_b
.
– egreg
Dec 2 at 10:26
@egreg Sure, but that's not directly related to the syntax ...
– Joseph Wright♦
Dec 2 at 10:37
add a comment |
up vote
17
down vote
accepted
up vote
17
down vote
accepted
The underbrace
macro is exactly the same in LaTeX as in plain: it's one of those things which came with the original 'load on top of plain' approach, well before latex.ltx
. Moreover, the _
'argument' isn't an argument at all, it's a TeX core subscript. It looks like an argument, but the construction uses low-level TeX math mode primitives.
Re-implemented today, one would likely set up such that the alignment is done without the primitives, and thus the text part would be an argument. But that's a completely different question!
The underbrace
macro is exactly the same in LaTeX as in plain: it's one of those things which came with the original 'load on top of plain' approach, well before latex.ltx
. Moreover, the _
'argument' isn't an argument at all, it's a TeX core subscript. It looks like an argument, but the construction uses low-level TeX math mode primitives.
Re-implemented today, one would likely set up such that the alignment is done without the primitives, and thus the text part would be an argument. But that's a completely different question!
edited Dec 2 at 13:38
CarLaTeX
28.6k446122
28.6k446122
answered Dec 2 at 9:56
Joseph Wright♦
201k21554879
201k21554879
1
Thank you, so TeXnician was right :)
– CarLaTeX
Dec 2 at 9:59
2
One might argue that it is more-or-less a subscript anyway, so the interface is consistent withsum
,int
, ...
– Joseph Wright♦
Dec 2 at 10:00
1
And also mnemonic, as Mico said.
– CarLaTeX
Dec 2 at 10:10
8
@JosephWright There's the added problem thatunderbracea_b
is treated as an Op atom, with consequences on spacing. It's usually better to brace it:underbracea_b
.
– egreg
Dec 2 at 10:26
@egreg Sure, but that's not directly related to the syntax ...
– Joseph Wright♦
Dec 2 at 10:37
add a comment |
1
Thank you, so TeXnician was right :)
– CarLaTeX
Dec 2 at 9:59
2
One might argue that it is more-or-less a subscript anyway, so the interface is consistent withsum
,int
, ...
– Joseph Wright♦
Dec 2 at 10:00
1
And also mnemonic, as Mico said.
– CarLaTeX
Dec 2 at 10:10
8
@JosephWright There's the added problem thatunderbracea_b
is treated as an Op atom, with consequences on spacing. It's usually better to brace it:underbracea_b
.
– egreg
Dec 2 at 10:26
@egreg Sure, but that's not directly related to the syntax ...
– Joseph Wright♦
Dec 2 at 10:37
1
1
Thank you, so TeXnician was right :)
– CarLaTeX
Dec 2 at 9:59
Thank you, so TeXnician was right :)
– CarLaTeX
Dec 2 at 9:59
2
2
One might argue that it is more-or-less a subscript anyway, so the interface is consistent with
sum
, int
, ...– Joseph Wright♦
Dec 2 at 10:00
One might argue that it is more-or-less a subscript anyway, so the interface is consistent with
sum
, int
, ...– Joseph Wright♦
Dec 2 at 10:00
1
1
And also mnemonic, as Mico said.
– CarLaTeX
Dec 2 at 10:10
And also mnemonic, as Mico said.
– CarLaTeX
Dec 2 at 10:10
8
8
@JosephWright There's the added problem that
underbracea_b
is treated as an Op atom, with consequences on spacing. It's usually better to brace it: underbracea_b
.– egreg
Dec 2 at 10:26
@JosephWright There's the added problem that
underbracea_b
is treated as an Op atom, with consequences on spacing. It's usually better to brace it: underbracea_b
.– egreg
Dec 2 at 10:26
@egreg Sure, but that's not directly related to the syntax ...
– Joseph Wright♦
Dec 2 at 10:37
@egreg Sure, but that's not directly related to the syntax ...
– Joseph Wright♦
Dec 2 at 10:37
add a comment |
up vote
3
down vote
When you look at the definition of underbrace
(or overbrace
) you'll see the following:
> underbrace=macro:
#1->mathop vtop m@th ialign ##crcr $hfil displaystyle #1hfil $crcr
noalign kern 3p@ nointerlineskip upbracefill crcr noalign kern 3p@
limits .
It shows that the first (and only) argument to underbrace
is set as a math
op
erator and closes with limits
. And, math operators have their limits (superscripts and subscripts) set on top/below it. It's therefore no surprise that you can do:
$underbraceabcd_dcba underbraceabcd^dcba$
It's treated like a math operator because that's the primitive way of stacking elements below/above something so that it doesn't displace the someting vertically.
add a comment |
up vote
3
down vote
When you look at the definition of underbrace
(or overbrace
) you'll see the following:
> underbrace=macro:
#1->mathop vtop m@th ialign ##crcr $hfil displaystyle #1hfil $crcr
noalign kern 3p@ nointerlineskip upbracefill crcr noalign kern 3p@
limits .
It shows that the first (and only) argument to underbrace
is set as a math
op
erator and closes with limits
. And, math operators have their limits (superscripts and subscripts) set on top/below it. It's therefore no surprise that you can do:
$underbraceabcd_dcba underbraceabcd^dcba$
It's treated like a math operator because that's the primitive way of stacking elements below/above something so that it doesn't displace the someting vertically.
add a comment |
up vote
3
down vote
up vote
3
down vote
When you look at the definition of underbrace
(or overbrace
) you'll see the following:
> underbrace=macro:
#1->mathop vtop m@th ialign ##crcr $hfil displaystyle #1hfil $crcr
noalign kern 3p@ nointerlineskip upbracefill crcr noalign kern 3p@
limits .
It shows that the first (and only) argument to underbrace
is set as a math
op
erator and closes with limits
. And, math operators have their limits (superscripts and subscripts) set on top/below it. It's therefore no surprise that you can do:
$underbraceabcd_dcba underbraceabcd^dcba$
It's treated like a math operator because that's the primitive way of stacking elements below/above something so that it doesn't displace the someting vertically.
When you look at the definition of underbrace
(or overbrace
) you'll see the following:
> underbrace=macro:
#1->mathop vtop m@th ialign ##crcr $hfil displaystyle #1hfil $crcr
noalign kern 3p@ nointerlineskip upbracefill crcr noalign kern 3p@
limits .
It shows that the first (and only) argument to underbrace
is set as a math
op
erator and closes with limits
. And, math operators have their limits (superscripts and subscripts) set on top/below it. It's therefore no surprise that you can do:
$underbraceabcd_dcba underbraceabcd^dcba$
It's treated like a math operator because that's the primitive way of stacking elements below/above something so that it doesn't displace the someting vertically.
answered Dec 5 at 3:59
Werner
434k619531639
434k619531639
add a comment |
add a comment |
up vote
1
down vote
I think it's much easier to iterate with the underscore syntax. For example
documentclassarticle
usepackageamsmath
begindocument
beginequation*
underbraceleft(frac12+frac13right)_
>underbracefrac14+frac14_
underbrace2cdot frac14_
frac12
quad + quad
underbraceleft(frac14+frac15+frac16+frac17right)_
>underbracefrac18+frac18+frac18+frac18_
underbrace4cdot frac18_
frac12
quad > quad frac12+frac12
endequation*
enddocument
Try to do the same with the "option" syntax. The point is that with the "underscore" syntax, you write the code for the iteration sequentially, from left to right, similarly to what the output will look like, while with the option syntax, you'd end up writing from right to left, so the bottom 1/2
in the output will be the leftmost formula after the three underbrace
commands.
add a comment |
up vote
1
down vote
I think it's much easier to iterate with the underscore syntax. For example
documentclassarticle
usepackageamsmath
begindocument
beginequation*
underbraceleft(frac12+frac13right)_
>underbracefrac14+frac14_
underbrace2cdot frac14_
frac12
quad + quad
underbraceleft(frac14+frac15+frac16+frac17right)_
>underbracefrac18+frac18+frac18+frac18_
underbrace4cdot frac18_
frac12
quad > quad frac12+frac12
endequation*
enddocument
Try to do the same with the "option" syntax. The point is that with the "underscore" syntax, you write the code for the iteration sequentially, from left to right, similarly to what the output will look like, while with the option syntax, you'd end up writing from right to left, so the bottom 1/2
in the output will be the leftmost formula after the three underbrace
commands.
add a comment |
up vote
1
down vote
up vote
1
down vote
I think it's much easier to iterate with the underscore syntax. For example
documentclassarticle
usepackageamsmath
begindocument
beginequation*
underbraceleft(frac12+frac13right)_
>underbracefrac14+frac14_
underbrace2cdot frac14_
frac12
quad + quad
underbraceleft(frac14+frac15+frac16+frac17right)_
>underbracefrac18+frac18+frac18+frac18_
underbrace4cdot frac18_
frac12
quad > quad frac12+frac12
endequation*
enddocument
Try to do the same with the "option" syntax. The point is that with the "underscore" syntax, you write the code for the iteration sequentially, from left to right, similarly to what the output will look like, while with the option syntax, you'd end up writing from right to left, so the bottom 1/2
in the output will be the leftmost formula after the three underbrace
commands.
I think it's much easier to iterate with the underscore syntax. For example
documentclassarticle
usepackageamsmath
begindocument
beginequation*
underbraceleft(frac12+frac13right)_
>underbracefrac14+frac14_
underbrace2cdot frac14_
frac12
quad + quad
underbraceleft(frac14+frac15+frac16+frac17right)_
>underbracefrac18+frac18+frac18+frac18_
underbrace4cdot frac18_
frac12
quad > quad frac12+frac12
endequation*
enddocument
Try to do the same with the "option" syntax. The point is that with the "underscore" syntax, you write the code for the iteration sequentially, from left to right, similarly to what the output will look like, while with the option syntax, you'd end up writing from right to left, so the bottom 1/2
in the output will be the leftmost formula after the three underbrace
commands.
edited Dec 5 at 3:56
answered Dec 5 at 3:21
Máté Wierdl
40428
40428
add a comment |
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%2f462798%2fwhy-underbrace-has-instead-of-an-optional-parameter%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
I don't know, but probably to be consistent with plain TeX.
– TeXnician
Dec 2 at 9:47
@TeXnician I'm curious :)
– CarLaTeX
Dec 2 at 9:48
1
And, don't forget the related expression for
overbrace
:overbracea+b=c^textsomething
. I'm surmising that the use of_
and^
in these directives was meant to be, at least in part, somewhat mnemonic.– Mico
Dec 2 at 10:01
If that plain TeX syntax bother:
letoldunderbraceunderbrace
defunderbrace#1#2oldunderbrace#1_#2
– Fran
Dec 2 at 10:58
1
@manooooh Thank you!
– CarLaTeX
Dec 5 at 5:44