djmurphy420/ggplot2-transition-guide — comment on commit ae050eb3133ce559adc1488edb96231fb2b08081
File: ggplot2-0.9.0-BW.Rnw line 1353
By djmurphy420:

Thanks, Yihui.

The reason why \tableofcontents isn't there is because Hadley thought it would be a good idea to put the TOC into a graph, but my fairly clumsy attempts at doing that didn't pan out. One alternative was to create a LaTeX table and then use a special font on it. Baptiste didn't like it, either; he suggested something that uses XeTeX but I haven't gotten it to work yet.

I'd prefer to keep one document, too, but part of the problem is that some graphs (notably the stacked histograms in section 2.1) don't print well at all on B/W printers so I used scale_grey() on them to get better grey shades. That happens for approximately 5-6 graphs. In most other cases, the color graphs render fine on B/W printers.

In my case, it isn't just ./guide.Rnw, it's ./guide-revisionXX.Rnw, but I like the idea. So far it hasn't been a big deal to maintain both since I created the two files after the document was pretty stable.

Appreciate the comments and the helpful alternatives. I'll incorporate them in the next pass through.

Regards,
Dennis

________________________________
From: Yihui Xie
To: Dennis Murphy
Sent: Sunday, February 5, 2012 10:33 PM
Subject: Re: [ggplot2-transition-guide] Updated .Rnw files, both color and B/W friendly (ae050eb)

I should have emailed you earlier, since I thought you would do this: make two copies of the same document. This is not the optimal way. Ideally you should only maintain one copy of the source document and compile it with different options. In this case, you can use two directories to put colored and BW output respectively, e.g. your dir structure is like this:

```
./guide.Rnw
-- colored/
-- bw/
```

then you can go to each directory and call knitr with different options:

```r
library(ggplot2)
library(knitr)

setwd('./colored/')
theme_set(theme_gray()) # set gray theme
opts_chunk$set(highlight = TRUE) # turn on highlighting
knit2pdf('../guide.Rnw', 'guide-colored.tex')

setwd('../bw/')
theme_set(theme_bw()) # set BW theme
opts_chunk$set(highlight = FALSE) # turn on highlighting
knit2pdf('../guide.Rnw', 'guide-bw.tex')
```

I'm almost sure it will be hell to maintain two source documents in the future :)

---
Reply to this email directly or view it on GitHub:
https://github.com/djmurphy420/ggplot2-transition-guide/commit/ae050eb3133ce559adc1488edb96231fb2b08081#commitcomment-935406