Interesting article I found on a cycling web site. Has some good info that I had not thought about.
There are 4 things to consider if you are trying to prevent muscle cramps:
training - as with the two other forms of activity related muscle pain, training to the level of the anticipated activity will decrease the possibility of incapacitating cramps.
hydration - dehydration is probably tied as one of the most common causes of muscle cramps.
electrolyte replacement - sweat contains approximately 2 grams sodium/liter, 1 gram chloride/liter,0.2 gram potassium /liter, and 0.1 gram magnesium/liter - and if you are acclimated, these concentrations are even lower. Except in extreme circumstances, dietary intake will replace these losses, but if you are going to be exercising in excessively hot or humid conditions, most trainers would suggest paying close attention to salt intake and even adding 1/2 tsp of salt (1150 mg of sodium) per day to your food. Don't worry about elevating your blood pressure as we are talking about a short term supplement and the sodium effect on blood pressure happens over months to years. A sports drink might help, but it is more likely that just maintaining adequate hydration is more important than the small amount of electrolytes they contain - and water is still a lot less expensive. The role of other micronutrients and vitamins are completely unproven.
In a recent review, it was suggested that magnesium might be an important electrolytes while the following comments suggested calcium might be a culprit as well.
"I read about a study of cramping during the Hotter'n Hell Hundred in Texas. They took blood samples of riders that cramped and riders that didn't. The most common deficiency wasn't calcium or potassium like many would guess, but magnesium. They suggested Rolaids because Rolaids has both calcium and magnesium, whereas Tums only has calcium. I like the fact that Rolaids covers you both ways."
"I have been plagued with leg cramps until a friend suggested standard calcium with magnesium supplements. I would take them prior to bed with a large glass of water. Amazingly, no more cramps. I also suffered during long rides and was concerned during a cross-country tour with my wife last summer. I would take one tablet in the morning and afternoon and of course stay hydrated. Not once during even the most arduous days or while sleeping did I suffer any cramps."
As magnesium is lost in sweat, the idea of a magnesium deficiency is physiologically more attractive than speculation that calcium (almost never a problem physiologically with so much calcium in the bones to draw upon) is at fault.
muscle glycogen reserves - replenishment of ATP is important for proper muscle cell functioning with adequate Caloric intake needed to achieve optimal physical performance. However the role of adequate glycogen reserves in preventing muscle cramps is speculative and requires further investigation.