I am using cleveref package. In one of my table, i'm refering to an equation in the text. The reference works fine (also hyperref) in the caption just below the table. Unfortunately it doesn't work in the list of tables and I get the traditional **??** in my pdf output together with the following warning:

LaTeX Warning: cref reference format for label type 'equation' undefined on in

Some piece of code (I hope sufficiently):

```
\documentclass[en,printlayout]{udesoftec}
\usepackage{cleveref}
\begin{document}
\frontmatter
\mainmatter
\part{Part1}
\begin{align}
\label{eq:CDF}
D_{fit}(x) =& \sum_{i=1}^{N-1} \frac{1}{2}K_i\left(1+erf(\frac{x-m_i}{\sqrt{2}\sigma_i})\right)\nonumber \\
&+ \frac{1}{2}(1-\sum_{i=1}^{N-1}K_i)\left(1+erf(\frac{x-m_N}{\sqrt{2}\sigma_N})\right)
\end{align}
\part{Part2}
\begin{table}[htbp]
\begin{tabular*}{\hsize}{@{\extracolsep{\stretch{1}}} c c c c }
\hline
\rule{0pt}{3ex} $i$ & $K $& $m$ & $\sigma$ \\
\end{tabular*}
\caption{$i$, $K$, $m$ and $\sigma$ correspond to the parameters in \cref{eq:CDF}}
\label{tab:myTab}
\end{table}
\end{document}
```

The class can be found on CTAN: http://www.ctan.org/pkg/udesoftec

I have already tried to delete the .lot file and compile twice without success. Any idea?

Thanks

## Best Answer

The diagnosis by Jean-Sébastien Gosselin is correct: the

`udesoftec`

class abuses`\AtBeginDocument`

for typesetting material, which is not a good thing to do, see this answer by Heiko OberdiekThe problem is that

`cleveref`

has to defer several of its tricks at begin document, but these will happenaftersome material has already been typeset, in particular the list of tables.Fortunately there is a hook that can be used to transfer the material erroneously executed at begin document to

`\AfterEndPreamble`

, as suggested by Heiko. The maintainers of the class should be made aware of the problem.I also fixed the equation, please look at it: the correct environment to use is

`multline`

and several small adjustments are also necessary; the main one is defining an operator for the error function.## The fixed equation