[texhax] overlapping braces

Oleg Katsitadze olegkat at gmail.com
Sat Feb 7 20:24:17 CET 2009


On Sat, Feb 07, 2009 at 04:52:28PM +0100, Benjamin Sambale wrote:
> is it possible to overlap the commands "underbrace" and "overbrace"? To 
> be more specific, I want something like $aba^{-1}b^{-1}$ with underbrace 
> under aba^{-1} and overbrace over ba^{-1}b^{-1}.

Something like this:

------------------------------>%------------------------------
\def\uobrace#1#2#3{%
  \hbox to0pt{\mathsurround=0pt $\underbrace{#1#2}$\hss}
  \phantom{#1}
  \!\overbrace{\phantom{#2}#3}
}

$aba^{-1}b^{-1}$

$\uobrace{a}{ba^{-1}}{b^{-1}}$
------------------------------%<------------------------------


However, you have to be careful when operators occur at the
boundaries:

------------------------------>%------------------------------
$a\times ba^{-1} \times b^{-1}$

$\uobrace{a\times{}}{ba^{-1}\times{}}{b^{-1}}$

\vskip2pc

$a\times ba^{-1} \times b^{-1}$

$\uobrace{a\times{}}{ba^{-1}}{{}\times b^{-1}}$

\vskip2pc

$a\times ba^{-1} \times b^{-1}$

$\uobrace{a}{{}\times ba^{-1}}{{}\times b^{-1}}$
------------------------------%<------------------------------


It would be nice if the space on the outside of an operator was not
covered by a brace, but that would become too complex I think.
Hopefully you don't need this :).

Best,
Oleg


More information about the texhax mailing list