# cleveref package and gather environment

I use the cleveref to cross-reference my equations and I have no problems with the equation and align environments. However, when using the gather environment, the cross-reference reads: "Section x.y.z" instead of "Equation x.a".

How to ensure that cleveref refers to gather as equations?

MWE

Note that I have an appendix wher I changed the "section" printed by 'cleveref' to "appendix".

% !TeX program = lualatex

\documentclass[class=book]{tudapub}

\usepackage[english]{babel}
\usepackage{amsmath} % Bold math symbols

\usepackage{appendix} % Needed to trigger clevref names change for appendix sections

\AtBeginEnvironment{appendices}{\crefalias{section}{appendix}} % To rename sections in clevref when entering appendices
\AtEndEnvironment{appendices}{\crefalias{section}{section}} % To rename sections back in clevref when leaving appendices

\begin{document}

\chapter{My chapter}

\section{My section}

This is an equation in the 'equation' environment:
$$\label{Eq_equation} a = b$$

This is an equation in the 'align' environment:
\begin{align}
\label{Eq_align}
a &= b
\nonumber \\
c &= d
\end{align}

This is an equation in the 'gather' environment:
\begin{gather}
\label{Eq_gather}
a = b
\nonumber \\
c = d
\end{gather}

I can use the package 'cleveref' with 'equation' and 'align: these are cross-references to \Cref{Eq_equation} and \Cref{Eq_align}.

But it does not work with 'gather': this is a cross-reference to \Cref*{Eq_gather}.

\end{document}

• Could you please post a minimal (non)working complete code? Oct 29 '20 at 10:12
• Using the simplest of MWEs I have no issues with cleveref and gather so please provide code as Bernard mentions. Oct 29 '20 at 10:18
• @Bernard Yes, sorry it took a while to get a MWE from my whole thesis. It is now added to the question.
– JuCa
Oct 29 '20 at 10:43
• you have used the label on an unnumbered line, what do you want it to refer to? Oct 29 '20 at 10:45
• @DavidCarlisle To the equation 1.2 composed of the two lines. This is currently the behaviour I am looking for with the 'align' environment
– JuCa
Oct 29 '20 at 10:47

In gather each line is numbered separately and so can have a separate label, in this case the \label is in an unnumbered like due to \nonumber so it references the currently active label which is typically the most recent section heading.
The same ought to be true of align but the processing of align is more involved and if it picks up something more useful in that case, that is by accident not design.