10

A slight change in TikZ code makes arrows disappear. I want to know what went wrong.

Consider the following code:

\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}

Compiling it with pdflatex generates the following figure without errors:

enter image description here

But, if the number 0.9999 in the 7th line in the code is replaced with 1, then

the arrow at B remains, but the arrows at C and D disappear (without error messages).

Can anyone help, please?

3

It may be going out on a limb to submit this as an answer since it's just inference, but in my experience, the decorations library is quite unstable when placing markings along curved paths. Actually, if you go into the manual to read the documentation of the library's implementation, it will tell you that it proceeds like an automaton "crawling" along the path, so it applies decorations only to the discrete points that are plotted rather than the abstract ideal curve you give in the code. There's really no recourse except to understand that a marking that's placed wildly wrong is probably being placed with an effective position either less than zero or greater than 1 due to some error of this nature, and to tweak the actual position values accordingly to hopefully bring them back in range.

| improve this answer | |
  • This may be another aspect of TikZ that we have to live with. Thanks for your comment. (^.^)/ – T_T Jun 6 '13 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.