Better code formatting with ``python

There is more than that here. I had a bad commit of a bunch of temporary
files, I had to reset back in time, and now I am doing a massive commit.
Sorry.
This commit is contained in:
Roger Labbe
2015-07-18 08:43:24 -07:00
parent cc24dd6291
commit 6092e06459
22 changed files with 1022 additions and 890 deletions

View File

@@ -9,6 +9,8 @@ rm --f Kalman_and_Bayesian_Filters_in_Python.ipynb
rm --f Kalman_and_Bayesian_Filters_in_Python.toc
rm --f Kalman_and_Bayesian_Filters_in_Python.tex
rm --f short.ipynb
rm --f chapter.ipynb
rm --f chapter.pdf
rmdir ./*_files/ 2> /dev/null

View File

@@ -5,8 +5,12 @@ rm --f *.toc
rm --f *.aux
rm --f *.log
rm --f *.out
rm --f book.ipynb
rm --f book.toc
rm --f book.tex
rm --f chapter.ipynb
rm --f chapter.pdf
rmdir /S /Q book_files
rmdir /S /Q chapter_files

5
pdf/make_chapter.bat Normal file
View File

@@ -0,0 +1,5 @@
cp %1 chapter.ipynb
ipython nbconvert --to latex chapter.ipynb
ipython to_pdf.py chapter.tex

View File

@@ -1,6 +1,12 @@
import IPython.nbconvert.exporters.pdf as pdf
import sys
f = open('book.tex', 'r', encoding="iso-8859-1")
if len(sys.argv) == 2:
name = sys.argv[1]
else:
name = 'book.tex'
f = open(name, 'r', encoding="iso-8859-1")
filedata = f.read()
f.close()
@@ -11,5 +17,5 @@ f.write(newdata)
f.close()
p = pdf.PDFExporter()
p.run_latex('book.tex')
p.run_latex(name)