Tikz 自动机:使标签更加清晰(不重叠)

Tikz 自动机:使标签更加清晰(不重叠)

我有以下代码:

\begin{tikzpicture} [shorten >=1pt, node distance=4cm, auto]
    \node [state, initial]   (00)                 {$(0, 0)$};
    \node [state]            (10) [right = of 00] {$(1, 0)$};
    \node [state]            (20) [right = of 10] {$(2, 0)$};
    \node [state]            (01) [above = of 00] {$(0, 1)$};
    \node [state]            (11) [right = of 01] {$(1, 1)$};
    \node [state, accepting] (21) [right = of 11] {$(2, 1)$};

    \path [->]
        (00) edge              node {a, b} (21)
        (10) edge              node {a}    (01)
        (11) edge [bend right] node {b}    (10)
        (10) edge [bend right] node {b}    (11)
        (20) edge              node {a}    (11)
        (20) edge [bend right] node {b}    (21)
        (01) edge              node {a, b} (20)
        (11) edge              node {a}    (00)
        (21) edge              node {a}    (10)
        (21) edge [bend right] node {b}    (20);
\end{tikzpicture}

绘制结果如下: 自动机

现在,如何在不改变节点位置的情况下确保标签清晰可读?

答案1

有了它possloped我现在能够让它看起来更有吸引力了。但我相信你可以让它看起来更赏心悦目。

\begin{tikzpicture} [shorten >=1pt, node distance=4cm, auto]
    \node [state, initial]   (00)                 {$(0, 0)$};
    \node [state]            (10) [right = of 00] {$(1, 0)$};
    \node [state]            (20) [right = of 10] {$(2, 0)$};
    \node [state]            (01) [above = of 00] {$(0, 1)$};
    \node [state]            (11) [right = of 01] {$(1, 1)$};
    \node [state, accepting] (21) [right = of 11] {$(2, 1)$};

    \path [->]
        (00) edge [pos=.15, sloped]    node {a, b} (21)
        (10) edge [pos=.15, sloped]    node {a}    (01)
        (11) edge [bend right]         node {b}    (10)
        (10) edge [bend right]         node {b}    (11)
        (20) edge [near start, sloped] node {a}    (11)
        (20) edge [bend right]         node {b}    (21)
        (01) edge [pos=.15, sloped]    node {a, b} (20)
        (11) edge [pos=.15, sloped]    node {a}    (00)
        (21) edge [near start, sloped] node {a}    (10)
        (21) edge [bend right]         node {b}    (20);
\end{tikzpicture}

更加美观的自动机

相关内容