gpt4 book ai didi

markdown - 如何在 Jekyll 中使用 mathjax?

转载 作者:行者123 更新时间:2023-12-05 09:22:40 25 4
gpt4 key购买 nike

我尝试使用 Jekyllkramdown 来构建我自己的网站。另外,我想包括 mathjax 来呈现数学公式。但是,kramdown Markdown 似乎与 mathjax 有冲突。如果我没有引用公式,我将无法正确呈现公式。

我将这些代码添加到我的模板文件中:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
});

MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});

</script>

<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

现在它可以工作了,但我必须在公式周围添加引号,然后 kramdown 将它们翻译成这种风格。你可以在我的webpage上看到.除了这种方法还有更好的解决方案吗?我发现在我的 $\LaTeX$ 代码周围添加额外的引号很烦人。我发现这个 solution是我想要的。它的语法与我在 TeX 中键入的语法相同,但我不理解代码..

最佳答案

Looking at the kramdown parser (或简称为 the test cases ),kramdown 似乎默认使用 $$...$$ 进行内联和显示数学运算,kramdown 解析器会区分它们。它实际上将此类数学很好地转换为 HTML 中 MathJax 的自定义脚本标记。

似乎人们已经成功地使用了其他 MathJax 配置,例如 http://www.idryman.org/blog/2012/03/10/writing-math-equations-on-octopress/ .

关于markdown - 如何在 Jekyll 中使用 mathjax?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25146431/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com