In a fashion similar to this and this question, I now get a "Extra endgroup" error at the \begin{document} of documents that previously compiled fine.

I understand this is because of the new LaTeX update that inter alia changed the AtBeginDocument hook to integrate it into a more systematic hook scheme.

So I suspect one of the very numerous packages I am using is not (yet) compatible. I reverted to an earlier version of LaTeX as suggested in this answer (also had to revert eso-pic).

How can I pinpoint which package(s) is at fault ? This seems hard to me because the faulty constructions are added to the hook and everything explodes at \begin{document}.

How can I inspect the content of what is to be done at that point and what should I look for ? I used to use \show to explore what is going on, often needing a \makeatletter to get to internal commands, but now the internals of \UseOneTimeHook are in the new syntax eg. \hook_use_one:n and I cannot \show it at the latex prompt.

  • You can use \csname to build any control sequence (even if it includes spaces) in the following way: \expandafter\show\csname hook_use_one:n\endcsname. Also you can use \ExplSyntaxOn like you use \makeatletter to get the category codes for \show\hook_use_one:n.
    – Skillmon
    Oct 26, 2020 at 14:04
  • The incompatible packages are not that many, so if you add \listfiles at the top of your document and show us the file list, it should be easy to pinpoint the faulty package. However, the error happens before the begindocument hook: the faulty packages break because they redefine \document, so if you use \show\document you can have a clue of which package did the redefinition. Looking at the definition of \hook_use_once:n will not help here Oct 26, 2020 at 14:09
  • Thank you so much. Here is the list of files : framagit.org/-/snippets/5992.
    – ysalmon
    Oct 26, 2020 at 14:20
  • 3
    xwatermark/catoptions Oct 26, 2020 at 14:21
  • Thanks. I can dispose of xwatermark for a reasonable amount of time, but menukeys also uses catopions and I regularly need it, so I will cross my fingers that either of them gets an update.
    – ysalmon
    Oct 26, 2020 at 15:23


You must log in to answer this question.

Browse other questions tagged .