安装
下载地址https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/
选择texlive.iso
下载后点击texlive.iso, 选择install-tl进行安装
- 验证安装结果
latex --version
正常情况类似输出
pdfTeX 3.141592653-2.6-1.40.29 (TeX Live 2026)
kpathsea version 6.4.2
Copyright 2026 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.55; using libpng 1.6.55
Compiled with zlib 1.3.2; using zlib 1.3.2
Compiled with xpdf version 4.06
配置
VSCode中安装LaTeX Workshop插件, settings.json配置参考:
注意修改为自己实际安装路径
// LaTeX编译器配置
"latex-workshop.latex.tools": [
{
"name": "pdflatex",
"command": "参考实际安装pdflatex.exe路径",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "xelatex",
"command": "参考实际安装xelatex.exe路径",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "参考实际安装bibtex.exe路径",
"args": [
"%DOCFILE%"
]
}
],
// 编译链配置(优先xelatex, 支持中文)
"latex-workshop.latex.recipes": [
{
"name": "XeLaTeX",
"tools": [
"xelatex"
]
},
{
"name": "XeLaTeX -> BibTeX -> XeLaTeX*2",
"tools": [
"xelatex",
"bibtex",
"xelatex",
"xelatex"
]
}
],
// 保存时自动编译
"latex-workshop.latex.autoBuild.run": "onSave",
// 内置PDF预览(无需额外软件)
"latex-workshop.view.pdf.viewer": "tab",
// 编译后清理临时文件
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.log"
]
创建
VSCode中创建新文件夹, 创建test.tex文件, 粘贴
\documentclass{article}
% 引入中文支持宏包
\usepackage{ctex}
% 文档标题、作者、日期
\title{LaTeX测试文档}
\author{dmjcb}
\date{\today}
\begin{document}
\maketitle
\section{一级标题}
这是中文测试内容, LaTeX安装成功!
\subsection{二级标题}
数学公式测试: $E=mc^2$
\end{document}
使用ctrl + s 保持, 正常情况会自动编译, 生成PDF
上篇大模型