我需要在同一個文檔中graphs
使用TikZ 庫。shapes
但他們似乎不相容。這是一個積極使用該graphs
庫但不需要該shapes
庫的最小範例。無論如何,shapes
庫一載入就編譯失敗。
這是最小的例子:
\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}
錯誤訊息是
! Missing \endcsname inserted
<to be read again>
\tikz@lg1
l.17 \graph[use existing nodes] { foo -> bar; };
我使用與我的 LaTeX 發行版捆綁在一起的軟體包版本。這就是說:
- 米克特克斯2.9
- pgf 2008/01/15 v2.10(rcs 修訂版 1.12)
- tikzlibraryshapes.code.tex 2008/01/09 v2.10(rcs 修訂版 1.1)
- tikzlibrarymatrix.code.tex 2008/06/18 v2.10(rcs 修訂版 1.2)
- tikzlibrarygraphs.code.tex 2010/10/23 v2.10(rcs 修訂版 1.1)
有任何想法嗎?
答案1
這似乎是 MikTex 包中的一個錯誤。我按照本指南從 SourceForge 安裝了最新且穩定的 PGF/TikZ 版本:http://docs.miktex.org/manual/localadditions.html現在它正在發揮作用。