In an answer on this site is proposed a method to draw arrows on paths. For example, using the style [arrow inside={pos=0.2}]
will put an arrow at position 0.2
on the path :
\begin{tikzpicture}
\tikzset{
set arrow inside/.code={\pgfqkeys{/tikz/arrow inside}{#1}},
set arrow inside={pos/.initial=.5, end/.initial=>},
arrow inside/.style={
set arrow inside={#1},
postaction={
decorate,
decoration={
markings,
mark=at position \pgfkeysvalueof{/tikz/arrow inside/pos} with \arrow{\pgfkeysvalueof{/tikz/arrow inside/end}}
}
}
},
}
\draw[arrow inside={pos=0.2}] (0,0) -- (5cm,5cm);
\end{tikzpicture}
Now, I would like to do something like
\draw[arrow inside={pos=0.2}, arrow inside={pos=0.8}] (0,0) -- (5cm,5cm);
and end up with two arrows, one at position 0.2 and the other at position 0.8. This does not work, because the second call to set arrow inside
modifies the value of the key /tikz/arrow inside/pos
and hence the style (only the second arrow is drawn). I tried to play with expansion rules, but I fail to wrap my mind around these things, so I hope perhaps somebody else will manage to do so (or perhaps the problem is somewhere else, and then I hope somebody will point out where !).
For the record, the original answer also provides another way to circumvent this problem by modifying the syntax a little, and that solution may be useful in practice. (However, I for one am interested in a solution to the evaluation order problem.) Thanks in advance !