![帮助使用 tikz 在 Latex 中完成图表](https://linux22.com/image/471892/%E5%B8%AE%E5%8A%A9%E4%BD%BF%E7%94%A8%20tikz%20%E5%9C%A8%20Latex%20%E4%B8%AD%E5%AE%8C%E6%88%90%E5%9B%BE%E8%A1%A8.png)
我的代码:
\documentclass[tikz,border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}[scale=1.5, angle radius=0.5cm]
\coordinate[label=left:A] (A) at (0,0);
\coordinate[label=right:B] (B) at (4,0);
\coordinate[label=above:F] (F) at (2.5,2.5);
\coordinate[label=below:E] (E) at (2,0);
\draw[thick, red] (A) -- (B);
\draw[thick] (E) -- (F);
\draw
pic[draw, fill=yellow!80, angle radius=-0.5cm, "$\alpha$"] {angle=B--E--A}
pic[draw, fill=green!50, angle radius=0.1cm, "$\beta$"] {angle=B--E--A};
\end{tikzpicture}
\end{document}
答案1
请尝试以下操作:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles,
backgrounds,
quotes}
\begin{document}
\begin{tikzpicture}[
> = stealth,
angle radius = 7mm,
MA/.style = {draw, fill=#1,
angle eccentricity=0.6,
font=\large} % angle label position!
]
\draw[thick, red] (0, 0) coordinate[label= left:A] (A) -- ++
(4, 0) coordinate[label=right:B] (B);
\draw[thick] (1.5,0) coordinate (O) -- ++
(1,2.5) coordinate[label=F] (F)
(O) -- ++ (-0.4,-1) coordinate[label=below:E];
\scoped[on background layer]
{
\pic [MA=green, "$\alpha$"] {angle=F--O--A};
\pic [MA=yellow, "$\beta$"] {angle=B--O--F};
}
\end{tikzpicture}
\end{document}
答案2
和tkz-euclide
\documentclass[border=5mm]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/A,4/0/B,-0.4/-1/E,2.5/2.5/F}
\tkzInterLL(A,B)(E,F)\tkzGetPoint{O}
%
\tkzFillAngle[draw,fill=yellow!80](F,O,A)
\tkzLabelAngle[pos = 0.5](F,O,A){$\alpha$}%
\tkzFillAngle[draw,fill=green!50](B,O,F)
\tkzLabelAngle[pos = 0.5](B,O,F){$\beta$}%
%
\tkzDrawLines[red](A,B)
\tkzDrawLines(E,F)
%
\tkzDrawPoints(A,B,E,F)
\tkzLabelPoints(A,B,E,F)
\end{tikzpicture}
\end{document}