retext icon indicating copy to clipboard operation
retext copied to clipboard

Use KaTeX instead of MathJax

Open Momo-Coco opened this issue 5 years ago • 5 comments
trafficstars

Is it any way to configure ReText to use KaTeX instead of MathJax? I am working in an environment where KaTeX is the only option and it would be great if I could use my favorite markdown editor.

Momo-Coco avatar May 29 '20 03:05 Momo-Coco

Hi! Unfortunately it is not possible yet.

Can you share a detail why KaTeX is the only option? Will it be an option to download and unpack MathJax locally, and use it?

mitya57 avatar May 29 '20 10:05 mitya57

Thank you for your quick answer. The reason for asking about KaTeX is that the editor should support GitLab-style markdown, which AFAIK uses KaTeX. Now that you answered 'no', I'm thinking I might get by with just configuring ReText/MathJax to use GitLab-style $`...`$ and ```math...```. Is it possible to to that? And if it is possible, how can it be done?

Momo-Coco avatar May 29 '20 13:05 Momo-Coco

Hi!

I added GitLab support to the math extension ReText uses. To upgrade it before I officially release it, use this command:

python3 -m pip install --upgrade --user https://github.com/mitya57/python-markdown-math/archive/master.zip

Then, you can use GitLab syntax in your markdown files:

<!-- Required extensions: mdx_math(use_gitlab_delimiters=1) -->

Inline: $` e^{i \pi} = -1 `$.

Standalone:
```math
e^{i \varphi} = \cos \varphi + i \sin \varphi
```

Please test and give your feedback, then I will release the update to PyPI.

mitya57 avatar Jun 02 '20 13:06 mitya57

It works! Thank you. It even works globally with mdx_math(use_gitlab_delimiters=1) Do you have a way to define shortcuts? (I mean without editing /usr/share/retext/ReText/editor.py if possible...)

Momo-Coco avatar Jun 03 '20 01:06 Momo-Coco

It works! Thank you.

Thanks for confirming this, I have released python-markdown-math 0.7 to PyPI yesterday which has this functionality.

Do you have a way to define shortcuts?

No, unfortunately. Is there any specific shortcut you want to have?

mitya57 avatar Jun 10 '20 07:06 mitya57