RyotaUshio / obsidian-mathjax-preamble-manager

Use preamble in Obsidian / switch preambles note to note
MIT License
19 stars 0 forks source link

MathJax Preamble Manager for Obsidian

This Obsidian.md plugin lets you use MathJax preambles and switch them based on note paths.

[!note] Once a command is defined via \newcommand, it will not be removed unless it's overwritten by another \newcommand or \renewcommand. If you want to remove the effect of a certain command, you need to reload the app.

Example

So suppose you want to use different probability symbols for different paths, say,

Writing preambles

Now you need to create two preamble files. Preambles can be any plain text files, but I recommend using markdown files because they can be easily edited from within Obsidian. In this example, the preamble for Folder A can be written in either of the following syntaxes:

I recommend using either of the $...$ or $$...$$ syntaxes. See here for details.

So now, we have the following two preambles:

Registering preambles

Before being able to use the preambles, you need to register them in the plugin settings.

image

Folder preambles

Now, recall we wanted to apply Preamble A.md for all notes inside Folder A. This can be achieved by setting Preamble A.md as the folder preamble for Folder A.

image

Specifying a preamble via preamble property

In order to apply a preamble to a single note (as opposed to an entire folder), you can add a link to the preamble as the preamble property of that note.

image

Results

image image

Using preambles in slides

This plugin supports the normal markdown views (Reading view/Live preview), embeds, hover page preview, PDF export and Canvas, but slides (the core Slides plugin and the Advanced Slides plugin) are not supported.

However, you can still manually load markdown preambles with either of the $...$ or $$...$$ syntax into your slides by embedding them. For this reason, I recommend using this preamble format.

![[preamble]]

Slide 1

---

Slide 2

---

...

Installation

Since this plugin is still in beta, it's not on the community plugin browser yet.

But you can install the latest beta release using BRAT:

  1. Install BRAT and enable it.
  2. Go to Options. In the Beta Plugin List section, click on the Add Beta plugin button.
  3. Copy and paste RyotaUshio/obsidian-mathjax-preamble in the pop-up prompt and click on Add Plugin.
  4. (Optional but highly recommended) Turn on Auto-update plugins at startup at the top of the page.
  5. Go to Community plugins > Installed plugins. You will find “MathJax Preamble Manager” in the list. Click on the toggle button to enable it.

Companion plugins

Here's a list of other math-related plugins I've developed:

Support development

If you find my plugins useful, please support my work by buying me a coffee!

Buy Me A Coffee