Using Jupyter Notebook for book creation

818 views
Skip to first unread message

Jesus Castello

unread,
Dec 8, 2016, 3:59:27 PM12/8/16
to Project Jupyter
Hello,
I was wondering if there is an easy way to use Jupyter Notebook to write programming books.

My idea is to have multiple notebooks, where every notebook is a chapter from the book. Then render all the notebooks into a single PDF, with the correct chapter order.

Would that be possible without creating a custom extension?

Thank you.

Thomas Kluyver

unread,
Dec 8, 2016, 5:27:18 PM12/8/16
to Project Jupyter
On 8 December 2016 at 21:59, Jesus Castello <mat...@gmail.com> wrote:
My idea is to have multiple notebooks, where every notebook is a chapter from the book. Then render all the notebooks into a single PDF, with the correct chapter order.

I have a project called 'bookbook' which does this. It's a very young project, so caveat emptor, but it's working for a set of lecture notes I've been working with (which I can't share publicly - sorry).

https://github.com/takluyver/bookbook

For now, it expects the notebook chapters to be named NN-name.ipynb, e.g. 01-Introduction.ipynb.

Thomas

jfbercher

unread,
Dec 10, 2016, 5:44:05 PM12/10/16
to Project Jupyter
@takowl bookbook looks very nice and promising!

Jesus, 
Alternatively, I used the following trick: 
In jupyter_latex_envs, there is an option to convert a notebook to LaTeX without headers (preambule) or footer (\end{document}); see the documentation, section 3.1
You can then convert your individual chapters using this command and gather them into a main TeXfile (which will also include the standard header used by the ipynb --> latex conversion, eg for rendering code). In turn, you will just have to compile this source file via latex/pdflatex/xelatex. 
If you are used to makefile, you can also design a makefile to automate updates. 
I used this approach for a project "A Journey in Signal Processing with IPython"  (a bit stalled for now). An example source file is here, and an example makefile here (update the conversion command). The resulting pdf is here.

Sascha Spors

unread,
Dec 12, 2016, 4:53:31 AM12/12/16
to jup...@googlegroups.com
Dear Jesus,

I use Sphinx together with the Jupyter Notebook Tools for Sphinx http://nbsphinx.readthedocs.io/en/latest/ to generate a PDF from my notebooks on Digital Signal Processing https://github.com/spatialaudio/digital-signal-processing-lecture. That works very well.

greetings,
Sascha

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/b648eded-7f07-4c93-a666-f2c661c18d7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages