原来在另一台电脑上找了个教程配了一遍,这次重新配的时候,那个教程作者更新过后,改成只有linux的脚本了,所以存档一下。真香警告, 2023年初的vscode+latex写作 - 知乎 (zhihu.com)
环境:
win10/win11+vscode+latex workshop+texlive+okular
一、vscode+latex workshop
安装vscode就不说了,直接官网下载就完了,不过可以补一个下载速度慢的解决方法。
vscode官方下载太慢解决办法_vscodeusersetup-x64-1.82.2.exe_luffy5459的博客-CSDN博客
详细步骤:
1、打开官网:Visual Studio Code 点击下载。
2、在下载器这里复制下载链接,粘贴到浏览器地址栏。
3、改变官网地址主地址为: vscode.cdn.azure.cn,然后回车。
然后插件里搜索latex workshop安装就行了。
二.texlive
https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/
直接下载 texlive.iso,运行里面的 install-tl-windows.bat
安装配置。点击“Advance”,然后可以修改安装目录“Installation root”。点击“Customize”,左边语言包先点击“无”,然后只勾选“Chinese”和“US and UK English”,右边工程包不勾选“TeXworks editor; TL includes only the Windows binary”,即不勾选配置主菜单的“安装TeXworks前端”(工程包和配置主菜单其他项均勾选)。最后点击“确定”,再点击“安装”,耐心等待安装完成,安装时间将持续30分钟甚至更长。
Latex 安装与VS code 配置_迷途呀的博客-CSDN博客
等待安装即可
打开终端,输入 xelatex,如果有以下输出,说明安装成功:
三、okular
windows商店直接安装
四、配置vscode
Ctrl+shift+P搜索“open user settings json”创建settings.json
复制粘贴,修改okular路径即可。
一般都在“C:\\Users\\<USERNAME>\\AppData\\Local\\Microsoft\\WindowsApps\\okular”里面
修改用户名
{
//使用 okular 预览编译好的PDF文件
// 设置外部查看生成的pdf文件
"latex-workshop.view.pdf.viewer": "external",
// PDF查看器用于在\ref上的[View on PDF]链接
"latex-workshop.view.pdf.ref.viewer": "auto",
// 使用外部查看器时要执行的命令。此功能不受官方支持。
"latex-workshop.view.pdf.external.viewer.command": "C:\\Users\\chris\\AppData\\Local\\Microsoft\\WindowsApps\\okular", // 注意修改路径
// 使用外部查看器时,latex-workshop.view.pdf.external.view .command的参数。此功能不受官方支持。%PDF%是用于生成PDF文件的绝对路径的占位符。
"latex-workshop.view.pdf.external.viewer.args": [
"%PDF%"
],
// 将synctex转发到外部查看器时要执行的命令。此功能不受官方支持。
"latex-workshop.view.pdf.external.synctex.command": "C:\\Users\\chris\\AppData\\Local\\Microsoft\\WindowsApps\\okular", // 注意修改路径
// latex-workshop.view.pdf.external.synctex的参数。当同步到外部查看器时。%LINE%是行号,%PDF%是生成PDF文件的绝对路径的占位符,%TEX%是触发syncTeX的扩展名为.tex的LaTeX文件路径。
"latex-workshop.view.pdf.external.synctex.args": [],
"editor.minimap.enabled": true, //控制是否显示缩略图。
//定义要在配方中使用的 LaTeX 编译工具。每个工具都标有其名称。
//调用时,命令会使用 args 中定义的参数和 env 中定义的环境变量生成。
//通常,除非在路径中,否则每个参数中不应出现空格。
//占位符 %DOC%、%DOC_W32%、%DOC_EXT%、%DOC_EXT_W32%、%DOCFILE%、%DOCFILE_EXT%、%DIR%、%DIR_W32%、%TMPDIR% 和 %OUTDIR%、%OUTDIR_W32% 可用.
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "xelatex-with-shell-escape",
"command": "xelatex",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "xelatex-latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-xelatex",
"-outdir=%OUTDIR%",
"%DOC%"
]
},
{
"name": "xelatex-latexmk-with-shell-escape",
"command": "latexmk",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-xelatex",
"-outdir=%OUTDIR%",
"%DOC%"
]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "pdflatex-with-shell-escape",
"command": "pdflatex",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "pdflatex-latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
]
},
{
"name": "pdflatex-latexmk-with-shell-escape",
"command": "latexmk",
"args": [
"--shell-escape",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
]
},
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
},
],
// 用于配置编译链
"latex-workshop.latex.recipes": [
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"name": "XeLaTeX with Shell Escape",
"tools": [
"xelatex-with-shell-escape"
]
},
{
"name": "XeLaTeX Auto",
"tools": [
"xelatex-latexmk"
]
},
{
"name": "XeLaTeX Auto with Shell Escape",
"tools": [
"xelatex-latexmk-with-shell-escape"
]
},
{
"name": "PDFLaTeX",
"tools": [
"pdflatex"
]
},
{
"name": "XeLaTeX -> BibTeX -> XeLaTeX*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
},
{
"name": "PDFLaTeX with Shell Escape",
"tools": [
"pdflatex-with-shell-escape"
]
},
{
"name": "PDFLaTeX Auto",
"tools": [
"pdflatex-latexmk"
]
},
{
"name": "PDFLaTeX Auto with Shell Escape",
"tools": [
"pdflatex-latexmk-with-shell-escape"
]
},
{
"name": "PDFLaTeX -> BibTeX -> PDFLaTeX*2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"name": "BibTeX",
"tools": [
"bibtex"
]
},
],
// .aux 文件跟引用有关系,最好不要清理,不用引用可以清理\ref{}
//文件清理。此属性必须是字符串数组
"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"
],
//设置为onFaild 在构建失败后清除辅助文件
"latex-workshop.latex.autoClean.run": "onFailed",
// 使用上次的recipe编译组合
"latex-workshop.latex.recipe.default": "lastUsed",
// 用于反向同步的内部查看器的键绑定。ctrl/cmd +点击(默认)或双击
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
//右键菜单
"latex-workshop.showContextMenu": true,
//从使用的包中自动补全命令和环境
"latex-workshop.intellisense.package.enabled": true,
"[latex]": {
"editor.formatOnPaste": false, //针对某种语言,配置替代编辑器设置
"editor.suggestSelection": "recentlyUsedByPrefix" //控制在建议列表中如何预先选择建议。recentlyUsedByPrefix: 根据之前补全过的建议的前缀来进行选择。例如,co -> console、con -> const。
},
}
五、IEEE-Latex-Template
链接:https://pan.baidu.com/s/17kRv0DcQbPEfXFkR2k1HVg?pwd=lj44
提取码:lj44