[Tex/LaTex] Consistent custom equality and subset symbols

relation-symbolsstacking-symbolssymbols

I would like to produce a handful of symbols with the following descriptions:

  • A subset (or rather \subseteq) symbol with the extra line replaced by a 'forward' arrow.
  • A similar symbol with a 'backward' arrow.
  • Equal signs with the lower line replaced by forward or backward arrows.

Browsing the symbols list, I came across stix symbols:

  • \subrarr (and the related \suplarr) which look like exactly the subset symbols I want, but have no reversed arrow variants
  • \dashleftharpoon and \dashrightharpoon, (or indeed the \barleftharpoon variants), but since the symbols I want relate to limits these are not what I'm looking for.

I tried making my own using boxes

\newcommand\subsetlim{\makebox[2\width]{\raisebox{0.5ex}{\scalebox{0.65}
    {$\underleftarrow{\scalebox{1.5}{\makebox[0.95\width][r]{$\subset$}}}$}}}}
\newcommand\subsetcolim{\makebox[2\width]{\raisebox{0.5ex}{\scalebox{0.65}
    {$\underrightarrow{\scalebox{1.5}{\makebox[0.95\width][r]{$\subset$}}}$}}}}
\newcommand\eqlim{\makebox[2\width]{\raisebox{0.6ex}{\scalebox{0.5}
    {$\underleftarrow{\scalebox{2}{\makebox[\width][c]{\---}}}$}}}}

but the rescaling necessary to make the arrow line up nicely results in varied line thickness in the first case, and there seems to be an unavoidably large ugly gap in the second case, whatever symbol I use for the dash.

I have seen solutions to similar problems given in pgf commands, which is fine, but I have not yet come across a definitive guide for resolving this kind of problem; I came up with my solutions based on the basic 'boxes' info in the LaTeX WikiBooks, which I feel is inadequate (especially considering that this is their page on \hbox, which I have seen used liberally in many custom typesetting constructions).

Once I've constructed my symbol, how do I ensure the surrounding spacing is correct (I know about the \mathop, \mathbin etc commands, but these rely on the symbol box being exactly the right size in the first place), or that the line widths consistent with the surrounding text/symbols?

Best Answer

Using stacks, but in this case, I only lay a scaled black triangle atop of the underlying symbol. As presented below, my first MWE will not work in smaller math styles. If that is needed, see my 2nd MWE.

The symbols are designed to take up the same horizontal space as their underlying roots (i.e., \subseteq and/or =).

\documentclass{article}
\usepackage{amssymb,stackengine,graphicx}
\stackMath
\newcommand\frightarrow{\scalebox{.4}[.3]{$\blacktriangleright$}}
\newcommand\fleftarrow{\scalebox{.4}[.3]{$\blacktriangleleft$}}
\newcommand\subsetrleads{\mathrel{%
  \stackengine{-1pt}{\subseteq}{\frightarrow}{U}{r}{F}{T}{S}}}
\newcommand\eqrleads{\mathrel{%
  \stackengine{-2.4pt}{=}{\frightarrow}{U}{r}{F}{T}{S}}}
\newcommand\subsetlleads{\mathrel{%
  \stackengine{-1pt}{\subseteq}{\fleftarrow}{U}{l}{F}{T}{S}}}
\newcommand\eqlleads{\mathrel{%
  \stackengine{-2.4pt}{=}{\fleftarrow}{U}{l}{F}{T}{S}}}
\begin{document}
$A \subseteq B\subsetrleads C$

$A = B\eqrleads C$

$A \subseteq B\subsetlleads C$

$A = B\eqlleads C$
\end{document}

enter image description here

Here's a version that works across math styles:

\documentclass{article}
\usepackage{amssymb,stackengine,graphicx,scalerel}
\stackMath
\newcommand\frightarrow{\scalebox{.4}[.3]{$\SavedStyle\blacktriangleright$}}
\newcommand\fleftarrow{\scalebox{.4}[.3]{$\SavedStyle\blacktriangleleft$}}
\newcommand\subsetrleads{\mathrel{\ThisStyle{%
  \stackengine{\dimexpr-.7\LMpt-.3pt}{\SavedStyle\subseteq}{\frightarrow}{U}{r}{F}{T}{S}}}}
\newcommand\eqrleads{\mathrel{\ThisStyle{%
  \stackengine{\dimexpr-2.45\LMpt+0.05pt}{\SavedStyle=}{\frightarrow}{U}{r}{F}{T}{S}}}}
\newcommand\subsetlleads{\mathrel{\ThisStyle{%
  \stackengine{\dimexpr-.7\LMpt-.3pt}{\SavedStyle\subseteq}{\fleftarrow}{U}{l}{F}{T}{S}}}}
\newcommand\eqlleads{\mathrel{\ThisStyle{%
  \stackengine{\dimexpr-2.45\LMpt+0.05pt}{\SavedStyle=}{\fleftarrow}{U}{l}{F}{T}{S}}}}
\begin{document}
$A \subseteq B\subsetrleads C$

$A = B\eqrleads C$

$A \subseteq B\subsetlleads C$

$A = B\eqlleads C$

$\scriptstyle A \subseteq B\subsetrleads C$

$\scriptstyle A = B\eqrleads C$

$\scriptscriptstyle A \subseteq B\subsetlleads C$

$\scriptscriptstyle A = B\eqlleads C$
\end{document}

enter image description here

ADDENDUM

Based on an OP follow up, here is a version of the fixed-style version in which the arrow conforms exactly to the end of the horizontal stroke, rather than extending past it. It does this by clipping off the tip of the black triangle, and using the rounded end of the underlying stroke to serve as the arrow tip.

\documentclass{article}
\usepackage{amssymb,stackengine,graphicx,trimclip}
\stackMath
\newcommand\frightarrow{\scalebox{.4}[.3]{%
  \clipbox{0pt 0pt 2pt 0pt}{$\blacktriangleright$}\kern1.8pt}}
\newcommand\fleftarrow{\scalebox{.4}[.3]{%
  \kern1.8pt\clipbox{2pt 0pt 0pt 0pt}{$\blacktriangleleft$}}}
\newcommand\subsetrleads{\mathrel{%
  \stackengine{-1.1pt}{\subseteq}{\frightarrow\kern.3pt}{U}{r}{F}{T}{S}}}
\newcommand\eqrleads{\mathrel{%
  \stackengine{-2.43pt}{=}{\frightarrow}{U}{r}{F}{T}{S}}}
\newcommand\subsetlleads{\mathrel{%
  \stackengine{-1.1pt}{\subseteq}{\kern.4pt\fleftarrow}{U}{l}{F}{T}{S}}}
\newcommand\eqlleads{\mathrel{%
  \stackengine{-2.43pt}{=}{\fleftarrow}{U}{l}{F}{T}{S}}}
\begin{document}
$A \subseteq B\subsetrleads C$

$A = B\eqrleads C$

$A \subseteq B\subsetlleads C$

$A = B\eqlleads C$
\end{document}

enter image description here

Related Question