TeX
About 1 min
the Markdown file in your VuePress site support the
Settings
Install related
pnpm
pnpm add -D katex
# or
pnpm add -D mathjax-full
yarn
yarn add -D katex
# or
yarn add -D mathjax-full
npm
npm i -D katex
# or
npm i -D mathjax-full
Then enabling via:
import { hopeTheme } from "vuepress-theme-hope";
export default {
theme: hopeTheme({
plugins: {
markdownMath: {
type: "katex", // or 'mathjax'
},
},
}),
};
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
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.
Demo
Inline
Euler's identity
Euler's identity $e^{i\pi}+1=0$ is a beautiful formula in $\mathbb{R}^2$.
Display
$$
\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
Input
Output
Support List
Plugin tutorial and FAQs: TeX
Katex:
Mathjax:
Using KaTeX
When using KaTeX, any other options will be passed to KaTeX as KatexOptions
. See KaTeX Docs for all available options.
Besides, 2 special options are supported:
copy
: enable copy extension or not.mhchem
: enable mhchem extension or not.
Using MathJax
When using MathJax, you can set:
tex
: options which is passed to TeX input parseroutput
: either'svg'
(default) or'chtml'
to change output format between SVG and HTML.chtml
: options which is passed to Common HTML output parsersvg
: options which is passed to SVG output parser