karnaughmap tikzpicture의 부정 순서 변경

karnaughmap tikzpicture의 부정 순서 변경

나는 이미 훌륭한 Karnaugh-Questions가 있다는 것을 알고 있지만 내 것은 특히 karnaughmap-Map의 부정을 재정렬하는 것에 관한 것입니다.

나는 현재 다음을 사용하고 있습니다.karnaughmap-Michael Vonbun의 패키지이지만 저는 이 패키지에 구속되지 않습니다. 패키지는 사용하기 매우 쉽고 이미 사용할 수 있었습니다.일종의내가 찾고 있던 것을 재현하십시오.

손으로 그린 ​​KV 다이어그램 이미지 TikZ KV 다이어그램 이미지

이것은 내 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}

sharelatex.com에서 결과 보기

시계 반대 방향 이름을 얻기 위해 변수 이름 지정과 바이너리를 잘못 사용하고 있습니다. x_0과 x_1의 부정 막대가 꺼져 있다는 것을 발견하기 전까지는 괜찮았습니다. 이는 내부의 진리값이 전혀 의미가 없다는 것을 의미합니다.

부정 표시줄을 왼쪽 x_0에서 오른쪽 x_0으로 어떻게 이동할 수 있나요?

나는 TikZ 경험이 거의 없기 때문에 패키지를 사용했습니다.

그만큼패키지 문서todo-notes의 36페이지에는 현재 직접적인 TikZ 상호 작용을 통해 karnaugh 맵을 변경할 가능성이 없다고 명시되어 있습니다.

내 목표:

TikZ KV 다이어그램의 조작된 이미지

이미지 조작을 통해 수행되었으며 빨간색 화살표는 변경된 내용을 보여줍니다.

답변1

나는 내 대답을 다음과 같이 조정했습니다.LaTeX에서 Karnaugh의 지도 그리기귀하의 필요에 맞게.

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

여기에 이미지 설명을 입력하세요

관련 정보