[XeTeX] I just installed XeTex...

Jonathan Kew jonathan_kew at sil.org
Thu Apr 10 00:57:10 CEST 2008


On 9 Apr 2008, at 10:54 pm, Dominik Gront wrote:

> Dear Group,
>
> I just installed XeTex on my Mac (Mac OS X 10.4.10) using TeXLive
> binary distribution.
> I opened my favorite vi editor and typed:
>
> \documentclass[10pt, a4paper]{article}
> \usepackage{fontspec}
> \fontspec{Palatino}
>
> \begin{document}
> Very simple text
> \end{document}
>
> It compiles with xelatex, but the text is red in color and not
> readable (strange characters). During compilation the following
> message appears:
> ## xdv2pdf: use of uninstalled fonts (specified by filename) such as
> ##   [/usr/local/texlive/2007/texmf-dist/fonts/opentype/public/lm/ 
> lmroman10-regular.otf]
> ## is not supported; try using the xdvipdfmx driver instead.

This is because the fontspec package loads the Latin Modern fonts by  
default, in a manner that is not compatible with xetex's default  
xdv2pdf output driver. Two possible solutions:

(1) use the alternative output driver xdvipdfmx instead of xdv2pdf,  
by running:

     xelatex -output-driver="xdvipdfmx -q -E" yourfile.tex

(2) load the fontspec package with the [cm-default] option, to  
prevent it loading the LM fonts:

     \usepackage[cm-default]{fontspec}

Either of these will fix the "garbage" characters, but you won't  
actually be getting Palatino; you'll be getting Latin Modern or  
Computer Modern, just as you would by default with pdflatex.

(The next TeX Live release, expected later this year, will include  
updated versions of xetex and associated software, and this issue  
should no longer arise.)

> When compiled without the two lines:
> \usepackage{fontspec}
> \fontspec{Palatino}
>
> it works fine.
>
> Could you kindly tell me what I am doing wrong?

For the result you were expecting, you should use

   \documentclass[10pt, a4paper]{article}
   \usepackage{fontspec}
   \setmainfont{Palatino}

   \begin{document}
   Very simple text
   \end{document}

Note the use of \setmainfont rather than \fontspec; this is the  
standard way to set the main body font in xelatex, using the fontspec  
package. The \fontspec command itself would be used for "local" font  
changes within the document, not for setting the overall typeface in  
the preamble.

See the fontspec documentation ("texdoc fontspec") for more information.

HTH,

JK



More information about the XeTeX mailing list