4

I'm using tikz and its "graph" library, and I'd like to label some of my graph's edges. The tikz manual (pgfmanual.pdf v3.0.1, p. 364) suggests the syntax

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{graphs}

\begin{document}
\tikz \graph
{
  a ->["foo"] b
};
\end{document}

However, this doesn't work; upon compilation I get the error message

! Package pgfkeys Error: I do not know the key '/tikz/"{foo}"' and I am going t
 o ignore it. Perhaps you misspelled it.

Am I doing something wrong, or is this a bug in tikz or its documentation?

By the way, the alternative syntax ->[edge label=foo] works fine.

aranea
  • 43
  • Welcome to TeX.SX ! I get the same message errors as you do, and the [edge label=foo] also works for me. The same things go for the examples in the manual using the ["foo"] syntax. I think this is either a bug or a case of the manual not being up to date. Please post a MWE, so other users can test more easily. – marsupilam Jun 27 '17 at 21:54
  • 2
    Did you load the quotes library? – cfr Jun 27 '17 at 21:58
  • @cfr That's it for me : \usetikzlibrary{quotes} ! Well spotted ! Is this requirement documented in the manual close enough to the graph examples ? – marsupilam Jun 27 '17 at 21:59
  • @cfr: Thanks, that does the trick. Care to submit this as an answer? – aranea Jun 27 '17 at 22:03
  • @marsupilam It is a standard feature of the TikZ manual not to mention the need for libraries which are incidental to the topic currently being covered. That is, probably not, but that's a problem running throughout the manual. – cfr Jun 27 '17 at 22:04

1 Answers1

3

You need to load the quotes library.

\RequirePackage{luatex85}
\documentclass[border=12pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing,quotes}
\begin{document}
\tikz \graph
{
  a ->["foo"] b
};
\end{document}

graph with label

cfr
  • 198,882