Some days ago, I asked about how to use sans serifed font in all math document. My approach, given those answers, was create a little function to use the serif fonts in math (using \definestartstop) but, when there is some align involved, it produces an error :-\ .
\definefontfamily [mainface] [ss] [Latin Modern Sans]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:digitsnormal]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:digitsbold]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:uppercasenormal]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:uppercaseitalic]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:uppercasebold]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:uppercasebolditalic]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:lowercasenormal]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:lowercaseitalic]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:lowercasebold]
\definefallbackfamily [mainface] [mm] [Latin Modern Sans] [preset=math:lowercasebolditalic]
\definefontfamily [mainface] [mm] [Latin Modern Math]
\definestartstop
[formulass]
[
before={\startformula
\setupbodyfont[mainface]},
after=\stopformula
]
\starttext
abcdefg ABCDEFG 123456 i
\startformula
{\tf abcdefg\,ABCDEFG} \quad abcdefg\,ABCDEFG \quad 123456 \quad {\bf 123456}
\stopformula
% it works:
\startformula
Y=X\beta+\varepsilon
\stopformula
% it works:
\startformulass
Y=X\beta+\varepsilon
\stopformulass
% it doesn't work:
\startformulass
\startalign[n=4]
\NC Y_t \NC = \beta_0 \NC + \beta_1 x_t \NC + \varepsilon_t \NR
\NC Y_t \NC = \beta_0 \NC + \beta_1 x_t \NC + \varepsilon_t \NR
\stopalign
\stopformulass
\stoptext