我试图在 Lyx 中绘制一个 5 个变量的卡诺图,所以我浏览了网站并寻找某种解决方案,然后我偶然发现了卡诺图包。我尝试绘制函数 Σ(1,2,4,7,12,18,22,24,26,27,31) 的图,这就是我得到的
这个包绘制了令人难以置信的 2、3、4 个变量的 K 图。但是,在 5 个变量时,它基本上重复了 4 个变量的映射,这会导致一个大问题 - 顺序不正确。例如,第一行是 0132 5687,这是有问题的,因为 2 和 5 之间的数字差不止一位。我需要它的格式为 0132 6754(我被教导的方式),这意味着正确的表格的顺序是 10 11 01 00。
我遇到的另一个小问题是它自动生成顶部的 2 位数字而不是 3 位数字。这没关系,因为我应该处理底部的第三个变量(就像我做的那样)。
我能做些什么来解决我的主要问题?提前谢谢。
编辑:我用来绘制该图的代码
begin{karnaugh-map}[4][4][2][d,e][a,b][c ]
\minterms{1,2,4,7,12,18,22,24,26,27,31}
\maxterms{0,3,5,6,8,9,10,11,13,14,15,16,17,18,19,20,21,23,25,28,29,30}
\autoterms[X]
\implicant{4}{6}
\implicant{1}{5}
\implicant{3}{6}
\implicant{29}{29}
\end{karnaugh-map}
答案1
不确定我是否完全理解了您的意思,但列的顺序在环境定义中是硬编码的karnaugh-map
,因此为了更改它,您需要更改该定义。\usepackage{karnaugh-map}
在文档 --> 设置 --> LaTeX 前言中,在后面添加以下代码块:
\RenewDocumentEnvironment{karnaugh-map}{s O{4} O{4} O{1} O{$X_1X_0$} O{$X_3X_2$} O{$X_5X_4$}} {%
\begingroup
% store map size {[START]
\renewcommand{\@karnaughmap@var@mapsizex@}{#2}%
\renewcommand{\@karnaughmap@var@mapsizey@}{#3}%
\renewcommand{\@karnaughmap@var@mapsizez@}{#4}%
% [END]}
% determinate if markings should be color or black and white
\IfBooleanTF{#1}{%
% should be black and white
\renewcommand{\@karnaughmap@var@bw@}{1}%
}{%
% should be color
\renewcommand{\@karnaughmap@var@bw@}{0}%
}%
%
% find matching matrix template and alignment parameters {[START]
\newcommand{\@karnaughmap@local@matrixtemplate@}{0}% '0' is considered as missing matrix template
\newcommand{\@karnaughmap@local@maprealignmentx@}{0}%
\newcommand{\@karnaughmap@local@maprealignmenty@}{0}%
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=221
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 0 \& 1 \& \phantom{0} \\
0 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& \\
1 \& |(000010)| \phantom{0} \& |(000011)| \phantom{0} \& \\
\phantom{0} \& \& \& \\
}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=241
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 0 \& 1 \& \phantom{00} \\
00 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& \\
01 \& |(000010)| \phantom{0} \& |(000011)| \phantom{0} \& \\
11 \& |(000110)| \phantom{0} \& |(000111)| \phantom{0} \& \\
10 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& \\
\phantom{00} \& \& \& \\
}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=421
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 00 \& 01 \& 11 \& 10 \& \phantom{00} \\
0 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& |(000011)| \phantom{0} \& |(000010)| \phantom{0} \& \\
1 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& |(000111)| \phantom{0} \& |(000110)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \\
}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=441
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 00 \& 01 \& 11 \& 10 \& \phantom{00} \\
00 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& |(000011)| \phantom{0} \& |(000010)| \phantom{0} \& \\
01 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& |(000111)| \phantom{0} \& |(000110)| \phantom{0} \& \\
11 \& |(001100)| \phantom{0} \& |(001101)| \phantom{0} \& |(001111)| \phantom{0} \& |(001110)| \phantom{0} \& \\
10 \& |(001000)| \phantom{0} \& |(001001)| \phantom{0} \& |(001011)| \phantom{0} \& |(001010)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \\
}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=442
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 00 \& 01 \& 11 \& 10 \& \phantom{00} \& 10 \& 11 \& 01 \& 00 \& \phantom{00} \\
00 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& |(000011)| \phantom{0} \& |(000010)| \phantom{0} \& \& |(010010)| \phantom{0} \& |(010011)| \phantom{0} \& |(010001)| \phantom{0} \& |(010000)| \phantom{0} \& \\
01 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& |(000111)| \phantom{0} \& |(000110)| \phantom{0} \& \& |(010110)| \phantom{0} \& |(010111)| \phantom{0} \& |(010101)| \phantom{0} \& |(010100)| \phantom{0} \& \\
11 \& |(001100)| \phantom{0} \& |(001101)| \phantom{0} \& |(001111)| \phantom{0} \& |(001110)| \phantom{0} \& \& |(011110)| \phantom{0} \& |(011111)| \phantom{0} \& |(011101)| \phantom{0} \& |(011100)| \phantom{0} \& \\
10 \& |(001000)| \phantom{0} \& |(001001)| \phantom{0} \& |(001011)| \phantom{0} \& |(001010)| \phantom{0} \& \& |(011010)| \phantom{0} \& |(011011)| \phantom{0} \& |(011001)| \phantom{0} \& |(011000)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \& \& \& \& \& \\
}%
\renewcommand{\@karnaughmap@local@maprealignmentx@}{2.5}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=444
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 00 \& 01 \& 11 \& 10 \& \phantom{00} \& 00 \& 01 \& 11 \& 10 \& \phantom{00} \\
00 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& |(000011)| \phantom{0} \& |(000010)| \phantom{0} \& \& |(010000)| \phantom{0} \& |(010001)| \phantom{0} \& |(010011)| \phantom{0} \& |(010010)| \phantom{0} \& \\
01 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& |(000111)| \phantom{0} \& |(000110)| \phantom{0} \& \& |(010100)| \phantom{0} \& |(010101)| \phantom{0} \& |(010111)| \phantom{0} \& |(010110)| \phantom{0} \& \\
11 \& |(001100)| \phantom{0} \& |(001101)| \phantom{0} \& |(001111)| \phantom{0} \& |(001110)| \phantom{0} \& \& |(011100)| \phantom{0} \& |(011101)| \phantom{0} \& |(011111)| \phantom{0} \& |(011110)| \phantom{0} \& \\
10 \& |(001000)| \phantom{0} \& |(001001)| \phantom{0} \& |(001011)| \phantom{0} \& |(001010)| \phantom{0} \& \& |(011000)| \phantom{0} \& |(011001)| \phantom{0} \& |(011011)| \phantom{0} \& |(011010)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \& \& \& \& \& \\
00 \& |(100000)| \phantom{0} \& |(100001)| \phantom{0} \& |(100011)| \phantom{0} \& |(100010)| \phantom{0} \& \& |(110000)| \phantom{0} \& |(110001)| \phantom{0} \& |(110011)| \phantom{0} \& |(110010)| \phantom{0} \& \\
01 \& |(100100)| \phantom{0} \& |(100101)| \phantom{0} \& |(100111)| \phantom{0} \& |(100110)| \phantom{0} \& \& |(110100)| \phantom{0} \& |(110101)| \phantom{0} \& |(110111)| \phantom{0} \& |(110110)| \phantom{0} \& \\
11 \& |(101100)| \phantom{0} \& |(101101)| \phantom{0} \& |(101111)| \phantom{0} \& |(101110)| \phantom{0} \& \& |(111100)| \phantom{0} \& |(111101)| \phantom{0} \& |(111111)| \phantom{0} \& |(111110)| \phantom{0} \& \\
10 \& |(101000)| \phantom{0} \& |(101001)| \phantom{0} \& |(101011)| \phantom{0} \& |(101010)| \phantom{0} \& \& |(111000)| \phantom{0} \& |(111001)| \phantom{0} \& |(111011)| \phantom{0} \& |(111010)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \& \& \& \& \& \\
}%
\renewcommand{\@karnaughmap@local@maprealignmentx@}{2.5}%
\renewcommand{\@karnaughmap@local@maprealignmenty@}{-2.5}%
\fi
% [END]}
% test if a matrix template is found or not(aka "\@karnaughmap@local@matrixtemplate@" equals to '0')
\ifnum0=\@karnaughmap@local@matrixtemplate@
% print error if no template could be found
\PackageError{karnaugh-map}{%
Can not find a template fitting your specification (\@karnaughmap@var@mapsizex@\space x \@karnaughmap@var@mapsizey@\space x \@karnaughmap@var@mapsizez@)%
}{%
Existing templates have the following dimensions: 2x2x1, 2x4x1, 4x2x1, 4x4x1, 4x4x2, and 4x4x4.
}%
\fi
\begin{tikzpicture}
% grid
% for all dimensions
\draw[color=black, ultra thin] (0,0) grid (\@karnaughmap@var@mapsizex@,\@karnaughmap@var@mapsizey@);
% when there are 2 sub maps
\ifnum\@karnaughmap@var@mapsizez@=2
\draw[color=black, ultra thin] (5,0) grid (9,4);
\fi
% when there are 4 sub maps
\ifnum\@karnaughmap@var@mapsizez@=4
\draw[color=black, ultra thin] (5,0) grid (9,4);
\draw[color=black, ultra thin] (0,-5) grid (4,-1);
\draw[color=black, ultra thin] (5,-5) grid (9,-1);
\fi
% labels
% for all dimensions
\node[above] at (\@karnaughmap@var@mapsizex@*0.5,\@karnaughmap@var@mapsizey@+0.9) {\small{#5}};
\node[left] at (-0.9,\@karnaughmap@var@mapsizey@*0.5) {\small{#6}};
% when there are 2 sub maps
\ifnum\@karnaughmap@var@mapsizez@=2
\node[above] at (7,4.9) {\small{#5}};
% extra sub maps labels
\node[below] at (2,-0.1) {\small{#7$=0$}};
\node[below] at (7,-0.1) {\small{#7$=1$}};
\fi
% when there are 4 sub maps
\ifnum\@karnaughmap@var@mapsizez@=4
\node[above] at (7,4.9) {\small{#5}};
\node[left] at (-0.9,-3) {\small{#6}};
% extra sub maps labels
\node[below] at (2,-0.1) {\small{#7$=00$}};
\node[below] at (7,-0.1) {\small{#7$=01$}};
\node[below] at (2,-5.1) {\small{#7$=10$}};
\node[below] at (7,-5.1) {\small{#7$=11$}};
\fi
% data
\matrix[
matrix of nodes,
ampersand replacement=\&,
column sep={1cm,between origins},
row sep={1cm,between origins},
] at (\@karnaughmap@var@mapsizex@*0.5+\@karnaughmap@local@maprealignmentx@,\@karnaughmap@var@mapsizey@*0.5+\@karnaughmap@local@maprealignmenty@) {
\@karnaughmap@local@matrixtemplate@%
};
}{
\end{tikzpicture}
\endgroup
}
输出将是
我所做的就是重新排列该定义中的“模板”矩阵中的列。\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=442
不过,我只更改了下面的一个,因此如果您想要 4x4x4 设置,则需要进行更多修改。
完整的 LaTeX 示例代码:
\documentclass[tikz,border=5]{standalone}
\usepackage{karnaugh-map}
\makeatletter
\RenewDocumentEnvironment{karnaugh-map}{s O{4} O{4} O{1} O{$X_1X_0$} O{$X_3X_2$} O{$X_5X_4$}} {%
\begingroup
% store map size {[START]
\renewcommand{\@karnaughmap@var@mapsizex@}{#2}%
\renewcommand{\@karnaughmap@var@mapsizey@}{#3}%
\renewcommand{\@karnaughmap@var@mapsizez@}{#4}%
% [END]}
% determinate if markings should be color or black and white
\IfBooleanTF{#1}{%
% should be black and white
\renewcommand{\@karnaughmap@var@bw@}{1}%
}{%
% should be color
\renewcommand{\@karnaughmap@var@bw@}{0}%
}%
%
% find matching matrix template and alignment parameters {[START]
\newcommand{\@karnaughmap@local@matrixtemplate@}{0}% '0' is considered as missing matrix template
\newcommand{\@karnaughmap@local@maprealignmentx@}{0}%
\newcommand{\@karnaughmap@local@maprealignmenty@}{0}%
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=221
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 0 \& 1 \& \phantom{0} \\
0 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& \\
1 \& |(000010)| \phantom{0} \& |(000011)| \phantom{0} \& \\
\phantom{0} \& \& \& \\
}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=241
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 0 \& 1 \& \phantom{00} \\
00 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& \\
01 \& |(000010)| \phantom{0} \& |(000011)| \phantom{0} \& \\
11 \& |(000110)| \phantom{0} \& |(000111)| \phantom{0} \& \\
10 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& \\
\phantom{00} \& \& \& \\
}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=421
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 00 \& 01 \& 11 \& 10 \& \phantom{00} \\
0 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& |(000011)| \phantom{0} \& |(000010)| \phantom{0} \& \\
1 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& |(000111)| \phantom{0} \& |(000110)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \\
}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=441
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 00 \& 01 \& 11 \& 10 \& \phantom{00} \\
00 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& |(000011)| \phantom{0} \& |(000010)| \phantom{0} \& \\
01 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& |(000111)| \phantom{0} \& |(000110)| \phantom{0} \& \\
11 \& |(001100)| \phantom{0} \& |(001101)| \phantom{0} \& |(001111)| \phantom{0} \& |(001110)| \phantom{0} \& \\
10 \& |(001000)| \phantom{0} \& |(001001)| \phantom{0} \& |(001011)| \phantom{0} \& |(001010)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \\
}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=442
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 00 \& 01 \& 11 \& 10 \& \phantom{00} \& 10 \& 11 \& 01 \& 00 \& \phantom{00} \\
00 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& |(000011)| \phantom{0} \& |(000010)| \phantom{0} \& \& |(010010)| \phantom{0} \& |(010011)| \phantom{0} \& |(010001)| \phantom{0} \& |(010000)| \phantom{0} \& \\
01 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& |(000111)| \phantom{0} \& |(000110)| \phantom{0} \& \& |(010110)| \phantom{0} \& |(010111)| \phantom{0} \& |(010101)| \phantom{0} \& |(010100)| \phantom{0} \& \\
11 \& |(001100)| \phantom{0} \& |(001101)| \phantom{0} \& |(001111)| \phantom{0} \& |(001110)| \phantom{0} \& \& |(011110)| \phantom{0} \& |(011111)| \phantom{0} \& |(011101)| \phantom{0} \& |(011100)| \phantom{0} \& \\
10 \& |(001000)| \phantom{0} \& |(001001)| \phantom{0} \& |(001011)| \phantom{0} \& |(001010)| \phantom{0} \& \& |(011010)| \phantom{0} \& |(011011)| \phantom{0} \& |(011001)| \phantom{0} \& |(011000)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \& \& \& \& \& \\
}%
\renewcommand{\@karnaughmap@local@maprealignmentx@}{2.5}%
\fi
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=444
\renewcommand{\@karnaughmap@local@matrixtemplate@}{%
\& 00 \& 01 \& 11 \& 10 \& \phantom{00} \& 00 \& 01 \& 11 \& 10 \& \phantom{00} \\
00 \& |(000000)| \phantom{0} \& |(000001)| \phantom{0} \& |(000011)| \phantom{0} \& |(000010)| \phantom{0} \& \& |(010000)| \phantom{0} \& |(010001)| \phantom{0} \& |(010011)| \phantom{0} \& |(010010)| \phantom{0} \& \\
01 \& |(000100)| \phantom{0} \& |(000101)| \phantom{0} \& |(000111)| \phantom{0} \& |(000110)| \phantom{0} \& \& |(010100)| \phantom{0} \& |(010101)| \phantom{0} \& |(010111)| \phantom{0} \& |(010110)| \phantom{0} \& \\
11 \& |(001100)| \phantom{0} \& |(001101)| \phantom{0} \& |(001111)| \phantom{0} \& |(001110)| \phantom{0} \& \& |(011100)| \phantom{0} \& |(011101)| \phantom{0} \& |(011111)| \phantom{0} \& |(011110)| \phantom{0} \& \\
10 \& |(001000)| \phantom{0} \& |(001001)| \phantom{0} \& |(001011)| \phantom{0} \& |(001010)| \phantom{0} \& \& |(011000)| \phantom{0} \& |(011001)| \phantom{0} \& |(011011)| \phantom{0} \& |(011010)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \& \& \& \& \& \\
00 \& |(100000)| \phantom{0} \& |(100001)| \phantom{0} \& |(100011)| \phantom{0} \& |(100010)| \phantom{0} \& \& |(110000)| \phantom{0} \& |(110001)| \phantom{0} \& |(110011)| \phantom{0} \& |(110010)| \phantom{0} \& \\
01 \& |(100100)| \phantom{0} \& |(100101)| \phantom{0} \& |(100111)| \phantom{0} \& |(100110)| \phantom{0} \& \& |(110100)| \phantom{0} \& |(110101)| \phantom{0} \& |(110111)| \phantom{0} \& |(110110)| \phantom{0} \& \\
11 \& |(101100)| \phantom{0} \& |(101101)| \phantom{0} \& |(101111)| \phantom{0} \& |(101110)| \phantom{0} \& \& |(111100)| \phantom{0} \& |(111101)| \phantom{0} \& |(111111)| \phantom{0} \& |(111110)| \phantom{0} \& \\
10 \& |(101000)| \phantom{0} \& |(101001)| \phantom{0} \& |(101011)| \phantom{0} \& |(101010)| \phantom{0} \& \& |(111000)| \phantom{0} \& |(111001)| \phantom{0} \& |(111011)| \phantom{0} \& |(111010)| \phantom{0} \& \\
\phantom{00} \& \& \& \& \& \& \& \& \& \& \\
}%
\renewcommand{\@karnaughmap@local@maprealignmentx@}{2.5}%
\renewcommand{\@karnaughmap@local@maprealignmenty@}{-2.5}%
\fi
% [END]}
% test if a matrix template is found or not(aka "\@karnaughmap@local@matrixtemplate@" equals to '0')
\ifnum0=\@karnaughmap@local@matrixtemplate@
% print error if no template could be found
\PackageError{karnaugh-map}{%
Can not find a template fitting your specification (\@karnaughmap@var@mapsizex@\space x \@karnaughmap@var@mapsizey@\space x \@karnaughmap@var@mapsizez@)%
}{%
Existing templates have the following dimensions: 2x2x1, 2x4x1, 4x2x1, 4x4x1, 4x4x2, and 4x4x4.
}%
\fi
\begin{tikzpicture}
% grid
% for all dimensions
\draw[color=black, ultra thin] (0,0) grid (\@karnaughmap@var@mapsizex@,\@karnaughmap@var@mapsizey@);
% when there are 2 sub maps
\ifnum\@karnaughmap@var@mapsizez@=2
\draw[color=black, ultra thin] (5,0) grid (9,4);
\fi
% when there are 4 sub maps
\ifnum\@karnaughmap@var@mapsizez@=4
\draw[color=black, ultra thin] (5,0) grid (9,4);
\draw[color=black, ultra thin] (0,-5) grid (4,-1);
\draw[color=black, ultra thin] (5,-5) grid (9,-1);
\fi
% labels
% for all dimensions
\node[above] at (\@karnaughmap@var@mapsizex@*0.5,\@karnaughmap@var@mapsizey@+0.9) {\small{#5}};
\node[left] at (-0.9,\@karnaughmap@var@mapsizey@*0.5) {\small{#6}};
% when there are 2 sub maps
\ifnum\@karnaughmap@var@mapsizez@=2
\node[above] at (7,4.9) {\small{#5}};
% extra sub maps labels
\node[below] at (2,-0.1) {\small{#7$=0$}};
\node[below] at (7,-0.1) {\small{#7$=1$}};
\fi
% when there are 4 sub maps
\ifnum\@karnaughmap@var@mapsizez@=4
\node[above] at (7,4.9) {\small{#5}};
\node[left] at (-0.9,-3) {\small{#6}};
% extra sub maps labels
\node[below] at (2,-0.1) {\small{#7$=00$}};
\node[below] at (7,-0.1) {\small{#7$=01$}};
\node[below] at (2,-5.1) {\small{#7$=10$}};
\node[below] at (7,-5.1) {\small{#7$=11$}};
\fi
% data
\matrix[
matrix of nodes,
ampersand replacement=\&,
column sep={1cm,between origins},
row sep={1cm,between origins},
] at (\@karnaughmap@var@mapsizex@*0.5+\@karnaughmap@local@maprealignmentx@,\@karnaughmap@var@mapsizey@*0.5+\@karnaughmap@local@maprealignmenty@) {
\@karnaughmap@local@matrixtemplate@%
};
}{
\end{tikzpicture}
\endgroup
}
\makeatother
\begin{document}
\begin{karnaugh-map}[4][4][2][d,e][a,b][c ]
\minterms{1,2,4,7,12,18,22,24,26,27,31}
\maxterms{0,3,5,6,8,9,10,11,13,14,15,16,17,18,19,20,21,23,25,28,29,30}
\autoterms[X]
\implicant{4}{6}
\implicant{1}{5}
\implicant{3}{6}
\implicant{29}{29}
\end{karnaugh-map}
\end{document}