การเพิ่มลูกศรระหว่างบรรทัด
Oct 18 2020
ฉันใช้รหัสนี้เพื่อวาดแผนภาพ:
\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}
ฉันต้องการวาดลูกศรชี้จากซ้ายไปขวาตรงกลางของแต่ละบรรทัด ใครช่วยหน่อยได้ไหม ขอบคุณ.
คำตอบ
3 Alenanno Oct 18 2020 at 17:12
วิธีหนึ่งคือใช้ของประดับตกแต่งผ่าน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}