2

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

Jack
  • 165

2 Answers2

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

Henri Menke
  • 109,596
2

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

Heiko Oberdiek
  • 271,626