有人知道我必须如何编译 tikz/pgf 用户手册 (v2.10) 第 28.5 节中的示例吗:
\usetikzlibrary{chains}
\begin{tikzpicture}[every on chain/.style=join,every join/.style=->,
node distance=2mm and 1cm]
{ [start chain=trunk]
\node [on chain] {A};
\node [on chain] {B};
{ [start branch=numbers going below]
\node [on chain] {1};
\node [on chain] {2};
\node [on chain] {3};
}
{ [start branch=greek going above]
\node [on chain] {$\alpha$};
\node [on chain] {$\beta$};
\node [on chain] {$\gamma$};
}
\node [on chain,join=with trunk/numbers-end,join=with trunk/greek-end] {C};
{ [start branch=symbols going below]
\node [on chain] {$\star$};
\node [on chain] {$\circ$};
\node [on chain] {$\int$};
}
}
\end{tikzpicture}
像这样我得到了
Line 6: Package tikz Error: Unknown chain ``chain''.
答案1
加载scopes
库:
\usetikzlibrary{chains,scopes}
完整示例:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains,scopes}
\begin{document}
\begin{tikzpicture}[every on chain/.style=join,every join/.style=->,
node distance=2mm and 1cm]
{ [start chain=trunk]
\node [on chain] {A};
\node [on chain] {B};
{ [start branch=numbers going below]
\node [on chain] {1};
\node [on chain] {2};
\node [on chain] {3};
}
{ [start branch=greek going above]
\node [on chain] {$\alpha$};
\node [on chain] {$\beta$};
\node [on chain] {$\gamma$};
}
\node [on chain,join=with trunk/numbers-end,join=with trunk/greek-end] {C};
{ [start branch=symbols going below]
\node [on chain] {$\star$};
\node [on chain] {$\circ$};
\node [on chain] {$\int$};
}
}
\end{tikzpicture}
\end{document}
左括号后面跟着一些选项(在方括号内)通常表示scopes
库提供的范围的语法。