texlive 2019 中包含 tkz-euclide 后,以下 MWE 可以工作
\documentclass{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){B}
\tkzDefPoint(6,0){A}
\tkzDefPoint(4,3){C}
\tkzDrawPolygon(A,B,C)
\tkzLabelSegment[below](A,B){$c$})
\tkzLabelSegment[left](B,C){$a$})
\tkzLabelSegment[above](A,C){$b$})
\tkzDrawAltitude(A,B)(C)
\tkzGetPoint{D}
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints(A,B,D)
\tkzMarkRightAngle(C,D,B)
\tkzLabelPoint[above](C){C}
\tkzLabelSegment[above](B,D){$m$}
\tkzLabelSegment[above](A,D){$n$}
\tkzLabelSegment[left](C,D){$h$}
\end{tikzpicture}
\end{document}
但是,在 texlive 2020(版本 3.06c)中包含 tkz-euclide 时,(在注释行之后\usetkzobj{all}
)出现以下错误
! Package pgf Error: No shape named `B,C,D' is known.
See the pgf package documentation for explanation.
Type H <return> for immediate help.
...
l.15 \tkzDrawPoints(A,B,C,D)
不知道哪里出了问题。有什么提示吗?
答案1
\tkzDrawAltitude
我不知道做了什么更改,但我注意到手册中没有记录tkz-euclide
。但是\tkzDrawLine[altitude]
,通过这样做
\tkzDrawLine[altitude](A,C,B)
我明白了
完整代码(有三个多余的)
,每个后面一个\tkzLabelSegment
,我都删除了):
\documentclass[border=4mm]{standalone}
\usepackage{tkz-euclide}
%\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){B}
\tkzDefPoint(6,0){A}
\tkzDefPoint(4,3){C}
\tkzDrawPolygon(A,B,C)
\tkzLabelSegment[below](A,B){$c$}
\tkzLabelSegment[left](B,C){$a$}
\tkzLabelSegment[above](A,C){$b$}
\tkzDrawLine[altitude](A,C,B)
\tkzGetPoint{D}
\tkzDrawPoints(A,B,C,D)
\tkzLabelPoints(A,B,D)
\tkzMarkRightAngle(C,D,B)
\tkzLabelPoint[above](C){C}
\tkzLabelSegment[above](B,D){$m$}
\tkzLabelSegment[above](A,D){$n$}
\tkzLabelSegment[left](C,D){$h$}
\end{tikzpicture}
\end{document}