  We describe an implementation of a subtraction scheme in the
nonrelativistic-QCD treatment of heavy-quarkonium production at
next-to-leading-order in the strong-coupling constant, covering $S$- and
$P$-wave bound states. It is based on the dipole subtraction in the massless
version by Catani and Seymour and its extension to massive quarks by Phaf and
Weinzierl. Important additions include the treatment of heavy-quark bound
states, in particular due to the more complicated infrared-divergence structure
in the case of $P$-wave states.
