\usetikzlibrary{fit,positioning,arrows,automata}
\usetikzlibrary{positioning,arrows,shapes}
\usepackage{mhchem}
\usepackage{chemformula}
\let\ce\ch
\begin{tikzpicture}[node distance=2cm,minimum size=1cm,]
\node[circle, draw=black] (A) at (1,2) {$X_{{t-1}}$};
\node[circle,draw=black] (B) at (-0.5,0) {$e_{t^{-}}$};
\node[circle,draw=black] (C) at (2,0) {$O_{t^{-}}$};
\node[circle, draw = black] (D) at (5,2) {$X_t$}
\node[circle, draw = black] (E) at (4,0) {$X_t$}
\node[circle, draw = black] (F) at (6,0) {$X_t$}
\node[circle, draw = black] (G) at (8,2) {$X_{t+1}$}
\node[circle, draw = black] (H) at (7,0) {$X_t$}
\node[circle, draw = black] (I) at (9,0) {$X_t$}
\draw [->] (A) -- (B);
\draw [->] (A) -- (C);
\draw [->] (A) -- (D)
\end{tikzpicture}
当我尝试在 Latex 中运行此程序时,编译器总是超时。我对使用 Tikz 和尝试绘制图形完全陌生。有人知道哪里出了问题吗?
答案1
欢迎来到 TeX StackExchange!
您的代码的问题在于您忘记\node
以“;”结尾每个代码(以及最后一个代码\draw
)。
您的代码应如下所示:
\usetikzlibrary{fit,positioning,arrows,automata}
\usetikzlibrary{positioning,arrows,shapes}
\usepackage{mhchem}
\usepackage{chemformula}
\let\ce\ch
\begin{tikzpicture}[node distance=2cm,minimum size=1cm,]
\node[circle, draw=black] (A) at (1,2) {$X_{{t-1}}$};
\node[circle,draw=black] (B) at (-0.5,0) {$e_{t^{-}}$};
\node[circle,draw=black] (C) at (2,0) {$O_{t^{-}}$};
\node[circle, draw = black] (D) at (5,2) {$X_t$};
\node[circle, draw = black] (E) at (4,0) {$X_t$};
\node[circle, draw = black] (F) at (6,0) {$X_t$};
\node[circle, draw = black] (G) at (8,2) {$X_{t+1}$};
\node[circle, draw = black] (H) at (7,0) {$X_t$};
\node[circle, draw = black] (I) at (9,0) {$X_t$};
\draw [->] (A) -- (B);
\draw [->] (A) -- (C);
\draw [->] (A) -- (D);
\end{tikzpicture}