Towards understanding the relation between the gas and the attenuation
  in galaxies at kpc scales
  [abridged]
  Aims. The aim of the present paper is to provide new and more detailed
relations at the kpc scale between the gas surface density and the face-on
optical depth directly calibrated on galaxies, in order to compute the
attenuation not only for semi-analytic models but also observationally as new
and upcoming radio observatories are able to trace gas ever farther in the
Universe.
  Methods. We have selected a sample of 4 nearby resolved galaxies and a sample
of 27 unresolved galaxies from the Herschel Reference Survey and the Very
Nearby Galaxies Survey, for which we have a large set of multi-wavelength data
from the FUV to the FIR including metallicity gradients for resolved galaxies,
along with radio HI and CO observations. For each pixel in resolved galaxies
and for each galaxy in the unresolved sample, we compute the face-on optical
depth from the attenuation determined with the CIGALE SED fitting code and an
assumed geometry. We determine the gas surface density from HI and CO
observations with a metallicity-dependent XCO factor.
  Results. We provide new, simple to use, relations to determine the face-on
optical depth from the gas surface density, taking the metallicity into
account, which proves to be crucial for a proper estimate. The method used to
determine the gas surface density or the face-on optical depth has little
impact on the relations except for galaxies that have an inclination over 50d.
Finally, we provide detailed instructions on how to compute the attenuation
practically from the gas surface density taking into account possible
information on the metallicity.
  Conclusions. Examination of the influence of these new relations on simulated
FUV and IR luminosity functions shows a clear impact compared to older oft-used
relations, which in turn could affect the conclusions drawn from studies based
on large scale cosmological simulations.
