I want the bold italic math character (as in normal math) in math mode. So, I tried to use the bm
package but it doesn't work together with the unicode-math
package in my LaTeX document. Again, for some specific characters, it is not possible to remove unicode-math
package. Can someone help me to use those packages together? Thanks!
The following codes work properly without \usepackage{unicode-math}
. But when adding this package, the \bm
command doesn't work.
\documentclass[12pt, twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[explicit]{titlesec}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{array}
\usepackage{tabularx,booktabs}
\usepackage{color, colortbl}
\usepackage{pgf, pgfplots}
\usepackage{tikz}\usetikzlibrary{shapes.misc}
\usepackage{mathrsfs}
\usepackage{enumitem}
\usepackage{geometry}
\begin{document}
$\bm{(\sqrt[n]{x})^{n}=\sqrt[n]{x^{n}}=x}$
\end{document}
Best Answer
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:
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
.