Open kindaro opened 7 years ago
You can just define a formatting directive and map it to anything you like.
I agree. It does not look very good. In my opinion, the issues are both height and separation.
For a paper we wrote together, @turion created this rule:
https://github.com/ivanperez-keera/lhs2tex-haskell-operators/blob/master/document.lhs#L16
It looks like this:
I've created that repo to start collecting these formatting rules. We can keep it simple, just putting them in a versioned file that everyone can download regularly and import for all their projects.
I use this: $$foo\mathbin{\langle\$\rangle} a \mathbin{\langle*\rangle} b$$
%format <$> = "\mathbin{\langle\$\rangle}"
%format <*> = "\mathbin{\langle*\rangle}"
https://github.com/ivanperez-keera/lhs2tex-haskell-operators/blob/master/document.lhs#L16
@ivanperez-keera do you know where this repository is now?
I removed the repository because I wasn't using it anymore and didn't know that anybody was. I did not keep a copy, apparently.
I have a copy of our paper and the rule you created was:
%format <$> = "\inanglebrackets{\raisebox{0.1pt}{\scalebox{.8}{\$}}}"
where
\newcommand{\inanglebrackets}[1]{\mathbin{<\hspace{-1.6pt}\mathclap{#1}\hspace{-1.6pt}>}}
Does that help?
I did not keep a copy, apparently.
Oh no :(
Does that help?
Yes, that's helpful, thanks! I don't know whether there is interest collecting these formatting rules again and maybe adding them to lhs2tex
(optionally)?
I'll leave that to you. For the most part, I stopped using lhs2TeX. When using extensions and such it always required too much tweaking and I had to modify my haskell to make it work, which defused the whole purpose :(
This must be an insignificant rant, but can something be done to improve this typesetting?
It's way spread out and not nicely vertically aligned: the
$
character is way too high up relative to the angle brackets and the rest of the line.Since
<$>
made it to Prelude, it sees more use as a nicer replacement for infix`fmap`
, so there must be quite a bunch of code around that would benefit from a better out-of-the-box typesetting.Even just setting
<$>
in monospace font with some spacing from the surrounding code will make it look better (as you can see throughout this very message). To my knowledge, there's no nice and commonly accepted Unicode codepoint for this operator, but, for example, here on github someone made a set of ligatures that features a nice<$>
glyph.P.S. This typesetting is observed in both poly and math styles.