CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download
Project: test
Views: 91872
1
import IPython.nbconvert.exporters.pdf as pdf
2
3
f = open('book.tex', 'r', encoding="iso-8859-1")
4
filedata = f.read()
5
f.close()
6
7
newdata = filedata.replace('\chapter{Preface}', '\chapter*{Preface}')
8
9
f = open('book.tex', 'w', encoding="iso-8859-1")
10
f.write(newdata)
11
f.close()
12
13
p = pdf.PDFExporter()
14
p.run_latex('book.tex')
15
16
17