I have two files; one is main.tex and the other is supplement.tex and I want to reference table label from supplement.tex to main.tex, I do the following in main.tex:


No error has shown and I got like this Table ?? (the number didn't appear)

Any help please, I tried different ways while searching but none of them succeed with me.

  • 1
    Pls give a full compilable example, with this info we can't get started
    – vaettchen
    Oct 22 '18 at 11:47
  • supplement.aux which comes into being when compiling supplement.tex needs to be available. (Make sure to have compiled supplement.tex as many times as needed for having everything matching out correctly.) Oct 22 '18 at 11:48
  • Are you using the hyperref package? Oct 22 '18 at 11:52
  • It like this really, put those two lines up and I have a text like: jkjkjfj Table \ref{fig1} kkjkjkj; and fig1 in supplement.tex. That's is @vaettchen
    – LamaMo
    Oct 22 '18 at 11:53
  • No I didn't, I just use what I write in the question @samcarter
    – LamaMo
    Oct 22 '18 at 11:53

File documentA.tex

\section{Section in document A}\label{Asection}

File documentB.tex

\section{Section in document B}\label{Bsection}

This are references to section of document A:

ref: \ref{documentAPrefix-Asection}

pageref: \pageref{documentAPrefix-Asection}


First compile documentA.tex in order to obtain documentA.pdf.

During this compilation, beneath other things, the file documentA.aux comes into being.

Keep that file. Don't have it deleted.

Then compile documentB.tex.

I suggest doing this on the shell-prompt (bash/LXTerminal/command.com/whatever you use) :

On the prompt of your shell change to the directory/folder where both documentA.tex and documentB.tex are saved. (The command for changing to a directory or folder is chdir or cd or the like.)

Then two or three times use the command pdflatex documentA.tex.

Then two or three times use the command pdflatex documentB.tex.

Besides documentA.pdf and documentB.pdf you will get files of extension .log and .aux as well. The .aux-files are of interest for the \externaldocument-command. ;-)

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.