mirror of
https://github.com/donnemartin/data-science-ipython-notebooks.git
synced 2024-03-22 13:30:56 +08:00
Added snippet to style an IPython Notebook based on a CSS file.
This commit is contained in:
parent
7a72a3baeb
commit
93aeefe0c3
|
@ -155,6 +155,29 @@
|
|||
"| object? | Object details, also use object?? |"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Apply css styling based on a css file:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from IPython.core.display import HTML\n",
|
||||
"\n",
|
||||
"def css_styling():\n",
|
||||
" styles = open(\"styles/custom.css\", \"r\").read()\n",
|
||||
" return HTML(styles)\n",
|
||||
"css_styling()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
|
|
60
commands/styles/custom.css
Normal file
60
commands/styles/custom.css
Normal file
|
@ -0,0 +1,60 @@
|
|||
<style>
|
||||
@font-face {
|
||||
font-family: "Computer Modern";
|
||||
src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');
|
||||
}
|
||||
div.cell{
|
||||
width:800px;
|
||||
margin-left:16% !important;
|
||||
margin-right:auto;
|
||||
}
|
||||
h1 {
|
||||
font-family: Helvetica, serif;
|
||||
}
|
||||
h4{
|
||||
margin-top:12px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
div.text_cell_render{
|
||||
font-family: Computer Modern, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
|
||||
line-height: 145%;
|
||||
font-size: 130%;
|
||||
width:800px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
.CodeMirror{
|
||||
font-family: "Source Code Pro", source-code-pro,Consolas, monospace;
|
||||
}
|
||||
.prompt{
|
||||
display: None;
|
||||
}
|
||||
.text_cell_render h5 {
|
||||
font-weight: 300;
|
||||
font-size: 22pt;
|
||||
color: #4057A1;
|
||||
font-style: italic;
|
||||
margin-bottom: .5em;
|
||||
margin-top: 0.5em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.warning{
|
||||
color: rgb( 240, 20, 20 )
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
MathJax.Hub.Config({
|
||||
TeX: {
|
||||
extensions: ["AMSmath.js"]
|
||||
},
|
||||
tex2jax: {
|
||||
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
|
||||
},
|
||||
displayAlign: 'center', // Change this to 'center' to center equations.
|
||||
"HTML-CSS": {
|
||||
styles: {'.MathJax_Display': {"margin": 4}}
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user