RSS notebook - 1/1 Blog automation (4) documentation (8) example (2) latex (2) notebook (4) sphinx (10)


notebook - 1/1

Why do I see invered question in a notebook converted into PDF?

2015-08-30

The function process_notebooks still uses the executable pdflatex and not xetex which can handle inline unicode characters. That’s why they are replaced by ¿ by function post_process_latex.

post

Convert a notebook into slides

2015-05-16

I thought it would be easy to convert a notebook into slides. I would just have to execute nbconvert. I went through two issues. The first one came from reveal.js. My first tries did not work. I decided to take the version included in the module sphinxjp.themes.revealjs and I also updated the output of nbconvert to remove external links as much as possible.

The second issue was that all my notebooks did not include any metadata indicated to indicate whether or not a new slide or subslide should start. So I create a simple function which does that on a notebook add_tag_slide. It does not overwrite existing metadata but start new slides for every section and new subslide if the current one becomes too long:

from pyquickhelper.ipythonhelper import read_nb
nb = read_nb("your notebook.ipynb")
nb.add_tag_slide()
nb.to_json("the modified notebook.ipynb")

It is too simple to be perfect, it is difficult to guess the size of the rendering of some objects (images, javascript...). You can check the results for this notebook: example pyquickhelper. That what the function nb2slides is doing first and then converts it into slides:

from pyquickhelper import nb2slides
nb2slides(("your notebook.ipynb", "convert.slides.html")

post

Add a custom menu to the notebook

2015-05-14

The function add_notebook_menu add HTML and Javascript to the notebook to create links to all sections in the notebook:

from pyquickhelper.ipythonhelper import add_notebook_menu
add_notebook_menu(menu_id="main_menu")

You can see what it looks like in notebook Example of a notebook with a fixed index. The trick consists in running:

from pyquickhelper.ipythonhelper import add_notebook_menu
add_notebook_menu(format="rst")

The menu can be then copy pasted into a text cell. It won’t be refreshed anymore but it will be converted as part of the notebook into RST, HTML or slides format.

post

Visualize differences between two files in a notebook

2015-04-23

It is now possible to visualize the differences between two files directly from a notebook:

../_images/diffview1.png

See function create_visual_diff_through_html_files.

post


RSS notebook - 1/1 2015-04 (8) 2015-05 (4) 2015-08 (2) 2015-10 (1) 2015-12 (3) 2016-01 (1) 2016-02 (3) 2016-04 (1) 2016-06 (1)