17

What is the correct way, both semantically and typographically, to typeset ab and ab (read “a divides b” and ”a does not divide b”)?

I guess I could simply type | (vertical bar, U+007C) or \vert for one and a combination of that with \not for the other. But I seem to recall that the default interpretation of that was something other then a binary relation.

There are unicode symbols U+2223 and U+2224 (which I also used in the title of this question), so some fonts might even ship precomposed characters. And semantically it seems “more correct” to somehow refer to this meaning, even if nobody will be able to tell the difference. Perhaps a screen reader or some other accessibility thingy might make use of it. On the other hand, since I'm mainly using pdflatex and not xetex or luatex, unicode probably isn't that important for me in practice. Using unicode to enter math appears to be a non-trivial task for pdflatex.

From this question I learned that there is a command called \divides somewhere out there, which apparently has binop spacing, but according to the comprehensive latex symbol list, it comes from mathabx, and even though there are guides on how to import individual symbols from that package, there are other voices indicating some kind of resource shortage related to this. And I'm unsure whether importing symbols will also import correct spacing for them. So I don't feel particularly at home with this approach either.

It might be that the solution I'll eventually take is already among those outlined above. But I don't know which. So if you find one of these solutions appropriate, feel free to post it as an answer, indicating why you consider it superior. That way, others can vote and I'll get second opinions which will hopefully help me choose among them. If you have another solution I haven't mentioned yet, that's even better.

23

Usually \mid is used for the "is a divisor of" relation. It's just a vertical bar, but declared a relation symbol.

For the negation, \nmid from amssymb is better than \not\mid that doesn't give a good result.

It is surely a good defining semantically sound names, for instance

\usepackage{amssymb}
\newcommand{\divides}{\mid}
\newcommand{\notdivides}{\nmid}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.