LatexNotes

Tilde (x̃ and ∼) in LaTeX

\tilde{x} sets a tilde accent over a letter, x̃; for the tilde as a relation, ∼, meaning 'similar to' or 'distributed as', use \sim.

LaTeX command

\tilde{x}

Not the symbol you meant? Draw it to find the command →

Typing up handwritten notes? Convert a whole page of handwriting to LaTeX →

\tilde is sized for a single letter. Over two or more letters it stays small and sits over the middle, so use \widetilde{xy} instead, which stretches to cover a group a few characters wide. Hats work the same way, with \hat and \widehat.

\sim is a relation, so LaTeX puts relation spacing around it: for a random variable's distribution, for asymptotic equivalence, and for an equivalence relation. Its neighbours are \simeq (≃), \approx (≈) and \cong (≅).

In ordinary text a typed ~ is not printed at all: LaTeX reads it as a space that cannot break, as in Figure~1. To print the character, write \textasciitilde, or \~{} for a small raised tilde. For web addresses, \url from the url or hyperref package prints a ~ correctly.

A tilde character in text

Because ~ means a non-breaking space, text that needs the character itself takes a command. \textasciitilde prints the full tilde at text height; inside a web address, let \url handle it.

\textasciitilde
\url{https://example.com/~name}

Other forms

\widetilde{xy}a wide tilde over several letters
\simthe tilde relation (∼): similar to, distributed as
\textasciitildea tilde character in text

Examples

$\tilde{x}$

x tilde, a single-letter accent

$\widetilde{AB}$

a wide tilde over two letters

$\tilde{\theta} = \theta + \varepsilon$

a perturbed parameter

$X \sim N(\mu, \sigma^2)$

X follows a normal distribution

$n! \sim \sqrt{2\pi n}\left(\frac{n}{e}\right)^n$

Stirling's formula, an asymptotic equivalence

$\tilde{\imath}$

a tilde on a dotless i

Tips and common mistakes

Working from handwritten notes?

LatexNotes turns a photo or PDF of handwritten mathematics into LaTeX, graphs and all. It is built with real pdflatex before you see it, and the .tex file is yours to edit or take to Overleaf. Free to try, no sign-up.

See how handwriting to LaTeX works, step by step, or go from GoodNotes to LaTeX if you write on an iPad (Notability works the same way).

Convert your maths to LaTeX →

FAQ

How do I put a tilde over a letter in LaTeX?

Use \tilde{x} in maths mode. For more than one letter use \widetilde{xy}, which stretches.

How do I type the tilde symbol ∼ in LaTeX?

Use \sim in maths mode, for example (0, 1). It is spaced as a relation.

Why does ~ not show up in my text?

LaTeX treats ~ as a non-breaking space. Write \textasciitilde to print a tilde, or use \url for web addresses.

What is the difference between \sim and \approx?

\sim (∼) means similar to, distributed as or asymptotically equal; \approx (≈) means approximately equal in value.

See also