divides, not divides and cardinalities

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.)

2 Answers

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}


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}


• That was very helpful indeed! Thanks a lot, also for giving the link to the short course on \ooalign. I hope this also will help to solve the remaining problem of using it as a subscript (where with the above suggestion the bar remains long). I have not yet studied it carefully enough. – Hartmut Laue May 31 '13 at 17:29
• @HartmutLaue Not easy, because \big can't be reliably used in subscripts. But here it is. – egreg May 31 '13 at 17:57
• Thank you for your \big help!! I was not online for some hours and now feel most grateful, seeing what you have done for me. I'd never had found such a solution so quickly - if at all. I tried it immediately, and it works perfectly. No wonder that nobody I knew had a solution as it wants a real LaTeX expert! It surprises me that this is so much beyond the usual LaTeX repertoire because it is that common in math texts. I'll forward your solution... – Hartmut Laue May 31 '13 at 20:22
• Wow. Very helpful. It seems to me that there's a lot of space around both symbols in the regular use, but the space compacts in the subscript (more than just the resizing of the subscript). Why is this? I like the tighter look, but I'm not sure how to tweak the regular usage without causing a change to the subscript usage. – Travis Bemrose Sep 18 '15 at 10:40
• @TravisBemrose In “normal size” there's the usual space around relations, which is removed in subscripts by general TeX rule. The “tighter look” in normal size is bad, in my opinion. If you really want to inflict it to your reader, just remove \mathrel (and nothing else) from the main definitions. – egreg Sep 18 '15 at 10:43

The mathabx package actually provides a \divides and \notdivides command, so a crude method is just to add \usepackage{mathabx} in your preamble and use those commands. It looks like this:

Nothing fancy, just $|G| \divides |H|$ and $|G| \notdivides |K|$. The division bars are slightly shorter and thinner, and I generally think they stand out enough to be distinguishable. So that works, sort of.

However, mathabx has its own style for a bunch of other symbols. This is what x \in Y looks like, for example:

If you don’t want to change lots of symbols, then you can tell LaTeX to only load certain symbols from the mathabx package. Adding the following to your preamble:

\DeclareMathSymbol{\notdivides}{3}{matha}{"1F}
\DeclareMathSymbol{\divides}{3}{matha}{"17}


but not loading the mathabx package will still get you the commands I used to typeset the first image, but no other symbols will be changed. (I didn’t discover this solution independently; I read it on a different forum many years ago and added it to my template.)

That’s the method I use, and it’s worked pretty well for me.

• Adding only the two lines that you suggest to my preamble results in ! LaTeX Error: Symbol font matha' is not defined.` What am I missing? – Scott Emmons Mar 26 '16 at 22:57
• On macs this can be installed via macports very easily without having to spelunk through your directory system. – ncmathsadist Feb 4 '17 at 15:17
• Once installed, it worked perfectly and it gives you lots of other fonts, including blackboard fonts. – ncmathsadist Feb 4 '17 at 23:31