0

I want to create an "approximately follows distribution" symbol. It should be a \sim with one dot above and one below.

I have tried using \underset and \overset, but I cannot get the dots to be the same distance above and below \sim.

Thanks,

Jack

4
3
\documentclass{article}

\makeatletter
\newcommand\approxsim{\mathpalette\@approxsim\relax}
\newcommand\@approxsim[2]{%
  \mathrel{%
    \ooalign{%
      $\m@th#1\sim$\cr
      \hidewidth$\m@th#1:$\hidewidth\cr
    }%
  }%
}
\makeatother

\begin{document}

$a \approxsim b_{a \approxsim b_{a \approxsim b}}$

\end{document}

enter image description here

This is maybe a bit nicer.

\documentclass{article}

\makeatletter
\newcommand\approxsim{\mathchoice
  {\@approxsim {\displaystyle}      {1ex} }
  {\@approxsim {\textstyle}         {1ex} }
  {\@approxsim {\scriptstyle}       {.7ex}}
  {\@approxsim {\scriptscriptstyle} {.5ex}}}
\newcommand\@approxsim[2]{%
  \mathrel{%
    \ooalign{%
      $\m@th#1\sim$\cr
      \hidewidth$\m@th#1.$\hidewidth\cr
      \hidewidth\raise #2 \hbox{$\m@th#1.$}\hidewidth\cr
    }%
  }%
}
\makeatother

\begin{document}

$a \approxsim b_{a \approxsim b_{a \approxsim b}}$

\end{document}

enter image description here

2
  • Thank you very much for this, although is there any way to get the top dot a little higher? – Jack Mar 23 '18 at 10:17
  • In the first version you could raise the colon a bit by using \mathop:. – campa Mar 23 '18 at 10:24
3

Symbol

The Unicode code point is probably U+2A6B (tilde operator with rising dots).

LuaTeX/XeTeX

If LuaTeX or XeTeX is used, the symbol is available in Asana Math and XITS math. Package unicode-math used the command sequence \rsimdots. Also, the character can be used directly or as ^-escape: ^^^^2a6b.

\documentclass{article}
\usepackage{fontspec}
\begin{document}
  \def\test#1{\fontspec{#1}^^^^2a6b&#1\\}
  \begin{tabular}{ll}
    \test{Asana Math}
    \test{XITS Math}
  \end{tabular}
\end{document}

Result

pdfTeX

A "poor man's" symbol constructed from \sim and two \cdots. The colon is not vertically centered, thus the position of the dots are not well defined.

See the code comments for the fine tuning:

  • The distance from the dots can be configured in the setting of \dimen@.
  • The rotation angle is given to \rotatebox. If rotation is not wanted, this line can be removed.

Full example:

\documentclass{article}
\usepackage{graphicx}

\makeatletter
\newcommand*{\rsimdots}{%
  \mathrel{%
    \mathpalette\@rsimdots{}% Adopt to math style size via \mathpalette
  }%
}
\newcommand*{\@rsimdots}[2]{%
  % #1: math style
  % #2: unused
  \sbox0{$#1\sim\m@th$}%
  \sbox2{$#1\vcenter{}$}% \ht2 is height of the math axis
  \dimen@=.75\ht2\relax % distance dot to math axis
  \sbox2{$#1\cdot\m@th$}% single vertically centered dot
  \sbox2{% two dots above and below the math axis
    \rlap{\raisebox{\dimen@}{\copy2}}%
    \raisebox{-\dimen@}{\copy2}%
  }%
  % Rotate the two dots.
  \sbox2{$#1\rotatebox[origin=c]{-45}{\copy2}$}%
  % Combine symbol
  \rlap{\hbox to \wd0{\hss\copy2\hss}}%
  \copy0 %
}
\makeatother

\begin{document}
\[
  A\rsimdots B,
  \scriptstyle A\rsimdots B,
  \scriptscriptstyle A\rsimdots B
\]
\end{document}

Result pdfTeX

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.