From 1350d098362fa6e7abbf70b080d37fc8fe66a2f0 Mon Sep 17 00:00:00 2001 From: Hengyu Ai Date: Wed, 6 Mar 2024 16:30:34 +0800 Subject: [PATCH] mathjax support --- lecture_note/docs/javascripts/mathjax.js | 19 +++++++++++++++++++ lecture_note/docs/pintos/proj1.md | 6 +++--- lecture_note/mkdocs.yml | 5 +++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 lecture_note/docs/javascripts/mathjax.js diff --git a/lecture_note/docs/javascripts/mathjax.js b/lecture_note/docs/javascripts/mathjax.js new file mode 100644 index 0000000..3d0d925 --- /dev/null +++ b/lecture_note/docs/javascripts/mathjax.js @@ -0,0 +1,19 @@ +window.MathJax = { + tex: { + inlineMath: [["\\(", "\\)"]], + displayMath: [["\\[", "\\]"]], + processEscapes: true, + processEnvironments: true + }, + options: { + ignoreHtmlClass: ".*|", + processHtmlClass: "arithmatex" + } + }; + + document$.subscribe(() => { + MathJax.startup.output.clearCache() + MathJax.typesetClear() + MathJax.texReset() + MathJax.typesetPromise() + }) \ No newline at end of file diff --git a/lecture_note/docs/pintos/proj1.md b/lecture_note/docs/pintos/proj1.md index 44f7970..6995fbf 100644 --- a/lecture_note/docs/pintos/proj1.md +++ b/lecture_note/docs/pintos/proj1.md @@ -285,7 +285,7 @@ nice 只来自外界传入 / 从 parent thread 继承, 修改后更新优先级 ### 计算 priority $$ -priority = PRI_MAX - \dfrac{1}{4} recent_cpu - 2 \cdot nice +priority = PRI\_MAX - \dfrac{1}{4} recent\_cpu - 2 \cdot nice $$ 需要控制范围不超过 `PRI_MIN` 到 `PRI_MAX`. @@ -293,7 +293,7 @@ $$ ### 计算 recent_cpu $$ -recent_cpu = \dfrac{2 \cdot load_avg}{2 \cdot load_avg + 1} \cdor recent_cpu + nice +recent\_cpu = \dfrac{2 \cdot load\_avg}{2 \cdot load\_avg + 1} \cdot recent\_cpu + nice $$ ### 计算 load_avg @@ -301,7 +301,7 @@ $$ `load_avg` 是全局的, 不是某个线程的属性. $$ -load_avg = \dfrac{59}{60} load_avg + \dfrac{1}{60} ready_thread +load\_avg = \dfrac{59}{60} load\_avg + \dfrac{1}{60} ready\_thread $$ $ready_thread$ 代表正在运行/就绪的线程数量. \ No newline at end of file diff --git a/lecture_note/mkdocs.yml b/lecture_note/mkdocs.yml index 6ee4367..efb8fb2 100644 --- a/lecture_note/mkdocs.yml +++ b/lecture_note/mkdocs.yml @@ -43,6 +43,11 @@ markdown_extensions: - pymdownx.arithmatex: generic: true +extra_javascript: + - javascripts/mathjax.js + - https://polyfill.io/v3/polyfill.min.js?features=es6 + - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js + nav: - 首页: 'index.md' - 课程笔记: