4

Why are the arrowheads placed as they are in the figure below? I.e. why are they not placed at the exact beginning and end of the path?

enter image description here

Code used:

\documentclass[tikz,border=2pt]{standalone}

\usetikzlibrary{decorations.markings,arrows.meta}

\begin{document}

\begin{tikzpicture}
    \draw[double distance=15, thick,
            postaction={decorate, decoration={markings, mark=at position 0 with {\arrow{Straight Barb[reversed,length=0pt 0.7]}}}},
            postaction={decorate, decoration={markings, mark=at position 1 with {\arrow{Straight Barb[length=2pt 0.7]}}}}
        ] (0,2) -- node {FOO}(5,2);
\end{tikzpicture}

\end{document}

For reference, how I want it to be:

enter image description here

1
  • double distance causes the problem. Even with a single line, results are not the expected ones, are they? Not exactly the same, but did you look the double arrowshape? – Ignasi Nov 4 '15 at 14:34
4

Placement of arrows with double lines is difficult (read not possible). Here you have to do some manual adjustments. Here is the first attempt using xshift:

\documentclass[tikz,border=2pt]{standalone}

\usetikzlibrary{decorations.markings,arrows.meta}

\begin{document}

\begin{tikzpicture}
    \draw[double distance=15, thick,
            postaction={decorate, decoration={markings, mark=at position 0 with {\arrow[xshift=5mm]{Straight Barb[reversed,length=2pt 0.7]}}}},
            postaction={decorate, decoration={markings, mark=at position 1 with {\arrow[xshift=7mm]{Straight Barb[length=2pt 0.7]}}}}
        ] (0,2) -- node {FOO}(5,2);
\end{tikzpicture}

\end{document}

enter image description here

And here is the second acrobatics:

\documentclass[tikz,border=2pt]{standalone}

\usetikzlibrary{decorations.markings,arrows.meta}

\begin{document}

\begin{tikzpicture}
    \draw[double distance=15](8pt,2) -- (5cm-8pt,2);   %% this length needs to be adjusted.
    \draw[double distance=15,
            {Straight Barb[black,length=2pt 0.7 0.2].}-{.Straight Barb[length=2pt 0.7 0.2]}
        ] (0,2) -- node {FOO}(5,2);

\end{tikzpicture}

\end{document}

enter image description here

So depending upon what do you want, you may also be interested in the double arrow shape as commented by Ignasi.

\documentclass[tikz,border=2pt]{standalone}

\usetikzlibrary{shapes.arrows}

\begin{document}

\begin{tikzpicture}
    \node [double arrow,draw, text width=5cm,align=center] {FOO};
\end{tikzpicture}

\end{document}

enter image description here

11
  • 1
    why is placement difficult? – percusse Nov 4 '15 at 14:50
  • @percusse Not difficult? I took it from the manual, it says so. :) – user11232 Nov 4 '15 at 14:55
  • It says On double lines, the arrow tip will not look correct. Not difficult or else. – percusse Nov 4 '15 at 14:55
  • 1
    @percusse: I take it as difficult in the sense we have to do extra work. Any thing that requires extra work is difficult in my dictionary as I am lazy :P – user11232 Nov 4 '15 at 14:59
  • This is not a double line arrow. It is a decoration. – percusse Nov 4 '15 at 15:00

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.