TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With (C-c C-e) AUCTeX allows to insert arbitrary environments. In my case I want to change the default aling-environment from



to insert comments in order to obtain blank lines like



Any suggestions?



share|improve this question
up vote 3 down vote accepted

You need to add a function that performs the insertion. It should be something like:

     '("align" LaTeX-env-with-preset "%" ""))
(defun LaTeX-env-with-preset (env pre post)
     (LaTeX-env-label env)
     (insert pre)
     (save-excursion (LaTeX-newline)
                     (insert post))

Note that LaTeX-add-environments only adds the environment to the list for the current buffer, so make sure this code is executed on the appropriate hook, as described at https://www.gnu.org/software/auctex/manual/auctex/Adding-Environments.html

share|improve this answer

Your Answer


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.