1

First of all, I know I should not use babel in XeTeX, but this weird problem is bugging me.

Here is the MWE I created on Overleaf:

\documentclass{article}

\usepackage{fontspec}

\iftrue
    \usepackage{polyglossia}
    \setdefaultlanguage{english}
\else
    \usepackage[english]{babel}
\fi

\usepackage[default]{sourcesanspro}

\begin{document}
\section*{This is a section title}
And this is a body text.
\end{document}

Since I gave the option default to sourcesanspro, I expected it to be applied all across the document. However, this is what I get: Polyglossia.png So, the font has only been applied to the section title, not to the body text.

Now, let's deactivate polyglossia and activate babel by changing line 5 from \iftrue to \iffalse. Then I get: Babel It can be seen that the font has been applied to both.

At first, I thought this would be a problem of sourcesanspro, but now I don't even know what's the cause. I haven't checked if this is Overleaf-specific problem; so FYI, here're the links to the above MWE on Overleaf when applied polyglossia or babel.

Any lead on this problem, please?

1

The sourcesanspro package resets \familydefault, but not \rmdefault.

\documentclass{article}

\usepackage{fontspec}

\iftrue 
    \usepackage{polyglossia}
    \setdefaultlanguage{english}
\else
    \usepackage[english]{babel}
\fi

\usepackage[default]{sourcesanspro}
\edef\rmdefault{\sfdefault} % this is missing in sourcesanspro

\begin{document}
\section*{This is a section title}
And this is a body text.
\end{document}

enter image description here

  • This fixed my problem. Thank you! But I am still curious why this depends on which multilingual package I load... – Ardie Hyun Hwang Mar 7 '17 at 20:53
  • 1
    @ArdieHyunHwang Apparently polyglossia relies on \rmdefault – egreg Mar 7 '17 at 21:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.