tikz 箭头上的直角而不是弯曲

tikz 箭头上的直角而不是弯曲

我正在尝试在两个字母之间绘制漂亮的文本箭头。我认为直角比弯曲更好看(我是 tikz 新手)。我该怎么做?也欢迎提出关于更美观的箭头的建议。:-)

注意:我必须编译两次才能使箭头处于正确的位置。

\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

像这样?

在此处输入图片描述

你只需要改为tikzpicture

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

tikzmark但是,使用库可以更简单、更正确地获得相同的结果:

\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}

相关内容