Evaluation of Integral $ \int\ln(\tan x)dx$ 
Compute the indefinite integral
  $$
\int\ln(\tan x)\,dx
$$

My Attempt:
Using $\sin x = \frac{e^{ix}-e^{-ix}}{2i}$ and $\cos x = \frac{e^{ix}-e^{-ix}}{2}$ and remembering that $\ln(\tan x) = \ln(\sin x) - \ln(\cos x)$, we have
$$
\begin{align}
\int\ln(\tan x)dx &= \int \ln(\sin x)\,dx - \int \ln (\cos x)\,dx\\
&= \int \ln \left(\frac{e^{ix}-e^{-ix}}{2i}\right)\,dx - \int \ln \left(\frac{e^{ix}-e^{-ix}}{2}\right)\,dx\\
&= \int (e^{ix}-e^{-ix})\,dx-\int \ln(2i)\,dx-\int \ln \left(e^{ix}-e^{-ix}\right)\,dx+\int \ln(2)\,dx
\end{align}
$$
What should I do next to get to the solution?
 A: Using the principal branch of the logarithm,
$$ \begin{align} \int \ln (\tan x) &= \int \ln \left( -i \frac{e^{ix}-e^{-ix}}{e^{ix}+e^{ix}}\right) \ dx \\ &= \int \ln(-i)\ dx + \int \ln(e^{ix}-e^{-ix})\ dx - \int \ln(e^{ix}-e^{-ix}) \ dx \\ &= - \frac{i \pi}{2} x + \int \ln\big(e^{ix}(1-e^{-2ix}) \big) \ dx - \int \ln\big(e^{ix}(1+e^{-2ix})\big) \ dx \\ &= \frac{ \pi x}{2i} + \int \ln(1-e^{-2ix}) \ dx - \int \ln(1+e^{-2ix}) \ dx \\ &= \frac{ \pi x}{2i} - \frac{1}{2i} \int \frac{\ln (1-u)}{u} \ du + \frac{1}{2i}\int \frac{\ln(1+u)}{u} du  \\ &= \frac{\pi x}{2i} + \frac{1}{2i} \text{Li}_{2}(u) - \frac{1}{2i} \text{Li}_{2}(-u) + C \tag{1}\\ &= \frac{1}{2i} \left( \pi x + \text{Li}_{2}(e^{-2ix}) -\text{Li}_{2}(-e^{-2ix}) \right) + C . \end{align}$$
Then, for example, 
$$ \begin{align} \int_{0}^{\pi /4} \ln(\tan x) \ dx &= \frac{1}{2i} \Big[\frac{\pi^{2}}{4}  + \text{Li}_{2}(-i) -\text{Li}_{2}(i) - \text{Li}_{2}(1) + \text{Li}_{2}(-1) \Big] \\  &= \frac{1}{2i} \Bigg[\frac{\pi^{2}}{4} + \left( -\frac{\pi^{2}}{48}- i G \right) - \left(- \frac{\pi^{2}}{48} + i G \right) - \frac{\pi^{2}}{6} - \frac{\pi^{2}}{12}\Bigg] \\ &= \frac{1}{2i} \left( -2iG\right)= -G \end{align}$$
where $G$ is Catalan's constant.
$ $
$(1)$ http://mathworld.wolfram.com/Dilogarithm.html
A: Recall the definition of the Clausen function:
$$\operatorname{Cl}_2(x)=-\int_0^{x}\ln \left(2\sin\frac{t}{2}\right)dt.$$
Therefore, the antiderivative you are interested in can be written as
$$-\frac{\operatorname{Cl}_2\left(2x\right)+\operatorname{Cl}_2\left(\pi-2x\right)}{2}.$$
One can also write a few more representations in terms of related functions - for example, the dilogarithm, Lobachevsky function, or Barnes G-function.
