Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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);
share|improve this question
    
Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. –  bersanri Jun 24 '13 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 Jun 24 '13 at 13:46
add comment

4 Answers 4

up vote 6 down vote accepted

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

share|improve this answer
    
Great, thanks! This has worked very well. I'd already looked at all the documentation you suggested, but thanks for posting it anyway. –  DavidHume Jun 24 '13 at 13:59
add comment

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.

share|improve this answer
    
-1. It's misleading. –  Leo Liu Jun 24 '13 at 13:59
2  
@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. –  dcmst Jun 24 '13 at 14:17
add comment

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

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

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.