In my align* environment I have a bunch of lined up equations, but I would like to put some explanations of the steps done to the right of the equations. Currently it looks bad:
\begin{align*}
P(X_l=x_l,\ldots ,X_{l+k}=x_{l+k}) &= \int_0^1 f(x_l)\cdots f(x_{l+k})dp\\
&= \int_0^1 \prod_{i=1}^k p^{1\{x_i=1\}}(1-p)^{1\{x_i=0\}}dp\\
&= \int_0^1 p^t(1-p)^{k-t}dp\\
&= \int_0^1 p^{t+1-1}(1-p)^{k-t+1-1}dp\\
&= \dfrac{\Gamma(k-t+1)\Gamma(t+1)}{\Gamma(k+2)}\int_0^1\dfrac{\Gamma(k+2)}{\Gamma(k-t+1)\Gamma(t+1)} p^{t+1-1}(1-p)^{k-t+1-1}dp\\
&= \dfrac{\Gamma(k-t+1)\Gamma(t+1)}{\Gamma(k+2)} \text{ \; term on right is a $\Gamma(t+1,k-t+1)$}\\
&= \dfrac{t!(k-t)!}{(k+1)!} \text{ \; Since $k$ is an integer}
\end{align*}
How would you make this look better? More specifically I think the text would look nice if it was all flushed to the right.
EDIT: How do I make the Latex show up?
Best Answer
In many situations, a comment can be added in the following way:
so that the comments are (left) aligned to each other. However, your case is different: the comment would be only in the last two lines and the fifth one is quite long. The fifth line makes it hard to set the comments so they stick out as such.
Probably the most amenable solution is to defer the comments to the text below the alignment. These are tough decisions, anyway. What about this?