# opening brace alignment/indentation problem in LaTeX mode

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...

• Emacs 24.5.1 is six years old; there have been three releases since then. If at all possible, it would be good for you to update to version 27. You don't have to do this, but as your version gets further and further out of date, you are likely to run into more issues that are tricky to resolve. As in this case, where the way Auctex gets installed has changed with the package.el system. – Tyler Mar 29 at 14:14