惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
量子位
博客园 - 司徒正美
V
V2EX
I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
美团技术团队
N
Netflix TechBlog - Medium
L
LangChain Blog
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog

Ridic

一个关于映射度的问题 买原版书遇到的坑 区域不变性及相关应用 Klein瓶的高维推广 待解决的问题 一些待整理的资料 记录一些想看的书和课程 在服务器中部署Overleaf 高等代数习题课-记录 关于学习过程的“参数权重”设置 从今天开始写一些东西 不定积分练习 国内Docker镜像代理 《上海高考指南》数学部分阅读与分析 函数关于两点对称问题 数学笔记-第八周 数学笔记-第七周 二模前复习总结 6 数学笔记-第六周 将 word 中的 Mathtype 公式转为 Latex 原创一题 为什么高中数学题越来越难 有趣的开源项目整理 5 4 3 上海高考数学压轴题 2023年普通高中学业水平模拟测试 2
博客加入数学公式支持
Tom · 2023-04-02 · via Ridic

记录一下 PaperMod 主题加入 Katex 公式支持的方法,以便之后博文的公式书写。当然,大部分数学的内容还是会写在 Astroid 中。

创建 layouts/partials/math.html 文件,写入以下内容:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.css" integrity="sha384-bYdxxUwYipFNohQlHt0bjN/LCpueqWz13HufFEV1SUatKs1cm4L6fFgCi1jT643X" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.js" integrity="sha384-Qsn9KnoKISj6dI8g7p1HBlNpVx0I8p1SvlwOldgi3IorMle61nQy4zEahWYtljaz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"></script>
<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: '\\(', right: '\\)', display: false},
              {left: '\\[', right: '\\]', display: true}
          ],
          // • rendering keys, e.g.:
          throwOnError : false
        });
    });
</script>

然后创建 layouts/partials/extend_head.html 文件,写入以下内容:

{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}

当我们确认某一篇博客需要加入数学公式支持时,我们需要在markdown文件键入以下内容:

---
title: 
date: 
tags: 
math: true
---

数学公式测试:

$$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$

$$ q(x,t)= \begin{cases}(t-k+1)x^2,\quad \ \ & t\in\big(k-1,k-\dfrac{1}{2}\big],\\ (k-t)x^2, \quad \ \ & t\in\big(k-\dfrac{1}{2},k\big], \end{cases} $$

$$ \left|\begin{array}{cccc} 1 &6 & 9 \\ 7 &90 & f(x) \\ 9 & \psi(x) &g(x) \\ \end{array}\right| $$

$$ \begin{cases} \ u_{tt}(x,t)= b(t)\triangle u(x,t-4)&\\ \ \hspace{42pt}- q(x,t)f[u(x,t-3)]+te^{-t}\sin^2 x, & t \neq t_k; \\ \ u(x,t_k^+) - u(x,t_k^-) = c_k u(x,t_k), & k=1,2,3\ldots ;\\ \ u_{t}(x,t_k^+) - u_{t}(x,t_k^-) =c_k u_{t}(x,t_k), & k=1,2,3\ldots\ . \end{cases} $$