Partial triangular arrows with TikZ/PGF
The new really cool CVS arrow stuff (bendy arrows!) written by Till Tantau makes all sorts of customization of arrows possible. In particular left
and right
parts of arrows can be specified like this -{Stealth[left]}
This example is culled from the latest CVS manual:
\documentclass[border=0.125cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\makeatletter
\long\def\arrowexample#1{%
\tt#1 &
\tikz\draw [-{#1}, very thick](0,0) -- (1,0);
\\
}
\begin{document}
\begin{tabular}{ll}
\arrowexample{Stealth[]}
\arrowexample{Stealth[sep] Stealth[]}
\arrowexample{Stealth[sep] . Stealth[]}
\arrowexample{Stealth[open]}
\arrowexample{Stealth[length=6pt,width=4pt]}
\arrowexample{Stealth[length=6pt,width=4pt,inset=1.5pt]}
\arrowexample{Stealth[round]}
\arrowexample{Stealth[slant=.3]}
\arrowexample{Stealth[left]}
\arrowexample{Stealth[right]}
\arrowexample{Stealth[red]}
\end{tabular}
\end{document}
Luigi, out TikZ-arrows guru provided in the Italian forum something very close to this question (for stealth tip).
Building on that:
\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz}
\makeatletter
\pgfarrowsdeclare{left stealth}{left stealth}
{
\pgfutil@tempdima=0.28pt%
\pgfutil@tempdimb=\pgflinewidth%
\ifdim\pgfinnerlinewidth>0pt%
\pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
\fi%
\advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfarrowsleftextend{+-3\pgfutil@tempdima}
\pgfarrowsrightextend{+5\pgfutil@tempdima}
}
{
\pgfutil@tempdima=0.28pt%
\pgfutil@tempdimb=\pgflinewidth%
\ifdim\pgfinnerlinewidth>0pt%
\pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
\fi%
\advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfmathsetlength\pgfutil@tempdimb{5\pgfutil@tempdima-\pgflinewidth}
\pgfpathmoveto{\pgfqpoint{5\pgfutil@tempdima}{0pt}}
\pgfpathlineto{\pgfqpoint{-3\pgfutil@tempdima}{4\pgfutil@tempdima}}
\pgfpathlineto{\pgfpointorigin}
\pgfpathlineto{\pgfqpoint{0pt}{-.5\pgflinewidth}}
\pgfpathlineto{\pgfqpoint{\pgfutil@tempdimb}{-.5\pgflinewidth}}
\pgfpathlineto{\pgfqpoint{6\pgfutil@tempdima}{-0.5\pgflinewidth}}
\pgfusepathqfill
}
\pgfarrowsdeclare{right stealth}{right stealth}
{
\pgfutil@tempdima=0.28pt%
\pgfutil@tempdimb=\pgflinewidth%
\ifdim\pgfinnerlinewidth>0pt%
\pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
\fi%
\advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfarrowsleftextend{+-3\pgfutil@tempdima}
\pgfarrowsrightextend{+5\pgfutil@tempdima}
}
{
\pgfutil@tempdima=0.28pt%
\pgfutil@tempdimb=\pgflinewidth%
\ifdim\pgfinnerlinewidth>0pt%
\pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
\fi%
\advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfmathsetlength\pgfutil@tempdimb{5\[email protected]\pgflinewidth}
\pgfpathmoveto{\pgfqpoint{5\pgfutil@tempdima}{0pt}}
\pgfpathlineto{\pgfqpoint{-3\pgfutil@tempdima}{-4\pgfutil@tempdima}}
\pgfpathlineto{\pgfpointorigin}
\pgfpathlineto{\pgfqpoint{0pt}{.5\pgflinewidth}}
\pgfpathlineto{\pgfqpoint{\pgfutil@tempdimb}{0.5\pgflinewidth}}
\pgfpathlineto{\pgfqpoint{6\pgfutil@tempdima}{0.5\pgflinewidth}}
\pgfusepathqfill
}
\pgfarrowsdeclare{left triangle}{left triangle}
{
\pgfutil@tempdima=0.28pt%
\pgfutil@tempdimb=\pgflinewidth%
\ifdim\pgfinnerlinewidth>0pt%
\pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
\fi%
\advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfarrowsleftextend{+-3\pgfutil@tempdima}
\pgfarrowsrightextend{+5\pgfutil@tempdima}
}
{
\pgfutil@tempdima=0.28pt%
\pgfutil@tempdimb=\pgflinewidth%
\ifdim\pgfinnerlinewidth>0pt%
\pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
\fi%
\advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfmathsetlength\pgfutil@tempdimb{5\pgfutil@tempdima-\pgflinewidth}
\pgfpathmoveto{\pgfqpoint{5\pgfutil@tempdima}{0pt}}
\pgfpathlineto{\pgfqpoint{0pt}{4\pgfutil@tempdima}}
\pgfpathlineto{\pgfpointorigin}
\pgfpathlineto{\pgfqpoint{0pt}{-.5\pgflinewidth}}
\pgfpathlineto{\pgfqpoint{\pgfutil@tempdimb}{-.5\pgflinewidth}}
\pgfpathlineto{\pgfqpoint{5.5\pgfutil@tempdima}{-0.5\pgflinewidth}}
\pgfusepathqfill
}
\pgfarrowsdeclare{right triangle}{right triangle}
{
\pgfutil@tempdima=0.28pt%
\pgfutil@tempdimb=\pgflinewidth%
\ifdim\pgfinnerlinewidth>0pt%
\pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
\fi%
\advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfarrowsleftextend{+-3\pgfutil@tempdima}
\pgfarrowsrightextend{+5\pgfutil@tempdima}
}
{
\pgfutil@tempdima=0.28pt%
\pgfutil@tempdimb=\pgflinewidth%
\ifdim\pgfinnerlinewidth>0pt%
\pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
\fi%
\advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
\pgfmathsetlength\pgfutil@tempdimb{5\[email protected]\pgflinewidth}
\pgfpathmoveto{\pgfqpoint{5\pgfutil@tempdima}{0pt}}
\pgfpathlineto{\pgfqpoint{0pt}{-4\pgfutil@tempdima}}
\pgfpathlineto{\pgfpointorigin}
\pgfpathlineto{\pgfqpoint{0pt}{.5\pgflinewidth}}
\pgfpathlineto{\pgfqpoint{\pgfutil@tempdimb}{0.5\pgflinewidth}}
\pgfpathlineto{\pgfqpoint{5.5\pgfutil@tempdima}{0.5\pgflinewidth}}
\pgfusepathqfill
}
\makeatother
\begin{document}
\begin{tikzpicture}
\draw[right stealth-right stealth] (0,0)--(2,0);
\draw[left stealth-left stealth] (0,1)--(2,1);
\draw[right triangle-right triangle] (0,2)--(2,2);
\draw[left triangle-left triangle] (0,3)--(2,3);
\end{tikzpicture}
\end{document}
The result: