<s>[INST] Prove that $2\int_0^\infty \frac{e^x-x-1}{x(e^{2x}-1)} \, \mathrm{d}x =\ln(\pi)-\gamma $ Let $\gamma$ be the Euler-Mascheroni constant.
I'm trying to prove that

$$2\int_0^\infty \frac{e^x-x-1}{x(e^{2x}-1)} \, \mathrm{d}x =\ln(\pi)-\gamma $$


I tried introducing a parameter to the exponent in the numerator and then differentiating under the integral sign. But doing so seems to result in an integral that doesn't converge.
 [/INST] $$ \begin{align} 2\int_{0}^{\infty} \frac{e^x-x-1}{x(e^{2x}-1)} \, dx &= 2 \int_{0}^{\infty} \frac{1}{x(e^{2x}-1)} \sum_{n=2}^{\infty} \frac{x^{n}}{n!}\\ & = 2 \sum_{n=2}^{\infty}\frac{1}{n!} \int_{0}^{\infty} \frac{x^{n-1}}{e^{2x}-1} \, dx \\ &= 2 \sum_{n=2}^{\infty}\frac{1}{n!2^{n}} \int_{0}^{\infty} \frac{u^{n-1}}{e^{u}-1} \, du \\ &= 2 \sum_{n=2}^{\infty} \frac{\zeta(n)}{n 2^{n}} \tag{1} \\ &= 2 \sum_{n=2}^{\infty} \frac{1}{n 2^{n}} \sum_{k=1}^{\infty} \frac{1}{k^{n}} \\ &= 2 \sum_{k=1}^{\infty} \sum_{n=2}^{\infty} \frac{1}{n(2k)^{n}} \\ & =2  \sum_{k=1}^{\infty} \left[ \log \left(\frac{2k}{2k-1} \right) - \frac{1}{2k}\right] \\ & =2 \lim_{N \to \infty} \left(\log \left(\frac{(2N)!!}{(2N-1)!!} \right) - \frac{H_{N}}{2} \right) \\ &= 2 \lim_{N \to \infty} \left(\log \left(\frac{2^{2N}(N!)^2}{(2N)!} \right) - \frac{H_{N}}{2} \right) \tag{2} \\ &= 2 \lim_{N \to \infty} \left(\log \left(\frac{2^{2N}(2\pi N) \left(\frac{N}{e} \right)^{2N}}{\sqrt{2 \pi(2N)} \left(\frac{2N}{e} \right)^{2N}} \right) - \frac{H_{N}}{2} \right) \tag{3} \\ &= \lim_{N \to \infty} \left(\log(\pi) + \log(N) - H_{N} \right)  \\  &= \log(\pi) - \gamma \end{align}$$

$(1)$ https://en.wikipedia.org/wiki/Riemann_zeta_function#Definition
$(2)$ http://mathworld.wolfram.com/DoubleFactorial.html
$(3)$ https://en.wikipedia.org/wiki/Stirling's_approximation
</s>