如何使用 TikZ 縮放角度標籤?

如何使用 TikZ 縮放角度標籤?

我希望能夠縮放這個角度的標籤:

在此輸入影像描述

代碼:

\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}

相關內容