[Tex/LaTex] Why is tilde not available out of the box in TeX

tilde

Today I need to type ~ in my document, but apparently it does not get rendered properly. I just got a blank space. I searched on the web and I found the same problem here. However, its solutions show me that tilde (~) seems to be a special crazy character that is not available out of the box in TeX world. Adjusting the vertical alignment of tilde seems to be one of the craziest ones.

Considering ~ is a character that is available on the normal keyboard, it should be available out of the box. But it is apparently not.
I am wondering why it is not available. What is the reason?

Edit

I need a simple macro that can render ~ as we can see in this sentence. This simple ~ should be available without any crazy adjustment. I don't understand why vertical adjustment is needed for ~ but not for other characters like a, b, c, d, e, f, …, z, 1, 2, …, 0?

Put simply, why is the character ~ not available without crazy vertical tweaking? ~ is just like other characters on the keyboard, right?

Best Answer

The command you are looking for is \textasciitilde (looks better with

\usepackage[T1]{fontenc}

than the default OT1 encoding, which doesn't include a tilde so uses the accent over an empty base)

But the basic premise of your question seems flawed, all programming languages use some of the "easily accessible" keyboard characters as control constructs. ~ makes a non breakable space so doesn't directly make a ~ just as \ and { and } are used for specific syntax constructs for Tex and do not directly typeset the corresponding character.