Asparagus
Asparagusic acid is the culprit, or alpha-aminodimethyl-gamma-butyrothetin for those of chemical mind. It is found in asparagus, and a few other food plants, though some non-food plants like tropical mangrove also contain it. The other interesting thing about asparagusic acid, other than being the chemical that probably makes urine smell after eating asparagus, is that it is kills parasitic nematodes, and protects the asparagus plant against them.
But the asparagus and smelly urine problem is more complicated. Not all of us can actually smell the smell in urine if it is there. The frequency of this inability to smell the odour is high, and tests have shown that 90% of an Israeli population and 75% of a Chinese population have anosmia (inability to smell). There is another proportion of the population with a degree of hyposmia, in which the smell is not distinct and can be confused with other smells.
Clearly this complicates finding out how many people have smelly urine after eating asparagus. Self-report is no use, and studies would need objective (and ideally blind) independent smelling of the urine. With this caveat, it seems that about 40% of the UK population produce smelly urine after eating asparagus based on tests on almost 1,000 people. Other studies suggest that French, Israeli and Chinese populations all produce odorous urine. It may all be down to the smelling.
The interesting thing about asparagus is that despite appearing in historical works for about 2,500 years, it was only in the 1700s that it was associated with malodorous urine. This coincided with the use of sulphur-rich fertilizers to improve the flavour of asparagus and onions and garlic.
Beetroot
The red colour of beetroot comes from pigments called betacyanins. These are acid/base indicators that are structurally unstable at extremes of pH, and have optical stability at pH 4 to 5. Red colour in urine, therefore, is dependent on urine pH. For the urine to be red, unchanged beetroot pigments have to be absorbed, and excreted.
During digestion beetroot pigments are subjected to changes in pH, especially the low pH in the stomach. At a pH of 2, found in the fasting stomach, the betacyanins are rapidly decomposed. Conditions where stomach pH is higher, and where there is rapid gastric emptying, would be more likely to cause coloured urine after eating beetroot.
All of which makes it unsurprising that all of us have beetroot pigments in our urine after eating beetroot. In most, though, the colour is too faint to see with the naked eye, though clearly present when investigated by chromatography in the laboratory. Older research indicated anything between 0% and 90% prevalence of red urine after eating beetroot.
What makes urine red depends. It depends on the type of beetroot, the way it is prepared, how much is eaten, what else is eaten, and other factors, like protective effects of oxalic acid. Those other factors may include use of drugs that raise gastric pH, especially histamine antagonists and proton pump inhibitors. There is at least one case-report of erythruria (red urine) after eating beetroot while on ranitidine [2].
God, but I love the internet!!!!!