简体   繁体   中英

Static images in IPython Notebook

I am using IPython notebook to create some tutorials. After finishing it, I need to convert them to latex/PDF and html/blogger. But I am facing two problems.

1 - Adding static images.

I will have to add some images into tutorial. First I tried with IPython.display.Image class. But those commands are shown in latex also, which i don't prefer. Then I tried in markdown region as in Inserting image into IPython notebook markdown . But image is not shown both in ipynb and latex.

So what is the best method to add an image in IPN which can be converted to latex and html?

2 - Converting to latex and html

I tried methods specified in IPython notebook to html for blog post? , but it doesn't work. It throws an error :

[NbconvertApp] Bad config encountered during initialization:
[NbconvertApp] Unrecognized flag: '-f'

Then I tried without -f flag, then I got following error:

[NbconvertApp] Config file for profile 'latex' not found, giving up 

The one what worked for me so far is the one given below, that also for pdf only:

python nbconvert2.py latex_sphinx_howto Test1.ipynb

So how can I convert my notebooks html and latex successfully?

The blog post is refering to nbconvert v1 and you try the command line with -f on the version2.

What you ask is difficult with nbconvert1, and this is one of the reason that pushed us to write te new version. The new version is still highly in development. You can have a look at PR 137 (iirc) of ipython/nbconvert if you are interested in following dev. Or wait a little for nbconvert to mature and the doc to be written.

I would be happy to give you details on how to do what you ask on current dev (we can discuss that on bug tracker), but I would prefere to avoid publishing info on SO with vocabulary, class names, and where to put files on the file system that will change in a few weeks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM