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, LaTeX can be configured to typeset in your language. Below is an example of a document in Spanish:

\documentclass{article}
\usepackage[utf8]{inputenc}
\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}

LanguageEx1.png


The package that makes possible to display special characters is babel, this package also changes the language of the elements in the document. In the example instead of "abstract" and "Contents" the Spanish words "resumen" and "Índice" are used.

  Open an example of the babel package in ShareLaTeX

Input encoding

Modern computer systems allow you to input letters of national alphabets directly from the keyboard. In order to handle a variety of input encodings used for different groups of languages and/or on different computer platforms LaTeX employs the inputenc package to set up input encoding. To use this package add the next line to the preamble of your document:

\usepackage[encoding]{inputenc}


The recommended input encoding is utf8, which supports a lot of national alphabets letters (Inside the brackets, instead of the word "encoding" you must put the name of the encoding you are using). If you want, you can also use other encodings connected with different groups of languages and/or on different computer platforms (see table below).

Operating system Western European Latin encoding Central European Latin encoding Cyrillic encoding
Windows cp1252 cp1250 cp1251
GNU/Linux & Unix-like (*BSD, Mac OS X) latin1 latin2 koi8-ru
Recommended for all systems utf8 utf8 utf8

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.

  Open an example in ShareLaTeX

Font encoding

To proper LaTeX document generation you must also choose a font which has to support specific characters for a given language by using fontenc package:

 \usepackage[encoding]{fontenc}


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

  Open an example of the pgfplots package in ShareLaTeX

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 built into your LaTeX system every time the compiler is started. In the .log file you can find something similar to this:

Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, 
kurmanji, lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nyn
orsk, polish, portuguese, romanian, romansh, russian, sanskrit, serbian, serbia
nc, slovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, uppersorb
ian, welsh, loaded.

Using more than one language in a document

Babel command can be called with multiple languages:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}
\usepackage[T1, T2A]{fontenc}

\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}

LanguajeEx3.png


Notice at the preamble that two encodings and two languages are passed as parameters to the fontenc and babel packages respectively.

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.

  Open an example in ShareLaTeX

Right-to-Left writing

Arabic language

The arabic package provides the Right-to-Left scripts support for LaTeX without the need of any external preprocessor. You can include the arabtex package for extended capabilities when working with documents in Arabic or Hebrew. If you need to insert latin text inside the arabic text use \textLR{Latin text}. See the next example:

\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}

LanguageEx2.png


  Open an example of the arabtex package in ShareLaTeX

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