如何调整箭头节点的箭头大小?

如何调整箭头节点的箭头大小?

我正在尝试使用TikZ 库single arrow中的节点shapes.arrows。问题在于使用参数正确调整箭头尖端跨度single arrow head extend。MWE:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\begin{document}
\begin{tikzpicture}
    \node [single arrow,draw,inner sep=0,minimum width=2cm,minimum height=2cm,single arrow head extend=0.2cm] {};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

minimum width与 的结合single arrow head extend似乎有问题。inner sep改为使用 来定义内部宽度:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\begin{document}
\begin{tikzpicture}
    \node [single arrow,draw,inner sep=1cm,minimum height=4cm, single arrow head extend=0.8cm,anchor=west] (a) {};
    \draw[|<->|, purple, ultra thin] (0,0) -- (4,0) node [midway, above, sloped] {\tiny 4 cm};
    \draw[|<->|, red, ultra thin] (0,0) -- (0,1) node [midway, above, sloped] {\tiny 1 cm};
    \draw[|<->|, blue, ultra thin] (a.before head) -- ++(0,0.8) node [midway, above, sloped] {\tiny 0.8 cm};
\end{tikzpicture}
\end{document}

箭头大小

更新:箭头的最终尺寸可能仍然比预期的要大,这是由有限的线宽和默认miter线连接选项造成的,如下图所示。

\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\begin{document}
\begin{tikzpicture}
    \tikzset{samplearrow/.style={single arrow,draw,inner sep=1cm,minimum height=4cm, single arrow head extend=0.8cm,anchor=west,line width=5mm}}
    \node [samplearrow, orange!50] (a) {};
    \node [samplearrow, gray,line join=round] (b) {};
    \draw[|<->|, purple, ultra thin] (0.5,0) -- ++(4,0) node [midway, above, sloped] {\tiny 4 cm};
    \draw[|<->|, red, ultra thin] (0,0) -- (0,1) node [midway, above, sloped] {\tiny 1 cm};
    \draw[|<->|, blue, ultra thin] (a.before head) -- ++(0,0.8) node [midway, above, sloped] {\tiny 0.8 cm};
    \draw[|<->|, ultra thin] (0,1) -- ++(0,0.5) node [midway, above, sloped] {\tiny 5 mm};
    \draw[|<->|, ultra thin] (0,0) -- (0.5,0) node [pos=0, left, sloped] {\tiny 5 mm};
    \draw[<-,orange] (a.before tip) -- ++(-0.2,0) node[left] {\tiny miter};
\end{tikzpicture}
\end{document}

粗箭头尺寸

inner sep这可以通过从和中减去线宽minimum height(例如inner sep=1cm-0.4pt对于使用线的默认情况thin)并设置line joinround(如灰色所示)或来解决bevel

相关内容