# Can't load xits-math.otf file in lualatex; missing \endcsname insterted

Here's a MWE of the problem I'm talking about. I'm using the lualatex command.

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

\begin{document}
\setmathfont[Path=~/texmf,
Extension=.otf,
]{xits-math}

\end{document}


I get the following output:

*************************************************
* fontspec warning: "script-not-exist"
*
* Font 'xits-math' does not contain script 'Math'.
*************************************************

*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
*
* OpenType feature 'Style=MathScript' (+ssty) not available for font
* 'xits-math' with script 'Math' and language 'Default'.
*************************************************

*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
*
* OpenType feature 'Style=MathScriptScript' (+ssty) not available for font
* 'xits-math' with script 'Math' and language 'Default'.
*************************************************
! Missing \endcsname inserted.
\protect
l.8             ]{xits-math}


I'm using the file from the XITS github. I am trying to use this font because Latin Modern Math doesn't have a character that I want and XITS Math does, but I have been completely unable to figure out how to successfully load the font.

• Try Path=\string~/texmf, – egreg Nov 14 '16 at 22:38

I'm unsure why you have to use a private copy of xits-math.otf, as it is distributed with TeX Live.

Anyhow, you need \string~:

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

\setmathfont[
Path=\string~/texmf/,
Extension=.otf,
]{xits-math}

\begin{document}

$a+b=c$

\end{document}


I get, in the terminal and the log file,

</Users/MASKED/texmf/xits-math.otf>

• Thanks, your answer worked! When I tried to include it, it didn't find the font. That's why I got a private copy. – Zorgoth Nov 15 '16 at 0:47