  The ionizing background determines the ionization balance and the
thermodynamics of the cosmic gas. It is therefore a fundamental ingredient to
theoretical and empirical studies of both the IGM and galaxy formation. We
present here a new calculation of its spectrum that satisfies the empirical
constraints we recently obtained by combining state-of-the-art luminosity
functions and intergalactic opacity measurements. In our preferred model,
star-forming galaxies and quasars each contribute substantially to the HI
ionizing field at z<3, with galaxies rapidly overtaking quasars at higher
redshifts as quasars become rarer. In addition to our fiducial model, we
explore the physical dependences of the calculated background and clarify how
recombination emission contributes to the ionization rates. We find that
recombinations do not simply boost the ionization rates by the number of
reemitted ionizing photons as many of these rapidly redshift below the
ionization edges and have a distribution of energies. A simple analytic model
that captures the main effects seen in our numerical radiative transfer
calculations is given. Finally, we discuss the effects of HeII reionization by
quasars on both the spectrum of the ionizing background and on the thermal
history of the IGM. In regions that have yet to be reionized, the spectrum is
expected to be almost completely suppressed immediately above 54.4 eV while a
background of higher-energy (>~0.5 keV) photons permeates the entire universe
owing to the frequency-dependence of the photoionization cross section. We
provide an analytic model of the heat input during HeII reionization and its
effects on the temperature-density relation.
