[XeTeX] Change Math font

Sven Siegmund sven.siegmund at gmail.com
Sat Mar 15 11:20:19 CET 2008


Hello,

I would like to change the font used for maths. I thought this would
be done with the \setmathrm command. But It seems that \setmathrm has
no effect on my document. I can outquote it and it gets typeset the
same:

---------
\documentclass[a4paper,oneside]{article}

\usepackage{xunicode} %handle unicode
\usepackage{xltxtra} %XeTeX extras
\usepackage{fontspec} %use OTF/TTF fonts
\usepackage[ngerman]{babel} %german hyphenation

\setmainfont{Adobe Garamond Pro} %use this font
\setmathrm{Adobe Garamond Pro} %use this font for math

\begin{document}

$\sin{x}$

sin {\textit x}

$\sqrt{\sin{x}^2}$

\end{document}
---------

The argument of \sin is not set in Adobe Garamond Pro and how can I change that?
What causes the \setmathrm command?

I tried to fiddle with the [no-math] option described for fontspec
package 1.14, but when I change the respective line in the preamble to
\usepackage[no-math]{fontspec}, I get this error when compiling
(MiKTeX, Windows XP):


--------------
D:\Sven\Märklin\geometrie>xelatex geometrie
This is XeTeX, Version 3.141592-2.2-0.997 (MiKTeX 2.7)
entering extended mode
(geometrie.tex
LaTeX2e <2005/12/01>
Babel <v3.8h> and hyphenation patterns for english, dumylang, nohyphenation, cz
ech, german, ngerman, french, loaded.
(preamble.tex (D:\MiKTeX\tex\latex\base\article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(D:\MiKTeX\tex\latex\base\size10.clo))
(D:\MiKTeX\tex\xelatex\xunicode\xunicode.sty)
(D:\MiKTeX\tex\xelatex\xltxtra\xltxtra.sty
(D:\MiKTeX\tex\generic\ifxetex\ifxetex.sty)
(D:\MiKTeX\tex\latex\graphics\graphicx.sty
(D:\MiKTeX\tex\latex\graphics\keyval.sty)
(D:\MiKTeX\tex\latex\graphics\graphics.sty
(D:\MiKTeX\tex\latex\graphics\trig.sty)
(D:\MiKTeX\tex\latex\00miktex\graphics.cfg)
(D:\MiKTeX\tex\xelatex\graphics\xetex.def)))
(D:\MiKTeX\tex\xelatex\fontspec\fontspec.sty
(D:\MiKTeX\tex\latex\tools\calc.sty) (D:\MiKTeX\tex\latex\xkeyval\xkeyval.sty
(D:\MiKTeX\tex\generic\xkeyval\xkeyval.tex))
(D:\MiKTeX\tex\latex\base\fontenc.sty (D:\MiKTeX\tex\xelatex\euenc\eu1enc.def)
(D:\MiKTeX\tex\xelatex\euenc\lm\eu1lmr.fd))
fontspec.cfg loaded.
(D:\MiKTeX\tex\xelatex\fontspec\fontspec.cfg))
(D:\MiKTeX\tex\latex\misc\etex.sty) (D:\MiKTeX\tex\latex\base\fixltx2e.sty))

! LaTeX Error: Option clash for package fontspec.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.6 \usepackage
               [ngerman]{babel} %german hyphenation
? h
The package fontspec has already been loaded with options:
  []
There has now been an attempt to load it with options
  [no-math]
Adding the global options:
  ,no-math
to your \documentclass declaration may fix this.
Try typing  <return>  to proceed.
?
-------

So now I am quite confused of all this math stuff. Please help me a bit with it.

S.


More information about the XeTeX mailing list