ÈËÆÞÓÕ»ó

Help Desk

Information Technology

Multilingual LaTeX

In most instances, XeLaTeX is easier to use than babel. To avoid unnecessary frustration, see the XeLaTex instruction section, which applies to all languages, not only Greek.

XeLaTeX Example: Ancient Greek

This is not the only way to type Greek in TeXShop. See the Babel instruction page for another option.

Preliminary Steps

  1. Unicode is a technology that standardizes the way computers encode text. You can use Unicode in your LaTeX documents to typeset text in non-Roman alphabets. On most modern varieties of Linux, text documents are by default UTF-8 encoded. In TeXShop, go to File > Save As... and under "Encoding" choose " UTF-8 Unicode" (not macOS "Unicode"). To make the change permanent, in TeXShop, open Preferences by clicking the TeXShop menu at the top of the screen. In the Source pane, find the Encoding section and choose Unicode (UTF-8) from the drop-down menu.

    Unicode location
  2. Next, click the Typesetting pane and click Command Listed Below under Default Command. Type XeLaTeX in the text field. You may need to save a new copy of your document after performing these steps.

    xelatex option location

Commands in TeXShop

  1. Add this command to the document’s preamble, the part of the document before \begin{document}:

    \usepackage{fontspec}

  2. If you want to use a font other than the default Computer Modern, you must add these commands under \usepackage{fontspec}. Instead of FONT NAME write the full name of the font you want the document to be. So, if you want to use Times New Roman, you will have to write “Times New Roman” (without quotes), not times or another abbreviation.

    \setmainfont{FONTNAME}
    \setmainfont[Ligatures=TeX]{FONTNAME}

  3. Next, create a macro, a sort of shortcut, so that you don’t have to type out the entire complicated Greek command. This also goes in the preamble. Replace FONT NAME with a font of your choice that has Greek letters. If you did the optional step, it does need to be the same font. Times New Roman, Cambria, Georgia and many more fonts have Greek by default, so you don’t need to download any new fonts in order to type in Greek.

    \newcommand{\greek}[1]{{\fontspec{FONTNAME}#1}}

  4. When you're typing your document, use the command \greek{Greek text here} to get Greek text to appear in LaTeX. It can even be used in the middle of a paragraph. To learn how to type in Greek, see .

    Text in LaTeX

    After typesetting turns into:

    Example typeset

back to top

Chinese, Japanese, and Korean with XeLaTeX

Use the fontspec package with XeLaTeX. We will document XeLaTeX RSN. For now here's a simple example:

\documentclass[11pt]{article}
\usepackage[cm-default]{fontspec}
\begin{document}

Some plain old text. And now, some Chinese:

{\fontspec{Kai} 你好吗}.
\end{document}

Declaring the Babel Package

LaTeX makes it easy to typeset foreign languages using the babel package. This package is found in most default installations of LaTeX.

Like all packages, you must declare that you will be using it in your document's preamble. You also need to list the languages you want in square brackets, listing first the language the bulk of your text is written in:

\usepackage[spanish,french,english]{babel}

After changing the languages in the preamble, you may need to trash your .aux files.

If you wish to use only German or French, there are separate packages (non- babel) that you may use. This streamlines the commands for punctuation and typesetting in slightly better ways than babel does, but you are restricted to the one language loaded. For an in-depth explanation of the usage of the packages german.sty or french.sty, see the book A Guide to LaTeX by Helmut Kopka and Patrick Daly.

back to top

Switching Between Languages

There are a few ways to switch between languages. If you wish to use all the features that babel gives you, then you should switch using the command \selectlanguage{language}. To avoid confusion with various other independent packages, some languages' names in babel are different than what you might expect:

  • Spanish = spanish
  • French = francais
  • German = germanb

For example:

Flowers often have nectar, oil, or pollen rewards for visitors, and it is to the flower's benefit if the animal that takes the reward is likely to transfer its pollen between flowers of the same species.

\selectlanguage{spanish}
Las flores tienen a menudo recompensas del n\'ectar, del aceite o del polen por visitantes, y es a la ventaja de la flor si el animal que toma la recompensa es probable transferir su polen entre las flores de la misma especie.
\selectlanguage{english}

The command \foreignlanguage{language}{text} and the otherlanguage* environment are to be used when you don't need the special commands or most of the bells and whistles enabled by babel. These are perfect for when you need only a short span of text in another language. For example:

\begin{otherlanguage*}{francais}
Les fleurs ont souvent des r\'ecompenses de nectar, de p\'etrole ou de pollen pour des visiteurs, et il est \`a l'avantage de la fleur si l'animal que prend la r\'ecompense est susceptible de transf\'erer son pollen entre les fleurs de m\^emes esp\`eces.
\end{otherlanguage*}

\foreignlanguage{germanb}{Nektar und Bl\"uenstaub sind Belohnugen f\"ur Best\"auber, die Blumen besuchen.}

back to top

Russian

You need to declare that you will be using Unicode, as well as the languages with the babel package, in your document's preamble, as follows:

\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}

If you are using Russian, you may want to add the line \sloppy to your preamble to turn off hyphenation, because hyphenation in Russian in LaTeX is a problem.

In your LaTeX document, enter your text in Unicode just as you normally would. You can enable the Unicode input methods in macOS in your System Preferences under "International". Here is an example file and output in Russian:

Russian output  sample image
Russian typeset sample image

back to top

Asian Languages with Babel etc.

Installing the CJK package and cyberbit fonts is not for novices. If you can use the XeLaTeX method described above we recommend it.

You need to declare that you will be using Unicode, as well as the CJK package, which enables you to input Chinese, Japanese, and Korean. We will also define a command as a shortcut to inputting CJK text, as follows:

\usepackage[encapsulated]{CJK}
\usepackage{ucs}
\usepackage[utf8]{inputenc}
\newcommand{\cjktext}[1]{\begin{CJK}{UTF8}{cyberbit}#1\end{CJK}}

In your LaTeX document, when you want to use CJK, all you have to do is enter the \cjktext{} command and type the Chinese, Japanese, or Korean inside the braces. Here is an example file and output using CJK:

example file screenshot image
example output screenshot

back to top

IPA

IPA functionality is provided by the tipa package, which can be downloaded from to the CTAN website.

back to top