3.8 KiB
title, icon, createTime, permalink
| title | icon | createTime | permalink |
|---|---|---|---|
| Mathematical Formulas | tabler:math | 2025/11/29 21:36:22 | /en/guide/markdown/math/ |
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
Usage
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-to
npm i @mathjax/src
:::
Syntax
Inline Syntax
Use $ to wrap mathematical formulas (i.e., write the mathematical formula between two $ symbols)
::: demo markdown title="Inline Mode" expanded
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
$$
:::demo markdown title="Block Mode" expanded
$$
\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
TeX Tutorial{.readmore} TeX Cheat Sheet{.readmore}
KaTeX
KaTeX Supported Features{.readmore} KaTeX Support Table{.readmore}
MathJax
Supported TeX / KaTeX Commands{.readmore}
Configuration Options
:::: field-group ::: field name="type" type="'katex' | 'mathjax'" default="'katex'"
Package used to render \TeX content.
'katex': Use KaTeX'mathjax': Use MathJax ::: :::field name="delimiters" type="'brackets' | 'dollars' | 'all'" default="'dollars'" optional 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:
:::: field-group ::: field name="copy" type="boolean" optional default="false" Whether to enable the copy extension. ::: ::: field name="mhchem" type="boolean" optional default="false" Whether to enable the mhchem extension. ::: ::::
Using MathJax
When using MathJax, you can set:
:::: field-group :::field name="tex" type="object" optional Options passed to the TeX input parser. ::: ::: field name="output" type="'svg' | 'chtml'" default="'svg'" optional Output format, either SVG or Common HTML. ::: ::: field name="chtml" type="object" optional Options passed to the Common HTML output parser. ::: ::: field name="svg" type="object" optional Options passed to the SVG output parser. ::: ::::