General ⇒ Split Output to separate Files for each Chapter
-
- Posts: 1
- Joined: Mon Aug 13, 2012 11:56 am
Split Output to separate Files for each Chapter
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
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10328
- Joined: Mon Mar 10, 2008 9:44 pm
Split Output to separate Files for each Chapter
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}
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

Stefan