I would like to define a node style, so that the node will look like the LaTeX symbol \oplus
, i.e. a circle with lines from north to south, and east to west. (I also have more complicated examples in mind.)
I think that I should draw the lines in the execute at end node
, or after mode path
arguments, but nothing I have tried seems to work. The code I have in mind is something like this:
\tikzstyle{foo}=[circle,draw,execute at end node={\draw ??????}]
To rephrase the question: How can one do arbitrary drawing within a node, and define this as a style? In particular, how do you get the coordinates of the current node in a style?
Best Answer
All TikZ node shapes are defined using lower-level PGF code. This is described in the
pgfmanual
in section 75.5 Declaring New Shapes, on page 625 of the v2.1 manual.You can use the existing code of the circle shape as a base and add the lines to it. The code can be found in the file
${TEXMF}/tex/generic/pgf/modules/pgfmoduleshapes.code.tex
.Here the way I would do it:
Shape declaration:
Usage example:
Result:
You might also want to draw the additional lines in the
\foregroundpath
instead. For this see theforbidden sign
shape in the filepgflibraryshapes.symbols.code.tex
is an good example.