如果在 TikZ 中将 0.9999 替换为 1,箭头就会消失

如果在 TikZ 中将 0.9999 替换为 1,箭头就会消失

TikZ 代码的细微变化导致箭头消失。我想知道哪里出了问题。

考虑以下代码:

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}
    [myarrow/.style={
    decoration=
       {markings,mark=at position 0.9999 with {\arrow[line width=0.1mm, scale=2]{stealth'}}},
    postaction={decorate}
    }]
\node[circle,draw] (A) at (0,2) {A};
\node[circle,draw] (B) at (2,2) {B};
\node[circle,draw] (C) at (0,0) {C};
\node[circle,draw] (D) at (2,0) {D};
\node (E) at (1,1.5) {};
\draw[myarrow] (A) -- (B);
\draw[myarrow] (E) to [out=270,in=20] (C);
\draw[myarrow] (E) to [out=270,in=160] (D);
\end{tikzpicture}
\end{document}

使用 pdflatex 编译它会生成下图并且不会出现错误:

在此处输入图片描述

但是,如果将代码中第 7 行的数字 0.9999 替换为 1,则

B 处的箭头保留,但 C 和 D 处的箭头消失(没有错误消息)。

有人可以帮忙吗?

答案1

将其作为答案提交可能有点冒险,因为这只是推论,但根据我的经验,decorations在沿弯曲路径放置标记时,该库非常不稳定。实际上,如果您进入手册阅读库的实现文档,它会告诉您它像自动机一样沿着路径“爬行”,因此它只将装饰应用于绘制的离散点,而不是您在代码中给出的抽象理想曲线。除了了解放置错误的标记可能由于某种此类错误而放置在小于零或大于 1 的有效位置,并相应地调整实际位置值以希望将它们带回范围内之外,实际上没有其他补救措施。

相关内容