Closed jinlin82 closed 3 years ago
I'm glad you find my package useful.
It should work in markdown-mode by enabling org-fragtog-mode just like in org-mode.
So you could try adding the following to your config:
(add-hook 'markdown-mode-hook 'org-fragtog-mode)
I tested this and it seems to work but let me know if you have issues.
if the markdown file does not have level headings, it works, minimum example:
math $\alpha$ frag
if the markdown file has level headings, it doesn't work, minimum example:
# h1
## h2
### h3
math $\alpha$ frag
and the error message:
Error in post-command-hook (org-fragtog--post-cmd): (wrong-type-argument stringp nil)
but if I move cursor to the text line, disable org-fragtog-mode and re-enable org-fragtog-mode, it works.
Can you repeat the error and check this? Thanks.
markdown-mode version: markdown-mode-20200416.116
org-fragtog-mode version: org-fragtog-20201224.428
The latest version fixes this. Thanks!
When there is no space before and after $. math preview is not activated
This seems to be the intended behavior of Org mode.
https://orgmode.org/manual/LaTeX-fragments.html
The manual recommends using \( ... \)
instead of $ ... $
, which seems to work.
math\(\alpha\)frag
However, \( ... \)
seems to not be supported Markdown syntax. Since org-fragtog
relies on Org mode for parsing LaTeX fragments, I don't think there's much I can do here. Sorry. You might want to try something else like texfrag.
This package is so useful for reproducible research. But sometimes I write rmarkdown document which supports latex math too with markdown-mode. So I wonder can make this package work in markdown-mode too? Thanks.