  A solution of the inelastic Enskog equation that goes beyond the weak
dissipation limit and applies for moderate densities is used to determine the
thermal diffusion factor of an intruder immersed in a dense granular gas under
gravity. This factor provides a segregation criterion that shows the transition
between the Brazil-nut effect (BNE) and the reverse Brazil-nut effect (RBNE) by
varying the parameters of the system (masses, sizes, density and coefficients
of restitution). The form of the phase-diagrams for the BNE/RBNE transition
depends sensitively on the value of gravity relative to the thermal gradient,
so that it is possible to switch between both states for given values of the
parameters of the system. Two specific limits are considered with detail: (i)
absence of gravity, and (ii) homogeneous temperature. In the latter case, after
some approximations, our results are consistent with previous theoretical
results derived from the Enskog equation. Our results also indicate that the
influence of dissipation on thermal diffusion is more important in the absence
of gravity than in the opposite limit. The present analysis extends previous
theoretical results derived in the dilute limit case [V. Garz\'o, Europhys.
Lett. {\bf 75}, 521 (2006)] and is consistent with the findings of some recent
experimental results.
