The new book I translate is composed by two volumes A and B. Each volume must have its own index and table of contents and page numbering starting from 1 but of course the cross references between the two volumes must be valid. Lets say that the whole book has (as an example) 8 chapters and each volume includes 4 chapters (Volume A includes Chapters 1, 2, 3 and 4, and Volume B includes Chapters 5, 6, 7 and 8). I have two files VolumeA.tex and VolumeB.tex with the following (minimal) contents:
VolumeA.tex
\includeonly {Chapter01,Chapter02,Chapter03,Chapter04}
\begin{document}
\include{Chapter01}
\include{Chapter02}
\include{Chapter03}
\include{Chapter04}
\include{Chapter05}
\include{Chapter06}
\include{Chapter07}
\include{Chapter08}
\end{document}
VolumeB.tex
\includeonly {Chapter05,Chapter06,Chapter07,Chapter08}
\begin{document}
\include{Chapter01}
\include{Chapter02}
\include{Chapter03}
\include{Chapter04}
\include{Chapter05}
\include{Chapter06}
\include{Chapter07}
\include{Chapter08}
\end{document}
In order to get valid cross references I compile each volume with the corresponding \includeonly in comments, for example
%\includeonly {Chapter01,Chapter02,Chapter03,Chapter04}
in order to create the associated aux files and then with this line enabled (namely without the comment) in order to create the pdf with the appropriate four files (I use xelatex under MikTEX / Windows 10). Even though i get the correct result, I noticed that:
- The table of contents in each volume contains all eight chapters and not only the appropriate four chapters of this volume.
- The produced subject index is the index of the whole book and not of the associated volume.
- The page numbering in the two volumes is continuing. I can solve this problem by using the command \setcounter{page}{1} in the first file of VolumeB but this affects the TOC (of course if I solve the first problem there is no problem, after all, the numbering in Volume B from the beginning is a desired feature) and furthermore, the index uses the continuous numbering.
Is it possible to eliminate the above problems and get the situation described in the beginning of the question, or this is just the way LaTEX works and I have to adopt this with the appropriate corrections?
\includeand\includeonlyis probably the wrong tool here that is really just for temporary draft versions that quickly process one chapter in a larger work. I would process as two separate documents, and usexror similar package to cross refrence between them. – David Carlisle May 21 '22 at 18:48