# Article and Beamer Accent Problem

This is a follow up question to this.

So after some experimentation, I realized that no matter which font package I put, beamer always has a problem with the formatting the accents, whereas article doesn't.

Article code:

\documentclass[12 pt]{article}
\usepackage{amsmath}
\usepackage{mleftright}
\usepackage{sansmathaccent} %To get the bar on top aligned correctly
\usepackage{accents} %For underbar
\newcommand\munderbar[1]{%
\underaccent{\bar}{#1}} %making the underbar
%Source: https://tex.stackexchange.com/questions/163280/underbar-changing-the-style-of-font-but-bar-not-why

\renewcommand{\left}{\mleft}
\renewcommand{\right}{\mright}
\begin{document}
$$\munderbar{u}_i \leq u_i\left(t\right)\leq \bar{u}_i$$
\end{document}


Output:

Beamer code (with original font):

\documentclass[12 pt,handout,notheorems]{beamer}
\usepackage{amsmath}
\usepackage{pgfpages}
\usepackage{mleftright}
\pgfpagesuselayout{resize to}[a4paper,landscape]
\usepackage{sansmathaccent} %To get the bar on top aligned correctly
\usepackage{accents} %For underbar
\newcommand\munderbar[1]{%
\underaccent{\bar}{#1}} %making the underbar
%Source: https://tex.stackexchange.com/questions/163280/underbar-changing-the-style-of-font-but-bar-not-why

\renewcommand{\left}{\mleft}
\renewcommand{\right}{\mright}
\begin{document}
\begin{frame}
$$\munderbar{u}_i \leq u_i\left(t\right)\leq \bar{u}_i$$
\end{frame}
\end{document}


Output:

Beamer code (with serif):

\documentclass[12 pt,handout,notheorems, serif]{beamer}
\usepackage{amsmath}
\usepackage{pgfpages}
\usepackage{mleftright}
\pgfpagesuselayout{resize to}[a4paper,landscape]
\usepackage{sansmathaccent} %To get the bar on top aligned correctly
\usepackage{accents} %For underbar
\newcommand\munderbar[1]{%
\underaccent{\bar}{#1}} %making the underbar
%Source: https://tex.stackexchange.com/questions/163280/underbar-changing-the-style-of-font-but-bar-not-why

\renewcommand{\left}{\mleft}
\renewcommand{\right}{\mright}
\begin{document}
\begin{frame}
$$\munderbar{u}_i \leq u_i\left(t\right)\leq \bar{u}_i$$
\end{frame}
\end{document}


Output:

I also tried to update MikTeX, but as mentioned in the previous query, it had no effect on fixing the efficacy of sansmathaccent in particular. I was introduced an ad-hoc method, but I would need to do so for any letter that I use if I place an accent on it. Is there any other "general" way of tackling this problem?

• It is always a struggle in terms of font: We want sans-serif in presentation but the math support is limited, and beamer replaces all Latin letters and digits using text font (by default) so the math accents break down. At least \usefonttheme{professionalfonts} gives “correct” maths… – Ruixi Zhang Apr 26 at 21:41

One way to avoid (not correct) the issue, could be to redefine \bar alltogether using \overline, and defining \ubar with \underline.

\documentclass[12 pt,handout,notheorems]{beamer}
\usepackage{amsmath}
\usepackage{pgfpages}
\usepackage{mleftright}
\pgfpagesuselayout{resize to}[a4paper,landscape]
$$\ubar{u}_i \leq u_i\left(t\right)\leq \bar{u}_i$$