Ab Initio Theory of NMR Chemical Shifts in Solids and Liquids.