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,
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.
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
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}
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}
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}
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
- How To Create A Cross Product Symbol In LaTeX
- How to create a hat symbol in LaTeX?
- How to create a prime symbol in LaTeX?
- How to create an absolute value symbol in LaTeX?
- How to create an approximate symbol in LaTeX?
- How to create an intersection symbol in LaTeX?
- How to create the empty set symbol in LaTeX?
- How to write a degree symbol in LaTeX?
- How to write a dot product in LaTeX?
- How to Write a Greater Than Symbol in LaTeX?
- How to write a norm symbol in LaTeX?
- How to write A Plus-Minus Symbol in LaTeX
- How to write a proportional to symbol in LaTeX?
- How to write a real number symbol in LaTeX?
- How to write a tilde symbol in LaTeX?
- How to write a union symbol in LaTeX?
- How to write a vector in LaTeX?
- How to write an infinity symbol in LaTeX?
- How to write bold text in LaTeX?
- How To Write Dots Symbols In LaTeX?
- How to write the arrow symbols in LaTeX
- How to write the Degree celsius symbol in LaTeX?
- How to write the Euro symbol in LaTeX?
- How to write the floor symbol in LaTeX?
- How to write the gradient operator symbol in LaTeX
- How To Write The Greater Than Or Equal To Symbol In LaTeX?
- How to write the integer number symbol in LaTeX?
- How to write the less than symbol in LaTeX?
- How to write the Natural numbers symbol in LaTeX?
- How to write the parallel symbol in LaTeX?
- How to write the percent symbol in LaTeX?
- How to write the square root symbol in LaTeX?
- How To Write The Symbol For A Subset In LaTeX?
- How to write the symbol for therefore in LaTeX?
- How to write with the mathbb in LaTeX?