# Adding slurs to words in a text

Friends, I have a special case in which I need to insert slurs (music) in some words in a text. A slur is a curved line connecting notes on a score to indicate that they are to be played or sung legato:

It would be something like this:

These "text" slurs won't be used on very long words.

I thought of using \draw (point) arc (x:y:z), but I'm stuck on how can I obtain the arc lenght for such words. Besides, I have no idea of what to do if there's a line break, though I don't believe this will ever happen.

I don't if there are any specific packages for this purpose. Slurs are common in music, but not in text (at least, on this context). Any ideas?

-
From the title, I thought you wanted to insert ethnic slurs at random points within words throughout a text, like some bad imitation of Tourette's. The conclusions we jump to… –  Jon Purdy Aug 14 '11 at 3:17
@JonPurdy. You're thinking of coprolalia, which is an occasional feature of Tourette's syndrome, but not an intrinsic part of the condition. –  TRiG Apr 23 '13 at 16:17
@TRiG: Yes, that’s why I said “bad imitation”. I have two friends with Tourette’s. –  Jon Purdy Apr 23 '13 at 20:22

The bend right option is quite useful for this kind of thing:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand*\slur[1]{%
\tikz[baseline=0]{
\node[anchor=base,inner sep=0,outer sep=0] (A) {#1};
\path[-] (A.south west) + (\pgflinewidth,0) edge [bend right=20] ($(A.south east)-(\pgflinewidth,0)$);
}%
}

\begin{document}
Hello world, how \slur{are you}?
\end{document}


-
Beautifully done, Caramdir! Thanks. =) –  Paulo Cereda Aug 14 '11 at 16:56

If you really want an arc, here's a TikZ solution, although Mike's solution is nicely simple. I've also added a pstricks version if you prefer that.

\documentclass{article}
\usepackage{tikz}

\newcommand*{\slur}[1]{
\tikz[baseline=0]{
\node[inner sep={0pt}, outer sep={0pt},anchor=base] (A) {#1};
\draw[very thick] (A.base west) .. controls +(0,-.5) and +(0,-.5) .. (A.base east);}
}
% pstricks alternative
%\usepackage{pst-node}
%\newcommand*{\psslur}[1]{\rnode{A}{}#1\rnode{B}
%   {}\nccurve[ncurv=.4,linewidth=1.2pt,angleA=-90,angleB=-90]{A}{B}}

\begin{document}

Some regular words. \slur{A slurred group} and some more regular words.

\end{document}


-
Very nice, Alan! I really like your tikz and pstricks codes. –  Paulo Cereda Aug 14 '11 at 16:55

Run with xelatex or latex

\documentclass{article}
\usepackage{pst-node,xspace}
\newcommand*\psslur[2][]{\rnode[lb]{A}{#2\rnode[rb]{B}{}}%
\nccurve[#1,ncurv=.4,linewidth=1.2pt,
angleA=-80,angleB=-100]{A}{B}\xspace}

\begin{document}

\psslur{Some} regular words. \psslur[linecolor=red]{A slurred group}
and some more regular words.

\end{document}


-
Thanks for a pstricks implementation, Herbert! –  Paulo Cereda Aug 14 '11 at 16:54

It's not exactly an arc, but it may be close enough for your purposes. Using Table 175, Comprehensive LaTeX Symbol List:

\documentclass{article}
\usepackage{amsmath,mathabx}

\newcommand{\slur}[1]{$\undergroup{\text{#1}}$}

\begin{document}
Hello world, how \slur{are you}?
\end{document}

-
Thanks Mike, I really like your approach! =) –  Paulo Cereda Aug 14 '11 at 16:52