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

From: Paul Nelson <[email-masked]>
Date: Sat, 9 Sep 2023 18:58:45 +0200

Looks good to me (I prefer it over my original suggestion).  Thanks!

On Sat, Sep 9, 2023 at 8:52 AM Ikumi Keita <[email-masked]> wrote:

> Hi Paul and Uwe,
>
> >>>>> Paul Nelson <[email-masked]> writes:
> > As for the "always-align t" case, there are still some natural "broken"
> > examples, as you know:
> > #+begin_src latex
> > \begin{equation*}
> >   g = \begin{pmatrix}
> >         a & b \\
> >         c & d \\
> >       \end{pmatrix},
> >       \quad
> >       h = \begin{pmatrix}
> >             x & y \\
> >             z & w \\
> >           \end{pmatrix}.
> > \end{equation*}
> > #+end_src
> > #+begin_src latex
> > The matrix $\begin{pmatrix}
> >               a & b \\
> >               c & d
> >             \end{pmatrix}$ has determinant
> >             \begin{equation*}
> >               a d - b c.
> >             \end{equation*}
>
> >             The matrix $\begin{pmatrix}
> >                           a & b \\
> >                           c & d
> >                         \end{pmatrix}$ has determinant
> >                         \begin{equation*}
> >                           a d - b c.
> >                         \end{equation*}
>
> >                         The matrix $\begin{pmatrix}
> >                                       a & b \\
> >                                       c & d
> >                                     \end{pmatrix}$ has determinant
> >                                     \begin{equation*}
> >                                       a d - b c.
> >                                     \end{equation*}
> > #+end_src
>
> I've been gradually inclined to the attached approach. Namely, align "&"
> as well as \end{foo} relative to beg-col, not beg-pos. In this way, the
> above examples turn into
> ----------------------------------------------------------------------
> \begin{equation*}
>   g = \begin{pmatrix}
>     a & b \\
>     c & d \\
>   \end{pmatrix},
>   \quad
>   h = \begin{pmatrix}
>     x & y \\
>     z & w \\
>   \end{pmatrix}.
> \end{equation*}
> ----------------------------------------------------------------------
> and
> ----------------------------------------------------------------------
> The matrix $\begin{pmatrix}
>   a & b \\
>   c & d
> \end{pmatrix}$ has determinant
> \begin{equation*}
>   a d - b c.
> \end{equation*}
>
> The matrix $\begin{pmatrix}
>   a & b \\
>   c & d
> \end{pmatrix}$ has determinant
> \begin{equation*}
>   a d - b c.
> \end{equation*}
>
> The matrix $\begin{pmatrix}
>   a & b \\
>   c & d
> \end{pmatrix}$ has determinant
> \begin{equation*}
>   a d - b c.
> \end{equation*}
> ----------------------------------------------------------------------
>
> This patch indents as
> \begin{equation}
>   n u m=\left[\begin{array}{ll}
>     2 & 25
>   \end{array}\right]
> \end{equation}
> , not the form Paul proposed
> \begin{equation}
>   n u m=\left[\begin{array}{ll}
>                 2 & 25
>   \end{array}\right]
> \end{equation}
> . Maybe Uwe doesn't like the former indentation, but it is more similar
> to the behavior of other (non-tabular type) environments.
>
> > With a bit more massaging, it should be possible to avoid these.  I had
> in
> > mind modifying LaTeX-indent-level-count (or the block surrounding where
> it
> > is called) in \end{TABULAR} cases, adjusting by the difference between
> the
> > matching \begin and its beginning of line.
>
> A similar idea crossed my brain, too. The best position to modify would be
> `LaTeX-indent-calculate-last'.
> It would make the indent algorithm more complex, so I began to search
> for more simple solution.
>
> Regards,
> Ikumi Keita
> #StandWithUkraine #StopWarInUkraine
>
>