How to write the equal or not equal symbol in LaTeX?

How to write the equal or not equal symbol in LaTeX?

This post may contain affiliate links that allow us to earn a commission at no expense to you. Learn more

This article aims to show you the simplest and easiest way to write the equal or not equal symbol in LaTeX.

A very common symbol used in mathematics and computer programming, with many more uses in spelling, linguistics and chemistry. Today you will learn how to insert it in your LaTeX document.

Equal or not Equal Symbols

Either called equal sign, equality sign, or equal symbol, is primarily used in mathematics to indicate an equality in a well-defined context, let’s say for example that two things are equivalent between them. It is represented by two horizontal parallel lines that place between the values,

Equal Or Not Equal Symbol In Latex : Equality symbol
Equality symbol

Usually in math we used the equal sign in equations to denote that two things are equals. We can also call this equality, a relation between two values.

Equal Or Not Equal Symbol In Latex : Left side equals the right side
Left side equals the right side

In case the equality is false -the two things are not equivalent- we used the not equal symbol/sign, it looks like the equal sign but instead of only two horizontal lines, it has a diagonal slash between the two lines.

Equal Or Not Equal Symbol In Latex : A value represented is not equal to another one
A value represented is not equal to another one

Equal or not Equal Symbol in LaTeX

To write the equal symbol in LaTeX you don’t need any command, it is already written in your keyboard, using the “=” you get the desired symbol. Either in math mode or text mode, it works the same.

\documentclass{article}
\begin{document}
\begin{center}
    Equal symbol in text mode: 1=1 \\
    Equal symbol in math mode: $a=b$
\end{center}
\end{document}
Equal Or Not Equal Symbol In Latex : Equal symbol in text and math mode
Equal symbol in text and math mode

Note: notice the difference in spacing between math mode and text mode.

Now regarding the not equal symbol, this time we don’t have such luck. The main difference between the “not equal to” and the “equal to” symbols is the former requires math mode, the latter does not.

To write it in LaTeX we have two commands we can use, either \neq or \ne, both work fine and generate the same symbol. 

\documentclass{article}
\begin{document}
\begin{center}
    Not equal symbol \verb|\neq|: $x \neq y$ %two variables are not equal \\
    Not equal symbol \verb|\ne|: $42 \ne 41$ %two numbers are not equal
\end{center}
\end{document}
Equal Or Not Equal Symbol In Latex : Not equal commands
Not equal commands

Going the extra mile, sometimes you may need to write the equal sign but with some add on above or below the parallel lines; to do so you need to load the amssymb package. You can see the generated symbols in the following example,

\documentclass{article}
\usepackage{amssymb}
\begin{document}
    Some variations can be \\
    - A dot above: $a \doteq b$ \\
    - A triangle above: $a \triangleq b$ \\
    - A circle above: $a \circeq b$
\end{document}
Equal Or Not Equal Symbol In Latex : Variations for equality
Variations for equality

Now you have the knowledge to write these useful and super common symbols in your documents with multiple methods and options. In case you wonder whether some variation of this symbol exists, look in the amssymb documentation or on the internet, don’t be shy to ask.

I hope this post was helpful, by writing you gain more confidence and get more experience, practice makes perfect. Keep writing in LaTeX and until next time.

All images were created in LaTeX by the author.

Further Reading

LaTex Tutorial on Symbols

  1. How To Create A Cross Product Symbol In LaTeX
  2. How to create a hat symbol in LaTeX?
  3. How to create a prime symbol in LaTeX?
  4. How to create an absolute value symbol in LaTeX?
  5. How to create an approximate symbol in LaTeX?
  6. How to create an intersection symbol in LaTeX?
  7. How to create the empty set symbol in LaTeX?
  8. How to write a degree symbol in LaTeX?
  9. How to write a dot product in LaTeX?
  10. How to Write a Greater Than Symbol in LaTeX?
  11. How to write a norm symbol in LaTeX?
  12. How to write A Plus-Minus Symbol in LaTeX
  13. How to write a proportional to symbol in LaTeX?
  14. How to write a real number symbol in LaTeX?
  15. How to write a tilde symbol in LaTeX?
  16. How to write a union symbol in LaTeX?
  17. How to write a vector in LaTeX?
  18. How to write an infinity symbol in LaTeX?
  19. How to write bold text in LaTeX?
  20. How To Write Dots Symbols In LaTeX?
  21. How to write the arrow symbols in LaTeX
  22. How to write the Degree celsius symbol in LaTeX?
  23. How to write the Euro symbol in LaTeX?
  24. How to write the floor symbol in LaTeX?
  25. How to write the gradient operator symbol in LaTeX
  26. How To Write The Greater Than Or Equal To Symbol In LaTeX?
  27. How to write the integer number symbol in LaTeX?
  28. How to write the less than symbol in LaTeX?
  29. How to write the Natural numbers symbol in LaTeX?
  30. How to write the parallel symbol in LaTeX?
  31. How to write the percent symbol in LaTeX?
  32. How to write the square root symbol in LaTeX?
  33. How To Write The Symbol For A Subset In LaTeX?
  34. How to write the symbol for therefore in LaTeX?
  35. How to write with the mathbb in LaTeX?

Photo of author
Author
SJ Tsai
Chief Editor. Writer wrangler. Research guru. Three years at scijournal. Hails from a family with five PhDs. When not shaping content, creates art. Peek at the collection on Etsy. For thoughts and updates, hit up Twitter.

Leave a Comment