github 主页 <https://github.com/hadley/ggplot2-book>
Hadley Wickham 发布了编译该书的源代码,还把编译过程写出来,我替大家把编译过程中的坑先淌了
配置环境变量 R 安装路径 C:\Program Files\R\R-3.4.2\bin
添加到系统 Path
texlive 2017
安装 R 包
Lahman
wesanderson
directlabels
USAboundaries
install.packages("USAboundariesData", repos = "http://packages.ropensci.org", type = "source")
下面是 make 记录
$ make
mkdir -p book/tex
mkdir -p book/tex/_figures
mkdir -p book/tex/diagrams
cp book/ggplot2-book.tex book/tex/ggplot2-book.tex
Rscript book/render-tex.R data-manip.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R ggplot.rmd
Loading required package: nlme
Attaching package: 'nlme'
The following object is masked from 'package:dplyr':
collapse
This is mgcv 1.8-22. For overview type 'help("mgcv-package")'.
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R introduction.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R layers.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R mastery.rmd
`geom_smooth()` using method = 'loess'
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R modelling.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R position.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R preface.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R programming.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R scales.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R themes.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R tidy-data.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
Rscript book/render-tex.R toolbox.rmd
[pandoc.exe warning] --chapters is deprecated. Use --top-level-division=chapter instead.
cp -R _figures/* book/tex/_figures
cp -R diagrams/* book/tex/diagrams
# strip bad ICC metadata
find book/tex -type f -name "*.png" -exec optipng -strip all -o0 -clobber -quiet {} \;
find: ‘optipng’: No such file or directory
find: ‘optipng’: No such file or directory
touch book/CHAPTERS
cp -R book/springer/* book/tex
cp book/latexmk book/tex/
cp book/latexmkrc book/tex/
cd book/tex && ./latexmk -pdf -interaction=batchmode ggplot2-book.tex
Use of uninitialized value $ENV{"USER"} in concatenation (.) or string at ./latexmk line 925.
Latexmk: This is Latexmk, John Collins, 10 Nov 2013, version: 4.39.
**** Report bugs etc to John Collins <collins at phys.psu.edu>. ****
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': Rules & subrules not known to be previously run:
pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -interaction=batchmode -recorder "ggplot2-book.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
Latexmk: Index file 'ggplot2-book.adx' was written
Cusdep 'adx and 0 makeadx2and' should be used
Latexmk: Index file 'ggplot2-book.idx' was written
Latexmk: Reference `cha:getting-started' on page x undefined
Latexmk: Reference `cha:getting-started' on page x undefined
`中间省略`
Latexmk: Reference `sub:trend' on page 216 undefined
Latexmk: Missing input file: 'ggplot2-book.ind' from line
'No file ggplot2-book.ind.'
Latexmk: Missing input file: 'ggplot2-book.and' from line
'No file ggplot2-book.and.'
Latexmk: References changed.
Latexmk: References changed.
Latexmk: Log file says output to 'ggplot2-book.pdf'
=== Creating rule for 'cusdep adx and ggplot2-book'
Latexmk: Summary of warnings:
Latex failed to resolve 180 reference(s)
Latexmk: applying rule 'makeindex ggplot2-book.idx'...
Rule 'makeindex ggplot2-book.idx': File changes, etc:
Non-existent destination files:
'ggplot2-book.ind'
------------
Run number 1 of rule 'makeindex ggplot2-book.idx'
------------
------------
Running 'makeindex -o "ggplot2-book.ind" "ggplot2-book.idx"'
------------
This is makeindex, version 2.15 [TeX Live 2017/W32TeX] (kpathsea + Thai support).
Scanning input file ggplot2-book.idx....done (218 entries accepted, 0 rejected).
Sorting entries.....done (1776 comparisons).
Generating output file ggplot2-book.ind....done (277 lines written, 0 warnings).
Output written in ggplot2-book.ind.
Transcript written in ggplot2-book.ilg.
Latexmk: applying rule 'cusdep adx and ggplot2-book'...
Rule 'cusdep adx and ggplot2-book': File changes, etc:
Changed files, or newly in use since previous run(s):
'ggplot2-book.adx'
Non-existent destination files:
'ggplot2-book.and'
------------
Run number 1 of rule 'cusdep adx and ggplot2-book'
------------
For rule 'cusdep adx and ggplot2-book', running '&do_cusdep( makeadx2and )' ...
This is makeindex, version 2.15 [TeX Live 2017/W32TeX] (kpathsea + Thai support).
Scanning input file ggplot2-book.adx....done (177 entries accepted, 0 rejected).
Sorting entries....done (1343 comparisons).
Generating output file ggplot2-book.and....done (217 lines written, 0 warnings).
Output written in ggplot2-book.and.
Transcript written in ggplot2-book.ilg.
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'ggplot2-book.and'
'ggplot2-book.aux'
'ggplot2-book.ind'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex -interaction=batchmode -recorder "ggplot2-book.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
Latexmk: Index file 'ggplot2-book.adx' was written
Cusdep 'adx and 0 makeadx2and' should be used
Latexmk: Index file 'ggplot2-book.idx' was written
Latexmk: References changed.
Latexmk: Log file says output to 'ggplot2-book.pdf'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'data-manip.aux'
'ggplot.aux'
'ggplot2-book.aux'
'ggplot2-book.out'
'ggplot2-book.toc'
'introduction.aux'
'layers.aux'
'mastery.aux'
'modelling.aux'
'position.aux'
'preface.aux'
'programming.aux'
'scales.aux'
'themes.aux'
'tidy-data.aux'
'toolbox.aux'
------------
Run number 3 of rule 'pdflatex'
------------
------------
Running 'pdflatex -interaction=batchmode -recorder "ggplot2-book.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
Latexmk: Index file 'ggplot2-book.adx' was written
Cusdep 'adx and 0 makeadx2and' should be used
Latexmk: Index file 'ggplot2-book.idx' was written
Latexmk: Log file says output to 'ggplot2-book.pdf'
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 256
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs of latex/pdflatex.
make: *** [book/ggplot2-book.pdf] Error 12
最后的警告无碍,在book/tex/ggplot2-book.pdf
可以找到编译得到的 pdf ,如果有人实在编译不出来请参看 <https://cloud2016.github.io/post/how-to-compile-ggplot2-book/>