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?
5
  • 2
    Specify your Emacs release. And if before you had the problem, specify that Emacs release as well. Thx.
    – Drew
    Commented May 18, 2021 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
    Commented May 19, 2021 at 2: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
    Commented May 19, 2021 at 6: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
    Commented May 19, 2021 at 7:31
  • @vonbrand any suggestion on how to make latex-mode the default for tex files?
    – Yair Daon
    Commented May 20, 2021 at 5:12

1 Answer 1

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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