答案1
该库的使用matrix
很简单:
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of nodes,
nodes={draw, minimum size=1em, anchor=center,
outer sep=0pt},
column sep=-\pgflinewidth, row sep=-\pgflinewidth
]
{
1 & 2 & 3 & 4 & 5 & 6 & 7 \\
& 2 & 3 & 4 & 5 & 6 & \\
& & 3 & 4 & 5 & & \\
& & & 4 & & & \\
};
\end{tikzpicture}
\end{document}