Answer: Bulbs of onion and garlic contain a volatile oil consisting of predominantly allyl sulfide. This compound has been shown to have pest-detering qualities, as well as medicinal qualities. <br><br>As far as why these plants contain this compound, I can onlyspeculate that as they evolved, they incorporated this substance into their cells, perhaps as a deterrent to herbivores. Different types of onions contain various amounts of this substance--that's why some are stronger-tasting than others.<br><br>Onions are grown as companion plants for several vegetables, including onions, carrots, and broccoli. Peas, beans, and sage are reputed to be "bad neighbors" for members of the onion family. Onions are believed to deter Colorado potato beetles and carrot root maggots. The reference book I am consulting doesn't list onions as a traditional companion plant for lettuce. Certainly, if slugs don't like the smell or taste of onions, then interplanting onions with lettuce may well deter slugs.
Q&A Library Searching Tips