Here's how you figure your gain:
Step 1: Determine the overall gain you have on the exchange. To do this, you need to know the value per share of the merger consideration, including both shares and stock. Generally the company gives you this information at the time of the merger. If you can't find this information, it's likely to be on the company's web site. Multiply that figure times the number of shares you held to determine the total consideration you received. Then subtract your total basis in the shares you held to get the overall gain.
Step 2: The amount of gain you report is the lesser of the amount of gain from step 1 or the amount of cash you received.
Step 3: Your basis in the shares you received is equal to your basis in the old shares, increased by the amount of gain you reported and decreased by the amount of cash you received.