Adicionando setas entre as linhas

Oct 18 2020

Estou usando este código para desenhar um diagrama:

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

Quero desenhar setas apontando da esquerda para a direita no meio de cada linha. Alguém pode ajudar por favor? Obrigado.

Respostas

3 Alenanno Oct 18 2020 at 17:12

Uma maneira é usar decorações por meio da decorations.markingsbiblioteca.

Resultado

Código

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