答案1
您可以从以下代码开始:
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{matrix, positioning}
\begin{document}
\begin{tikzpicture}
\matrix (A) [matrix of nodes,
nodes={draw, fill, minimum size=9mm}]
{~&~&~&~&|[fill=white]|~&|[fill=white]|~&|[fill=white]|~\\
&~&~&~&|[fill=white]|~&|[fill=white]|~&|[fill=white]|~\\
&&~&~&|[fill=white]|~&|[fill=white]|~&|[fill=white]|~\\
&&&~&~&~&~\\
&&&&~&~&~\\
&&&&&~&~\\
&&&&&&~\\};
\foreach \i [count=\ni from 4, count=\nj from 2] in {1,...,7}{
\node[right=1mm of A-\i-7.east]{$a_{1\nj}$};
\node[above=1mm of A-1-\i.north]{$a_{\ni(11)}$};
}
\end{tikzpicture}
\end{document}
答案2
只是为了好玩,一种以编程方式填充条目的替代方法。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of nodes,nodes in empty cells,column sep=-\pgflinewidth,row
sep=-3*\pgflinewidth,nodes={align=center,minimum width=4em,minimum height=4em,
/utils/exec=\ifnum\the\pgfmatrixcurrentcolumn<8
\ifnum\the\pgfmatrixcurrentrow>1
\ifnum\the\numexpr\pgfmatrixcurrentcolumn+1\relax>\the\numexpr\pgfmatrixcurrentrow-1\relax
\ifnum\the\pgfmatrixcurrentcolumn>4
\ifnum\the\pgfmatrixcurrentrow<5
\tikzset{draw,fill=white}
\else
\tikzset{draw,fill}
\fi
\else
\tikzset{draw,fill}
\fi
\else
\fi
\fi
\fi,
execute at begin node={\ifnum\the\pgfmatrixcurrentrow=1%
\ifnum\the\pgfmatrixcurrentcolumn<8%
$a_{\the\numexpr\pgfmatrixcurrentcolumn+3\relax(11)}$%
\fi%
\else%
\ifnum\the\pgfmatrixcurrentcolumn=8%
$a_{1\the\pgfmatrixcurrentrow}$%
\fi%
\fi%
}}] (mat)
{& & & & & & &\\
& & & & & & &\\
& & & & & & &\\
& & & & & & &\\
& & & & & & &\\
& & & & & & &\\
& & & & & & &\\
& & & & & & &\\
};
\end{tikzpicture}
\end{document}