# How to setup XeTeX on Ubuntu?

I am fairly new, but have some experience with using LaTeX. I mostly use it for various mathematical and scientific documents and school papers. However, seeing as how my native language uses various characters besides the ANSI alphabet, I need to be able to type Unicode characters directly into my .tex file and have them come out right (in LaTeX some of them simply disappear and others turn into other Unicode characters).

I've been told that instead of the workarounds for LaTeX (which I used in a while but did not have a pleasant experience with) I would be better off using XeTeX.

I would like a beginners' guide to XeTeX (as I have seen that there are some differences between the syntax) as well as a setting-up guide, ideally for a Linux machine (as it stands right now, the respective packets are not even installed).

Much appreciated,

Follow-up: I installed texlive-binaries (which I found out is the package required for XeTeX), I created a basic .tex file

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Palatino Linotype}
\begin{document}
Loneliness be over!
\end{document}


And I tried compiling it with XeTex but I got the following error: I can't find the format file xetex.fmt'!

Follow-up 2: I also tried the sudo fmtutil-sys --all and installing the texlive-xetex packaged (as I had originally installed a different one). The output is still different, though it still doesn't behave right. I think.

This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
entering extended mode
(./main.tex
! Undefined control sequence.
l.1 \documentclass
{article}
? ! Undefined control sequence.
l.2 \usepackage
{fontspec}
? ! Undefined control sequence.
l.3 \setmainfont
{Palatino Linotype}
? ! Undefined control sequence.
l.4 \begin
{document}
? [1] )
Output written on main.pdf (1 page).
Transcript written on main.log.


By the way, is there anyway to paste text into code format efficiently? Because after I type the four spaces and then paste the text I have to manually add 4 spaces to all the other lines.

Follow-up 3: Installed texlive-full, did not help. It still doesn't work.

I removed the \setmainfont line, and it now compiles in xelatex, but the unicode characters don't work. XeTeX still gives the same errors (undefined control sequence etc.)

I tried LuaTeX and it worked fine (I also imported the luatextra package) but it removes the unicode characters as well.

The characters I'm having issues with are ăîâĂÎÂșțȘȚ and in the final document, they come out blank or as other unicode characters.

-
Use the command xelatex. –  Håkon Malmedal Aug 18 '12 at 9:05
I tried it. The errors are slightly different but it still doesn't behave right! –  andreas.vitikan Aug 18 '12 at 9:07
Which error messages do you get? –  Håkon Malmedal Aug 18 '12 at 9:14
pastebin.com/Yw6SxACJ –  andreas.vitikan Aug 18 '12 at 9:20
you don't need inputenc for xelatex. make sure your file is enconded utf8 and that's all. also make sure you have palatino linotype installed (or choose another font). –  Joseph Aug 18 '12 at 10:52

If you want to run a latex document you should use xelatex (xetex engine with latex format) and not xetex (xetex engine with plain tex format).
while i still do have Unicode errors in my document, i at least succeeded to get a decent & recent installation of TeX Live by ditching this incredible apt BS and installing everything acc to tug.org/texlive/acquire-netinstall.html, tug.org/texlive/quickinstall.html. i did try sudo apt-get install texlive-full` before, but that version is incomplete and / or outdated (still installing TeX Live 2009 in 2014, must be kidding) –  flow Mar 2 at 21:39