[Tex/LaTex] Adjusting font size with TikZ picture

fontsizenodestikz-pgf

Taking from the PGF manual,

\begin{tikzpicture}
  \draw [help lines] (0,0) grid (3,3);
  \coordinate (a) at (rnd,rnd);
  \coordinate (b) at (3-rnd,3-rnd);
  \draw (a) -- (b);
  \node (c) at (1,2) {x};
  \draw let \p1 = ($ (a)!(c)!(b) - (c) $),
            \n1 = {veclen(\x1,\y1)}
        in circle [at=(c), radius=\n1];
\end{tikzpicture}

I'd like to increase the size of x. The problem is that I have multiple circles in the same diagram. Some of them require a larger sized font, while others are okay at default. How do I do this?

Best Answer

You can change the font size inside a tikZ node like you do it in normal LaTeX – use one of these:

\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge

e.g.

\node (c) at (1,2) {\large x};

or

\node (c) at (1,2) {\large $x$}; %note the \large *outside* the inline math

Edit: To change font size inside math mode, LaTeX provides the following commands:

\displaystyle
\textstyle
\scriptstyle
\scriptscriptstyle

Using scaling algorithms provided by tikZ/pgf (e.g. scale=...) scales "the entire character", so it may look ugly if you use too much scaling. If you set the font sizes with the above commands, LaTeX selects different symbols for the different font sizes. This ensures the fonts are readable and have enough "details". If you want a more extreme scaling, use the scale=3.0 option for the node.