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
BaskervilleF
luaotfload | query : Distance from "baskerville": 3
ADFBaskerville
GFSBaskerville-Regular
luaotfload | query : Distance from "baskerville": 5
BaskervilleF Bold
Libre Baskerville
luaotfload | query : Distance from "baskerville": 6
QTBasker-Bold
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:
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[LibreBaskerville]{
Extension=.ttf,
UprightFont = *-Regular,
ItalicFont = *-Italic,
BoldFont = *-Bold,
BoldItalicFont = LibreBskvl-BoldItalic,
SmallCapsFont = BaskervilleF-Regular.otf,
SmallCapsFeatures={Letters=SmallCaps},
Ligatures={Common,Discretionary,TeX}
}
% 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.
\setmainfont{LibreBaskerville}
\newfontfamily\baskerville{LibreBaskerville}
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.
latexmk -xelatex. Is there anything else I need to do to indicate the engine? – Ben Kovitz Oct 04 '22 at 13:21LibreBaskerville-Regular.ttfif you want to load by file name – David Carlisle Oct 04 '22 at 13:27\newfontfamily{\smallcaps}[RawFeature={+c2sc,+scmp}]{LibreBaskerville-Regular.ttf}got the same error as above. I'll try editing/etc/fonts/local.confnext. – Ben Kovitz Oct 04 '22 at 13:32LibreBaskerville-Regular.otfworked! This even worked as the math font withmathspec. Would you like to post that as an answer? I can edit it to include the LaTeX code to get the math font. Small caps isn't working, but I can live with that. – Ben Kovitz Oct 04 '22 at 18:30