Here is a second proof:
[math]\begin{array}{lll} 1-\dfrac{2}{1+\tan(x/2)}&=1-\dfrac{2}{1+\dfrac{1-\cos(x)}{\sin(x)}}\\[24pt] &=1-\dfrac{2\sin(x)}{1+\sin(x)-\cos(x)}\\[24pt] &=\dfrac{1-\sin(x)-\cos(x)}{1+\sin(x)-\cos(x)}\cdot \dfrac{1-\sin(x)-\cos(x)}{1-\sin(x)-\cos(x)}\\[24pt] &=\dfrac{\left(1-\sin(x)-\cos(x)\right)^2}{\left(1-\cos(x)\right)^2-\sin^2(x)}\\[24pt] &=\dfrac{\left(1-\left(\sin(x)+\cos(x)\right)\right)^2}{1-2\cos(x)+\cos^2(x)-\sin^2(x)}\\[24pt] &=\dfrac{1-2(\sin(x)+\cos(x))+\sin^2(x)+2\sin(x)\cos(x)+\cos^2(x)}{2\cos^2(x)-2\cos(x)}\\[24pt] &=\dfrac{1-\sin(x)-\cos(x)+\sin(x)\cos(x)}{-\cos(x)\left(1-\cos(x)\right)}\\[24pt] &=\dfrac{1-\cos(x)}{-\cos(x)\left(1-\cos(x)\right)}+\dfrac{\sin(x)(-1+\cos(x))}{\cos(x)\left(-1+\cos(x)\right)}\\[24pt] &=-\sec(x)+\tan(x) \end{array}[/math]
[math]\begin{array}{lll} 1-\dfrac{2}{1+\tan(x/2)}&=1-\dfrac{2}{1+\dfrac{1-\cos(x)}{\sin(x)}}\\[24pt] &=1-\dfrac{2\sin(x)}{1+\sin(x)-\cos(x)}\\[24pt] &=\dfrac{1-\sin(x)-\cos(x)}{1+\sin(x)-\cos(x)}\cdot \dfrac{1-\sin(x)-\cos(x)}{1-\sin(x)-\cos(x)}\\[24pt] &=\dfrac{\left(1-\sin(x)-\cos(x)\right)^2}{\left(1-\cos(x)\right)^2-\sin^2(x)}\\[24pt] &=\dfrac{\left(1-\left(\sin(x)+\cos(x)\right)\right)^2}{1-2\cos(x)+\cos^2(x)-\sin^2(x)}\\[24pt] &=\dfrac{1-2(\sin(x)+\cos(x))+\sin^2(x)+2\sin(x)\cos(x)+\cos^2(x)}{2\cos^2(x)-2\cos(x)}\\[24pt] &=\dfrac{1-\sin(x)-\cos(x)+\sin(x)\cos(x)}{-\cos(x)\left(1-\cos(x)\right)}\\[24pt] &=\dfrac{1-\cos(x)}{-\cos(x)\left(1-\cos(x)\right)}+\dfrac{\sin(x)(-1+\cos(x))}{\cos(x)\left(-1+\cos(x)\right)}\\[24pt] &=-\sec(x)+\tan(x) \end{array}[/math]