Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

inline formula notation issue #15

Closed
brlin-tw opened this issue Nov 1, 2015 · 8 comments
Closed

inline formula notation issue #15

brlin-tw opened this issue Nov 1, 2015 · 8 comments

Comments

@brlin-tw
Copy link

brlin-tw commented Nov 1, 2015

I wonder why the inline formula notation $$...$$ is different with math mode - Inline equation in latex with text - TeX - LaTeX Stack Exchange $...$

@cben
Copy link

cben commented Nov 2, 2015

[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 GitbookIO/kramed#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

@pkra
Copy link

pkra commented Nov 3, 2015

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.

@SamyPesse
Copy link
Member

@cben Awesome answer 👍

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
$$

@cben
Copy link

cben commented Jan 20, 2016

I like that! 2 late questions:

  1. If there are trailing spaces between the opening $$ and the newline it becomes inline. IMHO surprising, should be still block.

  2. 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?

@weihuayi
Copy link

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.

@yoczhang
Copy link

yoczhang commented Aug 9, 2019

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

@weihuayi
Copy link

weihuayi commented Aug 10, 2019 via email

@weihuayi
Copy link

weihuayi commented Aug 10, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants