when I have latex in a section, and press C-c C-x C-l it preview all LaTeX fragments in the section, and when I jump to another section and toggle latex preview fragment for that section, it untoggle the latex preview of the other section.

By section I mean an outline, or source code.

For example I have some LaTeX in an outline and some in a source code (because I am writing a lesson), and when I toggle the LaTeX in the source code, it untogle the LaTeX of the outline.

How can I prevent that ?

Is there a way to have a binding to preview all the LaTeX of a document, even if it's already previewed ?

Thank you


From org-preview-latex-fragment documentation, if you use a double prefix, it'll display all fragments in the buffer:

It is bound to C-c C-x C-l.

(org-preview-latex-fragment &optional SUBTREE)

Preview the LaTeX fragment at point, or all locally or globally. If the cursor is in a LaTeX fragment, create the image and overlay it over the source code. If there is no fragment at point, display all fragments in the current text, from one headline to the next. With prefix SUBTREE, display all fragments in the current subtree. With a double prefix arg C-u C-u, or when the cursor is before the first headline, display all fragments in the buffer. The images can be removed again with M-x org-ctrl-c-ctrl-c.

  • Thank you that solve the problem ! Is there a way I can bind it to an easier sequence ? – Nicolas Scotto Di Perto Jan 6 '16 at 17:44
  • Something like (global-set-key (kbd "<f11>") (lambda () (interactive) (org-preview-latex-fragment 16))) should do the trick. Note that the double C-u produces an argument of 16 to the function. – Juancho Jan 7 '16 at 0:14
  • org-preview-latex-fragment since version 9.3 you should use org-latex-preview – student Aug 25 '20 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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