https://github.com/loglux/auto-math-for-obsidian
Auto-expand LaTeX math snippets in Obsidian โ write equations faster.
https://github.com/loglux/auto-math-for-obsidian
auto-completion latex markdown math mathematical-expressions mathematics notes obsidian-plugin productivity
Last synced: 13 days ago
JSON representation
Auto-expand LaTeX math snippets in Obsidian โ write equations faster.
- Host: GitHub
- URL: https://github.com/loglux/auto-math-for-obsidian
- Owner: loglux
- License: mit
- Created: 2025-10-16T12:16:51.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-11-17T01:04:50.000Z (7 months ago)
- Last Synced: 2025-11-17T03:07:43.567Z (7 months ago)
- Topics: auto-completion, latex, markdown, math, mathematical-expressions, mathematics, notes, obsidian-plugin, productivity
- Language: JavaScript
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## ๐ Auto Math for Obsidian
โ๏ธ **Write equations at the speed of thought โ automatic LaTeX snippet expansion for Obsidian.**
Auto Math automatically expands LaTeX-style math snippets while you type in Obsidian.
It's like a mini _LaTeX auto-completion engine_ โ lightweight, fast, and entirely local.
---
### โจ Features
- ๐น **Instant snippet expansion** โ type `\frac`, `\sqrt`, `\sum`, etc., and get ready-to-edit templates.
- ๐น **Smart Limits** โ optional contextโaware behaviour for โซ (disabled by default):
- `$โฆ$` โ compact form (`\int_{}^{}`)
- `$$โฆ$$` โ display form with limits (`\int\limits_{}^{}`)
- ๐น **Multiline templates** โ environments like `\align` expand across multiple lines with proper formatting.
- ๐น **Custom rule file** โ all expansions are stored in `.obsidian/plugins/auto-math/rules.json` (user-editable).
- ๐น **Live reload** โ changes in the rules file are applied immediately, no restart required.
- ๐น **Built-in math pack** โ includes 38 essential LaTeX commands.
- ๐น **Custom Rules Editor** โ edit triggers and expansions directly inside Obsidian settings.
- ๐น **Toggle anytime** โ quickly enable or disable with the ribbon icon or command palette.
---
### ๐ How Auto Math Differs from Other Plugins
There are several LaTeX-related plugins available for Obsidian. Here's how Auto Math compares:
| Feature | Auto Math | Latex Suite | Quick LaTeX | Completr |
|---------|-----------|-------------|-------------|----------|
| **Approach** | Instant trigger expansion | Snippets + shortcuts | Auto-completion menu | General autocomplete |
| **Triggers** | Standard LaTeX commands | Custom shortcuts | Mixed | Various |
| **Learning curve** | Minimal | Steeper | Moderate | Moderate |
| **Configuration** | Simple JSON file | Complex config | Settings UI | Multiple sources |
| **Focus** | Math snippets only | Full LaTeX workflow | LaTeX shortcuts | All text types |
| **Popup menus** | None | Optional | Yes | Yes |
#### Why choose Auto Math?
1. **No new shortcuts to learn** โ Triggers are standard LaTeX commands (`\frac`, `\sqrt`, `\int`). If you know LaTeX, you already know how to use Auto Math. Perfect for beginners learning LaTeX.
2. **Simplicity** โ Does one thing well: expand triggers instantly. No menus, no popups, no complex configuration.
3. **Predictability** โ Every trigger expands exactly the same way, every time. No magic, no surprises.
4. **Flexibility** โ All rules are stored in a simple JSON file. Edit it directly or use the built-in settings editor.
5. **Lightweight** โ Zero dependencies, minimal footprint, works entirely offline.
**Best for:** Users who want fast, predictable LaTeX snippet expansion without learning new shortcuts or dealing with complex configuration.
For detailed documentation, tutorials, and examples, visit the **[Auto Math Wiki](https://github.com/loglux/auto-math-for-obsidian/wiki)**.
---
### ๐งฎ Default Rule Pack
Auto Math v0.2.5 comes preloaded with 38 essential triggers:
#### Basic Commands
|Trigger|Expands to|
|---|---|
|`\frac`|`\frac{}{}`|
|`\dfrac`|`\dfrac{}{}`|
|`\tfrac`|`\tfrac{}{}`|
|`\cfrac`|`\cfrac{}{}`|
|`\binom`|`\binom{}{}`|
|`\dbinom`|`\dbinom{}{}`|
|`\tbinom`|`\tbinom{}{}`|
|`\text`|`\text{}`|
|`\sqrt`|`\sqrt{}`|
|`\root`|`\sqrt[]{}`|
|`\pow`|`{}^{}`|
|`\abs`|`\left\|{}\right\|`|
|`\norm`|`\left\\|{}\right\\|`|
|`\vec`|`\vec{}`|
|`\hat`|`\hat{}`|
|`\bar`|`\bar{}`|
|`\overline`|`\overline{}`|
|`\underline`|`\underline{}`|
|`^^`|`^{}`|
|`__`|`_{}`|
#### Sums, Integrals & Limits
|Trigger|Expands to|
|---|---|
|`\sum`|`\sum_{}^{}`|
|`\int`|`\int_{}^{}`|
|`\lim_`|`\lim_{}`|
|`\limsup`|`\limsup_{}`|
|`\liminf`|`\liminf_{}`|
|`\max`|`\max_{}`|
|`\min`|`\min_{}`|
|`\inf_`|`\inf_{}`|
|`\sup`|`\sup_{}`|
#### Logarithms
|Trigger|Expands to|
|---|---|
|`\log`|`\log_{}`|
#### LaTeX Environments
|Trigger|Expands to|Use case|
|---|---|---|
|`\align`|`\begin{align}...\end{align}`|Aligned equations (with numbering)|
|`\aligned`|`\begin{aligned}...\end{aligned}`|Aligned equations (no numbering)|
|`\gather`|`\begin{gather}...\end{gather}`|Centred equations|
|`\cases`|`\begin{cases}...\end{cases}`|Piecewise functions|
|`\array`|`\begin{array}{}...\end{array}`|Custom arrays|
|`\matrix`|`\begin{matrix}...\end{matrix}`|Matrix (no brackets)|
|`\pmatrix`|`\begin{pmatrix}...\end{pmatrix}`|Matrix with ( )|
|`\bmatrix`|`\begin{bmatrix}...\end{bmatrix}`|Matrix with [ ]|
|`\split`|`\begin{split}...\end{split}`|Split equations|
---
### โ๏ธ Installation
#### Manual
1. Download the latest release from the [Releases](https://github.com/loglux/auto-math-for-obsidian/releases/) page.
2. Extract the folder `auto-math` into your vault under:
```
.obsidian/plugins/auto-math/
```
3. Enable **Auto Math** in _Settings โ Community Plugins โ Installed plugins_.
4. That's it โ start typing `\frac`, `\sqrt`, `\sum` and watch them expand automatically!
---
### ๐งฐ Configuration
Open **Settings โ Auto Math** to customise:
- **Enabled** โ toggle Auto Math on/off.
- **Rules file path** โ defaults to `.obsidian/plugins/auto-math/rules.json`.
- **Smart Limits** โ contextโaware expansions for โซ (disabled by default, enable in settings if needed).
- **Reload / Create / Open** โ reload or open your external rules file.
- **Debug logs** โ show extra information in the developer console.
- **Custom Rules Editor** โ view, add, delete, filter, sort, and edit your rules interactively.
- **Save rules to file** โ writes changes to the JSON file immediately.
- **Reset to default math pack** โ restores the built-in default rule set.
---
### ๐ Multiline Maths Mode
Auto Math now supports Smart Limits in multiline `$$...$$` blocks.
**Example:**
```markdown
$$
\int x dx โ expands to \int\limits_{}^{}
$$
```
The plugin automatically scans neighbouring lines (up to 50 by default) to detect display maths context.
**Technical note:** The scan depth can be adjusted by modifying `maxScanLines` in the plugin settings file (default: 50 lines). This is stored in `.obsidian/plugins/auto-math/data.json`.
---
## LaTeX Environments
Auto Math includes snippets for common LaTeX environments. These automatically expand into multiline blocks with proper formatting.
### Example Usage
**Input:**
```markdown
$$
\align
$$
```
**Expands to:**
```markdown
$$
\begin{align}
| โ cursor here
\end{align}
$$
```
Then you can write your equations with `\\` for line breaks:
```markdown
$$
\begin{align}
x + y &= 5 \\
x &= 5 - y
\end{align}
$$
```
**Result:**
$$
\begin{align}
x + y &= 5 \\
x &= 5 - y
\end{align}
$$
---
### ๐ก Customisation Example
If you'd like to add your own expansions, open `auto-math.rules.json` and add entries like:
```json
[
{ "trigger": "\\ceil", "expand": "\\left\\lceil{}\\right\\rceil" },
{ "trigger": "\\floor", "expand": "\\left\\lfloor{}\\right\\rfloor" },
{ "trigger": "\\bmatrix", "expand": "\\begin{bmatrix}\n & \\\\\n\\end{bmatrix}" }
]
```
Then click **Reload rules now** โ your new triggers will be active instantly.
---
### ๐ชถ Notes
- The plugin works fully offline and doesn't require any external dependencies.
- Uses plain JSON and Obsidian's own vault API.
- Safe to edit while running โ changes are detected automatically.
---
## Documentation
For more details, tips, and extended explanations, check the project Wiki:
https://github.com/loglux/auto-math-for-obsidian/wiki
---
### ๐งโ๐ป Credits
Released under the MIT licence.