# Chemistry formulas in Obsidian

**URL:** <https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772>\
**Category:** Help\
**Created:** [October 18, 2021, 1:28pm UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772 "2021-10-18T13:28:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![giulsparola](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/g/eb9ed0/32.png) [@giulsparola](https://forum.obsidian.md/u/giulsparola)\
**Post date:** [October 18, 2021, 1:28pm UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/1 "2021-10-18T13:28:01Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![mayurankv](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@mayurankv](https://forum.obsidian.md/u/mayurankv)\
**Post date:** [October 18, 2021, 2:40pm UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/2 "2021-10-18T14:40:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![saf-dmitry](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@saf-dmitry](https://forum.obsidian.md/u/saf-dmitry)\
**Post date:** [October 18, 2021, 7:01pm UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/3 "2021-10-18T19:01:36Z")

</div>

@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.

> [@giulsparola](#):
>
> I’ve also tried `\usepackage{chemfig}`, since that’s what’s explained on Overleaf, but that’s also not working.

Obsidian uses [MathJax](https://www.mathjax.org) to render math. It is not a full-fledged LaTeX environment like e.g. Overleaf, so only math macros (and mhchem syntax) are supported.

---

<div class="post-metadata">

**Author:** ![Obsidandnancy](https://forum.obsidian.md/user_avatar/forum.obsidian.md/obsidandnancy/32/17913_2.png) [@Obsidandnancy](https://forum.obsidian.md/u/Obsidandnancy)\
**Post date:** [October 18, 2021, 7:25pm UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/4 "2021-10-18T19:25:27Z")

</div>

Cuz of course there is already a video on this…

> **[r/ObsidianMD - Comprehensive Overview | LaTeX Mathjax Equation In \[\[Obsidian\]\]](https://www.reddit.com/r/ObsidianMD/comments/l4qdga/comprehensive_overview_latex_mathjax_equation_in/)**
>
> 16 votes and 6 comments so far on Reddit

---

<div class="post-metadata">

**Author:** ![saf-dmitry](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@saf-dmitry](https://forum.obsidian.md/u/saf-dmitry)\
**Post date:** [October 19, 2021, 2:59pm UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/5 "2021-10-19T14:59:20Z")

</div>

If I need to draw molecules like this

![Screenshot 2021-10-19 at 16.44.39](https://forum.obsidian.md/uploads/default/original/3X/4/2/421ee30093c5fd065f2084cfd0cac4424d362f85.png)

or add a reaction scheme representing electron movements and such, I usually create it in LaTeX using the [chemfig](https://ctan.org/pkg/chemfig?lang=en) 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.

---

<div class="post-metadata">

**Author:** ![giulsparola](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/g/eb9ed0/32.png) [@giulsparola](https://forum.obsidian.md/u/giulsparola)\
**Post date:** [October 21, 2021, 6:44am UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/6 "2021-10-21T06:44:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![giulsparola](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/g/eb9ed0/32.png) [@giulsparola](https://forum.obsidian.md/u/giulsparola)\
**Post date:** [October 21, 2021, 6:45am UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/7 "2021-10-21T06:45:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![giulsparola](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/g/eb9ed0/32.png) [@giulsparola](https://forum.obsidian.md/u/giulsparola)\
**Post date:** [October 21, 2021, 6:46am UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/8 "2021-10-21T06:46:28Z")

</div>

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 : )

---

<div class="post-metadata">

**Author:** ![giulsparola](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/g/eb9ed0/32.png) [@giulsparola](https://forum.obsidian.md/u/giulsparola)\
**Post date:** [October 21, 2021, 6:47am UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/9 "2021-10-21T06:47:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [November 20, 2021, 6:47am UTC](https://forum.obsidian.md/t/chemistry-formulas-in-obsidian/25772/10 "2021-11-20T06:47:51Z")

</div>

Closed on November 20, 2021, 6:47am UTC

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