With auctex I can run TeX-fold-env the environment on which point currently is located.

How can I fold all environments foo (\begin{foo}... \end{foo}) in my buffer at once? And how to unfold all occurences of foo?

1 Answer 1

(defun latex-fold-foo ()
  (let ((env (read-from-minibuffer "Environment: ")))
      (goto-char (point-min))
      (while (search-forward (format "begin{%s}" env) nil t)
  • Please some explanation in addition to just code Dec 10, 2018 at 16: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.