[XeTeX] fonts for units in math mode

Bruno Voisin bvoisin at mac.com
Sun Jan 29 09:45:16 CET 2006


Le 29 janv. 06 à 03:57, Faisal Moledina a écrit :

> I would like the units in math mode to be displayed in non-italic  
> font, but preferably using the same font that the math uses.

I don't quite agree with this design decision (the output of \mathrm 
{\coulomb\per\mole} and \coulomb\per\mole looks quite fine to me),  
but you need to take over the fontspec choices for fonts in math and  
revert them back to their LaTeX defaults. Namely, you need to  
counteract these lines at the end of fontspec.sty:

   \DeclareSymbolFont{operators}\zf at enc\zf at rmmaths\mddefault\updefault
   \SetSymbolFont{operators}{normal}\zf at enc\zf at rmmaths\mddefault 
\updefault
   \SetMathAlphabet\mathrm{normal}\zf at enc\zf at rmmaths\mddefault\updefault
   \SetMathAlphabet\mathit{normal}\zf at enc\zf at rmmaths\mddefault\itdefault
   \SetMathAlphabet\mathbf{normal}\zf at enc\zf at rmmaths\bfdefault\updefault
   \SetMathAlphabet\mathsf{normal}\zf at enc\zf at sfmaths\mddefault\updefault
   \SetMathAlphabet\mathtt{normal}\zf at enc\zf at ttmaths\mddefault\updefault
   \SetSymbolFont{operators}{bold}\zf at enc\zf at rmmaths\bfdefault\updefault
   \expandafter\ifx\csname zf at rmboldmaths\endcsname\relax
     \SetMathAlphabet\mathrm{bold}\zf at enc\zf at rmmaths\bfdefault\updefault
     \SetMathAlphabet\mathit{bold}\zf at enc\zf at rmmaths\bfdefault\itdefault
   \else
     \SetMathAlphabet\mathrm{bold}\zf at enc\zf at rmboldmaths\mddefault 
\updefault
     \SetMathAlphabet\mathbf{bold}\zf at enc\zf at rmboldmaths\bfdefault 
\updefault
     \SetMathAlphabet\mathit{bold}\zf at enc\zf at rmboldmaths\mddefault 
\itdefault
   \fi
   \SetMathAlphabet\mathsf{bold}\zf at enc\zf at sfmaths\bfdefault\updefault
   \SetMathAlphabet\mathsf{bold}\zf at enc\zf at ttmaths\bfdefault\updefault}

You could try putting at the end of your preamble the font  
declarations from /Library/teTeX/share/texmf.tetex/tex/latex/base/ 
fontmath.ltx, after loading fontspec. Something like:

\SetSymbolFont{operators}{normal}{OT1}{cmr}{m}{n}
\SetSymbolFont{operators}{bold}  {OT1}{cmr}{bx}{n}
\SetMathAlphabet{\mathrm}{normal}{OT1}{cmr}{m}{n}
\SetMathAlphabet{\mathbf}{normal}{OT1}{cmr}{bx}{n}
\SetMathAlphabet{\mathit}{normal}{OT1}{cmr}{m}{it}
\SetMathAlphabet{\mathsf}{normal}{OT1}{cmss}{m}{n}
\SetMathAlphabet{\mathtt}{normal}{OT1}{cmtt}{m}{n}
\SetMathAlphabet{\mathrm}{bold}  {OT1}{cmr}{bx}{n}
\SetMathAlphabet{\mathit}{bold}  {OT1}{cmr}{bx}{it}
\SetMathAlphabet{\mathbf}{bold}  {OT1}{cmr}{bx}{n}
\SetMathAlphabet{\mathsf}{bold}  {OT1}{cmss}{bx}{n}
\SetMathAlphabet{\mathtt}{normal}{OT1}{cmtt}{bx}{n}

BTW, Will, in case you're listening, there's a typo at the end of the  
fontspec code (last line in the above quote: \mathsf instead of  
\mathtt).

Bruno Voisin



More information about the XeTeX mailing list