[Tex/LaTex] Automatically spacing the tilde (~) symbol as a prefix number using the `siunitx` package

siunitxtilde

I'm trying to work out if there is a way to get siunitx to natively handle the ~ symbol (\sim) in the same way that it can handle the < and > operators before a number, as I would like to be able to use ~ as short hand for approximately. For example:

\documentclass[12pt,a4paper]{report}
\usepackage{siunitx}
\begin{document}

% Values output the same, with spacing after the < and before the % symbol
\SI{< 10}{\percent} \\
\SI{<10}{\percent} \\

% When writing in math mode a space in placed after the ~ symbol, but not before the % symbol
$\sim10\%$ \\

\end{document}

Ideally I'd like to be able to write something like \SI{~ 10}{\percent} or \SI{\tilde}{10}{\percent}, where {\tilde} is a custom value defined using the DeclareSIUnit\tilde{~} command. But I can't seem to find anything like this for prefix symbols in the documentation. Has anyone else come across a solution to this?

Best Answer

Using \SI{\sim 10}{\percent} should be OK; maybe you want \approx, instead.

\documentclass[12pt,a4paper]{report}
\usepackage{siunitx}
\begin{document}

\SI{< 10}{\percent}   

\SI{<10}{\percent}   

\SI{\sim 10}{\percent}

\SI{\approx 10}{\percent}

\end{document}

enter image description here