  The production cross-section of the $\chi_{c1}(3872)$ state relative to the
$\psi(2S)$ meson is measured using proton-proton collision data collected with
the LHCb experiment at centre-of-mass energies of $\sqrt{s}=8$ and 13 TeV,
corresponding to integrated luminosities of 2.0 and 5.4 fb$^{-1}$,
respectively. The two mesons are reconstructed in the $J/\psi\pi^{+}\pi^{-}$
final state. The ratios of the prompt and nonprompt $\chi_{c1}(3872)$ to
$\psi(2S)$ production cross-sections are measured as a function of transverse
momentum, $p_{\rm T}$, and rapidity, $y$, in the kinematic range $4 < p_{\rm T}
< 20$ GeV/$c$ and $2.0 < y < 4.5$. The prompt ratio is found to increase with
$p_{\rm T}$ independently of $y$. The double-differential cross-section ratio
of $\chi_{c1}(3872)$ relative to $\psi(2S)$ mesons between 13 and 8 TeV is also
measured for the prompt component and observed to be consistent with unity,
independent of $p_{\rm T}$ and centre-of-mass energy.
