3

I'm like two superimposed two arrow heads in tikz, e.g. given the arrow tips Latex and Circle, have a way of getting a new arrow tip SuperposeLatexCircle such that \draw [-{SuperposeLatexCircle}] (A) -- (B) is equivalent to \draw [-{Latex}] (A) -- (B); \draw [-{Circle}] (A) -- (B).

I think this should be doable using sep, e.g. \draw [-{Latex[sep=-1pt]Circle}] (A) -- (B) with 1pt replaced by a better value. The relevant values should be:

I tried taking sep=-3.88pt -4.8 0.9 (the first two components are -0.88pt-3pt and -.3-4.5 respectively, and I did not know what to put for the third one so I put the average of 1 and .8. This does not work but is fairly close when replacing Circle by Diamond.

The problem with Circle is probably that its length is very different from the lengths of Latex, so we probably also need the default length of Circle:


Candidate methods before I had before thinking about sep:

Any of the following would help (in decreasing order of preference):

  • A way of combining arrows without needing to predeclare them, e.g. \draw [-{Superpose[first=Latex, second=Circle]}] (A) -- (B);

Edit: I'm stating to think that it is possible to do this with a negative sep, e.g. -{Latex[sep=-1pt]Circle}, but I'm not sure how to compute the correct sep automatically.

  • A way of declaring combinations without copying and pasting, e.g. using pgfarrowsdeclarecombine plus some shifting to cancel the movement between the two arrows, or something like
\pgfdeclarearrow{
  name=CombineLatexCircle,
  % ...
  drawing code={
    \pgf@ar@code@Latex
    \pgf@ar@code@Circle
  },
  % ...
}

(This seems hard to do for some components of the definition)

  • Some systematic way of copying and pasting that allows to combine two \pgfdeclarearrow declarations, e.g. "Concatenate the drawing codes, discard the defaults, change all names in setup and drawing code to avoid clashes, ..."
3
  • 1
    Interesting question. I can see this being useful. Please open a feature request at github.com/pgf-tikz/pgf/issues. Something like \draw[-{LaTeX,Circle}] should actually be possible to implement. Aug 8 at 10:35
  • Please post a compilable MWE that people can use as a starting point. Aug 8 at 10:58
  • 1
    [-Latex,postaction={draw,-Circle}]
    – Symbol 1
    Aug 9 at 4:38
2

Here's one way to do this. Define a style that places the circle tip at the end of the segment and call it with the Latex arrow.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.markings}

\tikzset{
    circarr/.style={
        decoration={
            markings,
            mark=at position 1 with {\arrow{Circle}}
        },
        postaction={decorate}
    }
}

\begin{document}

\begin{tikzpicture}
\draw [-{Latex}] (0,0) -- (1,0); \draw [-{Circle}] (0,0) -- (1,0);
\draw [-{Latex}, circarr] (0,.5) -- (1,.5);
\end{tikzpicture}

\end{document}

enter image description here

Alternatively, you could have circarr draw both arrowheads:

\tikzset{
    circarr/.style={
        decoration={
            markings,
            mark={at position 1 with {\arrow{Circle}}, at position 1 with {\arrow{Latex}}}
        },
        postaction={decorate}
    }
}

Which creates the same output as above using \draw [circarr] (0,.5) -- (1,.5);. You could make another style for the arrows at the beginning of the segment using position 0 and \arrowreversed instead of \arrow.

Here is a MWE with circarrb (beginning) and circarre (end) both implemented:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.markings}

\tikzset{
    circarre/.style={
        decoration={
            markings,
            mark={at position 1 with {\arrow{Circle}}, at position 1 with {\arrow{Latex}}}
        },
        postaction={decorate}
    },
    circarrb/.style={
        decoration={
            markings,
            mark={at position 0 with {\arrowreversed{Circle}}, at position 0 with {\arrowreversed{Latex}}}
        },
        postaction={decorate}
    }
}

\begin{document}

\begin{tikzpicture}
\draw [circarre] (0,0) -- (1,0);
\draw [circarrb] (0,.5) -- (1,.5);
\draw [circarrb,circarre] (0,1) -- (1,1);
\end{tikzpicture}

\end{document}

enter image description here

1

/tikz/tips (and /pgf/tips) is the option that controls whether arrows are drawn when the base path is a degenerated one or when the it is not drawn.

For tips=true, the arrow will be drawn whatsoever, even though the base path is not drawn. So I use it with postaction

\documentclass[border=9,tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
    \tikz{
        \draw[tips=true,
            postaction=-Latex,
            postaction=-Circle,
            postaction=-|,
        ]
            (0,0)--(1,0);
    }
\end{document}

1
  • But there is one caveat, though. Consider what the bending module would do: it shortens the path so arrows fit in. How much should it shorten in this case? 0 or the max of length?
    – Symbol 1
    Aug 9 at 5:32

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.