数学错误:未知函数“q_1”

数学错误:未知函数“q_1”
\begin{tikzpicture}[shorten >=1pt,node distance=3cm,on grid,auto]
  \node[state,initial]   (q_1,q_4)    {$q_1$,$q_4$};
  \node[state]           (q_2,q_5) [right=of (q_1,q_4)] {$q_2$,$q_5$};
  \node[state,accepting]           (q_3,q_6) [right=of (q_2,q_5)] {$q_3$,$q_6$};
  \node[state]           (q_3,q_7) [right=of (q_3,q_6)] {$q_3$,$q_7$};
  \node[state]           (q_2,q_4) [below=of (q_1,q_4)] {$q_2$,$q_4$};
  \node[state,accepting]           (q_3,q_5) [below=of (q_2,q_4)] {$q_3$,$q_5$};
  \node[state,accepting]           (q_3,q_4) [below=of (q_3,q_6)] {$q_3$,$q_4$};

  \path[->] (q_1,q_4) edge        [bend right=30]    node[above][align=center] {a} (q_2,q_5)
                      edge     node {b} (q_2,q_4)
            (q_2,q_5) edge      [bend left=30]       node[below] {b} (q_1,q_4)
                      edge  [bend right=30] node[above] {a} (q_3,q_6)
            (q_3,q_6) edge  [bend right=30]    node[text width=1cm,align=center] {a} (q_3,q_7)
                      edge  node [align=center] {b} (q_3,q_4)
            (q_3,q_4) edge [bend left=30]node[below][align=left] {a} (q_3,q_5)
                      edge [loop above] node[text width=1cm,align=center] {b} (q_3,q_4)
            (q_3,q_5) edge node {a}(q_3,q_6) 
                      edge node {b} (q_3,q_4)
            (q_2,q_4) edge [bend left=30] node[below] {b} (q_1,q_4)
                      edge node {a} (q_3,q_5)
            (q_3,q_7) edge [loop above] node[above][text width=1cm,align=center] {a,b} (q_3,q_7);                 
\end{tikzpicture}\\

答案1

您的代码中有两个错误:

  1. 节点名称不能包含逗号。
  2. below = of并且left = of不要使用括号。

工作代码:

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{positioning,automata}
\begin{document}


\begin{tikzpicture}[shorten >=1pt,node distance=3cm,on grid,auto]
  \node[state,initial]   (q_1_q_4)    {$q_1$,$q_4$};
  \node[state]           (q_2_q_5) [right=of q_1_q_4] {$q_2$,$q_5$};
  \node[state,accepting]           (q_3_q_6) [right=of q_2_q_5] {$q_3$,$q_6$};
  \node[state]           (q_3_q_7) [right=of q_3_q_6] {$q_3$,$q_7$};
  \node[state]           (q_2_q_4) [below=of q_1_q_4] {$q_2$,$q_4$};
  \node[state,accepting]           (q_3_q_5) [below=of q_2_q_4] {$q_3$,$q_5$};
  \node[state,accepting]           (q_3_q_4) [below=of q_3_q_6] {$q_3$,$q_4$};

  \path[->] (q_1_q_4) edge        [bend right=30]    node[above][align=center] {a} (q_2_q_5)
                      edge     node {b} (q_2_q_4)
            (q_2_q_5) edge      [bend left=30]       node[below] {b} (q_1_q_4)
                      edge  [bend right=30] node[above] {a} (q_3_q_6)
            (q_3_q_6) edge  [bend right=30]    node[text width=1cm,align=center] {a} (q_3_q_7)
                      edge  node [align=center] {b} (q_3_q_4)
            (q_3_q_4) edge [bend left=30]node[below][align=left] {a} (q_3_q_5)
                      edge [loop above] node[text width=1cm,align=center] {b} (q_3_q_4)
            (q_3_q_5) edge node {a}(q_3_q_6) 
                      edge node {b} (q_3_q_4)
            (q_2_q_4) edge [bend left=30] node[below] {b} (q_1_q_4)
                      edge node {a} (q_3_q_5)
            (q_3_q_7) edge [loop above] node[above][text width=1cm,align=center] {a,b} (q_3_q_7);                 
\end{tikzpicture}
\end{document}

相关内容