diff --git a/bootstrap/lecture/Makefile b/bootstrap/lecture/Makefile
index de4182d..7abf35f 100644
--- a/bootstrap/lecture/Makefile
+++ b/bootstrap/lecture/Makefile
@@ -9,6 +9,9 @@ all : pdf
 pdf : $(BASENAME)-chapter.pdf
 
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES)
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 $(PYPDFFILES) : %.pdf : %.py
diff --git a/bootstrap/lecture/bootstrap-chapter.tex b/bootstrap/lecture/bootstrap-chapter.tex
index cb9ec3f..7ecd9a5 100644
--- a/bootstrap/lecture/bootstrap-chapter.tex
+++ b/bootstrap/lecture/bootstrap-chapter.tex
@@ -1,16 +1,17 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{figures/}}
 
+\setcounter{page}{81}
+\setcounter{chapter}{4}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{bootstrap}
+\input{bootstrap}
 
 \end{document}
diff --git a/designpattern/lecture/Makefile b/designpattern/lecture/Makefile
index d570705..145c35c 100644
--- a/designpattern/lecture/Makefile
+++ b/designpattern/lecture/Makefile
@@ -9,6 +9,9 @@ all : pdf
 pdf : $(BASENAME)-chapter.pdf
 
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES)
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 $(PYPDFFILES) : %.pdf : %.py
diff --git a/designpattern/lecture/designpattern-chapter.tex b/designpattern/lecture/designpattern-chapter.tex
index f695de3..0f3596c 100644
--- a/designpattern/lecture/designpattern-chapter.tex
+++ b/designpattern/lecture/designpattern-chapter.tex
@@ -1,16 +1,17 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{figures/}}
 
+\setcounter{page}{125}
+\setcounter{chapter}{8}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{designpattern}
+\input{designpattern}
 
 \end{document}
diff --git a/likelihood/lecture/Makefile b/likelihood/lecture/Makefile
index 42b8e3d..51e7876 100644
--- a/likelihood/lecture/Makefile
+++ b/likelihood/lecture/Makefile
@@ -9,6 +9,9 @@ all : pdf
 pdf : $(BASENAME)-chapter.pdf
 
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES)
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 $(PYPDFFILES) : %.pdf : %.py
diff --git a/likelihood/lecture/likelihood-chapter.tex b/likelihood/lecture/likelihood-chapter.tex
index 79d95f2..0f74fe3 100644
--- a/likelihood/lecture/likelihood-chapter.tex
+++ b/likelihood/lecture/likelihood-chapter.tex
@@ -1,16 +1,17 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{figures/}}
 
+\setcounter{page}{101}
+\setcounter{chapter}{6}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{likelihood}
+\input{likelihood}
 
 \end{document}
diff --git a/plotting/lecture/Makefile b/plotting/lecture/Makefile
index 4626417..3fa9e21 100644
--- a/plotting/lecture/Makefile
+++ b/plotting/lecture/Makefile
@@ -12,6 +12,9 @@ all: pdf slides thumbs
 # script:
 pdf : $(BASENAME)-chapter.pdf
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(GPTTEXFILES) $(PYPDFFILES) ../../header.tex
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 
diff --git a/plotting/lecture/plotting-chapter.tex b/plotting/lecture/plotting-chapter.tex
index 2f260f3..faab54e 100644
--- a/plotting/lecture/plotting-chapter.tex
+++ b/plotting/lecture/plotting-chapter.tex
@@ -1,17 +1,18 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{images/}}
 
+\setcounter{page}{45}
+\setcounter{chapter}{1}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{plotting}
+\input{plotting}
 
 \end{document}
 
diff --git a/pointprocesses/lecture/Makefile b/pointprocesses/lecture/Makefile
index 4ac656e..308f276 100644
--- a/pointprocesses/lecture/Makefile
+++ b/pointprocesses/lecture/Makefile
@@ -12,6 +12,9 @@ all: pdf slides thumbs
 # script:
 pdf : $(BASENAME)-chapter.pdf
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(GPTTEXFILES) $(PYPDFFILES)
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 
diff --git a/pointprocesses/lecture/pointprocesses-chapter.tex b/pointprocesses/lecture/pointprocesses-chapter.tex
index 9c392e4..70de527 100644
--- a/pointprocesses/lecture/pointprocesses-chapter.tex
+++ b/pointprocesses/lecture/pointprocesses-chapter.tex
@@ -1,17 +1,18 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{figures/}}
 
+\setcounter{page}{111}
+\setcounter{chapter}{7}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{pointprocesses}
+\input{pointprocesses}
 
 \end{document}
 
