  The KATRIN experiment is designed for a direct and model-independent
determination of the effective electron anti-neutrino mass via a high-precision
measurement of the tritium $\beta$-decay endpoint region with a sensitivity on
$m_\nu$ of 0.2$\,$eV/c$^2$ (90% CL). For this purpose, the $\beta$-electrons
from a high-luminosity windowless gaseous tritium source traversing an
electrostatic retarding spectrometer are counted to obtain an integral spectrum
around the endpoint energy of 18.6$\,$keV. A dominant systematic effect of the
response of the experimental setup is the energy loss of $\beta$-electrons from
elastic and inelastic scattering off tritium molecules within the source. We
determined the \linebreak energy-loss function in-situ with a pulsed
angular-selective and monoenergetic photoelectron source at various
tritium-source densities. The data was recorded in integral and differential
modes; the latter was achieved by using a novel time-of-flight technique.
  We developed a semi-empirical parametrization for the energy-loss function
for the scattering of 18.6-keV electrons from hydrogen isotopologs. This model
was fit to measurement data with a 95% T$_2$ gas mixture at 30$\,$K, as used in
the first KATRIN neutrino mass analyses, as well as a D$_2$ gas mixture of 96%
purity used in KATRIN commissioning runs. The achieved precision on the
energy-loss function has abated the corresponding uncertainty of
$\sigma(m_\nu^2)<10^{-2}\,\mathrm{eV}^2$ [arXiv:2101.05253] in the KATRIN
neutrino-mass measurement to a subdominant level.
