1

I am having problems with \not command. I have read this: unicode-math breaks \not command I have tried the fix mentioned there. This MWE compiles without problems in 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}

enter image description here

The first one with \nmid gives a small divides' symbol So, I use \not\left\vert ...\right.to get a largerdivides' symbol. I get the desired output in pdflatex as seen in the screen shot above. So, there is no syntax problem. But, this mwe gives problems in 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}

I get the following error message:

! 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.

How to fix this problem.

Edit: @egreg has pointed out that the pdflatex version works by accident of implementation. What is the best way to get a `not divides' symbol of the correct size that works with unicode-maths also?

5
  • This cannot work: \left needs to process everything up to the matching \right before TeX decides the size of the delimiter. You're misusing \left and \right anyway.
    – egreg
    Jan 22, 2022 at 9:46
  • @egreg There is nothing wrong in the latex syntax. The expression compiles fine in pdflatex. The problem is only with unicode-maths. Jan 22, 2022 at 9:47
  • @egreg The first MWE compiles fine in pdflatex. Please check it out. I have also explained why I need the \left\vert ...\right. construction. Jan 22, 2022 at 9:49
  • The first example seems to work with pdflatex. But just by accident of implementation: in that context \not just prints a zero width character which extends past its (empty) bounding box.
    – egreg
    Jan 22, 2022 at 9:57
  • @egreg I have modified the question. Please take a look when you are free. Jan 22, 2022 at 10:12

0

You must log in to answer this question.

Browse other questions tagged .