Theory of electronic states in lattices and superlattices