In the Mathematics for Physics of Stone and Goldbart the canonical energy momentum tensor is derived by the action principle as follows.
To the action of the form
$$ S=\int \mathcal{L}(\varphi,\varphi_\mu) \, \mathrm{d}^{d+1}x ,$$
where $\mathcal{L}$ the lagrangigan density and $\varphi_\mu = \frac{\partial \varphi}{\partial x^\mu}$ is, we make the variation of the form
$$ \varphi(x) \rightarrow \varphi(x^\mu + \varepsilon^\mu(x)) = \varphi (x^\mu) + \varepsilon^\mu(x)\partial_\mu\varphi+O(|\varepsilon|^2) ,$$ where $x=(x^0,...,x^d)$ is.
Then the resulting variation is
$$\delta S= \int \left( \frac{\partial\mathcal{L}}{\partial \varphi} \varepsilon^\mu \partial_\mu \varphi +\frac{\partial \mathcal{L}}{\partial \varphi_\nu} \partial_\nu(\varepsilon^\mu \partial_\mu \varphi) \right)\mathrm{d}^{d+1}x$$ $$ = \int \varepsilon^\mu \frac{\partial}{\partial x^\nu} \left( \mathcal{L} \delta^\nu_\mu -\frac{\partial \mathcal{L}}{\partial \varphi_\nu} \partial_\mu \varphi \right)\, \mathrm{d}^{d+1}x. $$
I understand that from going line 1 to 2 some sort of integration by parts is done. However when I try to do that I run into some trouble and don't get the second line. Can someone do it explicityl so that I learn where I made the mistake.
EDIT
My steps are
$$ \delta S=\int_\Omega \frac{\delta S}{\delta \varphi(x)} \mathrm{d}\Omega, $$ where $\Omega$ to be integrated region is.
$$=\int_\Omega \delta\varphi\left( \frac{\partial \mathcal{L}}{\partial \varphi} - \partial_\nu \frac{\partial\mathcal{L}}{\partial \varphi_\nu} \right) \mathrm{d}\Omega$$
$$=\int_\Omega \varepsilon^\mu \frac{\partial \varphi}{\partial x^\mu} \left( \frac{\partial \mathcal{L}}{\partial \varphi} - \partial_\nu \frac{\partial\mathcal{L}}{\partial \varphi_\nu} \right) \mathrm{d}\Omega \qquad \because \delta\varphi= \varepsilon^\mu \partial_\mu \varphi $$
$$=\int_\Omega \varepsilon^\mu \left( \frac{\partial \mathcal{L}}{\partial x^\mu} - \partial_\nu \frac{\partial\mathcal{L}}{\partial \varphi_\nu}\cdot \frac{\partial \varphi}{\partial x^\mu} \right) \mathrm{d}\Omega$$
Now I can take out $\partial_\nu$ however $\partial_\nu$ acts only on $\frac{\partial\mathcal{L}}{\partial \varphi_\nu}$ and not on $\frac{\partial \varphi}{\partial x^\mu}$. I thought $\partial_\nu\frac{\partial \varphi}{\partial x^\mu}$ could be zero so that I can take the partial derivative out of the bracket but I don't see why this should be true. If I were to take it out I arrive at the equation in the second line above.