1

Recently, when editing files in LaTex, upon pressing TAB, I get a huge indentation. Instead, the default behavior used to be to align with respect to previous environment definition. :

I start with this (Example 1):

\begin{align}
\begin{split}
F = ma
\end{split}
\end{align}

Upon pressing TAB in the second row I get something like (Example 2):

\begin{align}
                                 \begin{split}
F = ma
\end{split}
\end{align}

Whereas I would like to just smash the TAB button to get (Example 3):

\begin{align}
   \begin{split}
     F = ma
   \end{split}
\end{align}

Example 3 is what used to be the case but I might have broken something and I don't know what. Now I get Example 2. Also, if I hit the TAB outside of the align environment, I get a huge (12 spaces) displacement, which is also bizarre (previously it wouldn't do that).

I tried adding the following suggestions into my .emacs file:

  1. Suggestion in the question and first answer of Confusion by the usage of indent-tabs-mode nil
  2. The suggestion in Why is emacs indenting with tabs even though indent-tabs-mode is nil?
Yair Daon
  • 131
  • 5
  • 2
    Specify your Emacs release. And if before you had the problem, specify that Emacs release as well. Thx. – Drew May 18 '21 at 15:59
  • 1
    Also state what exact mode you are using. There are several (La)TeX modes. At least the vanilla one and the one with AUCTeX. – vonbrand May 19 '21 at 02:42
  • @vonbrand Your suggestion made me switch back to LaTex mode (I was in Tex mode)! I did not know about these! Thanks!!! I'll edit the question but feel free to answer it yourself if you want the vote. – Yair Daon May 19 '21 at 06:43
  • Please either delete your question or post your answer really as answer that you accept as soon as this is possible. (That keeps the overview page clean.) – Tobias May 19 '21 at 07:31
  • @vonbrand any suggestion on how to make latex-mode the default for tex files? – Yair Daon May 20 '21 at 05:12

1 Answers1

2

Looks like I somehow managed to switch to Tex mode, instead of LaTex mode. Changing to LaTex mode is easy: M-x latex-mode. Many thanks to @vonbrand for telling me to check the mode!

Yair Daon
  • 131
  • 5