Indefinite integral $\int \frac{1}{2-\cos(x)}\,dx$ has discontinuities. How to fix? Using the standard tangent half-angle substitution, we get $$\int \frac{1}{2-\cos(x)}\,dx = \frac{2}{\sqrt{3}}\tan^{-1}(\sqrt{3}\tan\frac{x}{2}) + C$$
The resulting antiderivatives are piecewise continuous functions with discontinuities at $x = (2k+1)\pi$. However, the integrand is continuous everywhere, so any antiderivative must be continuous everywhere (??) according to FTC. So, how do we deal with this problem? What is the correct form of the antiderivatives? Is there a form that avoids the discontinuities?

Although I'm really late with the answer, here's something other people might find interesting.
There is a continous elementary antiderivative,
$$F(x)=\frac{2}{\sqrt{3}}\left(\frac{x}{2}+ \tan^{-1}\left(\frac{\left( \sqrt{3}-1 \right)\tan\frac{x}{2}}{1+\sqrt{3}\tan^2\frac{x}{2}}\right)\right)$$
— but finding it may be somewhat inconvenient. Here's the how.
First of all, we carefully look at the function $\tan^{-1}\left(\tan x\right)$. Quite interesting plot, isn't it?
So, we see (check it!) that the floor function can be written as $$\mathbb{floor}(x)=\frac{2x-1}{2}-\frac{1}{\pi} \tan^{-1}\left(\tan\left( \frac{2x-1}{2}\pi  \right)\right)$$
Next, we find the precise floor expression that eliminates the discontinuities in your antiderivative. That part of the work is already done in one of the answers, $$\left \lfloor \frac{1}{2}\left( \frac{x}{\pi}+1 \right)  \right \rfloor = \frac{1}{\pi}\left( \frac{x}{2}-\tan^{-1}(\tan(\frac{x}{2}))\right) $$
Then you add this staircase function to your antiderivative, and end up with
$$F(x)=\frac{2}{\sqrt{3}} \left[ \tan^{-1}\left(\sqrt{3}\tan\frac{x}{2}\right)+\frac{x}{2}-\tan^{-1}\left(\tan\frac{x}{2}\right)  \right] $$ which is already cool if you don't mind stuff like $\tan^{-1}(\tan(x))$. But since we can combine inverse tangent sums by using the formula $\tan^{-1}(a)+\tan^{-1}(b)=\tan^{-1} \left( \frac{a+b}{1-ab} \right)$, we can go even further!
Combining inverse tangents and simplifying the resulting expression, we finally get a fully continuous antiderivative $F$ that we can use to calculate definite integrals without paying attention to the limits.
