VSCode配置LaTex写作环境(70%完成度)
然后就是得安装这两个插件
latex-workshop.showContextMenu
在设置页面输入上面的命令,打开激活
会在菜单内部出现
latex-workshop.view.outline.sections
是否打开大纲功能
workbench.settings.editor
在设置页面是否使用GUI或者json配置
对于一个长久要使用的工作环境,配置一个工作区时必要的
对于以上的更改,可以看到在下面的文件夹内做出了同步的修改
我们这里再把新的设置打开
latex-workshop.addtexroot
在命令板打开,选择指定的文件
如果你不想显式的设置根文件
可以使用如下的写法来隐式指派
\begin{document}
就是这样
latex-workshop.latex.search.rootFiles.include
可以再加入要解析的文件类型
扩大或者缩小选择的范围
https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile
安装wiki来说,一次写作使用一个干净的目录,然后一个main文件
当这个文件确定以后,就开始检索里面用到的各种依赖资源input,include,InputIfFileExists,subfile,import和subimport。
https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options
root检测机制要考虑的文件模式。
相对路径是从工作区文件夹计算的。为了检测根文件和 tex 文件树,我们解析.tex这里列出的所有.tex文件。\n如果你想foo递归指定目录中的所有文件,比如,以及它的所有子目录,你需要使用**/foo/**/*.tex. 如果您只想匹配.tex工作区顶层的文件,请使用*.tex
默认的文件类型
如果你引入了别的东西,可以使用这个选项去指定
这个选项是,资源有改动就触发构建
latex-workshop.latex.watch.files.ignore
因为这个东西编译一次牵扯太多,所以需要去针对性的忽略很多东西
latex-workshop.latex.recipe.default
首选的构建方式
CTRL+Alt+B是编译LaTex的项目
在这里的这些选项是编写构建文件,最重要的地方
注意在配置的时候,写明是要在哪里配置
用户的区域是全局改动,工作区是现在小范围的改动
这里选择工作区域,点击json文件
它会自动补全你要的东西
有波浪线是拼写毛病
添加一下就好
latex-workshop.latex.build.forceRecipeUsage
强制编译,这个不要开启了
我觉得没有用,日后也可以使用
这个是使用轮询来检测文件的情况,是否来编译
开始构建前的延迟
清理构建的中间文件
何时清理辅助文件
要清理的文件扩展名
何时清理中间文件
来看看重中之重
在配置的json文件里面,箭头所指是最重要的地方
我们先看看,这个是啥
懂了,是编译文件
http://www.personal.psu.edu/~jcc8/software/
官网
https://mirrors.tuna.tsinghua.edu.cn/CTAN/support/latexmk/latexmk.pdf
手册
https://mg.readthedocs.io/latexmk.html
在线文档
https://mirrors.nju.edu.cn/CTAN/support/latexmk/latexmk.txt
txt版本的在线文档
命令行执行一下,牛
% This is a small sample LaTeX input file (Version of 10 April 1994)
%
% Use this file as a model for making your own LaTeX input file.
% Everything to the right of a % is a remark to you and is ignored by LaTeX.
% The Local Guide tells how to run LaTeX.
% WARNING! Do not type any of the following 10 characters except as directed:
% & $ # % _ { } ^ ~ \
\documentclass{article} % Your input file must contain these two lines
\begin{document} % plus the \end{document} command at the end.
\section{Simple Text} % This command makes a section title.
Words are separated by one or more spaces. Paragraphs are separated by
one or more blank lines. The output is not affected by adding extra
spaces or extra blank lines to the input file.
Double quotes are typed like this: ``quoted text''.
Single quotes are typed like this: `single-quoted text'.
Long dashes are typed as three dash characters---like this.
Emphasized text is typed like this: \emph{this is emphasized}.
Bold text is typed like this: \textbf{this is bold}.
\subsection{A Warning or Two} % This command makes a subsection title.
If you get too much space after a mid-sentence period---abbreviations
like etc.\ are the common culprits)---then type a backslash followed by
a space after the period, as in this sentence.
Remember, don't type the 10 special characters (such as dollar sign and
backslash) except as directed! The following seven are printed by
typing a backslash in front of them: \$ \& \# \% \_ \{ and \}.
The manual tells how to make other symbols.
\end{document} % The input file ends with this command.
写一段稿子
大致的样子
稍等一下,自动编译中
点击文件,自动打开pdf预览
如果自动编译不生效,可以设置为保存时编译
中文文件不更新,pdf不更新等
全是打开这个开关
有中文的路径或者文件,编译效果不好的时候,使用用%DOCFILE%
代替%DOC%
自动切换侧边
在打开一个tex文件时,自动打开LaTex的扩展
关了这个设置,在内部嵌套时使用补全
在这里设置成这样,补全@片段
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
}
在配置文件内,写入的文件
大多数时候,预览pdf文件是这个快捷键
好像我没有完成自动滚动
因为pdf文件时实时更新的,但是不能太快
用这个参数控制一下刷新速度
在哪里可以找到pdf文件
默认的查看器
要预览的查看器
相关的pdf配置文件
是否有手形工具,好大个手
一些关于pdf文件的设置
众所周知,格式化是非常重要的
如果你的Tex里面支持格式化,这里是默认有东西
如果上面对你来说太复杂,你可以直接安装好插件,复制我下面的内容就可以开始你的编写任务:
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.autoSave": "onFocusChange",
"editor.mouseWheelZoom": true,
"editor.definitionLinkOpensInPeek": true,
"latex-workshop.latex.recipes": [
{
"name": "latexmk 🔃",
"tools": [
"latexmk"
]
},
{
"name": "latexmk (latexmkrc)",
"tools": [
"latexmk_rconly"
]
},
{
"name": "latexmk (lualatex)",
"tools": [
"lualatexmk"
]
},
{
"name": "pdflatex ➞ bibtex ➞ pdflatex × 2",
"tools": [
"pdflatex",
"bibtex",
"pdflatex",
"pdflatex"
]
},
{
"name": "Compile Rnw files",
"tools": [
"rnw2tex",
"latexmk"
]
},
{
"name": "Compile Jnw files",
"tools": [
"jnw2tex",
"latexmk"
]
},
{
"name": "tectonic",
"tools": [
"tectonic"
]
}
],
"cSpell.words": [
"OUTDIR",
"bibtex",
"latexmk",
"latexmkrc",
"nonstopmode",
"pdflatex",
"rconly"
],
"latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "lualatexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-lualatex",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "latexmk_rconly",
"command": "latexmk",
"args": [
"%DOC%"
],
"env": {}
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
],
"env": {}
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
],
"env": {}
},
{
"name": "rnw2tex",
"command": "Rscript",
"args": [
"-e",
"knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')"
],
"env": {}
},
{
"name": "jnw2tex",
"command": "julia",
"args": [
"-e",
"using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")"
],
"env": {}
},
{
"name": "jnw2texmintex",
"command": "julia",
"args": [
"-e",
"using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")"
],
"env": {}
},
{
"name": "tectonic",
"command": "tectonic",
"args": [
"--synctex",
"--keep-logs",
"%DOC%.tex"
],
"env": {}
}
],
"latex-workshop.latex.autoClean.run": "onBuilt",
"latex-workshop.latex.autoBuild.run": "onSave",
"latex-workshop.latex.watch.usePolling": true,
"latex-workshop.view.autoFocus.enabled": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
},
"latex-workshop.view.pdf.viewer": "tab",
"latex-workshop.view.pdf.hand": true
}
}
这份文件写入到这里启动
https://github.com/James-Yu/LaTeX-Workshop/wiki/Intellisense
更多内容可以去wiki研究