# Unexpected behaviour of \not in math mode when using elsarticle with times font

I'm facing an unexpected behaviour of the command \not in math mode in conjunction with the elsartical class when using the times font. Here is a MWE.

\documentclass[3p,times]{elsarticle}

\newcommand{\Pref}{\succ}
\newcommand{\Ranking}{\mathcal}
\newcommand{\PrefRanking}[1]{\Pref_{#1}}

\begin{document}
Test 1: $\alpha \Pref_\Ranking{R} \beta$.

Test 2: $\alpha \not\Pref_\Ranking{R} \beta$.

Test 3: $\alpha \PrefRanking{\Ranking{R}} \beta$.

Test 4: $\alpha \not\PrefRanking{\Ranking{R}} \beta$.
\end{document}


The output that I obtain is the following:

I would expect Test 2 and Test 4 to be the same. On the other hand, when I don't use the times font, everything is fine. Is there anything wrong in the macro definitions?

• With the option times the txfonts are used. This sty redefines \not: \not\somecommand tries to find a \nsomecommand and use this if it exists. With this spezial \not it is better if nothing to complicated is after the not. So don't use arguments. – Ulrike Fischer Aug 19 '17 at 15:45

With the option times the txfonts.sty is used. This sty redefines \not: \not\somecommand tries to find a \nsomecommand and uses this if it exists. This makes it possible to use or design better glyphs than you would get by simply putting a slash over a symbol, but it makes the \not more fragile.

With this spezial \not it is better if nothing to complicated is after the \not. So don't use a command with arguments.

• Thanks for your answer. I used the information you provided to find a workaround. I preferred to use a different approach, as the document in which I use those kind of macros is pretty long, and changing the use of the macros would have required extensive work with the possibility of introducing errors in the text. – not A or B Aug 21 '17 at 9:57

Suggestion for macro definitions:

• Use of \not directly with \succ.
• Macro \PrefRanking also uses \Ranking in the definition text instead of doing it again in the argument.

Example:

\documentclass[3p,times]{elsarticle}

\newcommand*{\Pref}{\succ}
\newcommand*{\Ranking}{\mathcal}
\newcommand*{\PrefRanking}[1]{\Pref_{\Ranking{#1}}}

\newcommand*{\NotPref}{\not\succ}
\newcommand*{\NotPrefRanking}[1]{\NotPref_{\Ranking{#1}}}

\begin{document}
Test 1: $\alpha \PrefRanking{R} \beta$.

Test 2: $\alpha \NotPrefRanking{R} \beta$.
\end{document}


• Thanks for your answer. I preferred to use a different workaround (reported in my own answer), as the document in which I use those kind of macros is pretty long, and changing the use of the macros would have required extensive work with the possibility of introducing errors in the text. – not A or B Aug 21 '17 at 9:53

The document from which I took the MWE was too long and too intricate to redefine the macros to avoid the use of arguments, or to use new macros for the negative case. Thanks to the answer of @UlrikeFischer, I found this workaround.

I defined the macro

\newcommand{\nPrefRanking}[1]{\not\Pref_#1}


and this solves the problem wihtout modifying the use of the macros in the text of the document (note the n at the beginning of the macro name, that the rest of the macro name is the same of the name of the "positive" macro, and that #1 is not enclosed within curly brackets). I found out that it is not sufficient (at least for my aims) to redefine

\newcommand{\PrefRanking}[1]{\Pref_{#1}}


into

\newcommand{\PrefRanking}[1]{\Pref_#1}


(i.e., redefine only the positive instance of \PrefRanking by removing the curly brackets enclosing #1), because

\PrefRanking{\Ranking{R}_1}


(i.e., when \PrefRanking is used without the \not in front of it, and the argument of \PrefRanking has a subscript), would generate a double subscripts error.