Fonts with XeLaTeX : tips and troubleshooting

First, one thing about fonts with XeLaTeX. How do I know what fonts I could use for the language I want to typeset ? Open a terminal (with ubuntu, enter alt+f2, and enter gnome-terminal in the prompt), and copy the following :

fc-list :lang=en

It will give you all fonts with their style that you can use for each language you specify. If you want to specify another language, then replace the “en” after “lang=” with any other language. For example, if i want to know what are the japanese fonts I can use, I replace “en” with “ja”, it returns :

Secondly, if you use XeLaTeX for the first time with, let say, Ubuntu 10.04, you are likely to get a problem with your fonts. Indeed, with Ubuntu 10.04 I got error messages when I wanted to use TeX Gyre Pagella. Here is a post to show you how to solve this problem if you get it. Notice that if you have installed TeXlive with your package manager, maybe you won’t get this problem, I don’t know.

Unfortunately, I am not aware of how XeLaTeX behaves with Microsoft Windows XP, Vista or Seven. For this reason, if you use those operating system, I can try to help you if you post a comment, but I can’t ensure you I can sucessfully help you. If you use a Unix system, then the following method might work, and has been tested with Ubuntu 10.04.

First, you need to copy texlive-fontconfig.conf in an other part of your system. For this, you need administrator privileges. To do so, you have two ways.

The first way, faster, depends on how you have installed your TeX distribution. If you have installed TeXlive with your package manager (Synaptic or Ubuntu software center in Ubuntu), then copy the following line in a terminal (to run this application, alt+f2 and enter gnome-terminal in the prompt) :

Since I don’t have installed TeXlive with my package manager, this line may not be correct. If so, don’t hesitate to leave a comment, I can modify it and tell you how to find the right line by yourself. Otherwise, if you are not familiar with the command line, then use your file manager. For this, type Alt+F2, and in the prompt enter gksu nautilus. Here is a screenshot :

Then, look at the device section in the panel on your left, and go in the file system section :

Then, search for the right directory in usr, share, something like texmf-texlive (since I can’t try I am not sure), fonts, conf, and copy texlive-fontconfig.conf. Then return select once again the file system directory, go in etc, fonts, conf.d, past the file in this directory and rename it as 09-texlive.conf. Then run the following line in a terminal :

sudo fc-cache -fsv

If you have installed TeXlive with the install script install-tl, then copy the following line in your terminal :