我正在尝试绘制一个包含迷你术语索引的 KMap,如下所示;
与此最接近的是以下代码:
\begin{kvmap}
\kvlist{8}{4}{\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},1,1,\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},X,X,X,X,X,X,X,X,\phantom{0},\phantom{0},\phantom{0},\phantom{0},X,X,X,1}{Q_2,Q_1,Q_0,Q_4,Q_3}
\bundle[color=red]{1}{1}{2}{2}
\bundle[color=blue,reducespace=3pt]{4}{2}{7}{3}
\end{kvmap}
我所需要的只是将这些小数字添加到每个单元格的右上角,忘记制作红色和黄色的框,我对我所拥有的隐含设计感到满意。
答案1
假设您使用,kvmap
您可以依赖它是一个 TikZ 包并循环遍历将单元格映射到其值的列表。
\documentclass{article}
\usepackage{kvmap}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{kvmap}
\kvlist{8}{4}{\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},1,1,\phantom{0},\phantom{0},\phantom{0},\phantom{0},\phantom{0},X,X,X,X,X,X,X,X,\phantom{0},\phantom{0},\phantom{0},\phantom{0},X,X,X,1}{Q_2,Q_1,Q_0,Q_4,Q_3}
\foreach \tikzn/\tikzi in {00/0, 10/1, 20/3, 30/2, 40/6, 50/7, 60/5, 70/4,
01/8, 11/9, 21/11, 31/10, 41/14, 51/15, 61/13, 71/12,
02/24, 12/25, 22/27, 32/26, 42/30, 52/31, 62/29, 72/28,
03/16, 13/17, 23/19, 33/18, 43/22, 53/23, 63/21, 73/20
} {
\node[font=\footnotesize,anchor=north east, inner sep=1pt] at (\tikzn.north east) {$\tikzi$};
}
\begin{scope}[on background layer]
\fill[red!30] (1,-1) rectangle (3,-3);
\fill[blue!30] (4,-2) rectangle (8,-4);
\end{scope}
\end{kvmap}
\end{document}