Yes you will have to pay capital gains on it even if you don't remove it. If you lose the gain in another stock you count your losses again your gains.
You bought and sold, had gains then you will get a F-1099 at the end of the year even if you re-invested on the same security or another... but if you had losses on the one you re-invested in, assuming you sold, you can deduct that at the end of the year as well. Only if you sold, paper losses don't count... you need to sell to take the loss...