# how can I create the negation of mathcal letters

I know that the negation of < is got by \not <. The same with many symbols. But this doesn't work with mathcal letters for example, like \not \mathcal{R} or \mathcal{\not R}.

• Why would you want such a thing? Commented Jun 13, 2013 at 10:13
• @Vishal essentially I want to negate relation symbols Commented Jun 13, 2013 at 10:21
• @Vishal Well, yes but $\notin$ is for the negation of the inclusion symbol. I need to negate any other symbol, specifically mathcal letters. Commented Jun 13, 2013 at 10:32
• @SeanAllred It's not weird math, we always have relation symbols: =, <, >, +,-,etc. but when we are dealing with them in general, I mean no particular symbol is used, like when we study logic or set theory then we use letters instead. Commented Jun 13, 2013 at 11:55
• Hmmm - I can see that. I suppose I never got far enough into it where $~$ and friends didn't suffice. Commented Jun 13, 2013 at 12:43

The package cancel can draw a diagonal line.

\documentclass[a4paper]{article}

\usepackage{amsmath}
\usepackage{cancel}
\begin{document}

$\cancel{\mathcal{R}}$

\end{document}


\not is designed for negating relation symbols basically as wide as the equals sign. But it doesn't always work and, for instance, one should use \notin rather than \not\in because the membership sign is too high.

Here's a possible solution for your “negated relations”:

\documentclass{article}
\usepackage{xparse}
\NewDocumentCommand{\calrel}{sm}
{%
\mathrel{
\IfBooleanTF{#1}
{\notcalrel{#2}}
{\mathcal{#2}}%
}%
}
\NewDocumentCommand{\notcalrel}{m}
{%
\ooalign{$\mathcal{#1}$\cr\noalign{\kern-.2ex}\hidewidth$/$\hidewidth\cr}
}

\begin{document}
We have $x \calrel{R} y$ but $a \calrel*{R} b$.

We have $x \calrel*{R} y$ but $a \calrel{R} b$.

\end{document}


With \calrel{R} you get a relation symbol with the correct spacing around it; the *-variant adds the negation bar.

Note that the *-variant will not work in subscripts or superscripts; this shouldn't be much of a concern, though.

Using this with \mathcal{T} poses some problems: the slope of the glyph is very similar to the slope of the slash and the central bar gets in the way. A solution might be to rotate a bit the slash, making it longer.

\documentclass{article}
\usepackage{xparse,graphicx}
\NewDocumentCommand{\calrel}{sm}
{%
\mathrel{
\IfBooleanTF{#1}
{\notcalrel{#2}}
{\mathcal{#2}}%
}%
}
\newcommand{\notcalrel}[1]
{%
\ooalign{%
$\mathcal{#1}$\cr
\noalign{\kern-.05ex}
\hidewidth\kern.05em\rotatedslash\hidewidth\cr}
}
\newcommand\rotatedslash{%
\rotatebox[origin=c]{-20}{\scalebox{1}[1.2]{/}}%
}

\begin{document}
We have $x \calrel{R} y$ but $a \calrel*{R} b$.

We have $x \calrel*{R} y$ but $a \calrel{R} b$.

We have $x \calrel{S} y$ but $a \calrel*{S} b$.

We have $x \calrel*{S} y$ but $a \calrel{S} b$.

We have $x \calrel{T} y$ but $a \calrel*{T} b$.

We have $x \calrel*{T} y$ but $a \calrel{T} b$.

\end{document}


• The first one looks really nice. It's probably worth just not using T. Commented Jun 13, 2013 at 18:02