9

I would like to typeset a symbol that means "element of or equal to," which is just the element symbol with a short horizontal line underneath.

I tried $\underline{\in}$, but that makes the underline too thick:

enter image description here

Is there a way to typeset this symbol directly, or to make the underline thinner?

Martin Thoma
  • 18,799
Nishant
  • 193

2 Answers2

8

This is a first approximation:

\documentclass{article}
\newcommand{\ineq}{%
  \mathrel{\mkern1mu\underline{\mkern-1mu\in\mkern-1mu}\mkern1mu}}

\begin{document}
$\alpha\ineq\beta$
\end{document}

enter image description here

This automatically changes size in subscripts.

You may prefer a solution with a roundcap bar below the main symbol:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\ineq}{\mathrel{\text{\in@eq}}}
\newcommand{\in@eq}{%
  \oalign{%
    \hidewidth$\m@th\in$\hidewidth\cr
    \noalign{\nointerlineskip\kern1ex}%
    $\m@th\smash{-}$\cr
    \noalign{\nointerlineskip\kern-.5ex}%
  }%
}
\makeatother
\begin{document}
$\alpha\ineq\beta_{\ineq}$
\end{document}

enter image description here

egreg
  • 1,121,712
8

The character ⋸ is the Unicode character U+2278, see Barbara Beeton's comment.

I found two math fonts, which contains the charactes:

  • Asana Math
  • XITS Math

They can be used with XeTeX or LuaTeX. With package unicode-math, the command is \isinvb, or the character can be given directly as UTF-8 character or the ^^^^-escape notation can be used: ^^^^22F8.

The following example shows:

  • The direct glyphs (only Asana Math and XITS Math).
  • The macros \isinvbA and \isinvbB.
    • They compose the symbol with ∈ (\in) and the minus sign. If the minus sign is too long (Latin Modern Fonts), then it is scaled horizontally to fit the symbol ∈.
    • The gap is estimated by the middle of ten percent of the height of ∈ and 150% of the line thickness of the minus sign.
    • Rounded line caps are kept (but subjected to the horizontal scaling in case of Latin Modern).
    • Asana Math centers the complete symbol around the math axis. This is implemented by \isinvbA by using \vcenter.
    • XITS Math keeps the symbol in and adds the line under it. This is implemented by \isinvbB by using \vtop.
  • The symbols can be used in all math styles.

Example and test file:

\tracinglostchars=2
\documentclass{article}
\usepackage{unicode-math}

\newcommand*{\teststring}{%
  \fbox{$\isinvb$}% U+22F8
}

\usepackage{graphicx}

\makeatletter
\newcommand*{\isinvbA}{%
  \mathrel{%
    \mathpalette\@isinvb@\vcenter
  }%
}
\newcommand*{\isinvbB}{%
  \mathrel{%
    \mathpalette\@isinvb@\vtop
  }%
}
\newcommand*{\@isinvb@}[2]{%
  % #1: math style   
  % #2: \vcenter or \vtop
  #2{%   
    \sbox0{$#1\in\m@th$}%
    \copy0 %
    \sbox2{$#1-\m@th$}%
    \sbox4{$#1\vcenter{}$}%
    \dimen@=\dimexpr\ht2-\ht4\relax
    \sbox2{\lower\dimexpr\ht4-\dimen@\relax\hbox{\unhcopy2}}%
    \dp2=\z@
    \kern.5\dimexpr3\dimen@ + .1\ht0\relax
    \ifdim\wd2>\wd0 %
      \hbox to \wd0{\hss\resizebox{\wd0}{\ht2}{\copy2}}%
    \else
      \hbox to \wd0{\hss\copy2}%
    \fi
  }%
}
\makeatother

\begin{document}

\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}   
\newcommand*{\test}[1]{%
  \fontfamily{lmvtt}\tiny #1 &
  \setmathfont{#1.otf}$\teststring$
  &
  \setmathfont{#1.otf}${\in}{-}$
  &      
  \setmathfont{#1.otf}%  
  \fbox{$\isinvbA$}$^{\isinvbA^{\isinvbA}}$%
  &
  \setmathfont{#1.otf}%
  \fbox{$\isinvbB$}$^{\isinvbB^{\isinvbB}}$%
  \\
}
\begin{tabular}{@{}l@{ }l@{ }l@{\quad}l@{ }l@{}}
  \test{Asana-Math}  
  \test{xits-math}
  \test{latinmodern-math}
  \test{texgyretermes-math}
  \test{texgyrepagella-math}
  \test{texgyrebonum-math}
  \test{texgyreschola-math}
\end{tabular}
\end{document}

Result

Remarks:

  • \tracinglostchar=2 is quite important, because then TeX will report characters, which are not present in the used fonts, e.g.:

    Missing character: There is no ⋸ (U+22F8) in font "[texgyrebonum-math.otf]:mode=base;script=math;language=DFLT;"!
    
  • Macros \isinvbA and \isinvbB do not depend on LuaTeX or XeTeX, they can also be used with pdflatex or latex.

  • The \fbox commands show the bounding boxes.
Heiko Oberdiek
  • 271,626