# A variation on the subset relation with an underlying squiggle

I'm looking for a variation on the \subseteq relation, but with an underlying squiggle instead of a line. In other words, I'm looking for the symbol to substitute for the square in the last printed line of following example.

\documentclass{amsart}
\usepackage{amssymb}
\begin{document}
\begin{align*}
\prec + \sim &= \precsim\\
< + \sim &= \lesssim\\
\subset + \sim &= \square
\end{align*}
\end{document}


I couldn't find any matching symbol using detexify.

• stix has \subsetapprox but with 2 squiggles. – CarLaTeX Oct 26 '18 at 10:15
• @CarLaTeX: This would work, except I get a LaTeX Error: Too many symbol fonts declared. when I try to use the package stix in my actual document (not the sample one listed in my post above). – Evan Aad Oct 26 '18 at 10:26
• @CarLaTeX: Upon further inspection, it appears there are three packages in my preamble that clash with stix, namely mathrsfs, stmaryrd, and unicode-math (I should note that I use the lualatex format with the scrbook document class). The first two packages produce the error message listed in my previous comment, whereas the third package produces the error message Command '\mathbfit' already defined. Is there a way to resolve these errors, so I can use stix's \subsetapprox command? – Evan Aad Oct 26 '18 at 10:40

If stix package gives you some incompatibilities, you can define your own symbol, without any additional package:

\documentclass{amsart}
\usepackage{amssymb}

\newcommand{\subsetsim}{\mathrel{\ooalign{\raise.4ex\hbox{$\subset$}\cr$\raise-.9ex\hbox{$\sim$}$}}}

\begin{document}
\begin{align*}
\prec + \sim &= \precsim\\
< + \sim &= \lesssim\\
\subset + \sim &= \subsetsim
\end{align*}
$\precsim \lesssim \subsetsim$
\end{document}


• Thanks you! Is there a way to lower the squiggle a little bit, so the vertical space between the subset symbol and the squiggle resembles that used in \precsim and \lesssim? – Evan Aad Oct 26 '18 at 12:41
• @EvanAad Of course, instead of \raise-.8ex you can put a bigger value. I'm modifying. – CarLaTeX Oct 26 '18 at 12:43
• @EvanAad See my renewed answer. You can also furtherly refine... – CarLaTeX Oct 26 '18 at 12:47
• @EvanAad See campa's answer, it's better than mine. – CarLaTeX Oct 26 '18 at 12:48
• \ooalign? Oh, no! – egreg Oct 28 '18 at 14:19

You can do that with the accents package:

\documentclass[border=2pt]{standalone}

\usepackage{amssymb, accents} %
\newcommand{\subsetsim}{\mathrel{\underaccent{\mkern6mu\sim}{{\subset}}}}
\newcommand{\supsetsim}{\mathrel{\underaccent{\backsim\mkern2mu}{{\supset}}}}%{\stackMath\mathrel{\stackinset{c}{0ex}{c}{-1ex}{\sim}{\subset}}}

\begin{document}

$E \subsetsim F \iff F \supsetsim E$

\end{document}


A slight improvement of CarLaTeX's answer which scales correctly in \scriptstyle and \scriptscriptstyle.

\documentclass{article}

\usepackage{amssymb}

\newcommand*{\subsetsim}{\mathrel{\mathpalette\subsetsimaux\relax}}
\newcommand*{\subsetsimaux}[2]{%
\setbox0=\hbox{\mathsurround=0pt$#1\sim$}%
{\ooalign{\raise.5\ht0\hbox{$#1\subset$}\cr\lower\ht0\box0}}
}

\begin{document}
$\precsim \lesssim \subsetsim_{\precsim \lesssim \subsetsim_{\precsim \lesssim \subsetsim}}$
\end{document}


The difference with the built-in symbols is visible in \scriptstyle and obvious in \scriptscriptstyle but I think one can live with it.

• I was just replying that I didn't know \mathpalette :) – CarLaTeX Oct 26 '18 at 12:48
• @CarLaTeX If you often cobble some math symbols together, you'll find \mathpalette to be one of your best friends, next to \ooalign and \vcenter :-D See The mysteries of \mathpalette for some background. – campa Oct 26 '18 at 13:01
• Everyday a new wonderful thing to learn in TeX/LaTeX :) – CarLaTeX Oct 26 '18 at 13:06

The places the “subset” part at the same height as in \subseteq. Other choices are possible.

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

\makeatletter
\DeclareRobustCommand{\subsetsim}{\supsub@setsim\subset}
\DeclareRobustCommand{\supsetsim}{\supsub@setsim\supset}

\newcommand{\supsub@setsim}[1]{%
\mathrel{\mathpalette\supsub@setsim@{#1}}%
}

\newcommand{\supsub@setsim@}[2]{%
\begingroup
\sbox\z@{$\m@th#1\subseteq$}%
\raisebox{\dimexpr\ht\z@-\height}{%
\vbox{\offinterlineskip
\ialign{%
##\cr
$\m@th#1#2$\cr
\noalign{\vskip0.6pt}
\hidewidth$\m@th#1\sim$\hidewidth\cr
}%
}%
}%
\endgroup
}
\makeatother

\begin{document}

$A\subseteq B \subseteq C$

$A\subseteq B \subsetsim C \precsim D$

$\scriptstyle A\subseteq B \subsetsim C$

\end{document}