14

I get an error in my document in the following circumstance:

  1. Using the cleveref package
  2. And the tikz-qtree package (for drawing syntax trees)
  3. Inside an enumerate environment

Here's a MWE:

\documentclass{article}

%\usepackage{cleveref} %Uncomment for crash

\usepackage{tikz}
\usepackage{tikz-qtree}

\begin{document}

\begin{enumerate}
  \item foo
    \begin{tikzpicture}
        \Tree [.Foo Bar ]
    \end{tikzpicture}
\end{enumerate}


\end{document}

Here's a link to the log that running that file (with cleveref uncommented) generates: log file. The first error is:

! Package tikz Error: A node must have a (possibly empty) label text.

I've verified the following things:

  • It is not a catcode problem, i.e. the catcode of . and [ is 12 both with and without loading cleveref
  • The problem goes away if the tree is not embedded in an enumerate, i.e. delete the entire document body and replace it with only the \begin{tikzpicture}...\end{tikzpicture}
  • The problem goes away if you change the enumerate to itemize

I tried running the example with \traceon from the trace package, but got mired in the half-million(!) lines of output.

Based on the esoteric combination of packages, I'm not sure a ready answer exists, but hopefully there is a TeX guru out there familiar with the guts of these packages who sees something I cannot.

4
  • It also fails with the gb4e and linguex examples. So this is something quite general with lists.
    – Alan Munn
    Mar 15, 2011 at 2:06
  • 6
    This question has been upvoted enough times that it looks like it deserves an answer, so I've offered a bounty on it. Most upvoted answer this time next week gets it.
    – Seamus
    Mar 21, 2011 at 15:05
  • @Seamus Thanks for adding the bounty to this question -- it looks like it was just what was needed to smoke out the answer. As far as I understand, if I accept Ulrich's answer, he will get the bounty. You mentioned waiting a week, but consensus seems to be that his answer is deserving. Any objections if I go ahead and accept it?
    – Aaron
    Mar 23, 2011 at 18:56
  • I'm not sure whether accepting the answer will trigger the bounty, since it wasn't offered by the asker. But I'm perfectly happy for Ulrich to get the bounty so go ahead and accept!
    – Seamus
    Mar 23, 2011 at 19:01

2 Answers 2

10
+100

My money is on a name clash of \@result. There's a suspicious

\@call #1#2->\let \@cont =#2\bgroup \@result ={}#1
#1<-\@subtree 
#2<-\@Tree 
{\let}
{begin-group character {}

\@result ->
{the character =}
Missing character: There is no = in font nullfont!
{begin-group character {}
{end-group character }}

in the log. Without having checked right now, I conjecture that TikZ has a token register of that name, while cleveref uses it as a macro.

7
  • \@result is the problem but not in TikZ but in tikz-qtree and in cleveref Mar 21, 2011 at 19:17
  • Sadly, grep -rl '\\@result' reveals nothing in the PGF directories (and all the results of grep -r @result are normal so there's no apparent \csname trickery). Though not knowing much of the mysteries of TeX, could it be encoded in some weird way? Mar 21, 2011 at 19:22
  • 1
    Ah, yes. As Altermundus says, line 30 of tikz-qtree.sty reads \newtoks\@result. That should be easy to patch. I guess that both packages should choose better names! Mar 21, 2011 at 19:24
  • 2
    Ulrich should get the bounty. I'm annoyed that I missed this when I looked into this last week! Changing all instances of \@result to \tkqt@result fixes the problem. I'm in contact with the author of tikz-qtree, so I'll send a fix along to him.
    – Alan Munn
    Mar 21, 2011 at 19:25
  • 6
    I've notified the authors of both packages.
    – Alan Munn
    Mar 21, 2011 at 19:35
9

A solution :

in tikz-qtree.tex you can replace \@result by \qt@result

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.