# How to print "~" in order to put text above it

How do I put text over symbols? gives some very good answers to placing text above a symbol (=), which works for many other symbols which as +, @ etc. However none of the solutions work for ~, I had to resort to \sim (see picture) to get the desired result.

Why do these not work?

\newcommand\myeq{\stackrel{\mathclap{\normalfont\mbox{s}}}{~}}

$\Lambda \stackrel{s}{~} A$

(Again, replacing ~ with \sim worked.)

MWE

 \documentclass[12pt,a4paper]{article}
%\usepackage[fleqn]{amsmath}
\usepackage{mathtools}
\newcommand\myeq{\stackrel{\mathclap{\normalfont\mbox{s}}}{~}}
% \newcommand\myeq{\stackrel{\mathclap{\normalfont\mbox{s}}}{\sim}}

\begin{document}
$\Lambda \stackrel{s}{~} A$

$\Lambda \stackrel{s}{\sim} A$

$\Lambda \myeq A$
\end{document}


• ~ is a special character in TeX System, an active character which usually represents non-breakable space. I does not print the symbol "~". The corect tilde symbol is printed with \sim. Apr 15 '17 at 15:34
• @Moriambar Ah! thx. If you put that line as an answer, I'd be happy to accept it. Apr 15 '17 at 15:35
• Done as you wished Apr 15 '17 at 15:38

~ is a special character in TeX System, an active character which usually represents non-breakable space. I does not print the symbol "~". The corect tilde symbol is printed with \sim.