Subject: bug#65648: 13.2; indentation of nested environments

From: Uwe Brauer <[email-masked]>
Date: Sun, 03 Sep 2023 10:44:54 +0200

>>> "IK" == Ikumi Keita <[email-masked]> writes:

> Hi Paul,
>>>>>> Paul Nelson <[email-masked]> writes:
>> A practical workaround for the user is to make sure that \begin{} is
>> always the first non-whitespace on its line (and to enforce that
>> requirement on coauthors via ~(defun fix-tex-buffer ...)~), but that
>> seems suboptimal.

>> The following seems to resolve the issue:

> Thanks for your proposal. I think it can be a practical solution for
> bug#54949[1] as well.

> The proposal gives one failure for regression test, namely the case Uwe
> Brauer raised last year[2]. Current AUCTeX indents
> ----------------------------------------------------------------------
> \begin{equation}
>   \begin{aligned}
> &n u m=\left[\begin{array}{ll}
> 2 & 25
> \end{array}\right] \\
> &d e n=\left[\begin{array}{lll}
> 1 & 4 & 25
> \end{array}\right]
> \end{aligned}
> \end{equation}
> ----------------------------------------------------------------------
> into
> ----------------------------------------------------------------------
> \begin{equation}
>   \begin{aligned}
>     &n u m=\left[\begin{array}{ll}
>                    2 & 25
>                  \end{array}\right] \\
>     &d e n=\left[\begin{array}{lll}
>                    1 & 4 & 25
>                  \end{array}\right]
>   \end{aligned}
> \end{equation}
> ----------------------------------------------------------------------
> while this proposal gives
> ----------------------------------------------------------------------
> \begin{equation}
>   \begin{aligned}
>     &n u m=\left[\begin{array}{ll}
>                    2 & 25
>     \end{array}\right] \\
>     &d e n=\left[\begin{array}{lll}
>                    1 & 4 & 25
>     \end{array}\right]
>   \end{aligned}
> \end{equation}
> ----------------------------------------------------------------------
> , which seems me another reasonable behavior. Uwe, what do you think
> about it? Is this result acceptable for you?

Frankly, rather not. Here is why.
The proposed change would lead to 

\begin{equation}*
  \begin{aligned}**
    &n u m=\left[\begin{array}{ll}***
                   2 & 25
    \end{array}\right] \\
    &d e n=\left[\begin{array}{lll}
                   1 & 4 & 25
    \end{array}\right]
  \end{aligned}
\end{equation}

The first to begin, end on the same column, which is how it should be.

However the last one, starting with \begin{array}
*does not* end on the same column.

So I personally find this proposed behavior inferior. It makes it more
difficult to spot errors.

> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54949
> [2] https://lists.gnu.org/r/auctex-devel/2022-01/msg00055.html

> Regards,
> Ikumi Keita
> #StandWithUkraine #StopWarInUkraine

-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the NATO membership of the Ukraine.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/