Mathematical Formulas
About 529 words
Overview
The theme has built-in support for mathematical formulas.
This feature is powered by @vuepress/plugin-markdown-math. You can choose to render mathematical formulas in markdown using the following methods:
katex(default)mathjax
export default defineUserConfig({
theme: plumeTheme({
markdown: {
math: {
type: 'katex', // 'katex' | 'mathjax'
// ... Other configuration options
}
},
})
})When you choose to use mathjax, you also need to install the dependency by running the following command:
npm i @mathjax/srcpnpm add @mathjax/srcyarn add @mathjax/srcSyntax
Inline Syntax
Use $ to wrap mathematical formulas (i.e., write the mathematical formula between two $ symbols)
This page's examples require the demo syntax to be enabled first
The ::: demo syntax is disabled by default. When it is not enabled, the md code blocks below are rendered as plain code blocks and no rendered output is shown.
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'
export default defineUserConfig({
theme: plumeTheme({
markdown: {
demo: true,
},
}),
})Euler's identity eiπ+1=0 is a beautiful formula in R2.
Inline Mode
Euler's identity $e^{i\pi}+1=0$ is a beautiful formula in $\mathbb{R}^2$.Block Syntax
Use $$ to wrap mathematical formulas (i.e., write the mathematical formula between two $$ symbols)
<!-- Write the mathematical formula between two `$$` symbols, rendered in a separate block -->
$$xxx$$
<!-- The two `$$` symbols can each occupy a separate line, with the mathematical formula between them -->
$$
xxx
$$∂ωr∂r(ωyω)=(ωyω){(logy)r+i=1∑rωi(−1)Ir⋯(r−i+1)(logy)ri}
Block Mode
$$
\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\}
$$Related Tutorials
TeX
KaTeX
KaTeX Supported FeaturesKaTeX Support Table
MathJax
Supported TeX / KaTeX Commands
Configuration Options
Optional
'katex' | 'mathjax'Default:'katex'
Optional
'brackets' | 'dollars' | 'all'Default:'dollars'
Enabled math delimiter syntax.
"brackets": Use\(...\)for inline math and\[...\]for display mode math (LaTeX style)"dollars": Use$...$for inline math and$$...$$for display mode math (common Markdown style)"all": Enable both bracket and dollar sign syntax
Using KaTeX
When using KaTeX, any other options will be passed to KaTeX as KatexOptions. For all available options, refer to the KaTeX documentation.
Additionally, 2 special options are supported:
Using MathJax
When using MathJax, you can set:
