3

I have created the following shape (it has some more features but the error is always the same), based on a rectangle.

\pgfdeclareshape{set}{  
  %Like in rectangle but without all the separators and height=width
    \savedanchor\northeast{%
        \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
        \pgf@x=.5\pgf@xb%
        \pgf@y=.5\pgf@xb%
    }%

    \savedanchor\southwest{%
        \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/minimum width}}%
        \pgf@x=-.5\pgf@xb%
        \pgf@y=-.5\pgf@xb%
    }%

    % Inherit from rectangle
    \inheritanchorborder[from=rectangle]%
    \inheritanchor[from=rectangle]{center}%
    \inheritanchor[from=rectangle]{north}%
    \inheritanchor[from=rectangle]{south}%
    \inheritanchor[from=rectangle]{west}%
    \inheritanchor[from=rectangle]{east}%
    \inheritanchor[from=rectangle]{north west}%
    \inheritanchor[from=rectangle]{north east}%
    \inheritanchor[from=rectangle]{south west}%
    \inheritanchor[from=rectangle]{south east}%

    \backgroundpath{%
        \pgfpathrectanglecorners{\southwest}{\northeast}%
    }%
 }%

Most things work just fine for me. For example:

\node[set,draw, below right=10ex of n, rotate=270, anchor=center] (sA) {};

positions the node perfectly and rotates it. Same with 'below left'.

But if I use

\node[set,draw, above left=10ex of n, rotate=270, anchor=center] (sA) {};

I get the error

Package PGF Math Error: Unknown function 'north' (in 'north west').

The same happens with 'above right'. The output still seems to be fine.

I am using the new version of tikz 3.0.0.

Any ideas to avoid this really disturbing error?

Thank you!

| improve this question | | | | |
  • Not the posted code has a problem. But in the shape used for node 'n' the anchors for 'north west' and 'north east' were missing. I fixed it by including \inheritanchor[from=rectangle]{north west} – baghira Mar 26 '14 at 17:26
  • 2
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – jub0bs Mar 26 '14 at 17:27
  • 2
    I don't have any problems on my system. It works without any errors. Are you including \usetikzlibrary{positioning} at the top? – percusse Mar 26 '14 at 20:34