# LuaLatex, how to use calibri font even in math mode?

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:

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

• 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

\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}


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.