在github页面上使用Jekyll在MathJax中渲染某些乳胶语法时出现问题 [英] Trouble rendering some latex syntax in MathJax with Jekyll on github pages

查看:147
本文介绍了在github页面上使用Jekyll在MathJax中渲染某些乳胶语法时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现在git页面中,使用Jekyll的MathJax无法呈现某些乳胶语法.

例如,在这篇帖子

此行: $ z = \ overbrace {\ underbrace {x} \ text {real} + \ underbrace {iy} \ text {imaginary}} ^ \ text {complex number} $

应该看起来像这样

的结果

其他一些乳胶语法也可以很好地工作,例如

我应该添加些什么来解决这个问题?我猜MathJax没有加载所需的库(例如上述情况下的\ usepackage {amsmath}).

页面代码位于此处.

以下代码显示了我对matjax的配置.

<script type="text/x-mathjax-config"> MathJax.Hub.Config({ TeX: { equationNumbers: { autoNumber: "all" } } }); </script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>

解决方案

请注意,在Jekyll的Markdown语法中,下划线用于表示斜体文本,因此Jekyll在\text{real} +\underbrace{iy}的下划线所在位置插入了<em>标记(注意在输出中缺少下划线,并且文本以斜体显示). MathJax无法处理包含HTML标记的数学,因此该数学方程式被跳过.

您需要确保Markdown不会干扰您的TeX表示法.这可以通过几种方式来完成.您可以使用\_而不是_来防止下划线被解释为斜体.另外,您可以在此处使用,在嵌入式数学和显示数学中使用<span>...</span>,在显示数学中使用<div>...</div>.

>

I found that some of latex syntaxes are not rendered with MathJax with Jekyll in my git page.

For example, in this post

this line: $z = \overbrace{\underbrace{x}\text{real} +\underbrace{iy}\text{imaginary}}^\text{complex number}$

should look like this

Some other latex syntax works well, like this

What should I add to solve this problem? I guess MathJax is not loading the required library (e.g. \usepackage{amsmath} in the above case).

The code of the page is here.

The following code shows the my configuration of matjax.

<script type="text/x-mathjax-config"> MathJax.Hub.Config({ TeX: { equationNumbers: { autoNumber: "all" } } }); </script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>

解决方案

Note that in Jekyll's Markdown syntax, underlines are used to indicate italic text, so Jekyll is inserting <em> tags around \text{real} +\underbrace{iy} where the underscores were (notice that the underscores are missing in the output and that the text is in italics). MathJax can't process math that contains HTML tags, so this math equation is skipped.

You need to make sure that Markdown doesn't interfere with your TeX notation. That can be done in several ways. You could use \_ instead of _ in order to prevent the underscores from being interpreted as italics. Alternatively, you could use <span>...</span> around inline math and <div>...</div> around display math, as suggested here.

这篇关于在github页面上使用Jekyll在MathJax中渲染某些乳胶语法时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