3

I need a newcommand like

\underbrace{}_{},

but I want a parenthese like that ( instead of {.

4 Answers4

6

Here's the variant of \underbrace without the piece in the middle:

\documentclass{article}

\makeatletter
\newcommand\underparen[1]{%
  \mathop{%
    \vtop{
      \m@th
      \ialign{%
        ##\crcr
        $\hfil\displaystyle{#1}\hfil$\crcr
        \noalign{\kern3\p@\nointerlineskip}%
        \upparenfill\crcr
      }%
    }%
  }\limits
}
\newcommand\upparenfill{%
  $\m@th\setbox\z@\hbox{$\braceld$}%
  \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$%
}
\makeatother

\begin{document}

$\underparen{abcdef}_{x}$

\end{document}

enter image description here

The small misalignment is only apparent, due to pixel rounding at low resolution.

egreg
  • 1,121,712
4

Here I do it with stacks.

\documentclass{article}
\usepackage{amsmath,stackengine,graphicx}
\makeatletter
\newcommand\underparen[1]{\@ifnextchar_{\uphelp{\uparen{#1}}}{\uparen{#1}}}
\makeatother
\def\uphelp#1_#2{\ensurestackMath{\stackunder[1pt]{#1}{\scriptstyle #2}}}
\newcommand\uparen[1]{\setbox0=\hbox{$#1$}\ensurestackMath{%
  \stackunder[0pt]{#1}{\rotatebox{90}{$\left(%
  \rule[\dimexpr-.5\wd0+\dp\strutbox-1.3pt]{0pt}{\wd0}\right.$}}%
}}
\begin{document}
\[
\underbrace{x^2 + y^2 + z^2}_{a}\quad
\underparen{x^2 + y^2 + z^2}\quad
\underparen{x^2 + y^2 + z^2}_{a}\quad
\]
\[
\underbrace{abcde}_{a}\quad
\underparen{abcde}\quad
\underparen{abcde}_{a}\quad
\]
\end{document}

enter image description here

3

If you dont know it yet, you also might consider using the \underbracket command from mathtools, which looks nice and may be customised (height and thickness). Of course there's also an \overbracket command:

\documentclass[10pt]{article}
\usepackage{mathtools} %
\providecommand\given{}
 \DeclarePairedDelimiterXPP\EV[1]{E}(){}{
 \renewcommand\given{\nonscript\,\delimsize\vert\nonscript\,}
 #1}
 \DeclarePairedDelimiterXPP\Var[1]{V}(){}{
 \renewcommand\given{\nonscript\,\delimsize\vert\nonscript\,}
 #1}


\begin{document}

\begin{align}
V(\varepsilon)&=\overbracket[0.4pt]{ E_{X}(\Var{\varepsilon \given X})}^\text{expected value}+V_{X}(\smash[b]{\underbracket[0.6pt]{\EV{\varepsilon \given X}}_\text{$=0$}})\notag
\\ & =E_{X}(\Var{\varepsilon \given X})\notag \\
&=E(\sigma^{2}_{Y\vert X})
\end{align}

\end{document} 

enter image description here

Bernard
  • 271,350
1

The abraces package ("a" for "asymmetric" or "arbitrary") will do this, and a lot more besides. The optional argument specifies the "design" of the brace. See the package documentation for more.

\documentclass{article}
\usepackage{abraces}
\begin{document}
$\aunderbrace[l1r]{abcdef}_{x}$
\end{document}
alephzero
  • 1,940