I'm working on writing a simple package to define some drawing tasks that I commonly do in my work. There are a number of symbols that are reused frequently and I'd like to add them as custom nodes. I've looked at pgf/tikz node custom shape and Creating node shapes; I found both useful, as well as read chapter 49.5 on declaring new shapes from the tikz/pgf manual (in particular, the example on page 335. Both were very informative. However, I'm still having a problem and I suspect it's simple.
Here are the snippets of code that are relevant to the issue:
\tikzset{leverage/.initial={}}
\pgfdeclareshape{circle player}{
\inheritsavedanchors[from=circle]
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{east}
\inheritbackgroundpath[from=circle]
\beforebackgroundpath{
% get and set options
\pgfkeys{/tikz/leverage/.get=\tmp}
\expandafter\tikzset\expandafter{\tmp}
\tikz@options
% get north and south coordinates
\north \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\south \pgf@xb=\pgf@x \pgf@yb=\pgf@y
% draw the line starting from north
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}
\pgfpathclose
}
}
\begin{tikzpicture}
\node[circle player, draw=black] at (240,90) {};
\end{tikzpicture}
The shape declaration is occurring in the .sty file (wherein I shouldn't need \makeatletter or \makeatother, and haven't had any issues with that), along with the declaration of the leverage option (which is currently not being used, but will be in the future). I've verified that the .sty file is working by writing other commands, using \usepackage in the preamble of my document, and executing those commands. The issue seems to be centered on the declaration of new shapes for nodes. I cannot suss out why there is an issue; I consistently get undefined control sequence when trying to use a newly defined node shape.
What am I missing? It's probably very simple.
Undefined control sequencefor\north. What is the\northcommand? Did you define it? – Phelype Oleinik Mar 29 '18 at 13:42circleshape doesn't have a\savedanchornamednorth. You have to redefine it – percusse Mar 29 '18 at 13:46\southwestis a saved anchor of rectangle but\northis not of circle shape. – percusse Mar 29 '18 at 14:19