29

I want to negate the symbol whose code is \models (this would be specific to Formal Logic). How can I do that? I tried a number of combination, but didn't find how this could be done. I tried \neqmodels, \nemodels, \notmodels, \nmodels but all of them are wrong.

Is there a general way to negate symbols?

6
  • 2
    Does \not\models work for you?
    – Scott H.
    Oct 27, 2013 at 18:06
  • @ScottH. , Oh this works! thanx! but is there a general rule to negate symbols ?
    – Element
    Oct 27, 2013 at 18:08
  • 1
    There may be other ways, but all I know for a general rule is to throw a \not in front of they symbol to be negated.
    – Scott H.
    Oct 27, 2013 at 18:10
  • There are a couple of good answers here that might be adapted if you don't like the looks of \not.
    – Scott H.
    Oct 27, 2013 at 18:15
  • 1
    @ScottH.: Perhaps we can generalize this question into something that requests the negation of a symbol (the question as well), and write up something that uses a bunch of methods. \cancel, \not, and more?
    – Werner
    Oct 27, 2013 at 18:25

3 Answers 3

44

There are a number of ways to achieve the negation of a symbol:

  1. Follow the guidelines in How to look up a symbol or identify a math symbol or character? to see whether such a symbol already exists.

    This is usually the best course of action, since the symbol would have been constructed to match certain specification (say, placement and height/depth of negation symbol). If such a symbol is only available in a different font, then consider including only that symbol by following the instructions in Importing a Single Symbol From a Different Font.

    enter image description here

    \documentclass{article}
    \usepackage{amssymb}% http://ctan.org/pkg/amssymb
    \begin{document}
    \[
      a \neq b \nparallel c \nvDash d \nprec e
    \]
    \end{document}
    
  2. For a symbol \mysymbol, try \not\mysymbol. \not is a zero-width math relation that is set "on the right" of where it's called. As such, it visually overlaps the typical math relation/symbol. Not always perfect, but works in general.

    enter image description here

    \documentclass{article}
    \begin{document}
    \[
      a \not= b \not\geq c \not\sim d \not\approx e \not\in f
    \]
    \end{document}
    
  3. centernot works well when symbols are somewhat wider than usual, yet you still want the regular \not-like visual.

    enter image description here

    \documentclass{article}
    \usepackage{centernot}% http://ctan.org/pkg/centernot
    \begin{document}
    \[
      a \not= b \centernot= c 
        \not\parallel d \centernot\parallel e 
        \not\longrightarrow f \centernot\longrightarrow g
    \]
    \end{document}
    
  4. The cancel package draws a diagonal line across a symbol to "cancel" it.

    enter image description here

    \documentclass{article}
    \usepackage{centernot,cancel}% http://ctan.org/pkg/{centernot,cancel}
    \begin{document}
    \[
      a \not= b \centernot= c \mathrel{\cancel{=}} d
        \not\longrightarrow e \centernot\longrightarrow f \mathrel{\cancel{\longrightarrow}} g
    \]
    \end{document}
    
  5. Other methods include using graphics packages like tikz or pstricks to draw rules in specific locations across a symbol/construction.

3
  • This is a great answer :) thanx for editing the question and providing this answer , it's a reference , I think!
    – Element
    Oct 27, 2013 at 19:59
  • 4
    \not\in shows why \notin is defined
    – egreg
    Oct 27, 2013 at 20:24
  • Point 2 works, including "\not\in". Thanks. Kindly try $\not\in \qquad \in $ with proper latex package.
    – PoreyS
    Jul 14, 2022 at 3:51
10

A good compromise is usually \centernot (from the package centernot).

But sometimes \centernot is good, sometimes it isn't. For instance, \centernot{\in} produces a poorer result than \notin that uses the common slash instead.

In other cases, some small adjustments are necessary:

\documentclass{article}
\usepackage{centernot}

\begin{document}

$\centernot{\eta}$

$\mkern-1mu\not\mathrel{\mkern1mu\eta}\mkern1mu$

\end{document}

enter image description here

The first \mkern does a small backing up; then \not is typeset, which takes no horizontal space, then \eta is printed with no intervening space, because it has been turned into a relation symbol and TeX adds no space between consecutive relation symbols, but preceded by a small space that compensates for the negative space inserted before. A final space is added to take care of the fact that the slash ends right of \eta.

Note that all the construction will be considered as a relation symbol as far as spacing is concerned:

\documentclass{article}

\newcommand{\noteta}{%
  \mkern-1mu\not\mathrel{\mkern1mu\eta}\mkern1mu
}

\begin{document}

$A \noteta B$

\end{document}

enter image description here

If an ordinary symbol is desired, add \mathord or just a pair of additional braces:

\newcommand{\noteta}{%
  \mathord{\mkern-1mu\not\mathrel{\mkern1mu\eta}\mkern1mu}%
}

is equivalent to, but clearer than,

\newcommand{\noteta}{%
  {\mkern-1mu\not\mathrel{\mkern1mu\eta}\mkern1mu}%
}

Such manual adjustments may be needed depending on the shape of the symbols involved.

-1

How to get \not\to arrow?

Probably best test code with amssymb

\documentclass{article}
\usepackage{amssymb}
\usepackage{unicode-math} % if you also need maths

\begin{document}
$\nrightarrow$
\end{document}

giving

enter image description here

Test code with centernot package but negative complications with unicode-math

\documentclass{article}
\usepackage{centernot}% http://ctan.org/pkg/centernot

\begin{document}
\[
\centernot\to
\]
\end{document}

giving

enter image description here

Errors with centernot package

  • with unicode-math: Latex Error: ./file.tex:9 Missing { inserted.

\not\to alone gives unaligned arrow but unicode-math package works

\documentclass{article}
\usepackage{unicode-math} % if you also need maths
\begin{document}
$\not\to$
\end{document}

enter image description here

6
  • Your question about this subject was closed as duplicate. If you change the question to reflect the actual problem you have, then it can be reopened. Making a question here is not the way to go.
    – egreg
    Sep 15, 2015 at 13:50
  • @egreg This is not a question! It is an answer to the thing. This is a specific task to negate \to symbol. I already deleted the old question because it was closed. I think this one is here ok because it fits the title. Sep 15, 2015 at 14:00
  • You do seem to answer a different question to what was asked though. Especially when referring to \nrightarrow which is not necessarily present for all symbols. And centernot was already covered by Werner and egreg. I fell you could re-work this answer quite a bit and it would be OK. You would have to make it more general. Your first point could be to try and find a negated version of the symbol (often called \n...), of course here the OP already tried that.
    – moewe
    Sep 15, 2015 at 14:18
  • \centernot was not covered for the symbol \to. It is the case here. Therefore, I left it like that. Feel free to edit if you can improve it, but without losing the information about \to and its negation. Sep 15, 2015 at 14:20
  • Mhhh, but then there are other symbols that are not explicitly covered in the other answers, do you want to add an answer for those as well? I appreciate that there was some lateral thinking needed to get from \to to \rightarrow and then to \nrightarrow as a negated version of \not. But from the other answer people can easily infer that trying \centernot\to might be an option.
    – moewe
    Sep 15, 2015 at 14:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .