在vscode中使用Latex:TexLive2023

安装TexLive2023及配置vscode可参考https://zhuanlan.zhihu.com/p/166523064

然后编译模板 .tex文件时,出现以下几个错误:

1. ctexbook找不到字体集   

d:/texlive/2023/texmf-dist/tex/latex/ctex/ctexbook.cls:1678: Class ctexbook Error: CTeX fontset `' could not be found.
(ctexbook)              Fontset `windows' will be used instead.

解决方法见ctexbook: fontset could not be found,也就是在主 .tex 文件里为命令\documentclass添加字体参数windows,使其变成

\documentclass[fontset=windows]

如果报错显示其他字体而非 windows,则要相应修改字体参数。

2. 总是报错找不到某种字体

Package fontspec Error: The font "SimSun" cannot be found.

解决方法见https://blog.csdn.net/king_ham/article/details/127797370,其中很重要的操作是将 .cls文件中包含 newtxtext 的内容注释掉。

如果真是缺少该字体,则下载安装该字体后,记得在cmd中运行 fmtutil-sys --all 来更新字体缓存。

3. 如果文档里插入了图片,注意图片的路径,有的模板里使用下面命令

\graphicspath{{./figs_1/},{./figs_2/},{../logos/}}

显式指定了图片的搜索目录,则插入图片时要使用图片相对于这些目录的路径。

你可能感兴趣的:(vscode,latex,TexLive2023)