Why doesn't the 'bm' package work with the 'unicode-math' package?
First, some general comments and observations about the code shown in your preamble:
When using LuaLaTeX or XeLaTeX, you should not load the
fontenc
andinputenc
packages. (Even when using pdfLaTeX, it's no longer necessary to load theinputenc
package unless your file's input encoding is not UTF8 or ASCII, which is a proper subset of UTF8.)Loading the
colortbl
andcolor
packages independently is a mistake, as it doesn't maximize the compatibility and interoperability of these two packages. Hence, do replace\usepackage{color, colortbl}
with\usepackage[table]{xcolor}
. See section 2.1.2, "Package options", as well as Table 1, "Package options", of the user guide of thexcolor
package for more information.When using the
unicode-math
package along with a suitable OpenType math font (specified via a suitable\setmathfont
instruction), there's no need to load the following packages:lmodern
,fontspec
,amsmath
,amsfonts
,amssymb
, andbm
. (Aside: If you load theunicode-math
package but do not run a\setmathfont
directive, the default math font isLatin Modern Math
.)The
unicode-math
package loads theamsmath
package automatically if it hasn't already been loaded prior to LaTeX encountering the instruction\usepackage{unicode-math}
. See Section 3, "Getting Started", of the user guide ofunicode-math
package for more information.If you wish to use the
\mathscr
directive of themathrsfs
package, be sure to loadmathrsfs
afterunicode-math
. (I mention this because the preamble you posted loads themathrsfs
package.)
Now, finally, to the main part of your query:
I want the bold italic math character (as in normal math) in math mode
To generate bold italic math-mode letters and symbols, the
unicode-math
package provides a macro called\symbfit
. Use it in lieu of\boldsymbol
and\bm
. (As you've discovered,\bm
doesn't work anyway; hence, don't use it.)To generate bold upright math-mode letters and symbols, use
\symbfup
. Use it in lieu of\mathbf
.
As the following screenshot demonstrates, \symbfit
and \symbfup
-- as well as their regular-weight counterparts \symit
and \symup
-- affect the weight and shape of Latin and Greek letters, but not the shape and weight of (math) "operators" such as \int
, \sum
, \exp
, and \ln
.
\documentclass{book}
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}
\newcommand\blurb{(\sqrt[n]{x}\,)^{n}=\sqrt[n]{x^{n}}=x
\quad \alpha\beta\Sigma\Omega \quad \int\sum\exp\ln}
\usepackage{setspace} % just for this example
\setstretch{1.25}
\obeylines
\begin{document}
$\blurb$ --- default
$\symbfit{\blurb}$ --- \verb+\symbfit+
$\symbfup{\blurb}$ --- \verb+\symbfup+
$\symit{\blurb}$ --- \verb+\symit+
$\symup{\blurb}$ --- \verb+\symup+
\end{document}
The bm
package is for legacy 8-bit fonts. In unicode-math
, load a math font that comes in bold (currently, XITS Math, Libertinus Math or Minion Math) and use \boldsymbol
for bold operators and signs. If you only need bold letters, you can use \mathbf
, \mathbfcal
, etc. Or the new commands \symbfup
for bold upright, \symbfit
for bold italic, etc., as Mico brought up. Bold letters work with any Unicode math font.
If you want to bold symbols and a different math font, you can also load a bold math font with \setmathfont[version=bold]{SomeBoldMathFont.otf}
.
You’re loading a number of legacy packages that are obsolete with unicode-math
, among them amssymb
, amsfonts
, mathrsfs
, fontenc
and inputenc
. All of these are only needed if you’re using legacy 7- and 8-bit fonts. (You shouldn’t be loading inputenc
in any case: XeLaTeX and LuaLaTeX don’t support it, and PDFLaTeX no longer needs it.)