2

你终于可以在 Github 上使用 Markdown 显示数学表达式了

 1 year ago
source link: https://www.techug.com/post/you-can-finally-use-markdown-to-display-mathematical-expressions-on-github/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

你终于可以在 Github 上使用 Markdown 显示数学表达式了

2



img165309481096244002.png

数学表达式是工程师、科学家、数据科学家和数学家之间信息共享的关键。8 年多以来,要求 GitHub 提供支持显示数学表达式这一功能的呼声极高。

5 月 19 日,GitHub 官方宣布,自当日起,开发者可以在 GitHub 上的 Markdown 中本地使用 和$ 分隔符以插入 TeX 和 LaTeX 样式语法中的数学表达式。据了解,GitHub 的数学渲染能力使用了 MathJax;一个开源的、基于 JavaScript 的显示引擎。

以下是官方提供的 Markdown 实例。

实例一:

When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are 
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$

将被呈现为:

When a=0, there are two solutions to (ax2+bx+c=0) and they are

x=2a−b±b2−4ac​​

实例二:

要将美元符号显示为与数学表达式在同一行中的字符,你需要避开非界定符 $ 以确保该行正确呈现。

  • 在数学表达式中,在显式 $ 之前添加 \ 符号。

This expression uses `\$` to display a dollar sign: $\sqrt{\$4}$ 

将被呈现为:

  • 在数学表达式之外,但在同一行,在显式 $ 周围使用 span 标签。

To split <span>$</span>100 in half, we calculate $100/2$

将被呈现为:

有关在 GitHub 上的 Markdown 中包含数学表达式的更多信息,可参阅文档:https://docs.github.com/cn/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions

本文文字及图片出自 InfoQ


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK