![tkz-euclide 文档中箭头示例出现错误](https://linux22.com/image/448813/tkz-euclide%20%E6%96%87%E6%A1%A3%E4%B8%AD%E7%AE%AD%E5%A4%B4%E7%A4%BA%E4%BE%8B%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AF.png)
我尝试实现tkz-euclide
手册第 192 页上的一个示例,该示例应该在圆圈上绘制几个箭头。但是我得到了一个错误。
\documentclass{standalone}
\usepackage{tkz-euclide}
\tikzset{tkz arrows/.style=
{postaction={on each path={tkz arrow={Latex[scale=2,color=black]}}}}}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/A,3/0/B}
\tkzDrawCircle[tkz arrows](A,B)
\end{tikzpicture}
\end{document}
错误是
Package pgfkeys Error: I do not know the key '/tikz/on each path', to which you passed 'tkz arrow={Latex[scale=2,color=black]}', and I am going to ignore it. Perhaps you misspelled it.
答案1
如果你有旧版本,你可以在文件中添加一些样式
\makeatletter
%<---------------- arrow --------------------------------------–>
% Syntax:
%
% - tkz arrow=<arrow end tip>`
% - tkz arrow=<arrow end tip> at <pos> (<pos> = .5 by default)
% - tkz arrow={<arrow end tip>[<arrow options>] at <pos>}
%
%
% Example usages:
%
% \draw[tkz arrow=Stealth] (A) -- (B);
% \draw[tkz arrow={To[scale=3] at .3}] (A)-- (B);
% \draw[tkz arrow={Latex[scale=5,blue] at .8}] (A)-- (B);
\tikzset{
tkz arrow/.default=Latex,
tkz arrow/.code=%
{%
\pgfutil@in@{ at }{#1}%
\ifpgfutil@in@
\mytikz@parsearrow#1\mytikz@stop
\else
\mytikz@parsearrow#1 at .5\mytikz@stop
\fi
}
}
\def\mytikz@parsearrow#1 at #2\mytikz@stop{%
\pgfutil@in@{[}{#1}%
\ifpgfutil@in@
\mytikz@parsearrow@opt{#2}#1\mytikz@stop
\else
\mytikz@parsearrow@opt{#2}#1[]\mytikz@stop
\fi
}
% #1 = pos, #2 = arrow end tip, #3 = arrow options
\def\mytikz@parsearrow@opt#1#2[#3]\mytikz@stop{%
\pgfkeysalso{decoration={
markings,
mark=at position #1 with {\arrow[#3]{#2}}
},
postaction={decorate}
}%
}
%<------------------------------------------------------------->
\tikzset{
on each path/.style={
decorate,
decoration={
show path construction,
moveto code={},
lineto code={
\path [#1]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
},
curveto code={
\path [#1] (\tikzinputsegmentfirst)
.. controls
(\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)
..
(\tikzinputsegmentlast);
},
closepath code={
\path [#1]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
}}}}
%<------------------ arrows --------------------------------------–>
\tikzset{tkz arrows/.style=%
{postaction={on each path={tkz arrow={Latex[scale=2,color=black]}}}}}
\makeatother