我的 tikzpicture 无法编译!

我的 tikzpicture 无法编译!

我正在尝试使用 Latex(在 Overleaf 中)编译我的 pdf,尽管昨天晚上编译得很好,但从昨天晚上开始我就无法编译它了。在阅读出现的横幅后,我得出结论,问题出在我添加的 tikzpicture 上(尽管昨天它看起来还不错)。我总共使用了以下软件包:

\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{alphabeta}
\usepackage{amsfonts}
\setlength{\parskip}{0.5em}
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{graphicx}
\graphicspath{ {c:/user/Desktop/images/} }
\usepackage{wrapfig}
\usepackage{fullpage}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{tikz}
\usepackage[bb=boondox]{mathalfa}

然后对于我的图表我有这个:

$$
\begin{tikzpicture}
\draw (1,1) -- (3,0) -- (0,3) -- (1,1);
\draw [dashed] (0,0) -- (0,3);
\draw [dashed] (0,0) -- (3,0);
\node at (0,0)[below left]{$(0,0)$};
\node at (1,1)[left]{$(\frac{1}{3},\frac{1}{3})$};
\node at (1,1)[below]{D}
\node at (0,3)[above]{$(0,1)$};
\node at (3,0)[below right]{$(1,0)$};
\draw[->] (3/2,3/4) -- (3/2,-1/2);
\node at (3/2,-1/2)[below]{$y=\frac{1-x}{2}$};
\draw[->] (3/4,3/2) -- (-1/2,3/2);
\node at (-1/2,3/2)[left]{$y=-2x+1$};
\draw[->] (3/2,3/2) -- (2,3/2);
\node at (2,3/2)[right]{$y=1-x$};
\end{tikzpicture}
$$

我不能不把它包含在我的任务中。我是否必须以其他方式编写它才能编译(即使它以前可以运行)?有没有其他网站可以将其与我作业的其余 5 页一起编译?问题是……我试过只编译它,希望截取屏幕截图,然后将其添加为图片,但程序甚至无法单独编译它!我做错了什么?我发誓这以前不是问题,但现在我无能为力,我的作业要在 5 小时后交……

答案1

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw (1,1) -- (3,0) -- (0,3) -- (1,1);
\draw [dashed] (0,0) -- (0,3);
\draw [dashed] (0,0) -- (3,0);
\node at (0,0)[below left]{$(0,0)$};
\node at (1,1)[left]{$(\frac{1}{3},\frac{1}{3})$};
\node at (1,1)[below]{D}
\node at (0,3)[above]{$(0,1)$};
\node at (3,0)[below right]{$(1,0)$};
\draw[->] (3/2,3/4) -- (3/2,-1/2);
\node at (3/2,-1/2)[below]{$y=\frac{1-x}{2}$};
\draw[->] (3/4,3/2) -- (-1/2,3/2);
\node at (-1/2,3/2)[left]{$y=-2x+1$};
\draw[->] (3/2,3/2) -- (2,3/2);
\node at (2,3/2)[right]{$y=1-x$};
\end{tikzpicture}

\end{document}

给出错误信息

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

See the tikz package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.14 \node
           at (0,3)[above]{$(0,1)$};
? 

;因为第 13 行末尾缺少 。后面;应该有{D}

相关内容