Why \underbrace has _{...} instead of an optional parameter?
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!
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 {#1}\hfil $\crcr
\noalign {\kern 3\p@ \nointerlineskip }\upbracefill \crcr \noalign {\kern 3\p@
}}}}\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:
$\underbrace{abcd}_{dcba}\ \underbrace{abcd}^{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.