55

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

1
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Sep 10, 2013 at 6:17

3 Answers 3

75

Try \mathtools's \underbracket and \overbracket:

enter image description here

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

enter image description here

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

enter image description here

1
  • 2
    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
    Commented Jan 18, 2014 at 19:50
9

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.

enter image description here

\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}
1

When Unicode math font is loaded then \overbracket and \underbracket are standard horizontally scalable math objects. For example in OpTeX:

\fontfam[lmfonts]

$\overbracket{a+b+c}$

\bye

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .