[IPython-dev] High-quality pdf output (pdflatex) directly from notebooks

Ondřej Čertík ondrej.certik at gmail.com
Fri Aug 3 14:19:52 EDT 2012


On Mon, Apr 30, 2012 at 1:02 AM, Fernando Perez <fperez.net at gmail.com> wrote:
> Hi folks,
> This pdf file:
> http://archive.ipython.org/tmp/IntroNumPy.pdf
> was produced without a single manual change, straight from the
> notebook in the tarball next to it.  We're getting to the point where
> we can really produce very nice PDFs straight from the notebook!
> If you want to see this in master, please come along and help with the
> code review (it also has the instructions to reproduce it yourself):
> https://github.com/ipython/nbconvert/pull/12
> I hope we'll have this moved over soon, so we can polish it further
> and can make notebooks part of a regular publishing workflow.
> Ouch, my wrists hurt now.  But it was a weekend well spent, I think...

Would it be possible to somehow add this as a menu item "File ->
Download as -> pdf", just like in Google Docs?
This is where I first looked. Then I did "Print Preview", then print
in Chrome, then I had to click print using system dialog, there I set
to print to pdf and finally I got the pdf.

So I searched this list and found that you already implemented a
solution in the nbconvert project. I just tried it and it works out of
the box in Ubuntu. Few comments:

1) Sometimes it might be useful to allow the user to keep the In[1],
Out[1] lines, so that it is clear what is going on.

2) The images in my notebook are saved as png, and then they look ugly
in pdf, as they are enlarged...
Fernando, how did you tell the ipython notebook to save plots from
matplotlib as svg? I can save
svg image by "savefig('a.svg')", but the actual image in the notebook
is still png.

Thanks for all the hard work. I am now using the IPython notebook
pretty much regularly whenever I need to do some interactive work.
Today I just created a pdf (using my long way through the system print
dialog above) and sent it to my collaborator. I like that the ipynb
format is self-contained, I have them all checked in in my git
repository. Eventually, as ipython notebook becomes more widespread,
it should be enough to just send the .ipynb, right? Just like people
send around Mathematica .nb notebooks.


More information about the IPython-dev mailing list