18

Often in physics, the symbol \sim is used as a unary operator to mean "approximately."

For example, one might say "the energy of these processes is $\sim 4$ eV." However, this looks awkward because \sim is a binary operator and the spacing is incorrect. How can one use \sim act as a unary operator?

5
  • 7
    ${\sim}4$ or $\mathord{\sim}4$ Commented Oct 25, 2012 at 21:31
  • 3
    \sim is a relation symbol, rather than a binary operation; if it were then $\sim 4$ would give no space. It's probably better to define a new command for it as an "Ord": \newcommand{\appx}{{\sim}}. Consider using siunitx for typesetting units of measure. Commented Oct 25, 2012 at 21:34
  • This question is a duplicate of tex.stackexchange.com/q/55701 Commented Oct 26, 2012 at 5:30
  • Related: How does one insert a backslash or a tilde (~) into LaTeX? Commented May 29, 2013 at 15:11
  • I had exactly the same question. Now that I understand the nice answer below, my question is, how does the unary minus not need a separate command? If we give the same treatment to the \sim symbol as the minus symbol, that would automatically solve the OP's question. Commented Jul 16, 2023 at 7:35

1 Answer 1

12

Just define a new command for it:

\newcommand{\ca}{{\sim}} 

I suggest also to use siunitx, if you have units of measure to typeset in your document: it ensures uniform setting.

\documentclass{article} \newcommand{\ca}{{\sim}} \usepackage{siunitx} \sisetup{input-protect-tokens=\ca,input-symbols=\ca} \begin{document} \SI{\ca 4}{eV} $\ca 4$\,eV \end{document} 

The input might seem more difficult, but it's surely rewarding.

enter image description here

If you load amssymb you can change the definition to

\usepackage{amssymb} \newcommand{\ca}{{\thicksim}} 

and the result would be

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.