2

I have created two LaTeX files: 1.tex and 2.tex. First file contains a figure and I want to make a reference to that figure in the second file. I run pdfLaTeX several times (2-3) for both files. Sadly in return, in second file I get "??" sign instead of a respective label. When checking the Console Output for second file, it contains following lines:

...
Package xr Warning: 
No file 1.aux
LABELS NOT IMPORTED.
on input line 4.
...

Apparently something is going wrong during compilation. How to fix this error?

Contents of both 1.tex and 2.tex files are shown below. Both of these files are saved in same folder.

1.tex:

\documentclass{article}
\usepackage{graphicx}
\usepackage{xr}

\begin{document}
My document No 1. And here you can see some chemical stuff: Figure~\ref{fig:Fig1}.
\begin{figure}[b]
\includegraphics[width=0.5\textwidth]{Fig1}
\caption{Some cheical stiff}
\label{fig:Fig1}    
\end{figure}

\end{document}

And here is the 2.tex:

\documentclass{article}
\usepackage{graphicx}
\usepackage{xr}
\externaldocument{1}

\begin{document}
My document No 1. And here you can see some chemical stuff: \ref{fig:Fig1}.

\end{document}

And here is what I see as an output for 2.tex: enter image description here

I have also copied the contents of the Console Output for both files and saved as Notepad txt files. Here are links for this files: 1.txt and 2.txt

19
  • you have to run both files two times each with.
    – user2478
    May 21 '17 at 14:22
  • Are you redirecting the output or cleaning up after the compilation? May 21 '17 at 14:25
  • I run both files several times. I.e. I run 1.tex 2-3 times, then I run 2.tex 2-3 times. It doesn't seem to be working anyway.
    – Bulat
    May 21 '17 at 14:30
  • 1
    Then show the log-files and the aux-files. May 21 '17 at 14:41
  • 3
    Both log-files say "No file 1.aux", so references can't work. If the messages don't disappear you are probably deleting the aux-files between the compilations. May 21 '17 at 19:55
1

You can run bibtex on its own, e.g. through the typeset menu, at the end there is bibtex:

enter image description here

I wouldn't use the pdfLaTeX+MakeIndex+BibTeX script, it uses texify and this is quite a pain when errors occur. Also it is really not needed to run makeindex and bibtex all the time. But if you want to use it, you should remove in the preferences the --clean option (select the script you want to adjust and then click edit):

enter image description here

1
  • Is this Windows specific? Here, with Linux version of Texworks I do not have such an entry. May 22 '17 at 10:38

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.