1 下载安装texlive
使用清华镜像源,选择一个.iso文件进行下载清华镜像
也可以使用官方的安装包,下载window安装包链接
双击bat文件进行安装
修改路径,点击advance-Customize,修改安装的语言,只选择英语和中文即可
安装完成后添加一下环境变量,找到系统高级设置-环境变量-用户变量Path,添加上你安装的texlive路径
E:\texlive\2024\bin\windows
打开cmd输入
tex -v
查看安装的版本如果有显示那就是安装成功了2 配置VScode
首先下载插件latex workshop
新建一个.tex文件就会出现扩展,说明安装成功
此时我们按F1,输入
Open Settings
,打开这个选项,将下边的代码加入保存(搬运大佬的) "latex-workshop.latex.tools": [
{
"name": "latexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
]
},
{
"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",
// "command": "biber",
"args": [
// "%DOC%"
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": ["xelatex"]
},
{
"name": "latexmk",
"tools": ["latexmk"]
},
{
"name": "pdflatex -> bibtex",
"tools": ["pdflatex","bibtex"]
},
// {
// "name": "pdflatex -> bibtex -> pdflatex*2",
// "tools": [
// "pdflatex",
// "bibtex",
// "pdflatex",
// "pdflatex"
// ]
// },
{
"name": "xelatex -> bibtex -> xelatex*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],
//设置在编译完成后所需要删除的文件格式
"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.message.error.show": false,
"latex-workshop.message.warning.show": false,
"latex-workshop.showContextMenu": true, //添加LaTex Workshop右键菜单。
"latex-workshop.intellisense.package.enabled": true, //根据加载的包,自动完成命令或包。
"latex-workshop.latex.autoBuild.run": "onSave", //保存文件时自动build(也就是说,点击保存文件或者按快捷键Ctrl+S的时候,除了会保存Tex文件,还会帮你编译LaTex为Pdf。
在文件中输入一些代码,点击xlatex运行,可以看到结果.
\documentclass{article}
\begin{document}
123
你好
hello world
\end{document}
问题1 中文无法显示
在开头加入中文字体,加载宏
\usepackage{xeCJK} % 加载 xeCJK 宏包以支持中文
\setCJKmainfont{SimSun} % 设置中文字体
问题2 一行的内容无法在一页内显示
如下图所示,必须得滚动过去才能看到感觉不是很方便
vscode-文件-首选项-设置,输入
Editor: Word Wrap
,将他打开即可,这样一行里边的内容会自动换行在页面里显示