6

I am trying to create a tree using the tikz-qtree package. But I keep getting the following error. ! Paragraph ended before \@@@@litlabel was complete. Here is my tex-file:

\documentclass[a4paper, 12pt]{scrartcl}
\usepackage[english, french, ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{positioning}
\usepackage{rotating}

\begin{document}

\begin{tikzpicture}[level distance=40pt]
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [.IP 
        [.DP [.D $\emptyset$ ]
         [.NP [.N Sue ] ] ]
         [.I' [.I \node(i){has}; ]
          [.VP [.V \node(v){ }; ]
           [.VP [.V been ]
            [.VP [.VP [.V cooking ]
             [.DP [.D $\emptyset$ ]
              [.NP [.N pasta ] ] ] ]
               [.PP [.P in ]
                [.DP [.D the ]
                 [.NP [.N kitchen ] ] ] ] ] ] ] ] ]

\draw[semithick,->] (v)..controls +(east:1) and +(south:1)..(i);
\end{tikzpicture}
\end{document}

However, if I am deleting the nodes inside the tree everyting compiles perfectly.

\begin{tikzpicture}[level distance=40pt]
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [.IP 
       [.DP [.D $\emptyset$ ]
        [.NP [.N Sue ] ] ]
         [.I' [.I has ] [.VP [.V ]
          [.VP [.V been ]
           [.VP [.VP [.V cooking ]
            [.DP [.D $\emptyset$ ]
             [.NP [.N pasta ] ] ] ]
              [.PP [.P in ]
               [.DP [.D the ]
                [.NP [.N kitchen ] ] ] ] ] ] ] ] ]
\end{tikzpicture}

The solution provided in this thread does not help. Any ideas?

  • If instead of \node(i){has}; I use \node[name=i]{has};, it works for me – Ignasi Nov 17 '14 at 10:34
  • @Ignasi It does not work for me. – swot Nov 17 '14 at 10:38
  • Forget my previous comment, just add \usetikzlibrary{babel} to your preamble. It also works for me, even with \node(i){has};. It looks like as a conflict with babel. – Ignasi Nov 17 '14 at 10:44
  • @Ignasi tikz-qtree 1.2 and tikz 1.79 – swot Nov 17 '14 at 10:49
4

You are a victim of babel. Add \usetikzlibrary{babel} to escape.

\documentclass[a4paper, 12pt]{scrartcl}
\usepackage[english, french, ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{positioning,babel}    %%<-------------------
\usepackage{rotating}

\begin{document}

\begin{tikzpicture}[level distance=40pt]
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [.IP
        [.DP [.D $\emptyset$ ]
         [.NP [.N Sue ] ] ]
         [.I' [.I \node(i){has}; ]
          [.VP [.V \node(v){ }; ]
           [.VP [.V been ]
            [.VP [.VP [.V cooking ]
             [.DP [.D $\emptyset$ ]
              [.NP [.N pasta ] ] ] ]
               [.PP [.P in ]
                [.DP [.D the ]
                 [.NP [.N kitchen ] ] ] ] ] ] ] ] ]

\draw[semithick,->] (v)..controls +(east:1) and +(south:1)..(i);
\end{tikzpicture}

\end{document}

enter image description here

It seems, you have old tikz. If you can't update put this in preamble.

\tikzset{
      every picture/.prefix style={
        execute at begin picture=\shorthandoff{;}
      }
    }

Code:

\documentclass[a4paper, 12pt]{scrartcl}
\usepackage[english, french, ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{positioning}
\usepackage{rotating}

\tikzset{
  every picture/.prefix style={
    execute at begin picture=\shorthandoff{;}
  }
}

\begin{document}

\begin{tikzpicture}[level distance=40pt]
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree [.IP
        [.DP [.D $\emptyset$ ]
         [.NP [.N Sue ] ] ]
         [.I' [.I \node(i){has}; ]
          [.VP [.V \node(v){ }; ]
           [.VP [.V been ]
            [.VP [.VP [.V cooking ]
             [.DP [.D $\emptyset$ ]
              [.NP [.N pasta ] ] ] ]
               [.PP [.P in ]
                [.DP [.D the ]
                 [.NP [.N kitchen ] ] ] ] ] ] ] ] ]

\draw[semithick,->] (v)..controls +(east:1) and +(south:1)..(i);
\end{tikzpicture}
\end{document}
  • I keep getting the following error: ! I can't find file 'tikzlibrarybabel.code.tex'. – swot Nov 17 '14 at 10:53
  • @swot That means you don't the library installed. May be your version of tikz is old. Latest one is v3. Please update tikz. – user11232 Nov 17 '14 at 10:54
  • @swot Please see the update for old tikz versions. – user11232 Nov 17 '14 at 10:59
  • I updated my tikzand babel versions. Thank you. – swot Nov 17 '14 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.