5

I am trying to define a TikZ arrow tip thatis a doubled version of the “open triangle” tip. I attempted to do it using \pgfarrowsdeclarecombine, as described in this answer, but it doesn’t come out right: the shaft is drawn over the first of the two tips. (Other than that, it’s exactly what I want.)

incorrect double-headed arrow

Other approaches to doubling the arrow tip — like in the following MWE — give the same result. How can I avoid this, and get a doubled version of the “open triangle” tip?

\documentclass{standalone}
\usepackage{tikz} \usetikzlibrary{arrows}
\begin{document}

\begin{tikzpicture}
  \node (A) at (0,0) {$A$}; \node (B) at (2,0) {$B$}; 
  \draw[>=open triangle 60,->>] (A) to (B);
\end{tikzpicture}

\end{document}

I’ve looked at the approaches in this answer, but I can’t see how to apply them in declaring a new tip.

9

Using Jake's accepted answer at How to draw a double continous arrowhead [tikz], and marsupilam's dot trick, you can define your own arrowhead style.

\documentclass{standalone}
\usepackage{tikz} 
\usetikzlibrary{arrows}
\pgfarrowsdeclaredouble[0pt]{openopen}{openopen}{open triangle 60}{.open triangle 60}
\begin{document}

\begin{tikzpicture}
  \node (A) at (0,0) {$A$}; \node (B) at (2,0) {$B$}; 
  \draw[-openopen] (A) to (B);
\end{tikzpicture}

\end{document}

enter image description here

  • Steven, can you please satisfy my curiosity about how that . works? – Enrico Maria De Angelis Jul 6 '17 at 19:12
  • 1
    @EnricoMariaDeAngelis To be honest, I learned it from marsupilam's answer. However, prior to that, I suspected there was such a mechanism, though I was trying commas, braces, etc. If I learn more, I will pass it on. – Steven B. Segletes Jul 6 '17 at 19:19
  • 2
    @EnricoMariaDeAngelis, As I understand there is one main arrow tip where the line ends, normally the outer one (right most in your case). The others are added inside of this. Most the arrow tip is filled and there is no difference, but e.g. open triangular and the default > will show the line. But you can also add arrow tips on the outside of the line end, by specifying the stop with .. You can see the difference with \draw[-.>>](0,0)--+(.9,0); \draw[->.>](1,0)--+(.9,0); \draw[->>](2,0)--+(.9,0);. – StefanH Jul 6 '17 at 20:42
7

If I understand correctly, you are one dot . away from what you want (that is, use ->.>).

The output

enter image description here

The code

\documentclass{standalone}
\usepackage{tikz} \usetikzlibrary{arrows}
\begin{document}

\begin{tikzpicture}
  \node (A) at (0,0) {$A$}; \node (B) at (2,0) {$B$}; 
  \draw[>=open triangle 60,->.>] (A) to (B);
\end{tikzpicture}

\end{document}
  • 1
    Could you please explain how . works? In addition, is it possible to make this solution work also for the \pgfarrowsdeclarecombine command? – Enrico Maria De Angelis Jul 6 '17 at 18:19
  • @EnricoMariaDeAngelis Can you please post a minimal working example for this other question ? – marsupilam Jul 6 '17 at 18:22
  • The OP posted the question of how to accomplish the task in two possible ways: using \pgfarrowsdeclarecombine or doing it manually. For the latter case he/she posted a MWE, for the former he/she posted a link. Both cases are part of the same question. So I don't think one separate question is required. – Enrico Maria De Angelis Jul 6 '17 at 18:28
  • @EnricoMariaDeAngelis Sorry for confusing you with the OP. Does the answer by Steven answer your question ? Otherwise, I am afraid I don't really know about this other point, and don't have time to investigate... – marsupilam Jul 6 '17 at 18:32
  • Btw, my first comment consists of two questions. Maybe we disagree about the lawfulness of the latter, but the former is a simple request of helping us all understand how your solution works. And I think it's important that you give us this information. – Enrico Maria De Angelis Jul 6 '17 at 18:34
4

If you are able to use the arrows.meta library you can declare an arrow using the .tip handler:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\tikz[>>/.tip={.Triangle[open]Triangle[open]}]
  \draw [->>] (0,0) -- (1,0);
\end{document}

(Note that this is redefining an existing arrow head >>, which may or may not be desirable)

enter image description here

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.