[Tex/LaTex] Force font to computer modern (serif) in math mode although it is set to sans serif

fontsmath-modesans-serif

I set my font to sans serif via

\renewcommand{\familydefault}{\sfdefault}
\usepackage{helvet,sfmath}

Now I want to use some symbols -not all- (only normal letters or greek letters) from the standard computer modern math font in mathmode.

Unfortunatly neither

$\mathrm{w}$

nor

{\fontfamily{cmm}\selectfont $w$}

will give me the desired result.

I want to use it in a tikz-environment, but I guess that's no difference to the usual usage.

update:
I am a little confused about the fact, that I cannot change the font at all. Neither with the above mentioned selectfont-command nor in tikz via (for example)

\node[font=\rmfamily] at (0,0) {$w$};

Best Answer

The following example using \mathrm seems to work nicely in MikTeX 2.9 with a tikz-box:

\documentclass{article}

\usepackage{lipsum}
\usepackage{tikz}

\newcommand*{\mycolorbox}[1]{
\begin{tikzpicture}
    \node[rectangle,inner xsep=10pt,inner ysep=10pt,
          anchor=south,text width=\columnwidth,shade]{#1};
\end{tikzpicture}
}

\renewcommand{\familydefault}{\sfdefault}
\usepackage{helvet}
\usepackage[mathrmOrig]{sfmath}

\begin{document}
sans serif text

\mycolorbox{Sans serif: $a + b$, CM: {$\mathrm{c}$}}

\end{document}

I think you need to explicitly enable this with the mathrmOrig option in sfmath. The result looks like this:

TeX example rendered