introduction原创
用于生成复杂表格和数学公式以及各类图形的排版。
# 安装
# win10
Tex Live 官方下载 (opens new window)
Tex Live 官方iso下载 (opens new window)
ISO下载完成后直接解压,运行其中的
TeXstudio 官方下载 (opens new window) 我用CSCODE
TeXstudio 官方下载 win (opens new window) 我用CSCODE
# mac
MacTeX (opens new window)下载安装包,5G左右。
brew install (opens new window)
brew install --cask mactex
警告
国内建议还是直接去官网下载安装吧,不然 brew
网络问题引起各种麻烦!!!
# 编辑器
# vscode
# 插件
LaTeX Workshop
使用 VSCode 写 LaTeX 的都会使用这个扩展,可以认为是必备。
mac 配置
::: datails
settings.json 添加下列配置"latex-workshop.latex.tools": [ //latex 编译工具命令 { "name": "xelatex", "command": "xelatex",// 程序在电脑中的位置 绝对路径 "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-no-pdf", // 不生成PDF "%DOCFILE%" ] }, { "name": "pdflatex", "command": "pdflatex",// 程序在电脑中的位置 绝对路径 "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-output-format=dvi", "%DOCFILE%" ] }, { "name": "bibtex", "command": "bibtex",// 程序在电脑中的位置 绝对路径 "args": [ "%DOCFILE%" ] }, // 使用 dvisvgm 生成 SVG { "name": "dvisvgm", "command": "dvisvgm",// 程序在电脑中的位置 绝对路径 "args": [ // "--synctex=1", "--zoom=1", "--exact", // "--font-format=woff", "%DOCFILE%.xdv" ] },
],
// latex 编译方式 顺序
"latex-workshop.latex.recipes": [
// {
// "name": "xelatex",
// "tools": [
// "xelatex"
// ],
// },
// {
// "name": "pdflatex",
// "tools": [
// "pdflatex",
// ]
// },
// 使用 dvisvgm 将DVI转为 SVG
{
"name": "xdv->svg",
"tools": [
"xelatex",
"pdflatex",
"dvisvgm"
]
},
// {
// "name": "xe->bib->xe->xe",
// "tools": [
// "xelatex",
// "bibtex",
// "xelatex",
// "xelatex"
// ]
// },
// {
// "name": "pdf->bib->pdf->pdf",
// "tools": [
// "pdflatex",
// "bibtex",
// "pdflatex",
// "pdflatex"
// ]
// },
],
"bracketPairColorizer.depreciation-notice": false,
"latex-workshop.view.pdf.viewer": "browser",
"latex-workshop.view.svg.viewer": "browser",
"latex-workshop.showContextMenu": true, // 添加右键菜单
"explorer.confirmDelete": false,
"workbench.startupEditor": "none",
// "explorer.confirmDelete": false,
// "latex-workshop.view.pdf.viewer": "external",
// "latex-workshop.view.pdf.external.viewer.command": "C:/.../SumatraPDF.exe",
// "latex-workshop.view.pdf.external.viewer.args": [
// "-forward-search",
// "%TEX%",
// "%LINE%",
// "-reuse-instance",
// "-inverse-search",
// ""C:/.../Microsoft VS Code/Code.exe" "C:/.../Microsoft VS Code/resources/app/out/cli.js" -gr "%f":"%l"",
// "%PDF%"
// ],
// "latex-workshop.view.pdf.external.synctex.command": "C:/.../SumatraPDF.exe",
// "latex-workshop.view.pdf.external.synctex.args": [
// "-forward-search",
// "%TEX%",
// "%LINE%",
// "-reuse-instance",
// "-inverse-search",
// ""C:/.../Microsoft VS Code/Code.exe" "C:/.../Microsoft VS Code/resources/app/out/cli.js" -gr "%f":"%l"",
// "%PDF%",
// ],
```
:::
win 配置
:::datails
settings.json
添加下列配置。该配置为 使用dvisvgm
将DVI
转为SVG
。// "latex-workshop.latex.autoBuild.run": "never",// 取消保存的时候自动编译 // "latex-workshop.message.error.show": false, // 编译出错时弹窗取消 // "latex-workshop.message.warning.show": false,// 编译警告时弹窗取消 "latex-workshop.latex.tools": [ //latex 编译工具命令 { "name": "xelatex", "command": "C:/texlive/2021/bin/win32/xelatex.exe",// 程序在电脑中的位置 绝对路径 "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-no-pdf", // 不生成PDF "%DOCFILE%" ] }, { "name": "pdflatex", "command": "C:/texlive/2021/bin/win32/pdflatex.exe",// 程序在电脑中的位置 绝对路径 "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-output-format=dvi",// 生成 dvi文件 "%DOCFILE%" ] }, { "name": "bibtex", "command": "C:/texlive/2021/bin/win32/bibtex.exe",// 程序在电脑中的位置 绝对路径 "args": [ "%DOCFILE%" ] }, // 使用 dvisvgm 生成 SVG { "name": "dvisvgm", "command": "C:/texlive/2021/bin/win32/dvisvgm.exe",// 程序在电脑中的位置 绝对路径 "args": [ // "--synctex=1", "--zoom=1", "--exact", // "--font-format=woff", "%DOCFILE%.xdv" ] },
],
// latex 编译方式 顺序
"latex-workshop.latex.recipes": [
// {
// "name": "xelatex",
// "tools": [
// "xelatex"
// ],
// },
// {
// "name": "pdflatex",
// "tools": [
// "pdflatex",
// ]
// },
// 使用 dvisvgm 将DVI转为 SVG
{
"name": "xdv->svg",
"tools": [
"xelatex",
"pdflatex",
"dvisvgm"
]
},
// {
// "name": "xe->bib->xe->xe",
// "tools": [
// "xelatex",
// "bibtex",
// "xelatex",
// "xelatex"
// ]
// },
// {
// "name": "pdf->bib->pdf->pdf",
// "tools": [
// "pdflatex",
// "bibtex",
// "pdflatex",
// "pdflatex"
// ]
// },
],
"bracketPairColorizer.depreciation-notice": false,
"latex-workshop.view.pdf.viewer": "browser", // 使用浏览器浏览 PDF文件
"latex-workshop.view.svg.viewer": "browser", // 使用浏览器浏览 PDF文件
// "explorer.confirmDelete": false,
// "latex-workshop.view.pdf.viewer": "external",
// "latex-workshop.view.pdf.external.viewer.command": "C:/.../SumatraPDF.exe",
// "latex-workshop.view.pdf.external.viewer.args": [
// "-forward-search",
// "%TEX%",
// "%LINE%",
// "-reuse-instance",
// "-inverse-search",
// "\"C:/.../Microsoft VS Code/Code.exe\" \"C:/.../Microsoft VS Code/resources/app/out/cli.js\" -gr \"%f\":\"%l\"",
// "%PDF%"
// ],
// "latex-workshop.view.pdf.external.synctex.command": "C:/.../SumatraPDF.exe",
// "latex-workshop.view.pdf.external.synctex.args": [
// "-forward-search",
// "%TEX%",
// "%LINE%",
// "-reuse-instance",
// "-inverse-search",
// "\"C:/.../Microsoft VS Code/Code.exe\" \"C:/.../Microsoft VS Code/resources/app/out/cli.js\" -gr \"%f\":\"%l\"",
// "%PDF%",
// ],
```
:::
LaTeX Utilities
字数统计
片段补全
格式化的粘贴
Unicode 字符 LaTeX 字符(如 "is this...a test" ``is this\ldots a test'')
粘贴表格单元格 表式
粘贴图片,可定制模板
粘贴CSV/图片的位置,使其包含在其中。
TikZ 预览
s
# LaTeX language support
# LaTeX Workshop
# 错误处理
# MAC
- ! LaTeX Error: File `standalone.cls' not found.
s - sear
# 常用字符表
语法 | Display | 语法 | Display | 语法 | Display | 语法 | Display |
---|---|---|---|---|---|---|---|
\times | \div | \pm | \mp | ||||
\otimes | \ominus | \oplus | \odot | ||||
\oslash | \triangleq | \ne | \equiv | ||||
\lt | \gt | \le | \ge | ||||
\cup | \cap | \Cup | \Cap | ||||
\bigcup | \bigcap | \ast | \star | ||||
\bigotimes | \bigoplus | \circ | \bullet | ||||
\bigcirc | \amalg | \to | \infty | ||||
\vee | \wedge | \lhd | \rhd | ||||
\bigvee | \bigwedge | \unlhd | \unrhd | ||||
\sqcap | \sqcup | \prec | \succ | ||||
\subset | \supset | \sim | \approx | ||||
\subseteq | \supseteq | \cong | \doteq | ||||
\setminus | \mid | \ll | \gg | ||||
\parallel | \Join | \in | \notin | ||||
\propto | \neg | \ldots | $ldots$ | \cdots | |||
\forall | \exists | \vdots | \ddots | ||||
\aleph | \nabla | \imath | \jmath | ||||
\ell | \partial | \int | \oint | ||||
\uplus | \biguplus |
# 常用公式
# 一元二次方程
公式
解
$$x={\frac{-b \pm \sqrt{b^2-4ac}}{2a}} \qquad\qquad\qquad x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$
# 方程组
左花括号
$$f(x) =\begin{equation} % \begin{equation*} 加'*'去掉公式编号 \left\{ \begin{aligned} %请使用'aligned'或'align*' 2x + y &= 1 \\ %加'&'指定对齐位置 2x + 2y &= 2 \end{aligned} \right. \end{equation} % \end{equation*} 加'*'去掉公式编号$$
显示如下:
分情况讨论
``` $$f(x) = \begin{cases} % cases 用于分段函数 x^2 \qquad & a \gt 0 \\ e^x \qquad & a \le 0 \end{cases} $$ ``` 显示如下: $$f(x) = \begin{cases} x^2 \qquad & a \gt 0 \\ e^x \qquad & a \le 0 \end{cases} $$
# 矩阵
无符号
``` $$ \begin{array}{ccc} x_1 & x_2 &\dots\\ x_3 & x_4 &\dots\\ \vdots&\vdots&\ddots \end{array} $$ ``` 显示如下: $$ \begin{array}{ccc} x_1 & x_2 &\dots\\ x_3 & x_4 &\dots\\ \vdots&\vdots&\ddots \end{array} $$
有符号
小括号 ``` $$ \begin{pmatrix} a & b\\ c & d \\ \end{pmatrix} $$ ```
显示如下
$$
\begin{pmatrix}
a & b\
c & d \
\end{pmatrix}
$$
---
中括号
```
$$
\begin{pmatrix}
a & b\\
c & d \\
\end{pmatrix}
$$
```
显示如下
$$
\begin{pmatrix}
a & b\
c & d \
\end{pmatrix}
$$
---
花括号
```
$$
\begin{Bmatrix}
a & b\\
c & d \\
\end{Bmatrix}
$$
```
显示如下
$$
\begin{Bmatrix}
a & b\
c & d \
\end{Bmatrix}
$$
---
单竖线
```
$$
\begin{vmatrix}
a & b\\
c & d \\
\end{vmatrix}
$$
```
显示如下
$$
\begin{vmatrix}
a & b\
c & d \
\end{vmatrix}
$$
---
双竖线
```
$$
\begin{Vmatrix}
a & b\\
c & d \\
\end{Vmatrix}
$$
```
显示如下:
$$
\begin{Vmatrix}
a & b\\
c & d \\
\end{Vmatrix}
$$
- s
# 其他
语法 | 显示 | 语法 | 显示 |
---|---|---|---|
\triangleleft | \triangleleft | ||
\bigtriangleup | \bigtriangledown | ||
\uparrow | \downarrow | ||
\Uparrow | \Downarrow | ||
\leftarrow | \rightarrow | ||
\Leftarrow | \Rightarrow | ||
\longleftarrow | \longrightarrow | ||
\Longleftarrow | \Longrightarrow | ||
\leftrightarrow | \Leftrightarrow | ||
\Longleftrightarrow | \Longleftrightarrow | ||
\leftharpoonup | \leftharpoonup | ||
\leftharpoondown | \rightharpoondown | ||
\rightleftharpoons | \sum | ||
\nwarrow | \nearrow | ||
\swarrow | \searrow | ||
\triangle | \box | ||
\diamond | \diamondsuit | ||
\heartsuit | \heartsuit | ||
\spadesuit | |||
\overline{} | \underline{} | ||
\tilde{} | \widetilde{} | ||
\hat{} | \widehat{} | ||
\overleftarrow{} | \overrightarrow{} | ||
\vec{} | \bar{} |