Trying to understand a power series example from Advanced Calculus by Taylor 
Example 2 from 21.1 in the book, Find an expansion in powers of $x$ of the function 
$$
f(x) = \int_{0}^{1} \frac{1-e^{-tx}}{t}dt
$$
and use it to calculate $f(1/2)$ approximately.

I understand how to get the power series
$$
\frac{1-e^{-tx}}{t} = x-\frac{tx^2}{2!}+\frac{t^2x^3}{3!} + ... + (-1)^{n-1}\frac{t^{n-1}x^n}{n!} + ... \tag{1}
$$
however I'm a bit confused by the integration shown in the book in order to get a power series for f(x).
according to the book it should be 
$$
f(x) = x-\frac{x^2}{2*2!}+\frac{x^3}{3*3!}-...+(-1)^{n-1}\frac{x^n}{n*n!}+...
$$
but this doesn't make sense to me as we are integrating with respect to t, and even if we were integrating with respect to x that wouldn't be correct.
Can anyone shed some light on this?
 A: We have $$\int_0^1 \frac{1-e^{-tx}}{t} \, \mathrm{d}t= \int_0^1 x-\frac{tx^2}{2!}+\frac{t^2x^3}{3!} + \cdots + (-1)^{n-1}\frac{t^{n-1}x^n}{n!} + \cdots \, \mathrm{d}t$$ You can split the right hand side term by term to get $$\int_{0}^1 x\, \mathrm{d}t - \int_0^1 \frac{tx^2}{2!} \, \mathrm{d}t + \cdots + \int_0^1 (-1)^{n-1}\frac{t^{n-1}x^n}{n!}\, \mathrm{d}t + \cdots$$
Let's evaluate the first few terms manually: You should treat $x$ like a constant since you're integrating with respect to $t$, hence you get $$\bigg[xt\bigg]_0^1 - \left[\frac{t^2x^2}{2\cdot 2!}\right]_0^1  +  \left[\frac{t^3x^3}{3\cdot 3!}\right]_0^1 + \cdots$$
So, wrapping things up, I'm sure you can now see that we get $$\int_0^1 \frac{1-e^{-tx}}{t} \, \mathrm{d}t = x - \frac{x^2}{2 \cdot 2!} + \frac{x^3}{3\cdot 3!} + \cdots + (-1)^{n-1}\frac{x^n}{n \cdot n!} + \cdots$$

You could also have simply done $$\int_{0}^{1}\frac{1-e^{-tx}}{t} \, \mathrm{d}t=\sum_{k=1}^\infty \frac{\left(-1\right)^{k}x^{k}}{k‌!}\int_{0}^{1}t^{k-1} \, \mathrm{d}t=\sum_{k=1}^{\infty}\frac{\left(-1\right)^{k}x^{k}}{k\cdot k!}.$$

Then $$f\left(\frac{1}{2}\right) = \sum_{k=1}^{\infty} \frac{(-1)^k}{2^k \cdot k \cdot k!}$$
