Caoshengzhao53 downloadsManually toggle and update display-equation numbering per document, and reuse the first number for duplicate equations.
When writing Markdown notes with a large number of mathematical equations, you often encounter the following issues:
\tag{n} for all subsequent equations, which is highly inefficient and error-prone.As shown in Equation (3)... manually means you must search the entire note and update them one by one whenever the equation numbers change. Missing even one leads to logical confusion for both you and your readers.\label and \tag directly in Obsidian often leads to MathJax parsing errors or rendering glitches, disrupting your writing flow.Auto Equation Numbering is a plugin designed specifically for Obsidian. It fully automates equation numbering and cross-references, freeing you from tedious formatting chores so you can focus on expressing your ideas.

$$ ... $$) in your Markdown note and appends a LaTeX-compliant \tag{n} automatically.$...$) and code blocks (like ``` blocks) to ensure your source code remains safe and untouched.Supports LaTeX-style equation label declarations and in-text links:
\label{label_name} inside a display equation to declare a unique identifier.[Eq. ()](#eq:model).[Eq. (1)](#eq:model)).Customize equation numbering styles globally or per-note to match different document formats and layout requirements:
1, 2, 3...A-1, A-2...2.1, 2.2...(2-1), (2-2)...* placeholder will be replaced with the equation index.🔢 icon in the bottom-right status bar to quickly toggle auto-numbering on or off for the active note.editor.replaceRange() instead of replacing the entire file text. This prevents full-page MathJax/KaTeX re-renders and eliminates UI lag or freezing, even in extremely large notes.| Sidebar Control Panel | Status Bar Switch |
|---|---|
![]() |
![]() |
(Note: Total Toggle Switch:
)
Original text:
$$
\hat{\boldsymbol{y}}_c = \boldsymbol{X}_c\hat{\boldsymbol{\beta}}
$$
After auto-update:
$$
\hat{\boldsymbol{y}}_c = \boldsymbol{X}_c\hat{\boldsymbol{\beta}}
\tag{1}
$$
During editing:
$$
y_i = \beta_0 + \sum_{j=1}^p \beta_j x_{ij} + \varepsilon_i
\label{eq:mlr}
$$
As shown in [Eq. ()](#eq:mlr), we establish a multiple linear regression model.
After clicking "Update":
[Eq. (1)](#eq:mlr).2, updating the document will automatically sync the in-text link to [Eq. (2)](#eq:mlr).
For example:$$
y_i = \beta_0 + \sum_{j=1}^p \beta_j x_{ij} + \varepsilon_i
% \label{eq:mlr}
\tag{2}
$$
As shown in [Eq. (2)](#eq:mlr), we establish a multiple linear regression model.
npm install
npm run build
.obsidian/plugins/ folder in your Obsidian vault and create a new directory named obsidian-auto-equation-numbering.main.js, manifest.json, and styles.css from the project root into that folder.To automatically recompile the code during development, run:
npm run dev
\tag{...} tags dynamically. Any manually written \tag inside display equations will be overwritten by the auto-numbering logic when you update.\label{...}, the plugin automatically prepends a % comment prefix (rewriting it as % \label{...}) when modifying the file. This is only a workaround to prevent rendering issues in Obsidian and does not affect the plugin's ability to extract labels and update references.在撰写包含大量数学公式的 Markdown 笔记时,经常遇到以下问题:
\tag{n} 必须手动逐个修改,效率极低且极易出错。如公式 (3) 所示...,一旦前面的公式编号发生变动,必须人工搜索全文,逐一核对并修改引用。漏掉一个,就会导致读者和自己逻辑错乱。\label 和 \tag 时,常常因为 MathJax 渲染机制导致解析异常或报错,破坏写作流畅度。Auto Equation Numbering 是一款专为 Obsidian 设计的公式管理插件。它将公式编号和正文交叉引用彻底自动化,让您从繁琐的排版纠错中解放出来,专注于思路的表达。

$$ ... $$),并在末尾自动追加符合 LaTeX 规范的 \tag{n}。$...$) and Markdown 代码块(如 ``` 块内代码)进行任何处理,保证源码安全。支持 LaTeX 风格的公式标签声明与正文内的链接引用:
\label{label_name} 声明唯一标识符。[式()](#eq:model)。[式(1)](#eq:model))。支持全局或单篇笔记独立的公式编号样式定制,满足不同文档与排版规范的要求:
1、2、3...A-1、A-2...2.1、2.2...(2-1)、(2-2)...* 占位符将被替换为公式的顺序序号。🔢 状态指示与快捷开关,随时切换当前笔记的自动编号状态。editor.replaceRange() 进行局部替换,而不是粗暴地覆盖全文。这避免了整个文档的 MathJax/KaTeX 公式完全重新排版,彻底解决了大文档点击更新时的界面卡死和卡顿问题。| 侧边控制面板 | 状态栏快捷切换 |
|---|---|
![]() |
![]() |
(注:自动编号总开关:
)
原始文本:
$$
\hat{\boldsymbol{y}}_c = \boldsymbol{X}_c\hat{\boldsymbol{\beta}}
$$
自动更新后:
$$
\hat{\boldsymbol{y}}_c = \boldsymbol{X}_c\hat{\boldsymbol{\beta}}
\tag{1}
$$
编辑中的笔记内容:
$$
y_i = \beta_0 + \sum_{j=1}^p \beta_j x_{ij} + \varepsilon_i
\label{eq:mlr}
$$
如[式()](#eq:mlr)所示,我们建立了多元线性回归模型。
点击“更新(Update)”后:
[式(1)](#eq:mlr)。2,再次触发更新后,引用链接将自动同步更新为:[式(2)](#eq:mlr)。
例如:$$
y_i = \beta_0 + \sum_{j=1}^p \beta_j x_{ij} + \varepsilon_i
% \label{eq:mlr}
\tag{2}
$$
如[式(2)](#eq:mlr)所示,我们建立了多元线性回归模型。
npm install
npm run build
.obsidian/plugins/ 目录,并创建一个名为 obsidian-auto-equation-numbering 的新文件夹。main.js 以及项目中的 manifest.json 复制到该文件夹中。本地开发调试时,可在本目录执行以下命令监听文件变化并自动重新编译:
npm run dev
\tag{...}。若文档中存在手动写入的 \tag,在执行更新时会被插件的自动编号逻辑覆盖。\label{...} 抛出解析异常,插件在重写公式时会为其自动添加 % 前缀(即重写为 % \label{...})。该处理仅在渲染层面避免报错,不影响插件对标识符的提取与交叉引用更新。