# Font loaded via package in XeTeX behaves differently on polyglossia or babel

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: 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: 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.

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}


• 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
• @ArdieHyunHwang Apparently polyglossia relies on \rmdefault – egreg Mar 7 '17 at 21:12