\begin{tikzpicture}
\draw[help lines](0,0)grid(3,2);
\coordinate(a)at(0,1);
\coordinate(b)at(3,2);
\coordinate(c)at(2.5,0);
\coordinate(e)at($(a)!(c)!(b)$);
\draw[blue](c)--($(a)!(c)!(b)$);
\node[left](a)at(0,1){$A$};
\node[right](b)at(3,2){$B$};
\node[below](c)at(2.5,0){$C$};
\node[above](d)at($(a)!(c)!(b)$){$D$};
\end{tikzpicture}

2 回答2

16
方法一:加载`angles`库 ```tex %\usetikzlibrary{angles} \begin{tikzpicture} \draw[help lines](0,0)grid(3,2); \coordinate(a)at(0,1); \coordinate(b)at(3,2); \coordinate(c)at(2.5,0); \coordinate(e)at($(a)!(c)!(b)$); \draw[blue](c)--($(a)!(c)!(b)$); \node[left]at(0,1){$A$}; \node[right]at(3,2){$B$}; \node[below]at(2.5,0){$C$}; \node[above]at($(a)!(c)!(b)$){$D$}; \draw pic[draw,scale=0.2]{right angle =b--e--c};%%绘制直角 \end{tikzpicture} ``` 方法二 用`tkz-euclide`包的`angles`库 ```tex %\usepackage{tkz-euclide} %\usetkzobj{angles} \begin{tikzpicture} \draw[help lines](0,0)grid(3,2); \coordinate(a)at(0,1); \coordinate(b)at(3,2); \coordinate(c)at(2.5,0); \coordinate(e)at($(a)!(c)!(b)$); \draw[blue](c)--($(a)!(c)!(b)$); \node[left]at(0,1){$A$}; \node[right]at(3,2){$B$}; \node[below]at(2.5,0){$C$}; \node[above]at($(a)!(c)!(b)$){$D$}; \tkzMarkRightAngle[scale=0.4](b,e,c)%%绘制直角 \end{tikzpicture} ```
  • 第一种方法显示错误:! Package pgfkeys Error: I do not know the key '/tikz/pics/right angle', to whi ch you pas – yqc_1013 2019-11-05 16:10 回复
2
一个偷懒不嫌麻烦的办法,用 turn 选项: ```tex \begin{tikzpicture} \draw[help lines](0,0)grid(3,2); \coordinate(a)at(0,1); \coordinate(b)at(3,2); \coordinate(c)at(2.5,0); \coordinate(d)at($(a)!(c)!(b)$); \path(c)--(d) -- ([turn]90:2mm) coordinate (t1) -- ([turn]90:2mm) coordinate (t2) -- ([turn]90:2mm) coordinate (t3); \draw[blue](c)--(d); \draw[red](t1)--(t2)--(t3); \node[left](A)at(0,1){$A$}; \node[right](B)at(3,2){$B$}; \node[below](C)at(2.5,0){$C$}; \node[above](D)at(d){$D$}; \end{tikzpicture} ```

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。