  The measurement of the production of charm jets, identified by the presence
of a ${\rm D^0}$ meson in the jet constituents, is presented in proton-proton
collisions at centre-of-mass energies of $\sqrt{s}$ = 5.02 and 13 TeV with the
ALICE detector at the CERN LHC. The ${\rm D^0}$ mesons were reconstructed from
their hadronic decay ${\rm D^0} \rightarrow {\rm K^-}\pi^+$ and the respective
charge conjugate. Jets were reconstructed from ${\rm D^0}$-meson candidates and
charged particles using the anti-$k_{\rm T}$ algorithm, in the jet transverse
momentum range $5<p_{\rm T;chjet}<50$ GeV/$c$, pseudorapidity $|\eta_{\rm jet}|
<0.9-R$, and with the jet resolution parameters $R$ = 0.2, 0.4, 0.6. The
distribution of the jet momentum fraction carried by a ${\rm D^0}$ meson along
the jet axis ($z^{\rm ch}_{||}$) was measured in the range $0.4 < z^{\rm
ch}_{||} < 1.0$ in four ranges of the jet transverse momentum. Comparisons of
results for different collision energies and jet resolution parameters are also
presented. The measurements are compared to predictions from Monte Carlo event
generators based on leading-order and next-to-leading-order perturbative
quantum chromodynamics calculations. A generally good description of the main
features of the data is obtained in spite of a few discrepancies at low $p_{\rm
T;chjet}$. Measurements were also done for $R = 0.3$ at $\sqrt{s}$ = 5.02 TeV
and are shown along with their comparisons to theoretical predictions in an
appendix to this paper.
