8

When doing \usepackage{fontspec}, where and how is the default font name specified?

On my TeX Live 2019, I see this font filename on the console log of the lualatex compilation: /usr/share/texmf/fonts/opentype/public/lm/lmroman10-regular.otf. Where is it configured?

FYI I wasn't able to find anything useful by eyeballing the output of grep -iE 'lmodern|latin.?modern' $(dpkg -L texlive-latex-recommended texlive-latex-base texlive-luatex) 2>/dev/null.

4
  • 1
    The default font is indeed Latin Modern.
    – Bernard
    Jan 13, 2019 at 23:41
  • @Bernard: I know that the default font is Latin Modern. I'm interested in which config file specifies it. Do you know?
    – pts
    Jan 13, 2019 at 23:42
  • 1
    I thought you wondered which was the default font. As far as I understand LaTeX 3 code, it seems to be set in lines 475–477 of fontspec-luatex.sty and fontspec-xetex.sty.
    – Bernard
    Jan 13, 2019 at 23:53
  • 1
    note that TU encoded latin modern is already the default in lualatex (since 2015) even before fontspec is loaded. Jan 14, 2019 at 0:08

1 Answer 1

9

The Latin Modern fonts are preloaded at format creation. If you look in

/usr/local/texlive/2018/texmf-var/web2c/xetex/xelatex.log

(the location may vary depending on the flavor of TeX Live you're using) you find

(/usr/local/texlive/2018/texmf-dist/tex/latex/base/tuenc.def
File: tuenc.def 2018/08/11 v2.0j Standard LaTeX file
)
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/tulmr.fd
File: tulmr.fd 2017/01/26 v1.8 Standard LaTeX font definitions for Latin Modern
)
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/tulmss.fd
File: tulmss.fd 2017/01/26 v1.8 Standard LaTeX font definitions for Latin Modern
)
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/tulmtt.fd
File: tulmtt.fd 2017/01/26 v1.8 Standard LaTeX font definitions for Latin Modern
)

Similarly for lualatex.log.

This is because if the engine is XeLaTeX or LuaLaTeX, the default encoding is set to TU and the default font family to lmr. The file tulmr.fd contains

\DeclareFontFamily{TU}{lmr}{}
\DeclareFontShape{TU}{lmr}{m}{n}%
  {<-5.5>    \UnicodeFontFile{lmroman5-regular}{\UnicodeFontTeXLigatures}
   <5.5-6.5> \UnicodeFontFile{lmroman6-regular}{\UnicodeFontTeXLigatures}
   <6.5-7.5> \UnicodeFontFile{lmroman7-regular}{\UnicodeFontTeXLigatures}
   <7.5-8.5> \UnicodeFontFile{lmroman8-regular}{\UnicodeFontTeXLigatures}
   <8.5-9.5> \UnicodeFontFile{lmroman9-regular}{\UnicodeFontTeXLigatures}
   <9.5-11>  \UnicodeFontFile{lmroman10-regular}{\UnicodeFontTeXLigatures}
   <11-15>   \UnicodeFontFile{lmroman12-regular}{\UnicodeFontTeXLigatures}
   <15-> \UnicodeFontFile{lmroman17-regular}{\UnicodeFontTeXLigatures}
   }{}

and other font definitions.

It's no longer a job for fontspec to define the standard fonts, as it used to be up to TeX Live 2015.

1
  • 2
    Thank you for clarifying this! FYI my fontmath.cfg contains cmr fonts, but lmodern.sty specifies lmr for math as well. So running \usepackage{lmodern} makes a difference: lmmi10.pfb will be used instead of cmmi10.pfb for math.
    – pts
    Jan 14, 2019 at 0:20

You must log in to answer this question.

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