# Writing an equation on two lines and adjusting the second line to the center

I am trying to split my equation into two lines. I want to adjust the second line to the center instead of having it at the left end of the equation.

\begin{equation*}
\begin{aligned}
x(k+3) = A[A^2x(k+1) + ABu(k) + AFd(k) + Af + Bu(k+1) + Fd(k+1) + f] + Bu(k+2) \\
+ Fd(k+2) + f
\end{aligned}
\end{equation*}


• For such aligning is intended gather environment, defined in the amsmath package: \begin{gather*} x(k+3) = A[A^2x(k+1) + ABu(k) + AFd(k) + Af + Bu(k+1) + Fd(k+1) + f] + Bu(k+2) \\ + Fd(k+2) + f \end{gather*} Commented Nov 24, 2020 at 21:58

You're probably interested in gather* rather than aligned, although a more common approach is to use align* with the appropriate alignment markers & and spacing correction:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align*}
x(k + 3) &= A \bigl[ A^2 x(k + 1) + A B u(k) + A F d(k) + A f + B u(k + 1) + F d(k + 1) + f \bigr] + B u(k + 2) \\
&\phantom{{}={}} + F d(k + 2) + f
\end{align*}

\begin{gather*}
x(k + 3) = A \bigl[ A^2 x(k + 1) + A B u(k) + A F d(k) + A f + B u(k + 1) + F d(k + 1) + f \bigr] + B u(k + 2) \\
{} + F d(k + 2) + f
\end{gather*}

\end{document}


Note the use of {} in the second line of gather* to achieve the appropriate spacing around the binary operator +.