The problem is in the \obeylines before \begin{document}, which interferes with the material in \AtBeginDocument which is evaluated after it.
It's generally a bad idea to use \obeylines outside a group. Ciao Enrico -- Enrico Gregorio + Dipartimento di Informatica + Tel: +39 045 8027937 enrico.grego...@univr.it + Università degli Studi di Verona + (grego...@math.unipd.it) + Strada le Grazie 15 / I-37134 Verona + Fax: +39 045 8027928 -------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex