tags:

views:

830

answers:

4

I'm currently finishing off my dissertation, and would like to be able to include some documents within my LaTeX document.

The files I'd like to include are weekly reports done in LaTeX to my supervisor. Obviously all documents are page numbered seperately. I would like them to be included in the final document.

I could concatenate all the final PDFs using GhostScript or some other tool, but I would like to have consistent numbering throughout the document.

I have tried including the LaTeX from each document in the main document, but the preamble etc causes problems and the small title I have in each report takes a whole page...

In summary, I'm looking for a way of including a number of 1 or 2 page self-complete LaTeX files in a large report, keeping their original layouts, but changing the page numbering.

+1  A: 

Sed and awk are your friends. I am not aware of any automated process for doing this.

Andrew Sledge
+3  A: 

Maintaining the original formatting per document will be difficult if they're using different formats. For example, concatenating different document classes will be near impossible.

I would suggest you go with the GhostScript solution with a slight twist. Latex allows you to set the starting page number using \setcounter{page}{13} for example. If you can find an application that can count the pages of a PDF document (pdfinfo in the pdfjam Ubuntu package is one example), then you can do the following:

  • Compile the next document to PDF
  • Concatenate the latest PDF with the current full PDF
  • Find the page count of the full PDF
  • Use sed to pluck in a \setcounter{page}{N} command into the next latex file
  • Go back to the beginning

If you need to do any other processing, again use sed. You should (assuming you fix the infinite loop in the above algorithm ;-) ) end up with a final PDF document with all original PDFs concatenated and continuous line numbers.

marcog
The best solution I've found so far, I'll give it a go, ty
Chris Clarke
+4  A: 

For a possible solution of \input-ing the original LaTeX files while skipping their preamble, the newclude package might help.

Otherwise, you can use pdfpages for inserting pre-existing PDFs into your dissertation. I seem to recall that it has a feature of "suppressing" the original page numbers by covering them up with white boxes.

Will Robertson
+1  A: 

Have a look a the combine package, which seems to be exactly what you're searching for. Since it merges documents at the source level, I guess the page numbers will be correct.

Damien Pollet