# Change default font size while using fontspec

I'd like to set the main font size (i.e. all text which isn't a heading or something else with an explicit font size) to a particular font size, in this case, 9.5pt.

I can't use the default package options. I also can't use \fontsize{9.5pt}{9.5pt}\selectfont at the start of my document because then latex (xelatex 3.1415926-2.4-0.9998 (MiKTeX 2.9)) selects some other font than the font set with \setmainfont.

What's a nice, simple way to set the default font size, analogous to the \setmainfont command from fontspec?

I have no version information about fontspec.

• \setmainfont[Ligatures=TeX,Scale=0.95]{Some Nice Font} – egreg Oct 31 '13 at 21:11
• @egreg Surely you realise what an incredibly unhelpful response that is. – Marcin Oct 31 '13 at 21:16
• @Mico There are no error messages. The behaviour is as described. Not every question requires an MWE. – Marcin Oct 31 '13 at 21:17
• @Marcin You're saying that XeLaTeX selects a different font; this is not what one expects and XeLaTeX does normally; so a MWE is needed. However, my proposal will work, because when a 10pt font is requested, XeLaTeX will use it scaled, so you'll get 9.5pt. – egreg Oct 31 '13 at 21:19
• It may be the case that not every question requires an MWE. Experience does show, though, that the odds that someone will come up with a diagnosis and, better still, a solution to the problem(s) you describe improve dramatically if an MWE is, in fact, provided. – Mico Oct 31 '13 at 21:25

I can't see what's wrong with scaling the main font:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Scale=0.95]{Linux Libertine O}

\usepackage{blindtext}

\begin{document}
\blinddocument
\end{document}


With \Large you'll get 13.4 instead of 14pt; it doesn't seem a big difference (and I'd say it's even better). At \Huge the font will be 24pt instead of 25pt.

This can be supplemented by appropriate \DeclareMathSizes commands, where the last three arguments are scaled at 95%:

\DeclareMathSizes{5}{4.75}{4.75}{4.75}
\DeclareMathSizes{6}{5.7}{4.75}{4.75}
\DeclareMathSizes{7}{6.65}{4.75}{4.75}
\DeclareMathSizes{8}{7.6}{5.7}{4.75}
\DeclareMathSizes{9}{8.55}{5.7}{4.75}
\DeclareMathSizes{\@xpt}{9.5}{6.65}{4.75}
\DeclareMathSizes{\@xipt}{10.4}{7.6}{5.7}
\DeclareMathSizes{\@xiipt}{11.4}{7.6}{5.7}
\DeclareMathSizes{\@xivpt}{13.68}{9.5}{6.65}
\DeclareMathSizes{\@xviipt}{16.42}{11.4}{9.5}
\DeclareMathSizes{\@xxpt}{19.7}{13.68}{11.4}
\DeclareMathSizes{\@xxvpt}{23.64}{19.7}{16.42}

• Unfortunately, this does not scale math, which the \normalsize solution does. – Alexander Pavlov Dec 3 '15 at 16:09
• @AlexanderPavlov Sorry, but scaling math was not required; redefining \normalsize is definitely not the way to go. There's the much safer \DeclareMathSizes command. – egreg Dec 3 '15 at 16:10
• Yes, that definitely looks like dangerous tinkering and too low-level. But see my comment below for @Marcin's answer, is a package setting default document font size, including math, to an arbitrary integer parameter possible? Being stuck with standard 10, 11, 12pt while having all of the fontspec's modern might at your disposal is really silly. – Alexander Pavlov Dec 3 '15 at 16:26
• The problem with scaling the main font is that some journals require exact font sizes of various pieces of text. Is there a way to ensure that you're getting e.g., exactly 11.5pt size? – Jonathan W. Jun 18 '16 at 20:51
• @egreg, please see this question in regards to the issue of using Scale to specify font size. – Jonathan W. Jun 19 '16 at 5:08

Unfortunately, the only way to do this (without, perhaps, using the KOMA packages), is to redefine \normalsize:

\makeatletter
\renewcommand\normalsize{%
\@setfontsize\normalsize{9.5pt}{11.5pt}% Will look incredibly crabbed if line height is too small
\abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@%
\abovedisplayshortskip \z@ \@plus2\p@%
\belowdisplayshortskip 5\p@ \@plus2\p@ \@minus3\p@%
\belowdisplayskip \abovedisplayskip%
\let\@listi\@listI%
}
\normalsize
\makeatother


• Hey, was looking to scale an entire document including math, and yours was the only answer which accomplished that! However, to get a consistent document for large sizes, you really have to redefine \small, \large, \huge etc., essentially redo from scratch what the .clo files do for standard document classes. Interesting that header comments in size12.clo mention classes.dtx with options 12pt. So maybe the .clo files can actually be computed with the base size as a parameter, and one might even try to roll a package that does this for any size. It won't be perfect but sounds tempting. – Alexander Pavlov Dec 3 '15 at 16:23
\documentclass[fontsize=11.5pt]{scrartcl}