Minted ignores fontfamily setting
stephenlevitt opened this issue · 4 comments
Tested platforms: Windows 10, MiKTeX 23.1
Versions:
- xelatex - this is MiKTeX-XETEX 4.9.0
- xelatex - running on Windows 10.0.19044
- minted v2.7
- Pygments Version: 2.15.1
I am trying to use Inconsolata for minted listings only - not the entire LaTeX document. As far as I can tell, the font is installed correctly because it is found when specifying it for normal text. However, when explicitly set as the font for a minted listing it cannot be found. See the MWE below and specifically the last line. I am not sure why this does not work.
\documentclass{article}
\usepackage{fontspec}
\usepackage[outputdir=./out]{minted}
\newfontfamily{\inconsolata}{InconsolataLGCMarkup}[Extension=.otf, ItalicFont =*-Italic, BoldFont=*-Bold, Scale=MatchLowercase]
\begin{document}
This is the main document font: 0 1 2
{\inconsolata This is the main document font typeset using Inconsolata: 0 1 2}
\mint[fontfamily=tt]{text}| This is a minted listing with the default typewriter font: 0 1 2 |
\mint[fontfamily=helvetica]{text}| This is a minted listing with Helvetica: 0 1 2 |
\mint[fontfamily=inconsolata]{text}| This is a minted listing should be typeset with Inconsolata: 0 1 2 |
\end{document}
minted
uses fancyvrb
to typeset the code. The fontspec
manual gives an example using fancyvrb
, and in the \newfontfamily
definition uses the equivalent of NFSSFamily=inconsolata
. I'd suggest starting there.
Thanks! The following change produces the correct results:
\newfontfamily{\inconsolata}{InconsolataLGCMarkup}[NFSSFamily=inconsolata, Extension=.otf, ItalicFont =*-Italic, BoldFont=*-Bold, Scale=MatchLowercase]
The
fontspec
manual gives an example usingfancyvrb
, and in the\newfontfamily
definition uses the equivalent ofNFSSFamily=inconsolata
. I'd suggest starting there.
can you share the links 😃
is it this one:
- texdoc/fontspec "II.4.2 Font Selection > Single Font Face > NFSS family" (pg-16)
Yes, that's it.