我正在尝试用 LaTex 画一幅画。当我编译文件时,它给出了未定义的控制序列错误。我尝试将它与我的其他文档进行比较,但找不到错误所在。我在这里附上了我的文件。提前感谢您的帮助!
\documentclass{article}
\usepackage{tikz,pgf}
\usetikzlibrary{calc,positioning,mindmap,trees,decorations.pathreplacing}
\usepackage{amssymb,amsmath}
\usepackage{sverb}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{verbatim}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\renewcommand{\labelitemii}{\scriptsize$\blacksquare$}
\usepackage{pgffor,pgf}
\newcommand{\MOD}[2]{\pgfmathparse{int(mod(#1,#2))}\pgfmathresult }
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}[scale=0.8, line width=1]
\definecolor{rojo}{rgb}{0.81,0.10,0}
\definecolor{rojo_1}{rgb}{0.81,0.30,0}
\definecolor{rojo_2}{rgb}{0.81,0.60,0}
\definecolor{verde}{rgb}{0.12, 0.35, 0.14}
\definecolor{verde_1}{rgb}{0.22, 0.60, 0.15}
\definecolor{verde_2}{rgb}{0.30, 0.80, 0.20}
\definecolor{azul}{rgb}{0, 0.30, 0.80}
\definecolor{azul_1}{rgb}{0, 0.10, 0.60}
\definecolor{azul_2}{rgb}{0, 0.10, 0.90}
\definecolor{morado}{rgb}{0.7, 0.20, 0.50}
\draw
(-11,4) node (1) [label=above:$\mathsf{G_{1}}$] {$\bullet$}
(-11,3) node (2) [] {$\bullet$}
(-11,2) node (3)[] {$\bullet$}
(-11,1) node (4) [] {$\bullet$)
(-11,-1) node (5) [] {$\bullet$}
(-11,-2) node (6) [] {$\bullet$}
(-11,-3) node (7)[] {$\bullet$}
(-11,-4) node (8) [] {$\bullet$)
(-9,4) node (9) [label=above:$\mathsf{G_{2}}$] {$\bullet$}
(-9,3) node (10) [] {$\bullet$}
(-9,2) node (11)[] {$\bullet$}
(-9,1) node (12) [] {$\bullet$)
(-9,-1) node (13) [] {$\bullet$}
(-9,-2) node (14) [] {$\bullet$}
(-9,-3) node (15)[] {$\bullet$}
(-9,-4) node (16) [] {$\bullet$)
(-7,4) node (17) [label=above:$\mathsf{G_{3}}$] {$\bullet$}
(-7,3) node (18) [] {$\bullet$}
(-7,2) node (19)[] {$\bullet$}
(-7,1) node (20) [] {$\bullet$)
(-7,-1) node (21) [] {$\bullet$}
(-7,-2) node (22) [] {$\bullet$}
(-7,-3) node (23)[] {$\bullet$}
(-7,-4) node (24) [] {$\bullet$)
(-5,4) node (25) [label=above:$\mathsf{G_{3}}$] {$\bullet$}
(-5,3) node (26) [] {$\bullet$}
(-5,2) node (27)[] {$\bullet$}
(-5,1) node (28) [] {$\bullet$)
(-5,-1) node (29) [] {$\bullet$}
(-5,-2) node (30) [] {$\bullet$}
(-5,-3) node (31)[] {$\bullet$}
(-5,-4) node (32) [] {$\bullet$)
(-8,-6) node (33) [label=below:$\mathsf{\infty}$] {$\bullet$}
;
\draw
(9)edge[postaction={decorate}, rojo](17)
(17)edge[postaction={decorate}, rojo](29)
(13)edge[postaction={decorate}, rojo](21)
(21)edge[postaction={decorate}, rojo](25)
(2)edge[postaction={decorate}, rojo](22)
(22)edge[postaction={decorate}, rojo](30)
(6)edge[postaction={decorate}, rojo](18)
(18)edge[postaction={decorate}, rojo](26)
(3)edge[postaction={decorate}, rojo](11)
(11)edge[out=45,in=135, postaction={decorate}, rojo](27)
(7)edge[postaction={decorate}, rojo](15)
(15)edge[out=-45,in=-135, postaction={decorate}, rojo](31)
(4)edge[postaction={decorate}, rojo](16)
(16)edge[postaction={decorate}, rojo](20)
(8)edge[postaction={decorate}, rojo](12)
(12)edge[postaction={decorate}, rojo](24)
;
\end{tikzpicture}
\end{figure}
\end{document}
答案1
您的其中一个复制/粘贴内容中有此行
(-5,1) node (28) [] {$\bullet$)
因此它会打开括号,其余部分是 TeX 的正常行为;抱怨代码中遇到的最遥远和最不相关的事情。我有时认为 TeX 会读取两次以找到最模糊的错误消息。
另请检查您的包裹申报,您实际上装载了graphicx
五次,pgf
三次。
TikZ 加载pgf
所有pgf*
模块并且也加载graphicx
。