MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a way to split output pdf-file (a book) into chapters on such a way that cross-references will survive.

A simple example with a solution (based on answers below) can be found here

share|cite|improve this question

closed as off topic by Scott Morrison Nov 19 '09 at 3:12

Questions on MathOverflow are expected to relate to research level mathematics within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This question is probably best asked on since there isn't anything about it which is specific to mathematics. – Anton Geraschenko Nov 19 '09 at 4:52
Right, sorry about that. – Anton Petrunin Nov 19 '09 at 5:55
up vote 6 down vote accepted

If you are using a book documentclass, then you can create a template file, with \include{chapter3} or \includeonly{chapter2}. I don't know if this works particularly. A hacky way to do it is to save your .aux file as say a .auk file, process, and then write over the .aux file with the saved version.

If you are on a mac, and have leopard or snow leopard, you can open files in preview and drag sets of pages into different preview windows, then you can save those files while editing others. Again it's a hack, but it works.

share|cite|improve this answer
I agree that \include and \includeonly are the best way to go. This creates a separate .aux file for each included chapter -- so it maintains cross-references, page numbering, etc. -- but only outputs the chapter(s) selected with \includeonly. I used this recently when I had to output my list of references as a separate PDF file, and it worked like a charm. – Ari Nov 19 '09 at 2:27
thank you so much :) – Anton Petrunin Nov 19 '09 at 3:29

The standard way to have inter file references in (pdf)latex is to use the xr package or, nowadays, the xr-hyper package which comes with hyperref.sty. Searching comp.text.tex (at, for example) should unearth information on how to do what you want.

share|cite|improve this answer
Close, but not exactly what I need. This way can I generate chapter-files with xrefs, BUT I do not see how one can automatically to keep all numeration (pages sections theorems) as in the book. – Anton Petrunin Nov 19 '09 at 2:11
If you put the chapters each in a separate .tex file, and include them in the main file using \include, latex will create one .aux file per included file. Process the main file as many times as you need to get it stabilize. Then edit the main file and add \includeonly{chapter-one}, for example, and re-run latex. It will use the .aux files for all included files, even though it will only process the one you told to process: that way, it will get all numeration counters correct. – Mariano Suárez-Alvarez Nov 19 '09 at 2:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.