在我的LaTeX模板中(我使用的是XeLaTeX,其他版本不知道是否也会报错),需要导入 mathtools 包使用 align 环境,同时也为了在数学公式中使用unicode数学符号,需要导入 unicode-math 包。但同时导入二者时发现出现使用下括号 \underbrace 排版错误的情况:
排版错误的情况

此外,导入 unicode-math 后所有数学公式中的字体都变为了sans-serif字体,这不是我想要的:

下面三篇来自Stack Exchange的文章解决了这些问题:
排版错误是 unicode-math 库和 mathtools 库冲突导致的,同时冲突会导致下面的报错:
Using \overbracket and \underbracket from(unicode-math) `mathtools' package.

I'm going to overwrite the following commands(unicode-math) from the `mathtools' package:(unicode-math)(unicode-math) \dblcolon, \coloneqq, \Coloneqq, \eqqcolon.
解决方法是:
  1. 按照 amsmath、mathtools、unicode-math 的顺序依次导入三个包。
  2. 在导入 unicode-math 时加上参数 mathrm=sym,warnings-off={mathtools-colon,mathtools-overbracket} ,其中 mathrm 选项避免了与amsmath的冲突,mathtools-xxx 选项避免了使用 overbracketcolon 的错误提示。

最后三者的导入可以写为:(我是写在.sty模板中所以用 \RequirePackage,如果正文使用改为 \usepackage 即可。

\RequirePackage{amsmath}                                                    % AMS数学字体, 环境等
\RequirePackage{mathtools}                                                  % align 需要
\RequirePackage[mathrm=sym,warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math}

修正后能正确显示下括号:

类似文章

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注