答案1
我不知道框的宽度和高度的规则。使用简单矩阵(整数坐标)的示例:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
x=15mm,
y=12mm,
font=\sffamily,
]
\fill[lightgray]
(2, 3) -- (6, 3) -- (6, 1) -- (3, 1) -- (3, 2) -- (2, 2) -- cycle
;
\draw
(1, 0) -- (1, 1) -- (6, 1) -- (6, 0) -- (0, 0) -- (0, 3) --
(2, 3) -- (2, 2)
(0, 2) -- (3, 2) -- (3, 1)
;
\draw[densely dashed]
(2, 3) -- (6, 3) -- (6, 1)
(4, 3) -- (4, 1)
;
\path
(0, 2) -- node{\bfseries Level 1} (2, 3)
(0, 1) -- node{\bfseries Level 2} (3, 2)
(1, 0) -- node{\bfseries Level 3} (6, 1)
(2, 2) -- node{\itshape Extra} (4, 3)
(4, 1) -- node{\itshape This \& That} (6, 3)
;
\end{tikzpicture}
\end{document}
或者保持垂直线或多或少不规则的位置:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
font=\sffamily,
]
\def\WD{8cm}
\pgfmathsetmacro{\HT}{\WD * 0.4}
\pgfmathsetmacro{\yunit}{\HT/3}
\tikzset{
x=\WD,
y=\yunit,
}
% x positions of the vertical lines as fractions of the image width
\def\xa{.15}
\def\xb{.38}
\def\xc{.57}
\def\xd{.69}
\fill[lightgray]
(\xb, 3) -- (1, 3) -- (1, 1) -- (\xc, 1) -- (\xc, 2) -- (\xb, 2) -- cycle
;
\draw
(\xa, 0) -- (\xa, 1) -- (1, 1) -- (1, 0) -- (0, 0) -- (0, 3) --
(\xb, 3) -- (\xb, 2)
(0, 2) -- (\xc, 2) -- (\xc, 1)
;
\draw[densely dashed]
(\xb, 3) -- (1, 3) -- (1, 1)
(\xd, 3) -- (\xd, 1)
;
\path
(0, 2) -- node{\bfseries Level 1} (\xb, 3)
(0, 1) -- node{\bfseries Level 2} (\xc, 2)
(\xa, 0) -- node{\bfseries Level 3} (1, 1)
(\xb, 2) -- node{\itshape Extra} (\xd, 3)
(\xd, 1) -- node{\itshape This \& That} (1, 3)
;
\end{tikzpicture}
\end{document}