MPDI article with cleveref

cleverefhyperrefmdpi

I need to write an article using the MDPI template.
The latest version of this template is available on Overleaf or directly on MDPI website.
This template is said to be compatible with cleveref package.

Unfortunately, when I add \usepackage{cleveref} within the available template, I get Package cleveref Error: cleveref must be loaded after hyperref!..
So, if I obey and load hyperref first, then I get a option clash for hyperref since this package is already loaded under the hood.
I considered not loading cleveref thinking that it might be also loaded under the hood, but then I could not use the command \cref.

Here is my MWE (based on the available template):

\documentclass{Definitions/mdpi} 

%\usepackage{hyperref}
\usepackage{cleveref}

%=================================================================
% MDPI internal commands
\firstpage{1} 
\pubvolume{1}
\issuenum{1}
\articlenumber{0}
\pubyear{2022}
\copyrightyear{2022}
\datereceived{} 
\dateaccepted{} 
\datepublished{} 
\hreflink{https://doi.org/}
%=================================================================
\Title{Title}
\newcommand{\orcidauthorA}{0000-0000-0000-000X}
\Author{Firstname Lastname $^{1,\dagger,\ddagger}$\orcidA{}, Firstname Lastname $^{1,\ddagger}$ and Firstname Lastname $^{2,}$*}
\address{%
    $^{1}$ \quad Affiliation 1; [email protected]\\
    $^{2}$ \quad Affiliation 2; [email protected]
}

\abstract{
    A single paragraph of about 200 words maximum. For research articles, abstracts should give a pertinent overview of the work. We strongly encourage authors to use the following style of structured abstracts, but without headings: (1) Background: place the question addressed in a broad context and highlight the purpose of the study; (2) Methods: describe briefly the main methods or treatments applied; (3) Results: summarize the article's main findings; (4) Conclusion: indicate the main conclusions or interpretations. The abstract should be an objective representation of the article, it must not contain results which are not presented and substantiated in the main text and should not exaggerate the main conclusions.
}

\keyword{
    keyword 1; keyword 2; keyword 3 (List three to ten pertinent keywords specific to the article; yet reasonably common within the subject discipline.)
} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\section{How to Use this Template}
    The template details the sections that can be used in a manuscript. Note that the order and names of article sections may differ from the requirements of the journal (e.g., the positioning of the Materials and Methods section). Please check the instructions on the authors' page of the journal to verify the correct order and names. For any questions, please contact the editorial office of the journal or [email protected]. For LaTeX-related questions please contact [email protected].
    

\subsection{Figures, Tables and Schemes}
    All figures and tables should be cited in the main text as Figure~\ref{fig1}, etc.
    
    \begin{figure}[H]
        \includegraphics[width=1.5 cm]{Definitions/logo-mdpi}
        \caption{This is a figure. Schemes follow the same formatting. If there are multiple panels, they should be listed as: (\textbf{a}) Description of what is contained in the first panel. (\textbf{b}) Description of what is contained in the second panel. Figures should be placed in the main text near to the first time they are cited. A caption on a single line should be centered.\label{fig1}}
    \end{figure}   
\end{document}

So is it a bug, and I should contact MDPI for support ? or am I missing something ?

Best Answer

mdpi adds hyperref by auto loading it at the beginng of the document, so always after your attempt to load cleveref. The example does compile if you delay cleveref even further using \AtBeginDocument{\usepackage{cleveref}} or similar.

Related Question