这里有一个很好的关于命名角度的答案:https://tex.stackexchange.com/a/55555/227339
我尝试在我的计算机上运行它,但出现以下错误:
据我了解,问题在于范围内的名称路径 = 圆圈是本地的,所以我需要改用名称路径全局。
是的,此代码可以编译并运行:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections}
\newcommand\markangle[6][red]{% [color] {X} {origin} {Y} {mark} {radius}
% filled circle: red by default
\begin{scope}
\path[clip] (#2) -- (#3) -- (#4);
\fill[color=#1,fill opacity=0.5,draw=#1,name path global=circle]
(#3) circle (#6mm);
\end{scope}
% middle calculation
\path[name path=line one] (#3) -- (#2);
\path[name path=line two] (#3) -- (#4);
\path[%
name intersections={of=line one and circle, by={inter one}},
name intersections={of=line two and circle, by={inter two}}
] (inter one) -- (inter two) coordinate[pos=.5] (middle);
% bissectrice definition
\path[%
name path=bissectrice
] (#3) -- (barycentric cs:#3=-1,middle=1.2);
% put mark
\path[
name intersections={of=bissectrice and circle, by={middleArc}}
] (#3) -- (middleArc) node[pos=1.3] {#5};
}
\begin{document}
\begin{tikzpicture}
\coordinate[label=below left:$A$] (A) at (0,0);
\coordinate[label=below right:$B$] (B) at (2,0);
\coordinate[label=above:$C$] (C) at (5,5);
\draw[thick] (B) -- (A) -- (C) -- cycle;
\markangle{A}{B}{C}{$\beta$}{5}
\markangle[blue]{B}{A}{C}{$\alpha$}{6}
\markangle[green]{B}{C}{A}{$\gamma$}{12}
\end{tikzpicture}
\end{document}
但如果我没猜错,name math global 会迫使我在整个文档中使用唯一的路径名。这在大型项目中确实很不方便。
然后我想起来:答案中的原始代码没有“全局”选项!这意味着它可以被编译,但为什么我会收到错误?