summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/karnaughmap
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-21 23:42:00 +0000
committerKarl Berry <karl@freefriends.org>2015-04-21 23:42:00 +0000
commitca0df6497bcdb1e76efe38af03eac5da6bfb3f20 (patch)
tree3c4448b281cf485a89add4f3f58f5f96671551a2 /Master/texmf-dist/tex/latex/karnaughmap
parente582c1ed07943cc8587a433d923c157b031a5762 (diff)
karnaughmap (21apr15)
git-svn-id: svn://tug.org/texlive/trunk@36989 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/karnaughmap')
-rw-r--r--Master/texmf-dist/tex/latex/karnaughmap/karnaughmap.sty579
1 files changed, 579 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/karnaughmap/karnaughmap.sty b/Master/texmf-dist/tex/latex/karnaughmap/karnaughmap.sty
new file mode 100644
index 00000000000..58c3e4fbebd
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/karnaughmap/karnaughmap.sty
@@ -0,0 +1,579 @@
+%%
+%% This is file `karnaughmap.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% karnaughmap.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% Copyright (C) 2013 by Michael Vonbun <michael.vonbun@tum.de>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.2 of this license
+%% or (at your option) any later version. The latest version of this
+%% license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.2 or later is part of all distributions of LaTeX version
+%% 1999/12/01 or later.
+%%
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{karnaughmap}
+ [2015/04/20 v2.0 draw karnaugh maps using tikz]
+\RequirePackage{tikz}
+\RequirePackage{xkeyval}
+\RequirePackage{ifthen}
+\RequirePackage{xstring}
+\newcounter{karnaughmapIdxCounter}
+\newcounter{karnaughmapStrCounter}
+\setcounter{karnaughmapIdxCounter}{0}
+\setcounter{karnaughmapStrCounter}{0}
+\define@boolkeys{karnaughmap}{omitzeros, omitones, omitdontcares}[true]
+\define@boolkeys{karnaughmap}{omitbinaries, omitvariables, omitidx, binaryidx, omitnegated}[true]
+\define@boolkey{karnaughmap}{outline}[true]{\setkeys{karnaughmap}{fill=false}}
+\define@boolkeys{karnaughmap}{fill}[true]
+\define@cmdkey{karnaughmap}{opacity}[0.5]{}
+\define@cmdkey{karnaughmap}{defaultmap}[16]{}
+\define@cmdkey{karnaughmap}{function}[z]{}
+\define@cmdkey{karnaughmap}{variables}[abcd]{}
+\define@cmdkey{karnaughmap}{dontcare}[*]{}
+\define@key{karnaughmap}{color}[black]{%
+ \colorlet{karnaughmapColor}{#1}%
+ \colorlet{karnaughmapMapColor}{#1}}
+\define@key{karnaughmap}{draw}[karnaughmapColor]{\colorlet{karnaughmapMapColor}{#1}}
+\define@key{karnaughmap}{labelcolor}[karnaughmapColor]{%
+ \colorlet{karnaughmapColor}{#1}}
+\define@cmdkeys{karnaughmap}{xshift,yshift}[0]
+\newcommand{\setkarnaughmap}[1][]{%
+\ifthenelse{\equal{#1}{}}{%
+\setkeys{karnaughmap}{%
+omitzeros, omitnegated}
+\setkeys{karnaughmap}{defaultmap, function, variables, dontcare, color, draw, labelcolor, xshift, yshift}
+}{
+\setkeys{karnaughmap}{#1}
+}}
+\setkarnaughmap
+\newcommand{\karnaughmapPrintIndex}[1][4]{%
+\scriptsize%
+\ifKV@karnaughmap@binaryidx
+ \ifthenelse{\equal{#1}{2}}{%
+ \ifcase\value{karnaughmapIdxCounter}%
+ 00\or 01\or 10\or 11
+ \fi
+ }{}%
+ \ifthenelse{\equal{#1}{3}}{%
+ \ifcase\value{karnaughmapIdxCounter}%
+ 000\or 001\or 010\or 011\or 100\or 101\or 110\or 111
+ \fi
+ }{}%
+ \ifthenelse{\equal{#1}{4}}{%
+ \ifcase\value{karnaughmapIdxCounter}%
+ 0000\or 0001\or 0010\or 0011\or 0100\or 0101\or 0110\or 0111\or
+ 1000\or 1001\or 1010\or 1011\or 1100\or 1101\or 1110\or 1111
+ \fi
+ }{}%
+\else
+$\thekarnaughmapIdxCounter$%
+\fi
+\stepcounter{karnaughmapIdxCounter}%
+}
+\newcommand{\karnaughmapPrintValue}[2][]{%
+ \stepcounter{karnaughmapStrCounter}%
+ \StrChar{#2}{\thekarnaughmapStrCounter}}
+\newcommand{\karnaughmapPrintCellContents}[6][]{%
+\ifthenelse{\equal{#4}{4}}{%
+ \def\karnaughmapPCCColumnSpecifier{++( 0,-1) node[#1] {#6}}%
+ \path (0, #5)
+ ++(#2,#3) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+1) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ;
+}{}
+\ifthenelse{\equal{#4}{8}}{%
+ \def\karnaughmapPCCColumnSpecifier{++( 0,-1) node[#1] {#6}}%
+ \path (0, #5)
+ ++(#2,#3) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+1) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+2,+1) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+1) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ;
+}{}
+\ifthenelse{\equal{#4}{16}}{%
+ \def\karnaughmapPCCColumnSpecifier{%
+ ++( 0,-1) node[#1] {#6}
+ ++( 0,-2) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ }%
+ \path (0, #5)
+ ++(#2,#3) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+2,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ;
+}{}
+\ifthenelse{\equal{#4}{32}}{%
+ \def\karnaughmapPCCColumnSpecifier{%
+ ++( 0,-1) node[#1] {#6}
+ ++( 0,-2) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ }%
+ \path (0, #5)
+ ++(#2,#3) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+2,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+5,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-2,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+2) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ;
+}{}
+\ifthenelse{\equal{#4}{64}}{%
+ \def\karnaughmapPCCColumnSpecifier{%
+ ++( 0,-1) node[#1] {#6}
+ ++( 0,-2) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ ++( 0,-5) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ ++( 0,+2) node[#1] {#6}
+ ++( 0,-1) node[#1] {#6}
+ }%
+ \path (0, #5)
+ ++(#2,#3) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+2,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+5,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-2,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ;
+}{}
+\ifthenelse{\equal{#4}{128}}{%
+ \def\karnaughmapPCCColumnSpecifier{%
+ ++( 0,-1) node[#1] {#6}
+ ++( 0,-2) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ ++( 0,-5) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ ++( 0,+2) node[#1] {#6}
+ ++( 0,-1) node[#1] {#6}
+ }%
+ \path (0, #5)
+ ++(#2,#3) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+2,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+5,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-2,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+10,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-2,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-5,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+2,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+5) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ;
+}{}
+\ifthenelse{\equal{#4}{256}}{%
+ \def\karnaughmapPCCColumnSpecifier{%
+ ++( 0,-1) node[#1] {#6}
+ ++( 0,-2) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ ++( 0,-5) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ ++( 0,+2) node[#1] {#6}
+ ++( 0,-1) node[#1] {#6}
+
+ ++( 0,-10) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ ++( 0,+2) node[#1] {#6}
+ ++( 0,-1) node[#1] {#6}
+ ++( 0,+5) node[#1] {#6}
+ ++( 0,-1) node[#1] {#6}
+ ++( 0,-2) node[#1] {#6}
+ ++( 0,+1) node[#1] {#6}
+ }%
+ \path (0, #5)
+ ++(#2,#3) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+2,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+5,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-2,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+10,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-2,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-5,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+1,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(+2,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ++(-1,+10) node[#1] {#6}
+ \karnaughmapPCCColumnSpecifier
+ ;
+}{}
+}
+
+\newcommand{\karnaughmapHighlightField}[3][]{%
+\ifKV@karnaughmap@fill
+ \path[fill=#3,opacity=\cmdKV@karnaughmap@opacity,#1] (#2) rectangle ++(1,1);%
+\fi
+\ifKV@karnaughmap@outline
+ \draw[#3,#1] (#2) ++ (0.1,0.1) rectangle ++(0.8,0.8);%
+\fi
+}
+\newcommand{\karnaughmapShadeMapfieldTWO}[3][]{%
+\begin{scope}[scale=1]
+ \ifthenelse{\equal{#2}{0}}{\karnaughmapHighlightField[#1]{0,1}{#3}}{}%
+ \ifthenelse{\equal{#2}{1}}{\karnaughmapHighlightField[#1]{0,0}{#3}}{}%
+ \ifthenelse{\equal{#2}{2}}{\karnaughmapHighlightField[#1]{1,1}{#3}}{}%
+ \ifthenelse{\equal{#2}{3}}{\karnaughmapHighlightField[#1]{1,0}{#3}}{}%
+\end{scope}
+}
+\newcommand{\karnaughmapShadeMapfieldTHREE}[3][]{%
+\begin{scope}[scale=1]
+ \ifthenelse{\equal{#2}{0}}{\karnaughmapHighlightField[#1]{0,1}{#3}}{}%
+ \ifthenelse{\equal{#2}{1}}{\karnaughmapHighlightField[#1]{0,0}{#3}}{}%
+ \ifthenelse{\equal{#2}{2}}{\karnaughmapHighlightField[#1]{1,1}{#3}}{}%
+ \ifthenelse{\equal{#2}{3}}{\karnaughmapHighlightField[#1]{1,0}{#3}}{}%
+ \ifthenelse{\equal{#2}{4}}{\karnaughmapHighlightField[#1]{3,1}{#3}}{}%
+ \ifthenelse{\equal{#2}{5}}{\karnaughmapHighlightField[#1]{3,0}{#3}}{}%
+ \ifthenelse{\equal{#2}{6}}{\karnaughmapHighlightField[#1]{2,1}{#3}}{}%
+ \ifthenelse{\equal{#2}{7}}{\karnaughmapHighlightField[#1]{2,0}{#3}}{}%
+\end{scope}
+}
+\newcommand{\karnaughmapShadeMapfieldFOUR}[3][]{%
+\begin{scope}[scale=1]%
+\ifthenelse{\equal{#2}{0}}{\karnaughmapHighlightField[#1]{0,3}{#3}}{}%
+\ifthenelse{\equal{#2}{1}}{\karnaughmapHighlightField[#1]{0,2}{#3}}{}%
+\ifthenelse{\equal{#2}{2}}{\karnaughmapHighlightField[#1]{0,0}{#3}}{}%
+\ifthenelse{\equal{#2}{3}}{\karnaughmapHighlightField[#1]{0,1}{#3}}{}%
+\ifthenelse{\equal{#2}{4}}{\karnaughmapHighlightField[#1]{1,3}{#3}}{}%
+\ifthenelse{\equal{#2}{5}}{\karnaughmapHighlightField[#1]{1,2}{#3}}{}%
+\ifthenelse{\equal{#2}{6}}{\karnaughmapHighlightField[#1]{1,0}{#3}}{}%
+\ifthenelse{\equal{#2}{7}}{\karnaughmapHighlightField[#1]{1,1}{#3}}{}%
+\ifthenelse{\equal{#2}{8}}{\karnaughmapHighlightField[#1]{3,3}{#3}}{}%
+\ifthenelse{\equal{#2}{9}}{\karnaughmapHighlightField[#1]{3,2}{#3}}{}%
+\ifthenelse{\equal{#2}{a}\OR\equal{#2}{A}}{\karnaughmapHighlightField[#1]{3,0}{#3}}{}%
+\ifthenelse{\equal{#2}{b}\OR\equal{#2}{B}}{\karnaughmapHighlightField[#1]{3,1}{#3}}{}%
+\ifthenelse{\equal{#2}{c}\OR\equal{#2}{C}}{\karnaughmapHighlightField[#1]{2,3}{#3}}{}%
+\ifthenelse{\equal{#2}{d}\OR\equal{#2}{D}}{\karnaughmapHighlightField[#1]{2,2}{#3}}{}%
+\ifthenelse{\equal{#2}{e}\OR\equal{#2}{E}}{\karnaughmapHighlightField[#1]{2,0}{#3}}{}%
+\ifthenelse{\equal{#2}{f}\OR\equal{#2}{F}}{\karnaughmapHighlightField[#1]{2,1}{#3}}{}%
+\end{scope}
+}
+\newcommand{\karnaughmap}[2][]{%
+\ifthenelse{\equal{#1}{}}{}{\setkeys{karnaughmap}{#1}}
+\def\karnaughmapCellEntries{#2}%
+\ifthenelse{\equal{#2}{}}{%
+ \def\karnaughmapSize{\cmdKV@karnaughmap@defaultmap}
+}{%
+\IfSubStr{\karnaughmapCellEntries}{ }{%
+\StrDel[0]{\karnaughmapCellEntries}{ }[\karnaughmapCellEntries]
+}{}
+ \StrLen{\karnaughmapCellEntries}[\karnaughmapSize]%
+ \ifthenelse{\karnaughmapSize < 4}{%
+ \def\karnaughmapSize{#2}\def\karnaughmapCellEntries{}}{}%
+}
+\ifKV@karnaughmap@omitzeros
+ \StrSubstitute[0]{\karnaughmapCellEntries}{0}{ }[\karnaughmapCellEntries]
+\fi
+\ifKV@karnaughmap@omitones
+ \StrSubstitute[0]{\karnaughmapCellEntries}{1}{ }[\karnaughmapCellEntries]
+\fi
+\ifKV@karnaughmap@omitdontcares
+ \StrSubstitute[0]{\karnaughmapCellEntries}{\cmdKV@karnaughmap@dontcare}{ }[\karnaughmapCellEntries]
+\fi
+\setcounter{karnaughmapIdxCounter}{0}
+\setcounter{karnaughmapStrCounter}{0}
+\ifthenelse{\karnaughmapSize = 4}{%
+ \StrChar{\cmdKV@karnaughmap@variables}{1}[\karnaughmapVarLabelA]
+ \def\karnaughmapVarLabelB{}
+ \StrChar{\cmdKV@karnaughmap@variables}{2}[\karnaughmapVarLabelC]
+ \def\karnaughmapVarLabelD{}
+ \def\karnaughmapNumRow{2}
+ \def\karnaughmapNumCol{2}
+ \def\karnaughmapNumVar{2}
+}{}
+\ifthenelse{\karnaughmapSize = 8}{%
+ \StrChar{\cmdKV@karnaughmap@variables}{1}[\karnaughmapVarLabelA]
+ \StrChar{\cmdKV@karnaughmap@variables}{2}[\karnaughmapVarLabelB]
+ \StrChar{\cmdKV@karnaughmap@variables}{3}[\karnaughmapVarLabelC]
+ \def\karnaughmapVarLabelD{}
+ \def\karnaughmapNumRow{2}
+ \def\karnaughmapNumCol{4}
+ \def\karnaughmapNumVar{3}
+}{}
+\ifthenelse{\karnaughmapSize = 16}{%
+ \StrChar{\cmdKV@karnaughmap@variables}{1}[\karnaughmapVarLabelA]
+ \StrChar{\cmdKV@karnaughmap@variables}{2}[\karnaughmapVarLabelB]
+ \StrChar{\cmdKV@karnaughmap@variables}{3}[\karnaughmapVarLabelC]
+ \StrChar{\cmdKV@karnaughmap@variables}{4}[\karnaughmapVarLabelD]
+ \def\karnaughmapNumRow{4}
+ \def\karnaughmapNumCol{4}
+ \def\karnaughmapNumVar{4}
+}{}
+\ifthenelse{\karnaughmapSize = 32}{%
+ \setkeys{karnaughmap}{omitidx=true, omitvariables=true}
+ \StrMid{\cmdKV@karnaughmap@variables}{1}{3}[\karnaughmapVarLabelA]
+ \def\karnaughmapVarLabelB{}
+ \StrMid{\cmdKV@karnaughmap@variables}{4}{5}[\karnaughmapVarLabelC]
+ \def\karnaughmapVarLabelD{}
+ \def\karnaughmapNumRow{4}
+ \def\karnaughmapNumCol{8}
+ \def\karnaughmapNumVar{5}
+}{}
+\ifthenelse{\karnaughmapSize = 64}{%
+ \setkeys{karnaughmap}{omitidx=true, omitvariables=true}
+ \StrMid{\cmdKV@karnaughmap@variables}{1}{3}[\karnaughmapVarLabelA]
+ \def\karnaughmapVarLabelB{}
+ \StrMid{\cmdKV@karnaughmap@variables}{4}{6}[\karnaughmapVarLabelC]
+ \def\karnaughmapVarLabelD{}
+ \def\karnaughmapNumRow{8}
+ \def\karnaughmapNumCol{8}
+ \def\karnaughmapNumVar{6}
+}{}
+\ifthenelse{\karnaughmapSize = 128}{%
+ \setkeys{karnaughmap}{omitidx=true, omitvariables=true}
+ \StrMid{\cmdKV@karnaughmap@variables}{1}{4}[\karnaughmapVarLabelA]
+ \def\karnaughmapVarLabelB{}
+ \StrMid{\cmdKV@karnaughmap@variables}{5}{7}[\karnaughmapVarLabelC]
+ \def\karnaughmapVarLabelD{}
+ \def\karnaughmapNumRow{8}
+ \def\karnaughmapNumCol{16}
+ \def\karnaughmapNumVar{7}
+}{}
+\ifthenelse{\karnaughmapSize = 256}{%
+ \setkeys{karnaughmap}{omitidx=true, omitvariables=true}
+ \StrMid{\cmdKV@karnaughmap@variables}{1}{4}[\karnaughmapVarLabelA]
+ \def\karnaughmapVarLabelB{}
+ \StrMid{\cmdKV@karnaughmap@variables}{5}{8}[\karnaughmapVarLabelC]
+ \def\karnaughmapVarLabelD{}
+ \def\karnaughmapNumRow{16}
+ \def\karnaughmapNumCol{16}
+ \def\karnaughmapNumVar{8}
+}{}
+ \begin{scope}[xshift=\cmdKV@karnaughmap@xshift,
+ yshift=\cmdKV@karnaughmap@yshift,
+ color=karnaughmapColor,
+ draw=karnaughmapMapColor ]
+ \draw (0,0) rectangle (\karnaughmapNumCol, \karnaughmapNumRow);
+ \foreach \x in {1,2,...,\karnaughmapNumCol} {%
+ \ifthenelse{\equal{\x}{1}}{}{%
+ \draw (\x-1,0) -- ++(0,\karnaughmapNumRow);%
+ }%
+ }%
+ \foreach \x in {1,2,...,\karnaughmapNumRow} {%
+ \ifthenelse{\equal{\x}{1}}{}{%
+ \draw (0,\x-1) -- ++(\karnaughmapNumCol,0);%
+ }%
+ }%
+\draw (0,\karnaughmapNumRow) -- ++(-0.4,0.4) coordinate(identifier)
+ -- ++(-0.4,0.4)
+ node[yshift=7.5,xshift=-3.5,right] {%
+ \ifthenelse{\equal{\cmdKV@karnaughmap@function}{}}{}{$\cmdKV@karnaughmap@function\colon$}};
+ \path (identifier) node[above right, xshift=-2.5] {$\karnaughmapVarLabelA\karnaughmapVarLabelB$};
+ \path (identifier) node[below left, yshift=0.5] {$\karnaughmapVarLabelC\karnaughmapVarLabelD$};
+\ifKV@karnaughmap@omitbinaries
+\else
+ \ifthenelse{\equal{\karnaughmapNumCol}{2}}{%
+ \foreach \pos/\lab in {0.5/0, 1.5/1} {%
+ \path (\pos, \karnaughmapNumRow) node[above] {$\lab$};%
+ }%
+ }{}%
+ \ifthenelse{\equal{\karnaughmapNumCol}{4}}{%
+ \foreach \pos/\lab in {0.5/00, 1.5/01, 2.5/11, 3.5/10} {%
+ \path (\pos, \karnaughmapNumRow) node[above] {$\lab$};%
+ }%
+ }{}%
+ \ifthenelse{\equal{\karnaughmapNumCol}{8}}{%
+ \foreach \pos/\lab in {0.5/000, 1.5/001, 2.5/011, 3.5/010, 4.5/110, 5.5/111, 6.5/101, 7.5/100} {%
+ \path (\pos, \karnaughmapNumRow) node[above] {$\lab$};%
+ }%
+ }{}%
+ \ifthenelse{\equal{\karnaughmapNumCol}{16}}{%
+ \foreach \pos/\lab in {0.5/0000, 1.5/0001, 2.5/0011, 3.5/0010, 4.5/0110, 5.5/0111, 6.5/0101, 7.5/0100,
+ 8.5/1100, 9.5/1101,10.5/1111,11.5/1110,12.5/1010,13.5/1011,14.5/1001,15.5/1000} {%
+ \path (\pos, \karnaughmapNumRow) node[above] {$\lab$};%
+ }%
+ }{}%
+ \ifthenelse{\equal{\karnaughmapNumRow}{2}}{%
+ \foreach \pos/\lab in {0.5/0, 1.5/1} {%
+ \path (0, \karnaughmapNumRow-\pos) node[left] {$\lab$};%
+ }%
+ }{}%
+ \ifthenelse{\equal{\karnaughmapNumRow}{4}}{%
+ \foreach \pos/\lab in {0.5/00, 1.5/01, 2.5/11, 3.5/10} {%
+ \path (0, \karnaughmapNumRow-\pos) node[left] {$\lab$};%
+ }%
+ }{}%
+ \ifthenelse{\equal{\karnaughmapNumRow}{8}}{%
+ \foreach \pos/\lab in {0.5/000, 1.5/001, 2.5/011, 3.5/010, 4.5/110, 5.5/111, 6.5/101, 7.5/100} {%
+ \path (-0.125, \karnaughmapNumRow-\pos) node[left] {$\lab$};%
+ }%
+ }{}%
+ \ifthenelse{\equal{\karnaughmapNumRow}{16}}{%
+ \foreach \pos/\lab in {0.5/0000, 1.5/0001, 2.5/0011, 3.5/0010, 4.5/0110, 5.5/0111, 6.5/0101, 7.5/0100,
+ 8.5/1100, 9.5/1101,10.5/1111,11.5/1110,12.5/1010,13.5/1011,14.5/1001,15.5/1000} {%
+ \path (-0.1875, \karnaughmapNumRow-\pos) node[left] {$\lab$};%
+ }%
+ }{}%
+\fi
+\def\karnaughmapVariableBaseBias{0.2}
+\ifKV@karnaughmap@omitbinaries
+ \def\karnaughmapVariableTopBias{0}
+ \def\karnaughmapVariableLeftBias{0}
+\else
+ \def\karnaughmapVariableTopBias{0.3}
+ \ifthenelse{\equal{\karnaughmapVarLabelD}{}}{%
+ \def\karnaughmapVariableLeftBias{0.2}
+ }{%
+ \def\karnaughmapVariableLeftBias{0.4}
+ }
+\fi
+\ifKV@karnaughmap@omitvariables
+\else
+ \ifthenelse{\equal{\karnaughmapVarLabelA}{}}{%
+ }{%
+ \ifthenelse{\equal{\karnaughmapVarLabelB}{}}{%
+ \draw (1.1, \karnaughmapNumRow + \karnaughmapVariableBaseBias + \karnaughmapVariableTopBias)
+ -- node[above] {$\karnaughmapVarLabelA$} ++(0.8, 0);
+ \ifKV@karnaughmap@omitnegated
+ \else
+ \draw (0.1, \karnaughmapNumRow + \karnaughmapVariableBaseBias + \karnaughmapVariableTopBias)
+ -- node[above] {$\overline{\karnaughmapVarLabelA}$} ++(0.8, 0);
+ \fi
+ }{%
+ \draw (2.1, \karnaughmapNumRow + \karnaughmapVariableBaseBias + \karnaughmapVariableTopBias)
+ -- node[above] {$\karnaughmapVarLabelA$} ++(1.8, 0);
+ \draw (1.1, -\karnaughmapVariableBaseBias)
+ -- node[below] {$\karnaughmapVarLabelB$} ++(1.8, 0);
+ \ifKV@karnaughmap@omitnegated
+ \else
+ \draw (0.1, \karnaughmapNumRow + \karnaughmapVariableBaseBias + \karnaughmapVariableTopBias)
+ -- node[above] {$\overline{\karnaughmapVarLabelA}$} ++(1.8, 0);
+ \draw (0.1, -\karnaughmapVariableBaseBias)
+ -- node[below] {$\overline{\karnaughmapVarLabelB}$} ++(0.8, 0);
+ \draw (3.1, -\karnaughmapVariableBaseBias)
+ -- node[below] {$\overline{\karnaughmapVarLabelB}$} ++(0.8, 0);
+ \fi
+ }
+ }
+ \ifthenelse{\equal{\karnaughmapVarLabelC}{}}{%
+ }{%
+ \ifthenelse{\equal{\karnaughmapVarLabelD}{}}{%
+ \draw (-\karnaughmapVariableBaseBias -\karnaughmapVariableLeftBias, 0.1)
+ -- node[left] {$\karnaughmapVarLabelC$} ++(0, 0.8);
+ \ifKV@karnaughmap@omitnegated
+ \else
+ \draw (-\karnaughmapVariableBaseBias -\karnaughmapVariableLeftBias, 1.1)
+ -- node[left] {$\overline{\karnaughmapVarLabelC}$} ++(0, 0.8);
+ \fi
+ }{%
+ \draw (-\karnaughmapVariableBaseBias -\karnaughmapVariableLeftBias, 0.1)
+ -- node[left] {$\karnaughmapVarLabelC$} ++(0, 1.8);
+ \draw (\karnaughmapNumCol + \karnaughmapVariableBaseBias, 1.1)
+ -- node[right] {$\karnaughmapVarLabelD$} ++(0, 1.8);
+ \ifKV@karnaughmap@omitnegated
+ \else
+ \draw (-\karnaughmapVariableBaseBias -\karnaughmapVariableLeftBias, 2.1)
+ -- node[left] {$\overline{\karnaughmapVarLabelC}$} ++(0, 1.8);
+ \draw (\karnaughmapNumCol + \karnaughmapVariableBaseBias, 0.1)
+ -- node[right] {$\overline{\karnaughmapVarLabelD}$} ++(0, 0.8);
+ \draw (\karnaughmapNumCol + \karnaughmapVariableBaseBias, 3.1)
+ -- node[right] {$\overline{\karnaughmapVarLabelD}$} ++(0, 0.8);
+ \fi
+ }
+ }
+\fi
+\ifKV@karnaughmap@omitidx
+\else
+ \karnaughmapPrintCellContents[anchor=west]{0.0}{-0.2}{\karnaughmapSize}{\karnaughmapNumRow}{\karnaughmapPrintIndex[\karnaughmapNumVar]}
+\fi
+\karnaughmapPrintCellContents{0.5}{-0.5}{\karnaughmapSize}{\karnaughmapNumRow}{\karnaughmapPrintValue{\karnaughmapCellEntries}}
+ \end{scope}
+}
+\newcommand{\karnaughmapcolorfield}[4][]{%
+\setkeys{karnaughmap}{fill,opacity}%
+\ifthenelse{\equal{#1}{}}{}{\setkeys*{karnaughmap}{#1}}%
+\ifthenelse{\equal{#3}{}}{}{%
+\StrSplit{#3}{1}{\karnaughmapColorfieldCur}{\karnaughmapColorfieldRem}
+\ifthenelse{\equal{#2}{2}}{%
+\karnaughmapShadeMapfieldTWO[\XKV@rm]{\karnaughmapColorfieldCur}{#4}
+}{}
+\ifthenelse{\equal{#2}{3}}{%
+\karnaughmapShadeMapfieldTHREE[\XKV@rm]{\karnaughmapColorfieldCur}{#4}
+}{}
+\ifthenelse{\equal{#2}{4}}{%
+\karnaughmapShadeMapfieldFOUR[\XKV@rm]{\karnaughmapColorfieldCur}{#4}
+}{}
+\karnaughmapcolorfield[#1]{#2}{\karnaughmapColorfieldRem}{#4}
+}
+}
+\endinput
+%%
+%% End of file `karnaughmap.sty'.