12

I am using MikTeX with PDFLaTeX and it has worked fine. After an update if MikTeX xwatermark throws an error:

! Extra \endgroup. 
\document ->\endgroup 
\let \BeforeStartOfDocument \@firstofone \cpt@beforest... 
l.5 \begin{document} 
Things are pretty
mixed up, but I think the worst is over.

Test tex file:

\documentclass{article}

\usepackage{xwatermark}

\begin{document} Text \end{document}

But as I understand it Xwatermark has not been updated since 2012!? What could be producing the error?

  • 4
    xwatermark uses the catoptions package and this package is incompatible with the new latex. See also https://tex.stackexchange.com/questions/565192/bug-in-skeyval-possible-solution-with-firstaid and https://tex.stackexchange.com/questions/565937/catoptions-menukeys-packages-compilation-error – Ulrike Fischer Oct 09 '20 at 15:39
  • 1
    Any alternative to get the job done? – OOzy Pal Nov 11 '20 at 06:47
  • I have this problem currently, does anyone have a simple fix? – Joey Gough Nov 12 '20 at 14:06

2 Answers2

5

This issue was happening with many packages. Apparently the catoptions package does not work with some of the last versions of latex, and so any package depending on it. This should be solved in the last versions, though. However, many distributions will not ship them for a while. I got the issue in the texlive version distributed in debian testing when this was posted.

A solution: add the following line before the documentclass definition:

\RequirePackage[2020-02-02]{latexrelease}

(I read this solution from github's user u-fischer in the following link: https://github.com/tweh/menukeys/issues/59)

2

I ran into the same problem and now use this...

\usepackage{eso-pic}

...

\AddToShipoutPictureFG{ \begin{tikzpicture}[remember picture, overlay] \node[opacity=0.5, inner sep=0] at (current page.center) {\includegraphics{data/images/watermark}}; \end{tikzpicture} }