Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you wrap lines in a Jupyter notebook?

I have a Jupyter notebook that I wish to convert to pdf for publication, however when I save the notebook as a pdf many of the cells go over the edge.

Is there are way to wrap lines (to the standard 80 characters) so that as I type the cells are never wider than a standard A4 page?

Alternatively, is there something I can do when I convert to pdf instead? Thanks.

like image 771
The Ref Avatar asked Apr 03 '17 11:04

The Ref


People also ask

How do you fold cells in Jupyter Notebook?

You CAN collapse an entire cell if you put a #comment at the top of the cell. Jupyter then provides a drop down arrow that will collapse the entire cell.

How do you beautify a Jupyter Notebook?

The extension also provides the shortcut CTRL+L for prettifying the current cell (the same thing that the icon does), and CTRL+SHIFT+L for prettifying the whole notebook (if something else is not blocking these shortcuts, of course; but you can configure them).

What does %% capture do in Jupyter?

What does %% capture do in Jupyter? Capturing Output With %%capture IPython has a cell magic, %%capture , which captures the stdout/stderr of a cell. With this magic you can discard these streams or store them in a variable. By default, %%capture discards these streams.


1 Answers

The problem has been solved in nbconvert 5.5 Just update and run

jupyter nbconvert --to pdf your-notebook.ipynb 
like image 180
moe Avatar answered Sep 28 '22 08:09

moe