当我使用 xelatex 2018 编译此代码时:
\begin{tikzpicture}[sibling distance=80pt]
\node[box] {TeX}
child {node[box] {Plain\TeX}} child {node[box] {\LaTeX}
child {node[box] {amsmath}} child {node[box] {graphicx}} child {node[box] {hyperref}}
}; \end{tikzpicture}
抛出此错误:
Package pgfkeys Error: I do not know the key '/tikz/box' and I am going to ignore it. Perhaps you misspelled it. ...icture}[sibling distance=80pt] \node[box]
这是我的参考:
\usepackage{pgf}
\usepackage{tikz} % Required for drawing custom shapes
\usetikzlibrary{shapes,arrows,automata}
缺少什么包裹?
答案1
box
不是预定义样式,因此您可能需要在代码中定义它。一个可能的定义可能是
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{automata}
\begin{document}
\begin{tikzpicture}[sibling distance=80pt,box/.style={rectangle,draw}]
\node[box] {TeX}
child {node[box] {Plain\TeX}} child {node[box] {\LaTeX}
child {node[box] {amsmath}} child {node[box] {graphicx}} child {node[box] {hyperref}}
}; \end{tikzpicture}
\end{document}
答案2
我也面临错误
额外的},或者被遗忘的\endgroup。}
请指点一下,其中缺少什么。我从下面的网址复制了代码,只修改了框项 如何在 tikz 或类似软件中绘制分类图
\documentclass[border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{shadows.blur}
\begin{document}
% addaswyd o ateb marmot: https://tex.stackexchange.com/a/436172/
% starting point: https://tex.stackexchange.com/a/341454/121799
\begin{forest}
forked edges,
for tree={font=\sffamily, rounded corners, top color=gray!5, bottom color=gray!10, edge+={darkgray, line width=1pt}, draw=darkgray, align=center, anchor=children},
before packing={where n children=3{calign child=2, calign=child edge}{}},
before typesetting nodes={where content={}{coordinate}{}},
where level<=1{line width=2pt}{line width=1pt},
[SDA, blur shadow
[Symetric
[310131432]
]
[Asymetric
[Homomorphic
[Fog-Based
[PHE
[61 79 80]
]
]
[Non-Fog-Based
[PHE
[Paillier
[6,11,23,30,31,34,37,39,40,44,53,54,56,69,70,72,73,74,75,76]
]
[Elgamal
[4,5,38,71]
]
]
[SWHE
[7,84]
]
[FHE Schemes
[57,58,71]
]
]
]
[Non Homomorphic
[No-Fog-Based
[SMPC
[678283]
]
[Others
[89212645]
]
]
[Fog-Based
[62]
]
]
]
]
\end{forest}
\end{document}