1

I'm writing a letter in LuaLatex using the calibri font. To set up I use these commands:

\usepackage{fontspec}
\setmainfont{calibri}[Ligatures=TeX,
  SmallCapsFeatures={Letters=SmallCaps,LetterSpace=5},
  Path=fonts/,
  Extension = .ttf,
  BoldFont = *b,
  ItalicFont = *i,
  BoldItalicFont = *z]

The problem is that I need to use inline math mode and the "math" font clashes very bad with the text font:

enter image description here

Is there a way to force the font even in math mode?

Thanks in advance.

  • Sorry but I have not installed Calibri font on my pc. I'd use the option \setmathfont{XITS Math} for the math mode. – Sebastiano May 1 at 20:35
1
\documentclass{article}
\usepackage[math-style=upright]{unicode-math}
\setmainfont{Calibri}
\setmathfont{Fira Math}
\setmathfont{Calibri}[range={up/{latin,Latin,num}, 
    it/{latin,Latin,num}, 
    bfup/{latin,Latin,num}, 
    bfit/{latin,Latin,num},
    frak/{latin,Latin,num}}]
\begin{document}

\[ \mathbf{F}(x) = \int\limits_1^\infty \frac1{x^2} dx = 1 \]

\centering\textbf{F}(x) $\phi$ \textsc{SmallCaps}

\end{document}

enter image description here

0

After a lot of trying I found something that kind works:

\usepackage{fontspec}
\usepackage[math-style=upright]{unicode-math}
\setmainfont{calibri}[Ligatures=TeX, SmallCapsFeatures={Letters=SmallCaps,LetterSpace=5}, Path=fonts/, Extension = .ttf, UprightFont = calibri, BoldFont = calibrib, ItalicFont = calibrii, BoldItalicFont = calibriz]
\setmathfont{XITS Math}
\setmathfont{calibri}[
    range={up/{greek,Greek,latin,Latin,num}, 
    it/{greek,Greek,latin,Latin,num}, 
    bfup/{greek,Greek,latin,Latin,num}, 
    bfit/{greek,Greek,latin,Latin,num},
    frak/{greek,Greek,latin,Latin,num}},
    Path=fonts/, Extension=.ttf, UprightFont = calibri, BoldFont = calibrib, ItalicFont = calibrii, BoldItalicFont = calibriz
    ]
\DeclareMathOperator{\uphi}{\symbol{"03C6}}

But it's very unreliable. I need to load XITS Math for the symbols since a lot of them are missing in calibri, \mathbf does not work with a lot of character.

I would not feel confident to use this solution on a large scale document, seems kinda buggy.

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.