# LaTeX to Notion A Chrome extension that automatically converts LaTeX equations to Notion's native math blocks. ## Features - **Auto-convert on paste** — Paste LaTeX from anywhere (ChatGPT, Overleaf, papers) and it converts automatically - **Multiple format support** — `$$...$$`, `$...$`, `\[...\]`, `\(...\)`, `\begin{equation}`, `\begin{align}`, `\begin{gather}`, `\begin{cases}`, `\begin{aligned}` - **Undo support** — Revert the last conversion with Ctrl+Shift+Z - **Hover-to-convert** — Hover over LaTeX to see a quick convert button - **Error detection** — Alerts for KaTeX parse errors - **Keyboard shortcuts** — Quick access without clicking ## Installation 1. Download or clone this repository 2. Open Chrome and navigate to `chrome://extensions/` 3. Enable **Developer mode** (top right) 4. Click **Load unpacked** 5. Select the extension folder ## Usage ### Auto-Convert (Recommended) 1. Enable **Auto-Convert on Paste** in the popup 2. Copy LaTeX from any source 3. Paste into Notion 4. Equations convert automatically ### Manual Conversion - **Convert All** — Converts all equations on the page - **From Clipboard** — Paste and convert clipboard content - **Undo** — Revert the last conversion ### Hover-to-Convert 1. Enable in Settings 2. Hover over `$...$` or other LaTeX 3. Click the "∑ Convert" button ## Supported Formats | Format | Type | Example | |--------|------|---------| | `$$...$$` | Block | `$$\frac{a}{b}$$` | | `\[...\]` | Block | `\[\int_0^1 x dx\]` | | `\begin{equation}` | Block | `\begin{equation} E = mc^2 \end{equation}` | | `\begin{align}` | Block | `\begin{align} a &= b \\ c &= d \end{align}` | | `$...$` | Inline | `$E = mc^2$` | | `\(...\)` | Inline | `\(E = mc^2\)` | ## Keyboard Shortcuts | Shortcut | Action | |----------|--------| | `Ctrl+Shift+M` | Convert all equations | | `Ctrl+Shift+A` | Toggle auto-convert | | `Ctrl+Shift+Z` | Undo last conversion | ## How It Works The extension uses Notion's own UI automation: 1. Detects LaTeX patterns in the DOM 2. Selects the equation text 3. Uses Notion's `/math` slash command 4. Inserts the LaTeX content 5. Closes the math block dialog This approach ensures compatibility without requiring API access or authentication. ## Settings - **Auto-Convert on Paste** — Automatic conversion when pasting - **Hover-to-Convert** — Show conversion button on hover - **Notifications** — Show toast messages ## Permissions | Permission | Purpose | |------------|---------| | `activeTab` | Access the active Notion tab | | `scripting` | Inject content script | | `clipboardRead/Write` | Read/write clipboard | | `storage` | Save settings | ## Limitations - Complex equations may need manual adjustment - Timing depends on Notion's responsiveness - Undo restores text but may not perfectly recreate math blocks ## License MIT License — See [LICENSE](LICENSE) for details. ## Contributing Contributions welcome! Please open an issue or pull request. ## Inspiration - [noeqtion](https://github.com/voidCounter/noeqtion) — Original approach - [auto-math.com](https://auto-math.com) — Auto-conversion concept