6

So, I'm using a custom beamer styling required by my employer, and while trying to typeset some problem examples with the "ohm" symbol, I've noticed it doesn't always work.

At first, I noticed it didn't appear at all, using the following code:

\documentclass[9pt]{beamer}
\mode<presentation>
{
    \usetheme{JuanLesPins}
    \usefonttheme{serif}
    \usecolortheme{beaver}
    \setbeamercovered{invisible} \setbeamertemplate{blocks}[rounded][shadow=true] 
    \setbeamertemplate{navigation symbols}{} 
    \setbeamertemplate{footline}[frame number]
    \usecolortheme[RGB={122,4,24}]{structure}
}

\setcounter{tocdepth}{1}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{polyglossia}
\setdefaultlanguage{brazil}

\usepackage{siunitx}
\sisetup{per-mode=symbol,output-decimal-marker={,},math-micro=\text{µ},text-micro=µ,exponent-product = \cdot}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\section*{Sumário}

\begin{frame}{Sumário}
  \tableofcontents
\end{frame}

\begin{frame}{}
    You can see that this doesn't work: \SI{1}{\ohm}

    Nor does this: $ \SI{1}{\ohm} $

    Or this: $$ \SI{1}{\ohm} $$
    Or this: \[ \SI{1}{\ohm} \]
    Or \[ \text{\SI{1}{\ohm}} \]
\end{frame}

\end{document}

After adding detect-all=true to the \sisetup command I managed to get the \SI macros in text-mode to work, but none of the math ones, like so.

I noticed that if I remove the \usefonttheme{serif} line from the styling definition (idk how to call it, sorry), everything works as usual.

Literally same code, but with the font theme 'serif' line commented

I thought of redefining the Omega characters used by the siunitx package, but to no avail.

\DeclareMathSymbol{\Omega}{\mathalpha}{letters}{"0A}
\DeclareMathSymbol{\varOmega}{\mathalpha}{operators}{"0A}

Also tried to change the font used by the package (math-rm=\mathrm, text-rm=\rmfamily in \sisetup), and to make it insensitive to outside family font (detect-family=false in \sisetup). All without any clear result.

3
  • 4
    Are you forced to use the polyglossia package? Things seem to work just fine if I replace \usepackage{polyglossia}\setdefaultlanguage{brazil} with \usepackage[brazil]{babel}, under both XeLaTeX and LuaLaTeX.
    – Mico
    Oct 1, 2019 at 7:16
  • Well, actually, I'm not. Thank you, @Mico. Hadn't thought of it.
    – Isabella B
    Oct 1, 2019 at 23:29
  • @CarLaTeX - Done! :-)
    – Mico
    Oct 5, 2019 at 14:06

2 Answers 2

2

It very much looks like the issue you've come across is a (bad) side-effect of using the polyglossia package, which seems to have a few issues when used with the brazil language option.

Unless you absolutely must use the polyglossia package, an easy remedy consists of (a) getting rid of (or, at least, commenting out) the instructions

\usepackage{polyglossia}
\setdefaultlanguage{brazil}

and (b) running, in their place, the instruction

\usepackage[portuguese]{babel}

A separate comment/observation: I would also get rid of the siunitx options math-micro=\text{µ} and text-micro=µ. For sure, when used in tandem with the babel package, these options generate incorrect output when writing, say, \si{\micro\ohm}.

enter image description here

\documentclass{beamer}
\mode<presentation>
{
    \usetheme{JuanLesPins}
    \usefonttheme{serif}
    \usecolortheme{beaver}
    \setbeamercovered{invisible} \setbeamertemplate{blocks}[rounded][shadow=true]
    \setbeamertemplate{navigation symbols}{}
    \setbeamertemplate{footline}[frame number]
    \usecolortheme[RGB={122,4,24}]{structure}
}

\usepackage{lmodern}
\usepackage[T1]{fontenc}

%\usepackage{polyglossia}
%\setdefaultlanguage{brazil}
\usepackage[portuguese]{babel}

\usepackage{siunitx}
\sisetup{per-mode=symbol,output-decimal-marker={,},exponent-product = \cdot}

\begin{document}
\begin{frame}{}
    This works now: \SI{1}{\micro\ohm}

    So does this: $\SI{1}{\micro\ohm}$

    And this: $$ \SI{1}{\micro\ohm} $$
    And this: \[ \SI{1}{\micro\ohm} \]
    And this: \[ \text{\SI{1}{\micro\ohm}} \]
\end{frame}
\end{document}
0
4

Just remove \usepackage{lmodern} and \usepackage[T1]{fontenc}.

\documentclass[9pt]{beamer}
\mode<presentation>
{
    \usetheme{JuanLesPins}
    \usefonttheme{serif}
    \usecolortheme{beaver}
    \setbeamercovered{invisible} \setbeamertemplate{blocks}[rounded][shadow=true] 
    \setbeamertemplate{navigation symbols}{} 
    \setbeamertemplate{footline}[frame number]
    \usecolortheme[RGB={122,4,24}]{structure}
}

\setcounter{tocdepth}{1}

\usepackage{polyglossia}
\setdefaultlanguage{brazil}

\usepackage{siunitx}
\sisetup{
  per-mode=symbol,
  output-decimal-marker={,},
  math-micro=\text{µ},
  text-micro=µ,
  exponent-product = \cdot
}

\begin{document}

\begin{frame}{}
    You can see that this doesn't work: \SI{1}{\ohm}

    Nor does this: $ \SI{1}{\ohm} $

    Or this: \[ \SI{1}{\ohm} \]
    Or \[ \text{\SI{1}{\ohm}} \]
\end{frame}

\end{document}

enter image description here

3
  • Hello @egreg! Can you please explain why one shouldn't use the lmodern and fontenc (with the option T1) packages? It is a general practice? I use this everywhere and hadn't any issues till I came to this case described in the question, but with babel, ngerman and pdflatex. Thank you for your effort in advance!
    – Su-47
    Nov 2, 2021 at 13:47
  • 1
    @Su-47 The recommendation is for the OP who uses XeLaTeX.
    – egreg
    Nov 2, 2021 at 13:48
  • Hello @egreg! Thank you for the explanation! In my case the ohm symbol wasn't show too, till I removed lmodern and fontenc. That is why I asking. So, there are somewhere unsupported glyphs?
    – Su-47
    Nov 2, 2021 at 14:23

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.