Following code shows four different ways of adding a label with its column and row value for certain nodes in a matrix or matrix of nodes. The problem is that the fourth way (commented in code) doesn't work. Compilation finishes with error
! TeX capacity exceeded, sorry [grouping levels=255].
\pgfutil@g@addto@macro #1#2->\begingroup
\pgfutil@toks@ \expandafter {#1#2}\...
l.37 D\\
! ==> Fatal error occurred, no output PDF file produced!
Could you explain me why? Are matrix of nodes limited respect matrix?
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning, matrix}
\begin{document}
\begin{tikzpicture}
\matrix (a)
{
\node[draw,
label=left:\the\pgfmatrixcurrentrow,
label=\the\pgfmatrixcurrentcolumn] {A};\\
};
\matrix (b) [right = 1mm of a,
matrix of nodes,
nodes = {draw}]
{
|[label=left:\the\pgfmatrixcurrentrow,
label=\the\pgfmatrixcurrentcolumn]| B\\
};
\matrix (c) [right = 3mm of b.south east, matrix anchor=south west,
matrix of nodes,
nodes = {draw}]
{
C\\
};
\node also [label=left:\the\pgfmatrixcurrentrow,
label=\the\pgfmatrixcurrentcolumn] (c-1-1) {};
%This labelling way doesn't work.
%\matrix (d) [right= of c,
% matrix of nodes,
% nodes={draw,
% label=left:\the\pgfmatrixcurrentrow,
% label=\the\pgfmatrixcurrentcolumn}]
%{
% D\\
%};
\end{tikzpicture}
\end{document}

nodes.execute at begin cellcan be an alternative – percusse Aug 15 '17 at 10:33