如何使用 lualatex 和 unicode-math 包获取正确大小的“不能整除”符号?

如何使用 lualatex 和 unicode-math 包获取正确大小的“不能整除”符号?

我遇到了问题\not。我读过以下内容: unicode-math 破坏 \not 命令 我已经尝试了那里提到的修复方法。此 MWE 在 pdflatex 中编译时没有问题:

\documentclass{article}
\usepackage{amssymb}
\newcommand{\Mod}[1]{\ \left(\mathrm{mod}\ #1\right)}
\begin{document}
    
    \(p^{k+1}\nmid\left(\alpha^2-a\right)\)
     $p^{k+1}\not\left\vert\left(\alpha^2-a\right)\right.$
\end{document}

在此处输入图片描述

第一个\nmid给出一个小的divides' symbol So, I use\not\l​​eft\vert ...\right.to get a larger除法符号。我在 pdflatex 中得到了所需的输出,如上面的屏幕截图所示。因此,没有语法问题。但是,这个 mwe 在 lualatex 中给出了问题:

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}

\ExplSyntaxOn
\def\__um_oldnot:#1{\mathrel{%
        \mathchoice
        {\rlap{$\displaystyle\mkern1mu/$}}%
        {\rlap{$\textstyle\mkern1mu/$}}%
        {\rlap{$\scriptstyle/$}}%
        {\rlap{$\scriptscriptstyle/$}}%
        {#1}}}
\ExplSyntaxOff
\setmathfont{XITS Math Regular}
\newcommand{\Mod}[1]{\ \left(\mathrm{mod}\ #1\right)}
\begin{document}
     \(p^{k+1}\nmid\left(\alpha^2-a\right)\)
     $p^{k+1}\not\left\vert\left(\alpha^2-a\right)\right.$
\end{document}

我收到以下错误消息:

! Missing { inserted.
<to be read again> 
\left 
l.18     $p^{k+1}\not\left
                      \vert\left(\alpha^2-a\right)\right.$
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
If you're confused by all this, try typing `I}' now.

! Missing } inserted.
<inserted text> 
}
l.18 ...not\left\vert\left(\alpha^2-a\right)\right.$
                                                  
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

如何解决这个问题。

编辑:@egreg 指出 pdflatex 版本是偶然实现的。获得正确大小的“不能整除”符号的最佳方法是什么,并且该符号也适用于 unicode-maths?

相关内容