# Getting \bm to pass thru siunitx macros

It seems that macros form the \siunitx package have a \bm problem, but no problem with \textcolor:

Note that the 180 passed thru the \ang macro is not bold.

So, how do I change the \MyFormat macro so that \bm passes thru the siunitx macros.

## Code:

\documentclass{article}
\usepackage{xcolor}
\usepackage{bm}
\usepackage{siunitx}

\newcommand*{\MyFormat}[2][blue]{\bm{\textcolor{#1}{#2}}}%

\begin{document}

$\MyFormat{\frac{180}{\pi}} = \MyFormat{\frac{\ang{180}}{\pi}}$

\end{document}

-
Colour and font weight are treated differently as siunitx deliberately resets the font, but does nothing to the colour. – Joseph Wright Jul 24 '12 at 17:56
I ran that document with \tracingall but decided to go home rather than look at it, thankfully someone else answered. You should try it:-) \ang is more complicated than it looks (and so is \bm for that matter:-) – David Carlisle Jul 24 '12 at 19:48
@DavidCarlisle: Wow!! With just the siunitx package and the document consisting only of \ang{180} I get a 5.4MB file with \tracingall. ...Well, if have just the package included and an completely empty document I still get a 4.7MB file!! How can you possibly debug with \tracingall? – Peter Grill Jul 24 '12 at 20:48
The log file looks a bit scary at first but nothing looks too bad once you have it safely in an emacs buffer. – David Carlisle Jul 24 '12 at 20:58
@PeterGrill There's a lot of font switching going on. You are best off with the trace package and \traceon. (Of course, I have the advantage of knowing where to look in the first place, at least in theory.) – Joseph Wright Jul 25 '12 at 18:25

You can configure the siunitx package to detect bold math. Try
\sisetup{detect-weight, detect-display-math}

\sisetup{detect-inline-weight=math}

To elaborate a little, siunitx can deal with math mode material either as 'matching' the surrounds or as 'independent'. With the standard settings, it ignores font changes entirely. If you turn on weight detection, math material is as standard treated as 'matching' the text it is within. – Joseph Wright Jul 24 '12 at 17:55