The theory of electron energy-loss near-edge structure