[Tex/LaTex] Type direct several languages in Xelatex using unicode

unicodexetex

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?

Best Answer

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.

Output

enter image description here

Code

\documentclass{article}
\usepackage{fontspec}

\setmainfont{Linux Libertine O} % main font

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

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

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

\begin{document}

Hindi \par

\selectlanguage{hindi}

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

\medskip

\selectlanguage{english}

Greek \par

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

Hebrew \par

\begin{hebrew}
אם עזה דפים הגולשות. פנאי לעתים אנגלית כתב בה. דת עזרה המקובל טבלאות מתן, את זקוק שנורו למנוע סדר, אחד קבלו אינטרנט גם. גם לחבר בלשנות ויקיפדיה שער, את קרן הבקשה הספרות, את בדף כלשהו תקשורת. מה לאחרונה אווירונאוטיקה היא, ממונרכיה אנציקלופדיה רבה או. אל כלשהו מדריכים שמו.
\end{hebrew}
\end{document}
Related Question