Tuesday, November 15, 2011

LaTeX - align environment and equation numbering including \nonumber

I also posted this in the original, yet older, post on where I introduced the align environment.
http://timothyandrewbarber.blogspot.com/2011/08/align-environment-in-latex.html


In order to have the equation number at the end of a long, multi-line equation use the command \nonumber right before you end the line with the double slashes

\begin{align}
\dfrac{\partial^2 T \left( x, t + \dfrac{\Delta t}{2} \right)}{\partial x^2} = &\dfrac{1}{2} \left[ \dfrac{T \left( x + \Delta x, t + \Delta t \right) - 2 T \left( x, t + \Delta t \right) + T \left( x - \Delta x, t + \Delta t \right)}{\Delta x^2} \right. \nonumber \\ &\left. + \dfrac{T \left( x + \Delta x, t \right) - 2 T \left( x, t \right) + T \left( x - \Delta x, t \right)}{\Delta x^2} \right]  + O \left( \Delta x^2 \right)
\end{align}


In order to center the equation number, surround the array environment with an equation environment

\begin{equation}
\begin{align}
\dfrac{\partial^2 T \left( x, t + \dfrac{\Delta t}{2} \right)}{\partial x^2} = &\dfrac{1}{2} \left[ \dfrac{T \left( x + \Delta x, t + \Delta t \right) - 2 T \left( x, t + \Delta t \right) + T \left( x - \Delta x, t + \Delta t \right)}{\Delta x^2} \right. \\ &\left. + \dfrac{T \left( x + \Delta x, t \right) - 2 T \left( x, t \right) + T \left( x - \Delta x, t \right)}{\Delta x^2} \right]  + O \left( \Delta x^2 \right)
\end{align}
\end{equation}

No comments:

Post a Comment