我尝试使用˙\pgflinewidth`来定义箭头的大小:
\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, calc}
\begin{document}
\begin{tikzpicture}
\draw (0cm,0cm) grid ($(2cm,3cm)-(\pgflinewidth,\pgflinewidth)$); % this works
\draw[very thick, -{Triangle[length=3\pgflinewidth]}] (0,0) -- (2,3); % this doesn't work!
\end{tikzpicture}
\end{document}
错误:! Missing \endcsname inserted.
。
我的尝试有什么问题?
答案1
尝试:
Triangle[length=3*\the\pgflinewidth]
平均能量损失
\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, calc}
\begin{document}
\begin{tikzpicture}
\draw (0cm,0cm) grid ($(2cm,3cm)-(\pgflinewidth,\pgflinewidth)$); % this works
\draw[very thick, -{Triangle[length=3*\the\pgflinewidth]}] (0,0) -- (2,3); % this doesn't work!
\end{tikzpicture}
\end{document}
编辑
使用以下行也可以获得相同的输出:
\draw[very thick, -{Triangle[length=0pt 3]}] (0,0) -- (2,3);