  We introduce a coarse-grained description of the surface energy of a nematic
liquid crystal. The thermal fluctuations of the nematic director close to the
surface renormalize at macroscopic scales the bare surface potential in a
temperature-dependent way. The angular dependence of the renormalized potential
is dramatically smoothed, thus explaining the success of the Rapini-Papoular
form. Close to the isotropic phase, the anchoring energy is strongly suppressed
and the change of its shape allows for anchoring transitions. Our theory
describes quantitatively the temperature dependence of the anchoring energy and
the temperature-induced anchoring transitions reported in the literature.
