I want to use JetBrains Mono (and its code ligatures) to render -> as an arrow. However, I get mixed results depending on the monospaced environment I am using. My goal is for this to work in the minted environment for Haskell:
\documentclass{article}
\usepackage{minted}
\usepackage{fontspec}
\setmonofont{JetBrains Mono}
\begin{document}
texttt:\\
\texttt{-> --> ->> <- <-- <<-\\
=> ==> >=> =>>\\
<= <== <<= <=<\\
<-> <=>}
verbatim:
\begin{verbatim}
-> --> ->> <- <-- <<-
=> ==> >=> =>>
<= <== <<= <=<
<-> <=>
\end{verbatim}
minted (Haskell):
\begin{minted}{haskell}
-> --> ->> <- <-- <<-
=> ==> >=> =>>
<= <== <<= <=<
<-> <=>
\end{minted}
minted (Bash):
\begin{minted}{bash}
-> --> ->> <- <-- <<-
=> ==> >=> =>>
<= <== <<= <=<
<-> <=>
\end{minted}
\end{document}
When run, only the texttt correctly renders -> and <- (though ->> is never rendered correctly in any of the environments):
The following changes do not affect the output:
- Replacing the font line with
\setmonofont{JetBrains Mono}[Contextuals=Alternate]. - Adding the package
microtypetogether with line\DisableLigatures[<,>]{encoding=T1,family=tt*}.
Replacing the font line with \setmonofont{JetBrains Mono}[Ligatures=TeX] results in instances of >> being replaced with a guillement "»".
I want the Haskell minted environment to render -> and <- as a ligature, and am not sure what steps to attempt next.


<<-works and not->>. Have you tried other coding fonts with ligatures like Fire Code or the ones listed on the Fira Code github page? If I am stating the obvious, sorry about it. – thymaro Apr 18 '23 at 18:31\makeatletter\def\verbatim@nolig@list{}\makeatotherto your preamble makes the ligatures work inverbatim(but notminted). Also, the ligature for->>renders fine for me with xelatex but not lualatex – mbert May 11 '23 at 01:35[Renderer=Harfbuzz]to fix all the ligatures in\texttt(andverbatimwith my comment above). See also my question about this – mbert May 11 '23 at 22:58