I would like to set the exact size, in points, of a font in my TeX document. Perusing through the fontspec documentation, I did not find a lot of information related to setting the font size. So I turned to google. Several posts suggest using \fontsize combined with \selectfont, including:

My question is twofold:

  • Why does fontspec not handle this?
  • Where do \fontsize and \selectfont come from? Are the LaTeX primitives? Are they part of a library?
  • 1
    why should fontspec do something here? \fontsize and \selectfont are the right commands for this and they are already defined by LaTeX. Aug 16, 2021 at 10:32
  • 2
    “Font size” is not a well-defined quantity. Times at 10pt is quite different in size from, say, Lucida at 10pt.
    – egreg
    Aug 16, 2021 at 10:45
  • Do texdoc latex2e for the documentation for the font commands, especially section 4 "Fonts". fontspec package deals with handling font features (face, weight, shape, scale, script, language, faces for specific sizes, OTF font feature switches, etc) and being able to use system fonts. unicode-math package builds on top of that for math, and polyglossia (for example) builds on top of that for multi/poly-lingual typesetting purposes. And so on.
    – Cicada
    Aug 16, 2021 at 11:35
  • @UlrikeFischer could you please tell me more about \fontsize and selectfont? Which library do they belong to? Are they native commands?
    – user32882
    Aug 16, 2021 at 11:48
  • I already wrote: LaTeX defines them, that means the format. Aug 16, 2021 at 11:49

1 Answer 1


You asked, "Where do \fontsize and \selectfont come from? Are the[y] LaTeX primitives? Are they part of a library?"

  • Both macros are defined by the LaTeX2e kernel, or format. The term "primitive" [command] has a special meaning in TeX and LaTeX circles, so it's not wise to call \fontsize and \selectfont "primitives".

  • Just as the original "Plain TeX" format consists of a set of primitives (frequently, but not universally, referred to as "Knuth TeX") and a set of macros that build on these primitives (both the primitives and the aforementioned macros are explained in full detail in the TeXbook), the LaTeX2e format consists of a set of primitives (which these days come from eTeX, not Knuth TeX) and a set of macros defined in the LaTeX2e kernel. The LaTeX kernel may be found in the file latex.ltx.

  • In the current version of latex.ltx ("LaTeX2e <2021-06-01> patch level 1"), the macro \fontsize is defined on lines 7036 and 7037 of the file, as follows:


    The macro \set@fontsize is defined on lines 7985 thru 8002 as follows:

  • The macro \selectfont, in turn, is defined on lines 7954 thru 7985 as follows:

        \ifx\f@linespread\baselinestretch \else
          \set@fontsize\baselinestretch\f@size\f@baselineskip \fi
          \ifcsname \f@encoding/\f@family/\f@series/\f@shape \endcsname
  • As the code demonstrates, both macros are quite complex and rely on a sizable number of subsidiary macros to get much of their work done.

  • You also asked, "Why does fontspec not handle this?" As @UlrikeFischer and @Cicada have already pointed out in comments, there's no need or justifiable reason for making fontspec perform tasks that are handled perfectly well by the existing LaTeX macros \fontsize and \selectfont.

  • This is already beyond my current level of understanding by I do see myself returning to your valuable answer in the near future and understanding more of it as my abilities in LaTeX improve. I trust it is complete and therefore accept it.
    – user32882
    Aug 16, 2021 at 13:28

You must log in to answer this question.

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