D
3) 箭头 Arrow
Tikz 框架中,几乎任何非 clip 的闭合 path 都可以放置箭头。由于箭头十分常用,Tikz 中箭头不需要指定键名(arrow 或 tips)就能使用,其基本的规则为,
/tikz/arrows=<start arrow spec>-<end arrow spec> % (no default)
Display
\begin{tikzpicture}
\node[font=\small] at (0, .5) {\textbf{Barbed Arrow}};
\foreach \y/\t in {
0/Arc Barb, 1/Bar, 2/Bracket, 3/Hooks,
4/Parenthesis, 5/Straight Barb, 6/Tee Barb
}{
\node[left, font=\small] at (-.3, -.4 * \y) { \t };
\draw[{\t}-{\t}] (0, -.4 * \y) -- ++(1, 0);
}
\node[font=\small] at (3.6, .5) {\textbf{Geometric Arrow}};
\foreach \y/\t in {
0/Circle, 1/Diamond, 2/Ellipse, 3/Kite, 4/Latex,
5/Rectangle, 6/Square, 7/Stealth, 8/Triangle, 9/Turned Square
}{
\node[left, font=\small] at (3.7, -.4 * \y) { \t };
\draw[{\t}-{\t}] (4, -.4 * \y) -- ++(1, 0);
}
\foreach \y/\t in {10/Latex, 11/Stealth}{
\node[left, font=\small] at (3.7, -.4 * \y) { \t[round] };
\draw[{\t[round]}-{\t[round]}] (4, -.4 * \y) -- ++(1, 0);
}
\node[font=\small] at (8.6, .5) {\textbf{Geometric Arrow(Open)}};
\foreach \y/\t in {
0/Circle, 1/Diamond, 2/Ellipse, 3/Kite, 4/Latex,
5/Rectangle, 6/Square, 7/Stealth, 8/Triangle, 9/Turned Square
}{
\node[left, font=\small] at (8.7, -.4 * \y) { \t[open] };
\draw[{\t[open]}-{\t[open]}] (9, -.4 * \y) -- ++(1, 0);
}
\foreach \y/\t in {10/Latex, 11/Stealth}{
\node[left, font=\small] at (8.7, -.4 * \y) { \t[round, open] };
\draw[{\t[round, open]}-{\t[round, open]}] (9, -.4 * \y) -- ++(1, 0);
}
\end{tikzpicture}
为了简便,可以使用< > | * o . 等简写箭头(简写表格待补充)。当然也可以指定多级箭头。例如
\begin{tikzpicture}[scale=2, ultra thick]
\begin{scope}[>=Latex]
\draw[>->] (0pt,3ex) -- (1cm,3ex);
\draw[|<->>|] (0pt,2ex) -- (1cm,2ex);
\end{scope}
\begin{scope}[>=Stealth]
\draw[>->] (0pt,1ex) -- (1cm,1ex);
\draw[|<<.<->|] (0pt,0ex) -- (1cm,0ex);
\end{scope}
\end{tikzpicture}
此外,箭头也可以设置宽度、拉伸等样式,其完整的功能过多,此处不赘述。