[XeTeX] fonts for units in math mode

Faisal Moledina faisal.moledina at gmail.com
Sun Jan 29 19:24:54 CET 2006


On 29-Jan-06, at 3:45 AM, Bruno Voisin wrote:

> 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:
>

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 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.  I've attached an exaggerated example  
(\setromanfont[scale=1.25]{Palatino}.  Look at F.  The first time  
it's \unit{96485.31}{\coulomb\per\mole}, the second time it's  
96485.31 \mathrm{\,\coulomb\per\mole}, and the third time it's  
96485.31 \coulomb\per\mole.  The last M_Zn is just done straight  
65.37 g/mol, which is wrong, but it's there for comparison.

Faisal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eqn2.png
Type: image/png
Size: 28575 bytes
Desc: not available
Url : http://tug.org/pipermail/xetex/attachments/20060129/63432a70/eqn2-0001.png


More information about the XeTeX mailing list