![如何使用 TikZ 缩放角度标签?](https://linux22.com/image/370474/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20TikZ%20%E7%BC%A9%E6%94%BE%E8%A7%92%E5%BA%A6%E6%A0%87%E7%AD%BE%EF%BC%9F.png)
我希望能够缩放这个角度的标签:
代码:
\documentclass[a4paper,12pt]{article}
\usepackage{siunitx}
\usepackage{tikz}
\usetikzlibrary{angles, quotes}
\begin{document}
\begin{tikzpicture}
% Declare Points
\coordinate (X) at (6,1);
\coordinate (A) at (0,0);
\coordinate (Y) at (3,5);
% Draw Angle
\draw[thick] (X) -- (A) -- (Y)
pic ["\ang{38}", draw, thick, angle eccentricity=1.8] {angle = X--A--Y};
% Label Points
\draw (A) node[below left, scale=0.85] {A};
\end{tikzpicture}
\end{document}
不令人满意的解决方法
画画"{\small \ang{38}}"
也行,但我更喜欢规模标签(与其他元素类似,例如顶点的名称)。
失败尝试 #1
这给了我尝试的想法pic ["\ang{38}", draw, thick, angle eccentricity=1.8, text scale=0.85] {angle = X--A--Y};
,但text scale
似乎不存在,因为我得到:
! Package pgfkeys Error: I do not know the key '/tikz/text scale', to which you
passed '0.85', and I am going to ignore it. Perhaps you misspelled it.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.17 ...ck, angle eccentricity=1.8, text scale=0.85]
{angle = X--A--Y};
失败尝试 #2
从那里我发现了这一点:
您可以使用简单的字符串“text”或带有选项的字符串,例如 node["text" {red, draw, thick}] 来实现类似 node[label={[red,draw,thick]text}] 的效果,书写更少,可读性更高。
但是,为了简单地测试颜色,作为开始,写作pic [node["\ang{38}" {red}], draw, thick, angle eccentricity=1.8] {angle = X--A--Y};
导致:
\xparse function is not expandable
l.17 pic [node["\ang{38}" {red}]
, draw, thick, angle eccentricity=1.8] {angle ...
而且可读性较差的方式也会出现错误。
问题
我是否可以采用这个建议或任何其他方法来规模角度的标签?
答案1
"\ang{38}"scale=0.5
。
一般来说quotes
,语法是"label text" {<options for label node>}, <other stuff>
。如果只有一个选项,则不需要括号。
\documentclass[a4paper,12pt]{article}
\usepackage{siunitx}
\usepackage{tikz}
\usetikzlibrary{angles, quotes}
\begin{document}
\begin{tikzpicture}
% Declare Points
\coordinate (X) at (6,1);
\coordinate (A) at (0,0);
\coordinate (Y) at (3,5);
% Draw Angle
\draw[thick] (X) -- (A) -- (Y)
pic ["\ang{38}"scale=0.5, draw, thick, angle eccentricity=1.8] {angle = X--A--Y};
% Label Points
\draw (A) node[below left, scale=0.85] {A};
\end{tikzpicture}
\end{document}