# Centering a \noalign section

I'm trying to format a list of steps to solve a quadratic equation. I have it so that it is aligning correctly for each of the math steps, but now I want to add some headings. This is what I have so far:

\begin{aligned}
x^2-4x+3&=&0\\\\
\noalign{\noindent some text in the middle.}\\\\
(x - 1)(x - 3)&=&0\\\\
\noalign{\noindent Solve Factor 1}\\\\
x - 1&=&0\\\\
+1& &+1\\\\
x&=&1\\\\
\noalign{\noindent Solve Factor 2}\\\\
x - 3&=&0\\\\
+3& &+3\\\\
x&=&3\\\\
\end{aligned}


The problems that I still have are: the noalign steps are still showing a lot of space around them. Also, is there a way to center the \noalign sections? Thanks!

-

Maybe something like this would look a bit better?

\newcommand{\pheq}{\mathrel{\phantom{=}}}

\begin{align*}
x^2-4x+3&= 0\\
\noalign{\centering some text in the middle.}
(x - 1)(x - 3)&= 0\\
\noalign{\centering Solve Factor 1}
x - 1&=0\\
+1& \pheq +1\\
x&= 1\\
\noalign{\centering Solve Factor 2}
x - 3&=0\\
+3&\pheq +3\\
x&= 3
\end{align*}


I think you were overusing the &'s and the \\'s in your example. Note that the syntax for aligned (as well as align) is that of

x &= y


i.e. there is only one & right before the math relation. Since you also wanted to align, for example, the line +1 +1 which does not have an = sign in the middle, I defined a \pheq which works just like a = with respect to spacing, but does not show up in the document.

Also note that a single pair \\ is enough. If, for some reason, you want a bit more of space between the lines, use something like \\[5pt] instead of a double line break. Also note that there is no \\ right before closing the environment.

-
Thanks a lot for your help! The one issue I have remaining is that I would like to have the right side aligned to the right (like the left side is). Is there a way to do that? –  Shane Fulmer Nov 18 '10 at 2:44
While I don’t think it is the most beautiful solution, replacing \noalign{\noindent some text in the middle.}\\ by \noalign{\centering some text in the middle.} (note the missing \\ at the end) solves the problem. I don’t know any simple way to improve the remaining spacing problems.