Derivation of single-scattering formulas for x-ray-absorption and high-energy electron-loss spectroscopies