[Tex/LaTex] How to place a \sim over \equiv similar to \simeq and \cong

amsmathmath-modemath-operatorssuperscriptssymbols

As the question states, I want a tilde over \equiv similar to \simeq and \cong commands. To be more specific, they tilde needs to be closer to the \equiv symbol.

I've tried using stackrel and DeclareMathOperator* but they place it way too high.

I've even tried to place it under empty space over \equiv as math operator as in

\DeclareMathOperator*{\eq}{\equiv}
\newcommand{\poly}{\eq^{\stackrel{\sim}{\hspace*{2em}}}}

yet still no luck.

Any suggestions? Thanks.

Best Answer

A straightforward modification of the code for \cong in fontmath.ltx

\DeclareRobustCommand
  \cong{\mathrel{\mathpalette\@vereq\sim}} % congruence sign
\def\@vereq#1#2{\lower.5\p@\vbox{\lineskiplimit\maxdimen\lineskip-.5\p@
    \ialign{$\m@th#1\hfil##\hfil$\crcr#2\crcr=\crcr}}}

Here is the new \ccong (change the name to your liking):

\documentclass{article}

\makeatletter
\DeclareRobustCommand{\ccong}{\mathrel{\mathpalette\@verequiv\sim}}
\newcommand{\@verequiv}[2]{%
  \lower.5\p@\vbox{
    \lineskiplimit\maxdimen
    \lineskip-.5\p@
    \ialign{%
      $\m@th#1\hfil##\hfil$\crcr
      #2\crcr
      \equiv\crcr
    }%
  }%
}
\makeatother

\begin{document}

$A=B\equiv C\cong D\ccong E$

\end{document}

enter image description here