Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for mhchem both inline and at export #2104

Closed
redoxmatlab opened this issue May 6, 2020 · 2 comments
Closed

Support for mhchem both inline and at export #2104

redoxmatlab opened this issue May 6, 2020 · 2 comments

Comments

@redoxmatlab
Copy link

redoxmatlab commented May 6, 2020

Hello,

I wish to request support for mhchem package (https://mhchem.github.io/MathJax-mhchem/).

This package is critical for technical writers. I have tried to add the equation below but it could not be exported correctly into PDF since mhchem is not supported.
$\ce{CH4 + 2 $\left( \ce{O2 + 79/21 N2} \right)$}$

The same applies to LaTeX expressions such as (this one below is from Typora website):

$$ \begin{align*} y = y(x,t) &= A e^{i\theta} \\ &= A (\cos \theta + i \sin \theta) \\ &= A (\cos(kx - \omega t) + i \sin(kx - \omega t)) \\ &= A\cos(kx - \omega t) + i A\sin(kx - \omega t) \\ &= A\cos \Big(\frac{2\pi}{\lambda}x - \frac{2\pi v}{\lambda} t \Big) + i A\sin \Big(\frac{2\pi}{\lambda}x - \frac{2\pi v}{\lambda} t \Big) \\ &= A\cos \frac{2\pi}{\lambda} (x - v t) + i A\sin \frac{2\pi}{\lambda} (x - v t) \end{align*} $$

Any ideas?

Many thanks.

@redoxmatlab
Copy link
Author

redoxmatlab commented May 10, 2020

Solving this myself. See below for whoever interested.

\begin{aligned} y = y(x,t) &= A e^{i\theta} \\ &= A (\cos \theta + i \sin \theta) \\ &= A (\cos(kx - \omega t) + i \sin(kx - \omega t)) \\ &= A\cos(kx - \omega t) + i A\sin(kx - \omega t) \\ &= A\cos \Big(\frac{2\pi}{\lambda}x - \frac{2\pi v}{\lambda} t \Big) + i A\sin \Big(\frac{2\pi}{\lambda}x - \frac{2\pi v}{\lambda} t \Big) \\ &= A\cos \frac{2\pi}{\lambda} (x - v t) + i A\sin \frac{2\pi}{\lambda} (x - v t) \\ \end{aligned}

@0187773933
Copy link

https://github.com/marktext/marktext/blob/develop/src/muya/lib/utils/exportHtml.js#L3

import katex from 'katex'
import 'katex/dist/contrib/mhchem'
import loadRenderer from '../renderers'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants