我在文档课书中,这是我绘制的三角形:
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\newcommand{\arrowL}{
\tikz \draw[latex-] (0,0) -- (0.1,0);
}
\newcommand{\arrowR}{
\tikz \draw[-latex] (0,0) -- (0.1,0);
}
\begin{tikzpicture}
\begin{scope}[rotate= -90]
\draw (0,0)--(0,2) node[sloped,pos=0.5]{\arrowR};
\draw (0,2)--(2,0) node[sloped,pos=0.5]{\arrowL};
\draw (0,0)--(2,0) node[sloped,pos=0.5]{\arrowL};
\node[left] at (0,0) {$v_3'$};
\node[above] at (0,2) {$v_0$};
\node[below] at (2,0) {$v_1'$};
\node[above] at (1,1) {$a$};
\node[above] at (1,-0.2) {$b$};
\end{scope}
\end{tikzpicture}
\end{document}
但是在箭头方向上我有以下问题,我需要我的箭头如下:左箭头从 $v_0$ 到 $v_3'$,上箭头从 $v_1'$ 到 $v_3'$,下箭头从 $v_0$ 到 $v_1'$
有人可以帮我调整这些箭头吗?
答案1
我推荐这个代码
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{decorations.markings}
\tikzset{midarrow/.style={postaction={decorate},
decoration={markings,% switch on markings
mark=at position .5 with {\arrow{latex}},
}}}
\begin{document}
\begin{tikzpicture}
\begin{scope}[rotate= -90]
\path
(0,0) coordinate (v3) node[left] {$v_3'$}
(0,2) coordinate (v0) node[right] {$v_0$}
(2,0) coordinate (v1) node[left] {$v_1'$};
\end{scope}
\draw[midarrow] (v3)--(v0);
\draw[midarrow] (v0) to node[right]{$a$} (v1) ;
\draw[midarrow] (v3) to node[left]{$b$} (v1);
\end{tikzpicture}
\end{document}