Is there a way to automatically split the output into different PDF files?

The reason is that I want to generate a document "paper.pdf" and a different document "supplementarymaterial.pdf", with shared macros, cross references, and even having some theorems from "paper.pdf" restated (using the restatable package) in the supplementarymaterial.pdf file.

The other immediate option (using different source files) has these pros/cons:

  • shared macros is easy (common \input file with macro definitions)
  • cross references is a pain (xr package, never used it)
  • restating theorems across different source files seems impossible

Basically I am looking for a latex-native alternative to Acrobat->Tools->split document (or wherever that option is)