# How to create these nice operators?

I'm trying to typeset a paper in Haskell, and I want to typeset these operators:

I'm talking about <*>, <$> and <$.

1. I've seen these before in articles about Haskell. Is there a package for them? Possibly an lhs2tex style file?

2. I'm trying to recreate them by hand. This is what I've tried:

• $<\mathclap{\$}>$ (Too much space) • $<\!\!\mathclap{\$}\!\!>$ (Very hacky, vertical spacing wrong)

Do I have to use TikZ for that, or is there a better way to achieve this?

• Will they be used in sub-/superscripts as well, or just in inline \textstyle? Mar 7 '16 at 21:36
• @Werner, just inline. Mar 7 '16 at 21:37

## 3 Answers

I think your second "very hacky" approach is not too bad at all. Instead of using \! for a negative space of fixed width, I used \hspace with a negative size argument. Also, I had to use \scalebox to shrink the dollar sign, which was taller than the angle braces. Here's the code:

\documentclass[border=10pt]{standalone}

\usepackage{mathtools}

\begin{document}

$<\hspace{-3.6pt}\mathclap{*}\hspace{-3.6pt}>$
$<\hspace{-3.6pt}\mathclap{\scalebox{.71}{\$}}\hspace{-3.6pt}><\hspace{-3.6pt}\mathclap{\scalebox{.71}{\$}}$

\end{document}


And here's the result:


\begin{document}

$f \dstar x$

$f \ddollar x$

$f \ddollarl x$

$f \ddollarr x$

\end{document}


Note that the above macros will be sufficient for inline \displaystyle and \teststyle use, but not for sub-/superscripts (\scriptstyle and smaller).

Choose better names. Depending on the fonts used some adjustment might be necessary.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\rstar}{
\mathbin{
<
\mathrel{
\mspace{-1.7mu}
\vcenter{
\hbox to 0pt{\hss$\scriptstyle*$\hss}
}
\mspace{-1.7mu}
}
>
}
}
\newcommand{\rdollar}{
\mathbin{
<
\mathrel{
\mspace{-1mu}
\vcenter{
\hbox to .5\wd0{\box0\hss}
\kern0.005ex
}
\mspace{-1mu}%
}
>
}
}

\begin{document}

$f\rstar x$

$f\rdollar x$

$f\ldollar x$

$f\gdollar x$

\end{document}


Look, ma! No percent!