3

I'm using the comment package for the comment environment. This environment cannot be indented, just like the verbatim environment. How can I configure AUCTeX to not indent this environment? Thanks in advance.

4
  • 1
    Does adding ("comment" current-indentation) to the LaTeX-indent-environment-list work?; see gnu.org/software/auctex/manual/auctex/Indenting.html Jan 22, 2016 at 18:27
  • @RenéB.Christensen additionnally I find in my customization file that my custom verbatim environments are added to LaTeX-verbatim-environments. (but perhaps the OP does not care for verbatim like treatment of his comment environment)
    – user4686
    Jan 23, 2016 at 21:44
  • I added (add-to-list 'LaTeX-verbatim-environments "comment") and evaluated the command, but I still don't see any change in the AUCTeX behavior.
    – Jeff
    Jan 29, 2016 at 19:07
  • 1
    @Jeff - One approach could be: (add-to-list 'LaTeX-indent-environment-list '("comment" current-indentation)). You can put something like this in your .emacs: (eval-after-load "latex" (progn (make-local-variable 'LaTeX-indent-environment-list) (add-to-list 'LaTeX-indent-environment-list '("comment" current-indentation)))) Feb 4, 2016 at 21:47

1 Answer 1

2

The steps explained here worked for me. Specifically, I added the following to my .emacs file.

(add-to-list 'LaTeX-verbatim-environments "pycode")
(add-to-list 'LaTeX-indent-environment-list
        '("pycode" current-indentation))

More information is available under (info "(auctex)Verbatim content") and (info "(auctex)Indenting").

After I did an eval-region on these lines, I had to reload the .tex file that I was working on in Emacs for them to take effect.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .