28

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.

11
  • 6
    @egreg Surely you realise what an incredibly unhelpful response that is.
    – Marcin
    Commented Oct 31, 2013 at 21:16
  • 4
    @Mico There are no error messages. The behaviour is as described. Not every question requires an MWE.
    – Marcin
    Commented Oct 31, 2013 at 21:17
  • 8
    @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
    Commented Oct 31, 2013 at 21:19
  • 6
    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
    Commented Oct 31, 2013 at 21:25
  • 3
    @Mico If you don't like the way I've asked this question, feel free not to answer it.
    – Marcin
    Commented Oct 31, 2013 at 21:46

3 Answers 3

29

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}

\linespread{0.95833} % 11.5/12

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

enter image description here

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}
10
  • Unfortunately, this does not scale math, which the \normalsize solution does. Commented Dec 3, 2015 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
    Commented Dec 3, 2015 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. Commented Dec 3, 2015 at 16:26
  • 1
    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? Commented Jun 18, 2016 at 20:51
  • 1
    @egreg, please see this question in regards to the issue of using Scale to specify font size. Commented Jun 19, 2016 at 5:08
3

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

Code adapted from: http://wiki.lyx.org/FAQ/ChangeFontUsingLatex

2
  • 4
    It's disappointing to me that people downvote without explaining their downvotes. Now I have no idea whether this is a useful answer or not without doing my own investigation. I know that some people believe in downvoting answers by the person asking the question. (I don't.) Perhaps that's the reason.
    – Mars
    Commented Dec 19, 2014 at 17:12
  • 3
    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. Commented Dec 3, 2015 at 16:23
2

If you can afford to use a different class, then the Koma-Script ones will give you a lot more flexibility in terms of size:

\documentclass[fontsize=11.5pt]{scrartcl}

This has the added advantage that it applies to all fonts in the document (tt, etc), without requiring individual scaling.

You must log in to answer this question.

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