# Have multiple transitions on different lines in a state machine using tikz

by Paradox   Last Updated January 20, 2018 21:23 PM

I am attempting to draw a state machine, however I intend to have more than two possible transitions listed on different lines, i.e. instead of a;$\bot/A\bot$, $a;A/AA$ being on the same line, I'd like to have a;$\bot/A\bot$ and $a;A/AA$ on different lines. So far, I have tried // and \n but neither have worked for me. Here is my LaTeX:

\usepackage{tikz}
\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2cm]
\node[initial,state] (q0)      {$q0$};
\node[state]         (q1) [right of=q0]  {$q_1$};
\node[state]         (q2) [right of=q1] {$q_2$};
\node[state, accepting] (q3) [below of=q1] {$q_3$};

\path[->] (q0)  edge [loop above] node {a} (q0)
edge              node {a} (q1)
(q1) edge [loop above] node {a;$\bot/A\bot$, $a;A/AA$} (q1)
edge [bend left]  node {a} (q0)
edge              node {b} (q2)
(q2) edge [loop above] node {b} (q2)
edge [bend left]  node {b} (q1);
\end{tikzpicture}


Here is what the above LaTeX looks like:

Tags :