是否可以将这两个值对齐放在一起? \usetikzlibrary{automata}

是否可以将这两个值对齐放在一起? \usetikzlibrary{automata}

这看起来不错,但只是出于好奇。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\begin{document}
\begin{tikzpicture}[->,node distance=1cm,auto,shorten >=2pt,>=stealth',state/.style=state with output,blue]
    \node[state,initial]    at(0,0) (A) {$A$\nodepart{lower} $0$};
    \node[state]    at  (3,0) (B){$B$ \nodepart{lower} $0$};
    \node[state]    at (3,-3) (C){$C$ \nodepart{lower} $1$};
    \node[state]    at (0,-3) (D){$D$ \nodepart{lower} $1$};

    \path[red,very thick]       
            (A) edge [bend left] node  {10}(B)
            (A) edge [bend left] node [below] {11} (B)
                edge[loop above] node {01} (A)
                edge[loop above] node[left, near start] {00} (A)
            (B) edge [bend left] node {01} (C)
            (B) edge [bend left] node {00} (A)
                edge [loop above] node {10} (B)
                edge[loop above] node[right, near end] {11} (B)
            (C) edge [bend left] node {01} (D)
            (C) edge [bend left] node [above]{00} (D)
                edge [loop below] node {11} (C)
                edge[loop below] node[right, near start] {00} (C)
            (D) edge  [bend left] node{01} (A)
            (D) edge  [bend left] node{00} (C)
                edge [loop below] node {11} (D)
                edge[loop below] node[left, near end] {10} (D);
\end{tikzpicture}
\end{document}

算命先生

答案1

\begin{tikzpicture}[->,node distance=1cm,auto,shorten >=2pt,>=stealth',state/.style=state with output,blue]
    \node[state,initial]    at(0,0) (A) {$A$\nodepart{lower} $0$};
    \node[state]    at  (3,0) (B){$B$ \nodepart{lower} $0$};
    \node[state]    at (3,-3) (C){$C$ \nodepart{lower} $1$};
    \node[state]    at (0,-3) (D){$D$ \nodepart{lower} $1$};

    \path[red,very thick]       
            (A) edge [bend left] node  {10}(B)
            (A) edge [bend left] node [below] {11} (B)
                edge[loop above] node[align=center] {01\\00} (A)
            (B) edge [bend left] node {01} (C)
            (B) edge [bend left] node {00} (A)
                edge [loop above] node[align=center] {10\\11} (B)
            (C) edge [bend left] node {01} (D)
            (C) edge [bend left] node [above]{00} (D)
                edge [loop below] node [align=center]{11\\00} (C)
            (D) edge  [bend left] node{01} (A)
            (D) edge  [bend left] node{00} (C)
                edge [loop below] node[align=center] {11\\10} (D);
\end{tikzpicture}

解决了

相关内容