5

I am trying to make a large unary operator from an equal sign =, namely, \mathlarger{\boldsymbol{=}}, but the bars are too close together to distinguish from the general binary case. Is there some package with = having a wider gap that I can use?

  • I go with @campa 's answer because it seems most simple – updraft Mar 12 at 11:20
  • 3
    I'm not sure what unary equality is supposed to denote but, if you're having trouble distinguishing your symbol for it from ordinary equality, that suggests you might want to look at a completely different symbol. – David Richerby Mar 12 at 11:49
  • @DavidRicherby thanks for the suggestion, I use unary equal to refer to the set that is the isovalue contour of point p, so it can be intuitive. – updraft Mar 13 at 6:41
8

Here's a proposal:

\documentclass{article}
\usepackage{amsmath,xparse}

\ExplSyntaxOn
\NewDocumentCommand{\uneq}{}
 {
  \mathbin{\mathpalette\updraft_uneq:nn {}}
 }

\dim_new:N \l__updraft_width_dim
\dim_new:N \l__updraft_height_dim

\cs_new_protected:Nn \updraft_uneq:nn
 {
  \vcenter
   {
    \mathsurround=0pt
    \hbox:n
     {
      % measure the width of the equals sign in the current style
      \hbox_set:Nn \l_tmpa_box {$#1{=}$}
      \dim_set:Nn \l__updraft_width_dim { \box_wd:N \l_tmpa_box }
      % measure the width of 1mu in the current style
      \hbox_set:Nn \l_tmpa_box {$#1\mkern1mu$}
      \dim_set:Nn \l__updraft_height_dim { \box_wd:N \l_tmpa_box }
      % start drawing
      \driver_draw_begin:
      % round caps on lines
      \driver_draw_cap_round:
      % set the line width (change 1.2 to your liking)
      \driver_draw_linewidth:n { 1.2\l__updraft_height_dim }
      % 1. cm fonts use width/10  of side bearings
      % 2. the gap between lines is 5 times the line width
      % bottom line
      \driver_draw_moveto:nn
       { 0.1 \l__updraft_width_dim }
       { -2.5 \l__updraft_height_dim }
      \driver_draw_lineto:nn
       { 0.9 \l__updraft_width_dim }
       { -2.5 \l__updraft_height_dim }
      \driver_draw_stroke:
      % top line
      \driver_draw_moveto:nn
       { 0.1 \l__updraft_width_dim }
       { 2.5 \l__updraft_height_dim }
      \driver_draw_lineto:nn
       { 0.9 \l__updraft_width_dim }
       { 2.5 \l__updraft_height_dim }
      \driver_draw_stroke:
      \driver_draw_end:
      % occupy the space
      \hspace{ \l__updraft_width_dim }
     }
   }
 }
\ExplSyntaxOff

\begin{document}

$\mathbin{=}A$

$\uneq A$ $\scriptstyle\uneq A$ $\scriptscriptstyle\uneq A$

$A=B$

\end{document}

There is no “unary operator” class, one has to use \mathbin and TeX will act according to the context. You could also decide to simply use \mathord.

enter image description here

  • thank you:), your proposal is a little hard I don't quite understand, haha – updraft Mar 12 at 11:02
  • @updraft I added some comments – egreg Mar 12 at 12:04
  • your method is actually very thorough and illuminating I go with yours instead! – updraft Mar 13 at 6:37
5

The gap can be tweaked by changing the 4\LMpt.

\documentclass{article}
\usepackage{scalerel,stackengine,bm}
\newcommand\bineq{\mathbin{\ThisStyle{\ensurestackMath{\vcenter{\hbox{\stackengine{%
  4\LMpt}{\SavedStyle\bm{-}}{\SavedStyle\bm{-}}{O}{c}{F}{F}{L}}}}}}}
\begin{document}
${\bm{=}} A\quad\scriptstyle{\bm{=}} A\quad\scriptscriptstyle{\bm{=}} A$ bold =

$\bineq A\quad\scriptstyle\bineq A\quad\scriptscriptstyle\bineq A$ \verb|\bineq|
\end{document}

enter image description here

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.