[Tex/LaTex] Tikz in Beamer: Giving up on this path. Did you forget a semicolon

beamertikz-pgf

I'm trying to add a very big graph in Beamer. However, it returns

Package tikz Error: Giving up on this path. Did you forge t a
semicolon?.

Here is a small part of my code

 \documentclass{beamer}

    \usepackage{tikz}
    \usetikzlibrary{arrows}
    \tikzset{
      treenode/.style = {align=center, inner sep=0pt, text centered,
        font=\sffamily},
      arn_n/.style = {treenode, circle,black, draw=black, text width=1.3em}% 
    }

    \begin{document}
    \begin{frame}
    \frametitle{Paragraphs of Text}
    $\bf{Step \ 0 }$
    \begin{tikzpicture}[->,>=stealth',level distance = 2.5cm,
    level 1/.style={sibling distance=5.75cm},
    level 2/.style={sibling distance=1.95cm},
    level 3/.style={sibling distance=0.6cm}] 
    \node [arn_n] {}
        child{ node [arn_n] {} 
                child{ node [arn_n] {} 
                    child{ node [arn_n] {} } 
                                child{ node [arn_n] {}
                                }
                                child{ node [arn_n] {}
                                }
                }                           
        }

    \end{tikzpicture}
    \end{frame}

How to fix it?


update:
I have add ; but it still returns error.

\begin{frame}
\frametitle{Paragraphs of Text}

\begin{tikzpicture}[->,>=stealth',level distance = 2.5cm,
level 1/.style={sibling distance=5.75cm},
level 2/.style={sibling distance=1.95cm},
level 3/.style={sibling distance=0.6cm}] 
\node [arn_n] {}
    child{ node [arn_n] {} ;
            child{ node [arn_n] {} 
                child{ node [arn_n] {} }; 
                            child{ node [arn_n] {}
                            };
                            child{ node [arn_n] {}
                            };
            };                            
    }; 
\end{tikzpicture}

\end{frame}

Missing $ inserted.
$ l.137 \end{frame}

Best Answer

Only one ; at the end is required. The errors come from the unpaired {} for each child. That is, every child must have a beginng { and an ending }. Also proper indentation would help in debugging. Actually, the use of underscore is not a problem here because it is a style name.

enter image description here

Here 3 cases are demonstrated because you have defined 3 levels.

Code

\documentclass{beamer}
    \usepackage{tikz}
    \usetikzlibrary{arrows}
    \tikzset{
      treenode/.style = {align=center, inner sep=0pt, text centered,
        font=\sffamily},
      arn_n/.style = {treenode, circle,black, draw=black, text width=1.3em},% 
    level distance = 2.5cm,
    level 1/.style={sibling distance=5.75cm},
    level 2/.style={sibling distance=1.95cm},
    level 3/.style={sibling distance=0.6cm}
}

    \begin{document}
    \begin{frame}
    \frametitle{Paragraphs of Text}
    $\bf{Step 0 }$\\
    \begin{tikzpicture}[scale=0.5] 
\node [arn_n] {0}
    child{ node [arn_n] {1} 
           child{node [arn_n] {2}} 
           child{node [arn_n] {2}}  
           child{node [arn_n] {2}}
           child{node [arn_n] {2}}};                             
 \end{tikzpicture}
\begin{tikzpicture}[scale=0.5]
\node [arn_n] {0}
    child{node [arn_n] {1}} 
    child{node [arn_n] {1} 
          child{node [arn_n] {2}}
          child{node [arn_n] {2}}
          child{node [arn_n] {2}}};    
\end{tikzpicture} 
\begin{tikzpicture}[scale=0.5]
\node [arn_n] {0}
    child{node [arn_n] {1}} 
    child{node [arn_n] {1} 
          child{node [arn_n] {2}}
          child{node [arn_n] {2}
                child{node [arn_n]{3}}}};    
\end{tikzpicture}                              
\end{frame}
\end{document}