Last active
August 29, 2015 14:06
-
-
Save damianavila/ba6a308bd0e605db0e6e to your computer and use it in GitHub Desktop.
Temporary fix for mathjax problem with slides in the IPython 2.x series.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- macro mathjax() -%} | |
<!-- Load mathjax --> | |
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script> | |
<!-- MathJax configuration --> | |
<script type="text/x-mathjax-config"> | |
MathJax.Hub.Config({ | |
tex2jax: { | |
inlineMath: [ ['$','$'], ["\\(","\\)"] ], | |
displayMath: [ ['$$','$$'], ["\\[","\\]"] ], | |
processEscapes: true, | |
processEnvironments: true | |
}, | |
// Center justify equations in code and markdown cells. Elsewhere | |
// we use CSS to left justify single line equations in code cells. | |
displayAlign: 'center', | |
"HTML-CSS": { | |
styles: {'.MathJax_Display': {"margin": 0}}, | |
linebreaks: { automatic: true } | |
} | |
}); | |
</script> | |
<!-- End of mathjax configuration --> | |
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- extends 'basic.tpl' -%} | |
{% from 'fixed_mathjax.tpl' import mathjax %} | |
{%- block any_cell scoped -%} | |
{%- if cell.metadata.slide_type in ['slide'] -%} | |
<section> | |
<section> | |
{{ super() }} | |
{%- elif cell.metadata.slide_type in ['subslide'] -%} | |
<section> | |
{{ super() }} | |
{%- elif cell.metadata.slide_type in ['-'] -%} | |
{{ super() }} | |
{%- elif cell.metadata.slide_type in ['skip'] -%} | |
<div style=display:none> | |
{{ super() }} | |
</div> | |
{%- elif cell.metadata.slide_type in ['notes'] -%} | |
<aside class="notes"> | |
{{ super() }} | |
</aside> | |
{%- elif cell.metadata.slide_type in ['fragment'] -%} | |
<div class="fragment"> | |
{{ super() }} | |
</div> | |
{%- endif -%} | |
{%- if cell.metadata.slide_helper in ['subslide_end'] -%} | |
</section> | |
{%- elif cell.metadata.slide_helper in ['slide_end'] -%} | |
</section> | |
</section> | |
{%- endif -%} | |
{%- endblock any_cell -%} | |
{% block header %} | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="chrome=1" /> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> | |
<title>{{resources['metadata']['name']}} slides</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<!-- General and theme style sheets --> | |
<link rel="stylesheet" href="{{resources.reveal.url_prefix}}/css/reveal.css"> | |
<link rel="stylesheet" href="{{resources.reveal.url_prefix}}/css/theme/simple.css" id="theme"> | |
<!-- For syntax highlighting --> | |
<link rel="stylesheet" href="{{resources.reveal.url_prefix}}/lib/css/zenburn.css"> | |
<!-- If the query includes 'print-pdf', include the PDF print sheet --> | |
<script> | |
if( window.location.search.match( /print-pdf/gi ) ) { | |
var link = document.createElement( 'link' ); | |
link.rel = 'stylesheet'; | |
link.type = 'text/css'; | |
link.href = '{{resources.reveal.url_prefix}}/css/print/pdf.css'; | |
document.getElementsByTagName( 'head' )[0].appendChild( link ); | |
} | |
</script> | |
<!--[if lt IE 9]> | |
<script src="{{resources.reveal.url_prefix}}/lib/js/html5shiv.js"></script> | |
<![endif]--> | |
<!-- Get Font-awesome from cdn --> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"> | |
{% for css in resources.inlining.css -%} | |
<style type="text/css"> | |
{{ css }} | |
</style> | |
{% endfor %} | |
<style type="text/css"> | |
/* Overrides of notebook CSS for static HTML export */ | |
html { | |
overflow-y: auto; | |
} | |
.reveal { | |
font-size: 160%; | |
} | |
.reveal pre { | |
width: inherit; | |
padding: 0.4em; | |
margin: 0px; | |
font-family: monospace, sans-serif; | |
font-size: 80%; | |
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0); | |
} | |
.reveal section img { | |
border: 0px solid black; | |
box-shadow: 0 0 10px rgba(0, 0, 0, 0); | |
} | |
.reveal i { | |
font-style: normal; | |
font-family: FontAwesome; | |
font-size: 2em; | |
} | |
.reveal .slides { | |
text-align: left; | |
} | |
.reveal.fade { | |
opacity: 1; | |
} | |
.reveal .progress { | |
position: static; | |
} | |
div.input_area { | |
padding: 0.06em; | |
} | |
div.code_cell { | |
background-color: transparent; | |
} | |
div.prompt { | |
width: 11ex; | |
padding: 0.4em; | |
margin: 0px; | |
font-family: monospace, sans-serif; | |
font-size: 80%; | |
text-align: right; | |
} | |
div.output_area pre { | |
font-family: monospace, sans-serif; | |
font-size: 80%; | |
} | |
div.output_prompt { | |
/* 5px right shift to account for margin in parent container */ | |
margin: 5px 5px 0 0; | |
} | |
.rendered_html p { | |
text-align: inherit; | |
} | |
</style> | |
<!-- Custom stylesheet, it must be in the same directory as the html file --> | |
<link rel="stylesheet" href="custom.css"> | |
</head> | |
{% endblock header%} | |
{% block body %} | |
<body> | |
<div class="reveal"> | |
<div class="slides"> | |
{{ super() }} | |
</div> | |
</div> | |
<script src="{{resources.reveal.url_prefix}}/lib/js/head.min.js"></script> | |
<script src="{{resources.reveal.url_prefix}}/js/reveal.js"></script> | |
<script> | |
// Full list of configuration options available here: https://github.com/hakimel/reveal.js#configuration | |
Reveal.initialize({ | |
controls: true, | |
progress: true, | |
history: true, | |
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme | |
transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/concave/zoom/linear/none | |
// Optional libraries used to extend on reveal.js | |
dependencies: [ | |
{ src: "{{resources.reveal.url_prefix}}/lib/js/classList.js", condition: function() { return !document.body.classList; } }, | |
{ src: "{{resources.reveal.url_prefix}}/plugin/highlight/highlight.js", async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, | |
{ src: "{{resources.reveal.url_prefix}}/plugin/notes/notes.js", async: true, condition: function() { return !!document.body.classList; } } | |
] | |
}); | |
</script> | |
<!-- Loading mathjax macro --> | |
{{ mathjax() }} | |
<script> | |
Reveal.addEventListener( 'slidechanged', function( event ) { | |
window.scrollTo(0,0); | |
MathJax.Hub.Rerender(event.currentSlide); | |
}); | |
</script> | |
</body> | |
{% endblock body %} | |
{% block footer %} | |
</html> | |
{% endblock footer %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use these templates, type e.g.