0

If I try to set up an independent font specifically for \mathit and/or \mathbf using

\setmathfont[range = it]{some italic font}
\setmathfont[range = bf]{some bold font}

unicode-math will not change it and just leave the default latex font. Other ranges do work, i.e. bfit and up. Haven't tested others...

it has a special issue. It falls back to vanilla latex italic font, Computer Modern or however it is called. If a different font was set using fontspec then it will fall back to its italic variant.

Code:

\documentclass{article}

\usepackage[english]{babel}
\usepackage{amsmath}

\usepackage{calc, geometry}
\usepackage{enumitem}
\usepackage{fancyhdr}

\usepackage{fontspec}
\usepackage{unicode-math}

\setmathfont[StylisticSet = 008]{STIX Two Math}
\setmathfont[range = bfup]{some upright bold font}
\setmathfont[range = it]{some italic font}

\begin{document}

\[ \mathbfit{F=ma} \quad \mathbf{F=ma} \quad F=ma \quad \mathit{F=ma}\]

\end{document}
7
  • Please do not use $$ for display maths in LaTeX. LaTeX-2e made it obsolete decades ago.
    – cfr
    Jan 25 '18 at 3:36
  • Please make your code compilable. Unless somebody has fonts with those names, it won't work. Since these issues often involve specifics of particular fonts, give us some particular fonts it doesn't work as you expect with.
    – cfr
    Jan 25 '18 at 3:39
  • 1
    How is this different from tex.stackexchange.com/questions/411785/…? You have not taken any notice of Will Robertson's request that you please give examples with real fonts from CTAN and not substitute non-working stuff like some italic font. There, your example appears to include settings for the ranges you give here (and some more), and you've said that Will's answer solved the problem there. So what's the new question exactly?
    – cfr
    Jan 25 '18 at 3:52
  • 2
    @Suppboi No, there are fonts in CTAN which are part of every TeX distribution, such as texgyrepagella-regular.otf, texgyrepagella-math.otf and so on and so on. Jan 25 '18 at 5:07
  • 1
    I had in mind what @WillRobertson said above and in comments on your other question about this. Unless it is font-specific and can't be reproduced with the standardly-available fonts we all have (in which case, we need to know the fonts), pick fonts from that set to demonstrate the issue. That's the point of giving example code: other people can compile it to reproduce your situation.
    – cfr
    Jan 26 '18 at 0:47
0

I fixed it by just changing the order of the font assignments. Putting unicode-math's \setmathfontcommands before fontspec's \setmainfont command as shown

\newcommand{\garamondPremierPro}{
    ItalicFont = Garamond Premier Pro Italic Caption,
    BoldFont = Garamond Premier Pro Bold Caption,
    BoldItalicFont = Garamond Premier Pro Bold Italic Caption,  
}

\newcommand{\normalFontFeatures}{
    Kerning = On,
    Style = Historic,
    Ligatures = {Historic, Rare},
    % VerticalPosition = Denominator,
}

\setmathfont[StylisticSet = 008]{STIX Two Math}
\setmathfont[range = up/{Latin, latin}]{Garamond Premier Pro Caption}
\setmathfont[range = bfit/{Latin,latin}]{Garamond Premier Pro Bold Italic Caption}

\setmainfont[
    Language = English,
    \garamondPremierPro
    \normalFontFeatures
]{Garamond Premier Pro Caption}

P.S. There's the font I was using :)

2
  • 2
    ER, that doesn't look like a math mode font to me!
    – Joseph Wright
    Jan 25 '18 at 8:40
  • it's ok, it works!
    – Suppboi
    Jan 25 '18 at 14:52

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.