1

I came across an excellent solution provided by user Ignasi for drawing Karnaugh maps in LaTeX. The original code can be found here.

I need to modify this code to support edge grouping for an 8-cell Karnaugh map, like this: required output I've tried a few modifications, but I'm facing difficulties in achieving the desired result. I tried using karnaugh-map package but it keep grouping in cell 5 and 7 which should not happen here.

\documentclass[tikz, border=2mm]{standalone}
\usepackage{karnaugh-map}
    \begin{document}   
        \begin{karnaugh-map}[4][2][1][$X_1X_0$][$X_2$]
            \minterms{4,6}
            \maxterms{0,2,3,7}
            \indeterminants{1,5}
            \implicant{4}{6}
         \end{karnaugh-map}
    \end{document}

Error while using karnaugh-map package

Could someone help me adapt the existing code for edge grouping in an 8-cell Karnaugh map? Any insights, suggestions, or modified code snippets would be greatly appreciated.

Alan
  • 209

1 Answers1

4
\documentclass[tikz, border=2mm]{standalone}
\usepackage{karnaugh-map}
\begin{document}
    \begin{karnaugh-map}[4][2][1][$X_1X_0$][$X_2$]
      \minterms{4,6}
      \maxterms{0,2,3,7}
      \indeterminants{1,5}
      \implicant{4}{6}
    \end{karnaugh-map}

    \begin{karnaugh-map}[4][2][1][$X_1X_0$][$X_2$]     
      \minterms{4,6}
      \maxterms{0,2,3,7}
      \indeterminants{1,5}
      \implicantedge{4}{4}{6}{6}
    \end{karnaugh-map}
  \end{document}

yields these two outputs, of which the second is the one you seek:

enter image description here