bm導致粗字體未定義的問題

bm導致粗字體未定義的問題
\documentclass[a4paper]{article}

\usepackage[no-math]{fontspec}

\usepackage{anyfontsize}
\usepackage{amsmath,amssymb,amsthm,mathrsfs}

\setmainfont{Times New Roman}
\usepackage{unicode-math}
\setmathfont{Asana-Math.otf}
\usepackage{bm}
\renewcommand{\bm}{\symbf}


\title{Title}
\author{Author}
\date{\today}

\begin{document}

    \maketitle

\end{document}

這會導致警告

Font shape `TU/Asana-Math.otf(1)/b/n' undefined
(Font)  using `TU/Asana-Math.otf(1)/m/n' instead.

但如果我刪除這些行

\usepackage{bm}
\renewcommand{\bm}{\symbf}

警告消失了。

為什麼?如何解決這個問題?

答案1

我的解決方案是不使用\bm並直接替換它\mathbf

\usepackage[no-math]{fontspec}
\setmainfont{TeX Gyre Pagella}
\usepackage[scr=rsfso,frak=euler,bb=ams]{mathalpha}
\usepackage[bold-style=ISO,sans-style=italic]{unicode-math}
\setmathfont{Asana Math}
\AtBeginDocument{
  \let\uglymathbf\mathbf
  \renewcommand\mathbf\symbf
  \let\uglymathsf\mathsf
  \renewcommand\mathsf\symsf
}

答案2

正如訊息所說,您使用的字體沒有粗體。\symbf不更改字體,它從同一字體中選擇粗體數學字母範圍。更一般地說,bm大多不相容unicode-math(我確實希望擴展它,但存在一些技術問題)。

當然第一行在這裡沒有意義

\usepackage{bm}
\renewcommand{\bm}{\symbf}

由於 renew 指令撤銷了套件的定義,只需使用

\newcommand\bm{\symbf}`

如果您想使用別名\symbfto ,可能是因為您正在使用package to\bm覆蓋現有的 pdftex 文檔,否則根本不要使用並在數學公式中使用。bmunicode-math\bm\symbf

請注意,問題詢問的是有關別名\bm\symbf問題,這就是我上面顯示的內容,但對於字母(例如 x), \bm{x}是粗體數學斜體而不是粗體直立,因此\symbfit可能是更好的選擇。

相關內容