typewriter version of \leq

I have the following piece of program code

written as

$r_4$:\quad\texttt{r(X)} \texttt{<=>} \texttt{X$\leq$0|} \texttt{q(X)}


I would like to cheat and display the less-equal sign in a font like typewriter.

I could not find the answer in http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf and hope that you have a trick or two. Thank you in advance.

• Courier and TeX Gyre Cursor are tt fonts with such characters (in text mode). They the U2264 and U2265 unicode characters. – Bernard Apr 13 '18 at 10:38

\documentclass{article}
\usepackage{stackengine}
\newcommand\ttleq{\mathrel{\stackunder[-1pt]{\texttt{<}}{\texttt{-}}}}
\begin{document}
$r_4$:\quad\texttt{r(X)} \texttt{<=>} \texttt{X$\leq$0|} \texttt{q(X)}

$r_4$:\quad\texttt{r(X)} \texttt{<=>} \texttt{X${}\ttleq{}$0|} \texttt{q(X)}
\end{document}


If you need one that scales to the smaller math styles,

\documentclass{article}
\usepackage{stackengine,scalerel}
\newcommand\ttleqtext{\stackunder[-1pt]{\texttt{<}}{\texttt{-}}}
\newcommand\ttleq{\mathrel{\scaleto{\ttleqtext}{10\LMpt}}}
\begin{document}
$\mathtt{X \ttleq Y_{X\ttleq Y_{X\ttleq Y}}}$
\end{document}


• Thanks! I ended up using \usepackage{stackengine} \newcommand\ttleq{\raisebox{1pt}{$\mathrel{\stackunder[-1.5pt]{\texttt{<}}{\texttt{-}}}$}} – Kirkeby Apr 13 '18 at 10:49

You can use the cmtex font:

\documentclass{article}

\DeclareFontFamily{OT1}{cmtex}{}
\DeclareFontShape{OT1}{cmtex}{m}{n}{
<-8.5> cmtex8
<8.5-9.5> cmtex9
<9.5-> cmtex10
}{}
\newcommand{\ttleq}{{\usefont{OT1}{cmtex}{m}{n}\symbol{"1C}}}
\newcommand{\ttgeq}{{\usefont{OT1}{cmtex}{m}{n}\symbol{"1D}}}

\begin{document}

$r_4$:\quad\texttt{r(X) <=> X\ttleq0| q(X)}

$r_5$:\quad\texttt{r(X) <=> X\ttgeq0| q(X)}

\end{document}


There are other symbols: here's the complete font table, so you can add them in a similar way as done for \ttleq and \ttgeq.