You are correct. Basically take all the gains for the year, subtract the losses, and if the losses are more than the gains then you have a capital loss, whereas if you have more gains than losses (totals) then you have a gain. Unfortunately Uncle Sam will only allow you to deduct 3K of losses in any given year on line 7 of form 1040, whereas there is no such limitation on your gains.
So in your example, 10K gains, 23K losses, means that on line 7 you would enter -3,000 and then carryover the remaining 10K loss to the following year.
Forgot to mention that when you match your losses vs your gains for the year, you would also include any carryover losses from the prior year into the calculation.