使用 tkz-berge 与其他 tikz 包加载顺序

使用 tkz-berge 与其他 tikz 包加载顺序

我使用独立包来预览我的 tikz 图片,而无需编译完整文档。因此序言包含我使用的所有包。我收到 tkz-berge 包的大多数 \gr* 宏的错误:

@edge 的使用与其定义不符。\Edge [#1]->@edge [ #1] l.58 \grPrism[RA=6,RB=3]{4} % ?

MWE 如下(短代码来自手册 tkz-Berge.sty v2.7c,第 45 页,但前言很长)

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}  %% for 3dplot functionality
\usepackage{tkz-fct}   % for parametric function gnu-plot
\usepackage{tkz-berge} %graph package has to be loaded after tikz-qtree package
\usepackage{tikz-qtree}
%\usepackage{tkz-berge} %graph package has to be loaded after tikz-qtree package
\usepackage{tkz-tab}
\usepackage{tikzducks}
\usepackage{tikzpeople}
\usepackage{tikzsymbols}
\usepackage{tkz-graph}
\usepackage{tkz-berge} %graph package has to be loaded after tikz-qtree package
\usepackage{tkz-euclide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usetikzlibrary{
arrows,
arrows.meta,
automata,
backgrounds,
calc,
decorations,
decorations.footprints,
decorations.fractals,
decorations.markings,
decorations.pathmorphing,
decorations.pathreplacing,
decorations.shapes,
decorations.text,
external,
fit,
intersections,
math,
matrix,
patterns,
petri,
plotmarks,
positioning,
shadows,
shapes,
shapes.arrows,
shapes.callouts,
shapes.geometric,
shapes.misc,
shapes.multipart,
shapes.symbols,
%snakes,
topaths,
turtle
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}
\pagestyle{empty} 
\begin{document}
\centering
\begin{tikzpicture}
\GraphInit[vstyle=Shade]
\grPrism[RA=6,RB=3]{4}%
\end{tikzpicture}
\end{document}

答案1

软件包的加载顺序是解决方案:注释掉 MWE 的第 5 行

\usepackage{tkz-berge} %graph 包必须在 tikz-qtree 包之后加载

并在第 7 行重新注释,问题就解决了。实际上,文档类并不相关,文章类也出现了同样的错误。检查序言就是解决方案。

相关内容