16

Is it possible to get TikZ-arrows to draw double-headed arrows?

What I'm looking for is a way to achieve

\draw[-triangle 90 triangle 90] (A) -- (B);

and the open triangle equivalent, in the way TikZ would normally read

\draw[->>] (A) -- (B);
2
  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format.
    – bersanri
    Commented Jun 24, 2013 at 13:25
  • You can also define meta arrow heads as described in the manual. They are relatively easier to construct if compared to arrow heads.
    – percusse
    Commented Jun 24, 2013 at 13:46

4 Answers 4

14

See the Section 74 (also 23) of PGF documentation (mine is version 2.10) to obtain a lot of arrow tips.

Just put on preamble

\usetikzlibrary{arrows}
\pgfarrowsdeclarecombine{twotriang}{twotriang}%
{triangle 90}{triangle 90}{triangle 90}{triangle 90}

and then you can use \draw[twotriang-twotriang] (0,0) -- (2,0);

Here is the output.

enter image description here

Here is a part of the documentation

enter image description here

1
  • Great, thanks! This has worked very well. I'd already looked at all the documentation you suggested, but thanks for posting it anyway.
    – DavidHume
    Commented Jun 24, 2013 at 13:59
12

A possibility is to use postactions and shorten

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}[font=\sffamily\small]
\draw[-triangle 90, postaction={draw, shorten >=4pt, -triangle 90}] (0,0) -- (1,0);
\draw[-triangle 90, postaction={draw, shorten >=-4pt, -triangle 90}] (0,-.5) -- (1,-.5);
\end{tikzpicture}

\end{document}

enter image description here

In the first case the second head is added before the original one, in the second is added after. This is controlled by the positive or negative shorten value.

If you want to typle less you can do:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\tikzset{dblb/.style={postaction={draw,shorten >=4pt, -triangle 90}}}
\tikzset{dbla/.style={postaction={draw,shorten >=-4pt, -triangle 90}}}
\begin{tikzpicture}[font=\sffamily\small] 
\draw[-triangle 90,dblb] (0,0) -- (1,0);
\draw[-triangle 90,dbla] (0,-.5) -- (1,-.5);
\end{tikzpicture}

\end{document}

same result.

2
  • -1. It's misleading.
    – Leo Liu
    Commented Jun 24, 2013 at 13:59
  • 3
    @LeoLiu I prefer this way because it's actually more powerful than other methods, you can have like five heads, placed wherever you want and you could also have heads with different shapes.
    – d-cmst
    Commented Jun 24, 2013 at 14:17
11

It is easy to use ->> if we set >=triangle 90 first.

An example:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\tikz \draw[>=triangle 90, ->>]
  (0,0) -- (2,0);

\end{document}

enter image description here

3
  • +1. I didn't know that it would be possible to do so simple.
    – Sigur
    Commented Jun 24, 2013 at 13:58
  • I can't get seem to get the tikz-cd package for some reason. Thanks anyway.
    – DavidHume
    Commented Jun 24, 2013 at 14:00
  • @DavidHume: No, tikz-cd is not needed. I misunderstood your question. Now see my update.
    – Leo Liu
    Commented Jun 24, 2013 at 14:01
7

With PSTricks. Just for fun!

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}(2,2)
    \psline{->>}(1,1)
\end{pspicture}
\end{document}

enter image description here

The look-up table is given as follows.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .