
\documentclass{book}
\usepackage{graphs}
\usetikzlibrary{graphs}
\begin{doument}
\begin{tikzpicture}[new set=import nodes]
\begin{scope}[nodes={set=import nodes}] % make all nodes part of this set
\node [red] (a) at (0,1) {$a$};
\node [red] (b) at (1,1) {$b$};
\node [red] (d) at (2,1) {$d$};
\end{scope}
\graph {
(import nodes);
% "import" the nodes
a -> b -> c -> d -> e;
};
\end{tikzpicture}
\end{document}
このコードをコンパイルすると、エラーが発生しました
! LaTeX Error: File `graphs.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
答え1
LaTeX は存在するパッケージのみをロードできます。存在しないパッケージをロードしようとすると、エラーが発生します。
私のシステムには存在しませんgraphs.sty
。おそらく必要なパッケージは TikZ だと思います:
\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\begin{tikzpicture}[new set=import nodes]
\begin{scope}[nodes={set=import nodes}] % make all nodes part of this set
\node [red] (a) at (0,1) {$a$};
\node [red] (b) at (1,1) {$b$};
\node [red] (d) at (2,1) {$d$};
\end{scope}
\graph {
(import nodes);
% "import" the nodes
a -> b -> c -> d -> e;
};
\end{tikzpicture}
\end{document}