It seems that the tikz-qtree and tkz-graph packages both define (or redefine) the \edge macro... I'd like to use both, but it doesn't seem possible:



\begin{tikzpicture}[level distance=40pt]
\Tree [.A [.B [.C a ] ]
          [.D [.E quote ]
               [.F \edge[roof]; {Eye of newt, and toe of frog} ] ] ]



I get the following error when compiling the document above:

! Use of \@edge doesn't match its definition.
<recently read> \edge 

l.12               [.F \edge
                            [roof]; {Eye of newt, and toe of frog} ] ] ]

Is there a workaround?


Sorry I'm guilty. I have not taken sufficient precautions. The problem comes from :

\newcommand*{\Edge}[1][]{\@edge[#1]}%  because tikz-qtree defines `\@edge` too :(

A better way was to use \tkz@edge instead of \@edge. In the next version with pgfkeys, I'll be more careful.

Actually you can save the next file with the name : patch-tkz-graph.tex

  % patch-tkz-graph.tex : patch for tkz-graph

 \tikzset{LocalEdgeStyle/.style={color = \cmdGR@edge@color,
                                 line width = \cmdGR@edge@lw}}}{%
 \tikzset{LocalEdgeStyle/.style={line width = \cmdGR@edge@dd,
                                 color = \cmdGR@edge@double,
                                 double distance = \cmdGR@edge@lw,
                                 double  = \cmdGR@edge@color}}}%
      \noexpand   \draw[LocalEdgeStyle,\cmdGR@edge@style,EdgeStyle]}%
                  \@tempa (#2) to (#3)}{%
      \noexpand   \draw[LocalEdgeStyle,\cmdGR@edge@style,EdgeStyle] (#2) to%
     node[fill = \cmdGR@edge@labelcolor,
          text = \cmdGR@edge@labeltext,
    {\cmdGR@edge@label} (#3)}%


And then

% no need to load tikz, tkz loads tikz 
\usepackage{tkz-graph}% in first  

\begin{tikzpicture}[level distance=40pt]
\Tree [.A [.B [.C a ] ]
          [.D [.E quote ]
               [.F \edge[roof]; {Eye of newt, and toe of frog} ] ] ]

\Vertex[style={line width=2pt}]{A}
\Vertex[x=6,y=0,style={line width=2pt}]{B}
\Edge[style={->,>=latex,bend left=90},label=$x$](A)(B)


enter image description here

  • @AndrewStacey Thanks for editing and for the corrections! I need to be more careful in my packages, but also in my answers – Alain Matthes Jun 18 '12 at 13:18
  • @Altermundus: thank you for your answer and for the patch! It works perfectly. – Jay Jun 18 '12 at 13:25
  • @Altermundus It was only a very minor edit. I strongly suspect you're not the only one that's used an obvious name for a macro only to find it used in some other package ... – Loop Space Jun 18 '12 at 13:29
  • @AndrewStacey Yes I know and it's not the first time. I was careful with my new packages. I need to rewrite tkz-graph with pgfkeys and some new tools from pgf 2.1 and with some others ideas. – Alain Matthes Jun 18 '12 at 14:20

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.