我正在尝试标记三角形的角度。我不明白为什么我的代码会将名称踢到外面。对于任何格式问题,我深表歉意;这是我在这里的第一篇帖子。
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[dot/.style={fill,circle,inner sep=1.5pt}]
\path
(80:5) node [dot,label=above left:A]{} coordinate (A)
(20:9) node[dot, label=right:B]{} coordinate (B)
(0:0) node[dot,label=below left:C]{} coordinate(C);
\path coordinate (Q)at((C)!(A)!(B)) node at (Q)[]{} ;
\draw[-] (A)--(C);
\draw[-] (C)--(B);
\draw[-] (A)--(B);
\draw[purple!70!black] (A)--(Q);
\tkzMarkRightAngle(A,Q,C);
\draw[|<->|] ((P)!−7mm!90:(B))--node[fill=white,sloped] {x} ((B)!−7mm!−90:(P));
\draw[|<->|] ((Q)!−4.9mm!90:(A))--node[fill=white] {10} ((A)!−3mm!−90:(Q));
\tkzMarkAngle[size=0.75cm,color=black,label=α];
\tkzMarkAngle[size=1cm,color=black,label=β];
\tkzMarkRightAngle(B,A,C);
\end{tikzpicture}
\end{document}
答案1
对代码进行一些努力后,可以获得以下输出。
\documentclass[margin=3mm]{standalone}
\usepackage{tkz-euclide}
\usetikzlibrary{calc}
%\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[dot/.style={fill,circle,inner sep=1.5pt},>=stealth]
\coordinate (C) at (0,0) ;
\coordinate (A) at (80:5);
\coordinate (B) at (20:9) ;
\node [dot] at (C) {};
\node [dot] at (A) {};
\node [dot] at (B) {};
\draw[-] (A)node[above]{A}--(C)node[left]{C};
\draw[-] (C)--(B)node[right]{B};
\draw[-] (A)--(B);
\coordinate (Q) at($(C)!(A)!(B)$) ;
\tkzMarkRightAngle(A,Q,C);
\draw[purple!70!black] (A)--(Q);
\draw[|<->|] ($(Q)!-4.9mm!90:(A)$)--node[fill=white] {10} ($(A)!3mm!90:(Q)$);
\draw[|<->|] ($(C)!-7mm!90:(B)$)--node[fill=white,sloped] {$x$} ($(B)!7mm!90:(C)$);
\tkzMarkAngle[size=0.75,draw = black, fill = white, opacity=1](Q,C,A)
\tkzLabelAngle[pos=1,font=\scriptsize](Q,C,A){$\alpha$}
\tkzMarkAngle[size=0.75,draw = black, fill = white, opacity=1](A,B,Q)
\tkzLabelAngle[pos=1,font=\scriptsize](A,B,Q){$\beta$}
\tkzMarkRightAngle(B,A,C);
\end{tikzpicture}
\end{document}
答案2
仅使用纯tkz-euclide
\documentclass{article} % or another class
\usepackage{xcolor} % before tikz or tkz-euclide if necessary
\usepackage{tkz-euclide} % no need to load TikZ
\begin{document}
\begin{tikzpicture}[scale=1.0]
%define points A,B,C
\tkzDefPoint(0,0){C}
\tkzDefPoint(20:9){B}
\tkzDefPoint(80:5){A}
%label point A,B,C
\tkzLabelPoints(B,C)
\tkzLabelPoints[above](A)
%draw triangleABC
\tkzDrawPolygon[thick,fill=yellow!15](A,B,C)
%get line orthogonal to base CB
\tkzDefPointsBy[projection=onto B--C](A){a}
\tkzDrawSegment[dashed, red](A,a)
%marking right angles
\tkzMarkRightAngle(A,a,C)
\tkzMarkRightAngle(C,A,B)
%drawing dimension 10
\tkzDrawSegment[style=red, dashed, dim={$10$,15pt,midway,font=\scriptsize, rotate=90}](A,a)
%marking the angles
\tkzFillAngle[fill=blue!20, opacity=0.5](B,C,A)
\tkzLabelAngle[pos=1.25](B,C,A){$\alpha$}
\tkzMarkAngle(B,C,A)
\tkzFillAngle[fill=red!20, opacity=0.5](A,B,C)
\tkzLabelAngle[pos=1.25](A,B,C){$\beta$}
\tkzMarkAngle(A,B,C)
\tkzDrawPoints(A,B,C)
\end{tikzpicture}
\end{document}
答案3
使用来自的代码角度标签问题,并注释掉\draw
使用未定义坐标的P
,我可以使用 TeX Live 2019 重现该问题(在 Overleaf 上)
我最初以为这只是使用 的问题\tkzLabelAngle
,但最初给出的结果相同且错误。交换坐标的顺序(即使用(Q,B,A)
而不是 )也(A,B,Q)
没有任何区别。在新版本的 中tkz-euclide
(ferahfeza 的回答中演示了这一点),它按预期工作,因此如果有错误,则已修复。
pos
旧版本的解决方法是在选项中使用负值\tkzLabelAngle
:
\tkzMarkAngle[size=1cm,color=black](A,B,Q);
\tkzLabelAngle[pos=-1.2](Q,B,A){$\beta$};
\documentclass{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[dot/.style={fill,circle,inner sep=1.5pt}]
\path
(80:5) node [dot,label=above left:$A$]{} coordinate (A)
(20:9) node[dot, label=right:$B$]{} coordinate (B)
(0:0) node[dot,label=below left:$C$]{} coordinate(C);
\path coordinate (Q)at($(C)!(A)!(B)$) node at (Q)[]{} ;
\draw[-] (A)--(C);
\draw[-] (C)--(B);
\draw[-] (A)--(B);
\draw[purple!70!black] (A)--(Q);
\tkzMarkRightAngle(A,Q,C);
%\draw[|<->|] ($(P)!-7mm!90:(B)$)--node[fill=white,sloped] {$x$} ($(B)!-7mm!-90:(P)$);
\draw[|<->|] ($(Q)!-4.9mm!90:(A)$)--node[fill=white] {$10$} ($(A)!-3mm!-90:(Q)$);
\tkzMarkAngle[size=0.75cm,color=black,label=a](B,C,A);
\tkzMarkAngle[size=1cm,color=black](A,B,Q);
\tkzLabelAngle[pos=-1.2](Q,B,A){b};
\tkzMarkRightAngle(B,A,C);
\end{tikzpicture}
\end{document}