Skip to main content
added 62 characters in body
Source Link
Malabarba
  • 23.3k
  • 6
  • 81
  • 166

Let's say I'm editing a latex in Auctex's latex-mode, and I have the following equation.
This is just indented with indent-region.

\begin{align}
    \phi & = a + b
    + c + d \\
    & = a + b
    + c + d + e
\end{align}

The above alignment is what I get if I select everything and hit TAB, that is, if I'm just using indent-region.

What I would like to get is the following:
Note how the + c + d is aligned with the text after the &. This would make the most sense to be, as the + c + d are part of the same "column" as = a + b.

\begin{align}
    \phi & = a + b
           + c + d \\
         & = a + b
           + c + d + e
\end{align}

Below is what I get if I call align-current.Below is what I get if I call align-current.

\begin{align}
    \phi & = a + b
    + c + d \\
         & = a + b
         + c + d + e
\end{align}

Which almost gets there, but not quite. The difference is clear.
Also, if I decide to remove the \phi, align-current does something simply bizarre:

\begin{align}
 & = a + b
    + c + d \\
 & = a + b
         + c + d + e
\end{align}

Is there a way I can customize align-current or use something else to get the desired effect?

Let's say I'm editing a latex in Auctex's latex-mode, and I have the following equation.

\begin{align}
    \phi & = a + b
    + c + d \\
    & = a + b
    + c + d + e
\end{align}

The above alignment is what I get if I select everything and hit TAB, that is, if I'm just using indent-region.

What I would like to get is the following:

\begin{align}
    \phi & = a + b
           + c + d \\
         & = a + b
           + c + d + e
\end{align}

Below is what I get if I call align-current.

\begin{align}
    \phi & = a + b
    + c + d \\
         & = a + b
         + c + d + e
\end{align}

Which almost gets there, but not quite. The difference is clear.
Also, if I decide to remove the \phi, align-current does something simply bizarre:

\begin{align}
 & = a + b
    + c + d \\
 & = a + b
         + c + d + e
\end{align}

Is there a way I can customize align-current or use something else to get the desired effect?

Let's say I'm editing a latex in Auctex's latex-mode, and I have the following equation.
This is just indented with indent-region.

\begin{align}
    \phi & = a + b
    + c + d \\
    & = a + b
    + c + d + e
\end{align}

The above alignment is what I get if I select everything and hit TAB, that is, if I'm just using indent-region.

What I would like to get is the following:
Note how the + c + d is aligned with the text after the &. This would make the most sense to be, as the + c + d are part of the same "column" as = a + b.

\begin{align}
    \phi & = a + b
           + c + d \\
         & = a + b
           + c + d + e
\end{align}

Below is what I get if I call align-current.

\begin{align}
    \phi & = a + b
    + c + d \\
         & = a + b
         + c + d + e
\end{align}

Which almost gets there, but not quite. The difference is clear.
Also, if I decide to remove the \phi, align-current does something simply bizarre:

\begin{align}
 & = a + b
    + c + d \\
 & = a + b
         + c + d + e
\end{align}

Is there a way I can customize align-current or use something else to get the desired effect?

Source Link
Malabarba
  • 23.3k
  • 6
  • 81
  • 166

Aligning multi-lined equations and tables in latex-mode

Let's say I'm editing a latex in Auctex's latex-mode, and I have the following equation.

\begin{align}
    \phi & = a + b
    + c + d \\
    & = a + b
    + c + d + e
\end{align}

The above alignment is what I get if I select everything and hit TAB, that is, if I'm just using indent-region.

What I would like to get is the following:

\begin{align}
    \phi & = a + b
           + c + d \\
         & = a + b
           + c + d + e
\end{align}

Below is what I get if I call align-current.

\begin{align}
    \phi & = a + b
    + c + d \\
         & = a + b
         + c + d + e
\end{align}

Which almost gets there, but not quite. The difference is clear.
Also, if I decide to remove the \phi, align-current does something simply bizarre:

\begin{align}
 & = a + b
    + c + d \\
 & = a + b
         + c + d + e
\end{align}

Is there a way I can customize align-current or use something else to get the desired effect?