# Providing references through a file

Does anyone know how to provide references through a file rather than by compiling labels? Specifically, I want to compile only a specific part of a LaTeX file into a PDF, but I want to make sure that the reference numbers and section numbers are consistent with the PDF of the entire file.

It sounds like what you want is to use LaTeX's \include mechanism. It allows you to specify only specific parts of the document to be compiled while keeping references/pagination/etc. the same as for the whole document. \include works like input except that you don't provide the .tex extension and every \include implicitly starts a new page. E.g.,

\documentclass{book}
\includeonly{chapter1,chapter2} % leave out \includeonly to compile whole document
\begin{document}
\include{frontmatter}
\include{chapter1}
\include{chapter2}
\include{chapter3}
\include{appendices}
\include{backmatter}
\end{document}

• The \includeonly was what I was looking for thanks. – Tae Hyung Kim Aug 28 '20 at 9:34