Não é possível carregar o arquivo xits-math.otf em lualatex; faltando \endcsname inserido

Não é possível carregar o arquivo xits-math.otf em lualatex; faltando \endcsname inserido

Aqui está um MWE do problema do qual estou falando. Estou usando o comando lualatex.

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

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


\end{document}

Eu recebo a seguinte saída:

*************************************************
* 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.
<to be read again> 
\protect 
l.8             ]{xits-math}

Estou usando o arquivo do github XITS. Estou tentando usar essa fonte porque o Latin Modern Math não tem um caractere que eu quero e o XITS Math tem, mas não consegui descobrir como carregar a fonte com êxito.

Responder1

Não sei por que você precisa usar uma cópia privada do xits-math.otf, já que ela é distribuída com o TeX Live.

De qualquer forma, você precisa de \string~:

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

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

\begin{document}

$a+b=c$

\end{document}

Eu recebo, no terminal e no arquivo de log,

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

informação relacionada