# [Tex/LaTex] \overbrace and \underbrace with square bracket

bracketsmath-mode

I'm trying to put a nice square bracket over a complex text, it should look like an \overline but with ending like
\ulcorner and \urcorner.
The presence of \overrightarrow and \overleftarrow makes me believe that is possible to decorate the end of the \overline bar.

I know the existence of \overbrace, but I need a square bracket; moreover, \overbrace takes too much vertical space

Try \mathtools's \underbracket and \overbracket:

\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\begin{document}
$\overbrace{a+b+c}^{d} \quad \overbracket{a+b+c}^{d} \quad \underbrace{a+b+c}_{d} \quad \underbracket{a+b+c}_{d}$
\end{document}


You can adjust the rule width and bracket height/depth via optional arguments. From the mathtools documentation (section 3.3.2 Braces and brackets, p. 14):

\underbracket[<rule thickness>][<bracket height>]{<arg>}
\overbracket[<rule thickness>][<bracket height>]{<arg>}


Or, a more subtle approach with abraces:

\documentclass{article}
\usepackage{abraces}% http://ctan.org/pkg/abraces
\begin{document}
$\overbrace{a+b+c}^{d} \quad \aoverbrace[L1R]{a+b+c}^{d} \quad \underbrace{a+b+c}_{d} \quad \aunderbrace[l1r]{a+b+c}_{d}$
\end{document}


The usage requires a brace specification <spec> as an optional argument to \aoverbrace and \aunderbrace (see the abraces documentation):