$\int x \tan x \,dx=\frac{1}{2} i \text{Li}_2\left(-e^{2 i x}\right)+\frac{i x^2}{2}-x \log\left(1+e^{2 i x}\right)+C $ Where Li is the [polylogarithm function][1] You can express the result in closed form also through polygamma function, Hurwitz zeta function or generalizer (to real orders) Bernoulli polynomials. [1]: https://en.wikipedia.org/wiki/Polylogarithm