Analytical theory of finite-size photonic crystal slabs near the band edge.