0

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:

enter image description here

Beamer code (with original font):

\documentclass[12 pt,handout,notheorems]{beamer}
\usepackage{amsmath}
\usepackage{pgfpages}
\usepackage{mleftright}
\pgfpagesuselayout{resize to}[a4paper,landscape]
\usetheme{Boadilla}
\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:

enter image description here

Beamer code (with serif):

\documentclass[12 pt,handout,notheorems, serif]{beamer}
\usepackage{amsmath}
\usepackage{pgfpages}
\usepackage{mleftright}
\pgfpagesuselayout{resize to}[a4paper,landscape]
\usetheme{Boadilla}
\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:

enter image description here

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?

  • 1
    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
1

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]
\usetheme{Boadilla}
\renewcommand\bar[1]{\overline{#1}}
\newcommand\ubar[1]{\underline{#1}}
\begin{document}
    \begin{frame}
        $$\ubar{u}_i \leq u_i\left(t\right)\leq \bar{u}_i$$
    \end{frame}
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.