convert to sin . cos
put tan( x/2) = t
\int \left(\frac{cotx+cosecx-1}{cotx - cosecx+1} \right)dx
ans ------>ln\left|2sin^{2}\frac{x}{2} \right|+c
\int \frac{cosx+1-sinx}{cosx-1+sinx} = \int \frac{1-tan^{2}\frac{x}{2} + 1 +tan^{2}\frac{x}{2} - 2 tan\frac{x}{2}}{1-tan^{2}\frac{x}{2} - 1 -tan^{2}\frac{x}{2} + 2 tan\frac{x}{2}} = \int cot\frac{x}{2}dx
\int cot\frac{x}{2}dx = log\left|sin^{2}\frac{x}{2} \right|