0

I would like to draw a double arrow like below: enter image description here

How should I do it with tikz?

I try below code but it's not as expected:

\documentclass[convert]{standalone}

\usepackage{tikz}
\usetikzlibrary{fit,shapes.arrows}
\definecolor{fillcolor}{HTML}{DDE776}
\begin{document}
\begin{tikzpicture}
    \tikzset{arr/.style={single arrow, draw=black, very thick, fill=fillcolor,
    minimum width = 10pt, single arrow head extend=30pt,
    inner xsep=0pt,
    }}
    \coordinate (a) at (0,0);
    \coordinate (b) at (2,2);
    \node[arr,fit=(a) (b)] {}; 
\end{tikzpicture}
\end{document}

Output: enter image description here

2

2 Answers 2

1

This new answer is inspired from one answer of Jasper Habicht to a different question. You enter in the first two lines of code the the four coordinates of point A and B. The code make all calculus for the slope of double arrow from point A to point B.

The code:

\documentclass[border=10mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows, calc}

\tikzset{
    MyLongArrow/.style args={#1 -- #2}{
        insert path={let \p1=($(#1)-(#2)$) in}, 
        single arrow, draw=black, minimum width=15mm, minimum height={veclen(\x1,\y1)}, inner sep=0mm, single arrow head extend=1mm, double arrow head extend=1mm
    }
}

\begin{document}
    \begin{tikzpicture}
        \newcommand{\xs}{-1} % x coord of point A
        \newcommand{\ys}{-2} % y coord  coordof point A
        \newcommand{\xe}{10} % x coord of point B
        \newcommand{\ye}{3} % y of point B
        \newcommand{\ang}{atan((\ye-\ys)/(\xe-\xs))} % slope of segment AB
        \coordinate (a) at (\xs,\ys); % point A 
        \coordinate (b) at (\xe,\ye); % point B
        \draw[gray!20] (a) grid (b);
        \path (a) -- (b) node[midway, MyLongArrow={a -- b},fill=cyan!20,double arrow,rotate=\ang] {From point A to point B};    
    \end{tikzpicture}
\end{document}

The output for points A(-1,-2) and B(10,3):

enter image description here

The grid is only for control, you can comment the relative line. If you dont want the text inside the double arrow change the last line of the code this way:

\path (a) -- (b) node[midway, MyLongArrow={a -- b},fill=cyan!20,double arrow,rotate=\ang] {};
1

Like this:

enter image description here

Code:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
%\usetikzlibrary{fit,shapes.arrows}
\definecolor{fillcolor}{HTML}{DDE776}

\begin{document}
    \begin{tikzpicture}
        \fill[fill=fillcolor,rotate=45,yscale=.5,xscale=.5] (-3,-3)--(-5,0)--(-3,3)--(-3,1)--(3,1)--(3,3)--(5,0)--(3,-3)--(3,-1)--(-3,-1)--cycle;
        \node[rotate=45,cyan] at (0,0) {\Huge freccia}; 
    \end{tikzpicture}   
\end{document}

You can make a newcommand to define a generic double arrow (with the same base points) and add a parameter for: color, rotation angle, xscale, yscale, text inside, ...

EDIT: For example you can have this double arrow

enter image description here

with some minimal changes in the code proposed before:

\begin{tikzpicture}
        \fill[fill=fillcolor,rotate=120,yscale=.5] (-3,-3)--(-5,0)--(-3,3)--(-3,1)--(3,1)--(3,3)--(5,0)--(3,-3)--(3,-1)--(-3,-1)--cycle;
        \node[rotate=120,red] at (0,0) {\Huge freccia}; 
    \end{tikzpicture}

or this one

enter image description here

with this code:

\begin{tikzpicture}
        \fill[draw,line width=2pt,fill=fillcolor,rotate=-30,yscale=.5] (-3,-3)--(-5,0)--(-3,3)--(-3,1)--(3,1)--(3,3)--(5,0)--(3,-3)--(3,-1)--(-3,-1)--cycle;
        \node[rotate=-30,red] at (0,0) {\Huge freccia}; 
    \end{tikzpicture}
2
  • Thanks, it's good but how to draw the double arrow from point A to point B? Just like draw a arrow between two point?
    – lucky1928
    May 27 at 14:26
  • Sorry, at moment I can't answer to your question. 2 days ago

You must log in to answer this question.

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