1

The title says it all. I'm using preamble.tex in R bookdown, and i changed the mainfont using fonspec like this:

\usepackage{fontspec}
\setmainfont{Calibri Light}[SizeFeatures={Size=14}]

Now everything is set to calibri light size 14 and i cannot change anything. If i try to change the footnote fontsize like this:

\renewcommand{\footnotesize}{\small}

Nothing happens. Any help ?

SOLVED:

Thanks to all the useful answers i figured out that i was using the wrong syntax to specify my fontsize.

By using

\usepackage{fontspec}
\setmainfont{Calibri Light}
\renewcommand{\normalsize}{\fontsize{14}{16.5}\selectfont}

I can now properly adjust footnote font size with

\renewcommand{\footnotesize}{\small}

Many thanks for all the answers.

3
  • 2
    Welcome to TeX.SE. I don't think your setup is appropriate. Try \documentclass[14pt]{extarticle} \usepackage{fontspec} \setmainfont{Calibri Light} instead.
    – Mico
    Feb 21 at 21:48
  • Thank you for your response. This is not working because my documentclass is already called as book, since i'm using the package bookdown for R markdown. It' s returning the error ! LaTeX Error: Two \documentclass or \documentstyle commands.
    – Jimmy
    Feb 21 at 23:27
  • You must replace your existing instruction \documentclass[...]{book} with \documentclass[...,14pt]{extbook}, where ... is the set of alread-present options in your document. Then, add \usepackage{fontspec} \setmainfont{Calibri Light}.
    – Mico
    Feb 22 at 1:11

2 Answers 2

2

With SizeFeatures={Size=14} you're precisely telling fontspec that at every requested size, the font will be used at 14pt.

So \footnotesize asks for size 8pt (if the main size is the default 10pt) and you get Calibri Light at 14pt.

If what you want is a large main font size this is definitely not the correct way. But neither is Scale=1.4. Let's see why. I use Calibri, because I don't have Calibri Light.

\documentclass{article}
\usepackage{fontspec}
\usepackage{lipsum}

\setmainfont{Calibri}[Scale=1.4]

\begin{document}

\lipsum[1][1-4]

\end{document}

enter image description here

You get the same with your (wrong) code. The typesetting is too tight and irregular, because the lines are only spaced using \lineskip.

A marginally better result is obtained with 12pt for the document class and the scale to 1.1667 (that is, 14/12):

enter image description here

If you want 14pt as main size, use extarticle.

\documentclass[14pt]{extarticle}
\usepackage{fontspec}
\usepackage{lipsum}

\setmainfont{Calibri}

\begin{document}

\lipsum[1][1-4]

{\footnotesize\lipsum[1][1-4]\par}

\end{document}

enter image description here

3
  • Thank you very much for you detailed response. Unfortunately i'm using package bookdown for R markdown and if i call \documentclass{extarticle} this error returns whiile knitting: ! LaTeX Error: Two \documentclass or \documentstyle commands.
    – Jimmy
    Feb 21 at 23:54
  • Is there a way then, to specify the size for the document via fontspec, and then footnotesize, scriptsize et al. are all automatically derived?
    – mas
    Feb 22 at 1:12
  • 1
    By following the advice from this answer, i figured out the problem, I was indeed using a wrong syntax : SizeFeatures={Size=14}. By using this: \usepackage{fontspec} \setmainfont{Calibri Light} \renewcommand{\normalsize}{\fontsize{14}{16.5}\selectfont} I can now properly adjust the footnote size. Thank you very much for the tips!
    – Jimmy
    Feb 22 at 1:36
1

I use lualatex which requires fontspec. My work is non-math, non-academic. The fonts I use are not loaded as TeX font packages, because they are not LaTeX fonts. Instead, I use fontspec methods to load them directly by file name.

I have discovered that you must set \normalsize prior to loading fontspec, and also prior to loading some other packages. This is reasonable, because those packages need to know something about sizes. The standard TeX document classes do this automatically, since it is part of document class options (or default). But if you are using a custom document class that does not set \normalsize via class option, then you must set it yourself, very early in Preamble.

The trick: Unless your fonts have size-specific files (one file for 10pt, another for 12pt, etc.) fontspec does not care what you set for \normalsize. After loading fontspec, you can re-define \normalsize, even using decimal values (not just integers) for the font size and baseline skip. Then, the fontspec Scale and ScaleAgain will work as expected, wherever you locally use them.

That information may not be useful to those who do math and other academic works, with the standard document classes. But if you have your own custom class (I do), it is worth knowing.

1
  • Thank you very much for your tips! I just needed to specify the font size with this syntax: ` \usepackage{fontspec} \setmainfont{Calibri Light} \renewcommand{\normalsize}{\fontsize{14}{16.5}\selectfont}` I can now properly change the footnote fontsize.
    – Jimmy
    Feb 22 at 1:38

You must log in to answer this question.

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