When writing or editing posts, chemistry and math formatting can take up a lot of your time. There is a set of scripts that can help. You can easily add formulas like $\ce{H2O}$ in the text, or in a separated line:

$\ce{2H2(g) + O2(g) -> 2H2O}$

You can also quickly format quantities such as a density of 4.524 g mL-1 or some math:

$$\rho = \pu{4.524 g mL-1}$$

The installation instructions are here: https://stackapps.com/questions/3373/mathjax-buttons

You need to install the script and allow sites to use it (browser dependent). When it is installed, there should be an extra set of commands at the top of the editing box.

There are also keyboard shortcut (Alt + S, M, D, C) instead of pushing buttons. The details are given in the link. To see the userscript in action, watch this two-minute video.

  • 1
    $\begingroup$ Voting to close as duplicate $\endgroup$ Aug 21, 2022 at 15:10
  • $\begingroup$ I could edit the older post to include the video. However, the video uses exactly this post, so then there would be some loss of coherence. Also, I changed the script to allow the \pu{} command, which did not exist when the original script was written. Anyway, closing as a duplicate would make sense, as it would reference the original post from 10 years ago. $\endgroup$
    – Karsten Mod
    Aug 21, 2022 at 15:17
  • 3
    $\begingroup$ chemistry.meta.stackexchange.com/q/4264/16683 I've never used this myself (preferring to manually type things out), but I think this is likely to be better than the old post. $\endgroup$ Aug 21, 2022 at 15:18
  • $\begingroup$ These scripts are nice and all, but MD/MJ is used pretty ubiquitously on other sites and I'm not going to invest time and effort to remember SE-specific shortcuts. So yeah, it's "ma'am I do my own plumbing" thing to me. $\endgroup$
    – andselisk Mod
    Aug 21, 2022 at 16:43
  • $\begingroup$ @andselisk And when it's really bad, I copy-paste into vim and edit there ;D of course, having good plugins helps a lot $\endgroup$ Aug 21, 2022 at 20:03


Browse other questions tagged .