kaTex使用
小于 1 分钟
kaTex使用
- KaTeX排版系统核心库
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
<link rel="stylesheet" href="/libs/katex/v0.15.6/katex.min.css" >
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="/libs/katex/v0.15.6/katex.min.js" ></script>
- 用于自动渲染的KaTeX扩展库
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="/libs/katex/v0.15.6/contrib/auto-render.min.js" ></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
// customised options
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: true},
{left: '\\[', right: '\\]', display: false}
],
// • rendering keys, e.g.:
throwOnError : true
});
});
</script>
- 允许复制tex公式时复制其源代码的扩展库
<link href="/libs/katex/v0.15.6/contrib/copy-tex.css" rel="stylesheet" type="text/css">
<script src="/libs/katex/v0.15.6/contrib/copy-tex.min.js"></script>