Skip to content

Instantly share code, notes, and snippets.

@uranusjr
Created September 16, 2014 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uranusjr/2882e927d055d02891f7 to your computer and use it in GitHub Desktop.
Save uranusjr/2882e927d055d02891f7 to your computer and use it in GitHub Desktop.
KaTeX test
<html>
<head>
<meta charset="utf-8">
<title>KaTeX test</title>
<link rel="stylesheet" type="text/css" href="katex.min.css">
<style type="text/css">
iframe {
width: 100%;
height: 75px;
border: none;
margin-bottom: 20px;
}
body {
font-size: 15px;
}
.displaystyle {
text-align: center;
}
</style>
<script src="katex.min.js" type="text/javascript"></script>
</head>
<body>
<iframe src="http://khan.github.io/KaTeX/"></iframe>
<div class="math displaystyle" data-expr="\displaystyle \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)"></div>
<script type="text/javascript">
Array.prototype.forEach.call(document.getElementsByClassName('math'), function (el) {
katex.render(el.getAttribute('data-expr'), el);
});
document.getElementsByTagName('iframe')[0].onload = function () {
this.contentWindow.scrollTo(0, 1070);
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment