Electromagnetism in nonleptonic weak interactions