Atoms embedded in an electron gas: the generalized gradient approximation