4

$\mathbf{0,00042}$ A renders to

enter image description here

I think the comma could be a bit more bold. What do I wrong here?

Im using Arial as main font here:

  5 \setmainfont{Arial}
  6
  7 \usepackage[ngerman]{babel}
  8
  9 \usepackage{amsmath}
 10 \usepackage{unicode-math}
 11 \setmathfont{GFSNeohellenicMath.otf}
 12 \setmathfont[range=up]{Arial}
 13 \setmathfont[range=it]{Arial Italic}
 14 \setmathfont[range=bfup]{Arial Bold}
 15 \setmathfont[range=bfit]{Arial Bold Italic}
 16 \setmathfont[range=tt]{Andale Mono}
2
  • unlike \symbf, \mathbf selects the a different font rather than different unicode range so it depends which font you have set up for bold roman but it's hard to test as you have not provided a usable test file (and I don't have all the fonts used in your fragment) posting fragments (especially line numbered ) makes it harder for anyone to test answers. Apr 8 at 23:01
  • Remark: You seem to be German or at least you use comma as a decimal separator. In that case, consider using 0{,}01 in order to remove the unwanted space after the comma. There are also packages for that, e. g. icomma. Update: I now see that this is already addressed in Davislor's answer :). Apr 9 at 2:16
7

You’re correct: \mathbf does not change the weight of symbols other than latters and numbers. The correct way to get a bold comma (or plus sign, etc.) is to set a bold math version.

As of 2021, there is no sans-serif math font that comes in a bold version, but you can fake one with fontspec commands. Unfortunately, the range= and version= options of \setmathfont do not work together. For this example, I picked Fira Sans and Fira Math.

\documentclass{article}
\usepackage{unicode-math}

\setmainfont{Fira Sans}
\setmathfont{Fira Math}
\setmathfont{Fira Math}[
  version=bold,
  FakeBold = 2.5]

\begin{document}
\noindent
$0{,}00042$ A \\
{\bfseries\boldmath
$0{,}00042$ A}
\end{document}

Fira Math/Fira Code sample

Tweak the value of FakeBold= to your taste. Writing the comma as {,} changes the math class to \mathord, which removes the spurious space you were getting after it. By default, TeX thinks that you have two numbers separated by a comma.

An alternative would be to use siunitx.

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.