Introduction to Multilingual LaTeX
By default, LaTeX was designed with the Latin alphabet in mind. However, as a global tool for academia and publishing, it has powerful capabilities for typesetting almost any script in the world—from Cyrillic and Greek to Right-to-Left (RTL) scripts like Arabic and Hebrew, and complex character systems like Chinese, Japanese, and Korean (CJK).
Handling non-Latin scripts depends heavily on the TeX engine you use. In this guide, we will focus on the modern approach using XeLaTeX and LuaLaTeX, which are designed to handle Unicode and system fonts natively, making multilingual documents much easier to manage than the older pdfLaTeX method.
The Modern Standard: XeLaTeX and LuaLaTeX
If you want to write in a non-Latin script, the first step is changing your compiler. While pdfLaTeX is the traditional workhorse, it struggles with Unicode (the universal character encoding).
XeLaTeX and LuaLaTeX allow you to:
- Use
.otfand.ttffonts installed on your computer. - Type characters (like Ω, Д, or Simplified Chinese) directly into your editor.
- Handle complex layout requirements (like vertical text or bidirectional writing).
The fontspec Package
The most important package for non-Latin scripts is fontspec. It allows you to select any font installed on your operating system.
\documentclass{article}
\usepackage{fontspec}
% Define a font that supports the characters you need
\newfontfamily\greekfont{Times New Roman}
\setmainfont{Arial}
\begin{document}
This is English.
{\greekfont Γειά σου Κόσμε} (Hello World in Greek)
\end{document}Note: To compile the code above, you must change your LaTeX editor's settings from
pdfLaTeXtoXeLaTeXorLuaLaTeX.
Working with Specific Scripts
1. Cyrillic and Greek
For scripts that follow a Left-to-Right (LTR) structure similar to Latin, the setup is straightforward. You simply need a font that contains those glyphs.
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\begin{document}
\section{Cyrillic Example}
Russian: Привет, как дела? (Hello, how are you?)
\section{Greek Example}
Greek: Λατέχ είναι υπέροχο! (LaTeX is wonderful!)
\end{document}2. Right-to-Left (RTL) Scripts: Arabic and Hebrew
Writing in Arabic, Persian, or Hebrew requires two things: a font that supports the characters and a way to tell LaTeX to change the text direction.
The polyglossia package is the recommended modern tool for managing multiple languages.
\documentclass{article}
\usepackage{polyglossia}
\usepackage{fontspec}
% Set the default language
\setmainlanguage{english}
% Set an additional language
\setotherlanguage{arabic}
% You must choose a font that supports Arabic script
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\begin{document}
This is a sentence in English.
\begin{Arabic}
هذا نص باللغة العربية.
\end{Arabic}
Back to English again.
\end{document}Tip: The
Amirifont is a popular, open-source choice for Arabic typesetting. If you don't have it, you can use any Arabic font installed on your system (likeArial Unicode MS).
3. Chinese, Japanese, and Korean (CJK)
CJK languages require special handling because they don't use spaces between words in the same way Latin scripts do, which affects how LaTeX handles line breaks. The xeCJK package is the gold standard for XeLaTeX users.
\documentclass{article}
\usepackage{xeCJK}
% Set a CJK font found on your system
% On Windows, "Microsoft YaHei" or "SimSun" are common
% On macOS, "PingFang SC" is a good choice
\setCJKmainfont{Microsoft YaHei}
\begin{document}
\section{Chinese Example}
你好,世界! (Hello World!)
\section{Japanese Example}
こんにちは世界!
\end{document}Using polyglossia for Multilingual Documents
When writing a document that switches between several languages, polyglossia is more robust than manually changing fonts. It automatically handles localized terms (like changing "Table of Contents" to "Содержание" in Russian) and hyphenation patterns.
Key Commands:
\setmainlanguage{lang}: Sets the primary language.\setotherlanguage{lang}: Defines an additional language.\text[lang]{...}: For short snippets of a different language.\begin{[lang]} ... \end{[lang]}: For longer paragraphs.
Best Practices and Tips
- Use UTF-8 Encoding: Ensure your LaTeX editor is set to save files in UTF-8 encoding. This is the modern standard that allows you to save non-Latin characters directly in the
.texfile. - Verify Font Support: Not all fonts contain all characters. If you see "squares" or empty spaces in your PDF, the font you selected likely doesn't support those specific characters.
- Check the Compiler: Beginners often forget to switch from
pdfLaTeXtoXeLaTeX. If you get an error sayingfontspeccannot be found or is incompatible, check your engine settings. - Keep it Simple: If you only need a single word in a different script, you can often just use
fontspecto define a specific font for that word. Usepolyglossiaonly when you need full document support (dates, table of contents, hyphenation).
Common Pitfalls to Avoid
- Missing Fonts: If you share your
.texfile with someone else, they must also have the same fonts installed on their system, or the file won't compile. For collaborative work, consider using standard fonts likeTimes New RomanorArial. - Mixing Packages: Avoid using the old
babelandinputencpackages at the same time asfontspecorpolyglossia. The "modern" and "traditional" ways of handling languages usually conflict with each other. - Bi-directional Complexity: When writing RTL text, punctuation can sometimes "flip" to the wrong side of the line if the direction isn't explicitly set using a language environment. Always wrap RTL text in its appropriate environment or command.
Final Recommendation: For most beginners, starting with XeLaTeX and the xeCJK package (for Asian scripts) or polyglossia (for others) provides the smoothest learning curve and the most professional results.
