5

I've read this question regarding a "possible conflict" of the siunitx and the sansmath packages, but that didn't really solve my issue.

I have a document where the text is written in roman font while the math uses sans serif fonts (thanks to the libertine and sansmath packages). Here's the preamble:

\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}

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

\usepackage[detect-all]{siunitx}
\sisetup{text-rm=\sffamily,math-rm=\mathsf}

\usepackage{sansmath}
\sansmath

I've noticed that whenever I put any of the siunitx commands inside the math "environment" ($ ... $), the output seems to "ignore" that it's supposed to use sans. Here's my MWE, without using the libertine packages.

\begin{document}

Let \ang{30} be an acute angle. Also, \num{30} is a number and
\SI{30}{\metre} is not that far!

Let $\ang{30}$ be an acute angle. Also, $\num{30}$ is a number and
$\SI{30}{\metre}$ is not that far!
\end{document}

Produces:

output of the mwe

What am I doing wrong? It's not mandatory, but all the other numbers inside the math spaces are "sans", so I'd like the bottom line to also show up as sans.

1 Answer 1

1

Using the sfmath package instead of sansmath seems to work with siunitx (i.e. you don't need to change siunitx font preferences at all).

If that is not an option, setting the number in text mode does the trick:

\sisetup{
  mode=text,
  text-rm=\sffamily,
}

You must log in to answer this question.

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