我的VScode 的设置json代码如下 我不知道哪里错了,因为我是知乎抄的,也不会修,所以求助大佬教教我怎么能修好这个json
我全部删掉json之后引用任何东西都正常了
重新加上json后 就又变回去了 引用什么都是【?】
出现的问题就是,,加上这个json后 不管我label什么图还是公式 引用出来的PDF都是个【?】
视图如下
这个json的好处在于可以调出来sumatraPDF 还可以告诉我我编译的部分对应PDF里的哪一行,,所以我不太想删了它,,希望大佬们教教我改怎么修 实在不行就算了
`{
"latex-workshop.latex.recipes": [{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "xelatex -> bibtex -> xelatex -> xelatex",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "pdflatex",
"tools": [
"pdflatex"
]
}
],
"latex-workshop.latex.tools": [{
"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.autoClean.run": "onBuilt",
"latex-workshop.latex.autoBuild.run": "never",
"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.external.viewer.command": "D:/ProgramFiles/SumatraPDF\\SumatraPDF.exe",
"latex-workshop.view.pdf.external.viewer.args": [
"%PDF%"
],
"latex-workshop.view.pdf.external.synctex.command": "D:/ProgramFiles/SumatraPDF\\SumatraPDF.exe",
"latex-workshop.view.pdf.external.synctex.args": [
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
"-inverse-search",
"\"E:/LaTEX/VScode/Microsoft VS Code\\Code.exe\" \"E:/LaTEX/VScode/Microsoft VS Code\\resources\\app\\out\\cli.js\" -r -g \"%f:%l\"",
"%PDF%"
],
"[latex]": {
"editor.defaultFormatter": "nickfode.latex-formatter"
},
}`
"latex-workshop.latex.tools": [
{
"name": "latexmkpdf",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-halt-on-error",
"-file-line-error",
"-pdf",
"%DOCFILE%"
]
},
{
"name": "latexmkxe",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-halt-on-error",
"-file-line-error",
"-pdfxe",
"%DOCFILE%"
]
},
],
"latex-workshop.latex.recipes": [
{
"name": "latexmkpdf",
"tools": [
"latexmkpdf"
]
},
{
"name": "latexmkxe",
"tools": [
"latexmkxe"
]
},
],
"latex-workshop.latex.autoBuild.run": "never",
// "latex-workshop.view.pdf.viewer": "tab"
"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.ref.viewer": "external",
"latex-workshop.view.pdf.external.viewer.command": "<SumatraPDFROOT>/SumatraPDF.exe",
"latex-workshop.view.pdf.external.viewer.args": [
"-inverse-search",
"\"<VSCodeROOT>/bin/code.cmd\" -r -g \"%f:%l\"",
"%PDF%"
],
"latex-workshop.view.pdf.external.synctex.command":"<SumatraPDFROOT>/SumatraPDF.exe",
"latex-workshop.view.pdf.external.synctex.args":[
"-forward-search",
"%TEX%",
"%LINE%",
"%PDF%",
],
实际配置时,
用户需要结合自身安装情况更换 <SumatraPDFROOT>
和 <VSCodeROOT>
,
即 SumatraPDF 和 VS Code 各自的安装路径.
你的配置里面,xelatex
在第一位,所以编译的时候默认用它,但是文档里面有参考文献的时候,需要使用 bibtex
编译。所以你可以手动点击 TEX 插件页里面 Build LaTeX Project 下面的 Recipe: xelatex -> bibtex -> xelatex -> xelatex
那一条进行编译(见图片,我的是 xe -> bib -> xe*2
)。
或者在 JSON 设置里面换一下顺序,把 recipes 那里改为
"latex-workshop.latex.recipes": [
{
"name": "xelatex -> bibtex -> xelatex -> xelatex",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "pdflatex",
"tools": [
"pdflatex"
]
}
],
这么改的话点击 Build LaTeX Project
默认使用的就是第一个带 BIB 的选项。
完美解决了我的提问,,而且改成大佬这个之后,连报错都变少了,,属实是比我知乎上抄过来这个好多了
另外非常感谢大佬的细致回答,即详细又好用