GeneralSplit Output to separate Files for each Chapter

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
oktoberjazz
Posts: 1
Joined: Mon Aug 13, 2012 11:56 am

Split Output to separate Files for each Chapter

Post by oktoberjazz »

Hello,

I can't find a solution to this problem on the internet. Starting from an input file in the »book« class, do you know a smart way to compile it and produce not a single PDF, but many files, one for every chapter? I mean something like this:

http://cacr.uwaterloo.ca/hac/

So that is possible to share only single chapters and not only the whole document

Thank you for your help

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Split Output to separate Files for each Chapter

Post by Stefan Kottwitz »

Hi,

welcome to the board!

If each chapter is a file (chapter1.tex, ...), which you read in by include, you could use \includeonly to include just the first chapter, i.e.

Code: Select all

\includeonly{chapter1}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
and compile, which produces a pdf with just the first chapter, but correct references.

Then you repeat it with chapter 2. Well, that's some work. It's more intended for easier development of larger documents, so you don't need to compile the whole book each time although you work on just one chapter.

Of course one could write a script, or even a LaTeX document which calls LaTeX itself several times producing chapter files. Also bit of work to program it.

The easiest way, however, is to use an external tool for splitting the big pdf, such as pdfsam or pdftk, or use pdfpages with LaTeX.

Stefan
LaTeX.org admin
Post Reply