3

I would like to be able to scale the label of this angle:

enter image description here

Code:

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

Unsatisfying workaround

Drawing "{\small \ang{38}}" kind of "works", but I'd prefer to scale the label (like the other elements, for instance the vertex' name).

Failed attempt #1

This gave me the idea to try pic ["\ang{38}", draw, thick, angle eccentricity=1.8, text scale=0.85] {angle = X--A--Y};, but text scale doesn't seem to exist, because I get:

! 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};

Failed attempt #2

From there I've found this:

You can use a simple string “text” or a string with options, such as node["text" {red, draw, thick}] to achieve an effect like node[label={[red,draw,thick]text}] with less writing and more readability.

But then, in order to simply test the color, as a start, writing pic [node["\ang{38}" {red}], draw, thick, angle eccentricity=1.8] {angle = X--A--Y}; leads to:

\xparse function is not expandable 
l.17 pic [node["\ang{38}" {red}]
                              , draw, thick, angle eccentricity=1.8] {angle ...

And the less readable way also gives an error.

Question

Is there a way I can use this advice, or any other mean, to scale the angle's label?

  • font=\small ? – user121799 Feb 14 '18 at 18:29
  • Hum, wouldn't this be quite the same as the unsatisfying workaround? – zezollo Feb 14 '18 at 18:31
  • Most likely I did not understand what you are asking. I thought "but I'd prefer to scale the label (like the other elements, for instance the vertex' name" means you want to make all text smaller. – user121799 Feb 14 '18 at 18:33
  • Oh, you mean instead of using a scale of 0.85 for the vertex, just do not scale anything and change the font size of the whole picture? – zezollo Feb 14 '18 at 18:38
  • If you want to decrease the font size of the whole tikzpicture (that is for every text that appears inside), just put the relating command \small or \footnotesize or whatever directly behind \begin{tikzpicture}. – Jasper Habicht Feb 14 '18 at 18:41
4

"\ang{38}"scale=0.5.

In general with the quotes syntax, "label text" {<options for label node>}, <other stuff>. If you only have one option, the braces aren't required.

smaller label

\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}
  • I guess this answers the question you asked, though it seems from the comments that might have been the wrong question. – Torbjørn T. Feb 14 '18 at 18:48
  • Yet your answer is correct and may be useful in other cases I am currently meeting! I thought this was just not possible, but it is. In the same time, for the present case, the solution given in comments will probably make it even easier. – zezollo Feb 14 '18 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.