我想使用我的宏 \angs 来绘制角度标签。我首先尝试了以下代码,但存在一些问题。
\usetikzlibrary{quotes,angles}
\tikzset{
ar/.style={angle radius=#1},
ar/.default=0.65cm,
ae/.style={angle eccentricity=#1},
ae/.default=0.75,
}
\def\angs[#1,#2]#3#4{%
\draw pic[draw,angle radius=#1,"{\scriptsize $#4$}",angle eccentricity=#2] {angle = #3}
}
\begin{tikzpicture}
\coordinate[label=below:{\scriptsize $A$}] (A) at (0,0);
\coordinate[label=below:{\scriptsize $B$}] (B) at (2,0);
\coordinate[label=above:{\scriptsize $C$}] (C) at (3,2);
\draw (A) -- (B) -- (C);
%\draw pic[draw,angle radius=0.65cm,"{\scriptsize $120^{\circ}$}",angle eccentricity=0.5] {angle = C--B--A};
\angs[ar,ae]{A--B--C}{120^{\circ}};
\end{tikzpicture}
答案1
也许你想要类似
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}
\tikzset{
ar/.style={angle radius=#1},
ar/.default=0.65cm,
ae/.style={angle eccentricity=#1},
ae/.default=0.75,
}
\newcommand{\angs}[3][]{%
\draw pic[ar,ae,#1,draw,"{\scriptsize $#3$}"] {angle = #2}
}
\begin{document}
\begin{tikzpicture}
\coordinate[label=below:{\scriptsize $A$}] (A) at (0,0);
\coordinate[label=below:{\scriptsize $B$}] (B) at (2,0);
\coordinate[label=above:{\scriptsize $C$}] (C) at (3,2);
\draw (A) -- (B) -- (C);
\angs[ar,ae]{A--B--C}{240^{\circ}};
\end{tikzpicture}
\begin{tikzpicture}
\coordinate[label=below:{\scriptsize $A$}] (A) at (0,0);
\coordinate[label=below:{\scriptsize $B$}] (B) at (2,0);
\coordinate[label=above:{\scriptsize $C$}] (C) at (3,2);
\draw (A) -- (B) -- (C);
\angs[ar=1cm,ae=.3]{A--B--C}{240^{\circ}};
\end{tikzpicture}
\end{document}