josephwright / beamer

A LaTeX class for producing presentations and slides
Other
1.41k stars 142 forks source link

DeclareMathOperator not displayed in math font #590

Open thbtppl opened 4 years ago

thbtppl commented 4 years ago

I am writing a Beamer presentation using pdfLaTeX for the backend. I want to use Lato for the text and eulervm for the math font. However my operator Re is not displayed with the math font in the equations:

screen

I also asked the question on stackexchange and shared my MWE:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[UKenglish]{babel}
\usepackage[default]{lato}
\usepackage{eulervm}

\usefonttheme[onlymath]{serif}

\DeclareMathOperator{\Rey}{Re}

\begin{document}

\begin{frame}
  \begin{block}{In block}
    \begin{equation*}
      x + y = z
    \end{equation*}
    \begin{equation*}
      \Rey = 1
    \end{equation*}
    In text \(\Rey = 1\)
  \end{block}
\end{frame}

\end{document}
samcarter commented 4 years ago

I think this is the same situation as https://tex.stackexchange.com/a/478920

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[UKenglish]{babel}

\usepackage[default]{lato}
\usepackage{eulervm}

\usefonttheme[onlymath]{serif}

\DeclareMathOperator{\Rey}{Re}
\AtBeginDocument{\SetSymbolFont{operators}{normal}{U}{zeur}{m}{n}}

\begin{document}

\begin{frame}

  \begin{block}{In block}
    \begin{equation*}
      x + y = z Re
    \end{equation*}
    \begin{equation*}
      \Rey = 1
    \end{equation*}
    In text \(\Rey = 1\)
  \end{block}
\end{frame}

\end{document}

Screen Shot 2020-04-07 at 17 02 49

thbtppl commented 4 years ago

Ah, thank you very much @samcarter I didn't notice that thread at all. However is such a workaround necessary? In other words shouldn't Beamer handle that seamlessly?

samcarter commented 4 years ago

@thbtppl well, it works seamlessly as long as the default font is used :)

However more seriously, I don't know enough about fonts to judge this, but the advantage I see is that this also changes things like \sin or \log which would otherwise be shown in computer modern font, which neither matches your text nor your math font and will look very out of place.