Using two different math fonts with LuaLaTeX

I found a workaround to the problem. I am not using any more the Type1 font for math; instead, with unicode-math, I create a custom math font based on Latin Modern and Crimson (not as nice as newtx, but it's ok). For math in sans, I create a new command \mathsans which allows me to select the sans math font everytime I need it. There may be some better way, but it works.

\documentclass{article}
\usepackage{fontspec,unicode-math}
\setmainfont{Crimson-Roman}[Ligatures=TeX,
           ItalicFont = {Crimson-Italic},
           BoldFont = {Crimson-Semibold},
           BoldItalicFont = {Crimson-SemiboldItalic}]
\setsansfont{Arial}
\setmathfont{Latin Modern Math}
\setmathfont[range=\mathup/{num}]{Crimson-Roman}  % for numbers
\setmathfont[range=\mathit/{latin}]{Crimson-Italic}

\newcommand{\mathsans}{\setmathfont{Arial}
    \setmathfont[range=\mathit]{Arial-Italic}}

\begin{document}

Here the main font, with some math: $\sum_ix_i^2$

\sffamily\mathsans and here is some other text in sans, with some math too $\sum_ix_i^2/2$.

\end{document}

EDIT: Although this solution works in the minimal example, it gives an error message for longer files. Specifically, it doesn't seem to allow for multiple switches to/from the sans font. The error is:

! LaTeX Error: Symbol font `__um_fam3' not defined.

Somethind relate is reported here: Switching math fonts with unicode-math


A bit late, but it’s a good question.

To use a Type1 math font with an OpenType text font, you can \usepackage{mathspec} after \newtxmath, and \setmathsfont to use your text font in math mode. As long as the text font matches the math symbols, you’re golden.

Another method is mathastext, which now supports fontspec.

Finally, in unicode-math, use \defaultfontfeatures{Scale=MatchLowercase} and consider whether any of the available OpenType math fonts would match well if you loaded \setmathfont[range=it]{Crimson Roman Italic}, \setmathfont[range=up]{Crimson Roman}, etc., after it.