# [OS X TeX] XeLaTeX newbie questions

Jonathan Kew jonathan_kew at sil.org
Wed Mar 7 06:16:08 EST 2007

On 7 Mar 2007, at 10:33 am, Luis Sequeira wrote:

> Hi
>
> Although I have been using (pdf)latex for many years, I am new to
> XeLaTeX.
>
> I am co-writing a little brochure in mathematics for elementary
> school teachers (in Portuguese), and I wanted to produce the output
> straight from my LaTeX sources (rather than having someone totally
> unknowledgeable mangle all the content in Quark).
>
> The editors have been sensitive to my plea, and are to give me the
> layout and font requirements, so that I can adjust my code.
>
> I have been experimenting with XeLaTeX for that, because I thought
> it might make the use of the required fonts easier.

If the fonts you need to use already have traditional LaTeX support
packages, then you might as well use those. But if they're TrueType
or OpenType fonts without existing TeX support, then it's probably
much easier to use xelatex (and fontspec).

>
> My first try was scaring: most characters with diacritical marks
> appeared wrong (such as the tilde in "ã" striking through the
> letter, and the "í" not appearing at all).

Are you using "traditional" LaTeX control sequences for accents, etc?
If so, you need to load the xunicode package to make these work with
Unicode fonts.

If you're using actual Portuguese accented letters in the input, then
you need to make sure your file is saved in Unicode (UTF-8), and *do
not* load the old inputenc package; xetex handles the Unicode text
natively, and inputenc will simply mangle it.

> Worse still, any LaTeX style markup, like \emph{...}, would produce
> only *red* garbage!

There was probably also a message in the console complaining that the
right fonts couldn't be found (by xdv2pdf). That might indicate you
were trying to use virtual fonts (requiring .vf files), which xdv2pdf
does not support.

>
> I finally *somewhat* got it to work, by modifying the xelatex
> engine,  to use "xelatex -no-pdf" to produce a xdv file, and then
> use  "xdvipfmx" (rather than, I believe, xdv2pdf) to produce the pdf.

It's possible to use xdvipdfmx directly in a single-step command,
include an engine configured this way (in an "Extras" folder -- I
forget the exact name), or it has been described on the list in the
past.

xunicode packages, and using \setmainfont to select a standard
Unicode font (any of the normal Mac OS X fonts, or additional
OpenType fonts you have installed in Library/Fonts). The problems you
describe sound like they'd arise from mixing Unicode-based xelatex
with old pre-Unicode TeX fonts, which can be done but is not the
preferred or simplest way to work.

JK