Last updated on:February 18, 2023 pm
LaTeX + VSCode,新姿势增长了,奇怪的知识也增加了!
1 安装TeXlive
λ tex -v
TeX 3.14159265 (TeX Live 2019/W32TeX)
kpathsea version 6.3.1
Copyright 2019 D.E. Knuth.
There is NO warranty. Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.
2 配置VSCode
2.1 安装LaTeX-Workshop插件
2.2 设置VSCode配置文件
settings.json
{
"latex-workshop.latex.recipes": [
{
"name": "lualatex->bibtex->lualatex*2",
"tools": [
"lualatex",
"bibtex",
"lualatex",
"lualatex",
]
}
],
"latex-workshop.latex.tools": [
{
"name": "lualatex",
"command": "lualatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOCFILE%"
]
},
{
"name": "bibtex",
"command": "bibtex",
"args": [
"%DOCFILE%"
]
},
],
"latex-workshop.view.pdf.viewer": "tab",
# "latex-workshop.latex.autoBuild.run": "never"
}
2.3 使用说明
当你在VSCode编辑
.tex
格式的文件时,LaTeX-Workshop插件会开始工作编译生成pdf的指令为
Ctrl + Alt + B
Ctrl + S
保存文件的同时会默认执行编译,若想去除此机制,可以在json设置文件中的加入:"latex-workshop.latex.autoBuild.run": "never"
3 用LaTeX编译第一个pdf
新建hello.tex
文件
\documentclass{article} % 选择模版,使用Latex自带的article模版
\author{my name}
\title{Title}
\usepackage{graphicx} % 插入图片用到的宏包
\usepackage{multirow} % 插入表格用到的宏包
\begin{document}
\maketitle
\section{Hello China} China is in East Asia.
\subsection{Hello Hubei} Hubei Province is located in central China.
\subsubsection{Hello Wuhan}
\paragraph{HUST}is Huazhong University of Science and Technology.
\subparagraph{Dian Group} is a student innovation technology team.
\subsection{Test}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
t & e & s & t\\
\hline
1 & 2 & 3 & 4\\
\hline
\end{tabular}
\end{document}
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!