我正在为我的学生准备一个几何笔记文件,并试图重现我在维基百科上看到的勾股定理证明中的图形。以下是该图
经过反复尝试,我可以用 tikz 画一个直角三角形,但我不知道如何给图形内部着色、标记顶点、标记角度(如下图所示)、画垂直线以及用圆弧或正方形标记直角(如 H 和 C 顶点)。我的职业是数学老师,我的计算机和 TeX 熟练程度很低。我当然会很感激任何帮助。我的目标是创建自己的图形,以免抄袭。我感谢所有帮助者。
编辑:这是我的直角三角形代码
\begin{tikzpicture}[scale=1.25]
\coordinate (A) at (-1.5cm,-1.cm);
\coordinate (C) at (1.5cm,-1.0cm);
\coordinate (B) at (1.5cm,1.0cm);
\draw (A) -- (B) -- (C) -- (A);
\end{tikzpicture}
答案1
我建议使用pst-eucl
模块来解决这个问题pstricks
,它可以模仿平面几何的构造:
\documentclass[border=6pt]{standalone}
\usepackage[x11names,svgnames]{xcolor}%
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}(-1,-1)(7,5)
\psset{PointSymbol=none, linejoin=1,CodeFigStyle=solid, CodeFigColor=black}
\pstTriangle[PosAngle={120,-130,-30}](0,4){A}(0,0){C}(6,0){B}
\pstProjection[CodeFig]{B}{A}{C}[H]\psline(C)(H)
\pspolygon*[linecolor=LightSteelBlue2!90](B)(H)(C)
\pspolygon*[linecolor=YellowGreen!30](C)(H)(A)
\psset{linewidth=0.6pt}
\psline(H)(A)(C)(H)(B)(C)
\psset{MarkAngleRadius=0.8, RightAngleSize=0.25, LabelSep=0.6}%, LabelSep=-0.2cm}
\pstMarkAngle{H}{C}{A}{$\theta$} \pstMarkAngle{B}{C}{H}{}\pstMarkAngle{B}{C}{H}{}
\pstMarkAngle{H}{B}{C}{$\theta$}
\pstMarkAngle{C}{A}{H}{}
\psset{MarkAngleRadius=0.6}
\pstMarkAngle{B}{C}{H}{}
\pstMarkAngle{C}{A}{H}{}
\pstRightAngle{B}{C}{A} \pstRightAngle{C}{H}{A}
\end{pspicture}
\end{document}
答案2
quotes
借助和库的帮助angles
,获得它并不难。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc, angles, quotes, backgrounds}
\begin{document}
\begin{tikzpicture}
\draw (0,0) node[below left] {$C$} coordinate (C) -- (0,3) node[above left] {$A$} coordinate (A) -- (5,0) node[below right] {$B$} coordinate (B)--cycle;
\draw (C)--($(A)!(C)!(B)$) coordinate (H) node[above right]{$H$};
\begin{scope}[on background layer]
\fill[blue!30] (B)--(C)--(H)--cycle;
\fill[green!30] (A)--(C)--(H)--cycle;
\end{scope}
\draw pic[draw] {angle=C--A--H} pic[draw, angle radius=4mm] {angle=C--A--H};
\draw pic["$\theta$",draw, angle radius=7mm, angle eccentricity=.8] {angle=H--B--C};
\draw pic["$\theta$",draw, angle radius=8mm, angle eccentricity=.8] {angle=H--C--A};
\draw pic[draw, angle radius=8mm] {angle=B--C--A} pic[draw, angle radius=7mm] {angle=B--C--H};
\draw pic[draw, angle radius=3mm] {right angle=B--C--A};
\draw pic[draw, angle radius=3mm] {right angle=C--H--A};
\end{tikzpicture}
\end{document}
答案3
这使用了 3-4-5 三角形。
\documentclass[tikz]{standalone}
\usetikzlibrary{calc,angles}
\begin{document}
\begin{tikzpicture}[scale=1]
\coordinate (A) at (0,0);
\coordinate (C) at (0,3);
\coordinate (B) at (4,0);
\coordinate (D) at ($(C)!{9/25}!(B)$);% see derivation below
\draw (A) -- (B) -- (C) -- cycle;
\draw (A) -- (D);
\path pic [draw,angle radius=2mm] {right angle = C--A--B}
pic [draw,angle radius=2mm] {right angle = A--D--B};
\fill[red, opacity=0.5] (A) -- (B) -- (D);
\fill[blue, opacity=0.5] (A) -- (C) -- (D);
\node[below left] at (A) {A};
\node[below right] at (B) {B};
\node[above left] at (C) {C};
\node[above right] at (D) {D};
\end{tikzpicture}
\end{document}