How to Insert a Tilde Symbol (~) in LaTeX

We can insert a tilde (sometimes called “twiddle”) in a LaTeX document by using \sim where sim refers to similar. When we would like to insert a tilde symbol on top of character(s), we can use \tilde{} instead.


Example




\documentclass{article}
\begin{document}
The model contains $\sim3M$ parameters. 
$\tilde{x}$ refers to the parameter of xxx.
\end{document}