💡 参考文章见Ref,感谢提供思路!
🗺️当前这篇博文地址:https://myoontyee.github.io/article/4743966.html
⚠️警告:博客文章禁止一切形式的非授权非法转载!
⚠️Attention: All forms of unauthorized illegal reposts are prohibited !

创建时间:2022年4月26日09:42:41
最新更新:2022年4月26日09:42:41


Problem Description:Visual Studio Code Error : BUILD command invoked. Cannot find LaTeX root file. Solution

核心思路settings.json配置没配置对,或者没选择对应的语言LaTeX


错误原因

  • 网上有些教程不是最新的了,记得看时间

  • 有2个可能

    • settings.json没配置对
    • or没有选择对应的语言LaTeX
  • 两种错误都是在Visual Studio Code内解决

错误原因1解决

  • 具体见[[WSL2 + Visual Studio Code + LaTeX 配置教程]]

    • 将你的配置和下面这个对比一下,不行直接复制粘贴我下面这个也行
  • Visual Studio Code内按F1,输入setjson,选择打开设置(json)

    • F1这个快捷键冲突的话,就按Ctrl+Shift+P
  • "latex-workshop.intellisense.biblatexJSON.replace": {},语句下方添加如下语句,然后保存

    • 注意一定要在最外侧的大括号{}内添加
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"latex-workshop.latex.tools": [
{
"name": "texify",
"command": "texify",
"args": [
"--synctex",
"--pdf",
"--tex-option=\"-interaction=nonstopmode\"",
"--tex-option=\"-file-line-error\"",
"%DOC%.tex"
]
},
{
// 编译工具和命令
"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%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "PDFLaTeX",
"tools": [
"pdflatex"
]
},
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "BibTeX",
"tools": [
"bibtex"
]
},
{
"name": "pdflatex -> bibtex -> pdflatex*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],

错误原因2解决

  • Visual Studio Code对应项目右下角,是不是选了LaTeX这个语言,如果没有则选择LaTeX这个语言

Ref