我想在 TikZ 中制作一个图形,编译可以成功,但不包括红色顶点。
这是我的代码的副本以及错误消息:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\title{}
\author{}
\date{}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{ amssymb }
\usepackage[margin=1in,footskip=0.3in]{geometry}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,positioning, decorations.pathmorphing,backgrounds,fit,petri,calc}
\usepackage{float}
\usepackage{pgf,tikz}
\usepackage[all,cmtip]{xy}
\graphicspath{ {images/} }
\usepackage[all]{xy}
\linespread{1.3}
\usepackage{mathtools}
\newcommand\SmallMatrix[1]{{%
\tiny\arraycolsep=0.3\arraycolsep\ensuremath{\begin{pmatrix}#1\end{pmatrix}}}}
\usepackage{enumerate}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=3]
\tkzDefPoint(0,-0.17){a}
\tkzDrawPoints[color=red,fill=red,size=12](a)
\node at ($(0.5,-1.1)$) {$C_1$};
\node at ($(-0.5,-1.1)$) {$C_2$};
\draw (-0.1,0) to (0.5,-1);
\draw (0.1,0) to (-0.5,-1);
\end{tikzpicture}
\caption{Step $1$}
\end{figure}
\end{document}
错误信息如下:
l.38 \tkzDefPoint (0,-0.17){a} 错误消息顶行末尾的控制序列从未被 \def'ed。如果您拼错了(例如,
\hobx'), type
I' 和正确的拼写(例如,I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. Missing character: There is no ( in font nullfont! Missing character: There is no 0 in font nullfont! Missing character: There is no , in font nullfont! Missing character: There is no - in font nullfont! Missing character: There is no 0 in font nullfont! Missing character: There is no . in font nullfont! Missing character: There is no 1 in font nullfont! Missing character: There is no 7 in font nullfont! Missing character: There is no ) in font nullfont! Missing character: There is no a in font nullfont! ! Undefined control sequence. l.40 \tkzDrawPoints [color=red,fill=red,size=12](a) The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g.,
\hobx'),请输入I' and the correct spelling (e.g.,
I\hbox')。否则继续,我会忘记未定义的内容。
它也在我朋友的电脑上运行。所以我很困惑(我使用了与他相同的软件包)。我正在使用 Sharelatex。提前谢谢!
答案1
我宁愿用纯粹的方式绘制此图像tikz
:
这姆韦mathtools
在考虑了有关您的文档序言的上述评论以及调用amsmath˙
、amssymb
调用amssfonts
、tikz
调用pgf
和hyperref
除了cleveref
序言中的最后一个之外的事实后,情况是:
\documentclass[11pt]{article}
\usepackage[margin=1in,footskip=0.3in]{geometry}
\usepackage[utf8]{inputenc}
\title{}
\author{}
\date{}
\usepackage{mathtools,amssymb,amsthm}
\newcommand\SmallMatrix[1]{{%
\tiny\arraycolsep=0.3\arraycolsep\ensuremath{\begin{pmatrix}#1\end{pmatrix}}}}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,positioning, decorations.pathmorphing,backgrounds,fit,petri,calc}
\usepackage[all,cmtip]{xy}
\graphicspath{ {images/} }
\linespread{1.3}
\usepackage{enumerate}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=3]
\fill[red] (0,-0.17) circle (1pt);
\draw ( 0.1,0) -- (-0.5,-1) node[below] {$C_1$};
\draw (-0.1,0) -- ( 0.5,-1) node[below] {$C_2$};
\end{tikzpicture}
\caption{Step $1$}
\end{figure}
答案2
我同意 Zarko 的回答。但是为什么不让 来tikz
完成寻找交点的工作呢?
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,through,backgrounds}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=3]
\coordinate (A) at (0.1,0);
\coordinate (B) at (-0.5,-1);
\draw [name path=A--B] (A) -- (B) node[below] {$C_1$};
\coordinate (C) at (-0.1,0);
\coordinate (D) at ( 0.5,-1);
\draw [name path=C--D] (C) -- (D) node[below] {$C_2$};
\path [name intersections={of=A--B and C--D,by=E}];
\node [circle, fill=red,label=-90:$E$] at (E) {};
\end{tikzpicture}
\caption{Step $1$}
\end{figure}
\end{document}