As I understand your question, you would like the `\bm`

command to always typeset its contents in *slanted* style, whether in ordinary, i.e., serif, math mode or in the sansmath environment. The following modified version of your MWE achieves this objective.

Relative to your code, I've made the following three changes: (a) The `sansmath`

package is now loaded with the `T1`

option; (b) the `\SetMathAlphabet{\mathsfbf}...{bx}{sl}`

command tells LaTeX to use a slanted font in bold-math mode; (c) the `sansmath`

environment is augmented so that `\bm`

will typeset its argument the way that `\mathsfbf`

does. (I say "augmented" rather than "patched" because I believe that the `sansmath`

package predates the `bm`

package. Hence, the `sansmath`

package couldn't make allowance for the emergence of the subsequent `\bm`

command, right?)

A word of caution: This quick fix lets `\bm`

operate, as expected, on lower- and uppercase Latin letters in the `sansmath`

environment. However, some of the other "magic" of the `bm`

package, which lets it operate on Greek letters and math symbols as well, is *not* preserved by this method. To set Greek letters and math symbols in bold in the sansmath environment, you'll have to use the `\boldsymbol`

command. (By the way, AFAIK the Latin Modern font family doesn't provide separate sans-serif math-mode Greek letters, whether regular weight or bold. Therefore, if you use Greek letters in the `sansmath`

environment, you'll get the ordinary math-mode Greek letters, which may look wrong in a sans-serif environment. If you *must* have sans-serif Greek math-mode letters in your document, you should probably use xelatex and employ a specialized math font that does provide this feature.)

```
\documentclass{scrartcl}
\usepackage{lmodern,bm}
\usepackage[T1]{sansmath}
\SetMathAlphabet{\mathsfbf}{sans}{\sansmathencoding}{\sfdefault}{bx}{sl}
\usepackage{etoolbox}
\AtBeginEnvironment{sansmath}{\let\bm\mathsfbf}{}{}
\begin{document}
Serif math:
$\bm{d} = (d_1, d_2)$
$\mathbf{d} = (d_1, d_2)$
\textsf{Sans-serif math:}
\begin{sansmath}
$\bm{d} = (d_1, d_2)$
$\mathbf{d} = (d_1, d_2)$
\end{sansmath}
\end{document}
```

Consistency is the primary goal. So the first task is to know what "special numbers" we need and define commands for them:

```
\newcommand{\euler}{e}
\newcommand{\ramuno}{i}
```

(*ramuno* was how some Italian mathematicians of the 16th century called the quantity that squared gives –1; then Euler started using *i*).

The mathematical typography tradition usually didn't have a special treatment of these symbols. See, for example, n. 359 in Gauss's *Disquisitiones Arithmeticae*, where the equivalent of

```
$\cos\frac{\lambda kP}{e} + i\sin\frac{\lambda kP}{e}$
```

is found (the edition I consulted is from the *Werke* by the Königlichen Gesellschaft der Wissenschaften in Göttingen, vol. 1, 1863, page 450). There's no doubt what this *i* is denoting.

http://gdz.sub.uni-goettingen.de/dms/load/img/?PPN=PPN235993352&IDDOC=137206

However, in recent times, under the influence of physics and applied mathematics, people started to denote "constants" with upright letters. There's even an ISO regulation about this, which is compulsory in some fields where uniformity among papers and books is very important.

In pure mathematics there's essentially *no* rule. Do as you like or how your field is used to. Using special names for the special numbers allow you to change the appearance of your document just by changing the definition.

If you feel that there may be confusion between the "imaginary unit" (no worse name could be chosen for it) and an index (for summations, for instance), you have three strategies:

use a special denotation for the imaginary unit;

don't use *i* as an index;

forget about it and let the reader know from the context.

Strategy 2 is used by Graham, Knuth and Patashnik in their "Concrete Mathematics". Strategy 3 is very common in math textbooks.

## Best Answer

I guess what you are seeing is the following when you use

`\mathrm`

with a serif font:There are two ways to fix this: one fairly drastic option is to put

but this may feed through to places you are not expecting. An alternative is to replace the two relevant definitions from

`beamerbasefont.sty`

byin your preamble. In the beamer style file

`{cmss}`

is`{\rmdefault}`

.Applied to the above example, either method gives you: