Comments (6)
See https://tex.stackexchange.com/questions/294362/use-fira-code-font-with-ligatures-in-code-listings
from minted.
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.
from minted.
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.
Footnotes
from minted.
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.
from minted.
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
Full example
% !TeX TS-program = lualatex
\documentclass{article}
\usepackage{fontspec}
\setmonofont[
Contextuals={Alternate},
% ligatures `.-` and `.=` require otf features cv25 and cv32, respectively
% see https://github.com/tonsky/FiraCode, README
CharacterVariant={25,32}
]{Fira Code Retina} % one of six weights of Fira Code, just to get glyphs a bit bolder
\usepackage{minted}
\makeatletter
\apptocmd\verbatim@font
{%
\def\verbatim@nolig@list{}%
\ifdefined\directlua
% see https://github.com/gpoore/fvextra/issues/14
\automatichyphenmode=2\relax
\fi
}
{}{\PatchFailed}
\makeatother
\begin{document}
\begin{minted}{haskell}
m1 >=> m2
\end{minted}
% see https://tex.stackexchange.com/a/294369
\begin{verbatim}
.= .- := =:=
== != === !== =/=
<<- <-- <- <-> -> --> ->>
<=< <<= <== <=> => ==> =>> >=>
>>= >>- >- -< -<< =<<
<~~ <~ ~~~ ~> ~~>
<<< << <= <> >= >> >>>
<| <|> |>
<$ <$> $>
<+ <+> +>
<* <*> *>
\\ \\\ {- -} // ///
/* /** **/ */
</ <!-- www --> />
0xF 9:45 m-x *ptr
;; ;;; :: ::: !! !!!
?? ??? %% %%% && &&&
|| ||| .. ... ..< []
-- --- ++ +++ ** ***
~= ~- -~ =~ ~@
^= ?= /= /== |= ||=
## ### ####
#{ #[ #( #? #_ #_(
a*b a*A B*b A*B *a *A a* A*
a-b a-A B-b A-B -a -A a- A-
a+b a+A B+b A+B +a +A a+ A+
a:b a:A B:b A:B :a :A a: A:
\end{verbatim}
\end{document}
Some links
- Fira Code's repo: https://github.com/tonsky/FiraCode
- Fira Code's wiki on "LaTeX instructions", resulted from discussions under tonsky/FiraCode#388): https://github.com/tonsky/FiraCode/wiki/LaTeX-instructions
- An in-browse font tool to interactively inspect otf features: https://fontdrop.info
from minted.
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.
from minted.
Related Issues (20)
- importing mathtools after minted gives errors in amsmath.sty HOT 2
- Passing additional flags to `pygmentize` / Using local lexers with the `-x` flag HOT 3
- "bgcolor" option is not in the right place in the documentation
- Only allow page break on a blank line HOT 2
- Trying to get `\inputminted` works with variable arguments HOT 14
- `\minted@opt@quote` prevents expansion too much HOT 5
- [Feature Request] Allow arbitrary or tagged line ranges HOT 1
- Passing newlines via `+v` argument causes error in 2.7 HOT 5
- Use a \def macro as the value for the style option HOT 3
- Update the options forwarded to `fvextra` HOT 1
- breakautoindent option doesn't work with some languages HOT 3
- Custom lexer no longer worked in my computer. HOT 6
- Make `langlinenos` with with `\inputminted` HOT 2
- `\mintinline{cpp}{#include}` in section title results in error HOT 12
- Leading Chinese characters introduce unexpected boxes HOT 5
- Didn't receive error message that fvextra was not installed HOT 2
- Minted ignores fontfamily setting HOT 4
- Font settings (migrating from lst-listings) HOT 12
- clearing `\verbatim@nolig@list` does not allow for code ligatures HOT 2
- Confused by arbitrary failure HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minted.