Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Based on the questions How can I draw arrows between words in linguistic examples? and Add arrow pointing from one table cell to another, I'm trying to draw a curved arrow from one character to another within a word. Whereas it looks fine with normal text, the arrow is slightly misaligned when the text is italicized (i.e. the arrow doesn't take into account that the text has been italicized). What to do?

\documentclass{article}
\usepackage{tikz}
\begin{document}
\noindent
abcd\tikz[baseline, remember picture] \node[inner sep = 0pt, anchor = base] (finisharrow){e};fgh\tikz[baseline, remember picture] \node[inner sep = 0pt, anchor = base] (startarrow){i};jklmnopqrstuvwxyz\\
\begin{tikzpicture}[remember picture, overlay, shorten <=.2ex, shorten >=.2ex]
    \path[->, thin](startarrow) edge[out = 90, in = 90] (finisharrow);
\end{tikzpicture}
\\ \textit{abcd\tikz[baseline, remember picture] \node[inner sep = 0pt, anchor = base] (finisharrow){e};fgh\tikz[baseline, remember picture] \node[inner sep = 0pt, anchor = base] (startarrow){i};jklmnopqrstuvwxyz}
\begin{tikzpicture}[remember picture, overlay, shorten <=.2ex, shorten >=.2ex]
    \path[->, thin](startarrow) edge[out = 90, in = 90] (finisharrow);
\end{tikzpicture}
\end{document}

enter image description here

(Based on what I found in the pgf manual, I first tried to use \draw with arc(::) rather than \path, but I wasn't able to connect the characters. I'm open to suggestions using arc instead, if that's better).

share|improve this question
1  
Hi Sverre. A tip: if you copy and paste the url of the questions directly, the title of the question will appear automatically. –  Claudio Fiandrino Feb 16 '13 at 14:15
add comment

1 Answer

up vote 4 down vote accepted

If you draw the "bounding box" of the italized i and e, you can see that the problem is that the north anchor of those boxes (which lies in the middle of the top edge), is misaligned with what the eye perceives as the middle of the char (due to the slant):

boxes

The above red boxes were drawn with:

\draw[red] (startarrow.south west) rectangle (startarrow.north east);
\draw[red] (finisharrow.south west) rectangle (finisharrow.north east);

Look at tihe i. The arrow correctly starts from the middle of the box, but the dot of the i is more on the north east of the box. For the letter e, however, north east would be too to the right.

I think a reasonable solution would be to use "angle anchors" as starting and finishing points for the arrow. An angle anchor is specified as nodename.angle, and it is the point which lies in the node edge, at the given angle from its center. If we use as angle the value of the slant in the italized letters (which I stimated to be around 70 degrees), a reasonably good result is get:

\path[->, thin](startarrow.70) edge[out = 90, in = 90] (finisharrow.70);

Result

share|improve this answer
    
This seems to be a good way to fix the issue I raised. Using a lower character (like a) as the starting point, however, I've noticed that the arc of the arrow is too flat. I've addressed this in a follow-up question in tex.stackexchange.com/questions/98484/… –  Sverre Feb 16 '13 at 16:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.