Optionally Load MathJax Definitions from Other Files

Use case or problem

Currently, whenever I write a MathJax definition, say $\def\d{{\delta}}$ somewhere (in any file, say “this.md”), it gets automatically applied to other files as well: that is, if I write $\d$ in another file “that.md”, $\d$ gets translated to $\delta$.

The advantage of this behavior is that I can just put all the custom definitions I know I use all the time to one single file, and open this file every time I use Obsidian, to load the definitions globally.

The drawback however, is that the definition written in an arbitrary file could affect another totally irrelevant file. And if I were to write $\def\d{{\delta}}$ in “this.md” and $\def\d{{\mathrm{diam}}}$ in “that.md”, then some funny things would start to occur, in general the behavior of $\d$ in other files would be inconsistent (dependent on the opening and the closing and the rendering of the files)

Proposed solution

I hope that there is some optional field, say “mathjax”, in YAML frontmatter which specifies other files in the same vault to achieve the effect of loading all the MathJax definitions of only the files specified in that particular field to the file containing this piece of frontmatter. So if the frontmatter of “this.md” looks like:

---
mathjax: that1.md, that2.md
---

Then all the mathjax definitions contained only in the files “that1.md” and “that2.md” would be loaded to “this.md”.

1 Like

And something which I forgot to mention, the MathJax definition in one file should affect that file only, unless explicitly loaded by another file.