15

If one needs to slightly increase the size of the text in a TikZ node. What are the pros and cons of using scale= in the style options instead of changing the font size with the usual LaTeX\TeX macros: \Huge, \Large and \large ?

2
  • 1
    Since you mentioned that you had recently started to read the TeXbook (if I recall correctly from another question), I just found a quote from Knuth regarding this issue and I've added it as an edit to my answer. May 14, 2014 at 22:12
  • 2
    I would say thank you for the quote even if we are not suppose to say thanks here. :-) May 14, 2014 at 22:40

1 Answer 1

18

Scaling affects all the glyph strokes and this can be not very pleasant (some strokes will be unnecessarily and excessively thick); changing the font size using the font switches or \fontsize produce more harmonious results.

Compare the results in the following simple experiment; the upper line uses \fontsize; the lower line uses scale:

\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\usepackage{fix-cm}

\begin{document}

\begin{tikzpicture}
\begin{scope}[scale=12,transform shape]
\node (A) {1234AQMI};
\end{scope}
\node[font=\fontsize{120}{144}\selectfont] at (0,4) (B) {1234AQMI};
\end{tikzpicture}

\end{document}

enter image description here

Of course, for a small scaling factor the difference can be almost imperceptible, but I'd use the font switches for better results unless, of course, one is specifically after the effect produced by scaling.

Addressing this same situation, D. Knuth mentions on the fourth bend sign on page 16 of the TeXbook:

What's the difference between cmr5 at 10pt and the normal 10-point font, cmr10? Plenty; a well-designed font will be drawn differently at different point sizes, and the letters will often have different relative heights and widths, in order to enhance readability[...]

It is usually best to scale fonts only slightly with respect to their design size, unless the final product is going to be photographically reduced after TeX has finished with it, or unless you are trying for an unusual effect.

6
  • 1
    @subhamsoni of course it matters; that's what my answer shows. The second line produced with scale is not as harmonious as the first one using \fontsize. May 14, 2014 at 4:17
  • 1
    @GonzaloMedina: What are the #1 and #2 arguments in font=\fontsize{#1}{#2}\selectfont. Width and height? Jun 3, 2014 at 17:17
  • 1
    @SergioParreiras font size and value for baseline skip. Jun 4, 2014 at 17:17
  • 2
    if you had used (0,-4) the order in the code and the order in the picture would line up, making it easier to follow
    – ted
    Apr 11, 2015 at 23:06
  • 1
    instead of specifying the absolute font size, you can also use font=\small or any of the relative font sizes Feb 10, 2016 at 17:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .