io12 / org-fragtog

Automatically toggle Org mode LaTeX fragment previews as the cursor enters and exits them
MIT License
404 stars 14 forks source link

Add math-preview as a backend. #22

Closed rka97 closed 3 years ago

rka97 commented 3 years ago

This adds math-preview as a backend instead of the built in org-latex-preview. math-preview is a lot faster than org-latex-preview.

io12 commented 3 years ago

Thanks for the PR! I didn't know about math-preview and it looks really cool. Unfortunately though, I feel like this PR is outside the scope of org-fragtog, since it's just supposed to be about automatically toggling org-mode fragments (sorry). That said, I think you can fully replace org's built in fragments with math-preview with:

(defalias #'org-latex-preview #'math-preview-at-point)
(defalias #'org-clear-latex-preview #'math-preview-clear-region)

That way, using the built-in org preview functions will actually call math-preview. I haven't tested it, but I think it should work, and it has the benefit of also working with the built-in C-c C-x C-l binding.