3

I use \autoref to reference everything in my Thesis. I get without problem the references of the images and the Tables but when I try to get the references of a equation I get just ??.

\noindent
Die Standardform eines Optimierungsproblems ist in \autoref{eq:generalOptimization} dargestellt.\\

\begin{align}
f(x)&   \longrightarrow  min/max  & x& =(x_1,x_2,\dots,x_n ) \nonumber  \\
wobei,          \qquad   g_i(x)& \leq 0                      & i& =(1,\dots,m) \label{eq:generalOptimization}\\
                         h_j(x)& = 0                         & j& = (1,\dotsb,p) \nonumber  
\end{align}\\

here can you see what i get

Do you have any idea to solve this problem?? maybe is a problem with the packages that i am im using:

\usepackage[left=3.2cm, right=2cm, top=3.0cm, bottom=2.19cm,includefoot]{geometry}
\usepackage{blindtext}
\usepackage[]{caption} 
\captionsetup{labelfont=bf,font={sf,footnotesize},format=plain}

\usepackage{amsmath,amssymb}
\usepackage{mathtools}
\usepackage[bitstream-charter]{mathdesign}
\usepackage[T1]{fontenc}
\usepackage{multicol} 
\usepackage{fancyhdr} 
\usepackage{graphicx} 
\usepackage{cite} 
\usepackage[printonlyused]{acronym} 
\usepackage{siunitx }
\usepackage{units} 
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{listings} 
\usepackage{color} 
\usepackage{transparent}
\usepackage{subfig}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage[intoc]{nomencl}
\usepackage{setspace}
\usepackage{microtype}
\usepackage{appendix}
\usepackage{wrapfig} 
\usepackage{pdfpages}
\usepackage{pgfplots}




\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,shapes.geometric}
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!10]
\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm, minimum height=1cm, text badly centered, text width=3cm,  draw=black, , fill=green!10]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=0.5cm,text badly centered, draw=black, fill=blue!10]
\tikzstyle{decision} = [diamond, text badly centered, text width=2cm, draw=black, fill=green!30, inner sep=0pt]
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{invisible}=[coordinate]

\usepackage{epstopdf}
\DeclareGraphicsExtensions{.eps,.jpg,.png}


\usepackage{setspace} 
 \usepackage{cleveref}

 %============================================


 \makeatletter
 \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
 \hbox{}
 \thispagestyle{empty}
 \newpage
 \if@twocolumn\hbox{}\newpage\fi\fi\fi}
 \makeatother

 %==========================================


\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{gray}{rgb}{0.95,0.95,0.95}

\lstset{frame=tb,   
  backgroundcolor=\color{gray},  
  frame=single,   
  language=c,
  aboveskip=5mm,
  belowskip=5mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle=\scriptsize\ttfamily,
  numbers=left,
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  numberstyle=\tiny\color{black}, 
  breaklines=true,
  breakatwhitespace=true
  tabsize=3
}

%% PDF metadata
\usepackage{hyperref} 
\makeatletter
\@ifpackageloaded{hyperref}{%
\hypersetup{%
    pdftitle = {b},
    pdfsubject = {Ermittlung hochaufloesender Motor-Lastkollektive in unterschiedlichen Kundennutzungsprofilen},
    pdfkeywords = { automotive, testing, belastungskollektive,kundennuntzungsprofil},
    pdfauthor = {Juan Mauricio Toro Ramos },
    pdfcreator = \LaTeX,
    pdfproducer= {a},

}
}{}

\makeatother
\hypersetup{ 
    colorlinks=true,%
    linkcolor=black,%
    citecolor=blue,%
    unicode%
}

%===================================

\usepackage[acronym,toc,shortcuts]{glossaries}

%=======================
9
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Dec 3 '14 at 13:25
  • Are you using \usepackage{mathtools} and \usepackage{hyperref}? This should provide the correct reference
    – user31729
    Dec 3 '14 at 13:27
  • 2
    not an answer about \autoref, but a comment on the form of the input: this could (better, i think) be coded as \begin{equation} \begin{aligned} ... \end{aligned} \end{equation}. that would yield only a single equation number, in the same location; no \nonumber. also, get rid of the blank line before the display -- the spacing will be better (lots of reference to this in other questions); enter \text{wobei} so it won't be treated as five separate variables multiplied together; and use \min and \max for the same reason. Dec 3 '14 at 13:34
  • 2
    The package cleveref should be loaded after hyperref. Both packages should generally be loaded last, i.e., after all other packages have been loaded.
    – Mico
    Dec 3 '14 at 15:43
  • 1
3

You need \usepackage{mathtools} for \begin{align}...\end{align} as well for \text{} (improving non-math-typesetting within formulas).

The main issue however is \usepackage{hyperref} for \autoref to work. Compile twice, to see the effect.

Edit: My first version of this solution was posted before the OP added his 'MWE', but now it's quite clear, that the wrong position of including cleveref package is the cause of the problem (Mico commented already on this)

cleveref is one of rare cases where a package must be included after \usepackage{hyperref} in order to make cross-references correct.

\documentclass[12pt]{article}
\usepackage[ngerman]{babel}
\usepackage{mathtools}
\usepackage{hyperref}
\usepackage{cleveref}

\begin{document}

\noindent
Die Standardform eines Optimierungsproblems ist in \autoref{eq:generalOptimization} dargestellt.

\begin{align}
f(x)&   \longrightarrow  min/max  & x& =(x_1,x_2,\dots,x_n ) \nonumber  \\
\text{wobei}          \qquad   g_i(x)& \leq 0                      & i& =(1,\dots,m) \label{eq:generalOptimization}\\
h_j(x)& = 0                         & j& = (1,\dotsb,p) \nonumber  
\end{align}

\end{document}

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.