This chapter presents a review on the latest advances in the computation of physical conditions and chemical abundances of elements present in photoionized gas H II regions and planetary nebulae). The arrival of highly sensitive spectrographs attached to large telescopes and the development of more sophisticated and detailed atomic data calculations and ionization correction factors have helped to raise the number of ionic species studied in photoionized nebulae in the last years, as well as to reduce the uncertainties in the computed abundances. Special attention will be given to the detection of very faint lines such as heavy-element recombination lines of C, N and O in H II regions and planetary nebulae, and collisionally excited lines of neutron-capture elements (Z >30) in planetary nebulae.