1. 安装 TeX Live
改位置
高级
便携式
便携式切换完成
取消勾选安装 TeXworks ,这个编辑器太老,使用 VSCOde 即可
可选择语言包(这里默认,不进行设置)
安装很慢,耐心等待,很多小文件包,目测安装不需要网络,大概花了1小时30分钟左右
经过测试,发现安装后,并不会自动配置环境变量,需要自己手动配置
设置环境变量 路径如下
1 | D:\Program Files\texlive\2022\bin\win32 |
---|
tex -v
latex -v
xelatex -v
pdflatex -v
2. 安装 VSCode 扩展: LaTeX Workshop Visual Studio Code Marketplace
参考: Settings - Install · James-Yu/LaTeX-Workshop Wiki 注意: 实测,此步可省,直接使用也可以 VSCode 设置
settings.json
"latex-workshop.view.pdf.viewer": "tab",
"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",
"args": [
"%DOCFILE%"
]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex",
"tools": [
"xelatex"
]
},
{
"name": "latexmk",
"tools": [
"latexmk"
]
},
{
"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"
]
参考: https://pastebin.com/wmkTDxv7 settings.json
"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": "PDFLaTeX",
"tools": [
"pdflatex"
]
},
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"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.recipe.default": "lastUsed",
3. LaTex 的编译测试 在本地新建一个文件夹并新建一个 .tex 结尾的文件,例如新建一个 test-latex.tex 文件,文件内容如下: test-latex.tex
\documentclass[a4paper, 11pt]{article}
\title{This is a Title}
\author{yiyun}
\date{\today}
\begin{document}
\maketitle
This is the context of the article.
\end{document}
Q&A 补充
参考: 【LaTeX】环境配置以及中文支持 - 简书 Chinese - Overleaf, 在线LaTeX编辑器
\documentclass{ctexart}
\begin{document}
\tableofcontents
\begin{abstract}
这是简介及摘要。
\end{abstract}
\section{前言}
\section{关于数学部分}
数学、中英文皆可以混排。You can intersperse math, Chinese and English (Latin script) without adding extra environments.
這是繁體中文。
\end{document}
\documentclass[a4paper, 11pt]{ctexart}
\title{中文标题}
\author{yiyun}
\date{\today}
\begin{document}
\maketitle
这是文章内容
\end{document}