Alterar a ordem de negação do karnaughmap tikzpicture

Alterar a ordem de negação do karnaughmap tikzpicture

Eu sei que já existem ótimas perguntas de Karnaugh por aí, mas a minha é especificamente sobre reordenar as negações de um karnaughmapmapa.

Atualmente estou usando okarnaughmap-Pacote de Michael Vonbun mas não estou vinculado a este pacote. O pacote é bastante fácil de usar e eu já conseguitipo dereproduzir o que eu estava procurando:

imagem do Diagrama KV desenhado à mão imagem do diagrama TikZ KV

Este é o meu código LaTeX:

\documentclass{article}
\usepackage{karnaughmap}

\begin{document}

    \begin{tikzpicture}[thick]
    \karnaughmapcolorfield{4}{028a}{violet!50}

    \karnaughmap
    [omitidx,omitbinaries,
    omitnegated=false,
    variables={{x_0}{x_2}{x_1}{x_3}},
    function=y_0]
    {1010 0000 1010 0000}
    % i actually want to display 1111 0000 0000 0000
    \end{tikzpicture}

\end{document}

veja o resultado em sharelatex.com

Estou fazendo mau uso da nomenclatura da variável e do binário para obter a nomenclatura no sentido anti-horário. Eu estava bem com isso até descobrir que as barras de negação de x_0 e x_1 estão desativadas. Isso significa que os valores de verdade internos não fazem sentido algum.

Como posso mover a barra de negação de x_0 à esquerda para x_0 à direita?

Não tenho mais ou menos nenhuma experiência com TikZ e é por isso que usei um pacote para isso.

Odocumentação do pacoteafirma na página 36 nas notas de tarefas que atualmente não há possibilidade de permutar o mapa Karnaugh por meio da interação direta do TikZ.

Meu gol:

imagem manipulada do diagrama TikZ KV

feito através de manipulação de imagem, seta vermelha mostra o que mudou

Responder1

Eu adaptei minha resposta emDesenhando mapas de Karnaugh em LaTeXpara atender às suas necessidades.

\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 sep=-\pgflinewidth,
         row sep=-\pgflinewidth,
         every node/.style={draw, minimum size=8mm, outer sep=0pt},
         row 1/.style={every node/.style={draw=none, minimum size=8mm, outer sep=0pt}},
         column 1/.style={every node/.style={draw=none, minimum size=8mm, outer sep=0pt}},
        ampersand replacement=\&]
{
|[draw=none]| \&[2mm] |(c01)| \& |(c11)| \& |(c10)| \& |(c00)| \\[2mm]
|(r01)| \& |(3)|  \& |(7)|  \& |(6)|  \& |(2)|  \\
|(r11)| \& |(11)| \& |(15)| \& |(14)| \& |(10)| \\
|(r10)| \& |(9)|  \& |(13)| \& |(12)| \& |(8)|  \\
|(r00)| \& |(1)|  \& |(5)|  \& |(4)|  \& |(0)|  \\
};
\draw (3.north west) -- node [pos=0.7,above right,anchor=south west, inner sep=1pt] {$x_2x_0$} node [pos=0.7,below left,anchor=north east, inner sep=1pt] {$x_3x_1$} ++(135:1);

\draw ([xshift=1mm]c01.south west)--node[above] {$x_0$} ([xshift=-1mm]c11.south east);
\draw ([xshift=1mm]c10.south west)--node[above] {$\overline{x_0}$} ([xshift=-1mm]c00.south east);
\draw ([yshift=-1mm]r01.north east)--node[left] {$x_1$} ([yshift=1mm]r11.south east);
\draw ([yshift=-1mm]r10.north east)--node[left] {$\overline{x_1}$} ([yshift=1mm]r00.south east);
\draw ([shift={(2mm,-1mm)}]2.north east)--node[right] {$\overline{x_3}$} ([shift={(2mm,1mm)}]2.south east);
\draw ([shift={(2mm,-1mm)}]10.north east)--node[right] {$x_3$} ([shift={(2mm,1mm)}]8.south east);
\draw ([shift={(2mm,-1mm)}]0.north east)--node[right] {$\overline{x_3}$} ([shift={(2mm,1mm)}]0.south east);
\draw ([shift={(1mm,-2mm)}]1.south west)--node[below] {$\overline{x_2}$} ([shift={(-1mm,-2mm)}]1.south east);
\draw ([shift={(1mm,-2mm)}]5.south west)--node[below] {$x_2$} ([shift={(-1mm,-2mm)}]4.south east);
\draw ([shift={(1mm,-2mm)}]0.south west)--node[below] {$\overline{x_2}$} ([shift={(-1mm,-2mm)}]0.south east);

}%
{
\end{tikzpicture}
}

%Defines 8 or 16 values (0,1,X)
\newcommand{\contingut}[1]{%
\foreach \x [count=\xi from 0]  in {#1}
     \path (\xi) node {\x};
}

%color fields
%#1 - comma separated list of filling terms. 
%#2 - filling color
\newcommand{\colorfields}[2]{%
\foreach \i in {#1}
   \fill[#2, opacity=.3] (\i.north west) rectangle (\i.south east);
}

%Places 1 in listed positions
\newcommand{\minterms}[1]{%
    \foreach \x in {#1}
        \path (\x) node {1};
}

%Places 0 in listed positions
\newcommand{\maxterms}[1]{%
    \foreach \x in {#1}
        \path (\x) node {0};
}

%Places X in listed positions
\newcommand{\indeterminats}[1]{%
    \foreach \x in {#1}
        \path (\x) node {X};
}

\begin{document}
\begin{Karnaugh}
\minterms{0,1,2,3}
\colorfields{0,1,2,3}{red}
\end{Karnaugh}
\end{document}

insira a descrição da imagem aqui

informação relacionada