public
Last active — forked from /ipynb_style.py

  • Download Gist
ipynb_style.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
 
import IPython.core.display
import matplotlib as mpl
 
def clean():
# set mpl defaults for nice display
mpl.rcParams['font.size'] = 12
mpl.rcParams['figure.figsize'] = (18, 6)
mpl.rcParams['lines.linewidth'] = 1
 
return IPython.core.display.HTML("""
<style type="text/css">
div.input {
width: 105ex; /* about 80 chars + buffer */
}
 
div.text_cell {
width: 105ex /* instead of 100%, */
}
 
div.text_cell_render {
/*font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;*/
font-family: "Charis SIL", serif; /* Make non-code text serif. */
line-height: 145%; /* added for some line spacing of text. */
width: 105ex; /* instead of 'inherit' for shorter lines */
}
 
/* Set the size of the headers */
div.text_cell_render h1 {
font-size: 18pt;
}
 
div.text_cell_render h2 {
font-size: 14pt;
}
 
.CodeMirror {
font-family: Consolas, monospace;
}
 
.rendered_html ol {list-style:decimal; margin: 1em 2em;}
 
</style>
""")
 
 
def presentation():
# set mpl defaults for nice display
mpl.rcParams['font.size'] = 15
mpl.rcParams['figure.figsize'] = (12, 6)
mpl.rcParams['lines.linewidth'] = 3
 
return IPython.core.display.HTML("""
<style type="text/css">
div.input {
width: 1024px; /* about 80 chars + buffer */
}
 
div.text_cell {
width: 1024px /* instead of 100%, */
}
 
div.text_cell_render {
/*font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;*/
font-family: "Charis SIL", serif; /* Make non-code text serif. */
line-height: 145%; /* added for some line spacing of text. */
font-size: 28pt;
}
 
/* Set the size of the headers */
div.text_cell_render h1 {
font-size: 36pt;
}
 
div.text_cell_render h2 {
font-size: 32pt;
}
 
div.text_cell_render li {
line-height: 1.2em;
}
 
div.text_cell_render p {
font-size: 14pt;
line-height: 1em;
}
 
.CodeMirror {
font-size: 14pt;
font-family: Consolas, monospace;
}
 
.rendered_html ol {list-style:decimal; margin: 1em 2em;}
 
</style>
""")
 
def pres2():
# set mpl defaults for nice display
mpl.rcParams['font.size'] = 15
mpl.rcParams['figure.figsize'] = (12, 6)
mpl.rcParams['lines.linewidth'] = 3
 
return IPython.core.display.HTML("""
<style>.rendered_html {
font-size: 150%;
line-height: 1.3;
}</style>
 
<style>.rendered_html li {
line-height: 2;
}</style>
 
<style>.rendered_html h1{
margin: 0.5em 0;
line-height: 1.3;
}</style>
 
<style>.rendered_html h2{
margin: 0.15em 0;
line-height: 1.2;
}</style>
 
<style>.input_prompt {
font-size: 120%;
font-family: Consolas;
}</style>
 
<style>.CodeMirror-lines {
font-size: 120%;
font-family: Consolas;
}</style>
 
<style>.output_area {
font-size: 120%;
font-family: Consolas;
}</style>
""")

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.