  Scattering amplitudes in $D$ dimensions involve particular terms that
originate from the interplay of UV poles with the $D-4$ dimensional parts of
loop numerators. Such contributions can be controlled through a finite set of
process-independent rational counterterms, which make it possible to compute
loop amplitudes with numerical tools that construct the loop numerators in four
dimensions. Building on a recent study [1] of the general properties of
two-loop rational counterterms, in this paper we investigate their dependence
on the choice of renormalisation scheme. We identify a nontrivial form of
scheme dependence, which originates from the interplay of mass and field
renormalisation with the $D-4$ dimensional parts of loop numerators, and we
show that it can be controlled through a new kind of one-loop counterterms.
This guarantees that the two-loop rational counterterms for a given
renormalisable theory can be derived once and for all in terms of generic
renormalisation constants, which can be adapted a posteriori to any scheme.
Using this approach, we present the first calculation of the full set of
two-loop rational counterterms in Yang-Mills theories. The results are
applicable to SU(N) and U(1) gauge theories coupled to $n_{f}$ fermions with
arbitrary masses.
