![学习 tkz-euclide 并遇到奇怪的错误](https://linux22.com/image/324347/%E5%AD%A6%E4%B9%A0%20tkz-euclide%20%E5%B9%B6%E9%81%87%E5%88%B0%E5%A5%87%E6%80%AA%E7%9A%84%E9%94%99%E8%AF%AF.png)
我在 Windows 上使用 mikTeX,想制作一些指南针和尺子结构的图形。所以我想使用 tkz-euclide。一个最小的工作示例如下:
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{lmodern}
\usepackage{tkz-euclide,tkz-fct}
\usetkzobj{all} \usetikzlibrary{calc,shapes,decorations}
\begin{document}
\begin{tikzpicture}[scale=1.0]
\tkzDefPoint(0,0){C}
\tkzDefPoint(4,5){A}
\tkzDefPoint(4,-1){B}
\tkzDrawLine[add=0 and 0.4](C,A)
\tkzDrawLine[add=0 and 0.4](C,B)
\tkzDrawArc[R,ultra thin,blue!50](B,3cm)(60,120)
\tkzDrawArc[R,ultra thin,blue!50](A,3cm)(240,300)
\tkzDefMidPoint(A,B) \tkzGetPoint{P}
\tkzDrawLine[add=0 and 0.5](C,P)
\tkzDrawPoint[size=5]{P}
% og nå tegne normalen fra P:
\tkzLabelPoints(A,B,C,P)
\tkzDefLine[perpendicular=through P](C,P) \tkzGetPoint{F}
\tkzDrawLine[add=0.5 and 0.5](P,F)
\tkzShowLine[perpendicular=through P,size=2,orange,gap=3](C,P)
\end{tikzpicture}
\end{document}
运行此程序(使用 emacs 和 auctex)得到:
ERROR: Package pgfkeys Error: I do not know the key '/drawpoint/B' and I am going to ignore it. Perhaps you misspelled it.
--- TeX said ---
--- HELP ---
No help available
由于手册是法语的,所以我有点看不懂……
答案1
错误似乎来自 的参数\tkzDrawPoint
,它不应该在 之间{}
,而应该在 之间()
。通过此修改,代码可以编译。我删除了usenames
的选项xcolor
,因为它已经过时了:
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor}
\usepackage{lmodern}
\usepackage{tkz-euclide,tkz-fct}
\usetkzobj{all} \usetikzlibrary{calc,shapes,decorations}
\begin{document}
\begin{tikzpicture}[scale=1.0]
\tkzDefPoint(0,0){C}
\tkzDefPoint(4,5){A}
\tkzDefPoint(4,-1){B}
\tkzDrawLine[add=0 and 0.4](C,A)
\tkzDrawLine[add=0 and 0.4](C,B)
\tkzDrawArc[R,ultra thin,blue!50](B,3cm)(60,120)
\tkzDrawArc[R,ultra thin,blue!50](A,3cm)(240,300)
\tkzDefMidPoint(A,B) \tkzGetPoint{P}
\tkzDrawLine[add=0 and 0.5](C,P)
\tkzDrawPoint[size=5](P)%{P}
% og nå tegne normalen fra P:
\tkzLabelPoints(A,B,C,P)
\tkzDefLine[perpendicular=through P](C,P) \tkzGetPoint{F}
\tkzDrawLine[add=0.5 and 0.5](P,F)
\tkzShowLine[perpendicular=through P,size=2,orange,gap=3](C,P)
\end{tikzpicture}
\end{document}