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


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…


\newenvironment{exampletwo}{\setmathfont{Bradley Hand ITC}\setmainfont{Bradley Hand ITC}}{}

\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$

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

Best Answer

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

enter image description here

\setmathfont[version=bhitc]{Bradley Hand ITC}

\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$