0

I am trying to set mathrm font to be Scala Sans. What I have done is the following,

\usepackage[quiet]{mathspec}

\newfontfamily{\scala}{ScalaSans}[Path =scalasans/,
Extension = .otf,
UprightFont = *-RegularLF,
BoldFont = *-BoldLF,
ItalicFont = *-RegularLFItalic]

\setmathrm{\scala}

It's not working and I am not sure how to set Scala Sans as the mathrm font (though I have been able to use the font in the text). How to do it? I am using XeLaTeX.

Moreover, I am using overleaf. So, I have uploaded the font .otf files in overleaf. Please describe a general method so that if I have any other custom fonts then the method can be applied as well.

2

You call \setmathrm this way:

\documentclass{article}
\usepackage[quiet]{mathspec}

\setmathrm{ScalaSans}[ Path = scalasans/,
                       Extension = .otf,
                       UprightFont = *-RegularLF,
                       BoldFont = *-BoldLF,
                       ItalicFont = *-RegularLFItalic ]

\begin{document}
\( \mathrm{Scala Sans }\mathbf{Bold }\mathit{Italic} \)
\end{document}

See §4.4 of the fontspec manual. (You might have been thinking of setting an operator font.)

To load Scala Sans twice, as a body font and in math mode, but write its options only once, use \defaultfontfeatures[ScalaSans]:

\documentclass{article}
\usepackage[quiet]{mathspec}

\defaultfontfeatures[ScalaSans]{
  Path = scalasans/,
  Extension = .otf,
  UprightFont = *-RegularLF,
  BoldFont = *-BoldLF,
  ItalicFont = *-RegularLFItalic }        

\newfontfamily\scala{ScalaSans}
\setmathrm{ScalaSans}

\begin{document}
\( \mathrm{Scala Sans }\mathbf{Bold }\mathit{Italic} \)
\end{document}

You can also save this \defaultfontfeatures command in a file named ScalaSans.fontspec, and fontspec will then load the correct options for your installation whenever you load ScalaSans.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.