How to write a tilde symbol in LaTeX

How to write a tilde 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 a simple way to create a tilde symbol in LaTeX.

Whether you are writing an article or document about mathematics, or an essay (depending on the language you are writing it), you will need the tilde symbol, it is pretty common in some languages and in some areas in mathematics.

Today you will learn how to insert the tilde in your documents, independently of the context.

Tilde Symbol

The tilde is used every single day in some languages, for example in Spanish some words have a tilde, and in Portuguese some words have tildes, sometimes above or below the letters. 

Another purpose for the tilde is in mathematics, either in algebra, geometry or set theory. But, what is a tilde? And a tilde is just

Tilde symbol

Write Tilde in LaTeX

LaTeX has two main built-in options to generate the tilde. The first one is with the command \~{}, it takes one value as an argument (a letter), it is important to notice that this is principally used for spanish and portuguese, the command works in text mode. 

The following commands can be used: 

\documentclass{article}
\begin{document}
el peque\~{n}o ni\~{n}o es cari\~{n}oso \\
irm\~{a} (sister), avi\~{a}o (plane)
\end{document}
\~{} output

As you can see, Spanish is always used with the “n”, in Portuguese depending on the word the tilde can be in other vowels. 

The other option is with the command \tilde{}, it takes one value as argument Compared to the first method, this one is only allow in math mode, for example

\documentclass{article}
\begin{document}
ara$\tilde{n}$a en su telara$\tilde{n}$a\\
opini$\tilde{o}$es (opinions), capit$\tilde{a}$es (captains)

\end{document}
Command \tilde{} in math mode

The downside of this method is the fact that you will get the letter inside the command, in math mode font. 

As a plu if maybe you need for some reason a wider tilde you can use the \widetilde{} command, it generates a wide tilde. For example

\documentclass{article}
\begin{document}
$$ \widetilde{abc} $$
\end{document}
wide tilde command output

Both methods are limited to letters, but there is one method available to write the tilde when referring to mathematics.

Tilde in Math Mode

The tilde in math has many variations, either alone or together with another symbol, so depending on which one you will need you have to define it luckily all of them are built-in in LaTeX. 

The principal command is \sim for the plain ~ symbol, it does require the math mode. The most populars symbols with tilde are presented in the example. 

\documentclass{article}
\begin{document}
    $$\pi \sim 3.14$$
    $$\theta \simeq 90$$
    $$\tau \approx \pi$$
    $$x \backsim y$$
    $$A \approxeq B$$
\end{document}
Multiple variations of tilde LaTex symbols command in math latex code

There could be LaTeX packages that can also have more options regarding the tilde symbol. But it’s is up to you to decide if you want to use the built-in commands or external resources for specific code, font, or character in latex math mode. 

LaTex, like math, allows for multiple answers rather than just one right answer. 

Now you know the basics of the tilde symbol in the LaTeX document.

I hope this post helps your research effort, and as always keep writing in LaTeX.

Not the answer you’re looking for? Check out our LaTex Tutorial for the other answers. 

FAQ

Q1. How does one insert a “\” (backslash) into the text of a LaTeX document?

According to tex.stackexchange.com, the following solution is considered the best. 

A backslash is produced in text-mode by /textbackslash. Math-mode $/sim$ and /texttildelow (from the textcomp package) are options for producing a lower tilde (while /*{} and /textasciitilde produce a raised tilde in text-mode).

It is important that you familiarize yourself with the Comprehensive LaTeX Symbol List. Although the link seems to keep changing, the command texdoc symbols-a4 will display the local copy if you have a complete TeX Live installation.

\textbackslash and \textasciitilde are found in several places in the document, but the LaTeX 2e ASCII Table (Table 529 as of this writing) and the following discussion are convenient resources for all ASCII characters. 


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 union symbol in LaTeX?
  16. How to write a vector in LaTeX?
  17. How to write an infinity symbol in LaTeX?
  18. How to write bold text in LaTeX?
  19. How To Write Dots Symbols In LaTeX?
  20. How to write the arrow symbols in LaTeX
  21. How to write the Degree celsius symbol in LaTeX?
  22. How to write the equal or not equal 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