  We present a systematic analysis of heavy-flavour production in the
underlying event in connection to a leading hard process in pp collisions at
$\sqrt{s}$ = 13 TeV, using the PYTHIA 8 Monte Carlo event generator. We compare
results from events selected by triggering on the leading hadron, as well as
those triggered with reconstructed jets. We show that the kinematics of
heavy-flavour fragmentation complicates the characterisation of the underlying
event, and the usual method which uses the leading charged final-state hadron
as a trigger may wash away the connection between the leading process and the
heavy-flavour particle created in association with that. Events triggered with
light or heavy-flavour jets, however, retain this connection and bring more
direct information on the underlying heavy-flavour production process, but may
also import unwanted sensitivity to gluon radiation. The methods outlined in
the current work provide means to verify model calculations for light and
heavy-flavour production in the jet and the underlying event in great details.
