I have some code in which I write this: $\sim_r$. I want to use this command as a binary operator (in the same way as $\sim$ is normally used, but with a subscript).
I would like to create a custom command so that the subscript r appears immediately under the tilde, rather than to the right. I have tried this:
\newcommand{\stb}[1]{{\genfrac{}{}{-2pt}{}{\sim}{#1}}}
but it looks bad because there is too large a gap between the tilde and the r. Does anyone have an easy fix?
Sorry if this is too easy a question!


$\underset{r}{\sim}$? – Sigur Jan 20 '20 at 14:36$\widetilde{r}$– TivV Jan 20 '20 at 14:39\simshould be aligned asa\sim b, right? – Sigur Jan 20 '20 at 15:33lipsumand try this piece:\lipsum[1] $a\sim b\underset{r}{\sim} p$ \lipsum*. You'll see that it is pretty. – Sigur Jan 20 '20 at 15:43