1

I can't reference my equations, I've labeled all my equations, and am referencing them with \ref{}, but only two question marks appear. I've tried everything and can't for the life of me understand why it doesn't work. I have been able to reference figures, but not equations. An excerpt of the code is:

\documentclass{scrartcl}
\usepackage{etex}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{cleveref}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{fancyref}
\usepackage{amssymb}
\usepackage[utf8x]{inputenc}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage{floatrow}
\usepackage{imakeidx}
\addtokomafont{sectioning}{\rmfamily}
\usepackage{indentfirst}
\makeindex

\begin{document}

...
\begin{equation}\label{eq:funcao_dif}
v_1 = K v_i + \frac{v_2}{Q} - v_3 = K v_i - \frac{1}{sT}\frac{1}{Q} v_1  + 
\frac{1}{sT} v_2 = K v_i - \frac{1}{sT}\frac{1}{Q} v_1  - \frac{1}{s^2T^2} 
v_1 
\end{equation}
...

{\par A primeira parte é logo um circuito subtractor que simula a equação 
\ref{eq:funcao_dif}}

\end{document}
3
  • 1
    Welcome to TeX.SX! Please remove any unnecessary package and make your document fragment compilable (MWE).
    – TeXnician
    Oct 18 '17 at 7:37
  • unrelated to \label, but why do you have \par and a {...} group around your paragraph? Oct 18 '17 at 7:44
  • do not use etex package with current latex, don't load blindtext or lipsum in real documents, most likely you should use [utf8] rather than [utf8x] unless you really need some of the non standard features of the utf8x version. Oct 18 '17 at 7:47
4

You are loading a lot of un-needed packages in your preamble and experiencing a clash of redefinitions. In particular the cleverref manual explains that it must be loaded last (and in particular, after hyperref).

This version works

\documentclass{scrartcl}

\usepackage{amsmath}

%\usepackage{cleveref}
%\usepackage{fancyref}
\usepackage[utf8]{inputenc}

\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}

...
\begin{equation}\label{eq:funcao_dif}
v_1 = K v_i + \frac{v_2}{Q} - v_3 = K v_i - \frac{1}{sT}\frac{1}{Q} v_1  + 
\frac{1}{sT} v_2 = K v_i - \frac{1}{sT}\frac{1}{Q} v_1  - \frac{1}{s^2T^2} 
v_1 
\end{equation}
...

{\par A primeira parte é logo um circuito subtractor que simula a equação 
\ref{eq:funcao_dif}}

\end{document}
2

I had a similar issue. I had this in my preamble:

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[nosumlimits,nointlimits,nonamelimits]{amsmath}
\usepackage[onehalfspacing]{setspace}
\usepackage{footmisc}
\usepackage[round,authoryear,longnamesfirst]{natbib}
\usepackage{xcolor}
\definecolor{darkgreen}{rgb}{0,.6,0}
\definecolor{darkblue}{rgb}{0,0,0.5}
\definecolor{purple}{rgb}{0.5,0,0.5}
\usepackage[colorlinks,linkcolor=darkblue,citecolor=darkgreen]{hyperref}
\usepackage{appendix}
\usepackage{subfig}
\usepackage{framed}
\usepackage{caption}
\usepackage{tikz}
\usepackage[inline]{enumitem}
\usepackage[thmmarks]{ntheorem}

It turns out that I had to move ntheorem before amsmath. There is probably some conflict between these two packages, and ntheorem must come first.

1
  • I also had this problem, and while your solution works, the ntheorem documentation suggests otherwise. According to section 3.2.1, when using the thmmarks option with ntheorem, if also using amsmath, amsmath should be loaded first and ntheorem should be included as \usepackage[thmmarks,amsmath]{ntheorem}.
    – Robly18
    May 13 at 22:32
-1

enter image description here

You should use the package \usepackage{hyperref} to try with \eqref{eq:funcao_dif} or \ref{eq:funcao_dif}. I think this will work.

Output of following shown in image.

\usepackage{cleveref}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{fancyref}
\usepackage{amssymb}
\usepackage[utf8x]{inputenc}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage{floatrow}
\usepackage{imakeidx}
\addtokomafont{sectioning}{\rmfamily}
\usepackage{indentfirst}
\makeindex
\begin{document}
\begin{equation}\label{eq:funcao_dif}
v_1 = K v_i + \frac{v_2}{Q} - v_3 = K v_i - \frac{1}{sT}\frac{1}{Q} v_1  + 
\frac{1}{sT} v_2 = K v_i - \frac{1}{sT}\frac{1}{Q} v_1  - \frac{1}{s^2T^2} 
v_1 
\end{equation}
\end{document}

You should to try with \eqref{eq:funcao_dif} or \ref{eq:funcao_dif}. I think this will work.

4
  • 4
    I am sorry but this answer is wrong, you do not need hyperref to use \ref and \label. Oct 18 '17 at 7:45
  • Please try following:- with and without {hyperref} it will be clear.
    – alphy
    Oct 18 '17 at 7:48
  • @alphy hyperref adds hyperlinks but \label and \ref work fine without the package
    – cgnieder
    Oct 18 '17 at 7:49
  • Sir, I've tried both with and without {hyperref}. Its working when using \usepackage{hyperref}.
    – alphy
    Oct 18 '17 at 7:52

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.