Skip to content

Commit

Permalink
latex
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed Aug 22, 2024
1 parent 2840697 commit 7c9c033
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ plugins:
- jekyll-include-cache
- jekyll-jupyter-notebook

# TODO(template):
katex: true
katex_macros:
# put macros here..

# Default layouts for each collection type
defaults:
- scope:
Expand Down Expand Up @@ -190,6 +195,7 @@ compress_html:
profile: false

kramdown:
gfm_emojis: true
math_engine: katex
math_engine_opts:
syntax_highlighter: rouge
Expand Down
27 changes: 27 additions & 0 deletions _includes/katex.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- TODO: Move to local files... -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"></script>

<!-- Investigate adding copy-tex -->
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
// customised options
// • auto-render specific keys, e.g.:
delimiters: [
{left: '$$$', right: '$$$', display: true},
{left: '$$', right: '$$', display: false},
{left: "\\begin{equation}", right: "\\end{equation}", display: true},
{left: "\\begin{align}", right: "\\end{align}", display: true},
{left: "\\begin{alignat}", right: "\\end{alignat}", display: true},
{left: "\\begin{gather}", right: "\\end{gather}", display: true},
{left: "\\begin{CD}", right: "\\end{CD}", display: true},
],
// • rendering keys, e.g.:
throwOnError : false,
// Marcos:https://katex.org/docs/supported#gdef
marcos: {}
});
});
</script>

0 comments on commit 7c9c033

Please sign in to comment.