I’ve added support for the MathJax mhchem and bussproofs packages, extending the usefulness of the Obsidian MathJax engine. I’ve also added support for a MathJax preamble, useful for defining common macros.
The preamble is defined in a preamble.sty file in the root of the vault.
I’ve got plans for this plugin, including optionally using Latex rather than MathJax to have access to all the usual goodies and packages.
Great plugin. The preamble is a must have because writing pure Latex without macros is time consuming. Is there any way to get the preamble through to Obsidian Publish? I couldn’t get it to work because the .sty file couldn’t be found to be published.
Hey, sorry I forgot to check this forum and I’m not getting email notifications. I’ll take a look at getting it working with Obsidian Publish, but since I don’t have access to that it may take a little while.
Is it possible to add different packages in the preamble somehow? It is straightforward to edit the plugin to load the packages, e.g. in main.ts I could load the tensor package:
But then I would need to fork it, create my own plug in, and then pull from upstream every time you update. And presumably every user would need to do the same depending on what packages they need, which would be a bit of a mess. I’d love for a way to add MathJax extensions within this plugin!
Hello @shenghan, you’re not the first person to report this though each time the issue seems to be transitory. Can you confirm that you are on Windows (10)? Are you able to reproduce this in a fresh vault?
I’m going to take a deeper look into this during the weekend, see if maybe something changed in initialization of obsidian plugins?
Hi @xldenis , thanks for your reply. I am using Windows 10.
I follow your suggestion to try a new vault, and the problem disappear. In the current vault, I reinstall the plugin, and the problem also disappear. Thanks!
Hey, I’m having the same problem. I’m in version 0.11.5, also on Windows 10. When I made a new vault for testing it worked as you said. So I tried copying my old vault’s folder to another location, deleting the .obsidian folder, and opening the copied folder as a new vault. This worked, so the next step was deleting the .obsidian folder from my original vault, removing it from Obsidian, and opening the folder as a new vault. This worked too, but then I tried editing the preamble. Since nothing changed, and I wasn’t able to refresh Obsidian (Ctrl+R doesn’t seem to do anything [anymore?]) I closed and re-opened the program, but now the plugin doesn’t seem to work anymore. Some comments:
Reinstalling doesn’t work for me like it does for @shenghan, apparently.
Some times when testing MathJax would break completely, and the equations would display as plain text.
By the way, thanks for making this much needed package.
Thanks for the report, I’ll investigate this over the weekend, I wonder if there have been changes to plug-in loading or file access… I’m curious why it only happens on windows 10 though.
Hey. Just wanted to tell that your plugin is great. It is exactly what I was looking for, just thought of something like this and here it is! The open-source community at its best.
To load the package “physics” you can use \require{physics} in the preamble. For example, when I use \require{physics} in the preamble, I see $\op{a}{b}$ rendered globally and it is not rendered globally otherwise.
Also trying to find out why $\ip{a}{b}$ from physics does not work, while $\innerproduct{a}{b}$ does. In physics readme \ip is said to be the shorthand version of \innerproduct.
What do you mean by “HomePage”? If there is a setting for the “first note that Obsidian loads” on startup, I’m sorry but I can’t find it. Could you clarify this point?
I use a community plugin called “Homepage”. There you can define a default page that you want to open on startup of Obsidian. On that page you can have links to other important notes etc.
And you can also add these kind of Mathjax definitions. Because it is the first page you load, you inject these things in Mathjax before you open any other note. So you have one place to define the definitions you can use in other notes.