Let's say you buy 1000 shares in Company A for $10 each. Six months down the track, Company A does a demerger and spins off one aspect of their business into Company B. The deal is that however many shares you have in Company A, you will be given the same number of shares in Company B.
After the demerger takes place, Company A shares drop to $5 and Company B shares are valued at $5 by the market (so you still haven't lost any 'value' as such, because you still hold $1,000 worth of shares in total).
A further six months down the track, Company A shares are now worth $6 on the market, and you decided to sell your 1000 shares, so you receive $6,000.
Have you made a loss, because you bought these Company A shares at $10 and sold them at $6? Or have you made a gain, because the total value of your shares is $11 as opposed to $10?