# Tag Info

## Hot answers tagged karnaugh

53

I've added a filling color to the code proposed on remove vertical lines for table. It works well for all groups although I must admit that \implicantcantons (group 4 corners on a 16 positions map) needs some improvement. EDIT: I've also added a 2x2 Karnaugh map and command \implicantsol to mark isolated elements. EDIT 2: Solved the problem with \...

21

Some days ago (Nov. 26), Mat­tias Ja­cob­s­son uploaded his karnaugh-map package to CTAN. Now instead of the code in my alternative answer you can use a real package. karnaugh-map is also based in TikZ and can draw maps from two to six variables, being four the number for the default map. Maps for five and six variables are drawn with two (or four) four ...

20

Ben Frank was kind enough to package this answer and put it on CTAN (package kvmap). With the kvmap package you can input your Karnaugh map like a tabular. This works even for very large sizes (I just tested 64x64 fields), so it is definitely able to typeset an 8x8 map. If you want to draw implicants you can use the \bundle macro and pass the coordinates ...

9

The command in karnaugh-map responsible for the colors looks as follows: \newcommand{\@karnaughmap@func@decimaltocolor@}[1]{% \ifnum#1=0 red\fi \ifnum#1=1 green\fi \ifnum#1=2 yellow\fi \ifnum#1=3 cyan\fi \ifnum#1=4 blue\fi \ifnum#1=5 magenta\fi \ifnum#1>5 cyan\fi } To extend the colors, add the following lines after loading the package. \...

5

This is a completely different approach taken from my answer at How to draw a 8x8 Karnaugh map in LaTeX?. It does also show some different outcome, but as a personal preference I find it more comfortable (at least the drawing part in the document). \documentclass{article} \usepackage{kvmap} \begin{document} \begin{kvmap} \begin{kvmatrix}{x_0,x_2,...

5

Here is an example of using tikzmark: Note: This does require two runs. First one to determine the locations, and the second to do the drawing. The \tikzmark is from Adding a large brace next to a body of text. Also, I don't know how those coordinates were determined so I just piggy backed onto the existing nodes so added the tikzmark to 13 and 11 and ...

5

Coloring is turned off when adding an asterisk to the environment. See the documentation for more information. Therefore remove the asterisk when you begin the karnaugh-map environment making your environment line; \begin{karnaugh-map}[4][2][1][$yz$][$x$] This is not directly supported by the package. Fortunately this could manually be done with version v1....

4

According to the documentation (see here) removing the star at the start of the karnaugh-map environment is the right way. It should be \begin{karnaugh-map}[4][2][1][$yz$][$x$] then. Without making changes to the source code of the package itself this does not seem to be possible as the positions for the labels are "hardcoded" (source code). If you comment ...

4

There is no karnaugh.sty file in the TeX distributions. You have to say \input{kvmacros} in order to load it. Actually, the documentation says \input kvmacros, as this works also in Plain TeX, but the syntax with braces is preferred in LaTeX.

4

In the manual (see karnaugh-map) you find how to draw implicants in the section Implicants;-). For your example you can do something like \begin{karnaugh-map} \manualterms{1,0,0,1,0,0,0,0,1,1,1,1,0,1,1,1} \implicant{13}{11} \implicant{15}{10} \implicantedge{0}{0}{8}{8} \implicantedge{3}{3}{11}{11} \end{karnaugh-map}

3

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: \RenewDocumentEnvironment{karnaugh-map}{s O{4} O{4} O{1} O{$... 3 A simple version to overlay your map is to use tikzmark (although your Karnaugh map does not really look nice). For ease of use I made all columns with bits equally wide (you may want to add some height with \extrarowheight or stretch the table using \arraystretch). \documentclass{article} \usepackage{array} \usepackage{tikz} \usetikzlibrary{tikzmark} \... 3 You should use MiKTeX’s own method for installing packages.1 Anyway, here’s what I get on a TeX Live distribution; apart from the starting point (here texmf-dist), the rest should be the same on MiKTeX: Included files, by type: run files: texmf-dist/tex/latex/karnaugh-map/karnaugh-map.sty source files: texmf-dist/source/latex/karnaugh-map/karnaugh-map.... 2 I've adapted my answer in Drawing Karnaugh's maps in LaTeX to fit your needs. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{matrix} %Empty Karnaugh map 4x4 \newenvironment{Karnaugh}% { \begin{tikzpicture}[baseline=(current bounding box.north),scale=0.8] \matrix (mapa) [matrix of nodes, nodes in empty cells, column ... 2 You can put your Karnaugh Map Code between a \begin{center} ... \end{center} environment. \documentclass[legalpaper, 12pt, addpoints]{exam} \usepackage{tikz} \usepackage{karnaugh-map} \CorrectChoiceEmphasis{\itseries\color{red}} \begin{document} \begin{questions} \question The following is a 2x4 k-map: \begin{center} \... 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. \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}... 1 I solved the problem by putting the maps inside a figure and using the subfigure command. Here's the code: \begin{figure} \begin{subfigure}[b]{0.4\textwidth} \begin{karnaugh-map}*[4][4][1][$ab$][$cd\$] \minterms{0,2, 4,9,10} \implicant{4}{7} \end{karnaugh-map} \caption{AAA} \end{subfigure} ...

Only top voted, non community-wiki answers of a minimum length are eligible