When you use the tikzposter
LaTeX class and also the hyperref
package, 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.
Because of that, when hyperref
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.
Be First to Comment