# Why do the standard siunitx settings not detect font weight?

Using KOMA-script I got a bold font for chapter/section titles. I had a unit, `\SI{1}{\something}`, in one of them which was not set in bold font. Giving `siunitx` the following options

``````detect-weight=true, detect-family=true
``````

helped. Probably there are good reasons not to enable this by default. Which are they?

• Of note, for those afeard of applying it as a general setting to fix a specific problem, and thereby changing instances unpredictably: if there's a particular instance (such as a section heading) in which one wants siunitx to take the font-weight, the option can be set for that instance alone e.g. \section{Alignment of \SI[detect-weight=true]{532}{\nano\metre} laser} Aug 11 '17 at 12:44

The aim of `siunitx` is to be a flexible and comprehensive units package which follows the 'standards' as far as possible when loaded. If you read up on the use of units, you'll find that quantities (the combination of a number and a unit) is a mathematical entity. As with other mathematics, things like font shape and weight are therefore important. With the default settings, the package uses the current upright roman font for everything: that's the same as any other mathematics:

``````\textbf{Bold text but \$y = mx + c\$}
``````

However, some people prefer to follow some or all of the surrounding style, particularly in section headings. That's where the 'flexible' part comes in: you can do that using a package option without otherwise changing the input.

This is the choice of the package writer.

As written in the manual:

The `siunitx` package controls the font used to print output independently of the surrounding material. The standard method is to ignore the surroundings entirely, and to use the current body fonts.

To enable your choices by default, you just have to write these options in the preamble of your document, using `\sisetup`

``````\sisetup{detect-weight=true, detect-family=true}
``````
• Is there any reason why ignoring the surrounding material might be a good choice? Jan 17 '17 at 11:37
• @Martin Thoma: Consistency. If you regard units as mathematical objects, it is reasonable to have them look exactly the same everywhere. If your headings are set in small caps, for example, you wouldn't want any math to follow that style, breaking the meaning behind the appearance of mathematical objects.
– lblb
Apr 20 '17 at 16:25