# Math accents overlap in beamer

Consider the following MWE

\documentclass{beamer}

\usepackage[english,spanish]{babel}
\uselanguage{spanish}
\languagepath{spanish}

\usepackage{lmodern}
\usefonttheme[onlymath]{serif}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
\begin{frame}
$\max \lim$
\end{frame}
\end{document}


With this MWE the math operators accents overlap:

How can I fix this in order to obtain máx and lím?

If you are planning to use a non-default font (lmodern, in your case), it is advisable to use the professionalfonts font theme

\usefonttheme{professionalfonts}


to prevent beamer from doing some undesired replacements:

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,spanish]{babel}
\uselanguage{spanish}
\languagepath{spanish}

\usepackage{lmodern}
\usefonttheme[onlymath]{serif}
\usefonttheme{professionalfonts}

\begin{document}
\begin{frame}
$\max \lim$
\end{frame}
\end{document}


According to the beamer manual, the following font packages don't need the explicit use of professionalfonts, since beamer's substitution is automatically turned off for them: arevmath, hvmath, kpfonts, lucidabr, lucimatx, mathpmnt, mathpple, mathtime, mtpro, and mtpro2. I've contacted one of the maintainers to request that lmodern is included in this list as well.