TeX - LaTeX Asked by PGratrex on April 27, 2021
SOLVED: see edits #1 and #2 below.
I’m trying to set up a XeLaTeX document that uses a sans-serif math font (Myriad Pro) with a serif text font (Arno Pro). Because Myriad Pro does not have full math support, I’m using the MdSymbol package to access mathematical symbols. However, when calling built-in mathematical functions such as ln or exp (and presumably cos etc.), the font reverts to Computer Modern.
Is there a way I can get these built-in functions correctly displayed in Myriad Pro?
As an additional question, I would like to have in-line math in the main text font (Arno Pro) rather than the math font (Myriad Pro). Can anyone suggest a convenient way of doing this?
MWE below.
documentclass[11pt]{article}
usepackage{mathspec}
setmainfont{ArnoPro-Regular.otf}
setmathfont(Digits,Latin,Greek)[Uppercase=Regular,Lowercase=Regular]{MyriadPro-Regular}
usepackage{mdsymbol}
begin{document}
begin{equation}
begin{split}
j_0 = frac{j_{kin}}{exp{frac{- alpha_c F eta}{RT}}}
alpha_c = - frac{RT}{F eta} ln{frac{j_{kin}}{j_0}}
end{split}
end{equation}
end{document}
EDIT #1: the ln issue can be resolved by adding the following:
setmathrm{MyriadPro-Regular}
The answer was found here: XeTeX/mathspec math environment font
EDIT #2: the in-line font issue can be solved using the instructions in this page: Use different math font in inline-style and display-style formulas
However, the discussion there, and the comments on this thread, have convinced me that it is better to write mathematical expressions in the same font whether they are in-line or in dedicated environments. Since switching between serif and sans-serif in a line of text is jarring, I have opted for just using serif font throughout.
Although @egreg gave one method, setmathrm
, it is also possible to change the operator font to something other than mathrm
.
In unicode-math
, this is the operatorfont
command, for example
operatorfontmathsfup
In classic LaTeX, you can redefine the operator@font
command to a different font than mathrm
. Remember to makeatletter
before using a command name with @
in it, and makeatother
when you are done.
Answered by Davislor on April 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP