latex

How to Write and Use a Tilde Symbol in LaTeX

The tilde symbol in mathematics is also known as the approximate or backlash symbol, representing approximation. For example, the expression A∼B shows variable A’s equivalence relation with variable B.

Hence, the tilde symbol plays a significant role in mathematics and physics. You can write this symbol in the document producer, but it requires a correct source code. That’s why we have created this tutorial to briefly describe how to write and use the tilde symbol in LaTeX.

How to Write and Use a Tilde Symbol in LaTeX?

You can use different types of tilde symbols in LaTeX, so let’s look at these symbols one by one to get in-depth information.

1. Tilde Symbol on a Variable

In probability and statistics, we can place a tilde symbol over a variable to show the median of that variable. Here is the basic source code to use a tilde symbol:

\documentclass{article}
\begin{document}
$\tilde{D}$
$\tilde{A}$
$\tilde{B}$
\end{document}

Output:

If you use $\tilde{}$ in multiple variables, you will get the following result:

So please use the $\widetilde$ rather than $\tilde{}$ to cover all variables:

\documentclass{article}
\begin{document}
$$\widetilde{DAB}$$
\end{document}

Output:

2. Tilde Symbol Below a Variable

You can use the tilde symbol below a variable or a number to represent the vector quantity. To place a tilde symbol under a variable, please use the below source code and the accents \usepackage:

\documentclass{article}
\usepackage{accents}
\begin{document}
$$\underaccent{\tilde}{D}$$
$$\underaccent{\tilde}{A}$$
$$\underaccent{\tilde}{B}$$
\end{document}

Output

3. Tilde Symbol Between Variables

Multiple source codes exist to write and use a tilde symbol between two variables in LaTeX. First, let’s use the \sim source code to get the following result:

\documentclass{article}
\begin{document}
$ A \sim D$
\end{document}

Output:

Similarly, you can use the amssymb \usepackage with \thicksim instead of \sim source code to get a thicker tilde symbol:

\documentclass{article}
\usepackage{amssymb}
\begin{document}
$ A \thicksim D$
\end{document}

Output

You can also use the \approx source code to get the double tilde symbol in LaTeX:

\documentclass{article}
\begin{document}
$ A \approx D$
\end{document}

Output:

Now let’s use the \thickapprox to get a thicker double tilde symbol:

\documentclass{article}
\usepackage{amssymb}
\begin{document}
$ A \thickapprox D$
\end{document}

Output

Conclusion

This was the complete way to write and use a tilde symbol in LaTeX. We have explained the various types of tilde symbols and their importance in any expression. Please make sure to use these tilde symbols accordingly because the wrong symbol can change the meaning of the complete expression.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.