Graphics, Figures & TablesIncomprehensible Error in Code for Tree

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
mjperrone
Posts: 1
Joined: Mon Apr 22, 2013 6:22 am

Incomprehensible Error in Code for Tree

Post by mjperrone »

I can't seem to figure out what's wrong with this.

Code: Select all

\documentclass[12pt]{report}
\usepackage{tikz-qtree}

\begin{document}
  \begin{tikzpicture}[level distance=70pt,sibling distance=50pt]
    \Tree [.$(x<0)$
      \edge node[auto=right]{1}; 
      [.(a) 
        \edge node[auto=right]{1}; 
        [.$f_1();$ ] 
        \edge node[auto=left]{0};
        [.(b) 
          \edge node[auto=right]{0};
          [.$f_1();$ ] 
          \edge node[auto=left]{1}
	  [.$f_2();$ ] ] ]
	\edge node[auto=left]{0}; 
	[.(b)
        \edge node[auto=right]{0};
          [.$f_1();$ ] 
          \edge node[auto=left]{1};
          [.$f_2();$ ] ] ] ]
  \end{tikzpicture}
\end{document}
I get this error.

Code: Select all

! Extra }, or forgotten $.
<recently read> }
                 
l.16 	\edge
            node[auto=left]{0};
? 

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Incomprehensible Error in Code for Tree

Post by Johannes_B »

Hi, a semicolon is missing at the end of line 15.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply