Closed duskmoon314 closed 2 years ago
See tex.stackexchange.com/questions/294362/use-fira-code-font-with-ligatures-in-code-listings
I have already tried this and still have the same problem. So I assume it has something to do with minted
. BTW, this definitely works when using verbatim
alone.
Then please provide a complete (and if possible, minimal) example, not code snippet with screenshot[^1]. And you should mention what you tried and what you got, no matter the result is negative or partial.
[^1]: Please never ever post images of code. --- daleif (link)
The linked answer involves multiple steps. The version toward the end uses \def\verbatim@nolig@list{}
. This is worth trying if you haven't already.
One additional factor that may be relevant: Pygments, which minted
uses to do the actual highlighting, converts >=>
into \PYGZgt{}=\PYGZgt{}
in the highlighted LaTeX output, where the Pygments style file defines \def\PYGZgt{\char`\>}
. It's possible \PYGZgt
needs to be redefined.
The following setting works for me, with fira code v3.2v6.2 and a latest mactex 2022, compiled either with xelatex or lualatex.
\setmonofont[
Contextuals={Alternate},
CharacterVariant={25,32}
]{Fira Code}
\def\verbatim@nolig@list{}%
\ifdefined\directlua
\automatichyphenmode=2\relax
\fi
Some links
Then please provide a complete (and if possible, minimal) example, not code snippet with screenshot1. And you should mention what you tried and what you got, no matter the result is negative or partial.
Sorry, my fault.
I have tried to make a minimal example and I found out the main problem is using ctex
instead of fontspec
to write in Chinese. FiraCode works well in the minted environment, even without using \def\verbatim@nolig@list{}
.
Sorry for my bother. Thanks.
Hello. I'm trying to use FiraCode with minted but have encountered the problem of not enabling all ligatures.
FiraCode supports a lot of ligatures and I want to use the ligature of
>=>
. But In theminted
environment, I get>
and=>
separately. I also try it in\texttt{}
and it works.Example Pic:
The preamble part of my tex file: