这是我想要绘制的图像。
这就是我目前得到的。
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(2,0){B}
\tkzDefPoint(2,5){C}
\tkzDefPoint(0,4){D}
\tkzDrawPolygon[fill=gray!10](A,B,C,D)
\tkzLabelPoints(A)[anchor=east]{$A$}
\tkzLabelPoints(B)[anchor=west]{$B$}
\tkzLabelPoints(C)[anchor=south]{$C$}
\tkzLabelPoints(D)[anchor=east]{$D$}
\tkzMarkRightAngle(D,A,B)
\tkzLabelSegment[above](A,C){$1$\,cm}
\tkzLabelSegment[left=4pt](B,A){$x$\,cm}
\tkzLabelSegment[right](C,B){$y$\,cm}
\end{tikzpicture}
\end{document}
我究竟做错了什么?
我感谢您的帮助。
答案1
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(2,0){B}
\tkzDefPoint(2,5){C}
\tkzDefPoint(0,4){D}
\tkzDrawPolygon[fill=gray!10](A,B,C,D)
\tkzLabelPoints(B,C)
\tkzLabelPoints[below left](A)
\tkzLabelPoints[below left](D)
\tkzDrawSegment(D,B)
\tkzMarkRightAngle(C,D,B)
\tkzLabelSegment[above=4pt](D,C){$1$\,cm}
\tkzLabelSegment[left=4pt](D,A){$2$\,cm}
\tkzLabelSegment[below](A,B){$1$\,cm}
\tkzLabelSegment[right](B,C){$x$\,cm}
\tkzLabelSegment[right](D,B){$y$\,cm}
\end{tikzpicture}
\end{document}