3

Can somebody tell me why the references don't work in this example?

\documentclass{article}

\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}

\usepackage{amsmath}

\begin{document}
Some group of equations:
\begin{subequations}
    \begin{align}
        f(x) &= x \label{eq1} \\
        g(x) &= x+1 \label{eq2} \\
        h(x) &= x+2 \label{eq3} \\
        k(x) &= x+3 \label{eq4}
    \end{align}
    \label{all-eq}
\end{subequations}
Reference to \eqref{eq1} works but a \vrefrange{eq1}{eq4} or 
\crefrange{eq1}{eq4} or \cref{eq1,eq2,eq3,eq4} or 
\vref{eq1,eq2,eq3,eq4} fail

\end{document}

This gives me: output

5

This is a typical error: Loading packages which uses counters and special reference formats after cleveref is wrong, since this package uses sophisticated macros in in the background, well, to do the clever reference ;-)

cleveref should be the last package to be loaded, even after hyperref

\documentclass{article}


\usepackage{amsmath}

\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}

\begin{document}
Some group of equations:
\begin{subequations}
    \begin{align}
        f(x) &= x \label{eq1} \\
        g(x) &= x+1 \label{eq2} \\
        h(x) &= x+2 \label{eq3} \\
        k(x) &= x+3 \label{eq4}
    \end{align}
    \label{all-eq}
\end{subequations}
Reference to \eqref{eq1} works but a \vrefrange{eq1}{eq4} or 
\crefrange{eq1}{eq4} or \cref{eq1,eq2,eq3,eq4} or 
\vref{eq1,eq2,eq3,eq4} fail

\end{document}

enter image description here

  • I wonder, haw you generate image in your answer. I prepare similar answer, but not figured out, how to show result in tight form. So on the end I give up ... – Zarko May 14 '15 at 21:23
  • @Zarko: I just use the screenshot device from Gimp and then export the image as .jpg. The Adobe reader snapshot tool does not maintain the link borders, unfortunately. – user31729 May 14 '15 at 21:25
  • @Cristian Huppfer, thank you for your answer. I usually use 'preview' package, but using it I didn't find a way to combine some text and equations. Unfortunately I newer use 'Gimp' (does it exit in Windows?). – Zarko May 14 '15 at 21:31
  • @Zarko: I never use preview... but here's a download link for Windows (untested, since I am no Windows user ;-)) download.gimp.org/pub/gimp/v2.8/windows/… – user31729 May 14 '15 at 21:39
  • That did the trick. Thanks! @Zarko, have a look at tex.stackexchange.com/questions/11866/… – wpoely86 May 15 '15 at 14:03

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.