# Draw A Karnaugh Map with variables in the order 0132

I would like to draw a table-like diagram called a Karnaugh map. These diagrams can have information about how the inputs and outputs of a circuit. Each Letter represents that input being true. Each entry in the diagram is an output, that is the value of the variable it is nearest. There are two main ways to sort the entries in a Karnaugh map. I want the outputs to be sorted in a special way so that the indices of the first row of a 2x4 map (like a 2x4 array) are 0 1 3 2, rather than the default 0 2 6 4 that some packages give.

Note that in all Karnaugh maps, the entries are always out of order (that is, not arranged 0 1 2 3) on purpose because the ordering of the bits is what is important.

I would like my diagram to look like this (note the small number begin 0 1 3 2...)

Here is what I have so far, a Karnaugh map with entries in order 0 2 6 4 (see the small numbers):

\documentclass{article}
\usepackage{karnaughmap}
\begin{document}

\begin{tikzpicture}[thick]
\karnaughmap[defaultmap=8]{01234567}
\end{tikzpicture}
\end{document}


This is in accordance with the package manual but not with my desired ordering. The manual is available at

http://mirrors.ctan.org/graphics/pgf/contrib/karnaughmap/karnaughmap.pdf

and does not mention reordering. I am open to using another package.

• Welcome to TeX.SX! Please provide a MWE (meta.tex.stackexchange.com/questions/228/…). – TeXnician Feb 8 '17 at 7:03
• Welcome to TeX.SE. Please always add a MWE (Minimal Working Example), which is compilable (hence the "Working"), so your code example should start with \documentclass and end in \end{document}. This helps us to help you. Personally, I a no expert in Karnaugh. Maybe an even broader description of the problem---what you want to do, want you expect to get, what you instead got---could be of great help. – Jan Feb 8 '17 at 7:04
• Thank you, I added a functioning example. Sorry, Karnaugh maps are used to help visual circuit inputs and outputs but as far as the diagram goes I just need a grid with some appropriate numbers in it. Oh, and I know how to edit the big numbers, just the small ones are pre-coded by the plugin. Thanks Jan. – Joshua Satterfield Feb 8 '17 at 7:20
• The Karnaugh maps in my answer use your desired cell order: tex.stackexchange.com/a/140581/1952 – Ignasi Feb 8 '17 at 7:51
• Thank you Ignasi. Do you include it with \input? – Joshua Satterfield Feb 8 '17 at 8:17