[Tex/LaTex] How to generate a smaller \sim with respect to text

fontsizerelation-symbolssymbols

When I use \sim I get:

enter image description here

Is there a way to make the \sim sign smaller with respect to the text?

I looked online but did not find what I was looking for.

Thanks.

Best Answer

With \mathpalette trickery we can choose the smaller size.

\documentclass{article}

\newcommand{\smallsim}{\smallsym{\mathrel}{\sim}}

\makeatletter
\newcommand{\smallsym}[2]{#1{\mathpalette\make@small@sym{#2}}}
\newcommand{\make@small@sym}[2]{%
  \vcenter{\hbox{$\m@th\downgrade@style#1#2$}}%
}
\newcommand{\downgrade@style}[1]{%
  \ifx#1\displaystyle\scriptstyle\else
    \ifx#1\textstyle\scriptstyle\else
      \scriptscriptstyle
  \fi\fi
}
\makeatother

\begin{document}

exchange $\sim 60\%$ and $\sim 15\%$

exchange $\smallsim 60\%$ and $\smallsim 15\%$

\end{document}

enter image description here

I defined a generic \smallsym command in case you need other symbols to be made smaller in a similar way. For instance, with

\newcommand{\smallcirc}{\smallsym{\mathbin}{\circ}}

you get

enter image description here

from the input

$f\circ g$

$f\smallcirc g$
Related Question