# Align and Center equations

I have the following equations . I just want to center them , such that the equality '= ' signs are one below the other. I tried \begin{align} but, that pushes them all to the left of the page.

\newcommand{\nrm}[1]{\left \lVert {#1} \right \rVert}

$$\nrm{e} ^2 _{L_2(I)} = \langle e,e \rangle_{L_2(I)}$$
$$= \langle e, -\phi '' \rangle_{L_2(I)}$$
$$= \langle e' ,\phi ' \rangle_{L_2(I)}$$
$$= \langle e ,\phi \rangle_{a}$$


How do I do it?

In the align environment, lines are centred around the & character. Use

\documentclass{article}
\usepackage{amsmath}
\newcommand{\nrm}[1]{\left \lVert {#1} \right \rVert}

\begin{document}
\begin{align*}
\nrm{e} ^2 _{L_2(I)} &= \langle e,e \rangle_{L_2(I)} \\
&= \langle e, -\phi '' \rangle_{L_2(I)} \\
&= \langle e' ,\phi ' \rangle_{L_2(I)} \\
&= \langle e ,\phi  \rangle_{a} \\
\end{align*}
\end{document}


The align* environment is used to avoid equation numbering; if you want this, remove the asterisks.

• Yeah, This works, Great!!. But it removes the equation number. – ssk May 29 '14 at 5:55
• @ssk: The code snippet you posted doesn't produce equation numbers either. If you need equation numbers, it's helpful to state it explicitly in the posting. (Hint: use align instead of align*.) – Mico May 29 '14 at 6:02
• remove the * and you get the number back :) If you also add the line breaks be sure to disable the numbering for some lines using \nonumber – Ronny May 29 '14 at 6:02

Here is how I would do it using the powerful mathtools package:

\documentclass{article}

\usepackage{mathtools}

\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\DeclarePairedDelimiter{\inner}{\langle}{\rangle}

\begin{document}

\begin{align*}
\norm{e}_{L_{2}(I)}^{2}
&= \inner{e, e}_{L_{2}(I)}\\
&= \inner{e, -\phi''}_{L_{2}(I)}\\
&= \inner{e', \phi'}_{L_{2}(I)}\\
&= \inner{e, \phi}_{a}
\end{align*}

\end{document}


The point of using \DeclarePairedDelimiter to define the delimiter macros \norm and \inner is that you will get an automatic scaling by using the starred versions of the macros (and the code syntax in nice and clean).