I'm trying to use an otf file that is in the TEXMF tree, but another file with the same name is used instead.

I run lualatex from a locally installed TexLive 2019 on this file:


\setmainfont [
  ItalicFont = LinLibertine_RI.otf,
  BoldFont = LinLibertine_RB.otf,


and get the output

This is LuaTeX, Version 1.10.0 (TeX Live 2019) 
 restricted system commands enabled.
LaTeX2e <2018-12-01>

luaotfload | main : initialization completed in 0.076 seconds
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
No file whichfont.aux.
 410 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 5 attribute, 48 glue_spec
, 5 attribute_list, 1 write nodes
   avail lists: 2:15,3:4,4:1,5:22,6:1,7:16,9:7
Output written on whichfont.pdf (1 page, 2910 bytes).
Transcript written on whichfont.log.

As you can see files that are part of the Texlive 2019 installation are used, except that the file LinLibertine_R.otf is from another location. I would like to instead use the version that is in /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/libertine (or rather the version that is in the TEXMF tree I use when TeXing the file).

I though this would do it:

$ luaotfload-tool --cache=erase
$ luaotfload-tool --update --prefer-texmf

but even after repeating lualatex after those commands it uses the same otf file. What can I do? (A kpsewhich LinLibertine_R.otf finds /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/libertine/LinLibertine_R.otf as expected.)

I thought a workaround could be to use an explicit path, but actually, when adding

Path = /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/libertine/

it still chooses the other file! (It matters what path I write though, because it complains it can't find the file if I give another directory!)

  • It is not. a good idea to install texlive in an own directory and also a texlive with the package manager of your Linux distribution. You should delete the files installed by the package manager.
    – user187802
    Jun 30, 2019 at 13:42
  • Does setting an explicit Path option in the \setmainfont directive help?
    – Mico
    Jun 30, 2019 at 13:57
  • @Mico I mention that as a possible workaround that didn't work at the end. (But even if it did work it's not a real solution anyway.)
    – pst
    Jun 30, 2019 at 14:02
  • 1
    What does your log-file say about the cache path? (look for "Lookup cache loaded from ..."). Jun 30, 2019 at 14:14
  • The output texmf-dist/fonts/opentype/public/libertine/LinLibertine_R.otf shows that the fonts used are from the texlive texmf tree.
    – user51830
    Jun 30, 2019 at 14:45

1 Answer 1


If you just want to prefer fonts in the texmf directory to system fonts, you can set the "location_precedence" of luaotfload:

    "local", "texmf", "system" % The default is "local", "system", "texmf"

\setmainfont [
  ItalicFont = LinLibertine_RI.otf,
  BoldFont = LinLibertine_RB.otf,


This still uses luaotfload's database to find the font. The font loading system also allows to load a font as kpse:the_filname.otf to explicitly request the use of kpse, but this isn't exposed through fontspec.

  • 1
    I have been just considering if we could add an option to luaotfload.conf to set the order. But beside this: is /usr/share/texlive a "system" folder in this sense on linux? Jun 30, 2019 at 14:22
  • @UlrikeFischer That depends on how you set it in the fontconfig configuration files, but if it isn't the font wouldn't be found there in the first place. Jun 30, 2019 at 14:35
  • This gives me an error "[\directlua]:1: '}' expected near <eof>." What's wrong?
    – pst
    Jul 1, 2019 at 9:41
  • 1
    @pst That's fixed now. I used the wrong comment marker. If -- is used inside \directlua, the whole remaining \directlua argument is ignored, in this case including the }. Jul 1, 2019 at 9:54

You must log in to answer this question.

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