diff --git a/programming/lecture/Makefile b/programming/lecture/Makefile
index 5cd2a27..379ae0e 100644
--- a/programming/lecture/Makefile
+++ b/programming/lecture/Makefile
@@ -11,6 +11,9 @@ all : pdf
 pdf : $(BASENAME)-chapter.pdf
 
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES) ../../header.tex
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 $(PYPDFFILES) : %.pdf : %.py
diff --git a/programming/lecture/programming-chapter.tex b/programming/lecture/programming-chapter.tex
index 00d52a4..8eb19a1 100644
--- a/programming/lecture/programming-chapter.tex
+++ b/programming/lecture/programming-chapter.tex
@@ -1,17 +1,18 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{images/}}
 
+\setcounter{page}{15}
+\setcounter{chapter}{0}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{programming}
+\input{programming}
 
 \end{document}
 
diff --git a/programmingstyle/lecture/Makefile b/programmingstyle/lecture/Makefile
index ad1b36a..463f202 100644
--- a/programmingstyle/lecture/Makefile
+++ b/programmingstyle/lecture/Makefile
@@ -1,7 +1,5 @@
 BASENAME=programmingstyle
 
-#TEXFILES=programmingstyle.tex
-
 PYFILES=$(wildcard *.py)
 PYPDFFILES=$(PYFILES:.py=.pdf)
 
@@ -11,6 +9,9 @@ all : pdf
 pdf : $(BASENAME)-chapter.pdf
 
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES) ../../header.tex
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 $(PYPDFFILES) : %.pdf : %.py
diff --git a/programmingstyle/lecture/programmingstyle-chapter.tex b/programmingstyle/lecture/programmingstyle-chapter.tex
index fffe3a4..d82204d 100644
--- a/programmingstyle/lecture/programmingstyle-chapter.tex
+++ b/programmingstyle/lecture/programmingstyle-chapter.tex
@@ -1,17 +1,18 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{figures/}}
 
+\setcounter{page}{57}
+\setcounter{chapter}{2}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{programmingstyle}
+\input{programmingstyle}
 
 \end{document}
 
diff --git a/regression/lecture/Makefile b/regression/lecture/Makefile
index 9a3574d..1f7271d 100644
--- a/regression/lecture/Makefile
+++ b/regression/lecture/Makefile
@@ -9,6 +9,9 @@ all : pdf
 pdf : $(BASENAME)-chapter.pdf
 
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES)
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 $(PYPDFFILES) : %.pdf : %.py
diff --git a/regression/lecture/regression-chapter.tex b/regression/lecture/regression-chapter.tex
index 8cbba06..0df5e2b 100644
--- a/regression/lecture/regression-chapter.tex
+++ b/regression/lecture/regression-chapter.tex
@@ -1,16 +1,17 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{figures/}}
 
+\setcounter{page}{89}
+\setcounter{chapter}{5}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{regression}
+\input{regression}
 
 \end{document}
diff --git a/scientificcomputing-script.tex b/scientificcomputing-script.tex
index 618b89d..304d5ef 100644
--- a/scientificcomputing-script.tex
+++ b/scientificcomputing-script.tex
@@ -64,6 +64,6 @@
 \lstset{inputpath=designpattern/code}
 \include{designpattern/lecture/designpattern}
 
-\chapter{Cheat-Sheet}
+%\chapter{Cheat-Sheet}
 
 \end{document}
diff --git a/statistics/lecture/Makefile b/statistics/lecture/Makefile
index 7ab252d..7cc97e2 100644
--- a/statistics/lecture/Makefile
+++ b/statistics/lecture/Makefile
@@ -9,6 +9,9 @@ all : pdf
 pdf : $(BASENAME)-chapter.pdf
 
 $(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES) ../../header.tex
+	CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
+	PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
+	sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
 	pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
 
 $(PYPDFFILES) : %.pdf : %.py
diff --git a/statistics/lecture/statistics-chapter.tex b/statistics/lecture/statistics-chapter.tex
index 814ba77..ad93f38 100644
--- a/statistics/lecture/statistics-chapter.tex
+++ b/statistics/lecture/statistics-chapter.tex
@@ -1,22 +1,22 @@
-\documentclass[12pt]{report}
+\documentclass[12pt]{book}
 
 \input{../../header}
 
 \lstset{inputpath=../code}
-
 \graphicspath{{figures/}}
 
+\setcounter{page}{69}
+\setcounter{chapter}{3}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{document} 
 
-\include{statistics}
+\input{statistics}
 
 \end{document}
 
 
-\end{document}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{Statistics}