I'm struggling a lot with XeLaTeX and polyglossia
. Somehow the font selection doesn't seem to work as I would expect it (and as the error messages suggest).
Please consider the following example:
\documentclass{scrreprt}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\setsansfont{Arial}
\newfontfamily\greekfont[Script=Greek]{Linux Libertine O}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\begin{document}
\tableofcontents{}
\section{Αυτό είναι ελληνικά.}
{\bfseries Welcome to Greek:} Αυτό είναι ελληνικά
Or Russian: Привет
Or Hebrew: מה הבעיה?
\end{document}
This works perfectly well with an automatically generated "Table des matières" thanks to polyglossia
.
When I change the default language to Greek by using:
\setdefaultlanguage{greek}
XeLaTeX issues an error from polyglossia
:
! Package polyglossia Error:
The current roman font does not contain the Greek script!
Please define \greekfont with \newfontfamily.
See the polyglossia package documentation for explanation.
Type H <return> for immediate help.
...
l.12 \tableofcontents
{}
I did declare the \greekfont
with \newfontfamily
as you can see, but somehow \tableofcontents
seems to do and expect something else.
In the end I would like to use the same document with different languages in \setdefaultlanguage
to get all the nice automatic texts of polyglossia
for my chapters, table of contents, etc... in the appropriate language.
Can anyone please help?
greek
I get Greek headings for the TOC and no error.\setsansfont{Liberation Sans}
it works for me as well - almost. On close inspection the whole text body is in boldface (compared to french language setting where only theWelcome to Greek
is bold).