[Note that I am using LuaTeX for all compilations.]
Consider the following MWE which sets up several versions for maths using unicode-math's version key.
\documentclass{article}
\usepackage[math-style=TeX]{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont{Latin Modern Math}[version=lm]% sanity check
\setmathfont{Asana Math}[version=asana]
\setmathfont{TeX Gyre Schola Math}[version=tgs]
\setmathfont{Tex Gyre Termes Math}[version=tgt]
% \setmathfont{Tex Gyre Schola Math}[version=tgs, range=it]
% \setmathfont{Tex Gyre Termes Math}[version=tgt]
\newcommand*\testmaths{%
\begin{equation}
\int_{t = 0}^{x^2} t dt
\end{equation}
\[
\sin^2{\theta} + \cos^2{\theta} = 1
\]
}
\begin{document}
Latin Modern Math (\verb|normal|):
\testmaths
\mathversion{asana}
Asana Math (\verb|asana|):
\testmaths
\mathversion{tgt}
TeX Gyre Termes Math (\verb|tgt|):
\testmaths
\mathversion{normal}
Latin Modern Math (\verb|normal|):
\testmaths
{%
\mathversion{tgs}
TeX Gyre Schola Math (\verb|tgs|):
\testmaths
}
Latin Modern Math (\verb|normal|):
\testmaths
\mathversion{lm}
Latin Modern Math (\verb|lm|):
\testmaths
\end{document}
This works fine.
However, this code cannot be combined with the use of range. Although the effect of range is to restrict the specified font to the given range, its use is not then restricted to the specified version. Instead, all versions are affected.
% \setmathfont{TeX Gyre Schola Math}[version=tgs]
\setmathfont{Tex Gyre Termes Math}[version=tgt]
\setmathfont{Tex Gyre Schola Math}[version=tgs, range=it]
% \setmathfont{Tex Gyre Termes Math}[version=tgt]
Or, changing the order, the specified range in the specified version simply ends up producing emptiness.
% \setmathfont{TeX Gyre Schola Math}[version=tgs]
% \setmathfont{Tex Gyre Termes Math}[version=tgt]
\setmathfont{Tex Gyre Schola Math}[version=tgs, range=it]
\setmathfont{Tex Gyre Termes Math}[version=tgt]
Why is this and can it be corrected?
EDIT
It is, of course, true that the above examples are incomplete because they do not define sufficient stuff for an alternative maths version. To do this, additional configuration would be required to ensure that all ranges are set for the alternative maths version(s). However, this cannot be done unless a single font is used for all ranges for a given version. This is quite unlike the standard case, where you must use multiple fonts to ensure complete coverage.
Here's a non-LuaTeX example using various fonts from Arev. The commands are mostly from arevmath.sty. Note that the macros are, essentially, each setting a relevant range for the new version, sansserif. (Even here, things are not really complete: there are symbols and maths alphabets to worry about. But hopefully the basic idea is clear.)
\documentclass{article}
\usepackage{lmodern}
\DeclareMathVersion{sansserif}
% modified from arev - node that a complete set up would need additional stuff
\SetSymbolFont{operators} {sansserif}{OT1}{zavm}{m}{n}
\SetSymbolFont{letters} {sansserif}{OML}{zavm}{m}{it}
\SetSymbolFont{symbols} {sansserif}{OMS}{zavm}{m}{n}
\SetSymbolFont{largesymbols} {sansserif}{OMX}{mdbch}{m}{n}
\SetMathAlphabet{\mathnormal}{sansserif}{OML}{zavm}{m}{it}
\SetMathAlphabet{\mathit} {sansserif}{OML}{zavm}{m}{it}
\SetMathAlphabet{\mathrm} {sansserif}{OT1}{zavm}{m}{n}
\SetMathAlphabet{\mathsf} {sansserif}{OML}{zavm}{m}{it}
\SetMathAlphabet{\mathbf} {sansserif}{OT1}{zavm}{b}{n}
\SetMathAlphabet{\mathtt} {sansserif}{T1} {fvm} {m}{n}
\newcommand*\testmaths{%
\begin{equation}
\int_{t = 0}^{x^2} t dt
\end{equation}
\[
\sin^2{\theta} + \cos^2{\theta} = 1
\]
}
\begin{document}
Latin Modern Math (\verb|normal|):
\testmaths
\mathversion{sansserif}
Arev (\verb|sansserif|):
\testmaths
\mathversion{normal}
Latin Modern Math (\verb|normal|):
\testmaths
\end{document}
The question is how to do the equivalent with unicode-math if you want letters to come from one maths font, say, and operators from another.




\mathversionreplaces the whole math font. What should happen when there is arangespecified? Should it only display characters from thisrangeand undefine all the others? Should it only apply to characters withinrange? (But then\mathversiondoes not work as expected. It is to replace the whole font.) I'd say,\mathversionis the wrong tool for the job. What you want (and need) is\setmathfont. – Henri Menke Sep 04 '16 at 08:37