如何在tikz中更改箭头提示

问题描述 投票:18回答:1

是否有一种简单的方法可以使用类似的方法来增加箭头的大小:

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

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

latex tikz
1个回答
24
投票

一种解决问题的方法,非常快速,只需缩放箭头,以下为数字%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}

这产生了:

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS8wajN0Qi5wbmcifQ==” alt =“在此处输入图像描述”>

(抱歉,变焦过度。

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

© www.soinside.com 2019 - 2024. All rights reserved.