# Sans-Serif Font using Metropolis Theme and Physics Package

using the beamer class theme metropolis, I stumbled over the physics package's \dv{} command. This MWE illustrates the issue:

\documentclass{beamer}
\usetheme{metropolis}
\usepackage{physics}
\begin{document}
\begin{frame}
Usual math is sans-serif: $12 + 4 = x^2$.

Physics package not necessarily: $\dv{x}{y} \neq \pdv{i}{k}$.
\end{frame}
\end{document}


Usually, the theme takes good care of its math font and typesetting everything sans-serif. Yet, the physics package seems to use a completely different, serif font. How do I fix this?

The physics packages uses \mathrm in the definition of \diffd, this will force serif font even if the rest of the presentation is in sans serif. You could change the definition of \diffd:

\documentclass{beamer}
\usetheme{metropolis}
\usepackage{physics}

\def\diffd{\textup{d}}

\begin{document}
\begin{frame}
Usual math is sans-serif: $12 + 4 = x^2$.

Physics package not necessarily: $\dv{x}{y} \neq \pdv{i}{k}$.
\end{frame}
\end{document}


• According to this answer, it seems better to use this definition for \diffd: \def\diffd{\mathop{}\!\mathsf{d}}. Compare space before dx with your definition and with mine, in $I=\int_a^b f(x)\dd x$. – quark67 Jan 18 at 4:14
• @quark67 That's the way the physics package defines it. I'm not going to challenge that there are better ways to define it. – user36296 Jan 18 at 9:12