Skip to content

LaTeX supports many worldwide languages by means of some special packages. In this article is explained how to import and use those packages.

Introduction

If you are a non-English speaker, you can load the babel package to enable LaTeX to typeset in your preferred language. Below is an example of a document in Spanish:

\documentclass{article}
\usepackage[spanish]{babel}
\begin{document}

\tableofcontents

\vspace{2cm} %Add a 2cm space

\begin{abstract}
Este es un breve resumen del contenido del 
documento escrito en español.
\end{abstract}

\section{Sección Introductoria}
Esta es la primera sección, podemos agregar 
algunos elementos adicionales y todo será 
escrito correctamente. Más aún, si una palabra 
es demaciado larga y tiene que ser truncada, 
babel tratará de truncarla correctamente 
dependiendo del idioma.

\section{Sección con teoremas}
Esta sección es para ver que pasa con los comandos 
que definen texto
\end{document}

 Open this example in Overleaf.

This example produces the following output:

Example typesetting in Spanish

The babel package not only makes it possible to display Spanish language characters but also changes the language used to typeset elements; for example, instead of "abstract" and "Contents" the Spanish words "resumen" and "Índice" are used.

Input encoding

Prior to 2018, LaTeX’s handling of input files encoded in UTF-8 required users to add the line

\usepackage[utf8]{inputenc}

to their document preamble. With the release of TeX Live 2018, LaTeX was enhanced to adopt UTF-8 as its default text encoding, removing the need to add \usepackage[utf8]{inputenc}—as demonstrated by examples in this article.

  • Note: If you can’t input some letters of national alphabets directly from the keyboard, you can use LaTeX alternative commands for accents and special characters. See the reference guide.

Font encoding

To ensure LaTeX can typeset your document you need to use fonts which have the character shapes required to typeset the language(s) being used. In addition, when using pdfLaTeX the fontenc package may still be required to ensure that input characters are correctly mapped to the appropriate output character shape (glyph) in the fonts being used:

 \usepackage[encoding]{fontenc}

where encoding is a comma-separated list of encodings reflecting the languages being used. The default LaTeX font encoding is OT1, but it contains only the 128 characters. The T1 encoding contains letters and punctuation characters for most European languages using the Latin script. For languages using Cyrillic script you can use T2A, T2B, T2C, or X2 font encodings.

Users needing support for advanced multi-language typesetting should consider switching from pdfLaTeX to LuaLaTeX or XeLaTeX—for more information see the Overleaf article Multilingual typesetting on Overleaf using polyglossia and fontspec.

  Open an example of the pgfplots package in Overleaf

Babel

The Babel package presented in the introduction allows to use special characters and also translates some elements within the document. This package also automatically activates the appropriate hyphenation rules for the language you choose.

You can activate the babel package by adding the next command to the preamble:

\usepackage[language]{babel}

Change the language to the name of the language you need. You can see list of the languages available in the babel package documentation, under section 1.26 "Languages supported by babel with ldf files".


Using more than one language in a document

The babel package enables typesetting multiple languages in the same document:

\documentclass{article}
\usepackage[T1, T2A]{fontenc}% T2A for Cyrillic font encoding
\usepackage[english, russian]{babel}
\begin{document}

\begin{abstract}
Это вводный абзац в начале документа.
\end{abstract}

 Этот текст будет на русском языке. Это демонстрация того, что символы кириллицы
 в сгенерированном документе (Compile to PDF) отображаются правильно.
 Для этого Вы должны установить нужный  язык (russian) 
и необходимую кодировку шрифта (T2A).

\selectlanguage{english}
This text will be in English. The elements within this 
block of text will also be set in the right language.

\begin{abstract}
A brief description of the main subject to be 
explained in the entire document.
\end{abstract}

\selectlanguage{russian}

Кириллические символы также могут быть использованы в математическом режиме.
 
\begin{equation}
  S_\textup{ис} = S_{123}
