Question

I upgraded to IPython 2.0 today.

Alot of changes seem good, but the button to insert a new cell, above/below seems to be gone. The option is still in the menu, and I believe the keyboard short cut works. But the button is gone.

I'm sure there is a way to turn it back on, but the documentation for the new version doesn't seem super complete. Possibly to turn it back on I need to adjust something in the config. Which is just python script. Maybe even tell it to insert a new element, and bind some javascript to it.

Was it helpful?

Solution 2

I ended up teaching myself some javascript to do this. You can make this change in the custom.js file. which can be found in ~/.ipython/profile_[profile name]/static/custom.

Replace it with the following:

$([IPython.events]).on('app_initialized.NotebookApp', function(){
             IPython.toolbar.add_buttons_group([
                 {
                      'label'   : 'Insert Cell Above',
                      'icon'    : 'fa-arrow-circle-o-up',
                      'callback': function () {
                                                    IPython.notebook.insert_cell_above('code');
                                                    IPython.notebook.select_prev();
                                                    IPython.notebook.focus_cell();
                      }
                 },
                 {
                      'label'   : 'Insert Cell Below',
                      'icon'    : 'fa-arrow-circle-o-down',
                      'callback': function () {
                                                    IPython.notebook.insert_cell_below('code');
                                                    IPython.notebook.select_next();
                                                    IPython.notebook.focus_cell();
                      }
                 }
                 ]);
             $('#insert_above_below').remove()
         });

If you have already modified it, then you can not replace the whole file, obviously, and should merge the appropriate parts.

The buttons will show up on the right. The single + button for below is also removed.

OTHER TIPS

These buttons relocated to "Insert" menu. However, it is always good idea to use shortcut commands:

Ctrl+m+- (split cell)

Ctrl+m+a (insert cell above)

Ctrl+m+b (insert cell below)

If you can master them and other basic commands, it will make your notebook workflow really slick. Full list of commands can be found here.

as now in 5.7.4 version shortcut to create cell above is esc + a

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top