0

I have written a latex document, and in this document I reference to equations, tables, and figures. Everything works perfectly.

Now I discovered that I have to use a specific template. Therefore I copy-past my latex code into the template .tex file, and now equation reference is broken. References to tables and figures still work, the bibliography is still fine, but any reference to an equation ends up with a (??).

I am not sure what could be causing this, maybe some loaded packages? (I only load hyperref last).

This is the list of packages I load:

\documentclass[11pt,a4paper,english,oneside]{book}
\usepackage{etex}
\usepackage[left=1in, right=1in]{geometry} 
\usepackage[Lenny]{fncychap}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{dsfont}
\usepackage{fancyhdr} 
\usepackage{booktabs} 
\usepackage[hang,bottom,stable,multiple]{footmisc} 
\usepackage{appendix} 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[sort,round]{natbib} 
\usepackage{etoolbox} 
\usepackage{amsthm} 
\usepackage{thmtools} 
\usepackage{setspace}
\usepackage{lipsum} 
\usepackage{datetime} 
%\usepackage{tocloft}
\usepackage{graphicx,listings,xcolor,textcomp}
\usepackage{mcode} 
\usepackage[margin=10pt, font=small, labelfont=bf, labelsep=endash]{caption}
\usepackage{chngcntr} 
\usepackage{epstopdf}
\usepackage{xparse}
\usepackage{cleveref}
\usepackage{array,hhline}
\usepackage{rotating} 
\usepackage{tabularx} 
\usepackage{arydshln}
\usepackage{tikz}
\usepackage{multirow}
\usepackage{csquotes}
\usepackage{wrapfig}

%instructions to make the algorithm pseudo-code package work
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother

\usepackage{hyperref} 

Please tell me what other informations I should include.

  • Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – samcarter_is_at_topanswers.xyz Nov 21 '17 at 10:06
  • 1
    cleveref needs to be loaded after hyperref – samcarter_is_at_topanswers.xyz Nov 21 '17 at 10:10
  • @samcarter Ah, thank you very much, I completely missed that. It solves the problem. Please make than an answer and I will accept it :) – Ant Nov 21 '17 at 10:13
  • @samcarter Well, to be fair it is a duplicate only once you know what was causing the problem. Somebody having the same problem won't google for "packages to load after hyperref" :-) – Ant Nov 21 '17 at 11:05
  • That's why your questions is valuable for this site. Somebody having the same problem will google and find your questions and can follow the link to the solution. – samcarter_is_at_topanswers.xyz Nov 21 '17 at 11:47