I have an alignment/indentation problem in LaTeX mode. Every time I begin a line with an opening brace and I hit <TAB> or run an indentation command on the region, the brace becomes aligned with the previous opening brace, even if a closing brace has been inserted in between. For instance,

\begin{document}
{\foo}

becomes

\begin{document}
      {\foo}

Because of this, the document is increasingly shifted to the right. How can I get rid of this behavior? I use GNU Emacs 24.5.1. I have tried to open the LaTex file with emacs -q --no-site-file to make sure this is not due to a local configuration file, to no avail...

I do not see this problem (emacs-version = 25.2.2; auctex-version = 12.1.0) In your place, I will try edebug. F1 k TAB (or another key to identify the tab command (probably indent-for-tab-command) follow the link in the popup to indent.el.The point being on the code of the function, C-u C-M-x to enable edebug of function.Back to the file being edited, activate the faulty command and trace its execution with the spacebar I hope the culprit will appear.

  • AUCTeX had not been properly installed on my Linux machine. The problem has been solved by installing it from within emacs rather from a terminal. Still, thanks for your help. – Michel Fioc Jan 16 at 11:08
  • How do your install from within emacs? – vy32 Sep 11 at 10:08

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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