[Tex/LaTex] \vref and input command


You've saved my life in some occasions, I am writing my master thesis and as I am working with MATLAB, I found a very useful MATLAB function which "translate" MATLAB images to TeX tikzpicture.

I decided to put the images in some folders and to call them with a "input" command, so i make everything like this:

\caption{Results at time $t=100$ with $i_{max}=150$}

and everything worked fine.

Then i tried to recall the images with the \vref command, recalling the labels i wrote (i made copy+paste to be sure!) and they doesn't recall anything. They write something like:"as we can see in figure ?? on page 79"; the page is correct but there is no figure number!

Just to be clear:

  • I have uploaded all the necessary packages (I also put hyperref before varioref)
  • I use TeXShop on Mac
  • I have read all the manuals of the packages and found nothing
  • I have to give my thesis to my tutor on thursday 🙂

I hope some of you have a piece of advice for me!

Thank you in advice to all of you.

[EDIT] I add some more informations:

I am writing in the {book} environment, and it's a bit complicated to write here how my file is because I have one main file with the heading of my thesis recalling all the chapters. However I'll put here the code of the document which stays after the \usepackage (which are something like 40, so i don't know if it is useful to put them all…




\thispagestyle{empty} % citazione
    \vspace*{4 cm}



\thispagestyle{empty} % dedica
%   \vspace*{4 cm}
%   \textit{ \\
%   }\\
%   []\\

%   \vspace{2cm}
%   \textit{}\\
%   ()









        \fancyhead[RO,LE]{\slshape \leftmark}


%    \input{cap4}
%    \input{cap5}
%    \input{cap6}

%   \input{conclusion}  




Best Answer

The key piece of information, I believe, is that you load the hyperref package before the varioref package.

A solution to the problems you report consists of (a) loading varioref before hyperref and (b) loading cleveref as well, after hyperref. The reason this works is that when cleveref is loaded, it checks if varioref is loaded and, if the answer is yes, modifies some of varioref's internals in order to improve interoperability with cleveref. (Of course, for this to work cleveref must be loaded after varioref...) In the process, varioref also becomes more compatible -- I'm not sure if it's OK to say fully compatible -- with hyperref. For more information on this matter, see the posting Lost labels using intertext with varioref and hyperref.

In short, if you load the packages varioref, hyperref, and cleveref in this order, you should be able to use \vref without further problems.