I am fairly new to python and have no html experience. The question has been asked and either not answered at all or not answered in enough detail for me to set the default font within iPython (not change to browser). Specifically, what has to be put in the css file and which css file should be used? I am on a Windows system.
For reference, these are in answer to the linked SO questions below:
/usr/lib/python2.6/.../css/
custom.css
in profile subdirectory /static/custom/custom.css
Related questions:
Edit: Changing the monospace font in my browser worked, as suggested in an answer comment of #1. However the font is italic, which is not what is intended.
This question is related to
html
css
fonts
ipython-notebook
In JupyterNotebook cell, Simply you can use:
%%html
<style type='text/css'>
.CodeMirror{
font-size: 17px;
</style>
Using Jupyterthemes, one can easily change look of notebook.
pip install jupyterthemes
jt -fs 15
By default code font size is set to 11 . Trying above will change font size. It can be reset using.
jt -r
This will reset all jupyter theme changes to default.
There is a much easier way to do without adding the CSS files and all the other methods suggested. But you have to do it every time you start the Jupiter notebook.
Go to inspect in your browser and click on the element selection icon and then click on the box. And at the bottom of the page, you will be seeing the styling option for CSS where you can easily change the font-size.
The new location of the theme file is: ~/.jupyter/custom/custom.css
In your notebook (simple approach). Add new cell with following code
%%html
<style type='text/css'>
.CodeMirror{
font-size: 12px;
}
div.output_area pre {
font-size: 12px;
}
</style>
In addition to the suggestion by Konrad here, I'd like to suggest jupyter themes, which seems to have more options, such as line-height, font size, cell width etc.
Command line usage:
jt [-h] [-l] [-t THEME] [-f MONOFONT] [-fs MONOSIZE] [-nf NBFONT]
[-nfs NBFONTSIZE] [-tf TCFONT] [-tfs TCFONTSIZE] [-dfs DFFONTSIZE]
[-m MARGINS] [-cursw CURSORWIDTH] [-cursc CURSORCOLOR] [-vim]
[-cellw CELLWIDTH] [-lineh LINEHEIGHT] [-altp] [-P] [-T] [-N]
[-r] [-dfonts]
I would also suggest that you explore the options offered by the jupyter themer. For more modest interface changes you may be satisfied with running the syntax:
jupyter-themer [-c COLOR, --color COLOR]
[-l LAYOUT, --layout LAYOUT]
[-t TYPOGRAPHY, --typography TYPOGRAPHY]
where the options offered by themer would provide you with a less onerous way of making some changes in to the look of Jupyter Notebook. Naturally, you may still to prefer edit the .css
files if the changes you want to apply are elaborate.
Source: Stackoverflow.com