I’m going to go back in time a bit to answer this question:1
why is the character ~ not available without crazy vertical tweaking? ~ is just like other characters on the keyboard, right?
The answer is — no. The tilde is not like other characters on the keyboard. And the reason for this is that the tilde doesn’t “exist” in conventional typography. To understand this, we need a bit of history, and luckily Wikipedia obliges.
Briefly, while the tilde character has been a staple of typewriting since the middle ages, it was always used as a combining character, rarely on its own. Its meaning also changes through the ages, and in the early 20th century the only real uses of the tilde seem to have been:
- As a combining character in Spanish (ñ) and other languages (e.g. Portuguese ã, õ).
- In mathematics, to denote “approximately”.
But a sentence such as the one you apparently want to typeset (“~ nari ~ nari”) has no conventional meaning (case in point, not many people here seem to know what the tilde denotes here); it’s a made-up character, same as the ones in a CollegeHumour post (this isn’t a problem, of course; it just means that TeX didn’t anticipate this usage).
So there we have it: the tilde, as a separate character, doesn’t occur in conventional typesetting so there’s no reason to provide it. Consequently, Knuth opted to use the available keyboard key for something else (protected space).
… Which leads us to the question: why is the tilde key on the keyboard at all? And the answer, once again, is given by Wikipedia:
On mechanical typewriters, Spanish keyboards … had a dead key, which contained the acute accent (´), used over any vowel, and the dieresis (¨), used only over u. It was a simple matter to create a dead key for a Portuguese keyboard (created later than the Spanish one) … and so the ~ was born as a typographical character, which did not exist previously as a type or hot-lead printing character.
— On mechanical typewriters, the tilde was added purely as a combining character. When computer keyboards came along, they took over the typewriter layout and that’s why we’re settled with the tilde. In time, people found other uses for this character (especially in computer programming and as a character in paths/URLs). But yet, these were special uses and there was never a need for TeX to support this out of the box. Rather, you can use the various packages (e.g.
url) to typeset e.g. paths correctly. Similarly, when using the tilde in the context of mathematics, you can simply use the math-mode command
But in normal text mode, typesetting a tilde becomes a challenge because different types of fonts handle the character differently (and using
\(\sim\) usually looks ugly). A comprehensive overview of different ways to typeset the character are provided in a separate question.
In a nutshell, modern (OTF/TTF) fonts contain the expected glyph for tilde, so it can be accessed via
\char`~. Better yet,
\textasciitilde produces the same character and will also work on other font encodings. Still other fonts may require more elaborate workarounds, which are provided by commands such as
1 Other people have already answered this in parts but I’m missing a complete overview.