Tikz:使用独立

Tikz:使用独立

以下程序复制自TikZ 中的思维导图/树正在独立编译。


\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap}


\begin{document}
\begin{tikzpicture}[
  mindmap,
  every node/.style={concept, execute at begin node=\hskip0pt},
  root concept/.append style={
    concept color=black, fill=white, line width=1ex, text=black
  },
  text=white, grow cyclic,
  level 1/.append style={level distance=4.5cm,sibling angle=90},
  level 2/.append style={level distance=3cm,sibling angle=45}
]

\node[root concept] {Computational Complexity} % root
child[concept color=red] { node {Computational Problems}
child { node {Problem Measures} }
child { node {Problem Aspects} }
child { node {Problem Domains} }
child { node {Key Problems} }
}
child[concept color=blue] { node {Computational Models}
child { node {Turing Machines} }
child { node {Random-Access Machines} }
child { node {Circuits} }
child { node {Binary Decision Diagrams} }
child { node {Oracle Machines} }
child { node {Programming in Logic} }
}
child[concept color=orange] { node  {Measuring Complexity}
child { node {Complexity Measures} }
child { node {Classifying Complexity} }
child { node {Comparing Complexity} }
child { node {Describing Complexity} }
}
child[concept color=green!50!black] { node {Solving Problems}
child { node {Exact Algorithms} }
child { node {Randomization} }
child { node {Fixed-Parameter Algorithms} }
child { node {Parallel Computation} }
child { node {Partial Solutions} }
child { node {Approximation} }
};
\end{tikzpicture}
\end{document}

但是,当我尝试使用以下命令将此文件包含到我的主文档中时,出现错误。

\begin{figure}[h!]

\includestandalone[width=.8\textwidth]{figures/mindMapExample}

\end{figure}

错误说:pgfkeys: I do not know the key '/tikz/mindmap' and I am going to ignore it. Perhaps you misspelled it. ]

如何解决?

答案1

正如评论、使用standalonemindmap包装中提到的:

\documentclass[11pt]{article} % use larger type; default would be 10pt
\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
\usepackage{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap}

\title{Tikz: Using standalone}
\author{Sooraj}

\begin{document}
\maketitle
\section{Computional complexity}
Now, when I try to include this file in my main document using the following, I get this:
\begin{figure}[h!]
\includestandalone[width=.8\textwidth]{figures/mindMapExample}
\caption{Blablabla}
\end{figure}

\end{document}

includestandalone假定所有需要的包都已由 main.. 加载。

结果你会得到这样的结果:

在此处输入图片描述

相关内容