[Tex/LaTex] divides, not divides and cardinalities

delimitersmath-moderelation-symbolssymbols

In group theory it happens very often that you want to say: "The order of $H$ divides / does not divide the order of $G$." But the length of | is then always the same:

$ |H| | |G| $ produces |H|||G|

which is not ideal at all. (The negation \nmid has just this length too.) The length of "divides" should be longer than the "cardinality length". I could use

$ |H| \big| |G|$

but then there is no good way to say "does not divide" with the same length.
Also, \big| is no solution when the expression has to be used in subscripts.

I thought it was just me, but I asked other group theorists, and nobody had a solution. I hope there is one.

I am seeking a division sign which is a little longer than the usual | , allows negation (with the same length) and proportionally correct use in subscripts (also under \sum etc.). It does not look professional if the "order sign" has the same length as the "divides" sign. (And what about combinations with absolute values, norms – although personally I don't use them as often as group orders.)

Best Answer

You should use \bigm| to make a relation symbol, so that the three consecutive bars are distinguishable from each other. If you want to make them slightly bigger, here's a way:

\documentclass{article}
\usepackage{amssymb}
\newcommand{\divides}{\bigm|}
\newcommand{\ndivides}{%
  \mathrel{\mkern.5mu % small adjustment
    % superimpose \nmid to \big|
    \ooalign{\hidewidth$\big|$\hidewidth\cr$\nmid$\cr}%
  }%
}

\begin{document}
$|H|\divides |G|$

$|H|\ndivides |G|$
\end{document}

enter image description here

See https://tex.stackexchange.com/a/22375/4427 for a short course on \ooalign.


Extended version working also in subscripts

\documentclass{article}
\usepackage{amssymb}

\makeatletter
\def\localbig#1#2{%
  \sbox\z@{$\m@th#1
    \sbox\tw@{$#1()$}%
    \dimen@=\ht\tw@\advance\dimen@\dp\tw@
    \nulldelimiterspace\z@\left#2\vcenter to1.2\dimen@{}\right.
  $}\box\z@}

\newcommand{\divides}{\mathrel{\mathpalette\dividesaux\relax}}
\newcommand{\ndivides}{\mathrel{\mathpalette\ndividesaux\relax}}

\newcommand{\dividesaux}[2]{\mbox{$\m@th#1\localbig{#1}|$}}
\newcommand{\ndividesaux}[2]{%
  \mkern.5mu
  \ooalign{%
    \hidewidth$\m@th#1\localbig{#1}|$\hidewidth\cr
    $\m@th#1\nmid$\cr%
  }%
}
\makeatother

\begin{document}
$|H|\divides |G|$

$|H|\ndivides |G|$

$\displaystyle\sum_{k\ndivides |G|}k^2$

$\displaystyle\sum_{k\divides |G|}k^2$
\end{document}

enter image description here