The theory of sunspots