2

This is a problem that took me long to figure out, posting it here in the help it is useful.

The problem is the following:

\documentclass{article}


\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[font={sf}]{caption}

\usepackage{siunitx}
\sisetup{detect-family=true}

\usepackage[scaled]{berasans}


\begin{document}

\begin{figure}
  Dummy figure
  \caption{Caption with units: \SI{10}{m} vs 10~m}
\end{figure}


\end{document}

Without the \usepackage[scaled]{berasans} line, everything works perfectly fine, and the fonts in the legend are homogeneous. However, with the redefinition of the default sans serif font, there is a significant mismatch between the fonts of the \SI{10}{m} command in the legend and the following 10~m (and yes, I know the spacing is wrong but that's not the point).

1 Answer 1

3

It took me forever to realize that the problem was that the output of the \SI command is not typeset using \sfdefault, but using \mathsf, which is not redefined by the \usepackage[scaled]{berasans}.

My fix was to add the following in the preamble:

\DeclareMathAlphabet{\mathsf}{T1}{fvs}{m}{n}

This redefines the default family for \mathsf ot be the same as what the berasans package defines as the \sfdefault family.

You must log in to answer this question.

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