I'm having a hard time understanding how TikZ handles coordinates. This question is thus related to my previous two questions, and some more in the future...
In the code below I define a tikzset that takes two parameter. I want to store them in coordinates (yes - not needed and nonsense in this case, but not in what I'm trying to do with TikZ).
The resulting picture is correct but I get an error: ! Package tikz Error: Giving up on this path. Did you forget a semicolon?. l.17 \pic at (0,0) {somearrow={(1,1)}{(3,3)}}
What is wrong with my code? Please explain.
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\tikzset{
pics/somearrow/.style 2 args={
code={
\coordinate (A) at (#1);
\coordinate (B) at (#2);
\node at (A) {#1};
\node at (B) {#2};
}}}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (4,4);
\pic at (0,0) {somearrow={(1,1)}{(3,3)}};
\end{tikzpicture}
\end{document}


#1in thepic, the outer curly brackets are removed and you get e.g.(0,0)or whatever which is what you want for a coordinate specification. When you are putting the parameter into a node, you need the curly brackets because that's the syntax for nodes i.e. you want{(0,0)}. So, you need to restore the ones which have been stripped. Does that help? As I say, I'm not sure I understand what you are asking.... (So it may well not help at all :(.) – cfr Dec 08 '15 at 13:23