[XeTeX] Fwd: [OS X TeX] Wanted: XeTeX HOWTO

Bruno Voisin bvoisin at mac.com
Sat Jan 20 17:33:14 CET 2007


Le 20 janv. 07 à 14:50, Arno Kruse a écrit :

> I took one of my further .tex files, copied the strange first lines
> (beginning with %!) and added \usepackage{fontspec} - the result was
> a catastrophy, wrong fonts, ugly look. Business as usual for me.
> Then I removed the three added lines. Result: The old file was  
> demaged.
>
> All this is horrible. The day will arrive I use Open Office instead
> of TeX.

Hi Arno,

Could you be more specific about what you did, what exactly the  
preamble of your LaTeX file contained, in which way the output was  
catastrophic (more precisely than mentioning wrong fonts and ugly  
look, I mean)?

There are a number of reasons why things may have gone wrong, and for  
many of them an easy cure:

- A fair number of LaTeX packages are incompatible with XeTeX at  
present. That is changing, all the more so as XeTeX is now included  
in TeX Live and multiplatform, hence gaining more and more visibility  
in the LaTeX world. I don't remember exactly which packages are  
problematic (I haven't used XeTeX myself for a couple of months), but  
given a list of the packages you use it should be possible to point  
out which ones should be avoided and what to do to make them work, if  
possible.

For example, you should use fontenc with option [utf8] (or whatever  
this option is called exactly). When calling hyperref, you should  
make sure the option [dvipdfm] is specified (either explicitly, or in  
a file hyperref.cfg). Same with color and graphics, and the option  
[xetex]. For babel you should avoid any language (like Greek or  
Russian) whose babel support relies on specific hard-wired fonts. And  
so forth.

- XeTeX by default doesn't do virtual fonts. Hence if you're calling  
a font whose support relies on virtual fonts, you're in for trouble.  
That can be cured by making XeTeX use the xdvipfmx DVI-to-PDF driver,  
instead of its default xdv2pdf driver on the Mac. You'll lose the Mac- 
specific functionalities of XeTeX (use of AAT fonts, recognition of  
all the graphics formats -- such as TIFF -- known to QuickTime), but  
you'll get more compatibility -- like virtual font support.

This is achieved by calling XeTeX with option -output- 
driver="xdvipdfmx -q -E". For example, with TeXShop I have created an  
engine "XeLaTeX + xdvipdfmx.engine" containing:

#!/bin/tcsh
set path= ($path /usr/texbin /usr/local/bin)
xelatex -output-driver="xdvipdfmx -q -E" "$1"

(/usr/texbin is the new path to the TeX executables in the latest  
distributions of TeX, either gwTeX via i-Installer or TeX Live via  
the MacTeX package).

- There are some packages and settings that you should always use  
with XeTeX: the xunicode package from Ross Moore, to translate any  
TeX control sequence for a character, like \`a, to the corresponding  
character in a Unicode font, like 00E0 in this case; the fontspec  
package of Will Robertson, for easy font selection; and the option  
[mapping=tex-text] when calling a font, such that TeX ligatures, like  
-- for the en-dash –, are translated again in the corresponding  
Unicode characters.

For example, a document of mine from some time ago started with:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[11pt,a4paper]{report}
\usepackage[british,francais]{babel}
\usepackage{fontspec,xunicode}
\usepackage{graphicx,color}
\usepackage[colorlinks=true,
             raiselinks=true,
             bookmarks=true,
             bookmarksnumbered=true,
             bookmarksopen=true,
             pdfstartview=FitH]{hyperref}
\setromanfont[Mapping=tex-text]{Optima Regular}

I hope you get the idea.

- XeTeX cannot at present use easily other math fonts than Computer  
Modern. It's possible to use Lucida with it (I do), but it's a bit  
tricky, and I guess that when using the DVI driver xdvipdfmx (see  
above) you should be able to call the mathptmx package. More  
generally, Will Robertson has been working on a package (called  
xmaths I think) for using Unicode math fonts with XeTeX, waiting only  
for the STIX fonts to be released.

Did you otherwise look at the XeTeX docs (preliminary and largely  
incomplete, but still usable), in the "Documentation and sample  
files" section on the page <http://scripts.sil.org/xetex_download>?  
With the recent installation of TeX that I mentioned earlier, there  
are also some docs inside /Library/TeX/Documentation/texmf-dist-doc/ 
xelatex/, like the fontspec doc. The lack of docs is due to the fact  
that until now Jonathan Kew, the author of XeTeX, has devoted all its  
energy to developing XeTeX up to version 1, and incorporating XeTeX  
into TeX Live 2007; extended documentation will come afterwards.

I think it's a bit unfair to say XeTeX is useless, without even  
mentioning if you did locate some doc and read it.

Bruno


More information about the XeTeX mailing list