# How to set the maths font in Beamer when using XeLaTeX?

I am using XeLaTeX with fontspec and mathdesign to set the maths font separately. This works fine in memoir, for example, but Beamer overrides my maths font settings and uses the main font as a maths font.

Minimum example:

\documentclass[serif]{beamer}
\usepackage[utopia]{mathdesign}
\usepackage[no-math]{fontspec}
\setmainfont{Liberation Serif}
\begin{document}
\begin{frame}
\frametitle{Minimum working example}
\begin{itemize}
\item normal text set in Liberation Serif and maths \textbf{also,} instead of Adobe Utopia as intended
$v_x(t) := \lim\limits_{\Delta t \rightarrow 0} \frac{\Delta x}{\Delta t} =: \frac{\mathrm{d}v_x}{\mathrm{d}t}$
\end{itemize}
\end{frame}
\end{document}


This produces the following output, all set in the main font:

• Yes, the command that worked is \usefonttheme{professionalfonts}. Sep 5, 2015 at 10:33
• If you are using xetex you probably should be using unicode-math for changing the math font. Sep 5, 2015 at 16:30

As you found out yourself, \usefonttheme{professionalfonts} is needed to be able to use opentype fonts with beamer.

However, I want to add that you probably should use unicode-math together with xelatex to change the math-fonts.

\documentclass[serif]{beamer}

\usefonttheme{professionalfonts}
\usepackage{fontspec}
\setromanfont{Linux Libertine O}

\usepackage{mathtools}

\usepackage{unicode-math}
% check name of font for your system, this works on Ubuntu
\setmathfont{TeX Gyre Pagella Math}

\begin{document}

\begin{frame}{Unicode-Examples}
Some unicode in formulas:
$$α² + β² = γ²$$
And a fraction: ½.
\end{frame}
\end{document}


For some reason the comments containing the answer have disappeared, but I hope it is not impolite to answer my own question on the basis of those comments.

The solution is to use \usefonttheme{professionalfonts} in the preamble.

The minimum working example is now:

\documentclass[serif]{beamer}
\usepackage[utopia]{mathdesign}
\usepackage[no-math]{fontspec}
\setmainfont{Liberation Serif}
\usefonttheme{professionalfonts}% SOLUTION
%
\begin{document}

\begin{frame}
\frametitle{Minimum working example}
\begin{itemize}
\item normal text set in Liberation Serif and maths \textbf{also,} instead of Adobe Utopia as intended
$v_x(t) := \lim\limits_{\Delta t \rightarrow 0} \frac{\Delta x}{\Delta t} =: \frac{\mathrm{d}x}{\mathrm{d}t}$
\end{itemize}
\end{frame}
\end{document}


Producing

(having corrected the physics mistake above as well).