如何更改tikz中的箭头提示

时间:2015-06-13 19:22:28

标签: tikz

是否有一种简单的方法可以使用以下内容增加箭头的大小:

\tikzset{myptr/.style=->, ????}

没有从头开始设计新的箭头样式?

1 个答案:

答案 0 :(得分:19)

一个解决方案,非常快,只需缩放箭头,如下所示为%2

\documentclass[multi=false,tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,decorations.markings}

\begin{document}

\begin{tikzpicture}
%1
\draw [->,>=stealth] (0,.5) -- (2,.5);
%2
\draw [decoration={markings,mark=at position 1 with
    {\arrow[scale=3,>=stealth]{>}}},postaction={decorate}] (0,0) -- (2,0);
\end{tikzpicture}

\end{document}

这会产生:

enter image description here

(抱歉过度放大)。

this questionthis answer, that I used as a source的答案中包含更多内容。

<强>附录

\tikzset方法。这段代码:

\documentclass[multi=false,tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,decorations.markings}

\begin{document}

\begin{tikzpicture}
\tikzset{myptr/.style={decoration={markings,mark=at position 1 with %
    {\arrow[scale=3,>=stealth]{>}}},postaction={decorate}}}
%1
\draw [->,>=stealth] (0,.5) -- (2,.5);
%2
\draw [myptr] (0,0) -- (2,0);
\end{tikzpicture}

\end{document}

产生与上面相同的输出(来源:PGF Manual,第2.8节)。

显然,您可以使用-Latex代替stealth