# \overbrace and \underbrace with square bracket

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 13):

\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):

• I've rolled back an edit here as it pointed to a specific CTAN node rather than the mirror. Things might not work today as there is some maintenance ongoing at DANTE. – Joseph Wright Jan 18 '14 at 19:50

The "standard LaTeX" underbraces and overbraces quickly become straight lines with only minor bumps as soon as the material being embraced (pun intended) is of more than minimal length. To add some visual interest and pizzazz, one may want to consider using the \undercbrace and \overcbrace macros of the MathTime Professional 2 package. Note that the full mtpro2 package isn't free of charge; however, its "lite" subset, which is all that's required to generate the curly braces shown below, is indeed available free of charge.

\documentclass{article}
\usepackage[lite]{mtpro2}%
\begin{document}
Curly over- and underbraces of the \texttt{mtpro2} package:
$\overcbrace{a+b+c+d+e+f}^{ghi} \quad \undercbrace{a+b+c+d+e+f}_{ghi}$

Standard \LaTeX'' over- and underbraces:
$\overbrace{a+b+c+d+e+f}^{ghi} \quad \underbrace{a+b+c+d+e+f}_{ghi}$
\end{document}