p^·A^ vs x^·E^ : Gauge invariance in quantum optics and quantum field theory