Fontsizing in LaTeX
Richard Mortier · January 24, 2025 · #tech #researchI recently had colleagues hit an issue that I have hit myself in the past, and so I finally decided to figure out a fix.
Specifically, when building EPSRC research proposals in LaTeX, getting a complaint that the font size is non compliant – it should be 11pt Arial, but the standard LaTeX options generate something slightly smaller, with Adobe Acrobat and Microsoft tools both reporting a size of 10.45pt or so.
One proposed solution was the to add the following in the preamble:
\AtBeginDocument
…but that did not work unfortunately.
After some poking about and staring at output and searching the interwebs, it appears that this was triggered, at least for me, by the fontspec
package that was being used to sort out fonts and unicode and so on in conjunction with XeLaTeX as a backend driver.
A key piece of debug logic was to add the following text in a document:
The quick fox --- \the\fontdimen6\font\relax
…which ensured there was some text and then inserted the font dimesions according to LaTeX. It did indeed produce the output The quick fox — 9.54147pt
when it should’ve been 10pt
.
The font runes I was using were
\defaultfontfeatures
\setmainfont
\setmonofont
…and it seemed to be the Scale=MatchUppercase
clause that caused the problem. Further investigation suggested that most of that was actually copypasta legacy code that was no longer required; replacing with
\setmainfont
\setmonofont
…gave the output The quick fox — 10.0pt
in Arial as expected. Which was nice.
I also realised in the course of doing this that xelatex
is now deprecated as a backend, so I have started using the still actively developed luatex
backend driver instead by passing -lualatex
to latexmk
and that has worked fine so far