3

I'm looking for a method to write divisibility (or, more precisely it's negation) for 2 numbers, a and b. The fragment of code:

$a \not\vdots b$

has two major problems:

  1. The "cut" is not passing through the middle of the symbol;
  2. Extremely low space between the symbol and b.

The second one is solvable by writing:

$a \not\vdots \ b$

So, how to solve the first one? And is there any other, more elegant solution, to the second one. I'm using article class, with few packages imported (I always use "ams-" family and ocasionally others).

2 Answers 2

4

I suggest with this MWE to load centernot package. It is possible to compare the differences with your fragment of LaTeX code.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{centernot}


\begin{document}
$a \centernot\vdots b, \quad a \not\vdots b$
\end{document}

enter image description here

5
  • The mathematical notation a \nmid b is not equivalent to a \not\vdots \ b. In fact, it's equivalent to b \not\vdots \ a Oct 30, 2021 at 11:56
  • @MathStackExchange I have changhed the answer. Sorry for my misunderstanding.
    – Sebastiano
    Oct 30, 2021 at 12:04
  • 2
    That's a great one! Thanks a lot! (+1) Oct 30, 2021 at 12:05
  • 1
    +1 for centernot: There are so many cool packages :) Oct 30, 2021 at 19:55
  • 1
    @Dr.ManuelKuehner :-) :-)....no no it is not very cool with the "Medicane" in these days in Mediterranean sea :-)
    – Sebastiano
    Oct 31, 2021 at 13:25
7

Not to hijack Sebastiano's fine answer, I'd warn you against using \vdots that way, for a few reasons:

  1. \vdots is not declared as a math relation;
  2. \vdots is too high;
  3. the bounding box of \vdots is “interesting”.

Here's a comparison of the bounding boxes of the symbol \Div I define below and \vdots:

enter image description here

Here's my proposal (but I'd use the vertical bar):

\documentclass{article}
\usepackage{amsmath,centernot,amssymb}

\makeatletter
\DeclareRobustCommand{\Div}{\mathrel{\Div@}}
\DeclareRobustCommand{\nDiv}{\mathrel{\nDiv@}}

\newcommand{\Div@}{%
  \mkern2mu\nonscript\mkern-2mu % some space in subscripts
  \mathpalette\Div@@\relax
  \mkern2mu\nonscript\mkern-2mu
}
\newcommand{\Div@@}[2]{%
  \hbox{%
    \sbox\z@{$#1T$}%
    \vbox to \ht\z@{%
      \offinterlineskip\m@th
      \hbox{$#1.$}\vfil
      \hbox{$#1.$}\vfil
      \hbox{$#1.$}%
    }%
  }%
}
\newcommand{\nDiv@}{\centernot\Div@}
\makeatother

\begin{document}

$a\Div b\quad\scriptstyle a\Div b$

$a\mid b\quad\scriptstyle a\mid b$

$a\nDiv b\quad\scriptstyle a\nDiv b$

$a\nmid b\quad\scriptstyle a\nmid b$

\end{document}

enter image description here

1
  • 1
    I thank you and all users for your exquisite kindness. Thank you very much Prof. Very nice the use of the word hijack: "dirottare" ahahaha. :-)
    – Sebastiano
    Oct 31, 2021 at 13:23

You must log in to answer this question.

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