[Tex/LaTex] How to add newline within node using TikZ

automatatikz-pgf

I want to break the input of a path in order to draw Pushdown Automaton,so I try to use the break line symbol \\ and even $$ $$, it still doesnt break the lines.
enter image description here
For example, the input should be
0, 1, 2
3, 4, 5

Any idea? Thank you.

Code Sample:

\documentclass[10pt,letterpaper]{article}
\usepackage[latin1]{inputenc}
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry} 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}

\begin{document}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}

\textbf{PDA:}\\
    \begin{tikzpicture}[shorten >=1pt,node distance=5cm,on grid,auto] 
        \node[state,initial]    (q_0)                   {$q_0$}; 
        \node[state,accepting]  (q_1)   [right=of q_0]  {$q_1$}; 
        \node[state]            (q_2)   [right=of q_1]  {$q_2$}; 
        \node[state]            (q_3)   [below=of q_1]  {$q_3$};

        \path[->]
        (q_0)   edge                    node {0,1}            (q_1)
                edge    [loop above]    node {0,1,2,3,4,5}            (q_0)

        (q_1)   edge                    node {0,1}            (q_2)

        (q_2)   edge    [loop right]    node {1}              (q_2)  

        ; %end path 
    \end{tikzpicture}
\\
\end{document}  

Best Answer

One simple method is to specify text characteristics within the node : text width, etc. This will let you do exactly what you want, without any extra package. For example,

\documentclass[]{minimal}

\usepackage{amsmath,amsfonts,amssymb}
\usepackage{tikz}
\usetikzlibrary{automata,positioning}

\begin{document}

\begin{tikzpicture}[shorten >=1pt,node distance=5cm,on grid,auto] 

\node[state,initial] (q_0) {$q_0$}; 
\path[->] (q_0) edge[loop above] node[text width=1cm,align=center] {0,1,2\\3,4,5} (q_0); 

\end{tikzpicture}
\end{document}  

The result is

enter image description here