问题:

问题:

如果我尝试将两个装饰放在同一条路径上,均在位置 1 处,则只会显示第一个:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
 \begin{tikzpicture}
  \node (0)                     {};
  \node (1) [right       of=0]  {};
  \node (2) [below right of=1]  {};
  \path (0) edge[out=0, in=135, postaction={decorate,
   decoration={
    markings,
    mark=at position 1 with {\arrow[>=diamond, yellow] {>}; },
    mark=at position 1 with {\arrow[>=open diamond]    {>}; } } }] (2);
 \end{tikzpicture}
\end{document}

在此处输入图片描述

通过黑客攻击(修改其中一个位置使其非常接近,但不完全等于 1)...

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
 \begin{tikzpicture}
  \node (0)                     {};
  \node (1) [right       of=0]  {};
  \node (2) [below right of=1]  {};
  \path (0) edge[out=0, in=135, postaction={decorate,
   decoration={
    markings,
    mark=at position 0.999 with {\arrow[>=diamond, yellow] {>}; },
    mark=at position 1     with {\arrow[>=open diamond]    {>}; } } }] (2);
 \end{tikzpicture}
\end{document}

...我获得了第一张图像所期望的输出:

在此处输入图片描述

如果装饰位于同一点且不同于 1,我也会得到预期的结果:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
 \begin{tikzpicture}
  \node (0)                     {};
  \node (1) [right       of=0]  {};
  \node (2) [below right of=1]  {};
  \path (0) edge[out=0, in=135, postaction={decorate,
   decoration={
    markings,
    mark=at position 0.5 with {\arrow[>=diamond, yellow] {>}; },
    mark=at position 0.5 with {\arrow[>=open diamond]    {>}; } } }] (2);
 \end{tikzpicture}
\end{document}

在此处输入图片描述

问题:

为什么会发生这种情况?

答案1

更新

比解决方法更好的是,你可以同时使用

mark=at position 1 with {\arrow[>=diamond, yellow] {>};
                           \arrow[>=open diamond] {>};}

完整代码:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
 \begin{tikzpicture}
  \node (0)                     {};
  \node (1) [right       of=0]  {};
  \node (2) [below right of=1]  {};
  \path (0) edge[out=0, in=135, 
   postaction={decorate,
    decoration={  
    markings,     
    mark=at position 1 with {\arrow[>=diamond, yellow] {>};\arrow[>=open diamond] {>};},
    }}] (2);
 \end{tikzpicture}
\end{document} 

解决方法

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
 \begin{tikzpicture}
  \node (0)                     {};
  \node (1) [right       of=0]  {};
  \node (2) [below right of=1]  {};
  \draw[postaction={decorate,
   decoration={
    markings,
    mark=at position 1 with {\arrow[>=diamond, yellow] {>}; }}}] (0) to [out=0, in=135] (2); 
  \path[postaction={decorate,
   decoration={
    markings,
    mark=at position 1 with {\arrow[>=open diamond]    {>};}}}] (0) to [out=0, in=135] (2); 
 \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

我刚刚又遇到了这个问题,我在问题中提供的破解方法没有奏效。以下方法奏效了:

mark=at position 0.999 with {\arrow[>=diamond, yellow] {>};
                             \arrow[>=open diamond]    {>};}

或者

mark=at position 0.999 with {\arrow[>=diamond, yellow] {>};}
mark=at position 0.999 with {\arrow[>=open diamond]    {>};}

基本上,不要将它们中的任何一个设置为 1。这肯定是真正的错误所在。

相关内容