我的 tikzpicture 无法使用

我的 tikzpicture 无法使用

我对 LaTex 还很陌生,目前正在尝试使用 tikzpicture 包绘制图像。但是,每次我去编译文档时,它都不起作用并且超时!你们能给我一些指点吗?这是我的代码(如果它很糟糕,请原谅,因为我说我是新手)

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{amsmath}

\begin{document}

\begin{center}
\begin{tikzpicture}
  \node[] (a) at (0,0) {$G$};
  \node[] (b) at (2, 0) {$\G \times \overset{d}{\cdots} \times G$};
  \node[] (c) at (0, -2) {$\textrm{St}_G(1)$};
  \node[] (d) at (2, -2) {$\varphi(\textrm{St}_G(1))$};
  \node[] (e) at (0, -4) {$H$};
  \node[] (f) at (2, -4) {$\varphi(H)$};
  \node[] (g) at (0, -6) {$K$};
  \node[] (h) at (2, -6) {$\K \times \overset{d}{\cdots} \times K$};
  \node[] (i) at (0, -8) {$\cdots$};
  \node[] (j) at (2, -8) {$\cdots$};
  \path (a) edge node [left] {} (c);
  \path (b) edge node [left] {} (d);
  \path (c) edge node [left] {$\varphi$} (d);
  \path (c) edge node [left] {} (e);
  \path (d) edge node [left] {} (f);
  \path (e) edge node [left] {$\varphi$} (f);
  \path (e) edge node [left] {} (g);
  \path (f) edge node [left] {} (h);
  \path (g) edge node [left] {$\varphi$} (h);
  \path (g) edge node [left] {} (i);
  \path (h) edge node [left] {} (j);
  \path (i) edge node [left] {} (j);
\end{tikzpicture}
\end{center}
\end{document}

答案1

不要忽视错误

TeX 报告

! Package tikz Error: Giving up on this path. Did you forget a semicolon?

;在错误消息指示的位置添加可停止 tex 循环。

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{tikz,amsmath}
\newcommand\G{G}
\newcommand\K{K}

\begin{document}

\begin{center}
\begin{tikzpicture}
  \node[] (a) at (0,0) {$G$};
  \node[] (b) at (2, 0) {$\G \times \overset{d}{\cdots} \times G$};
  \node[] (c) at (0, -2) {$\textrm{St}_G(1)$};
  \node[] (d) at (2, -2) {$\varphi(\textrm{St}_G(1))$};
  \node[] (e) at (0, -4) {$H$};
  \node[] (f) at (2, -4) {$\varphi(H)$};
  \node[] (g) at (0, -6) {$K$};
  \node[] (h) at (2, -6) {$\K \times \overset{d}{\cdots} \times K$};%<<<<<<<<<<<<<<<<<<<<<
  \node[] (i) at (0, -8) {$\cdots$};
  \node[] (j) at (2, -8) {$\cdots$};
  \path (a) edge node [left] {} (c);
  \path (b) edge node [left] {} (d);
  \path (c) edge node [left] {$\varphi$} (d);
  \path (c) edge node [left] {} (e);
  \path (d) edge node [left] {} (f);
  \path (e) edge node [left] {$\varphi$} (f);
  \path (e) edge node [left] {} (g);
  \path (f) edge node [left] {} (h);
  \path (g) edge node [left] {$\varphi$} (h);
  \path (g) edge node [left] {} (i);
  \path (h) edge node [left] {} (j);
  \path (i) edge node [left] {} (j);
\end{tikzpicture}
\end{center}
\end{document}

相关内容