0

I'm trying to draw a KMap with the miniterms index in it like this;

enter image description here

The closest I am to this is the following code:

\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}

All I need is adding those mininumbers to the topright corner of each cell, forget about making the red and yellow boxes, I am okay with the implicant desing I have.

ElSabio
  • 361

1 Answers1

1

Assuming you use kvmap you can rely on it being a TikZ package and loop over a list mapping the cell to its value.

numbers

\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}
TeXnician
  • 33,589