By default org-mode will overlap images of the latex equations for a given section, or for the whole document. If I press C-c C-c on an equation with an image overlay, all the images are removed. Can I make it so that only the one image is removed (and from which I can recreate the image by typing C-c C-x C-l?

1 Answer 1


I don't think that feature is present in org, but it's certainly possible to add it

(defun my-remove-latex-fragment-overlay-at-point ()
  (let ((overlays (overlays-at (point))))
    (mapc (lambda (ov)
            (when (eq (overlay-get ov 'org-overlay-type) 'org-latex-overlay)
              (setq org-latex-fragment-image-overlays
                    (delete ov org-latex-fragment-image-overlays))
              (delete-overlay ov)))

Calling that function will disable the overlay at point

  • It's probably more efficient to check each overlay with (eq (overlay-get ov 'org-overlay-type) 'org-latex-overlay) rather than linearly searching org-latex-fragment-image-overlays, especially if there are many equations in a document.
    – user227
    Sep 24, 2014 at 16:40
  • @lunaryorn you're absolutely right, sorry for being too lazy ! I edited the code to implement that
    – Sigma
    Sep 24, 2014 at 17:11
  • this works great! How about retoggling the equations with C-c C-x C-l? Presumably all I need to do is navigate to the top of the buffer, execute the chord, and then return to the original point. Is there some elisp functionality that allows this?
    – wdkrnls
    Sep 24, 2014 at 19:22
  • @wdkrnls I might be missing something, but why do you want to go to the top of the buffer? C-c C-x C-l is supposed to (and does for me) work happily from the document's body
    – Sigma
    Sep 24, 2014 at 19:29
  • @Sigma: for me C-c C-x C-l removes all LaTeX overlays above the parent heading.
    – wdkrnls
    Sep 24, 2014 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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