14

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 – Phelype Oleinik Feb 04 '21 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. – Ulrike Fischer Feb 04 '21 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 04 '21 at 10:40

1 Answers1

24

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 '22 at 17:11
  • 1
    This works on overleaf when compiling COLI templates. – Vimos Feb 18 '22 at 01:48
  • 1
    This worked for me with rQUF2e document class – zer0hedge Mar 16 '22 at 09: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 '23 at 14:30
  • This works, but what's the explanation behind this hack? I started having this issue a year ago or more, recently even updated my TexLive installation, and I still have it. – F.Webber Jan 21 '24 at 04:02
  • I really wonder why this bug is still alive in 2024. – Gyro Gearloose Feb 20 '24 at 19:41