I've defined a node style which contains a path picture consisting into an inner node:
cross/.style={circle, minimum size=1cm,
draw=black!70, fill=white,
path picture={%
\node[cross out, draw, ultra thick, red, minimum size=5mm]{};}}
This style can be used inside a node:
\node[cross] {};
and can be used inside a \matrix:
\matrix[fill=black!20, xshift=2cm] (b) {%
\node[cross]{}; & \node[cross]{};\\
\node[cross]{}; & \node[cross]{};\\};
but it fails when used inside a matrix of nodes with nodes=cross.
! TeX capacity exceeded, sorry [grouping levels=255].
\pgfutil@g@addto@macro #1#2->\begingroup
\pgfutil@toks@ \expandafter {#1#2}\...
l.15 ...odes={cross}, nodes in empty cells] (c) {&
\\ & \\};
! ==> Fatal error occurred, no output PDF file produced!
Could you explain me what's wrong?
Note: I've read Nodes and matrix of nodes but I think it describes another kind of problem.
The complete code is:
\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.misc, positioning, matrix}
\begin{document}
\begin{tikzpicture}[
cross/.style={circle, minimum size=1cm,
draw=black!70, fill=white,
path picture={\node[cross out, draw, ultra thick, red, minimum size=5mm] {};}},
]
% This works
\node[cross] (a) {};
%This works
\matrix[fill=black!20, xshift=2cm] (b) {\node[cross]{}; & \node[cross]{};\\ \node[cross]{}; & \node[cross]{};\\};
%This is wrong
%\matrix[fill=black!20, xshift=6cm, matrix of nodes, nodes={cross}, nodes in empty cells] (c) {& \\ & \\};
\end{tikzpicture}
\end{document}


nodes={cross}: Inpath pictureit will apply it again. So it causes infinite recursion of nodes. better addno crossor anything that can clean upnodesinpath picture– Symbol 1 Mar 22 '17 at 21:41