我想在两点之间画一个大箭头。我找到了一个有用的类似答案这里。该答案适用于链式连接,并且工作正常。但我只是复制它并将其应用于draw
命令,但没有任何效果:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows, calc, chains}
\tikzset{
myarr node/.style={
shape=single arrow, draw=black, minimum width=20mm, anchor=tail,
shape border uses incircle, single arrow head extend=+1pt,
inner sep=+0pt, outer sep=+0pt},
%
myarr with anchors/.style 2 args={
to path={
let \p0=($(\tikztotarget.#2)-(\tikztostart.#1)$) in
node[myarr node,
minimum height={veclen(\x0,\y0)},
shape border rotate={atan2(\y0,\x0)}] at (\tikztostart.#1) {}}
},
%
myarr/.default={}{},
myarr/.style 2 args={
to path={
\expanded{
(\tikztostart#1) edge[path only, overlay, line to]
coordinate[at start] (@start)
coordinate[at end] (@end) (\tikztotarget#2)}
let \p0=($(@end)-(@start)$) in
node[myarr node,
minimum height={veclen(\x0,\y0)},
shape border rotate={atan2(\y0,\x0)}] at (@start) {}}
},
}
\begin{document}
\begin{tikzpicture}
\draw[myarr] (0,0) -- (3,1);
\end{tikzpicture}
\end{document}
答案1
答案2
这是你需要的吗?代码来自PGF手册。
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{shapes.arrows}
\begin{document}
\begin{tikzpicture}[every node/.style={single arrow, draw},
rotate border/.style={shape border uses incircle, shape border rotate=#1}]
\node {right};
\node at (2,0) [shape border rotate=90]{up};
\node at (1,1) [rotate border=37, inner sep=0pt]{$37^\circ$};
\end{tikzpicture}
\end{document}