Move things into TeX hook functions