I'm having terrible trouble trying to declare a new shape with PGF and would appreciate help. What I would like to achieve is:
where the lighter grey boxes are \nodepart
anchors, and the base shape is a rectangle, with a line drawn from the upper left corner to the middle bottom to the upper right corner.
Here is what I've tried:
\catcode`@=11
\pgfdeclareshape{decision}{%
\inheritsavedanchors[from=rectangle]%
\inheritanchorborder[from=rectangle]%
\inheritanchor[from=rectangle]{center}%
\foreach \anchor in {north,north west,north east,center,west,east,mid,
mid west,mid east,base,base west,base east,south,south west,south east}{%
\inheritanchor[from=rectangle]{\anchor}}%
\nodeparts{text,false,true}%
\savedanchor{false}{%
\pgf@x=.1\wd\pgfnodeparttextbox%
\pgf@y=.1\ht\pgfnodeparttextbox%
}%
\savedanchor{true}{%
\pgf@x=.9\wd\pgfnodeparttextbox%
\pgf@y=.1\ht\pgfnodeparttextbox%
}%
\inheritbackgroundpath[from=rectangle]%
%\beforebackgroundpath{%
% \pgfpathmoveto{\pgfpointadd{ %}%
}
\catcode`@=12
\tikz \node[decision] {};
\bye
Trying to compile the above (unfinished) definitions I get an error:
! Missing control sequence inserted.
<inserted text>
\inaccessible
<to be read again>
f
\pgf@sh@savedpoints ...53297pt}{-3.53297pt}}\def f
alse{\pgfqpoint {0.0pt}{0....
UPDATE
After following @cjorssen's advice in a comment, I changed the first arguments of \savedanchor
commands to be a command (i.e., \true
, \false
), and then I get a different error:
! Missing number, treated as zero.
<to be read again>
\pgfnodepartfalsebox
\pgfsys@hbox #1->\pgfsys@beginscope \setbox #1
=\hbox {\box #1}\wd #1=0pt\ht ...
\savedanchor
should be a command sequence:\savedanchor{\false}
.\pgfnodepartfalsebox
and a\pgfnodeparttruebox
. See examples inpgflibraryshapes.multipart.code.tex
.