我是 tex.se 的新手,正在寻求一些帮助。
对于一个项目,我必须自动编译一些给定的 Latex 字符串,我无法更改这些字符串。但是我可以添加一些标题或定义一些新命令。
有人知道我需要添加哪些包才能以这种方式编译这些行吗?
\begin{tikzpicture}[graph]
\node[graph node] (1) [label=above:\(1\)]{};
\node[graph node] (2) at ($(1) + (-36:1.5cm)$) [label=right:\(2\)] {};
\node[graph node] (3) at ($(2) + (-108:1.5cm)$) [label=right:\(3\)] {};
\node[graph node] (4) [left of=3, label=left:\(4\)] {};
\node[graph node] (5) at ($(1) + (-144:1.5cm)$) [label=left:\(5\)] {};
\node[graph node] (6) at ($(2) + (15:2.0cm)$) [label=left:\(6\)] {};
\node[graph node] (7) [right of=6, label=right:\(7\)] {};
\node[graph node] (8) [below of=7, label=right:\(8\)] {};
\node[graph node] (9) [below of=6, label=left:\(9\)] {};
\path[->]
(2) edge (1)
edge (3)
edge (5)
(3) edge (1)
edge[bend left=10] (4)
(4) edge (1)
edge[bend left=10] (3)
edge (5)
(6) edge[bend left=10] (7)
edge (8)
edge (9)
(7) edge[bend left=10] (6)
edge (8)
(9) edge (8);
\end{tikzpicture}
我已经包含了一些包,例如:
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{paralist}
\usepackage{setspace}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage{tkz-graph}
\usetikzlibrary{shapes,arrows}
但我确实收到了这个错误:
!软件包 pgfkeys 错误:我不知道密钥“/tikz/graph”,我将忽略它。也许你拼错了。
感谢您的帮助! :)
答案1
好了,编译并给出输出。请注意,该tkzgraph
包有自己独特的设置:咨询它的手册在使用前。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\node (1) [label=above:\(1\)]{};
\node (2) at ($(1) + (-36:1.5cm)$) [label=right:\(2\)] {};
\node (3) at ($(2) + (-108:1.5cm)$) [label=right:\(3\)] {};
\node (4) [left of=3, label=left:\(4\)] {};
\node (5) at ($(1) + (-144:1.5cm)$) [label=left:\(5\)] {};
\node (6) at ($(2) + (15:2.0cm)$) [label=left:\(6\)] {};
\node (7) [right of=6, label=right:\(7\)] {};
\node (8) [below of=7, label=right:\(8\)] {};
\node (9) [below of=6, label=left:\(9\)] {};
\path[->]
(2) edge (1)
edge (3)
edge (5)
(3) edge (1)
edge[bend left=10] (4)
(4) edge (1)
edge[bend left=10] (3)
edge (5)
(6) edge[bend left=10] (7)
edge (8)
edge (9)
(7) edge[bend left=10] (6)
edge (8)
(9) edge (8);
\end{tikzpicture}
\end{document}