# problem with align

i'm trying to typeset someting like this:

\begin{align} f_{**p}(X_p,Y_p)  = X_p(Y(f)) = \sum_{i,j = 1} ^n \alpha_i
\beta_j E_{pi}(E_j(f)) f
\end{align}
short remark
\begin{align}
E_{pi}(E_j(f)) &= \frac{\partial}{\partial x_i}(E_j(f) \circ \phi^{-1} )|_{\phi(p)} \\
&= \frac{\partial}{\partial x_i} ...
\end{align}


but I would like to put the short remark in a \shortintertext inside the same align environment, that is:

\begin{align} f_{**p}(X_p,Y_p)  = X_p(Y(f)) = \sum_{i,j = 1} ^n \alpha_i
\beta_j E_{pi}(E_j(f)) f
\shortintertext{short remark}
E_{pi}(E_j(f)) &= \frac{\partial}{\partial x_i}(E_j(f) \circ \phi^{-1} )|_{\phi(p)} \\
&= \frac{\partial}{\partial x_i} ...
\end{align}


However for some reason the spacing is terrible in this last one. How can I fix this?

Thanks for any help.

-
This is a comment not directly related to the core of your question, but to your apparent usage of summation notation: The expression \sum_{i,j = 1} ^n is potentially ambiguous as it could be taken to indicate that the indices i and j should always be equal, i.e., i=j=1, i=j=2, ..., i=j=n. If that's not what you want to express, i.e., if the indices i and j can range independently from 1 to n, it may be preferable to use double summation notation: \sum_{i=1}^n \sum_{j=1}^n. –  Mico Jan 4 '13 at 1:21

If you don't want the first equation to align with the others, use:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{gather}
f_{**p}(X_p,Y_p)  = X_p(Y(f)) = \sum_{i,j = 1} ^n \alpha_i
\beta_j E_{pi}(E_j(f)) f
\\
\shortintertext{short remark}
\begin{align}
E_{pi}(E_j(f)) &= \frac{\partial}{\partial x_i}(E_j(f) \circ \phi^{-1} )|_{\phi(p)} \\
&= \frac{\partial}{\partial x_i}
\end{align}
\end{gather}
\end{document}

-
Thanks, this is exactly what I was looking for. I didn't know you could use one environment inside the other. Accepted! –  Emilio Ferrucci Jan 3 '13 at 23:53
@Emilio This works as long as you don't label the equations inside align, see also my answer tex.stackexchange.com/a/85699/21591. –  mafp Jan 3 '13 at 23:57
I don't think it's a good idea to nest an align environment inside a gather environment. Why not just use an equation environment for the first equation and a non-nested align environment for the second and third equations? A side benefit of such a setup is that it won't cause trouble with missed page breaks; by default, the gather environment doesn't allow page breaks between equations... –  Mico Jan 4 '13 at 1:10
@Mico All true. But the OP asked specifically for that to get the narrow spacing with \shortintertext. I myself would probably try an equation together with an align, maybe accompanied with \SwapAboveDisplaySkip. But that might be another answer ... ;-) –  mafp Jan 4 '13 at 1:27

You missed a & in the first equation and a \\ before \shortintertext{short remark}

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{align}
f_{**p}(X_p,Y_p)  &= X_p(Y(f)) = \sum_{i,j = 1} ^n \alpha_i
\beta_j E_{pi}(E_j(f)) f\\
\shortintertext{short remark}
E_{pi}(E_j(f)) &= \frac{\partial}{\partial x_i}(E_j(f) \circ \phi^{-1} )|_{\phi(p)} \\
&= \frac{\partial}{\partial x_i}
\end{align}
\end{document}


# On request from Op:

You can use \span\omit as in:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
$$f_{**p}(X_p,Y_p) = X_p(Y(f)) = \sum_{i,j = 1} ^n \alpha_i \beta_j E_{pi}(E_j(f)) f$$
\begin{align}
f_{**p}(X_p,Y_p)  = X_p(Y(f)) = \sum_{i,j = 1} ^n \alpha_i
\beta_j E_{pi}(E_j(f)) f \span\omit\\
\shortintertext{short remark}
E_{pi}(E_j(f)) &= \frac{\partial}{\partial x_i}(E_j(f) \circ \phi^{-1} )|_{\phi(p)} \\
&= \frac{\partial}{\partial x_i}
\end{align}
\end{document}


-
Thanks for your answer. The point, however, is that I don't want the part after the short remark to be aligned with anything above. I would like the first line to have its own natural spacing and would like to start aligning stuff after that, which is what happens if I use two separate align environments. –  Emilio Ferrucci Jan 3 '13 at 23:27
Do you want to align things from second equation onwards? If so, put first equation inside and rest inside align. –  Harish Kumar Jan 3 '13 at 23:30
But I wanted to put my short remark in a shortintertext to avoid losing a lot of space. Perhaps there is no way to avoid alignign equations starting from the first line in the align environment... –  Emilio Ferrucci Jan 3 '13 at 23:33
@Emilio See the update. I have changed and added the & in first equation. Let me know if it is ok. The first equation is for showing that the natural position is matching. –  Harish Kumar Jan 3 '13 at 23:42
But now the aligned equations aren't centered as they were before. –  Emilio Ferrucci Jan 3 '13 at 23:49