# How do I specify a round parenthesis below some text?

I need something similar to \underbrace but instead of curly brackets, I would like to have normal round horizontal paranthesis below my text. Similar to \textbottomtiebar but spanning the whole text.

How do I achieve this with tex?

-

## migrated from stackoverflow.comNov 24 '11 at 23:57

This question came from our site for professional and enthusiast programmers.

Perhaps a minipage? – Kerrek SB Nov 24 '11 at 17:26
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. – Torbjørn T. Nov 25 '11 at 0:01
See also: How do I specify a round parenthesis above some text? for another solution – Dejan Dec 28 '11 at 6:11

Here is an implementation of such thing you wanted done entirely in TeX (no tikz, no mathtools, no pstricks, nothing extra, etc):

\documentclass{article}
\pagestyle{empty}
\makeatletter
\def\underparen#1{\mathop{\vtop{\m@th\ialign{##\crcr
$\hfil\displaystyle{#1}\hfil$\crcr
\noalign{\kern3\p@\nointerlineskip}%
\upparenfill\crcr\noalign{\kern3\p@}}}}\limits}
\def\upparenfill{$\m@th \setbox\z@\hbox{$\braceld$}% \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$}
\makeatother
\begin{document}
$\underparen{\textrm{The quick brown fox jumped over the lazy dog}}$
\end{document}


Here is another solution using graphicx package:

\documentclass[12pt]{article}
\usepackage{graphicx}
\makeatletter
\newdimen\myboxwidth
\newdimen\myboxheight
\newdimen\myboxdepth
\def\underparen#1{%
\setbox\z@\hbox{#1}%
\myboxwidth\wd\z@%
\myboxheight\ht\z@%
\myboxdepth\dp\z@%
\mathop{\box\z@}\limits_{\kern-\myboxdepth\resizebox{\myboxwidth}{\myboxheight}{\rotatebox{90}{(}}}}
\makeatother
\begin{document}
$\underparen{The quick brown fox jumped over the lazy dog}$
\end{document}

-
The second solution has obvious problems if it's used inline: the baseline of underbraced text and that of the surrounding text don't match. – kahen Nov 25 '11 at 12:18
I edited second solution. – IRAN Nov 26 '11 at 7:13

Here's a TikZ-based solution (in fact, this solution can be viewed as the TikZ version of the PS-Tricks solution provided by Werner); the idea is to place a node at the beginning of the text and another one at the end, and then draw a curved line between those two nodes; the optional argument of \myunderline gives control over the attributes used to draw the line:

\documentclass{article}
\usepackage{tikz}

\newcommand\myunderline[2][]{%
\tikz[overlay,remember picture] \node (a) {};#2%
\tikz[overlay,remember picture] \node (b) {};
\begin{tikzpicture}[overlay,remember picture,out=315,in=225,distance=0.2cm]
\draw[#1] (a.center) to (b.center);
\end{tikzpicture}}

\begin{document}

\myunderline{The quick brown fox jumped over the lazy dog}

\myunderline[red]{The quick brown fox jumped over the lazy dog}

\myunderline[blue,dashed]{The quick brown fox jumped over the lazy dog}

\end{document}


-
You might add that you have to compile twice for the lines to show up. – Torbjørn T. Nov 25 '11 at 8:17
@TorbjørnT. Good point! That also applies to my answer. – Loop Space Nov 25 '11 at 8:28
@TorbjørnT. thanks for the comment. – Gonzalo Medina Nov 25 '11 at 17:09

Here's a slight variant of Gonzalo's answer that uses the calligraphy package to style the parenthetical line a little more like a parenthesis.

Here's the result:

Unfortunately, dashed lines are no longer possible. The only allowed modification is to the colour (though one could make the thickness configurable).

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations}
\usepackage{calligraphy}

\newcommand\myunderline[2][black]{%
\rule[-1.5ex]{0pt}{1.5ex}\tikz[overlay,remember picture,baseline=.5ex] \coordinate (a);#2%
\tikz[overlay,remember picture,baseline=.5ex] \coordinate (b);
\begin{tikzpicture}[overlay,remember picture]
\draw[thick,/pgf/calligraphy/pen colour=#1,decorate,decoration={calligraphic straight parenthesis}] (b) to (a);
\end{tikzpicture}}

\begin{document}

\myunderline{The quick brown fox jumped over the lazy dog}

\myunderline[red]{The quick brown fox jumped over the lazy dog}

\myunderline[blue]{The quick brown fox jumped over the lazy dog}

\end{document}


(I should warn any readers of this that the calligraphy package is still in development and so should be considered at "alpha" level. Also, you need the spath library which is available from the same site.)

-
Torbjørn's comment on Gonzalo's answer also applies: you have to compile twice for the lines to show up, or to notice changes in location of the text. – Loop Space Nov 25 '11 at 8:28

There are some other alternatives to \underbrace, like \underbracket from the mathtools package. However, for optimal control, you could use a graphics package to draw an arc underneath your text.

The following minimal example shows the difference between \underbrace, \underbracket, tipa's \textbottomtiebar and the newly created \textbottomtie macro.

\documentclass{article}
\usepackage{tipa}% http://ctan.org/pkg/tipa
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\usepackage{pst-node}% http://ctan.org/pkg/pst-node
\newcounter{tbtcntr}% \textbottomtie counter
\newcommand{\textbottomtie}[2][]{%
\stepcounter{tbtcntr}% For uniqueness
\psDefBoxNodes{tbt\thetbtcntr}{#2}% typeset contents
\ncarc[linewidth=0.5pt,arcangle=-5,linestyle=solid,#1]{-}{tbt\thetbtcntr:bl}{tbt\thetbtcntr:br}% arc
}
\begin{document}
$\underbracket{\textrm{The quick brown fox jumped over the lazy dog}}$ \par
$\underbrace{\textrm{The quick brown fox jumped over the lazy dog}}$ \par
\textbottomtiebar{The quick brown fox jumped over the lazy dog} \par
\textbottomtie{The quick brown fox jumped over the lazy dog}
\end{document}


The construction relies on \ncarc from the pstricks bundle and sets an arc at an angle of -5, width of 0.5pt and solid line style by default. Alternative, all the rich features of pstricks can be passed to \ncarc via the optional parameters of \textbottomtie[<options>]{...}. For example, passing linecolor=blue will typeset a blue line, while offset=-5pt will drop the tie by 5pt vertically. You can also override the default values by merely respecifying then (for example, using linewidth=1pt,linestyle=dashed produces a 1pt dashed tie).

Nodes are marked using pst-node and inserts the arc (or tie) tips at the bottom left (bl) and bottom right (br) of the text argument. If need be, it is possible to extend this to work also with larger text groups, like paragraphs and such, using a minipage, for example.

Since this uses pstricks, your compile sequence should be latex->dvips->ps2pdf or xelatex. Also, if using an arc is not satisfactory, you could use any one of the many node connection alternatives; just view the pstricks documentation (VII Node Connections, p 58).

Note that you might have to do some vertical correction below \textbottomtie to avoid it overwriting text below it.

-