I want to write direct in a Latex document several languages, for example: संस्कृतम् - ελληνική γλώσσα - Latin - ꦲꦤꦕꦫꦏ - egypt hieroglyph - and more... So, my question is, how I can use "Xelatex"- Unicode in the preamble to write direct these languages? I tried to use \usepackage{xunicode}, but did not work... *And a second question, Have a list for supported languages in Unicode and the font type avaiable to write them direct in Xelatex? In the meaning, for the languages supported in Unicode, what I put in preamble to write they direct in Xelatex?

2 Answers 2


If you're using xelatex, you should load fontspec that allows you to set the main font with \setmainfont{} and you can choose any font you have in your own OS. This should be the font of the main part of your document. If you're writing primarily using the Latin alphabet, then you should choose an appropriate font.

As far as the languages are concerned, I'd advise using polyglossia, it might be hard to use at first, but it does its job.

Here's an example with Hindi, Greek and Hebrew (all examples are Lorem Ipsum). Note that you have two ways of doing this:

  • using \selectlanguage{...} switches to a new language. It's one command.
  • the environment \begin{<language>} ... \end{<language>}. No switching here, but you must enclose the text inside of these tags.

I suppose that if you had a font that supported all the glyphs in your document, this might not be necessary but, it's not likely. Especially if you font proper fonts for your foreign scripts.


enter image description here



\setmainfont{Linux Libertine O} % main font

    \setdefaultlanguage{english} % main language
    \setotherlanguages{hindi, greek, hebrew} % other languages 

% font declarations for the other languages
\newfontfamily\devanagarifont[Script=Devanagari]{Devanagari MT}
\newfontfamily\greekfont[Script=Greek]{Times New Roman}

\setlength\parindent{0cm} % no indent for this example


Hindi \par


बलवान किया उपलब्ध संस्थान केन्द्रित तकनिकल क्षमता। सोफ़्टवेर उनका सक्षम निरपेक्ष प्रव्रुति कार्यसिधान्तो सहित पहेला पुस्तक पासपाई विश्व भाषा संपादक स्थिति परिभाषित होभर पहोच। क्षमता यन्त्रालय कार्य वहहर जिसकी जागरुक विश्वास परिभाषित यधपि रहारुप तकनीकी व्रुद्धि सके। बनाने क्षमता अधिकार करती मुक्त



Greek \par

Κυιδαμ φευγαιθ ινσιδεριντ μεα συ, νες δισθας ασομμοδαρε ινστρυσθιορ αν, εα συμ νυσκυαμ ωφφενδιθ. Ευμ εξ συαφιθαθε σονσεσθεθυερ, φυλπυτατε δεμωσριθυμ δεφινιεβας ναμ αδ, ευμ ιν ιυσθο ρεγιονε ρεφερρεντυρ. Φαβυλας χενδρεριτ νεσεσιταθιβυς εαμ ιδ, οδιο σινθ αυγυε ευμ εξ, ευμ εριπυιτ ινθερπρεταρις ιν. Κυανδο αλβυσιυς κυαερενδυμ ατ εσθ, σιθ φερο σαεπε ιισκυε ιδ, τρασθατος σιμιλικυε πρω ατ. Οπθιων δολορεμ σωνσλυδαθυρκυε εα ευμ.

Hebrew \par

אם עזה דפים הגולשות. פנאי לעתים אנגלית כתב בה. דת עזרה המקובל טבלאות מתן, את זקוק שנורו למנוע סדר, אחד קבלו אינטרנט גם. גם לחבר בלשנות ויקיפדיה שער, את קרן הבקשה הספרות, את בדף כלשהו תקשורת. מה לאחרונה אווירונאוטיקה היא, ממונרכיה אנציקלופדיה רבה או. אל כלשהו מדריכים שמו.
  • But using "\usepackage{polyglossia}" can I type all languages supported by unicode [unicode.org/standard/supported.html] ? Or the package "polyglossia" have a him own support languages? My doubt is how can I acess all the languages that Unicode support using Xelatex.
    – Gergian
    Apr 21, 2016 at 19:12
  • @BozenoBozilson Not sute what you mean, but yes, xelatex uses Unicode.
    – Alenanno
    Apr 21, 2016 at 22:29
  • 1
    @BozenoBozilson your file doesn't know about languages. For it, there is only characters. polyglosia is a package that allows you an abstraction, to switch the font (the character set) you use when you switch languages (as more often than not, a certain font will be specifically designed for a certain language). Once you use a unicode encoding (utf-8) and a unicode-capable compiler (XeLaTeX), the only thing you are missing is the right font for the right language. Polyglosia just helps you manage that. Apr 22, 2016 at 9:12
  • @SamuelAlbert, Hmmm, that's it! So, I want to find some site or list of fonts for languages supported by Unicode, because for Greek and Sanskrit [more "traditional" languages] is easy to find a site or even a topic here that explain which font you need to use... But for other "exotic" languages, for example "classical mangolian script, Inscriptional Pahlavi, Nabataean" it's seem difficult... Where can I find this material ? I'm saw unicode site and I did not found.
    – Gergian
    Apr 22, 2016 at 16:02
  • 1
    @BozenoBozilson It seems there is a reference of a few unicode fonts that have a wide pannel of characters here. Other than that, you may have more luck with websites specialized in linguistics. Note that while it may be hard to find a font that does all languages, it may be easier to find a font suited for each specific language you seek to use. Polyglosia will allow you to easily do just that. Apr 25, 2016 at 9:49

There are several parts to your question.

How to use XeLaTeX ?

In order to compile a unicode document using XeLaTeX, you first need to write a unicode document. So you will have to make it an UTF-8 document. Once this is done, it is very easy. You write your document as if you were using PDFLatex, but instead, you will compile it using xelatex.exe. As for writing characters in different languages, then you just need to write them normally in your utf-8 document, and XeLaTeX should handle them as if they were normal characters.

What is utf-8, and how to use it ?

Using utf-8 is not something you a are usually paying direct attention to, so most people don't really understand what it is. To understand it, you need to remember that when you write a file, would it be a .tex, .txt or a .exe, you are really just writing a series of binary numbers. UTF-8, as well as ANSI, and a few other ones, are the names of a few of the different "tables" we use to associate a binary number and a character.

The thing is, some encodings (that's what they are called) can choose to have some characters that others do not. The whole point of UTF-8 (and thus XeLaTeX and LuaLaTeX that are designed to work with it) is to be able to encode the whole range of the Unicode standard.

To use utf-8 in a file, you need an editor that is able (and configured to) work with this encoding. As for LaTeX IDEs, Texmaker does. In a more general sense, notepad++ allows you to convert between different encodings, and thus can be beneficial.

Once you made sure you use utf-8 encoding, you don't need to use any specific package to tell that to XeLaTeX, since it already knows how to use it.

Is there a list of supported languages ?

Once you write in utf-8, the languages you can access are the whole range of the utf-8 (and therefore unicode) supported languages. So in theory, almost anything. Now, the real issue is to have a font that will contain those characters, so you may want to choose the font you use carefully, and have a look at how to switch fonts. But other than that ... the sky is your limit !

  • And to do this I just put \usepackage[utf-8] in preamble? And start to write everything? The languages that I want are the languages of: unicode.org/standard/supported.html . Thanks.
    – Gergian
    Apr 21, 2016 at 19:15
  • No, UTF-8 is the encoding your computer uses to write the text of the file itself. So you can for exemple use notepad++ to be able to convert that. Texmaker is capable of working with utf-8 for example. I'll edit to add details about that. Apr 22, 2016 at 8:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .