[XeTeX] Changing font for equations

Andrew Moschou andmos at gmail.com
Fri May 9 08:37:51 CEST 2008


Easter Sunshine,

If you want mathematics in Computer Modern / Latin Modern then it should be
enough to do nothing (Will, correct me if I'm wrong) because fontspec is
designed to revert to the default appearance for mathematics, this is
without [no-math] as in TeX Live 2007.. so you might have:

\usepackage{fontspec}
\setmainfont{Minion Pro}

and that's it, without any mention of \setmathrm or other maths commands.

You however mentioned that your mathematics is set in Minion Pro, which I
think is a bit odd because I can't see how you managed to do that. Have you
done \usepackage{MinionPro}? What about \usepackage{MnSymbol}? (neither of
these packages are in TeX Live 2007, I believe). Send us an example file and
we can see exactly how to help.

What happens if you use this (You should get text in Minion Pro and all
mathematics in Computer Modern):

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Minion Pro}
\begin{document}
some text $some maths$. Latin: $abcd$. Greek: $\alpha\beta\Gamma\Delta$.
Operators: $2\times3\circ5$.
\end{document}

This will work with the TeX Live 2007 version of fontspec (It should give
text and maths letters and numbers in Minion Pro, all other maths symbols
like \times and \sqrt{} in Computer Modern):

\documentclass{article}

\usepackage{fontspec}
\makeatletter\zf at package@euler at loadedtrue\zf at math@lucidatrue
\setmainfont{Times New Roman} % You can use Minion Pro
\setmathrm{Times New Roman}

\newfontfamily\MyFont{Times New Roman}
\DeclareSymbolFont{FontN}{EU1}{\zf at family}{m}{n}
\DeclareSymbolFont{FontIt}{EU1}{\zf at family}{m}{it}

\catcode`¡=13 % You can choose a different character if this one is not
suitable (Do find and replace)
\newcommand¡[1]{\DeclareMathSymbol{#1}{\mathord}{FontN}{`#1}}
¡0¡1¡2¡3¡4¡5¡6¡7¡8¡9
\newcommand¡[1]{\DeclareMathSymbol{#1}{\mathalpha}{FontIt}{`#1}}
¡a¡b¡c¡d¡e¡f¡g¡h¡i¡j¡k¡l¡m¡n¡o¡p¡q¡r¡s¡t¡u¡v¡w¡x¡y¡z
¡A¡B¡C¡D¡E¡F¡G¡H¡I¡J¡K¡L¡M¡N¡O¡P¡Q¡R¡S¡T¡U¡V¡W¡X¡Y¡Z
\newcommand¡[2]{\XeTeXmathcode`#1=0 5`#1\let#2=#1}
¡α\alpha¡β\beta¡γ\gamma¡δ\delta¡ε\epsilon¡ζ\zeta¡η\eta¡θ\theta¡ι\iota¡κ\kappa¡λ\lambda
¡μ\mu¡ν\nu¡ξ\xi¡ο\omicron¡π\pi¡ρ\rho¡σ\sigma¡τ\tau¡υ\upsilon¡φ\phi¡χ\chi¡ψ\psi¡ω\omega
¡ς\varsigma
\newcommand¡[2]{\XeTeXmathcode`#1=7 4`#1\let#2=#1}
¡Α\Alpha¡Β\Beta¡Γ\Gamma¡Δ\Delta¡Ε\Epsilon¡Ζ\Zeta¡Η\Eta¡Θ\Theta¡Ι\Iota¡Κ\Kappa¡Λ\Lambda
¡Μ\Mu¡Ν\Nu¡Ξ\Xi¡Ο\Omicron¡Π\Pi¡Ρ\Rho¡Σ\Sigma¡Τ\Tau¡Υ\Upsilon¡Φ\Phi¡Χ\Chi¡Ψ\Psi¡Ω\Omega

\begin{document}
some text $some maths\cos\theta$. Latin: $abcd$. Greek:
$\alpha\beta\Gamma\Delta$. Operators: $2\times3\circ5$.
\end{document}

In the lines that have \XeTeXmathcode, in this example, font numbers 4 and 5
give Regular and Italic. If you have loaded other fonts (e.g. AMS's), then
change these numbers by trial and error until you get Greek (usually
capitals is in regular and lower case is in italic).

Downloading the new fontspec.sty from CTAN, and replacing the old one (to
use [no-math] option) shouldn't break your TeX Live installation. You can
always make a backup of the old fontspec.sty and put it back if needed.

Let us know if this achieves (or doesn't achieve) what you want.

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/xetex/attachments/20080509/fe141699/attachment.html 


More information about the XeTeX mailing list