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.

3 Answers3

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? – Enlico Jul 06 '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 06 '17 at 19:19
  • 3
    @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 06 '17 at 20:42
8

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}
marsupilam
  • 6,383
  • 1
    Could you please explain how . works? In addition, is it possible to make this solution work also for the \pgfarrowsdeclarecombine command? – Enlico Jul 06 '17 at 18:19
  • @EnricoMariaDeAngelis Can you please post a minimal working example for this other question ? – marsupilam Jul 06 '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. – Enlico Jul 06 '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 06 '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. – Enlico Jul 06 '17 at 18:34
  • Actually no, I still can't see how this . works. And I'm really curious about it! – Enlico Jul 06 '17 at 18:36
  • @EnricoMariaDeAngelis In fact, I don't really know how this works, I just looked p204 of the TikZ manual, and found an example that matched the requirement ;). I think Steven's answer shows how to define the arrowhead using a \pgf command. – marsupilam Jul 06 '17 at 18:44
  • @marsupilam: as Enrico said, I was looking for a way to define the doubled triangle as a new arrow tip — sorry if the question was unclear — so I’ve accepted the other answer. But thank you very much for finding one of the key components that went into that answer! – Peter LeFanu Lumsdaine Jul 06 '17 at 22:43
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

Mark Wibrow
  • 70,437