When compiling a file using XeLaTex in TeXShop on Mac OS X, the console persistently hangs after the detection of the XeTeX driver:
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
./paper.tex:53: Extended mathchar used as mathchar (71311379).
<to be read again>
\relax
l.53 \begin{document}
It's possible to continue the compilation, but I'd like to understand what is going on. The problem seems to be related to the mathastext
package, which I use to allow math and text formatting both to use the TeX Gyre Termes font; commenting out the \usepackage
line for mathastext
relieves the problem.
I've seen discussions from 2006 (long predating the existence of mathastext
) saying that there is a bug in the XeTeX distro (v. 0.995 rev. D) and the only solution is to compile from source. (Google search results here.) The version of XeTeX currently installed on Mac OS 10.6.7 by TeX Live is 0.9997.4, but the problem persists, and I wonder if there is any newer intelligence on how to repair it or what causes it. I am having trouble building XeTeX manually.
Edit, 20110505
Because the discussion below became quite involved, I am summarizing the two main conclusions:
- There turns to be a bug in
amsmath
that requires the optionnoendash
to be passed tomathastext
. An alternate fix is offered by Philipp. - Discussion of how to get math formatting to apply to non-math text, without looking like math mode, was transfered to a different posting: applying math formatting to a non-math font.
your code loading mathspec which itself caused behind the scenes fontspec to be loaded with option no-math?
Edit: minimal example, as requested by Philipp
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{mathspec} % replaces amssymb; do not use unicode-math
\usepackage[italic]{mathastext} % propagates document text font to math mode
\usepackage{xeCJK}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{TeX Gyre Termes}
\begin{document}
The expected number of collisions in a given unit is \[E(collisions)=k\times\left(1-\left(1-\left(1/n\right)\right)^{{\left(k-1\right)}}\right)\]
\end{document}
Another edit, 2011.05.04, replying to JFBU's comment about [no-math]
.
With no-math
being passed to fontspec
:
\usepackage[no-math]{fontspec}
...
\setmainfont[Scale=1,Mapping=tex-text]{TeX Gyre Termes}
...
\usepackage[italic,noendash]{mathastext} % set *after* setmainfont
...
\begin{document}
au\(_{\rm3yā}\)
\end{document}
I get . But without no-math
being passed to fontspec
:
\usepackage{fontspec}
...
\setmainfont[Scale=1,Mapping=tex-text]{TeX Gyre Termes}
...
\usepackage[italic,noendash]{mathastext} % set *after* setmainfont
...
\begin{document}
au\(_{\rm3yā}\)
\end{document}
I get . I believe these are the same; I chose ā because the height of the macron is very distinctive in Termes.
Edit, 2011.05.04b: In response to another comment of @JFBU, appearance of \centerline{0123456789}\centerline{$0123456789$}
with and without no-math
passed to fontspec
.
With no-math
:
W/o no-math
:
I see no obvious difference.
mathastext
has hardly been tested with unicode engines (I know from first-hand source that the author does not even have a working xe(la)tex on his system... and only did a bit of testing with LuaLaTeX). The source of your problem may indeed quite probably be withmathastext
. Try loading it with thebasic
option to see if it helps.mathastext
has informed me that at his office, they have TL2010 since a few days, and that for the first time he could try out XeLaTeX. He says that a minimal document works fine: ` \documentclass{article} \usepackage[no-math]{fontspec} \setmainfont{Andale Mono} \usepackage{mathastext} \setmainfont{Arial Black} \Mathastext[Arial] \begin{document} \MTversion{normal} Hello $world$ \MTversion{Arial} Hi $again$ \end{document}` so please provide a minimal example.mathastext
, one should load it after thesetmainfont
command. To return to your problem, it goes away whenamsmath
is not loaded. This should help locate the source of the error inmathastext
. Will transmit to its author.