# Setting math fonts in Beamer

Is it possible to only change the math font in Beamer with XeLaTeX? The only partial solution I've been about to find is to create a new command:

\renewcommand\mathfamilydefault{\rmdefault}


The above command does essentially what I want, but it also strangely inserts characters (lmr) prior to maths. For example,

\mathfamilydefault{${x}_{ij} = -d_{k}/d_{0}$},


yields:

-

there is no need for using that macro inside your text. It is an internal definition and has the value lmr

\documentclass{beamer}
\renewcommand\mathfamilydefault{\rmdefault}

\begin{document}
\begin{frame}{foo}
${x}_{ij} = -d_{k}/d_{0}$
\end{frame}
\end{document}

-
Thank you. Is there an easy way to get this behavior inside the equation environment? I see that inside the equation environment, Beamer defaults to non-math fonts. –  dr.bunsen Jan 19 '12 at 11:59
I do not understand what you really want?? It is valid inside the math expression and not outside –  Herbert Jan 19 '12 at 12:21
Your solution is perfect. My follow-up question was: How can I change math fonts within the equation environment? I've noticed that when working with this environment the default font is non-math. –  dr.bunsen Jan 19 '12 at 12:37

I think you can use \usefonttheme[onlymath]{serif}:

\documentclass{beamer}

\usefonttheme[onlymath]{serif}

\begin{document}
\begin{frame}{foo}

Hello world!

${x}_{ij} = -d_{k}/d_{0}$
\end{frame}
\end{document}


-
there is also the option stillsansserifmath –  Herbert Jan 19 '12 at 12:25
\usefonttheme[onlymath]{serif} Plus $10^10^100$ on that. Awesome - looks so much better. –  user36629 Sep 13 '13 at 4:17