Solution
= Solution
Take $t=e^x>0$ in the <substitution rule>, so $dx=dt/t$. The transformed <integral> is
$$
\int\frac{t-2}{t^2+1}\,dt=\frac12\ln(t^2+1)-2\arctan t+C.
$$
The two terms follow from the <derivatives> of the <natural logarithm> and the <inverse tangent>. Returning to $x$ gives the <antiderivative>
$$
\boxed{\frac12\ln(1+e^{2x})-2\arctan(e^x)+C.}
$$