Thysrael / GreenParkBeamerTheme

北京航空航天大学 BUAA LaTeX Beamer 非官方主题
Creative Commons Attribution 4.0 International
12 stars 2 forks source link

Fix #1: 解决minted宏包字体问题并添加寻找不到字体时的Fallback策略 #4

Closed TrickEye closed 1 month ago

TrickEye commented 1 month ago

解决minted使用自定义字体问题

Fix #1 .

如果直接/newfontfamily/mintedcodefont{Consolas},那么minted会报"Font shape TU/mintedcodefont/m/n' undefined"

翻到 https://github.com/gpoore/minted/issues/365 指出:

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. (https://github.com/gpoore/minted/issues/365#issuecomment-1517794111

因此此PR主要添加一行NFSSFamily=mintedcodefont,解决了自定义fontfamily失效的问题

添加默认字体Fallback策略

此外,优于原作者采用了部分生僻字体,因此不一定所有人都有安装在自己的电脑上,因此添加了找不到目标字体时Fallback到一个覆盖率更高些的字体上的策略,基于\IfFontExistsTF实现

这样既不影响喜欢这些字体的原作者,也不影响没有这些字体的普罗大众和Overleaf,再也不用为后者特殊关照辣