在线条之间添加箭头

在线条之间添加箭头

我正在使用此代码绘制图表:

\begin{tikzpicture}
\draw (1,1) rectangle (11,7);
\draw (1.5,6) node{\textbf{X}$^{+}$}  .. controls (8,6) and (6,3) .. (10,3) node{\textbf{X}$^{+}$};
\draw (1.5,4) node{\textbf{X}$^{+}$}  .. controls (6,4) and (8.5,7) .. (10,6.5) node{\textbf{X}$^{+}$};
\draw (1.5,2) node{\textbf{X}$^{+}$}  .. controls (10,2) and (10,1.5) .. (10,1.5) node{\textbf{X}$^{+}$};
\draw (10,5.5) node{\textbf{X}$^{-}$}  .. controls (6,5) and (11,4) .. (10,4) node{\textbf{X}$^{+}$};
\draw (1.5,-0.3) node{$\tau$}  .. controls (3,0) and (11,-0.6) .. (10,-0.3) node{$\tau^{'}$};
\draw (12,7) node{$D_A\phi=0$};
\draw (12,-0.3) node{$\wedge^{+}$};

\end{tikzpicture}
    

我想在每条线的中间画从左到右的箭头。有人可以帮忙吗?谢谢。

答案1

一种方法是通过库使用装饰decorations.markings

输出

在此处输入图片描述

代码

\documentclass[tikz, margin=10pt]{standalone}

\usetikzlibrary{decorations.markings, arrows.meta}

\tikzset{
    direc/.style={%
        postaction={decorate,
            decoration={%
                markings,
                mark=at position 0.5 with{%
                    \arrow{Straight Barb[scale=1.5]}
                },
            }
        }
    }
}

\begin{document}
\begin{tikzpicture}
    \draw (1,1) rectangle (11,7);
    \draw[direc] (1.5,6) node{\textbf{X}$^{+}$}  .. controls (8,6) and (6,3) .. (10,3) node{\textbf{X}$^{+}$};
    \draw[direc] (1.5,4) node{\textbf{X}$^{+}$}  .. controls (6,4) and (8.5,7) .. (10,6.5) node{\textbf{X}$^{+}$};
    \draw[direc] (1.5,2) node{\textbf{X}$^{+}$}  .. controls (10,2) and (10,1.5) .. (10,1.5) node{\textbf{X}$^{+}$};
    \draw[direc] (10,5.5) node{\textbf{X}$^{-}$}  .. controls (6,5) and (11,4) .. (10,4) node{\textbf{X}$^{+}$};
    \draw[direc] (1.5,-0.3) node{$\tau$}  .. controls (3,0) and (11,-0.6) .. (10,-0.3) node{$\tau^{'}$};
    \draw (12,7) node{$D_A\phi=0$};
    \draw (12,-0.3) node{$\wedge^{+}$}; 
    \end{tikzpicture}
\end{document}

相关内容