[XeTeX] fontspec's \setmathrm seems to have no effect

Daniel Greenhoe dgreenhoe at gmail.com
Thu Sep 1 14:27:19 CEST 2011


When I use \setmathrm from the fontspec package to try to set the math
roman font, it doesn't seem to have any effect. Here an example:

\documentclass{book}
\usepackage{fontspec}
 \setmainfont{texgyrepagella-regular.otf}% TeX-Gyre Pagella font (Roman font)
 \setmathrm{texgyrecursor-regular.otf}% TeX-Gyre Cursor font (mono-spaced font)
 %\setmathrm{Asana-Math.otf}%
 \setlength{\parindent}{0pt}
\begin{document}
abcdefgh\\
$abcdefgh$\\
\fontspec{texgyrecursor-regular.otf}abcdefgh
\end{document}

* The first line is roman.
* The second line (in math mode) I would think should be mono-spaced
because of the \setmathrm command; but instead it seems to be maybe a
proportional computer modern font.
* The third line is mono-spaced as expected (because of the \fontspec command).

When I checked the pdf file using the program pdffonts
(http://www.foolabs.com/xpdf/download.html) I got

VIWLPD+TeXGyrePagella-Regular-Identity-H CID Type 0C
JTLJYE+CMMI10                        Type 1C
UIRRAJ+TeXGyreCursor-Regular-Identity-H CID Type 0C

... but the JTLJYE seems to change for each xelatex compile.
So instead of the \setmathrm giving me the font I requested, I seem to
be getting a computer modern font. Why would this be???

Many thanks in advance,
Dan


More information about the XeTeX mailing list