# [Tex/LaTex] Using mathspec \setmathfont with \newenvironment

environmentsfontsunicode-math

I would like to change back and forth between two fonts. But I would like these two fonts to affect both normal text, as well as the digits and letters in maths mode. Something like this should work fine…

\documentclass{minimal}
\usepackage{unicode-math}

\newenvironment{example}{\setmathfont{Arial}\setmainfont{Arial}}{}

\begin{document}
\begin{example}  Prove the 33 is a factor of $2^{55}+1$ \end{example}\\
\begin{exampletwo}
First note 33 that $2^{55}+1 &=(2^5)^{11}+1$
\end{exampletwo}
\item
\end{document}


The problem comes when I try to use something like \cdots, since the fonts I'm using don't have full maths support. I have got round this by using mathspec and something like

 \setmathfont(Digits,Latin){Bradley Hand ITC}


so all the symbols remain as the default font. But I can't get \setmathfont with the mathspec package to work in the \newenvironment command.

Any help greatly appreciated.

Many Thanks

You want to do the font declarations in the preamble, and just switch math versions in the environments.

\documentclass{article}
\usepackage{fontspec,unicode-math}
\setmainfont{Arial}
\DeclareMathVersion{bhitc}
\setmathfont[version=normal]{Arial}
\begin{example}  Prove the 33 is a factor of $2^{55}+1$ \end{example}\\
First note 33 that $2^{55}+1 =(2^5)^{11}+1$