QUESTION: How to make cleveref and nameref work with \documentclass{wlscirep} and \section*?
Note that \documentclass{wlscirep} comes from "Template for submissions to Scientific Reports". Here following I show the cases I tested with cleveref and nameref:
(1) cleveref works with \documentclass{article} and \section
\documentclass{article}
\usepackage{cleveref}
\begin{document}
\section{Methods}\label{test}
We see in \cref{test} that ...
\end{document}
(2) cleveref does not work with \documentclass{article} and \section*
\documentclass{article}
\usepackage{cleveref}
\begin{document}
\section*{Methods}\label{test}
We see in \cref{test} that ...
\end{document}
(3) cleveref works with \documentclass[fleqn,10pt]{wlscirep} and \section
\documentclass[fleqn,10pt]{wlscirep}
\usepackage{cleveref}
\begin{document}
\section{Methods}\label{test}
We see in \cref{test} that ...
\end{document}
(4) cleveref does not work with \documentclass[fleqn,10pt]{wlscirep} and \section*
\documentclass[fleqn,10pt]{wlscirep}
\usepackage{cleveref}
\begin{document}
\section*{Methods}\label{test}
We see in \cref{test} that ...
\end{document}
(5) nameref works with \documentclass[fleqn,10pt]{wlscirep} and \section
\documentclass[fleqn,10pt]{wlscirep}
\usepackage{nameref}
\begin{document}
\section{Methods}\label{test}
We see in \nameref{test} that ...
\end{document}
(6) nameref does not work with \documentclass[fleqn,10pt]{wlscirep} and \section*
\documentclass[fleqn,10pt]{wlscirep}
\usepackage{nameref}
\begin{document}
\section*{Methods}\label{test}
We see in \nameref{test} that ...
\end{document}







namerefand command\namerefinstead ofcleverefand\cref. – cabohah Nov 10 '23 at 12:49namerefyou need, as far as I know cleverref does not collect the title of a sectional command. – daleif Nov 10 '23 at 12:52namerefworks for\documentclass{article}, but it does not work with my\documentclass[fleqn,10pt]{wlscirep}. Should I modify the current question or open a new one?? In addition, even though it worked, it would not have the link to bring you to the corresponding section of the document - Instead, with\cref, by clicking on the name (in the PDF), it would bring you to the corresponding section of the document... – Ommo Nov 10 '23 at 14:02\documentclass[fleqn,10pt]{wlscirep}comes from "Template for submissions to Scientific Reports", (https://www.overleaf.com/latex/templates/template-for-submissions-to-scientific-reports/xyrztqvdccns) – Ommo Nov 10 '23 at 14:14hyperrefbefore loadingtitlesecto modify sections. Just a guess, but that's not a good combination and is a possible source of the problem. If I were you I would not use this class at all. – Alan Munn Nov 10 '23 at 14:33