LaTeX预编译技术
目录:
参考的文章
待解决的问题
- 无法让报错信息同步到VSC
- 无法使用xelatex,会报错。
我的VSC配置
其中编译相关代码在setting.json的23-133行"latex-workshop.latex.tools"
和"latex-workshop.latex.recipes"
项。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "DavidAnson.vscode-markdownlint", | |
"name": "vscode-markdownlint", | |
"publisher": "DavidAnson", | |
"version": "0.37.2" | |
}, | |
{ | |
"id": "donjayamanne.githistory", | |
"name": "githistory", | |
"publisher": "donjayamanne", | |
"version": "0.6.14" | |
}, | |
{ | |
"id": "James-Yu.latex-workshop", | |
"name": "latex-workshop", | |
"publisher": "James-Yu", | |
"version": "8.14.0" | |
}, | |
{ | |
"id": "MS-CEINTL.vscode-language-pack-zh-hans", | |
"name": "vscode-language-pack-zh-hans", | |
"publisher": "MS-CEINTL", | |
"version": "1.51.2" | |
}, | |
{ | |
"id": "ms-python.python", | |
"name": "python", | |
"publisher": "ms-python", | |
"version": "2020.11.371526539" | |
}, | |
{ | |
"id": "ms-toolsai.jupyter", | |
"name": "jupyter", | |
"publisher": "ms-toolsai", | |
"version": "2020.11.372831992" | |
}, | |
{ | |
"id": "ms-vscode-remote.remote-wsl", | |
"name": "remote-wsl", | |
"publisher": "ms-vscode-remote", | |
"version": "0.51.4" | |
}, | |
{ | |
"id": "ms-vscode.cpptools", | |
"name": "cpptools", | |
"publisher": "ms-vscode", | |
"version": "1.1.2" | |
}, | |
{ | |
"id": "ms-vscode.powershell", | |
"name": "powershell", | |
"publisher": "ms-vscode", | |
"version": "2020.6.0" | |
}, | |
{ | |
"id": "nonoroazoro.syncing", | |
"name": "syncing", | |
"publisher": "nonoroazoro", | |
"version": "3.1.0" | |
}, | |
{ | |
"id": "shigma.vscode-wl", | |
"name": "vscode-wl", | |
"publisher": "shigma", | |
"version": "1.7.3" | |
}, | |
{ | |
"id": "streetsidesoftware.code-spell-checker", | |
"name": "code-spell-checker", | |
"publisher": "streetsidesoftware", | |
"version": "1.10.0" | |
}, | |
{ | |
"id": "VisualStudioExptTeam.vscodeintellicode", | |
"name": "vscodeintellicode", | |
"publisher": "VisualStudioExptTeam", | |
"version": "1.2.10" | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"files.autoSave": "afterDelay", | |
"files.associations": { | |
"*.make": "makefile" | |
}, | |
"editor.multiCursorModifier": "alt", | |
"editor.suggestSelection": "first", | |
"editor.acceptSuggestionOnEnter": "smart", | |
"editor.insertSpaces": false, | |
"editor.wordWrap": "on", | |
"workbench.activityBar.visible": true, | |
"extensions.showRecommendationsOnlyOnDemand": true, | |
"git.autofetch": true, | |
"git.enableSmartCommit": true, | |
"git.confirmSync": false, | |
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", | |
"python.languageServer": "Microsoft", | |
"C_Cpp.intelliSenseCacheSize": 512, | |
"window.zoomLevel": 0, | |
"diffEditor.ignoreTrimWhitespace": true, | |
"latex-workshop.view.pdf.viewer": "external", | |
"latex-workshop.view.pdf.external.viewer.command": "D:/Program Files/PDF相关/SumatraPDF-3.2-64/SumatraPDF-3.2-64.exe", | |
"latex-workshop.view.pdf.external.viewer.args":[ | |
"-inverse-search", | |
"code.cmd -r -g \"%f\":%l", | |
"%PDF%" | |
], | |
"latex-workshop.view.pdf.external.synctex.command": "D:/Program Files/PDF相关/SumatraPDF-3.2-64/SumatraPDF-3.2-64.exe", | |
"latex-workshop.view.pdf.external.synctex.args": [ | |
"-forward-search", | |
"%TEX%", | |
"%LINE%", | |
"%PDF%" | |
], | |
"latex-workshop.view.pdf.internal.synctex.keybinding": "double-click", | |
"latex-workshop.intellisense.package.enabled": true, | |
"latex-workshop.intellisense.unimathsymbols.enabled": true, | |
"latex-workshop.latex.tools": [ | |
{ | |
// 编译工具和命令 | |
"name": "xelatex", | |
"command": "xelatex", | |
"args": [ | |
"-synctex=1", | |
"-interaction=nonstopmode", | |
"-file-line-error", | |
"-pdf", | |
"%DOCFILE%" | |
] | |
}, | |
{ | |
"name": "pdflatex", | |
"command": "pdflatex", | |
"args": [ | |
"-synctex=1", | |
"-interaction=nonstopmode", | |
"-file-line-error", | |
"%DOCFILE%" | |
] | |
}, | |
{ | |
"name": "pdflatex-precompile", | |
"command": "pdflatex", | |
"args": [ | |
"-ini", | |
"-jobname=\"cfg\"", | |
"-interaction=nonstopmode", | |
"&pdflatex mylatexformat.ltx", | |
"%DOCFILE%.tex" | |
] | |
}, | |
{ | |
"name": "pdflatex-later-compile", | |
"command": "pdflatex", | |
"args": [ | |
"-interaction=nonstopmode", | |
"%DOCFILE%" | |
] | |
}, | |
{ | |
"name": "latexmk", | |
"command": "wsl latexmk", | |
"args": [ | |
"-xelatex", | |
"-synctex=1", | |
"-interaction=nonstopmode", | |
"-file-line-error", | |
"-logfilewarninglist", | |
"%DOCFILE%" | |
] | |
}, | |
{ | |
"name": "bibtex", | |
"command": "bibtex", | |
"args": [ | |
"%DOCFILE%" | |
] | |
}, | |
{ | |
"name": "TeXLive Install-on-fly", | |
"command": "texliveonfly", | |
"args": [ | |
"--compiler=xelatex", | |
"%DOCFILE%" | |
] | |
} | |
], | |
"latex-workshop.latex.recipes": [ | |
{ | |
"name": "latexmk", | |
"tools": [ | |
"latexmk" | |
] | |
}, | |
{ | |
"name": "xelatex", | |
"tools": [ | |
"xelatex" | |
] | |
}, | |
{ | |
"name": "xe->bib->xe->xe", | |
"tools": [ | |
"xelatex", | |
"bibtex", | |
"xelatex", | |
"xelatex" | |
] | |
}, | |
{ | |
"name": "pdf precompile", | |
"tools": [ | |
"pdflatex-precompile" | |
] | |
}, | |
{ | |
"name": "pdf later compile", | |
"tools": [ | |
"pdflatex", | |
"bibtex", | |
"pdflatex", | |
"pdflatex" | |
] | |
} | |
], | |
"latex-workshop.intellisense.file.base": "file relative", | |
"cSpell.userWords": [ | |
"Chengyang", | |
"Qian", | |
"SJTU", | |
"extremal", | |
"infimum", | |
"injective", | |
"nilpotent", | |
"nonnegatively", | |
"nonsingular", | |
"semigroup", | |
"submatrix", | |
"submodule", | |
"subring", | |
"supremum", | |
"surjective", | |
"unassociative", | |
"unrooted" | |
], | |
"explorer.confirmDelete": false, | |
"editor.renderControlCharacters": false, | |
"python.defaultInterpreterPath": "C:\\Program Files\\Python38\\python.exe", | |
"latex-workshop.latex.autoBuild.interval": 2000, | |
"jupyter.jupyterServerType": "local", | |
"jupyter.sendSelectionToInteractiveWindow": true, | |
"cSpell.enableFiletypes": [ | |
"!python" | |
], | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Place your snippets for latex here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// 1,2 for tab stops, 0forthefinalcursorposition,and{1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "prefix": "log", | |
// "body": [ | |
// "console.log('$1');", | |
// "$2" | |
// ], | |
// "description": "Log output to console" | |
// } | |
"Insert a begin-end pair": { | |
"prefix": "beg", | |
"body": [ | |
"\\begin{$1}", | |
"\t$0", | |
"\\end{$1}" | |
], | |
"description": "插入begin-end对\nInsert a begin-end pair" | |
}, | |
"Insert a pmatrix environment": { | |
"prefix": "BPM", | |
"body": [ | |
"\\begin{pmatrix}", | |
"\t$0", | |
"\\end{pmatrix}" | |
], | |
"description": "插入pmatrix环境" | |
}, | |
"Insert a proof environment": { | |
"prefix": "BPR", | |
"body": [ | |
"\\begin{proof}", | |
"\t$0", | |
"\\end{proof}" | |
], | |
"description": "插入proof环境" | |
}, | |
"Init code": { | |
"prefix": "INIT", | |
"body": [ | |
"\\documentclass[a4paper,10pt]{article}", | |
"% \\pagestyle{plain} % 文档样式; empty则底部不放置页码.", | |
"", | |
"% Basic Packages", | |
"\\usepackage{amsmath,amsthm,amsfonts,amssymb,mathtools}", | |
"", | |
"% Label, Link", | |
"\\usepackage[colorlinks]{hyperref}", | |
"\\usepackage[capitalize]{cleveref}", | |
"\\usepackage[notref,notcite]{showkeys} % 文档格式为final时自动禁用", | |
"\\usepackage{url}", | |
"\\newcommand{\\email}[1]{\\href{mailto:#1}{\\nolinkurl{#1}}}", | |
"\\newcommand{\\OEIS}[1]{\\href{http://oeis.org/#1}{\\nolinkurl{#1}}}", | |
"\\newcommand{\\doi}[1]{\\textsc{doi}: \\href{http://dx.doi.org/#1}{\\nolinkurl{#1}}}", | |
"", | |
"% Graph", | |
"\\usepackage{tikz}", | |
"\\usetikzlibrary{calc}", | |
"\\usetikzlibrary{positioning}", | |
"% \\usepackage{graphicx}", | |
"% \\usepackage{subcaption} % 支持子图", | |
"", | |
"% Fonts", | |
"% \\usepackage{mathrsfs} % 花体 \\mathscr", | |
"% \\usepackage{bbm} % 空心体 \\mathbbm", | |
"% \\usepackage{dsfont} % 空心体 \\mathds", | |
"", | |
"% Other packages", | |
"% \\usepackage{ifthen} % 支持条件判断", | |
"\\usepackage[toc,pages]{appendix} % 支持附录", | |
"% \\usepackage[scheme=plain]{ctex}", | |
"", | |
"% New commands", | |
"\\newcommand{\\eqgap}{\\;\\phantom{=}\\;} % 在align环境中对齐使用", | |
"", | |
"% Environments", | |
"\\theoremstyle{plain}", | |
"\\newtheorem{theorem}{Theorem}[section]", | |
"\\newtheorem{corollary}[theorem]{Corollary}", | |
"\\newtheorem{lemma}[theorem]{Lemma}", | |
"\\theoremstyle{definition}", | |
"\\newtheorem{definition}[theorem]{Definition}", | |
"\\newtheorem{example}[theorem]{Example}", | |
"\\theoremstyle{remark}", | |
"\\newtheorem{remark}[theorem]{Remark}", | |
"\\newtheorem{conjecture}[theorem]{Conjecture}", | |
"\\crefname{conjecture}{conjecture}{conjectures}", | |
"", | |
"% Change margin", | |
"% % Method 1", | |
"% \\addtolength{\\oddsidemargin}{-.875in}", | |
"% \\addtolength{\\evensidemargin}{-.875in}", | |
"% \\addtolength{\\textwidth}{1.75in}", | |
"% \\addtolength{\\topmargin}{-.875in}", | |
"% \\addtolength{\\textheight}{1.75in}", | |
"% Method 2", | |
"\\usepackage{geometry}", | |
"\\geometry{a4paper,scale=0.8}", | |
"", | |
"\\begin{document}", | |
"\t$0", | |
"\\end{document}" | |
], | |
"description": "初始代码" | |
}, | |
"text{if}": { | |
"prefix": "TIF", | |
"body": "\\text{if } $0", | |
"description": "插入\\text{if }" | |
}, | |
"text{otherwise}": { | |
"prefix": "TOTH", | |
"body": "\\text{otherwise}$0", | |
"description": "插入\\text{otherwise}" | |
} | |
} |