I was trying to draw in Lyx a Karnaugh map in 5 variables, so I looked around the site and looked for some sort of solution and I came across the karnaugh-map package. And I tried to draw the map for the function Σ(1,2,4,7,12,18,22,24,26,27,31) and this is what I got
This package draws incredibly K-maps of 2,3,4 variables. However, at 5 variables it basically duplicates the 4 variable map, which causes a big problem – The order isn't correct. The first row for example is 0132 5687 which is problematic as there's more than a one digit difference between 2 and 5. I need it in the format 0132 6754 (the way I was taught) meaning the right table is in the order 10 11 01 00 instead.
Another smaller problem I have is that it auto-generates only 2 digits at the top instead of 3 digits. This is okay as I'm supposed to adress the third variable at the bottom (as I did).
Is there anything I can do to adress my (main) problem? Thanks in advance.
EDIT: The code I used to draw this diagram
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}
Best Answer
Not sure I fully understood you, but the order of the columns is hardcoded in the definition of the
karnaugh-map
environment, so in order to change it you need to change that definition. Add the following code block after\usepackage{karnaugh-map}
, in Document --> Settings --> LaTeX preamble:The output will then be
What I did was to rearrange the columns in the "template" matrices found in that definition. I only changed the one under
\ifnum\@karnaughmap@var@mapsizex@\@karnaughmap@var@mapsizey@\@karnaughmap@var@mapsizez@=442
though, so if you want a 4x4x4 setup more modifications are needed.Complete LaTeX example code: