After compiling my latex file using MikTek in Windows 10 using TexMaker, I get the following error.

! Extra \endgroup.
\document ->\endgroup
\let \BeforeStartOfDocument \@firstofone \cpt@beforest...
l.73 \begin{document}

The .pdf file is getting generated but cannot be seen in the built-in viewer of TexMaker. What should I be rectifying in my latex file?

  • 2
    You are using a package that uses catoptions, which doesn't work. Please show a compilable example that demonstrates the issue Feb 4, 2021 at 10:19
  • Either something in your preamble is incompatible with a current latex, or something is not up-to-date. But without a small but complete example it is not possible to say more. Feb 4, 2021 at 10:20
  • 3
    Unfortunately, catoptions is broken with the current LaTeX kernel: it uses several tricks that heavily modify the standard behavior of LaTeX, so the fact it eventually broke was not unexpected.
    – egreg
    Feb 4, 2021 at 10:40

1 Answer 1


A quick fix is to use \RequirePackage[2020-02-02]{latexrelease} before \documentclass[]{}.

  • This fixed it for me, MikTek with TexStudio on Windows. I tried the latest RevTex on MikTek, and I tried downloading directly from CTAN. Nothing worked except this.
    – Matt Stein
    Jan 20, 2022 at 17:11
  • 1
    This works on overleaf when compiling COLI templates.
    – Vimos
    Feb 18, 2022 at 1:48
  • 1
    This worked for me with rQUF2e document class
    – zer0hedge
    Mar 16, 2022 at 9:01
  • 1
    This introduces the hyperref bug with pageref as described here. In my case, OP's error was being caused by the inclusion of the xwatermark package (\usepackage[printwatermark]{xwatermark}). Will not be using it, then.
    – Mew
    Apr 28 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .