GeneralCross-referencing files

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
fasdafs
Posts: 3
Joined: Tue Apr 22, 2008 7:09 am

Cross-referencing files

Post by fasdafs »

Say I have two documents doc1.tex and doc2.tex and they are complementary. I want each document to be able to refer to the other documents figures/equations by label. For example, doc1.tex has

Code: Select all

\begin{figure}
    ...
    \label{fig:fig1}
\end{figure}
I want doc2.tex to be able to use

Code: Select all

...(see Figure \ref{fig:fig1}).
Is there any possibly way to do this in latex and avoid the manual numbering and re-numbering any time either document changes? I need these two documents (doc1.tex and doc2.tex) to become separate PDFs. It's okay if the only way is to include both into the same file and compile them together as long as I can separate out the two PDF files. Note that they will need separate \title's and \maketitle's.

--fasd

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Cross-referencing files

Post by gmedina »

Can doc1.tex and doc2.tex be treated as subsidiary documents from a main .tex file?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
fasdafs
Posts: 3
Joined: Tue Apr 22, 2008 7:09 am

Re: Cross-referencing files

Post by fasdafs »

The problem is that I want each of them to result in two independent PDF files. If you have a way for both of them to be the subsidiary of the same file and compile into two independent PDFs (say, by toggling a flag) and not result in any broken cross-references, then that would be just as good.
fasdafs
Posts: 3
Joined: Tue Apr 22, 2008 7:09 am

Re: Cross-referencing files

Post by fasdafs »

Ah, I suppose the problem is partially solved now. I can make the same document and use dvips with -pp option to specify which pages should be converted to PS to get separate PS files. And then convert the resulting PS files to PDF.

The disadvantage is that \maketitle in doc2.tex doesn't seem to have any affect, but I suppose the above fix will do for now.
Post Reply