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?
[Tex/LaTex] Type direct several languages in Xelatex using unicode
unicodexetex
Best Answer
If you're using
xelatex
, you should loadfontspec
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:
\selectlanguage{...}
switches to a new language. It's one command.\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
Code