  We compute fragmentation functions for a quark to fragment to a quarkonium
through an $S$-wave spin-triplet heavy quark-antiquark pair. We consider both
color-singlet and color-octet heavy quark-antiquark ($Q\bar Q$) pairs. We give
results for the case in which the fragmenting quark and the quark that is a
constituent of the quarkonium have different flavors and for the case in which
these quarks have the same flavors. Our results for the sum over all spin
polarizations of the $Q\bar Q$ pairs confirm previous results. Our results for
longitudinally polarized $Q\bar Q$ pairs agree with previous calculations for
the same flavor cases and correct an error in a previous calculation for the
different-flavor case.
