Crystalline carbon allotropes: Relative stability and electronic spectra