# Trouble with unicode-math/fontspec in XeTeX

The following MWE yields a wrong output:

\documentclass{article}

\RequirePackage{xltxtra}
\RequirePackage{unicode-math}

%\setmainfont{Linux Libertine}
\setmathfont{Asana Math}

\begin{document}
$$\sigma \gets 1$$
\end{document}


The expected output should be obvious. Unfortunately though, the “gets” arrow is dropped from the output when rendered with XeTeX (0.9997.4, Unicode-Math v0.5b):

𝜎 1

But even weirder, when I comment in the \setmainfont line and comment out the \setmathfont line, then the result looks as follows:

← 1

i.e. the sigma is swallowed.

Summary: when trying to use either Asana Math or Linux Libertine or both I cannot get the above text to display correctly.

Is this a bug? How can I get this to display correctly?

Furthermore, when I have “Asana Math” loaded, additionally load microype (2.5 beta 0.4) and display a very huge math text (e.g. fontsize{50}{50}), the xelatex compiler creates an error and doesn’t produce any output. This is the error log:

thesis.tex:13: [Font] Font shape OT1/cmr/m/n' in size <50> not available size <24.88> substituted. (page 1)
thesis.tex:13: [Font] Font shape OT1/cmr/m/n' in size <34.99985> not available size <24.88> substituted. (page 1)
thesis.tex:13: [Font] Font shape OML/cmm/m/it' in size <50> not available size <24.88> substituted. (page 1)
thesis.tex:13: [Font] Font shape OML/cmm/m/it' in size <34.99985> not available size <24.88> substituted. (page 1)

– I understand this error, but why does xelatex fail so badly and doesn’t produce any output?

-
I should note that this particular problem can be solved rather easily by a simple \renewcommand*\gets{←} but I don’t know which other characters aren’t working. –  Konrad Rudolph Jan 26 '11 at 21:56
That is more or less what unicode-math was missing. –  Caramdir Jan 26 '11 at 22:34

It is a bug that has been fixed last October, but the fix doesn't seem to have propagated to CTAN yet (or at least not into TeX Live). With unicode-math from git your code works as expected (at least the arrow part).

-
@Caramdir — Ah. I'd better do something about this :) –  Will Robertson Jan 27 '11 at 5:07
Drat, for some reason the TeX Live installation can’t find this package when I install it in TEXMFLOCAL, even though the same works seamlessly for other packages … but this is the correct answer so I’ve accepted it. –  Konrad Rudolph Jan 27 '11 at 16:03
@Konrad: please report that as a bug. unicode-math should work like other packages. –  Philipp Jan 28 '11 at 10:51
@Philipp: that’s not an issue with unicode-math, the package is put into the correct location (I’m doing a manual install via make install-sys). But somehow kpathsea refuses to pick up this path, as evidenced by kpsewhich unicode-math.sty returning the texmf-dist path instead of texmf-local (but for other packages that exist in both paths this works). I blame my own stupidity. –  Konrad Rudolph Jan 28 '11 at 11:04
@Konrad: Did you run mktexlsr afterwards? (Probably the makefile should do this automatically.) –  Philipp Jan 28 '11 at 11:07

Your example works for me with the latest unicode-math's nighty-build. Another solution is to use \leftarrow instead of \gets. The comprehensive list of symbols for unicode-math may also be helpful for this kind of problems.

-
Carmdir has been a little faster than me. So instead of delete my post I've added a link for the unicode-math list of symbols. –  Matsaya Jan 26 '11 at 22:40
Welcome to tex.sx! A tip: you can use backticks  to mark your inline code as I did in my edit. –  Hendrik Vogt Jan 26 '11 at 22:46
@Hendrik Vogt, thanks for the welcome and for the tip (and of course for the edit) –  Matsaya Jan 26 '11 at 22:54

microtype is not compatible with xelatex, unless that has been updated relatively recently (in the last few months).

you also say you're trying to use unicode math, but you are not using unicode in your example. the unicode symbol would be the sigma symbol, not \sigma.

-
I’m using version 2.5 (beta) which is compatible with XeTeX. You’re right about my not using Unicode but I still expect this code to work (and unicode-math is required for \setmathfont). –  Konrad Rudolph Jan 26 '11 at 21:58
As far as I know σ and \sigma are equivalent with unicode-math. –  Caramdir Jan 26 '11 at 22:31
@Caramdir — Yep, it is correct to use either (and sometimes even preferable to use \sigma` depending on your text editor and whether other people need to use the code — e.g., copying a maths expression into a totally different pdfLaTeX document). –  Will Robertson Jan 27 '11 at 5:07
well I stand corrected. Microtype support for xetex and xelatex is an excellent feature addition. :P –  Mica Jan 29 '11 at 1:15