Possibly related to
- What is the difference between unicode-math and mathspec?
- Change math font only in some parts of a document?
Roughly speaking, I would like to know if it is possible to change math font as freely as I can change text font by \fontspec.
It seems \setmathsfont form mathspec is powerful but can be used only in preamble. On the other hand \setmathfont from unicode-math can be used everywhere but it is not as powerful as \setmathsfont.
For instance, the following document does not compile
% !TEX program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{mathspec}
\begin{document}
$1+2=3$
\setmathsfont(Digits){Zapfino}
$1+2=3$
\end{document}
And the following document does compile.
% !TEX program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{unicode-math}
\begin{document}
$1+2=3$
\setmathfont[range=up/num]{Zapfino}
$1+2=3$
\end{document}
So my questions are
- Is
\setmathfontan alternative to\setmathsfont?- If so, what corresponds to
\setmathsfont(Digits),\setmathsfont(Latin), and\setmathsfont(Greek)?
- If so, what corresponds to
- Is it possible to use
\setmathsfontwithin the document? Just like\setmathfontand\setmainfont. - Or, is there any better way to break photomath? (see below)
Motivation
I am currently making some arithmetic exercise such as
It turns out that my students use photomath to get the answer. The good news is that photomath does not recognize "ugly" fonts such as Zapfino.
But for demonstrating purpose, I want to use "pretty" font such as Latin Modern in the same document. So it would be nice if I can switch between "pretty" and "ugly" fonts.


\DeclareSymbolFontthat is defined as\@latex@error {Can be used only in preamble}\@eha. Should I try @Joseph Wright♦'s answer instead? – Symbol 1 Dec 27 '15 at 09:35