1

I am new to LaTeX, this question is basic, but I have tried to solve it to no avail. I don't understand the LaTeX lingo too well, so I'd appreciate an answer a complete beginner will get. Thank you.

I want to produce an automatic reference which states (1) the object I am referring to (section, graph, etc.) and (2) the position in the document (if on the same page, "above"/"below", next page etc.). When I load both packages and use \vref, the procedure works if I copy the relevant sections of text/ code into a new Latex document and run it twice. It does not work in the original Latex document. Instead of producing "section 5 on the following page" it produces "?? on the following page".

The only significant difference between the two documents (that I can think of) is the preamble. Could this be the problem? If not, what then?

Dummy preamble:

\documentclass[12pt,a4paper]{report}  
\usepackage[utf8]{inputenc}  
\usepackage[american]{babel}  
\usepackage{varioref}  
\usepackage{hyperref}  
\usepackage{cleveref}  
\begin{document}  

'Real' file

\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel} 
\usepackage{csquotes} 
\usepackage{enumitem}
\usepackage{verbatim}
\usepackage[style=mla,backend=biber]{biblatex}
\usepackage{hyperref}
\usepackage{rotating}
\usepackage{tcolorbox}
\usepackage{booktabs}
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}

\tableofcontents
\pagebreak

\chapter{Manuel}

\section{Text Passage Summary and Irrelevant Information}

\subsection{Text Passages and their Usage}

\subsection{Eliminating Irrelevant Information: Descriptive and Speculative Text}

\section{The Object}

\subsection{Identifying the Object}

\subsection{Summarizing Relevant Information Concerning the Object}
\textbf{Both or either the object and/or its surrounding text may contain relevant information}, so that both must be looked at carefully. Information is relevant if it provides particular kinds of details about what the party wants to do. What kind of information is relevant will be described in \vref{sec:means}. 

\pagebreak

\section{Identifying Relevant Information} \label{sec:means}

\end{document}    
  • 2
    Welcome to TeX.SE. Did you compile twice? That's necessary, since the cross-referencing information is known at the end of the first run, but not at the begin of it. Sometimes, three compilation runs are necessary – user31729 Feb 28 '17 at 13:26
  • I am a bit ashamed, now I have and it's fine. I tried it in the actual document I am working in and it continues to produce the ??, however, and I compiled that millions of times. – dan1789 Feb 28 '17 at 13:29
  • Sometimes it's a typo for the label name, i.e. \label{foo} and \ref{foO} will cause a ??, as well as \ref{fo o} would cause it, but \ref{foo} will work, as well as \cref{foo} etc. – user31729 Feb 28 '17 at 13:31
  • Nope, the labels are identical. Thanks for your suggestions though. – dan1789 Feb 28 '17 at 13:45
  • 1
    Please post the minimal version of your document that has the issue, not just fragments – user31729 Feb 28 '17 at 13:50
1

The correct load order should be varioref, hyperref, cleveref

Interchanging the load order of varioref and hyperref in the following document will produce warnings and the references are wrong, since varioref hooks into the label system, as well as hyperref does, calling varioref later than hyperref, the linking and labelling and all achievement by hyperref is damaged.

\documentclass{book}
\usepackage{blindtext}
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}

See \vref{foosection}

\chapter{Foo chapter}\label{foochapter}
\blindtext
\section{Foo section} \label{foosection}
\blindtext[5]



\end{document}    
|improve this answer|||||

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.