# Switch between sans and sans-serif math with MyriadPro and MinionPro

I have a document using MinionPro as serif and MyriadPro as sans-serif font families. Math is set by default with the serif font but for captions I like to switch to the sans-serif font. A minimal working example would be:

\documentclass[11pt]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{MinionPro}
\usepackage[onlysansmath]{mdsymbol}
\usepackage{sansmath}

\begin{document}

{\sffamily
This should be sans-serif, but the math isn't: $E=\hbar\omega$}

This should be sans: $E=\hbar\omega$
\end{document}


However, I can get math with MyriadPro if I use the option \usepackage[math]{MyriadPro} and using the mdsymbol package. Then however, I have no serif math any more... How can I get it to work properly? I tried also to use sansmath but that didn't work. I also looked at this question but I cannot get it to work with my choice of fonts.

Are you aware of sansmath option of MyriadPro?

\documentclass[11pt]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{MinionPro}
This should be sans-serif, but the math isn't: $E=\hbar\omega$}
This should be sans: $E=\hbar\omega$