2016-01-03 19:43:45 +01:00
|
|
|
import nbconvert.exporters.pdf as pdf
|
2015-07-18 17:43:24 +02:00
|
|
|
import sys
|
2015-05-01 19:49:12 +02:00
|
|
|
|
2015-07-18 17:43:24 +02:00
|
|
|
if len(sys.argv) == 2:
|
|
|
|
name = sys.argv[1]
|
|
|
|
else:
|
|
|
|
name = 'book.tex'
|
|
|
|
|
|
|
|
f = open(name, 'r', encoding="iso-8859-1")
|
2015-05-01 19:49:12 +02:00
|
|
|
filedata = f.read()
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
newdata = filedata.replace('\chapter{Preface}', '\chapter*{Preface}')
|
|
|
|
|
2016-01-03 19:43:45 +01:00
|
|
|
f = open(name, 'w', encoding="iso-8859-1")
|
2015-05-01 19:49:12 +02:00
|
|
|
f.write(newdata)
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
p = pdf.PDFExporter()
|
2015-07-18 17:43:24 +02:00
|
|
|
p.run_latex(name)
|
2015-05-01 19:49:12 +02:00
|
|
|
|