2

How to create a dashed equality symbol as follows?

enter image description here

Also, make sure that, it

  • be effected by \not the same as =,
  • and act the same as = in other ways.

By the way, it's not necessary that there must be three gaps in =.

M. Logic
  • 4,214

2 Answers2

6

You can make your own symbol using the techniques from this post. Here is a version using \ooalign to superimpose two white rules on an = symbol to make the dash pattern. You can adjust the spacing and thickness of the gaps to your liking by changing the arguments in \hspace and \rule. Note that if your page color is not white you'll have to change the color of the rules.

enter image description here

\documentclass{article}

\usepackage{color} %for \textcolor

\newcommand{\eqeqeq}{\mathrel{\ooalign{=\cr\hfil\textcolor{white}{\rule[.28ex]{.1em}{.6ex}\hspace{.2em}\rule[.28ex]{.1em}{.6ex}}\hfil\cr}}}

\begin{document}

$A\eqeqeq B$

$A\not\eqeqeq B$

$A=B$

$A\ne B$

\end{document}

If you need the symbol in \scriptstyle or \scriptscriptstyle, you can use \mathchoice:

\newcommand{\eqeqeq}{\mathrel{
   \mathchoice
     {\ooalign{=\cr\hfil\textcolor{white}{\rule[.28ex]{.1em}{.6ex}\hspace{.2em}\rule[.28ex]{.1em}{.6ex}}\hfil\cr}}
     {\ooalign{=\cr\hfil\textcolor{white}{\rule[.28ex]{.1em}{.6ex}\hspace{.2em}\rule[.28ex]{.1em}{.6ex}}\hfil\cr}}
     {\ooalign{$\scriptstyle{=}$\cr\hfil\textcolor{white}{\rule[.17ex]{.08em}{.47ex}\hspace{.18em}\rule[.17ex]{.08em}{.47ex}}\hfil\cr}}
     {\ooalign{$\scriptscriptstyle{=}$\cr\hfil\textcolor{white}{\rule[.1ex]{.06em}{.38ex}\hspace{.17em}\rule[.1ex]{.06em}{.38ex}}\hfil\cr}}
}}

enter image description here

Again, you can adjust the spacing and thickness of the gaps however you like.

Sandy G
  • 42,558
  • Could you give an improvement to make it adjust to scriptsize? – M. Logic Aug 08 '21 at 16:07
  • @M.Logic, I updated my response. – Sandy G Aug 08 '21 at 18:43
  • Oops! It looks like the value of em is stuck at \normalsize. It might be possible to salvage this by explicitly specifying the desired size for each stage. (This should probably be investigated directly at the level of \mathchoice, but that's digging deeper than I feel comfortable doing.) – barbara beeton Aug 08 '21 at 23:27
  • @Sandy G When we use huge fontsize over such symbol, the white line will cover parts of the \not line. – M. Logic Aug 09 '21 at 06:02
  • @M.Logic, I posted a different solution that resolves the fontsize issue. – Sandy G Aug 09 '21 at 17:46
4

Here is a different solution using the trimclip package. This works with all sizes (large, Huge, etc.) as well as scriptstyle and scriptscriptstyle.

enter image description here

Instead of overlaying white onto an = sign, we clip portions of the = sign and replace with whitespace. I selected the left, middle and right 1/4 of the = sign indicated in the code as .25\weq (left quarter) followed by an eighth space (.125\weq) followed by the middle quarter (.375\weq to .625\weq), etc. You can adjust the spacing however you wish, or subdivide the = even more.

Update

Here are two additional versions where the clipping only affects one of the lines. Instead of inserting space between the segments, a clipped = symbol is inserted. When the bottom portion is clipped (\eqeqeqb) the baseline changes so a \raisebox command is used.

enter image description here

\documentclass{article}

\usepackage{trimclip}

\newlength{\weq} \newlength{\heq}

\makeatletter \newcommand{\eqeqeq}{\mathrel{\mathpalette\eq@eq\relax}} \newcommand{\eq@eq}[2]{\settowidth{\weq}{$\m@th#1=$}% \clipbox{0pt 0pt {.25\weq} \height}{$\m@th#1=$}% \hspace{.125\weq}% \clipbox{{.375\weq} 0pt {.625\weq} \height}{$\m@th#1=$}% \hspace{.125\weq}% \clipbox{{.75\weq} 0pt {\weq} \height}{$\m@th#1=$}% } \newcommand{\eqeqeqt}{\mathrel{\mathpalette\eq@eqt\relax}} \newcommand{\eq@eqt}[2]{\settowidth{\weq}{$\m@th#1=$}% \clipbox{0pt 0pt {.25\weq} \height}{$\m@th#1=$}% \clipbox{{.25\weq} 0pt {.375\weq} {.5\height}}{$\m@th#1=$}% \clipbox{{.375\weq} 0pt {.625\weq} \height}{$\m@th#1=$}% \clipbox{{.625\weq} 0pt {.75\weq} {.5\height}}{$\m@th#1=$}% \clipbox{{.75\weq} 0pt {\weq} \height}{$\m@th#1=$}% } \newcommand{\eqeqeqb}{\mathrel{\mathpalette\eq@eqb\relax}} \newcommand{\eq@eqb}[2]{\settowidth{\weq}{$\m@th#1=$}\settoheight{\heq}{$\m@th#1=$}% \clipbox{0pt 0pt {.25\weq} \height}{$\m@th#1=$}% \raisebox{.5\heq}{\clipbox{{.25\weq} {.5\height} {.375\weq} {\height}}{$\m@th#1=$}}% \clipbox{{.375\weq} 0pt {.625\weq} \height}{$\m@th#1=$}% \raisebox{.5\heq}{\clipbox{{.625\weq} {.5\height} {.75\weq} {\height}}{$\m@th#1=$}}% \clipbox*{{.75\weq} 0pt {\weq} \height}{$\m@th#1=$}% } \makeatother

\begin{document}

$A=B_{a=b_{x=y}}$

$A\eqeqeq B_{a\eqeqeq b_{x\eqeqeq y}}$

$A\eqeqeqt B_{a\eqeqeqt b_{x\eqeqeqt y}}$

$A\eqeqeqb B_{a\eqeqeqb b_{x\eqeqeqb y}}$

$A\ne B_{a\ne b_{x\ne y}}$

$A\not\eqeqeq B_{a\not\eqeqeq b_{x\not\eqeqeq y}}$

$A\not\eqeqeqt B_{a\not\eqeqeqt b_{x\not\eqeqeqt y}}$

$A\not\eqeqeqb B_{a\not\eqeqeqb b_{x\not\eqeqeqb y}}$

\end{document}

Sandy G
  • 42,558