4

I'm trying to draw nice arrows in-text arrows between two letters. I think they would look better with right angles instead of a bend (I'm new to tikz). How would I do this? Also open to suggestions on nicer looking arrows. :-)

Note: I have to compile this twice to get the arrows in the right position.

\documentclass[12pt,a4paper]{article} 
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,automata,backgrounds,petri,matrix,fit,calc}

\begin{document}
\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [inner xsep=0pt, inner ysep=0pt, baseline]
This is some text. This is some text. This is some text. 
This is some text. -- {d\tikz\node[na, anchor=base](a1){o};g\tikz\node[na, anchor=base](a2){e};} -- This is some text. 
This is some text. This is some text. This is some text. This is some text.



\begin{tikzpicture}[overlay]
 \draw [<-](a1) to [bend left=90] (a2);
  \draw [->](a1) to [bend left=-90] (a2);
\end{tikzpicture} 
\end{document}

1 Answer 1

5

like this?

enter image description here

you only need to change tikzpicture to:

\draw [<-] (a1.north) -- ++ (0, 2mm) -| (a2);
\draw [->] (a1.south) -- ++ (0,-2mm) -| (a2);

however, the same result is more simple and correct to obtain with using tikzmark library:

\documentclass[12pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}
This is some text. This is some text. This is some text.
This is some text. -- d\tikzmarknode{a1}{o}g\tikzmarknode{a2}{e} --  This is some text. This is some text. This is some text. This is some text. This is some text.

    \begin{tikzpicture}[overlay,remember picture]
\draw [<-] (a1.north) -- ++ (0, 2mm) -| (a2);
\draw [->] (a1.south) -- ++ (0,-2mm) -| (a2);
    \end{tikzpicture}
\end{document}
2
  • Thanks @Zarko, the first option works perfectly. However, the tikzmark library doesn't seem to be working correctly when I run your second suggestion. Do you know why? Commented Apr 28, 2019 at 10:28
  • @user9974638, you might have installed old version of tikz. recent version is 3.1.2. try to update your whole latex installation.
    – Zarko
    Commented Apr 28, 2019 at 10:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .