How can one make the math mode change its font according to the surrounding text?
I have to use (pdf)latex
. xelatex
, luatex
etc. are not possible alternatives in this case.
\documentclass{scrartcl}
\usepackage{lmodern}
%\usepackage{sfmath}
%\usepackage{cmbright}
\newcommand{\test}{%
\sqrt{(a_1+a_2+\gamma)^2}=\sum_{i=1}^2 a_i + \gamma
}
\begin{document}
Text in roman family and math too $\test$
\begin{equation}
\sqrt{(a_1+a_2+\gamma)^2}=\sum_{i=1}^2 a_i + \gamma
\end{equation}
\sffamily
Text in sans family and math should be in sans too $\test$
\begin{equation}
\sqrt{(a_1+a_2+\gamma)^2}=\sum_{i=1}^2 a_i + \gamma
\end{equation}
\normalfont
Back to roman $\test$
\end{document}
I found sfmath
but it only changes the latin letters and numbers and it works only as a global setting. cmbright
contains a more or less matching (and working) math font but it changes the text font also and it works only globally too.