[Tex/LaTex] EB Garamond numbers in XeLaTeX

ebgaramondfont-encodingsfontsmath-fontsxetex

I'm trying to get the ebgaramond-maths package to work properly in XeLaTeX. Everything seems to work well except for the numbers. The numbers in math mode still show up in the default Computer/Latin Modern typeface.

%!TEX program = xelatex
\documentclass{standalone}
\usepackage{ebgaramond}
\usepackage[cmintegrals,cmbraces]{newtxmath}
\usepackage{ebgaramond-maths}
\usepackage{anyfontsize} 

\begin{document}
123 $123 ABC$
\end{document}

This code gives the following output with no warnings. As you can see, the numbers in math mode aren't set in EB Garamond.

enter image description here

If I remove the first line, to compile with pdfLaTeX, the package works fine and the numbers are in EB Garamond.

enter image description here

I think this has something to do with the encoding of the numbers. I have tried the declaring the math symbols manually using this code, but that didn't work in XeLaTeX (though it did work with pdfLaTeX). I also tried using the mathspec package, but that clashed with ebgaramond-maths.

Does anyone know how to get ebgaramond-maths with EB Garamond numbers in math mode using XeLaTeX?

Best Answer

You have to call fontspec with the no-math option.

\documentclass{article}
\usepackage[no-math]{fontspec}
\usepackage{ebgaramond}
\usepackage[cmintegrals,cmbraces]{newtxmath}
\usepackage{ebgaramond-maths}

\begin{document}
123 $123 ABC$
\end{document}

enter image description here

Related Question