当前位置:网站首页>Latex在VSCODE中编译中文,使用中文路径问题解决
Latex在VSCODE中编译中文,使用中文路径问题解决
2022-07-02 06:22:00 【呆呆象呆呆】
latex 编译中文和中文路径
问题1编译中文
\documentclass{article}
\usepackage{CTEX}
\begin{document}
这是一个CTEX的utf-8编码例子,{\kaishu 这里是楷体显示},{\songti 这里是宋体显示},{\heiti 这里是黑体显示},{\fangsong 这里是仿宋显示}。
\end{document}
如上代码需要使用xelatex进行编译,编译结果

如果使用latexmk,就会出现如下报错

我们应该作如下操作进行xelatex编译工具的配置
在VSCODE中按下F1选择首选项 进行环境配置

这里展示部分的配置文件,如果不是想要修改文件而是需要从头进行配置时候可以看到最后有一个链接里面有完整的配置代码
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
// 这里是xelatex工具的定义
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
}
],
//设置编译链的时候使用xelatex作为默认的第一个首选编译
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "pdflatex -> bibtex",
"tools": [
"pdflatex",
"bibtex"
]
},
// {
// "name": "pdflatex -> bibtex -> pdflatex*2",
// "tools": [
// "pdflatex",
// "bibtex",
// "pdflatex",
// "pdflatex"
// ]
// },
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],
问题2 中文路径无法编译
解决方案1
向上面一样只使用xelatex进行编译(在没有参考文献的时候是可行的哈)

解决方案2
但是在工具链路中有使用其他工具 比如 bibtex等 还需要修改一下配置 把工具定义中间的参数"%DOC%"改成"%DOCFILE%"因为bibtex识别不了中文路径
修改之前的失败案例

修改之后就可以顺利通过了

最后文件
如下连接中会分享一下我全部的latex配置 可以直接复制了放进去
VSCODE 安装LATEX环境,参数配置,常见问题解决_呆呆象呆呆的博客-CSDN博客
参考文献
边栏推荐
- Win10网络图标消失,网络图标变成灰色,打开网络设置闪退等问题解决
- Summary of advertisement business bug replay
- 实现strStr() II
- 代码技巧——Controller参数注解@RequestParam
- TensorRT的命令行程序
- Data science [viii]: SVD (I)
- Introduce two automatic code generators to help improve work efficiency
- web自动化切换窗口时报错“list“ object is not callable
- Find the highest value of the current element Z-index of the page
- 一起学习SQL中各种join以及它们的区别
猜你喜欢
随机推荐
Introduce two automatic code generators to help improve work efficiency
Self cultivation of programmers - Reflection on job hunting
Redis——缓存击穿、穿透、雪崩
Android - Kotlin 下使用 Room 遇到 There are multiple good constructors and Room will ... 问题
ModuleNotFoundError: No module named ‘jieba.analyse‘; ‘jieba‘ is not a package
Dynamic global memory allocation and operation in CUDA
实现strStr() II
压力测试修改解决方案
Fe - use of weex development weex UI components and configuration use
pytest(3)parametrize参数化
Sublime Text 配置php编译环境
Virtualenv and pipenv installation
Redis - grande question clé
NodeJs - Express 中间件修改 Header: TypeError [ERR_INVALID_CHAR]: Invalid character in header content
Sparse array (nonlinear structure)
DeprecationWarning: .ix is deprecated. Please use.loc for label based indexing or.iloc for positi
FE - weex 开发 之 使用 weex-ui 组件与配置使用
【程序员的自我修养]—找工作反思篇二
Automation - when Jenkins pipline executes the nodejs command, it prompts node: command not found
eslint配置代码自动格式化








