I want to place a tikzpicture in a node/cell of a tikz-cd diagram and then paint some more stuff in the inner tikzpicture. However, it seems that the nesting messes up the center anchor.
Concretely: In the following MWE, why is the blue circle not properly in the center of the node? How can I fix it?
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{cd}
\newcommand{\boxedBWithAnchors}{
\begin{tikzpicture}[baseline=(B.base)]
\node[draw=black!20] (B) {B};
\draw[draw=black!20] (B.south west) to (B.north east);
\draw[draw=black!20] (B.north west) to (B.south east);
\draw[draw=blue] (B.center) circle (1pt);
\end{tikzpicture}
}
\begin{document}
\,\boxedBWithAnchors
\begin{tikzcd}
\boxedBWithAnchors
\end{tikzcd}
\end{document}



tikzpictures is discouraged. – egreg Apr 05 '19 at 12:57