# [OS X TeX] Re : XeLaTeX& Unicode

Bruno Voisin bvoisin at mac.com
Sun Aug 14 04:37:28 EDT 2005

Le 14 août 05 à 09:08, delanoy at math.univ-lyon1.fr a écrit :

> Le 13 août 05 à 17:56, Bruno Voisin a écrit :
>
>> Le 13 août 05 à 17:20, delanoy at math.univ-lyon1.fr a écrit :
>>
>>>  thanks to the many people who answered my mail about a week ago.
>>> But I still
>>> can't solve my basic problem; if I compile the following file
>>> with XeLaTeX,
>>>
>>> \documentclass{article}
>>> \begin{document}
>>>  This is the greek letter µ. (yes, this is $\mu$).
>>> \end{document}
>>>
>>>  the first "mu" does not appear on the PDF file. But XeLaTeX
>>> should know
>>> Unicode,
>>> my Mac keyboard uses Unicode, so why doesn't it work ?
>>
>> You have to specify a font that includes the letter µ, at the
>> appropriate Unicode slot. This isn't the case of the default TeX
>> fonts (i.e. the Computer Modern fonts). You need to use an AAT
>> (the OS X font technology) font instead, or an OpenType font. For
>> example, Hoefler Text.
>>
>>
>> <http://scripts.sil.org/cms/scripts/page.php?
>> site_id=nrsi&item_id=xetex_related>
>> <http://www.ctan.org/tex-archive/macros/xetex/latex/fontspec/>
>>
>> Then install them inside ~/Library/texmf/tex/xelatex/, and compile
>> the following (the first two lines are for TeXShop, in case you're
>> using it):
>>
>>     %!TEX TS-program = xelatex
>>     %!TEX encoding = UTF-8 Unicode
>>     \documentclass{article}
>>     \usepackage{xunicode,fontspec}
>>     \setromanfont[Mapping=tex-tex]{Hoefler Text}
>>     \begin{document}
>>      This is the greek letter µ. (yes, this is $\mu$).
>>     \end{document}
>>
>> Works here (you'll notice the difference between the two µ's, the
>> >one
>> from Hoefler Text and the other from Computer Modern.
>
>      Yes indeed, all this works fine. However, the first "mu" above
> was
> produced
> by Alt+M on my usual French keyboard. Now, if I switch to the Greek
> keyboard
> inside my Mac and write "mu" in the source file with that keyboard,
> then
> it doesn't
> work any more (the PDF output gives a blank character instead of a
> "mu").
>
>   So it seems that the native Greek keyboard on my Mac does not use
> Unicode.
> How may I solve this compatibility problem ? Should I create my own
> Greek
> keyboard
> on the Mac ? How is this done ?

The problem seems to be that the "μ" produced by switching to the
Greek keyboard corresponds to a different Unicode slot from the "µ"
produced by typing Alt-M on a French or English keyboard.

As a indication of this, depending on the font used in you emailing
software, you should notice a slight difference between these two
"mus" in the preceding sentence. I'm using Mail, and the font Monaco
10 to display messages (text the default format, and fixed-width font
to display text messages). The second mu is a bit wider, and the
first has an anti-aliased look (I suspect OS X, not finding it in
Monaco, takes it from Lucida Grande instead).

The problem in your case is then, apparently, that Hoefler Text
doesn't include the characters produced by keys from the Greek
keyboard. Given Lucida Grande is one of the core fonts of OS X,
living in /System/Library/Fonts and used by default for interaction
with the OS (in all dialogs, etc.), it is likely to include one of
the widest character coverage of OS X fonts.

Thus, try replacing the call of Hoefler Text by one of Lucida Grande,
for example:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass{article}
\usepackage{xunicode,fontspec}

\setromanfont[Mapping=tex-tex]{Lucida Grande}

\begin{document}

This is the greek letter µ. (yes, this is $\mu$).

ςερτυθιοπ\par
ασδφγηξκλ\par
ζχψωβνμ

\end{document}

To find out which font includes a given character, you can use the
Character Palette (available in the Input menu -- the one with the
flag icon in the menu bar -- and activated in System Prefs >
International > Input Menu). Then you can select to display Code
Tables with the first pull-down menu of the palette, and then the
Greek & Coptic range (00000370), and select on a character; in the
Font Variant sub-window, you'll see all fonts containing this
character. Here, for example, Arial, Helvetica, Trebuchet, Verdana,
Century, Times, and more. There's also an Extended Greek range
(00001F00) including letters with many diacritics, and which seems to
require Helvetica, Lucida Grande or Times.

A place where you're more likely to find answers to your questions is
the XeTeX mailing list (there are a number of users experienced with
non-Roman or non-alphabetic writing there), to which I'm cc'ing this
message. In particular, you should obtain there indication of which
font is more appropriate for the kind of writing you're planning to
do (a font installed by default with OS X, or an optional install in
the OS X installer, or a separate font to be downloaded from
somewhere on the internet).

Bruno Voisin--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>