If I set the default language to, lets say, english, and as another language greek, I can not get polyglossia (i.e. fontspec in the end?) to use the greek font family I set in my xetex code (with \newfontfamily\greekfont
) when compiling with xelatex. If I set the default language to greek, and the other one english, it works.
My M(not)WE is the following. Here, I set the greekfont
to Liberation Sans and the greekfontsf
to Liberation Serif, just to show that it ignores those definitions. It renders the normal greek (serif) part in serif, and the sans serif part in sans, like this:
\documentclass{article}
\usepackage{polyglossia}
\setmainfont{Liberation Serif}
\setsansfont{Liberation Sans}
\newfontfamily\greekfont{Liberation Sans}
\newfontfamily\greekfontsf{Liberation Serif}
\setdefaultlanguage{english}
\setotherlanguage{greek}
\begin{document}
\tableofcontents{}
\section{Αυτό είναι ελληνικά.}
Welcome to Greek should-not-be-serif: Αυτό είναι ελληνικά
Welcome to Greek should-not-be-sans: \textsf{Αυτό είναι ελληνικά}
Another try to should-not-be-sans: \textgreek{\textsf{Αυτό είναι ελληνικά}}
\end{document}
If one now sets \setdefaultlanguage{greek}
and \setotherlanguage{english}
, it does select the correct font shapes:
What is going on? Unfortunately, other similar questions didnt help. Specifically, this one seemed to be very relevant. But it didnt work :/
//UPDATE: Since the scope of this question is answered, I was able to refine what the problem actually is. Thus, I opened another question found here.
\textgreek{\textsf{Αυτό είναι ελληνικά}}
\textgreek
, it doesnt work. May I ask whether my MWE produces a PDF with correct fonts selected in your tex setup?\textsf
command works, whereas for the rest of it serif font applies