How can I display line numbers in Jupyter notebook code cells by default?

6,443 views
Skip to first unread message

Keir Lockridge

unread,
Jul 16, 2016, 1:10:30 PM7/16/16
to sage-cloud
There is probably a global configuration file for the Jupyter notebook where this setting can be changed, but I'm not sure where it is.

In a code cell in the Jupyter notebook, line numbers may be turned on by typing ESC-L. This effect seems to be temporary (when I save the notebook and reload it, the line numbers disappear). I am wondering if there is some way to have the notebook display line numbers by default.

Thanks --

Keir

Harald Schilly

unread,
Jul 16, 2016, 1:26:01 PM7/16/16
to sage-cloud
Good question, I just did this and it worked:
http://stackoverflow.com/a/29916445/54236

use jupyter --config-dir to get the config dir, which should be
~/.jupyter in SMC and hence it's the file ~/.jupyter/custom/custom.js
where you have to put that startup code in.

-- harald
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/549d7a30-e6bf-4919-baca-bd12869f40f0%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Keir Lockridge

unread,
Jul 16, 2016, 1:35:15 PM7/16/16
to sage-cloud
Thanks! It worked for me as well.

--Keir
Reply all
Reply to author
Forward
0 new messages