我正在尝试使用软件包创建一棵树tikz-qtree
。! Paragraph ended before \@@@@litlabel was complete.
\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}
但是,如果我要删除树内的节点,则每条都可以完美编译。
\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}
提供的解决方案此主题没有帮助。
答案1
您是逃脱的受害者babel
。\usetikzlibrary{babel}
\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}
看来,tikz
如果您无法更新,那么您有旧的。
\tikzset{
every picture/.prefix style={
execute at begin picture=\shorthandoff{;}
}
}
代码:
\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}