2

I need to use the TikZ libraries graphs and shapes in the same document. But they seem to be incompatible. Here is a minimal example that makes active use of the graphs library, but does not need the shapes library. Anyway, the compilation fails as soon as the shapes library is loaded.

This is the minimal example:

\documentclass{minimal}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

% If the TikZ library 'shapes' is loaded, compilation fails
\usetikzlibrary{shapes,matrix,graphs}
%\usetikzlibrary{matrix,graphs}

\begin{document}
\begin{tikzpicture}
\matrix { \node(foo) {foo}; \\ \node(bar) {bar}; \\ };
\graph[use existing nodes] { foo -> bar; };
\end{tikzpicture}
\end{document}

The error message is

! Missing \endcsname inserted
<to be read again>
\tikz@lg1
l.17 \graph[use existing nodes] { foo -> bar; };

I use the package versions that are bundled with my LaTeX distribution. This is to say:

  • MikTex 2.9
  • pgf 2008/01/15 v2.10 (rcs-revision 1.12)
  • tikzlibraryshapes.code.tex 2008/01/09 v2.10 (rcs-revision 1.1)
  • tikzlibrarymatrix.code.tex 2008/06/18 v2.10 (rcs-revision 1.2)
  • tikzlibrarygraphs.code.tex 2010/10/23 v2.10 (rcs-revision 1.1)

Any ideas?

  • Welcome to TeX.SX! The version of pgf that you have is not the latest, could you try updating with MikTeX's Update manager? – Torbjørn T. Mar 17 '14 at 10:00
  • are you manually updating TikZ since graph is added in v3.00? – percusse Mar 17 '14 at 10:01
  • @Torbjørn T: it is the most recent version that is provided my the MikTeX package manager. The package manager shows "2013-12-xy" as the built date for the various pgf/tikz packages @percusse: No, I did not manually update TikZ. Why do you believe so? My 2.10 manual also mentions the graphs library and it is working (without shapes). – nagmat84 Mar 17 '14 at 10:11
  • You have something wrong with your miktex. Although MikTeX page shows that pgf was packed on 11/5/2011 9:43:10 PM, their sources in CTAN (from where you download packages) shows pgf was packaged on 28/02/2014. In any case your example works for me with an updated miktex system. – Ignasi Mar 17 '14 at 20:46
1

it seems to be a bug in the MikTex bundle. I installed the most recent and stable version of PGF/TikZ from SourceForge following this guide: http://docs.miktex.org/manual/localadditions.html and now it is working.

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.