Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mhchemparser

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mhchemparser

Parser to convert mhchem syntax to LaTeX syntax, for downstream inclusion in MathJax, KaTeX and similar projects.

  • 4.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
141K
increased by15.83%
Maintainers
1
Weekly downloads
 
Created
Source

mhchem Parser

mhchem is an input syntax for typesetting chemical equations and physical units.

This is the parser to convert mhchem syntax to LaTeX syntax, for downstream inclusion in MathJax, KaTeX and similar projects.

Usage

Users of MathJax and KaTex can write

\ce{CO2 + C -> 2 CO}
\pu{123 kJ*mol-1}

For a hundred more features and how to configure MathJax or KaTeX, see the manual.

Usage for Downstream Software

For "translating" the \ce syntax, make a call like

mhchemParser.toTex("CO2 + C -> 2 CO", "ce");

This will return

"{\mathrm{CO}{\vphantom{A}}_{\smash[t]{2}} {}+{} \mathrm{C} {}\mathrel{\longrightarrow}{} 2\,\mathrm{CO}}"

For the \pu command, call

mhchemParser.toTex("123 kJ*mol-1", "pu");

You could also insert a TeX string. All instances of \ce and \pu will be replaced in the returned value. This might make integration easier, because the mhchem parser does not need to be called from the TeX parser.

mhchemParser.toTex("m_{\\ce{H2O}}", "tex");

Keywords

FAQs

Package last updated on 06 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc