How to reuse TeX macros across Obsidian notes

As of October 2026, Obsidian supports inline and display math through MathJax. Shared TeX Preamble loads supported definitions from a vault file into that engine.

Background

Keep notation in one file when several notes use the same commands. Reload that file after editing a definition.

2 ways to do it

  1. Write the expression directly

    For a short formula, write its full LaTeX expression between dollar signs. Use display math for a separate equation block.

    limits
    Writing expressions directly avoids a shared macro file, but you still maintain the formula text in each note.
  2. Shared TeX Preamble from this site

    Select a macro file in your vault to load its definitions into the math engine. Your notes use those commands without copies of the definitions.

    limits
    Removed definitions remain available until Obsidian restarts.
    Two notes show probability and linear algebra formulas using shared macros.
    Open larger

    MIT · no telemetry · core features free

    All features of Shared TeX Preamble

Reuse TeX macros from one vault file

  1. Create Macros.md with your definitions in a display math block.

  2. Select that note in the Macro file setting.

  3. Use a defined command in math in another note.

  4. After editing the file, run Reload the macro file.

Common questions

Why does another person see an undefined command?

Your note contains the macro call rather than its definition. Share the macro file as well as the note.

Can I inspect a library before switching?

Pro provides a library preview with sample calls and errors. Previewing doesn't activate that library.

Sources

Photo of Michael LipThat's every step, start to finish.

Obsidian rewards people who share. NoteMods is just me and a lot of coffee. If this guide saved you a fight with the syntax, buy me a cup.