Left: The fragmentation fractions for charm hadrons in p–Pb collisions at $\sqrt{s_\mathrm{NN}}=5.02$ TeV, compared with results from pp collisions at $\sqrt{s}=5.02$ TeV and from $\mathrm{e}^+\mathrm{e}^-$ and $\mathrm{e}^-\mathrm{p}$ collisions at lower energies. The fragmentation fractions for $\mathrm{J}/\psi$ are multiplied by 20 for visibility. Right: Total $\mathrm{c\overline{c}}$ production cross section per unit of rapidity and per nucleon in p–Pb collisions, compared with measurements in pp collisions from ALICE, PHENIX, and STAR, and with FONLL and NNLO pQCD calculations. The statistical uncertainties are shown as bars, and the systematic uncertainties as unfilled boxes.