# TeX

Let the Markdown file in your VuePress site support the $T\phantom{\rule{-.14em}{0ex}}E\phantom{\rule{-.115em}{0ex}}X$ syntax.

## # Config

// .vuepress/config.ts
import { defineUserConfig } from "vuepress";
import { hopeTheme } from "vuepress-theme-hope";

export default defineUserConfig({
theme: hopeTheme({
plugins: {
mdEnhance: {
// Enable Tex Support using katex
katex: true,
// Enable Tex Support using mathjax
mathjax: true,
},
},
}),
});


You can only enable ONE of them, and katex has a higher priority.

## # Syntax

• Inline mode: $xxx$

• Display mode:

$$xxx$$

$$xxx$$


Escaping

Escaping can be done by using \ before the $ character, or adding space both before and after the $ character:

• The $a=1$ is a TeX equation, while $a=1$ and $a=1$ is not.
- The $a=1$ is a TeX equation, while $a=1$ and \$a=1$ is not.


## # Demo

Euler's identity ${e}^{i\pi }+1=0$ is a beautiful formula in ${\mathbb{R}}^{2}$.

Euler's identity $e^{i\pi}+1=0$ is a beautiful formula in $\mathbb{R}^2$.

$\frac{{\partial }^{r}}{\partial {\omega }^{r}}\left(\frac{{y}^{\omega }}{\omega }\right)=\left(\frac{{y}^{\omega }}{\omega }\right)\left\{\left(\mathrm{log}y{\right)}^{r}+\sum _{i=1}^{r}\frac{\left(-1{\right)}^{I}r\cdots \left(r-i+1\right)\left(\mathrm{log}y{\right)}^{ri}}{{\omega }^{i}}\right\}$
$$\frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right) = \left(\frac {y^{\omega}} {\omega}\right) \left\{(\log y)^r + \sum_{i=1}^r \frac {(-1)^ Ir \cdots (r-i+1) (\log y)^{ri}} {\omega^i} \right\}$$


## # Playground

### Output

$\frac {\partial^r} {\partial \omega^r} \left(\frac {y^{\omega}} {\omega}\right) = \left(\frac {y^{\omega}} {\omega}\right) \left\{(\log y)^r + \sum_{i=1}^r \frac {(-1)^ Ir \cdots (r-i+1) (\log y)^{ri}} {\omega^i} \right\}$

## # Support List

Katex:

Mathjax:

KaTeX

When using KaTeX, you can pass an object to katex as KatexOptions. It will be passed to KaTeX. Please see KaTeX Docsopen in new window for available options.

Also, 2 special options are supported:

• copy: enable copy extension by setting it to true.
• mhchem: enable mhchem extension by setting it to true.

Mathjax

When using mathjax, you can pass an object to mathjax.

You can set output option to either svg (default) or chtml to change between SVG and HTML output.

Also, you can set tex option which is passed to TeX input parser, and you can set chtml or svg option based on your output syntax which is passed to Common HTML output parser and SVG output parser.