[Tex/LaTex] nother style to make an \underbrace in big braces look elegant

best practicesequationsmath-mode

I don't think the following equation looks good because of the existence of the \underbrace.

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{amsmath}
\begin{document}
\[
12\left(\underbrace{y^2 +2y\left(-\frac{2}{3}\right) +\left(-\frac{2}{3}\right)^2}_{\left[y+\left(-\frac{2}{3}\right)\right]^2} -\left(-\frac{2}{3}\right)^2 +\frac{4}{5}\right) = 0
\]
\end{document}

enter image description here

Is there another style to make an \underbrace in big braces look elegant? I want to pull the underbrace out of the braces.

Best Answer

Instead of using \left( and \right) to auto-size the outermost set of parentheses, you could use \biggl( and \biggr):

enter image description here

(Aside: See the postings Why the control sequences \bigl, \biggl, \bigr or \biggr, as I can always use \big or \bigg? and Difference between \big[ and \bigl[ for a discussion of the differences between \Bigg( and \Biggl(.)

I would recommend, actually, using \Biggl[ (while adding \, immediately afterwards) and \Biggr] to provide a bit more -- but not too much... -- visual prominence as well as variety to the outer fences:

enter image description here

The default LaTeX/amsmath style for underbraces frankly looks quite boring to me. If you have access to the mtpro2 package, you could use its macro \undercbrace to generate a curly underbrace. Cautions: (i) The font used by this package is Times Roman, which may or may not be to your liking. (ii) The mtpro2 package isn't free of charge; however, its "lite" subset, which is all that's needed to use the \undercbrace macro, can be obtained without (financial) charge.

enter image description here

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{amsmath}
\usepackage[lite]{mtpro2}
\begin{document}
\[
12\Biggl[\,\undercbrace{y^2 +2y\left(-\frac{2}{3}\right) +\left(-\frac{2}{3}\right)^2}_{\left[y+\left(-\frac{2}{3}\right)\right]^2}{} -\left(-\frac{2}{3}\right)^2 +\frac{4}{5}\Biggr] = 0
\]
\end{document}

Addendum: The immediately preceding example is intended mainly to demonstrate the shape of the "curly" underbrace. Thus, the only changes, relative to the code used in the second example, were in loading the mtpro2 package and using \undercbrace instead of \underbrace.

If you're serious about using the mtpro2 package, I would recommend making a few additional changes to the code. Chief among them are these: (i) load the mleftright package and execute \mleftright in the preamble to eliminate the extra horizontal whitespace that's otherwise inserted by \left and \right; (ii) don't insert a thinspace after \Biggl[; and (iii) insert a negative thinspace (\!) after the undercbrace material.

enter image description here

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{amsmath}
\usepackage{mleftright}\mleftright
\usepackage[lite]{mtpro2}
\begin{document}
\[
12\Biggl[ \undercbrace{y^2 +2y\left(-\frac{2}{3}\right) 
  +\left(-\frac{2}{3}\right)^2}_{
   \left[y+\left(-\frac{2}{3}\right)\right]^2} \! {}
  -\left(-\frac{2}{3}\right)^2 +\frac{4}{5}\Biggr] = 0
\]
\end{document}