Closed brlin-tw closed 8 years ago
[not a gitbook dev, just providing context]
The problem everybody runs into with $
is false positives — texts like It costs between $20 and $37
occur naturally and having them turn into math unless escaped would be annoying to users who don't need math, and incompatible to the original markdown (well, any syntax extension is technically incompatible but practically the question is whether many or few existing documents change meaning).
There are many solutions to this, eg. constraining $
with heuristics (e.g. closing $ not followed by digit and not under full moon), using \(
/ \[
(which interfere with escaping some markdown syntaxes) or \\(
/ \\[
instead, etc.
Using $$
for both inline and display was I believe an invention of kramdown, and is one of the prettier solutions. There is interesting critique on https://github.com/GitbookIO/kramed/issues/3 however that it prevents conveying when display math is part of a larger "semantic paragraph" (a concept mostly ignored by Markdown but easily expressed in LaTeX).
And {% math %}...{% endmath %}
is of course modeled on Gitbook templating constructs.
FWIW, I'm cataloging math in markdown syntaxes at https://github.com/cben/mathdown/wiki/math-in-markdown
FWIW, I'm cataloging math in markdown syntaxes at https://github.com/cben/mathdown/wiki/math-in-markdown
@cben that's very useful! Thanks for sharing this.
@cben Awesome answer :+1:
With GitBook, inline math are differentiated from block math using the first character, example:
Some inline math $$a = b$$
And a block of math:
$$
a = b
$$
I like that! 2 late questions:
It seems that's specific to GitBook plugins, kramed itself still uses same regex as kramdown, essentially /^ *$$...$$ *\n/
(sounds like should be alone on a line, but I tested kramdown and it actually must be alone in paragraph, as documented, there is probably extra logic...). Right?
Given that kramed is "your" fork, any plans to match gitbook rule, or will you keep the kramdown rule?
For the inline math, does there exist any way to reset it to $ .... $
in gitbook? I find $$ ... $$
annoy me very much when I want to copy markdown to latex or other place.
For the inline math, does there exist any way to reset it to
$ .... $
in gitbook? I find$$ ... $$
annoy me very much when I want to copy markdown to latex or other place.
Have you found the right way? @weihuayi
我尝试解决过这个问题,但一直没有成功。
---Original--- From: "YcZhang"notifications@github.com Date: Sat, Aug 10, 2019 02:39 AM To: "GitbookIO/plugin-mathjax"plugin-mathjax@noreply.github.com; Cc: "Huayi Wei"weihuayi@xtu.edu.cn;"Mention"mention@noreply.github.com; Subject: Re: [GitbookIO/plugin-mathjax] inline formula notation issue (#15)
For the inline math, does there exist any way to reset it to $ .... $ in gitbook? I find $$ ... $$ annoy me very much when I want to copy markdown to latex or other place.
Have you found the right way? @weihuayi
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
可以先把 markdown 转成 latex 试试
---Original--- From: "YcZhang"notifications@github.com Date: Sat, Aug 10, 2019 02:39 AM To: "GitbookIO/plugin-mathjax"plugin-mathjax@noreply.github.com; Cc: "Huayi Wei"weihuayi@xtu.edu.cn;"Mention"mention@noreply.github.com; Subject: Re: [GitbookIO/plugin-mathjax] inline formula notation issue (#15)
For the inline math, does there exist any way to reset it to $ .... $ in gitbook? I find $$ ... $$ annoy me very much when I want to copy markdown to latex or other place.
Have you found the right way? @weihuayi
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I wonder why the inline formula notation
$$...$$
is different with math mode - Inline equation in latex with text - TeX - LaTeX Stack Exchange$...$