Re: [R] Sweave / Latex per-chapter output

From: Brett Presnell <>
Date: Wed, 21 May 2008 08:05:20 -0400

"Anne-Marie Ternes" <> writes:

> What I would like to do, is to be able to get 2 types of output with
> the same code (I'm lazy ;-) ):
> ...
> 2. a PDF and HTML file *per chapter*, for displaying on our website
> and allowing people to download individual chapters
> ...
> BTW, I'm working on Ubuntu Linux.

I'm assuming that you are using pdflatex to process the latex file(s) produced by Sweave.

Assuming also that you are using latex's \include command (e.g., \include{chap1}, \include{chap2}, etc.) inside your master file, you could add a line like


in the preamble to just create a pdf file containing only Chapter 2. The easiest way to do this is probably to edit the master latex file by hand, after having run pdflatex a few times to produce the full document (you need to do this to get all the pagination and cross-referencing information into the .aux, .toc, and other files).

Another way to accomplish 2 is to install Ubuntu's pdftk package then use the pdftk command with the "cat" option to extract whatever pages you want. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 21 May 2008 - 12:07:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 21 May 2008 - 13:30:38 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive