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}
The first one with \nmid
gives a small divides' symbol So, I use
\not\left\vert ...\right.to get a larger
divides' 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?
\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.pdflatex
. But just by accident of implementation: in that context\not
just prints a zero width character which extends past its (empty) bounding box.