I have browsed arrows.meta
and arrows
library. They are fantastic.
However, I want to have a custom image/shape as arrow tip e.g. an image of glove as arrow tip or shapes of $PO_4^{3-}$ group as arrow tips.
I looked at \pgfdeclarearrow
macro. I could not use a \node
inside this macro; nor I could place \includegraphics
in it. The code is tried is basically many trial and error with following code given in manual (update: Added MWE)
\RequirePackage{luatex85}
\documentclass[crop,tikz]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta}
\begin{document}
\pgfdeclarearrow{
name = foo,
parameters = { \the\pgfarrowlength },
setup code = {
% The different end values:
\pgfarrowssettipend{.25\pgfarrowlength}
\pgfarrowssetlineend{-.25\pgfarrowlength}
\pgfarrowssetvisualbackend{-.5\pgfarrowlength}
\pgfarrowssetbackend{-.75\pgfarrowlength}
% The hull
\pgfarrowshullpoint{.25\pgfarrowlength}{0pt}
\pgfarrowshullpoint{-.75\pgfarrowlength}{.5\pgfarrowlength}
\pgfarrowshullpoint{-.75\pgfarrowlength}{-.5\pgfarrowlength}
% Saves: Only the length:
\pgfarrowssavethe\pgfarrowlength
},
drawing code = {
% Attempt here.
\pgfsetdash{}
\pgftext[left]{$X$}
\pgfusepathqfill
},
defaults = {length=4}
}
\begin{tikzpicture}[scale=1, every node/.style={} ]
\node[thick] at (0,0) {+};
\draw[gray!20] (-5,-5) grid (5,5);
\draw[foo-foo] (0,0) -- (3cm,0);
%\draw[-foo] (0,1) -- (10cm,1);
\end{tikzpicture}
\end{document}
This is the first time I am trying to write a custom anything
in tikz. I have a working solution where I put a node with given shape or graphic, and draw an arrow till it touches it boundary. But it would be good if I can exploit pgf internals to achieve the same.
\pgfdeclareimage
and\pgftext
+\pgfuseimage
(see manual chapter 105.3) can be used. (I don't actually know if that is the case.)