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:
\begin{figure}[H]
\centering
\input{./images/cap3/expmcwe/imax150t100.tex}
\caption{Results at time $t=100$ with $i_{max}=150$}
\label{fig:imax150t100exp}
\end{figure}
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…
\begin{document}
\title{---}
\providecommand{\autore}{}
\providecommand{\coautore}{}
\providecommand{\cocoautore}{}
\providecommand{\principaladviser}{---}
\providecommand{\corelatore}{}
\providecommand{\secondadviser}{}
\providecommand{\annoacc}{}
\providecommand{\corso}{\uppercase{---}}
\providecommand{\nomecorso}{}
\titlep
\thispagestyle{empty}
\cleardoublepage
\thispagestyle{empty} % citazione
\begin{flushright}
\vspace*{4 cm}
\textit{---}\\
\end{flushright}
\newpage
\thispagestyle{empty}
\cleardoublepage
\thispagestyle{empty} % dedica
\begin{flushright}
% \vspace*{4 cm}
% \textit{ \\
% }\\
% []\\
% \vspace{2cm}
% \textit{}\\
% ()
\end{flushright}
\newpage
\thispagestyle{empty}
%\maketitle
\cleardoublepage
\input{abstract}
\newpage
\thispagestyle{empty}
\frontmatter
\newpage
\tableofcontents
\listoffigures
\listoftables
\lstlistoflistings
\newpage
\printnomenclature
\mainmatter
\pagestyle{fancy}
%\fancyhead[LO]{}
%\fancyhead[RE]{}
\fancyhead{}
\fancyhead[RO,LE]{\slshape \leftmark}
\fancyfoot{}
\fancyfoot[RO,LE]{\thepage}
\fancypagestyle{plain}{%
\fancyfoot{}
\fancyfoot[RO,LE]{\thepage}}
\input{introd}
\input{cap1}
\input{cap2}
\input{cap3}
% \input{cap4}
% \input{cap5}
% \input{cap6}
% \input{conclusion}
\cleardoublepage
%\phantomsection
\addcontentsline{toc}{chapter}{\bibname}
\bibliographystyle{plainnat}
\bibliography{bibliography}
\cleardoublepage
\input{acknowledgement}
\newpage
\thispagestyle{empty}
\end{document}
Best Answer
The key piece of information, I believe, is that you load the
hyperref
package before thevarioref
package.A solution to the problems you report consists of (a) loading
varioref
beforehyperref
and (b) loadingcleveref
as well, afterhyperref
. The reason this works is that whencleveref
is loaded, it checks ifvarioref
is loaded and, if the answer is yes, modifies some ofvarioref
's internals in order to improve interoperability withcleveref
. (Of course, for this to workcleveref
must be loaded aftervarioref
...) In the process,varioref
also becomes more compatible -- I'm not sure if it's OK to say fully compatible -- withhyperref
. 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
, andcleveref
in this order, you should be able to use\vref
without further problems.