7

I have recently upgraded from an old machine on which I use siunitx with the cmbright package to get a sans serif font. However, this produces a slightly bold(er) font for the unit now which should not be the case: siunitxs slightly bolder font

I hope I have implemented the necessary improvements of my code, namely exchanging SI by qty. So I run the following code with pdflatex (mwe):

\documentclass{article}
\usepackage{siunitx}
\usepackage{cmbright}
\begin{document}
\qty{5}{\m} vs. 5m
\end{document}

2 Answers 2

8

siunitx detects that you are using a sans serif font and switches to \mathsf, which cmbright doesn't set up and so is still cmss. You can force siunitx to use \mathrm again:

\documentclass{article}
\usepackage{siunitx}
\AtBeginDocument{\sisetup{unit-font-command = \mathrm}} 
\usepackage{cmbright}
\begin{document}
\qty{5}{\m} vs. 5m
\end{document}

enter image description here

7

Just declare \mathsf to be what it should. For some reasons, cmbright fails to declare it.

\documentclass{article}
\usepackage{siunitx}
\usepackage{cmbright}

\DeclareMathAlphabet{\mathsf}{OT1}{\familydefault}{m}{n}

\begin{document}

\qty{5}{\m} vs. 5m

\end{document}

enter image description here

2
  • This sounds like (almost) a bug in cmbright. I chose Ulrike's answer since it seems less technical, hope you understand:)
    – fborchers
    Jan 4, 2022 at 13:57
  • 2
    @fborchers No problem! The declaration is important in order not to have surprises when \mathsf is used, maybe porting some other code.
    – egreg
    Jan 4, 2022 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .