When you use the tikzposter
LaTeX class and also the hyperref
package with colorlinks=true
, and you encounter a compilation error similar to ! LaTeX Error: Loading a class or package in a group
, then the following snippet in your preamble may resolve the issue:
\makeatletter
\patchcmd{%
\Hy@AtBeginDocumentHook%
}{%
\RequirePackage {color}%
}{}{}{%
\PackageWarning{patch}{patch failed!}%
}
\makeatother
The core problem is that the tikzposter
class puts all of the main content inside one big tikzpicture
environment. More specifically, it starts a \begin{tikzpicture}
in \AtBeginDocument
but never closes it there.
On the other hand , if hyperref
is configured with colorlinks=true
, it tries to load the color
package through its own \AtBeginDocument
, that package ends up being loaded inside the still-open tikzpicture
environment. That’s what triggers the error about loading a class or package “in a group.”
The fix we used basically prevents hyperref
from trying to load color
during its custom \AtBeginDocument
to resolve the conflict. The color
package is likely already loaded by other packages before hyperref
, so it’s fine not loading it in \AtBeginDocument
.
Be First to Comment