![无法绘制带有居中字母的框](https://linux22.com/image/445098/%E6%97%A0%E6%B3%95%E7%BB%98%E5%88%B6%E5%B8%A6%E6%9C%89%E5%B1%85%E4%B8%AD%E5%AD%97%E6%AF%8D%E7%9A%84%E6%A1%86.png)
答案1
这是使用 tikz 矩阵的版本:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newlength{\myboxlength}
\begin{document}
\setlength{\myboxlength}{1cm}
\begin{tikzpicture}
\matrix(table)[
matrix of nodes,
row sep = 0.2\myboxlength,
column sep = 0.2\myboxlength,
nodes={ fill=none, draw=black},
column 1/.style={minimum width=5\myboxlength},
column 2/.style={minimum width=1\myboxlength},
row 1/.style={minimum height=3\myboxlength},
row 2/.style={minimum height=1\myboxlength},
]
{A & B \\
C & 0 \\
};
\end{tikzpicture}
\bigskip
\setlength{\myboxlength}{5mm}
\begin{tikzpicture}
\matrix(table)[
matrix of nodes,
row sep = 0.2\myboxlength,
column sep = 0.2\myboxlength,
nodes={ fill=none, draw=black},
column 1/.style={minimum width=5\myboxlength},
column 2/.style={minimum width=1\myboxlength},
row 1/.style={minimum height=3\myboxlength},
row 2/.style={minimum height=1\myboxlength},
]
{A & B \\
C & 0 \\
};
\end{tikzpicture}
\end{document}
答案2
\def\mybox#1#2#3{\vrule height#2\vbox to#2{\dimen0=#1\advance\dimen0by-.8pt
\hrule width\dimen0\vfil\hbox to\dimen0{\strut\hfil#3\hfil}\vfil\hrule width\dimen0}\vrule height#2\relax}
\def\mykern{\kern1pt}
\vbox{\hbox{\mybox{5pc}{3pc}{A}\mykern\mybox{1pc}{3pc}{b}}
\mykern
\hbox{\mybox{5pc}{1pc}{c}\mykern\mybox{1pc}{1pc}{0}}}