Simple Method to Insert Math Equations in SteemIt MarkDown Editor 如何在 SteemIt MarkDown Editor 里添加数学公式?

in #cn7 years ago (edited)

SteemIt Markdown Editor does not support Latex easily. But one alternative (workaround) is to use the Google Tex Image URL. In particular I like Markdown and Latex because it is what-you-think is what-you-get.

我们都知道 STEEMIT支持HTML和MARKDOWN两种编辑模式,一旦启用了一种就无法使用另一种。我比较喜欢用Markdown, 因为这种是一种比较面向程序员 所想即所得的方式 (What you think is what you get).

I am a math fan, in my last post, I realized that inserting equations in SteemIt Markdown or HTML editor is a pain. The fact is that the Latex is not supported in the SteemIt Markdown editor.

同时,我还是一个伪数学爱好者,在上次的帖子里我就发现STEEMIT的MARKDOWN并不支持LATEX数学公式。实际上Markdown和LATEX也是两个独立的语言,在一般的环境下,需要通过第三方的包来启用在Markdown里Latex公式的支持,但是很明显,在SteemIt里不支持。

In Latex, we use $$ or $ to begin a math equation, but it doesn't work in SteemIt editor, obviously.

比如在Latex里,我们通过 $$ 或者 $ 来启用数学公式,这里明显不可以:

$$ \sum_{i=1}^{100} f(i^2) $$

We can use the Google API to show the image by inputing a math equation in the URL: The documentation can be found: https://developers.google.com/chart/infographics/docs/formulas

你看,还是没法显示。 其实我们完全可以通过图片的方式来插入数学公式,这里需要用 Google 的库支持,官方文档在:https://developers.google.com/chart/infographics/docs/formulas

We need to replace the following MATH-Equation with your intended math equation.
我们只需要替换以下 MATH-Equation 为你需要的数学公式即可:

![](https://chart.googleapis.com/chart?cht=tx&chl=MATH-Equation)

For example,
比如:

![](https://chart.googleapis.com/chart?cht=tx&chl=c=\sqrt{x^2%2By^2})

It shows:
显示效果为:

What the hell is the %2B in the URL? You will need to percentage-encode the URL parameters as some symbols represent special meanings in URL.

但,这里面的%2B 又是什么鬼?因为数学公式里含有的一些在URL中表达特殊的字符,像空格,加号,等号什么都得转义,

Here, I recommend an online tool (written by me) to encode the equation/text:
这里推荐一个我很久以前写的工具

https://helloacm.com/tools/url-encode-decode/

For example:
比如把

$$ \sum_{i=1}^{100} f(i^2) $$

URL-encoded becomes:
转义后就是:

%24%24%20%5Csum_%7Bi%3D1%7D%5E%7B100%7D%20f(i%5E2)%20%24%24

And the final Image URL to insert is:
然后整个图片地址就是:

https://chart.googleapis.com/chart?cht=tx&chl=%24%24%20%5Csum_%7Bi%3D1%7D%5E%7B100%7D%20f(i%5E2)%20%24%24

This is how it looks like:
效果为:

I do hope that the SteemIt team supports Latex in the Markdown one day!

SteemIt里没法原生态支持,这至少目前是个可行的方案,我真心希望SteemIt团队能把LATEX这个功能加上去,这样就能方便广大数学爱好者了,至少像我这种伪数学爱好者也能时不时晒晒公式装装B,是吧?

Originally published at https://steemit.com Thank you for reading my post, feel free to Follow, Upvote, Reply, ReSteem (repost) @justyy which motivates me to create more quality posts.

原创 https://Steemit.com 首发。感谢阅读,如有可能,欢迎Follow, Upvote, Reply, ReSteem (repost) @justyy 激励我创作更多更好的内容。

// 稍后同步到我的中文博客英文博客

近期热贴 Recent Popular Posts

Sort:  

技术上很棒,但是,据说 presentation 里每增加一个公式就吓跑一半听众?

另外,文末的“稍候”我觉得应该是“稍后”或者是“请稍候,本文将......”

多谢,已改正。
还有:岂不是加一段代码也一样吓跑听众?

Too much work for me. :)

Yes, I know... this is just a workaround. I hope it will be supported eventually.

Excellent nice post. I'll follow you and esteemed this blog. i want earnings as like you @yash0108

thank you.

Nice post and congrats on creating tool, I hope a lot of people will find it useful!

I hope so. :) thanks!

怎么会想用输入数学公式,你这是干什么呢

玩算法需要数学啊

嗯有理,我喜欢数学!!!

直接贴图会不会更快呢?

如果这样的话, 也需要在 比如 WORD里打公式,用QQ , ctrl + alt + A 然后截屏。

真的要這樣做是很痛苦的。

对的, 其实 我想了一下, 好像在 WORD里打公式,然后QQ ctrl + al + A 截屏 这样快一些。

技术大牛啊,期待LaTeX支持

哎呀。真不是大牛。
不过真心希望支持 LaTex.

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.030
BTC 58613.96
ETH 3153.58
USDT 1.00
SBD 2.43