39

The symbol for modularly congruent is ≡, which can be produced with \equiv.

For instance,

18 ≡ 0 (mod 9)

What is the symbol for not modularly congruent, and how do I represent it in TeX?

I have perused some references including http://web.ift.uib.no/Teori/KURS/WRK/TeX/symALL.html and have not found it.

  • 6
    Is there something wrong with \not\equiv? – Alan Munn Jan 30 '12 at 3:07
  • That looks right. Thank you! In general, does \not negate the following operation? – David Faux Jan 30 '12 at 3:12
  • 1
    Yes, \not is defined zero width relation character in TeX so it will always be on top of the following character. – Alan Munn Jan 30 '12 at 3:22
45

Negation of symbols in LaTeX is typically achieved prepending it with \not. For example

Negating symbols

\documentclass{article}
\begin{document}
$18 \equiv 0\ (\textrm{mod}\ 9) \not\equiv 2\ (\textrm{mod}\ 9)$
\end{document}

For more elaborate, larger or lengthy symbols, you can use the cancel package. In those instances \not may not provide a sufficiently-centred negation. The centernot package also provides a centred \not for symbols with larger horizontal dimension.

The ≢ character is in Unicode as U+2262, and can be entered directly with unicode-math. The command for it is \nequiv in many packages, including unicode-math, pxfonts, txfonts, newpxmath, newtxmath, stix, stix2, mnsymbol and fdsymbol.

Other symbol-lookup techniques are described in How to look up a symbol or identify a math symbol or character?

  • There's also the centernot package, which provides a \centernot command that measures its argument and centres the not correctly. – Alan Munn Jan 30 '12 at 3:39
  • 7
    Also instead of writing (\textrm{mod}\ 9), you can just write \pmod{9}. – Daniel Kats Jan 19 '14 at 4:12
  • @BlackSheep Thanks! It was annoying me that \mod creates a wide space to the left (presumably meant for when you're not using the brackets) and I found myself having to use \textrm{mod} as a workaround. So \pmod is what I was looking for! – Stewart Jan 8 at 22:43
  • @Stewart: \pmod leaves a wide space, not \textrm{mod}. – Werner Jan 9 at 0:30
  • @Werner I didn't say \textrm{mod} leaves a wide space - I said \mod does. – Stewart May 10 at 15:55
5

Here is an alternative, late answer using https://ctan.org/pkg/unicode-math, hence it requires LuaLaTeX or XeLaTeX. The example uses various modulo macros of the package amsmath.

\documentclass{memoir}
\usepackage{fontspec,amsmath,unicode-math}

\begin{document}
Here's to you, Donald and Leslie; 
\begin{align*}
    18 &\equiv 0 \bmod 9, \\
    18 &\nequiv 1 \mod 9, \\
    18 &\equiv 0 \pmod 9, \\
    18 &\nequiv 1 \pod 9.
\end{align*}
\end{document}

enter image description here

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.