Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using org-mode 8.0, Emacs 24.3, Auctex 11.87, in Windows.

I was able to use LaTeX preview functions in org-mode files by pressing Ctrl + X, Ctrl + C, Ctrl + L. However, I think it would be more useful if the math preview can be done automatically when the cursor leaves the math equation, e.g. for $$a=b+c$$, when my cursor is out of $$, Emacs should automatically enable preview. This may not be so important for .tex file, but is quite useful for org-mode, especially when you input equations during note taking, you want instantaneous preview.

I thought that latex-math-preview.el should provide such function but seems it is just another implementation of preview-latex.el.

How to enable automatic LaTeX math preview in org-mode/Emacs?

share|improve this question

1 Answer 1

Hmmm...An ugly and not imperfect solution:

(define-key org-mode-map (kbd "$") (lambda ()
                                     (interactive)
                                     (insert "$")
                                     (save-excursion
                                       (left-char 1)
                                       (if (org-inside-LaTeX-fragment-p)
                                           (progn
                                             (right-char 2)
                                             (org-preview-latex-fragment))))))

Anyway, it works on some degree.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.