  Baryonification algorithms model the impact of galaxy formation and feedback
on the matter field in gravity-only simulations by adopting physically
motivated parametric prescriptions. In this paper, we extend these models to
describe gas temperature and pressure, allowing for a self-consistent modelling
of the thermal Sunyaev-Zeldovich effect, weak gravitational lensing, and their
cross-correlation, down to small scales. We validate our approach by showing
that it can simultaneously reproduce the electron pressure, gas, stellar, and
dark matter power spectra as measured in all BAHAMAS hydrodynamical
simulations. Specifically, with only two additional free parameters, we can fit
the electron pressure auto- and cross-power spectra at 10% while reproducing
the suppression in the matter power spectrum induced by baryons at the per cent
level, for different AGN feedback strengths in BAHAMAS. Furthermore, we
reproduce BAHAMAS convergence and thermal Sunyaev Zeldovich angular power
spectra within 1% and 10% accuracy, respectively, down to l = 5000. When used
jointly with cosmological rescaling algorithms, the baryonification presented
here will allow a fast and accurate exploration of cosmological and
astrophysical scenarios. Therefore, it can be employed to create mock
catalogues, lightcones, and large training sets for emulators aimed at
interpreting forthcoming multi-wavelength observations of the large-scale
structure of the Universe.
