Caoshengzhao337 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 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 note-taking experience.Auto Equation Numbering is a plugin designed specifically for Obsidian. It fully automates equation numbering, in-text cross-referencing, and intelligent autocomplete suggestions, 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 with customizable display templates:
\label{label_name} inside a display equation to declare a unique identifier.[Eq. ()](#eq:model).Eq. () $\rightarrow$ [Eq. (2)](#eq:mlr) (International scientific paper standard)Equation () $\rightarrow$ [Equation (2)](#eq:mlr) (Full-word standard)() $\rightarrow$ [(2)](#eq:mlr) (Parentheses only)式() $\rightarrow$ [式(2)](#eq:mlr) (Chinese academic standard)xxx () $\rightarrow$ [xxx (2)](#eq:mlr) (Arbitrary custom prefix)Eq., Equation, 式, or custom xxx) is completely preserved and only the number inside parentheses (3) is updated dynamically.[式()](# or [式()](prefix: (or # followed by your prefix like #eq: or #f:) automatically triggers a floating autocomplete popup.\tag{...}), and a clean LaTeX preview snippet.Enter or click an item to instantly complete the citation link and place the cursor conveniently outside the closing parenthesis.Insert Equation Reference Link to automatically insert [式()](# and open the candidate list.Customize equation numbering styles globally or per-note to match different document formats and layout requirements:
1, 2, 3...a-1, a-2... under 1st # chapter, resetting to b-1, b-2... under 2nd # chapter.A-1, A-2...2.1, 2.2...(2-1), (2-2)...* will be replaced with formula index, and a / {ch} with chapter letters (a-z).list-ordered) or command palette.refresh-cw ribbon button to trigger instant numbering and reference synchronization on the active note.🔢 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.
[Eq. ()](#eq: triggers the autocomplete popup with eq:mlr listed at the top.Enter, it completes to [Eq. ()](#eq:mlr).[Eq. (1)](#eq:mlr).2, updating the document will automatically sync the in-text link to [Eq. (2)](#eq:mlr):$$
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/ and create a folder named obsidian-auto-equation-numbering.main.js, manifest.json, and styles.css 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}。$...$)和 Markdown 代码块(如 ``` 块内代码)进行任何处理,保证源码安全。支持 LaTeX 风格的公式标签声明与正文内的链接引用,并支持灵活定制引用前缀模板:
\label{label_name} 声明唯一标识符。[Eq. ()](#eq:model) 或 [式()](#eq:model)。Eq. () $\rightarrow$ [Eq. (2)](#eq:mlr)(国际期刊英文标准缩写)Equation () $\rightarrow$ [Equation (2)](#eq:mlr)(英文全称规范)() $\rightarrow$ [(2)](#eq:mlr)(纯括号极简风格)式() $\rightarrow$ [式(2)](#eq:mlr)(中文学术规范)xxx () $\rightarrow$ [xxx (2)](#eq:mlr)(支持任意自定义前缀词)Eq.、Equation、式 或自定义的 xxx)将完整保留,仅括号内的数字动态更新为 (3)。[式()](# 或 [式()](prefix:(或 # 紧跟标签前缀如 #eq:、#f:)时,自动弹出悬浮候选框。f:model)、当前公式编号 Tag(如 a-14)以及精简的 LaTeX 公式代码预览。Enter 键即可自动补全引用标识符,并智能将光标移至括号外,书写行云流水。Insert Equation Reference Link(可绑定快捷键),一键自动键入 [式()](# 并唤醒候选弹窗。支持全局或单篇笔记独立的公式编号样式定制,满足不同文档与排版规范的要求:
1、2、3...# 第一章 下采用 a-1a-n,# 第二章 下自动重编号为 b-1b-n,以此类推。A-1、A-2...2.1、2.2...(2-1), (2-2)...* 被替换为序号,a 或 {ch} 被替换为大章节字母(a-z)。list-ordered)或通过命令栏打开。refresh-cw 快捷更新按钮,轻点一下即可瞬间更新当前笔记的全部公式编号与正文引用。🔢 状态指示与快捷开关,随时切换当前笔记的自动编号状态。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)所示,我们建立了多元线性回归模型。
如[式()](#eq: 时,弹出候选框并推荐 eq:mlr。如[式()](#eq:mlr)。[式(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、styles.css 复制到该文件夹中。本地开发调试时,可在本目录执行以下命令监听文件变化并自动重新编译:
npm run dev
\tag{...}。若文档中存在手动写入的 \tag,在执行更新时会被插件的自动编号逻辑覆盖。\label{...} 抛出解析异常,插件在重写公式时会为其自动添加 % 前缀(即重写为 % \label{...})。该处理仅在渲染层面避免报错,不影响插件对标识符的提取与交叉引用更新。