12

When using \not together with wider symbols such as \Leftrightarrow the diagonal line produced by \not is placed too far to the left. How can the line be properly aligned?

For example the following code

\documentclass{article}

\begin{document}

\(\not\subset\)% Looks good

\(\not\approx\)% Looks good

\(\not\leftrightarrow\)% \not line is too far to the left

\(\not\Leftrightarrow\)% \not line is too far to the left

\end{document}

produces the following output where the last two symbols has got a misaligned diagonal line

Aligned and not aligned examples of \not

Also, maybe the lines may need other changes than alignment to look good.

3
  • 1
    You could try to place it over it by yourself. See the answers to Overlay symbol with another. Note that the accepted answer (written by me) seems not the best way to go after all. Check the other answers first. Jul 19, 2011 at 10:13
  • @Martin It doesn't work because \not has zero width.
    – egreg
    Jul 19, 2011 at 10:23
  • @egreg: I knew that. IMHO this makes it more difficult but not impossible. I still thought pointing that question out added some value. I'm not saying it is a duplicate. Jul 19, 2011 at 10:27

4 Answers 4

12

The \not symbol typesets a zero width character which protrudes on the right and so it is apt to be superimposed only on certain characters having a suitable width (the equal sign, for example); since the two arrows are wider than the equal sign, the alignment is not optimal. A solution is to push the \not a bit on the right and backspacing for the same amount:

\newcommand\nleftrightarrow{
  \mathrel{\mkern2.1mu\not\mkern-2.1mu\leftrightarrow}}
\newcommand\nLeftrightarrow{
  \mathrel{\mkern2.1mu\not\mkern-2.1mu\Leftrightarrow}}

You might also consider the set of "negated arrows" provided by amssymb; the names are the same that I chose:

\usepackage{amssymb}

$X\nleftrightarrow Y$ and $X\nLeftrightarrow Y$

Try both and choose what suits your taste. If you already load amssymb use \renewcommand instead of \newcommand.

enter image description here

One can also define a \xnot command that gives to the symbol the width of the equal sign and use a standard method for superimposing symbols:

\newcommand\xnot{\mathpalette\xxnot}
\newcommand*\xxnot[2]{\mathrel{\ooalign{%
  \hfil$#1\not\mathrel{\hphantom=}$\hfil\cr\hfil$#1#2$\hfil\cr}}}

Now \xnot\leftrightarrow gives the same result as the "definition by hand" before. The strange \mathrel after \not has its explanation in the fact that TeX never adds space between two relation math atoms. Thanks to Martin for having suggested this method. The centernot package does something similar.

2
  • I appreciate the detail of this answer. I like both the shorter lines of amssymb and the longer of your definition by hand. Is there any convention to look at in choosing which to use?
    – N.N.
    Jul 19, 2011 at 10:52
  • @N.N. I would prefer the AMS ones, had I to use negated arrows, which I don't like at all. :)
    – egreg
    Jul 19, 2011 at 10:57
11

The centernot package provides a centered slash with the \centernot macro, which looks far better than the original \not in many cases.

\documentclass{article}
\usepackage{centernot}
\begin{document}
    $\centernot\leftrightarrow$, $\centernot\Leftrightarrow$
\end{document}

Result:

\centernot\leftrightarrow, \centernot\Leftrightarrow

1
  • I like the simplicity of this answer (and the resulting output).
    – N.N.
    Jul 19, 2011 at 10:50
6

You could use the cancel package for arrows and other wider expressions:

\usepackage{cancel}

\(\cancel\leftrightarrow\)
\(\cancel\Leftrightarrow\)

cancelled arrows

1
  • If I want a somewhat uniform look of \neq and wider canceled symbols this solution will be unsatisfactory. For example, compare the output of \neq and \cancel\Leftrightarrow, the line of the latter is distinctly different.
    – N.N.
    Jul 19, 2011 at 10:17
0

Apparently, if you only need \not\Leftrightarrow (or a few other similar symbols), these are already included with prefix n: So just use \nLeftrightarrow, \nleq, etc.

(of course, centernot or cancel are still useful for all the other symbols that do not support this)

You must log in to answer this question.

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