10

Did something change related to \ne recenetly?

The MWE below in TeXLive 2018 yields the expected output

enter image description here

but with TeXLive 2019 (with all packages up to date as of today) I get

Argument of \ne  has an extra }.

Code

\documentclass{article}
\usepackage{mathtools}
\usepackage{xparse}

\let\OldNe\ne

\RenewDocumentCommand{\ne}{o}{%
    \mathrel{\OldNe}
}

\begin{document}
$a \ne b$
\end{document}
  • 2
    \ne is now \protect\ne<space>, so you need to use the letltxmacro package and \LetLtxMacro\OldNe\ne – Phelype Oleinik Nov 12 at 1:45
  • @PhelypeOleinik: Thanks. Works great. Please post a answer. – Peter Grill Nov 12 at 1:50
13

With the last LaTeX release (October 2019) a lot of commands which are not usually supposed to expand were made robust, so \ne, which usually was \not=, now expands to \protect\ne<space> (\ne<space> is \csname ne \endcsname).

With \let\OldNe\ne, when your command does \mathrel{\OldNe}, \OldNe expands to \protect\ne<space>, and now \ne<space> is a macro delimited by a ], but a } is found before that, so TeX raises the Argument of \ne  has an extra } (note the extra space in the error message).

To work around the issue, for the time being, load the letltxmacro and use \LetLtxMacro\OldNe\ne instead of \let\OldNe\ne. \LetLtxMacro takes care of the fact that \ne is now protected. Eventually the LaTeX kernel will probably have, now that there are many more protected macros, a \let command that takes care of that in a similar way \LetLtxMacro does.

  • 3
    Is there a document which list the commands that were changed? – Peter Grill Nov 12 at 3:00
  • 3
    @PeterGrill Not officially, as far as I know. We have the history of commits in the LaTeX2e repo (github.com/latex3/latex2e), but not officially compiled into a list. That's a good idea, though, we should probably have one. I'll let you know if one comes to exist. – Phelype Oleinik Nov 12 at 3:22
  • 1
    Why is the protected version delimited by a ]? – siracusa Nov 12 at 5:48
  • @siracusa I think that is a response to what ever it is the OP is doing, Peter is making a macro that takes an optional arg. – daleif Nov 12 at 8:35
  • @siracusa to be honest I don't know yet. I'm traveling until tomorrow, so my debugging powers are limited. I thought it weird too, since (from the very little I know of xparse's internals) there should not be a \ne<space> nor a ]-delimited macro. I'll investigate when I can. – Phelype Oleinik Nov 12 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.