# Relational override symbol

Looking for a way to write the following infix binary operator, meaning "relational override":

You're lucky: the minus sign and \vartriangleleft have the same width.

\documentclass{article}
\usepackage{amssymb}

\makeatletter
\DeclareRobustCommand{\reloverrideleft}{\mathrel{\mathpalette\rel@override\vartriangleleft}}
\DeclareRobustCommand{\reloverrideright}{\mathrel{\mathpalette\rel@override\vartriangleright}}

\newcommand{\rel@override}[2]{%
\vphantom{#2}%
\ooalign{$\m@th#1-$\cr$\m@th#1#2$}%
}
\makeatother

\begin{document}

$A \reloverrideleft B_{\reloverrideleft}$

$A \reloverrideright B_{\reloverrideright}$

\end{document}


With other math fonts it may not work flawlessly, I'm afraid.

For acmart we need to clip the minus sign:

\documentclass{acmart}
\usepackage{trimclip}

\makeatletter
\DeclareRobustCommand{\reloverrideleft}{\mathrel{\mathpalette\rel@override\vartriangleleft}}
\DeclareRobustCommand{\reloverrideright}{\mathrel{\mathpalette\rel@override\vartriangleright}}

\newcommand{\rel@override}[2]{%
\vphantom{#2}%
\ooalign{%
\hidewidth\clipbox*{{0.17\width} 0 {0.83\width} {\height}}{$\m@th#1-$}\hidewidth\cr
$\m@th#1#2$\cr
}%
}
\makeatother

\begin{document}

$A \reloverrideleft B_{\reloverrideleft}$

$A \reloverrideright B_{\reloverrideright}$

\end{document}


• Thanks. I'm using acmart.cls, and it took me a while to figure out that I have to not import amssymb for this to render nicely (if I import amssymb the minus sign is too short). – Roly Mar 23 '17 at 13:09
• @Roly With acmart the minus sign is a bit too long, unfortunately. – egreg Mar 23 '17 at 13:16
• @Roly There's a reason why a mwe is always needed! – CarLaTeX Mar 23 '17 at 13:47
• @CarLaTeX Hah, yeah. I was trying to be cute with the Detexify "spec". – Roly Mar 23 '17 at 15:39
• @Roly Detexify is a great tool, indeed! – CarLaTeX Mar 23 '17 at 15:40

Package stix has it:

\documentclass{article}
\pagestyle{empty}
\usepackage{stix}
\begin{document}
$a\dsub b$
\end{document}


Actually texdoc comprehensive is a very good source for information like this.

• Thanks! I prefer the answer above, but this is also useful. – Roly Mar 23 '17 at 13:10