Fixed PDF output; blank Particle filter chapter.

The PDF was not setting the Preface as a unnumbered chapter.
I think there is more work to get it's subsections unnumbered.

Added empty Particl filter chapter. Had to renumber the chapters
to make it fit in.
This commit is contained in:
Roger Labbe
2015-05-01 10:42:53 -07:00
parent 08123b0d15
commit f4d218e1b4
9 changed files with 336 additions and 20 deletions

View File

@@ -1,13 +1,12 @@
#! /bin/bash
echo "merging book..."
python merge_book.py > Kalman_and_Bayesian_Filters_in_Python.ipynb
python merge_book.py
echo "creating pdf..."
ipython nbconvert --to latex --template book Kalman_and_Bayesian_Filters_in_Python.ipynb
ipython nbconvert --to latex --template book book.ipynb
ipython to_pdf.py
mv Kalman_and_Bayesian_Filters_in_Python.pdf ..
echo "done."

View File

@@ -47,9 +47,10 @@ if __name__ == '__main__':
'../10_Unscented_Kalman_Filter.ipynb',
'../11_Extended_Kalman_Filters.ipynb',
'../12_Designing_Nonlinear_Kalman_Filters.ipynb',
'../13_Smoothing.ipynb',
'../14_Adaptive_Filtering.ipynb',
'../15_HInfinity_Filters.ipynb',
'../16_Ensemble_Kalman_Filters.ipynb',
'../13_Particle_Filters.ipynb',
'../14_Smoothing.ipynb',
'../15_Adaptive_Filtering.ipynb',
'../16_HInfinity_Filters.ipynb',
'../17_Ensemble_Kalman_Filters.ipynb',
'../Appendix_A_Installation.ipynb',
'../Appendix_B_Symbols_and_Notations.ipynb'])

View File

@@ -4,10 +4,22 @@ import io
import IPython.nbconvert.exporters.pdf as pdf
import fileinput
'''
for line in fileinput.input('book.tex', openhook=fileinput.hook_encoded("iso-8859-1")):
# print(line.replace('\chapter{Preface}', '\chapter*{Preface}'), end='')
line.replace('\chapter{Preface}', '\chapter*{Preface}')
#print(line.replace('\chapter{Preface}\label{preface}', '\chapter*{Preface}\label{preface}'), end='')
# line.replace(' \chapter{Preface}\label{preface}', ' \chapter*{Preface}\label{preface}')
line.replace('shit', 'poop')
'''
f = open('book.tex', 'r', encoding="iso-8859-1")
filedata = f.read()
f.close()
newdata = filedata.replace('\chapter{Preface}', '\chapter*{Preface}')
f = open('book.tex', 'w', encoding="iso-8859-1")
f.write(newdata)
f.close()
p = pdf.PDFExporter()
p.run_latex('book.tex')