I can load the package 'librebaskerville' but I can't seem to refer to it in commands that take the name of a font.

Here's a short .tex file to demonstrate:



% All of these fail
\newfontfamily{\smallcaps}[RawFeature={+c2sc,+scmp}]{Libre Baskerville}

Some text.

Running with latexmk -xelatex (on both Ubuntu 18.04 and OSX 12.4), this generates an error message like this:

(/usr/local/texlive/2020/texmf-dist/tex/latex/base/textcomp.sty))kpathsea:make_tex: Invalid filename `Libre Baskerville', contains ' '

! Package fontspec Error: The font "Libre Baskerville" cannot be found.

What name is needed to refer to the librebaskerville font in commands like \newfontfamily, \setmathsfont, and \setmathrm? Or how could I find out? (I already did a bunch of googling.)

Update: The above .tex file works on Overleaf.

  • 1
    Note that it is a good idea to mention which engine you are using. As e.e. lualatex is much more forgiven than xelatex.
    – daleif
    Oct 4, 2022 at 13:08
  • Note you can also use the file name as well as the internal font name (this is required for xetex texlive fonts unless you have configured fontconfig to index texlive) Oct 4, 2022 at 13:13
  • Your document works without error for me in texlive 2022 xelatex and lualatex (with fontconfig set up for xetex) tex.stackexchange.com/a/619577/1090 Oct 4, 2022 at 13:16
  • @daleif Thanks! I just edited the question to say that I ran latexmk -xelatex. Is there anything else I need to do to indicate the engine?
    – Ben Kovitz
    Oct 4, 2022 at 13:21
  • @DavidCarlisle Thanks! I will try upgrading to TeX Live 2022. And thanks for that link to your answer to a similar question: that might be the crucial piece of the puzzle.
    – Ben Kovitz
    Oct 4, 2022 at 13:24

3 Answers 3


Although the inimitable @egreg gave an answer that got to the root of your problem, nobody’s yet given a completely literal one, and someone who finds this page in a search might be looking for one.

A good way to find a font by name from the command line is

luaotfload-tool --find "Libre Baskerville" --fuzzy

If the name is correct, this will display the full path of the file.

If that doesn’t get you the exact match—if you had only remembered that it was some version of Baskerville—--fuzzy would have told you that the closest match was BaskervilleF. If it finds the wrong font, you can tell it to show the top few matches. So,

luaotfload-tool --find "Baskerville" --fuzzy --limit=4

on my box gives me

luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "Baskerville" not found.
luaotfload | resolve : sequence of 3 lookups yielded nothing appropriate.
luaotfload | resolve : Cannot find "Baskerville" in index.
luaotfload | resolve : Looking for close matches, this may take a while ...
luaotfload | query : Distance from "baskerville": 1
luaotfload | query : Distance from "baskerville": 3
luaotfload | query : Distance from "baskerville": 5
    BaskervilleF Bold
    Libre Baskerville
luaotfload | query : Distance from "baskerville": 6

It’s also possible to give more complex queries to either luaotfload-tool, fc-match or fc-search, but the above is usually what you want.

At this point, you want to check for a file named LibreBaskerville.fontspec, with a filename search or kpsewhich LibreBaskerville.fontspec. If that existed, all configuration would be done for you and \setmainfont{LibreBaskerville} would load it. In this case, however, it does not.

Once you have the path, searching the directory will give you the filenames of the fonts in the family. In this case: LibreBaskerville-Bold.ttf, LibreBaskerville-Italic.ttf, LibreBaskerville-Regular.ttf and LibreBskvl-BoldItalic.ttf. The recommended way to load this family is by filename, like in egreg’s answer, although I usually do it slightly differently in case I need to re-use the same font family:

  UprightFont    = *-Regular,
  ItalicFont     = *-Italic,
  BoldFont       = *-Bold,
  BoldItalicFont = LibreBskvl-BoldItalic,
  SmallCapsFont  = BaskervilleF-Regular.otf,

% I don’t want to repeat all of the above multiple times when I select the
% same font more than once, and probably introduce inconsistencies.

However, there is also another way. If you tell luaotfload-tool to display font information and not just the filename, it will give you all the font’s internal names. So,

luaotfload-tool --find "Libre Baskerville" -i

will give you a big dump that includes

compatiblename: Libre Baskerville
        family: Libre Baskerville
      fontname: LibreBaskerville-Regular

and a number of others. Normally, fontspec should be able to find the font by one of these names, but it doesn’t always work.

  • Ah, I'm glad to see a direct answer to the question. I did not know about Scale=MatchLowercase. I'll be putting that to use. I'm getting the error message "Misplaced equals sign in key-value input on line 125" on \newfontfamily\baskerville{LibreBaskerville}. Any suggestions?
    – Ben Kovitz
    Oct 10, 2022 at 13:01
  • I just fixed that error: a missing comma (I added it to your answer). It looks like Scale=MatchLowercase reduced the font size throughout the whole document, so I took that out. But I will use it later to scale Friz Quadrata, which is interspersed with the body text. Thanks! I'll accept this answer barring any surprises showing up in the next day or so.
    – Ben Kovitz
    Oct 10, 2022 at 13:22

If I look for the features of the LibreBaskerville font distributed with TeX Live in


by doing

otfinfo -f $(kpsewhich LibreBaskerville-Regular.ttf)

I get

dlig    Discretionary Ligatures
frac    Fractions
kern    Kerning
liga    Standard Ligatures
ordn    Ordinals
sinf    Scientific Inferiors
sups    Superscript

which reveals that small caps are not supported.

To the contrary, BaskervilleF does support them.


  UprightFont    = *-Regular,
  ItalicFont     = *-Italic,
  BoldFont       = *-Bold,
  BoldItalicFont = LibreBskvl-BoldItalic,
  SmallCapsFont  = BaskervilleF-Regular.otf,


Baskerville \textsc{Baskerville}


enter image description here

However, it seems that BaskervilleF just scales down capitals. :-(

  • Wow. It took me a day to get around to looking at your answer closely because I actually wasn't all that concerned with small capitals, just how to supply the name of the font to commands that need it. But now I see! I had no idea that you could specify so much in \setmainfont. I made two changes to get it to work on my computer: Extension=.otf and BoldItalicFont = *-BoldItalic, and now, not only do I have the spacious Libre Baskerville to counter my university's dissertation format's requirement of wide lines and small font sizes, I even have small caps!
    – Ben Kovitz
    Oct 5, 2022 at 16:14
  • Great answer, as usual! Also, otfinfo -i will display the family names that the question was literally asking for, although if you have the filenames of the font family, it’s recommended to just use those.
    – Davislor
    Oct 9, 2022 at 17:38

If you run the test document with lualatex it will confirm you have the font, and at the end of the log will show its full path. You can use the filename with fontspec which is easier to make work with xetex than the internal font name. In this case that is LibreBaskerville-Regular.otf

You must log in to answer this question.

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