# Superimposed arrows: how to differentiate them using “twin” tails?

Two vectors have the same direction and their arrows remain undifferentiated. I want to make them appear as "siamese twins", one half arrow to the left and the another half to the right. What I mean can be better explained in the upper left corner of the following image: (one arrow is red and the another is black).

In the Manual "TikZ and pgf" from Till Tantau, I didn't find these style. Actually, when I tried to use [o-stealth] I got the following:

I do not know the key 'o'.

My code is a mess, but super simple since I'm a newbie in Tikz. Here goes a part of it:

    \documentclass[tikz]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}\begin{document}
\usetikzlibrary{calc,patterns,angles,quotes}
\begin{tikzpicture}
\pgfmathsetmacro{\Gvec}{1}
\pgfmathsetmacro{\midAngle}{20}
\pgfmathsetmacro{\Gcosmid}{\Gvec*cos(\midAngle)}
\coordinate (center) at (0,0);
\draw [thin, gray] (center) -- ++(270-\midAngle:2) coordinate (left);
\draw [thick, -stealth] (left)-- ++(90-\midAngle:\Gcosmid + 0.3) coordinate (Tmid);
\draw [thin] (left) -- ++(270-\midAngle:-\Gcosmid) coordinate (gcosmid);
\draw [->, red] (gcosmid) -- (Tmid) node [left] {\footnotesize{$a_{cp}$}};
\end{tikzpicture}


I suppose the "siamese arrow" would be I nice way to handle the problem. But I do accept other alternatives.

Edit: The siamese arrows relies mainly in the color differentiation. In a later moment I bet on a good shape's combination (superimposition of -stealth and -angle 90 styles, when vectors have the same nature, ex: mg and a_r).

• Welcome! Your code does not compile because there are undefined macros like \Gvec. Circle type arrow heads can be found in the arrows and, in particular, arrows.meta libraries. That is, \documentclass[tikz]{standalone} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture} \draw [o-stealth] (0,0) -- (1,1); \end{tikzpicture} \end{document} works, but you want to use Circle[open] from arrows.meta. – user194703 Apr 24 at 22:36
• @Schrödinger'scat Thanks! I forgot the \pgfmathsetmacro{\Gvec}{1} and, indeed, the particularity with the library helped me with the the multiple arrow types. – arantxa Apr 26 at 2:29

