Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I see a few questions and answers about writing a book/thesis in LaTeX (here's one). But I would like to be able to compile reports separately as I write them to have a bunch of standalone documents. Is this possible without a lot of editing each time?

The context: every week for class I have to write a few summaries of the papers we read (some assigned, some just for my own benefit later). So I like the ability to compile each individually each week, then at the end of the semester bind them all into one "book" with pagination and a TOC.

Should I just make standalone articles each week, then edit all manually at the end of the semester into a book? Thanks!

share|improve this question

2 Answers 2

up vote 15 down vote accepted

You could split every report into two files: a main file holding only the preamble and an \input as document body, and a second file holding all the actual content. Then you are able to \input or \include all the content files in another main file for the book.

  % Main file of one report, e.g. `report01.tex`
  \documentclass{report}
  \title{...}
  \begin{document}
  \maketitle
  \input{content01}
  \end{document}

The content file then look like:

  % content01.tex
  \section{...}
  Some text

Book main file:

  \documentclass{book}
  % ....
  \begin{document}
  \maketitle
  \input{content01}
  \input{content02}
  \input{content03}
  \input{content04}
  \end{document}

This should work fine as long you don't want to keep the report title pages.

There are also packages like docmute or standalone which allow you to \include or \input another file which has its own preamble. The preambles of this sub-files are then ignored. This is basically the same like above but you don't need to split each report into two files.

share|improve this answer
    
Thanks! I used your first solution and it works great! –  Richard Herron Feb 16 '11 at 15:46
    
Looking to do something similar, I also ran across the combine and includex packages. The combine packages looks particularly interesting. –  David L Mar 20 '12 at 21:47

I created a project template for the Texlipse IDE which separates the different sections for an article using the exact same principle Martin suggests. I mentioned it in another post. You find it here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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