Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with polyglossia #94

Open
lazzalazza opened this issue Nov 19, 2020 · 1 comment
Open

Issue with polyglossia #94

lazzalazza opened this issue Nov 19, 2020 · 1 comment

Comments

@lazzalazza
Copy link

Using polyglossia & xelatex with the moderncv class leads to unexpected output.
I'm using TeX Live under MacOs Catilina 10.15.4.

Is there a way to solve this?

\documentclass[11pt, a4paper]{moderncv}
\usepackage{polyglossia}
\setdefaultlanguage{italian}
\setotherlanguages{french, spanish, german}

\firstname{Name}
\familyname{Surname}
\title{Curriculum Vitae}
\address{Random Address 15, 000123, Ran (DOM)}
\phone{+39 348/3852269}
\email{[email protected]}

\moderncvstyle{classic}
\moderncvcolor{black}

\begin{document}
\makecvtitle
\section{Section}
Some content
\end{document}

mwe.pdf

@cryptointerest
Copy link

This seems to be due to polyglossia needing to be loaded before hyperref. There is no straight forward solution to this because it requires writing a parsable option for the document class, e.g. something like

\documentclass[11pt,a4paper,sans,polyglossia,pgldefaultlang={[lang option]<lang>},pglotherlang={[lang option]<lang>},pglotherlangs={<lang1>,<lang2>,...}]{moderncv}

which would then setup polyglossial before hyperref. Alternatively, write setter functions that allow to set the default language before hyperref is loaded. I have no idea how to achieve this. If somebody knows something, step up.

For now, you can alter your copy of moderncv.cls. Around line 84 you should see

% font loading
\RequirePackage{ifxetex,ifluatex}
\newif\ifxetexorluatex
\ifxetex
  \xetexorluatextrue
\else
  \ifluatex
    \xetexorluatextrue
  \else
    \xetexorluatexfalse
  \fi
\fi

Thereafter, insert the following lines

\ifxetexorluatex
  \RequirePackage{polyglossia}
  \setdefaultlanguage{italian}
  \setotherlanguages{french, spanish, german}
\else
    \RequirePackage[utf8]{inputenc}
    \RequirePackage[T1]{fontenc}
\fi

to setup polyglossia in like in your MWE.

Alternatively, forget all that and use babel.

cryptointerest added a commit to cryptointerest/moderncv that referenced this issue Jan 29, 2021
Include hook to input a file cvloadbeforehyperref.tex before
hyperref if the file exists and lua or xelatex ist used.
This is mainly done to allow users to use and configure the
polyglossia package which needs to be loaded before  hyperref.
Explain this in the new user guide.
Of course other packages that conflict with hyperref could
be loaded in this way aswell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants