答案1
\documentclass{article}
\usepackage{stackengine}
\begin{document}
\stackon[-\fboxrule]{\fbox{C}\fbox{D}\fbox{E}}{\fbox{A}\fbox{B}}
\end{document}
想要一些更奇特的东西……
\documentclass{article}
\usepackage{stackengine,xcolor}
\newcommand\mybox[1]{\fcolorbox{blue!40!gray}{blue!10}{#1}\kern-\fboxrule}
\begin{document}
\sffamily
\stackon[-\fboxrule]{\mybox{C}\mybox{D}\mybox{E}}{\mybox{A}\mybox{B}}
\end{document}
答案2
有了几个nx1
矩阵,就很容易进行这些构造。
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{matrix, positioning}
\tikzset{
myarray/.style={matrix, matrix of nodes, inner sep=0pt, outer sep=0pt,
column sep=-\pgflinewidth, row sep=-\pgflinewidth,
nodes={draw=blue!50, fill=blue!50!gray!20, font=\ttfamily, inner sep=.3333em, anchor=center,}}
}
\begin{document}
\begin{tikzpicture}
\node[myarray] (A) {A&B\\};
\node[myarray, below=-\pgflinewidth of A] {C&D&E\\};
\end{tikzpicture}
\begin{tikzpicture}
\node[myarray] (A) {A\\B\\};
\node[myarray, right=-\pgflinewidth of A] {C\\D\\E\\};
\end{tikzpicture}
\end{document}