Getting started with XeLaTeX

Date

24 October 2010

Topics
LaTeX

By now, most LaTeX users have probably heard of XeLaTeX, if only because it is an option in the latest versions of the standard LaTeX editors such as TeXnicCenter, WinEdt and TeXWorks. But most LaTeXers have probably not yet become XeLaTeXers. Why should you?

XeLaTeX is essentially a replacement for pdfLaTeX. It was primarily developed to enable better font handling, especially non-Roman scripts. If you want to write in Telugu, then XeLaTeX is going to make your life much easier. For English writers, the main benefit of XeLaTeX is the ability to use the fonts on your computer, just as you can with other software. If you’ve grown to love using Georgia in MS-Word and always wanted to write a LaTeX document in Georgia, now you can.

Here is a very simple example:

\documentclass{article}
\usepackage{fontspec,lipsum}
\defaultfontfeatures{Ligatures=TeX}
\usepackage[small,sf,bf]{titlesec}

\setromanfont{Georgia}
\setsansfont{Tahoma}

\begin{document}
\section{Introduction}

\lipsum[1]

\section{Nonsense}

\lipsum[2-4]
\end{document}

Note the following features:

A disadvantage of using XeLaTeX is that most of the fonts on your computer will not come with enough fancy characters (known as glyphs) for mathematics. So maths has to be set using a standard LaTeX font. Consequently, I am not using XeLaTeX for my mathematical documents, but I have started trying it out on non-mathematical documents.

My first serious XeLaTeX document is my latest CV where I’ve used the following font commands:

\setromanfont{Minion Pro}
\setsansfont[Colour=AA0000]{Myriad Pro}

For a lot more information, read the fontspec manual.