答案1
Amatrix of nodes
将所有节点对齐在其上baseline
而不是在其上center
。您需要添加anchor=center
到nodes
样式。
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (A) [matrix of nodes, ampersand replacement=\&,
row sep=-\pgflinewidth, column sep=-\pgflinewidth,
nodes={draw,minimum size=10mm,anchor=center},
column 1/.style={nodes={minimum width=20mm}}] {
Bob \& A \& 21\\
Alice\& B \& 5\\
Charlie \& F \& 2\\
};
\end{tikzpicture}
\end{document}