1

I'm writing an article in which I want the title of one of my subsections to be $n\not\equiv_41$. When I put that in though, I get the error message

Undefined control sequence.
\not #1->\let \@@not
                     =\not \let \@@n =\n \let \not =\relax \let \n =\relax \...

Troubleshooting a bit, I find that there is some conflict between using \not inside the subsection, and using the mathabx package.

For instance, I can typeset any one of the following 3 things.

\documentclass{amsart} %not using mathabx
\begin{document}
\subsection{$n\not\equiv_41$}
\end{document}

\documentclass{amsart}
\usepackage{mathabx}
\begin{document}
$n\not\equiv_41$ %not putting this in a subsection title
\end{document}

\documentclass{amsart}
\usepackage{mathabx}
\begin{document}
\subsection{$n\equiv_41$} %erasing the \not
\end{document}

But I cannot typeset this:

\documentclass{amsart}
\usepackage{mathabx}
\begin{document}
\subsection{$n\not\equiv_41$}
\end{document}

Is there some other way to cross out my $\equiv$ symbol inside the subsection title and still use the mathabx package? Or do I have to choose between the title I want and the stuff in the article that I'm using mathabx for?

5
  • 1
    Yes there is: use \notequiv, or the alias \nequiv.
    – Bernard
    Oct 5 '17 at 16:43
  • @Bernard Awesome, that does it! Also, unless you're expecting this question to be closed I think you should post that as an answer. I don't know if this will be of interest to others but it is certainly specific enough to not be a duplicate. Either way I am happy to get on with my article, thanks.
    – j0equ1nn
    Oct 5 '17 at 16:46
  • 1
    Use \protect\not when in a moving argument (such as a sectional title).
    – egreg
    Oct 5 '17 at 16:58
  • @egreg This looks like a solution to a more general problem, maybe this should be "the" answer?
    – j0equ1nn
    Oct 5 '17 at 17:32
  • @j0equ1nn Engaged in other business, now. I’ll turn in later.
    – egreg
    Oct 5 '17 at 18:18
1

The mathabx version of \not is fragile, so it should be protected in moving arguments, such as sectional titles and captions, by prefixing it with \protect. So

\section{$n\protect\not\equiv_41$}

You can, however, make it robust at the outset:

\documentclass{amsart}

\usepackage{mathabx}

\MakeRobust{\not}

\begin{document}

$n\not\equiv_41$

\section{$n\not\equiv_41$}

\end{document}

For completeness, here's how mathabx could define \not in a more robust and efficient way:

\makeatletter
\def\strip@bs{\expandafter\@gobble\string}
\DeclareRobustCommand\not[1]{%
  \@ifundefined{not\strip@bs#1}
    {%
     \@ifundefined{n\strip@bs#1}
       {\notsign#1}
       {\@nameuse{n\strip@bs#1}}%
    }
    {\@nameuse{not\strip@bs#1}}%
}
\makeatletter
1
  • Congrats on passing the 600K rep mark!!!
    – Mico
    Oct 6 '17 at 5:28
1

I don't know why it doesn't work, but it's simpler to use the pre-defined command \notequiv or its alias \nequiv.

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.