2

This example is from ScumCoder's question, based on Grigory M et al.'s answer.

If I compile the following code with XeLaTeX, all is well:

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{russian}
\setotherlanguage{english}
\setmainfont{Linux Libertine O}
\begin{document}
Привет
\begin{english}
Hello!
\end{english}
\end{document}

expected result (I assume)

However, if I add a definition for \russianfont, I have problems:

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{russian}
\setotherlanguage{english}
\newfontfamily\russianfont[Script=Cyrillic]{Linux Libertine}
\setmainfont{Linux Libertine O}
\begin{document}
Привет
\begin{english}
Hello!
\end{english}
\end{document}

even though I still have \setmainfont{...} which should set the font for Russian.

No Russian (not expected)

In this case, XeLaTeX claims that the font does not support Cyrillic. The same happens if I switch Russian and English so that Russian is an other language (so defining \russianfont might really be needed).

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{russian}
\newfontfamily\russianfont[Script=Cyrillic]{Linux Libertine}
\begin{document}
\begin{russian}
Привет
\end{russian}
\begin{english}
Hello!
\end{english}
\end{document}

I am not certain how to tell which copy of the font XeTeX tries to use. I have this installed for both the OS and as part of TeX Live. Moreover fontconfig knows about the TeX Live directories.

fc-match -v "Linux Libertine O" returns /usr/share/fonts/otf-linux-libertine-ibx/LinLibertine_R.otf (and a bunch of information).

However, the fonts installed for TeX Live and those installed for the system appear to be identical in the case of Linux Libertine. diff -qr run on the two directories finds no differences.

What is going on and how should I be doing this?

  • 2
    You are missing the "O" in "Linux Libertine O" in the \russianfont command. If this doesn't lead to an error this means that some other linux libertine version is found. With the O it works fine for me on windows. You can add \XeTeXtracingfonts= 1 to your document to get more info about font pathes in the log. – Ulrike Fischer Jun 29 '16 at 6:49
  • @UlrikeFischer But it works fine if \setmainfont{Linux Libertine} is used without the O, although I'm not sure why. And I get Russian fine in that case, too. – cfr Jun 29 '16 at 15:13
  • I can't test "Linux Libertine", I don't have it. With "Linux Libertine O" I have no problems. What do you get with in the log? Which font is used? – Ulrike Fischer Jun 29 '16 at 15:25
  • I get different results today. Possibly because I updated TL, I think. Yesterday, compiling the code in this answer did not fail with an error. (I just got boxes in place of Russian.) Today, I get an error. You are right about the O and I suggested that in my comments on the other question. (After a while, I always forget the O at first.) But I still can't really figure out what is going on. – cfr Jun 29 '16 at 22:16
  • @UlrikeFischer But I do seem to have both Linux Libertine and Linux Libertine O. Only the latter has Cyrillic. But I can get English in Libertine using Linux Libertine without the O. Weird. – cfr Jun 29 '16 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.