\end{equation}
\end{document}

 Open this example in Overleaf.

This example produces the following output:

Multi-language example typeset with babel

Note how the fontenc and babel packages are each passed two parameters:

  • two encodings for fontenc: T1 for Latin-script languages and T2A for Cyrillic languages.
  • two languages for babel: english and russian. When using this syntax the last language in the option list will be active (i.e. Russian), and you can use the command \selectlanguage{english} at any point to change the active language.

Right-to-Left writing

Arabic language

LaTeX users wishing to typeset languages such as Arabic or Hebrew should use either LuaLaTeX or XeLaTeX. However, if the use of pdfLaTeX is unavoidable you can typeset Arabic using the arabtex package, which is further discussed and demonstrated in an Overleaf article on Arabic typesetting. Here, we’ll give an example without repeating material contained in the article dedicated to Arabic.

  • Note: Possibly due to the age of the package, arabtex depends on \usepackage[utf8]{inputenc} and will not work without it.
\documentclass[11pt,a4paper]{report}
\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage[LFE,LAE]{fontenc}
\usepackage[arabic]{babel}
\title{
\Huge\textsc{اللغة العربية}
}
\author{سالم البوزيدي}
\begin{document}
\maketitle
\tableofcontents
\chapter{علوم الحاسوب}
\section{تاريخ}
\begin{otherlanguage}{arabic}
يعود تاريخ علوم الحاسوب إلى اختراع أول حاسوب رقمي حديث. فقبل العشرينات من القرن العشرين، كان مصطلح حاسوب \textLR{Computer} يشير إلى أي أداة بشرية تقوم بعملية الحسابات. ما هي القضايا أو الأشياء التي يمكن لآلة أن تحسبها باتباع قائمة من التعليمات مع ورقة وقلم، دون تحديد للزمن اللازم ودون أي مهارات أو بصيرة (ذكاء)؟ وكان أحد دوافع هذه الدراسات هو تطوير آلات حاسبة \textLR{computing machines} يمكنها إتمام الأعمال الروتينية والعرضة للخطأ البشري عند إجراء حسابات بشرية.
خلال الأربعينات، مع تطوير آلات حاسبة أكثر قوة وقدرة حسابية، تتطور مصطلح حاسوب ليشير إلى الآلات بدلا من الأشخاص الذين يقومون بالحسابات. وأصبح من الواضح أن الحواسيب يمكنها أن تقوم بأكثر من مجرد عمليات حسابية وبالتالي انتقلوا لدراسة تحسيب أو التحسيب بشكل عام. بدأت المعلوماتية وعلوم الحاسب تأخذ استقلالها كفرع أكاديمي مستقل في الستينات، مع إيجاد أوائل أقسام علوم الحاسب في الجامعات وبدأت الجامعات تعطي إجازات في هذه العلوم [1]. 
\end{otherlanguage}
\begin{thebibliography}{99}
   [1]
    من ويكيبيديا، الموسوعة الحرة
\end{thebibliography}
\end{document}

 Open this example in Overleaf.

This example produces the following output:

Example of Arabic typesetting using arabtex

Examples of Supported Languages

Reference guide

Accents and special characters

If you can't input some letters of national alphabets directly from the keyboard, you can use LaTeX commands for accents and special characters.

LaTeX command (universal) Output
\`{o}
ò
\'{o}
ó
\^{o}
ô
\"{o}
ö
\H{o}
ő
\~{o}
õ
\c{c}
ç
\k{a}
ą
\={o}
ō
\b{o}
o
\.{o}
ȯ
\d{u}
\r{a}
å
\u{o}
ŏ
\v{s}
š
\t{oo}
o͡o
LaTeX command Output
\aa
å
\AA
Å
\ae
æ
\AE
Æ
\l
ł
\L
Ł
\o
ø
\O
Ø
\i
ı
\j
!`
¡
?`
¿

Further reading

For more information see

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX