0

I have 3 equations with 2 equals signs, followed by 2 equations with single equals signs. It makes so much sense to align the first 3 from their first equals signs, and then the latter 2 equations with the second equals sign of the 3rd equation.

The following aligns all 5 of the equations from the first equals sign:

\end{align*}
    T(0) &= c_1 + c_2 = 9\\
    T(1) &= 3c_1 + c_2 = 17\\
    T(1) - T(0) &= 2c_1 = 8\\
    c_1 &= 4\\
    c_2 &= 5
\end{align*}

enter image description here

I wish there was a marker I could put on the second equals sign of the third equation to mark it as the alignment point for the subsequent equations. Is there a robust way, perhaps a package doing this?

1 Answer 1

2

Here is a not-so-robust trick to have the desired output:

\begin{align*}
    T(0) &= c_1 + c_2 = 9\\
    T(1) &= 3c_1 + c_2 = 17\\
    T(1) - T(0) &=
    \begin{aligned}[t]
        2c_1 &= 8\\
        c_1 &= 4\\
        c_2 &= 5
    \end{aligned}
\end{align*}

enter image description here

If the left-hand-side of the subsequent equations are not shorter than the first, then \mathllap will be necessary to keep the equation with the alignment-interchange flush:

\begin{align*}
    T(0) &= c_1 + c_2 = 9\\
    T(1) &= 3c_1 + c_2 = 17\\
    T(1) - T(0) &=
    \begin{aligned}[t]
        2c_1 &= 8\\
        \mathllap{0+c_1} &= 4\\
        c_2 &= 5
    \end{aligned}
\end{align*}

enter image description here

Other issues that I cannot think of now may arise with different sets of equations. There might be a better solution.

1
  • 3
    Shouldn't the first line be \begin{align*} instead of \end...?
    – leandriis
    Dec 22, 2019 at 9:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .