Theory of X-ray Thomson scattering in dense plasmas