MathBox

approvedunreviewed

by JiangYan

A visual LaTeX formula editor: live preview, symbol palette, templates, favorites, and multi-format export.

↓ 52 downloadsUpdated 24d ago0BSD

MathBox

v3.4.2 — A visual LaTeX formula editor for Obsidian: live preview on top, LaTeX source below, an option bar in between, and a collapsible side pane holding symbols, templates and favorites.

一个显式的上下分栏公式编辑器:上方实时渲染、下方编辑 LaTeX 源码,中间选项栏控制字号 / 字体 / 颜色并提供行内、行间两种插入方式;右侧可展开侧边栏承载常用符号、公式模板与收藏夹。

侧边栏三页(快捷工具 / 公式模板 / 收藏夹)中的公式与符号均由宿主 MathJax 渲染,字体与笔记 正文里的公式完全一致(Computer Modern / TeX)。

图像导出(SVG / PNG)走 MathJax 原生 SVG 输出:字形是内嵌的矢量路径,不依赖任何字体文件, 导出的图在任何查看器里都与预览逐像素一致,且可无限缩放。

image

Features / 功能

Three entry pointsribbon icon, editor right-click menu (Insert formula with MathBox), command MathBox: Open MathBox formula editor (no default hotkey — bind your own in Settings → Hotkeys)
Live previewrendered through the host MathJax (renderMath), 200 ms debounce, errors reported without blanking the last good render
Option barfont size / font family / color / environment on the left; Insert inline · Insert display on the right
Display font sizethe preview and the source pane each have their own − value + stepper, left of Favorite / Copy: 1 px steps, or click the number and type a value (Enter or blur applies, Esc cancels, clearing it resets); preview 12–30 px, source 11–30 px, persisted across restarts
Source panemonospace editor with copy / clear; pasting strips $, $$, \(\), \[\] delimiters automatically
Symbol palette13 groups / 370 items, every button rendered as a real formula (Computer Modern / TeX); lazy-rendered with a per-formula cache so the pane opens instantly
Formula templates9 groups / 66 items, each entry previewed as a rendered formula instead of raw LaTeX
Favoritessearch / pin / rename / regroup / delete; stored in the plugin's data.json, JSON import & export
Hover hintstwo-line tooltip: line 1 the LaTeX source, line 2 a Chinese / English description (all 370 symbols covered)
Matrix entriesbuttons preview a 2×2 case (a₁₁ … a₂₂) and insert a 2×2 skeleton with & / \\ already in place; arbitrary sizes via the custom matrix dialog
ExportLaTeX, MathML, SVG (native vector — glyphs as paths, no font dependency), PNG at 3×; white or transparent background, switchable right in the export menu
i18n简体中文 / English, auto follows the app language
Themeevery color comes from Obsidian CSS variables; icons are Lucide via setIcon

Usage / 使用

  1. Open the panel from any of the three entry points.
  2. Type LaTeX below (or click symbols/templates in the side pane).
  3. Watch the preview; use the − / + stepper above to scale the preview (and the one above the source pane to scale the code), or apply font size / font / color to the formula itself.
  4. Click Inline formula or Display formula — the panel closes and the formula is written into the note in a single editor operation, so one Ctrl+Z undoes it.

If a selection that looks like LaTeX (starts with \, or is wrapped in $…$) is present when the panel is opened from the menu or the hotkey, it is pre-filled into the source pane.

Side-pane symbol order: Common → Greek → Relations → Arrows → Sets & Logic → Fractions → Radicals → Limits → Trigonometry → Integrals → Large operators → Brackets → Arrays & matrices.

Settings / 设置

  • Interface language — follow app language / 简体中文 / English
  • Default font size — preview (12–30 px) and source (11–30 px). The −/+ steppers inside the panel write back to these two values; a ↺ button in front of each field restores that row only to the software default (preview 18 px, source 13 px — the measured v3.4.0 baseline)
  • Expand non-standard macros on insert — rewrites physics-style commands (\vb{}, \abs{}, \dv{}{}, …) as standard LaTeX so the formula stays portable outside Obsidian
  • Use compact display math — $$x$$ on one line vs. a fenced block on its own lines
  • Export image background — white (best for pasting into documents) or transparent (blends into any page). The same switch also sits at the top of the export menu, so you needn't leave the panel. With a transparent background the glyphs take the current theme's foreground colour.
  • Favorites — export / import JSON, clear all

Version history

VersionHighlights
3.4.2Plugin id renamed to math-box — rename the plugin folder to math-box when upgrading (settings/favorites are preserved with the folder, then re-enable the plugin); settings searchable via declarative getSettingDefinitions() (Obsidian 1.13+); no default hotkey anymore (bind your own in Settings → Hotkeys); host requestUrl instead of fetch; removed deprecated execCommand fallback; CSS lint cleanup (zero !important, dropped partially-supported CSS); release assets now ship build-provenance attestations
3.4.1Display font size for the preview and the source pane: − value + steppers left of Favorite / Copy, buttons sized like the neighbouring icon buttons, click the value to type (Enter/blur applies, Esc cancels without closing the panel, clearing resets), 1 px steps, preview 12–30 px / source 11–30 px, persisted; the two sizes are exposed as default sizes in settings with a per-row ↺ reset
3.4.0Image export switched to native MathJax SVG output (glyphs as <path>, no font dependency, ~7 KB vs ~288 KB); white / transparent background switchable in the export menu; size gate raised to 2000 KB
3.3.0Side pane fully rendered through host MathJax (symbols, templates, favorites); two-line hover hints; matrix previews + 2×2 insertion skeletons; group re-ordering; 370 bilingual remarks
3.2.xFavorites groups, adaptive option bar, panel/tab/popout entry points
3.0.0Renamed to MathBox; three-column layout with collapsible side pane; multi-format export
2.0.0Right-click invoked three-pane editor (render / source / templates)
1.0.0Inline palette on inserting a formula block

This plugin follows the official Obsidian sample plugin structure (TypeScript + esbuild).

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.