5

Yes, I've seen this question. It is (1) five years old, (2) answered with answers that do not work for me, and (3) I don't have enough reputation to comment (and posting question as an answer seems wrong).

The situation is kinda baffling for me. I am trying to compile the Cyrillic Hello World proposed by Grigory M, and whatever I do, XeLaTeX just refuses to load any system font.

What I've done:

  • Made sure Linux Libertine is installed;
  • Tried running fc-list and using other fonts in the document;
  • Tried using the *.otf file name as an argument of the \newfontfamily\russianfont command, as suggested here;
  • Tried copying the *.otf files in ~/.fonts, then running fc-cache -f -v as root AND also as normal user
  • Tried copying the texlive-fontconfig.conf file from /var/lib/texmf/fonts/conf to /etc/fonts/conf.d/09-texlive.conf, then running fc-cache -fsv as root as suggested here.

Nothing helped. I just keep seeing the same error:

fontspec error: "font-not-found"! The font "Linux Libertine" cannot be found. ...sianfont[Script=Cyrillic]{Linux Libertine}

Full log is here.

I am using TeXLive2016 on OpenSuSE 13.2. I've installed it by enabling the TeXLive RPM repo, which is essentially a tool to convert the CTAN files into RPM packages.

Any help will be very appreciated.

For the sake of completeness, here's the code itself:

\documentclass{article}
\usepackage{fontspec} % loaded by polyglossia, but included here for transparency 
\usepackage{polyglossia}
\setmainlanguage{russian} 
\setotherlanguage{english}

% XeLaTeX can use any font installed in your system fonts folder
% Linux Libertine in the next line can be replaced with any 
% OpenType or TrueType font that supports the Cyrillic script.

\newfontfamily\russianfont[Script=Cyrillic]{Linux Libertine}

\begin{document}
Привет
\begin{english}
Hello! 
\end{english}
\end{document}
ScumCoder
  • 1,639
  • We'll probably need more of your log file. Also, please include a complete MWE here rather than just linking to the other question so that your question still makes sense if that other answer gets edited. For what it's worth, on my system, it finds the font but says it does not provide Cyrillic. – cfr Jun 28 '16 at 23:43
  • How did you install TeX Live exactly? – cfr Jun 28 '16 at 23:44
  • @cfr I edited the question to answer your inquiries. – ScumCoder Jun 29 '16 at 00:02
  • Thanks. Not your fault, but why on Earth does XeLaTeX load so much unnecessary gunk! I'm surprised it doesn't load TikZ - it seems to load pretty much everything else. – cfr Jun 29 '16 at 00:17
  • 1
    What does fc-match "Linux Libertine" return? If it doesn't find the font, perhaps it needs a different name on your system. How did you install Linux Libertine? Your question suggests you might have done this manually. If so, uninstall it, update the caches and then install using OpenSuse's package manager (can't remember what it uses, but whatever it is). – cfr Jun 29 '16 at 00:19
  • On my system, for example, I get LinLibertine_R.otf: "Linux Libertine O" "Regular". This doesn't work, it is true. But it does find the font. – cfr Jun 29 '16 at 00:20
  • @cfr

    What does fc-match "Linux Libertine" return?

    I get exactly the same output.

    How did you install Linux Libertine?

    Using OpenSuse's package manager.

    – ScumCoder Jun 29 '16 at 00:21
  • Are you using an editor? If so, try compiling on the command line. It makes no sense that fontconfig can find the font but not find it .... Also, let's try to minimise the example. Drop Russian for now and take polyglossia out so you just have English with a \setmainfont{Linux Libertine}. – cfr Jun 29 '16 at 00:29
  • I see it loads graphicx in order to fake TIPA stuff. Or just to confuse me ;). – cfr Jun 29 '16 at 00:30
  • @cfr this still gives exactly the same error, even if I run it from terminal as xelatex ./document.tex. – ScumCoder Jun 29 '16 at 00:36
  • 1
    Same here, font not found on texlive 2016; but it compiles fine when using any of the *.otf font from fc-list | grep -i libertin, for example \newfontfamily\russianfont[Script=Cyrillic]{libertinusserifdisplay-regular.otf}: http://i.imgur.com/bWUMcdb.png – alwaysask Jun 29 '16 at 00:37
  • You could try using otfinfo -i to check the name of the OTF font. I suspect that the font you're using is the the one I'm getting, anyway, because it certainly doesn't compile fine for me - it just finds the font OK. – cfr Jun 29 '16 at 00:56
  • Try Linux Libertine O @alwaysask rather than Linux Libertine. I also need to comment out the \russianfont definition in order to not get empty boxes. – cfr Jun 29 '16 at 01:02
  • @cfr \newfontfamily\russianfont[Script=Cyrillic]{Linux Libertine O} works fine too. By the way, fc-match "Linux Libertine" returns DejaVuSans.ttf: "DejaVu Sans" "Book" on my system. – alwaysask Jun 29 '16 at 01:11
  • @alwaysask That suggests you do not have a font by that name installed for the OS. – cfr Jun 29 '16 at 01:18
  • @cfr Right. I just mentioned it to show the font-not-found was legit on my system (forgot to say 1st time). – alwaysask Jun 29 '16 at 01:33
  • @alwaysask Oh, I see. Yes, certainly. And in that case, it is expected that you need the complete path etc. But the OP shouldn't need this ... ;). – cfr Jun 29 '16 at 01:34
  • 1
    http://tex.stackexchange.com/questions/313837/how-do-i-load-a-texlive-font-with-fontspec – Jonathan Komar Jun 29 '16 at 04:11

2 Answers2

3

Ok, I got this (thanks a bunch @alwaysask).

It turns out that I actually had to specify the name of the *.otf file (instead of the abstract human-readable name of the font) as the argument of the \newfontfamily\russianfont command, as it was suggested here. The only thing that was wrong in that post was that you have to specify the complete file name (with extension).

ScumCoder
  • 1,639
  • But this doesn't really explain why it doesn't work otherwise. It should work. That it doesn't suggests a problem with fontconfig or with something related to TeX. – cfr Jun 29 '16 at 00:54
  • +1 to this. I'm having the same problem and my file will only compile if I type the font exactly as the filename, including the extension .otf. Don't know why tho, all examples I've seem online used the font name instead of file name. – Mateus Felipe Feb 18 '19 at 19:49
-3

Simple Solution: Do NOT just double click to run. Right click on the font and "install it for all users" .

Majid
  • 201