[Tex/LaTex] How to setup XeTeX on Ubuntu

xetex

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.

Best Answer

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).