Chemistry formulas in Obsidian

Hi everyone! I’m kinda new to Obsidian, and I mostly use it to take notes in class.
Recently I’ve been wanting to add chemistry formulas in a way that is easier to type and looks cleaner in the end.
From my understanding, I can use the Extended MathJax plugin and add the mhchem extension in the preamble file, however, I have a few struggles with that.

So far, I have installed the plugin, I have created a preamble.sty file, and I’ve tried typing \usepackage{mhchem} in it (I’m not sure if I’m supposed to add anything else, since I only care about enabling this one package in obsidian).
I’ve also tried \usepackage{chemfig}, since that’s what’s explained on Overleaf, but that’s also not working.
I refreshed Obsidian and I tried typing a formula as $\ch{formula}$ but it doesn’t work, and it just marks \ch in red, like a misspelled function.

I would really appreciate if anyone could tell me if I’m doing something wrong…

2 Likes

Have you tried just writing the preamble at the top of the markdown file in $$ $$ delimiters rather than as a preamble? Does that work?

1 Like

@giulsparola mhchem formulas work out of the box, without explicit package loading in Markdown file or preamble.sty. Just type something like $\ce{H2O}$ and it will be rendered in the preview.

Obsidian uses MathJax to render math. It is not a full-fledged LaTeX environment like e.g. Overleaf, so only math macros (and mhchem syntax) are supported.

1 Like

Cuz of course there is already a video on this…

1 Like

If I need to draw molecules like this

Screenshot 2021-10-19 at 16.44.39

or add a reaction scheme representing electron movements and such, I usually create it in LaTeX using the chemfig package, and then embed it in my notes as PNG file.

However, if someone has a better suggestion how to represent complex chemical structures in Obsidian, I would be glad to know.

1 Like

Not really, but thank you anyway! I think I’ll just stick to plain formulas :blush:

2 Likes

Thank you! I think I’ll just stick to regular formulas then : )

Hi! Thanks for the response, but I had already watched the video and I couldn’t really find anything for my problem… thank you anyway : )

1 Like

Thank you, I think I’ll use your method then : )

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.