赞
踩
我要投的是elsvier下面一个子刊,要求用elsvier的cls文件为核心上传latex代码,b站和同门都请教过,感觉都不完整,还是自己一个晚上高了出来一个能用的,在这里分享下
b站有很多教程,课题组前辈应该也有这方面配置经验,这里就不详述了,直接上个链接吧,其他环境编辑器也都能找到相应教程的
链接: TexLive环境+VScode编辑器
去官网如下图:
红圈的文件是需要下载的,对于第一个文件:如果是windows就cmd进入安装的文件夹,如果是linux或者mac就直接进入安装位置,并且输入:latex elsarticle.ins
就可以得到cls文件了
在上面的b站视频里你应该已经配好latex vscode环境了吧,之后就可以随便创建一个.tex文件,这时候会有一个tex栏目,可以进入右侧tex栏进行编程了:
这是上面第二个红圈的模板文件,也是比较常用的单列模板:
我们点击打开这个,再切换到TEX栏,点击Recipe:xelatex即可(其他的也可以,点运行按钮也可以,这个我比较常用)
最后View in VSCode Tab就得到如图结果了,可以在模板里编辑文章了
下载就是官网下载,不多说了
把上面settings.json后面加上如下设置:
"latex-workshop.view.pdf.viewer": "external", "latex-workshop.view.pdf.ref.viewer":"auto", "latex-workshop.view.pdf.external.viewer.command":"D:/pdf/SumatraPDF/SumatraPDF.exe", //注意修改路径 "latex-workshop.view.pdf.external.viewer.args": [ "%PDF%" ], "latex-workshop.view.pdf.external.synctex.command":"D:/pdf/SumatraPDF/SumatraPDF.exe", //注意修改路径 "latex-workshop.view.pdf.external.synctex.args": [ "-forward-search", "%TEX%", "%LINE%", "-reuse-instance", "-inverse-search", "\"D:/VSCode/Microsoft VS Code/Code.exe\" -g \"%f:%l\"", // 注意修改路径 "%PDF%" ],
以上相当于是完成了PDF阅读器和vscode之间的绑定,一定注意把修改路径的地方修改了
这时候你运行完,再点"View in external viewer"就可以弹出PDF阅读器了
如果弹不出,在SumatraPDF->设置->高级选项里最后加入:
InverseSearchCmdLine = "D:/VSCode/Microsoft VS Code/Code.exe" "D:\VScode\Microsoft VS Code\resources\app\out\cli.js" --ms-enable-electron-run-as-node -r -g "%f:%l" //注意修改路径
EnableTeXEnhancements = true
注意快捷键:从PDF显示到vscode的位置是选中完后双击,从vscode显示到PDF快捷键是ctrl+alt+j
最后再发个我用的整体settings.json设置吧,方便copy:
{ "latex-workshop.latex.autoBuild.run": "never", "latex-workshop.showContextMenu": true, "latex-workshop.intellisense.package.enabled": true, "latex-workshop.message.error.show": false, "latex-workshop.message.warning.show": false, "latex-workshop.latex.tools": [ { "name": "xelatex", "command": "xelatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "pdflatex", "command": "pdflatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOCFILE%" ] }, { "name": "latexmk", "command": "latexmk", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdf", "-outdir=%OUTDIR%", "%DOCFILE%" ] }, { "name": "bibtex", "command": "bibtex", "args": [ "%DOCFILE%" ] } ], "latex-workshop.latex.recipes": [ { "name": "XeLaTeX", "tools": [ "xelatex" ] }, { "name": "PDFLaTeX", "tools": [ "pdflatex" ] }, { "name": "BibTeX", "tools": [ "bibtex" ] }, { "name": "LaTeXmk", "tools": [ "latexmk" ] }, { "name": "xelatex -> bibtex -> xelatex*2", "tools": [ "xelatex", "bibtex", "xelatex", "xelatex" ] }, { "name": "pdflatex -> bibtex -> pdflatex*2", "tools": [ "pdflatex", "bibtex", "pdflatex", "pdflatex" ] }, ], "latex-workshop.latex.clean.fileTypes": [ "*.aux", "*.bbl", "*.blg", "*.idx", "*.ind", "*.lof", "*.lot", "*.out", "*.toc", "*.acn", "*.acr", "*.alg", "*.glg", "*.glo", "*.gls", "*.ist", "*.fls", "*.log", "*.fdb_latexmk" ], "latex-workshop.latex.autoClean.run": "onFailed", "latex-workshop.latex.recipe.default": "lastUsed", "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click", "latex-workshop.view.pdf.viewer": "external", "latex-workshop.view.pdf.ref.viewer":"auto", "latex-workshop.view.pdf.external.viewer.command":"D:/pdf/SumatraPDF/SumatraPDF.exe", //注意修改路径 "latex-workshop.view.pdf.external.viewer.args": [ "%PDF%" ], "latex-workshop.view.pdf.external.synctex.command":"D:/pdf/SumatraPDF/SumatraPDF.exe", //注意修改路径 "latex-workshop.view.pdf.external.synctex.args": [ "-forward-search", "%TEX%", "%LINE%", "-reuse-instance", "-inverse-search", "\"D:/VSCode/Microsoft VS Code/Code.exe\" -g \"%f:%l\"", // 注意修改路径 "%PDF%" ], }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。