I want to create 10x10 squares and fill the elements all around with zeros
As shown in the attached images
But when I add zeros, a space appears between these elements.
Below is the MWE:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix, backgrounds}
\newcommand{\0}{\scalebox{2}{$0$}}
\begin{document}
\begin{tikzpicture}[font=\scriptsize]
\matrix (space) [matrix of math nodes, row sep=-\pgflinewidth, column sep=-\pgflinewidth,
nodes={draw, semithick, minimum height=10mm, minimum width=10mm, text=blue}]
{\0 & \0 & \0 & \0 & \0 & \0 & \0 & \0 & \0 & \0 \
\0 &\ & \ & \ & \ & \ & \ & \ & \ & \0 \
\0 &\ & \ & \ & \ & \ & \ & \ & \ & \0 \
\0 &\ & \ & \ & \ & \ & \ & \ & \ & \0 \
\0 &\ & \ & \ & \ & \ & \ & \ & \ & \0 \
\0 &\ & \ & \ & \ & \ & \ & \ & \ & \0 \
\0 &\ & \ & \ & \ & \ & \ & \ & \ & \0 \
\0 &\ & \ & \ & \ & \ & \ & \ & \ & \0 \
\0 &\ & \ & \ & \ & \ & \ & \ & \ & \0 \
\0 & \0 & \0 & \0 & \0 & \0 & \0 & \0 & \0 & \0 \};
\end{tikzpicture}
\begin{tikzpicture}[font=\scriptsize]
\matrix (space) [matrix of math nodes, row sep=-\pgflinewidth, column sep=-\pgflinewidth,
nodes={draw, semithick, minimum height=10mm, minimum width=10mm, text=blue}]
{\ & \ & \ & \ & \ & \ & \ & \ & \ & \ \
\ &\ & \ & \ & \ & \ & \ & \ & \ & \ \
\ &\ & \ & \ & \ & \ & \ & \ & \ & \ \
\ &\ & \ & \ & \ & \ & \ & \ & \ & \ \
\ &\ & \ & \ & \ & \ & \ & \ & \ & \ \
\ &\ & \ & \ & \ & \ & \ & \ & \ & \ \
\ &\ & \ & \ & \ & \ & \ & \ & \ & \ \
\ &\ & \ & \ & \ & \ & \ & \ & \ & \ \
\ &\ & \ & \ & \ & \ & \ & \ & \ & \ \
\ & \ & \ & \ & \ & \ & \ & \ & \ & \ \};
\end{tikzpicture}
\end{document}






font=\vphantom{\0}to thenodeshelps correct the vertical alignment and spacing. – Qrrbrbirlbel Aug 12 '22 at 12:10matrix of nodessets anchor tobase, change it tocenter:nodes={..., anchor=center}– Ignasi Aug 12 '22 at 16:34