3

Is it possible to get the \not glyph with a centered bounding box in Latin Modern?

\documentclass{article}

\usepackage{lmodern}

\begin{document}
\fbox{$\not$}
\end{document}

Bounding box of \not

1 Answer 1

3

The \not symbol has zero width; (the box you get is twice \fboxsep wide).

You can use \centernot over an invisible =.

\documentclass{article}

\usepackage{lmodern}
\usepackage{centernot}

\setlength{\fboxsep}{0pt}

\begin{document}

\fbox{$\not$}

\fbox{$\centernot{\hphantom{=}}$}

\end{document}

with =

Of course you want to define a command.

\documentclass{article}

\usepackage{lmodern}
\usepackage{centernot}

\NewDocumentCommand{\wnot}{O{6}}{%
  \centernot{\mkern#1mu}%
}

\setlength{\fboxsep}{0pt}

\begin{document}

\fbox{$\not$}

\fbox{$\wnot[4]$} (4)

\fbox{$\wnot[6]$} (6)

\fbox{$\wnot[8]$} (8)

\fbox{$\wnot[10]$} (10)

\fbox{$\wnot[12]$} (12)

\end{document}

When you have decided what's the width that suits you, you can remove the optional argument and hardwire the desired width.

variable width

Note that \centernot creates a relation symbol. If you want an ordinary symbol, add braces around the whole thing.

In the following example I use 12mu, which is the width of =.

\documentclass{article}

\usepackage{lmodern}
\usepackage{centernot}

\NewDocumentCommand{\wnot}{}{% ordinary
  {\centernot{\mkern12mu}}%
}

\NewDocumentCommand{\rnot}{}{% relation
  \centernot{\mkern12mu}%
}

\begin{document}

$a\wnot b$ versus $a\rnot b$

\end{document}

ordinary or relation

1
  • Thank you very much for this very fast answer! Commented Sep 4 at 21:47

You must log in to answer this question.

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