Welcome! Here is a "Siamese Stealth" arrow tip. I wasn't sure about the shape, so I used Stealth as the base. You can copy the codes for other heads from pgflibraryarrows.meta.code.tex, if needed. In order to make this work, one needs to declare a new arrow parameter, second color, and split the paths into two.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta}
\makeatletter
\pgfkeys{/pgf/arrow keys/second color/.code=%
\pgfdeclarearrow{
name = Siamese Stealth,
defaults = {
length  = +3pt 4.5 .8,
width'  = +0pt .75,
inset'  = +0pt 0.325,
line width = +0pt 0.5 0.5,
second color=red
},
setup code = {
% Cap the line width at 1/4th distance from inset to tip
\pgf@x\pgfarrowlength
\pgf@x.25\pgf@x
\ifdim\pgf@x<\pgfarrowlinewidth
\pgfarrowlinewidth\pgf@x
\fi
% Compute front miter length:
\pgfmathdivide@{\pgf@sys@tonumber\pgfarrowlength}{\pgf@sys@tonumber\pgfarrowwidth}%
\let\pgf@temp@quot\pgfmathresult%
\pgf@x\pgfmathresult pt%
\pgf@x\pgfmathresult\pgf@x%
\pgf@x4\pgf@x%
\pgfmathsqrt@{\pgf@sys@tonumber\pgf@x}%
\pgf@xc\pgfmathresult\pgfarrowlinewidth% xc is front miter
\pgf@xc.5\pgf@xc
\pgf@xa\pgf@temp@quot\pgfarrowlinewidth% xa is extra harpoon miter
% Compute back miter length:
\pgf@ya.5\pgfarrowwidth%
\csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowlength}{\pgfmath@tonumber\pgf@ya}%
\pgf@yb\pgfmathresult pt%
\csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowinset}{\pgfmath@tonumber\pgf@ya}%
\pgf@ya\pgfmathresult pt%
\pgf@yb.5\pgf@yb% half angle in yb
\pgfmathtan@{\pgf@sys@tonumber\pgf@yb}%
\pgfmathreciprocal@{\pgfmathresult}%
\pgf@yc\pgfmathresult\pgfarrowlinewidth%
\pgf@yc.5\pgf@yc%
\pgfmathsincos@{\pgf@sys@tonumber\pgf@ya}%
\pgf@ya\pgfmathresulty\pgf@yc% ya is the back miter
\pgf@yb\pgfmathresultx\pgf@yc% yb is the top miter
\ifdim\pgfarrowinset=0pt%
\pgf@ya.5\pgfarrowlinewidth% easy: back miter is half linewidth
\fi
% Compute inset miter length:
\pgfmathdivide@{\pgf@sys@tonumber\pgfarrowinset}{\pgf@sys@tonumber\pgfarrowwidth}%
\let\pgf@temp@quot\pgfmathresult%
\pgf@x\pgfmathresult pt%
\pgf@x\pgfmathresult\pgf@x%
\pgf@x4\pgf@x%
\pgfmathsqrt@{\pgf@sys@tonumber\pgf@x}%
\pgf@yc\pgfmathresult\pgfarrowlinewidth% yc is inset miter
\pgf@yc.5\pgf@yc%
% Inner length (pgfutil@tempdima) is now arrowlength - front miter - back miter
\pgfutil@tempdima\pgfarrowlength%
\pgfutil@tempdimb.5\pgfarrowwidth%
% harpoon miter correction
\ifpgfarrowroundjoin
\else
\pgfarrowssetbackend{0pt}
\fi
\ifpgfarrowharpoon
\else
\ifpgfarrowreversed
\ifdim\pgfinnerlinewidth>0pt
\pgfarrowssetlineend{\pgfarrowinset}
\else
\fi
\fi
\fi
\ifpgfarrowroundjoin
\else
\fi
% The hull:
\pgfarrowsupperhullpoint{0pt}{.5\pgfarrowwidth}%
\pgfarrowshullpoint{\pgfarrowinset}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else 0pt\fi}%
\pgfarrowssetvisualbackend{\pgfarrowinset}
% The following are needed in the code:
\pgfarrowssavethe\pgfutil@tempdima
\pgfarrowssavethe\pgfutil@tempdimb
\pgfarrowssavethe\pgfarrowlinewidth
\pgfarrowssavethe\pgf@ya
\pgfarrowssavethe\pgfarrowinset
},
drawing code = {
\pgfsetdash{}{+0pt}%
\ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi
\ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{+\pgfarrowlinewidth}\fi
\pgfpathlineto{\pgfqpoint{\pgf@ya}{-0.5\pgfarrowlinewidth}}%
\pgfpathlineto{\pgfqpoint{\pgfarrowinset}{-0.5\pgfarrowlinewidth}}%
\ifpgfarrowharpoon \else
\pgfpathlineto{\pgfqpoint{\pgf@ya}{-\pgfutil@tempdimb}}%
\fi
\pgfpathclose
\ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi
\pgfsetstrokecolor{\pgfarrowsecondcolor}%
\pgfsetfillcolor{\pgfarrowsecondcolor}%
\pgfpathlineto{\pgfqpoint{\pgf@ya}{0.5\pgfarrowlinewidth}}%
\pgfpathlineto{\pgfqpoint{\pgfarrowinset}{0.5\pgfarrowlinewidth}}%
\ifpgfarrowharpoon \else
\pgfpathlineto{\pgfqpoint{\pgf@ya}{\pgfutil@tempdimb}}%
\fi
\pgfpathclose
\ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi
},
parameters = {
\pgfarrowsecondcolor,%
\the\pgfarrowlinewidth,%
\the\pgfarrowlength,%
\the\pgfarrowwidth,%
\the\pgfarrowinset,%
\ifpgfarrowharpoon h\fi%
\ifpgfarrowopen o\fi%
\ifpgfarrowroundjoin j\fi%
},
}%
\makeatother
\begin{document}
\begin{tikzpicture}
\draw [thick,{Circle[open]}-{Siamese Stealth}] (0,0) -- ++ (70:1);
\draw [thick,{Circle[fill=blue]}-{Siamese Stealth[second color=blue,length=10pt]}] (1,0) -- ++ (70:1);
\draw [thick,{Circle[fill=orange]}-{Siamese Stealth[orange,second color=black,width=6pt]}] (2,0) -- ++ (70:1);
\end{tikzpicture}
\end{document}


As for the o arrow head: it is defined in the arrows library, which however got superseded by arrows.meta, which is used here. The Circle arrow head is a more flexible variant of o.

Another possibility is to use a pic. This has a shortenings code without pgf core commands, but is also less flexible.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[pics/Siamese arrow/.style={code={
\tikzset{Siamese arrow/.cd,#1}
\def\pv##1{\pgfkeysvalueof{/tikz/Siamese arrow/##1}}%
\begin{scope}
\clip (-\pv{length}-5pt,0) -- (2pt,0) --
(2pt,0.5*\pv{width}+\pgflinewidth)
-- (-\pv{length}-5pt,0.5*\pv{width}+\pgflinewidth) -- cycle;
color=\pv{color 1}] (-\pv{length}+2pt,0) -- (2pt,0);
\end{scope}
\begin{scope}
\clip (-\pv{length}-5pt,0) -- (2pt,0) --
(2pt,-0.5*\pv{width}-\pgflinewidth)
-- (-\pv{length}-5pt,-0.5*\pv{width}-\pgflinewidth) -- cycle;
color=\pv{color 2}] (-\pv{length}+2pt,0) -- (2pt,0);
\end{scope}
}},Siamese arrow/.cd,length/.initial=6pt,width/.initial=3pt,

• I saw that the library arrows.meta doesn't define other arrow's styles such as barbed angle 90 neither o-stealth. In despicte of that, the first alternative, using pgf core commands, allowed me to use these both styles. That said, the library doesn't seems to be sovereign. – arantxa Apr 26 at 14:06