# [XeTeX] fonts for units in math mode

Bruno Voisin bvoisin at mac.com
Sun Jan 29 19:51:15 CET 2006

Le 29 janv. 06 à 19:24, Faisal Moledina a écrit :

> If I put the number and then just \coulomb\per\mole (ex: F=96485.31
> \coulomb\per\mole) it would not put the desired space between the
> number and the unit.  That is why I used the \mathrm.
> Theoretically, it would probably be best to use the SIunits \unit
> command and type something like \unit{96485.31}{\coulomb\per\mole}
> but that turns both the number and the unit into my rm font and
> everything else around it is my math font.

You could try \; to create the desired space (Knuth uses \, in the
TeXbook). Or \text{...} from the amsmath package, but this will use
the text font which is precisely what you're wanting to avoid.

>> 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}
>
> I tried putting all those lines (correcting for the last typo) into
> a style.sty and opening it after I loaded fontspec.sty in my
> document but it didn't change anything.

Sorry, I'd forgotten to check that it should be included inside
\AtBeginDocument, given fontspec.sty includes the corresponding code
inside \AtBeginDocument. Thus you should try, I think:

\AtBeginDocument{
\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{\mathbf}{bold}  {OT1}{cmr}{bx}{n}
\SetMathAlphabet{\mathit}{bold}  {OT1}{cmr}{bx}{it}
\SetMathAlphabet{\mathsf}{bold}  {OT1}{cmss}{bx}{n}
\SetMathAlphabet{\mathtt}{bold}  {OT1}{cmtt}{bx}{n}}

No need to create a specific style file, in any case.

Bruno Voisin