Dimensional regularization is incompatible with the standard covariant
projection methods that are used to calculate the short-distance coef
ficients in inclusive heavy-quarkonium production and annihilation rat
es. A new method is developed that allows dimensional regularization t
o be used consistently to regularize the infrared and ultraviolet dive
rgences that arise in these perturbative calculations. We illustrate t
he method by calculating the leading color-octet terms and the leading
color-singlet terms in the gluon fragmentation functions for arbitrar
y quarkonium states. We resolve a discrepancy between two previous cal
culations of the gluon fragmentation functions for the spin-tripler P-
wave quarkonium states.