Skip to content

In September 2019 Overleaf upgraded to TeX Live 2018, meaning you can now use the babel package with the XeLaTeX or LuaLaTeX compilers to assign fonts for typesetting specific languages or scripts—providing an alternative to using the polyglossia package.

This article is a follow-up to accompany our earlier piece titled Multilingual typesetting on Overleaf using polyglossia and fontspec. Here, we show how to use the babel package, via the \babelprovide and \babelfont commands, to reproduce examples contained in the previous article, which focussed on using polyglossia.

Multiple languages/scripts in the same document with babel and \babelfont

To reproduce the first example in our earlier article, where the document’s main language is French but contains English, Russian and Thai text snippets, you can now load babel for text in English, Russian and French but use the \babelprovide command to load support for Thai. We use the \babelfont command to set the document’s fonts: FreeSerif, FreeSans and FreeMono which provide sufficient support for the Latin, Cyrillic and Thai scripts.

Le Lorem Ipsum est simplement du faux texte employé dans 
la composition et la mise en page avant impression.
Merci. \foreignlanguage{english}{Thank you.} \foreignlanguage{russian}{Спасибо.} Et plus de
texte en français!
Le Lorem Ipsum est le faux texte standard ...

Lorem Ipsum is simply dummy text ...
Lorem Ipsum - это текст-`\textsf{рыба}', часто используемый в 
\texttt{печати} и вэб-дизайне. ...
\foreignlanguage{english}{Lorem Ipsum} คือ เนื้อหาจำลองแบบเรียบๆ ที่ใช้กันในธุรกิจงานพิมพ์หรืองานเรียงพิมพ์

Because the document’s main language is set to French, it will, by default, use French typesetting conventions: this would include French hyphenation patterns, punctuation and some automatic keywords—such as Résumé instead of Abstract. Short text snippets in a different language are inserted with \foreignlanguage{language}{...}. Longer paragraphs of foreign language text are inserted with \begin{otherlanguage}{language} ... \end{otherlanguage}.

Mixing right-to-left (RTL) and left-to-right (LTR) languages

To typeset a document with Arabic as the main language we use \babelprovide[import,main]{arabic}. We also need to ensure the document is typeset from right-to-left by default, which is achieved by passing-in the bidi=default option when loading babel:


ما هو \foreignlanguage{english}{differentiation}

See this example if you’d like to use the polyglossia package instead.

Specifying fonts for specific languages

You can specify the font used for different languages by adding the language name or the script name, preceded by an *, as an option to \babelfont. In our French—English—Russian—Thai example, you can add

\babelfont[english]{rm}{Free Chancery}
\babelfont[*cyrillic]{rm}{Charis SIL}

to use Free Chancery to typeset English text, Charis SIL to typeset all Cyrillic scripts (including Russian), and Garuda to typeset Thai text.

Here is another example of setting a font for a particluar script—Devanagari, which is used for Hindi and Sanskrit:

%% Each \babelprovide can only be used for one language
\babelfont[*devanagari]{rm}{Lohit Devanagari}
Hindi: \foreignlanguage{hindi}{हिन्दी}
Sanskrit: \foreignlanguage{sanskrit}{संस्कृतम्}

See this example if you'd like to do this with the polyglossia package instead.

Defining other font families

Recall that you can set typefaces for different languages and families. In the following example we explicitly set a sans serif font for Hebrew because we would like to use sans serif for section headers:

\babelfont[hebrew]{rm}{Hadasim CLM}
\babelfont[hebrew]{sf}{Miriam CLM}


זוהי עובדה מבוססת שדעתו של הקורא תהיה מוסחת עלידי טקטס קריא כאשר הוא יביט בפריסתו.


See this example if you’d like to do this with the polyglossia package instead.

Further Reading

Overleaf guides

LaTeX Basics


Figures and tables

References and Citations


Document structure





Field specific

Class files

Advanced TeX/LaTeX