# TeX Live won't work with custom class. Says Undefined control sequence \if@cref@hyperrefloaded

since switching to Linux and therefore switching from MiKTeX to TeX Live, I'm having problems getting all my documents compiled with a custom class made by a fellow student from my university.

The class I'm using is the iodhbwm, which is also available at CTAN. The class itself is based on scrreprt.

I prepared a minimal example, which works just fine in Overleaf, but not with my local compiler:

\documentclass[load-dhbw-templates]{iodhbwm}
\usepackage[T1]{fontenc}

\dhbwsetup{%
author              = John Doe
}

\begin{document}
\tableofcontents    % Print ToC
\chapter{Test Chapter}\label{chap:test-chap}
\end{document}


Here is the Error log

I've already searched for possible solutions, but most are based on wrong usage of packages. I'm 100% confident, my minimal example is working with MiKTeX and in Overleaf.

If needed, I'm on Manjaro Linux with KDE Plasma, using TeXStudio 3.0.4 and TeX Live 2020. Here are my installed packages.

## Update

iodhbwm 2021-02-15 v1.2.2 fixes the issue.

The iodhbwm class uses a deprecated option to \AfterPackage. More precisely, it does

\AfterPackage!{hyperref}{<code to load cleveref>}


The current version of scrlfile no longer accepts ! and this causes cleveref to be loaded before hyperref. Indeed, one of the first error messages you get is

! Package cleveref Error: cleveref must be loaded after hyperref!


Workaround until the class is updated: pass the withdeprecated option to scrlfile.

\documentclass[load-dhbw-templates,withdeprecated]{iodhbwm}
\usepackage[T1]{fontenc}

\dhbwsetup{%
author              = John Doe
}

\begin{document}
\tableofcontents    % Print ToC
\chapter{Test Chapter}\label{chap:test-chap}
\end{document}


The fix to the class is easy: remove the ! after \AfterPackage.

• You literally saved my bachelor thesis! Thank you so much for this simple solution! – Bastian Feb 15 at 10:53