图片外面多余的箭头是从哪里来的?用于pdflatex --shell-escape
排版示例代码。
\documentclass{article}
\usepackage{tkz-fct}
\tikzset{
arr/.style={
postaction=decorate,
decoration={
markings,
mark=at position 0.25 with {\arrow[thick,line width=0.5mm]{latex}},
mark=at position 0.5 with {\arrow[thick,line width=0.5mm]{latex}},
mark=at position 0.75 with {\arrow[thick,line width=0.5mm]{latex}}
}
}
}
\begin{document}
\fbox{%
\begin{tikzpicture}
\tkzFctPolar[domain=pi:2*pi,arr]{3}
\end{tikzpicture}%
}
\end{document}
答案1
可选参数\tkzFctPolar
被使用了两次,就像\tikzset{#1}\draw[#1]...;
,因此最终累积的标记位置是0.25, 0.5, 0.75, 0.25, 0.5, 0.75
。这打破了tikz
这些位置必须是 的要求按照递增顺序,请参阅pgfmanual
v3.1.8b,第 50.6 节,
(关键文档
/pgf/decoration/mark=at position <pos> with <code>
)可以
mark
多次给出该选项,这样会应用多个标记。但是,在这种情况下,路径上的位置必须按递增顺序排列。也就是说,不允许(并且会导致混乱)路径上较早的标记跟在路径上较晚的标记后面。
解决方法:添加reset marks
样式选项的定义arr
。
\documentclass{article}
\usepackage{tkz-fct}
\tikzset{
arr/.style={
postaction=decorate,
decoration={
markings,
reset marks, % <<< added here
mark=at position 0.25 with {\arrow[thick,line width=0.5mm]{latex}},
mark=at position 0.5 with {\arrow[thick,line width=0.5mm]{latex}},
mark=at position 0.75 with {\arrow[thick,line width=0.5mm]{latex}}
}
}
}
\begin{document}
\fbox{%
\begin{tikzpicture}
\tkzFctPolar[domain=pi:2*pi,arr]{3}
\end{tikzpicture}%
}
\end{document}
说明该问题的一个tikz
例子。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{
my decoration/.style={
postaction={decorate},
decoration={
markings,
mark=at position .5 with {\fill[blue] circle (2pt);},
mark=at position .75 with {\fill[blue] circle (2pt);},
% this third mark breaks the increacing order requirements, hence will
% appear at a wrong position
mark=at position .6 with {\fill[red] (-2pt,-2pt) rectangle (2pt,2pt);}
}
}
}
\begin{document}
\tikz
\draw[my decoration] circle (1cm);
\end{document}