Closed mbertucci47 closed 1 year ago
This is due to how Pygments does tokenization. For Bash, |=>
becomes \PYG{p}{|}\PYG{o}{=}\PYGZgt{}
. For Python, it becomes \PYG{o}{|=\PYGZgt{}}
. (\PYGZgt{}
is the Pygments translation of >
.) Because the characters are split between different tokens for Bash (\PYG{<token_type>}{<token_text>}
), ligatures won't work.
Thanks for the explanation
If using
fontspec
and a monospaced font with code ligatures such as JetBrains Mono or Fira Code, then redefining\verbatim@nolig@list
to be empty allows for the code ligatures in averbatim
orVerbatim
(fancyvrb) environment. However this is not true forminted
environments (or commands, etc.). Compile the following with xelatex or lualatex withRenderer=Harfbuzz
(see this issue) to see the problem:So some ligatures are enabled, others are disabled, and it depends on the language chosen.
I thought minted used fancyvrb environments "under the hood", so I'm not sure why some ligatures are disabled in the minted environments. I'm also not sure why it depends on the language. Assumedly it has something to do with the Pygments settings for each language. Is this expected behavior or a bug?
Related SE question: https://tex.stackexchange.com/questions/683184/jetbrains-arrow-code-ligatures-do-not-apply-consistently-in-different