Left-align {align} environment

I have a problem writing my report in LaTeX. I dearly need this block of equations to be aligned on the left side of the page, in fact I want all my equations to be left-aligned and have the option of centering, right-aligning specific {align} blocks. How do I do this? The following code is right-centered and parts of my equation is actually out of the page..

\begin{align}
u(x+\Delta x, t) = u(x,t) +\frac{\partial u(x,t)}{\partial x}\Delta x +\frac{\partial u(x,t)}{\partial t}(t-t) + \frac12\frac{\partial^2 u(x,t)}{\partial x^2}(\Delta x)^2 \\+ \frac{\partial^2u(x,t)}{\partial x\partial y}(t-t)(\Delta x)^2 + \frac12\frac{\partial u(x,t)}{\partial^2t}(t-t)^2 +(...)\Delta x^3 +(...)\Delta x^4 \intertext{Seeing powers of t dropping in expansion around $x\pm\Delta x$}\\
u(x-\Delta x, t) = u(x,t) -\frac{\partial u(x,t)}{\partial x}\Delta x +  \frac12\frac{\partial^2 u(x,t)}{\partial x^2}(\Delta x)^2 -(...)\Delta x^3 +(...)\Delta x^4\\
\left[\frac12\frac{\partial^2 u(x,t)}{\partial x^2}(\Delta x)^2+ \frac12\frac{\partial^2 u(x,t)}{\partial x^2}(\Delta x)^2\right] = u(x-\Delta x, t) + u(x+\Delta x, t) - u(x,t) - u(x,t) + O(\Delta x^4)
\intertext{Odd powers of $\Delta x$ cancelling eachother}\\
\frac{\partial^2 u(x,t)}{\partial x^2} = \frac{u(x-\Delta x, t) + u(x+\Delta x, t) - 2u(x,t)}{\Delta x^2} + O(\Delta x^2)
\end{align}


Is there a way to indent a copy-paste autoamtically in here without spacing each line with 4 whitespaces? That isn't working because the browser is keeping the formatting of my copy-paste so some lines can't be indented unless I do each line by hand. This looks ugly, very ugly.

-

migrated from stackoverflow.comDec 8 '11 at 21:14

This question came from our site for professional and enthusiast programmers.

The align environment of amsmath should be aligned by inserting & wherever alignment is wanted. Additionally, global left-aligned equations is possible by using the fleqn option to amsmath: \usepackage[fleqn]{amsmath}. Finally, align does not automatically break equations if they do not fit on the page. You need to either manually break the equations where they cannot fit within the text block, or use something like breqn. –  Werner Dec 8 '11 at 20:59

1 Answer

use it this way:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align}
u(x+\Delta x, t) &= u(x,t) +\frac{\partial u(x,t)}{\partial x}\Delta x +\frac{\partial u(x,t)}{\partial t}(t-t) + \frac12\frac{\partial^2 u(x,t)}{\partial x^2}(\Delta x)^2 \\
& \qquad + \frac{\partial^2u(x,t)}{\partial x\partial y}(t-t)(\Delta x)^2 + \frac12\frac{\partial u(x,t)}{\partial^2t}(t-t)^2 \\
& \qquad +(...)\Delta x^3 +(...)\Delta x^4
\intertext{Seeing powers of t dropping in expansion around $x\pm\Delta x$}
u(x-\Delta x, t) &= u(x,t) -\frac{\partial u(x,t)}{\partial x}\Delta x +  \frac12\frac{\partial^2 u(x,t)}{\partial x^2}(\Delta x)^2 -(...)\Delta x^3 +(...)\Delta x^4\\
& \left[\frac12\frac{\partial^2 u(x,t)}{\partial x^2}(\Delta x)^2+ \frac12\frac{\partial^2 u(x,t)}{\partial x^2}(\Delta x)^2\right] \\
& = u(x-\Delta x, t) + u(x+\Delta x, t) - u(x,t) - u(x,t) + O(\Delta x^4)
\intertext{Odd powers of $\Delta x$ cancelling eachother}
\frac{\partial^2 u(x,t)}{\partial x^2} &= \frac{u(x-\Delta x, t) + u(x+\Delta x, t) - 2u(x,t)}{\Delta x^2} + O(\Delta x^2)
\end{align}

\end{document}


-