# Getting started with XeLaTeX

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:

• The fontspec package is almost always necessary with XeLaTeX and contains commands to load the required fonts.
• You usually need the command \defaultfontfeatures{Ligatures=TeX}. This is so the new fonts behave in the way we’ve come to expect with LaTeX, such as allowing an em-dash to be written as ---.
• The two fonts that are loaded (Georgia and Tahoma in this example) are fonts available in my Windows fonts directory.
• The titlesec package is loaded only so headings are in sans-serif bold in order to show the effect of the font changes.
• The lipsum package provides some nonsense text for testing purposes.

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}

### Related Posts:

Hi! Great blog! I just found it today and read quite a bit, mostly about LaTeX. I’m trying to write my own blog on WordPress, so I would like to ask you this: How do you get this nice LaTeX syntax highlighting? Do you use WordPress online service, or maybe you have your own WordPress installation?

Thanks in advance. Great work, again.

• I have my own WordPress installation. The syntax highlighting comes from the WP-CodeBox plugin.

• hithere

Hi! may i know which editor are you using for the xelatex compile?
Well, i have been a long -time wineditor user for latex compile. When i am searching how to write professional resume using latex, i found your website. Your resume looks really impressive.

Could you

• Aline Menezes

How do I get XeLatex working with TexStudio?

• Pingback: Research tips - XeLaTeX with TeXstudio()

• Kumar

I just wanted to say thanks! Helpmed me type telugu and devanagari !

• Rama

Hi Kumar, can you please send me a sample file where you could do both telugu and english in the same Latex document. I am using MikTek and TeXworks as editor, which shows me the XeLateX option.

• Valentina

Can I use XeLaTex with LyX? I’m starting at LaTeX and a friend recommended LyX to me as I wouldn’t have to learn ad do all that coding. I find it very usefull, but I would love to get to use all the fonts I have on my PC (I am a visual designer with an editorial design interest).

I also work mostly in spanish, as I live in Latinamerica. Itell you this ‘cos you mention that “for english writers, the main benefit of XeLaTex is the ability to use the fonts on your computer” so maybe it wasn’t available for spanish configuration… Could you clear this things up to me? Thanks a lot!

• QS

Your CV nauseates me. How the fuck do you have so much motivation? I can barely gather the strength to work on my PhD.

• Venkat

Thankyou. Telugu, that is precisely when I landed on this page. Coincidence or conspiracy !! Why Telugu ?

• Where is the list of commands I can use and their documentation eg. setromanfont?